From c570d529aff4b1242f2c7ba742c9738ac0050603 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 7 Sep 2010 15:46:48 +0900 Subject: [PATCH 01/34] ASoC: fsi-ak4642: modify platform_name Signed-off-by: Kuninori Morimoto Acked-by: Laim Girdwood Signed-off-by: Mark Brown --- sound/soc/sh/fsi-ak4642.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c index 53836ca11d3b..a7d2686dbab0 100644 --- a/sound/soc/sh/fsi-ak4642.c +++ b/sound/soc/sh/fsi-ak4642.c @@ -32,7 +32,7 @@ static struct snd_soc_dai_link fsi_dai_link = { .cpu_dai_name = "fsia-dai", /* fsi A */ .codec_dai_name = "ak4642-hifi", #ifdef CONFIG_MACH_AP4EVB - .platform_name = "sh_fsi2.0", + .platform_name = "sh_fsi2", .codec_name = "ak4642-codec.0-0013", #else .platform_name = "sh_fsi.0", From 715ce576187c783bd166e298584d0e584869c42c Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Fri, 10 Sep 2010 10:34:32 +0900 Subject: [PATCH 02/34] ASoC: fsi codecs: modify menu attribute on Kconfig Current SND_FSI_xxx menu attributes were bool, but it should be tristate. This patch solve below report from Guennadi "bool" means, if someone is linking the whole ASoC into the kernel, they will not be able to build this as a module. Not a big deal, but you're stealing some freedom from the user. Reported-by: Guennadi Liakhovetski Signed-off-by: Kuninori Morimoto Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/sh/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig index 6b224d21e51b..7f0a496e07ce 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig @@ -47,7 +47,7 @@ config SND_SH7760_AC97 AC97 unit of the SH7760. config SND_FSI_AK4642 - bool "FSI-AK4642 sound support" + tristate "FSI-AK4642 sound support" depends on SND_SOC_SH4_FSI && I2C_SH_MOBILE select SND_SOC_AK4642 help @@ -55,7 +55,7 @@ config SND_FSI_AK4642 FSI - AK4642 unit config SND_FSI_DA7210 - bool "FSI-DA7210 sound support" + tristate "FSI-DA7210 sound support" depends on SND_SOC_SH4_FSI && I2C_SH_MOBILE select SND_SOC_DA7210 help @@ -63,7 +63,7 @@ config SND_FSI_DA7210 FSI - DA7210 unit config SND_FSI_HDMI - bool "FSI-HDMI sound support" + tristate "FSI-HDMI sound support" depends on SND_SOC_SH4_FSI && FB_SH_MOBILE_HDMI help This option enables generic sound support for the From e66477d337f74e43994ffccfdfc26080bf6393f4 Mon Sep 17 00:00:00 2001 From: Jassi Brar Date: Fri, 10 Sep 2010 16:40:31 +0900 Subject: [PATCH 03/34] ASoC: S3C: AC97: Remove the -dai suffix Drop the invalid -dai suffix appended to the Samsung AC97 CPU DAI. Signed-off-by: Jassi Brar Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/s3c24xx/smdk2443_wm9710.c | 2 +- sound/soc/s3c24xx/smdk_wm9713.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/s3c24xx/smdk2443_wm9710.c b/sound/soc/s3c24xx/smdk2443_wm9710.c index 66f9e222220b..4613288c2772 100644 --- a/sound/soc/s3c24xx/smdk2443_wm9710.c +++ b/sound/soc/s3c24xx/smdk2443_wm9710.c @@ -28,7 +28,7 @@ static struct snd_soc_dai_link smdk2443_dai[] = { { .name = "AC97", .stream_name = "AC97 HiFi", - .cpu_dai_name = "s3c-ac97-dai", + .cpu_dai_name = "s3c-ac97", .codec_dai_name = "ac97-hifi", .codec_name = "ac97-codec", .platform_name = "s3c24xx-pcm-audio", diff --git a/sound/soc/s3c24xx/smdk_wm9713.c b/sound/soc/s3c24xx/smdk_wm9713.c index 90108a7a0a8e..11086f8c046d 100644 --- a/sound/soc/s3c24xx/smdk_wm9713.c +++ b/sound/soc/s3c24xx/smdk_wm9713.c @@ -47,7 +47,7 @@ static struct snd_soc_dai_link smdk_dai = { .name = "AC97", .stream_name = "AC97 PCM", .platform_name = "s3c24xx-pcm-audio", - .cpu_dai_name = "s3c-ac97-dai", + .cpu_dai_name = "s3c-ac97", .codec_dai_name = "wm9713-hifi", .codec_name = "wm9713-codec", }; From 5fbdedf072500859601705fa6f07a9e895d5e3a8 Mon Sep 17 00:00:00 2001 From: Jassi Brar Date: Fri, 10 Sep 2010 16:41:17 +0900 Subject: [PATCH 04/34] ASoC: Samsung: Debug PCM platform device name The PCM controller platform devices are registered by the name 'samsung-pcm', so use the same in the CPU driver. Signed-off-by: Jassi Brar Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/s3c24xx/s3c-pcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/s3c24xx/s3c-pcm.c b/sound/soc/s3c24xx/s3c-pcm.c index 6174e26e433e..825645fbe4de 100644 --- a/sound/soc/s3c24xx/s3c-pcm.c +++ b/sound/soc/s3c24xx/s3c-pcm.c @@ -522,7 +522,7 @@ static struct platform_driver s3c_pcm_driver = { .probe = s3c_pcm_dev_probe, .remove = s3c_pcm_dev_remove, .driver = { - .name = "samsung-pcm-audio", + .name = "samsung-pcm", .owner = THIS_MODULE, }, }; @@ -543,4 +543,4 @@ module_exit(s3c_pcm_exit); MODULE_AUTHOR("Jaswinder Singh, "); MODULE_DESCRIPTION("S3C PCM Controller Driver"); MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:samsung-pcm-audio"); +MODULE_ALIAS("platform:samsung-pcm"); From f4363b7d88e99497e4241397efee09b106d802c4 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 9 Sep 2010 11:47:49 +0900 Subject: [PATCH 05/34] fbdev: sh_mobile_hdmi: modify noisy comment out This patch solve below report from Guennadi 1) > - hdmi_write(hdmi, 0x00, HDMI_AUDIO_SETTING_1); > + switch (pdata->flags & HDMI_SRC_MASK) { > + default: > + /* FALL THROUGH */ I'm not sure I like the capitalisation here - no reason to shout;) 2) > +/************************************************************************ > + > + > + HDMI sound > + > + > +************************************************************************/ I don't think this comment deserves 7 lines of text, besides breaking the multiline comment style. If you think, one line like /* HDMI sound */ is not enough how about just /* * HDMI sound */ 3) > +/************************************************************************ > + > + > + HDMI video > + > + > +************************************************************************/ See above - 7 lines seem to be an overkill to me. Reported-by: Guennadi Liakhovetski Signed-off-by: Kuninori Morimoto Reviewed-by: Guennadi Liakhovetski Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- drivers/video/sh_mobile_hdmi.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c index 16187d66255c..0acd850f73b5 100644 --- a/drivers/video/sh_mobile_hdmi.c +++ b/drivers/video/sh_mobile_hdmi.c @@ -224,13 +224,9 @@ static u8 hdmi_read(struct sh_hdmi *hdmi, u8 reg) return ioread8(hdmi->base + reg); } -/************************************************************************ - - - HDMI sound - - -************************************************************************/ +/* + * HDMI sound + */ static unsigned int sh_hdmi_snd_read(struct snd_soc_codec *codec, unsigned int reg) { @@ -273,13 +269,10 @@ static struct snd_soc_codec_driver soc_codec_dev_sh_hdmi = { .write = sh_hdmi_snd_write, }; -/************************************************************************ +/* + * HDMI video + */ - - HDMI video - - -************************************************************************/ /* External video parameter settings */ static void hdmi_external_video_param(struct sh_hdmi *hdmi) { @@ -398,7 +391,7 @@ static void sh_hdmi_audio_config(struct sh_hdmi *hdmi) */ switch (pdata->flags & HDMI_SRC_MASK) { default: - /* FALL THROUGH */ + /* fall through */ case HDMI_SRC_I2S: data = (0x0 << 3); break; From dec6aa49abf73b061b631163cb1e1d803a614d24 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 9 Sep 2010 11:48:01 +0900 Subject: [PATCH 06/34] fbdev: sh_mobile_hdmi: modify flags name to more specific This patch solve below report from Guennadi 1) > +/* Audio source select */ > +#define HDMI_SRC_MASK (0xF << 0) > +#define HDMI_SRC_I2S (0 << 0) /* default */ > +#define HDMI_SRC_SPDIF (1 << 0) > +#define HDMI_SRC_DSD (2 << 0) > +#define HDMI_SRC_HBR (3 << 0) I would be more specific with these macro names, i.e., include "AUDIO" or "SND" or something similar in them, e.g., HDMI_AUDIO_SRC_I2S. 2) > + case HDMI_SRC_I2S: > + data = (0x0 << 3); > + break; > + case HDMI_SRC_SPDIF: > + data = (0x1 << 3); > + break; > + case HDMI_SRC_DSD: > + data = (0x2 << 3); > + break; > + case HDMI_SRC_HBR: > + data = (0x3 << 3); In all above cases parenthesis are superfluous. Reported-by: Guennadi Liakhovetski Signed-off-by: Kuninori Morimoto Reviewed-by: Guennadi Liakhovetski Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- drivers/video/sh_mobile_hdmi.c | 18 +++++++++--------- include/video/sh_mobile_hdmi.h | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c index 0acd850f73b5..beb04ef5fd0b 100644 --- a/drivers/video/sh_mobile_hdmi.c +++ b/drivers/video/sh_mobile_hdmi.c @@ -389,20 +389,20 @@ static void sh_hdmi_audio_config(struct sh_hdmi *hdmi) * [6:5] set required down sampling rate if required * [4:3] set required audio source */ - switch (pdata->flags & HDMI_SRC_MASK) { + switch (pdata->flags & HDMI_SND_SRC_MASK) { default: /* fall through */ - case HDMI_SRC_I2S: - data = (0x0 << 3); + case HDMI_SND_SRC_I2S: + data = 0x0 << 3; break; - case HDMI_SRC_SPDIF: - data = (0x1 << 3); + case HDMI_SND_SRC_SPDIF: + data = 0x1 << 3; break; - case HDMI_SRC_DSD: - data = (0x2 << 3); + case HDMI_SND_SRC_DSD: + data = 0x2 << 3; break; - case HDMI_SRC_HBR: - data = (0x3 << 3); + case HDMI_SND_SRC_HBR: + data = 0x3 << 3; break; } hdmi_write(hdmi, data, HDMI_AUDIO_SETTING_1); diff --git a/include/video/sh_mobile_hdmi.h b/include/video/sh_mobile_hdmi.h index 929c2d3147bc..1e1aa54ab2e4 100644 --- a/include/video/sh_mobile_hdmi.h +++ b/include/video/sh_mobile_hdmi.h @@ -23,11 +23,11 @@ struct device; */ /* Audio source select */ -#define HDMI_SRC_MASK (0xF << 0) -#define HDMI_SRC_I2S (0 << 0) /* default */ -#define HDMI_SRC_SPDIF (1 << 0) -#define HDMI_SRC_DSD (2 << 0) -#define HDMI_SRC_HBR (3 << 0) +#define HDMI_SND_SRC_MASK (0xF << 0) +#define HDMI_SND_SRC_I2S (0 << 0) /* default */ +#define HDMI_SND_SRC_SPDIF (1 << 0) +#define HDMI_SND_SRC_DSD (2 << 0) +#define HDMI_SND_SRC_HBR (3 << 0) struct sh_mobile_hdmi_info { struct sh_mobile_lcdc_chan_cfg *lcd_chan; From 17731f8dffe7dc6fd0eb82018505a74907431699 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 9 Sep 2010 11:48:10 +0900 Subject: [PATCH 07/34] fbdev: sh_mobile_hdmi: modify snd_soc_dai_driver settings This patch solve below report from Guennadi > +static struct snd_soc_dai_driver sh_hdmi_dai = { > + .name = "sh_mobile_hdmi-hifi", > + .playback = { > + .stream_name = "Playback", > + .channels_min = 1, Can it actually do mono? Maybe at probe time you could look at audio flags from your previous patch and, e.g., for SPDIF set channels_min to 2? > + .channels_max = 2, That's the "smallest max," yes. With some other interfaces (I2S, DSD) it can support up to 8 channels... > + .rates = SNDRV_PCM_RATE_8000_48000, Hm, in the datasheet I see supported frequencies 32kHz to 192kHz. And if you promise support for multiple frequencies, don't you want to implement .hw_params? Besides, not all of these frequencies will be available, depending on your supplied clock and your willingness to implement downsampling. Reported-by: Guennadi Liakhovetski Signed-off-by: Kuninori Morimoto Reviewed-by: Guennadi Liakhovetski Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- drivers/video/sh_mobile_hdmi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c index beb04ef5fd0b..a2cb49254eb2 100644 --- a/drivers/video/sh_mobile_hdmi.c +++ b/drivers/video/sh_mobile_hdmi.c @@ -249,9 +249,12 @@ static struct snd_soc_dai_driver sh_hdmi_dai = { .name = "sh_mobile_hdmi-hifi", .playback = { .stream_name = "Playback", - .channels_min = 1, - .channels_max = 2, - .rates = SNDRV_PCM_RATE_8000_48000, + .channels_min = 2, + .channels_max = 8, + .rates = SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | + SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | + SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 | + SNDRV_PCM_RATE_192000, .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, }, }; From ec4e5ccd4b8be576f9cd8bfc3cb8651565ed87ef Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 9 Sep 2010 11:48:20 +0900 Subject: [PATCH 08/34] fbdev: sh_mobile_hdmi: add new label for sound error path This patch solve below report from Guennadi > /* External video parameter settings */ > static void hdmi_external_video_param(struct sh_hdmi *hdmi) > { > @@ -804,6 +862,11 @@ static int __init sh_hdmi_probe(struct platform_device *pdev) > return -ENOMEM; > } > > + ret = snd_soc_register_codec(&pdev->dev, > + &soc_codec_dev_sh_hdmi, &sh_hdmi_dai, 1); > + if (ret < 0) > + goto egetclk; > + > hdmi->dev = &pdev->dev; > > hdmi->hdmi_clk = clk_get(&pdev->dev, "ick"); NAK. This breaks the error path and has to be fixed. Firstly, please, use a new label like "esndreg," secondly, you have to add clk_disable(hdmi->hdmi_clk); erate: clk_put(hdmi->hdmi_clk); egetclk: + snd_soc_unregister_codec(&pdev->dev); +esndreg: mutex_destroy(&hdmi->mutex); kfree(hdmi); Reported-by: Guennadi Liakhovetski Signed-off-by: Kuninori Morimoto Reviewed-by: Guennadi Liakhovetski Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- drivers/video/sh_mobile_hdmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c index a2cb49254eb2..ef989d94511c 100644 --- a/drivers/video/sh_mobile_hdmi.c +++ b/drivers/video/sh_mobile_hdmi.c @@ -967,7 +967,7 @@ static int __init sh_hdmi_probe(struct platform_device *pdev) ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_sh_hdmi, &sh_hdmi_dai, 1); if (ret < 0) - goto egetclk; + goto esndreg; hdmi->dev = &pdev->dev; @@ -1054,6 +1054,8 @@ eclkenable: erate: clk_put(hdmi->hdmi_clk); egetclk: + snd_soc_unregister_codec(&pdev->dev); +esndreg: kfree(hdmi); return ret; From b5e31dfe069e9ddd877e277116ca2f155137a937 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 9 Sep 2010 11:48:30 +0900 Subject: [PATCH 09/34] ASoC: fsi-hdmi: remove unneeded header This patch solve below report from Guennadi. But I didn't remove #include . Because it have FSI_PORT_B define which is used on this file. > +#include > +#include > +#include