diff options
author | Mengdong Lin <mengdong.lin@intel.com> | 2015-04-29 17:43:36 +0800 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-04-29 12:27:53 +0200 |
commit | 795614dde4d3550c3ef72469b1ba4d09d8635202 (patch) | |
tree | ca2576888eb4343dc9dcb2ca15e9f2b2bad58623 /sound/pci/hda/hda_intel.c | |
parent | 17eccb27fce7cac8469dd9e828645a3ba256fc1e (diff) |
ALSA: hda - divide controller and codec dependency on i915 gfx power well
This patch can improve power saving for Intel platforms on which only the
display audio codec is in the shared i915 power well:
- Add a flag "need_i915_power" to indicate whether the controller needs the
i915 power well.
- The driver will always request the i915 power when probing the controller
and codecs if AZX_DCAPS_I915_POWERWELL is set (either the controller or a
codec needs this power).
- If the controller needs the i915 power, the power will be held after probe
until the controller is runtime suspended or S3. If the controller doesn't
need the power, the power will be released the after probe, and a codec
that needs the power can request/release the power via bus link_power ops.
Background:
- For Haswell/Broadwell, which has a separate HD-A controller for display audio,
both the controller and the display codec are in the i915 power well.
- For Baytrail/Braswell, the display and analog audio share the same HDA
controller and link, and only the display codec is in the i915 power well.
- For Skylake, the display and analog audio share the same HDA controller but
use separate links. Only the display codec is in the i915 power well. And in
legacy mode we take the two links as one. So it can follow Baytrail/Braswell.
Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
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.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index d7922a6df91b..8cd10b8cd41d 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -814,7 +814,8 @@ static int azx_suspend(struct device *dev) if (chip->msi) pci_disable_msi(chip->pci); - if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) + if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL + && hda->need_i915_power) hda_display_power(hda, false); return 0; } @@ -834,7 +835,8 @@ static int azx_resume(struct device *dev) if (chip->disabled || hda->init_failed) return 0; - if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { + if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL + && hda->need_i915_power) { hda_display_power(hda, true); haswell_set_bclk(hda); } @@ -877,7 +879,8 @@ static int azx_runtime_suspend(struct device *dev) azx_stop_chip(chip); azx_enter_link_reset(chip); azx_clear_irq_pending(chip); - if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) + if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL + && hda->need_i915_power) hda_display_power(hda, false); return 0; @@ -902,7 +905,8 @@ static int azx_runtime_resume(struct device *dev) if (!azx_has_pm_runtime(chip)) return 0; - if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { + if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL + && hda->need_i915_power) { hda_display_power(hda, true); haswell_set_bclk(hda); } @@ -1123,7 +1127,8 @@ static int azx_free(struct azx *chip) release_firmware(chip->fw); #endif if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { - hda_display_power(hda, false); + if (hda->need_i915_power) + hda_display_power(hda, false); hda_i915_exit(hda); } kfree(hda); @@ -1888,17 +1893,26 @@ static int azx_probe_continue(struct azx *chip) int err; hda->probe_continued = 1; - /* Request power well for Haswell HDA controller and codec */ + + /* Request display power well for the HDA controller or codec. For + * Haswell/Broadwell, both the display HDA controller and codec need + * this power. For other platforms, like Baytrail/Braswell, only the + * display codec needs the power and it can be released after probe. + */ if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { + /* Assume the controller needs the power by default */ + hda->need_i915_power = 1; + #ifdef CONFIG_SND_HDA_I915 err = hda_i915_init(hda); if (err < 0) - goto out_free; + goto i915_power_fail; + err = hda_display_power(hda, true); if (err < 0) { dev_err(chip->card->dev, "Cannot turn on display power on i915\n"); - goto out_free; + goto i915_power_fail; } #endif } @@ -1945,6 +1959,11 @@ static int azx_probe_continue(struct azx *chip) pm_runtime_put_noidle(&pci->dev); out_free: + if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL + && !hda->need_i915_power) + hda_display_power(hda, false); + +i915_power_fail: if (err < 0) hda->init_failed = 1; complete_all(&hda->probe_wait); |