Skip to contentSkip to conversation

ASoC: add ADAU1361 codec driver

PATCH In review Mike Frysinger 5 participants 18 messages Aug 7, 2010 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 ASoC: add ADAU1361 codec driver

From: Cliff Cai <[email protected]>

---
 sound/soc/codecs/Kconfig    |    4 +
 sound/soc/codecs/Makefile   |    2 +
 sound/soc/codecs/adau1361.c |  992 +++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/adau1361.h |  264 ++++++++++++
 4 files changed, 1262 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/codecs/adau1361.c
 create mode 100644 sound/soc/codecs/adau1361.h
sound/soc/codecs/Kconfig +4 -0
index ae01cba..f37d5f4 100644
@@ -16,6 +16,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_AD193X if SND_SOC_I2C_AND_SPI
 	select SND_SOC_AD1980 if SND_SOC_AC97_BUS
 	select SND_SOC_AD73311 if I2C
+	select SND_SOC_ADAU1361 if I2C
 	select SND_SOC_ADAV80X if SND_SOC_I2C_AND_SPI
 	select SND_SOC_ADS117X
 	select SND_SOC_AK4104 if SPI_MASTER
@@ -104,6 +105,9 @@ config SND_SOC_AD1980
 config SND_SOC_AD73311
 	tristate
 	
+config SND_SOC_ADAU1361
+	tristate
+
 config SND_SOC_ADAV80X
 	tristate
 
sound/soc/codecs/Makefile +2 -0
index f5b3d5b..d05b672 100644
@@ -3,6 +3,7 @@ snd-soc-ad1836-objs := ad1836.o
 snd-soc-ad193x-objs := ad193x.o
 snd-soc-ad1980-objs := ad1980.o
 snd-soc-ad73311-objs := ad73311.o
+snd-soc-adau1361-objs := adau1361.o
 snd-soc-adav80x-objs := adav80x.o
 snd-soc-ads117x-objs := ads117x.o
 snd-soc-ak4104-objs := ak4104.o
@@ -70,6 +71,7 @@ obj-$(CONFIG_SND_SOC_AD1836)	+= snd-soc-ad1836.o
 obj-$(CONFIG_SND_SOC_AD193X)	+= snd-soc-ad193x.o
 obj-$(CONFIG_SND_SOC_AD1980)	+= snd-soc-ad1980.o
 obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o
+obj-$(CONFIG_SND_SOC_ADAU1361)	+= snd-soc-adau1361.o
 obj-$(CONFIG_SND_SOC_ADAV80X)	+= snd-soc-adav80x.o
 obj-$(CONFIG_SND_SOC_ADS117X)	+= snd-soc-ads117x.o
 obj-$(CONFIG_SND_SOC_AK4104)	+= snd-soc-ak4104.o
sound/soc/codecs/adau1361.c new file +992 -0

992 lines not on this page · raw message

sound/soc/codecs/adau1361.h new file +264 -0

264 lines not on this page · raw message

Signature · 1 line
1.7.2

A message that is not in the archive (sent off-list or not yet received): 1281212905-12957-1-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org

#2 lore raw

PATCH 2/6 ASoC: Blackfin: new machine driver for ADAU1361 codecs

From: Cliff Cai <[email protected]>

---
 sound/soc/blackfin/Kconfig          |    9 ++
 sound/soc/blackfin/Makefile         |    2 +
 sound/soc/blackfin/bf5xx-adau1361.c |  144 +++++++++++++++++++++++++++++++++++
 3 files changed, 155 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/blackfin/bf5xx-adau1361.c
sound/soc/blackfin/Kconfig +9 -0
index b73ee38..56eb6c6 100644
@@ -32,6 +32,15 @@ config SND_BFIN_AD73311_SE
 	  Enter the GPIO used to control AD73311's SE pin. Acceptable
 	  values are 0 to 7
 
+config SND_BF5XX_SOC_ADAU1361
+	tristate "SoC ADAU1361 Audio support"
+	depends on SND_BF5XX_I2S
+	select SND_BF5XX_SOC_I2S
+	select SND_SOC_ADAU1361
+	select I2C
+	help
+	  Say Y if you want to add support for ADAU1361 SoC audio.
+
 config SND_BF5XX_SOC_ADAV80X
 	tristate "SoC ADAV801/3 Audio support"
 	depends on SND_BF5XX_I2S && (SPI_MASTER || I2C)
sound/soc/blackfin/Makefile +2 -0
index 872dac8..9de1fc9 100644
@@ -21,6 +21,7 @@ snd-ad1980-objs := bf5xx-ad1980.o
 snd-ssm2602-objs := bf5xx-ssm2602.o
 snd-ad73311-objs := bf5xx-ad73311.o
 snd-ad193x-objs := bf5xx-ad193x.o
+snd-adau1361-objs := bf5xx-adau1361.o
 snd-adav80x-objs := bf5xx-adav80x.o
 
 obj-$(CONFIG_SND_BF5XX_SOC_AD1836) += snd-ad1836.o
@@ -28,4 +29,5 @@ obj-$(CONFIG_SND_BF5XX_SOC_AD1980) += snd-ad1980.o
 obj-$(CONFIG_SND_BF5XX_SOC_SSM2602) += snd-ssm2602.o
 obj-$(CONFIG_SND_BF5XX_SOC_AD73311) += snd-ad73311.o
 obj-$(CONFIG_SND_BF5XX_SOC_AD193X) += snd-ad193x.o
+obj-$(CONFIG_SND_BF5XX_SOC_ADAU1361) += snd-adau1361.o
 obj-$(CONFIG_SND_BF5XX_SOC_ADAV80X) += snd-adav80x.o
sound/soc/blackfin/bf5xx-adau1361.c new file +144 -0

144 lines not on this page · raw message

Signature · 1 line
1.7.2
#3 lore raw

Re: [PATCH 2/6] ASoC: Blackfin: new machine driver for ADAU1361 codecs

sound/soc/blackfin/Kconfig config SND_BFIN_AD73311_SE · line 43

Quoted 9 lines · Mike Frysinger
sound/soc/blackfin/Kconfig +9 -0
+config SND_BF5XX_SOC_ADAU1361
+	tristate "SoC ADAU1361 Audio support"
+	depends on SND_BF5XX_I2S
+	select SND_BF5XX_SOC_I2S
+	select SND_SOC_ADAU1361
+	select I2C
+	help
+	  Say Y if you want to add support for ADAU1361 SoC audio.
+

