diff mbox

[v2,2/3] backlight: tdo24m: add the reset line gpio

Message ID 20171013194250.9001-2-robert.jarzmik@free.fr (mailing list archive)
State New, archived
Headers show

Commit Message

Robert Jarzmik Oct. 13, 2017, 7:42 p.m. UTC
The Toppoly panels have a global reset line. Add an optional gpio
control for this line, for platforms which have the ability to drive it.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/video/backlight/tdo24m.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Daniel Thompson Dec. 15, 2017, 11:53 a.m. UTC | #1
On Fri, Oct 13, 2017 at 09:42:48PM +0200, Robert Jarzmik wrote:
> The Toppoly panels have a global reset line. Add an optional gpio
> control for this line, for platforms which have the ability to drive it.
> 
> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
> ---
>  drivers/video/backlight/tdo24m.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
> index e4bd63e9db6b..e4b2dfabf192 100644
> --- a/drivers/video/backlight/tdo24m.c
> +++ b/drivers/video/backlight/tdo24m.c
> @@ -10,6 +10,7 @@
>   */
>  
>  #include <linux/module.h>
> +#include <linux/gpio/consumer.h>
>  #include <linux/kernel.h>
>  #include <linux/init.h>
>  #include <linux/device.h>
> @@ -32,6 +33,7 @@ struct tdo24m {
>  	struct spi_message	msg;
>  	struct spi_transfer	xfer;
>  	uint8_t			*buf;
> +	struct gpio_desc	*xres;

Why do we need a write-only variable?


>  	int (*adj_mode)(struct tdo24m *lcd, int mode);
>  	int color_invert;
> @@ -364,6 +366,7 @@ static int tdo24m_probe(struct spi_device *spi)
>  	if (lcd->buf == NULL)
>  		return -ENOMEM;
>  
> +	lcd->xres = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_LOW);

devm_gpiod_get_optional() would be better, if only for its commenting
value.

Also, this adds a new optional property, doesn't the devicetree binding 
docs need to be update to match this?


Daniel.


>  	m = &lcd->msg;
>  	x = &lcd->xfer;
>  
> -- 
> 2.11.0
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Robert Jarzmik Dec. 16, 2017, 11:39 a.m. UTC | #2
Daniel Thompson <daniel.thompson@linaro.org> writes:

> On Fri, Oct 13, 2017 at 09:42:48PM +0200, Robert Jarzmik wrote:
>> The Toppoly panels have a global reset line. Add an optional gpio
>> control for this line, for platforms which have the ability to drive it.
>> 
>> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
>> ---
>>  drivers/video/backlight/tdo24m.c | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
>> index e4bd63e9db6b..e4b2dfabf192 100644
>> --- a/drivers/video/backlight/tdo24m.c
>> +++ b/drivers/video/backlight/tdo24m.c
>> @@ -10,6 +10,7 @@
>>   */
>>  
>>  #include <linux/module.h>
>> +#include <linux/gpio/consumer.h>
>>  #include <linux/kernel.h>
>>  #include <linux/init.h>
>>  #include <linux/device.h>
>> @@ -32,6 +33,7 @@ struct tdo24m {
>>  	struct spi_message	msg;
>>  	struct spi_transfer	xfer;
>>  	uint8_t			*buf;
>> +	struct gpio_desc	*xres;
>
> Why do we need a write-only variable?
It's written to by devm_gpiod_get() below.

>> +	lcd->xres = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_LOW);
>
> devm_gpiod_get_optional() would be better, if only for its commenting
> value.
Yes, you're perfectly right.

> Also, this adds a new optional property, doesn't the devicetree binding 
> docs need to be update to match this?
Ah yes, that too. I'll add it for v3.

