Skip to contentSkip to conversation

: AD1980 audio codec ASOC driver

PATCH In review Bryan Wu 4 participants 8 messages May 12, 2008 – May 13, 2008

Subsystems (3)
lore
Share & tools
lore

Bryan Wu

author
#0 lore raw

PATCH 1/1 : AD1980 audio codec ASOC driver

From: Cliff Cai <[email protected]>

---
 sound/soc/codecs/Kconfig  |    4 +
 sound/soc/codecs/Makefile |    2 +
 sound/soc/codecs/ad1980.c |  322 +++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/ad1980.h |   23 ++++
 4 files changed, 351 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/codecs/ad1980.c
 create mode 100644 sound/soc/codecs/ad1980.h
sound/soc/codecs/Kconfig +4 -0
index 3903ab7..62ef183 100644
@@ -2,6 +2,10 @@ config SND_SOC_AC97_CODEC
 	tristate
 	depends on SND_SOC
 
+config SND_SOC_AD1980
+	tristate
+	depends on SND_SOC
+
 config SND_SOC_WM8731
 	tristate
 	depends on SND_SOC
sound/soc/codecs/Makefile +2 -0
index 4e1314c..0568d32 100644
@@ -1,4 +1,5 @@
 snd-soc-ac97-objs := ac97.o
+snd-soc-ad1980-objs := ad1980.o
 snd-soc-wm8731-objs := wm8731.o
 snd-soc-wm8750-objs := wm8750.o
 snd-soc-wm8753-objs := wm8753.o
@@ -8,6 +9,7 @@ snd-soc-cs4270-objs := cs4270.o
 snd-soc-tlv320aic3x-objs := tlv320aic3x.o
 
 obj-$(CONFIG_SND_SOC_AC97_CODEC)	+= snd-soc-ac97.o
+obj-$(CONFIG_SND_SOC_AD1980)	+= snd-soc-ad1980.o
 obj-$(CONFIG_SND_SOC_WM8731)	+= snd-soc-wm8731.o
 obj-$(CONFIG_SND_SOC_WM8750)	+= snd-soc-wm8750.o
 obj-$(CONFIG_SND_SOC_WM8753)	+= snd-soc-wm8753.o
sound/soc/codecs/ad1980.c new file +322 -0

322 lines not on this page · raw message

sound/soc/codecs/ad1980.h new file +23 -0
new file mode 100644
index 0000000..5d4710d
@@ -0,0 +1,23 @@
+/*
+ * ad1980.h  --  ad1980 Soc Audio driver
+ */
+
+#ifndef _AD1980_H
+#define _AD1980_H
+/* Bit definition of Power-Down Control/Status Register */
+#define ADC		0x0001
+#define DAC		0x0002
+#define ANL		0x0004
+#define REF		0x0008
+#define PR0		0x0100
+#define PR1		0x0200
+#define PR2		0x0400
+#define PR3		0x0800
+#define PR4		0x1000
+#define PR5		0x2000
+#define PR6		0x4000
+
+extern struct snd_soc_codec_dai ad1980_dai;
+extern struct snd_soc_codec_device soc_codec_dev_ad1980;
+
+#endif
Signature · 1 line
1.5.5
#1 lore raw
Quoted 4 lines · Bryan Wu

From: Cliff Cai <[email protected]>

Thanks, I've applied this to the ASoC git tree. CCing in [email protected] - ALSA patches should go via there.

sound/soc/codecs/ad1980.c line 199

Quoted 10 lines
sound/soc/codecs/ad1980.c new file +10 -0
+static int ad1980_soc_suspend(struct platform_device *pdev,
+	pm_message_t state)
+{
+	return 0;
+}
+
+static int ad1980_soc_resume(struct platform_device *pdev)
+{
+	return 0;
+}

Are you sure about these? I would expect the suspend and resume functions to either do some register writes or be omitted if they don't do anything. Standard AC97 codecs would have some power management via register 0x26 if they were doing anything.

#2 lore raw
Quoted 1 line · Mark Brown

Thanks, I've applied this to the ASoC git tree. CCing in

...actually, it's already there so I've not applied it - sorry for the noise.

#3 lore raw
In reply to Mark Brown

ok,we will implement these two functions later.

Best Regards
Cliff Cai

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Monday, May 12, 2008 7:54 PM
To: Bryan Wu
Cc: [email protected]; [email protected]; Cliff Cai; [email protected]
Subject: Re: [PATCH 1/1] [ASOC]: AD1980 audio codec ASOC driver

