OpenCloudOS-Kernel/drivers/video/backlight
Alexandru Stan 789eb04b6c backlight: pwm_bl: Fix interpolation
The previous behavior was a little unexpected, its properties/problems:
1. It was designed to generate strictly increasing values (no repeats)
2. It had quantization errors when calculating step size. Resulting in
unexpected jumps near the end of some segments.

Example settings:
	brightness-levels = <0 1 2 4 8 16 32 64 128 256>;
	num-interpolated-steps = <16>;

Whenever num-interpolated-steps was larger than the distance
between 2 consecutive brightness levels the table would get really
discontinuous. The slope of the interpolation would stick with
integers only and if it was 0 the whole line segment would get skipped.

The distances between 1 2 4 and 8 would be 1 (property #1 fighting us),
and only starting with 16 it would start to interpolate properly.

Property #1 is not enough. The goal here is more than just monotonically
increasing. We should still care about the shape of the curve. Repeated
points might be desired if we're in the part of the curve where we want
to go slow (aka slope near 0).

Problem #2 is plainly a bug. Imagine if the 64 entry was 63 instead,
the calculated slope on the 32-63 segment will be almost half as it
should be.

The most expected and simplest algorithm for interpolation is linear
interpolation, which would handle both problems.
Let's just implement that!

Take pairs of points from the brightness-levels array and linearly
interpolate between them. On the X axis (what userspace sees) we'll
now have equally sized intervals (num-interpolated-steps sized,
as opposed to before where we were at the mercy of quantization).

Signed-off-by: Alexandru Stan <amstan@chromium.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-11-04 15:54:57 +00:00
..
88pm860x_bl.c backlight: Use backlight_get_brightness() throughout 2020-07-20 10:27:06 +01:00
Kconfig backlight: Add Kinetic KTD253 backlight driver 2020-08-28 11:48:04 +01:00
Makefile backlight: Add Kinetic KTD253 backlight driver 2020-08-28 11:48:04 +01:00
aat2870_bl.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 336 2019-06-05 17:37:07 +02:00
adp5520_bl.c backlight: Use backlight_get_brightness() throughout 2020-07-20 10:27:06 +01:00
adp8860_bl.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
adp8870_bl.c backlight: Use backlight_get_brightness() throughout 2020-07-20 10:27:06 +01:00
ams369fg06.c backlight: ams369fg06: Drop GPIO include 2019-12-16 10:30:41 +00:00
apple_bl.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
arcxcnn_bl.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
as3711_bl.c backlight: as3711_bl: Simplify update_status 2020-07-20 10:27:03 +01:00
backlight.c backlight: backlight: Make of_find_backlight static 2020-07-20 10:27:11 +01:00
bd6107.c backlight: Use backlight_get_brightness() throughout 2020-07-20 10:27:06 +01:00
corgi_lcd.c backlight: Use backlight_get_brightness() throughout 2020-07-20 10:27:06 +01:00
cr_bllcd.c video: backlight: cr_bllcd: Remove unused variable 'intensity' 2020-07-21 15:45:45 +01:00
da903x_bl.c backlight: Use backlight_get_brightness() throughout 2020-07-20 10:27:06 +01:00
da9052_bl.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
ep93xx_bl.c backlight: Use backlight_get_brightness() throughout 2020-07-20 10:27:06 +01:00
gpio_backlight.c backlight: gpio_backlight: Simplify update_status() 2020-07-20 10:27:05 +01:00
hp680_bl.c backlight: Use backlight_get_brightness() throughout 2020-07-20 10:27:06 +01:00
hx8357.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 71 2019-05-24 17:36:47 +02:00
ili922x.c backlight: ili922x: Add missing kerneldoc description for ili922x_reg_dump()'s arg 2020-07-06 08:11:42 +01:00
ili9320.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ili9320.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ipaq_micro_bl.c backlight: ipaq_micro: Make structure micro_bl_props constant 2019-10-02 14:19:00 +01:00
jornada720_bl.c backlight: jornada720_bl: Introduce backlight_is_blank() 2020-07-20 10:27:05 +01:00
jornada720_lcd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 73 2019-05-24 17:36:47 +02:00
kb3886_bl.c backlight: Use backlight_get_brightness() throughout 2020-07-20 10:27:06 +01:00
ktd253-backlight.c backlight: Add Kinetic KTD253 backlight driver 2020-08-28 11:48:04 +01:00
l4f00242t03.c backlight: l4f00242t03: Convert to GPIO descriptors 2020-04-29 08:52:15 +01:00
lcd.c backlight: lcd: Add missing kerneldoc entry for 'struct device parent' 2020-07-06 08:11:41 +01:00
led_bl.c backlight: Use backlight_get_brightness() throughout 2020-07-20 10:27:06 +01:00
lm3533_bl.c backlight: Use backlight_get_brightness() throughout 2020-07-20 10:27:06 +01:00
lm3630a_bl.c backlight: lm3630a_bl: Remove invalid checks for unsigned int < 0 2020-07-06 08:11:43 +01:00
lm3639_bl.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
lms283gf05.c backlight: lms283gf05: Fix a typo in the description passed to 'devm_gpio_request_one()' 2019-08-12 09:11:22 +01:00
lms501kf03.c backlight: lms501kf03: Remove unused const variables 2020-07-06 08:11:41 +01:00
locomolcd.c backlight: Use backlight_get_brightness() throughout 2020-07-20 10:27:06 +01:00
lp855x_bl.c backlight: lp855x: Ensure regulators are disabled on probe failure 2020-04-28 08:09:36 +01:00
lp8788_bl.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ltv350qv.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ltv350qv.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
lv5207lp.c backlight: Use backlight_get_brightness() throughout 2020-07-20 10:27:06 +01:00
max8925_bl.c backlight: Use backlight_get_brightness() throughout 2020-07-20 10:27:06 +01:00
omap1_bl.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 154 2019-05-30 11:26:33 -07:00
otm3225a.c backlight: otm3225a: Add support for ORISE OTM3225A LCD SoC 2018-04-30 10:50:44 +01:00
pandora_bl.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pcf50633-backlight.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 151 2019-05-30 11:26:28 -07:00
platform_lcd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pwm_bl.c backlight: pwm_bl: Fix interpolation 2020-11-04 15:54:57 +00:00
qcom-wled.c backlight: Use backlight_get_brightness() throughout 2020-07-20 10:27:06 +01:00
rave-sp-backlight.c backlight: rave-sp: Leave initial state and register with correct device 2019-08-12 09:11:10 +01:00
sky81452-backlight.c backlight: sky81452-backlight: Fix refcount imbalance on error 2020-08-28 10:25:54 +01:00
tdo24m.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 332 2019-06-05 17:37:06 +02:00
tosa_bl.c backlight: tosa_bl: Include the right header 2020-09-08 12:31:19 +01:00
tosa_bl.h video: backlight: tosa: Use GPIO lookup table 2019-11-11 09:29:56 +00:00
tosa_lcd.c backlight: tosa_lcd: Include the right header 2020-09-08 12:30:02 +01:00
tps65217_bl.c backlight: Use backlight_get_brightness() throughout 2020-07-20 10:27:06 +01:00
vgg2432a4.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
wm831x_bl.c backlight: Use backlight_get_brightness() throughout 2020-07-20 10:27:06 +01:00