diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-07-31 09:56:24 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 09:58:18 -0400 |
commit | 8259980ebcecd8096a04cc43c1c1d72e1c0ed165 (patch) | |
tree | 3c62ab90e8ac20ec87240db124c18a44f4b1e8b6 | |
parent | d71a5c50ca9b1e24987df3cdd3a1a4fb06d265e4 (diff) |
[ALSA] hda-codec - Fix GPIO in resume
Reinitialize GPIO in resume callback if necessary.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index d2c340e45f9e..5ca430cc399a 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -95,6 +95,8 @@ struct sigmatel_spec { | |||
95 | unsigned int hp_detect: 1; | 95 | unsigned int hp_detect: 1; |
96 | unsigned int gpio_mute: 1; | 96 | unsigned int gpio_mute: 1; |
97 | 97 | ||
98 | unsigned int gpio_mask, gpio_data; | ||
99 | |||
98 | /* playback */ | 100 | /* playback */ |
99 | struct hda_multi_out multiout; | 101 | struct hda_multi_out multiout; |
100 | hda_nid_t dac_nids[5]; | 102 | hda_nid_t dac_nids[5]; |
@@ -854,20 +856,20 @@ static void stac92xx_set_config_regs(struct hda_codec *codec) | |||
854 | spec->pin_configs[i]); | 856 | spec->pin_configs[i]); |
855 | } | 857 | } |
856 | 858 | ||
857 | static void stac92xx_enable_gpio_mask(struct hda_codec *codec, | 859 | static void stac92xx_enable_gpio_mask(struct hda_codec *codec) |
858 | int gpio_mask, int gpio_data) | ||
859 | { | 860 | { |
861 | struct sigmatel_spec *spec = codec->spec; | ||
860 | /* Configure GPIOx as output */ | 862 | /* Configure GPIOx as output */ |
861 | snd_hda_codec_write(codec, codec->afg, 0, | 863 | snd_hda_codec_write(codec, codec->afg, 0, |
862 | AC_VERB_SET_GPIO_DIRECTION, gpio_mask); | 864 | AC_VERB_SET_GPIO_DIRECTION, spec->gpio_mask); |
863 | /* Configure GPIOx as CMOS */ | 865 | /* Configure GPIOx as CMOS */ |
864 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0x00000000); | 866 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0x00000000); |
865 | /* Assert GPIOx */ | 867 | /* Assert GPIOx */ |
866 | snd_hda_codec_write(codec, codec->afg, 0, | 868 | snd_hda_codec_write(codec, codec->afg, 0, |
867 | AC_VERB_SET_GPIO_DATA, gpio_data); | 869 | AC_VERB_SET_GPIO_DATA, spec->gpio_data); |
868 | /* Enable GPIOx */ | 870 | /* Enable GPIOx */ |
869 | snd_hda_codec_write(codec, codec->afg, 0, | 871 | snd_hda_codec_write(codec, codec->afg, 0, |
870 | AC_VERB_SET_GPIO_MASK, gpio_mask); | 872 | AC_VERB_SET_GPIO_MASK, spec->gpio_mask); |
871 | } | 873 | } |
872 | 874 | ||
873 | /* | 875 | /* |
@@ -1935,8 +1937,10 @@ static int stac92xx_resume(struct hda_codec *codec) | |||
1935 | struct sigmatel_spec *spec = codec->spec; | 1937 | struct sigmatel_spec *spec = codec->spec; |
1936 | int i; | 1938 | int i; |
1937 | 1939 | ||
1938 | stac92xx_init(codec); | ||
1939 | stac92xx_set_config_regs(codec); | 1940 | stac92xx_set_config_regs(codec); |
1941 | if (spec->gpio_mask && spec->gpio_data) | ||
1942 | stac92xx_enable_gpio_mask(codec); | ||
1943 | stac92xx_init(codec); | ||
1940 | snd_hda_resume_ctls(codec, spec->mixer); | 1944 | snd_hda_resume_ctls(codec, spec->mixer); |
1941 | for (i = 0; i < spec->num_mixers; i++) | 1945 | for (i = 0; i < spec->num_mixers; i++) |
1942 | snd_hda_resume_ctls(codec, spec->mixers[i]); | 1946 | snd_hda_resume_ctls(codec, spec->mixers[i]); |
@@ -2240,7 +2244,8 @@ static int patch_stac927x(struct hda_codec *codec) | |||
2240 | 2244 | ||
2241 | spec->multiout.dac_nids = spec->dac_nids; | 2245 | spec->multiout.dac_nids = spec->dac_nids; |
2242 | /* GPIO0 High = Enable EAPD */ | 2246 | /* GPIO0 High = Enable EAPD */ |
2243 | stac92xx_enable_gpio_mask(codec, 0x00000001, 0x00000001); | 2247 | spec->gpio_mask = spec->gpio_data = 0x00000001; |
2248 | stac92xx_enable_gpio_mask(codec); | ||
2244 | 2249 | ||
2245 | err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); | 2250 | err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); |
2246 | if (!err) { | 2251 | if (!err) { |
@@ -2265,7 +2270,7 @@ static int patch_stac927x(struct hda_codec *codec) | |||
2265 | static int patch_stac9205(struct hda_codec *codec) | 2270 | static int patch_stac9205(struct hda_codec *codec) |
2266 | { | 2271 | { |
2267 | struct sigmatel_spec *spec; | 2272 | struct sigmatel_spec *spec; |
2268 | int err, gpio_mask, gpio_data; | 2273 | int err; |
2269 | 2274 | ||
2270 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 2275 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
2271 | if (spec == NULL) | 2276 | if (spec == NULL) |
@@ -2308,15 +2313,16 @@ static int patch_stac9205(struct hda_codec *codec) | |||
2308 | stac92xx_set_config_reg(codec, 0x1f, 0x01441030); | 2313 | stac92xx_set_config_reg(codec, 0x1f, 0x01441030); |
2309 | stac92xx_set_config_reg(codec, 0x20, 0x1c410030); | 2314 | stac92xx_set_config_reg(codec, 0x20, 0x1c410030); |
2310 | 2315 | ||
2311 | gpio_mask = 0x00000007; /* GPIO0-2 */ | 2316 | spec->gpio_mask = 0x00000007; /* GPIO0-2 */ |
2312 | /* GPIO0 High = EAPD, GPIO1 Low = DRM, | 2317 | /* GPIO0 High = EAPD, GPIO1 Low = DRM, |
2313 | * GPIO2 High = Headphone Mute | 2318 | * GPIO2 High = Headphone Mute |
2314 | */ | 2319 | */ |
2315 | gpio_data = 0x00000005; | 2320 | spec->gpio_data = 0x00000005; |
2316 | } else | 2321 | } else |
2317 | gpio_mask = gpio_data = 0x00000001; /* GPIO0 High = EAPD */ | 2322 | spec->gpio_mask = spec->gpio_data = |
2323 | 0x00000001; /* GPIO0 High = EAPD */ | ||
2318 | 2324 | ||
2319 | stac92xx_enable_gpio_mask(codec, gpio_mask, gpio_data); | 2325 | stac92xx_enable_gpio_mask(codec); |
2320 | err = stac92xx_parse_auto_config(codec, 0x1f, 0x20); | 2326 | err = stac92xx_parse_auto_config(codec, 0x1f, 0x20); |
2321 | if (!err) { | 2327 | if (!err) { |
2322 | if (spec->board_config < 0) { | 2328 | if (spec->board_config < 0) { |