Re: [PATCH v8] backlight: lms283gf05: Convert to GPIO descriptors

2021-01-11 Thread Mark Brown
On Mon, Jan 11, 2021 at 10:40:46PM +0100, Linus Walleij wrote:

> Mark, can I have your ACK for deleting
> include/linux/spi/lms283gf05.h
> As part of this patch sets?

Acked-by: Mark Brown 


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v8] backlight: lms283gf05: Convert to GPIO descriptors

2021-01-11 Thread Linus Walleij
On Mon, Jan 11, 2021 at 5:19 PM Lee Jones  wrote:

> > ChangeLog v7->v8:
> > - Rebase onto v5.11-rc1
> > - I wonder why this never seems to get merged...?
>
> Because you need SPI & PXA Acks and a merge plan.

Ah you're right I completely missed that the include is down
in include/spi/...

Mark, can I have your ACK for deleting
include/linux/spi/lms283gf05.h
As part of this patch sets?

I will collect the ACKs and resend with a proposal to merge
through the backlight tree.

Yours,
Linus Walleij
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v8] backlight: lms283gf05: Convert to GPIO descriptors

2021-01-11 Thread Lee Jones
On Sun, 10 Jan 2021, Linus Walleij wrote:

> This converts the lms283gf05 backlight driver to use GPIO
> descriptors and switches the single PXA Palm Z2 device
> over to defining these.
> 
> Since the platform data was only used to convey GPIO
> information we can delete the platform data header.
> 
> Notice that we define the proper active low semantics in
> the board file GPIO descriptor table (active low) and
> assert the reset line by bringing it to "1" (asserted).
> 
> Cc: Marek Vasut 
> Cc: Daniel Mack 
> Cc: Haojian Zhuang 
> Cc: Robert Jarzmik 
> Reviewed-by: Daniel Thompson 
> Signed-off-by: Linus Walleij 
> ---
> ChangeLog v7->v8:
> - Rebase onto v5.11-rc1
> - I wonder why this never seems to get merged...?

Because you need SPI & PXA Acks and a merge plan.

> ChangeLog v6->v7:
> - Rebase onto v5.10-rc1
> ChangeLog v5->v6:
> - Rebase onto v5.9-rc1
> ChangeLog v4->v5:
> - Rebase on v5.8-rc1
> - Collected Daniel's Reviewed-by tag.
> ChangeLog v3->v4:
> - Check IS_ERR() on the returned GPIO descriptor.
> - Unconditionally set consumer name since the API tolerates NULL.
> ChangeLog v2->v3:
> - Fix a use-before-allocated bug discovered by compile tests.
> - Remove unused ret variable as autobuilders complained.
> ChangeLog v1->v2:
> - Bring up the GPIO de-asserted in probe()
> 
> Marek: I saw this was written by you, are you regularly
> testing the Z2 device?
> ---
>  arch/arm/mach-pxa/z2.c   | 12 +---
>  drivers/video/backlight/lms283gf05.c | 43 +++-
>  include/linux/spi/lms283gf05.h   | 16 ---
>  3 files changed, 25 insertions(+), 46 deletions(-)
>  delete mode 100644 include/linux/spi/lms283gf05.h

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v8] backlight: lms283gf05: Convert to GPIO descriptors

2021-01-11 Thread Daniel Mack
Hi Linus,

On 10/1/2021 1:09 pm, Linus Walleij wrote:
> This converts the lms283gf05 backlight driver to use GPIO
> descriptors and switches the single PXA Palm Z2 device
> over to defining these.
> 
> Since the platform data was only used to convey GPIO
> information we can delete the platform data header.
> 
> Notice that we define the proper active low semantics in
> the board file GPIO descriptor table (active low) and
> assert the reset line by bringing it to "1" (asserted).
> 
> Cc: Marek Vasut 
> Cc: Daniel Mack 
> Cc: Haojian Zhuang 
> Cc: Robert Jarzmik 
> Reviewed-by: Daniel Thompson 

Reviewed-by: Daniel Mack 

Thanks for working on this! The PXA tree is usually maintained by
Robert, but I haven't heard from him in a while.

Maybe this patch can go through some broader ARM tree like Arnd's (cc'ed)?


Daniel


