S3C PCM: Added the CPU driver for PCM controllers
PATCH 7/7 S3C PCM: Added the CPU driver for PCM controllers
--- sound/soc/s3c24xx/Kconfig | 3 + sound/soc/s3c24xx/Makefile | 2 + sound/soc/s3c24xx/s3c-pcm.c | 558 +++++++++++++++++++++++++++++++++++++++++++ sound/soc/s3c24xx/s3c-pcm.h | 123 ++++++++++ 4 files changed, 686 insertions(+), 0 deletions(-) create mode 100644 sound/soc/s3c24xx/s3c-pcm.c create mode 100644 sound/soc/s3c24xx/s3c-pcm.h
sound/soc/s3c24xx/Kconfig +3 -0
@@ -24,6 +24,9 @@ config SND_S3C64XX_SOC_I2S select SND_S3C_I2SV2_SOC select S3C64XX_DMA +config SND_S3C_SOC_PCM + tristate + config SND_S3C2443_SOC_AC97 tristate select S3C2410_DMA
sound/soc/s3c24xx/Makefile +2 -0
@@ -5,6 +5,7 @@ snd-soc-s3c2412-i2s-objs := s3c2412-i2s.o snd-soc-s3c64xx-i2s-objs := s3c64xx-i2s.o snd-soc-s3c2443-ac97-objs := s3c2443-ac97.o snd-soc-s3c-i2s-v2-objs := s3c-i2s-v2.o +snd-soc-s3c-pcm-objs := s3c-pcm.o obj-$(CONFIG_SND_S3C24XX_SOC) += snd-soc-s3c24xx.o obj-$(CONFIG_SND_S3C24XX_SOC_I2S) += snd-soc-s3c24xx-i2s.o
@@ -12,6 +13,7 @@ obj-$(CONFIG_SND_S3C2443_SOC_AC97) += snd-soc-s3c2443-ac97.o obj-$(CONFIG_SND_S3C2412_SOC_I2S) += snd-soc-s3c2412-i2s.o obj-$(CONFIG_SND_S3C64XX_SOC_I2S) += snd-soc-s3c64xx-i2s.o obj-$(CONFIG_SND_S3C_I2SV2_SOC) += snd-soc-s3c-i2s-v2.o +obj-$(CONFIG_SND_S3C_SOC_PCM) += snd-soc-s3c-pcm.o # S3C24XX Machine Support snd-soc-jive-wm8750-objs := jive_wm8750.o
sound/soc/s3c24xx/s3c-pcm.c new file +558 -0
558 lines not on this page · raw message
sound/soc/s3c24xx/s3c-pcm.h new file +123 -0
123 lines not on this page · raw message
Signature · 1 line
1.6.2.5
Quoted 1 line · Jassi Brar
Signed-off-by Jassi Brar <[email protected]>
This looks basically good. A few comments but they're pretty much nitpicks:
sound/soc/s3c24xx/s3c-pcm.c line 205
Quoted 2 lines
sound/soc/s3c24xx/s3c-pcm.c new file +2
-0+ clk = (clkctl &S3C_PCM_CLKCTL_SERCLKSEL_PCLK ) ? + pcm->pclk : pcm->cclk;
This would be clearer as an if statement - the ternery operator isn't massively legible at the best of times, especially when statements end up spanning multiple lines.
sound/soc/s3c24xx/s3c-pcm.c line 267
Quoted 8 lines
sound/soc/s3c24xx/s3c-pcm.c new file +8
-0+case SND_SOC_DAIFMT_CBS_CFS : +/* Nothing to do, Master by default */ +break ; +default : +spin_unlock_irq (&pcm->lock); +dev_err (pcm->dev,"Unsupported master/slave format!\n" ); +return -EINVAL ; + }
A goto to handle the lock unwinding might be appropriate.
sound/soc/s3c24xx/s3c-pcm.c line 338
Quoted 6 lines
sound/soc/s3c24xx/s3c-pcm.c new file +6
-0+case S3C_PCM_CLKSRC_MUX : + clkctl &= ~S3C_PCM_CLKCTL_SERCLKSEL_PCLK ; + +if (clk_get_rate (pcm->cclk) != freq) +clk_set_rate (pcm->cclk, freq); +
May as well just clk_set_rate() unconditionally, it'll do no harm to do a null change.
sound/soc/s3c24xx/s3c-pcm.c line 361
Quoted 12 lines
sound/soc/s3c24xx/s3c-pcm.c new file +12
-0+struct clk *s3c_pcm_get_clock (struct snd_soc_dai *cpu_dai) +{ +struct s3c_pcm_info *pcm =to_info (cpu_dai); +void __iomem *regs = pcm->regs; +u32 clkctl =readl (regs +S3C_PCM_CLKCTL ); + +if (clkctl &S3C_PCM_CLKCTL_SERCLKSEL_PCLK ) +return pcm->pclk; +else +return pcm->cclk; +} +EXPORT_SYMBOL_GPL (s3c_pcm_get_clock);
How will this be used?
sound/soc/s3c24xx/s3c-pcm.c line 411
Quoted 5 lines
sound/soc/s3c24xx/s3c-pcm.c new file +5
-0+/* Check for valid device index */ +if (pdev->id >=ARRAY_SIZE (s3c_pcm)) { +dev_err (&pdev->dev,"id %d out of range\n" , pdev->id); +return -EINVAL ; + }
id could be less than zero too.
Quoted 6 lines · Mark Brown
Quoted 1 line · Jassi Brar
Signed-off-by Jassi Brar <[email protected]>This looks basically good. A few comments but they're pretty much nitpicks:
Quoted 6 lines
Quoted 2 lines
+ clk = (clkctl &
S3C_PCM_CLKCTL_SERCLKSEL_PCLK) ?
+pcm->pclk:pcm->cclk;This would be clearer as an if statement - the ternery operator isn't massively legible at the best of times, especially when statements end up spanning multiple lines.
okay.
Quoted 10 lines
Quoted 8 lines
+ case
SND_SOC_DAIFMT_CBS_CFS:
+ /* Nothing to do, Master by default */
+ break;
+ default:
+spin_unlock_irq(&pcm->lock);
+dev_err(pcm->dev, "Unsupported master/slave format!\n");
+ return-EINVAL;
+ }A goto to handle the lock unwinding might be appropriate.
Yes, that wud be better.
Quoted 9 lines
sound/soc/s3c24xx/s3c-pcm.c line 338
Quoted 6 lines
+ case
S3C_PCM_CLKSRC_MUX:
+ clkctl &= ~S3C_PCM_CLKCTL_SERCLKSEL_PCLK;sound/soc/s3c24xx/s3c-pcm.c new file +4
-0+ + if (clk_get_rate(pcm->cclk) != freq) + clk_set_rate(pcm->cclk, freq); +May as well just
clk_set_rate()unconditionally, it'll do no harm to do a null change.
I believe the clock sources should be touched only when we can't do without it. clk_get_rate doesn't touch any register, but clk_set_rate does even if overwrite the same value.
Quoted 6 lines
Quoted 6 lines
sound/soc/s3c24xx/s3c-pcm.c new file +6
-0+struct clk *s3c_pcm_get_clock (struct snd_soc_dai *cpu_dai) +{ + struct s3c_pcm_info *pcm = to_info(cpu_dai); + void __iomem *regs = pcm->regs; + u32 clkctl = readl(regs + S3C_PCM_CLKCTL); +
Quoted 8 lines
Review
Quoted 6 lines
+ if (clkctl &
S3C_PCM_CLKCTL_SERCLKSEL_PCLK)
+ returnpcm->pclk;
+ else
+ returnpcm->cclk;(quoted diff) +2
-0+} +EXPORT_SYMBOL_GPL(s3c_pcm_get_clock);How will this be used?
Hmmm, can't think of it's role with this revised driver.
Quoted 7 lines
Quoted 5 lines
+ /* Check for valid device index */
+ if (pdev->id>=ARRAY_SIZE(s3c_pcm)) {
+dev_err(&pdev->dev, "id %d out of range\n", pdev->id);
+ return-EINVAL;
+ }id could be less than zero too.
okay. Though i wonder how did it pass review in s3c64xx-i2s.c
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 8 lines · jassi brar
On Sat, Nov 7, 2009 at 2:50 AM, Mark Brown
Quoted 2 lines
May as well just
clk_set_rate()unconditionally, it'll do no harm to do a null change.I believe the clock sources should be touched only when we can't do without it.
clk_get_ratedoesn't touch any register, butclk_set_ratedoes even if overwrite the same value.
I can see your point but if this is required it feels like something that the clock API ought to be handling it - the same code should be added pretty much every time the clock might be set.
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines
+ /* Check for valid device index */
+ if (pdev->id>=ARRAY_SIZE(s3c_pcm)) {
+dev_err(&pdev->dev, "id %d out of range\n", pdev->id);
+ return-EINVAL;
+ }id could be less than zero too.
okay. Though i wonder how did it pass review in
s3c64xx-i2s.c
When the drivers were originally merged there were quite a few issues that needed fixing up but it was felt that it was better to get the code into mainline where it could be worked on more readily. Ben didn't really have any time to do much work on the drivers at the time and this way it's easier for others to pitch in and fix up problems.