On Fri, 24 Oct 2025, Jouni Högander <[email protected]> wrote: > Implement runtime pm wrappers for i915 driver and add them into display > parent interface. > > v2: > - move i915 display rpm interface implementation to intel_runtime_pm.c > - rename intel_display as i915_display > > Signed-off-by: Jouni Högander <[email protected]>
Reviewed-by: Jani Nikula <[email protected]> > --- > drivers/gpu/drm/i915/i915_driver.c | 1 + > drivers/gpu/drm/i915/intel_runtime_pm.c | 77 +++++++++++++++++++++++++ > drivers/gpu/drm/i915/intel_runtime_pm.h | 3 + > 3 files changed, 81 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_driver.c > b/drivers/gpu/drm/i915/i915_driver.c > index b295326eb4331..c97b767719176 100644 > --- a/drivers/gpu/drm/i915/i915_driver.c > +++ b/drivers/gpu/drm/i915/i915_driver.c > @@ -740,6 +740,7 @@ static void i915_welcome_messages(struct drm_i915_private > *dev_priv) > } > > static const struct intel_display_parent_interface parent = { > + .rpm = &i915_display_rpm_interface, > }; > > const struct intel_display_parent_interface > *i915_driver_parent_interface(void) > diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c > b/drivers/gpu/drm/i915/intel_runtime_pm.c > index 7ce3e6de0c197..d11c2814b787b 100644 > --- a/drivers/gpu/drm/i915/intel_runtime_pm.c > +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c > @@ -29,6 +29,7 @@ > #include <linux/pm_runtime.h> > > #include <drm/drm_print.h> > +#include <drm/intel/display_parent_interface.h> > > #include "i915_drv.h" > #include "i915_trace.h" > @@ -177,6 +178,82 @@ static intel_wakeref_t __intel_runtime_pm_get(struct > intel_runtime_pm *rpm, > return track_intel_runtime_pm_wakeref(rpm); > } > > +static struct intel_runtime_pm *drm_to_rpm(const struct drm_device *drm) > +{ > + struct drm_i915_private *i915 = to_i915(drm); > + > + return &i915->runtime_pm; > +} > + > +static struct ref_tracker *i915_display_rpm_get(const struct drm_device *drm) > +{ > + return intel_runtime_pm_get(drm_to_rpm(drm)); > +} > + > +static struct ref_tracker *i915_display_rpm_get_raw(const struct drm_device > *drm) > +{ > + return intel_runtime_pm_get_raw(drm_to_rpm(drm)); > +} > + > +static struct ref_tracker *i915_display_rpm_get_if_in_use(const struct > drm_device *drm) > +{ > + return intel_runtime_pm_get_if_in_use(drm_to_rpm(drm)); > +} > + > +static struct ref_tracker *i915_display_rpm_get_noresume(const struct > drm_device *drm) > +{ > + return intel_runtime_pm_get_noresume(drm_to_rpm(drm)); > +} > + > +static void i915_display_rpm_put(const struct drm_device *drm, struct > ref_tracker *wakeref) > +{ > + intel_runtime_pm_put(drm_to_rpm(drm), wakeref); > +} > + > +static void i915_display_rpm_put_raw(const struct drm_device *drm, struct > ref_tracker *wakeref) > +{ > + intel_runtime_pm_put_raw(drm_to_rpm(drm), wakeref); > +} > + > +static void i915_display_rpm_put_unchecked(const struct drm_device *drm) > +{ > + intel_runtime_pm_put_unchecked(drm_to_rpm(drm)); > +} > + > +static bool i915_display_rpm_suspended(const struct drm_device *drm) > +{ > + return intel_runtime_pm_suspended(drm_to_rpm(drm)); > +} > + > +static void i915_display_rpm_assert_held(const struct drm_device *drm) > +{ > + assert_rpm_wakelock_held(drm_to_rpm(drm)); > +} > + > +static void i915_display_rpm_assert_block(const struct drm_device *drm) > +{ > + disable_rpm_wakeref_asserts(drm_to_rpm(drm)); > +} > + > +static void i915_display_rpm_assert_unblock(const struct drm_device *drm) > +{ > + enable_rpm_wakeref_asserts(drm_to_rpm(drm)); > +} > + > +const struct intel_display_rpm_interface i915_display_rpm_interface = { > + .get = i915_display_rpm_get, > + .get_raw = i915_display_rpm_get_raw, > + .get_if_in_use = i915_display_rpm_get_if_in_use, > + .get_noresume = i915_display_rpm_get_noresume, > + .put = i915_display_rpm_put, > + .put_raw = i915_display_rpm_put_raw, > + .put_unchecked = i915_display_rpm_put_unchecked, > + .suspended = i915_display_rpm_suspended, > + .assert_held = i915_display_rpm_assert_held, > + .assert_block = i915_display_rpm_assert_block, > + .assert_unblock = i915_display_rpm_assert_unblock > +}; > + > /** > * intel_runtime_pm_get_raw - grab a raw runtime pm reference > * @rpm: the intel_runtime_pm structure > diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.h > b/drivers/gpu/drm/i915/intel_runtime_pm.h > index 7428bd8fa67f4..ed6c43b17f9ae 100644 > --- a/drivers/gpu/drm/i915/intel_runtime_pm.h > +++ b/drivers/gpu/drm/i915/intel_runtime_pm.h > @@ -14,6 +14,7 @@ > struct device; > struct drm_i915_private; > struct drm_printer; > +struct intel_display_rpm_interface; > > /* > * This struct helps tracking the state needed for runtime PM, which puts the > @@ -226,4 +227,6 @@ static inline void print_intel_runtime_pm_wakeref(struct > intel_runtime_pm *rpm, > } > #endif > > +extern const struct intel_display_rpm_interface i915_display_rpm_interface; > + > #endif /* __INTEL_RUNTIME_PM_H__ */ -- Jani Nikula, Intel
