aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMengdong Lin <mengdong.lin@intel.com>2012-08-24 00:06:30 -0400
committerTakashi Iwai <tiwai@suse.de>2012-08-24 01:22:42 -0400
commit5d6147f10113c240845ea9e8e4e744bbadce5bcb (patch)
tree9b30d7abcbb1f641e2c0525711fc56564b0788ad
parentb8dfc4624162c0547d7f36a9df48da2d9b4bd58a (diff)
ALSA: hda - bug fix on references without checking CONFIG_SND_HDA_POWER_SAVE
The patch to support runtime PM introduced a bug: Module parameter 'power_save_controller', and the codec flag 'd3_stop_clk' 'd3_stop_clk_ok' are defined only when HDA power save is enabled in config. But there are references to them without checking macro CONFIG_SND_HDA_POWER_SAVE. This patch is to fix the bug. Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_codec.c6
-rw-r--r--sound/pci/hda/hda_intel.c2
2 files changed, 8 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 0de1f76733d2..4a2f35ccbf05 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1320,11 +1320,13 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus,
1320 AC_VERB_GET_SUBSYSTEM_ID, 0); 1320 AC_VERB_GET_SUBSYSTEM_ID, 0);
1321 } 1321 }
1322 1322
1323#ifdef CONFIG_SND_HDA_POWER_SAVE
1323 codec->d3_stop_clk = snd_hda_codec_get_supported_ps(codec, 1324 codec->d3_stop_clk = snd_hda_codec_get_supported_ps(codec,
1324 codec->afg ? codec->afg : codec->mfg, 1325 codec->afg ? codec->afg : codec->mfg,
1325 AC_PWRST_CLKSTOP); 1326 AC_PWRST_CLKSTOP);
1326 if (!codec->d3_stop_clk) 1327 if (!codec->d3_stop_clk)
1327 bus->power_keep_link_on = 1; 1328 bus->power_keep_link_on = 1;
1329#endif
1328 1330
1329 /* power-up all before initialization */ 1331 /* power-up all before initialization */
1330 hda_set_power_state(codec, 1332 hda_set_power_state(codec,
@@ -3544,7 +3546,9 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
3544 int count; 3546 int count;
3545 unsigned int state; 3547 unsigned int state;
3546 3548
3549#ifdef CONFIG_SND_HDA_POWER_SAVE
3547 codec->d3_stop_clk_ok = 0; 3550 codec->d3_stop_clk_ok = 0;
3551#endif
3548 3552
3549 if (codec->patch_ops.set_power_state) { 3553 if (codec->patch_ops.set_power_state) {
3550 codec->patch_ops.set_power_state(codec, fg, power_state); 3554 codec->patch_ops.set_power_state(codec, fg, power_state);
@@ -3569,9 +3573,11 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
3569 break; 3573 break;
3570 } 3574 }
3571 3575
3576#ifdef CONFIG_SND_HDA_POWER_SAVE
3572 if ((power_state == AC_PWRST_D3) 3577 if ((power_state == AC_PWRST_D3)
3573 && codec->d3_stop_clk && (state & AC_PWRST_CLK_STOP_OK)) 3578 && codec->d3_stop_clk && (state & AC_PWRST_CLK_STOP_OK))
3574 codec->d3_stop_clk_ok = 1; 3579 codec->d3_stop_clk_ok = 1;
3580#endif
3575} 3581}
3576 3582
3577#ifdef CONFIG_SND_HDA_HWDEP 3583#ifdef CONFIG_SND_HDA_HWDEP
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 726f4208bd05..1c9c779dda55 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2528,8 +2528,10 @@ static int azx_runtime_suspend(struct device *dev)
2528 struct snd_card *card = dev_get_drvdata(dev); 2528 struct snd_card *card = dev_get_drvdata(dev);
2529 struct azx *chip = card->private_data; 2529 struct azx *chip = card->private_data;
2530 2530
2531#ifdef CONFIG_SND_HDA_POWER_SAVE
2531 if (!power_save_controller) 2532 if (!power_save_controller)
2532 return -EAGAIN; 2533 return -EAGAIN;
2534#endif
2533 2535
2534 azx_stop_chip(chip); 2536 azx_stop_chip(chip);
2535 azx_clear_irq_pending(chip); 2537 azx_clear_irq_pending(chip);