9
0
Fork 0
Commit Graph

9 Commits

Author SHA1 Message Date
Sascha Hauer ac20c4f03b video: backlight: fix the value of 'brightness_max'
Fixes: 87c6a88 video/backlight-pwm: fix the value of 'brightness_max'.

brightness_max should really contain the number of brightness steps, so
the number of elements in the brightness array.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-08-29 17:36:36 +02:00
iw3gtf@arcor.de 832f9fec6a video/backlight-pwm: properly handle the case of an empty 'brightness-levels' in the device tree.
In case of an empty 'brightness-levels' array in the device tree or
a non empty one but containing only zeros the value of
'pwm_backlight->scale' would remain 0 possibly causing a division by zero
in the function compute_duty_cycle().

To fix it we check the computed value in case we actually have a 'brightness-levels'
array in the device tree otherwise we implicitly assume a simple array
of the form { 0, 1, 2, ..., 100 } and set the scale to 100.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-15 08:07:14 +02:00
iw3gtf@arcor.de ca497ce66d video/backlight-pwm: code readability improvement.
We use the local variable 'length' instead of the lengthy
'pwm_backlight->backlight.brightness_max' within pwm_backlight_parse_dt().

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-15 08:07:14 +02:00
iw3gtf@arcor.de 87c6a88f2a video/backlight-pwm: fix the value of 'brightness_max'.
The field pwm_backlight->backlight.brightness_max should be the maximum
allowed brightness value for the backlight, not the max index of the
array 'pwm_backlight->levels[]'.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-15 08:07:14 +02:00
iw3gtf@arcor.de c27b1a93ce video/backlight-pwm: fixed a loop index going out of range.
In the function pwm_backlight_parse_dt() the last iteration of the for
loop accessed memory past the end of the array 'pwm_backlight->levels[]'
because of a wrong test ( '<=' instead of '<').

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-15 08:07:14 +02:00
Sascha Hauer 42c797b091 video: pwm-backlight: Honour discrete brightness levels from dt
If probed from device tree we have an array of pwm duty cycle levels
in the brightness-levels property. Although the driver parsed the property,
the values have been ignored. Make use of these flags so that the driver
can work for example with inverted PWMs.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-23 09:46:27 +01:00
Sascha Hauer 65894735e6 video: backlight-pwm: Add regulator support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-01 08:26:08 +02:00
Sascha Hauer 7bc30c8276 video: backlight-pwm: Add error message
Inform the user when we can't find a pwm for the backlight driver.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-01 08:26:07 +02:00
Sascha Hauer 3149ad20e7 video: Add PWM backlight support
This adds a backlight driver for backlights controlled by a PWM.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-12 12:00:41 +02:00