diff mbox

[2/4] ARM: OMAP: twl-common: Add helper function to register the omap-twl4030 audio driver

Message ID 1344419650-5389-3-git-send-email-peter.ujfalusi@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Ujfalusi Aug. 8, 2012, 9:54 a.m. UTC
Since several OMAP3 based boards will be using the unified simple audio
driver it is better to not have duplicated code in the board files for this
purpose.
Board files can call omap_twl4030_audio_init(); to set up the needed device
for the audio support.

For example:
omap_twl4030_audio_init("omap3beagle", 26000000);

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 arch/arm/mach-omap2/twl-common.c |   28 ++++++++++++++++++++++++++++
 arch/arm/mach-omap2/twl-common.h |    2 ++
 2 files changed, 30 insertions(+), 0 deletions(-)

Comments

Tony Lindgren Aug. 10, 2012, 6:29 a.m. UTC | #1
* Peter Ujfalusi <peter.ujfalusi@ti.com> [120808 02:54]:
> Since several OMAP3 based boards will be using the unified simple audio
> driver it is better to not have duplicated code in the board files for this
> purpose.
> Board files can call omap_twl4030_audio_init(); to set up the needed device
> for the audio support.
> 
> For example:
> omap_twl4030_audio_init("omap3beagle", 26000000);

Acked-by: Tony Lindgren <tony@atomide.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index d52be85..639ea02 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -522,3 +522,31 @@  void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
 		pmic_data->v2v1 = &omap4_v2v1_idata;
 }
 #endif /* CONFIG_ARCH_OMAP4 */
+
+#if defined(CONFIG_SND_OMAP_SOC_OMAP_TWL4030) || \
+	defined(CONFIG_SND_OMAP_SOC_OMAP_TWL4030_MODULE)
+#include <linux/platform_data/omap-twl4030.h>
+
+static struct omap_tw4030_pdata omap_twl4030_audio_data;
+
+static struct platform_device audio_device = {
+	.name		= "omap-twl4030",
+	.id		= -1,
+	.dev = {
+		.platform_data = &omap_twl4030_audio_data,
+	},
+};
+
+void __init omap_twl4030_audio_init(char *card_name, int codec_sysclk)
+{
+	omap_twl4030_audio_data.card_name = card_name;
+	omap_twl4030_audio_data.codec_sysclk = codec_sysclk;
+	platform_device_register(&audio_device);
+}
+
+#else /* SOC_OMAP_TWL4030 */
+void __init omap_twl4030_audio_init(char *card_name, int codec_sysclk)
+{
+	return;
+}
+#endif /* SOC_OMAP_TWL4030 */
diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-common.h
index de062c7..b774c19 100644
--- a/arch/arm/mach-omap2/twl-common.h
+++ b/arch/arm/mach-omap2/twl-common.h
@@ -60,4 +60,6 @@  void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
 void omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
 			   u32 pdata_flags, u32 regulators_flags);
 
+void omap_twl4030_audio_init(char *card_name, int codec_sysclk);
+
 #endif /* __OMAP_PMIC_COMMON__ */