backlight: pwm_bl: Fix brightness levels for non-DT case.
authorEnric Balletbo i Serra <enric.balletbo@collabora.com>
Mon, 10 Dec 2018 12:14:37 +0000 (13:14 +0100)
committerLee Jones <lee.jones@linaro.org>
Mon, 10 Dec 2018 15:37:47 +0000 (15:37 +0000)
commitd347d0c82a99b41efc2770fc01a04066903300df
treef9ba3616d7e7adab403100a6f3492aa229da6231
parent651022382c7f8da46cb4872a545ee1da6d097d2a
backlight: pwm_bl: Fix brightness levels for non-DT case.

Commit '88ba95bedb79 ("backlight: pwm_bl: Compute brightness of LED
linearly to human eye")' allows the possibility to compute a default
brightness table when there isn't the brightness-levels property in the
DT. Unfortunately the changes made broke the pwm backlight for the
non-DT boards.

Usually, the non-DT boards don't pass the brightness levels via platform
data, instead, it sets the max_brightness in their platform data and the
driver calculates the level without a table. The offending patch assumed
that when there is no brightness levels table we should create one, but this
is clearly wrong for the non-DT case.

After this patch the code handles the DT and the non-DT case taking in
consideration also if max_brightness is set or not.

Fixes: 88ba95bedb79 ("backlight: pwm_bl: Compute brightness of LED linearly to human eye")
Reported-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Acked-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/video/backlight/pwm_bl.c