Cheers.
Daniel Thompson Dec. 17, 2017, 8:57 p.m. UTC | #3
On Sat, Dec 16, 2017 at 12:39:50PM +0100, Robert Jarzmik wrote:
> Daniel Thompson <daniel.thompson@linaro.org> writes:
> > On Fri, Oct 13, 2017 at 09:42:48PM +0200, Robert Jarzmik wrote:
> >> The Toppoly panels have a global reset line. Add an optional gpio
> >> control for this line, for platforms which have the ability to drive it.
> >> 
> >> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
> >> ---
> >>  drivers/video/backlight/tdo24m.c | 3 +++
> >>  1 file changed, 3 insertions(+)
> >> 
> >> diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
> >> index e4bd63e9db6b..e4b2dfabf192 100644
> >> --- a/drivers/video/backlight/tdo24m.c
> >> +++ b/drivers/video/backlight/tdo24m.c
> >> @@ -10,6 +10,7 @@
> >>   */
> >>  
> >>  #include <linux/module.h>
> >> +#include <linux/gpio/consumer.h>
> >>  #include <linux/kernel.h>
> >>  #include <linux/init.h>
> >>  #include <linux/device.h>
> >> @@ -32,6 +33,7 @@ struct tdo24m {
> >>  	struct spi_message	msg;
> >>  	struct spi_transfer	xfer;
> >>  	uint8_t			*buf;
> >> +	struct gpio_desc	*xres;
> >
> > Why do we need a write-only variable?
> It's written to by devm_gpiod_get() below.

Yes, but it not *read* anywhere because we rely on devm to release the GPIO.
Why do we need a write-only variable?


> >> +	lcd->xres = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_LOW);
> >
> > devm_gpiod_get_optional() would be better, if only for its commenting
> > value.
> Yes, you're perfectly right.
> 
> > Also, this adds a new optional property, doesn't the devicetree binding 
> > docs need to be update to match this?
> Ah yes, that too. I'll add it for v3.

Thanks!


Daniel.
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Robert Jarzmik Dec. 24, 2017, 11:55 a.m. UTC | #4
Robert Jarzmik <robert.jarzmik@free.fr> writes:

> Daniel Thompson <daniel.thompson@linaro.org> writes:
>
>> On Fri, Oct 13, 2017 at 09:42:48PM +0200, Robert Jarzmik wrote:
>> Also, this adds a new optional property, doesn't the devicetree binding 
>> docs need to be update to match this?
> Ah yes, that too. I'll add it for v3.
Actually I won't ... because there is no description for tdo24m I could find.

If that's a problem for you, I'll drop that patch as well.

Cheers.
Daniel Thompson Jan. 3, 2018, 9:49 a.m. UTC | #5
On Sun, Dec 24, 2017 at 12:55:55PM +0100, Robert Jarzmik wrote:
> Robert Jarzmik <robert.jarzmik@free.fr> writes:
> 
> > Daniel Thompson <daniel.thompson@linaro.org> writes:
> >
> >> On Fri, Oct 13, 2017 at 09:42:48PM +0200, Robert Jarzmik wrote:
> >> Also, this adds a new optional property, doesn't the devicetree binding 
> >> docs need to be update to match this?
> > Ah yes, that too. I'll add it for v3.
> Actually I won't ... because there is no description for tdo24m I could find.
> 
> If that's a problem for you, I'll drop that patch as well.

I think I'm ok to drop this, if only because based on current upstream 
state I think this code will never be given a reset line anyway (or is
there a partner patch for mach-pxa that hasn't been posted yet).


Daniel.
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
index e4bd63e9db6b..e4b2dfabf192 100644
--- a/drivers/video/backlight/tdo24m.c
+++ b/drivers/video/backlight/tdo24m.c
@@ -10,6 +10,7 @@ 
  */
 
 #include <linux/module.h>
+#include <linux/gpio/consumer.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/device.h>
@@ -32,6 +33,7 @@  struct tdo24m {
 	struct spi_message	msg;
 	struct spi_transfer	xfer;
 	uint8_t			*buf;
+	struct gpio_desc	*xres;
 
 	int (*adj_mode)(struct tdo24m *lcd, int mode);
 	int color_invert;
@@ -364,6 +366,7 @@  static int tdo24m_probe(struct spi_device *spi)
 	if (lcd->buf == NULL)
 		return -ENOMEM;
 
+	lcd->xres = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_LOW);
 	m = &lcd->msg;
 	x = &lcd->xfer;