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/hda/hda_codec.c | |
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/hda/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 15 |
1 files changed, 8 insertions, 7 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; |