Identical comments to the last machine driver you posted here.

It'd be really helpful if you could do a bit more pre-review on the stuff you're posting, especially where you've got a bunch of drivers that follow similar patterns and are going to generate exactly the same feedback. Posting a large batch of patches at once isn't a problem but if you're sending additional patches later on it'd be helpful to take into account the feedback that has already been given on prior serieses.

Quoted 11 lines
sound/soc/blackfin/bf5xx-adau1361.c new file +11 -0
+	switch (params_rate(params)) {
+	case 11025:
+	case 22050:
+	case 44100:
+	case 88200:
+		pll_out = ADAU1361_PLL_FREQ_441;
+		break;
+	case 8000:
+	case 12000:
+	case 16000:
+	case 24000:

sound/soc/blackfin/bf5xx-adau1361.c line 56

Quoted 10 lines
sound/soc/blackfin/bf5xx-adau1361.c new file +10 -0
+	case 32000:
+	case 48000:
+	case 64000:
+	case 96000:
+		pll_out = ADAU1361_PLL_FREQ_48;
+		break;
+	default:
+		pll_out = ADAU1361_PLL_FREQ_441;
+		break;
+	}

It seems silly for the machine drivers to all have to manually do this lookup - it appears to be entirely and inflexibly related to the sample rate in use. May as well just specify the input clock to the device.

sound/soc/blackfin/bf5xx-adau1361.c line 63

Quoted 6 lines
sound/soc/blackfin/bf5xx-adau1361.c new file +6 -0
+	/* set codec DAI configuration */
+	ret = codec_dai->ops->set_fmt(codec_dai,
+		SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+		SND_SOC_DAIFMT_CBM_CFM);
+	if (ret < 0)
+		return ret;

There are accessor functions for this stuff. I've stopped reviewing the code at this point.

#4 lore raw

Re: [Uclinux-dist-devel] [PATCH 2/6] ASoC: Blackfin: new machine driver for ADAU1361 codecs

Quoted 14 lines · Mark Brown

sound/soc/blackfin/Kconfig config SND_BFIN_AD73311_SE · line 43

Quoted 9 lines · Mike Frysinger
sound/soc/blackfin/Kconfig +9 -0
+config SND_BF5XX_SOC_ADAU1361
+     tristate "SoC ADAU1361 Audio support"
+     depends on SND_BF5XX_I2S
+     select SND_BF5XX_SOC_I2S
+     select SND_SOC_ADAU1361
+     select I2C
+     help
+       Say Y if you want to add support for ADAU1361 SoC audio.
+

Identical comments to the last machine driver you posted here.

Quoted 1 line

It'd be really helpful if you could do a bit more pre-review on the stuff you're posting, especially where you've got a bunch of drivers that follow similar patterns and are going to generate exactly the same feedback. Posting a large batch of patches at once isn't a problem but if you're sending additional patches later on it'd be helpful to take into account the feedback that has already been given on prior serieses.

probably, but i'm not familiar with the ASoC stuff to fix/review any of this. i'll open another tracker item for these codecs. -mike
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#5 lore raw

Re: [Uclinux-dist-devel] [PATCH 2/6] ASoC: Blackfin: new machine driver for ADAU1361 codecs

Quoted 7 lines · Mike Frysinger
Quoted 1 line · Mark Brown

It'd be really helpful if you could do a bit more pre-review on the stuff you're posting, especially where you've got a bunch of drivers that follow similar patterns and are going to generate exactly the same feedback. Posting a large batch of patches at once isn't a problem but if you're sending additional patches later on it'd be helpful to take into account the feedback that has already been given on prior serieses.

probably, but i'm not familiar with the ASoC stuff to fix/review any of this. i'll open another tracker item for these codecs.

