ARM: s3c64xx: Tidy up handling of regulator GPIO lookups
diff mbox series

Message ID 20180419150119.5yhf3uupdolg3cnv@localhost.localdomain
State New
Headers show
Series
  • ARM: s3c64xx: Tidy up handling of regulator GPIO lookups
Related show

Commit Message

Charles Keepax April 19, 2018, 3:01 p.m. UTC
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(-)

Comments

Linus Walleij May 14, 2018, 5:54 a.m. UTC | #1
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
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox series

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);