Commit 5bef1bad authored by Jouni Högander's avatar Jouni Högander
Browse files

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: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarJouni Högander <jouni.hogander@intel.com>
Link: https://patch.msgid.link/20251030202836.1815680-4-jouni.hogander@intel.com
parent 1914d686
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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)
+77 −0
Original line number Diff line number Diff line
@@ -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
+3 −0
Original line number Diff line number Diff line
@@ -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__ */