linux-stable/drivers/video/backlight
Marijn Suijten 7a4e6e0878 backlight: qcom-wled: Respect enabled-strings in set_brightness
[ Upstream commit ec961cf324 ]

The hardware is capable of controlling any non-contiguous sequence of
LEDs specified in the DT using qcom,enabled-strings as u32
array, and this also follows from the DT-bindings documentation.  The
numbers specified in this array represent indices of the LED strings
that are to be enabled and disabled.

Its value is appropriately used to setup and enable string modules, but
completely disregarded in the set_brightness paths which only iterate
over the number of strings linearly.
Take an example where only string 2 is enabled with
qcom,enabled_strings=<2>: this string is appropriately enabled but
subsequent brightness changes would have only touched the zero'th
brightness register because num_strings is 1 here.  This is simply
addressed by looking up the string for this index in the enabled_strings
array just like the other codepaths that iterate over num_strings.

Likewise enabled_strings is now also used in the autodetection path for
consistent behaviour: when a list of strings is specified in DT only
those strings will be probed for autodetection, analogous to how the
number of strings that need to be probed is already bound by
qcom,num-strings.  After all autodetection uses the set_brightness
helpers to set an initial value, which could otherwise end up changing
brightness on a different set of strings.

Fixes: 775d2ffb4a ("backlight: qcom-wled: Restructure the driver for WLED3")
Fixes: 03b2b5e869 ("backlight: qcom-wled: Add support for WLED4 peripheral")
Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211115203459.1634079-10-marijn.suijten@somainline.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-01-27 11:03:46 +01:00
..
88pm860x_bl.c
aat2870_bl.c
adp5520_bl.c
adp8860_bl.c
adp8870_bl.c
ams369fg06.c
apple_bl.c
arcxcnn_bl.c
as3711_bl.c
backlight.c
bd6107.c
corgi_lcd.c
cr_bllcd.c
da903x_bl.c
da9052_bl.c
ep93xx_bl.c
gpio_backlight.c
hp680_bl.c
hx8357.c
ili922x.c
ili9320.c
ili9320.h
ipaq_micro_bl.c
jornada720_bl.c
jornada720_lcd.c
kb3886_bl.c
Kconfig
ktd253-backlight.c
l4f00242t03.c
lcd.c
led_bl.c
lm3533_bl.c
lm3630a_bl.c
lm3639_bl.c
lms283gf05.c
lms501kf03.c
locomolcd.c
lp855x_bl.c
lp8788_bl.c
ltv350qv.c
ltv350qv.h
lv5207lp.c
Makefile
max8925_bl.c
omap1_bl.c
otm3225a.c
pandora_bl.c
pcf50633-backlight.c
platform_lcd.c
pwm_bl.c
qcom-wled.c backlight: qcom-wled: Respect enabled-strings in set_brightness 2022-01-27 11:03:46 +01:00
rave-sp-backlight.c
rt4831-backlight.c
sky81452-backlight.c
tdo24m.c
tosa_bl.c
tosa_bl.h
tosa_lcd.c
tps65217_bl.c
vgg2432a4.c
wm831x_bl.c