aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_intel.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-08-28 12:14:29 -0400
committerTakashi Iwai <tiwai@suse.de>2012-08-30 10:48:49 -0400
commit68467f51c1b578ad98593bf5dee4337bd8d7798d (patch)
tree52bd817b23e2274425bc6c8cc1776405bea8f7ea /sound/pci/hda/hda_intel.c
parent48ee7cb8b4867093c75eb5102f2359c9799b3341 (diff)
ALSA: hda - Fix runtime PM leftover refcounts
When the HD-audio is removed, it leaves the refcounts when codecs are powered up (usually yes) in the destructor. For fixing the unbalance, and cleaning up the code mess, this patch changes the following: - change pm_notify callback to take the explicit power on/off state, - check of D3 stop-clock and keep_link_on flags is moved to the caller side, - call pm_notify callback in snd_hda_codec_new() and snd_hda_codec_free() so that the refcounts are proprely updated. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_intel.c')
-rw-r--r--sound/pci/hda/hda_intel.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 1c9c779dda55..1b6e856e7ab1 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1033,7 +1033,7 @@ static unsigned int azx_get_response(struct hda_bus *bus,
1033} 1033}
1034 1034
1035#ifdef CONFIG_SND_HDA_POWER_SAVE 1035#ifdef CONFIG_SND_HDA_POWER_SAVE
1036static void azx_power_notify(struct hda_bus *bus, struct hda_codec *codec); 1036static void azx_power_notify(struct hda_bus *bus, bool power_up);
1037#endif 1037#endif
1038 1038
1039/* reset codec link */ 1039/* reset codec link */
@@ -2406,14 +2406,11 @@ static void azx_stop_chip(struct azx *chip)
2406 2406
2407#ifdef CONFIG_SND_HDA_POWER_SAVE 2407#ifdef CONFIG_SND_HDA_POWER_SAVE
2408/* power-up/down the controller */ 2408/* power-up/down the controller */
2409static void azx_power_notify(struct hda_bus *bus, struct hda_codec *codec) 2409static void azx_power_notify(struct hda_bus *bus, bool power_up)
2410{ 2410{
2411 struct azx *chip = bus->private_data; 2411 struct azx *chip = bus->private_data;
2412 2412
2413 if (bus->power_keep_link_on || !codec->d3_stop_clk_ok) 2413 if (power_up)
2414 return;
2415
2416 if (codec->power_on)
2417 pm_runtime_get_sync(&chip->pci->dev); 2414 pm_runtime_get_sync(&chip->pci->dev);
2418 else 2415 else
2419 pm_runtime_put_sync(&chip->pci->dev); 2416 pm_runtime_put_sync(&chip->pci->dev);
@@ -3273,15 +3270,6 @@ static void azx_firmware_cb(const struct firmware *fw, void *context)
3273} 3270}
3274#endif 3271#endif
3275 3272
3276static void rpm_get_all_codecs(struct azx *chip)
3277{
3278 struct hda_codec *codec;
3279
3280 list_for_each_entry(codec, &chip->bus->codec_list, list) {
3281 pm_runtime_get_noresume(&chip->pci->dev);
3282 }
3283}
3284
3285static int __devinit azx_probe(struct pci_dev *pci, 3273static int __devinit azx_probe(struct pci_dev *pci,
3286 const struct pci_device_id *pci_id) 3274 const struct pci_device_id *pci_id)
3287{ 3275{
@@ -3388,7 +3376,6 @@ static int DELAYED_INIT_MARK azx_probe_continue(struct azx *chip)
3388 goto out_free; 3376 goto out_free;
3389 3377
3390 chip->running = 1; 3378 chip->running = 1;
3391 rpm_get_all_codecs(chip); /* all codecs are active */
3392 power_down_all_codecs(chip); 3379 power_down_all_codecs(chip);
3393 azx_notifier_register(chip); 3380 azx_notifier_register(chip);
3394 azx_add_card_list(chip); 3381 azx_add_card_list(chip);