Skip to contentSkip to conversation

ASoC sst: Add msic codec driver

PATCH In review Vinod Koul 2 participants 6 messages Dec 30, 2010 – Jan 3, 2011

Subsystems (2)
lore
Share & tools
lore

Vinod Koul

author
#0 lore raw

PATCH 1/4 ASoC sst: Add msic codec driver

This patch adds the msic asoc codec driver. This driver currently supports only playback. Capture and jack detection to be added later

---
 sound/soc/codecs/Kconfig  |    4 +
 sound/soc/codecs/Makefile |    2 +
 sound/soc/codecs/msic.c   |  490 +++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/msic.h   |   99 +++++++++
 4 files changed, 595 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/codecs/msic.c
 create mode 100644 sound/soc/codecs/msic.h
sound/soc/codecs/Kconfig +4 -0
index 054191e..5f800da 100644
@@ -31,6 +31,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_JZ4740_CODEC if SOC_JZ4740
 	select SND_SOC_MAX98088 if I2C
 	select SND_SOC_MAX9877 if I2C
+	select SND_SOC_MSIC if INTEL_SCU_IPC
 	select SND_SOC_PCM3008
 	select SND_SOC_SPDIF
 	select SND_SOC_SSM2602 if I2C
@@ -170,6 +171,9 @@ config SND_SOC_DA7210
 config SND_SOC_MAX98088
        tristate
 
+config SND_SOC_MSIC
+	tristate
+
 config SND_SOC_PCM3008
        tristate
 
sound/soc/codecs/Makefile +2 -0
index 6a1e17b..5e57586 100644
@@ -16,6 +16,7 @@ snd-soc-cx20442-objs := cx20442.o
 snd-soc-da7210-objs := da7210.o
 snd-soc-l3-objs := l3.o
 snd-soc-max98088-objs := max98088.o
+snd-soc-msic-objs := msic.o
 snd-soc-pcm3008-objs := pcm3008.o
 snd-soc-alc5623-objs := alc5623.o
 snd-soc-spdif-objs := spdif_transciever.o
@@ -95,6 +96,7 @@ obj-$(CONFIG_SND_SOC_DA7210)	+= snd-soc-da7210.o
 obj-$(CONFIG_SND_SOC_L3)	+= snd-soc-l3.o
 obj-$(CONFIG_SND_SOC_JZ4740_CODEC)	+= snd-soc-jz4740-codec.o
 obj-$(CONFIG_SND_SOC_MAX98088)	+= snd-soc-max98088.o
+obj-$(CONFIG_SND_SOC_MSIC)	+=snd-soc-msic.o
 obj-$(CONFIG_SND_SOC_PCM3008)	+= snd-soc-pcm3008.o
 obj-$(CONFIG_SND_SOC_ALC5623)    += snd-soc-alc5623.o
 obj-$(CONFIG_SND_SOC_SPDIF)	+= snd-soc-spdif.o
sound/soc/codecs/msic.c new file +490 -0

490 lines not on this page · raw message

sound/soc/codecs/msic.h new file +99 -0

99 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#1 lore raw
Quoted 2 lines · Vinod Koul

This patch adds the msic asoc codec driver. This driver currently supports only playback. Capture and jack detection to be added later

This looks mostly OK, but you probably want to run it through checkpatch.pl. For quite a few of the debug prints you've got here you're replicating stuff that's in the core as standard - if you turn on debug logs from the core you should get equivalent logging.

Some more specific issues below:

sound/soc/codecs/msic.c line 291

Quoted 12 lines
sound/soc/codecs/msic.c new file +12 -0
+	switch (params_format(params)) {
+	case SNDRV_PCM_FORMAT_S16_LE:
+		format = 3;
+		break;
+
+	case SNDRV_PCM_FORMAT_S24_LE:
+		format = 0;
+		break;
+	default:
+		return -EINVAL;
+	}
+	snd_soc_update_bits(dai->codec, MSIC_PCM2C2, BIT(4)|BIT(5), format);

This won't work - both the mask and value for snd_soc_update_bits() are bitmasks so I'd expect the format for S16 to be 0x18 with that bitmask.

sound/soc/codecs/msic.c line 308

Quoted 1 line
sound/soc/codecs/msic.c new file +1 -0
+	snd_soc_update_bits(dai->codec, MSIC_PCM1C1, BIT(7), rate);

Similarly here.

sound/soc/codecs/msic.c line 390

Quoted 4 lines
sound/soc/codecs/msic.c new file +4 -0
+	/*PCM interface */
+	msic_write(codec, MSIC_PCM2RXSLOT01, 0x10);
+	msic_write(codec, MSIC_PCM2RXSLOT23, 0x32);
+	msic_write(codec, MSIC_PCM2RXSLOT45, 0x54);

For these it'd be better if you could provide some comments explaining what the configuration that's being set is. It's hard to tell if this is stuff that should be managed by the driver or not.

sound/soc/codecs/msic.c line 490

