diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-08-30 07:05:30 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-08-30 07:05:30 -0400 |
commit | c1e0bb92174dd16ffba5be0e4e5fbd366f61ff7f (patch) | |
tree | caf072d1c13e807e4742ee36f21d018a19a0dc0b | |
parent | fa4968a8b231816d161583e604a9f972e5713f17 (diff) |
ALSA: hda - Use new inputs[] field to parse input-pins for CirrusLogic codecs
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/patch_cirrus.c | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 4ef5efaaaef1..ee1aea7296eb 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
@@ -329,7 +329,7 @@ static int is_ext_mic(struct hda_codec *codec, unsigned int idx) | |||
329 | { | 329 | { |
330 | struct cs_spec *spec = codec->spec; | 330 | struct cs_spec *spec = codec->spec; |
331 | struct auto_pin_cfg *cfg = &spec->autocfg; | 331 | struct auto_pin_cfg *cfg = &spec->autocfg; |
332 | hda_nid_t pin = cfg->input_pins[idx]; | 332 | hda_nid_t pin = cfg->inputs[idx].pin; |
333 | unsigned int val = snd_hda_query_pin_caps(codec, pin); | 333 | unsigned int val = snd_hda_query_pin_caps(codec, pin); |
334 | if (!(val & AC_PINCAP_PRES_DETECT)) | 334 | if (!(val & AC_PINCAP_PRES_DETECT)) |
335 | return 0; | 335 | return 0; |
@@ -424,10 +424,8 @@ static int parse_input(struct hda_codec *codec) | |||
424 | struct auto_pin_cfg *cfg = &spec->autocfg; | 424 | struct auto_pin_cfg *cfg = &spec->autocfg; |
425 | int i; | 425 | int i; |
426 | 426 | ||
427 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 427 | for (i = 0; i < cfg->num_inputs; i++) { |
428 | hda_nid_t pin = cfg->input_pins[i]; | 428 | hda_nid_t pin = cfg->inputs[i].pin; |
429 | if (!pin) | ||
430 | continue; | ||
431 | spec->input_idx[spec->num_inputs] = i; | 429 | spec->input_idx[spec->num_inputs] = i; |
432 | spec->capsrc_idx[i] = spec->num_inputs++; | 430 | spec->capsrc_idx[i] = spec->num_inputs++; |
433 | spec->cur_input = i; | 431 | spec->cur_input = i; |
@@ -438,16 +436,17 @@ static int parse_input(struct hda_codec *codec) | |||
438 | 436 | ||
439 | /* check whether the automatic mic switch is available */ | 437 | /* check whether the automatic mic switch is available */ |
440 | if (spec->num_inputs == 2 && | 438 | if (spec->num_inputs == 2 && |
441 | spec->adc_nid[AUTO_PIN_MIC] && spec->adc_nid[AUTO_PIN_FRONT_MIC]) { | 439 | cfg->inputs[0].type <= AUTO_PIN_FRONT_MIC && |
442 | if (is_ext_mic(codec, cfg->input_pins[AUTO_PIN_FRONT_MIC])) { | 440 | cfg->inputs[1].type == AUTO_PIN_FRONT_MIC) { |
443 | if (!is_ext_mic(codec, cfg->input_pins[AUTO_PIN_MIC])) { | 441 | if (is_ext_mic(codec, cfg->inputs[0].pin)) { |
442 | if (!is_ext_mic(codec, cfg->inputs[1].pin)) { | ||
444 | spec->mic_detect = 1; | 443 | spec->mic_detect = 1; |
445 | spec->automic_idx = AUTO_PIN_FRONT_MIC; | 444 | spec->automic_idx = 0; |
446 | } | 445 | } |
447 | } else { | 446 | } else { |
448 | if (is_ext_mic(codec, cfg->input_pins[AUTO_PIN_MIC])) { | 447 | if (is_ext_mic(codec, cfg->inputs[1].pin)) { |
449 | spec->mic_detect = 1; | 448 | spec->mic_detect = 1; |
450 | spec->automic_idx = AUTO_PIN_MIC; | 449 | spec->automic_idx = 1; |
451 | } | 450 | } |
452 | } | 451 | } |
453 | } | 452 | } |
@@ -853,15 +852,12 @@ static void cs_automic(struct hda_codec *codec) | |||
853 | hda_nid_t nid; | 852 | hda_nid_t nid; |
854 | unsigned int present; | 853 | unsigned int present; |
855 | 854 | ||
856 | nid = cfg->input_pins[spec->automic_idx]; | 855 | nid = cfg->inputs[spec->automic_idx].pin; |
857 | present = snd_hda_jack_detect(codec, nid); | 856 | present = snd_hda_jack_detect(codec, nid); |
858 | if (present) | 857 | if (present) |
859 | change_cur_input(codec, spec->automic_idx, 0); | 858 | change_cur_input(codec, spec->automic_idx, 0); |
860 | else { | 859 | else |
861 | unsigned int imic = (spec->automic_idx == AUTO_PIN_MIC) ? | 860 | change_cur_input(codec, !spec->automic_idx, 0); |
862 | AUTO_PIN_FRONT_MIC : AUTO_PIN_MIC; | ||
863 | change_cur_input(codec, imic, 0); | ||
864 | } | ||
865 | } | 861 | } |
866 | 862 | ||
867 | /* | 863 | /* |
@@ -918,14 +914,14 @@ static void init_input(struct hda_codec *codec) | |||
918 | unsigned int coef; | 914 | unsigned int coef; |
919 | int i; | 915 | int i; |
920 | 916 | ||
921 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 917 | for (i = 0; i < cfg->num_inputs; i++) { |
922 | unsigned int ctl; | 918 | unsigned int ctl; |
923 | hda_nid_t pin = cfg->input_pins[i]; | 919 | hda_nid_t pin = cfg->inputs[i].pin; |
924 | if (!pin || !spec->adc_nid[i]) | 920 | if (!spec->adc_nid[i]) |
925 | continue; | 921 | continue; |
926 | /* set appropriate pin control and mute first */ | 922 | /* set appropriate pin control and mute first */ |
927 | ctl = PIN_IN; | 923 | ctl = PIN_IN; |
928 | if (i <= AUTO_PIN_FRONT_MIC) { | 924 | if (cfg->inputs[i].type <= AUTO_PIN_FRONT_MIC) { |
929 | unsigned int caps = snd_hda_query_pin_caps(codec, pin); | 925 | unsigned int caps = snd_hda_query_pin_caps(codec, pin); |
930 | caps >>= AC_PINCAP_VREF_SHIFT; | 926 | caps >>= AC_PINCAP_VREF_SHIFT; |
931 | if (caps & AC_PINCAP_VREF_80) | 927 | if (caps & AC_PINCAP_VREF_80) |