backlight: pwm_bl: Switch to power-of-2 base for fixed-point math
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Tue, 8 Oct 2019 12:03:27 +0000 (14:03 +0200)
committerLee Jones <lee.jones@linaro.org>
Mon, 14 Oct 2019 07:57:45 +0000 (08:57 +0100)
commitca58b37034453e690e5278f95f32ea050951cf9f
tree07f29271da2dd267d4eed1979069c33799355011
parent407feae1cacaa5d00ebe686532a73ad6de747409
backlight: pwm_bl: Switch to power-of-2 base for fixed-point math

Using a power-of-2 instead of power-of-10 base makes the computations
much cheaper. 2^16 is safe; retval never becomes more than 2^48 +
2^32/2. On a 32 bit platform, the very expensive 64/32 division at the
end of cie1931() instead becomes essentially free (a shift by 32 is
just a register rename).

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/video/backlight/pwm_bl.c