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=1796209822; b=RjYp1pbYwxgoUrQMQuD+Y28jGS1mEKoFT6YlzdS8twv/fnW6f812YlK8wJbYxpJSU2aQ P6AgkleOV+0T3W6ONyDnfDl1XY2sbcDcefhKiyhj22aV0Om8UcEKjBlA22aW5Rcdvc3TP p5yumICZldw/yPmSQFkkfUo/ZP7L9gtZS6MN50Kw7CMqjKQJW/+x9Ilv1Dn7nPScvvrjc 1ss4B1lNm+9uBYYTb0or5vp7QSz6jpXs/f2G9LpeYqANuQsoQUX7MeybWD04IaDGdhUPA ef9UpCuFUEhmRCtv/Y/3CBdbBrbSQClNQC0qYZYNyzEl89lpX2XIkpWYVGx8gIBYQnw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796209822; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=feQUXXAA5v8NTCgGwKaOapUoVa8bC7c75wc5eXhBW6c=; b=p50nKh0IwgE1UsNvkY25DIz9G5a9sDQAUp42yBlANYNJQg3yQ1gBO+kabGcsp4QmzdBJ dtMzlNxQ5B1ESsnf4VVrG6odZcH9mY5sOvQF5VKLZk0YP7DAZhl0m6JizyWVEeSu4dm7D LeMnZDS4okGKJeRbV/CMA2K5Eh3q6y0YbQAxf2HmPtl/plZH3TZW4TI9c3V/Qr7AyOPwV o1psLxXHZB8J0mwu/mcPu7CPDM1GgrohVlABxH9zp4Amr/mKY4ou9gwcXv78CIIjMKIal H3tD7CETtEDqupZ6wOqQuxv23aCYA2TEGp6M5St7JfAa6myEhmRLDPeRkmt5HiRs7Bg== 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=iMP4G0y6; 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 78B12606A31A for ; Wed, 2 Dec 2026 11:10:22 +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=iMP4G0y6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F5521F00893; Wed, 2 Dec 2026 11:10:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796209822; bh=feQUXXAA5v8NTCgGwKaOapUoVa8bC7c75wc5eXhBW6c=; h=Subject:To:Cc:From:Date; b=iMP4G0y62zW6Dka+4l5+XrVOKAVD9Lg3kmxQf398Z/I8pYcoZqAGhoshJBx5WEEQr j0St8ou6srrDOD8MGloBAcLRT4GqkrY0W+urxZcmeJgYNV8qA3HYPQbc+62x6YC6t4 vjDuhbGCF6V9VT8AMw7/ZfNL7RxsaLLm4OGPObhE= Subject: FAILED: patch "[PATCH] drm/amd/display: Add the AUX backlight minimum once on the" failed to apply to 6.18-stable tree To: hugo@hsal.es,Wayne.Lin@amd.com,alexander.deucher@amd.com,ray.wu@amd.com Cc: From: Date: Wed, 02 Dec 2026 12:10:19 +0100 Message-ID: <2026120219-edition-tuesday-cff4@gregkh> 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-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.18-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y git checkout FETCH_HEAD git cherry-pick -x 988ab04d773ac089588ce17742f491e9ee8b1793 # git commit -s git send-email --to '' --in-reply-to '2026120219-edition-tuesday-cff4@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 988ab04d773ac089588ce17742f491e9ee8b1793 Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Tue, 3 Nov 2026 13:15:57 +0000 Subject: [PATCH] drm/amd/display: Add the AUX backlight minimum once on the custom curve 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 diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c index cb74b00723fd..8d27c2712c51 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c @@ -122,10 +122,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 u32 backlight_signal_to_luminance(const struct amdgpu_dm_backlight_caps *caps, @@ -251,8 +251,7 @@ void convert_custom_brightness(const struct amdgpu_dm_backlight_caps *caps, (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)); } EXPORT_IF_KUNIT(convert_custom_brightness); diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_backlight_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_backlight_test.c index 5221050dec2f..e500c55a0672 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_backlight_test.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_backlight_test.c @@ -1125,10 +1125,10 @@ static void dm_test_custom_brightness_exact_match(struct kunit *test) /* * Exact match: lum=50, brightness_scaled=128 - * result = scale_fw_to_input(min, max, DIV_ROUND_CLOSEST(50*128, 101)) - * = scale_fw_to_input(0, 65535, DIV_ROUND_CLOSEST(6400, 101)) - * = scale_fw_to_input(0, 65535, 63) - * = 0 + DIV_ROUND_CLOSEST(63 * 65535, 255) = 16191 (approx) + * result = scale_fw_to_input(max, DIV_ROUND_CLOSEST(50*128, 101)) + * = scale_fw_to_input(65535, DIV_ROUND_CLOSEST(6400, 101)) + * = scale_fw_to_input(65535, 63) + * = DIV_ROUND_CLOSEST(63 * 65535, 255) = 16191 (approx) */ KUNIT_EXPECT_TRUE(test, brightness != 32896); KUNIT_EXPECT_TRUE(test, brightness < 32896); @@ -1171,9 +1171,9 @@ static void dm_test_custom_brightness_below_first(struct kunit *test) /* * Below first data point: lum = DIV_ROUND_CLOSEST(40 * 50, 100) = 20 - * Then: scale_fw_to_input(0, 65535, DIV_ROUND_CLOSEST(20 * 50, 101)) - * = scale_fw_to_input(0, 65535, DIV_ROUND_CLOSEST(1000, 101)) - * = scale_fw_to_input(0, 65535, 10) + * Then: scale_fw_to_input(65535, DIV_ROUND_CLOSEST(20 * 50, 101)) + * = scale_fw_to_input(65535, DIV_ROUND_CLOSEST(1000, 101)) + * = scale_fw_to_input(65535, 10) * The output should be significantly less than input. */ KUNIT_EXPECT_TRUE(test, brightness < 12850);