diff options
author | Hans de Goede <hdegoede@redhat.com> | 2022-09-09 13:56:45 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2022-09-17 15:20:40 +0200 |
commit | 672c473576ca5c9f5a40ac848c938e6898a5aac8 (patch) | |
tree | b52e49ec624c543f86548ea1b5f2791707d86fa3 /drivers/gpu/drm/gma500/psb_drv.c | |
parent | d35a4bf66079b92e232ac85b08f19312be9b7eca (diff) | |
download | linux-672c473576ca5c9f5a40ac848c938e6898a5aac8.tar.bz2 |
drm/gma500: Rewrite power management code
Rewrite the power.c code. For some reason this was doing locking +
refcounting + state (suspended or not) bookkeeping all by itself.
But there is no reason for this, this is all taken care of by
the runtime-pm core, through pm_runtime_get()/_put().
Besides this not being necessary the DIY code is also quite weird/
buggy in some places. E.g. power_begin() would manually do a resume
when not resumed already and force_on=true, followed by a
pm_runtime_get(), which will cause a call to gma_power_resume() to
get scheduled which would redo the entire resume again. Which can
all be replaced by a single pm_runtime_get_sync() call.
Note that this is just a cleanup, this does not actually fix
the (disabled through #if 0) runtime-pm support. It does now call
pm_runtime_enable(), but only after doing a pm_runtime_get() at
probe-time, so the device is never runtime suspended.
Doing this permanent get() + enable() instead of not calling
enable() at all is necessary for the pm_runtime_get_if_in_use() call
in gma_power_begin() to work properly.
Note this also removes the gma_power_is_on() call a check like this
without actually holding a reference is always racy, so it is a bad
idea (and therefor has no pm_runtime_foo() equivalent).
The 2 code paths which were using gma_power_is_on() are actually both
guaranteed to only run when the device is powered-on so the 2 checks
can simply be dropped.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220909115646.99920-6-hdegoede@redhat.com
Diffstat (limited to 'drivers/gpu/drm/gma500/psb_drv.c')
-rw-r--r-- | drivers/gpu/drm/gma500/psb_drv.c | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c index 8266371aeac1..aea8876059d8 100644 --- a/drivers/gpu/drm/gma500/psb_drv.c +++ b/drivers/gpu/drm/gma500/psb_drv.c @@ -407,11 +407,6 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags) if (ret) return ret; psb_intel_opregion_enable_asle(dev); -#if 0 - /* Enable runtime pm at last */ - pm_runtime_enable(dev->dev); - pm_runtime_set_active(dev->dev); -#endif return devm_add_action_or_reset(dev->dev, psb_device_release, dev); @@ -484,7 +479,6 @@ static const struct dev_pm_ops psb_pm_ops = { .restore = gma_power_restore, .runtime_suspend = psb_runtime_suspend, .runtime_resume = psb_runtime_resume, - .runtime_idle = psb_runtime_idle, }; static const struct file_operations psb_gem_fops = { |