Quoted 4 lines · Bryan Wu

From: Cliff Cai <[email protected]>

Thanks, I've applied this to the ASoC git tree. CCing in [email protected] - ALSA patches should go via there.

sound/soc/codecs/ad1980.c line 199

Quoted 9 lines
sound/soc/codecs/ad1980.c new file +9 -0
+static int ad1980_soc_suspend(struct platform_device *pdev,
+	pm_message_t state)
+{
+	return 0;
+}
+
+static int ad1980_soc_resume(struct platform_device *pdev) {
+	return 0;
+}

Are you sure about these? I would expect the suspend and resume functions to either do some register writes or be omitted if they don't do anything. Standard AC97 codecs would have some power management via register 0x26 if they were doing anything.

#4 lore raw
Quoted 1 line · Cliff

ok,we will implement these two functions later.

So they can be removed for now?

What's the current status of merging the Blackfin ASoC support? We've had patches in the ASoC git tree for some time (along with the AD1980 driver) - it'd be good to get everything merged into ALSA.

author
#5 lore raw
Quoted 7 lines · Mark Brown
Quoted 1 line · Cliff

ok,we will implement these two functions later.

So they can be removed for now?

What's the current status of merging the Blackfin ASoC support?

We plan to cleanup the Blackfin ASoC code, after that we will send out the code for merging.

Quoted 3 lines

We've had patches in the ASoC git tree for some time (along with the AD1980
driver) - it'd be good to get everything merged into ALSA.

Do you mean there is another version AD1980 in ASoC git tree?

Thanks
-Bryan

#6 lore raw
Quoted 6 lines · Bryan Wu

On Tue, May 13, 2008 at 10:01 PM, Mark Brown

Quoted 2 lines

We've had patches in the ASoC git tree for some time (along with the AD1980
driver) - it'd be good to get everything merged into ALSA.

Do you mean there is another version AD1980 in ASoC git tree?

We're carrying both AD1980 and Blackfin platform code. The AD1980 driver is currently identical to the one you just sent.

Everything is in the dev branch of:

git://opensource.wolfsonmicro.com/linux-2.6-asoc

#7 lore raw
In reply to Bryan Wu

At Mon, 12 May 2008 18:45:12 +0800,

Quoted 1 line · Bryan Wu
sound/soc/codecs/ad1980.c +0 -0

(snip)

sound/soc/codecs/ad1980.c line 104

Quoted 6 lines
sound/soc/codecs/ad1980.c +6 -0
+static int ad1980_add_controls(struct snd_soc_codec *codec)
+{
+	int err, i;
+
+	for (i = 0; i < ARRAY_SIZE(ad1980_snd_ac97_controls); i++) {
+		err = snd_ctl_add(codec->card, snd_soc_cnew( \

The backslash isn't needed.

sound/soc/codecs/ad1980.c line 119

Quoted 8 lines
sound/soc/codecs/ad1980.c +8 -0
+static unsigned int ac97_read(struct snd_soc_codec *codec,
+	unsigned int reg)
+{
+	u16 *cache = codec->reg_cache;
+
+	if (reg == AC97_RESET || reg == AC97_INT_PAGING || \
+			reg == AC97_POWERDOWN || reg == AC97_EXTENDED_STATUS  \
+			|| reg == AC97_VENDOR_ID1 || reg == AC97_VENDOR_ID2)

Ditto. Maybe a switch is a better choice here.

sound/soc/codecs/ad1980.c line 124

Quoted 5 lines
sound/soc/codecs/ad1980.c +5 -0
+		return soc_ac97_ops.read(codec->ac97, reg);
+	else {
+		reg = reg >> 1;
+
+		if (reg > (ARRAY_SIZE(ad1980_reg)))

Isn't it reg >= ARRAY_SIZE(ad1980_reg) ??

sound/soc/codecs/ad1980.c line 138

Quoted 8 lines
sound/soc/codecs/ad1980.c +8 -0
+static int ac97_write(struct snd_soc_codec *codec, unsigned int reg,
+	unsigned int val)
+{
+	u16 *cache = codec->reg_cache;
+
+	soc_ac97_ops.write(codec->ac97, reg, val);
+	reg = reg >> 1;
+	if (reg <= (ARRAY_SIZE(ad1980_reg)))

And reg < ARRAY_SIZE(ad1980_reg)

thanks,

Takashi