Skip to content

Commit

Permalink
drm/i915: Fix runtime PM for LPE audio
Browse files Browse the repository at this point in the history
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: [email protected]
Cc: Takashi Iwai <[email protected]>
Cc: Pierre-Louis Bossart <[email protected]>
Fixes: 0b6b524 ("ALSA: x86: Don't enable runtime PM as default")
Signed-off-by: Ville Syrjälä <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Reviewed-by: Takashi Iwai <[email protected]>
  • Loading branch information
vsyrjala committed May 3, 2017
1 parent 49f0859 commit 183c003
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 5 additions & 0 deletions drivers/gpu/drm/i915/intel_lpe_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
#include <linux/acpi.h>
#include <linux/device.h>
#include <linux/pci.h>
#include <linux/pm_runtime.h>

#include "i915_drv.h"
#include <linux/delay.h>
Expand Down Expand Up @@ -121,6 +122,10 @@ lpe_audio_platdev_create(struct drm_i915_private *dev_priv)

kfree(rsc);

pm_runtime_forbid(&platdev->dev);
pm_runtime_set_active(&platdev->dev);
pm_runtime_enable(&platdev->dev);

return platdev;

err:
Expand Down
4 changes: 0 additions & 4 deletions sound/x86/intel_hdmi_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1809,10 +1809,6 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev)
pdata->notify_pending = false;
spin_unlock_irq(&pdata->lpe_audio_slock);

/* runtime PM isn't enabled as default, since it won't save much on
* BYT/CHT devices; user who want the runtime PM should adjust the
* power/ontrol and power/autosuspend_delay_ms sysfs entries instead
*/
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_mark_last_busy(&pdev->dev);
pm_runtime_set_active(&pdev->dev);
Expand Down

0 comments on commit 183c003

Please sign in to comment.