Re: [PATCH 16/21] regulator: wm8994: Pass descriptor instead of GPIO number

From: Charles Keepax
Date: Tue Feb 13 2018 - 06:11:58 EST


On Mon, Feb 12, 2018 at 02:17:12PM +0100, Linus Walleij wrote:
> Instead of passing a global GPIO number for the enable GPIO, pass
> a descriptor looked up from the device tree node or the board file
> decriptor table for the regulator.
>
> There is a single board file passing the GPIOs for LDO1 and LDO2
> through platform data, so augment this to pass descriptors
> associated with the i2c device as well.
>
> Cc: patches@xxxxxxxxxxxxxxxxxxxxx
> Cc: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
> Cc: Lee Jones <lee.jones@xxxxxxxxxx>
> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
> ---
> Lee: this patch is touching the MFD core driver for WM8994,
> but as with all other patches we just change the regulator
> parts. Would be nice if you could ACK it.
> ---
> arch/arm/mach-s3c64xx/mach-crag6410-module.c | 18 ++++++++++++++++--
> drivers/mfd/wm8994-core.c | 9 ---------
> drivers/regulator/wm8994-regulator.c | 19 +++++++++++--------
> include/linux/mfd/wm8994/pdata.h | 3 ---
> 4 files changed, 27 insertions(+), 22 deletions(-)
>
> +static struct gpiod_lookup_table wm8994_gpiod_table = {
> + .dev_id = "i2c-wm8958", /* I2C device name */
> + .table = {
> + GPIO_LOOKUP("GPION", 6,
> + "wlf,ldo1ena", GPIO_ACTIVE_HIGH),
> + GPIO_LOOKUP("GPION", 4,
> + "wlf,ldo2ena", GPIO_ACTIVE_HIGH),
> + { },
> },
> };
>
> @@ -366,6 +379,7 @@ static int wlf_gf_module_probe(struct i2c_client *i2c,
> rev == gf_mods[i].rev))
> break;
>
> + gpiod_add_lookup_table(&wm8994_gpiod_table);

Would it be nicer to add this as a new member of gf_mods and
register it inside the loop? Since eventually we will need tables
for wm5102, wm8994, wm2200, wm8996, wm5100 and wm0010.

Thanks,
Charles