diff options
| -rw-r--r-- | sound/pci/hda/patch_realtek.c | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index c53ca589c930..c39f48e02ee9 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -478,12 +478,45 @@ static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) | |||
| 478 | set_eapd(codec, *p, on); | 478 | set_eapd(codec, *p, on); |
| 479 | } | 479 | } |
| 480 | 480 | ||
| 481 | static int find_ext_mic_pin(struct hda_codec *codec); | ||
| 482 | |||
| 483 | static void alc_headset_mic_no_shutup(struct hda_codec *codec) | ||
| 484 | { | ||
| 485 | const struct hda_pincfg *pin; | ||
| 486 | int mic_pin = find_ext_mic_pin(codec); | ||
| 487 | int i; | ||
| 488 | |||
| 489 | /* don't shut up pins when unloading the driver; otherwise it breaks | ||
| 490 | * the default pin setup at the next load of the driver | ||
| 491 | */ | ||
| 492 | if (codec->bus->shutdown) | ||
| 493 | return; | ||
| 494 | |||
| 495 | snd_array_for_each(&codec->init_pins, i, pin) { | ||
| 496 | /* use read here for syncing after issuing each verb */ | ||
| 497 | if (pin->nid != mic_pin) | ||
| 498 | snd_hda_codec_read(codec, pin->nid, 0, | ||
| 499 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
| 500 | } | ||
| 501 | |||
| 502 | codec->pins_shutup = 1; | ||
| 503 | } | ||
| 504 | |||
| 481 | static void alc_shutup_pins(struct hda_codec *codec) | 505 | static void alc_shutup_pins(struct hda_codec *codec) |
| 482 | { | 506 | { |
| 483 | struct alc_spec *spec = codec->spec; | 507 | struct alc_spec *spec = codec->spec; |
| 484 | 508 | ||
| 485 | if (!spec->no_shutup_pins) | 509 | switch (codec->core.vendor_id) { |
| 486 | snd_hda_shutup_pins(codec); | 510 | case 0x10ec0286: |
| 511 | case 0x10ec0288: | ||
| 512 | case 0x10ec0298: | ||
| 513 | alc_headset_mic_no_shutup(codec); | ||
| 514 | break; | ||
| 515 | default: | ||
| 516 | if (!spec->no_shutup_pins) | ||
| 517 | snd_hda_shutup_pins(codec); | ||
| 518 | break; | ||
| 519 | } | ||
| 487 | } | 520 | } |
| 488 | 521 | ||
| 489 | /* generic shutup callback; | 522 | /* generic shutup callback; |
| @@ -2924,27 +2957,6 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | |||
| 2924 | return alc_parse_auto_config(codec, alc269_ignore, ssids); | 2957 | return alc_parse_auto_config(codec, alc269_ignore, ssids); |
| 2925 | } | 2958 | } |
| 2926 | 2959 | ||
| 2927 | static int find_ext_mic_pin(struct hda_codec *codec); | ||
| 2928 | |||
| 2929 | static void alc286_shutup(struct hda_codec *codec) | ||
| 2930 | { | ||
| 2931 | const struct hda_pincfg *pin; | ||
| 2932 | int i; | ||
| 2933 | int mic_pin = find_ext_mic_pin(codec); | ||
| 2934 | /* don't shut up pins when unloading the driver; otherwise it breaks | ||
| 2935 | * the default pin setup at the next load of the driver | ||
| 2936 | */ | ||
| 2937 | if (codec->bus->shutdown) | ||
| 2938 | return; | ||
| 2939 | snd_array_for_each(&codec->init_pins, i, pin) { | ||
| 2940 | /* use read here for syncing after issuing each verb */ | ||
| 2941 | if (pin->nid != mic_pin) | ||
| 2942 | snd_hda_codec_read(codec, pin->nid, 0, | ||
| 2943 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
| 2944 | } | ||
| 2945 | codec->pins_shutup = 1; | ||
| 2946 | } | ||
| 2947 | |||
| 2948 | static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) | 2960 | static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) |
| 2949 | { | 2961 | { |
| 2950 | alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0); | 2962 | alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0); |
| @@ -7736,7 +7748,6 @@ static int patch_alc269(struct hda_codec *codec) | |||
| 7736 | case 0x10ec0286: | 7748 | case 0x10ec0286: |
| 7737 | case 0x10ec0288: | 7749 | case 0x10ec0288: |
| 7738 | spec->codec_variant = ALC269_TYPE_ALC286; | 7750 | spec->codec_variant = ALC269_TYPE_ALC286; |
| 7739 | spec->shutup = alc286_shutup; | ||
| 7740 | break; | 7751 | break; |
| 7741 | case 0x10ec0298: | 7752 | case 0x10ec0298: |
| 7742 | spec->codec_variant = ALC269_TYPE_ALC298; | 7753 | spec->codec_variant = ALC269_TYPE_ALC298; |
