aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2017-04-27 12:02:20 -0400
committerJani Nikula <jani.nikula@intel.com>2017-05-15 07:44:11 -0400
commit668e3b014afb66ab29e134bca7c258527273ac75 (patch)
treeff020ac52613f534341b65991bac52b6c03353dc
parent9b5fed0daa2a9ea3355ef06bb9e87ce800e71df6 (diff)
drm/i915: Fix runtime PM for LPE audio
Not calling pm_runtime_enable() means that runtime PM can't be enabled at all via sysfs. So we definitely need to call it from somewhere. Calling it from the driver seems like a bad idea because it would have to be paired with a pm_runtime_disable() at driver unload time, otherwise the core gets upset. Also if there's no LPE audio driver loaded then we couldn't runtime suspend i915 either. So it looks like a better plan is to call it from i915 when we register the platform device. That seems to match how pci generally does things. I cargo culted the pm_runtime_forbid() and pm_runtime_set_active() calls from pci as well. The exposed runtime PM API is massive an thorougly misleading, so I don't actually know if this is how you're supposed to use the API or not. But it seems to work. I can now runtime suspend i915 again with or without the LPE audio driver loaded, and reloading the LPE audio driver also seems to work. Note that powertop won't auto-tune runtime PM for platform devices, which is a little annoying. So I'm not sure that leaving runtime PM in "on" mode by default is the best choice here. But I've left it like that for now at least. Also remove the comment about there not being much benefit from LPE audio runtime PM. Not allowing runtime PM blocks i915 runtime PM, which will also block s0ix, and that could have a measurable impact on power consumption. Cc: stable@vger.kernel.org Cc: Takashi Iwai <tiwai@suse.de> Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Fixes: 0b6b524f3915 ("ALSA: x86: Don't enable runtime PM as default") Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170427160231.13337-2-ville.syrjala@linux.intel.com Reviewed-by: Takashi Iwai <tiwai@suse.de> (cherry picked from commit 183c00350ccda86781f6695840e6c5f5b22efbd1) Signed-off-by: Jani Nikula <jani.nikula@intel.com>
-rw-r--r--drivers/gpu/drm/i915/intel_lpe_audio.c5
-rw-r--r--sound/x86/intel_hdmi_audio.c4
2 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/intel_lpe_audio.c b/drivers/gpu/drm/i915/intel_lpe_audio.c
index 25d8e76489e4..668f00480d97 100644
--- a/drivers/gpu/drm/i915/intel_lpe_audio.c
+++ b/drivers/gpu/drm/i915/intel_lpe_audio.c
@@ -63,6 +63,7 @@
63#include <linux/acpi.h> 63#include <linux/acpi.h>
64#include <linux/device.h> 64#include <linux/device.h>
65#include <linux/pci.h> 65#include <linux/pci.h>
66#include <linux/pm_runtime.h>
66 67
67#include "i915_drv.h" 68#include "i915_drv.h"
68#include <linux/delay.h> 69#include <linux/delay.h>
@@ -121,6 +122,10 @@ lpe_audio_platdev_create(struct drm_i915_private *dev_priv)
121 122
122 kfree(rsc); 123 kfree(rsc);
123 124
125 pm_runtime_forbid(&platdev->dev);
126 pm_runtime_set_active(&platdev->dev);
127 pm_runtime_enable(&platdev->dev);
128
124 return platdev; 129 return platdev;
125 130
126err: 131err:
diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c
index 664b7fe206d6..b11d3920b9a5 100644
--- a/sound/x86/intel_hdmi_audio.c
+++ b/sound/x86/intel_hdmi_audio.c
@@ -1809,10 +1809,6 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev)
1809 pdata->notify_pending = false; 1809 pdata->notify_pending = false;
1810 spin_unlock_irq(&pdata->lpe_audio_slock); 1810 spin_unlock_irq(&pdata->lpe_audio_slock);
1811 1811
1812 /* runtime PM isn't enabled as default, since it won't save much on
1813 * BYT/CHT devices; user who want the runtime PM should adjust the
1814 * power/ontrol and power/autosuspend_delay_ms sysfs entries instead
1815 */
1816 pm_runtime_use_autosuspend(&pdev->dev); 1812 pm_runtime_use_autosuspend(&pdev->dev);
1817 pm_runtime_mark_last_busy(&pdev->dev); 1813 pm_runtime_mark_last_busy(&pdev->dev);
1818 pm_runtime_set_active(&pdev->dev); 1814 pm_runtime_set_active(&pdev->dev);