Skip to contentSkip to conversation

ASoC:Add support for cs42l73 codec

PATCH Superseded Brian Austin 3 participants 14 messages Oct 18, 2011 – Oct 21, 2011 1 message not in the archive

Subsystems (3)

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 ASoC:Add support for cs42l73 codec

This patch adds support for Cirrus Logic CS42L73
low power stereo codec

---
 sound/soc/codecs/Kconfig   |    4 +
 sound/soc/codecs/Makefile  |    2 +
 sound/soc/codecs/cs42l73.c | 1070 ++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/cs42l73.h |  227 ++++++++++
 4 files changed, 1303 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/codecs/cs42l73.c
 create mode 100644 sound/soc/codecs/cs42l73.h
sound/soc/codecs/Kconfig +4 -0
index 4584514..4f0ce61 100644
@@ -28,6 +28,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_ALC5623 if I2C
 	select SND_SOC_CQ0093VC if MFD_DAVINCI_VOICECODEC
 	select SND_SOC_CS42L51 if I2C
+	select SND_SOC_CS42L73 if I2C
 	select SND_SOC_CS4270 if I2C
 	select SND_SOC_CS4271 if SND_SOC_I2C_AND_SPI
 	select SND_SOC_CX20442
@@ -175,6 +176,9 @@ config SND_SOC_CQ0093VC
 config SND_SOC_CS42L51
 	tristate
 
+config SND_SOC_CS42L73
+	tristate
+
 # Cirrus Logic CS4270 Codec
 config SND_SOC_CS4270
 	tristate
sound/soc/codecs/Makefile +2 -0
index a2c7842..b271eb5 100644
@@ -15,6 +15,7 @@ snd-soc-ak4642-objs := ak4642.o
 snd-soc-ak4671-objs := ak4671.o
 snd-soc-cq93vc-objs := cq93vc.o
 snd-soc-cs42l51-objs := cs42l51.o
+snd-soc-cs42l73-objs := cs42l73.o
 snd-soc-cs4270-objs := cs4270.o
 snd-soc-cs4271-objs := cs4271.o
 snd-soc-cx20442-objs := cx20442.o
@@ -115,6 +116,7 @@ obj-$(CONFIG_SND_SOC_AK4671)	+= snd-soc-ak4671.o
 obj-$(CONFIG_SND_SOC_ALC5623)    += snd-soc-alc5623.o
 obj-$(CONFIG_SND_SOC_CQ0093VC) += snd-soc-cq93vc.o
 obj-$(CONFIG_SND_SOC_CS42L51)	+= snd-soc-cs42l51.o
+obj-$(CONFIG_SND_SOC_CS42L73)	+= snd-soc-cs42l73.o
 obj-$(CONFIG_SND_SOC_CS4270)	+= snd-soc-cs4270.o
 obj-$(CONFIG_SND_SOC_CS4271)	+= snd-soc-cs4271.o
 obj-$(CONFIG_SND_SOC_CX20442)	+= snd-soc-cx20442.o
sound/soc/codecs/cs42l73.c new file +1070 -0

1,070 lines not on this page · raw message

sound/soc/codecs/cs42l73.h new file +227 -0

227 lines not on this page · raw message

