On Mon, Jan 31, 2011 at 4:26 PM, Raymond Yau superquad.vortex2@gmail.com wrote:
2011/1/31 Mark Goldstein goldstein.mark@gmail.com
Raymond,
On Mon, Jan 31, 2011 at 11:22 AM, Raymond Yau superquad.vortex2@gmail.com wrote:
2011/1/29 Mark Goldstein goldstein.mark@gmail.com
On Sat, Jan 29, 2011 at 12:53 PM, Mark Goldstein goldstein.mark@gmail.com wrote:
On Sat, Jan 29, 2011 at 12:42 PM, Mark Goldstein goldstein.mark@gmail.com wrote:
On Sat, Jan 29, 2011 at 11:37 AM, Mark Goldstein goldstein.mark@gmail.com wrote: > On Fri, Jan 28, 2011 at 2:47 AM, Raymond Yau > superquad.vortex2@gmail.com wrote: >> 2011/1/27 Mark Goldstein goldstein.mark@gmail.com >> >>> On Thu, Jan 27, 2011 at 11:09 AM, Raymond Yau >>> superquad.vortex2@gmail.com wrote: >>> > 2011/1/27 Mark Goldstein goldstein.mark@gmail.com >>> >
> Still trying to figure out why only Rear Mic works while Front Mic
does
not.
Ok, for some reason Pin-ctls for Front Mic (0x1e) set to VREF Hi-Z. After I set it to VREF 50 using hda-analyser, Front Mic started working. Have to figure out why it is set to Hi-Z.
static void via_auto_init_analog_input(struct hda_codec *codec) { struct via_spec *spec = codec->spec; const struct auto_pin_cfg *cfg = &spec->autocfg; unsigned int ctl; int i;
for (i = 0; i < cfg->num_inputs; i++) { hda_nid_t nid = cfg->inputs[i].pin; if (spec->smart51_enabled && is_smart51_pins(spec,
nid))
ctl = PIN_OUT; else if (i == AUTO_PIN_MIC) ^^^^^^^^^^^^^^^^^^^^^^^^^ ctl = PIN_VREF50; else ctl = PIN_IN; snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
ctl);
} }
Should it probably be else if (cfg->input[i].type == AUTO_PIN_MIC) ?
OK, now it works for me. So totally there were 3 changes:
- setting of PIN control for Mics
- shifting the ids in pin_idxs one position to the right
- using specialized version of vt_auto_create_analog_input_ctls, that
passes idx - 1 to snd_hda_add_imux_item.
Well, instead of last two changes it was probably possible to use only 3rd, but instead of passing idx - 1 to snd_hda_add_imux_item pass idx
- 1 to via_new_analog_input.
Of course it should be done in more common way, since not only VT1708S used different indexes for via_new_analog_input and snd_hda_add_imux_item.
The reason is assign "Stereo Mix" as first element of input source ,
In snd_hda_input_mux_put() , imux->items[].index is the position of the
pin
in the connection list
snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, imux->items[idx].index);
if you look at print_codec_info() in hda_proc.c
you can get the connection list of imux using snd_hda_get_connections()
conn_len = snd_hda_get_connections(codec, nid, conn, HDA_MAX_CONNECTIONS);
... Not sure what do you mean. In case of VT1708S Stereo Mixer is added with index 5 (and it was so in 1.0.23 also). I noticed that in part of the codecs Stereo Mixer is passed with index 0 and there the same idx is used for both snd_hda_add_imux_item and via_new_analog_input. But for VT1708S and some others Stereo Mixer is passed as the last element in the array.
In any case, using of idx and idx -1 definitely resolved the problem.
Also I think that the issue with Mic Pin configuration is generic for patch_via.c - if you have more than one Mic, the current git code will configure correctly only the first one (index 0). In 1.0.23 the code was checking whether index is < that that of the FrontMic. Probably it assumed that Front Mic is always the last one in the connection list. The new code only checks for index 0. Since there is now explicit field for input type, I think the change I did (cfg->input[i].type == AUTO_PIN_MIC) should be OK.
Node 0x17 [Audio Selector] wcaps 0x300501: Stereo Control: name="Input Source", index=0, device=0 Power states: D0 D1 D2 D3 Power: setting=D0, actual=D0 Connection: 6 0x1f 0x1a* 0x1b 0x1e 0x1d 0x16
static int vt1708S_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg) { static hda_nid_t pin_idxs[] = { 0x1f, 0x1a, 0x1b, 0x1e, 0, 0xff }; return vt_auto_create_analog_input_ctls(codec, cfg, 0x16, pin_idxs, ARRAY_SIZE(pin_idxs)); }
you should notice that pin_idxs[] is just the connection list of imux node 0x17
the position of 0xff is the nid of the stereo mixer 0x16
0x1f [Fixed] CD is also input pins
you don't need to add 0x1d since 0x1d is not in cfg->inputs[i].pin
The routine just add stereo mixer first into the input source items
Yes, and that's exactly what did not work for me. Looking into vt_auto_create_analog_input_ctls, I saw that it passes indexes 0, 1, 2, 3 for CD, Rear Mic, Line and Front Mic to both snd_hda_add_imux_item and via_new_analog_input, while in the 1.0.23 for vt1708s vt1708S_auto_create_analog_input_ctls passed the same 0,1,2,3 to snd_hda_add_imux_item, but 1,2,3,4 to via_new_analog_input. When I did the same, everything started working.
So probably to do it in common way, I would suggest to add another parameter "idx_offset" to vt_auto_create_analog_input_ctls. Then for the codecs that require the same indexes for both functions, pass idx_offset 0 and for these like vt1708s, pass idx_offset 1. And then vt_auto_create_analog_input_ctls will pass idx+idx_offset to via_new_analog_input.
Regards,