[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210211035245.GG82362@intel.com>
Date: Wed, 10 Feb 2021 22:52:45 -0500
From: Rodrigo Vivi <rodrigo.vivi@...el.com>
To: Lyude Paul <lyude@...hat.com>
Cc: dri-devel@...ts.freedesktop.org, nouveau@...ts.freedesktop.org,
intel-gfx@...ts.freedesktop.org, David Airlie <airlied@...ux.ie>,
open list <linux-kernel@...r.kernel.org>,
Sean Paul <seanpaul@...omium.org>
Subject: Re: [Intel-gfx] [RFC v4 08/11] drm/i915/dpcd_bl: Return early in
vesa_calc_max_backlight if we can't read PWMGEN_BIT_COUNT
On Mon, Feb 08, 2021 at 06:38:58PM -0500, Lyude Paul wrote:
> If we can't read DP_EDP_PWMGEN_BIT_COUNT in
> intel_dp_aux_vesa_calc_max_backlight() but do have a valid PWM frequency
> defined in the VBT, we'll keep going in the function until we inevitably
> fail on reading DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN. There's not much point in
> doing this, so just return early.
>
> Signed-off-by: Lyude Paul <lyude@...hat.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@...el.com>
> ---
> drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
> index 611eb3a7cc08..a139f0e08839 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
> @@ -449,11 +449,14 @@ static u32 intel_dp_aux_vesa_calc_max_backlight(struct intel_connector *connecto
> int freq, fxp, fxp_min, fxp_max, fxp_actual, f = 1;
> u8 pn, pn_min, pn_max;
>
> - if (drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_PWMGEN_BIT_COUNT, &pn) == 1) {
> - pn &= DP_EDP_PWMGEN_BIT_COUNT_MASK;
> - max_backlight = (1 << pn) - 1;
> + if (drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_PWMGEN_BIT_COUNT, &pn) != 1) {
> + drm_dbg_kms(&i915->drm, "Failed to read pwmgen bit count cap\n");
> + return 0;
> }
>
> + pn &= DP_EDP_PWMGEN_BIT_COUNT_MASK;
> + max_backlight = (1 << pn) - 1;
> +
> /* Find desired value of (F x P)
> * Note that, if F x P is out of supported range, the maximum value or
> * minimum value will applied automatically. So no need to check that.
> --
> 2.29.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Powered by blists - more mailing lists