diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-03-13 04:02:42 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-03-13 04:06:31 -0400 |
commit | bb6ac72fb19c6676eb8bafa8e3b8bf970a2294a2 (patch) | |
tree | 6cf263c2c3172bd1371ffbb0fcd0da14345aa5d4 /sound/pci | |
parent | 307282c8990c5658604b9fda8a64a9a07079b850 (diff) |
ALSA: hda - power up before codec initialization
Change the power state of each widget before starting the initialization
work so that all verbs are executed properly.
Also, keep power-up during hwdep reconfiguration.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 15 | ||||
-rw-r--r-- | sound/pci/hda/hda_hwdep.c | 14 |
2 files changed, 17 insertions, 12 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 1885e7649101..cf6339436de1 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -842,6 +842,9 @@ static void snd_hda_codec_free(struct hda_codec *codec) | |||
842 | kfree(codec); | 842 | kfree(codec); |
843 | } | 843 | } |
844 | 844 | ||
845 | static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, | ||
846 | unsigned int power_state); | ||
847 | |||
845 | /** | 848 | /** |
846 | * snd_hda_codec_new - create a HDA codec | 849 | * snd_hda_codec_new - create a HDA codec |
847 | * @bus: the bus to assign | 850 | * @bus: the bus to assign |
@@ -941,6 +944,11 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr | |||
941 | if (bus->modelname) | 944 | if (bus->modelname) |
942 | codec->modelname = kstrdup(bus->modelname, GFP_KERNEL); | 945 | codec->modelname = kstrdup(bus->modelname, GFP_KERNEL); |
943 | 946 | ||
947 | /* power-up all before initialization */ | ||
948 | hda_set_power_state(codec, | ||
949 | codec->afg ? codec->afg : codec->mfg, | ||
950 | AC_PWRST_D0); | ||
951 | |||
944 | if (do_init) { | 952 | if (do_init) { |
945 | err = snd_hda_codec_configure(codec); | 953 | err = snd_hda_codec_configure(codec); |
946 | if (err < 0) | 954 | if (err < 0) |
@@ -2413,19 +2421,12 @@ EXPORT_SYMBOL_HDA(snd_hda_build_controls); | |||
2413 | int snd_hda_codec_build_controls(struct hda_codec *codec) | 2421 | int snd_hda_codec_build_controls(struct hda_codec *codec) |
2414 | { | 2422 | { |
2415 | int err = 0; | 2423 | int err = 0; |
2416 | /* fake as if already powered-on */ | ||
2417 | hda_keep_power_on(codec); | ||
2418 | /* then fire up */ | ||
2419 | hda_set_power_state(codec, | ||
2420 | codec->afg ? codec->afg : codec->mfg, | ||
2421 | AC_PWRST_D0); | ||
2422 | hda_exec_init_verbs(codec); | 2424 | hda_exec_init_verbs(codec); |
2423 | /* continue to initialize... */ | 2425 | /* continue to initialize... */ |
2424 | if (codec->patch_ops.init) | 2426 | if (codec->patch_ops.init) |
2425 | err = codec->patch_ops.init(codec); | 2427 | err = codec->patch_ops.init(codec); |
2426 | if (!err && codec->patch_ops.build_controls) | 2428 | if (!err && codec->patch_ops.build_controls) |
2427 | err = codec->patch_ops.build_controls(codec); | 2429 | err = codec->patch_ops.build_controls(codec); |
2428 | snd_hda_power_down(codec); | ||
2429 | if (err < 0) | 2430 | if (err < 0) |
2430 | return err; | 2431 | return err; |
2431 | return 0; | 2432 | return 0; |
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index 1e3ccc740afc..1c57505c2874 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c | |||
@@ -176,25 +176,29 @@ static int reconfig_codec(struct hda_codec *codec) | |||
176 | { | 176 | { |
177 | int err; | 177 | int err; |
178 | 178 | ||
179 | snd_hda_power_up(codec); | ||
179 | snd_printk(KERN_INFO "hda-codec: reconfiguring\n"); | 180 | snd_printk(KERN_INFO "hda-codec: reconfiguring\n"); |
180 | err = snd_hda_codec_reset(codec); | 181 | err = snd_hda_codec_reset(codec); |
181 | if (err < 0) { | 182 | if (err < 0) { |
182 | snd_printk(KERN_ERR | 183 | snd_printk(KERN_ERR |
183 | "The codec is being used, can't reconfigure.\n"); | 184 | "The codec is being used, can't reconfigure.\n"); |
184 | return err; | 185 | goto error; |
185 | } | 186 | } |
186 | err = snd_hda_codec_configure(codec); | 187 | err = snd_hda_codec_configure(codec); |
187 | if (err < 0) | 188 | if (err < 0) |
188 | return err; | 189 | goto error; |
189 | /* rebuild PCMs */ | 190 | /* rebuild PCMs */ |
190 | err = snd_hda_codec_build_pcms(codec); | 191 | err = snd_hda_codec_build_pcms(codec); |
191 | if (err < 0) | 192 | if (err < 0) |
192 | return err; | 193 | goto error; |
193 | /* rebuild mixers */ | 194 | /* rebuild mixers */ |
194 | err = snd_hda_codec_build_controls(codec); | 195 | err = snd_hda_codec_build_controls(codec); |
195 | if (err < 0) | 196 | if (err < 0) |
196 | return err; | 197 | goto error; |
197 | return snd_card_register(codec->bus->card); | 198 | err = snd_card_register(codec->bus->card); |
199 | error: | ||
200 | snd_hda_power_down(codec); | ||
201 | return err; | ||
198 | } | 202 | } |
199 | 203 | ||
200 | /* | 204 | /* |