[alsa-devel] pci/hda/patch_via.c - broken between 2.6.36 and 2.6.37 (bisected)

Mark Goldstein goldstein.mark at gmail.com
Mon Feb 21 07:55:38 CET 2011


On Mon, Feb 21, 2011 at 5:01 AM, Raymond Yau
<superquad.vortex2 at gmail.com> wrote:
> 2011/2/20 Mark Goldstein <goldstein.mark at gmail.com>
>
>>
>> I think the Mic part might be the same problem I had. I found out that
>> the following code:
>>
>> 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);
>>       }
>> }
>>
>> configures correctly only the first MIC (in my case it was Rear MIC).
>> Front Mic pin was configured as HiZ.
>> Changing the underlined condition to
>>
>> else if (cfg->input[i].type == AUTO_PIN_MIC)
>>
>> resolved the issue for me. (In alsa driver 1.0.23 this code was
>> different, it checked that i <= FRONT_MIC index).
>>
>
> This may fix your vt1708s smart51 since only rear mic and line in are
> retasked
>
>
> static int is_smart51_pins(struct via_spec *spec, hda_nid_t pin)
> {
>    const struct auto_pin_cfg *cfg = &spec->autocfg;
>    int i;
>        if (cfg->line_outs != 1)
>        return 0;
>    for (i = 0; i < cfg->num_inputs; i++) {
>        if (pin == cfg->inputs[i].pin) {
>                        switch(cfg->inputs[i].type){
>            case AUTO_PIN_LINE_IN:
>                    return 1;
>                        case AUTO_PIN_MIC:
>                                if (
> strncmp(hda_get_autocfg_input_label(spec->codec,cfg,i),"Rear Mic",8) == 0 )
>                           return 1;
>                else
>                    return 0;
>            default:
>                return 0;
>                        }
>                }
>    }
>    return 0;
> }
>
> http://git.alsa-project.org/?p=alsa-kernel.git;a=commit;h=1564b2878f5cf160f60af99d4dbca1dd7809ee8a
>
> Smart 5.1 is for 3-jacks model, to reuse input pins as outputs.
> While off, they act as "line out" / "line in" / "mic in".
> While on, they acts as "line out" / "back left/right" / "center/lfe".

Hi Raymond,
I've always had spart5.1 disabled and still Front Mic PIN has been
configured as High Impedance and did not work until I changed the code
as I described.

What I see in this function (is_smart51_pins) is that pin type is
checked the same way I tried, that is cfg->inputs[i].type is compared
to AUTO_PIN_MIC and not "i" itself as in the code of
via_auto_init_analog_input.

So should the via_auto_init_analog_input be fixed? What do you think?

BTW for some reason I can't see the link included in your mail, I'm
getting: 403 Forbidden - No such project

Thank you & regards,
-- 
Mark Goldstein


More information about the Alsa-devel mailing list