From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382889; b=Z0K9kQ86bRitikGPmcexKlE31VrpTctuknCa2N5V+9jrxz2YrggB0ZTayYowu4tF1IFN uhMiUQ7JtD238GrC6XqyCj0lEp9+waf/yOuWIPmZcxZqoGbN8IIKRmoOalHeVb/LA9Z4B /XvUkEZUPItLyzoOSmrkVxFL6ThUOXd0kkO8gceglXhMrJ3q9RoUfa/Eatc2+u60Bp61u jzn289nXNDKNsRHOs0ZCUCRKYoeE8QF9+yJEXemtwFPlyf5Q1iOmX29//QkAw3dXTAtO5 lzZZCrPqY4g2IJRnrfXHHYM/DmaujpaswSYFJJODSinZrZ7LK78Jx+eKVdvJHxcGLlg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382889; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=m2Sq96pzX15XlR+MffNRMudrzZFRlPiTG+b3Ypc5Awc=; b=Pw0/jvYcDE4lc/5mWu5NyyLEyhTgWx8tvvs9beuUv3tAUBjiZjk43UMWpPPQ492GScuy jsrQ1npWMLPRhcFebXTpfazqpxLZg1LPKdpO0ek6ltrTNzO0VE657BqQMdai9cLTZQ7kw PF8I2UO+E9oHdNgB4gsXHaeCM6ZG+wNe2ermhPn8i1Eyutlj5AAAE3cCezfAYbEXrzuFx r3E5aLUuy5jb2ovEvvV9p2CoBM3DJl629f2ZJtpZes9gyldmHul6bGtoY8pHvGnPqW5Cq R1mf5ahYBn58UJoihQGgqh9pkXrEf4bwUBmCpk7Vab2LiF8PVhQAdUo7XsapU4WeCgQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=rgQtfYZw; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBA08606A32D; Fri, 4 Dec 2026 11:14:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=rgQtfYZw Received: by smtp.kernel.org (Postfix) with ESMTPSA id 453001F000C2; Fri, 4 Dec 2026 11:14:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382889; bh=m2Sq96pzX15XlR+MffNRMudrzZFRlPiTG+b3Ypc5Awc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rgQtfYZwkez2igyTBw2rBuBZ1xhkWxUXvbb/W5He7Ga1hopfS8/A4qr8S1u5kIvR8 yvZKUYvpKib2J9r+3w1T+ysDDoTytAnkVdm4zLl1HnJD1pA/hVwfIxoquyABs36N7U Qr8n5CtpwHXlVU8epe2WYYGBnoY9RElDw/jXuRL4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ray Wu , Hugo Sales , Wayne Lin , Alex Deucher , Sasha Levin Subject: [PATCH 6.18 639/703] drm/amd/display: Add the AUX backlight minimum once on the custom curve Date: Fri, 4 Dec 2026 19:08:58 +0900 Message-ID: <20261204100644.783060892@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hugo Sales commit 988ab04d773ac089588ce17742f491e9ee8b1793 upstream. On an AUX backlight, convert_brightness_from_user() maps the user level through the ATIF custom brightness curve with convert_custom_brightness(), which rescales the result to user_min..user_max. convert_brightness_from_user() then rescales it again, from 0..user_max to user_min..user_max, so the minimum goes in twice. On the 1..512 nits AUX fallback range, a request for 0 gives 1998 millinits instead of 1000 Rescale the curve's output to 0..user_max and leave the offset to the caller Fixes: 8dbd72cb7900 ("drm/amd/display: Export full brightness range to userspace") Reviewed-by: Ray Wu Signed-off-by: Hugo Sales Signed-off-by: Wayne Lin Signed-off-by: Alex Deucher (cherry picked from commit 5f95ef2cfd208ca7efe446abfc9e3144dc5ce4fa) Cc: stable@vger.kernel.org [ In 6.18 the code is in amdgpu_dm.c and there are no KUnit tests, so drop the test hunks ] Signed-off-by: Hugo Sales Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 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 d3ec5c11abb18..8124d554431f6 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -4981,10 +4981,10 @@ static inline u32 scale_input_to_fw(int max, u64 input) return DIV_ROUND_CLOSEST_ULL(input * AMDGPU_MAX_BL_LEVEL, max); } -/* Rescale from [0..AMDGPU_MAX_BL_LEVEL] to [min..max] */ -static inline u32 scale_fw_to_input(int min, int max, u64 input) +/* Rescale from [0..AMDGPU_MAX_BL_LEVEL] to [0..max] */ +static inline u32 scale_fw_to_input(int max, u64 input) { - return min + DIV_ROUND_CLOSEST_ULL(input * (max - min), AMDGPU_MAX_BL_LEVEL); + return DIV_ROUND_CLOSEST_ULL(input * max, AMDGPU_MAX_BL_LEVEL); } static void convert_custom_brightness(const struct amdgpu_dm_backlight_caps *caps, @@ -5047,8 +5047,7 @@ static void convert_custom_brightness(const struct amdgpu_dm_backlight_caps *cap (brightness - lower_signal), upper_signal - lower_signal); scale: - *user_brightness = scale_fw_to_input(min, max, - DIV_ROUND_CLOSEST(lum * brightness, 101)); + *user_brightness = scale_fw_to_input(max, DIV_ROUND_CLOSEST(lum * brightness, 101)); } static u32 convert_brightness_from_user(const struct amdgpu_dm_backlight_caps *caps, -- 2.53.0