Re: [RFC 3/4] sh: ecovec24: convert backlight to use device properties

2018-03-16 Thread Dmitry Torokhov
On Fri, Mar 16, 2018 at 09:50:21AM +0100, Geert Uytterhoeven wrote:
> Hi Dmitry,
> 
> On Thu, Mar 15, 2018 at 11:42 PM, Dmitry Torokhov
>  wrote:
> > Instead of backlight legacy platform data, let's switch to using device
> > properties and GPIO lookup tables.
> >
> > Signed-off-by: Dmitry Torokhov 
> 
> Thanks for your patch!
> 
> > --- a/arch/sh/boards/mach-ecovec24/setup.c
> > +++ b/arch/sh/boards/mach-ecovec24/setup.c
> 
> > @@ -367,17 +368,21 @@ static struct platform_device lcdc_device = {
> > },
> >  };
> >
> > -static struct gpio_backlight_platform_data gpio_backlight_data = {
> > -   .gpio = GPIO_PTR1,
> > -   .def_value = 1,
> > -   .name = "backlight",
> > +static struct gpiod_lookup_table gpio_backlight_gpios_table = {
> 
> gpio_backlight_gpios_table is unused?

There was supposed to be gpiod_add_lookup_table() that I lost as I was
reshuffling and reshuffling the patches.

> 
> > +   .dev_id = "gpio-backlight.0",
> > +   .table = {
> > +   GPIO_LOOKUP_IDX("sh7724_pfc", GPIO_PTR1, NULL, 0, 
> > GPIO_ACTIVE_HIGH);
> > +   { }
> > +   },
> > +};
> > +
> > +static struct property_entry gpio_backlight_properties[] = {
> 
> const

OK.

> 
> > +   PROPERTY_ENTRY_BOOL("default-on"),
> > +   { }
> >  };
> >
> >  static struct platform_device gpio_backlight_device = {
> > .name = "gpio-backlight",
> > -   .dev = {
> > -   .platform_data = _backlight_data,
> > -   },
> >  };
> >
> >  /* CEU0 */
> > @@ -1436,6 +1441,8 @@ static int __init arch_setup(void)
> > return error;
> >
> > if (use_backlight) {
> > +   device_add_properties(_backlight_device.dev,
> > + gpio_backlight_properties);
> > error = platform_device_add(_backlight_device);
> > if (error)
> > pr_warn("%s: failed to register backlight: %d\n",
> 
> Gr{oetje,eeting}s,
> 
> Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- 
> ge...@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like 
> that.
> -- Linus Torvalds

-- 
Dmitry


Re: [RFC 3/4] sh: ecovec24: convert backlight to use device properties

2018-03-16 Thread Dmitry Torokhov
On Fri, Mar 16, 2018 at 09:50:21AM +0100, Geert Uytterhoeven wrote:
> Hi Dmitry,
> 
> On Thu, Mar 15, 2018 at 11:42 PM, Dmitry Torokhov
>  wrote:
> > Instead of backlight legacy platform data, let's switch to using device
> > properties and GPIO lookup tables.
> >
> > Signed-off-by: Dmitry Torokhov 
> 
> Thanks for your patch!
> 
> > --- a/arch/sh/boards/mach-ecovec24/setup.c
> > +++ b/arch/sh/boards/mach-ecovec24/setup.c
> 
> > @@ -367,17 +368,21 @@ static struct platform_device lcdc_device = {
> > },
> >  };
> >
> > -static struct gpio_backlight_platform_data gpio_backlight_data = {
> > -   .gpio = GPIO_PTR1,
> > -   .def_value = 1,
> > -   .name = "backlight",
> > +static struct gpiod_lookup_table gpio_backlight_gpios_table = {
> 
> gpio_backlight_gpios_table is unused?

There was supposed to be gpiod_add_lookup_table() that I lost as I was
reshuffling and reshuffling the patches.

> 
> > +   .dev_id = "gpio-backlight.0",
> > +   .table = {
> > +   GPIO_LOOKUP_IDX("sh7724_pfc", GPIO_PTR1, NULL, 0, 
> > GPIO_ACTIVE_HIGH);
> > +   { }
> > +   },
> > +};
> > +
> > +static struct property_entry gpio_backlight_properties[] = {
> 
> const

OK.

> 
> > +   PROPERTY_ENTRY_BOOL("default-on"),
> > +   { }
> >  };
> >
> >  static struct platform_device gpio_backlight_device = {
> > .name = "gpio-backlight",
> > -   .dev = {
> > -   .platform_data = _backlight_data,
> > -   },
> >  };
> >
> >  /* CEU0 */
> > @@ -1436,6 +1441,8 @@ static int __init arch_setup(void)
> > return error;
> >
> > if (use_backlight) {
> > +   device_add_properties(_backlight_device.dev,
> > + gpio_backlight_properties);
> > error = platform_device_add(_backlight_device);
> > if (error)
> > pr_warn("%s: failed to register backlight: %d\n",
> 
> Gr{oetje,eeting}s,
> 
> Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- 
> ge...@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like 
> that.
> -- Linus Torvalds

-- 
Dmitry


Re: [RFC 3/4] sh: ecovec24: convert backlight to use device properties

2018-03-16 Thread jacopo mondi
Hi Dmitry,

On Thu, Mar 15, 2018 at 03:42:01PM -0700, Dmitry Torokhov wrote:
> Instead of backlight legacy platform data, let's switch to using device
> properties and GPIO lookup tables.
>
> Signed-off-by: Dmitry Torokhov 
> ---
>  arch/sh/boards/mach-ecovec24/setup.c | 23 +++
>  1 file changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/arch/sh/boards/mach-ecovec24/setup.c 
> b/arch/sh/boards/mach-ecovec24/setup.c
> index 67633d2d42390..ad3d48b3ead19 100644
> --- a/arch/sh/boards/mach-ecovec24/setup.c
> +++ b/arch/sh/boards/mach-ecovec24/setup.c
> @@ -11,11 +11,13 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -30,7 +32,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -367,17 +368,21 @@ static struct platform_device lcdc_device = {
>   },
>  };
>
> -static struct gpio_backlight_platform_data gpio_backlight_data = {
> - .gpio = GPIO_PTR1,
> - .def_value = 1,
> - .name = "backlight",
> +static struct gpiod_lookup_table gpio_backlight_gpios_table = {
> + .dev_id = "gpio-backlight.0",
> + .table = {
> + GPIO_LOOKUP_IDX("sh7724_pfc", GPIO_PTR1, NULL, 0, 
> GPIO_ACTIVE_HIGH);
> + { }

I understand this is an RFC, but this bit does not even compile.

../arch/sh/boards/mach-ecovec24/setup.c:374:70: error: expected '}'
before ';' token

Thanks
   j

> + },
> +};
> +
> +static struct property_entry gpio_backlight_properties[] = {
> + PROPERTY_ENTRY_BOOL("default-on"),
> + { }
>  };
>
>  static struct platform_device gpio_backlight_device = {
>   .name = "gpio-backlight",
> - .dev = {
> - .platform_data = _backlight_data,
> - },
>  };
>
>  /* CEU0 */
> @@ -1436,6 +1441,8 @@ static int __init arch_setup(void)
>   return error;
>
>   if (use_backlight) {
> + device_add_properties(_backlight_device.dev,
> +   gpio_backlight_properties);
>   error = platform_device_add(_backlight_device);
>   if (error)
>   pr_warn("%s: failed to register backlight: %d\n",
> --
> 2.16.2.804.g6dcf76e118-goog
>


signature.asc
Description: PGP signature


Re: [RFC 3/4] sh: ecovec24: convert backlight to use device properties

2018-03-16 Thread jacopo mondi
Hi Dmitry,

On Thu, Mar 15, 2018 at 03:42:01PM -0700, Dmitry Torokhov wrote:
> Instead of backlight legacy platform data, let's switch to using device
> properties and GPIO lookup tables.
>
> Signed-off-by: Dmitry Torokhov 
> ---
>  arch/sh/boards/mach-ecovec24/setup.c | 23 +++
>  1 file changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/arch/sh/boards/mach-ecovec24/setup.c 
> b/arch/sh/boards/mach-ecovec24/setup.c
> index 67633d2d42390..ad3d48b3ead19 100644
> --- a/arch/sh/boards/mach-ecovec24/setup.c
> +++ b/arch/sh/boards/mach-ecovec24/setup.c
> @@ -11,11 +11,13 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -30,7 +32,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -367,17 +368,21 @@ static struct platform_device lcdc_device = {
>   },
>  };
>
> -static struct gpio_backlight_platform_data gpio_backlight_data = {
> - .gpio = GPIO_PTR1,
> - .def_value = 1,
> - .name = "backlight",
> +static struct gpiod_lookup_table gpio_backlight_gpios_table = {
> + .dev_id = "gpio-backlight.0",
> + .table = {
> + GPIO_LOOKUP_IDX("sh7724_pfc", GPIO_PTR1, NULL, 0, 
> GPIO_ACTIVE_HIGH);
> + { }

I understand this is an RFC, but this bit does not even compile.

../arch/sh/boards/mach-ecovec24/setup.c:374:70: error: expected '}'
before ';' token

Thanks
   j

> + },
> +};
> +
> +static struct property_entry gpio_backlight_properties[] = {
> + PROPERTY_ENTRY_BOOL("default-on"),
> + { }
>  };
>
>  static struct platform_device gpio_backlight_device = {
>   .name = "gpio-backlight",
> - .dev = {
> - .platform_data = _backlight_data,
> - },
>  };
>
>  /* CEU0 */
> @@ -1436,6 +1441,8 @@ static int __init arch_setup(void)
>   return error;
>
>   if (use_backlight) {
> + device_add_properties(_backlight_device.dev,
> +   gpio_backlight_properties);
>   error = platform_device_add(_backlight_device);
>   if (error)
>   pr_warn("%s: failed to register backlight: %d\n",
> --
> 2.16.2.804.g6dcf76e118-goog
>


signature.asc
Description: PGP signature


Re: [RFC 3/4] sh: ecovec24: convert backlight to use device properties

2018-03-16 Thread Geert Uytterhoeven
Hi Dmitry,

On Thu, Mar 15, 2018 at 11:42 PM, Dmitry Torokhov
 wrote:
> Instead of backlight legacy platform data, let's switch to using device
> properties and GPIO lookup tables.
>
> Signed-off-by: Dmitry Torokhov 

Thanks for your patch!

> --- a/arch/sh/boards/mach-ecovec24/setup.c
> +++ b/arch/sh/boards/mach-ecovec24/setup.c

> @@ -367,17 +368,21 @@ static struct platform_device lcdc_device = {
> },
>  };
>
> -static struct gpio_backlight_platform_data gpio_backlight_data = {
> -   .gpio = GPIO_PTR1,
> -   .def_value = 1,
> -   .name = "backlight",
> +static struct gpiod_lookup_table gpio_backlight_gpios_table = {

gpio_backlight_gpios_table is unused?

> +   .dev_id = "gpio-backlight.0",
> +   .table = {
> +   GPIO_LOOKUP_IDX("sh7724_pfc", GPIO_PTR1, NULL, 0, 
> GPIO_ACTIVE_HIGH);
> +   { }
> +   },
> +};
> +
> +static struct property_entry gpio_backlight_properties[] = {

const

> +   PROPERTY_ENTRY_BOOL("default-on"),
> +   { }
>  };
>
>  static struct platform_device gpio_backlight_device = {
> .name = "gpio-backlight",
> -   .dev = {
> -   .platform_data = _backlight_data,
> -   },
>  };
>
>  /* CEU0 */
> @@ -1436,6 +1441,8 @@ static int __init arch_setup(void)
> return error;
>
> if (use_backlight) {
> +   device_add_properties(_backlight_device.dev,
> + gpio_backlight_properties);
> error = platform_device_add(_backlight_device);
> if (error)
> pr_warn("%s: failed to register backlight: %d\n",

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [RFC 3/4] sh: ecovec24: convert backlight to use device properties

2018-03-16 Thread Geert Uytterhoeven
Hi Dmitry,

On Thu, Mar 15, 2018 at 11:42 PM, Dmitry Torokhov
 wrote:
> Instead of backlight legacy platform data, let's switch to using device
> properties and GPIO lookup tables.
>
> Signed-off-by: Dmitry Torokhov 

Thanks for your patch!

> --- a/arch/sh/boards/mach-ecovec24/setup.c
> +++ b/arch/sh/boards/mach-ecovec24/setup.c

> @@ -367,17 +368,21 @@ static struct platform_device lcdc_device = {
> },
>  };
>
> -static struct gpio_backlight_platform_data gpio_backlight_data = {
> -   .gpio = GPIO_PTR1,
> -   .def_value = 1,
> -   .name = "backlight",
> +static struct gpiod_lookup_table gpio_backlight_gpios_table = {

gpio_backlight_gpios_table is unused?

> +   .dev_id = "gpio-backlight.0",
> +   .table = {
> +   GPIO_LOOKUP_IDX("sh7724_pfc", GPIO_PTR1, NULL, 0, 
> GPIO_ACTIVE_HIGH);
> +   { }
> +   },
> +};
> +
> +static struct property_entry gpio_backlight_properties[] = {

const

> +   PROPERTY_ENTRY_BOOL("default-on"),
> +   { }
>  };
>
>  static struct platform_device gpio_backlight_device = {
> .name = "gpio-backlight",
> -   .dev = {
> -   .platform_data = _backlight_data,
> -   },
>  };
>
>  /* CEU0 */
> @@ -1436,6 +1441,8 @@ static int __init arch_setup(void)
> return error;
>
> if (use_backlight) {
> +   device_add_properties(_backlight_device.dev,
> + gpio_backlight_properties);
> error = platform_device_add(_backlight_device);
> if (error)
> pr_warn("%s: failed to register backlight: %d\n",

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds