From: Johan Hovold <hidden> Date: 2013-10-23 09:56:03
Clean up probe error handling by checking parameters before any
allocations and removing an obsolete error label. Also remove
unnecessary reset of private gpio number.
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 31 ++++++++++++-------------------
1 file changed, 12 insertions(+), 19 deletions(-)
@@ -126,40 +126,33 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)structatmel_pwm_bl*pwmbl;intretval;+pdata=dev_get_platdata(&pdev->dev);+if(!pdata)+return-ENODEV;++if(pdata->pwm_compare_max<pdata->pwm_duty_max||+pdata->pwm_duty_min>pdata->pwm_duty_max||+pdata->pwm_frequency=0)+return-EINVAL;+pwmbl=devm_kzalloc(&pdev->dev,sizeof(structatmel_pwm_bl),GFP_KERNEL);if(!pwmbl)return-ENOMEM;pwmbl->pdev=pdev;--pdata=dev_get_platdata(&pdev->dev);-if(!pdata){-retval=-ENODEV;-gotoerr_free_mem;-}--if(pdata->pwm_compare_max<pdata->pwm_duty_max||-pdata->pwm_duty_min>pdata->pwm_duty_max||-pdata->pwm_frequency=0){-retval=-EINVAL;-gotoerr_free_mem;-}-pwmbl->pdata=pdata;pwmbl->gpio_on=pdata->gpio_on;retval=pwm_channel_alloc(pdata->pwm_channel,&pwmbl->pwmc);if(retval)-gotoerr_free_mem;+returnretval;if(pwmbl->gpio_on!=-1){retval=devm_gpio_request(&pdev->dev,pwmbl->gpio_on,"gpio_atmel_pwm_bl");-if(retval){-pwmbl->gpio_on=-1;+if(retval)gotoerr_free_pwm;-}/* Turn display off by default. */retval=gpio_direction_output(pwmbl->gpio_on,
@@ -197,7 +190,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)err_free_pwm:pwm_channel_free(&pwmbl->pwmc);-err_free_mem:+returnretval;}
Clean up probe error handling by checking parameters before any
allocations and removing an obsolete error label. Also remove
unnecessary reset of private gpio number.
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 31 ++++++++++++-------------------
1 file changed, 12 insertions(+), 19 deletions(-)
From: Johan Hovold <hidden> Date: 2013-10-29 13:09:41
On Fri, Oct 25, 2013 at 01:11:25PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
On 11:55 Wed 23 Oct , Johan Hovold wrote:
quoted
Clean up probe error handling by checking parameters before any
allocations and removing an obsolete error label. Also remove
unnecessary reset of private gpio number.
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 31 ++++++++++++-------------------
1 file changed, 12 insertions(+), 19 deletions(-)
From: Johan Hovold <hidden> Date: 2013-10-23 09:56:08
Use gpio_is_valid rather than open coding the more restrictive != -1
test.
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
From: Johan Hovold <hidden> Date: 2013-10-23 09:56:10
The driver supports 16-bit brightness values, but the value returned
from get_brightness was truncated to eight bits.
Cc: stable@vger.kernel.org
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
The driver supports 16-bit brightness values, but the value returned
from get_brightness was truncated to eight bits.
Cc: stable@vger.kernel.org
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Johan Hovold <hidden> Date: 2013-10-29 13:32:13
On Fri, Oct 25, 2013 at 01:08:36PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
On 11:55 Wed 23 Oct , Johan Hovold wrote:
quoted
The driver supports 16-bit brightness values, but the value returned
from get_brightness was truncated to eight bits.
Cc: stable@vger.kernel.org
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Johan Hovold <hidden> Date: 2013-10-23 09:57:46
Add helper function to control the gpio_on signal.
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
From: Johan Hovold <hidden> Date: 2013-10-23 09:58:19
Use devm_gpio_request_one rather than requesting and setting direction
in two calls.
Acked-by: Jingoo Han <redacted>:w
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
@@ -124,6 +124,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)conststructatmel_pwm_bl_platform_data*pdata;structbacklight_device*bldev;structatmel_pwm_bl*pwmbl;+intflags;intretval;pdata=dev_get_platdata(&pdev->dev);
@@ -149,14 +150,14 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)returnretval;if(gpio_is_valid(pwmbl->gpio_on)){-retval=devm_gpio_request(&pdev->dev,pwmbl->gpio_on,-"gpio_atmel_pwm_bl");-if(retval)-gotoerr_free_pwm;-/* Turn display off by default. */-retval=gpio_direction_output(pwmbl->gpio_on,-0^pdata->on_active_low);+if(pdata->on_active_low)+flags=GPIOF_OUT_INIT_HIGH;+else+flags=GPIOF_OUT_INIT_LOW;++retval=devm_gpio_request_one(&pdev->dev,pwmbl->gpio_on,+flags,"gpio_atmel_pwm_bl");if(retval)gotoerr_free_pwm;}
Use devm_gpio_request_one rather than requesting and setting direction
in two calls.
this is the same I do not see any advantage
and as I said for ather backligth It's wrong to enable or disable it at probe
as the bootloader might have already enable it for splash screen
Best Regards,
J.
quoted hunk
Acked-by: Jingoo Han <redacted>:w
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
@@ -124,6 +124,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)conststructatmel_pwm_bl_platform_data*pdata;structbacklight_device*bldev;structatmel_pwm_bl*pwmbl;+intflags;intretval;pdata=dev_get_platdata(&pdev->dev);
@@ -149,14 +150,14 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)returnretval;if(gpio_is_valid(pwmbl->gpio_on)){-retval=devm_gpio_request(&pdev->dev,pwmbl->gpio_on,-"gpio_atmel_pwm_bl");-if(retval)-gotoerr_free_pwm;-/* Turn display off by default. */-retval=gpio_direction_output(pwmbl->gpio_on,-0^pdata->on_active_low);+if(pdata->on_active_low)+flags=GPIOF_OUT_INIT_HIGH;+else+flags=GPIOF_OUT_INIT_LOW;++retval=devm_gpio_request_one(&pdev->dev,pwmbl->gpio_on,+flags,"gpio_atmel_pwm_bl");if(retval)gotoerr_free_pwm;}
From: Johan Hovold <hidden> Date: 2013-10-29 13:20:28
On Fri, Oct 25, 2013 at 01:15:43PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
On 11:55 Wed 23 Oct , Johan Hovold wrote:
quoted
Use devm_gpio_request_one rather than requesting and setting direction
in two calls.
this is the same I do not see any advantage
It removes one error path.
and as I said for ather backligth It's wrong to enable or disable it at probe
as the bootloader might have already enable it for splash screen
I agree with you on that, and it's actually the reason for the below
clean up. I use a second patch:
if (gpio_is_valid(pwmbl->gpio_on)) {
- /* Turn display off by default. */
- if (pdata->on_active_low)
+ /* Turn display off unless already enabled. */
+ if (pdata->gpio_on_enabled ^ pdata->on_active_low)
flags = GPIOF_OUT_INIT_HIGH;
else
flags = GPIOF_OUT_INIT_LOW;
to make sure the driver does not temporarily disable the backlight at
probe.
Decided not to submit it as part of this series when I realised that
several other backlight drivers did the same, but perhaps I should?
Thanks,
Johan
quoted
Acked-by: Jingoo Han <redacted>:w
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
@@ -124,6 +124,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)conststructatmel_pwm_bl_platform_data*pdata;structbacklight_device*bldev;structatmel_pwm_bl*pwmbl;+intflags;intretval;pdata=dev_get_platdata(&pdev->dev);
@@ -149,14 +150,14 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)returnretval;if(gpio_is_valid(pwmbl->gpio_on)){-retval=devm_gpio_request(&pdev->dev,pwmbl->gpio_on,-"gpio_atmel_pwm_bl");-if(retval)-gotoerr_free_pwm;-/* Turn display off by default. */-retval=gpio_direction_output(pwmbl->gpio_on,-0^pdata->on_active_low);+if(pdata->on_active_low)+flags=GPIOF_OUT_INIT_HIGH;+else+flags=GPIOF_OUT_INIT_LOW;++retval=devm_gpio_request_one(&pdev->dev,pwmbl->gpio_on,+flags,"gpio_atmel_pwm_bl");if(retval)gotoerr_free_pwm;}
On Fri, Oct 25, 2013 at 01:15:43PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
quoted
On 11:55 Wed 23 Oct , Johan Hovold wrote:
quoted
Use devm_gpio_request_one rather than requesting and setting direction
in two calls.
this is the same I do not see any advantage
It removes one error path.
quoted
and as I said for ather backligth It's wrong to enable or disable it at probe
as the bootloader might have already enable it for splash screen
I agree with you on that, and it's actually the reason for the below
clean up. I use a second patch:
if (gpio_is_valid(pwmbl->gpio_on)) {
- /* Turn display off by default. */
- if (pdata->on_active_low)
+ /* Turn display off unless already enabled. */
+ if (pdata->gpio_on_enabled ^ pdata->on_active_low)
flags = GPIOF_OUT_INIT_HIGH;
else
flags = GPIOF_OUT_INIT_LOW;
to make sure the driver does not temporarily disable the backlight at
probe.
Decided not to submit it as part of this series when I realised that
several other backlight drivers did the same, but perhaps I should?
I'm not happy with this idea to play with enable at probe time
we need to detect the current status if possible and only enable or disable
when requiered
Best Regards,
J.
Thanks,
Johan
quoted
quoted
Acked-by: Jingoo Han <redacted>:w
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
@@ -124,6 +124,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)conststructatmel_pwm_bl_platform_data*pdata;structbacklight_device*bldev;structatmel_pwm_bl*pwmbl;+intflags;intretval;pdata=dev_get_platdata(&pdev->dev);
@@ -149,14 +150,14 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)returnretval;if(gpio_is_valid(pwmbl->gpio_on)){-retval=devm_gpio_request(&pdev->dev,pwmbl->gpio_on,-"gpio_atmel_pwm_bl");-if(retval)-gotoerr_free_pwm;-/* Turn display off by default. */-retval=gpio_direction_output(pwmbl->gpio_on,-0^pdata->on_active_low);+if(pdata->on_active_low)+flags=GPIOF_OUT_INIT_HIGH;+else+flags=GPIOF_OUT_INIT_LOW;++retval=devm_gpio_request_one(&pdev->dev,pwmbl->gpio_on,+flags,"gpio_atmel_pwm_bl");if(retval)gotoerr_free_pwm;}
From: Johan Hovold <hidden> Date: 2013-10-23 09:59:03
Make sure to honour gpio polarity also at remove so that the backlight
is actually disabled on boards with active-low enable pin.
Cc: stable@vger.kernel.org
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Make sure to honour gpio polarity also at remove so that the backlight
is actually disabled on boards with active-low enable pin.
Cc: stable@vger.kernel.org
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
From: Johan Hovold <hidden> Date: 2013-10-29 13:08:20
On Fri, Oct 25, 2013 at 01:09:28PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
On 11:55 Wed 23 Oct , Johan Hovold wrote:
quoted
Make sure to honour gpio polarity also at remove so that the backlight
is actually disabled on boards with active-low enable pin.
Cc: stable@vger.kernel.org
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
From: Johan Hovold <hidden> Date: 2013-10-23 09:59:26
Add missing module alias which is needed for module autoloading.
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 1 +
1 file changed, 1 insertion(+)
From: Johan Hovold <hidden> Date: 2013-10-29 16:28:15
These patches fix a few issues and clean up the atmel-pwm-bl driver
somewhat.
Acks from Jingoo Han retained on all patches but the slightly modified
first patch.
Johan
v2:
- mask returned brightness rather than cast it to u16 (patch 1/9)
Johan Hovold (9):
backlight: atmel-pwm-bl: fix reported brightness
backlight: atmel-pwm-bl: fix gpio polarity in remove
backlight: atmel-pwm-bl: fix module autoload
backlight: atmel-pwm-bl: clean up probe error handling
backlight: atmel-pwm-bl: clean up get_intensity
backlight: atmel-pwm-bl: remove unused include
backlight: atmel-pwm-bl: use gpio_is_valid
backlight: atmel-pwm-bl: refactor gpio_on handling
backlight: atmel-pwm-bl: use gpio_request_one
drivers/video/backlight/atmel-pwm-bl.c | 86 ++++++++++++++++------------------
1 file changed, 40 insertions(+), 46 deletions(-)
--
1.8.4.2
From: Johan Hovold <hidden> Date: 2013-10-29 16:28:17
Add missing module alias which is needed for module autoloading.
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 1 +
1 file changed, 1 insertion(+)
From: Johan Hovold <hidden> Date: 2013-10-29 16:28:22
Make sure to honour gpio polarity also at remove so that the backlight
is actually disabled on boards with active-low enable pin.
Cc: stable@vger.kernel.org
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
From: Johan Hovold <hidden> Date: 2013-10-29 16:29:32
Use devm_gpio_request_one rather than requesting and setting direction
in two calls.
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
@@ -124,6 +124,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)conststructatmel_pwm_bl_platform_data*pdata;structbacklight_device*bldev;structatmel_pwm_bl*pwmbl;+intflags;intretval;pdata=dev_get_platdata(&pdev->dev);
@@ -149,14 +150,14 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)returnretval;if(gpio_is_valid(pwmbl->gpio_on)){-retval=devm_gpio_request(&pdev->dev,pwmbl->gpio_on,-"gpio_atmel_pwm_bl");-if(retval)-gotoerr_free_pwm;-/* Turn display off by default. */-retval=gpio_direction_output(pwmbl->gpio_on,-0^pdata->on_active_low);+if(pdata->on_active_low)+flags=GPIOF_OUT_INIT_HIGH;+else+flags=GPIOF_OUT_INIT_LOW;++retval=devm_gpio_request_one(&pdev->dev,pwmbl->gpio_on,+flags,"gpio_atmel_pwm_bl");if(retval)gotoerr_free_pwm;}
From: Johan Hovold <hidden> Date: 2013-10-29 16:29:34
Add helper function to control the gpio_on signal.
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
From: Johan Hovold <hidden> Date: 2013-10-29 16:30:01
Use gpio_is_valid rather than open coding the more restrictive != -1
test.
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
From: Johan Hovold <hidden> Date: 2013-10-29 16:30:04
Clean up probe error handling by checking parameters before any
allocations and removing an obsolete error label. Also remove
unnecessary reset of private gpio number.
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 31 ++++++++++++-------------------
1 file changed, 12 insertions(+), 19 deletions(-)
@@ -126,40 +126,33 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)structatmel_pwm_bl*pwmbl;intretval;+pdata=dev_get_platdata(&pdev->dev);+if(!pdata)+return-ENODEV;++if(pdata->pwm_compare_max<pdata->pwm_duty_max||+pdata->pwm_duty_min>pdata->pwm_duty_max||+pdata->pwm_frequency=0)+return-EINVAL;+pwmbl=devm_kzalloc(&pdev->dev,sizeof(structatmel_pwm_bl),GFP_KERNEL);if(!pwmbl)return-ENOMEM;pwmbl->pdev=pdev;--pdata=dev_get_platdata(&pdev->dev);-if(!pdata){-retval=-ENODEV;-gotoerr_free_mem;-}--if(pdata->pwm_compare_max<pdata->pwm_duty_max||-pdata->pwm_duty_min>pdata->pwm_duty_max||-pdata->pwm_frequency=0){-retval=-EINVAL;-gotoerr_free_mem;-}-pwmbl->pdata=pdata;pwmbl->gpio_on=pdata->gpio_on;retval=pwm_channel_alloc(pdata->pwm_channel,&pwmbl->pwmc);if(retval)-gotoerr_free_mem;+returnretval;if(pwmbl->gpio_on!=-1){retval=devm_gpio_request(&pdev->dev,pwmbl->gpio_on,"gpio_atmel_pwm_bl");-if(retval){-pwmbl->gpio_on=-1;+if(retval)gotoerr_free_pwm;-}/* Turn display off by default. */retval=gpio_direction_output(pwmbl->gpio_on,
@@ -197,7 +190,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)err_free_pwm:pwm_channel_free(&pwmbl->pwmc);-err_free_mem:+returnretval;}
From: Johan Hovold <hidden> Date: 2013-10-29 16:30:06
The driver supports 16-bit brightness values, but the value returned
from get_brightness was truncated to eight bits.
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Johan Hovold <hidden> Date: 2013-10-31 17:59:30
These patches fix a few issues and clean up the atmel-pwm-bl driver
somewhat.
Acks from Jingoo Han retained on all patches but the slightly modified
first and final patch.
Johan
v2:
- mask returned brightness rather than cast it to u16 (patch 1/9)
v3
- use unsigned long for gpio flags (patch 9/9)
Johan Hovold (9):
backlight: atmel-pwm-bl: fix reported brightness
backlight: atmel-pwm-bl: fix gpio polarity in remove
backlight: atmel-pwm-bl: fix module autoload
backlight: atmel-pwm-bl: clean up probe error handling
backlight: atmel-pwm-bl: clean up get_intensity
backlight: atmel-pwm-bl: remove unused include
backlight: atmel-pwm-bl: use gpio_is_valid
backlight: atmel-pwm-bl: refactor gpio_on handling
backlight: atmel-pwm-bl: use gpio_request_one
drivers/video/backlight/atmel-pwm-bl.c | 86 ++++++++++++++++------------------
1 file changed, 40 insertions(+), 46 deletions(-)
--
1.8.4.2
From: Johan Hovold <hidden> Date: 2013-10-31 17:58:22
Add missing module alias which is needed for module autoloading.
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 1 +
1 file changed, 1 insertion(+)
From: Johan Hovold <hidden> Date: 2013-10-31 17:58:23
Clean up probe error handling by checking parameters before any
allocations and removing an obsolete error label. Also remove
unnecessary reset of private gpio number.
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 31 ++++++++++++-------------------
1 file changed, 12 insertions(+), 19 deletions(-)
@@ -126,40 +126,33 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)structatmel_pwm_bl*pwmbl;intretval;+pdata=dev_get_platdata(&pdev->dev);+if(!pdata)+return-ENODEV;++if(pdata->pwm_compare_max<pdata->pwm_duty_max||+pdata->pwm_duty_min>pdata->pwm_duty_max||+pdata->pwm_frequency=0)+return-EINVAL;+pwmbl=devm_kzalloc(&pdev->dev,sizeof(structatmel_pwm_bl),GFP_KERNEL);if(!pwmbl)return-ENOMEM;pwmbl->pdev=pdev;--pdata=dev_get_platdata(&pdev->dev);-if(!pdata){-retval=-ENODEV;-gotoerr_free_mem;-}--if(pdata->pwm_compare_max<pdata->pwm_duty_max||-pdata->pwm_duty_min>pdata->pwm_duty_max||-pdata->pwm_frequency=0){-retval=-EINVAL;-gotoerr_free_mem;-}-pwmbl->pdata=pdata;pwmbl->gpio_on=pdata->gpio_on;retval=pwm_channel_alloc(pdata->pwm_channel,&pwmbl->pwmc);if(retval)-gotoerr_free_mem;+returnretval;if(pwmbl->gpio_on!=-1){retval=devm_gpio_request(&pdev->dev,pwmbl->gpio_on,"gpio_atmel_pwm_bl");-if(retval){-pwmbl->gpio_on=-1;+if(retval)gotoerr_free_pwm;-}/* Turn display off by default. */retval=gpio_direction_output(pwmbl->gpio_on,
@@ -197,7 +190,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)err_free_pwm:pwm_channel_free(&pwmbl->pwmc);-err_free_mem:+returnretval;}
From: Johan Hovold <hidden> Date: 2013-10-31 17:58:25
The driver supports 16-bit brightness values, but the value returned
from get_brightness was truncated to eight bits.
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Johan Hovold <hidden> Date: 2013-10-31 17:58:27
Make sure to honour gpio polarity also at remove so that the backlight
is actually disabled on boards with active-low enable pin.
Cc: stable@vger.kernel.org
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
From: Johan Hovold <hidden> Date: 2013-10-31 17:58:29
Use devm_gpio_request_one rather than requesting and setting direction
in two calls.
Cc: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
@@ -124,6 +124,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)conststructatmel_pwm_bl_platform_data*pdata;structbacklight_device*bldev;structatmel_pwm_bl*pwmbl;+unsignedlongflags;intretval;pdata=dev_get_platdata(&pdev->dev);
@@ -149,14 +150,14 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)returnretval;if(gpio_is_valid(pwmbl->gpio_on)){-retval=devm_gpio_request(&pdev->dev,pwmbl->gpio_on,-"gpio_atmel_pwm_bl");-if(retval)-gotoerr_free_pwm;-/* Turn display off by default. */-retval=gpio_direction_output(pwmbl->gpio_on,-0^pdata->on_active_low);+if(pdata->on_active_low)+flags=GPIOF_OUT_INIT_HIGH;+else+flags=GPIOF_OUT_INIT_LOW;++retval=devm_gpio_request_one(&pdev->dev,pwmbl->gpio_on,+flags,"gpio_atmel_pwm_bl");if(retval)gotoerr_free_pwm;}
From: Johan Hovold <hidden> Date: 2013-10-31 17:59:46
Add helper function to control the gpio_on signal.
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
From: Johan Hovold <hidden> Date: 2013-10-31 18:00:38
Use gpio_is_valid rather than open coding the more restrictive != -1
test.
Acked-by: Jingoo Han <redacted>
Signed-off-by: Johan Hovold <redacted>
---
drivers/video/backlight/atmel-pwm-bl.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)