Skip to contentSkip to conversation

ASoC: codecs: Add DA9055 codec driver

PATCH Superseded Ashish Chavan 2 participants 4 messages Sep 14, 2012 – Sep 20, 2012

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ASoC: codecs: Add DA9055 codec driver

This patch adds support for Dialog semiconductor's DA9055 audio codec.

This has been tested on DA9055 EVB with Samsung SMDK6410 board.

---
Changes since v1:

- Made extensive use of DAPM throughout the driver
- Removed LDO, DMIC and other non used controls
- Corrected names for many controls
- Other minor improvements

---
 sound/soc/codecs/Kconfig  |    4 +
 sound/soc/codecs/Makefile |    2 +
 sound/soc/codecs/da9055.c | 1468 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1474 insertions(+), 0 deletions(-)
sound/soc/codecs/Kconfig +4 -0
index 3684255..b92759a 100644
@@ -37,6 +37,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_CX20442
 	select SND_SOC_DA7210 if I2C
 	select SND_SOC_DA732X if I2C
+	select SND_SOC_DA9055 if I2C
 	select SND_SOC_DFBMCS320
 	select SND_SOC_ISABELLE if I2C
 	select SND_SOC_JZ4740_CODEC
@@ -239,6 +240,9 @@ config SND_SOC_DA7210
 config SND_SOC_DA732X
         tristate
 
+config SND_SOC_DA9055
+	tristate
+
 config SND_SOC_DFBMCS320
 	tristate
 
sound/soc/codecs/Makefile +2 -0
index ca508b2..9bd4d95 100644
@@ -24,6 +24,7 @@ snd-soc-cs4271-objs := cs4271.o
 snd-soc-cx20442-objs := cx20442.o
 snd-soc-da7210-objs := da7210.o
 snd-soc-da732x-objs := da732x.o
+snd-soc-da9055-objs := da9055.o
 snd-soc-dfbmcs320-objs := dfbmcs320.o
 snd-soc-dmic-objs := dmic.o
 snd-soc-isabelle-objs := isabelle.o
@@ -144,6 +145,7 @@ obj-$(CONFIG_SND_SOC_CS4271)	+= snd-soc-cs4271.o
 obj-$(CONFIG_SND_SOC_CX20442)	+= snd-soc-cx20442.o
 obj-$(CONFIG_SND_SOC_DA7210)	+= snd-soc-da7210.o
 obj-$(CONFIG_SND_SOC_DA732X)	+= snd-soc-da732x.o
+obj-$(CONFIG_SND_SOC_DA9055)	+= snd-soc-da9055.o
 obj-$(CONFIG_SND_SOC_DFBMCS320)	+= snd-soc-dfbmcs320.o
 obj-$(CONFIG_SND_SOC_DMIC)	+= snd-soc-dmic.o
 obj-$(CONFIG_SND_SOC_ISABELLE)	+= snd-soc-isabelle.o
sound/soc/codecs/da9055.c new file +1468 -0

1,468 lines not on this page · raw message

Signature · 1 line
1.7.1
#1 lore raw

On Fri, Sep 14, 2012 at 04:57:37PM +0530, Ashish Chavan wrote:

This looks like a good improvement, a few issues remain though:

sound/soc/codecs/da9055.c line 631

Quoted 3 lines
sound/soc/codecs/da9055.c new file +3 -0
+	/* DAC Routing control */
+	SOC_ENUM("DAC Left Select", da9055_dac_l_select),
+	SOC_ENUM("DAC Right Select", da9055_dac_r_select),

DAPM. This even says its a routing control...

sound/soc/codecs/da9055.c line 642

Quoted 2 lines
sound/soc/codecs/da9055.c new file +2 -0
+	/* To select if MIC Bias powers MIC 1 or MIC 2 */
+	SOC_ENUM("Mic Bias Select", da9055_mic_bias_select),

This would normally be something controlled by the board... what exactly is this doing? How does the MICBIAS relate to the microphone inputs?

sound/soc/codecs/da9055.c line 1306

