From 5e0c1f2e1b6dd337482260eaea474720f0dc5723 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 16 Feb 2026 19:16:35 +0900 Subject: [PATCH] backlight: also change clamp percentage on ID_BACKLIGHT_CLAMP/ID_LEDS_CLAMP=yes Follow-up for 4ed1e2ea17e0f29a23d7a3dd65af192def9b3214. --- src/backlight/backlight.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c index 15e0d17b8d..027379809d 100644 --- a/src/backlight/backlight.c +++ b/src/backlight/backlight.c @@ -372,6 +372,9 @@ static int clamp_brightness( return 0; } +/* used as the default for devices in the backlight subsystem, or when ID_BACKLIGHT_CLAMP/ID_LEDS_CLAMP=yes. */ +#define DEFAULT_CLAMP_PERCENT 1u + static int shall_clamp(sd_device *device, unsigned *ret) { const char *property, *s; unsigned default_percent; @@ -385,10 +388,10 @@ static int shall_clamp(sd_device *device, unsigned *ret) { return r; if (r > 0) { property = "ID_BACKLIGHT_CLAMP"; - default_percent = 1; + default_percent = DEFAULT_CLAMP_PERCENT; } else { property = "ID_LEDS_CLAMP"; - default_percent = 0; + default_percent = 0; /* The clamping is disabled by default. */ } r = sd_device_get_property_value(device, property, &s); @@ -401,7 +404,7 @@ static int shall_clamp(sd_device *device, unsigned *ret) { r = parse_boolean(s); if (r >= 0) { - *ret = r ? 5 : 0; + *ret = r ? DEFAULT_CLAMP_PERCENT : 0; return r; }