On Mon, Apr 23, 2018 at 01:07:27AM +0200, Linus Walleij wrote:
> Instead of passing a global GPIO number, pass a descriptor looked
> up with the standard devm_gpiod_get_optional() call.
> 
> We have augmented the GPIO core to look up the regulator special
> GPIO "wlf,ldoena" in commit 6a537d48461d
> "gpio: of: Support regulator nonstandard GPIO properties".
> 
> Cc: patc...@opensource.cirrus.com
> Cc: Richard Fitzgerald <r...@opensource.cirrus.com>
> Cc: Charles Keepax <ckee...@opensource.cirrus.com>
> Signed-off-by: Linus Walleij <linus.wall...@linaro.org>
> ---
>  static struct arizona_pdata wm5102_reva_pdata = {
> -     .ldo1 = {
> -             .ldoena = S3C64XX_GPN(7),
> -     },
>       .gpio_base = CODEC_GPIO_BASE,
>       .irq_flags = IRQF_TRIGGER_HIGH,
>       .micd_pol_gpio = CODEC_GPIO_BASE + 4,
> @@ -237,10 +235,16 @@ static struct spi_board_info wm5102_reva_spi_devs[] = {
>       },
>  };
>  
> -static struct arizona_pdata wm5102_pdata = {
> -     .ldo1 = {
> -             .ldoena = S3C64XX_GPN(7),
> +static struct gpiod_lookup_table wm5102_reva_gpiod_table = {
> +     .dev_id = "spi0.1", /* SPI device name */
> +     .table = {
> +             GPIO_LOOKUP("GPION", 7,
> +                         "wlf,ldo1ena", GPIO_ACTIVE_HIGH),

This should be wlf,ldoena.

> +             { },
>       },
> +};
> +
> +static struct arizona_pdata wm5102_pdata = {
>       .gpio_base = CODEC_GPIO_BASE,
>       .irq_flags = IRQF_TRIGGER_HIGH,
>       .micd_pol_gpio = CODEC_GPIO_BASE + 2,
> @@ -264,6 +268,15 @@ static struct spi_board_info wm5102_spi_devs[] = {
>       },
>  };
>  
> +static struct gpiod_lookup_table wm5102_gpiod_table = {
> +     .dev_id = "spi0.1", /* SPI device name */
> +     .table = {
> +             GPIO_LOOKUP("GPION", 7,
> +                         "wlf,ldo1ena", GPIO_ACTIVE_HIGH),
> +             { },
> +     },
> +};
> +

Might as well share the same lookup table between the revs since
it is identical.

Thanks,
Charles

Reply via email to