ALSA: hda - Create capture source ctls when stereo mix input is added
PATCH 1/2 ALSA: hda - Create capture source ctls when stereo mix input is added
When the stereo mix input is explicitly enabled via a user hint, the driver should create always a capture source enum ctl and disable the auto-mic switch. Otherwise the behavior gets confused. For doing it, this patch just sets spec->suppress_auto_mic flag appropriately.
--- sound/pci/hda/hda_generic.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/hda_generic.c +2 -0
@@ -3224,6 +3224,8 @@ static int create_input_ctls(struct hda_codec *codec) "Stereo Mix", 0);if (err <0 )return err; +else + spec->suppress_auto_mic =1 ; }return 0 ;
Signature · 1 line
2.2.0
PATCH 2/2 ALSA: hda - Make add_stereo_mix_input flag tristate
... for distinguishing whether it's explicitly enabled via a user hint or enabled by a driver as a fallback. Now the former case corresponds to HDA_HINT_STEREO_MIX_ENABLE while the latter to HDA_HINT_STEREO_MIX_AUTO.
--- sound/pci/hda/hda_generic.c | 8 +++----- sound/pci/hda/hda_generic.h | 9 ++++++++- sound/pci/hda/patch_analog.c | 3 ++- sound/pci/hda/patch_conexant.c | 4 ++-- sound/pci/hda/patch_via.c | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-)
sound/pci/hda/hda_generic.c +3 -5
@@ -3218,8 +3218,7 @@ static int create_input_ctls(struct hda_codec *codec) }/* add stereo mix when explicitly enabled via hint */ -if (mixer && spec->add_stereo_mix_input && -snd_hda_get_bool_hint (codec,"add_stereo_mix_input" ) >0 ) { +if (mixer && spec->add_stereo_mix_input ==HDA_HINT_STEREO_MIX_ENABLE ) { err =parse_capture_source (codec, mixer,CFG_IDX_MIX , num_adcs,"Stereo Mix" ,0 );if (err <0 )
@@ -4544,9 +4543,8 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec,/* add stereo mix if available and not enabled yet */ if (!spec->auto_mic && spec->mixer_nid && - spec->add_stereo_mix_input && - spec->input_mux.num_items >1 && -snd_hda_get_bool_hint (codec,"add_stereo_mix_input" ) <0 ) { + spec->add_stereo_mix_input ==HDA_HINT_STEREO_MIX_AUTO && + spec->input_mux.num_items >1 ) { err =parse_capture_source (codec, spec->mixer_nid,CFG_IDX_MIX , spec->num_all_adcs,"Stereo Mix" ,0 );
sound/pci/hda/hda_generic.h +8 -1
@@ -222,7 +222,7 @@ struct hda_gen_spec { unsigned int vmaster_mute_enum:1; /* add vmaster mute mode enum */ unsigned int indep_hp:1; /* independent HP supported */ unsigned int prefer_hp_amp:1; /* enable HP amp for speaker if any */ - unsigned int add_stereo_mix_input:1; /* add aamix as a capture src */ + unsigned int add_stereo_mix_input:2; /* add aamix as a capture src */ unsigned int add_jack_modes:1; /* add i/o jack mode enum ctls */ unsigned int power_down_unused:1; /* power down unused widgets */ unsigned int dac_min_mute:1; /* minimal = mute for DACs */
@@ -291,6 +291,13 @@ struct hda_gen_spec { struct hda_jack_callback *cb); }; +/* values for add_stereo_mix_input flag */ +enum { +HDA_HINT_STEREO_MIX_DISABLE ,/* No stereo mix input */ +HDA_HINT_STEREO_MIX_ENABLE ,/* Add stereo mix input */ +HDA_HINT_STEREO_MIX_AUTO ,/* Add only if auto-mic is disabled */ +}; +int snd_hda_gen_spec_init (struct hda_gen_spec *spec);int snd_hda_gen_init (struct hda_codec *codec);
sound/pci/hda/patch_analog.c +2 -1
@@ -195,7 +195,8 @@ static int ad198x_parse_auto_config(struct hda_codec *codec, bool indep_hp) codec->no_sticky_stream =1 ; spec->gen.indep_hp = indep_hp; - spec->gen.add_stereo_mix_input =1 ; +if (!spec->gen.add_stereo_mix_input) + spec->gen.add_stereo_mix_input =HDA_HINT_STEREO_MIX_AUTO ; err =snd_hda_parse_pin_defcfg (codec, cfg,NULL ,0 );if (err <0 )
sound/pci/hda/patch_conexant.c +2 -2
@@ -855,14 +855,14 @@ static int patch_conexant_auto(struct hda_codec *codec)case 0x14f15045 : codec->single_adc_amp =1 ; spec->gen.mixer_nid =0x17 ; - spec->gen.add_stereo_mix_input =1 ; + spec->gen.add_stereo_mix_input =HDA_HINT_STEREO_MIX_AUTO ;snd_hda_pick_fixup (codec, cxt5045_fixup_models, cxt5045_fixups, cxt_fixups);break ;case 0x14f15047 : codec->pin_amp_workaround =1 ; spec->gen.mixer_nid =0x19 ; - spec->gen.add_stereo_mix_input =1 ; + spec->gen.add_stereo_mix_input =HDA_HINT_STEREO_MIX_AUTO ;snd_hda_pick_fixup (codec, cxt5047_fixup_models, cxt5047_fixups, cxt_fixups);break ;
sound/pci/hda/patch_via.c +1 -1
@@ -137,7 +137,7 @@ static struct via_spec *via_new_spec(struct hda_codec *codec) spec->gen.indep_hp =1 ; spec->gen.keep_eapd_on =1 ; spec->gen.pcm_playback_hook = via_playback_pcm_hook; - spec->gen.add_stereo_mix_input =1 ; + spec->gen.add_stereo_mix_input =HDA_HINT_STEREO_MIX_AUTO ;return spec; }
Signature · 1 line
2.2.0
Quoted 6 lines
When the stereo mix input is explicitly enabled via a user hint, the driver should create always a capture source enum ctl and disable the auto-mic switch. Otherwise the behavior gets confused. For doing it, this patch just sets
spec->suppress_auto_micflag appropriately.
As your patch allow notebook to use stereo mix by hint , does it mean that those audio mixer which only have input from audio output but no mic or line input can be also enabled on notebook by hint ?
https://bugzilla.kernel.org/attachment.cgi?id=144111
Node 0x14 [Audio Input] wcaps 0x100d1b: Stereo Amp-In R/L
Control: name="Capture Volume", index=0, device=0
ControlAmp: chs=3, dir=In, idx=0, ofs=0
Control: name="Capture Switch", index=0, device=0
ControlAmp: chs=3, dir=In, idx=0, ofs=0
Device: name="CX20590 Analog", type="Audio", device=0
Amp-In caps: ofs=0x4a, nsteps=0x50, stepsize=0x03, mute=1
Amp-In vals: [0x50 0x50] [0x80 0x80] [0x50 0x50] [0x80 0x80]
Converter: stream=1, channel=0
SDI-Select: 0
PCM:
rates [0x160]: 44100 48000 96000
bits [0xe]: 16 20 24
formats [0x1]: PCM
Power states: D0 D1 D2 D3 D3cold EPSS
Power: setting=D0, actual=D0
Connection: 4
0x17 0x18 0x23* 0x24Node 0x24 [Audio Mixer] wcaps 0x20050b: Stereo Amp-In
Amp-In caps: ofs=0x4a, nsteps=0x4a, stepsize=0x03, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00]
Power states: D0 D1 D2 D3 D3cold EPSS
Power: setting=D0, actual=D0
Connection: 2
0x10 0x11
At Thu, 18 Dec 2014 15:13:13 +0800,
Quoted 11 lines · Raymond Yau
Quoted 7 lines
When the stereo mix input is explicitly enabled via a user hint, the driver should create always a capture source enum ctl and disable the auto-mic switch. Otherwise the behavior gets confused. For doing it, this patch just sets
spec->suppress_auto_micflag appropriately.As your patch allow notebook to use stereo mix by hint , does it mean that those audio mixer which only have input from audio output but no mic or line input can be also enabled on notebook by hint ?
The patch doesn't change anything about the already implemented behavior.
Takashi