From f0fba2ad1b6b53d5360125c41953b7afcd6deff0 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Wed, 17 Mar 2010 20:15:21 +0000 Subject: ASoC: multi-component - ASoC Multi-Component Support This patch extends the ASoC API to allow sound cards to have more than one CODEC and more than one platform DMA controller. This is achieved by dividing some current ASoC structures that contain both driver data and device data into structures that only either contain device data or driver data. i.e. struct snd_soc_codec ---> struct snd_soc_codec (device data) +-> struct snd_soc_codec_driver (driver data) struct snd_soc_platform ---> struct snd_soc_platform (device data) +-> struct snd_soc_platform_driver (driver data) struct snd_soc_dai ---> struct snd_soc_dai (device data) +-> struct snd_soc_dai_driver (driver data) struct snd_soc_device ---> deleted This now allows ASoC to be more tightly aligned with the Linux driver model and also means that every ASoC codec, platform and (platform) DAI is a kernel device. ASoC component private data is now stored as device private data. The ASoC sound card struct snd_soc_card has also been updated to store lists of it's components rather than a pointer to a codec and platform. The PCM runtime struct soc_pcm_runtime now has pointers to all its components. This patch adds DAPM support for ASoC multi-component and removes struct snd_soc_socdev from DAPM core. All DAPM calls are now made on a card, codec or runtime PCM level basis rather than using snd_soc_socdev. Other notable multi-component changes:- * Stream operations now de-reference less structures. * close_delayed work() now runs on a DAI basis rather than looping all DAIs in a card. * PM suspend()/resume() operations can now handle N CODECs and Platforms per sound card. * Added soc_bind_dai_link() to bind the component devices to the sound card. * Added soc_dai_link_probe() and soc_dai_link_remove() to probe and remove DAI link components. * sysfs entries can now be registered per component per card. * snd_soc_new_pcms() functionailty rolled into dai_link_probe(). * snd_soc_register_codec() now does all the codec list and mutex init. This patch changes the probe() and remove() of the CODEC drivers as follows:- o Make CODEC driver a platform driver o Moved all struct snd_soc_codec list, mutex, etc initialiasation to core. o Removed all static codec pointers (drivers now support > 1 codec dev) o snd_soc_register_pcms() now done by core. o snd_soc_register_dai() folded into snd_soc_register_codec(). CS4270 portions: Acked-by: Timur Tabi Some TLV320aic23 and Cirrus platform fixes. Signed-off-by: Ryan Mallon TI CODEC and OMAP fixes Signed-off-by: Peter Ujfalusi Signed-off-by: Janusz Krzysztofik Signed-off-by: Jarkko Nikula Samsung platform and misc fixes :- Signed-off-by: Chanwoo Choi Signed-off-by: Joonyoung Shim Signed-off-by: Kyungmin Park Reviewed-by: Jassi Brar Signed-off-by: Seungwhan Youn MPC8610 and PPC fixes. Signed-off-by: Timur Tabi i.MX fixes and some core fixes. Signed-off-by: Sascha Hauer J4740 platform fixes:- Signed-off-by: Lars-Peter Clausen CC: Tony Lindgren CC: Nicolas Ferre CC: Kevin Hilman CC: Sascha Hauer CC: Atsushi Nemoto CC: Kuninori Morimoto CC: Daniel Gloeckner CC: Manuel Lauss CC: Mike Frysinger CC: Arnaud Patard CC: Wan ZongShun Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- sound/soc/omap/omap2evm.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'sound/soc/omap/omap2evm.c') diff --git a/sound/soc/omap/omap2evm.c b/sound/soc/omap/omap2evm.c index c7adea38274c..38cd1894623e 100644 --- a/sound/soc/omap/omap2evm.c +++ b/sound/soc/omap/omap2evm.c @@ -35,15 +35,13 @@ #include "omap-mcbsp.h" #include "omap-pcm.h" -#include "../codecs/twl4030.h" static int omap2evm_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params, - struct snd_soc_dai *dai) + struct snd_pcm_hw_params *params) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; - struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; int ret; /* Set codec DAI configuration */ @@ -85,25 +83,20 @@ static struct snd_soc_ops omap2evm_ops = { static struct snd_soc_dai_link omap2evm_dai = { .name = "TWL4030", .stream_name = "TWL4030", - .cpu_dai = &omap_mcbsp_dai[0], - .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI], + .cpu_dai_name = "omap-mcbsp-dai.1", + .codec_dai_name = "twl4030-hifi", + .platform_name = "omap-pcm-audio", + .codec_name = "twl4030-codec", .ops = &omap2evm_ops, }; /* Audio machine driver */ static struct snd_soc_card snd_soc_omap2evm = { .name = "omap2evm", - .platform = &omap_soc_platform, .dai_link = &omap2evm_dai, .num_links = 1, }; -/* Audio subsystem */ -static struct snd_soc_device omap2evm_snd_devdata = { - .card = &snd_soc_omap2evm, - .codec_dev = &soc_codec_dev_twl4030, -}; - static struct platform_device *omap2evm_snd_device; static int __init omap2evm_soc_init(void) @@ -122,9 +115,7 @@ static int __init omap2evm_soc_init(void) return -ENOMEM; } - platform_set_drvdata(omap2evm_snd_device, &omap2evm_snd_devdata); - omap2evm_snd_devdata.dev = &omap2evm_snd_device->dev; - *(unsigned int *)omap2evm_dai.cpu_dai->private_data = 1; /* McBSP2 */ + platform_set_drvdata(omap2evm_snd_device, &snd_soc_omap2evm); ret = platform_device_add(omap2evm_snd_device); if (ret) -- cgit v1.2.3-58-ga151 From ec588ae6c21ae20a22ce13a287728a220935b8ee Mon Sep 17 00:00:00 2001 From: Jarkko Nikula Date: Wed, 6 Oct 2010 16:47:26 +0300 Subject: ASoC: omap: Remove needless prints from machine drivers It is currently completely normal to execute these machine drivers code on different boards if the kernel includes support for multiple boards so no error message should be printed if the machine_is_xxx does not match with the machine driver. Therefore remove these pr_err and pr_debug prints in those cases. Signed-off-by: Jarkko Nikula Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- sound/soc/omap/am3517evm.c | 4 +--- sound/soc/omap/igep0020.c | 4 +--- sound/soc/omap/omap2evm.c | 4 +--- sound/soc/omap/omap3beagle.c | 4 +--- sound/soc/omap/omap3evm.c | 4 +--- sound/soc/omap/sdp3430.c | 4 +--- sound/soc/omap/sdp4430.c | 4 +--- sound/soc/omap/zoom2.c | 4 +--- 8 files changed, 8 insertions(+), 24 deletions(-) (limited to 'sound/soc/omap/omap2evm.c') diff --git a/sound/soc/omap/am3517evm.c b/sound/soc/omap/am3517evm.c index 68bd902ccd4e..979dd508305f 100644 --- a/sound/soc/omap/am3517evm.c +++ b/sound/soc/omap/am3517evm.c @@ -157,10 +157,8 @@ static int __init am3517evm_soc_init(void) { int ret; - if (!machine_is_omap3517evm()) { - pr_err("Not OMAP3517 / AM3517 EVM!\n"); + if (!machine_is_omap3517evm()) return -ENODEV; - } pr_info("OMAP3517 / AM3517 EVM SoC init\n"); am3517evm_snd_device = platform_device_alloc("soc-audio", -1); diff --git a/sound/soc/omap/igep0020.c b/sound/soc/omap/igep0020.c index d296cfcc672e..fd3a40f309c8 100644 --- a/sound/soc/omap/igep0020.c +++ b/sound/soc/omap/igep0020.c @@ -101,10 +101,8 @@ static int __init igep2_soc_init(void) { int ret; - if (!machine_is_igep0020()) { - pr_debug("Not IGEP v2!\n"); + if (!machine_is_igep0020()) return -ENODEV; - } printk(KERN_INFO "IGEP v2 SoC init\n"); igep2_snd_device = platform_device_alloc("soc-audio", -1); diff --git a/sound/soc/omap/omap2evm.c b/sound/soc/omap/omap2evm.c index 38cd1894623e..cf3fc8a675b5 100644 --- a/sound/soc/omap/omap2evm.c +++ b/sound/soc/omap/omap2evm.c @@ -103,10 +103,8 @@ static int __init omap2evm_soc_init(void) { int ret; - if (!machine_is_omap2evm()) { - pr_debug("Not omap2evm!\n"); + if (!machine_is_omap2evm()) return -ENODEV; - } printk(KERN_INFO "omap2evm SoC init\n"); omap2evm_snd_device = platform_device_alloc("soc-audio", -1); diff --git a/sound/soc/omap/omap3beagle.c b/sound/soc/omap/omap3beagle.c index 7c11e1afe9e6..e56832b0c444 100644 --- a/sound/soc/omap/omap3beagle.c +++ b/sound/soc/omap/omap3beagle.c @@ -112,10 +112,8 @@ static int __init omap3beagle_soc_init(void) { int ret; - if (!(machine_is_omap3_beagle() || machine_is_devkit8000())) { - pr_debug("Not OMAP3 Beagle or Devkit8000!\n"); + if (!(machine_is_omap3_beagle() || machine_is_devkit8000())) return -ENODEV; - } pr_info("OMAP3 Beagle/Devkit8000 SoC init\n"); omap3beagle_snd_device = platform_device_alloc("soc-audio", -1); diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c index 1ac5babef00d..810f1e36da21 100644 --- a/sound/soc/omap/omap3evm.c +++ b/sound/soc/omap/omap3evm.c @@ -99,10 +99,8 @@ static int __init omap3evm_soc_init(void) { int ret; - if (!machine_is_omap3evm()) { - pr_err("Not OMAP3 EVM!\n"); + if (!machine_is_omap3evm()) return -ENODEV; - } pr_info("OMAP3 EVM SoC init\n"); omap3evm_snd_device = platform_device_alloc("soc-audio", -1); diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c index 76ce77b91844..07fbcf7d2411 100644 --- a/sound/soc/omap/sdp3430.c +++ b/sound/soc/omap/sdp3430.c @@ -296,10 +296,8 @@ static int __init sdp3430_soc_init(void) int ret; u8 pin_mux; - if (!machine_is_omap_3430sdp()) { - pr_debug("Not SDP3430!\n"); + if (!machine_is_omap_3430sdp()) return -ENODEV; - } printk(KERN_INFO "SDP3430 SoC init\n"); sdp3430_snd_device = platform_device_alloc("soc-audio", -1); diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c index 62f6a622d791..4b4463db6ba0 100644 --- a/sound/soc/omap/sdp4430.c +++ b/sound/soc/omap/sdp4430.c @@ -186,10 +186,8 @@ static int __init sdp4430_soc_init(void) { int ret; - if (!machine_is_omap_4430sdp()) { - pr_debug("Not SDP4430!\n"); + if (!machine_is_omap_4430sdp()) return -ENODEV; - } printk(KERN_INFO "SDP4430 SoC init\n"); sdp4430_snd_device = platform_device_alloc("soc-audio", -1); diff --git a/sound/soc/omap/zoom2.c b/sound/soc/omap/zoom2.c index 338dc9552bd6..718031eeac34 100644 --- a/sound/soc/omap/zoom2.c +++ b/sound/soc/omap/zoom2.c @@ -245,10 +245,8 @@ static int __init zoom2_soc_init(void) { int ret; - if (!machine_is_omap_zoom2()) { - pr_debug("Not Zoom2!\n"); + if (!machine_is_omap_zoom2()) return -ENODEV; - } printk(KERN_INFO "Zoom2 SoC init\n"); zoom2_snd_device = platform_device_alloc("soc-audio", -1); -- cgit v1.2.3-58-ga151