]> www.infradead.org Git - users/jedix/linux-maple.git/commit
leds: lm3601x: Calculate max_brightness and brightness properly
authorJack Chen <zenghuchen@google.com>
Thu, 4 Jul 2024 19:15:00 +0000 (15:15 -0400)
committerLee Jones <lee@kernel.org>
Thu, 1 Aug 2024 12:40:00 +0000 (13:40 +0100)
commitb5a7fc286c0f1a1f6e50b030a9450cf39ba100b1
tree29f5df68a50696086e226100f4c2f5837718cc42
parent8400291e289ee6b2bf9779ff1c83a291501f017b
leds: lm3601x: Calculate max_brightness and brightness properly

The torch_current_max should be checked not exceeding the upper bound.
If it does, throw a warning message and set to LM3601X_MAX_TORCH_I_UA.

LM3601x torch brigthness register (LM3601X_LED_TORCH_REG) takes 0 as the
minimum output (2.4 mA). However, 0 of led_brightness means LED_OFF.
Adding a -1 offset to brightness before writing to brightness
register, so when users write minimum brightness (1), it sets lm3601x
output the minimum.

Signed-off-by: Jack Chen <zenghuchen@google.com>
Link: https://lore.kernel.org/r/20240704191500.766846-1-zenghuchen@google.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/leds/flash/leds-lm3601x.c