Message ID | 20241219221429.109668-2-gustavo.sousa@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/i915/dmc_wl: Support extra values for dmc_wl_enable for debugging | expand |
> -----Original Message----- > From: Intel-xe <intel-xe-bounces@lists.freedesktop.org> On Behalf Of Gustavo > Sousa > Sent: Friday, December 20, 2024 3:44 AM > To: intel-xe@lists.freedesktop.org; intel-gfx@lists.freedesktop.org > Subject: [PATCH 1/4] drm/i915/dmc_wl: Use enum values for enable_dmc_wl > > Currently, after sanitization, enable_dmc_wl will behave like a boolean parameter > (enabled vs disabled). However, in upcoming changes, we will allow more values > for debugging purposes. For that, let's make the sanitized value an enumeration. > > Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com> Looks good to me, Reviewed-by: Dnyaneshwar Bhadane <dnyaneshwar.bhadane@intel.com> Dnyaneshwar > --- > drivers/gpu/drm/i915/display/intel_dmc_wl.c | 29 ++++++++++++++++----- > 1 file changed, 23 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_dmc_wl.c > b/drivers/gpu/drm/i915/display/intel_dmc_wl.c > index 3ac44151aab5..cff841521ca0 100644 > --- a/drivers/gpu/drm/i915/display/intel_dmc_wl.c > +++ b/drivers/gpu/drm/i915/display/intel_dmc_wl.c > @@ -50,6 +50,15 @@ > #define DMC_WAKELOCK_CTL_TIMEOUT_US 5000 #define > DMC_WAKELOCK_HOLD_TIME 50 > > +/* > + * Possible non-negative values for the enable_dmc_wl param. > + */ > +enum { > + ENABLE_DMC_WL_DISABLED, > + ENABLE_DMC_WL_ENABLED, > + ENABLE_DMC_WL_MAX, > +}; > + > struct intel_dmc_wl_range { > u32 start; > u32 end; > @@ -270,12 +279,20 @@ static bool __intel_dmc_wl_supported(struct > intel_display *display) > > static void intel_dmc_wl_sanitize_param(struct intel_display *display) { > - if (!HAS_DMC_WAKELOCK(display)) > - display->params.enable_dmc_wl = 0; > - else if (display->params.enable_dmc_wl >= 0) > - display->params.enable_dmc_wl = !!display- > >params.enable_dmc_wl; > - else > - display->params.enable_dmc_wl = DISPLAY_VER(display) >= 30; > + if (!HAS_DMC_WAKELOCK(display)) { > + display->params.enable_dmc_wl = > ENABLE_DMC_WL_DISABLED; > + } else if (display->params.enable_dmc_wl < 0) { > + if (DISPLAY_VER(display) >= 30) > + display->params.enable_dmc_wl = > ENABLE_DMC_WL_ENABLED; > + else > + display->params.enable_dmc_wl = > ENABLE_DMC_WL_DISABLED; > + } else if (display->params.enable_dmc_wl >= ENABLE_DMC_WL_MAX) { > + display->params.enable_dmc_wl = > ENABLE_DMC_WL_ENABLED; > + } > + > + drm_WARN_ON(display->drm, > + display->params.enable_dmc_wl < 0 || > + display->params.enable_dmc_wl >= > ENABLE_DMC_WL_MAX); > > drm_dbg_kms(display->drm, "Sanitized enable_dmc_wl value: %d\n", > display->params.enable_dmc_wl); > -- > 2.47.1
diff --git a/drivers/gpu/drm/i915/display/intel_dmc_wl.c b/drivers/gpu/drm/i915/display/intel_dmc_wl.c index 3ac44151aab5..cff841521ca0 100644 --- a/drivers/gpu/drm/i915/display/intel_dmc_wl.c +++ b/drivers/gpu/drm/i915/display/intel_dmc_wl.c @@ -50,6 +50,15 @@ #define DMC_WAKELOCK_CTL_TIMEOUT_US 5000 #define DMC_WAKELOCK_HOLD_TIME 50 +/* + * Possible non-negative values for the enable_dmc_wl param. + */ +enum { + ENABLE_DMC_WL_DISABLED, + ENABLE_DMC_WL_ENABLED, + ENABLE_DMC_WL_MAX, +}; + struct intel_dmc_wl_range { u32 start; u32 end; @@ -270,12 +279,20 @@ static bool __intel_dmc_wl_supported(struct intel_display *display) static void intel_dmc_wl_sanitize_param(struct intel_display *display) { - if (!HAS_DMC_WAKELOCK(display)) - display->params.enable_dmc_wl = 0; - else if (display->params.enable_dmc_wl >= 0) - display->params.enable_dmc_wl = !!display->params.enable_dmc_wl; - else - display->params.enable_dmc_wl = DISPLAY_VER(display) >= 30; + if (!HAS_DMC_WAKELOCK(display)) { + display->params.enable_dmc_wl = ENABLE_DMC_WL_DISABLED; + } else if (display->params.enable_dmc_wl < 0) { + if (DISPLAY_VER(display) >= 30) + display->params.enable_dmc_wl = ENABLE_DMC_WL_ENABLED; + else + display->params.enable_dmc_wl = ENABLE_DMC_WL_DISABLED; + } else if (display->params.enable_dmc_wl >= ENABLE_DMC_WL_MAX) { + display->params.enable_dmc_wl = ENABLE_DMC_WL_ENABLED; + } + + drm_WARN_ON(display->drm, + display->params.enable_dmc_wl < 0 || + display->params.enable_dmc_wl >= ENABLE_DMC_WL_MAX); drm_dbg_kms(display->drm, "Sanitized enable_dmc_wl value: %d\n", display->params.enable_dmc_wl);
Currently, after sanitization, enable_dmc_wl will behave like a boolean parameter (enabled vs disabled). However, in upcoming changes, we will allow more values for debugging purposes. For that, let's make the sanitized value an enumeration. Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com> --- drivers/gpu/drm/i915/display/intel_dmc_wl.c | 29 ++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-)