aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2018-06-07 09:10:56 -0400
committerMark Brown <broonie@kernel.org>2018-06-07 09:23:08 -0400
commite536700ef5bf9788af185bf890a52f296d055ed7 (patch)
tree09eb6373a71e194036e2b773b3ece710bda24864
parent2b6c00c157c5bf80417f6b814f1088da2dc588ee (diff)
regulator: gpio: Revert
regulator: fixed/gpio: Revert GPIO descriptor changes due to platform breakage Commit 6059577cb28 "regulator: fixed: Convert to use GPIO descriptor only" broke at least the ams-delta platform since the lookup tables added to the board files use the function name "enable" while the driver uses NULL causing the regulator to not acquire and control the enable GPIOs. Revert that and a couple of other commits that are caught up with it to fix the issue: 2b6c00c157c5bf80 "ARM: pxa, regulator: fix building ezx e680" 6059577cb28d8b15 "regulator: fixed: Convert to use GPIO descriptor only" 37bed97f00734ce3 "regulator: gpio: Get enable GPIO using GPIO descriptor" Reported-by: Janusz Krzysztofik <jmkrzyszt@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--arch/arm/mach-imx/mach-mx21ads.c13
-rw-r--r--arch/arm/mach-imx/mach-mx27ads.c12
-rw-r--r--arch/arm/mach-mmp/brownstone.c12
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c14
-rw-r--r--arch/arm/mach-omap2/pdata-quirks.c16
-rw-r--r--arch/arm/mach-pxa/em-x270.c1
-rw-r--r--arch/arm/mach-pxa/ezx.c33
-rw-r--r--arch/arm/mach-pxa/hx4700.c12
-rw-r--r--arch/arm/mach-pxa/magician.c13
-rw-r--r--arch/arm/mach-pxa/raumfeld.c12
-rw-r--r--arch/arm/mach-pxa/zeus.c23
-rw-r--r--arch/arm/mach-s3c64xx/mach-crag6410.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-smdk6410.c1
-rw-r--r--arch/arm/mach-sa1100/assabet.c21
-rw-r--r--arch/arm/mach-sa1100/generic.c5
-rw-r--r--arch/arm/mach-sa1100/generic.h3
-rw-r--r--arch/arm/mach-sa1100/shannon.c4
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c22
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_bcm43xx.c17
-rw-r--r--drivers/regulator/fixed-helper.c1
-rw-r--r--drivers/regulator/fixed.c33
-rw-r--r--drivers/regulator/gpio-regulator.c23
-rw-r--r--include/linux/regulator/fixed.h3
-rw-r--r--include/linux/regulator/gpio-regulator.h3
24 files changed, 79 insertions, 219 deletions
diff --git a/arch/arm/mach-imx/mach-mx21ads.c b/arch/arm/mach-imx/mach-mx21ads.c
index 5d3b6b4fe6db..5e366824814f 100644
--- a/arch/arm/mach-imx/mach-mx21ads.c
+++ b/arch/arm/mach-imx/mach-mx21ads.c
@@ -18,7 +18,6 @@
18#include <linux/mtd/mtd.h> 18#include <linux/mtd/mtd.h>
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/gpio/driver.h> 20#include <linux/gpio/driver.h>
21#include <linux/gpio/machine.h>
22#include <linux/gpio.h> 21#include <linux/gpio.h>
23#include <linux/regulator/fixed.h> 22#include <linux/regulator/fixed.h>
24#include <linux/regulator/machine.h> 23#include <linux/regulator/machine.h>
@@ -176,7 +175,6 @@ static struct resource mx21ads_mmgpio_resource =
176 DEFINE_RES_MEM_NAMED(MX21ADS_IO_REG, SZ_2, "dat"); 175 DEFINE_RES_MEM_NAMED(MX21ADS_IO_REG, SZ_2, "dat");
177 176
178static struct bgpio_pdata mx21ads_mmgpio_pdata = { 177static struct bgpio_pdata mx21ads_mmgpio_pdata = {
179 .label = "mx21ads-mmgpio",
180 .base = MX21ADS_MMGPIO_BASE, 178 .base = MX21ADS_MMGPIO_BASE,
181 .ngpio = 16, 179 .ngpio = 16,
182}; 180};
@@ -205,6 +203,7 @@ static struct regulator_init_data mx21ads_lcd_regulator_init_data = {
205static struct fixed_voltage_config mx21ads_lcd_regulator_pdata = { 203static struct fixed_voltage_config mx21ads_lcd_regulator_pdata = {
206 .supply_name = "LCD", 204 .supply_name = "LCD",
207 .microvolts = 3300000, 205 .microvolts = 3300000,
206 .gpio = MX21ADS_IO_LCDON,
208 .enable_high = 1, 207 .enable_high = 1,
209 .init_data = &mx21ads_lcd_regulator_init_data, 208 .init_data = &mx21ads_lcd_regulator_init_data,
210}; 209};
@@ -217,15 +216,6 @@ static struct platform_device mx21ads_lcd_regulator = {
217 }, 216 },
218}; 217};
219 218
220static struct gpiod_lookup_table mx21ads_lcd_regulator_gpiod_table = {
221 .dev_id = "reg-fixed-voltage.0", /* Let's hope ID 0 is what we get */
222 .table = {
223 GPIO_LOOKUP("mx21ads-mmgpio", 9,
224 "enable", GPIO_ACTIVE_HIGH),
225 { },
226 },
227};
228
229/* 219/*
230 * Connected is a portrait Sharp-QVGA display 220 * Connected is a portrait Sharp-QVGA display
231 * of type: LQ035Q7DB02 221 * of type: LQ035Q7DB02
@@ -321,7 +311,6 @@ static void __init mx21ads_late_init(void)
321{ 311{
322 imx21_add_mxc_mmc(0, &mx21ads_sdhc_pdata); 312 imx21_add_mxc_mmc(0, &mx21ads_sdhc_pdata);
323 313
324 gpiod_add_lookup_table(&mx21ads_lcd_regulator_gpiod_table);
325 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 314 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
326 315
327 mx21ads_cs8900_resources[1].start = 316 mx21ads_cs8900_resources[1].start =
diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c
index 0fdb88db0cbd..a04bb094ded1 100644
--- a/arch/arm/mach-imx/mach-mx27ads.c
+++ b/arch/arm/mach-imx/mach-mx27ads.c
@@ -16,7 +16,6 @@
16#include <linux/gpio/driver.h> 16#include <linux/gpio/driver.h>
17/* Needed for gpio_to_irq() */ 17/* Needed for gpio_to_irq() */
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/gpio/machine.h>
20#include <linux/platform_device.h> 19#include <linux/platform_device.h>
21#include <linux/mtd/mtd.h> 20#include <linux/mtd/mtd.h>
22#include <linux/mtd/map.h> 21#include <linux/mtd/map.h>
@@ -231,17 +230,10 @@ static struct regulator_init_data mx27ads_lcd_regulator_init_data = {
231static struct fixed_voltage_config mx27ads_lcd_regulator_pdata = { 230static struct fixed_voltage_config mx27ads_lcd_regulator_pdata = {
232 .supply_name = "LCD", 231 .supply_name = "LCD",
233 .microvolts = 3300000, 232 .microvolts = 3300000,
233 .gpio = MX27ADS_LCD_GPIO,
234 .init_data = &mx27ads_lcd_regulator_init_data, 234 .init_data = &mx27ads_lcd_regulator_init_data,
235}; 235};
236 236
237static struct gpiod_lookup_table mx27ads_lcd_regulator_gpiod_table = {
238 .dev_id = "reg-fixed-voltage.0", /* Let's hope ID 0 is what we get */
239 .table = {
240 GPIO_LOOKUP("LCD", 0, "enable", GPIO_ACTIVE_HIGH),
241 { },
242 },
243};
244
245static void __init mx27ads_regulator_init(void) 237static void __init mx27ads_regulator_init(void)
246{ 238{
247 struct gpio_chip *vchip; 239 struct gpio_chip *vchip;
@@ -255,8 +247,6 @@ static void __init mx27ads_regulator_init(void)
255 vchip->set = vgpio_set; 247 vchip->set = vgpio_set;
256 gpiochip_add_data(vchip, NULL); 248 gpiochip_add_data(vchip, NULL);
257 249
258 gpiod_add_lookup_table(&mx27ads_lcd_regulator_gpiod_table);
259
260 platform_device_register_data(NULL, "reg-fixed-voltage", 250 platform_device_register_data(NULL, "reg-fixed-voltage",
261 PLATFORM_DEVID_AUTO, 251 PLATFORM_DEVID_AUTO,
262 &mx27ads_lcd_regulator_pdata, 252 &mx27ads_lcd_regulator_pdata,
diff --git a/arch/arm/mach-mmp/brownstone.c b/arch/arm/mach-mmp/brownstone.c
index 563b5a278d65..d1613b954926 100644
--- a/arch/arm/mach-mmp/brownstone.c
+++ b/arch/arm/mach-mmp/brownstone.c
@@ -15,7 +15,6 @@
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/gpio-pxa.h> 17#include <linux/gpio-pxa.h>
18#include <linux/gpio/machine.h>
19#include <linux/regulator/machine.h> 18#include <linux/regulator/machine.h>
20#include <linux/regulator/max8649.h> 19#include <linux/regulator/max8649.h>
21#include <linux/regulator/fixed.h> 20#include <linux/regulator/fixed.h>
@@ -149,6 +148,7 @@ static struct regulator_init_data brownstone_v_5vp_data = {
149static struct fixed_voltage_config brownstone_v_5vp = { 148static struct fixed_voltage_config brownstone_v_5vp = {
150 .supply_name = "v_5vp", 149 .supply_name = "v_5vp",
151 .microvolts = 5000000, 150 .microvolts = 5000000,
151 .gpio = GPIO_5V_ENABLE,
152 .enable_high = 1, 152 .enable_high = 1,
153 .enabled_at_boot = 1, 153 .enabled_at_boot = 1,
154 .init_data = &brownstone_v_5vp_data, 154 .init_data = &brownstone_v_5vp_data,
@@ -162,15 +162,6 @@ static struct platform_device brownstone_v_5vp_device = {
162 }, 162 },
163}; 163};
164 164
165static struct gpiod_lookup_table brownstone_v_5vp_gpiod_table = {
166 .dev_id = "reg-fixed-voltage.1", /* .id set to 1 above */
167 .table = {
168 GPIO_LOOKUP("gpio-pxa", GPIO_5V_ENABLE,
169 "enable", GPIO_ACTIVE_HIGH),
170 { },
171 },
172};
173
174static struct max8925_platform_data brownstone_max8925_info = { 165static struct max8925_platform_data brownstone_max8925_info = {
175 .irq_base = MMP_NR_IRQS, 166 .irq_base = MMP_NR_IRQS,
176}; 167};
@@ -226,7 +217,6 @@ static void __init brownstone_init(void)
226 mmp2_add_isram(&mmp2_isram_platdata); 217 mmp2_add_isram(&mmp2_isram_platdata);
227 218
228 /* enable 5v regulator */ 219 /* enable 5v regulator */
229 gpiod_add_lookup_table(&brownstone_v_5vp_gpiod_table);
230 platform_device_register(&brownstone_v_5vp_device); 220 platform_device_register(&brownstone_v_5vp_device);
231} 221}
232 222
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 759fa18f6ab4..52e8e53ca154 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -12,7 +12,6 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14#include <linux/gpio/driver.h> 14#include <linux/gpio/driver.h>
15#include <linux/gpio/machine.h>
16#include <linux/gpio.h> 15#include <linux/gpio.h>
17#include <linux/kernel.h> 16#include <linux/kernel.h>
18#include <linux/init.h> 17#include <linux/init.h>
@@ -204,7 +203,6 @@ static struct resource latch2_resources[] = {
204}; 203};
205 204
206static struct bgpio_pdata latch2_pdata = { 205static struct bgpio_pdata latch2_pdata = {
207 .label = "ams-delta-latch2",
208 .base = AMS_DELTA_LATCH2_GPIO_BASE, 206 .base = AMS_DELTA_LATCH2_GPIO_BASE,
209 .ngpio = AMS_DELTA_LATCH2_NGPIO, 207 .ngpio = AMS_DELTA_LATCH2_NGPIO,
210}; 208};
@@ -274,6 +272,7 @@ static struct regulator_init_data modem_nreset_data = {
274static struct fixed_voltage_config modem_nreset_config = { 272static struct fixed_voltage_config modem_nreset_config = {
275 .supply_name = "modem_nreset", 273 .supply_name = "modem_nreset",
276 .microvolts = 3300000, 274 .microvolts = 3300000,
275 .gpio = AMS_DELTA_GPIO_PIN_MODEM_NRESET,
277 .startup_delay = 25000, 276 .startup_delay = 25000,
278 .enable_high = 1, 277 .enable_high = 1,
279 .enabled_at_boot = 1, 278 .enabled_at_boot = 1,
@@ -288,16 +287,6 @@ static struct platform_device modem_nreset_device = {
288 }, 287 },
289}; 288};
290 289
291static struct gpiod_lookup_table modem_nreset_gpiod_table = {
292 .dev_id = "reg-fixed-voltage",
293 .table = {
294 /* The AMS_DELTA_GPIO_PIN_MODEM_NRESET is at offset 12 */
295 GPIO_LOOKUP("ams-delta-latch2", 12,
296 "enable", GPIO_ACTIVE_HIGH),
297 { },
298 },
299};
300
301struct modem_private_data { 290struct modem_private_data {
302 struct regulator *regulator; 291 struct regulator *regulator;
303}; 292};
@@ -581,7 +570,6 @@ static int __init late_init(void)
581 570
582 platform_add_devices(late_devices, ARRAY_SIZE(late_devices)); 571 platform_add_devices(late_devices, ARRAY_SIZE(late_devices));
583 572
584 gpiod_add_lookup_table(&modem_nreset_gpiod_table);
585 err = platform_device_register(&modem_nreset_device); 573 err = platform_device_register(&modem_nreset_device);
586 if (err) { 574 if (err) {
587 pr_err("Couldn't register the modem regulator device\n"); 575 pr_err("Couldn't register the modem regulator device\n");
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index 7d1447204fb8..6459816c2879 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -10,7 +10,6 @@
10#include <linux/clk.h> 10#include <linux/clk.h>
11#include <linux/davinci_emac.h> 11#include <linux/davinci_emac.h>
12#include <linux/gpio.h> 12#include <linux/gpio.h>
13#include <linux/gpio/machine.h>
14#include <linux/init.h> 13#include <linux/init.h>
15#include <linux/kernel.h> 14#include <linux/kernel.h>
16#include <linux/of_platform.h> 15#include <linux/of_platform.h>
@@ -331,6 +330,7 @@ static struct regulator_init_data pandora_vmmc3 = {
331static struct fixed_voltage_config pandora_vwlan = { 330static struct fixed_voltage_config pandora_vwlan = {
332 .supply_name = "vwlan", 331 .supply_name = "vwlan",
333 .microvolts = 1800000, /* 1.8V */ 332 .microvolts = 1800000, /* 1.8V */
333 .gpio = PANDORA_WIFI_NRESET_GPIO,
334 .startup_delay = 50000, /* 50ms */ 334 .startup_delay = 50000, /* 50ms */
335 .enable_high = 1, 335 .enable_high = 1,
336 .init_data = &pandora_vmmc3, 336 .init_data = &pandora_vmmc3,
@@ -344,19 +344,6 @@ static struct platform_device pandora_vwlan_device = {
344 }, 344 },
345}; 345};
346 346
347static struct gpiod_lookup_table pandora_vwlan_gpiod_table = {
348 .dev_id = "reg-fixed-voltage.1",
349 .table = {
350 /*
351 * As this is a low GPIO number it should be at the first
352 * GPIO bank.
353 */
354 GPIO_LOOKUP("gpio-0-31", PANDORA_WIFI_NRESET_GPIO,
355 "enable", GPIO_ACTIVE_HIGH),
356 { },
357 },
358};
359
360static void pandora_wl1251_init_card(struct mmc_card *card) 347static void pandora_wl1251_init_card(struct mmc_card *card)
361{ 348{
362 /* 349 /*
@@ -418,7 +405,6 @@ fail:
418static void __init omap3_pandora_legacy_init(void) 405static void __init omap3_pandora_legacy_init(void)
419{ 406{
420 platform_device_register(&pandora_backlight); 407 platform_device_register(&pandora_backlight);
421 gpiod_add_lookup_table(&pandora_vwlan_gpiod_table);
422 platform_device_register(&pandora_vwlan_device); 408 platform_device_register(&pandora_vwlan_device);
423 omap_hsmmc_init(pandora_mmc3); 409 omap_hsmmc_init(pandora_mmc3);
424 omap_hsmmc_late_init(pandora_mmc3); 410 omap_hsmmc_late_init(pandora_mmc3);
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index 6d7d93981098..49022ad338e9 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -987,6 +987,7 @@ static struct fixed_voltage_config camera_dummy_config = {
987 .supply_name = "camera_vdd", 987 .supply_name = "camera_vdd",
988 .input_supply = "vcc cam", 988 .input_supply = "vcc cam",
989 .microvolts = 2800000, 989 .microvolts = 2800000,
990 .gpio = -1,
990 .enable_high = 0, 991 .enable_high = 0,
991 .init_data = &camera_dummy_initdata, 992 .init_data = &camera_dummy_initdata,
992}; 993};
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c
index 4f33eea73f9a..2c90b58f347d 100644
--- a/arch/arm/mach-pxa/ezx.c
+++ b/arch/arm/mach-pxa/ezx.c
@@ -21,7 +21,6 @@
21#include <linux/regulator/fixed.h> 21#include <linux/regulator/fixed.h>
22#include <linux/input.h> 22#include <linux/input.h>
23#include <linux/gpio.h> 23#include <linux/gpio.h>
24#include <linux/gpio/machine.h>
25#include <linux/gpio_keys.h> 24#include <linux/gpio_keys.h>
26#include <linux/leds-lp3944.h> 25#include <linux/leds-lp3944.h>
27#include <linux/platform_data/i2c-pxa.h> 26#include <linux/platform_data/i2c-pxa.h>
@@ -699,39 +698,31 @@ static struct pxa27x_keypad_platform_data e2_keypad_platform_data = {
699 698
700#if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_A910) 699#if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_A910)
701/* camera */ 700/* camera */
702static struct regulator_consumer_supply camera_regulator_supplies[] = { 701static struct regulator_consumer_supply camera_dummy_supplies[] = {
703 REGULATOR_SUPPLY("vdd", "0-005d"), 702 REGULATOR_SUPPLY("vdd", "0-005d"),
704}; 703};
705 704
706static struct regulator_init_data camera_regulator_initdata = { 705static struct regulator_init_data camera_dummy_initdata = {
707 .consumer_supplies = camera_regulator_supplies, 706 .consumer_supplies = camera_dummy_supplies,
708 .num_consumer_supplies = ARRAY_SIZE(camera_regulator_supplies), 707 .num_consumer_supplies = ARRAY_SIZE(camera_dummy_supplies),
709 .constraints = { 708 .constraints = {
710 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 709 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
711 }, 710 },
712}; 711};
713 712
714static struct fixed_voltage_config camera_regulator_config = { 713static struct fixed_voltage_config camera_dummy_config = {
715 .supply_name = "camera_vdd", 714 .supply_name = "camera_vdd",
716 .microvolts = 2800000, 715 .microvolts = 2800000,
716 .gpio = GPIO50_nCAM_EN,
717 .enable_high = 0, 717 .enable_high = 0,
718 .init_data = &camera_regulator_initdata, 718 .init_data = &camera_dummy_initdata,
719}; 719};
720 720
721static struct platform_device camera_supply_regulator_device = { 721static struct platform_device camera_supply_dummy_device = {
722 .name = "reg-fixed-voltage", 722 .name = "reg-fixed-voltage",
723 .id = 1, 723 .id = 1,
724 .dev = { 724 .dev = {
725 .platform_data = &camera_regulator_config, 725 .platform_data = &camera_dummy_config,
726 },
727};
728
729static struct gpiod_lookup_table camera_supply_gpiod_table = {
730 .dev_id = "reg-fixed-voltage.1",
731 .table = {
732 GPIO_LOOKUP("gpio-pxa", GPIO50_nCAM_EN,
733 "enable", GPIO_ACTIVE_HIGH),
734 { },
735 }, 726 },
736}; 727};
737#endif 728#endif
@@ -809,7 +800,7 @@ static struct i2c_board_info a780_i2c_board_info[] = {
809 800
810static struct platform_device *a780_devices[] __initdata = { 801static struct platform_device *a780_devices[] __initdata = {
811 &a780_gpio_keys, 802 &a780_gpio_keys,
812 &camera_supply_regulator_device, 803 &camera_supply_dummy_device,
813}; 804};
814 805
815static void __init a780_init(void) 806static void __init a780_init(void)
@@ -832,7 +823,6 @@ static void __init a780_init(void)
832 if (a780_camera_init() == 0) 823 if (a780_camera_init() == 0)
833 pxa_set_camera_info(&a780_pxacamera_platform_data); 824 pxa_set_camera_info(&a780_pxacamera_platform_data);
834 825
835 gpiod_add_lookup_table(&camera_supply_gpiod_table);
836 pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup)); 826 pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
837 platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); 827 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
838 platform_add_devices(ARRAY_AND_SIZE(a780_devices)); 828 platform_add_devices(ARRAY_AND_SIZE(a780_devices));
@@ -1108,7 +1098,7 @@ static struct i2c_board_info __initdata a910_i2c_board_info[] = {
1108 1098
1109static struct platform_device *a910_devices[] __initdata = { 1099static struct platform_device *a910_devices[] __initdata = {
1110 &a910_gpio_keys, 1100 &a910_gpio_keys,
1111 &camera_supply_regulator_device, 1101 &camera_supply_dummy_device,
1112}; 1102};
1113 1103
1114static void __init a910_init(void) 1104static void __init a910_init(void)
@@ -1131,7 +1121,6 @@ static void __init a910_init(void)
1131 if (a910_camera_init() == 0) 1121 if (a910_camera_init() == 0)
1132 pxa_set_camera_info(&a910_pxacamera_platform_data); 1122 pxa_set_camera_info(&a910_pxacamera_platform_data);
1133 1123
1134 gpiod_add_lookup_table(&camera_supply_gpiod_table);
1135 pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup)); 1124 pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
1136 platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); 1125 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1137 platform_add_devices(ARRAY_AND_SIZE(a910_devices)); 1126 platform_add_devices(ARRAY_AND_SIZE(a910_devices));
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index 6717a10180eb..e2e7f247a645 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -20,7 +20,6 @@
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/fb.h> 21#include <linux/fb.h>
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <linux/gpio/machine.h>
24#include <linux/gpio_keys.h> 23#include <linux/gpio_keys.h>
25#include <linux/input.h> 24#include <linux/input.h>
26#include <linux/input/navpoint.h> 25#include <linux/input/navpoint.h>
@@ -712,6 +711,7 @@ static struct gpio_regulator_state bq24022_states[] = {
712static struct gpio_regulator_config bq24022_info = { 711static struct gpio_regulator_config bq24022_info = {
713 .supply_name = "bq24022", 712 .supply_name = "bq24022",
714 713
714 .enable_gpio = GPIO72_HX4700_BQ24022_nCHARGE_EN,
715 .enable_high = 0, 715 .enable_high = 0,
716 .enabled_at_boot = 0, 716 .enabled_at_boot = 0,
717 717
@@ -733,15 +733,6 @@ static struct platform_device bq24022 = {
733 }, 733 },
734}; 734};
735 735
736static struct gpiod_lookup_table bq24022_gpiod_table = {
737 .dev_id = "gpio-regulator",
738 .table = {
739 GPIO_LOOKUP("gpio-pxa", GPIO72_HX4700_BQ24022_nCHARGE_EN,
740 "enable", GPIO_ACTIVE_HIGH),
741 { },
742 },
743};
744
745/* 736/*
746 * StrataFlash 737 * StrataFlash
747 */ 738 */
@@ -884,7 +875,6 @@ static void __init hx4700_init(void)
884 pxa_set_btuart_info(NULL); 875 pxa_set_btuart_info(NULL);
885 pxa_set_stuart_info(NULL); 876 pxa_set_stuart_info(NULL);
886 877
887 gpiod_add_lookup_table(&bq24022_gpiod_table);
888 platform_add_devices(devices, ARRAY_SIZE(devices)); 878 platform_add_devices(devices, ARRAY_SIZE(devices));
889 pwm_add_table(hx4700_pwm_lookup, ARRAY_SIZE(hx4700_pwm_lookup)); 879 pwm_add_table(hx4700_pwm_lookup, ARRAY_SIZE(hx4700_pwm_lookup));
890 880
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 9a5bda3ea194..c5325d1ae77b 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -18,7 +18,6 @@
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21#include <linux/gpio/machine.h>
22#include <linux/gpio_keys.h> 21#include <linux/gpio_keys.h>
23#include <linux/input.h> 22#include <linux/input.h>
24#include <linux/mfd/htc-pasic3.h> 23#include <linux/mfd/htc-pasic3.h>
@@ -657,6 +656,7 @@ static struct gpio_regulator_state bq24022_states[] = {
657static struct gpio_regulator_config bq24022_info = { 656static struct gpio_regulator_config bq24022_info = {
658 .supply_name = "bq24022", 657 .supply_name = "bq24022",
659 658
659 .enable_gpio = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
660 .enable_high = 0, 660 .enable_high = 0,
661 .enabled_at_boot = 1, 661 .enabled_at_boot = 1,
662 662
@@ -678,15 +678,6 @@ static struct platform_device bq24022 = {
678 }, 678 },
679}; 679};
680 680
681static struct gpiod_lookup_table bq24022_gpiod_table = {
682 .dev_id = "gpio-regulator",
683 .table = {
684 GPIO_LOOKUP("gpio-pxa", GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
685 "enable", GPIO_ACTIVE_HIGH),
686 { },
687 },
688};
689
690/* 681/*
691 * fixed regulator for ads7846 682 * fixed regulator for ads7846
692 */ 683 */
@@ -705,6 +696,7 @@ static struct regulator_init_data vads7846_regulator = {
705static struct fixed_voltage_config vads7846 = { 696static struct fixed_voltage_config vads7846 = {
706 .supply_name = "vads7846", 697 .supply_name = "vads7846",
707 .microvolts = 3300000, /* probably */ 698 .microvolts = 3300000, /* probably */
699 .gpio = -EINVAL,
708 .startup_delay = 0, 700 .startup_delay = 0,
709 .init_data = &vads7846_regulator, 701 .init_data = &vads7846_regulator,
710}; 702};
@@ -1015,7 +1007,6 @@ static void __init magician_init(void)
1015 regulator_register_always_on(0, "power", pwm_backlight_supply, 1007 regulator_register_always_on(0, "power", pwm_backlight_supply,
1016 ARRAY_SIZE(pwm_backlight_supply), 5000000); 1008 ARRAY_SIZE(pwm_backlight_supply), 5000000);
1017 1009
1018 gpiod_add_lookup_table(&bq24022_gpiod_table);
1019 platform_add_devices(ARRAY_AND_SIZE(devices)); 1010 platform_add_devices(ARRAY_AND_SIZE(devices));
1020} 1011}
1021 1012
diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
index ee766e4ebddc..034345546f84 100644
--- a/arch/arm/mach-pxa/raumfeld.c
+++ b/arch/arm/mach-pxa/raumfeld.c
@@ -886,6 +886,7 @@ static struct regulator_init_data audio_va_initdata = {
886static struct fixed_voltage_config audio_va_config = { 886static struct fixed_voltage_config audio_va_config = {
887 .supply_name = "audio_va", 887 .supply_name = "audio_va",
888 .microvolts = 5000000, 888 .microvolts = 5000000,
889 .gpio = GPIO_AUDIO_VA_ENABLE,
889 .enable_high = 1, 890 .enable_high = 1,
890 .enabled_at_boot = 0, 891 .enabled_at_boot = 0,
891 .init_data = &audio_va_initdata, 892 .init_data = &audio_va_initdata,
@@ -899,15 +900,6 @@ static struct platform_device audio_va_device = {
899 }, 900 },
900}; 901};
901 902
902static struct gpiod_lookup_table audio_va_gpiod_table = {
903 .dev_id = "reg-fixed-voltage.0",
904 .table = {
905 GPIO_LOOKUP("gpio-pxa", GPIO_AUDIO_VA_ENABLE,
906 "enable", GPIO_ACTIVE_HIGH),
907 { },
908 },
909};
910
911/* Dummy supplies for Codec's VD/VLC */ 903/* Dummy supplies for Codec's VD/VLC */
912 904
913static struct regulator_consumer_supply audio_dummy_supplies[] = { 905static struct regulator_consumer_supply audio_dummy_supplies[] = {
@@ -926,6 +918,7 @@ static struct regulator_init_data audio_dummy_initdata = {
926static struct fixed_voltage_config audio_dummy_config = { 918static struct fixed_voltage_config audio_dummy_config = {
927 .supply_name = "audio_vd", 919 .supply_name = "audio_vd",
928 .microvolts = 3300000, 920 .microvolts = 3300000,
921 .gpio = -1,
929 .init_data = &audio_dummy_initdata, 922 .init_data = &audio_dummy_initdata,
930}; 923};
931 924
@@ -1040,7 +1033,6 @@ static void __init raumfeld_audio_init(void)
1040 else 1033 else
1041 gpio_direction_output(GPIO_MCLK_RESET, 1); 1034 gpio_direction_output(GPIO_MCLK_RESET, 1);
1042 1035
1043 gpiod_add_lookup_table(&audio_va_gpiod_table);
1044 platform_add_devices(ARRAY_AND_SIZE(audio_regulator_devices)); 1036 platform_add_devices(ARRAY_AND_SIZE(audio_regulator_devices));
1045} 1037}
1046 1038
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
index 58e05afcece0..e3851795d6d7 100644
--- a/arch/arm/mach-pxa/zeus.c
+++ b/arch/arm/mach-pxa/zeus.c
@@ -17,7 +17,6 @@
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/pm.h> 18#include <linux/pm.h>
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/gpio/machine.h>
21#include <linux/serial_8250.h> 20#include <linux/serial_8250.h>
22#include <linux/dm9000.h> 21#include <linux/dm9000.h>
23#include <linux/mmc/host.h> 22#include <linux/mmc/host.h>
@@ -411,6 +410,7 @@ static struct regulator_init_data can_regulator_init_data = {
411static struct fixed_voltage_config can_regulator_pdata = { 410static struct fixed_voltage_config can_regulator_pdata = {
412 .supply_name = "CAN_SHDN", 411 .supply_name = "CAN_SHDN",
413 .microvolts = 3300000, 412 .microvolts = 3300000,
413 .gpio = ZEUS_CAN_SHDN_GPIO,
414 .init_data = &can_regulator_init_data, 414 .init_data = &can_regulator_init_data,
415}; 415};
416 416
@@ -422,15 +422,6 @@ static struct platform_device can_regulator_device = {
422 }, 422 },
423}; 423};
424 424
425static struct gpiod_lookup_table can_regulator_gpiod_table = {
426 .dev_id = "reg-fixed-voltage.0",
427 .table = {
428 GPIO_LOOKUP("gpio-pxa", ZEUS_CAN_SHDN_GPIO,
429 "enable", GPIO_ACTIVE_HIGH),
430 { },
431 },
432};
433
434static struct mcp251x_platform_data zeus_mcp2515_pdata = { 425static struct mcp251x_platform_data zeus_mcp2515_pdata = {
435 .oscillator_frequency = 16*1000*1000, 426 .oscillator_frequency = 16*1000*1000,
436}; 427};
@@ -547,6 +538,7 @@ static struct regulator_init_data zeus_ohci_regulator_data = {
547static struct fixed_voltage_config zeus_ohci_regulator_config = { 538static struct fixed_voltage_config zeus_ohci_regulator_config = {
548 .supply_name = "vbus2", 539 .supply_name = "vbus2",
549 .microvolts = 5000000, /* 5.0V */ 540 .microvolts = 5000000, /* 5.0V */
541 .gpio = ZEUS_USB2_PWREN_GPIO,
550 .enable_high = 1, 542 .enable_high = 1,
551 .startup_delay = 0, 543 .startup_delay = 0,
552 .init_data = &zeus_ohci_regulator_data, 544 .init_data = &zeus_ohci_regulator_data,
@@ -560,15 +552,6 @@ static struct platform_device zeus_ohci_regulator_device = {
560 }, 552 },
561}; 553};
562 554
563static struct gpiod_lookup_table zeus_ohci_regulator_gpiod_table = {
564 .dev_id = "reg-fixed-voltage.0",
565 .table = {
566 GPIO_LOOKUP("gpio-pxa", ZEUS_USB2_PWREN_GPIO,
567 "enable", GPIO_ACTIVE_HIGH),
568 { },
569 },
570};
571
572static struct pxaohci_platform_data zeus_ohci_platform_data = { 555static struct pxaohci_platform_data zeus_ohci_platform_data = {
573 .port_mode = PMM_NPS_MODE, 556 .port_mode = PMM_NPS_MODE,
574 /* Clear Power Control Polarity Low and set Power Sense 557 /* Clear Power Control Polarity Low and set Power Sense
@@ -872,8 +855,6 @@ static void __init zeus_init(void)
872 855
873 pxa2xx_mfp_config(ARRAY_AND_SIZE(zeus_pin_config)); 856 pxa2xx_mfp_config(ARRAY_AND_SIZE(zeus_pin_config));
874 857
875 gpiod_add_lookup_table(&can_regulator_gpiod_table);
876 gpiod_add_lookup_table(&zeus_ohci_regulator_gpiod_table);
877 platform_add_devices(zeus_devices, ARRAY_SIZE(zeus_devices)); 858 platform_add_devices(zeus_devices, ARRAY_SIZE(zeus_devices));
878 859
879 zeus_register_ohci(); 860 zeus_register_ohci();
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 379424d72ae7..f04650297487 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -352,6 +352,7 @@ static struct fixed_voltage_config wallvdd_pdata = {
352 .supply_name = "WALLVDD", 352 .supply_name = "WALLVDD",
353 .microvolts = 5000000, 353 .microvolts = 5000000,
354 .init_data = &wallvdd_data, 354 .init_data = &wallvdd_data,
355 .gpio = -EINVAL,
355}; 356};
356 357
357static struct platform_device wallvdd_device = { 358static struct platform_device wallvdd_device = {
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index 908e5aa831c8..c46fa5dfd2e0 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -222,6 +222,7 @@ static struct fixed_voltage_config smdk6410_b_pwr_5v_pdata = {
222 .supply_name = "B_PWR_5V", 222 .supply_name = "B_PWR_5V",
223 .microvolts = 5000000, 223 .microvolts = 5000000,
224 .init_data = &smdk6410_b_pwr_5v_data, 224 .init_data = &smdk6410_b_pwr_5v_data,
225 .gpio = -EINVAL,
225}; 226};
226 227
227static struct platform_device smdk6410_b_pwr_5v = { 228static struct platform_device smdk6410_b_pwr_5v = {
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index dbb53c520165..575ec085cffa 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -101,7 +101,7 @@ static int __init assabet_init_gpio(void __iomem *reg, u32 def_val)
101 101
102 assabet_bcr_gc = gc; 102 assabet_bcr_gc = gc;
103 103
104 return 0; 104 return gc->base;
105} 105}
106 106
107/* 107/*
@@ -471,14 +471,6 @@ static struct fixed_voltage_config assabet_cf_vcc_pdata __initdata = {
471 .enable_high = 1, 471 .enable_high = 1,
472}; 472};
473 473
474static struct gpiod_lookup_table assabet_cf_vcc_gpio_table = {
475 .dev_id = "reg-fixed-voltage.0",
476 .table = {
477 GPIO_LOOKUP("assabet", 0, "enable", GPIO_ACTIVE_HIGH),
478 { },
479 },
480};
481
482static void __init assabet_init(void) 474static void __init assabet_init(void)
483{ 475{
484 /* 476 /*
@@ -525,11 +517,9 @@ static void __init assabet_init(void)
525 neponset_resources, ARRAY_SIZE(neponset_resources)); 517 neponset_resources, ARRAY_SIZE(neponset_resources));
526#endif 518#endif
527 } else { 519 } else {
528 gpiod_add_lookup_table(&assabet_cf_vcc_gpio_table);
529 sa11x0_register_fixed_regulator(0, &assabet_cf_vcc_pdata, 520 sa11x0_register_fixed_regulator(0, &assabet_cf_vcc_pdata,
530 assabet_cf_vcc_consumers, 521 assabet_cf_vcc_consumers,
531 ARRAY_SIZE(assabet_cf_vcc_consumers), 522 ARRAY_SIZE(assabet_cf_vcc_consumers));
532 true);
533 523
534 } 524 }
535 525
@@ -812,6 +802,7 @@ fs_initcall(assabet_leds_init);
812 802
813void __init assabet_init_irq(void) 803void __init assabet_init_irq(void)
814{ 804{
805 unsigned int assabet_gpio_base;
815 u32 def_val; 806 u32 def_val;
816 807
817 sa1100_init_irq(); 808 sa1100_init_irq();
@@ -826,7 +817,9 @@ void __init assabet_init_irq(void)
826 * 817 *
827 * This must precede any driver calls to BCR_set() or BCR_clear(). 818 * This must precede any driver calls to BCR_set() or BCR_clear().
828 */ 819 */
829 assabet_init_gpio((void *)&ASSABET_BCR, def_val); 820 assabet_gpio_base = assabet_init_gpio((void *)&ASSABET_BCR, def_val);
821
822 assabet_cf_vcc_pdata.gpio = assabet_gpio_base + 0;
830} 823}
831 824
832MACHINE_START(ASSABET, "Intel-Assabet") 825MACHINE_START(ASSABET, "Intel-Assabet")
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 800321c6cbd8..7167ddf84a0e 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -348,8 +348,7 @@ void __init sa11x0_init_late(void)
348 348
349int __init sa11x0_register_fixed_regulator(int n, 349int __init sa11x0_register_fixed_regulator(int n,
350 struct fixed_voltage_config *cfg, 350 struct fixed_voltage_config *cfg,
351 struct regulator_consumer_supply *supplies, unsigned num_supplies, 351 struct regulator_consumer_supply *supplies, unsigned num_supplies)
352 bool uses_gpio)
353{ 352{
354 struct regulator_init_data *id; 353 struct regulator_init_data *id;
355 354
@@ -357,7 +356,7 @@ int __init sa11x0_register_fixed_regulator(int n,
357 if (!cfg->init_data) 356 if (!cfg->init_data)
358 return -ENOMEM; 357 return -ENOMEM;
359 358
360 if (!uses_gpio) 359 if (cfg->gpio < 0)
361 id->constraints.always_on = 1; 360 id->constraints.always_on = 1;
362 id->constraints.name = cfg->supply_name; 361 id->constraints.name = cfg->supply_name;
363 id->constraints.min_uV = cfg->microvolts; 362 id->constraints.min_uV = cfg->microvolts;
diff --git a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h
index 158a4fd5ca24..5f3cb52fa6ab 100644
--- a/arch/arm/mach-sa1100/generic.h
+++ b/arch/arm/mach-sa1100/generic.h
@@ -54,5 +54,4 @@ void sa11x0_register_pcmcia(int socket, struct gpiod_lookup_table *);
54struct fixed_voltage_config; 54struct fixed_voltage_config;
55struct regulator_consumer_supply; 55struct regulator_consumer_supply;
56int sa11x0_register_fixed_regulator(int n, struct fixed_voltage_config *cfg, 56int sa11x0_register_fixed_regulator(int n, struct fixed_voltage_config *cfg,
57 struct regulator_consumer_supply *supplies, unsigned num_supplies, 57 struct regulator_consumer_supply *supplies, unsigned num_supplies);
58 bool uses_gpio);
diff --git a/arch/arm/mach-sa1100/shannon.c b/arch/arm/mach-sa1100/shannon.c
index 5bc82e2671c6..22f7fe0b809f 100644
--- a/arch/arm/mach-sa1100/shannon.c
+++ b/arch/arm/mach-sa1100/shannon.c
@@ -102,14 +102,14 @@ static struct fixed_voltage_config shannon_cf_vcc_pdata __initdata = {
102 .supply_name = "cf-power", 102 .supply_name = "cf-power",
103 .microvolts = 3300000, 103 .microvolts = 3300000,
104 .enabled_at_boot = 1, 104 .enabled_at_boot = 1,
105 .gpio = -EINVAL,
105}; 106};
106 107
107static void __init shannon_init(void) 108static void __init shannon_init(void)
108{ 109{
109 sa11x0_register_fixed_regulator(0, &shannon_cf_vcc_pdata, 110 sa11x0_register_fixed_regulator(0, &shannon_cf_vcc_pdata,
110 shannon_cf_vcc_consumers, 111 shannon_cf_vcc_consumers,
111 ARRAY_SIZE(shannon_cf_vcc_consumers), 112 ARRAY_SIZE(shannon_cf_vcc_consumers));
112 false);
113 sa11x0_register_pcmcia(0, &shannon_pcmcia0_gpio_table); 113 sa11x0_register_pcmcia(0, &shannon_pcmcia0_gpio_table);
114 sa11x0_register_pcmcia(1, &shannon_pcmcia1_gpio_table); 114 sa11x0_register_pcmcia(1, &shannon_pcmcia1_gpio_table);
115 sa11x0_ppc_configure_mcp(); 115 sa11x0_ppc_configure_mcp();
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index c296b5c399b7..adc61d14172c 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -633,6 +633,7 @@ static struct regulator_init_data cn12_power_init_data = {
633static struct fixed_voltage_config cn12_power_info = { 633static struct fixed_voltage_config cn12_power_info = {
634 .supply_name = "CN12 SD/MMC Vdd", 634 .supply_name = "CN12 SD/MMC Vdd",
635 .microvolts = 3300000, 635 .microvolts = 3300000,
636 .gpio = GPIO_PTB7,
636 .enable_high = 1, 637 .enable_high = 1,
637 .init_data = &cn12_power_init_data, 638 .init_data = &cn12_power_init_data,
638}; 639};
@@ -645,16 +646,6 @@ static struct platform_device cn12_power = {
645 }, 646 },
646}; 647};
647 648
648static struct gpiod_lookup_table cn12_power_gpiod_table = {
649 .dev_id = "reg-fixed-voltage.0",
650 .table = {
651 /* Offset 7 on port B */
652 GPIO_LOOKUP("sh7724_pfc", GPIO_PTB7,
653 "enable", GPIO_ACTIVE_HIGH),
654 { },
655 },
656};
657
658#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE) 649#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
659/* SDHI0 */ 650/* SDHI0 */
660static struct regulator_consumer_supply sdhi0_power_consumers[] = 651static struct regulator_consumer_supply sdhi0_power_consumers[] =
@@ -674,6 +665,7 @@ static struct regulator_init_data sdhi0_power_init_data = {
674static struct fixed_voltage_config sdhi0_power_info = { 665static struct fixed_voltage_config sdhi0_power_info = {
675 .supply_name = "CN11 SD/MMC Vdd", 666 .supply_name = "CN11 SD/MMC Vdd",
676 .microvolts = 3300000, 667 .microvolts = 3300000,
668 .gpio = GPIO_PTB6,
677 .enable_high = 1, 669 .enable_high = 1,
678 .init_data = &sdhi0_power_init_data, 670 .init_data = &sdhi0_power_init_data,
679}; 671};
@@ -686,16 +678,6 @@ static struct platform_device sdhi0_power = {
686 }, 678 },
687}; 679};
688 680
689static struct gpiod_lookup_table sdhi0_power_gpiod_table = {
690 .dev_id = "reg-fixed-voltage.1",
691 .table = {
692 /* Offset 6 on port B */
693 GPIO_LOOKUP("sh7724_pfc", GPIO_PTB6,
694 "enable", GPIO_ACTIVE_HIGH),
695 { },
696 },
697};
698
699static struct tmio_mmc_data sdhi0_info = { 681static struct tmio_mmc_data sdhi0_info = {
700 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI0_TX, 682 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI0_TX,
701 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI0_RX, 683 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI0_RX,
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_bcm43xx.c b/arch/x86/platform/intel-mid/device_libs/platform_bcm43xx.c
index fc77d69e51d7..4392c15ed9e0 100644
--- a/arch/x86/platform/intel-mid/device_libs/platform_bcm43xx.c
+++ b/arch/x86/platform/intel-mid/device_libs/platform_bcm43xx.c
@@ -10,7 +10,7 @@
10 * of the License. 10 * of the License.
11 */ 11 */
12 12
13#include <linux/gpio/machine.h> 13#include <linux/gpio.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/regulator/machine.h> 15#include <linux/regulator/machine.h>
16#include <linux/regulator/fixed.h> 16#include <linux/regulator/fixed.h>
@@ -43,6 +43,7 @@ static struct fixed_voltage_config bcm43xx_vmmc = {
43 * real voltage and signaling are still 1.8V. 43 * real voltage and signaling are still 1.8V.
44 */ 44 */
45 .microvolts = 2000000, /* 1.8V */ 45 .microvolts = 2000000, /* 1.8V */
46 .gpio = -EINVAL,
46 .startup_delay = 250 * 1000, /* 250ms */ 47 .startup_delay = 250 * 1000, /* 250ms */
47 .enable_high = 1, /* active high */ 48 .enable_high = 1, /* active high */
48 .enabled_at_boot = 0, /* disabled at boot */ 49 .enabled_at_boot = 0, /* disabled at boot */
@@ -57,23 +58,11 @@ static struct platform_device bcm43xx_vmmc_regulator = {
57 }, 58 },
58}; 59};
59 60
60static struct gpiod_lookup_table bcm43xx_vmmc_gpio_table = {
61 .dev_id = "reg-fixed-voltage.0",
62 .table = {
63 GPIO_LOOKUP("0000:00:0c.0", -1, "enable", GPIO_ACTIVE_LOW),
64 {}
65 },
66};
67
68static int __init bcm43xx_regulator_register(void) 61static int __init bcm43xx_regulator_register(void)
69{ 62{
70 struct gpiod_lookup_table *table = &bcm43xx_vmmc_gpio_table;
71 struct gpiod_lookup *lookup = table->table;
72 int ret; 63 int ret;
73 64
74 lookup[0].chip_hwnum = get_gpio_by_name(WLAN_SFI_GPIO_ENABLE_NAME); 65 bcm43xx_vmmc.gpio = get_gpio_by_name(WLAN_SFI_GPIO_ENABLE_NAME);
75 gpiod_add_lookup_table(table);
76
77 ret = platform_device_register(&bcm43xx_vmmc_regulator); 66 ret = platform_device_register(&bcm43xx_vmmc_regulator);
78 if (ret) { 67 if (ret) {
79 pr_err("%s: vmmc regulator register failed\n", __func__); 68 pr_err("%s: vmmc regulator register failed\n", __func__);
diff --git a/drivers/regulator/fixed-helper.c b/drivers/regulator/fixed-helper.c
index 2c6098e6f4bc..777fac6fb4cb 100644
--- a/drivers/regulator/fixed-helper.c
+++ b/drivers/regulator/fixed-helper.c
@@ -43,6 +43,7 @@ struct platform_device *regulator_register_always_on(int id, const char *name,
43 } 43 }
44 44
45 data->cfg.microvolts = uv; 45 data->cfg.microvolts = uv;
46 data->cfg.gpio = -EINVAL;
46 data->cfg.enabled_at_boot = 1; 47 data->cfg.enabled_at_boot = 1;
47 data->cfg.init_data = &data->init_data; 48 data->cfg.init_data = &data->init_data;
48 49
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 1142f195529b..988a7472c2ab 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -24,9 +24,10 @@
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/regulator/driver.h> 25#include <linux/regulator/driver.h>
26#include <linux/regulator/fixed.h> 26#include <linux/regulator/fixed.h>
27#include <linux/gpio/consumer.h> 27#include <linux/gpio.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/of.h> 29#include <linux/of.h>
30#include <linux/of_gpio.h>
30#include <linux/regulator/of_regulator.h> 31#include <linux/regulator/of_regulator.h>
31#include <linux/regulator/machine.h> 32#include <linux/regulator/machine.h>
32 33
@@ -77,6 +78,10 @@ of_get_fixed_voltage_config(struct device *dev,
77 if (init_data->constraints.boot_on) 78 if (init_data->constraints.boot_on)
78 config->enabled_at_boot = true; 79 config->enabled_at_boot = true;
79 80
81 config->gpio = of_get_named_gpio(np, "gpio", 0);
82 if ((config->gpio < 0) && (config->gpio != -ENOENT))
83 return ERR_PTR(config->gpio);
84
80 of_property_read_u32(np, "startup-delay-us", &config->startup_delay); 85 of_property_read_u32(np, "startup-delay-us", &config->startup_delay);
81 86
82 config->enable_high = of_property_read_bool(np, "enable-active-high"); 87 config->enable_high = of_property_read_bool(np, "enable-active-high");
@@ -97,7 +102,6 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
97 struct fixed_voltage_config *config; 102 struct fixed_voltage_config *config;
98 struct fixed_voltage_data *drvdata; 103 struct fixed_voltage_data *drvdata;
99 struct regulator_config cfg = { }; 104 struct regulator_config cfg = { };
100 enum gpiod_flags gflags;
101 int ret; 105 int ret;
102 106
103 drvdata = devm_kzalloc(&pdev->dev, sizeof(struct fixed_voltage_data), 107 drvdata = devm_kzalloc(&pdev->dev, sizeof(struct fixed_voltage_data),
@@ -146,28 +150,25 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
146 150
147 drvdata->desc.fixed_uV = config->microvolts; 151 drvdata->desc.fixed_uV = config->microvolts;
148 152
153 if (gpio_is_valid(config->gpio)) {
154 cfg.ena_gpio = config->gpio;
155 if (pdev->dev.of_node)
156 cfg.ena_gpio_initialized = true;
157 }
149 cfg.ena_gpio_invert = !config->enable_high; 158 cfg.ena_gpio_invert = !config->enable_high;
150 if (config->enabled_at_boot) { 159 if (config->enabled_at_boot) {
151 if (config->enable_high) 160 if (config->enable_high)
152 gflags = GPIOD_OUT_HIGH; 161 cfg.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH;
153 else 162 else
154 gflags = GPIOD_OUT_LOW; 163 cfg.ena_gpio_flags |= GPIOF_OUT_INIT_LOW;
155 } else { 164 } else {
156 if (config->enable_high) 165 if (config->enable_high)
157 gflags = GPIOD_OUT_LOW; 166 cfg.ena_gpio_flags |= GPIOF_OUT_INIT_LOW;
158 else 167 else
159 gflags = GPIOD_OUT_HIGH; 168 cfg.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH;
160 } 169 }
161 if (config->gpio_is_open_drain) { 170 if (config->gpio_is_open_drain)
162 if (gflags == GPIOD_OUT_HIGH) 171 cfg.ena_gpio_flags |= GPIOF_OPEN_DRAIN;
163 gflags = GPIOD_OUT_HIGH_OPEN_DRAIN;
164 else
165 gflags = GPIOD_OUT_LOW_OPEN_DRAIN;
166 }
167
168 cfg.ena_gpiod = devm_gpiod_get_optional(&pdev->dev, NULL, gflags);
169 if (IS_ERR(cfg.ena_gpiod))
170 return PTR_ERR(cfg.ena_gpiod);
171 172
172 cfg.dev = &pdev->dev; 173 cfg.dev = &pdev->dev;
173 cfg.init_data = config->init_data; 174 cfg.init_data = config->init_data;
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index 9d6094c4d71c..a86b8997bb54 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -31,7 +31,6 @@
31#include <linux/regulator/of_regulator.h> 31#include <linux/regulator/of_regulator.h>
32#include <linux/regulator/gpio-regulator.h> 32#include <linux/regulator/gpio-regulator.h>
33#include <linux/gpio.h> 33#include <linux/gpio.h>
34#include <linux/gpio/consumer.h>
35#include <linux/slab.h> 34#include <linux/slab.h>
36#include <linux/of.h> 35#include <linux/of.h>
37#include <linux/of_gpio.h> 36#include <linux/of_gpio.h>
@@ -162,6 +161,10 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np,
162 161
163 of_property_read_u32(np, "startup-delay-us", &config->startup_delay); 162 of_property_read_u32(np, "startup-delay-us", &config->startup_delay);
164 163
164 config->enable_gpio = of_get_named_gpio(np, "enable-gpio", 0);
165 if (config->enable_gpio < 0 && config->enable_gpio != -ENOENT)
166 return ERR_PTR(config->enable_gpio);
167
165 /* Fetch GPIOs. - optional property*/ 168 /* Fetch GPIOs. - optional property*/
166 ret = of_gpio_count(np); 169 ret = of_gpio_count(np);
167 if ((ret < 0) && (ret != -ENOENT)) 170 if ((ret < 0) && (ret != -ENOENT))
@@ -252,7 +255,6 @@ static int gpio_regulator_probe(struct platform_device *pdev)
252 struct device_node *np = pdev->dev.of_node; 255 struct device_node *np = pdev->dev.of_node;
253 struct gpio_regulator_data *drvdata; 256 struct gpio_regulator_data *drvdata;
254 struct regulator_config cfg = { }; 257 struct regulator_config cfg = { };
255 enum gpiod_flags gflags;
256 int ptr, ret, state; 258 int ptr, ret, state;
257 259
258 drvdata = devm_kzalloc(&pdev->dev, sizeof(struct gpio_regulator_data), 260 drvdata = devm_kzalloc(&pdev->dev, sizeof(struct gpio_regulator_data),
@@ -338,22 +340,21 @@ static int gpio_regulator_probe(struct platform_device *pdev)
338 cfg.driver_data = drvdata; 340 cfg.driver_data = drvdata;
339 cfg.of_node = np; 341 cfg.of_node = np;
340 342
343 if (gpio_is_valid(config->enable_gpio)) {
344 cfg.ena_gpio = config->enable_gpio;
345 cfg.ena_gpio_initialized = true;
346 }
341 cfg.ena_gpio_invert = !config->enable_high; 347 cfg.ena_gpio_invert = !config->enable_high;
342 if (config->enabled_at_boot) { 348 if (config->enabled_at_boot) {
343 if (config->enable_high) 349 if (config->enable_high)
344 gflags = GPIOD_OUT_HIGH; 350 cfg.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH;
345 else 351 else
346 gflags = GPIOD_OUT_LOW; 352 cfg.ena_gpio_flags |= GPIOF_OUT_INIT_LOW;
347 } else { 353 } else {
348 if (config->enable_high) 354 if (config->enable_high)
349 gflags = GPIOD_OUT_LOW; 355 cfg.ena_gpio_flags |= GPIOF_OUT_INIT_LOW;
350 else 356 else
351 gflags = GPIOD_OUT_HIGH; 357 cfg.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH;
352 }
353 cfg.ena_gpiod = devm_gpiod_get_optional(&pdev->dev, "enable", gflags);
354 if (IS_ERR(cfg.ena_gpiod)) {
355 ret = PTR_ERR(cfg.ena_gpiod);
356 goto err_stategpio;
357 } 358 }
358 359
359 drvdata->dev = regulator_register(&drvdata->desc, &cfg); 360 drvdata->dev = regulator_register(&drvdata->desc, &cfg);
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h
index 1a4340ed8e2b..48918be649d4 100644
--- a/include/linux/regulator/fixed.h
+++ b/include/linux/regulator/fixed.h
@@ -24,6 +24,8 @@ struct regulator_init_data;
24 * @supply_name: Name of the regulator supply 24 * @supply_name: Name of the regulator supply
25 * @input_supply: Name of the input regulator supply 25 * @input_supply: Name of the input regulator supply
26 * @microvolts: Output voltage of regulator 26 * @microvolts: Output voltage of regulator
27 * @gpio: GPIO to use for enable control
28 * set to -EINVAL if not used
27 * @startup_delay: Start-up time in microseconds 29 * @startup_delay: Start-up time in microseconds
28 * @gpio_is_open_drain: Gpio pin is open drain or normal type. 30 * @gpio_is_open_drain: Gpio pin is open drain or normal type.
29 * If it is open drain type then HIGH will be set 31 * If it is open drain type then HIGH will be set
@@ -47,6 +49,7 @@ struct fixed_voltage_config {
47 const char *supply_name; 49 const char *supply_name;
48 const char *input_supply; 50 const char *input_supply;
49 int microvolts; 51 int microvolts;
52 int gpio;
50 unsigned startup_delay; 53 unsigned startup_delay;
51 unsigned gpio_is_open_drain:1; 54 unsigned gpio_is_open_drain:1;
52 unsigned enable_high:1; 55 unsigned enable_high:1;
diff --git a/include/linux/regulator/gpio-regulator.h b/include/linux/regulator/gpio-regulator.h
index 536cab86f2d5..19fbd267406d 100644
--- a/include/linux/regulator/gpio-regulator.h
+++ b/include/linux/regulator/gpio-regulator.h
@@ -44,6 +44,8 @@ struct gpio_regulator_state {
44/** 44/**
45 * struct gpio_regulator_config - config structure 45 * struct gpio_regulator_config - config structure
46 * @supply_name: Name of the regulator supply 46 * @supply_name: Name of the regulator supply
47 * @enable_gpio: GPIO to use for enable control
48 * set to -EINVAL if not used
47 * @enable_high: Polarity of enable GPIO 49 * @enable_high: Polarity of enable GPIO
48 * 1 = Active high, 0 = Active low 50 * 1 = Active high, 0 = Active low
49 * @enabled_at_boot: Whether regulator has been enabled at 51 * @enabled_at_boot: Whether regulator has been enabled at
@@ -67,6 +69,7 @@ struct gpio_regulator_state {
67struct gpio_regulator_config { 69struct gpio_regulator_config {
68 const char *supply_name; 70 const char *supply_name;
69 71
72 int enable_gpio;
70 unsigned enable_high:1; 73 unsigned enable_high:1;
71 unsigned enabled_at_boot:1; 74 unsigned enabled_at_boot:1;
72 unsigned startup_delay; 75 unsigned startup_delay;