From caa10b6e808a4d65eb0306f0006308244f2b8d79 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 20 Jan 2009 17:19:01 +0100 Subject: 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 --- sound/pci/hda/patch_sigmatel.c | 58 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 10 deletions(-) (limited to 'sound/pci/hda/patch_sigmatel.c') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index a4d4afe6b4f..b6e797d1c21 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -5511,24 +5511,62 @@ static struct snd_pci_quirk stac9872_cfg_tbl[] = { {} }; +static struct snd_kcontrol_new stac9872_mixer[] = { + HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), + HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), + STAC_INPUT_SOURCE(1), + { } /* end */ +}; + +static hda_nid_t stac9872_pin_nids[] = { + 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x11, 0x13, 0x14, +}; + +static hda_nid_t stac9872_adc_nids[] = { + 0x8 /*,0x6*/ +}; + +static hda_nid_t stac9872_mux_nids[] = { + 0x15 +}; + static int patch_stac9872(struct hda_codec *codec) { struct sigmatel_spec *spec; - int board_config; - board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, - stac9872_models, - stac9872_cfg_tbl); - if (board_config < 0) - /* unknown config, let generic-parser do its job... */ - return snd_hda_parse_generic_codec(codec); - spec = kzalloc(sizeof(*spec), GFP_KERNEL); if (spec == NULL) return -ENOMEM; - codec->spec = spec; - switch (board_config) { + + spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, + stac9872_models, + stac9872_cfg_tbl); + if (spec->board_config < 0) { + int err; + + spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); + spec->pin_nids = stac9872_pin_nids; + spec->multiout.dac_nids = spec->dac_nids; + spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids); + spec->adc_nids = stac9872_adc_nids; + spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids); + spec->mux_nids = stac9872_mux_nids; + spec->mixer = stac9872_mixer; + spec->init = vaio_init; + + err = stac92xx_parse_auto_config(codec, 0x10, 0x12); + if (err < 0) { + stac92xx_free(codec); + return -EINVAL; + } + spec->input_mux = &spec->private_imux; + codec->patch_ops = stac92xx_patch_ops; + return 0; + } + + switch (spec->board_config) { case CXD9872RD_VAIO: case STAC9872AK_VAIO: case STAC9872K_VAIO: -- cgit v1.2.3