Quoted 8 lines
sound/soc/codecs/da9055.c new file +8 -0
+	case SND_SOC_BIAS_STANDBY:
+		if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
+			/* Enable VMID reference & master bias */
+			snd_soc_update_bits(codec, DA9055_REFERENCES,
+					    DA9055_VMID_EN | DA9055_BIAS_EN,
+					    DA9055_VMID_EN | DA9055_BIAS_EN);
+		}
+		regcache_sync(da9055->regmap);

Doing the sync every time is very odd, why is it only done on transitions from _OFF? Given that there's no regulator support here it's also a bit surprising that you need to do a sync outside of system suspend...

sound/soc/codecs/da9055.c line 1331

Quoted 2 lines
sound/soc/codecs/da9055.c new file +2 -0
+	da9055->mclk_rate       = 0;    /* This will be set from set_sysclk() */
+	da9055->master          = 0;    /* This will be set from set_fmt() */

You use kzalloc...

#2 lore raw
Quoted 6 lines

sound/soc/codecs/da9055.c line 631

Quoted 4 lines
sound/soc/codecs/da9055.c new file +3 -0
+	/* DAC Routing control */
+	SOC_ENUM("DAC Left Select", da9055_dac_l_select),
+	SOC_ENUM("DAC Right Select", da9055_dac_r_select),

DAPM. This even says its a routing control...

Yes, let me see if I can make it DAPM based.

Quoted 7 lines

sound/soc/codecs/da9055.c line 642

Quoted 3 lines
sound/soc/codecs/da9055.c new file +2 -0
+	/* To select if MIC Bias powers MIC 1 or MIC 2 */
+	SOC_ENUM("Mic Bias Select", da9055_mic_bias_select),

This would normally be something controlled by the board... what exactly is this doing? How does the MICBIAS relate to the microphone inputs?

Yes, it should be controlled by the board.
This control selects which of the two MIC Bias pins acts as the BIAS source. Earlier we misinterpreted it because of a hardware modification which was present on the board without our knowledge.

Quoted 12 lines

sound/soc/codecs/da9055.c line 1306

Quoted 9 lines
sound/soc/codecs/da9055.c new file +8 -0
+	case SND_SOC_BIAS_STANDBY:
+		if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
+			/* Enable VMID reference & master bias */
+			snd_soc_update_bits(codec, DA9055_REFERENCES,
+					    DA9055_VMID_EN | DA9055_BIAS_EN,
+					    DA9055_VMID_EN | DA9055_BIAS_EN);
+		}
+		regcache_sync(da9055->regmap);

Doing the sync every time is very odd, why is it only done on transitions from _OFF?

It was a typo :-( I intend to put the sync inside if().

Quoted 4 lines

Given that there's no regulator support here
it's also a bit surprising that you need to do a sync outside of system suspend...

I am not sure if I understood this fully. Do you mean a sync is not required here?

Quoted 5 lines

sound/soc/codecs/da9055.c line 1331

Quoted 2 lines
sound/soc/codecs/da9055.c new file +2 -0
+	da9055->mclk_rate       = 0;    /* This will be set from set_sysclk() */
+	da9055->master          = 0;    /* This will be set from set_fmt() */

You use kzalloc...

Yeah!

#3 lore raw
Quoted 11 lines · Ashish Chavan
Quoted 6 lines

sound/soc/codecs/da9055.c line 642

Quoted 2 lines
sound/soc/codecs/da9055.c new file +2 -0
+	/* To select if MIC Bias powers MIC 1 or MIC 2 */
+	SOC_ENUM("Mic Bias Select", da9055_mic_bias_select),

This would normally be something controlled by the board... what exactly is this doing? How does the MICBIAS relate to the microphone inputs?

Yes, it should be controlled by the board.
This control selects which of the two MIC Bias pins acts as the BIAS source. Earlier we misinterpreted it because of a hardware modification which was present on the board without our knowledge.

OK, that sounds like it should either be hooked up in the DAPM graph or supplied as platform data then.

Quoted 6 lines
Quoted 3 lines

Given that there's no regulator support here
it's also a bit surprising that you need to do a sync outside of system suspend...

I am not sure if I understood this fully. Do you mean a sync is not required here?

You only need to resync if the device might have lost power and forgotten it's register settings (or might've forgotten them for some other reason). If the device is left powered up then this isn't needed.