Signature · 1 line
1.7.6.3
#1 lore raw
Quoted 4 lines · Brian Austin
sound/soc/codecs/cs42l73.c new file +4 -0
+static const struct snd_soc_dapm_route cs42l73_audio_map[] = {
+
+       {"HPOUT", NULL, "HP Amp"},
+       {"LINEOUT", NULL, "LO Amp"},

sound/soc/codecs/cs42l73.c line 440

Quoted 10 lines
sound/soc/codecs/cs42l73.c new file +10 -0
+       {"SPKOUT", NULL, "SPK Amp"},
+       {"EAROUT", NULL, "EAR Amp"},
+       {"SPKLINEOUT", NULL, "SPKLO Amp"},
+
+       {"HP Amp", "Switch", "DAC1"},
+       {"LO Amp", "Switch", "DAC1"},
+       {"SPK Amp", "Switch", "DAC2"},
+       {"SPKLO Amp", "Switch", "DAC2"},
+       {"EAR Amp", "Switch", "DAC2"},
+ 

Since you have a mixer in codec before each of the amp, who is going to configure those? And how are they represented here?

Signature · 1 line
~Vinod
#2 lore raw
Quoted 22 lines · Vinod Koul
Quoted 4 lines · Brian Austin
sound/soc/codecs/cs42l73.c new file +4 -0
+static const struct snd_soc_dapm_route cs42l73_audio_map[] = {
+
+       {"HPOUT", NULL, "HP Amp"},
+       {"LINEOUT", NULL, "LO Amp"},

sound/soc/codecs/cs42l73.c line 440

Quoted 10 lines
sound/soc/codecs/cs42l73.c new file +10 -0
+       {"SPKOUT", NULL, "SPK Amp"},
+       {"EAROUT", NULL, "EAR Amp"},
+       {"SPKLINEOUT", NULL, "SPKLO Amp"},
+
+       {"HP Amp", "Switch", "DAC1"},
+       {"LO Amp", "Switch", "DAC1"},
+       {"SPK Amp", "Switch", "DAC2"},
+       {"SPKLO Amp", "Switch", "DAC2"},
+       {"EAR Amp", "Switch", "DAC2"},
+ 

Since you have a mixer in codec before each of the amp, who is going to configure those? And how are they represented here?

Signature · 1 line
~Vinod

The mixer in the codec is configured by the Attenuation mixer controls. You then select the mono/stereo output with the xSP Output Mixer Select. I didn't think we needed to represent that in the DAPM map.

#3 lore raw
Quoted 3 lines · Brian

The mixer in the codec is configured by the Attenuation mixer controls. You then select the mono/stereo output with the xSP Output Mixer Select. I didn't think we needed to represent that in the DAPM map.

That would be *extremely* surprising given that DAPM is supposed to understand the audio routing through the CODEC so it can tell where the connected audio paths go. Doesn't your current design cause too much of the device to be powered up?

#4 lore raw
Quoted 10 lines · Mark Brown
Quoted 3 lines · Brian

The mixer in the codec is configured by the Attenuation mixer controls. You then select the mono/stereo output with the xSP Output Mixer Select. I didn't think we needed to represent that in the DAPM map.

That would be *extremely* surprising given that DAPM is supposed to understand the audio routing through the CODEC so it can tell where the connected audio paths go. Doesn't your current design cause too much of the device to be powered up?

Precisely why this should be controlled by DAPM :)

Signature · 1 line
~Vinod
#5 lore raw
Quoted 7 lines · Vinod Koul
Quoted 6 lines · Mark Brown
Quoted 3 lines · Brian

The mixer in the codec is configured by the Attenuation mixer controls. You then select the mono/stereo output with the xSP Output Mixer Select. I didn't think we needed to represent that in the DAPM map.

Quoted 14 lines
Quoted 4 lines

That would be *extremely* surprising given that DAPM is supposed to understand the audio routing through the CODEC so it can tell where the connected audio paths go. Doesn't your current design cause too much of the device to be powered up?

Precisely why this should be controlled by DAPM :)

Signature · 6 lines
~Vinod

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

With the current mixer settings enabling the AMP to be used for output, the power is exactly where it is supposed to be.

#6 lore raw
Quoted 2 lines · Brian

With the current mixer settings enabling the AMP to be used for output, the power is exactly where it is supposed to be.

Could you explain how this works please? It may be that we're just missing something about how the chip power is managed here but what you're describing is definitely not normal.

#7 lore raw
Quoted 9 lines · Mark Brown
Quoted 2 lines · Brian

With the current mixer settings enabling the AMP to be used for output, the power is exactly where it is supposed to be.

Could you explain how this works please? It may be that we're just missing something about how the chip power is managed here but what you're describing is definitely not normal.

OK. Yeah, the chip is different as far as how power is managed internally. It can also be that I am missing something wrt how this DAPM mapping is supposed to work.

Let me write something up and I'll send it.

Thanks

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw
Quoted 1 line · Georgi Vlaev

Hello,

Don't top post.

Quoted 1 line

The codec has 2 basic groups of power control bits:

You're describing some features that don't sound at all unusual here... I'm not sure what point you're trying to make here?

#10 lore raw
Quoted 10 lines · Mark Brown
Quoted 1 line · Georgi Vlaev

Hello,

Don't top post.

Quoted 1 line

The codec has 2 basic groups of power control bits:

You're describing some features that don't sound at all unusual here... I'm not sure what point you're trying to make here?

