Re: [PATCH 1/4] pwm_backlight: Fix PWM levels support in non DT case

From
Peter Ujfalusi <hidden>
Date
2013-01-29 08:17:41
Also in
linux-devicetree, lkml
Reply to
Thierry Reding, 2013-01-28
On 01/28/2013 10:01 PM, Thierry Reding wrote:
On Tue, Jan 22, 2013 at 02:39:53PM +0100, Peter Ujfalusi wrote:
quoted
It is expected that board files would have:
static unsigned int bl_levels[] = { 0, 50, 100, 150, 200, 250, };

static struct platform_pwm_backlight_data bl_data = {
	.levels = bl_levels,
	.max_brightness = ARRAY_SIZE(bl_levels),
	.dft_brightness = 4,
	.pwm_period_ns = 7812500,
};

In this case the max_brightness would be out of range in the levels array.
Decrement the received max_brightness in every case (DT or non DT) when the
levels has been provided.
What's wrong with specifying .max_brightness = ARRAY_SIZE(bl_levels) - 1
instead?
There is nothing wrong with that either but IMHO it is more natural for board
files to use just ARRAY_SIZE(bl_levels). In this way the handling of
data->max_brightness among non DT and DT booted kernel is more uniform in the
driver itself.
Right now all board files are using only the .max_brightness to specify the
maximum value, I could not find any users of .levels in the kernel.

-- 
Péter
Thread (14 messages) 14 messages, 2 authors, last reply 2013-01-31
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help