> Signed-off-by: Linus Walleij 
> ---
> ChangeLog v7->v8:
> - Rebase onto v5.11-rc1
> - I wonder why this never seems to get merged...?
> ChangeLog v6->v7:
> - Rebase onto v5.10-rc1
> ChangeLog v5->v6:
> - Rebase onto v5.9-rc1
> ChangeLog v4->v5:
> - Rebase on v5.8-rc1
> - Collected Daniel's Reviewed-by tag.
> ChangeLog v3->v4:
> - Check IS_ERR() on the returned GPIO descriptor.
> - Unconditionally set consumer name since the API tolerates NULL.
> ChangeLog v2->v3:
> - Fix a use-before-allocated bug discovered by compile tests.
> - Remove unused ret variable as autobuilders complained.
> ChangeLog v1->v2:
> - Bring up the GPIO de-asserted in probe()
> 
> Marek: I saw this was written by you, are you regularly
> testing the Z2 device?
> ---
>  arch/arm/mach-pxa/z2.c   | 12 +---
>  drivers/video/backlight/lms283gf05.c | 43 +++-
>  include/linux/spi/lms283gf05.h   | 16 ---
>  3 files changed, 25 insertions(+), 46 deletions(-)
>  delete mode 100644 include/linux/spi/lms283gf05.h
> 
> diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
> index 21fd76bb09cd..89eb5243c85f 100644
> --- a/arch/arm/mach-pxa/z2.c
> +++ b/arch/arm/mach-pxa/z2.c
> @@ -20,7 +20,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -578,8 +577,13 @@ static struct pxa2xx_spi_chip lms283_chip_info = {
>   .gpio_cs= GPIO88_ZIPITZ2_LCD_CS,
>  };
>  
> -static const struct lms283gf05_pdata lms283_pdata = {
> - .reset_gpio = GPIO19_ZIPITZ2_LCD_RESET,
> +static struct gpiod_lookup_table lms283_gpio_table = {
> + .dev_id = "spi2.0", /* SPI bus 2 chip select 0 */
> + .table = {
> + GPIO_LOOKUP("gpio-pxa", GPIO19_ZIPITZ2_LCD_RESET,
> + "reset", GPIO_ACTIVE_LOW),
> + { },
> + },
>  };
>  
>  static struct spi_board_info spi_board_info[] __initdata = {
> @@ -595,7 +599,6 @@ static struct spi_board_info spi_board_info[] __initdata 
> = {
>  {
>   .modalias   = "lms283gf05",
>   .controller_data= _chip_info,
> - .platform_data  = _pdata,
>   .max_speed_hz   = 40,
>   .bus_num= 2,
>   .chip_select= 0,
> @@ -615,6 +618,7 @@ static void __init z2_spi_init(void)
>  {
>   pxa2xx_set_spi_info(1, _ssp1_master_info);
>   pxa2xx_set_spi_info(2, _ssp2_master_info);
> + gpiod_add_lookup_table(_gpio_table);
>   spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
>  }
>  #else
> diff --git a/drivers/video/backlight/lms283gf05.c 
> b/drivers/video/backlight/lms283gf05.c
> index 0e45685bcc1c..36856962ed83 100644
> --- a/drivers/video/backlight/lms283gf05.c
> +++ b/drivers/video/backlight/lms283gf05.c
> @@ -9,16 +9,16 @@
>  #include 
>  #include 
>  #include 
> -#include 
> +#include 
>  #include 
>  
>  #include 
> -#include 
>  #include 
>  
>  struct lms283gf05_state {
>   struct spi_device   *spi;
>   struct lcd_device   *ld;
> + struct gpio_desc*reset;
>  };
>  
>  struct lms283gf05_seq {
> @@ -90,13 +90,13 @@ static const struct lms283gf05_seq disp_pdwnseq[] = {
>  };
>  
>  
> -static void lms283gf05_reset(unsigned long gpio, bool inverted)
> +static void lms283gf05_reset(struct gpio_desc *gpiod)
>  {
> - gpio_set_value(gpio, !inverted);
> + gpiod_set_value(gpiod, 0); /* De-asserted */
>   mdelay(100);
> - gpio_set_value(gpio, inverted);
> + gpiod_set_value(gpiod, 1); /* Asserted */
>   mdelay(20);
> - gpio_set_value(gpio, !inverted);
> + gpiod_set_value(gpiod, 0); /* De-asserted */
>   mdelay(20);
>  }
>  
> @@ -125,18 +125,15 @@ static int lms283gf05_power_set(struct lcd_device *ld, 
> int power)
>  {
>   struct lms283gf05_state *st = lcd_get_data(ld);
>   struct spi_device *spi = st->spi;
> - struct lms283gf05_pdata *pdata = dev_get_platdata(>dev);
>  
>   if (power <= FB_BLANK_NORMAL) {
> - if (pdata)
> - lms283gf05_reset(pdata->reset_gpio,
> - pdata->reset_inverted);
> + if 

[PATCH v8] backlight: lms283gf05: Convert to GPIO descriptors

2021-01-10 Thread Linus Walleij
This converts the lms283gf05 backlight driver to use GPIO
descriptors and switches the single PXA Palm Z2 device
over to defining these.

Since the platform data was only used to convey GPIO
information we can delete the platform data header.

Notice that we define the proper active low semantics in
the board file GPIO descriptor table (active low) and
assert the reset line by bringing it to "1" (asserted).

Cc: Marek Vasut 
Cc: Daniel Mack 
Cc: Haojian Zhuang 
Cc: Robert Jarzmik 
Reviewed-by: Daniel Thompson 
Signed-off-by: Linus Walleij 
---
ChangeLog v7->v8:
- Rebase onto v5.11-rc1
- I wonder why this never seems to get merged...?
ChangeLog v6->v7:
- Rebase onto v5.10-rc1
ChangeLog v5->v6:
- Rebase onto v5.9-rc1
ChangeLog v4->v5:
- Rebase on v5.8-rc1
- Collected Daniel's Reviewed-by tag.
ChangeLog v3->v4:
- Check IS_ERR() on the returned GPIO descriptor.
- Unconditionally set consumer name since the API tolerates NULL.
ChangeLog v2->v3:
- Fix a use-before-allocated bug discovered by compile tests.
- Remove unused ret variable as autobuilders complained.
ChangeLog v1->v2:
- Bring up the GPIO de-asserted in probe()

Marek: I saw this was written by you, are you regularly
testing the Z2 device?
---
 arch/arm/mach-pxa/z2.c   | 12 +---
 drivers/video/backlight/lms283gf05.c | 43 +++-
 include/linux/spi/lms283gf05.h   | 16 ---
 3 files changed, 25 insertions(+), 46 deletions(-)
 delete mode 100644 include/linux/spi/lms283gf05.h

diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
index 21fd76bb09cd..89eb5243c85f 100644
--- a/arch/arm/mach-pxa/z2.c
+++ b/arch/arm/mach-pxa/z2.c
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -578,8 +577,13 @@ static struct pxa2xx_spi_chip lms283_chip_info = {
.gpio_cs= GPIO88_ZIPITZ2_LCD_CS,
 };
 
-static const struct lms283gf05_pdata lms283_pdata = {
-   .reset_gpio = GPIO19_ZIPITZ2_LCD_RESET,
+static struct gpiod_lookup_table lms283_gpio_table = {
+   .dev_id = "spi2.0", /* SPI bus 2 chip select 0 */
+   .table = {
+   GPIO_LOOKUP("gpio-pxa", GPIO19_ZIPITZ2_LCD_RESET,
+   "reset", GPIO_ACTIVE_LOW),
+   { },
+   },
 };
 
 static struct spi_board_info spi_board_info[] __initdata = {
@@ -595,7 +599,6 @@ static struct spi_board_info spi_board_info[] __initdata = {
 {
.modalias   = "lms283gf05",
.controller_data= _chip_info,
-   .platform_data  = _pdata,
.max_speed_hz   = 40,
.bus_num= 2,
.chip_select= 0,
@@ -615,6 +618,7 @@ static void __init z2_spi_init(void)
 {
pxa2xx_set_spi_info(1, _ssp1_master_info);
pxa2xx_set_spi_info(2, _ssp2_master_info);
+   gpiod_add_lookup_table(_gpio_table);
spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
 }
 #else
diff --git a/drivers/video/backlight/lms283gf05.c 
b/drivers/video/backlight/lms283gf05.c
index 0e45685bcc1c..36856962ed83 100644
--- a/drivers/video/backlight/lms283gf05.c
+++ b/drivers/video/backlight/lms283gf05.c
@@ -9,16 +9,16 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
-#include 
 #include 
 
 struct lms283gf05_state {
struct spi_device   *spi;
struct lcd_device   *ld;
+   struct gpio_desc*reset;
 };
 
 struct lms283gf05_seq {
@@ -90,13 +90,13 @@ static const struct lms283gf05_seq disp_pdwnseq[] = {
 };
 
 
-static void lms283gf05_reset(unsigned long gpio, bool inverted)
+static void lms283gf05_reset(struct gpio_desc *gpiod)
 {
-   gpio_set_value(gpio, !inverted);
+   gpiod_set_value(gpiod, 0); /* De-asserted */
mdelay(100);
-   gpio_set_value(gpio, inverted);
+   gpiod_set_value(gpiod, 1); /* Asserted */
mdelay(20);
-   gpio_set_value(gpio, !inverted);
+   gpiod_set_value(gpiod, 0); /* De-asserted */
mdelay(20);
 }
 
@@ -125,18 +125,15 @@ static int lms283gf05_power_set(struct lcd_device *ld, 
int power)
 {
struct lms283gf05_state *st = lcd_get_data(ld);
struct spi_device *spi = st->spi;
-   struct lms283gf05_pdata *pdata = dev_get_platdata(>dev);
 
if (power <= FB_BLANK_NORMAL) {
-   if (pdata)
-   lms283gf05_reset(pdata->reset_gpio,
-   pdata->reset_inverted);
+   if (st->reset)
+   lms283gf05_reset(st->reset);
lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq));
} else {
lms283gf05_toggle(spi, disp_pdwnseq, ARRAY_SIZE(disp_pdwnseq));
-   if (pdata)
-   gpio_set_value(pdata->reset_gpio,
-   pdata->reset_inverted);
+   if (st->reset)
+   gpiod_set_value(st->reset, 1); /* Asserted */