mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 20:14:06 +02:00
drm/i915/pc8: Add parent interface for PC8 forcewake tricks
We use forcewake to prevent the SoC from actually entering
PC8 while performing the PC8 disable sequence. Hide that
behind a new parent interface to eliminate the naked
forcewake/uncore usage from the display power code.
v2: Mark the interface optional and warn if
someone calls it when not provided (Jani)
Include the header to make sure the extern
declaration matches the definition (Jani)
v3: Rebase due to shuffling
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/20251218182052.18756-1-ville.syrjala@linux.intel.com
This commit is contained in:
parent
9236cf0ade
commit
35ec71285c
|
|
@ -76,6 +76,7 @@ i915-$(CONFIG_PERF_EVENTS) += \
|
||||||
|
|
||||||
# core display adaptation
|
# core display adaptation
|
||||||
i915-y += \
|
i915-y += \
|
||||||
|
i915_display_pc8.o \
|
||||||
i915_hdcp_gsc.o \
|
i915_hdcp_gsc.o \
|
||||||
i915_panic.o
|
i915_panic.o
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1339,10 +1339,10 @@ static void hsw_restore_lcpll(struct intel_display *display)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure we're not on PC8 state before disabling PC8, otherwise
|
* Make sure we're not on PC8 state before disabling
|
||||||
* we'll hang the machine. To prevent PC8 state, just enable force_wake.
|
* PC8, otherwise we'll hang the machine.
|
||||||
*/
|
*/
|
||||||
intel_uncore_forcewake_get(&dev_priv->uncore, FORCEWAKE_ALL);
|
intel_parent_pc8_block(display);
|
||||||
|
|
||||||
if (val & LCPLL_POWER_DOWN_ALLOW) {
|
if (val & LCPLL_POWER_DOWN_ALLOW) {
|
||||||
val &= ~LCPLL_POWER_DOWN_ALLOW;
|
val &= ~LCPLL_POWER_DOWN_ALLOW;
|
||||||
|
|
@ -1372,7 +1372,7 @@ static void hsw_restore_lcpll(struct intel_display *display)
|
||||||
"Switching back to LCPLL failed\n");
|
"Switching back to LCPLL failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL);
|
intel_parent_pc8_unblock(display);
|
||||||
|
|
||||||
intel_update_cdclk(display);
|
intel_update_cdclk(display);
|
||||||
intel_cdclk_dump_config(display, &display->cdclk.hw, "Current CDCLK");
|
intel_cdclk_dump_config(display, &display->cdclk.hw, "Current CDCLK");
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,23 @@ void intel_parent_panic_finish(struct intel_display *display, struct intel_panic
|
||||||
display->parent->panic->finish(panic);
|
display->parent->panic->finish(panic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* pc8 */
|
||||||
|
void intel_parent_pc8_block(struct intel_display *display)
|
||||||
|
{
|
||||||
|
if (drm_WARN_ON_ONCE(display->drm, !display->parent->pc8))
|
||||||
|
return;
|
||||||
|
|
||||||
|
display->parent->pc8->block(display->drm);
|
||||||
|
}
|
||||||
|
|
||||||
|
void intel_parent_pc8_unblock(struct intel_display *display)
|
||||||
|
{
|
||||||
|
if (drm_WARN_ON_ONCE(display->drm, !display->parent->pc8))
|
||||||
|
return;
|
||||||
|
|
||||||
|
display->parent->pc8->unblock(display->drm);
|
||||||
|
}
|
||||||
|
|
||||||
/* rps */
|
/* rps */
|
||||||
bool intel_parent_rps_available(struct intel_display *display)
|
bool intel_parent_rps_available(struct intel_display *display)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,10 @@ struct intel_panic *intel_parent_panic_alloc(struct intel_display *display);
|
||||||
int intel_parent_panic_setup(struct intel_display *display, struct intel_panic *panic, struct drm_scanout_buffer *sb);
|
int intel_parent_panic_setup(struct intel_display *display, struct intel_panic *panic, struct drm_scanout_buffer *sb);
|
||||||
void intel_parent_panic_finish(struct intel_display *display, struct intel_panic *panic);
|
void intel_parent_panic_finish(struct intel_display *display, struct intel_panic *panic);
|
||||||
|
|
||||||
|
/* pc8 */
|
||||||
|
void intel_parent_pc8_block(struct intel_display *display);
|
||||||
|
void intel_parent_pc8_unblock(struct intel_display *display);
|
||||||
|
|
||||||
/* rps */
|
/* rps */
|
||||||
bool intel_parent_rps_available(struct intel_display *display);
|
bool intel_parent_rps_available(struct intel_display *display);
|
||||||
void intel_parent_rps_boost_if_not_started(struct intel_display *display, struct dma_fence *fence);
|
void intel_parent_rps_boost_if_not_started(struct intel_display *display, struct dma_fence *fence);
|
||||||
|
|
|
||||||
31
drivers/gpu/drm/i915/i915_display_pc8.c
Normal file
31
drivers/gpu/drm/i915/i915_display_pc8.c
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
/*
|
||||||
|
* Copyright 2025, Intel Corporation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <drm/drm_print.h>
|
||||||
|
#include <drm/intel/display_parent_interface.h>
|
||||||
|
|
||||||
|
#include "i915_display_pc8.h"
|
||||||
|
#include "i915_drv.h"
|
||||||
|
#include "intel_uncore.h"
|
||||||
|
|
||||||
|
static void i915_display_pc8_block(struct drm_device *drm)
|
||||||
|
{
|
||||||
|
struct intel_uncore *uncore = &to_i915(drm)->uncore;
|
||||||
|
|
||||||
|
/* to prevent PC8 state, just enable force_wake */
|
||||||
|
intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void i915_display_pc8_unblock(struct drm_device *drm)
|
||||||
|
{
|
||||||
|
struct intel_uncore *uncore = &to_i915(drm)->uncore;
|
||||||
|
|
||||||
|
intel_uncore_forcewake_put(uncore, FORCEWAKE_ALL);
|
||||||
|
}
|
||||||
|
|
||||||
|
const struct intel_display_pc8_interface i915_display_pc8_interface = {
|
||||||
|
.block = i915_display_pc8_block,
|
||||||
|
.unblock = i915_display_pc8_unblock,
|
||||||
|
};
|
||||||
9
drivers/gpu/drm/i915/i915_display_pc8.h
Normal file
9
drivers/gpu/drm/i915/i915_display_pc8.h
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
/* Copyright © 2025 Intel Corporation */
|
||||||
|
|
||||||
|
#ifndef __I915_DISPLAY_PC8_H__
|
||||||
|
#define __I915_DISPLAY_PC8_H__
|
||||||
|
|
||||||
|
extern const struct intel_display_pc8_interface i915_display_pc8_interface;
|
||||||
|
|
||||||
|
#endif /* __I915_DISPLAY_PC8_H__ */
|
||||||
|
|
@ -89,6 +89,7 @@
|
||||||
#include "pxp/intel_pxp_pm.h"
|
#include "pxp/intel_pxp_pm.h"
|
||||||
|
|
||||||
#include "i915_debugfs.h"
|
#include "i915_debugfs.h"
|
||||||
|
#include "i915_display_pc8.h"
|
||||||
#include "i915_driver.h"
|
#include "i915_driver.h"
|
||||||
#include "i915_drm_client.h"
|
#include "i915_drm_client.h"
|
||||||
#include "i915_drv.h"
|
#include "i915_drv.h"
|
||||||
|
|
@ -765,6 +766,7 @@ static const struct intel_display_parent_interface parent = {
|
||||||
.hdcp = &i915_display_hdcp_interface,
|
.hdcp = &i915_display_hdcp_interface,
|
||||||
.irq = &i915_display_irq_interface,
|
.irq = &i915_display_irq_interface,
|
||||||
.panic = &i915_display_panic_interface,
|
.panic = &i915_display_panic_interface,
|
||||||
|
.pc8 = &i915_display_pc8_interface,
|
||||||
.rpm = &i915_display_rpm_interface,
|
.rpm = &i915_display_rpm_interface,
|
||||||
.rps = &i915_display_rps_interface,
|
.rps = &i915_display_rps_interface,
|
||||||
.stolen = &i915_display_stolen_interface,
|
.stolen = &i915_display_stolen_interface,
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,11 @@ struct intel_display_panic_interface {
|
||||||
void (*finish)(struct intel_panic *panic);
|
void (*finish)(struct intel_panic *panic);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct intel_display_pc8_interface {
|
||||||
|
void (*block)(struct drm_device *drm);
|
||||||
|
void (*unblock)(struct drm_device *drm);
|
||||||
|
};
|
||||||
|
|
||||||
struct intel_display_rpm_interface {
|
struct intel_display_rpm_interface {
|
||||||
struct ref_tracker *(*get)(const struct drm_device *drm);
|
struct ref_tracker *(*get)(const struct drm_device *drm);
|
||||||
struct ref_tracker *(*get_raw)(const struct drm_device *drm);
|
struct ref_tracker *(*get_raw)(const struct drm_device *drm);
|
||||||
|
|
@ -96,6 +101,9 @@ struct intel_display_parent_interface {
|
||||||
/** @panic: Panic interface */
|
/** @panic: Panic interface */
|
||||||
const struct intel_display_panic_interface *panic;
|
const struct intel_display_panic_interface *panic;
|
||||||
|
|
||||||
|
/** @pc8: PC8 interface. Optional. */
|
||||||
|
const struct intel_display_pc8_interface *pc8;
|
||||||
|
|
||||||
/** @rpm: Runtime PM functions */
|
/** @rpm: Runtime PM functions */
|
||||||
const struct intel_display_rpm_interface *rpm;
|
const struct intel_display_rpm_interface *rpm;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user