Commit caa10b6e808a4d65eb0306f0006308244f2b8d79
1 parent
1b52ae701f
Exists in
master
and in
20 other branches
ALSA: hda - Improve auto-probing of STAC9872 codec
Use the standard STAC/IDT auto-probing routine for non-static STAC9872 codec probing. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Showing 1 changed file with 48 additions and 10 deletions Side-by-side Diff
sound/pci/hda/patch_sigmatel.c
... | ... | @@ -5511,24 +5511,62 @@ |
5511 | 5511 | {} |
5512 | 5512 | }; |
5513 | 5513 | |
5514 | +static struct snd_kcontrol_new stac9872_mixer[] = { | |
5515 | + HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), | |
5516 | + HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), | |
5517 | + STAC_INPUT_SOURCE(1), | |
5518 | + { } /* end */ | |
5519 | +}; | |
5520 | + | |
5521 | +static hda_nid_t stac9872_pin_nids[] = { | |
5522 | + 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | |
5523 | + 0x11, 0x13, 0x14, | |
5524 | +}; | |
5525 | + | |
5526 | +static hda_nid_t stac9872_adc_nids[] = { | |
5527 | + 0x8 /*,0x6*/ | |
5528 | +}; | |
5529 | + | |
5530 | +static hda_nid_t stac9872_mux_nids[] = { | |
5531 | + 0x15 | |
5532 | +}; | |
5533 | + | |
5514 | 5534 | static int patch_stac9872(struct hda_codec *codec) |
5515 | 5535 | { |
5516 | 5536 | struct sigmatel_spec *spec; |
5517 | - int board_config; | |
5518 | 5537 | |
5519 | - board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, | |
5520 | - stac9872_models, | |
5521 | - stac9872_cfg_tbl); | |
5522 | - if (board_config < 0) | |
5523 | - /* unknown config, let generic-parser do its job... */ | |
5524 | - return snd_hda_parse_generic_codec(codec); | |
5525 | - | |
5526 | 5538 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
5527 | 5539 | if (spec == NULL) |
5528 | 5540 | return -ENOMEM; |
5529 | - | |
5530 | 5541 | codec->spec = spec; |
5531 | - switch (board_config) { | |
5542 | + | |
5543 | + spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, | |
5544 | + stac9872_models, | |
5545 | + stac9872_cfg_tbl); | |
5546 | + if (spec->board_config < 0) { | |
5547 | + int err; | |
5548 | + | |
5549 | + spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); | |
5550 | + spec->pin_nids = stac9872_pin_nids; | |
5551 | + spec->multiout.dac_nids = spec->dac_nids; | |
5552 | + spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids); | |
5553 | + spec->adc_nids = stac9872_adc_nids; | |
5554 | + spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids); | |
5555 | + spec->mux_nids = stac9872_mux_nids; | |
5556 | + spec->mixer = stac9872_mixer; | |
5557 | + spec->init = vaio_init; | |
5558 | + | |
5559 | + err = stac92xx_parse_auto_config(codec, 0x10, 0x12); | |
5560 | + if (err < 0) { | |
5561 | + stac92xx_free(codec); | |
5562 | + return -EINVAL; | |
5563 | + } | |
5564 | + spec->input_mux = &spec->private_imux; | |
5565 | + codec->patch_ops = stac92xx_patch_ops; | |
5566 | + return 0; | |
5567 | + } | |
5568 | + | |
5569 | + switch (spec->board_config) { | |
5532 | 5570 | case CXD9872RD_VAIO: |
5533 | 5571 | case STAC9872AK_VAIO: |
5534 | 5572 | case STAC9872K_VAIO: |