Quoted 5 lines
sound/soc/codecs/msic.c new file +4 -0
+static struct platform_driver intelmid_codec_driver = {
+	.driver		= {
+		.name		= "mid-msic-codec",
 
+MODULE_ALIAS("msic-codec");

This should be platform:mid-msic-codec.

#2 lore raw
Quoted 9 lines
Quoted 2 lines

This patch adds the msic asoc codec driver. This driver currently supports

only playback.

Quoted 1 line

Capture and jack detection to be added later

This looks mostly OK, but you probably want to run it through checkpatch.pl. For quite a few of the debug prints you've got here you're replicating stuff that's in the core as standard - if you turn on debug logs from the core you should get equivalent logging.

Yes we have run checkpatch. Currently yes we have quite a few logs, we will remove them later when we add the capture, jack detection etc. It would be nice to have these logs on.

Quoted 18 lines

Some more specific issues below:

sound/soc/codecs/msic.c line 291

Quoted 12 lines
sound/soc/codecs/msic.c new file +12 -0
+	switch (params_format(params)) {
+	case SNDRV_PCM_FORMAT_S16_LE:
+		format = 3;
+		break;
+
+	case SNDRV_PCM_FORMAT_S24_LE:
+		format = 0;
+		break;
+	default:
+		return -EINVAL;
+	}
+	snd_soc_update_bits(dai->codec, MSIC_PCM2C2, BIT(4)|BIT(5), format);

This won't work - both the mask and value for snd_soc_update_bits() are bitmasks so I'd expect the format for S16 to be 0x18 with that bitmask.

Quoted 1 line

sound/soc/codecs/msic.c line 308

Quoted 1 line
sound/soc/codecs/msic.c new file +1 -0
+	snd_soc_update_bits(dai->codec, MSIC_PCM1C1, BIT(7), rate);

Will fix

Quoted 10 lines

Similarly here.

sound/soc/codecs/msic.c line 390

Quoted 4 lines
sound/soc/codecs/msic.c new file +4 -0
+	/*PCM interface */
+	msic_write(codec, MSIC_PCM2RXSLOT01, 0x10);
+	msic_write(codec, MSIC_PCM2RXSLOT23, 0x32);
+	msic_write(codec, MSIC_PCM2RXSLOT45, 0x54);

For these it'd be better if you could provide some comments explaining what the configuration that's being set is. It's hard to tell if this is stuff that should be managed by the driver or not.

Sure

Quoted 8 lines

sound/soc/codecs/msic.c line 490

Quoted 6 lines
sound/soc/codecs/msic.c new file +4 -0
+static struct platform_driver intelmid_codec_driver = {
+	.driver		= {
+		.name		= "mid-msic-codec",
 
+MODULE_ALIAS("msic-codec");

This should be platform:mid-msic-codec.

Okay

~Vinod

#3 lore raw
Quoted 6 lines · Vinod
Quoted 4 lines

This looks mostly OK, but you probably want to run it through checkpatch.pl. For quite a few of the debug prints you've got here you're replicating stuff that's in the core as standard - if you turn on debug logs from the core you should get equivalent logging.

Yes we have run checkpatch. Currently yes we have quite a few logs, we will

There's quite a few places where there are coding style issues, in general if your code doesn't look like other kernel code that's a problem. One of the most frequent issues was that you weren't using spaces around /* and */.

Quoted 2 lines

remove them later when we add the capture, jack detection etc. It would be nice to have these logs on.

It would be good if you could at least make the logging consistent with the rest of the subsystem, and as I say avoid replicating logging which is already provided by the subsystem. The point is not that this stuff exists, the point is that it's replicating a facility that's already there.

#4 lore raw
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines

This looks mostly OK, but you probably want to run it through checkpatch.pl. For quite a few of the debug prints you've got here you're replicating stuff that's in the core as standard - if you turn on debug logs from the core you should get equivalent logging.

Yes we have run checkpatch. Currently yes we have quite a few logs, we will

There's quite a few places where there are coding style issues, in general if your code doesn't look like other kernel code that's a problem. One of the most frequent issues was that you weren't using spaces around /* and */.

Checkpatch doesn't seem to catch these, have fixed them now. Any other inconsistency you noted which may not be detected by checkpatch

Quoted 8 lines
Quoted 2 lines

remove them later when we add the capture, jack detection etc. It would be nice to have these logs on.

It would be good if you could at least make the logging consistent with the rest of the subsystem, and as I say avoid replicating logging which is already provided by the subsystem. The point is not that this stuff exists, the point is that it's replicating a facility that's already there.

Agreed, I have removed the duplication of what is there already in soc-core

~Vinod

#5 lore raw
Quoted 7 lines · Vinod
Quoted 4 lines

There's quite a few places where there are coding style issues, in general if your code doesn't look like other kernel code that's a problem. One of the most frequent issues was that you weren't using spaces around /* and */.

Checkpatch doesn't seem to catch these, have fixed them now. Any other inconsistency you noted which may not be detected by checkpatch

I'll point them out when I notice them; like I say this is something you should be able to check by comparing with other code.