// SPDX-License-Identifier: MIT /* * Copyright (C) 2024 Intel Corporation */ #include <linux/kernel.h> #include "intel_de.h" #include "intel_dmc.h" #include "intel_dmc_regs.h" #include "intel_dmc_wl.h" /** * DOC: DMC wakelock support * * Wake lock is the mechanism to cause display engine to exit DC * states to allow programming to registers that are powered down in * those states. Previous projects exited DC states automatically when * detecting programming. Now software controls the exit by * programming the wake lock. This improves system performance and * system interactions and better fits the flip queue style of * programming. Wake lock is only required when DC5, DC6, or DC6v have * been enabled in DC_STATE_EN and the wake lock mode of operation has * been enabled. * * The wakelock mechanism in DMC allows the display engine to exit DC * states explicitly before programming registers that may be powered * down. In earlier hardware, this was done automatically and * implicitly when the display engine accessed a register. With the * wakelock implementation, the driver asserts a wakelock in DMC, * which forces it to exit the DC state until the wakelock is * deasserted. * * The mechanism can be enabled and disabled by writing to the * DMC_WAKELOCK_CFG register. There are also 13 control registers * that can be used to hold and release different wakelocks. In the * current implementation, we only need one wakelock, so only * DMC_WAKELOCK1_CTL is used. The other definitions are here for * potential future use. */ #define DMC_WAKELOCK_CTL_TIMEOUT … #define DMC_WAKELOCK_HOLD_TIME … struct intel_dmc_wl_range { … }; static struct intel_dmc_wl_range lnl_wl_range[] = …; static void __intel_dmc_wl_release(struct intel_display *display) { … } static void intel_dmc_wl_work(struct work_struct *work) { … } static bool intel_dmc_wl_check_range(u32 address) { … } static bool __intel_dmc_wl_supported(struct intel_display *display) { … } void intel_dmc_wl_init(struct intel_display *display) { … } void intel_dmc_wl_enable(struct intel_display *display) { … } void intel_dmc_wl_disable(struct intel_display *display) { … } void intel_dmc_wl_get(struct intel_display *display, i915_reg_t reg) { … } void intel_dmc_wl_put(struct intel_display *display, i915_reg_t reg) { … }