[alsa-devel] [PATCH 1/3] ASoC: multi-component - Fix S3C compile error
This patch fix compile error on using S3C I2S.
Signed-off-by: Seungwhan Youn sw.youn@samsung.com --- sound/soc/s3c24xx/s3c64xx-i2s.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/s3c24xx/s3c64xx-i2s.c b/sound/soc/s3c24xx/s3c64xx-i2s.c index ad92e10..5017e31 100644 --- a/sound/soc/s3c24xx/s3c64xx-i2s.c +++ b/sound/soc/s3c24xx/s3c64xx-i2s.c @@ -56,11 +56,11 @@ static int s3c64xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai,
switch (clk_id) { case S3C64XX_CLKSRC_PCLK: - iismod &= ~S3C64XX_IISMOD_IMS_SYSMUX; + iismod &= ~S3C2412_IISMOD_IMS_SYSMUX; break;
case S3C64XX_CLKSRC_MUX: - iismod |= S3C64XX_IISMOD_IMS_SYSMUX; + iismod |= S3C2412_IISMOD_IMS_SYSMUX; break;
case S3C64XX_CLKSRC_CDCLK: @@ -90,7 +90,7 @@ struct clk *s3c64xx_i2s_get_clock(struct snd_soc_dai *dai) struct s3c_i2sv2_info *i2s = snd_soc_dai_get_drvdata(dai); u32 iismod = readl(i2s->regs + S3C2412_IISMOD);
- if (iismod & S3C64XX_IISMOD_IMS_SYSMUX) + if (iismod & S3C2412_IISMOD_IMS_SYSMUX) return i2s->iis_cclk; else return i2s->iis_pclk;
In Samsung SoC's I2S was improved gradually from I2Sv2 to I2Sv4. So, S3C I2S platform codes are designed to use privious feature hierarchy. This patch modify that s3c64xx-i2s use common features of s3c-i2s-v2 and remove duplicated function on s3c64xx-i2s.
Signed-off-by: Seungwhan Youn sw.youn@samsung.com --- sound/soc/s3c24xx/s3c-i2s-v2.h | 2 + sound/soc/s3c24xx/s3c64xx-i2s-v4.c | 13 +++++++- sound/soc/s3c24xx/s3c64xx-i2s.c | 55 ++++++++++++------------------------ 3 files changed, 31 insertions(+), 39 deletions(-)
diff --git a/sound/soc/s3c24xx/s3c-i2s-v2.h b/sound/soc/s3c24xx/s3c-i2s-v2.h index c2a4bad..d458301 100644 --- a/sound/soc/s3c24xx/s3c-i2s-v2.h +++ b/sound/soc/s3c24xx/s3c-i2s-v2.h @@ -66,6 +66,8 @@ struct s3c_i2sv2_info { u32 suspend_iismod; u32 suspend_iiscon; u32 suspend_iispsr; + + unsigned long base; };
extern struct clk *s3c_i2sv2_get_clock(struct snd_soc_dai *cpu_dai); diff --git a/sound/soc/s3c24xx/s3c64xx-i2s-v4.c b/sound/soc/s3c24xx/s3c64xx-i2s-v4.c index 72708af..e17bc92 100644 --- a/sound/soc/s3c24xx/s3c64xx-i2s-v4.c +++ b/sound/soc/s3c24xx/s3c64xx-i2s-v4.c @@ -41,6 +41,9 @@ static struct s3c_i2sv2_info s3c64xx_i2sv4;
static int s3c64xx_i2sv4_probe(struct snd_soc_dai *dai) { + struct s3c_i2sv2_info *i2s = &s3c64xx_i2sv4; + int ret = 0; + /* configure GPIO for i2s port */ s3c_gpio_cfgpin(S3C64XX_GPC(4), S3C64XX_GPC4_I2S_V40_DO0); s3c_gpio_cfgpin(S3C64XX_GPC(5), S3C64XX_GPC5_I2S_V40_DO1); @@ -50,7 +53,11 @@ static int s3c64xx_i2sv4_probe(struct snd_soc_dai *dai) s3c_gpio_cfgpin(S3C64XX_GPH(8), S3C64XX_GPH8_I2S_V40_LRCLK); s3c_gpio_cfgpin(S3C64XX_GPH(9), S3C64XX_GPH9_I2S_V40_DI);
- return 0; + snd_soc_dai_set_drvdata(dai, i2s); + + ret = s3c_i2sv2_probe(dai, i2s, i2s->base); + + return ret; }
static int s3c_i2sv4_hw_params(struct snd_pcm_substream *substream, @@ -137,6 +144,8 @@ static __devinit int s3c64xx_i2sv4_dev_probe(struct platform_device *pdev) i2s->dma_playback->client = &s3c64xx_dma_client_out; i2s->dma_playback->dma_size = 4;
+ i2s->base = S3C64XX_PA_IISV4; + i2s->iis_cclk = clk_get(&pdev->dev, "audio-bus"); if (IS_ERR(i2s->iis_cclk)) { dev_err(&pdev->dev, "failed to get audio-bus\n"); @@ -146,7 +155,7 @@ static __devinit int s3c64xx_i2sv4_dev_probe(struct platform_device *pdev)
clk_enable(i2s->iis_cclk);
- ret = snd_soc_register_dai(&pdev->dev, pdev->id, &s3c64xx_i2s_v4_dai); + ret = s3c_i2sv2_register_dai(&pdev->dev, pdev->id, &s3c64xx_i2s_v4_dai); if (ret != 0) goto err_i2sv2;
diff --git a/sound/soc/s3c24xx/s3c64xx-i2s.c b/sound/soc/s3c24xx/s3c64xx-i2s.c index 5017e31..e712204 100644 --- a/sound/soc/s3c24xx/s3c64xx-i2s.c +++ b/sound/soc/s3c24xx/s3c64xx-i2s.c @@ -48,43 +48,6 @@ static struct s3c2410_dma_client s3c64xx_dma_client_in = { static struct s3c_dma_params s3c64xx_i2s_pcm_stereo_out[MAX_I2SV3]; static struct s3c_dma_params s3c64xx_i2s_pcm_stereo_in[MAX_I2SV3];
-static int s3c64xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, - int clk_id, unsigned int freq, int dir) -{ - struct s3c_i2sv2_info *i2s = snd_soc_dai_get_drvdata(cpu_dai); - u32 iismod = readl(i2s->regs + S3C2412_IISMOD); - - switch (clk_id) { - case S3C64XX_CLKSRC_PCLK: - iismod &= ~S3C2412_IISMOD_IMS_SYSMUX; - break; - - case S3C64XX_CLKSRC_MUX: - iismod |= S3C2412_IISMOD_IMS_SYSMUX; - break; - - case S3C64XX_CLKSRC_CDCLK: - switch (dir) { - case SND_SOC_CLOCK_IN: - iismod |= S3C64XX_IISMOD_CDCLKCON; - break; - case SND_SOC_CLOCK_OUT: - iismod &= ~S3C64XX_IISMOD_CDCLKCON; - break; - default: - return -EINVAL; - } - break; - - default: - return -EINVAL; - } - - writel(iismod, i2s->regs + S3C2412_IISMOD); - - return 0; -} - struct clk *s3c64xx_i2s_get_clock(struct snd_soc_dai *dai) { struct s3c_i2sv2_info *i2s = snd_soc_dai_get_drvdata(dai); @@ -112,12 +75,14 @@ static int s3c64xx_i2s_probe(struct snd_soc_dai *dai)
switch (dai->id) { case 0: + i2s->base = S3C64XX_PA_IIS0; i2s->dma_capture->channel = DMACH_I2S0_IN; i2s->dma_capture->dma_addr = S3C64XX_PA_IIS0 + S3C2412_IISRXD; i2s->dma_playback->channel = DMACH_I2S0_OUT; i2s->dma_playback->dma_addr = S3C64XX_PA_IIS0 + S3C2412_IISTXD; break; case 1: + i2s->base = S3C64XX_PA_IIS1; i2s->dma_capture->channel = DMACH_I2S1_IN; i2s->dma_capture->dma_addr = S3C64XX_PA_IIS1 + S3C2412_IISRXD; i2s->dma_playback->channel = DMACH_I2S1_OUT; @@ -156,8 +121,15 @@ static int s3c64xx_i2s_probe(struct snd_soc_dai *dai) s3c_gpio_cfgpin(S3C64XX_GPE(4), S3C64XX_GPE4_I2S1_D0); }
+ ret = s3c_i2sv2_probe(dai, i2s, i2s->base); + if (ret) + goto err_clk; + return 0;
+err_clk: + clk_disable(i2s->i2s_cclk); + clk_put(i2s->i2s_cclk); err: kfree(i2s); return ret; @@ -213,6 +185,7 @@ EXPORT_SYMBOL_GPL(s3c64xx_i2s_dai);
static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev) { + int i, ret;
if (pdev->id >= MAX_I2SV3) { dev_err(&pdev->dev, "id %d out of range\n", pdev->id); @@ -221,6 +194,14 @@ static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev)
return snd_soc_register_dais(&pdev->dev, s3c64xx_i2s_dai, ARRAY_SIZE(s3c64xx_i2s_dai)); + for (i = 0; i < ARRAY_SIZE(s3c64xx_i2s_dai); i++) { + ret = s3c_i2sv2_register_dai(&pdev->dev, i, + &s3c4xx_i2s_dai[i]); + if (ret != 0) + return ret; + } + + return 0; }
static __devexit int s3c64xx_iis_dev_remove(struct platform_device *pdev)
This patch adds AC97 codec driver for SMDK board.
Signed-off-by: Seungwhan Youn sw.youn@samsung.com --- sound/soc/s3c24xx/smdk_wm9713.c | 22 +++++++++++++++++++--- 1 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/sound/soc/s3c24xx/smdk_wm9713.c b/sound/soc/s3c24xx/smdk_wm9713.c index 001c2dd..f8aed14 100644 --- a/sound/soc/s3c24xx/smdk_wm9713.c +++ b/sound/soc/s3c24xx/smdk_wm9713.c @@ -60,22 +60,38 @@ static struct snd_soc_card smdk = { .num_links = 1, };
+static struct platform_device *smdk_snd_wm9713_device; static struct platform_device *smdk_snd_ac97_device;
static int __init smdk_init(void) { int ret;
- smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1); - if (!smdk_snd_ac97_device) + smdk_snd_wm9713_device = platform_device_alloc("wm9713-codec", -1); + if (!smdk_snd_wm9713_device) return -ENOMEM;
+ ret = platform_device_add(smdk_snd_wm9713_device); + if (ret) + goto err; + + smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1); + if (!smdk_snd_ac97_device) { + ret = -ENOMEM; + goto err; + } + platform_set_drvdata(smdk_snd_ac97_device, &smdk);
ret = platform_device_add(smdk_snd_ac97_device); - if (ret) + if (ret) { platform_device_put(smdk_snd_ac97_device); + goto err; + }
+ return 0; +err: + platform_device_put(smdk_snd_wm9713_device); return ret; }
On Thu, Jul 15, 2010 at 05:58:48PM +0900, Seungwhan Youn wrote:
This patch adds AC97 codec driver for SMDK board.
We already have a driver for this in mainline (which you are modifying). It looks like what you're actually doing is registering a device for the AC'97 CODEC so things probe.
On Thu, Jul 15, 2010 at 6:34 PM, Mark Brown broonie@opensource.wolfsonmicro.com wrote:
On Thu, Jul 15, 2010 at 05:58:48PM +0900, Seungwhan Youn wrote:
This patch adds AC97 codec driver for SMDK board.
We already have a driver for this in mainline (which you are modifying). It looks like what you're actually doing is registering a device for the AC'97 CODEC so things probe.
Okay, I'll fix this.
Thanks
Claude
On Thu, Jul 15, 2010 at 05:58:47PM +0900, Seungwhan Youn wrote:
- i2s->base = S3C64XX_PA_IISV4;
I'd really expect this to be being pulled from the resources for the platform device for the DAI rather than hard coded into the driver. If we're going to start reorganising things like this and touching all the drivers it'd seem better to go straight to doing that rather than introducing this approach.
Hi Mark,
On Thu, Jul 15, 2010 at 6:32 PM, Mark Brown broonie@opensource.wolfsonmicro.com wrote:
On Thu, Jul 15, 2010 at 05:58:47PM +0900, Seungwhan Youn wrote:
- i2s->base = S3C64XX_PA_IISV4;
I'd really expect this to be being pulled from the resources for the platform device for the DAI rather than hard coded into the driver. If we're going to start reorganising things like this and touching all the drivers it'd seem better to go straight to doing that rather than introducing this approach.
Does your comment means that 'i2s->base' get base address from the resources for the platform device using 'platform_get_resources()'? I'm doing on preparing that issue into another patch already (because I think this patch is only for Liam's multi-comp, not for that issue).
If the resource should get from platform device, I'll be happy to make a new one.
Thanks.
Claude.
On Thu, Jul 15, 2010 at 08:33:28PM +0900, Seungwhan Youn wrote:
Does your comment means that 'i2s->base' get base address from the resources for the platform device using 'platform_get_resources()'?
Yes, exactly.
I'm doing on preparing that issue into another patch already (because I think this patch is only for Liam's multi-comp, not for that issue).
My comment was that since this patch is going so far towards doing the move to pulling the data from the platform device it'd make sense to just do that as part of this patch rather than introduce a temporary workaround. It's not really any extra effort and it's much nicer.
On Thu, Jul 15, 2010 at 8:54 PM, Mark Brown broonie@opensource.wolfsonmicro.com wrote:
On Thu, Jul 15, 2010 at 08:33:28PM +0900, Seungwhan Youn wrote:
Does your comment means that 'i2s->base' get base address from the resources for the platform device using 'platform_get_resources()'?
Yes, exactly.
I'm doing on preparing that issue into another patch already (because I think this patch is only for Liam's multi-comp, not for that issue).
My comment was that since this patch is going so far towards doing the move to pulling the data from the platform device it'd make sense to just do that as part of this patch rather than introduce a temporary workaround. It's not really any extra effort and it's much nicer.
Okay,
I'll make a new patch-set that includes the data pulls from platform device. Thank you for your advice. :-)
Claude.
On Thu, 2010-07-15 at 17:58 +0900, Seungwhan Youn wrote:
This patch fix compile error on using S3C I2S.
Signed-off-by: Seungwhan Youn sw.youn@samsung.com
Thanks
Applied this one.
Liam
participants (4)
-
Liam Girdwood
-
Mark Brown
-
Seungwhan Youn
-
Seungwhan Youn