* [PATCH] backlight: add low threshold to pwm backlight
@ 2010-09-09 11:29 Arun Murthy
2010-09-14 7:05 ` Arun MURTHY
0 siblings, 1 reply; 4+ messages in thread
From: Arun Murthy @ 2010-09-09 11:29 UTC (permalink / raw)
To: rpurdie, linux, ben, tj
Cc: linux-kernel, STEricsson_nomadik_linux, arun.murthy
The intensity of the backlight can be varied from a range of
max_brightness to zero. Though most, if not all the pwm based backlight
devices start flickering at lower brightness value. And also for each
device there exists a brightness value below which the backlight appears
to be turned off though the value is not equal to zero.
If the range of brightness for a device is from zero to
max_brightness. A graph is plotted for brightness Vs intensity fo the
pwm based backlight device has to be a linear graph.
intensity
| /
| /
| /
|/
---------
0 max_brightness
But pratically on measuring the above we note that the intensity of
backlight goes to zero(OFF) when the value in not zero almost nearing to
zero(some x%). so the graph looks like
intensity
| /
| /
| /
| |
------------
0 x max_brightness
In order to overcome this drawback knowing this x% i.e nothing but the
low threshold beyond which the backlight is off and will have no effect,
the brightness value is being offset by the low threshold
value(retaining the linearity of the graph). Now the graph becomes
intensity
| /
| /
| /
| /
-------------
0 max_brightness
With this for each and every digit increment in the brightness from zero
there is a change in the intensity of backlight.
Devices having this behaviour can set the low threshold
brightness(lth_brightness) and pass the same as platform data else can
have it as zero.
Signed-off-by: Arun Murthy <arun.murthy@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
---
drivers/video/backlight/pwm_bl.c | 7 ++++++-
include/linux/pwm_backlight.h | 1 +
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 5504435..1f958ce 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -25,6 +25,7 @@ struct pwm_bl_data {
struct pwm_device *pwm;
struct device *dev;
unsigned int period;
+ unsigned int lth_brightness;
int (*notify)(struct device *,
int brightness);
};
@@ -48,7 +49,9 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
pwm_config(pb->pwm, 0, pb->period);
pwm_disable(pb->pwm);
} else {
- pwm_config(pb->pwm, brightness * pb->period / max, pb->period);
+ brightness = pb->lth_brightness +
+ (brightness * (pb->period - pb->lth_brightness)/ max);
+ pwm_config(pb->pwm, brightness, pb->period);
pwm_enable(pb->pwm);
}
return 0;
@@ -92,6 +95,8 @@ static int pwm_backlight_probe(struct platform_device *pdev)
pb->period = data->pwm_period_ns;
pb->notify = data->notify;
+ pb->lth_brightness = data->lth_brightness *
+ (data->pwm_period_ns / data->max_brightness);
pb->dev = &pdev->dev;
pb->pwm = pwm_request(data->pwm_id, "backlight");
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h
index 01b3d75..e031e1a 100644
--- a/include/linux/pwm_backlight.h
+++ b/include/linux/pwm_backlight.h
@@ -8,6 +8,7 @@ struct platform_pwm_backlight_data {
int pwm_id;
unsigned int max_brightness;
unsigned int dft_brightness;
+ unsigned int lth_brightness;
unsigned int pwm_period_ns;
int (*init)(struct device *dev);
int (*notify)(struct device *dev, int brightness);
--
1.7.2.dirty
^ permalink raw reply [flat|nested] 4+ messages in thread* RE: [PATCH] backlight: add low threshold to pwm backlight
2010-09-09 11:29 [PATCH] backlight: add low threshold to pwm backlight Arun Murthy
@ 2010-09-14 7:05 ` Arun MURTHY
2010-09-28 7:37 ` Arun MURTHY
0 siblings, 1 reply; 4+ messages in thread
From: Arun MURTHY @ 2010-09-14 7:05 UTC (permalink / raw)
To: Arun MURTHY, rpurdie, linux, ben, tj
Cc: linux-kernel, STEricsson_nomadik_linux
Any comments?
> -----Original Message-----
> From: Arun MURTHY
> Sent: Thursday, September 09, 2010 5:00 PM
> To: rpurdie@rpsys.net; linux@simtec.co.uk; ben@simtec.co.uk;
> tj@kernel.org
> Cc: linux-kernel@vger.kernel.org; STEricsson_nomadik_linux; Arun MURTHY
> Subject: [PATCH] backlight: add low threshold to pwm backlight
>
> The intensity of the backlight can be varied from a range of
> max_brightness to zero. Though most, if not all the pwm based backlight
> devices start flickering at lower brightness value. And also for each
> device there exists a brightness value below which the backlight
> appears
> to be turned off though the value is not equal to zero.
>
> If the range of brightness for a device is from zero to
> max_brightness. A graph is plotted for brightness Vs intensity fo the
> pwm based backlight device has to be a linear graph.
>
> intensity
> | /
> | /
> | /
> |/
> ---------
> 0 max_brightness
> But pratically on measuring the above we note that the intensity of
> backlight goes to zero(OFF) when the value in not zero almost nearing
> to
> zero(some x%). so the graph looks like
>
> intensity
> | /
> | /
> | /
> | |
> ------------
> 0 x max_brightness
>
> In order to overcome this drawback knowing this x% i.e nothing but the
> low threshold beyond which the backlight is off and will have no
> effect,
> the brightness value is being offset by the low threshold
> value(retaining the linearity of the graph). Now the graph becomes
>
> intensity
> | /
> | /
> | /
> | /
> -------------
> 0 max_brightness
> With this for each and every digit increment in the brightness from
> zero
> there is a change in the intensity of backlight.
> Devices having this behaviour can set the low threshold
> brightness(lth_brightness) and pass the same as platform data else can
> have it as zero.
>
> Signed-off-by: Arun Murthy <arun.murthy@stericsson.com>
> Acked-by: Linus Walleij <linus.walleij@stericsson.com>
> ---
> drivers/video/backlight/pwm_bl.c | 7 ++++++-
> include/linux/pwm_backlight.h | 1 +
> 2 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/video/backlight/pwm_bl.c
> b/drivers/video/backlight/pwm_bl.c
> index 5504435..1f958ce 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -25,6 +25,7 @@ struct pwm_bl_data {
> struct pwm_device *pwm;
> struct device *dev;
> unsigned int period;
> + unsigned int lth_brightness;
> int (*notify)(struct device *,
> int brightness);
> };
> @@ -48,7 +49,9 @@ static int pwm_backlight_update_status(struct
> backlight_device *bl)
> pwm_config(pb->pwm, 0, pb->period);
> pwm_disable(pb->pwm);
> } else {
> - pwm_config(pb->pwm, brightness * pb->period / max, pb-
> >period);
> + brightness = pb->lth_brightness +
> + (brightness * (pb->period - pb->lth_brightness)/
> max);
> + pwm_config(pb->pwm, brightness, pb->period);
> pwm_enable(pb->pwm);
> }
> return 0;
> @@ -92,6 +95,8 @@ static int pwm_backlight_probe(struct platform_device
> *pdev)
>
> pb->period = data->pwm_period_ns;
> pb->notify = data->notify;
> + pb->lth_brightness = data->lth_brightness *
> + (data->pwm_period_ns / data->max_brightness);
> pb->dev = &pdev->dev;
>
> pb->pwm = pwm_request(data->pwm_id, "backlight");
> diff --git a/include/linux/pwm_backlight.h
> b/include/linux/pwm_backlight.h
> index 01b3d75..e031e1a 100644
> --- a/include/linux/pwm_backlight.h
> +++ b/include/linux/pwm_backlight.h
> @@ -8,6 +8,7 @@ struct platform_pwm_backlight_data {
> int pwm_id;
> unsigned int max_brightness;
> unsigned int dft_brightness;
> + unsigned int lth_brightness;
> unsigned int pwm_period_ns;
> int (*init)(struct device *dev);
> int (*notify)(struct device *dev, int brightness);
> --
> 1.7.2.dirty
^ permalink raw reply [flat|nested] 4+ messages in thread* RE: [PATCH] backlight: add low threshold to pwm backlight
2010-09-14 7:05 ` Arun MURTHY
@ 2010-09-28 7:37 ` Arun MURTHY
2010-09-28 20:47 ` Linus Walleij
0 siblings, 1 reply; 4+ messages in thread
From: Arun MURTHY @ 2010-09-28 7:37 UTC (permalink / raw)
To: rpurdie, linux, ben, tj; +Cc: linux-kernel, Arun MURTHY, Linus WALLEIJ, akpm
If there are no comments, can you please pick this patch?
Thanks and Regards,
Arun R Murthy
-------------
> -----Original Message-----
> From: Arun MURTHY
> Sent: Tuesday, September 14, 2010 12:36 PM
> To: Arun MURTHY; rpurdie@rpsys.net; linux@simtec.co.uk;
> ben@simtec.co.uk; tj@kernel.org
> Cc: linux-kernel@vger.kernel.org; STEricsson_nomadik_linux
> Subject: RE: [PATCH] backlight: add low threshold to pwm backlight
>
> Any comments?
>
> > -----Original Message-----
> > From: Arun MURTHY
> > Sent: Thursday, September 09, 2010 5:00 PM
> > To: rpurdie@rpsys.net; linux@simtec.co.uk; ben@simtec.co.uk;
> > tj@kernel.org
> > Cc: linux-kernel@vger.kernel.org; STEricsson_nomadik_linux; Arun
> MURTHY
> > Subject: [PATCH] backlight: add low threshold to pwm backlight
> >
> > The intensity of the backlight can be varied from a range of
> > max_brightness to zero. Though most, if not all the pwm based
> backlight
> > devices start flickering at lower brightness value. And also for each
> > device there exists a brightness value below which the backlight
> > appears
> > to be turned off though the value is not equal to zero.
> >
> > If the range of brightness for a device is from zero to
> > max_brightness. A graph is plotted for brightness Vs intensity fo the
> > pwm based backlight device has to be a linear graph.
> >
> > intensity
> > | /
> > | /
> > | /
> > |/
> > ---------
> > 0 max_brightness
> > But pratically on measuring the above we note that the intensity of
> > backlight goes to zero(OFF) when the value in not zero almost nearing
> > to
> > zero(some x%). so the graph looks like
> >
> > intensity
> > | /
> > | /
> > | /
> > | |
> > ------------
> > 0 x max_brightness
> >
> > In order to overcome this drawback knowing this x% i.e nothing but
> the
> > low threshold beyond which the backlight is off and will have no
> > effect,
> > the brightness value is being offset by the low threshold
> > value(retaining the linearity of the graph). Now the graph becomes
> >
> > intensity
> > | /
> > | /
> > | /
> > | /
> > -------------
> > 0 max_brightness
> > With this for each and every digit increment in the brightness from
> > zero
> > there is a change in the intensity of backlight.
> > Devices having this behaviour can set the low threshold
> > brightness(lth_brightness) and pass the same as platform data else
> can
> > have it as zero.
> >
> > Signed-off-by: Arun Murthy <arun.murthy@stericsson.com>
> > Acked-by: Linus Walleij <linus.walleij@stericsson.com>
> > ---
> > drivers/video/backlight/pwm_bl.c | 7 ++++++-
> > include/linux/pwm_backlight.h | 1 +
> > 2 files changed, 7 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/video/backlight/pwm_bl.c
> > b/drivers/video/backlight/pwm_bl.c
> > index 5504435..1f958ce 100644
> > --- a/drivers/video/backlight/pwm_bl.c
> > +++ b/drivers/video/backlight/pwm_bl.c
> > @@ -25,6 +25,7 @@ struct pwm_bl_data {
> > struct pwm_device *pwm;
> > struct device *dev;
> > unsigned int period;
> > + unsigned int lth_brightness;
> > int (*notify)(struct device *,
> > int brightness);
> > };
> > @@ -48,7 +49,9 @@ static int pwm_backlight_update_status(struct
> > backlight_device *bl)
> > pwm_config(pb->pwm, 0, pb->period);
> > pwm_disable(pb->pwm);
> > } else {
> > - pwm_config(pb->pwm, brightness * pb->period / max, pb-
> > >period);
> > + brightness = pb->lth_brightness +
> > + (brightness * (pb->period - pb->lth_brightness)/
> > max);
> > + pwm_config(pb->pwm, brightness, pb->period);
> > pwm_enable(pb->pwm);
> > }
> > return 0;
> > @@ -92,6 +95,8 @@ static int pwm_backlight_probe(struct
> platform_device
> > *pdev)
> >
> > pb->period = data->pwm_period_ns;
> > pb->notify = data->notify;
> > + pb->lth_brightness = data->lth_brightness *
> > + (data->pwm_period_ns / data->max_brightness);
> > pb->dev = &pdev->dev;
> >
> > pb->pwm = pwm_request(data->pwm_id, "backlight");
> > diff --git a/include/linux/pwm_backlight.h
> > b/include/linux/pwm_backlight.h
> > index 01b3d75..e031e1a 100644
> > --- a/include/linux/pwm_backlight.h
> > +++ b/include/linux/pwm_backlight.h
> > @@ -8,6 +8,7 @@ struct platform_pwm_backlight_data {
> > int pwm_id;
> > unsigned int max_brightness;
> > unsigned int dft_brightness;
> > + unsigned int lth_brightness;
> > unsigned int pwm_period_ns;
> > int (*init)(struct device *dev);
> > int (*notify)(struct device *dev, int brightness);
> > --
> > 1.7.2.dirty
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] backlight: add low threshold to pwm backlight
2010-09-28 7:37 ` Arun MURTHY
@ 2010-09-28 20:47 ` Linus Walleij
0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2010-09-28 20:47 UTC (permalink / raw)
To: Arun MURTHY, akpm; +Cc: rpurdie, linux, ben, tj, linux-kernel
2010/9/28 Arun MURTHY <arun.murthy@stericsson.com>:
> If there are no comments, can you please pick this patch?
Hm, no Sign-offs or mails to be seen from Purdie since
May or June... :-(
Andrew would you mind queuing this one too in his absence?
We have some other backlight related stuff making rounds at
the moment and when I just search the archive for "purdie" there
seems to be a pile of stuff pending for Leds/Backlight actually.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-09-28 20:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-09 11:29 [PATCH] backlight: add low threshold to pwm backlight Arun Murthy
2010-09-14 7:05 ` Arun MURTHY
2010-09-28 7:37 ` Arun MURTHY
2010-09-28 20:47 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®