All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mario Limonciello <superm1@kernel.org>
To: Lauri Tirkkonen <lauri@hacktheplanet.fi>
Cc: stable@vger.kernel.org, regressions@lists.linux.dev,
	amd-gfx@lists.freedesktop.org, Wayne Lin <wayne.lin@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [REGRESSION] [PATCH] drm/amd/display: fix initial backlight brightness calculation
Date: Sun, 20 Jul 2025 07:49:50 -0500	[thread overview]
Message-ID: <18a71fc3-dd01-4335-9655-716c87048530@kernel.org> (raw)
In-Reply-To: <aHy4tohvbwd1HpxI@hacktheplanet.fi>



On 7/20/25 4:36 AM, Lauri Tirkkonen wrote:
> DIV_ROUND_CLOSEST(x, 100) returns either 0 or 1 if 0<x<=100, so the
> division needs to be performed after the multiplication and not the
> other way around, to properly scale the value.
> 
> Fixes: 6c56c8ec6f97 ("drm/amd/display: Fix default DC and AC levels")
> Signed-off-by: Lauri Tirkkonen <lauri@hacktheplanet.fi>
> ---
>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index f58fa5da7fe5..8a5b5dfad1ab 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -4941,9 +4941,9 @@ amdgpu_dm_register_backlight_device(struct amdgpu_dm_connector *aconnector)
>   	caps = &dm->backlight_caps[aconnector->bl_idx];
>   	if (get_brightness_range(caps, &min, &max)) {
>   		if (power_supply_is_system_supplied() > 0)
> -			props.brightness = (max - min) * DIV_ROUND_CLOSEST(caps->ac_level, 100);
> +			props.brightness = DIV_ROUND_CLOSEST((max - min) * caps->ac_level, 100);
>   		else
> -			props.brightness = (max - min) * DIV_ROUND_CLOSEST(caps->dc_level, 100);
> +			props.brightness = DIV_ROUND_CLOSEST((max - min) * caps->dc_level, 100);
>   		/* min is zero, so max needs to be adjusted */
>   		props.max_brightness = max - min;
>   		drm_dbg(drm, "Backlight caps: min: %d, max: %d, ac %d, dc %d\n", min, max,

Thanks! The change makes sense.  Besides Greg's comments can you please 
send out of the regression thread?  IMO This should be it's own patch 
thread.

      parent reply	other threads:[~2025-07-20 12:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-18  7:29 [REGRESSION] drm/amd/display: backlight brightness set to 0 at amdgpu initialization Lauri Tirkkonen
2025-07-18 13:10 ` Mario Limonciello
2025-07-18 14:36   ` Lauri Tirkkonen
2025-07-18 17:13     ` Mario Limonciello
2025-07-19  1:03       ` Lauri Tirkkonen
2025-07-19  1:14         ` Mario Limonciello
2025-07-19  2:12           ` Lauri Tirkkonen
2025-07-19 15:25             ` Mario Limonciello
2025-07-19 17:39               ` Mario Limonciello
2025-07-20  9:34                 ` Lauri Tirkkonen
2025-07-20  9:36                   ` [REGRESSION] [PATCH] drm/amd/display: fix initial backlight brightness calculation Lauri Tirkkonen
2025-07-20 10:26                     ` Greg Kroah-Hartman
2025-07-21  0:51                       ` Lauri Tirkkonen
2025-07-20 12:49                     ` Mario Limonciello [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18a71fc3-dd01-4335-9655-716c87048530@kernel.org \
    --to=superm1@kernel.org \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=lauri@hacktheplanet.fi \
    --cc=regressions@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=wayne.lin@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.