summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sousa <gustavo.sousa@intel.com>2024-11-08 09:57:12 -0300
committerMatt Roper <matthew.d.roper@intel.com>2024-11-08 09:54:01 -0800
commit83329df1be0c883801251d9aeaca0df317e14a14 (patch)
treeb9ed34991ba5c18d7ee1b61aadb91f4a171ea5d7
parent1e15bc5bd7665558f4296b4cc50a561460b9f236 (diff)
downloadlinux-83329df1be0c883801251d9aeaca0df317e14a14.tar.gz
linux-83329df1be0c883801251d9aeaca0df317e14a14.zip
drm/i915/dmc_wl: Extract intel_dmc_wl_reg_in_range()
We will be using more than one range table in intel_dmc_wl_check_range(). As such, move the logic to a new function and name it intel_dmc_wl_reg_in_range(). Reviewed-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com> Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20241108130218.24125-8-gustavo.sousa@intel.com
-rw-r--r--drivers/gpu/drm/i915/display/intel_dmc_wl.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_dmc_wl.c b/drivers/gpu/drm/i915/display/intel_dmc_wl.c
index 1753c334f3fd..4b958a4c4358 100644
--- a/drivers/gpu/drm/i915/display/intel_dmc_wl.c
+++ b/drivers/gpu/drm/i915/display/intel_dmc_wl.c
@@ -99,21 +99,22 @@ out_unlock:
spin_unlock_irqrestore(&wl->lock, flags);
}
-static bool intel_dmc_wl_check_range(i915_reg_t reg)
+static bool intel_dmc_wl_reg_in_range(i915_reg_t reg,
+ const struct intel_dmc_wl_range ranges[])
{
- int i;
- bool wl_needed = false;
u32 offset = i915_mmio_reg_offset(reg);
- for (i = 0; lnl_wl_range[i].start; i++) {
- if (offset >= lnl_wl_range[i].start &&
- offset <= lnl_wl_range[i].end) {
- wl_needed = true;
- break;
- }
+ for (int i = 0; ranges[i].start; i++) {
+ if (ranges[i].start <= offset && offset <= ranges[i].end)
+ return true;
}
- return wl_needed;
+ return false;
+}
+
+static bool intel_dmc_wl_check_range(i915_reg_t reg)
+{
+ return intel_dmc_wl_reg_in_range(reg, lnl_wl_range);
}
static bool __intel_dmc_wl_supported(struct intel_display *display)