linux-stable/drivers/video
Matthias Kaehlcke 5105593b6e backlight: pwm_bl: Fix heuristic to determine number of brightness levels
[ Upstream commit 73fbfc4994 ]

With commit 88ba95bedb ("backlight: pwm_bl: Compute brightness of
LED linearly to human eye") the number of set bits (aka hweight())
in the PWM period is used in the heuristic to determine the number
of brightness levels, when the brightness table isn't specified in
the DT. The number of set bits doesn't provide a reliable clue about
the length of the period, instead change the heuristic to:

 nlevels = period / fls(period)

Also limit the maximum number of brightness levels to 4096 to avoid
excessively large tables.

With this the number of levels increases monotonically with the PWM
period, until the maximum of 4096 levels is reached:

period (ns)    # levels

100    	       16
500	       62
1000	       111
5000	       416
10000	       769
50000	       3333
100000	       4096

Fixes: 88ba95bedb ("backlight: pwm_bl: Compute brightness of LED linearly to human eye")
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Acked-by: Daniel Thompson <daniel.thompson@linaro.org>
Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-27 14:50:58 +01:00
..
backlight backlight: pwm_bl: Fix heuristic to determine number of brightness levels 2020-01-27 14:50:58 +01:00
console vgacon: unconfuse vc_origin when using soft scrollback 2019-01-31 08:14:36 +01:00
fbdev fbdev: chipsfb: remove set but not used variable 'size' 2020-01-27 14:50:21 +01:00
logo
display_timing.c
hdmi.c video/hdmi: Fix AVI bar unpack 2019-12-17 20:35:17 +01:00
Kconfig
Makefile
of_display_timing.c
of_videomode.c
vgastate.c
videomode.c