* [PATCH] ARM: s3c64xx: Tidy up handling of regulator GPIO lookups @ 2019-04-12 7:14 ` Linus Walleij 0 siblings, 0 replies; 9+ messages in thread From: Linus Walleij @ 2019-04-12 7:14 UTC (permalink / raw) To: linux-arm-kernel, linux-samsung-soc, Krzysztof Kozlowski Cc: Linus Walleij, Charles Keepax, Bartlomiej Zolnierkiewicz From: Charles Keepax <ckeepax@opensource.cirrus.com> Rather than unconditionally registering the GPIO lookup table only do so for devices that require it. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> [Fixed up to also handle wm5102 and wm5102 reva] Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- This modified patch from Charles is sitting in one of my regulator branches. Krzsystof are you collecting S3C patches? The MAINATINERS file seems to be lacking an S3C maintainer currently... --- arch/arm/mach-s3c64xx/mach-crag6410-module.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c index 76c4855a03bc..937d0a83f8fd 100644 --- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c +++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c @@ -328,6 +328,8 @@ static const struct { int num_i2c_devs; const struct spi_board_info *spi_devs; int num_spi_devs; + + struct gpiod_lookup_table *gpiod_table; } gf_mods[] = { { .id = 0x01, .rev = 0xff, .name = "1250-EV1 Springbank" }, { .id = 0x02, .rev = 0xff, .name = "1251-EV1 Jura" }, @@ -362,13 +364,16 @@ static const struct { .i2c_devs = wm1255_devs, .num_i2c_devs = ARRAY_SIZE(wm1255_devs) }, { .id = 0x3c, .rev = 0xff, .name = "1273-EV1 Longmorn" }, { .id = 0x3d, .rev = 0xff, .name = "1277-EV1 Littlemill", - .i2c_devs = wm1277_devs, .num_i2c_devs = ARRAY_SIZE(wm1277_devs) }, + .i2c_devs = wm1277_devs, .num_i2c_devs = ARRAY_SIZE(wm1277_devs), + .gpiod_table = &wm8994_gpiod_table }, { .id = 0x3e, .rev = 0, .name = "WM5102-6271-EV1-CS127 Amrut", .spi_devs = wm5102_reva_spi_devs, - .num_spi_devs = ARRAY_SIZE(wm5102_reva_spi_devs) }, + .num_spi_devs = ARRAY_SIZE(wm5102_reva_spi_devs), + .gpiod_table = &wm5102_reva_gpiod_table }, { .id = 0x3e, .rev = -1, .name = "WM5102-6271-EV1-CS127 Amrut", .spi_devs = wm5102_spi_devs, - .num_spi_devs = ARRAY_SIZE(wm5102_spi_devs) }, + .num_spi_devs = ARRAY_SIZE(wm5102_spi_devs), + .gpiod_table = &wm5102_gpiod_table }, { .id = 0x3f, .rev = -1, .name = "WM2200-6271-CS90-M-REV1", .i2c_devs = wm2200_i2c, .num_i2c_devs = ARRAY_SIZE(wm2200_i2c) }, }; @@ -408,6 +413,9 @@ static int wlf_gf_module_probe(struct i2c_client *i2c, spi_register_board_info(gf_mods[i].spi_devs, gf_mods[i].num_spi_devs); + + if (gf_mods[i].gpiod_table) + gpiod_add_lookup_table(gf_mods[i].gpiod_table); } else { dev_warn(&i2c->dev, "Unknown module ID 0x%x revision %d\n", id, rev + 1); -- 2.20.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] ARM: s3c64xx: Tidy up handling of regulator GPIO lookups @ 2019-04-12 7:14 ` Linus Walleij 0 siblings, 0 replies; 9+ messages in thread From: Linus Walleij @ 2019-04-12 7:14 UTC (permalink / raw) To: linux-arm-kernel, linux-samsung-soc, Krzysztof Kozlowski Cc: Linus Walleij, Charles Keepax, Bartlomiej Zolnierkiewicz From: Charles Keepax <ckeepax@opensource.cirrus.com> Rather than unconditionally registering the GPIO lookup table only do so for devices that require it. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> [Fixed up to also handle wm5102 and wm5102 reva] Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- This modified patch from Charles is sitting in one of my regulator branches. Krzsystof are you collecting S3C patches? The MAINATINERS file seems to be lacking an S3C maintainer currently... --- arch/arm/mach-s3c64xx/mach-crag6410-module.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c index 76c4855a03bc..937d0a83f8fd 100644 --- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c +++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c @@ -328,6 +328,8 @@ static const struct { int num_i2c_devs; const struct spi_board_info *spi_devs; int num_spi_devs; + + struct gpiod_lookup_table *gpiod_table; } gf_mods[] = { { .id = 0x01, .rev = 0xff, .name = "1250-EV1 Springbank" }, { .id = 0x02, .rev = 0xff, .name = "1251-EV1 Jura" }, @@ -362,13 +364,16 @@ static const struct { .i2c_devs = wm1255_devs, .num_i2c_devs = ARRAY_SIZE(wm1255_devs) }, { .id = 0x3c, .rev = 0xff, .name = "1273-EV1 Longmorn" }, { .id = 0x3d, .rev = 0xff, .name = "1277-EV1 Littlemill", - .i2c_devs = wm1277_devs, .num_i2c_devs = ARRAY_SIZE(wm1277_devs) }, + .i2c_devs = wm1277_devs, .num_i2c_devs = ARRAY_SIZE(wm1277_devs), + .gpiod_table = &wm8994_gpiod_table }, { .id = 0x3e, .rev = 0, .name = "WM5102-6271-EV1-CS127 Amrut", .spi_devs = wm5102_reva_spi_devs, - .num_spi_devs = ARRAY_SIZE(wm5102_reva_spi_devs) }, + .num_spi_devs = ARRAY_SIZE(wm5102_reva_spi_devs), + .gpiod_table = &wm5102_reva_gpiod_table }, { .id = 0x3e, .rev = -1, .name = "WM5102-6271-EV1-CS127 Amrut", .spi_devs = wm5102_spi_devs, - .num_spi_devs = ARRAY_SIZE(wm5102_spi_devs) }, + .num_spi_devs = ARRAY_SIZE(wm5102_spi_devs), + .gpiod_table = &wm5102_gpiod_table }, { .id = 0x3f, .rev = -1, .name = "WM2200-6271-CS90-M-REV1", .i2c_devs = wm2200_i2c, .num_i2c_devs = ARRAY_SIZE(wm2200_i2c) }, }; @@ -408,6 +413,9 @@ static int wlf_gf_module_probe(struct i2c_client *i2c, spi_register_board_info(gf_mods[i].spi_devs, gf_mods[i].num_spi_devs); + + if (gf_mods[i].gpiod_table) + gpiod_add_lookup_table(gf_mods[i].gpiod_table); } else { dev_warn(&i2c->dev, "Unknown module ID 0x%x revision %d\n", id, rev + 1); -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] ARM: s3c64xx: Tidy up handling of regulator GPIO lookups 2019-04-12 7:14 ` Linus Walleij @ 2019-04-12 10:28 ` Krzysztof Kozlowski -1 siblings, 0 replies; 9+ messages in thread From: Krzysztof Kozlowski @ 2019-04-12 10:28 UTC (permalink / raw) To: Linus Walleij Cc: linux-samsung-soc, Charles Keepax, linux-arm-kernel, Bartlomiej Zolnierkiewicz On Fri, 12 Apr 2019 at 09:17, Linus Walleij <linus.walleij@linaro.org> wrote: > > From: Charles Keepax <ckeepax@opensource.cirrus.com> > > Rather than unconditionally registering the GPIO lookup table only do so > for devices that require it. > > Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> > [Fixed up to also handle wm5102 and wm5102 reva] > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > --- > This modified patch from Charles is sitting in one of > my regulator branches. > Krzsystof are you collecting S3C patches? > The MAINATINERS file seems to be lacking an S3C maintainer > currently... Hi, This was never sent before to linux-samsung-soc, nor to me. I am properly listed there: Krzysztof Kozlowski <krzk@kernel.org> (maintainer:ARM/SAMSUNG EXYNOS ARM ARCHITECTURES) linux-samsung-soc@vger.kernel.org (moderated list:ARM/SAMSUNG EXYNOS ARM ARCHITECTURES) And yes - I am collecting these (mach-exynos, mach-s3c, mach-s5p and plat-samsung) I will pick it up. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ARM: s3c64xx: Tidy up handling of regulator GPIO lookups @ 2019-04-12 10:28 ` Krzysztof Kozlowski 0 siblings, 0 replies; 9+ messages in thread From: Krzysztof Kozlowski @ 2019-04-12 10:28 UTC (permalink / raw) To: Linus Walleij Cc: linux-samsung-soc, Charles Keepax, linux-arm-kernel, Bartlomiej Zolnierkiewicz On Fri, 12 Apr 2019 at 09:17, Linus Walleij <linus.walleij@linaro.org> wrote: > > From: Charles Keepax <ckeepax@opensource.cirrus.com> > > Rather than unconditionally registering the GPIO lookup table only do so > for devices that require it. > > Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> > [Fixed up to also handle wm5102 and wm5102 reva] > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > --- > This modified patch from Charles is sitting in one of > my regulator branches. > Krzsystof are you collecting S3C patches? > The MAINATINERS file seems to be lacking an S3C maintainer > currently... Hi, This was never sent before to linux-samsung-soc, nor to me. I am properly listed there: Krzysztof Kozlowski <krzk@kernel.org> (maintainer:ARM/SAMSUNG EXYNOS ARM ARCHITECTURES) linux-samsung-soc@vger.kernel.org (moderated list:ARM/SAMSUNG EXYNOS ARM ARCHITECTURES) And yes - I am collecting these (mach-exynos, mach-s3c, mach-s5p and plat-samsung) I will pick it up. Best regards, Krzysztof _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ARM: s3c64xx: Tidy up handling of regulator GPIO lookups 2019-04-12 7:14 ` Linus Walleij @ 2019-04-14 11:19 ` Krzysztof Kozlowski -1 siblings, 0 replies; 9+ messages in thread From: Krzysztof Kozlowski @ 2019-04-14 11:19 UTC (permalink / raw) To: Linus Walleij Cc: linux-samsung-soc, Charles Keepax, linux-arm-kernel, Bartlomiej Zolnierkiewicz On Fri, Apr 12, 2019 at 09:14:58AM +0200, Linus Walleij wrote: > From: Charles Keepax <ckeepax@opensource.cirrus.com> > > Rather than unconditionally registering the GPIO lookup table only do so > for devices that require it. > > Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> > [Fixed up to also handle wm5102 and wm5102 reva] > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > --- > This modified patch from Charles is sitting in one of > my regulator branches. > Krzsystof are you collecting S3C patches? > The MAINATINERS file seems to be lacking an S3C maintainer > currently... > --- > arch/arm/mach-s3c64xx/mach-crag6410-module.c | 14 +++++++++++--- Thanks, applied. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ARM: s3c64xx: Tidy up handling of regulator GPIO lookups @ 2019-04-14 11:19 ` Krzysztof Kozlowski 0 siblings, 0 replies; 9+ messages in thread From: Krzysztof Kozlowski @ 2019-04-14 11:19 UTC (permalink / raw) To: Linus Walleij Cc: linux-samsung-soc, Charles Keepax, linux-arm-kernel, Bartlomiej Zolnierkiewicz On Fri, Apr 12, 2019 at 09:14:58AM +0200, Linus Walleij wrote: > From: Charles Keepax <ckeepax@opensource.cirrus.com> > > Rather than unconditionally registering the GPIO lookup table only do so > for devices that require it. > > Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> > [Fixed up to also handle wm5102 and wm5102 reva] > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > --- > This modified patch from Charles is sitting in one of > my regulator branches. > Krzsystof are you collecting S3C patches? > The MAINATINERS file seems to be lacking an S3C maintainer > currently... > --- > arch/arm/mach-s3c64xx/mach-crag6410-module.c | 14 +++++++++++--- Thanks, applied. Best regards, Krzysztof _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 00/21] regulator: switch core to GPIO descriptors @ 2018-02-12 13:16 Linus Walleij 2018-02-12 13:17 ` [PATCH 16/21] regulator: wm8994: Pass descriptor instead of GPIO number Linus Walleij 0 siblings, 1 reply; 9+ messages in thread From: Linus Walleij @ 2018-02-12 13:16 UTC (permalink / raw) To: Liam Girdwood, Mark Brown; +Cc: linux-kernel, linux-gpio, Linus Walleij While the regulator core mostly use GPIO descriptors there are some rough edges we need to chisel down: - The fixed regulator still passes a "ena_gpio" number from the global GPIO numberspace. This we want to get rid of. We do this by allowing drivers to pass in a descriptor instead, converting all drivers and platform data over and then only allowing that. - The fixed regulator also has special platform data or device tree properties for handling polarity inversion or open drain. We have pulled these special semantics into gpiolib in commit a603a2b8d86ee93ee2107da8ca75fd854fd4ff32 "gpio: of: Add special quirk to parse regulator flags" so we can now move all drivers over to using only descriptors for this as well. - The GPIO regulator has a similar complicated relationship to the global GPIO numberspace. We have merged helpers and convert these users too. Some drivers needed to get a GPIO from an opaque DT node i.e. a DT node without a corresponding device. For this case we have added devm_gpiod_get_from_of_node() in the v4.16-rc1 kernel so we can proceed with the conversion. I have tried to loop in maintainers of the board files affected as much as I can. It is uncertain if they even care in some cases, with some PalmPilot-PDA-type ARM devices I'm really starting to wonder if they are really maintained and tested anymore, but I've still done my best to not accidentally break them. The patches can also be grabbed from this branch: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/log/?h=gpio-descriptors-regulator I.e. git pull git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git gpio-descriptors-regulator to test it with any pet system. Some ACKs and Tested-by's would be nice! I really don't want to break anything if I can avoid it. All patches have been boiled through the zeroday build system so at least everything builds, but runtime testing is paramount. Linus Walleij (21): regulator: core: Support passing an initialized GPIO enable descriptor regulator: fixed: Convert to use GPIO descriptor only regulator: gpio: Get enable GPIO using GPIO descriptor regulator: da9055: Pass descriptor instead of GPIO number regulator: arizona-ldo1: Look up a descriptor and pass to the core regulator: da9211: Pass descriptors instead of GPIO numbers regulator: max8973: Pass descriptor instead of GPIO number regulator: max77686: Pass descriptor instead of GPIO number regulator: lm363x: Pass descriptor instead of GPIO number regulator: lp8788-ldo: Pass descriptor instead of GPIO number regulator: max8952: Pass descriptor instead of GPIO number regulator: pfuze100: Delete reference to ena_gpio regulator: s2mps11: Pass descriptor instead of GPIO number regulator: s5m8767: Pass descriptor instead of GPIO number regulator: tps65090: Pass descriptor instead of GPIO number regulator: wm8994: Pass descriptor instead of GPIO number regulator: core: Only support passing enable GPIO descriptors regulator: fixed/gpio: Pull inversion/OD into gpiolib regulator: fixed/gpio: Update device tree bindings regulator: gpio: Convert to fully use descriptors regulator: gpio: Simplify probe path .../bindings/regulator/fixed-regulator.txt | 13 +- .../bindings/regulator/gpio-regulator.txt | 4 + arch/arm/mach-imx/mach-mx21ads.c | 14 +- arch/arm/mach-imx/mach-mx27ads.c | 12 +- arch/arm/mach-mmp/brownstone.c | 13 +- arch/arm/mach-omap1/board-ams-delta.c | 15 +- arch/arm/mach-omap2/pdata-quirks.c | 17 +- arch/arm/mach-pxa/em-x270.c | 2 - arch/arm/mach-pxa/ezx.c | 34 ++-- arch/arm/mach-pxa/hx4700.c | 23 ++- arch/arm/mach-pxa/magician.c | 25 ++- arch/arm/mach-pxa/raumfeld.c | 13 +- arch/arm/mach-pxa/zeus.c | 24 ++- arch/arm/mach-s3c64xx/mach-crag6410-module.c | 18 +- arch/arm/mach-s3c64xx/mach-crag6410.c | 1 - arch/arm/mach-s3c64xx/mach-smdk6410.c | 1 - arch/blackfin/mach-bf537/boards/stamp.c | 15 +- arch/sh/boards/mach-ecovec24/setup.c | 29 +++- .../intel-mid/device_libs/platform_bcm43xx.c | 20 ++- drivers/mfd/wm8994-core.c | 9 - drivers/regulator/arizona-ldo1.c | 19 +- drivers/regulator/core.c | 33 +--- drivers/regulator/da9055-regulator.c | 5 +- drivers/regulator/da9211-regulator.c | 23 ++- drivers/regulator/fixed-helper.c | 1 - drivers/regulator/fixed.c | 43 ++--- drivers/regulator/gpio-regulator.c | 193 ++++++++------------- drivers/regulator/lm363x-regulator.c | 20 +-- drivers/regulator/lp8788-ldo.c | 32 ++-- drivers/regulator/max77686-regulator.c | 19 +- drivers/regulator/max8952.c | 18 +- drivers/regulator/max8973-regulator.c | 54 +++--- drivers/regulator/pfuze100-regulator.c | 1 - drivers/regulator/s2mps11.c | 46 ++--- drivers/regulator/s5m8767.c | 26 +-- drivers/regulator/tps65090-regulator.c | 50 +++--- drivers/regulator/wm8994-regulator.c | 19 +- include/linux/mfd/da9055/pdata.h | 5 +- include/linux/mfd/lp8788.h | 16 -- include/linux/mfd/samsung/core.h | 4 +- include/linux/mfd/tps65090.h | 8 +- include/linux/mfd/wm8994/pdata.h | 3 - include/linux/regulator/arizona-ldo1.h | 3 - include/linux/regulator/da9211.h | 4 +- include/linux/regulator/driver.h | 11 +- include/linux/regulator/fixed.h | 13 -- include/linux/regulator/gpio-regulator.h | 18 +- include/linux/regulator/max8952.h | 1 - 48 files changed, 519 insertions(+), 471 deletions(-) -- 2.14.3 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 16/21] regulator: wm8994: Pass descriptor instead of GPIO number 2018-02-12 13:16 [PATCH 00/21] regulator: switch core to GPIO descriptors Linus Walleij @ 2018-02-12 13:17 ` Linus Walleij 2018-02-13 11:11 ` Charles Keepax 0 siblings, 1 reply; 9+ messages in thread From: Linus Walleij @ 2018-02-12 13:17 UTC (permalink / raw) To: Liam Girdwood, Mark Brown Cc: linux-kernel, linux-gpio, Linus Walleij, patches, Charles Keepax, Lee Jones 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@opensource.cirrus.com Cc: Charles Keepax <ckeepax@opensource.cirrus.com> Cc: Lee Jones <lee.jones@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- 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(-) diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c index f00988705408..a4db97f156d7 100644 --- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c +++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c @@ -9,6 +9,7 @@ #include <linux/interrupt.h> #include <linux/i2c.h> #include <linux/spi/spi.h> +#include <linux/gpio/machine.h> #include <linux/mfd/wm831x/irq.h> #include <linux/mfd/wm831x/gpio.h> @@ -193,8 +194,8 @@ static struct wm8994_pdata wm8994_pdata = { 0x3, /* IRQ out, active high, CMOS */ }, .ldo = { - { .enable = S3C64XX_GPN(6), .init_data = &wm8994_ldo1, }, - { .enable = S3C64XX_GPN(4), .init_data = &wm8994_ldo2, }, + { .init_data = &wm8994_ldo1, }, + { .init_data = &wm8994_ldo2, }, }, }; @@ -202,6 +203,18 @@ static const struct i2c_board_info wm1277_devs[] = { { I2C_BOARD_INFO("wm8958", 0x1a), /* WM8958 is the superset */ .platform_data = &wm8994_pdata, .irq = GLENFARCLAS_PMIC_IRQ_BASE + WM831X_IRQ_GPIO_2, + .dev_name = "wm8958", + }, +}; + +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); if (i < ARRAY_SIZE(gf_mods)) { dev_info(&i2c->dev, "%s revision %d\n", gf_mods[i].name, rev + 1); diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 953d0790ffd5..c409464231f6 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c @@ -21,7 +21,6 @@ #include <linux/mfd/core.h> #include <linux/of.h> #include <linux/of_device.h> -#include <linux/of_gpio.h> #include <linux/pm_runtime.h> #include <linux/regmap.h> #include <linux/regulator/consumer.h> @@ -302,14 +301,6 @@ static int wm8994_set_pdata_from_of(struct wm8994 *wm8994) if (of_find_property(np, "wlf,ldoena-always-driven", NULL)) pdata->lineout2fb = true; - pdata->ldo[0].enable = of_get_named_gpio(np, "wlf,ldo1ena", 0); - if (pdata->ldo[0].enable < 0) - pdata->ldo[0].enable = 0; - - pdata->ldo[1].enable = of_get_named_gpio(np, "wlf,ldo2ena", 0); - if (pdata->ldo[1].enable < 0) - pdata->ldo[1].enable = 0; - return 0; } #else diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c index 7a4ce6df4f22..d3a5f48119c2 100644 --- a/drivers/regulator/wm8994-regulator.c +++ b/drivers/regulator/wm8994-regulator.c @@ -19,7 +19,7 @@ #include <linux/platform_device.h> #include <linux/regulator/driver.h> #include <linux/regulator/machine.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/slab.h> #include <linux/mfd/wm8994/core.h> @@ -129,6 +129,7 @@ static int wm8994_ldo_probe(struct platform_device *pdev) int id = pdev->id % ARRAY_SIZE(pdata->ldo); struct regulator_config config = { }; struct wm8994_ldo *ldo; + struct gpio_desc *gpiod; int ret; dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); @@ -145,12 +146,14 @@ static int wm8994_ldo_probe(struct platform_device *pdev) config.driver_data = ldo; config.regmap = wm8994->regmap; config.init_data = &ldo->init_data; - if (pdata) { - config.ena_gpio = pdata->ldo[id].enable; - } else if (wm8994->dev->of_node) { - config.ena_gpio = wm8994->pdata.ldo[id].enable; - config.ena_gpio_initialized = true; - } + + /* Look up LDO enable GPIO from the parent device node */ + gpiod = devm_gpiod_get_optional(pdev->dev.parent, + id ? "wlf,ldo2ena" : "wlf,ldo1ena", + GPIOD_OUT_LOW); + if (IS_ERR(gpiod)) + return PTR_ERR(gpiod); + config.ena_gpiod = gpiod; /* Use default constraints if none set up */ if (!pdata || !pdata->ldo[id].init_data || wm8994->dev->of_node) { @@ -159,7 +162,7 @@ static int wm8994_ldo_probe(struct platform_device *pdev) ldo->init_data = wm8994_ldo_default[id]; ldo->init_data.consumer_supplies = &ldo->supply; - if (!config.ena_gpio) + if (!gpiod) ldo->init_data.constraints.valid_ops_mask = 0; } else { ldo->init_data = *pdata->ldo[id].init_data; diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h index 90c60524a496..fca67bd194e2 100644 --- a/include/linux/mfd/wm8994/pdata.h +++ b/include/linux/mfd/wm8994/pdata.h @@ -20,9 +20,6 @@ #define WM8994_NUM_AIF 3 struct wm8994_ldo_pdata { - /** GPIOs to enable regulator, 0 or less if not available */ - int enable; - const struct regulator_init_data *init_data; }; -- 2.14.3 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 16/21] regulator: wm8994: Pass descriptor instead of GPIO number 2018-02-12 13:17 ` [PATCH 16/21] regulator: wm8994: Pass descriptor instead of GPIO number Linus Walleij @ 2018-02-13 11:11 ` Charles Keepax 2018-04-19 13:55 ` Linus Walleij 0 siblings, 1 reply; 9+ messages in thread From: Charles Keepax @ 2018-02-13 11:11 UTC (permalink / raw) To: Linus Walleij Cc: Liam Girdwood, Mark Brown, linux-kernel, linux-gpio, patches, Lee Jones 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@opensource.cirrus.com > Cc: Charles Keepax <ckeepax@opensource.cirrus.com> > Cc: Lee Jones <lee.jones@linaro.org> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > --- > 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 16/21] regulator: wm8994: Pass descriptor instead of GPIO number 2018-02-13 11:11 ` Charles Keepax @ 2018-04-19 13:55 ` Linus Walleij 2018-04-19 15:01 ` Charles Keepax 0 siblings, 1 reply; 9+ messages in thread From: Linus Walleij @ 2018-04-19 13:55 UTC (permalink / raw) To: Charles Keepax Cc: Liam Girdwood, Mark Brown, linux-kernel, open list:GPIO SUBSYSTEM, patches, Lee Jones On Tue, Feb 13, 2018 at 12:11 PM, Charles Keepax <ckeepax@opensource.cirrus.com> wrote: >> +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? There is a lot of stuff that would be nice, but currently I'm almost breaking my back over these refactorings, so I would prefer to take one thing per patch, cleanups can be done later. I am also hesitant to do any unnecessary infrastructure changes as I cannot test anything (don't have this system). > Since eventually we will need tables > for wm5102, wm8994, wm2200, wm8996, wm5100 and wm0010. Just wm5102 and wm8994 this time, because only those drivers pass an enable GPIO to the regulator core. The wm2200 for example is just managing the LDO without the use of the regulator framework (I guess this is technically incorrect). I am only trying to fix the regulators right now, fixing all GPIOs in the kernel tree to use descriptors is something I might have time to accomplish before I retire. > Likewise here the DT bindings for these parts have no -gpio > suffix on them so this will break the DT case. This is solved in the GPIO OF core as mentioned before. I will put a pointer in the commit message. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] ARM: s3c64xx: Tidy up handling of regulator GPIO lookups 2018-04-19 13:55 ` Linus Walleij @ 2018-04-19 15:01 ` Charles Keepax 0 siblings, 0 replies; 9+ messages in thread From: Charles Keepax @ 2018-04-19 15:01 UTC (permalink / raw) To: Linus Walleij Cc: Liam Girdwood, Mark Brown, linux-kernel, open list:GPIO SUBSYSTEM, patches, Lee Jones From: Charles Keepax <ckeepax@opensource.cirrus.com> Rather than unconditionally registering the GPIO lookup table only do so for devices that require it. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> --- Do you have any objections to the following? If we are lucky I might be able to find time to test these early next week. Well at least there is reasonable chance I can test the 5102 stuff when you resend, not sure I have a device to test the wm1277 but will have a look. Also I haven't run up Cragganmore in a little while so might depend a little on how much people have broken it since last I did :-) Thanks, Charles arch/arm/mach-s3c64xx/mach-crag6410-module.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c index a4db97f156d78..883907fb38e28 100644 --- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c +++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c @@ -316,6 +316,8 @@ static const struct { int num_i2c_devs; const struct spi_board_info *spi_devs; int num_spi_devs; + + struct gpiod_lookup_table *gpiod_table; } gf_mods[] = { { .id = 0x01, .rev = 0xff, .name = "1250-EV1 Springbank" }, { .id = 0x02, .rev = 0xff, .name = "1251-EV1 Jura" }, @@ -350,7 +352,8 @@ static const struct { .i2c_devs = wm1255_devs, .num_i2c_devs = ARRAY_SIZE(wm1255_devs) }, { .id = 0x3c, .rev = 0xff, .name = "1273-EV1 Longmorn" }, { .id = 0x3d, .rev = 0xff, .name = "1277-EV1 Littlemill", - .i2c_devs = wm1277_devs, .num_i2c_devs = ARRAY_SIZE(wm1277_devs) }, + .i2c_devs = wm1277_devs, .num_i2c_devs = ARRAY_SIZE(wm1277_devs), + .gpiod_table = &wm8994_gpiod_table }, { .id = 0x3e, .rev = 0, .name = "WM5102-6271-EV1-CS127 Amrut", .spi_devs = wm5102_reva_spi_devs, .num_spi_devs = ARRAY_SIZE(wm5102_reva_spi_devs) }, @@ -379,7 +382,6 @@ static int wlf_gf_module_probe(struct i2c_client *i2c, rev == gf_mods[i].rev)) break; - gpiod_add_lookup_table(&wm8994_gpiod_table); if (i < ARRAY_SIZE(gf_mods)) { dev_info(&i2c->dev, "%s revision %d\n", gf_mods[i].name, rev + 1); @@ -393,6 +395,9 @@ static int wlf_gf_module_probe(struct i2c_client *i2c, spi_register_board_info(gf_mods[i].spi_devs, gf_mods[i].num_spi_devs); + + if (gf_mods[i].gpiod_table) + gpiod_add_lookup_table(gf_mods[i].gpiod_table); } else { dev_warn(&i2c->dev, "Unknown module ID 0x%x revision %d\n", id, rev + 1); -- 2.11.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] ARM: s3c64xx: Tidy up handling of regulator GPIO lookups @ 2018-04-19 15:01 ` Charles Keepax 0 siblings, 0 replies; 9+ messages in thread From: Charles Keepax @ 2018-04-19 15:01 UTC (permalink / raw) To: Linus Walleij Cc: Liam Girdwood, Mark Brown, linux-kernel, open list:GPIO SUBSYSTEM, patches, Lee Jones From: Charles Keepax <ckeepax@opensource.cirrus.com> Rather than unconditionally registering the GPIO lookup table only do so for devices that require it. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> --- Do you have any objections to the following? If we are lucky I might be able to find time to test these early next week. Well at least there is reasonable chance I can test the 5102 stuff when you resend, not sure I have a device to test the wm1277 but will have a look. Also I haven't run up Cragganmore in a little while so might depend a little on how much people have broken it since last I did :-) Thanks, Charles arch/arm/mach-s3c64xx/mach-crag6410-module.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c index a4db97f156d78..883907fb38e28 100644 --- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c +++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c @@ -316,6 +316,8 @@ static const struct { int num_i2c_devs; const struct spi_board_info *spi_devs; int num_spi_devs; + + struct gpiod_lookup_table *gpiod_table; } gf_mods[] = { { .id = 0x01, .rev = 0xff, .name = "1250-EV1 Springbank" }, { .id = 0x02, .rev = 0xff, .name = "1251-EV1 Jura" }, @@ -350,7 +352,8 @@ static const struct { .i2c_devs = wm1255_devs, .num_i2c_devs = ARRAY_SIZE(wm1255_devs) }, { .id = 0x3c, .rev = 0xff, .name = "1273-EV1 Longmorn" }, { .id = 0x3d, .rev = 0xff, .name = "1277-EV1 Littlemill", - .i2c_devs = wm1277_devs, .num_i2c_devs = ARRAY_SIZE(wm1277_devs) }, + .i2c_devs = wm1277_devs, .num_i2c_devs = ARRAY_SIZE(wm1277_devs), + .gpiod_table = &wm8994_gpiod_table }, { .id = 0x3e, .rev = 0, .name = "WM5102-6271-EV1-CS127 Amrut", .spi_devs = wm5102_reva_spi_devs, .num_spi_devs = ARRAY_SIZE(wm5102_reva_spi_devs) }, @@ -379,7 +382,6 @@ static int wlf_gf_module_probe(struct i2c_client *i2c, rev == gf_mods[i].rev)) break; - gpiod_add_lookup_table(&wm8994_gpiod_table); if (i < ARRAY_SIZE(gf_mods)) { dev_info(&i2c->dev, "%s revision %d\n", gf_mods[i].name, rev + 1); @@ -393,6 +395,9 @@ static int wlf_gf_module_probe(struct i2c_client *i2c, spi_register_board_info(gf_mods[i].spi_devs, gf_mods[i].num_spi_devs); + + if (gf_mods[i].gpiod_table) + gpiod_add_lookup_table(gf_mods[i].gpiod_table); } else { dev_warn(&i2c->dev, "Unknown module ID 0x%x revision %d\n", id, rev + 1); -- 2.11.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] ARM: s3c64xx: Tidy up handling of regulator GPIO lookups 2018-04-19 15:01 ` Charles Keepax (?) @ 2018-05-14 5:54 ` Linus Walleij -1 siblings, 0 replies; 9+ messages in thread From: Linus Walleij @ 2018-05-14 5:54 UTC (permalink / raw) To: Charles Keepax Cc: Liam Girdwood, Mark Brown, linux-kernel, open list:GPIO SUBSYSTEM, patches, Lee Jones On Thu, Apr 19, 2018 at 5:01 PM, Charles Keepax <ckeepax@opensource.cirrus.com> wrote: > From: Charles Keepax <ckeepax@opensource.cirrus.com> > > Rather than unconditionally registering the GPIO lookup table only do so > for devices that require it. > > Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> > --- > > Do you have any objections to the following? > > If we are lucky I might be able to find time to test these early > next week. Well at least there is reasonable chance I can test > the 5102 stuff when you resend, not sure I have a device to > test the wm1277 but will have a look. Also I haven't run up > Cragganmore in a little while so might depend a little on how > much people have broken it since last I did :-) I folded this in on top of my series, also adding the table entries for wm5102 and wm5102 reva. Sorry for the delay, I was sidetracked... Yours, Linus Walleij ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-04-14 11:20 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-04-12 7:14 [PATCH] ARM: s3c64xx: Tidy up handling of regulator GPIO lookups Linus Walleij 2019-04-12 7:14 ` Linus Walleij 2019-04-12 10:28 ` Krzysztof Kozlowski 2019-04-12 10:28 ` Krzysztof Kozlowski 2019-04-14 11:19 ` Krzysztof Kozlowski 2019-04-14 11:19 ` Krzysztof Kozlowski -- strict thread matches above, loose matches on Subject: below -- 2018-02-12 13:16 [PATCH 00/21] regulator: switch core to GPIO descriptors Linus Walleij 2018-02-12 13:17 ` [PATCH 16/21] regulator: wm8994: Pass descriptor instead of GPIO number Linus Walleij 2018-02-13 11:11 ` Charles Keepax 2018-04-19 13:55 ` Linus Walleij 2018-04-19 15:01 ` [PATCH] ARM: s3c64xx: Tidy up handling of regulator GPIO lookups Charles Keepax 2018-04-19 15:01 ` Charles Keepax 2018-05-14 5:54 ` Linus Walleij
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.