sound: codec: tlv320aic3x: remove mono controls
Subsystems (3)
PATCH 1/1 sound: codec: tlv320aic3x: remove mono controls
if codec driver is used for AIC3X_MODEL_3007 the mono iout controls overwrite registers for class-d amplifier.
classd amplifier controls are only used for AIC3X_MODEL_3007.
Removing all mono snd_kcontrol_new, snd_soc_dapm_widget, snd_soc_dapm_route and aic3x_init stuff from common code and call only for not AIC3X_MODEL_3007 codecs.
Testet only with AIC3X_MODEL_3007
--- sound/soc/codecs/tlv320aic3x.c | 106 ++++++++++++++++++++++++--------------- 1 files changed, 65 insertions(+), 41 deletions(-)
sound/soc/codecs/tlv320aic3x.c +65 -41
@@ -324,16 +324,6 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = { DACL1_2_LLOPM_VOL, DACR1_2_RLOPM_VOL, 0, 118, 1, output_stage_tlv), -SOC_DOUBLE_R_TLV ("Mono Line2 Bypass Volume" , -LINE2L_2_MONOLOPM_VOL ,LINE2R_2_MONOLOPM_VOL , -0 ,118 ,1 , output_stage_tlv), -SOC_DOUBLE_R_TLV ("Mono PGA Bypass Volume" , -PGAL_2_MONOLOPM_VOL ,PGAR_2_MONOLOPM_VOL , -0 ,118 ,1 , output_stage_tlv), -SOC_DOUBLE_R_TLV ("Mono DAC Playback Volume" , -DACL1_2_MONOLOPM_VOL ,DACR1_2_MONOLOPM_VOL , -0 ,118 ,1 , output_stage_tlv), -SOC_DOUBLE_R_TLV ("HP Line2 Bypass Volume" ,LINE2L_2_HPLOUT_VOL ,LINE2R_2_HPROUT_VOL , 0, 118, 1, output_stage_tlv),
@@ -357,7 +347,6 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = {/* Output pin mute controls */ SOC_DOUBLE_R ("Line Playback Switch" ,LLOPM_CTRL ,RLOPM_CTRL ,3 ,0x01 ,0 ), -SOC_SINGLE ("Mono Playback Switch" ,MONOLOPM_CTRL ,3 ,0x01 ,0 ),SOC_DOUBLE_R ("HP Playback Switch" ,HPLOUT_CTRL ,HPROUT_CTRL ,3 ,0x01 ,0 ), SOC_DOUBLE_R("HPCOM Playback Switch", HPLCOM_CTRL, HPRCOM_CTRL, 3,
@@ -377,6 +366,19 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = { SOC_ENUM("ADC HPF Cut-off", aic3x_enum[ADC_HPF_ENUM]), }; +static const struct snd_kcontrol_new aic3x_mono_controls[] = { +SOC_DOUBLE_R_TLV ("Mono Line2 Bypass Volume" , +LINE2L_2_MONOLOPM_VOL ,LINE2R_2_MONOLOPM_VOL , +0 ,118 ,1 , output_stage_tlv), +SOC_DOUBLE_R_TLV ("Mono PGA Bypass Volume" , +PGAL_2_MONOLOPM_VOL ,PGAR_2_MONOLOPM_VOL , +0 ,118 ,1 , output_stage_tlv), +SOC_DOUBLE_R_TLV ("Mono DAC Playback Volume" , +DACL1_2_MONOLOPM_VOL ,DACR1_2_MONOLOPM_VOL , +0 ,118 ,1 , output_stage_tlv), +SOC_SINGLE ("Mono Playback Switch" ,MONOLOPM_CTRL ,3 ,0x01 ,0 ), +}; +/* * Class-D amplifier gain. From 0 to 18 dB in 6 dB steps */
@@ -526,9 +528,6 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = {SND_SOC_DAPM_PGA ("Right HP Out" ,HPROUT_CTRL ,0 ,0 ,NULL ,0 ),SND_SOC_DAPM_PGA ("Right HP Com" ,HPRCOM_CTRL ,0 ,0 ,NULL ,0 ), -/* Mono Output */ -SND_SOC_DAPM_PGA ("Mono Out" ,MONOLOPM_CTRL ,0 ,0 ,NULL ,0 ), -/* Inputs to Left ADC */ SND_SOC_DAPM_ADC ("Left ADC" ,"Left Capture" ,LINE1L_2_LADC_CTRL ,2 ,0 ), SND_SOC_DAPM_MIXER("Left PGA Mixer", SND_SOC_NOPM, 0, 0,
@@ -590,9 +589,6 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = {SND_SOC_DAPM_MIXER ("Right Line Mixer" ,SND_SOC_NOPM ,0 ,0 , &aic3x_right_line_mixer_controls[0 ],ARRAY_SIZE (aic3x_right_line_mixer_controls)), -SND_SOC_DAPM_MIXER ("Mono Mixer" ,SND_SOC_NOPM ,0 ,0 , - &aic3x_mono_mixer_controls[0 ], -ARRAY_SIZE (aic3x_mono_mixer_controls)),SND_SOC_DAPM_MIXER ("Left HP Mixer" ,SND_SOC_NOPM ,0 ,0 , &aic3x_left_hp_mixer_controls[0 ], ARRAY_SIZE(aic3x_left_hp_mixer_controls)),
@@ -608,7 +604,6 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = {SND_SOC_DAPM_OUTPUT ("LLOUT" ),SND_SOC_DAPM_OUTPUT ("RLOUT" ), -SND_SOC_DAPM_OUTPUT ("MONO_LOUT" ),SND_SOC_DAPM_OUTPUT ("HPLOUT" ),SND_SOC_DAPM_OUTPUT ("HPROUT" ), SND_SOC_DAPM_OUTPUT("HPLCOM"),
@@ -630,6 +625,18 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { SND_SOC_DAPM_OUTPUT("Detection"), }; +static const struct snd_soc_dapm_widget aic3x_dapm_mono_widgets[] = { +/* Mono Output */ +SND_SOC_DAPM_PGA ("Mono Out" ,MONOLOPM_CTRL ,0 ,0 ,NULL ,0 ), + +/* Output mixers */ +SND_SOC_DAPM_MIXER ("Mono Mixer" ,SND_SOC_NOPM ,0 ,0 , + &aic3x_mono_mixer_controls[0 ], +ARRAY_SIZE (aic3x_mono_mixer_controls)), + +SND_SOC_DAPM_OUTPUT ("MONO_LOUT" ), +}; +static const struct snd_soc_dapm_widget aic3007_dapm_widgets[] = {/* Class-D outputs */ SND_SOC_DAPM_PGA ("Left Class-D Out" ,CLASSD_CTRL ,3 ,0 ,NULL ,0 ),
@@ -714,17 +721,6 @@ static const struct snd_soc_dapm_route intercon[] = { {"Right Line Out", NULL, "Right DAC Mux"}, {"RLOUT", NULL, "Right Line Out"}, -/* Mono Output */ - {"Mono Mixer", "Line2L Bypass Switch", "Left Line2L Mux"}, - {"Mono Mixer", "PGAL Bypass Switch", "Left PGA Mixer"}, - {"Mono Mixer", "DACL1 Switch", "Left DAC Mux"}, - {"Mono Mixer", "Line2R Bypass Switch", "Right Line2R Mux"}, - {"Mono Mixer", "PGAR Bypass Switch", "Right PGA Mixer"}, - {"Mono Mixer", "DACR1 Switch", "Right DAC Mux"}, - - {"Mono Out", NULL, "Mono Mixer"}, - {"MONO_LOUT", NULL, "Mono Out"}, -/* Left HP Output */ {"Left HP Mixer", "Line2L Bypass Switch", "Left Line2L Mux"}, {"Left HP Mixer", "PGAL Bypass Switch", "Left PGA Mixer"},
@@ -780,6 +776,19 @@ static const struct snd_soc_dapm_route intercon[] = { {"HPRCOM", NULL, "Right HP Com"}, }; +static const struct snd_soc_dapm_route intercon_mono[] = { +/* Mono Output */ + {"Mono Mixer" ,"Line2L Bypass Switch" ,"Left Line2L Mux" }, + {"Mono Mixer" ,"PGAL Bypass Switch" ,"Left PGA Mixer" }, + {"Mono Mixer" ,"DACL1 Switch" ,"Left DAC Mux" }, + {"Mono Mixer" ,"Line2R Bypass Switch" ,"Right Line2R Mux" }, + {"Mono Mixer" ,"PGAR Bypass Switch" ,"Right PGA Mixer" }, + {"Mono Mixer" ,"DACR1 Switch" ,"Right DAC Mux" }, + + {"Mono Out" ,NULL ,"Mono Mixer" }, + {"MONO_LOUT" ,NULL ,"Mono Out" }, +}; +static const struct snd_soc_dapm_route intercon_3007[] = {/* Class-D outputs */ {"Left Class-D Out", NULL, "Left Line Out"},
@@ -804,6 +813,11 @@ static int aic3x_add_widgets(struct snd_soc_codec *codec) ARRAY_SIZE(aic3007_dapm_widgets));snd_soc_dapm_add_routes (dapm, intercon_3007,ARRAY_SIZE (intercon_3007)); + }else { +snd_soc_dapm_new_controls (dapm, aic3x_dapm_mono_widgets, +ARRAY_SIZE (aic3x_dapm_mono_widgets)); +snd_soc_dapm_add_routes (dapm, intercon_mono, +ARRAY_SIZE (intercon_mono)); }return 0 ;
@@ -1290,17 +1304,12 @@ static int aic3x_init(struct snd_soc_codec *codec)/* DAC to Line Out default volume and route to Output mixer */ snd_soc_write (codec,DACL1_2_LLOPM_VOL ,DEFAULT_VOL |ROUTE_ON );snd_soc_write (codec,DACR1_2_RLOPM_VOL ,DEFAULT_VOL |ROUTE_ON ); -/* DAC to Mono Line Out default volume and route to Output mixer */ -snd_soc_write (codec,DACL1_2_MONOLOPM_VOL ,DEFAULT_VOL |ROUTE_ON ); -snd_soc_write (codec,DACR1_2_MONOLOPM_VOL ,DEFAULT_VOL |ROUTE_ON );/* unmute all outputs */ reg =snd_soc_read (codec,LLOPM_CTRL );snd_soc_write (codec,LLOPM_CTRL , reg |UNMUTE ); reg =snd_soc_read (codec,RLOPM_CTRL );snd_soc_write (codec,RLOPM_CTRL , reg |UNMUTE ); - reg =snd_soc_read (codec,MONOLOPM_CTRL ); -snd_soc_write (codec,MONOLOPM_CTRL , reg |UNMUTE ); reg =snd_soc_read (codec,HPLOUT_CTRL );snd_soc_write (codec,HPLOUT_CTRL , reg |UNMUTE ); reg =snd_soc_read (codec,HPROUT_CTRL );
@@ -1325,9 +1334,6 @@ static int aic3x_init(struct snd_soc_codec *codec)/* PGA to Line Out default volume, disconnect from Output Mixer */ snd_soc_write (codec,PGAL_2_LLOPM_VOL ,DEFAULT_VOL );snd_soc_write (codec,PGAR_2_RLOPM_VOL ,DEFAULT_VOL ); -/* PGA to Mono Line Out default volume, disconnect from Output Mixer */ -snd_soc_write (codec,PGAL_2_MONOLOPM_VOL ,DEFAULT_VOL ); -snd_soc_write (codec,PGAR_2_MONOLOPM_VOL ,DEFAULT_VOL );/* Line2 to HP Bypass default volume, disconnect from Output Mixer */ snd_soc_write (codec,LINE2L_2_HPLOUT_VOL ,DEFAULT_VOL );
@@ -1337,14 +1343,30 @@ static int aic3x_init(struct snd_soc_codec *codec)/* Line2 Line Out default volume, disconnect from Output Mixer */ snd_soc_write (codec,LINE2L_2_LLOPM_VOL ,DEFAULT_VOL );snd_soc_write (codec,LINE2R_2_RLOPM_VOL ,DEFAULT_VOL ); -/* Line2 to Mono Out default volume, disconnect from Output Mixer */ -snd_soc_write (codec,LINE2L_2_MONOLOPM_VOL ,DEFAULT_VOL ); -snd_soc_write (codec,LINE2R_2_MONOLOPM_VOL ,DEFAULT_VOL );if (aic3x->model ==AIC3X_MODEL_3007 ) {aic3x_init_3007 (codec);snd_soc_write (codec,CLASSD_CTRL ,0 ); + +return 0 ; } +/* Not on AIC3X_MODEL_3007 init */ + +/* DAC to Mono Line Out default volume and route to Output mixer */ +snd_soc_write (codec,DACL1_2_MONOLOPM_VOL ,DEFAULT_VOL |ROUTE_ON ); +snd_soc_write (codec,DACR1_2_MONOLOPM_VOL ,DEFAULT_VOL |ROUTE_ON ); + +/* unmute outputs */ + reg =snd_soc_read (codec,MONOLOPM_CTRL ); +snd_soc_write (codec,MONOLOPM_CTRL , reg |UNMUTE ); + +/* PGA to Mono Line Out default volume, disconnect from Output Mixer */ +snd_soc_write (codec,PGAL_2_MONOLOPM_VOL ,DEFAULT_VOL ); +snd_soc_write (codec,PGAR_2_MONOLOPM_VOL ,DEFAULT_VOL ); + +/* Line2 to Mono Out default volume, disconnect from Output Mixer */ +snd_soc_write (codec,LINE2L_2_MONOLOPM_VOL ,DEFAULT_VOL ); +snd_soc_write (codec,LINE2R_2_MONOLOPM_VOL ,DEFAULT_VOL );return 0 ; }
@@ -1423,7 +1445,9 @@ static int aic3x_probe(struct snd_soc_codec *codec) ARRAY_SIZE(aic3x_snd_controls));if (aic3x->model ==AIC3X_MODEL_3007 )snd_soc_add_controls (codec, &aic3x_classd_amp_gain_ctrl,1 ); - +else +snd_soc_add_controls (codec, aic3x_mono_controls, +ARRAY_SIZE (aic3x_mono_controls));aic3x_add_widgets (codec);list_add (&aic3x->list, &reset_list);
Signature · 1 line
1.7.0.4
[Cc'ing s/roonie/broonie/]
Quoted 8 lines · On Fri, 17 Jun 2011 13:40:27 +0200 Jan Weitzel <[email protected]> wrote:
if codec driver is used for
AIC3X_MODEL_3007the mono iout controls overwrite registers for class-d amplifier.
classd amplifier controls are only used forAIC3X_MODEL_3007.Removing all mono
snd_kcontrol_new,snd_soc_dapm_widget,snd_soc_dapm_routeandaic3x_initstuff from common code and call only for notAIC3X_MODEL_3007codecs.
Quoted 7 lines
Testet only with
AIC3X_MODEL_3007Signed-off-by Jan Weitzel <[email protected]>--- sound/soc/codecs/tlv320aic3x.c | 106 ++++++++++++++++++++++++--------------- 1 files changed, 65 insertions(+), 41 deletions(-)
with aic34,
Quoted 1 line · Jarkko Nikula
[Cc'ing s/roonie/broonie/]
If you're CCing people in on patches it's handy to include the full patch :)
Quoted 5 lines · On Fri, 17 Jun 2011 14:05:29 +0100 Mark Brown…
Quoted 1 line · Jarkko Nikula
[Cc'ing s/roonie/broonie/]
If you're CCing people in on patches it's handy to include the full patch :)
Oh, the patch must be waiting for moderator approval since I cannot see it on list archive.
Jan, care to repost with correct addresses and my tested-by included?
Signature · 1 line
Jarkko
PATCH 1/1 sound: codec: tlv320aic3x: remove mono controls
In reply to Mark Brownif codec driver is used for AIC3X_MODEL_3007 the mono iout controls overwrite registers for class-d amplifier.
classd amplifier controls are only used for AIC3X_MODEL_3007.
Removing all mono snd_kcontrol_new, snd_soc_dapm_widget, snd_soc_dapm_route and aic3x_init stuff from common code and call only for not AIC3X_MODEL_3007 codecs.
Testet only with AIC3X_MODEL_3007
with aic34
--- sound/soc/codecs/tlv320aic3x.c | 106 ++++++++++++++++++++++++--------------- 1 files changed, 65 insertions(+), 41 deletions(-)
sound/soc/codecs/tlv320aic3x.c +65 -41
@@ -324,16 +324,6 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = { DACL1_2_LLOPM_VOL, DACR1_2_RLOPM_VOL, 0, 118, 1, output_stage_tlv), -SOC_DOUBLE_R_TLV ("Mono Line2 Bypass Volume" , -LINE2L_2_MONOLOPM_VOL ,LINE2R_2_MONOLOPM_VOL , -0 ,118 ,1 , output_stage_tlv), -SOC_DOUBLE_R_TLV ("Mono PGA Bypass Volume" , -PGAL_2_MONOLOPM_VOL ,PGAR_2_MONOLOPM_VOL , -0 ,118 ,1 , output_stage_tlv), -SOC_DOUBLE_R_TLV ("Mono DAC Playback Volume" , -DACL1_2_MONOLOPM_VOL ,DACR1_2_MONOLOPM_VOL , -0 ,118 ,1 , output_stage_tlv), -SOC_DOUBLE_R_TLV ("HP Line2 Bypass Volume" ,LINE2L_2_HPLOUT_VOL ,LINE2R_2_HPROUT_VOL , 0, 118, 1, output_stage_tlv),
@@ -357,7 +347,6 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = {/* Output pin mute controls */ SOC_DOUBLE_R ("Line Playback Switch" ,LLOPM_CTRL ,RLOPM_CTRL ,3 ,0x01 ,0 ), -SOC_SINGLE ("Mono Playback Switch" ,MONOLOPM_CTRL ,3 ,0x01 ,0 ),SOC_DOUBLE_R ("HP Playback Switch" ,HPLOUT_CTRL ,HPROUT_CTRL ,3 ,0x01 ,0 ), SOC_DOUBLE_R("HPCOM Playback Switch", HPLCOM_CTRL, HPRCOM_CTRL, 3,
@@ -377,6 +366,19 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = { SOC_ENUM("ADC HPF Cut-off", aic3x_enum[ADC_HPF_ENUM]), }; +static const struct snd_kcontrol_new aic3x_mono_controls[] = { +SOC_DOUBLE_R_TLV ("Mono Line2 Bypass Volume" , +LINE2L_2_MONOLOPM_VOL ,LINE2R_2_MONOLOPM_VOL , +0 ,118 ,1 , output_stage_tlv), +SOC_DOUBLE_R_TLV ("Mono PGA Bypass Volume" , +PGAL_2_MONOLOPM_VOL ,PGAR_2_MONOLOPM_VOL , +0 ,118 ,1 , output_stage_tlv), +SOC_DOUBLE_R_TLV ("Mono DAC Playback Volume" , +DACL1_2_MONOLOPM_VOL ,DACR1_2_MONOLOPM_VOL , +0 ,118 ,1 , output_stage_tlv), +SOC_SINGLE ("Mono Playback Switch" ,MONOLOPM_CTRL ,3 ,0x01 ,0 ), +}; +/* * Class-D amplifier gain. From 0 to 18 dB in 6 dB steps */
@@ -526,9 +528,6 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = {SND_SOC_DAPM_PGA ("Right HP Out" ,HPROUT_CTRL ,0 ,0 ,NULL ,0 ),SND_SOC_DAPM_PGA ("Right HP Com" ,HPRCOM_CTRL ,0 ,0 ,NULL ,0 ), -/* Mono Output */ -SND_SOC_DAPM_PGA ("Mono Out" ,MONOLOPM_CTRL ,0 ,0 ,NULL ,0 ), -/* Inputs to Left ADC */ SND_SOC_DAPM_ADC ("Left ADC" ,"Left Capture" ,LINE1L_2_LADC_CTRL ,2 ,0 ), SND_SOC_DAPM_MIXER("Left PGA Mixer", SND_SOC_NOPM, 0, 0,
@@ -590,9 +589,6 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = {SND_SOC_DAPM_MIXER ("Right Line Mixer" ,SND_SOC_NOPM ,0 ,0 , &aic3x_right_line_mixer_controls[0 ],ARRAY_SIZE (aic3x_right_line_mixer_controls)), -SND_SOC_DAPM_MIXER ("Mono Mixer" ,SND_SOC_NOPM ,0 ,0 , - &aic3x_mono_mixer_controls[0 ], -ARRAY_SIZE (aic3x_mono_mixer_controls)),SND_SOC_DAPM_MIXER ("Left HP Mixer" ,SND_SOC_NOPM ,0 ,0 , &aic3x_left_hp_mixer_controls[0 ], ARRAY_SIZE(aic3x_left_hp_mixer_controls)),
@@ -608,7 +604,6 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = {SND_SOC_DAPM_OUTPUT ("LLOUT" ),SND_SOC_DAPM_OUTPUT ("RLOUT" ), -SND_SOC_DAPM_OUTPUT ("MONO_LOUT" ),SND_SOC_DAPM_OUTPUT ("HPLOUT" ),SND_SOC_DAPM_OUTPUT ("HPROUT" ), SND_SOC_DAPM_OUTPUT("HPLCOM"),
@@ -630,6 +625,18 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { SND_SOC_DAPM_OUTPUT("Detection"), }; +static const struct snd_soc_dapm_widget aic3x_dapm_mono_widgets[] = { +/* Mono Output */ +SND_SOC_DAPM_PGA ("Mono Out" ,MONOLOPM_CTRL ,0 ,0 ,NULL ,0 ), + +/* Output mixers */ +SND_SOC_DAPM_MIXER ("Mono Mixer" ,SND_SOC_NOPM ,0 ,0 , + &aic3x_mono_mixer_controls[0 ], +ARRAY_SIZE (aic3x_mono_mixer_controls)), + +SND_SOC_DAPM_OUTPUT ("MONO_LOUT" ), +}; +static const struct snd_soc_dapm_widget aic3007_dapm_widgets[] = {/* Class-D outputs */ SND_SOC_DAPM_PGA ("Left Class-D Out" ,CLASSD_CTRL ,3 ,0 ,NULL ,0 ),
@@ -714,17 +721,6 @@ static const struct snd_soc_dapm_route intercon[] = { {"Right Line Out", NULL, "Right DAC Mux"}, {"RLOUT", NULL, "Right Line Out"}, -/* Mono Output */ - {"Mono Mixer", "Line2L Bypass Switch", "Left Line2L Mux"}, - {"Mono Mixer", "PGAL Bypass Switch", "Left PGA Mixer"}, - {"Mono Mixer", "DACL1 Switch", "Left DAC Mux"}, - {"Mono Mixer", "Line2R Bypass Switch", "Right Line2R Mux"}, - {"Mono Mixer", "PGAR Bypass Switch", "Right PGA Mixer"}, - {"Mono Mixer", "DACR1 Switch", "Right DAC Mux"}, - - {"Mono Out", NULL, "Mono Mixer"}, - {"MONO_LOUT", NULL, "Mono Out"}, -/* Left HP Output */ {"Left HP Mixer", "Line2L Bypass Switch", "Left Line2L Mux"}, {"Left HP Mixer", "PGAL Bypass Switch", "Left PGA Mixer"},
@@ -780,6 +776,19 @@ static const struct snd_soc_dapm_route intercon[] = { {"HPRCOM", NULL, "Right HP Com"}, }; +static const struct snd_soc_dapm_route intercon_mono[] = { +/* Mono Output */ + {"Mono Mixer" ,"Line2L Bypass Switch" ,"Left Line2L Mux" }, + {"Mono Mixer" ,"PGAL Bypass Switch" ,"Left PGA Mixer" }, + {"Mono Mixer" ,"DACL1 Switch" ,"Left DAC Mux" }, + {"Mono Mixer" ,"Line2R Bypass Switch" ,"Right Line2R Mux" }, + {"Mono Mixer" ,"PGAR Bypass Switch" ,"Right PGA Mixer" }, + {"Mono Mixer" ,"DACR1 Switch" ,"Right DAC Mux" }, + + {"Mono Out" ,NULL ,"Mono Mixer" }, + {"MONO_LOUT" ,NULL ,"Mono Out" }, +}; +static const struct snd_soc_dapm_route intercon_3007[] = {/* Class-D outputs */ {"Left Class-D Out", NULL, "Left Line Out"},
@@ -804,6 +813,11 @@ static int aic3x_add_widgets(struct snd_soc_codec *codec) ARRAY_SIZE(aic3007_dapm_widgets));snd_soc_dapm_add_routes (dapm, intercon_3007,ARRAY_SIZE (intercon_3007)); + }else { +snd_soc_dapm_new_controls (dapm, aic3x_dapm_mono_widgets, +ARRAY_SIZE (aic3x_dapm_mono_widgets)); +snd_soc_dapm_add_routes (dapm, intercon_mono, +ARRAY_SIZE (intercon_mono)); }return 0 ;
@@ -1290,17 +1304,12 @@ static int aic3x_init(struct snd_soc_codec *codec)/* DAC to Line Out default volume and route to Output mixer */ snd_soc_write (codec,DACL1_2_LLOPM_VOL ,DEFAULT_VOL |ROUTE_ON );snd_soc_write (codec,DACR1_2_RLOPM_VOL ,DEFAULT_VOL |ROUTE_ON ); -/* DAC to Mono Line Out default volume and route to Output mixer */ -snd_soc_write (codec,DACL1_2_MONOLOPM_VOL ,DEFAULT_VOL |ROUTE_ON ); -snd_soc_write (codec,DACR1_2_MONOLOPM_VOL ,DEFAULT_VOL |ROUTE_ON );/* unmute all outputs */ reg =snd_soc_read (codec,LLOPM_CTRL );snd_soc_write (codec,LLOPM_CTRL , reg |UNMUTE ); reg =snd_soc_read (codec,RLOPM_CTRL );snd_soc_write (codec,RLOPM_CTRL , reg |UNMUTE ); - reg =snd_soc_read (codec,MONOLOPM_CTRL ); -snd_soc_write (codec,MONOLOPM_CTRL , reg |UNMUTE ); reg =snd_soc_read (codec,HPLOUT_CTRL );snd_soc_write (codec,HPLOUT_CTRL , reg |UNMUTE ); reg =snd_soc_read (codec,HPROUT_CTRL );
@@ -1325,9 +1334,6 @@ static int aic3x_init(struct snd_soc_codec *codec)/* PGA to Line Out default volume, disconnect from Output Mixer */ snd_soc_write (codec,PGAL_2_LLOPM_VOL ,DEFAULT_VOL );snd_soc_write (codec,PGAR_2_RLOPM_VOL ,DEFAULT_VOL ); -/* PGA to Mono Line Out default volume, disconnect from Output Mixer */ -snd_soc_write (codec,PGAL_2_MONOLOPM_VOL ,DEFAULT_VOL ); -snd_soc_write (codec,PGAR_2_MONOLOPM_VOL ,DEFAULT_VOL );/* Line2 to HP Bypass default volume, disconnect from Output Mixer */ snd_soc_write (codec,LINE2L_2_HPLOUT_VOL ,DEFAULT_VOL );
@@ -1337,14 +1343,30 @@ static int aic3x_init(struct snd_soc_codec *codec)/* Line2 Line Out default volume, disconnect from Output Mixer */ snd_soc_write (codec,LINE2L_2_LLOPM_VOL ,DEFAULT_VOL );snd_soc_write (codec,LINE2R_2_RLOPM_VOL ,DEFAULT_VOL ); -/* Line2 to Mono Out default volume, disconnect from Output Mixer */ -snd_soc_write (codec,LINE2L_2_MONOLOPM_VOL ,DEFAULT_VOL ); -snd_soc_write (codec,LINE2R_2_MONOLOPM_VOL ,DEFAULT_VOL );if (aic3x->model ==AIC3X_MODEL_3007 ) {aic3x_init_3007 (codec);snd_soc_write (codec,CLASSD_CTRL ,0 ); + +return 0 ; } +/* Not on AIC3X_MODEL_3007 init */ + +/* DAC to Mono Line Out default volume and route to Output mixer */ +snd_soc_write (codec,DACL1_2_MONOLOPM_VOL ,DEFAULT_VOL |ROUTE_ON ); +snd_soc_write (codec,DACR1_2_MONOLOPM_VOL ,DEFAULT_VOL |ROUTE_ON ); + +/* unmute outputs */ + reg =snd_soc_read (codec,MONOLOPM_CTRL ); +snd_soc_write (codec,MONOLOPM_CTRL , reg |UNMUTE ); + +/* PGA to Mono Line Out default volume, disconnect from Output Mixer */ +snd_soc_write (codec,PGAL_2_MONOLOPM_VOL ,DEFAULT_VOL ); +snd_soc_write (codec,PGAR_2_MONOLOPM_VOL ,DEFAULT_VOL ); + +/* Line2 to Mono Out default volume, disconnect from Output Mixer */ +snd_soc_write (codec,LINE2L_2_MONOLOPM_VOL ,DEFAULT_VOL ); +snd_soc_write (codec,LINE2R_2_MONOLOPM_VOL ,DEFAULT_VOL );return 0 ; }
@@ -1423,7 +1445,9 @@ static int aic3x_probe(struct snd_soc_codec *codec) ARRAY_SIZE(aic3x_snd_controls));if (aic3x->model ==AIC3X_MODEL_3007 )snd_soc_add_controls (codec, &aic3x_classd_amp_gain_ctrl,1 ); - +else +snd_soc_add_controls (codec, aic3x_mono_controls, +ARRAY_SIZE (aic3x_mono_controls));aic3x_add_widgets (codec);list_add (&aic3x->list, &reset_list);
Signature · 1 line
1.7.0.4
A message that is not in the archive (sent off-list or not yet received): 1310727555.26087.40.camel@lws-weitzel
Quoted 1 line · Jan Weitzel
Any rework needed?
It'd be easier to review the patch if you sent me a copy...
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Jan Weitzel
if codec driver is used for
AIC3X_MODEL_3007the mono iout controls overwrite registers for class-d amplifier.
classd amplifier controls are only used forAIC3X_MODEL_3007.Removing all mono
snd_kcontrol_new,snd_soc_dapm_widget,snd_soc_dapm_routeandaic3x_initstuff from common code and call only for notAIC3X_MODEL_3007codecs.
This is clearly not what your subject line says...
sound/soc/codecs/tlv320aic3x.c static int aic3x_init(struct snd_soc_codec *codec) · line 1354
Quoted 8 lines
sound/soc/codecs/tlv320aic3x.c +4
-0if (aic3x->model ==AIC3X_MODEL_3007 ) {aic3x_init_3007 (codec);snd_soc_write (codec,CLASSD_CTRL ,0 ); + +return 0 ; } +/* Not on AIC3X_MODEL_3007 init */ +
This is really not great legibility and it's going to get terribly confusing if someone comes up with some other device that also needs custom init. A similar issue applied to some of the other stuff but this is the most obvious example. I'd suggest restructuring this to have all the mono-specific code in an if statement that postively selects for the feature.
sound/soc/codecs/tlv320aic3x.c static int aic3x_probe(struct snd_soc_codec *codec) · line 1450
Quoted 6 lines
sound/soc/codecs/tlv320aic3x.c +3
-1if (aic3x->model ==AIC3X_MODEL_3007 )snd_soc_add_controls (codec, &aic3x_classd_amp_gain_ctrl,1 ); - +else +snd_soc_add_controls (codec, aic3x_mono_controls, +ARRAY_SIZE (aic3x_mono_controls));
This if ... else should really be a switch.
PATCH v2 1/1 ASoC: tlv320aic3x: no mono controls 3007 model
if codec driver is used for AIC3X_MODEL_3007 the mono iout controls overwrite registers for class-d amplifier.
classd amplifier controls are only used for AIC3X_MODEL_3007.
Removing all mono snd_kcontrol_new, snd_soc_dapm_widget, snd_soc_dapm_route and aic3x_init stuff from common code and call only for not AIC3X_MODEL_3007 codecs.
Testet only with AIC3X_MODEL_3007
--- sound/soc/codecs/tlv320aic3x.c | 129 ++++++++++++++++++++++++++-------------- 1 files changed, 85 insertions(+), 44 deletions(-)
v2: rename subject, was "sound: codec: tlv320aic3x: remove mono controls"
use switches, add aic3x_mono_init
sound/soc/codecs/tlv320aic3x.c +85 -44
@@ -324,16 +324,6 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = { DACL1_2_LLOPM_VOL, DACR1_2_RLOPM_VOL, 0, 118, 1, output_stage_tlv), -SOC_DOUBLE_R_TLV ("Mono Line2 Bypass Volume" , -LINE2L_2_MONOLOPM_VOL ,LINE2R_2_MONOLOPM_VOL , -0 ,118 ,1 , output_stage_tlv), -SOC_DOUBLE_R_TLV ("Mono PGA Bypass Volume" , -PGAL_2_MONOLOPM_VOL ,PGAR_2_MONOLOPM_VOL , -0 ,118 ,1 , output_stage_tlv), -SOC_DOUBLE_R_TLV ("Mono DAC Playback Volume" , -DACL1_2_MONOLOPM_VOL ,DACR1_2_MONOLOPM_VOL , -0 ,118 ,1 , output_stage_tlv), -SOC_DOUBLE_R_TLV ("HP Line2 Bypass Volume" ,LINE2L_2_HPLOUT_VOL ,LINE2R_2_HPROUT_VOL , 0, 118, 1, output_stage_tlv),
@@ -357,7 +347,6 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = {/* Output pin mute controls */ SOC_DOUBLE_R ("Line Playback Switch" ,LLOPM_CTRL ,RLOPM_CTRL ,3 ,0x01 ,0 ), -SOC_SINGLE ("Mono Playback Switch" ,MONOLOPM_CTRL ,3 ,0x01 ,0 ),SOC_DOUBLE_R ("HP Playback Switch" ,HPLOUT_CTRL ,HPROUT_CTRL ,3 ,0x01 ,0 ), SOC_DOUBLE_R("HPCOM Playback Switch", HPLCOM_CTRL, HPRCOM_CTRL, 3,
@@ -377,6 +366,19 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = { SOC_ENUM("ADC HPF Cut-off", aic3x_enum[ADC_HPF_ENUM]), }; +static const struct snd_kcontrol_new aic3x_mono_controls[] = { +SOC_DOUBLE_R_TLV ("Mono Line2 Bypass Volume" , +LINE2L_2_MONOLOPM_VOL ,LINE2R_2_MONOLOPM_VOL , +0 ,118 ,1 , output_stage_tlv), +SOC_DOUBLE_R_TLV ("Mono PGA Bypass Volume" , +PGAL_2_MONOLOPM_VOL ,PGAR_2_MONOLOPM_VOL , +0 ,118 ,1 , output_stage_tlv), +SOC_DOUBLE_R_TLV ("Mono DAC Playback Volume" , +DACL1_2_MONOLOPM_VOL ,DACR1_2_MONOLOPM_VOL , +0 ,118 ,1 , output_stage_tlv), +SOC_SINGLE ("Mono Playback Switch" ,MONOLOPM_CTRL ,3 ,0x01 ,0 ), +}; +/* * Class-D amplifier gain. From 0 to 18 dB in 6 dB steps */
@@ -526,9 +528,6 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = {SND_SOC_DAPM_PGA ("Right HP Out" ,HPROUT_CTRL ,0 ,0 ,NULL ,0 ),SND_SOC_DAPM_PGA ("Right HP Com" ,HPRCOM_CTRL ,0 ,0 ,NULL ,0 ), -/* Mono Output */ -SND_SOC_DAPM_PGA ("Mono Out" ,MONOLOPM_CTRL ,0 ,0 ,NULL ,0 ), -/* Inputs to Left ADC */ SND_SOC_DAPM_ADC ("Left ADC" ,"Left Capture" ,LINE1L_2_LADC_CTRL ,2 ,0 ), SND_SOC_DAPM_MIXER("Left PGA Mixer", SND_SOC_NOPM, 0, 0,
@@ -590,9 +589,6 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = {SND_SOC_DAPM_MIXER ("Right Line Mixer" ,SND_SOC_NOPM ,0 ,0 , &aic3x_right_line_mixer_controls[0 ],ARRAY_SIZE (aic3x_right_line_mixer_controls)), -SND_SOC_DAPM_MIXER ("Mono Mixer" ,SND_SOC_NOPM ,0 ,0 , - &aic3x_mono_mixer_controls[0 ], -ARRAY_SIZE (aic3x_mono_mixer_controls)),SND_SOC_DAPM_MIXER ("Left HP Mixer" ,SND_SOC_NOPM ,0 ,0 , &aic3x_left_hp_mixer_controls[0 ], ARRAY_SIZE(aic3x_left_hp_mixer_controls)),
@@ -608,7 +604,6 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = {SND_SOC_DAPM_OUTPUT ("LLOUT" ),SND_SOC_DAPM_OUTPUT ("RLOUT" ), -SND_SOC_DAPM_OUTPUT ("MONO_LOUT" ),SND_SOC_DAPM_OUTPUT ("HPLOUT" ),SND_SOC_DAPM_OUTPUT ("HPROUT" ), SND_SOC_DAPM_OUTPUT("HPLCOM"),
@@ -630,6 +625,18 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { SND_SOC_DAPM_OUTPUT("Detection"), }; +static const struct snd_soc_dapm_widget aic3x_dapm_mono_widgets[] = { +/* Mono Output */ +SND_SOC_DAPM_PGA ("Mono Out" ,MONOLOPM_CTRL ,0 ,0 ,NULL ,0 ), + +/* Output mixers */ +SND_SOC_DAPM_MIXER ("Mono Mixer" ,SND_SOC_NOPM ,0 ,0 , + &aic3x_mono_mixer_controls[0 ], +ARRAY_SIZE (aic3x_mono_mixer_controls)), + +SND_SOC_DAPM_OUTPUT ("MONO_LOUT" ), +}; +static const struct snd_soc_dapm_widget aic3007_dapm_widgets[] = {/* Class-D outputs */ SND_SOC_DAPM_PGA ("Left Class-D Out" ,CLASSD_CTRL ,3 ,0 ,NULL ,0 ),
@@ -714,17 +721,6 @@ static const struct snd_soc_dapm_route intercon[] = { {"Right Line Out", NULL, "Right DAC Mux"}, {"RLOUT", NULL, "Right Line Out"}, -/* Mono Output */ - {"Mono Mixer", "Line2L Bypass Switch", "Left Line2L Mux"}, - {"Mono Mixer", "PGAL Bypass Switch", "Left PGA Mixer"}, - {"Mono Mixer", "DACL1 Switch", "Left DAC Mux"}, - {"Mono Mixer", "Line2R Bypass Switch", "Right Line2R Mux"}, - {"Mono Mixer", "PGAR Bypass Switch", "Right PGA Mixer"}, - {"Mono Mixer", "DACR1 Switch", "Right DAC Mux"}, - - {"Mono Out", NULL, "Mono Mixer"}, - {"MONO_LOUT", NULL, "Mono Out"}, -/* Left HP Output */ {"Left HP Mixer", "Line2L Bypass Switch", "Left Line2L Mux"}, {"Left HP Mixer", "PGAL Bypass Switch", "Left PGA Mixer"},
@@ -780,6 +776,19 @@ static const struct snd_soc_dapm_route intercon[] = { {"HPRCOM", NULL, "Right HP Com"}, }; +static const struct snd_soc_dapm_route intercon_mono[] = { +/* Mono Output */ + {"Mono Mixer" ,"Line2L Bypass Switch" ,"Left Line2L Mux" }, + {"Mono Mixer" ,"PGAL Bypass Switch" ,"Left PGA Mixer" }, + {"Mono Mixer" ,"DACL1 Switch" ,"Left DAC Mux" }, + {"Mono Mixer" ,"Line2R Bypass Switch" ,"Right Line2R Mux" }, + {"Mono Mixer" ,"PGAR Bypass Switch" ,"Right PGA Mixer" }, + {"Mono Mixer" ,"DACR1 Switch" ,"Right DAC Mux" }, + + {"Mono Out" ,NULL ,"Mono Mixer" }, + {"MONO_LOUT" ,NULL ,"Mono Out" }, +}; +static const struct snd_soc_dapm_route intercon_3007[] = {/* Class-D outputs */ {"Left Class-D Out", NULL, "Left Line Out"},
@@ -798,12 +807,20 @@ static int aic3x_add_widgets(struct snd_soc_codec *codec)/* set up audio path interconnects */ snd_soc_dapm_add_routes (dapm, intercon,ARRAY_SIZE (intercon)); - -if (aic3x->model ==AIC3X_MODEL_3007 ) { +switch (aic3x->model) { +case AIC3X_MODEL_3X : +case AIC3X_MODEL_33 : +snd_soc_dapm_new_controls (dapm, aic3x_dapm_mono_widgets, +ARRAY_SIZE (aic3x_dapm_mono_widgets)); +snd_soc_dapm_add_routes (dapm, intercon_mono, +ARRAY_SIZE (intercon_mono)); +break ; +case AIC3X_MODEL_3007 :snd_soc_dapm_new_controls (dapm, aic3007_dapm_widgets,ARRAY_SIZE (aic3007_dapm_widgets));snd_soc_dapm_add_routes (dapm, intercon_3007,ARRAY_SIZE (intercon_3007)); +break ; }return 0 ;
@@ -1273,6 +1290,26 @@ static int aic3x_resume(struct snd_soc_codec *codec)return 0 ; } +static void aic3x_mono_init (struct snd_soc_codec *codec) { +int reg; + +/* DAC to Mono Line Out default volume and route to Output mixer */ +snd_soc_write (codec,DACL1_2_MONOLOPM_VOL ,DEFAULT_VOL |ROUTE_ON ); +snd_soc_write (codec,DACR1_2_MONOLOPM_VOL ,DEFAULT_VOL |ROUTE_ON ); + +/* unmute outputs */ + reg =snd_soc_read (codec,MONOLOPM_CTRL ); +snd_soc_write (codec,MONOLOPM_CTRL , reg |UNMUTE ); + +/* PGA to Mono Line Out default volume, disconnect from Output Mixer */ +snd_soc_write (codec,PGAL_2_MONOLOPM_VOL ,DEFAULT_VOL ); +snd_soc_write (codec,PGAR_2_MONOLOPM_VOL ,DEFAULT_VOL ); + +/* Line2 to Mono Out default volume, disconnect from Output Mixer */ +snd_soc_write (codec,LINE2L_2_MONOLOPM_VOL ,DEFAULT_VOL ); +snd_soc_write (codec,LINE2R_2_MONOLOPM_VOL ,DEFAULT_VOL ); +} +/* * initialise the AIC3X driver * register the mixer and dsp interfaces with the kernel
@@ -1297,17 +1334,12 @@ static int aic3x_init(struct snd_soc_codec *codec)/* DAC to Line Out default volume and route to Output mixer */ snd_soc_write (codec,DACL1_2_LLOPM_VOL ,DEFAULT_VOL |ROUTE_ON );snd_soc_write (codec,DACR1_2_RLOPM_VOL ,DEFAULT_VOL |ROUTE_ON ); -/* DAC to Mono Line Out default volume and route to Output mixer */ -snd_soc_write (codec,DACL1_2_MONOLOPM_VOL ,DEFAULT_VOL |ROUTE_ON ); -snd_soc_write (codec,DACR1_2_MONOLOPM_VOL ,DEFAULT_VOL |ROUTE_ON );/* unmute all outputs */ reg =snd_soc_read (codec,LLOPM_CTRL );snd_soc_write (codec,LLOPM_CTRL , reg |UNMUTE ); reg =snd_soc_read (codec,RLOPM_CTRL );snd_soc_write (codec,RLOPM_CTRL , reg |UNMUTE ); - reg =snd_soc_read (codec,MONOLOPM_CTRL ); -snd_soc_write (codec,MONOLOPM_CTRL , reg |UNMUTE ); reg =snd_soc_read (codec,HPLOUT_CTRL );snd_soc_write (codec,HPLOUT_CTRL , reg |UNMUTE ); reg =snd_soc_read (codec,HPROUT_CTRL );
@@ -1332,9 +1364,6 @@ static int aic3x_init(struct snd_soc_codec *codec)/* PGA to Line Out default volume, disconnect from Output Mixer */ snd_soc_write (codec,PGAL_2_LLOPM_VOL ,DEFAULT_VOL );snd_soc_write (codec,PGAR_2_RLOPM_VOL ,DEFAULT_VOL ); -/* PGA to Mono Line Out default volume, disconnect from Output Mixer */ -snd_soc_write (codec,PGAL_2_MONOLOPM_VOL ,DEFAULT_VOL ); -snd_soc_write (codec,PGAR_2_MONOLOPM_VOL ,DEFAULT_VOL );/* Line2 to HP Bypass default volume, disconnect from Output Mixer */ snd_soc_write (codec,LINE2L_2_HPLOUT_VOL ,DEFAULT_VOL );
@@ -1344,13 +1373,16 @@ static int aic3x_init(struct snd_soc_codec *codec)/* Line2 Line Out default volume, disconnect from Output Mixer */ snd_soc_write (codec,LINE2L_2_LLOPM_VOL ,DEFAULT_VOL );snd_soc_write (codec,LINE2R_2_RLOPM_VOL ,DEFAULT_VOL ); -/* Line2 to Mono Out default volume, disconnect from Output Mixer */ -snd_soc_write (codec,LINE2L_2_MONOLOPM_VOL ,DEFAULT_VOL ); -snd_soc_write (codec,LINE2R_2_MONOLOPM_VOL ,DEFAULT_VOL ); -if (aic3x->model ==AIC3X_MODEL_3007 ) { +switch (aic3x->model) { +case AIC3X_MODEL_3X : +case AIC3X_MODEL_33 : +aic3x_mono_init (codec); +break ; +case AIC3X_MODEL_3007 :aic3x_init_3007 (codec);snd_soc_write (codec,CLASSD_CTRL ,0 ); +break ; }return 0 ;
@@ -1428,8 +1460,17 @@ static int aic3x_probe(struct snd_soc_codec *codec)snd_soc_add_controls (codec, aic3x_snd_controls,ARRAY_SIZE (aic3x_snd_controls)); -if (aic3x->model ==AIC3X_MODEL_3007 ) + +switch (aic3x->model) { +case AIC3X_MODEL_3X : +case AIC3X_MODEL_33 : +snd_soc_add_controls (codec, aic3x_mono_controls, +ARRAY_SIZE (aic3x_mono_controls)); +break ; +case AIC3X_MODEL_3007 :snd_soc_add_controls (codec, &aic3x_classd_amp_gain_ctrl,1 ); +break ; + }aic3x_add_widgets (codec);list_add (&aic3x->list, &reset_list);
Signature · 1 line
1.7.0.4
Re: [PATCH v2] ASoC: tlv320aic3x: no mono controls 3007 model
Quoted 11 lines · Jan Weitzel
if codec driver is used for
AIC3X_MODEL_3007the mono iout controls overwrite registers for class-d amplifier.
classd amplifier controls are only used forAIC3X_MODEL_3007.Removing all mono
snd_kcontrol_new,snd_soc_dapm_widget,snd_soc_dapm_routeandaic3x_initstuff from common code and call only for notAIC3X_MODEL_3007codecs.Testet only with
AIC3X_MODEL_3007Signed-off-by Jan Weitzel <[email protected]>
PATCH v3 1/1 ASoC: tlv320aic3x: no mono controls 3007 model
if codec driver is used for AIC3X_MODEL_3007 the mono iout controls overwrite registers for class-d amplifier.
classd amplifier controls are only used for AIC3X_MODEL_3007.
Removing all mono snd_kcontrol_new, snd_soc_dapm_widget, snd_soc_dapm_route and aic3x_init stuff from common code and call only for not AIC3X_MODEL_3007 codecs.
Testet only with AIC3X_MODEL_3007
---
v2: rename subject, was "sound: codec: tlv320aic3x: remove mono controls"
use switches, add aic3x_mono_init
v3: add Acked-by, checkpatch cleanups
sound/soc/codecs/tlv320aic3x.c | 130 ++++++++++++++++++++++++++-------------- 1 files changed, 86 insertions(+), 44 deletions(-)
sound/soc/codecs/tlv320aic3x.c +86 -44
@@ -324,16 +324,6 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = { DACL1_2_LLOPM_VOL, DACR1_2_RLOPM_VOL, 0, 118, 1, output_stage_tlv), -SOC_DOUBLE_R_TLV ("Mono Line2 Bypass Volume" , -LINE2L_2_MONOLOPM_VOL ,LINE2R_2_MONOLOPM_VOL , -0 ,118 ,1 , output_stage_tlv), -SOC_DOUBLE_R_TLV ("Mono PGA Bypass Volume" , -PGAL_2_MONOLOPM_VOL ,PGAR_2_MONOLOPM_VOL , -0 ,118 ,1 , output_stage_tlv), -SOC_DOUBLE_R_TLV ("Mono DAC Playback Volume" , -DACL1_2_MONOLOPM_VOL ,DACR1_2_MONOLOPM_VOL , -0 ,118 ,1 , output_stage_tlv), -SOC_DOUBLE_R_TLV ("HP Line2 Bypass Volume" ,LINE2L_2_HPLOUT_VOL ,LINE2R_2_HPROUT_VOL , 0, 118, 1, output_stage_tlv),
@@ -357,7 +347,6 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = {/* Output pin mute controls */ SOC_DOUBLE_R ("Line Playback Switch" ,LLOPM_CTRL ,RLOPM_CTRL ,3 ,0x01 ,0 ), -SOC_SINGLE ("Mono Playback Switch" ,MONOLOPM_CTRL ,3 ,0x01 ,0 ),SOC_DOUBLE_R ("HP Playback Switch" ,HPLOUT_CTRL ,HPROUT_CTRL ,3 ,0x01 ,0 ), SOC_DOUBLE_R("HPCOM Playback Switch", HPLCOM_CTRL, HPRCOM_CTRL, 3,
@@ -377,6 +366,19 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = { SOC_ENUM("ADC HPF Cut-off", aic3x_enum[ADC_HPF_ENUM]), }; +static const struct snd_kcontrol_new aic3x_mono_controls[] = { +SOC_DOUBLE_R_TLV ("Mono Line2 Bypass Volume" , +LINE2L_2_MONOLOPM_VOL ,LINE2R_2_MONOLOPM_VOL , +0 ,118 ,1 , output_stage_tlv), +SOC_DOUBLE_R_TLV ("Mono PGA Bypass Volume" , +PGAL_2_MONOLOPM_VOL ,PGAR_2_MONOLOPM_VOL , +0 ,118 ,1 , output_stage_tlv), +SOC_DOUBLE_R_TLV ("Mono DAC Playback Volume" , +DACL1_2_MONOLOPM_VOL ,DACR1_2_MONOLOPM_VOL , +0 ,118 ,1 , output_stage_tlv), +SOC_SINGLE ("Mono Playback Switch" ,MONOLOPM_CTRL ,3 ,0x01 ,0 ), +}; +/* * Class-D amplifier gain. From 0 to 18 dB in 6 dB steps */
@@ -526,9 +528,6 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = {SND_SOC_DAPM_PGA ("Right HP Out" ,HPROUT_CTRL ,0 ,0 ,NULL ,0 ),SND_SOC_DAPM_PGA ("Right HP Com" ,HPRCOM_CTRL ,0 ,0 ,NULL ,0 ), -/* Mono Output */ -SND_SOC_DAPM_PGA ("Mono Out" ,MONOLOPM_CTRL ,0 ,0 ,NULL ,0 ), -/* Inputs to Left ADC */ SND_SOC_DAPM_ADC ("Left ADC" ,"Left Capture" ,LINE1L_2_LADC_CTRL ,2 ,0 ), SND_SOC_DAPM_MIXER("Left PGA Mixer", SND_SOC_NOPM, 0, 0,
@@ -590,9 +589,6 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = {SND_SOC_DAPM_MIXER ("Right Line Mixer" ,SND_SOC_NOPM ,0 ,0 , &aic3x_right_line_mixer_controls[0 ],ARRAY_SIZE (aic3x_right_line_mixer_controls)), -SND_SOC_DAPM_MIXER ("Mono Mixer" ,SND_SOC_NOPM ,0 ,0 , - &aic3x_mono_mixer_controls[0 ], -ARRAY_SIZE (aic3x_mono_mixer_controls)),SND_SOC_DAPM_MIXER ("Left HP Mixer" ,SND_SOC_NOPM ,0 ,0 , &aic3x_left_hp_mixer_controls[0 ], ARRAY_SIZE(aic3x_left_hp_mixer_controls)),
@@ -608,7 +604,6 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = {SND_SOC_DAPM_OUTPUT ("LLOUT" ),SND_SOC_DAPM_OUTPUT ("RLOUT" ), -SND_SOC_DAPM_OUTPUT ("MONO_LOUT" ),SND_SOC_DAPM_OUTPUT ("HPLOUT" ),SND_SOC_DAPM_OUTPUT ("HPROUT" ), SND_SOC_DAPM_OUTPUT("HPLCOM"),
@@ -630,6 +625,18 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { SND_SOC_DAPM_OUTPUT("Detection"), }; +static const struct snd_soc_dapm_widget aic3x_dapm_mono_widgets[] = { +/* Mono Output */ +SND_SOC_DAPM_PGA ("Mono Out" ,MONOLOPM_CTRL ,0 ,0 ,NULL ,0 ), + +/* Output mixers */ +SND_SOC_DAPM_MIXER ("Mono Mixer" ,SND_SOC_NOPM ,0 ,0 , + &aic3x_mono_mixer_controls[0 ], +ARRAY_SIZE (aic3x_mono_mixer_controls)), + +SND_SOC_DAPM_OUTPUT ("MONO_LOUT" ), +}; +static const struct snd_soc_dapm_widget aic3007_dapm_widgets[] = {/* Class-D outputs */ SND_SOC_DAPM_PGA ("Left Class-D Out" ,CLASSD_CTRL ,3 ,0 ,NULL ,0 ),
@@ -714,17 +721,6 @@ static const struct snd_soc_dapm_route intercon[] = { {"Right Line Out", NULL, "Right DAC Mux"}, {"RLOUT", NULL, "Right Line Out"}, -/* Mono Output */ - {"Mono Mixer", "Line2L Bypass Switch", "Left Line2L Mux"}, - {"Mono Mixer", "PGAL Bypass Switch", "Left PGA Mixer"}, - {"Mono Mixer", "DACL1 Switch", "Left DAC Mux"}, - {"Mono Mixer", "Line2R Bypass Switch", "Right Line2R Mux"}, - {"Mono Mixer", "PGAR Bypass Switch", "Right PGA Mixer"}, - {"Mono Mixer", "DACR1 Switch", "Right DAC Mux"}, - - {"Mono Out", NULL, "Mono Mixer"}, - {"MONO_LOUT", NULL, "Mono Out"}, -/* Left HP Output */ {"Left HP Mixer", "Line2L Bypass Switch", "Left Line2L Mux"}, {"Left HP Mixer", "PGAL Bypass Switch", "Left PGA Mixer"},
@@ -780,6 +776,19 @@ static const struct snd_soc_dapm_route intercon[] = { {"HPRCOM", NULL, "Right HP Com"}, }; +static const struct snd_soc_dapm_route intercon_mono[] = { +/* Mono Output */ + {"Mono Mixer" ,"Line2L Bypass Switch" ,"Left Line2L Mux" }, + {"Mono Mixer" ,"PGAL Bypass Switch" ,"Left PGA Mixer" }, + {"Mono Mixer" ,"DACL1 Switch" ,"Left DAC Mux" }, + {"Mono Mixer" ,"Line2R Bypass Switch" ,"Right Line2R Mux" }, + {"Mono Mixer" ,"PGAR Bypass Switch" ,"Right PGA Mixer" }, + {"Mono Mixer" ,"DACR1 Switch" ,"Right DAC Mux" }, + + {"Mono Out" ,NULL ,"Mono Mixer" }, + {"MONO_LOUT" ,NULL ,"Mono Out" }, +}; +static const struct snd_soc_dapm_route intercon_3007[] = {/* Class-D outputs */ {"Left Class-D Out", NULL, "Left Line Out"},
@@ -798,12 +807,20 @@ static int aic3x_add_widgets(struct snd_soc_codec *codec)/* set up audio path interconnects */ snd_soc_dapm_add_routes (dapm, intercon,ARRAY_SIZE (intercon)); - -if (aic3x->model ==AIC3X_MODEL_3007 ) { +switch (aic3x->model) { +case AIC3X_MODEL_3X : +case AIC3X_MODEL_33 : +snd_soc_dapm_new_controls (dapm, aic3x_dapm_mono_widgets, +ARRAY_SIZE (aic3x_dapm_mono_widgets)); +snd_soc_dapm_add_routes (dapm, intercon_mono, +ARRAY_SIZE (intercon_mono)); +break ; +case AIC3X_MODEL_3007 :snd_soc_dapm_new_controls (dapm, aic3007_dapm_widgets,ARRAY_SIZE (aic3007_dapm_widgets));snd_soc_dapm_add_routes (dapm, intercon_3007,ARRAY_SIZE (intercon_3007)); +break ; }return 0 ;
@@ -1273,6 +1290,27 @@ static int aic3x_resume(struct snd_soc_codec *codec)return 0 ; } +static void aic3x_mono_init (struct snd_soc_codec *codec) +{ +int reg; + +/* DAC to Mono Line Out default volume and route to Output mixer */ +snd_soc_write (codec,DACL1_2_MONOLOPM_VOL ,DEFAULT_VOL |ROUTE_ON ); +snd_soc_write (codec,DACR1_2_MONOLOPM_VOL ,DEFAULT_VOL |ROUTE_ON ); + +/* unmute outputs */ + reg =snd_soc_read (codec,MONOLOPM_CTRL ); +snd_soc_write (codec,MONOLOPM_CTRL , reg |UNMUTE ); + +/* PGA to Mono Line Out default volume, disconnect from Output Mixer */ +snd_soc_write (codec,PGAL_2_MONOLOPM_VOL ,DEFAULT_VOL ); +snd_soc_write (codec,PGAR_2_MONOLOPM_VOL ,DEFAULT_VOL ); + +/* Line2 to Mono Out default volume, disconnect from Output Mixer */ +snd_soc_write (codec,LINE2L_2_MONOLOPM_VOL ,DEFAULT_VOL ); +snd_soc_write (codec,LINE2R_2_MONOLOPM_VOL ,DEFAULT_VOL ); +} +/* * initialise the AIC3X driver * register the mixer and dsp interfaces with the kernel
@@ -1297,17 +1335,12 @@ static int aic3x_init(struct snd_soc_codec *codec)/* DAC to Line Out default volume and route to Output mixer */ snd_soc_write (codec,DACL1_2_LLOPM_VOL ,DEFAULT_VOL |ROUTE_ON );snd_soc_write (codec,DACR1_2_RLOPM_VOL ,DEFAULT_VOL |ROUTE_ON ); -/* DAC to Mono Line Out default volume and route to Output mixer */ -snd_soc_write (codec,DACL1_2_MONOLOPM_VOL ,DEFAULT_VOL |ROUTE_ON ); -snd_soc_write (codec,DACR1_2_MONOLOPM_VOL ,DEFAULT_VOL |ROUTE_ON );/* unmute all outputs */ reg =snd_soc_read (codec,LLOPM_CTRL );snd_soc_write (codec,LLOPM_CTRL , reg |UNMUTE ); reg =snd_soc_read (codec,RLOPM_CTRL );snd_soc_write (codec,RLOPM_CTRL , reg |UNMUTE ); - reg =snd_soc_read (codec,MONOLOPM_CTRL ); -snd_soc_write (codec,MONOLOPM_CTRL , reg |UNMUTE ); reg =snd_soc_read (codec,HPLOUT_CTRL );snd_soc_write (codec,HPLOUT_CTRL , reg |UNMUTE ); reg =snd_soc_read (codec,HPROUT_CTRL );
@@ -1332,9 +1365,6 @@ static int aic3x_init(struct snd_soc_codec *codec)/* PGA to Line Out default volume, disconnect from Output Mixer */ snd_soc_write (codec,PGAL_2_LLOPM_VOL ,DEFAULT_VOL );snd_soc_write (codec,PGAR_2_RLOPM_VOL ,DEFAULT_VOL ); -/* PGA to Mono Line Out default volume, disconnect from Output Mixer */ -snd_soc_write (codec,PGAL_2_MONOLOPM_VOL ,DEFAULT_VOL ); -snd_soc_write (codec,PGAR_2_MONOLOPM_VOL ,DEFAULT_VOL );/* Line2 to HP Bypass default volume, disconnect from Output Mixer */ snd_soc_write (codec,LINE2L_2_HPLOUT_VOL ,DEFAULT_VOL );
@@ -1344,13 +1374,16 @@ static int aic3x_init(struct snd_soc_codec *codec)/* Line2 Line Out default volume, disconnect from Output Mixer */ snd_soc_write (codec,LINE2L_2_LLOPM_VOL ,DEFAULT_VOL );snd_soc_write (codec,LINE2R_2_RLOPM_VOL ,DEFAULT_VOL ); -/* Line2 to Mono Out default volume, disconnect from Output Mixer */ -snd_soc_write (codec,LINE2L_2_MONOLOPM_VOL ,DEFAULT_VOL ); -snd_soc_write (codec,LINE2R_2_MONOLOPM_VOL ,DEFAULT_VOL ); -if (aic3x->model ==AIC3X_MODEL_3007 ) { +switch (aic3x->model) { +case AIC3X_MODEL_3X : +case AIC3X_MODEL_33 : +aic3x_mono_init (codec); +break ; +case AIC3X_MODEL_3007 :aic3x_init_3007 (codec);snd_soc_write (codec,CLASSD_CTRL ,0 ); +break ; }return 0 ;
@@ -1428,8 +1461,17 @@ static int aic3x_probe(struct snd_soc_codec *codec)snd_soc_add_controls (codec, aic3x_snd_controls,ARRAY_SIZE (aic3x_snd_controls)); -if (aic3x->model ==AIC3X_MODEL_3007 ) + +switch (aic3x->model) { +case AIC3X_MODEL_3X : +case AIC3X_MODEL_33 : +snd_soc_add_controls (codec, aic3x_mono_controls, +ARRAY_SIZE (aic3x_mono_controls)); +break ; +case AIC3X_MODEL_3007 :snd_soc_add_controls (codec, &aic3x_classd_amp_gain_ctrl,1 ); +break ; + }aic3x_add_widgets (codec);list_add (&aic3x->list, &reset_list);
Signature · 1 line
1.7.0.4