Skip to content

Commit 5bef1ba

Browse files
committed
drm/i915/display: Runtime pm wrappers for display parent interface
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 Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Jouni Högander <jouni.hogander@intel.com> Link: https://patch.msgid.link/20251030202836.1815680-4-jouni.hogander@intel.com
1 parent 1914d68 commit 5bef1ba

3 files changed

Lines changed: 81 additions & 0 deletions

File tree

drivers/gpu/drm/i915/i915_driver.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,7 @@ static void i915_welcome_messages(struct drm_i915_private *dev_priv)
740740
}
741741

742742
static const struct intel_display_parent_interface parent = {
743+
.rpm = &i915_display_rpm_interface,
743744
};
744745

745746
const struct intel_display_parent_interface *i915_driver_parent_interface(void)

drivers/gpu/drm/i915/intel_runtime_pm.c

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <linux/pm_runtime.h>
3030

3131
#include <drm/drm_print.h>
32+
#include <drm/intel/display_parent_interface.h>
3233

3334
#include "i915_drv.h"
3435
#include "i915_trace.h"
@@ -177,6 +178,82 @@ static intel_wakeref_t __intel_runtime_pm_get(struct intel_runtime_pm *rpm,
177178
return track_intel_runtime_pm_wakeref(rpm);
178179
}
179180

181+
static struct intel_runtime_pm *drm_to_rpm(const struct drm_device *drm)
182+
{
183+
struct drm_i915_private *i915 = to_i915(drm);
184+
185+
return &i915->runtime_pm;
186+
}
187+
188+
static struct ref_tracker *i915_display_rpm_get(const struct drm_device *drm)
189+
{
190+
return intel_runtime_pm_get(drm_to_rpm(drm));
191+
}
192+
193+
static struct ref_tracker *i915_display_rpm_get_raw(const struct drm_device *drm)
194+
{
195+
return intel_runtime_pm_get_raw(drm_to_rpm(drm));
196+
}
197+
198+
static struct ref_tracker *i915_display_rpm_get_if_in_use(const struct drm_device *drm)
199+
{
200+
return intel_runtime_pm_get_if_in_use(drm_to_rpm(drm));
201+
}
202+
203+
static struct ref_tracker *i915_display_rpm_get_noresume(const struct drm_device *drm)
204+
{
205+
return intel_runtime_pm_get_noresume(drm_to_rpm(drm));
206+
}
207+
208+
static void i915_display_rpm_put(const struct drm_device *drm, struct ref_tracker *wakeref)
209+
{
210+
intel_runtime_pm_put(drm_to_rpm(drm), wakeref);
211+
}
212+
213+
static void i915_display_rpm_put_raw(const struct drm_device *drm, struct ref_tracker *wakeref)
214+
{
215+
intel_runtime_pm_put_raw(drm_to_rpm(drm), wakeref);
216+
}
217+
218+
static void i915_display_rpm_put_unchecked(const struct drm_device *drm)
219+
{
220+
intel_runtime_pm_put_unchecked(drm_to_rpm(drm));
221+
}
222+
223+
static bool i915_display_rpm_suspended(const struct drm_device *drm)
224+
{
225+
return intel_runtime_pm_suspended(drm_to_rpm(drm));
226+
}
227+
228+
static void i915_display_rpm_assert_held(const struct drm_device *drm)
229+
{
230+
assert_rpm_wakelock_held(drm_to_rpm(drm));
231+
}
232+
233+
static void i915_display_rpm_assert_block(const struct drm_device *drm)
234+
{
235+
disable_rpm_wakeref_asserts(drm_to_rpm(drm));
236+
}
237+
238+
static void i915_display_rpm_assert_unblock(const struct drm_device *drm)
239+
{
240+
enable_rpm_wakeref_asserts(drm_to_rpm(drm));
241+
}
242+
243+
const struct intel_display_rpm_interface i915_display_rpm_interface = {
244+
.get = i915_display_rpm_get,
245+
.get_raw = i915_display_rpm_get_raw,
246+
.get_if_in_use = i915_display_rpm_get_if_in_use,
247+
.get_noresume = i915_display_rpm_get_noresume,
248+
.put = i915_display_rpm_put,
249+
.put_raw = i915_display_rpm_put_raw,
250+
.put_unchecked = i915_display_rpm_put_unchecked,
251+
.suspended = i915_display_rpm_suspended,
252+
.assert_held = i915_display_rpm_assert_held,
253+
.assert_block = i915_display_rpm_assert_block,
254+
.assert_unblock = i915_display_rpm_assert_unblock
255+
};
256+
180257
/**
181258
* intel_runtime_pm_get_raw - grab a raw runtime pm reference
182259
* @rpm: the intel_runtime_pm structure

drivers/gpu/drm/i915/intel_runtime_pm.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
struct device;
1515
struct drm_i915_private;
1616
struct drm_printer;
17+
struct intel_display_rpm_interface;
1718

1819
/*
1920
* 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,
226227
}
227228
#endif
228229

230+
extern const struct intel_display_rpm_interface i915_display_rpm_interface;
231+
229232
#endif /* __INTEL_RUNTIME_PM_H__ */

0 commit comments

Comments
 (0)