We have only 2 power domains. The input PCM and the output AMP. The routing between these 2 points in the codec is handled by volume levels.

Say I am routing through the XSP port to the HP. If I power the HP Amp and adjust the HP-XSP volume level, the route is then established. I could also adjust the SPK-XSP volume and power the SPK Amp to route the stream to the Speaker as well.

Given that, why would there be a need to show all routes through the mixer in a DAPM context? How do you show that?

would it look something like this?

{"HPOUT", NULL, "HP Amp"}
{"HP Amp", "Amp Switch", "DAC1"}
{"DAC1", "HP-XSP Volume Control", "XSPIN"}

You can represent the "HP-XSP Volume Control" control as DAPM?

#11 lore raw

On Thu, Oct 20, 2011 at 08:26:11PM +0000, Austin, Brian wrote:

Fix your mailer to word wrap within paragraphs, I've reflowed for legibility.

Quoted 2 lines

We have only 2 power domains. The input PCM and the output AMP. The routing between these 2 points in the codec is handled by volume levels.

Like I say this is pretty unremarkable - the volumes are your DAPM routing controls.

Quoted 3 lines

Given that, why would there be a need to show all routes through the mixer in a DAPM context? How do you show that? would it look something like this?

Well, the most obvious issue is that even if your device doesn't have any useful internal power management there may be external devices connected to the outputs (eg, a high power speaker amp) which do and so we need to know which outputs are actually active in order to control the outputs.

Quoted 3 lines

{"HPOUT", NULL, "HP Amp"}
{"HP Amp", "Amp Switch", "DAC1"}
{"DAC1", "HP-XSP Volume Control", "XSPIN"}

This looks wrong, the control on the DAC looks like it actually controls just the one input path.

Quoted 1 line

You can represent the "HP-XSP Volume Control" control as DAPM?

Yes.

#12 lore raw
Quoted 15 lines · Mark Brown

On Thu, Oct 20, 2011 at 08:26:11PM +0000, Austin, Brian wrote:

Fix your mailer to word wrap within paragraphs, I've reflowed for legibility.

Quoted 2 lines

We have only 2 power domains. The input PCM and the output AMP. The routing between these 2 points in the codec is handled by volume levels.

Like I say this is pretty unremarkable - the volumes are your DAPM routing controls.

Quoted 3 lines

Given that, why would there be a need to show all routes through the mixer in a DAPM context? How do you show that? would it look something like this?

Quoted 5 lines

Well, the most obvious issue is that even if your device doesn't have any useful internal power management there may be external devices connected to the outputs (eg, a high power speaker amp) which do and so we need to know which outputs are actually active in order to control the outputs.

That makes sense, thanks

Quoted 7 lines
Quoted 4 lines

{"HPOUT", NULL, "HP Amp"}
{"HP Amp", "Amp Switch", "DAC1"}
{"DAC1", "HP-XSP Volume Control", "XSPIN"}

This looks wrong, the control on the DAC looks like it actually controls just the one input path.

That is just one example, it would be
for all inputs as the mixer controls are.

Quoted 5 lines
Quoted 2 lines

You can represent the "HP-XSP Volume Control" control as DAPM?

Yes.
______

Let me rework the routes to show all inputs.

Sorry this has been such a hassle.

Quoted 5 lines

_________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#13 lore raw
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

{"HPOUT", NULL, "HP Amp"}
{"HP Amp", "Amp Switch", "DAC1"}
{"DAC1", "HP-XSP Volume Control", "XSPIN"}

This looks wrong, the control on the DAC looks like it actually controls just the one input path.

That is just one example, it would be
for all inputs as the mixer controls are.

Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

You can represent the "HP-XSP Volume Control" control as DAPM?

Yes.
______

Let me rework the routes to show all inputs.

Sorry this has been such a hassle.

I get it now! This is going to add a lot of code as there are a lot of mixer controls. Using volume controls as DAPM I can create all routes in the codec.

Thanks for the help.

#14 lore raw
Quoted 3 lines · Brian Austin

I get it now! This is going to add a lot of code as there are a lot of mixer controls. Using volume controls as DAPM I can create all routes in the codec.

I did also mean to say that if you do have the really coarse power control it might be worth looking at using supply widgets to control the actual registers and no power management (SND_SOC_NOPM) for the widgets used for routing.