It'd probably be enough to just avoid posting additional batches of patches without incorporating previous review, either by just posting everything in one series or by holding off on later ones after getting the first batch of review. The reason I mentioned this was that I'd already reviewed previous postings (and seen that you'd read my review) but was noticing many of the same issues cropping up in the new postings.

#6 lore raw

Re: [Uclinux-dist-devel] [PATCH 2/6] ASoC: Blackfin: new machine driver for ADAU1361 codecs

Quoted 9 lines · Mark Brown
Quoted 6 lines · Mike Frysinger
Quoted 1 line · Mark Brown

It'd be really helpful if you could do a bit more pre-review on the stuff you're posting, especially where you've got a bunch of drivers that follow similar patterns and are going to generate exactly the same feedback. Posting a large batch of patches at once isn't a problem but if you're sending additional patches later on it'd be helpful to take into account the feedback that has already been given on prior serieses.

probably, but i'm not familiar with the ASoC stuff to fix/review any of this.  i'll open another tracker item for these codecs.

It'd probably be enough to just avoid posting additional batches of patches without incorporating previous review, either by just posting everything in one series or by holding off on later ones after getting the first batch of review. The reason I mentioned this was that I'd already reviewed previous postings (and seen that you'd read my review) but was noticing many of the same issues cropping up in the new postings.

i'd like to have sent these out as one batch, but it takes time for me to clean up the commits being sent to me. you'd probably barf all over the changesets that i have to process ;).

i dont have any other codec drivers atm though. just bug fixes that i need to further clean up/split/document/etc...
-mike
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#7 lore raw

PATCH 5/6 ASoC: new ADAU1761 codec driver

In reply to a message not in the archive

From: Cliff Cai <[email protected]>

---
 sound/soc/codecs/Kconfig    |    5 +
 sound/soc/codecs/Makefile   |    2 +
 sound/soc/codecs/adau1761.c | 1077 +++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/adau1761.h |  320 +++++++++++++
 4 files changed, 1404 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/codecs/adau1761.c
 create mode 100644 sound/soc/codecs/adau1761.h
sound/soc/codecs/Kconfig +5 -0
index e7195ca..79f2b5e 100644
@@ -18,6 +18,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_AD73311 if I2C
 	select SND_SOC_ADAU1361 if I2C
 	select SND_SOC_ADAU1381 if I2C
+	select SND_SOC_ADAU1761 if I2C
 	select SND_SOC_ADAV80X if SND_SOC_I2C_AND_SPI
 	select SND_SOC_ADS117X
 	select SND_SOC_AK4104 if SPI_MASTER
@@ -112,6 +113,10 @@ config SND_SOC_ADAU1361
 config SND_SOC_ADAU1381
 	tristate
 
+config SND_SOC_ADAU1761
+	tristate
+	select SIGMA
+
 config SND_SOC_ADAV80X
 	tristate
 
sound/soc/codecs/Makefile +2 -0
index 887ff5d..3eb7dcf 100644
@@ -5,6 +5,7 @@ snd-soc-ad1980-objs := ad1980.o
 snd-soc-ad73311-objs := ad73311.o
 snd-soc-adau1361-objs := adau1361.o
 snd-soc-adau1381-objs := adau1381.o
+snd-soc-adau1761-objs := adau1761.o
 snd-soc-adav80x-objs := adav80x.o
 snd-soc-ads117x-objs := ads117x.o
 snd-soc-ak4104-objs := ak4104.o
@@ -74,6 +75,7 @@ obj-$(CONFIG_SND_SOC_AD1980)	+= snd-soc-ad1980.o
 obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o
 obj-$(CONFIG_SND_SOC_ADAU1361)	+= snd-soc-adau1361.o
 obj-$(CONFIG_SND_SOC_ADAU1381)	+= snd-soc-adau1381.o
+obj-$(CONFIG_SND_SOC_ADAU1761)	+= snd-soc-adau1761.o
 obj-$(CONFIG_SND_SOC_ADAV80X)	+= snd-soc-adav80x.o
 obj-$(CONFIG_SND_SOC_ADS117X)	+= snd-soc-ads117x.o
 obj-$(CONFIG_SND_SOC_AK4104)	+= snd-soc-ak4104.o
sound/soc/codecs/adau1761.c new file +1077 -0

1,077 lines not on this page · raw message

sound/soc/codecs/adau1761.h new file +320 -0

320 lines not on this page · raw message

Signature · 1 line
1.7.2
#8 lore raw

Re: [PATCH 5/6] ASoC: new ADAU1761 codec driver

sound/soc/codecs/Kconfig config SND_SOC_ADAU1361 · line 119

Quoted 4 lines · Mike Frysinger
sound/soc/codecs/Kconfig +4 -0
+config SND_SOC_ADAU1761
+	tristate
+	select SIGMA
+

What is SIGMA?

sound/soc/codecs/adau1761.c line 36

Quoted 4 lines
sound/soc/codecs/adau1761.c new file +4 -0
+#define CAP_MIC  1
+#define CAP_LINE 2
+#define CAPTURE_SOURCE_NUMBER 2
+#define ADAU1761_DIG_MIC 0

So, it looks like there's an awful lot of similarity between this and some of the other drivers. I'm going to skip a lot of repetitive comments but please assume that points which can be applied to this driver do apply.

sound/soc/codecs/adau1761.c line 302

Quoted 4 lines
sound/soc/codecs/adau1761.c new file +4 -0
+static const struct snd_kcontrol_new adau1761_right_mixer_controls[] = {
+SOC_DAPM_SINGLE("LineRight Bypass Switch", ADAU_PLBLOVR-ADAU_FIRSTREG, 1, 1, 0),
+SOC_DAPM_SINGLE("HPRight Bypass Switch", ADAU_PLBHPVR-ADAU_FIRSTREG, 1, 1, 0),
+};

Remember that the name of the mixer will be prepended to these - you can probably drop the Rights.

sound/soc/codecs/adau1761.c line 650

Quoted 3 lines
sound/soc/codecs/adau1761.c new file +3 -0
+	snd_soc_write(codec, ADAU_DSP_RUN, 0x0);
+	reg = snd_soc_read(codec, ADAU_CLKCTRL);
+	snd_soc_write(codec, ADAU_CLKCTRL, reg & ~0x1);

I suspect the DSP power may warrant being managed via DAPM.

Quoted 5 lines
sound/soc/codecs/adau1761.c new file +5 -0
+static ssize_t adau1371_dsp_load(struct device *dev,
+				  struct device_attribute *attr,
+				  const char *buf, size_t count)
+{
+	struct snd_soc_device *socdev = dev_get_drvdata(dev);

sound/soc/codecs/adau1761.c line 940

Quoted 10 lines
sound/soc/codecs/adau1761.c new file +10 -0
+	struct snd_soc_codec *codec = socdev->card->codec;
+	int ret = 0;
+
+	ret = adau1761_setprogram(codec);
+	if (ret)
+		return ret;
+	else
+		return count;
+}
+static DEVICE_ATTR(dsp, 0644, NULL, adau1371_dsp_load);

This looks redundant - it doesn't offer any opportunity to configure the firmware to download and you're already (as one one would expect) automatically downloading the firmware. If this is being exposed at all it should be via debugfs.

The permissions also look wrong given that you don't have a read function.

#9 lore raw

Re: [Uclinux-dist-devel] [PATCH 5/6] ASoC: new ADAU1761 codec driver

Quoted 7 lines · Mark Brown

sound/soc/codecs/Kconfig config SND_SOC_ADAU1361 · line 119

Quoted 4 lines · Mike Frysinger
sound/soc/codecs/Kconfig +4 -0
+config SND_SOC_ADAU1761
+     tristate
+     select SIGMA
+

What is SIGMA?

it's a new firmware loader that's standardized across SigmaDSP parts. i (correctly) assumed this driver wasnt going to be accepted right away, so i wanted to get feedback in parallel to the firmware loader being merged.

Quoted 9 lines
Quoted 9 lines
sound/soc/codecs/adau1761.c new file +9 -0
+static ssize_t adau1371_dsp_load(struct device *dev,
+                               struct device_attribute *attr,
+                               const char *buf, size_t count)
+{
+     struct snd_soc_device *socdev = dev_get_drvdata(dev);
+     struct snd_soc_codec *codec = socdev->card->codec;
+     int ret = 0;
+
+     ret = adau1761_setprogram(codec);
Quoted 8 lines

sound/soc/codecs/adau1761.c line 940

Quoted 6 lines

+     if (ret)
+             return ret;
+     else
+             return count;

sound/soc/codecs/adau1761.c new file +2 -0
+}
+static DEVICE_ATTR(dsp, 0644, NULL, adau1371_dsp_load);

This looks redundant - it doesn't offer any opportunity to configure the firmware to download and you're already (as one one would expect) automatically downloading the firmware. If this is being exposed at all it should be via debugfs.

SigmaDSP parts have the ability to change firmwares on the fly. this isnt a debug feature, it's somewhat core to these parts. idea being that you can load up different mini signal processing engines based on the current needs.
-mike
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#10 lore raw

Re: [Uclinux-dist-devel] [PATCH 5/6] ASoC: new ADAU1761 codec driver

Quoted 18 lines · Mike Frysinger
Quoted 9 lines
Quoted 9 lines
sound/soc/codecs/adau1761.c new file +9 -0
+static ssize_t adau1371_dsp_load(struct device *dev,
+                               struct device_attribute *attr,
+                               const char *buf, size_t count)
+{
+     struct snd_soc_device *socdev = dev_get_drvdata(dev);
+     struct snd_soc_codec *codec = socdev->card->codec;
+     int ret = 0;
+
+     ret = adau1761_setprogram(codec);
Quoted 8 lines

sound/soc/codecs/adau1761.c line 940

Quoted 6 lines
sound/soc/codecs/adau1761.c new file +6 -0
+     if (ret)
+             return ret;
+     else
+             return count;
+}
+static DEVICE_ATTR(dsp, 0644, NULL, adau1371_dsp_load);

This looks redundant - it doesn't offer any opportunity to configure the firmware to download and you're already (as one one would expect) automatically downloading the firmware. If this is being exposed at all it should be via debugfs.

Quoted 4 lines

SigmaDSP parts have the ability to change firmwares on the fly. this isnt a debug feature, it's somewhat core to these parts. idea being that you can load up different mini signal processing engines based on the current needs.

Right, but see my point about there being no opportunity to configure the firmware - if you were allowing the user to select between multiple firmwares available then I expect that the value written into the sysfs file would be parsed as the name of the new firmware file to load or otherwise select a new firmware. With the current code the value written is totally ignored and the application layer has to overwrite the firmware in the filesystem (or have a custom helper program which does the equivalent thereof) so as far as the kernel is concerned it's going to reload the same firmware which isn't ideal.

#11 lore raw

Re: [Uclinux-dist-devel] [PATCH 5/6] ASoC: new ADAU1761 codec driver

Quoted 27 lines · Mark Brown
Quoted 21 lines · Mike Frysinger
Quoted 12 lines
Quoted 12 lines
sound/soc/codecs/adau1761.c new file +12 -0
+static ssize_t adau1371_dsp_load(struct device *dev,
+                               struct device_attribute *attr,
+                               const char *buf, size_t count)
+{
+     struct snd_soc_device *socdev = dev_get_drvdata(dev);
+     struct snd_soc_codec *codec = socdev->card->codec;
+     int ret = 0;
+
+     ret = adau1761_setprogram(codec);
+     if (ret)
+             return ret;
+     else
Quoted 8 lines

sound/soc/codecs/adau1761.c line 940

Quoted 3 lines

+             return count;

sound/soc/codecs/adau1761.c new file +2 -0
+}
+static DEVICE_ATTR(dsp, 0644, NULL, adau1371_dsp_load);

This looks redundant - it doesn't offer any opportunity to configure the firmware to download and you're already (as one one would expect) automatically downloading the firmware. If this is being exposed at all it should be via debugfs.

Quoted 4 lines

SigmaDSP parts have the ability to change firmwares on the fly.  this isnt a debug feature, it's somewhat core to these parts.  idea being that you can load up different mini signal processing engines based on the current needs.

Quoted 9 lines

Right, but see my point about there being no opportunity to configure the firmware - if you were allowing the user to select between multiple firmwares available then I expect that the value written into the sysfs file would be parsed as the name of the new firmware file to load or otherwise select a new firmware. With the current code the value written is totally ignored and the application layer has to overwrite the firmware in the filesystem (or have a custom helper program which does the equivalent thereof) so as far as the kernel is concerned it's going to reload the same firmware which isn't ideal.

yes, that is the current limitation that'll need to be fixed. not a big hassle for us to replace the file when doing initial testing ;). -mike
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#12 lore raw

Re: [Uclinux-dist-devel] [PATCH 5/6] ASoC: new ADAU1761 codec driver

Quoted 2 lines · Mike Frysinger

yes, that is the current limitation that'll need to be fixed. not a big hassle for us to replace the file when doing initial testing ;).

Sure, which is why I say that if you're going to expose this feature in this manner it should be via debugfs. That's the place for this sort of development only hack.

#13 lore raw

PATCH 6/6 ASoC: Blackfin: new machine driver for ADAU1761 codecs

In reply to a message not in the archive

From: Cliff Cai <[email protected]>

---
 sound/soc/blackfin/Kconfig          |    9 ++
 sound/soc/blackfin/Makefile         |    2 +
 sound/soc/blackfin/bf5xx-adau1761.c |  144 +++++++++++++++++++++++++++++++++++
 3 files changed, 155 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/blackfin/bf5xx-adau1761.c
sound/soc/blackfin/Kconfig +9 -0
index 5df4e4b..64b90c1 100644
@@ -50,6 +50,15 @@ config SND_BF5XX_SOC_ADAU1381
 	help
 	  Say Y if you want to add support for ADAU1381 SoC audio.
 
+config SND_BF5XX_SOC_ADAU1761
+	tristate "SoC ADAU1761 Audio support"
+	depends on SND_BF5XX_I2S
+	select SND_BF5XX_SOC_I2S
+	select SND_SOC_ADAU1761
+	select I2C
+	help
+	  Say Y if you want to add support for ADAU1761 SoC audio.
+
 config SND_BF5XX_SOC_ADAV80X
 	tristate "SoC ADAV801/3 Audio support"
 	depends on SND_BF5XX_I2S && (SPI_MASTER || I2C)
sound/soc/blackfin/Makefile +2 -0
index 02bb207..33449b9 100644
@@ -23,6 +23,7 @@ snd-ad73311-objs := bf5xx-ad73311.o
 snd-ad193x-objs := bf5xx-ad193x.o
 snd-adau1361-objs := bf5xx-adau1361.o
 snd-adau1381-objs := bf5xx-adau1381.o
+snd-adau1761-objs := bf5xx-adau1761.o
 snd-adav80x-objs := bf5xx-adav80x.o
 
 obj-$(CONFIG_SND_BF5XX_SOC_AD1836) += snd-ad1836.o
@@ -32,4 +33,5 @@ obj-$(CONFIG_SND_BF5XX_SOC_AD73311) += snd-ad73311.o
 obj-$(CONFIG_SND_BF5XX_SOC_AD193X) += snd-ad193x.o
 obj-$(CONFIG_SND_BF5XX_SOC_ADAU1361) += snd-adau1361.o
 obj-$(CONFIG_SND_BF5XX_SOC_ADAU1381) += snd-adau1381.o
+obj-$(CONFIG_SND_BF5XX_SOC_ADAU1761) += snd-adau1761.o
 obj-$(CONFIG_SND_BF5XX_SOC_ADAV80X) += snd-adav80x.o
sound/soc/blackfin/bf5xx-adau1761.c new file +144 -0

144 lines not on this page · raw message

Signature · 1 line
1.7.2
#14 lore raw

PATCH 3/6 ASoC: new ADAU1381 codec driver

In reply to Mike Frysinger

From: Cliff Cai <[email protected]>

---
 sound/soc/codecs/Kconfig    |    4 +
 sound/soc/codecs/Makefile   |    2 +
 sound/soc/codecs/adau1381.c |  842 +++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/adau1381.h |  222 ++++++++++++
 4 files changed, 1070 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/codecs/adau1381.c
 create mode 100644 sound/soc/codecs/adau1381.h
sound/soc/codecs/Kconfig +4 -0
index f37d5f4..e7195ca 100644
@@ -17,6 +17,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_AD1980 if SND_SOC_AC97_BUS
 	select SND_SOC_AD73311 if I2C
 	select SND_SOC_ADAU1361 if I2C
+	select SND_SOC_ADAU1381 if I2C
 	select SND_SOC_ADAV80X if SND_SOC_I2C_AND_SPI
 	select SND_SOC_ADS117X
 	select SND_SOC_AK4104 if SPI_MASTER
@@ -108,6 +109,9 @@ config SND_SOC_AD73311
 config SND_SOC_ADAU1361
 	tristate
 
+config SND_SOC_ADAU1381
+	tristate
+
 config SND_SOC_ADAV80X
 	tristate
 
sound/soc/codecs/Makefile +2 -0
index d05b672..887ff5d 100644
@@ -4,6 +4,7 @@ snd-soc-ad193x-objs := ad193x.o
 snd-soc-ad1980-objs := ad1980.o
 snd-soc-ad73311-objs := ad73311.o
 snd-soc-adau1361-objs := adau1361.o
+snd-soc-adau1381-objs := adau1381.o
 snd-soc-adav80x-objs := adav80x.o
 snd-soc-ads117x-objs := ads117x.o
 snd-soc-ak4104-objs := ak4104.o
@@ -72,6 +73,7 @@ obj-$(CONFIG_SND_SOC_AD193X)	+= snd-soc-ad193x.o
 obj-$(CONFIG_SND_SOC_AD1980)	+= snd-soc-ad1980.o
 obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o
 obj-$(CONFIG_SND_SOC_ADAU1361)	+= snd-soc-adau1361.o
+obj-$(CONFIG_SND_SOC_ADAU1381)	+= snd-soc-adau1381.o
 obj-$(CONFIG_SND_SOC_ADAV80X)	+= snd-soc-adav80x.o
 obj-$(CONFIG_SND_SOC_ADS117X)	+= snd-soc-ads117x.o
 obj-$(CONFIG_SND_SOC_AK4104)	+= snd-soc-ak4104.o
sound/soc/codecs/adau1381.c new file +842 -0

842 lines not on this page · raw message

sound/soc/codecs/adau1381.h new file +222 -0

222 lines not on this page · raw message

Signature · 1 line
1.7.2
#15 lore raw

Re: [PATCH 3/6] ASoC: new ADAU1381 codec driver

Quoted 4 lines · Mike Frysinger

From: Cliff Cai <[email protected]>

As with all your other postings today this needs to be redone based on the multi-component branch. It is safe to assume that any new drivers like this ought to be done against the multi-component branch.

sound/soc/codecs/adau1381.c line 29

Quoted 2 lines
sound/soc/codecs/adau1381.c new file +2 -0
+#define AUDIO_NAME "adau1381"
+#define ADAU1381_VERSION "0.1"

Remove the version number at least.

sound/soc/codecs/adau1381.c line 34

Quoted 4 lines
sound/soc/codecs/adau1381.c new file +4 -0
+#define CAP_MIC  1
+#define CAP_LINE 2
+#define CAPTURE_SOURCE_NUMBER 2
+#define ADAU1381_DIG_MIC 0

No ifdefs, this is all stuff that should be configured by the machine driver for the particular board rather than hard coded by the CODEC.

This comes back to the issue I keep raising with the way you guys are doing machine drivers. The machine drivers should describe how a particular board is set up while all the Blackfin machine drivers are producing a "generic" machine driver which attempts to cover all possible machines, which results in things like this and the SPORT stuff in Kconfig as soon as you get even a mildly flexible system setup. It really would be a good idea to fix up your machine drivers to use the framework in the intended fashion, especially as people start deploying more flexible CODECs in conjunction with Blackfin.

Review

Quoted 2 lines
(quoted diff) +2 -0
+	if (i2c_master_recv(codec->control_data, buf, len) != len)
+		return -EIO;

If i2c_master_recv() gave you an error code you should return that. -EIO is reasonable for short reads.

sound/soc/codecs/adau1381.c line 170

Quoted 9 lines
sound/soc/codecs/adau1381.c new file +9 -0
+#if !defined(ADAU1381_DIG_MIC)
+SND_SOC_DAPM_MICBIAS("Mic Bias", ADAU_RECMBIA-ADAU_FIRSTREG, 0, 0),
+SND_SOC_DAPM_MIXER("Left Mic Mixer", ADAU_RECVLCL-ADAU_FIRSTREG, 0, 0, NULL, 0),
+SND_SOC_DAPM_MIXER("Right Mic Mixer", ADAU_RECVLCR-ADAU_FIRSTREG, 0, 0, NULL, 0),
+#else
+SND_SOC_DAPM_MICBIAS("Mic Bias Left", SND_SOC_NOPM, 1, 0),
+SND_SOC_DAPM_MICBIAS("Mic Bias Right", SND_SOC_NOPM, 1, 0),
+SND_SOC_DAPM_MIXER("Left Mic Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
+SND_SOC_DAPM_MIXER("Right Mic Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),

It's difficult to see the point of the two biases here - they're not representing anything in the chip (they're _NOPM).

sound/soc/codecs/adau1381.c line 430

Quoted 10 lines
sound/soc/codecs/adau1381.c new file +10 -0
+	snd_soc_write(codec, ADAU_DIGPWR0, 0xF3);
+	snd_soc_write(codec, ADAU_DIGPWR0, 0x0D);
+	reg = (snd_soc_read(codec, ADAU_CONVCT0) & 0xF8) | reg;
+	snd_soc_write(codec, ADAU_CONVCT0, reg);
+	reg = (snd_soc_read(codec, ADAU_SAMRATE)) | reg;
+	snd_soc_write(codec, ADAU_SAMRATE, reg);
+
+	reg = (snd_soc_read(codec, ADAU_FRMRATE)) | reg;
+	snd_soc_write(codec, ADAU_FRMRATE, reg);
+	snd_soc_write(codec, ADAU_ENGIRUN, 0x01);

It's hard to tell what all this is doing due to the use of magic numbers but it feels like something that'd be better done through the power management infrastructure (either DAPM or the bias level configuration) rather than this.

sound/soc/codecs/adau1381.c line 470

Quoted 12 lines
sound/soc/codecs/adau1381.c new file +12 -0
+	/* set master/slave audio interface */
+	reg = (snd_soc_read(codec, ADAU_SPRTCT0) & 0xFE);
+	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
+	case SND_SOC_DAIFMT_CBM_CFM:  /*master*/
+		reg |= 0x1;
+		break;
+	case SND_SOC_DAIFMT_CBS_CFS: /*slave*/
+		reg &= ~0x1;
+		break;
+	default:
+		return 0;
+	}

Here and elsewhere in the driver I'd expect the default case to return an error rather than zero when it's bombing out.

sound/soc/codecs/adau1381.c line 514

Quoted 11 lines
sound/soc/codecs/adau1381.c new file +11 -0
+	switch (freq) {
+	case 12000000:
+		adau1381->sysclk = freq;
+		return 0;
+	case 12288000:
+		adau1381->sysclk = freq;
+		return 0;
+	}
+
+	/* supported 12MHz MCLK only for now */
+	return -EINVAL;

This comment is bit rotted - it'd probably be clearer to just use a default: case in the switch statement.

sound/soc/codecs/adau1381.c line 529

Quoted 3 lines
sound/soc/codecs/adau1381.c new file +3 -0
+	/* Only update pll when freq changes */
+	if (adau1381->pll_enable && adau1381->pll_out == freq_out)
+		return 0;

Given that you only store the value and don't actually reconfigure the PLL here this is redundant. Doesn't do any harm, though.

sound/soc/codecs/adau1381.c line 559

Quoted 4 lines
sound/soc/codecs/adau1381.c new file +4 -0
+	case SND_SOC_BIAS_STANDBY:
+		snd_soc_write(codec, ADAU_CLKCTRL,
+			(CLKCTRL_SRC_PLL | CLKCTRL_FRQ_1024 | CLKCTRL_DISABLE));
+		break;

What exactly is this doing? Looking at the bitfields being set it looks like it's doing something that ought to be done elsewhere.

sound/soc/codecs/adau1381.c line 652

Quoted 7 lines
sound/soc/codecs/adau1381.c new file +7 -0
+static int adau1381_resume(struct platform_device *pdev)
+{
+	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
+	struct snd_soc_codec *codec = socdev->card->codec;
+	struct adau1381_priv *adau1381 = codec->private_data;
+
+	adau1381->pdev = pdev;

Why is this being done here rather than on init? Though all this will change when you redo this against multi-component?

sound/soc/codecs/adau1381.c line 653

Quoted 1 line
sound/soc/codecs/adau1381.c new file +1 -0
+	schedule_work(&adau1381->resume_work);

Why are you deferring this to scheduled work? ASoC already defers all resume work for non-AC97 devices to a workqueue in order to minimise the impact of things like lengthy rise times for VMIDs and register restores over slow buses so adding an additional deferral seems odd. This code seems likely to cause problems since it's not synchronised with userspace at all (the ASoC core stuff is) which means that applications may start trying to use the device before the work has completed.

sound/soc/codecs/adau1381.c line 729

Quoted 7 lines
sound/soc/codecs/adau1381.c new file +7 -0
+	adau1381->in_source = CAP_MIC; /*default is mic input*/
+	adau1381->sysclk = ADAU1381_MCLK_RATE;
+	adau1381->pll_out = ADAU1381_PLL_FREQ_48;
+	adau1381->dapm_lineL = DAPM_LINE_DEF;
+	adau1381->dapm_lineR = DAPM_LINE_DEF;
+	adau1381->dapm_hpL = DAPM_HP_DEF;
+	adau1381->dapm_hpR = DAPM_HP_DEF;

As with your other drivers you should use chip defaults.

sound/soc/codecs/adau1381.h line 16

Quoted 4 lines
sound/soc/codecs/adau1381.h new file +4 -0
+struct adau1381_setup_data {
+	unsigned short i2c_bus;
+	unsigned short i2c_address;
+};

This shouldn't be here.

sound/soc/codecs/adau1381.h line 33

Quoted 8 lines
sound/soc/codecs/adau1381.h new file +8 -0
+#define MASTER_MODE 1
+#ifdef MASTER_MODE
+/* IIS mater mode*/
+#define ADAU_SRPT_CTRL0		0x01
+#else
+/* IIS slave mode*/
+#define ADAU_SRPT_CTRL0		0x00
+#endif

This should be controlled at runtime via set_dai_fmt(). There's also a namespace pollution issue with the define, but given that it shouldn't be there in the first place...

sound/soc/codecs/adau1381.h line 172

Quoted 7 lines
sound/soc/codecs/adau1381.h new file +7 -0
+/*
+ * Reset Mode - ADC capture/DAC playback
+ * (AInput mixers 0db, AOuput mixers 0db, HP out ON)
+*/
+static struct adau1381_mode_register adau1381_reset[RESET_REGISTER_COUNT] = {
+	/* mute outputs */
+	{ADAU_RGUCTRL, 0x00},

This and all the other tables need to be in the body of the driver rather than the header file. I'm somewhat surprised the compiler isn't complaining about this stuff.

sound/soc/codecs/adau1381.h line 179

Quoted 1 line
sound/soc/codecs/adau1381.h new file +1 -0
+	{ADAU_SPRTCT1, 0x21}, /*0x21 = 32bclocks frame, 0x41 = 48*/

Is this not the chip default?

#16 lore raw

PATCH 4/6 ASoC: Blackfin: new machine driver for ADAU1381 codecs

In reply to Mike Frysinger

From: Cliff Cai <[email protected]>

---
 sound/soc/blackfin/Kconfig          |    9 ++
 sound/soc/blackfin/Makefile         |    2 +
 sound/soc/blackfin/bf5xx-adau1381.c |  144 +++++++++++++++++++++++++++++++++++
 3 files changed, 155 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/blackfin/bf5xx-adau1381.c
sound/soc/blackfin/Kconfig +9 -0
index 56eb6c6..5df4e4b 100644
@@ -41,6 +41,15 @@ config SND_BF5XX_SOC_ADAU1361
 	help
 	  Say Y if you want to add support for ADAU1361 SoC audio.
 
+config SND_BF5XX_SOC_ADAU1381
+	tristate "SoC ADAU1381 Audio support"
+	depends on SND_BF5XX_I2S
+	select SND_BF5XX_SOC_I2S
+	select SND_SOC_ADAU1381
+	select I2C
+	help
+	  Say Y if you want to add support for ADAU1381 SoC audio.
+
 config SND_BF5XX_SOC_ADAV80X
 	tristate "SoC ADAV801/3 Audio support"
 	depends on SND_BF5XX_I2S && (SPI_MASTER || I2C)
sound/soc/blackfin/Makefile +2 -0
index 9de1fc9..02bb207 100644
@@ -22,6 +22,7 @@ snd-ssm2602-objs := bf5xx-ssm2602.o
 snd-ad73311-objs := bf5xx-ad73311.o
 snd-ad193x-objs := bf5xx-ad193x.o
 snd-adau1361-objs := bf5xx-adau1361.o
+snd-adau1381-objs := bf5xx-adau1381.o
 snd-adav80x-objs := bf5xx-adav80x.o
 
 obj-$(CONFIG_SND_BF5XX_SOC_AD1836) += snd-ad1836.o
@@ -30,4 +31,5 @@ obj-$(CONFIG_SND_BF5XX_SOC_SSM2602) += snd-ssm2602.o
 obj-$(CONFIG_SND_BF5XX_SOC_AD73311) += snd-ad73311.o
 obj-$(CONFIG_SND_BF5XX_SOC_AD193X) += snd-ad193x.o
 obj-$(CONFIG_SND_BF5XX_SOC_ADAU1361) += snd-adau1361.o
+obj-$(CONFIG_SND_BF5XX_SOC_ADAU1381) += snd-adau1381.o
 obj-$(CONFIG_SND_BF5XX_SOC_ADAV80X) += snd-adav80x.o
sound/soc/blackfin/bf5xx-adau1381.c new file +144 -0

144 lines not on this page · raw message

Signature · 1 line
1.7.2
#17 lore raw
In reply to Mike Frysinger

Hi Mike,

Quoted 4 lines · Mike Frysinger

From: Cliff Cai <[email protected]>

Quoted 8 lines
---
 sound/soc/codecs/Kconfig    |    4 +
 sound/soc/codecs/Makefile   |    2 +
 sound/soc/codecs/adau1361.c |  992 +++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/adau1361.h |  264 ++++++++++++
 4 files changed, 1262 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/codecs/adau1361.c
 create mode 100644 sound/soc/codecs/adau1361.h

As Mark has mentioned, please re-work your CODEC probe() and remove() calls against the soon to be merged multi-component branch :-

git://git.kernel.org/pub/scm/linux/kernel/git/lrg/asoc-2.6.git topic/multi-component

The machine drivers will also need modified to use the component dev_name() now instead of a pointer when creating a DAI link.

Thanks

Liam

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
#18 lore raw
In reply to Mike Frysinger

sound/soc/codecs/adau1361.c line 29

Quoted 2 lines · Mike Frysinger
sound/soc/codecs/adau1361.c new file +2 -0
+#define AUDIO_NAME "adau1361"
+#define ADAU1361_VERSION "0.1"

As ever, remove the version numbers and you need to convert to mullet-component.

sound/soc/codecs/adau1361.c line 33

Quoted 3 lines
sound/soc/codecs/adau1361.c new file +3 -0
+#define CAP_MIC  1
+#define CAP_LINE 2
+#define CAPTURE_SOURCE_NUMBER 2

This looks rather like more machine driver stuff.

sound/soc/codecs/adau1361.c line 92

Quoted 7 lines
sound/soc/codecs/adau1361.c new file +6 -0
+	/* dapm */
+	u8 dapm_lineL;
+	u8 dapm_lineR;
+	u8 dapm_hpL;
+	u8 dapm_hpR;
 
+	addr[0] = (u8)(reg >> 8);

I suspect the casts are redundant.

Review

Quoted 2 lines
(quoted diff) +2 -0
+	if (i2c_master_recv(codec->control_data, buf, len) != len)
+		return -EIO;

Pass back the error code if you got one.

sound/soc/codecs/adau1361.c line 129

Quoted 5 lines
sound/soc/codecs/adau1361.c new file +5 -0
+	if (codec->hw_write(codec->control_data, buf, count) == count)
+		return 0;
+	else {
+		dev_err(codec->dev, "address block write failed.");
+		return -EIO;

Likewise.

Quoted 13 lines
sound/soc/codecs/adau1361.c new file +13 -0
+static int adau1361_mux_put(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+	struct adau1361_priv *adau1361 = codec->private_data;
+	int src = ucontrol->value.integer.value[0];
+	u8 regvalue = 0;
+
+	if (src == 0) {/* Select Mic */
+		adau1361->in_source = CAP_MIC;
+#ifdef ADAU1361_DIG_MIC
+		regvalue = (snd_soc_read(codec, ADAU_ADCCTL0) & 0xFB)|0x4;
+		snd_soc_write(codec, ADAU_ADCCTL0, regvalue);

sound/soc/codecs/adau1361.c line 172

Quoted 10 lines
sound/soc/codecs/adau1361.c new file +10 -0
+#else
+		snd_soc_write(codec, ADAU_RECMBIA, RECMBIA_DISABLE);
+		regvalue = (snd_soc_read(codec, ADAU_RECVLCL)
+				| RECVLC_ENABLE_MASK);
+		snd_soc_write(codec, ADAU_RECVLCL, regvalue);
+		regvalue = (snd_soc_read(codec, ADAU_RECVLCR)
+				| RECVLC_ENABLE_MASK);
+		snd_soc_write(codec, ADAU_RECVLCR, regvalue);
+		snd_soc_write(codec, ADAU_RECMLC1, RECMLC_MIC_0DB);
+		snd_soc_write(codec, ADAU_RECMRC1, RECMLC_MIC_0DB);

As well as the issue with the configuration of the digital microphone with an ifdef rather than a runtime selection it looks rather like this register configuration is doing a bunch of stuff like configuring volume controls and power which I'd rather expect to be done elsewhere.

Quoted 9 lines
sound/soc/codecs/adau1361.c new file +9 -0
+static int adau1361_mic_boost_put(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+	struct adau1361_priv *adau1361 = codec->private_data;
+	int val = ucontrol->value.integer.value[0];
+	u8 regvalue = 0;
+
+	if (adau1361->in_source & CAP_MIC) {

sound/soc/codecs/adau1361.c line 230

Quoted 10 lines
sound/soc/codecs/adau1361.c new file +10 -0
+		regvalue = (val) ? RECMLC_MIC_20DB : RECMLC_MIC_0DB;
+		if (snd_soc_read(codec, ADAU_RECMLC1) != regvalue) {
+			snd_soc_write(codec, ADAU_RECMLC1, regvalue);
+			snd_soc_write(codec, ADAU_RECMRC1, regvalue);
+			return 1;
+		}
+	}
+
+	return 0;
+}

I'm having a hard time seeing why you're not just using standard controls here. You've also got a mono control exposed to the user but apparently stereo control in the chip - that seems restrictive for machine drivers (for example, a system might have a mono microphone plus a line input).

Quoted 7 lines
sound/soc/codecs/adau1361.c new file +6 -0
+static int adau1361_mute(struct snd_soc_dai *dai, int mute)
+{
+	struct snd_soc_codec *codec = dai->codec;
+	u8 reg = 0;
+
+	if (mute) {

sound/soc/codecs/adau1361.c line 273

Quoted 10 lines
sound/soc/codecs/adau1361.c new file +10 -0
+		/* mute inputs */
+		reg = (snd_soc_read(codec, ADAU_RECMLC0) & 0xFE) | 0x0;
+		snd_soc_write(codec, ADAU_RECMLC0, reg);
+		reg = (snd_soc_read(codec, ADAU_RECMRC0) & 0xFE) | 0x0;
+		snd_soc_write(codec, ADAU_RECMRC0, reg);
+		/* mute outputs */
+		reg = (snd_soc_read(codec, ADAU_PLBMLC0) & 0xFE) | 0x1;
+		snd_soc_write(codec, ADAU_PLBMLC0, reg);
+		reg = (snd_soc_read(codec, ADAU_PLBMRC0) & 0xFE) | 0x1;
+		snd_soc_write(codec, ADAU_PLBMRC0, reg);

Ick, no. Your mute control should be muting and unmuting the DAC only. Quite apart from anything else this is going to leave the inputs muted unless there's an active playback which seems likely to cause problems during recordings.

Quoted 5 lines
sound/soc/codecs/adau1361.c new file +5 -0
+static int adau1361_pll_enable(struct snd_soc_codec *codec, int enable)
+{
+	struct adau1361_priv *adau1361 = codec->private_data;
+	u8 *pll_reg = adau1361->adau1361_pll_reg;
+	int counter = 0;

sound/soc/codecs/adau1361.c line 470

Quoted 10 lines
sound/soc/codecs/adau1361.c new file +10 -0
+
+	if (enable) {
+		pll_reg[5]  = PLLCTRL_ENABLE;
+		adau1361_write_reg_block(codec, ADAU_PLLCTRL, 6, pll_reg);
+
+		/* wait for PLL lock*/
+		do {
+			++counter;
+			schedule_timeout_interruptible(msecs_to_jiffies(1));
+			adau1361_read_reg_block(codec, ADAU_PLLCTRL, 6);

Why interruptible?

sound/soc/codecs/adau1361.c line 474

Quoted 2 lines
sound/soc/codecs/adau1361.c new file +2 -0
+		if (counter >= 20)
+			return -1;

Return proper error codes.

sound/soc/codecs/adau1361.c line 514

Quoted 5 lines
sound/soc/codecs/adau1361.c new file +5 -0
+	/* unmute outputs */
+	snd_soc_write(codec, ADAU_PLBHPVL, DAPM_HP_DEF);
+	snd_soc_write(codec, ADAU_PLBHPVR, DAPM_HP_DEF);
+	snd_soc_write(codec, ADAU_PLBLOVL, DAPM_LINE_DEF);
+	snd_soc_write(codec, ADAU_PLBLOVR, DAPM_LINE_DEF);

Use chip defaults (this also applies to the register setting above).

sound/soc/codecs/adau1361.c line 551

Quoted 3 lines
sound/soc/codecs/adau1361.c new file +3 -0
+	/* initialize the PLL */
+	if (adau1361_pll_init(codec) != 0)
+		return -EINVAL;

Pass back the error code.

sound/soc/codecs/adau1361.c line 613

Quoted 11 lines
sound/soc/codecs/adau1361.c new file +11 -0
+	reg = (snd_soc_read(codec, ADAU_SPRTCT0) & 0xFE);
+	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
+	case SND_SOC_DAIFMT_CBM_CFM:  /*master*/
+		reg |= 0x1;
+		break;
+	case SND_SOC_DAIFMT_CBS_CFS: /*slave*/
+		reg &= ~0x1;
+		break;
+	default:
+		return 0;
+	}

Return an error if the mode is unsupported here and elsewhere.

Quoted 8 lines
sound/soc/codecs/adau1361.c new file +8 -0
+static int adau1361_set_dai_sysclk(struct snd_soc_dai *codec_dai,
+		int clk_id, unsigned int freq, int dir)
+{
+	struct snd_soc_codec *codec = codec_dai->codec;
+	struct adau1361_priv *adau1361 = codec->private_data;
+
+	switch (freq) {
+	case 12000000:

sound/soc/codecs/adau1361.c line 659

Quoted 10 lines
sound/soc/codecs/adau1361.c new file +10 -0
+		adau1361->sysclk = freq;
+		return 0;
+	case 12288000:
+		adau1361->sysclk = freq;
+		return 0;
+	}
+
+	/* supported 12MHz MCLK only for now */
+	return -EINVAL;
+

Similar comments to the previous driver here - use the default for the switch statement and your comment is bit. I've not made further comments on this but many of the issues in the driver I previously reviewed also apply here.