diff options
| author | Takashi Iwai <tiwai@suse.de> | 2010-08-30 07:04:44 -0400 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2010-08-30 07:04:44 -0400 |
| commit | 9e042e71325eeda03636aedfde6f2d27d6332188 (patch) | |
| tree | 7136a07ca3ddd506241d7289669c8c63ee359522 | |
| parent | d7b1ae9d8851bd247590cf7ab53248a2dac0419f (diff) | |
ALSA: hda - Use new inputs[] field to parse input-pins for AD codecs
Signed-off-by: Takashi Iwai <tiwai@suse.de>
| -rw-r--r-- | sound/pci/hda/patch_analog.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index b697fd2a6f8b..3409d315f507 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
| @@ -2880,7 +2880,7 @@ static int ad1988_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | |||
| 2880 | 2880 | ||
| 2881 | /* create input playback/capture controls for the given pin */ | 2881 | /* create input playback/capture controls for the given pin */ |
| 2882 | static int new_analog_input(struct ad198x_spec *spec, hda_nid_t pin, | 2882 | static int new_analog_input(struct ad198x_spec *spec, hda_nid_t pin, |
| 2883 | const char *ctlname, int boost) | 2883 | const char *ctlname, int ctlidx, int boost) |
| 2884 | { | 2884 | { |
| 2885 | char name[32]; | 2885 | char name[32]; |
| 2886 | int err, idx; | 2886 | int err, idx; |
| @@ -2913,16 +2913,23 @@ static int ad1988_auto_create_analog_input_ctls(struct ad198x_spec *spec, | |||
| 2913 | const struct auto_pin_cfg *cfg) | 2913 | const struct auto_pin_cfg *cfg) |
| 2914 | { | 2914 | { |
| 2915 | struct hda_input_mux *imux = &spec->private_imux; | 2915 | struct hda_input_mux *imux = &spec->private_imux; |
| 2916 | int i, err; | 2916 | int i, err, type, type_idx = 0; |
| 2917 | 2917 | ||
| 2918 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 2918 | for (i = 0; i < cfg->num_inputs; i++) { |
| 2919 | err = new_analog_input(spec, cfg->input_pins[i], | 2919 | type = cfg->inputs[i].type; |
| 2920 | auto_pin_cfg_labels[i], | 2920 | if (i > 0 && type != cfg->inputs[i - 1].type) |
| 2921 | i <= AUTO_PIN_FRONT_MIC); | 2921 | type_idx++; |
| 2922 | else | ||
| 2923 | type_idx = 0; | ||
| 2924 | err = new_analog_input(spec, cfg->inputs[i].pin, | ||
| 2925 | auto_pin_cfg_labels[type], type_idx, | ||
| 2926 | type <= AUTO_PIN_FRONT_MIC); | ||
| 2922 | if (err < 0) | 2927 | if (err < 0) |
| 2923 | return err; | 2928 | return err; |
| 2924 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; | 2929 | imux->items[imux->num_items].label = |
| 2925 | imux->items[imux->num_items].index = ad1988_pin_to_adc_idx(cfg->input_pins[i]); | 2930 | snd_hda_get_input_pin_label(cfg, i); |
| 2931 | imux->items[imux->num_items].index = | ||
| 2932 | ad1988_pin_to_adc_idx(cfg->inputs[i].pin); | ||
| 2926 | imux->num_items++; | 2933 | imux->num_items++; |
| 2927 | } | 2934 | } |
| 2928 | imux->items[imux->num_items].label = "Mix"; | 2935 | imux->items[imux->num_items].label = "Mix"; |
| @@ -2994,12 +3001,11 @@ static void ad1988_auto_init_extra_out(struct hda_codec *codec) | |||
| 2994 | static void ad1988_auto_init_analog_input(struct hda_codec *codec) | 3001 | static void ad1988_auto_init_analog_input(struct hda_codec *codec) |
| 2995 | { | 3002 | { |
| 2996 | struct ad198x_spec *spec = codec->spec; | 3003 | struct ad198x_spec *spec = codec->spec; |
| 3004 | const struct auto_pin_cfg *cfg = &spec->autocfg; | ||
| 2997 | int i, idx; | 3005 | int i, idx; |
| 2998 | 3006 | ||
| 2999 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 3007 | for (i = 0; i < cfg->num_inputs; i++) { |
| 3000 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 3008 | hda_nid_t nid = cfg->inputs[i].pin; |
| 3001 | if (! nid) | ||
| 3002 | continue; | ||
| 3003 | switch (nid) { | 3009 | switch (nid) { |
| 3004 | case 0x15: /* port-C */ | 3010 | case 0x15: /* port-C */ |
| 3005 | snd_hda_codec_write(codec, 0x33, 0, AC_VERB_SET_CONNECT_SEL, 0x0); | 3011 | snd_hda_codec_write(codec, 0x33, 0, AC_VERB_SET_CONNECT_SEL, 0x0); |
