backlight: atmel-pwm-bl: fixes and clean ups
Subsystems (4)
cover backlight: atmel-pwm-bl: fixes and clean ups
These patches fix a few issues and clean up the atmel-pwm-bl driver somewhat.
Johan
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(-)
Signature · 1 line
1.8.4
PATCH 1/9 backlight: atmel-pwm-bl: fix reported brightness
The driver supports 16-bit brightness values, but the value returned from get_brightness was truncated to eight bits.
--- drivers/video/backlight/atmel-pwm-bl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/backlight/atmel-pwm-bl.c +2 -2
@@ -70,7 +70,7 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd)static int atmel_pwm_bl_get_intensity (struct backlight_device *bd) {struct atmel_pwm_bl *pwmbl =bl_get_data (bd); -u8 intensity; +u32 intensity;if (pwmbl->pdata->pwm_active_low) { intensity = pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY) -
@@ -80,7 +80,7 @@ static int atmel_pwm_bl_get_intensity(struct backlight_device *bd)pwm_channel_readl (&pwmbl->pwmc,PWM_CDTY ); } -return intensity; +return (u16 )intensity; }static int atmel_pwm_bl_init_pwm (struct atmel_pwm_bl *pwmbl)
Signature · 1 line
1.8.4
Re: [PATCH 1/9] backlight: atmel-pwm-bl: fix reported brightness
Quoted 24 lines · Johan Hovold
The driver supports 16-bit brightness values, but the value returned from
get_brightnesswas truncated to eight bits.Signed-off-by Johan Hovold <[email protected]>--- drivers/video/backlight/atmel-pwm-bl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/video/backlight/atmel-pwm-bl.c +1
-1@@ -70,7 +70,7 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd)static int atmel_pwm_bl_get_intensity (struct backlight_device *bd) {struct atmel_pwm_bl *pwmbl =bl_get_data (bd); -u8 intensity; +u32 intensity;if (pwmbl->pdata->pwm_active_low) { intensity = pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY) -
drivers/video/backlight/atmel-pwm-bl.c static int atmel_pwm_bl_get_intensity(struct backlight_device *bd) · line 83
Quoted 5 lines
drivers/video/backlight/atmel-pwm-bl.c +1
-1@@ -80,7 +80,7 @@ static int atmel_pwm_bl_get_intensity(struct backlight_device *bd)pwm_channel_readl (&pwmbl->pwmc,PWM_CDTY ); } -return intensity; +return (u16 )intensity;
However, atmel_pwm_bl_get_intensity() should return 'int', instead of 'u16'. Also, pwm_channel_readl() returns 'u32'.
Then, how about the following?
drivers/video/backlight/atmel-pwm-bl.c +0 -0
@@ -70,17 +70,17 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd)static int atmel_pwm_bl_get_intensity (struct backlight_device *bd) {
struct atmel_pwm_bl *pwmbl = bl_get_data(bd);
- u8 intensity;
+ u16 intensity;
if (pwmbl->pdata->pwm_active_low) {
- intensity = pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY) -
+ intensity = (u16) pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY) -
pwmbl->pdata->pwm_duty_min;
} else {
- intensity = pwmbl->pdata->pwm_duty_max -
+ intensity = (u16) pwmbl->pdata->pwm_duty_max -
pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY);
}- return intensity;
+ return (int)intensity;
}
Best regards,
Jingoo Han
Re: [PATCH 1/9] backlight: atmel-pwm-bl: fix reported brightness
Quoted 28 lines · Jingoo Han
Quoted 27 lines · Johan Hovold
The driver supports 16-bit brightness values, but the value returned from
get_brightnesswas truncated to eight bits.Signed-off-by Johan Hovold <[email protected]>--- drivers/video/backlight/atmel-pwm-bl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/video/backlight/atmel-pwm-bl.c +1
-1@@ -70,7 +70,7 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd)static int atmel_pwm_bl_get_intensity (struct backlight_device *bd) {struct atmel_pwm_bl *pwmbl =bl_get_data (bd); -u8 intensity; +u32 intensity;if (pwmbl->pdata->pwm_active_low) { intensity = pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY) -@@ -80,7 +80,7 @@ static int atmel_pwm_bl_get_intensity(struct backlight_device *bd)pwm_channel_readl (&pwmbl->pwmc,PWM_CDTY ); }
Quoted 5 lines
drivers/video/backlight/atmel-pwm-bl.c static int atmel_pwm_bl_get_intensity(struct backlight_device *bd) · line 83
Quoted 2 lines
drivers/video/backlight/atmel-pwm-bl.c +1
-1-return intensity; +return (u16 )intensity;However,
atmel_pwm_bl_get_intensity()should return 'int', instead of 'u16'.
Yes, but the cast to int is implicit. Perhaps
return (intensity & 0xffff);
(or just a comment) would make it more clear why the cast is there.
Quoted 1 line
Also,
pwm_channel_readl()returns 'u32'.
Yes, (and only the 16 least-significant bits are used). That and the fact that the platform-data limits are currently unsigned long (I was considering fixing this later) was why I preferred keeping all register value manipulation in u32 and do a single cast at the end.
Quoted 5 lines
Then, how about the following?
drivers/video/backlight/atmel-pwm-bl.c static int atmel_pwm_bl_set_intensity(struct backlight_device *bd) · line 77
Quoted 10 lines
drivers/video/backlight/atmel-pwm-bl.c +2
-2@@ -70,17 +70,17 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd)static int atmel_pwm_bl_get_intensity (struct backlight_device *bd) {struct atmel_pwm_bl *pwmbl =bl_get_data (bd); -u8 intensity; +u16 intensity;if (pwmbl->pdata->pwm_active_low) { - intensity =pwm_channel_readl (&pwmbl->pwmc,PWM_CDTY ) - + intensity = (u16 )pwm_channel_readl (&pwmbl->pwmc,PWM_CDTY ) - pwmbl->pdata->pwm_duty_min;
This would actually introduce a new conversion warning (unless you add parentheses as well) as pwm_duty_min is unsigned long. Same below.
drivers/video/backlight/atmel-pwm-bl.c static int atmel_pwm_bl_set_intensity(struct backlight_device *bd) · line 84
Quoted 9 lines
drivers/video/backlight/atmel-pwm-bl.c +2
-2}else { - intensity = pwmbl->pdata->pwm_duty_max - + intensity = (u16 ) pwmbl->pdata->pwm_duty_max -pwm_channel_readl (&pwmbl->pwmc,PWM_CDTY ); } -return intensity; +return (int )intensity; }
However, if you feel strongly about this, I'll respin the series (a later patch would likely no longer apply), use u16 and add casts to the two assignments.
Thanks,
Johan
Re: [PATCH 1/9] backlight: atmel-pwm-bl: fix reported brightness
Quoted 73 lines · Johan Hovold
Quoted 28 lines · Jingoo Han
Quoted 27 lines · Johan Hovold
The driver supports 16-bit brightness values, but the value returned from
get_brightnesswas truncated to eight bits.Signed-off-by Johan Hovold <[email protected]>--- drivers/video/backlight/atmel-pwm-bl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/video/backlight/atmel-pwm-bl.c +1
-1@@ -70,7 +70,7 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd)static int atmel_pwm_bl_get_intensity (struct backlight_device *bd) {struct atmel_pwm_bl *pwmbl =bl_get_data (bd); -u8 intensity; +u32 intensity;if (pwmbl->pdata->pwm_active_low) { intensity = pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY) -@@ -80,7 +80,7 @@ static int atmel_pwm_bl_get_intensity(struct backlight_device *bd)pwm_channel_readl (&pwmbl->pwmc,PWM_CDTY ); }Quoted 5 lines
drivers/video/backlight/atmel-pwm-bl.c static int atmel_pwm_bl_get_intensity(struct backlight_device *bd) · line 83
Quoted 2 lines
drivers/video/backlight/atmel-pwm-bl.c +1
-1-return intensity; +return (u16 )intensity;However,
atmel_pwm_bl_get_intensity()should return 'int', instead of 'u16'.Yes, but the cast to int is implicit. Perhaps
return (intensity & 0xffff);(or just a comment) would make it more clear why the cast is there.
Quoted 1 line
Also,
pwm_channel_readl()returns 'u32'.Yes, (and only the 16 least-significant bits are used). That and the fact that the platform-data limits are currently unsigned long (I was considering fixing this later) was why I preferred keeping all register value manipulation in u32 and do a single cast at the end.
Quoted 5 lines
Then, how about the following?
drivers/video/backlight/atmel-pwm-bl.c static int atmel_pwm_bl_set_intensity(struct backlight_device *bd) · line 77
Quoted 10 lines
drivers/video/backlight/atmel-pwm-bl.c +2
-2@@ -70,17 +70,17 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd)static int atmel_pwm_bl_get_intensity (struct backlight_device *bd) {struct atmel_pwm_bl *pwmbl =bl_get_data (bd); -u8 intensity; +u16 intensity;if (pwmbl->pdata->pwm_active_low) { - intensity =pwm_channel_readl (&pwmbl->pwmc,PWM_CDTY ) - + intensity = (u16 )pwm_channel_readl (&pwmbl->pwmc,PWM_CDTY ) - pwmbl->pdata->pwm_duty_min;This would actually introduce a new conversion warning (unless you add parentheses as well) as
pwm_duty_minis unsigned long. Same below.Quoted 6 lines
drivers/video/backlight/atmel-pwm-bl.c +1
-1}else { - intensity = pwmbl->pdata->pwm_duty_max - + intensity = (u16 ) pwmbl->pdata->pwm_duty_max -pwm_channel_readl (&pwmbl->pwmc,PWM_CDTY ); }
Quoted 7 lines
drivers/video/backlight/atmel-pwm-bl.c static int atmel_pwm_bl_set_intensity(struct backlight_device *bd) · line 84
Quoted 3 lines
drivers/video/backlight/atmel-pwm-bl.c +1
-1-return intensity; +return (int )intensity; }However, if you feel strongly about this, I'll respin the series (a later patch would likely no longer apply), use u16 and add casts to the two assignments.
Thank you for your kind and detailed description. :-) OK, I have no objection on your original patch.
Would you re-send these patches with my Acked-by with CC'ing Andrew Morton, Tomi Valkeinen? Then, these patches can be merged through mm-tree.
Best regards,
Jingoo Han
PATCH 2/9 backlight: atmel-pwm-bl: fix gpio polarity in remove
In reply to Johan HovoldMake sure to honour gpio polarity also at remove so that the backlight is actually disabled on boards with active-low enable pin.
--- drivers/video/backlight/atmel-pwm-bl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/video/backlight/atmel-pwm-bl.c +4 -2
@@ -205,8 +205,10 @@ static int atmel_pwm_bl_remove(struct platform_device *pdev) {struct atmel_pwm_bl *pwmbl =platform_get_drvdata (pdev); -if (pwmbl->gpio_on !=-1 ) -gpio_set_value (pwmbl->gpio_on,0 ); +if (pwmbl->gpio_on !=-1 ) { +gpio_set_value (pwmbl->gpio_on, +0 ^ pwmbl->pdata->on_active_low); + }pwm_channel_disable (&pwmbl->pwmc);pwm_channel_free (&pwmbl->pwmc);
Signature · 1 line
1.8.4
Re: [PATCH 2/9] backlight: atmel-pwm-bl: fix gpio polarity in remove
Quoted 6 lines · Johan Hovold
Make sure to honour gpio polarity also at remove so that the backlight is actually disabled on boards with active-low enable pin.
Signed-off-by Johan Hovold <[email protected]>
Best regards,
Jingoo Han
Quoted 3 lines
--- drivers/video/backlight/atmel-pwm-bl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
PATCH 3/9 backlight: atmel-pwm-bl: fix module autoload
In reply to Johan HovoldAdd missing module alias which is needed for module autoloading.
--- drivers/video/backlight/atmel-pwm-bl.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/backlight/atmel-pwm-bl.c +1 -0
@@ -229,3 +229,4 @@ module_platform_driver(atmel_pwm_bl_driver);MODULE_AUTHOR ("Hans-Christian egtvedt <[email protected]>" );MODULE_DESCRIPTION ("Atmel PWM backlight driver" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:atmel-pwm-bl" );
Signature · 1 line
1.8.4
Re: [PATCH 3/9] backlight: atmel-pwm-bl: fix module autoload
Quoted 4 lines · Johan Hovold
Add missing module alias which is needed for module autoloading.
Signed-off-by Johan Hovold <[email protected]>
Best regards,
Jingoo Han
Quoted 3 lines
--- drivers/video/backlight/atmel-pwm-bl.c | 1 + 1 file changed, 1 insertion(+)
PATCH 4/9 backlight: atmel-pwm-bl: clean up probe error handling
In reply to Johan HovoldClean up probe error handling by checking parameters before any allocations and removing an obsolete error label. Also remove unnecessary reset of private gpio number.
--- drivers/video/backlight/atmel-pwm-bl.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-)
drivers/video/backlight/atmel-pwm-bl.c +12 -19
@@ -126,40 +126,33 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)struct atmel_pwm_bl *pwmbl;int retval; + 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 (struct atmel_pwm_bl ),GFP_KERNEL );if (!pwmbl)return -ENOMEM ; pwmbl->pdev = pdev; - - pdata =dev_get_platdata (&pdev->dev); -if (!pdata) { - retval = -ENODEV ; - goto err_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 ; - goto err_free_mem; - } - pwmbl->pdata = pdata; pwmbl->gpio_on = pdata->gpio_on; retval =pwm_channel_alloc (pdata->pwm_channel, &pwmbl->pwmc);if (retval) - goto err_free_mem; +return retval;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) goto err_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: +return retval; }
Signature · 1 line
1.8.4
Re: [PATCH 4/9] backlight: atmel-pwm-bl: clean up probe error handling
Quoted 6 lines · Johan Hovold
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.
Signed-off-by Johan Hovold <[email protected]>
Best regards,
Jingoo Han
Quoted 3 lines
--- drivers/video/backlight/atmel-pwm-bl.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-)
PATCH 5/9 backlight: atmel-pwm-bl: clean up get_intensity
In reply to Johan HovoldClean up get_intensity to increase readability.
--- drivers/video/backlight/atmel-pwm-bl.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/video/backlight/atmel-pwm-bl.c +6 -7
@@ -70,15 +70,14 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd)static int atmel_pwm_bl_get_intensity (struct backlight_device *bd) {struct atmel_pwm_bl *pwmbl =bl_get_data (bd); +u32 cdty;u32 intensity; -if (pwmbl->pdata->pwm_active_low) { - intensity =pwm_channel_readl (&pwmbl->pwmc,PWM_CDTY ) - - pwmbl->pdata->pwm_duty_min; - }else { - intensity = pwmbl->pdata->pwm_duty_max - -pwm_channel_readl (&pwmbl->pwmc,PWM_CDTY ); - } + cdty =pwm_channel_readl (&pwmbl->pwmc,PWM_CDTY ); +if (pwmbl->pdata->pwm_active_low) + intensity = cdty - pwmbl->pdata->pwm_duty_min; +else + intensity = pwmbl->pdata->pwm_duty_max - cdty;return (u16 )intensity; }
Signature · 1 line
1.8.4
Re: [PATCH 5/9] backlight: atmel-pwm-bl: clean up get_intensity
Quoted 4 lines · Johan Hovold
Clean up
get_intensityto increase readability.Signed-off-by Johan Hovold <[email protected]>
Best regards,
Jingoo Han
Quoted 3 lines
--- drivers/video/backlight/atmel-pwm-bl.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
PATCH 6/9 backlight: atmel-pwm-bl: remove unused include
In reply to Johan HovoldRemove unused include of clk.h.
--- drivers/video/backlight/atmel-pwm-bl.c | 1 - 1 file changed, 1 deletion(-)
drivers/video/backlight/atmel-pwm-bl.c +0 -1
@@ -12,7 +12,6 @@#include <linux/module.h> #include <linux/platform_device.h> #include <linux/fb.h> -#include <linux/clk.h> #include <linux/gpio.h> #include <linux/backlight.h> #include <linux/atmel_pwm.h>
Signature · 1 line
1.8.4
Re: [PATCH 6/9] backlight: atmel-pwm-bl: remove unused include
Quoted 4 lines · Johan Hovold
Remove unused include of
clk.h.Signed-off-by Johan Hovold <[email protected]>
Best regards,
Jingoo Han
Quoted 3 lines
--- drivers/video/backlight/atmel-pwm-bl.c | 1 - 1 file changed, 1 deletion(-)
PATCH 7/9 backlight: atmel-pwm-bl: use gpio_is_valid
In reply to Johan HovoldUse gpio_is_valid rather than open coding the more restrictive != -1 test.
--- drivers/video/backlight/atmel-pwm-bl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/video/backlight/atmel-pwm-bl.c +4 -4
@@ -48,7 +48,7 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd) pwm_duty = pwmbl->pdata->pwm_duty_min;if (!intensity) { -if (pwmbl->gpio_on !=-1 ) { +if (gpio_is_valid (pwmbl->gpio_on)) {gpio_set_value (pwmbl->gpio_on,0 ^ pwmbl->pdata->on_active_low); }
@@ -57,7 +57,7 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd) }else {pwm_channel_enable (&pwmbl->pwmc);pwm_channel_writel (&pwmbl->pwmc,PWM_CUPD , pwm_duty); -if (pwmbl->gpio_on !=-1 ) { +if (gpio_is_valid (pwmbl->gpio_on)) {gpio_set_value (pwmbl->gpio_on,1 ^ pwmbl->pdata->on_active_low); }
@@ -146,7 +146,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)if (retval)return retval; -if (pwmbl->gpio_on !=-1 ) { +if (gpio_is_valid (pwmbl->gpio_on)) { retval =devm_gpio_request (&pdev->dev, pwmbl->gpio_on,"gpio_atmel_pwm_bl" );if (retval)
@@ -196,7 +196,7 @@ static int atmel_pwm_bl_remove(struct platform_device *pdev) {struct atmel_pwm_bl *pwmbl =platform_get_drvdata (pdev); -if (pwmbl->gpio_on !=-1 ) { +if (gpio_is_valid (pwmbl->gpio_on)) {gpio_set_value (pwmbl->gpio_on,0 ^ pwmbl->pdata->on_active_low); }
Signature · 1 line
1.8.4
Re: [PATCH 7/9] backlight: atmel-pwm-bl: use gpio_is_valid
Quoted 5 lines · Johan Hovold
Use
gpio_is_validrather than open coding the more restrictive != -1 test.Signed-off-by Johan Hovold <[email protected]>
Best regards,
Jingoo Han
Quoted 3 lines
--- drivers/video/backlight/atmel-pwm-bl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
PATCH 8/9 backlight: atmel-pwm-bl: refactor gpio_on handling
In reply to Johan HovoldAdd helper function to control the gpio_on signal.
--- drivers/video/backlight/atmel-pwm-bl.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
drivers/video/backlight/atmel-pwm-bl.c +11 -12
@@ -26,6 +26,14 @@ struct atmel_pwm_bl {int gpio_on; }; +static void atmel_pwm_bl_set_gpio_on (struct atmel_pwm_bl *pwmbl,int on) +{ +if (!gpio_is_valid (pwmbl->gpio_on)) +return ; + +gpio_set_value (pwmbl->gpio_on, on ^ pwmbl->pdata->on_active_low); +} +static int atmel_pwm_bl_set_intensity (struct backlight_device *bd) {struct atmel_pwm_bl *pwmbl =bl_get_data (bd);
@@ -48,19 +56,13 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd) pwm_duty = pwmbl->pdata->pwm_duty_min;if (!intensity) { -if (gpio_is_valid (pwmbl->gpio_on)) { -gpio_set_value (pwmbl->gpio_on, -0 ^ pwmbl->pdata->on_active_low); - } +atmel_pwm_bl_set_gpio_on (pwmbl,0 );pwm_channel_writel (&pwmbl->pwmc,PWM_CUPD , pwm_duty);pwm_channel_disable (&pwmbl->pwmc); }else {pwm_channel_enable (&pwmbl->pwmc);pwm_channel_writel (&pwmbl->pwmc,PWM_CUPD , pwm_duty); -if (gpio_is_valid (pwmbl->gpio_on)) { -gpio_set_value (pwmbl->gpio_on, -1 ^ pwmbl->pdata->on_active_low); - } +atmel_pwm_bl_set_gpio_on (pwmbl,1 ); }return 0 ;
@@ -196,10 +198,7 @@ static int atmel_pwm_bl_remove(struct platform_device *pdev) {struct atmel_pwm_bl *pwmbl =platform_get_drvdata (pdev); -if (gpio_is_valid (pwmbl->gpio_on)) { -gpio_set_value (pwmbl->gpio_on, -0 ^ pwmbl->pdata->on_active_low); - } +atmel_pwm_bl_set_gpio_on (pwmbl,0 );pwm_channel_disable (&pwmbl->pwmc);pwm_channel_free (&pwmbl->pwmc);
Signature · 1 line
1.8.4
Re: [PATCH 8/9] backlight: atmel-pwm-bl: refactor gpio_on handling
Quoted 4 lines · Johan Hovold
Add helper function to control the
gpio_onsignal.Signed-off-by Johan Hovold <[email protected]>
Best regards,
Jingoo Han
Quoted 3 lines
--- drivers/video/backlight/atmel-pwm-bl.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
PATCH 9/9 backlight: atmel-pwm-bl: use gpio_request_one
In reply to Johan HovoldUse devm_gpio_request_one rather than requesting and setting direction in two calls.
--- drivers/video/backlight/atmel-pwm-bl.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/video/backlight/atmel-pwm-bl.c +8 -7
@@ -124,6 +124,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)const struct atmel_pwm_bl_platform_data *pdata;struct backlight_device *bldev;struct atmel_pwm_bl *pwmbl; +int flags;int retval; pdata =dev_get_platdata (&pdev->dev);
@@ -149,14 +150,14 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)return retval;if (gpio_is_valid (pwmbl->gpio_on)) { - retval =devm_gpio_request (&pdev->dev, pwmbl->gpio_on, -"gpio_atmel_pwm_bl" ); -if (retval) - goto err_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) goto err_free_pwm; }
Signature · 1 line
1.8.4
Re: [PATCH 9/9] backlight: atmel-pwm-bl: use gpio_request_one
Quoted 5 lines · Johan Hovold
Use
devm_gpio_request_onerather than requesting and setting direction in two calls.Signed-off-by Johan Hovold <[email protected]>
Best regards,
Jingoo Han
Quoted 3 lines
--- drivers/video/backlight/atmel-pwm-bl.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
Quoted 6 lines · Johan Hovold
These patches fix a few issues and clean up the atmel-pwm-bl driver somewhat.
Johan
Quoted 10 lines
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 upget_intensity
backlight: atmel-pwm-bl: remove unused include
backlight: atmel-pwm-bl: usegpio_is_valid
backlight: atmel-pwm-bl: refactorgpio_onhandling
backlight: atmel-pwm-bl: usegpio_request_one
++cc Andrew Morton, Tomi Valkeinen, Jean-Christophe Plagniol-Villard
Hi Johan Hovold,
Currently, because there is no git tree for backlight, backlight patches have been merged to mm-tree by Andrew Morton. Please, add Andrew Morton to CC list.
Also, there is another way.
If Nicolas Ferre wants to merge these patches, the patches can be merged through ATMEL-SoC tree with my Acked-by.
Best regards,
Jingoo Han
Quoted 3 lines
drivers/video/backlight/atmel-pwm-bl.c | 86 ++++++++++++++++------------------ 1 file changed, 40 insertions(+), 46 deletions(-)
On 23/10/2013 02:19, Jingoo Han :
Quoted 22 lines · Johan Hovold
Quoted 6 lines
These patches fix a few issues and clean up the atmel-pwm-bl driver somewhat.
Johan
Quoted 10 lines
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 upget_intensity
backlight: atmel-pwm-bl: remove unused include
backlight: atmel-pwm-bl: usegpio_is_valid
backlight: atmel-pwm-bl: refactorgpio_onhandling
backlight: atmel-pwm-bl: usegpio_request_one++cc Andrew Morton, Tomi Valkeinen, Jean-Christophe Plagniol-Villard
Hi Johan Hovold,
Quoted 7 lines
Currently, because there is no git tree for backlight, backlight patches have been merged to mm-tree by Andrew Morton. Please, add Andrew Morton to CC list.
Also, there is another way.
If Nicolas Ferre wants to merge these patches, the patches can be merged through ATMEL-SoC tree with my Acked-by.
Hi,
As it's a driver without interaction with AT91 code, maybe routing this patch series through mm-tree is the way to go.
If you find any issue in the process, please tell me. I would be happy to ease the process.
Bye,
Quoted 5 lines
Quoted 3 lines
drivers/video/backlight/atmel-pwm-bl.c | 86 ++++++++++++++++------------------ 1 file changed, 40 insertions(+), 46 deletions(-)
Signature · 1 line
Nicolas Ferre