ASoC: Add support for cs42l73 codec
Subsystems (3)
PATCH v3 1/1 ASoC: Add support for cs42l73 codec
This patch adds support for Cirrus Logic CS42L73
low power stereo codec.
Applied coding style changes and added correct SoB emails Digital mute to be implemented after more testing
--- sound/soc/codecs/Kconfig | 4 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/cs42l73.c | 1076 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/cs42l73.h | 227 ++++++++++ 4 files changed, 1309 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
@@ -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
@@ -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 +1076 -0
1,076 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
Quoted 7 lines · Brian Austin
sound/soc/codecs/cs42l73.c new file +6
-0+ {"DAC1 Mixer", "Headphone Switch", "XSPIN"}, + {"DAC1 Mixer", "LineOut Switch", "XSPIN"}, + {"DAC2 Mixer", "Speakerphone Switch", "XSPIN"}, + {"DAC2 Mixer", "Speakerphone LineOut Switch", "XSPIN"}, + {"DAC2 Mixer", "EarSpeaker Switch", "XSPIN"}, + {"DAC1 Mixer", "Headphone Switch", "ASPIN"},
sound/soc/codecs/cs42l73.c line 455
Quoted 10 lines
sound/soc/codecs/cs42l73.c new file +9
-0+ {"DAC1 Mixer", "LineOut Switch", "ASPIN"}, + {"DAC2 Mixer", "Speakerphone Switch", "ASPIN"}, + {"DAC2 Mixer", "Speakerphone LineOut Switch", "ASPIN"}, + {"DAC2 Mixer", "EarSpeaker Switch", "ASPIN"}, + {"DAC1 Mixer", "Headphone Switch", "VSPIN"}, + {"DAC1 Mixer", "LineOut Switch", "VSPIN"}, + {"DAC2 Mixer", "Speakerphone Switch", "VSPIN"}, + {"DAC2 Mixer", "Speakerphone LineOut Switch", "VSPIN"}, + {"DAC2 Mixer", "EarSpeaker Switch", "VSPIN"},
This all looks totally wrong and I'm surprised the driver loads without errors. There's two issues:
- All the controls here are for the input to the DAC mixers but their names are for physical outputs. I'd expect the switches to name inputs (for example, "DAC1 Mixer VSPIN Switch"). What's actually going on here?
- You've got three copies of each of the controls for each mixer - I'm surprsied this loads without the core complaining that it can't create controls with duplicate names.
Quoted 23 lines · Mark Brown
Quoted 7 lines · Brian Austin
sound/soc/codecs/cs42l73.c new file +6
-0+ {"DAC1 Mixer", "Headphone Switch", "XSPIN"}, + {"DAC1 Mixer", "LineOut Switch", "XSPIN"}, + {"DAC2 Mixer", "Speakerphone Switch", "XSPIN"}, + {"DAC2 Mixer", "Speakerphone LineOut Switch", "XSPIN"}, + {"DAC2 Mixer", "EarSpeaker Switch", "XSPIN"}, + {"DAC1 Mixer", "Headphone Switch", "ASPIN"},sound/soc/codecs/cs42l73.c line 455
Quoted 10 lines
sound/soc/codecs/cs42l73.c new file +9
-0+ {"DAC1 Mixer", "LineOut Switch", "ASPIN"}, + {"DAC2 Mixer", "Speakerphone Switch", "ASPIN"}, + {"DAC2 Mixer", "Speakerphone LineOut Switch", "ASPIN"}, + {"DAC2 Mixer", "EarSpeaker Switch", "ASPIN"}, + {"DAC1 Mixer", "Headphone Switch", "VSPIN"}, + {"DAC1 Mixer", "LineOut Switch", "VSPIN"}, + {"DAC2 Mixer", "Speakerphone Switch", "VSPIN"}, + {"DAC2 Mixer", "Speakerphone LineOut Switch", "VSPIN"}, + {"DAC2 Mixer", "EarSpeaker Switch", "VSPIN"},This all looks totally wrong and I'm surprised the driver loads without errors. There's two issues:
Quoted 9 lines
- All the controls here are for the input to the DAC mixers but their names are for physical outputs. I'd expect the switches to name inputs (for example, "DAC1 Mixer VSPIN Switch"). What's actually going on here?
- You've got three copies of each of the controls for each mixer - I'm surprsied this loads without the core complaining that it can't create controls with duplicate names.
This works fine on my setup with a beagleboard.
There are 3 routes for the HP/LO/SPK/SPKLO/EAR. What I am trying to accomplish is the following. Allow a stream from any serial port to go to any output.
Quoted 17 lines · Brian
Quoted 15 lines · Mark Brown
sound/soc/codecs/cs42l73.c line 451
Quoted 5 lines · Brian Austin
sound/soc/codecs/cs42l73.c new file +3
-0+ {"DAC1 Mixer", "Headphone Switch", "XSPIN"}, + {"DAC1 Mixer", "Headphone Switch", "ASPIN"}, + {"DAC1 Mixer", "Headphone Switch", "VSPIN"},This all looks totally wrong and I'm surprised the driver loads without errors. There's two issues:
- All the controls here are for the input to the DAC mixers but their names are for physical outputs. I'd expect the switches to name inputs (for example, "DAC1 Mixer VSPIN Switch"). What's actually going on here?
Quoted 5 lines
Quoted 3 lines
- You've got three copies of each of the controls for each mixer - I'm surprsied this loads without the core complaining that it can't create controls with duplicate names.
This works fine on my setup with a beagleboard.
I'm frankly astonished. What are these controls called?
Quoted 2 lines
There are 3 routes for the HP/LO/SPK/SPKLO/EAR. What I am trying to accomplish is the following. Allow a stream from any serial port to go to any output.
That's perfectly reasonable but what you've written doesn't seem to do that. The DAPM routes are in the form:
{ destination, control, source }so what the above example says is that audio is routed from XSPIN to DAC1 if the DAC1 Headphone switch is turned on.
Quoted 29 lines · Mark Brown
Quoted 17 lines · Brian
Quoted 15 lines · Mark Brown
sound/soc/codecs/cs42l73.c line 451
Quoted 5 lines · Brian Austin
sound/soc/codecs/cs42l73.c new file +3
-0+ {"DAC1 Mixer", "Headphone Switch", "XSPIN"}, + {"DAC1 Mixer", "Headphone Switch", "ASPIN"}, + {"DAC1 Mixer", "Headphone Switch", "VSPIN"},This all looks totally wrong and I'm surprised the driver loads without errors. There's two issues:
- All the controls here are for the input to the DAC mixers but their names are for physical outputs. I'd expect the switches to name inputs (for example, "DAC1 Mixer VSPIN Switch"). What's actually going on here?
Quoted 5 lines
Quoted 3 lines
- You've got three copies of each of the controls for each mixer - I'm surprsied this loads without the core complaining that it can't create controls with duplicate names.
This works fine on my setup with a beagleboard.
I'm frankly astonished. What are these controls called?
Quoted 2 lines
There are 3 routes for the HP/LO/SPK/SPKLO/EAR. What I am trying to accomplish is the following. Allow a stream from any serial port to go to any output.
Quoted 7 lines
That's perfectly reasonable but what you've written doesn't seem to do that. The DAPM routes are in the form:
{ destination, control, source }so what the above example says is that audio is routed from XSPIN to DAC1 if the DAC1 Headphone switch is turned on.
See below:
+static const struct snd_kcontrol_new dac1_output_mixer[] = {
+ SOC_DAPM_SINGLE("Headphone Switch", CS42L73_PWRCTL3, 0, 1, 1),
+ SOC_DAPM_SINGLE("LineOut Switch", CS42L73_PWRCTL3, 1, 1, 1),
+};
+
+static const struct snd_kcontrol_new dac2_output_mixer[] = {
+ SOC_DAPM_SINGLE("Speakerphone Switch", CS42L73_PWRCTL3, 2, 1,
1),
+ SOC_DAPM_SINGLE("Speakerphone LineOut Switch", CS42L73_PWRCTL3,
+ 4, 1, 1),
+ SOC_DAPM_SINGLE("EarSpeaker Switch", CS42L73_PWRCTL3, 3, 1, 1),
+};
+
I think naming should be slightly better :)
Signature · 1 line
~Vinod
Quoted 15 lines · Vinod Koul
See below:
sound/soc/codecs/cs42l73.c new file +6
-0+static const struct snd_kcontrol_new dac1_output_mixer[] = { +SOC_DAPM_SINGLE ("Headphone Switch" ,CS42L73_PWRCTL3 ,0 ,1 ,1 ), +SOC_DAPM_SINGLE ("LineOut Switch" ,CS42L73_PWRCTL3 ,1 ,1 ,1 ), +}; +static const struct snd_kcontrol_new dac2_output_mixer[] = { + SOC_DAPM_SINGLE("Speakerphone Switch", CS42L73_PWRCTL3, 2, 1,1),
sound/soc/codecs/cs42l73.c new file +4
-0+SOC_DAPM_SINGLE ("Speakerphone LineOut Switch" ,CS42L73_PWRCTL3 , +4 ,1 ,1 ), + SOC_DAPM_SINGLE("EarSpeaker Switch", CS42L73_PWRCTL3, 3, 1, 1), +};
Quoted 1 line
I think naming should be slightly better :)
I'm not sure, it might be more than the naming. The fact that we're in PWRCTL registers could be confusing hardware design, or the structure of the hardware may not actually reflect what the driver is doing.
Quoted 17 lines · Mark Brown
Quoted 14 lines · Vinod Koul
See below:
sound/soc/codecs/cs42l73.c new file +6
-0+static const struct snd_kcontrol_new dac1_output_mixer[] = { +SOC_DAPM_SINGLE ("Headphone Switch" ,CS42L73_PWRCTL3 ,0 ,1 ,1 ), +SOC_DAPM_SINGLE ("LineOut Switch" ,CS42L73_PWRCTL3 ,1 ,1 ,1 ), +}; +static const struct snd_kcontrol_new dac2_output_mixer[] = { + SOC_DAPM_SINGLE("Speakerphone Switch", CS42L73_PWRCTL3, 2, 1,1),
sound/soc/codecs/cs42l73.c new file +4
-0+SOC_DAPM_SINGLE ("Speakerphone LineOut Switch" ,CS42L73_PWRCTL3 , +4 ,1 ,1 ), + SOC_DAPM_SINGLE("EarSpeaker Switch", CS42L73_PWRCTL3, 3, 1, 1), +};
Quoted 6 lines
Quoted 1 line
I think naming should be slightly better :)
I'm not sure, it might be more than the naming. The fact that we're in PWRCTL registers could be confusing hardware design, or the structure of the hardware may not actually reflect what the driver is doing.
The way to enable the output is to enable the output pin. I have no control in SW over the DAC's. The pins are power controlled of course. I know it looks strange, but without using a machine driver to enable/disable the pins for a certain route, this seems to be the best solution.
I am of course open to other ideas :)
Quoted 4 lines · Brian
The way to enable the output is to enable the output pin. I have no control in SW over the DAC's. The pins are power controlled of course. I know it looks strange, but without using a machine driver to enable/disable the pins for a certain route, this seems to be the best solution.
Right, which is why I'm saying this routing makes no sense. You've got code which has a mixer mixing input signals down into the DAC but what you've actually got is a single output from the DAC which can then be sent to the outputs separately. You should be able to draw a graph of the audio routes through the CODEC which directly corresponds to the DAPM graph.
Quoted 25 lines · Brian
Quoted 17 lines · Mark Brown
Quoted 14 lines · Vinod Koul
See below:
(quoted diff) +6
-0+static const struct snd_kcontrol_new dac1_output_mixer[] = { + SOC_DAPM_SINGLE("Headphone Switch", CS42L73_PWRCTL3, 0, 1, 1), + SOC_DAPM_SINGLE("LineOut Switch", CS42L73_PWRCTL3, 1, 1, 1), +}; +static const struct snd_kcontrol_new dac2_output_mixer[] = { + SOC_DAPM_SINGLE("Speakerphone Switch", CS42L73_PWRCTL3, 2, 1,1),
(quoted diff) +4
-0+ SOC_DAPM_SINGLE("Speakerphone LineOut Switch", CS42L73_PWRCTL3, + 4, 1, 1), + SOC_DAPM_SINGLE("EarSpeaker Switch", CS42L73_PWRCTL3, 3, 1, 1), +};Quoted 6 lines
Quoted 1 line
I think naming should be slightly better :)
I'm not sure, it might be more than the naming. The fact that we're in PWRCTL registers could be confusing hardware design, or the structure of the hardware may not actually reflect what the driver is doing.
Quoted 6 lines
The way to enable the output is to enable the output pin. I have no control in SW over the DAC's. The pins are power controlled of course. I know it looks strange, but without using a machine driver to enable/disable the pins for a certain route, this seems to be the best solution.
I am of course open to other ideas :)
What i saw in the spec is that this codec has three PCM ports and each one can be input to the DACs. The DAC output goes to output pins and in some cases shared (like DAC2 for ep/spkr).
For output you have amp switches at end, so we can control where output is going as well.
So we can have is APCM -> Mixer's -> DAC -> out switches -> pins All this is codec domain so why should machine driver be bothered about this stuff. Anything external to codec should be handled in machine driver, otherwise we end up creating same code in all machine drivers which use this codec.
Signature · 1 line
~Vinod
Quoted 32 lines · Vinod Koul
Quoted 25 lines · Brian
Quoted 17 lines · Mark Brown
Quoted 14 lines · Vinod Koul
See below:
(quoted diff) +6
-0+static const struct snd_kcontrol_new dac1_output_mixer[] = { + SOC_DAPM_SINGLE("Headphone Switch", CS42L73_PWRCTL3, 0, 1, 1), + SOC_DAPM_SINGLE("LineOut Switch", CS42L73_PWRCTL3, 1, 1, 1), +}; +static const struct snd_kcontrol_new dac2_output_mixer[] = { + SOC_DAPM_SINGLE("Speakerphone Switch", CS42L73_PWRCTL3, 2, 1,1),
(quoted diff) +4
-0+ SOC_DAPM_SINGLE("Speakerphone LineOut Switch", CS42L73_PWRCTL3, + 4, 1, 1), + SOC_DAPM_SINGLE("EarSpeaker Switch", CS42L73_PWRCTL3, 3, 1, 1), +};Quoted 6 lines
Quoted 1 line
I think naming should be slightly better :)
I'm not sure, it might be more than the naming. The fact that we're in PWRCTL registers could be confusing hardware design, or the structure of the hardware may not actually reflect what the driver is doing.
Quoted 6 lines
The way to enable the output is to enable the output pin. I have no control in SW over the DAC's. The pins are power controlled of course. I know it looks strange, but without using a machine driver to enable/disable the pins for a certain route, this seems to be the best solution.
I am of course open to other ideas :)
Quoted 10 lines
What i saw in the spec is that this codec has three PCM ports and each one can be input to the DACs. The DAC output goes to output pins and in some cases shared (like DAC2 for ep/spkr).
For output you have amp switches at end, so we can control where output is going as well.
So we can have is APCM -> Mixer's -> DAC -> out switches -> pins All this is codec domain so why should machine driver be bothered about this stuff. Anything external to codec should be handled in machine driver, otherwise we end up creating same code in all machine drivers which use this codec.
So more of a "mixer" for the PCM's to the DAC's and then the switches for the output control. I'll try that
Thanks
Quoted 4 lines · Vinod Koul
Quoted 1 line
What i saw in the spec is that this codec has three PCM ports and each one can be input to the DACs. The DAC output goes to output pins and in some cases shared (like DAC2 for ep/spkr).
This is controlled through the 'HL-XSP/ASP/VSP' mixer control for Headphone/LineOut.
Quoted 3 lines
For output you have amp switches at end, so we can control where output is going as well.
So we can have is APCM -> Mixer's -> DAC -> out switches -> pins
XPCM (hw:0,1) -> Mixers (HL-XSP) -> DAC(NULL) -> HP Amp (DAC1 Mixer Headphone) - > HPOUT.
Quoted 8 lines
All this is codec domain so why should machine driver be bothered about this stuff. Anything external to codec should be handled in machine driver, otherwise we end up creating same code in all machine drivers which use this codec.
Signature · 1 line
~Vinod
With the code I have I can do this and it works as intended, at least in my mind. I can enable and disable the outputs to send the stream to wherever I want and only power what is being used.
Quoted 20 lines · Brian
Quoted 4 lines · Vinod Koul
Quoted 1 line
What i saw in the spec is that this codec has three PCM ports and each one can be input to the DACs. The DAC output goes to output pins and in some cases shared (like DAC2 for ep/spkr).
This is controlled through the 'HL-XSP/ASP/VSP' mixer control for Headphone/LineOut.
Quoted 3 lines
For output you have amp switches at end, so we can control where output is going as well.
So we can have is APCM -> Mixer's -> DAC -> out switches -> pinsXPCM (hw:0,1) -> Mixers (HL-XSP) -> DAC(NULL) -> HP Amp (DAC1 Mixer Headphone) - > HPOUT.
Quoted 5 lines
All this is codec domain so why should machine driver be bothered about this stuff. Anything external to codec should be handled in machine driver, otherwise we end up creating same code in all machine drivers which use this codec.
Quoted 7 lines
Quoted 3 lines
Signature · 1 line
~VinodWith the code I have I can do this and it works as intended, at least in my mind. I can enable and disable the outputs to send the stream to wherever I want and only power what is being used.
I see the problem now…
If you have multiple DAI's on the same serial port you get duplicate entries. I'll fix it. Sorry
Brian
Quoted 31 lines · Brian
Quoted 20 lines · Brian
Quoted 4 lines · Vinod Koul
Quoted 1 line
What i saw in the spec is that this codec has three PCM ports and each one can be input to the DACs. The DAC output goes to output pins and in some cases shared (like DAC2 for ep/spkr).
This is controlled through the 'HL-XSP/ASP/VSP' mixer control for Headphone/LineOut.
Quoted 3 lines
For output you have amp switches at end, so we can control where output is going as well.
So we can have is APCM -> Mixer's -> DAC -> out switches -> pinsXPCM (hw:0,1) -> Mixers (HL-XSP) -> DAC(NULL) -> HP Amp (DAC1 Mixer Headphone) - > HPOUT.
Quoted 5 lines
All this is codec domain so why should machine driver be bothered about this stuff. Anything external to codec should be handled in machine driver, otherwise we end up creating same code in all machine drivers which use this codec.
Quoted 7 lines
Quoted 3 lines
Signature · 1 line
~VinodWith the code I have I can do this and it works as intended, at least in my mind. I can enable and disable the outputs to send the stream to wherever I want and only power what is being used.
Quoted 6 lines
I see the problem now…
If you have multiple DAI's on the same serial port you get duplicate entries. I'll fix it. Sorry
Brian
Disregard this email please.
Sorry for the confusion
Quoted 32 lines · Vinod Koul
Quoted 25 lines · Brian
Quoted 17 lines · Mark Brown
Quoted 14 lines · Vinod Koul
See below:
(quoted diff) +6
-0+static const struct snd_kcontrol_new dac1_output_mixer[] = { + SOC_DAPM_SINGLE("Headphone Switch", CS42L73_PWRCTL3, 0, 1, 1), + SOC_DAPM_SINGLE("LineOut Switch", CS42L73_PWRCTL3, 1, 1, 1), +}; +static const struct snd_kcontrol_new dac2_output_mixer[] = { + SOC_DAPM_SINGLE("Speakerphone Switch", CS42L73_PWRCTL3, 2, 1,1),
(quoted diff) +4
-0+ SOC_DAPM_SINGLE("Speakerphone LineOut Switch", CS42L73_PWRCTL3, + 4, 1, 1), + SOC_DAPM_SINGLE("EarSpeaker Switch", CS42L73_PWRCTL3, 3, 1, 1), +};Quoted 6 lines
Quoted 1 line
I think naming should be slightly better :)
I'm not sure, it might be more than the naming. The fact that we're in PWRCTL registers could be confusing hardware design, or the structure of the hardware may not actually reflect what the driver is doing.
Quoted 6 lines
The way to enable the output is to enable the output pin. I have no control in SW over the DAC's. The pins are power controlled of course. I know it looks strange, but without using a machine driver to enable/disable the pins for a certain route, this seems to be the best solution.
I am of course open to other ideas :)
Quoted 15 lines
What i saw in the spec is that this codec has three PCM ports and each one can be input to the DACs. The DAC output goes to output pins and in some cases shared (like DAC2 for ep/spkr).
For output you have amp switches at end, so we can control where output is going as well.
So we can have is APCM -> Mixer's -> DAC -> out switches -> pins All this is codec domain so why should machine driver be bothered about this stuff. Anything external to codec should be handled in machine driver, otherwise we end up creating same code in all machine drivers which use this codec.Signature · 1 line
~Vinod
I have changed the DAPM widgets for the Amp's to be Switches. They are on or off based on the mixer control. so now it looks as follows.
static const struct snd_kcontrol_new hp_amp_ctl =
SOC_DAPM_SINGLE("Switch", CS42L73_PWRCTL3, 0, 1, 1);static const struct snd_kcontrol_new lo_amp_ctl =
SOC_DAPM_SINGLE("Switch", CS42L73_PWRCTL3, 1, 1, 1);static const struct snd_kcontrol_new spk_amp_ctl =
SOC_DAPM_SINGLE("Switch", CS42L73_PWRCTL3, 2, 1, 1);static const struct snd_kcontrol_new spklo_amp_ctl =
SOC_DAPM_SINGLE("Switch", CS42L73_PWRCTL3, 4, 1, 1);static const struct snd_kcontrol_new ear_amp_ctl =
SOC_DAPM_SINGLE("Switch", CS42L73_PWRCTL3, 3, 1, 1);SND_SOC_DAPM_SWITCH("HP Amp", CS42L73_PWRCTL3, 0, 1, &hp_amp_ctl), SND_SOC_DAPM_SWITCH("LO Amp", CS42L73_PWRCTL3, 1, 1, &lo_amp_ctl), SND_SOC_DAPM_SWITCH("SPK Amp", CS42L73_PWRCTL3, 2, 1, &spk_amp_ctl), SND_SOC_DAPM_SWITCH("EAR Amp", CS42L73_PWRCTL3, 3, 1, &ear_amp_ctl), SND_SOC_DAPM_SWITCH("SPKLO Amp", CS42L73_PWRCTL3, 4, 1, &spklo_amp_ctl),
{"HP Amp", "Switch", "DAC1"},
{"LO Amp", "Switch", "DAC1"},
{"SPK Amp", "Switch", "DAC2"},
{"SPKLO Amp", "Switch", "DAC2"},
{"EAR Amp", "Switch", "DAC2"},
This allows me to route the streams from any PCM to any output. IF this is OK I would like to resubmit.
Thanks,
Brian
Quoted 8 lines · Brian
{"HP Amp", "Switch", "DAC1"},
{"LO Amp", "Switch", "DAC1"},
{"SPK Amp", "Switch", "DAC2"},
{"SPKLO Amp", "Switch", "DAC2"},
{"EAR Amp", "Switch", "DAC2"},This allows me to route the streams from any PCM to any output. IF this is OK I would like to resubmit.
This looks reasonable.
[Please fix your mail client to word wrap within paragraphs.]
Quoted 23 lines · Mark Brown
Quoted 7 lines · Brian Austin
sound/soc/codecs/cs42l73.c new file +6
-0+ {"DAC1 Mixer", "Headphone Switch", "XSPIN"}, + {"DAC1 Mixer", "LineOut Switch", "XSPIN"}, + {"DAC2 Mixer", "Speakerphone Switch", "XSPIN"}, + {"DAC2 Mixer", "Speakerphone LineOut Switch", "XSPIN"}, + {"DAC2 Mixer", "EarSpeaker Switch", "XSPIN"}, + {"DAC1 Mixer", "Headphone Switch", "ASPIN"},sound/soc/codecs/cs42l73.c line 455
Quoted 10 lines
sound/soc/codecs/cs42l73.c new file +9
-0+ {"DAC1 Mixer", "LineOut Switch", "ASPIN"}, + {"DAC2 Mixer", "Speakerphone Switch", "ASPIN"}, + {"DAC2 Mixer", "Speakerphone LineOut Switch", "ASPIN"}, + {"DAC2 Mixer", "EarSpeaker Switch", "ASPIN"}, + {"DAC1 Mixer", "Headphone Switch", "VSPIN"}, + {"DAC1 Mixer", "LineOut Switch", "VSPIN"}, + {"DAC2 Mixer", "Speakerphone Switch", "VSPIN"}, + {"DAC2 Mixer", "Speakerphone LineOut Switch", "VSPIN"}, + {"DAC2 Mixer", "EarSpeaker Switch", "VSPIN"},This all looks totally wrong and I'm surprised the driver loads without errors. There's two issues:
Quoted 8 lines
- All the controls here are for the input to the DAC mixers but their names are for physical outputs. I'd expect the switches to name inputs (for example, "DAC1 Mixer VSPIN Switch"). What's actually going on here?
- You've got three copies of each of the controls for each mixer - I'm surprsied this loads without the core complaining that it can't create controls with duplicate names.
This codec has two DACs, three PCM ports. Each DAC has a mixer to allow any port to be routed to it
I recommended this to be done as it helps DAPM to power off unused paths.
Signature · 1 line
~Vinod
Quoted 17 lines · Brian Austin
sound/soc/codecs/cs42l73.c new file +17
-0+static const u8 cs42l73_reg[] = { +/*0*/ 0x00 ,0x42 ,0xA7 ,0x30 , +/*4*/ 0x00 ,0x00 ,0xF1 ,0xDF , +/*8*/ 0x3F ,0x57 ,0x53 ,0x00 , +/*C*/ 0x00 ,0x15 ,0x00 ,0x15 , +/*A*/ 0x00 ,0x15 ,0x00 ,0x06 , +/*E*/ 0x00 ,0x00 ,0x00 ,0x00 , +/*18*/ 0x00 ,0x00 ,0x00 ,0x00 , +/*1C*/ 0x00 ,0x00 ,0x00 ,0x00 , +/*20*/ 0x00 ,0x00 ,0x00 ,0x00 , +/*24*/ 0x00 ,0x00 ,0x00 ,0x7F , +/*28*/ 0x00 ,0x00 ,0x3F ,0x00 , +/*2C*/ 0x00 ,0x3F ,0x00 ,0x00 , +/*30*/ 0x3F ,0x00 ,0x00 ,0x00 , +/*34*/ 0x18 ,0x3F ,0x3F ,0x3F , +/*38*/ 0x3F ,0x3F ,0x3F ,0x3F , +/*3C*/ 0x3F ,0x3F ,0x3F ,0x3F ,
sound/soc/codecs/cs42l73.c line 69
Quoted 10 lines
sound/soc/codecs/cs42l73.c new file +10
-0+/*40*/ 0x3F ,0x3F ,0x3F ,0x3F , +/*44*/ 0x3F ,0x3F ,0x3F ,0x3F , +/*48*/ 0x3F ,0x3F ,0x3F ,0x3F , +/*4C*/ 0x3F ,0x3F ,0x3F ,0x3F , +/*50*/ 0x3F ,0x3F ,0x3F ,0x3F , +/*54*/ 0x3F ,0xAA ,0x3F ,0x3F , +/*58*/ 0x3F ,0x3F ,0x3F ,0x3F , +/*5C*/ 0x3F ,0x3F ,0x00 ,0x00 , +/*60*/ 0x00 ,0x00 +};
The comments should go on the right side, not the left.
Quoted 4 lines
+static struct
cs42l73_mclkx_divcs42l73_mclkx_coeffs[] = {
+ {5644800, 1, 0}, /* 5644800 */
+ {6000000, 1, 0}, /* 6000000 */
+ {6144000, 1, 0}, /* 6144000 */
Quoted 8 lines
+ {11289600, 2, 2}, /* 5644800 */
+ {12288000, 2, 2}, /* 6144000 */
+ {12000000, 2, 2}, /* 6000000 */
+ {13000000, 2, 2}, /* 6500000 */
+ {19200000, 3, 3}, /* 6400000 */
+ {24000000, 4, 4}, /* 6000000 */
+ {26000000, 4, 4}, /* 6500000 */
+ {38400000, 6, 5} /* 6400000 */
What do these comments mean?
In fact, I think there should be more comments in this file overall. For example, almost none of the functions are commented.
sound/soc/codecs/cs42l73.h line 29
Quoted 2 lines
sound/soc/codecs/cs42l73.h new file +2
-0+/* I2C Registers */ +/* I2C Address: 1001010[R/W] - 10010100 = 0x94(Write); 10010101 = 0x95(Read) */
This chip has separate I2C addresses for reading and writing?
Signature · 2 lines
Timur Tabi Linux kernel developer at Freescale
Quoted 4 lines · On Fri, Oct 07, 2011 at 02:13:32AM +0000, Tabi Timur-B04825 wrote:
sound/soc/codecs/cs42l73.h line 29
Quoted 2 lines
sound/soc/codecs/cs42l73.h new file +2
-0+/* I2C Registers */ +/* I2C Address: 1001010[R/W] - 10010100 = 0x94(Write); 10010101 = 0x95(Read) */ This chip has separate I2C addresses for reading and writing?
This is standard - the I2C address can be quoted in either 8 bit form (where the lowest bit is a read write flag) or 7 bit form. The confusing thing here is that the Linux code uses the 7 bit form exclusively.