diff options
| -rw-r--r-- | sound/pci/hda/hda_codec.c | 19 | ||||
| -rw-r--r-- | sound/pci/hda/hda_codec.h | 1 | ||||
| -rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 12 |
3 files changed, 21 insertions, 11 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index b3554df740ff..94ae69f20925 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
| @@ -899,6 +899,25 @@ static void restore_pincfgs(struct hda_codec *codec) | |||
| 899 | } | 899 | } |
| 900 | } | 900 | } |
| 901 | 901 | ||
| 902 | /** | ||
| 903 | * snd_hda_shutup_pins - Shut up all pins | ||
| 904 | * @codec: the HDA codec | ||
| 905 | * | ||
| 906 | * Clear all pin controls to shup up before suspend for avoiding click noise. | ||
| 907 | * The controls aren't cached so that they can be resumed properly. | ||
| 908 | */ | ||
| 909 | void snd_hda_shutup_pins(struct hda_codec *codec) | ||
| 910 | { | ||
| 911 | int i; | ||
| 912 | for (i = 0; i < codec->init_pins.used; i++) { | ||
| 913 | struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i); | ||
| 914 | /* use read here for syncing after issuing each verb */ | ||
| 915 | snd_hda_codec_read(codec, pin->nid, 0, | ||
| 916 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
| 917 | } | ||
| 918 | } | ||
| 919 | EXPORT_SYMBOL_HDA(snd_hda_shutup_pins); | ||
| 920 | |||
| 902 | static void init_hda_cache(struct hda_cache_rec *cache, | 921 | static void init_hda_cache(struct hda_cache_rec *cache, |
| 903 | unsigned int record_size); | 922 | unsigned int record_size); |
| 904 | static void free_hda_cache(struct hda_cache_rec *cache); | 923 | static void free_hda_cache(struct hda_cache_rec *cache); |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 0d08ad5bd898..11c4aa8ee996 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
| @@ -898,6 +898,7 @@ int snd_hda_codec_set_pincfg(struct hda_codec *codec, hda_nid_t nid, | |||
| 898 | unsigned int cfg); | 898 | unsigned int cfg); |
| 899 | int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, | 899 | int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, |
| 900 | hda_nid_t nid, unsigned int cfg); /* for hwdep */ | 900 | hda_nid_t nid, unsigned int cfg); /* for hwdep */ |
| 901 | void snd_hda_shutup_pins(struct hda_codec *codec); | ||
| 901 | 902 | ||
| 902 | /* | 903 | /* |
| 903 | * Mixer | 904 | * Mixer |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 69dd5a4e52f2..dc1d9f124578 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
| @@ -4385,18 +4385,8 @@ static void stac92xx_free_kctls(struct hda_codec *codec) | |||
| 4385 | static void stac92xx_shutup(struct hda_codec *codec) | 4385 | static void stac92xx_shutup(struct hda_codec *codec) |
| 4386 | { | 4386 | { |
| 4387 | struct sigmatel_spec *spec = codec->spec; | 4387 | struct sigmatel_spec *spec = codec->spec; |
| 4388 | int i; | ||
| 4389 | hda_nid_t nid; | ||
| 4390 | 4388 | ||
| 4391 | /* reset each pin before powering down DAC/ADC to avoid click noise */ | 4389 | snd_hda_shutup_pins(codec); |
| 4392 | nid = codec->start_nid; | ||
| 4393 | for (i = 0; i < codec->num_nodes; i++, nid++) { | ||
| 4394 | unsigned int wcaps = get_wcaps(codec, nid); | ||
| 4395 | unsigned int wid_type = get_wcaps_type(wcaps); | ||
| 4396 | if (wid_type == AC_WID_PIN) | ||
| 4397 | snd_hda_codec_read(codec, nid, 0, | ||
| 4398 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
| 4399 | } | ||
| 4400 | 4390 | ||
| 4401 | if (spec->eapd_mask) | 4391 | if (spec->eapd_mask) |
| 4402 | stac_gpio_set(codec, spec->gpio_mask, | 4392 | stac_gpio_set(codec, spec->gpio_mask, |
