History

Merge tag 'gpio-omap-descriptors-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio into soc/arm

This removes all usage of global GPIO numbers from arch/arm/mach-omap[12]. The patches have been reviewed and tested by everyone who showed interest which was one person that tested on OSK1 and Nokia 770, and we smoked out the bugs and also addressed all review comments. Any remaining problems can certainly be fixed in-tree. * tag 'gpio-omap-descriptors-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: ARM/musb: omap2: Remove global GPIO numbers from TUSB6010 ARM: omap2: Rewrite WLAN quirk to use GPIO descriptors ARM: omap2: Get USB hub reset GPIO from descriptor ARM/gpio: Push OMAP2 quirk down into TWL4030 driver ARM: omap1: Exorcise the legacy GPIO header ARM: omap1: Make serial wakeup GPIOs use descriptors ARM: omap1: Fix up the Nokia 770 board device IRQs ARM/mmc: Convert old mmci-omap to GPIO descriptors Input: ads7846 - Convert to use software nodes ARM: omap1: Remove reliance on GPIO numbers from SX1 ARM: omap1: Remove reliance on GPIO numbers from PalmTE ARM: omap1: Drop header on AMS Delta ARM/mfd/gpio: Fixup TPS65010 regression on OMAP1 OSK1

Arnd Bergmann committed 3 years ago

Commit 0b47a622 parents 88813f0 8e0285a32 files · +636 −511Browse files

Unified · Split

32 files
  1. arch/arm/mach-omap1/board-ams-delta.c +0 −1
  2. arch/arm/mach-omap1/board-nokia770.c +130 −77
  3. arch/arm/mach-omap1/board-osk.c +102 −44
  4. arch/arm/mach-omap1/board-palmte.c +31 −20
  5. arch/arm/mach-omap1/board-sx1-mmc.c +0 −1
  6. arch/arm/mach-omap1/board-sx1.c +33 −7
  7. arch/arm/mach-omap1/devices.c +0 −1
  8. arch/arm/mach-omap1/gpio15xx.c +0 −1
  9. arch/arm/mach-omap1/gpio16xx.c +0 −1
  10. arch/arm/mach-omap1/irq.c +0 −1
  11. arch/arm/mach-omap1/serial.c +15 −15
  12. arch/arm/mach-omap2/board-n8x0.c +44 −112
  13. arch/arm/mach-omap2/omap_device.c +0 −1
  14. arch/arm/mach-omap2/pdata-quirks.c +66 −66
  15. arch/arm/mach-omap2/usb-tusb6010.c +4 −16
  16. arch/arm/mach-omap2/usb-tusb6010.h +12 −0
  17. arch/arm/mach-pxa/spitz.c +10 −1
  18. arch/mips/alchemy/devboards/db1000.c +10 −1
  19. drivers/gpio/gpio-twl4030.c +36 −16
  20. drivers/input/touchscreen/ads7846.c +41 −72
  21. drivers/mfd/tps65010.c +5 −9
  22. drivers/mmc/host/omap.c +44 −2
  23. drivers/usb/musb/musb_core.c +0 −1
  24. drivers/usb/musb/musb_core.h +0 −2
  25. drivers/usb/musb/tusb6010.c +39 −14
  26. drivers/video/fbdev/omap/lcd_mipid.c +10 −0
  27. include/linux/mfd/tps65010.h +4 −7
  28. include/linux/mfd/twl.h +0 −3
  29. include/linux/platform_data/lcd-mipid.h +0 −2
  30. include/linux/platform_data/mmc-omap.h +0 −2
  31. include/linux/spi/ads7846.h +0 −2
  32. include/linux/usb/musb.h +0 −13
arch/arm/mach-omap1/board-ams-delta.c+0−1
@@ -11,7 +11,6 @@ · 10 unmodified lines
1111 #include <linux/gpio/driver.h>
1212 #include <linux/gpio/machine.h>
1313 #include <linux/gpio/consumer.h>
14−#include <linux/gpio.h>
1514 #include <linux/kernel.h>
1615 #include <linux/init.h>
1716 #include <linux/input.h>
arch/arm/mach-omap1/board-nokia770.c+130−77
@@ -6,17 +6,18 @@ · 5 unmodified lines
66 */
77 #include <linux/clkdev.h>
88 #include <linux/irq.h>
9−#include <linux/gpio.h>
9+#include <linux/gpio/consumer.h>
1010 #include <linux/gpio/machine.h>
11+#include <linux/gpio/property.h>
1112 #include <linux/kernel.h>
1213 #include <linux/init.h>
1314 #include <linux/mutex.h>
1415 #include <linux/platform_device.h>
16+#include <linux/property.h>
1517 #include <linux/input.h>
1618 #include <linux/omapfb.h>
1719
1820 #include <linux/spi/spi.h>
19−#include <linux/spi/ads7846.h>
2021 #include <linux/workqueue.h>
2122 #include <linux/delay.h>
2223
@@ -35,6 +36,25 @@ · 12 unmodified lines
3536 #include "clock.h"
3637 #include "mmc.h"
3738
39+static const struct software_node nokia770_mpuio_gpiochip_node = {
40+ .name = "mpuio",
41+};
42+
43+static const struct software_node nokia770_gpiochip1_node = {
44+ .name = "gpio-0-15",
45+};
46+
47+static const struct software_node nokia770_gpiochip2_node = {
48+ .name = "gpio-16-31",
49+};
50+
51+static const struct software_node *nokia770_gpiochip_nodes[] = {
52+ &nokia770_mpuio_gpiochip_node,
53+ &nokia770_gpiochip1_node,
54+ &nokia770_gpiochip2_node,
55+ NULL
56+};
57+
3858 #define ADS7846_PENDOWN_GPIO 15
3959
4060 static const unsigned int nokia770_keymap[] = {
@@ -85,40 +105,47 @@ static struct platform_device *nokia770_devices[] __initdata = { · 44 unmodified lines
85105 &nokia770_kp_device,
86106 };
87107
88−static void mipid_shutdown(struct mipid_platform_data *pdata)
89−{
90− if (pdata->nreset_gpio != -1) {
91− printk(KERN_INFO "shutdown LCD\n");
92− gpio_set_value(pdata->nreset_gpio, 0);
93− msleep(120);
94− }
95−}
96−
97−static struct mipid_platform_data nokia770_mipid_platform_data = {
98− .shutdown = mipid_shutdown,
99−};
108+static struct mipid_platform_data nokia770_mipid_platform_data = { };
100109
101110 static const struct omap_lcd_config nokia770_lcd_config __initconst = {
102111 .ctrl_name = "hwa742",
103112 };
104113
114+static const struct property_entry nokia770_mipid_props[] = {
115+ PROPERTY_ENTRY_GPIO("reset-gpios", &nokia770_gpiochip1_node,
116+ 13, GPIO_ACTIVE_LOW),
117+ { }
118+};
119+
120+static const struct software_node nokia770_mipid_swnode = {
121+ .name = "lcd_mipid",
122+ .properties = nokia770_mipid_props,
123+};
124+
105125 static void __init mipid_dev_init(void)
106126 {
107− nokia770_mipid_platform_data.nreset_gpio = 13;
108127 nokia770_mipid_platform_data.data_lines = 16;
109128
110129 omapfb_set_lcd_config(&nokia770_lcd_config);
111130 }
112131
113−static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata = {
114− .x_max = 0x0fff,
115− .y_max = 0x0fff,
116− .x_plate_ohms = 180,
117− .pressure_max = 255,
118− .debounce_max = 10,
119− .debounce_tol = 3,
120− .debounce_rep = 1,
121− .gpio_pendown = ADS7846_PENDOWN_GPIO,
132+static const struct property_entry nokia770_ads7846_props[] = {
133+ PROPERTY_ENTRY_STRING("compatible", "ti,ads7846"),
134+ PROPERTY_ENTRY_U32("touchscreen-size-x", 4096),
135+ PROPERTY_ENTRY_U32("touchscreen-size-y", 4096),
136+ PROPERTY_ENTRY_U32("touchscreen-max-pressure", 256),
137+ PROPERTY_ENTRY_U32("touchscreen-average-samples", 10),
138+ PROPERTY_ENTRY_U16("ti,x-plate-ohms", 180),
139+ PROPERTY_ENTRY_U16("ti,debounce-tol", 3),
140+ PROPERTY_ENTRY_U16("ti,debounce-rep", 1),
141+ PROPERTY_ENTRY_GPIO("pendown-gpios", &nokia770_gpiochip1_node,
142+ ADS7846_PENDOWN_GPIO, GPIO_ACTIVE_LOW),
143+ { }
144+};
145+
146+static const struct software_node nokia770_ads7846_swnode = {
147+ .name = "ads7846",
148+ .properties = nokia770_ads7846_props,
122149 };
123150
124151 static struct spi_board_info nokia770_spi_board_info[] __initdata = {
@@ -128,13 +155,14 @@ static struct spi_board_info nokia770_spi_board_info[] __initdata = { · 3 unmodified lines
128155 .chip_select = 3,
129156 .max_speed_hz = 12000000,
130157 .platform_data = &nokia770_mipid_platform_data,
158+ .swnode = &nokia770_mipid_swnode,
131159 },
132160 [1] = {
133161 .modalias = "ads7846",
134162 .bus_num = 2,
135163 .chip_select = 0,
136164 .max_speed_hz = 2500000,
137− .platform_data = &nokia770_ads7846_platform_data,
165+ .swnode = &nokia770_ads7846_swnode,
138166 },
139167 };
140168
@@ -156,27 +184,23 @@ static struct omap_usb_config nokia770_usb_config __initdata = { · 15 unmodified lines
156184
157185 #if IS_ENABLED(CONFIG_MMC_OMAP)
158186
159−#define NOKIA770_GPIO_MMC_POWER 41
160−#define NOKIA770_GPIO_MMC_SWITCH 23
161−
162−static int nokia770_mmc_set_power(struct device *dev, int slot, int power_on,
163− int vdd)
164−{
165− gpio_set_value(NOKIA770_GPIO_MMC_POWER, power_on);
166− return 0;
167−}
168−
169−static int nokia770_mmc_get_cover_state(struct device *dev, int slot)
170−{
171− return gpio_get_value(NOKIA770_GPIO_MMC_SWITCH);
172−}
187+static struct gpiod_lookup_table nokia770_mmc_gpio_table = {
188+ .dev_id = "mmci-omap.1",
189+ .table = {
190+ /* Slot index 0, VSD power, GPIO 41 */
191+ GPIO_LOOKUP_IDX("gpio-32-47", 9,
192+ "vsd", 0, GPIO_ACTIVE_HIGH),
193+ /* Slot index 0, switch, GPIO 23 */
194+ GPIO_LOOKUP_IDX("gpio-16-31", 7,
195+ "cover", 0, GPIO_ACTIVE_HIGH),
196+ { }
197+ },
198+};
173199
174200 static struct omap_mmc_platform_data nokia770_mmc2_data = {
175201 .nr_slots = 1,
176202 .max_freq = 12000000,
177203 .slots[0] = {
178− .set_power = nokia770_mmc_set_power,
179− .get_cover_state = nokia770_mmc_get_cover_state,
180204 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
181205 .name = "mmcblk",
182206 },
@@ -186,20 +210,7 @@ static struct omap_mmc_platform_data *nokia770_mmc_data[OMAP16XX_NR_MMC]; · 3 unmodified lines
186210
187211 static void __init nokia770_mmc_init(void)
188212 {
189− int ret;
190−
191− ret = gpio_request(NOKIA770_GPIO_MMC_POWER, "MMC power");
192− if (ret < 0)
193− return;
194− gpio_direction_output(NOKIA770_GPIO_MMC_POWER, 0);
195−
196− ret = gpio_request(NOKIA770_GPIO_MMC_SWITCH, "MMC cover");
197− if (ret < 0) {
198− gpio_free(NOKIA770_GPIO_MMC_POWER);
199− return;
200− }
201− gpio_direction_input(NOKIA770_GPIO_MMC_SWITCH);
202−
213+ gpiod_add_lookup_table(&nokia770_mmc_gpio_table);
203214 /* Only the second MMC controller is used */
204215 nokia770_mmc_data[1] = &nokia770_mmc2_data;
205216 omap1_init_mmc(nokia770_mmc_data, OMAP16XX_NR_MMC);
@@ -212,14 +223,16 @@ static inline void nokia770_mmc_init(void) · 6 unmodified lines
212223 #endif
213224
214225 #if IS_ENABLED(CONFIG_I2C_CBUS_GPIO)
215−static struct gpiod_lookup_table nokia770_cbus_gpio_table = {
216− .dev_id = "i2c-cbus-gpio.2",
217− .table = {
218− GPIO_LOOKUP_IDX("mpuio", 9, NULL, 0, 0), /* clk */
219− GPIO_LOOKUP_IDX("mpuio", 10, NULL, 1, 0), /* dat */
220− GPIO_LOOKUP_IDX("mpuio", 11, NULL, 2, 0), /* sel */
221− { },
222− },
226+
227+static const struct software_node_ref_args nokia770_cbus_gpio_refs[] = {
228+ SOFTWARE_NODE_REFERENCE(&nokia770_mpuio_gpiochip_node, 9, 0),
229+ SOFTWARE_NODE_REFERENCE(&nokia770_mpuio_gpiochip_node, 10, 0),
230+ SOFTWARE_NODE_REFERENCE(&nokia770_mpuio_gpiochip_node, 11, 0),
231+};
232+
233+static const struct property_entry nokia770_cbus_props[] = {
234+ PROPERTY_ENTRY_REF_ARRAY("gpios", nokia770_cbus_gpio_refs),
235+ { }
223236 };
224237
225238 static struct platform_device nokia770_cbus_device = {
@@ -238,22 +251,29 @@ static struct i2c_board_info nokia770_i2c_board_info_2[] __initdata = { · 12 unmodified lines
238251
239252 static void __init nokia770_cbus_init(void)
240253 {
241− const int retu_irq_gpio = 62;
242− const int tahvo_irq_gpio = 40;
243−
244− if (gpio_request_one(retu_irq_gpio, GPIOF_IN, "Retu IRQ"))
245− return;
246− if (gpio_request_one(tahvo_irq_gpio, GPIOF_IN, "Tahvo IRQ")) {
247− gpio_free(retu_irq_gpio);
248− return;
254+ struct gpio_desc *d;
255+ int irq;
256+
257+ d = gpiod_get(NULL, "retu_irq", GPIOD_IN);
258+ if (IS_ERR(d)) {
259+ pr_err("Unable to get CBUS Retu IRQ GPIO descriptor\n");
260+ } else {
261+ irq = gpiod_to_irq(d);
262+ irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING);
263+ nokia770_i2c_board_info_2[0].irq = irq;
264+ }
265+ d = gpiod_get(NULL, "tahvo_irq", GPIOD_IN);
266+ if (IS_ERR(d)) {
267+ pr_err("Unable to get CBUS Tahvo IRQ GPIO descriptor\n");
268+ } else {
269+ irq = gpiod_to_irq(d);
270+ irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING);
271+ nokia770_i2c_board_info_2[1].irq = irq;
249272 }
250− irq_set_irq_type(gpio_to_irq(retu_irq_gpio), IRQ_TYPE_EDGE_RISING);
251− irq_set_irq_type(gpio_to_irq(tahvo_irq_gpio), IRQ_TYPE_EDGE_RISING);
252− nokia770_i2c_board_info_2[0].irq = gpio_to_irq(retu_irq_gpio);
253− nokia770_i2c_board_info_2[1].irq = gpio_to_irq(tahvo_irq_gpio);
254273 i2c_register_board_info(2, nokia770_i2c_board_info_2,
255274 ARRAY_SIZE(nokia770_i2c_board_info_2));
256− gpiod_add_lookup_table(&nokia770_cbus_gpio_table);
275+ device_create_managed_software_node(&nokia770_cbus_device.dev,
276+ nokia770_cbus_props, NULL);
257277 platform_device_register(&nokia770_cbus_device);
258278 }
259279 #else /* CONFIG_I2C_CBUS_GPIO */
@@ -262,8 +282,33 @@ static void __init nokia770_cbus_init(void) · 2 unmodified lines
262282 }
263283 #endif /* CONFIG_I2C_CBUS_GPIO */
264284
285+static struct gpiod_lookup_table nokia770_irq_gpio_table = {
286+ .dev_id = NULL,
287+ .table = {
288+ /* GPIO used by SPI device 1 */
289+ GPIO_LOOKUP("gpio-0-15", 15, "ads7846_irq",
290+ GPIO_ACTIVE_HIGH),
291+ /* GPIO used for retu IRQ */
292+ GPIO_LOOKUP("gpio-48-63", 15, "retu_irq",
293+ GPIO_ACTIVE_HIGH),
294+ /* GPIO used for tahvo IRQ */
295+ GPIO_LOOKUP("gpio-32-47", 8, "tahvo_irq",
296+ GPIO_ACTIVE_HIGH),
297+ /* GPIOs used by serial wakeup IRQs */
298+ GPIO_LOOKUP_IDX("gpio-32-47", 5, "wakeup", 0,
299+ GPIO_ACTIVE_HIGH),
300+ GPIO_LOOKUP_IDX("gpio-16-31", 2, "wakeup", 1,
301+ GPIO_ACTIVE_HIGH),
302+ GPIO_LOOKUP_IDX("gpio-48-63", 1, "wakeup", 2,
303+ GPIO_ACTIVE_HIGH),
304+ { }
305+ },
306+};
307+
265308 static void __init omap_nokia770_init(void)
266309 {
310+ struct gpio_desc *d;
311+
267312 /* On Nokia 770, the SleepX signal is masked with an
268313 * MPUIO line by default. It has to be unmasked for it
269314 * to become functional */
@@ -273,8 +318,16 @@ static void __init omap_nokia770_init(void) · 3 unmodified lines
273318 /* Unmask SleepX signal */
274319 omap_writew((omap_readw(0xfffb5004) & ~2), 0xfffb5004);
275320
321+ software_node_register_node_group(nokia770_gpiochip_nodes);
276322 platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices));
277− nokia770_spi_board_info[1].irq = gpio_to_irq(15);
323+
324+ gpiod_add_lookup_table(&nokia770_irq_gpio_table);
325+ d = gpiod_get(NULL, "ads7846_irq", GPIOD_IN);
326+ if (IS_ERR(d))
327+ pr_err("Unable to get ADS7846 IRQ GPIO descriptor\n");
328+ else
329+ nokia770_spi_board_info[1].irq = gpiod_to_irq(d);
330+
278331 spi_register_board_info(nokia770_spi_board_info,
279332 ARRAY_SIZE(nokia770_spi_board_info));
280333 omap_serial_init();
arch/arm/mach-omap1/board-osk.c+102−44
@@ -25,7 +25,8 @@ · 24 unmodified lines
2525 * with this program; if not, write to the Free Software Foundation, Inc.,
2626 * 675 Mass Ave, Cambridge, MA 02139, USA.
2727 */
28−#include <linux/gpio.h>
28+#include <linux/gpio/consumer.h>
29+#include <linux/gpio/driver.h>
2930 #include <linux/gpio/machine.h>
3031 #include <linux/kernel.h>
3132 #include <linux/init.h>
@@ -64,13 +65,12 @@ · 32 unmodified lines
6465 /* TPS65010 has four GPIOs. nPG and LED2 can be treated like GPIOs with
6566 * alternate pin configurations for hardware-controlled blinking.
6667 */
67−#define OSK_TPS_GPIO_BASE (OMAP_MAX_GPIO_LINES + 16 /* MPUIO */)
68−# define OSK_TPS_GPIO_USB_PWR_EN (OSK_TPS_GPIO_BASE + 0)
69−# define OSK_TPS_GPIO_LED_D3 (OSK_TPS_GPIO_BASE + 1)
70−# define OSK_TPS_GPIO_LAN_RESET (OSK_TPS_GPIO_BASE + 2)
71−# define OSK_TPS_GPIO_DSP_PWR_EN (OSK_TPS_GPIO_BASE + 3)
72−# define OSK_TPS_GPIO_LED_D9 (OSK_TPS_GPIO_BASE + 4)
73−# define OSK_TPS_GPIO_LED_D2 (OSK_TPS_GPIO_BASE + 5)
68+#define OSK_TPS_GPIO_USB_PWR_EN 0
69+#define OSK_TPS_GPIO_LED_D3 1
70+#define OSK_TPS_GPIO_LAN_RESET 2
71+#define OSK_TPS_GPIO_DSP_PWR_EN 3
72+#define OSK_TPS_GPIO_LED_D9 4
73+#define OSK_TPS_GPIO_LED_D2 5
7474
7575 static struct mtd_partition osk_partitions[] = {
7676 /* bootloader (U-Boot, etc) in first sector */
@@ -174,11 +174,20 @@ static const struct gpio_led tps_leds[] = { · 97 unmodified lines
174174 /* NOTE: D9 and D2 have hardware blink support.
175175 * Also, D9 requires non-battery power.
176176 */
177− { .gpio = OSK_TPS_GPIO_LED_D9, .name = "d9",
178− .default_trigger = "disk-activity", },
179− { .gpio = OSK_TPS_GPIO_LED_D2, .name = "d2", },
180− { .gpio = OSK_TPS_GPIO_LED_D3, .name = "d3", .active_low = 1,
181− .default_trigger = "heartbeat", },
177+ { .name = "d9", .default_trigger = "disk-activity", },
178+ { .name = "d2", },
179+ { .name = "d3", .default_trigger = "heartbeat", },
180+};
181+
182+static struct gpiod_lookup_table tps_leds_gpio_table = {
183+ .dev_id = "leds-gpio",
184+ .table = {
185+ /* Use local offsets on TPS65010 */
186+ GPIO_LOOKUP_IDX("tps65010", OSK_TPS_GPIO_LED_D9, NULL, 0, GPIO_ACTIVE_HIGH),
187+ GPIO_LOOKUP_IDX("tps65010", OSK_TPS_GPIO_LED_D2, NULL, 1, GPIO_ACTIVE_HIGH),
188+ GPIO_LOOKUP_IDX("tps65010", OSK_TPS_GPIO_LED_D3, NULL, 2, GPIO_ACTIVE_LOW),
189+ { }
190+ },
182191 };
183192
184193 static struct gpio_led_platform_data tps_leds_data = {
@@ -192,29 +201,34 @@ static struct platform_device osk5912_tps_leds = { · 7 unmodified lines
192201 .dev.platform_data = &tps_leds_data,
193202 };
194203
195−static int osk_tps_setup(struct i2c_client *client, void *context)
204+/* The board just hold these GPIOs hogged from setup to teardown */
205+static struct gpio_desc *eth_reset;
206+static struct gpio_desc *vdd_dsp;
207+
208+static int osk_tps_setup(struct i2c_client *client, struct gpio_chip *gc)
196209 {
210+ struct gpio_desc *d;
197211 if (!IS_BUILTIN(CONFIG_TPS65010))
198212 return -ENOSYS;
199213
200214 /* Set GPIO 1 HIGH to disable VBUS power supply;
201215 * OHCI driver powers it up/down as needed.
202216 */
203− gpio_request(OSK_TPS_GPIO_USB_PWR_EN, "n_vbus_en");
204− gpio_direction_output(OSK_TPS_GPIO_USB_PWR_EN, 1);
217+ d = gpiochip_request_own_desc(gc, OSK_TPS_GPIO_USB_PWR_EN, "n_vbus_en",
218+ GPIO_ACTIVE_HIGH, GPIOD_OUT_HIGH);
205219 /* Free the GPIO again as the driver will request it */
206− gpio_free(OSK_TPS_GPIO_USB_PWR_EN);
220+ gpiochip_free_own_desc(d);
207221
208222 /* Set GPIO 2 high so LED D3 is off by default */
209223 tps65010_set_gpio_out_value(GPIO2, HIGH);
210224
211225 /* Set GPIO 3 low to take ethernet out of reset */
212− gpio_request(OSK_TPS_GPIO_LAN_RESET, "smc_reset");
213− gpio_direction_output(OSK_TPS_GPIO_LAN_RESET, 0);
226+ eth_reset = gpiochip_request_own_desc(gc, OSK_TPS_GPIO_LAN_RESET, "smc_reset",
227+ GPIO_ACTIVE_HIGH, GPIOD_OUT_LOW);
214228
215229 /* GPIO4 is VDD_DSP */
216− gpio_request(OSK_TPS_GPIO_DSP_PWR_EN, "dsp_power");
217− gpio_direction_output(OSK_TPS_GPIO_DSP_PWR_EN, 1);
230+ vdd_dsp = gpiochip_request_own_desc(gc, OSK_TPS_GPIO_DSP_PWR_EN, "dsp_power",
231+ GPIO_ACTIVE_HIGH, GPIOD_OUT_HIGH);
218232 /* REVISIT if DSP support isn't configured, power it off ... */
219233
220234 /* Let LED1 (D9) blink; leds-gpio may override it */
@@ -232,15 +246,22 @@ static int osk_tps_setup(struct i2c_client *client, void *context) · 11 unmodified lines
232246
233247 /* register these three LEDs */
234248 osk5912_tps_leds.dev.parent = &client->dev;
249+ gpiod_add_lookup_table(&tps_leds_gpio_table);
235250 platform_device_register(&osk5912_tps_leds);
236251
237252 return 0;
238253 }
239254
255+static void osk_tps_teardown(struct i2c_client *client, struct gpio_chip *gc)
256+{
257+ gpiochip_free_own_desc(eth_reset);
258+ gpiochip_free_own_desc(vdd_dsp);
259+}
260+
240261 static struct tps65010_board tps_board = {
241− .base = OSK_TPS_GPIO_BASE,
242262 .outmask = 0x0f,
243263 .setup = osk_tps_setup,
264+ .teardown = osk_tps_teardown,
244265 };
245266
246267 static struct i2c_board_info __initdata osk_i2c_board_info[] = {
@@ -263,11 +284,6 @@ static void __init osk_init_smc91x(void) · 16 unmodified lines
263284 {
264285 u32 l;
265286
266− if ((gpio_request(0, "smc_irq")) < 0) {
267− printk("Error requesting gpio 0 for smc91x irq\n");
268− return;
269− }
270−
271287 /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */
272288 l = omap_readl(EMIFS_CCS(1));
273289 l |= 0x3;
@@ -279,10 +295,6 @@ static void __init osk_init_cf(int seg) · 5 unmodified lines
279295 struct resource *res = &osk5912_cf_resources[1];
280296
281297 omap_cfg_reg(M7_1610_GPIO62);
282− if ((gpio_request(62, "cf_irq")) < 0) {
283− printk("Error requesting gpio 62 for CF irq\n");
284− return;
285− }
286298
287299 switch (seg) {
288300 /* NOTE: CS0 could be configured too ... */
@@ -308,18 +320,17 @@ static void __init osk_init_cf(int seg) · 19 unmodified lines
308320 seg, omap_readl(EMIFS_CCS(seg)), omap_readl(EMIFS_ACS(seg)));
309321 omap_writel(0x0004a1b3, EMIFS_CCS(seg)); /* synch mode 4 etc */
310322 omap_writel(0x00000000, EMIFS_ACS(seg)); /* OE hold/setup */
311−
312− /* the CF I/O IRQ is really active-low */
313− irq_set_irq_type(gpio_to_irq(62), IRQ_TYPE_EDGE_FALLING);
314323 }
315324
316325 static struct gpiod_lookup_table osk_usb_gpio_table = {
317326 .dev_id = "ohci",
318327 .table = {
319328 /* Power GPIO on the I2C-attached TPS65010 */
320− GPIO_LOOKUP("tps65010", 0, "power", GPIO_ACTIVE_HIGH),
329+ GPIO_LOOKUP("tps65010", OSK_TPS_GPIO_USB_PWR_EN, "power",
330+ GPIO_ACTIVE_HIGH),
321331 GPIO_LOOKUP(OMAP_GPIO_LABEL, 9, "overcurrent",
322332 GPIO_ACTIVE_HIGH),
333+ { }
323334 },
324335 };
325336
@@ -341,8 +352,32 @@ static struct omap_usb_config osk_usb_config __initdata = { · 15 unmodified lines
341352
342353 #define EMIFS_CS3_VAL (0x88013141)
343354
355+static struct gpiod_lookup_table osk_irq_gpio_table = {
356+ .dev_id = NULL,
357+ .table = {
358+ /* GPIO used for SMC91x IRQ */
359+ GPIO_LOOKUP(OMAP_GPIO_LABEL, 0, "smc_irq",
360+ GPIO_ACTIVE_HIGH),
361+ /* GPIO used for CF IRQ */
362+ GPIO_LOOKUP("gpio-48-63", 14, "cf_irq",
363+ GPIO_ACTIVE_HIGH),
364+ /* GPIO used by the TPS65010 chip */
365+ GPIO_LOOKUP("mpuio", 1, "tps65010",
366+ GPIO_ACTIVE_HIGH),
367+ /* GPIOs used for serial wakeup IRQs */
368+ GPIO_LOOKUP_IDX("gpio-32-47", 5, "wakeup", 0,
369+ GPIO_ACTIVE_HIGH),
370+ GPIO_LOOKUP_IDX("gpio-16-31", 2, "wakeup", 1,
371+ GPIO_ACTIVE_HIGH),
372+ GPIO_LOOKUP_IDX("gpio-48-63", 1, "wakeup", 2,
373+ GPIO_ACTIVE_HIGH),
374+ { }
375+ },
376+};
377+
344378 static void __init osk_init(void)
345379 {
380+ struct gpio_desc *d;
346381 u32 l;
347382
348383 osk_init_smc91x();
@@ -359,10 +394,31 @@ static void __init osk_init(void) · 10 unmodified lines
359394
360395 osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys();
361396 osk_flash_resource.end += SZ_32M - 1;
362− osk5912_smc91x_resources[1].start = gpio_to_irq(0);
363− osk5912_smc91x_resources[1].end = gpio_to_irq(0);
364− osk5912_cf_resources[0].start = gpio_to_irq(62);
365− osk5912_cf_resources[0].end = gpio_to_irq(62);
397+
398+ /*
399+ * Add the GPIOs to be used as IRQs and immediately look them up
400+ * to be passed as an IRQ resource. This is ugly but should work
401+ * until the day we convert to device tree.
402+ */
403+ gpiod_add_lookup_table(&osk_irq_gpio_table);
404+
405+ d = gpiod_get(NULL, "smc_irq", GPIOD_IN);
406+ if (IS_ERR(d)) {
407+ pr_err("Unable to get SMC IRQ GPIO descriptor\n");
408+ } else {
409+ irq_set_irq_type(gpiod_to_irq(d), IRQ_TYPE_EDGE_RISING);
410+ osk5912_smc91x_resources[1] = DEFINE_RES_IRQ(gpiod_to_irq(d));
411+ }
412+
413+ d = gpiod_get(NULL, "cf_irq", GPIOD_IN);
414+ if (IS_ERR(d)) {
415+ pr_err("Unable to get CF IRQ GPIO descriptor\n");
416+ } else {
417+ /* the CF I/O IRQ is really active-low */
418+ irq_set_irq_type(gpiod_to_irq(d), IRQ_TYPE_EDGE_FALLING);
419+ osk5912_cf_resources[0] = DEFINE_RES_IRQ(gpiod_to_irq(d));
420+ }
421+
366422 platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
367423
368424 l = omap_readl(USB_TRANSCEIVER_CTRL);
@@ -372,13 +428,15 @@ static void __init osk_init(void) · 3 unmodified lines
372428 gpiod_add_lookup_table(&osk_usb_gpio_table);
373429 omap1_usb_init(&osk_usb_config);
374430
431+ omap_serial_init();
432+
375433 /* irq for tps65010 chip */
376434 /* bootloader effectively does: omap_cfg_reg(U19_1610_MPUIO1); */
377− if (gpio_request(OMAP_MPUIO(1), "tps65010") == 0)
378− gpio_direction_input(OMAP_MPUIO(1));
379−
380− omap_serial_init();
381− osk_i2c_board_info[0].irq = gpio_to_irq(OMAP_MPUIO(1));
435+ d = gpiod_get(NULL, "tps65010", GPIOD_IN);
436+ if (IS_ERR(d))
437+ pr_err("Unable to get TPS65010 IRQ GPIO descriptor\n");
438+ else
439+ osk_i2c_board_info[0].irq = gpiod_to_irq(d);
382440 omap_register_i2c_bus(1, 400, osk_i2c_board_info,
383441 ARRAY_SIZE(osk_i2c_board_info));
384442 }
arch/arm/mach-omap1/board-palmte.c+31−20
@@ -13,7 +13,8 @@ · 12 unmodified lines
1313 *
1414 * Copyright (c) 2006 Andrzej Zaborowski <balrog@zabor.org>
1515 */
16−#include <linux/gpio.h>
16+#include <linux/gpio/machine.h>
17+#include <linux/gpio/consumer.h>
1718 #include <linux/kernel.h>
1819 #include <linux/init.h>
1920 #include <linux/input.h>
@@ -187,23 +188,6 @@ static struct spi_board_info palmte_spi_info[] __initdata = { · 167 unmodified lines
187188 },
188189 };
189190
190−static void __init palmte_misc_gpio_setup(void)
191−{
192− /* Set TSC2102 PINTDAV pin as input (used by TSC2102 driver) */
193− if (gpio_request(PALMTE_PINTDAV_GPIO, "TSC2102 PINTDAV") < 0) {
194− printk(KERN_ERR "Could not reserve PINTDAV GPIO!\n");
195− return;
196− }
197− gpio_direction_input(PALMTE_PINTDAV_GPIO);
198−
199− /* Set USB-or-DC-IN pin as input (unused) */
200− if (gpio_request(PALMTE_USB_OR_DC_GPIO, "USB/DC-IN") < 0) {
201− printk(KERN_ERR "Could not reserve cable signal GPIO!\n");
202− return;
203− }
204− gpio_direction_input(PALMTE_USB_OR_DC_GPIO);
205−}
206−
207191 #if IS_ENABLED(CONFIG_MMC_OMAP)
208192
209193 static struct omap_mmc_platform_data _palmte_mmc_config = {
@@ -231,8 +215,23 @@ static void palmte_mmc_init(void) · 21 unmodified lines
231215
232216 #endif /* CONFIG_MMC_OMAP */
233217
218+static struct gpiod_lookup_table palmte_irq_gpio_table = {
219+ .dev_id = NULL,
220+ .table = {
221+ /* GPIO used for TSC2102 PINTDAV IRQ */
222+ GPIO_LOOKUP("gpio-0-15", PALMTE_PINTDAV_GPIO, "tsc2102_irq",
223+ GPIO_ACTIVE_HIGH),
224+ /* GPIO used for USB or DC input detection */
225+ GPIO_LOOKUP("gpio-0-15", PALMTE_USB_OR_DC_GPIO, "usb_dc_irq",
226+ GPIO_ACTIVE_HIGH),
227+ { }
228+ },
229+};
230+
234231 static void __init omap_palmte_init(void)
235232 {
233+ struct gpio_desc *d;
234+
236235 /* mux pins for uarts */
237236 omap_cfg_reg(UART1_TX);
238237 omap_cfg_reg(UART1_RTS);
@@ -243,9 +242,21 @@ static void __init omap_palmte_init(void) · 4 unmodified lines
243242
244243 platform_add_devices(palmte_devices, ARRAY_SIZE(palmte_devices));
245244
246− palmte_spi_info[0].irq = gpio_to_irq(PALMTE_PINTDAV_GPIO);
245+ gpiod_add_lookup_table(&palmte_irq_gpio_table);
246+ d = gpiod_get(NULL, "tsc2102_irq", GPIOD_IN);
247+ if (IS_ERR(d))
248+ pr_err("Unable to get TSC2102 IRQ GPIO descriptor\n");
249+ else
250+ palmte_spi_info[0].irq = gpiod_to_irq(d);
247251 spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info));
248− palmte_misc_gpio_setup();
252+
253+ /* We are getting this just to set it up as input */
254+ d = gpiod_get(NULL, "usb_dc_irq", GPIOD_IN);
255+ if (IS_ERR(d))
256+ pr_err("Unable to get USB/DC IRQ GPIO descriptor\n");
257+ else
258+ gpiod_put(d);
259+
249260 omap_serial_init();
250261 omap1_usb_init(&palmte_usb_config);
251262 omap_register_i2c_bus(1, 100, NULL, 0);
arch/arm/mach-omap1/board-sx1-mmc.c+0−1
@@ -9,7 +9,6 @@ · 8 unmodified lines
99 * Copyright (C) 2007 Instituto Nokia de Tecnologia - INdT
1010 */
1111
12−#include <linux/gpio.h>
1312 #include <linux/platform_device.h>
1413
1514 #include "hardware.h"
arch/arm/mach-omap1/board-sx1.c+33−7
@@ -11,7 +11,8 @@ · 10 unmodified lines
1111 * Maintainters : Vladimir Ananiev (aka Vovan888), Sergge
1212 * oslik.ru
1313 */
14−#include <linux/gpio.h>
14+#include <linux/gpio/machine.h>
15+#include <linux/gpio/consumer.h>
1516 #include <linux/kernel.h>
1617 #include <linux/init.h>
1718 #include <linux/input.h>
@@ -304,8 +305,23 @@ static struct platform_device *sx1_devices[] __initdata = { · 286 unmodified lines
304305
305306 /*-----------------------------------------*/
306307
308+static struct gpiod_lookup_table sx1_gpio_table = {
309+ .dev_id = NULL,
310+ .table = {
311+ GPIO_LOOKUP("gpio-0-15", 1, "irda_off",
312+ GPIO_ACTIVE_HIGH),
313+ GPIO_LOOKUP("gpio-0-15", 11, "switch",
314+ GPIO_ACTIVE_HIGH),
315+ GPIO_LOOKUP("gpio-0-15", 15, "usb_on",
316+ GPIO_ACTIVE_HIGH),
317+ { }
318+ },
319+};
320+
307321 static void __init omap_sx1_init(void)
308322 {
323+ struct gpio_desc *d;
324+
309325 /* mux pins for uarts */
310326 omap_cfg_reg(UART1_TX);
311327 omap_cfg_reg(UART1_RTS);
@@ -320,15 +336,25 @@ static void __init omap_sx1_init(void) · 8 unmodified lines
320336 omap_register_i2c_bus(1, 100, NULL, 0);
321337 omap1_usb_init(&sx1_usb_config);
322338 sx1_mmc_init();
339+ gpiod_add_lookup_table(&sx1_gpio_table);
323340
324341 /* turn on USB power */
325342 /* sx1_setusbpower(1); can't do it here because i2c is not ready */
326− gpio_request(1, "A_IRDA_OFF");
327− gpio_request(11, "A_SWITCH");
328− gpio_request(15, "A_USB_ON");
329− gpio_direction_output(1, 1); /*A_IRDA_OFF = 1 */
330− gpio_direction_output(11, 0); /*A_SWITCH = 0 */
331− gpio_direction_output(15, 0); /*A_USB_ON = 0 */
343+ d = gpiod_get(NULL, "irda_off", GPIOD_OUT_HIGH);
344+ if (IS_ERR(d))
345+ pr_err("Unable to get IRDA OFF GPIO descriptor\n");
346+ else
347+ gpiod_put(d);
348+ d = gpiod_get(NULL, "switch", GPIOD_OUT_LOW);
349+ if (IS_ERR(d))
350+ pr_err("Unable to get SWITCH GPIO descriptor\n");
351+ else
352+ gpiod_put(d);
353+ d = gpiod_get(NULL, "usb_on", GPIOD_OUT_LOW);
354+ if (IS_ERR(d))
355+ pr_err("Unable to get USB ON GPIO descriptor\n");
356+ else
357+ gpiod_put(d);
332358
333359 omapfb_set_lcd_config(&sx1_lcd_config);
334360 }
arch/arm/mach-omap1/devices.c+0−1
@@ -6,7 +6,6 @@ · 5 unmodified lines
66 */
77
88 #include <linux/dma-mapping.h>
9−#include <linux/gpio.h>
109 #include <linux/module.h>
1110 #include <linux/kernel.h>
1211 #include <linux/init.h>
arch/arm/mach-omap1/gpio15xx.c+0−1
@@ -8,7 +8,6 @@ · 7 unmodified lines
88 * Charulatha V <charu@ti.com>
99 */
1010
11−#include <linux/gpio.h>
1211 #include <linux/platform_data/gpio-omap.h>
1312 #include <linux/soc/ti/omap1-soc.h>
1413 #include <asm/irq.h>
arch/arm/mach-omap1/gpio16xx.c+0−1
@@ -8,7 +8,6 @@ · 7 unmodified lines
88 * Charulatha V <charu@ti.com>
99 */
1010
11−#include <linux/gpio.h>
1211 #include <linux/platform_data/gpio-omap.h>
1312 #include <linux/soc/ti/omap1-io.h>
1413
arch/arm/mach-omap1/irq.c+0−1
@@ -35,7 +35,6 @@ · 34 unmodified lines
3535 * with this program; if not, write to the Free Software Foundation, Inc.,
3636 * 675 Mass Ave, Cambridge, MA 02139, USA.
3737 */
38−#include <linux/gpio.h>
3938 #include <linux/init.h>
4039 #include <linux/module.h>
4140 #include <linux/sched.h>
arch/arm/mach-omap1/serial.c+15−15
@@ -4,7 +4,8 @@ · 3 unmodified lines
44 *
55 * OMAP1 serial support.
66 */
7−#include <linux/gpio.h>
7+#include <linux/gpio/machine.h>
8+#include <linux/gpio/consumer.h>
89 #include <linux/module.h>
910 #include <linux/kernel.h>
1011 #include <linux/init.h>
@@ -197,39 +198,38 @@ void omap_serial_wake_trigger(int enable) · 186 unmodified lines
197198 }
198199 }
199200
200−static void __init omap_serial_set_port_wakeup(int gpio_nr)
201+static void __init omap_serial_set_port_wakeup(int idx)
201202 {
203+ struct gpio_desc *d;
202204 int ret;
203205
204− ret = gpio_request(gpio_nr, "UART wake");
205− if (ret < 0) {
206− printk(KERN_ERR "Could not request UART wake GPIO: %i\n",
207− gpio_nr);
206+ d = gpiod_get_index(NULL, "wakeup", idx, GPIOD_IN);
207+ if (IS_ERR(d)) {
208+ pr_err("Unable to get UART wakeup GPIO descriptor\n");
208209 return;
209210 }
210− gpio_direction_input(gpio_nr);
211− ret = request_irq(gpio_to_irq(gpio_nr), &omap_serial_wake_interrupt,
211+ ret = request_irq(gpiod_to_irq(d), &omap_serial_wake_interrupt,
212212 IRQF_TRIGGER_RISING, "serial wakeup", NULL);
213213 if (ret) {
214− gpio_free(gpio_nr);
215− printk(KERN_ERR "No interrupt for UART wake GPIO: %i\n",
216− gpio_nr);
214+ gpiod_put(d);
215+ pr_err("No interrupt for UART%d wake GPIO\n", idx + 1);
217216 return;
218217 }
219− enable_irq_wake(gpio_to_irq(gpio_nr));
218+ enable_irq_wake(gpiod_to_irq(d));
220219 }
221220
221+
222222 int __init omap_serial_wakeup_init(void)
223223 {
224224 if (!cpu_is_omap16xx())
225225 return 0;
226226
227227 if (uart1_ck != NULL)
228− omap_serial_set_port_wakeup(37);
228+ omap_serial_set_port_wakeup(0);
229229 if (uart2_ck != NULL)
230− omap_serial_set_port_wakeup(18);
230+ omap_serial_set_port_wakeup(1);
231231 if (uart3_ck != NULL)
232− omap_serial_set_port_wakeup(49);
232+ omap_serial_set_port_wakeup(2);
233233
234234 return 0;
235235 }
arch/arm/mach-omap2/board-n8x0.c+44−112
@@ -10,7 +10,8 @@ · 9 unmodified lines
1010
1111 #include <linux/clk.h>
1212 #include <linux/delay.h>
13−#include <linux/gpio.h>
13+#include <linux/gpio/machine.h>
14+#include <linux/gpio/consumer.h>
1415 #include <linux/init.h>
1516 #include <linux/io.h>
1617 #include <linux/irq.h>
@@ -28,13 +29,12 @@ · 11 unmodified lines
2829
2930 #include "common.h"
3031 #include "mmc.h"
32+#include "usb-tusb6010.h"
3133 #include "soc.h"
3234 #include "common-board-devices.h"
3335
3436 #define TUSB6010_ASYNC_CS 1
3537 #define TUSB6010_SYNC_CS 4
36−#define TUSB6010_GPIO_INT 58
37−#define TUSB6010_GPIO_ENABLE 0
3838 #define TUSB6010_DMACHAN 0x3f
3939
4040 #define NOKIA_N810_WIMAX (1 << 2)
@@ -61,37 +61,6 @@ static void board_check_revision(void) · 20 unmodified lines
6161 }
6262
6363 #if IS_ENABLED(CONFIG_USB_MUSB_TUSB6010)
64−/*
65− * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and
66− * 1.5 V voltage regulators of PM companion chip. Companion chip will then
67− * provide then PGOOD signal to TUSB6010 which will release it from reset.
68− */
69−static int tusb_set_power(int state)
70−{
71− int i, retval = 0;
72−
73− if (state) {
74− gpio_set_value(TUSB6010_GPIO_ENABLE, 1);
75− msleep(1);
76−
77− /* Wait until TUSB6010 pulls INT pin down */
78− i = 100;
79− while (i && gpio_get_value(TUSB6010_GPIO_INT)) {
80− msleep(1);
81− i--;
82− }
83−
84− if (!i) {
85− printk(KERN_ERR "tusb: powerup failed\n");
86− retval = -ENODEV;
87− }
88− } else {
89− gpio_set_value(TUSB6010_GPIO_ENABLE, 0);
90− msleep(10);
91− }
92−
93− return retval;
94−}
9564
9665 static struct musb_hdrc_config musb_config = {
9766 .multipoint = 1,
@@ -102,39 +71,36 @@ static struct musb_hdrc_config musb_config = { · 4 unmodified lines
10271
10372 static struct musb_hdrc_platform_data tusb_data = {
10473 .mode = MUSB_OTG,
105− .set_power = tusb_set_power,
10674 .min_power = 25, /* x2 = 50 mA drawn from VBUS as peripheral */
10775 .power = 100, /* Max 100 mA VBUS for host mode */
10876 .config = &musb_config,
10977 };
11078
79+static struct gpiod_lookup_table tusb_gpio_table = {
80+ .dev_id = "musb-tusb",
81+ .table = {
82+ GPIO_LOOKUP("gpio-0-15", 0, "enable",
83+ GPIO_ACTIVE_HIGH),
84+ GPIO_LOOKUP("gpio-48-63", 10, "int",
85+ GPIO_ACTIVE_HIGH),
86+ { }
87+ },
88+};
89+
11190 static void __init n8x0_usb_init(void)
11291 {
11392 int ret = 0;
114− static const char announce[] __initconst = KERN_INFO "TUSB 6010\n";
115−
116− /* PM companion chip power control pin */
117− ret = gpio_request_one(TUSB6010_GPIO_ENABLE, GPIOF_OUT_INIT_LOW,
118− "TUSB6010 enable");
119− if (ret != 0) {
120− printk(KERN_ERR "Could not get TUSB power GPIO%i\n",
121− TUSB6010_GPIO_ENABLE);
122− return;
123− }
124− tusb_set_power(0);
12593
94+ gpiod_add_lookup_table(&tusb_gpio_table);
12695 ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2,
127− TUSB6010_ASYNC_CS, TUSB6010_SYNC_CS,
128− TUSB6010_GPIO_INT, TUSB6010_DMACHAN);
96+ TUSB6010_ASYNC_CS, TUSB6010_SYNC_CS,
97+ TUSB6010_DMACHAN);
12998 if (ret != 0)
130− goto err;
99+ return;
131100
132− printk(announce);
101+ pr_info("TUSB 6010\n");
133102
134103 return;
135−
136−err:
137− gpio_free(TUSB6010_GPIO_ENABLE);
138104 }
139105 #else
140106
@@ -170,22 +136,32 @@ static struct spi_board_info n800_spi_board_info[] __initdata = { · 29 unmodified lines
170136 * GPIO23 and GPIO9 slot 2 EMMC on N810
171137 *
172138 */
173−#define N8X0_SLOT_SWITCH_GPIO 96
174−#define N810_EMMC_VSD_GPIO 23
175−#define N810_EMMC_VIO_GPIO 9
176−
177139 static int slot1_cover_open;
178140 static int slot2_cover_open;
179141 static struct device *mmc_device;
180142
181−static int n8x0_mmc_switch_slot(struct device *dev, int slot)
182−{
183−#ifdef CONFIG_MMC_DEBUG
184− dev_dbg(dev, "Choose slot %d\n", slot + 1);
185−#endif
186− gpio_set_value(N8X0_SLOT_SWITCH_GPIO, slot);
187− return 0;
188−}
143+static struct gpiod_lookup_table nokia8xx_mmc_gpio_table = {
144+ .dev_id = "mmci-omap.0",
145+ .table = {
146+ /* Slot switch, GPIO 96 */
147+ GPIO_LOOKUP("gpio-80-111", 16,
148+ "switch", GPIO_ACTIVE_HIGH),
149+ { }
150+ },
151+};
152+
153+static struct gpiod_lookup_table nokia810_mmc_gpio_table = {
154+ .dev_id = "mmci-omap.0",
155+ .table = {
156+ /* Slot index 1, VSD power, GPIO 23 */
157+ GPIO_LOOKUP_IDX("gpio-16-31", 7,
158+ "vsd", 1, GPIO_ACTIVE_HIGH),
159+ /* Slot index 1, VIO power, GPIO 9 */
160+ GPIO_LOOKUP_IDX("gpio-0-15", 9,
161+ "vsd", 1, GPIO_ACTIVE_HIGH),
162+ { }
163+ },
164+};
189165
190166 static int n8x0_mmc_set_power_menelaus(struct device *dev, int slot,
191167 int power_on, int vdd)
@@ -256,31 +232,13 @@ static int n8x0_mmc_set_power_menelaus(struct device *dev, int slot, · 64 unmodified lines
256232 return 0;
257233 }
258234
259−static void n810_set_power_emmc(struct device *dev,
260− int power_on)
261−{
262− dev_dbg(dev, "Set EMMC power %s\n", power_on ? "on" : "off");
263−
264− if (power_on) {
265− gpio_set_value(N810_EMMC_VSD_GPIO, 1);
266− msleep(1);
267− gpio_set_value(N810_EMMC_VIO_GPIO, 1);
268− msleep(1);
269− } else {
270− gpio_set_value(N810_EMMC_VIO_GPIO, 0);
271− msleep(50);
272− gpio_set_value(N810_EMMC_VSD_GPIO, 0);
273− msleep(50);
274− }
275−}
276−
277235 static int n8x0_mmc_set_power(struct device *dev, int slot, int power_on,
278236 int vdd)
279237 {
280238 if (board_is_n800() || slot == 0)
281239 return n8x0_mmc_set_power_menelaus(dev, slot, power_on, vdd);
282240
283− n810_set_power_emmc(dev, power_on);
241+ /* The n810 power will be handled by GPIO code in the driver */
284242
285243 return 0;
286244 }
@@ -418,13 +376,6 @@ static void n8x0_mmc_shutdown(struct device *dev) · 131 unmodified lines
418376 static void n8x0_mmc_cleanup(struct device *dev)
419377 {
420378 menelaus_unregister_mmc_callback();
421−
422− gpio_free(N8X0_SLOT_SWITCH_GPIO);
423−
424− if (board_is_n810()) {
425− gpio_free(N810_EMMC_VSD_GPIO);
426− gpio_free(N810_EMMC_VIO_GPIO);
427− }
428379 }
429380
430381 /*
@@ -433,7 +384,6 @@ static void n8x0_mmc_cleanup(struct device *dev) · 2 unmodified lines
433384 */
434385 static struct omap_mmc_platform_data mmc1_data = {
435386 .nr_slots = 0,
436− .switch_slot = n8x0_mmc_switch_slot,
437387 .init = n8x0_mmc_late_init,
438388 .cleanup = n8x0_mmc_cleanup,
439389 .shutdown = n8x0_mmc_shutdown,
@@ -463,14 +413,9 @@ static struct omap_mmc_platform_data mmc1_data = { · 23 unmodified lines
463413
464414 static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC];
465415
466−static struct gpio n810_emmc_gpios[] __initdata = {
467− { N810_EMMC_VSD_GPIO, GPIOF_OUT_INIT_LOW, "MMC slot 2 Vddf" },
468− { N810_EMMC_VIO_GPIO, GPIOF_OUT_INIT_LOW, "MMC slot 2 Vdd" },
469−};
470−
471416 static void __init n8x0_mmc_init(void)
472417 {
473− int err;
418+ gpiod_add_lookup_table(&nokia8xx_mmc_gpio_table);
474419
475420 if (board_is_n810()) {
476421 mmc1_data.slots[0].name = "external";
@@ -483,20 +428,7 @@ static void __init n8x0_mmc_init(void) · 6 unmodified lines
483428 */
484429 mmc1_data.slots[1].name = "internal";
485430 mmc1_data.slots[1].ban_openended = 1;
486− }
487−
488− err = gpio_request_one(N8X0_SLOT_SWITCH_GPIO, GPIOF_OUT_INIT_LOW,
489− "MMC slot switch");
490− if (err)
491− return;
492−
493− if (board_is_n810()) {
494− err = gpio_request_array(n810_emmc_gpios,
495− ARRAY_SIZE(n810_emmc_gpios));
496− if (err) {
497− gpio_free(N8X0_SLOT_SWITCH_GPIO);
498− return;
499− }
431+ gpiod_add_lookup_table(&nokia810_mmc_gpio_table);
500432 }
501433
502434 mmc1_data.nr_slots = 2;
arch/arm/mach-omap2/omap_device.c+0−1
@@ -244,7 +244,6 @@ static int _omap_device_notifier_call(struct notifier_block *nb, · 243 unmodified lines
244244 case BUS_NOTIFY_ADD_DEVICE:
245245 if (pdev->dev.of_node)
246246 omap_device_build_from_dt(pdev);
247− omap_auxdata_legacy_init(dev);
248247 fallthrough;
249248 default:
250249 od = to_omap_device(pdev);
arch/arm/mach-omap2/pdata-quirks.c+66−66
@@ -6,8 +6,8 @@ · 5 unmodified lines
66 */
77 #include <linux/clk.h>
88 #include <linux/davinci_emac.h>
9+#include <linux/gpio/machine.h>
910 #include <linux/gpio/consumer.h>
10−#include <linux/gpio.h>
1111 #include <linux/init.h>
1212 #include <linux/kernel.h>
1313 #include <linux/of_platform.h>
@@ -41,7 +41,6 @@ struct pdata_init { · 27 unmodified lines
4141 };
4242
4343 static struct of_dev_auxdata omap_auxdata_lookup[];
44−static struct twl4030_gpio_platform_data twl_gpio_auxdata;
4544
4645 #ifdef CONFIG_MACH_NOKIA_N8X0
4746 static void __init omap2420_n8x0_legacy_init(void)
@@ -98,52 +97,43 @@ static struct iommu_platform_data omap3_iommu_isp_pdata = { · 50 unmodified lines
9897 };
9998 #endif
10099
101−static int omap3_sbc_t3730_twl_callback(struct device *dev,
102− unsigned gpio,
103− unsigned ngpio)
100+static void __init omap3_sbc_t3x_usb_hub_init(char *hub_name, int idx)
104101 {
105− int res;
102+ struct gpio_desc *d;
106103
107− res = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
108− "wlan pwr");
109− if (res)
110− return res;
111−
112− gpiod_export(gpio_to_desc(gpio), 0);
113−
114− return 0;
115−}
116−
117−static void __init omap3_sbc_t3x_usb_hub_init(int gpio, char *hub_name)
118−{
119− int err = gpio_request_one(gpio, GPIOF_OUT_INIT_LOW, hub_name);
120−
121− if (err) {
122− pr_err("SBC-T3x: %s reset gpio request failed: %d\n",
123− hub_name, err);
104+ /* This asserts the RESET line (reverse polarity) */
105+ d = gpiod_get_index(NULL, "reset", idx, GPIOD_OUT_HIGH);
106+ if (IS_ERR(d)) {
107+ pr_err("Unable to get T3x USB reset GPIO descriptor\n");
124108 return;
125109 }
126−
127− gpiod_export(gpio_to_desc(gpio), 0);
128−
110+ gpiod_set_consumer_name(d, hub_name);
111+ gpiod_export(d, 0);
129112 udelay(10);
130− gpio_set_value(gpio, 1);
113+ /* De-assert RESET */
114+ gpiod_set_value(d, 0);
131115 msleep(1);
132116 }
133117
134−static void __init omap3_sbc_t3730_twl_init(void)
135−{
136− twl_gpio_auxdata.setup = omap3_sbc_t3730_twl_callback;
137−}
118+static struct gpiod_lookup_table omap3_sbc_t3x_usb_gpio_table = {
119+ .dev_id = NULL,
120+ .table = {
121+ GPIO_LOOKUP_IDX("gpio-160-175", 7, "reset", 0,
122+ GPIO_ACTIVE_LOW),
123+ { }
124+ },
125+};
138126
139127 static void __init omap3_sbc_t3730_legacy_init(void)
140128 {
141− omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub");
129+ gpiod_add_lookup_table(&omap3_sbc_t3x_usb_gpio_table);
130+ omap3_sbc_t3x_usb_hub_init("sb-t35 usb hub", 0);
142131 }
143132
144133 static void __init omap3_sbc_t3530_legacy_init(void)
145134 {
146− omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub");
135+ gpiod_add_lookup_table(&omap3_sbc_t3x_usb_gpio_table);
136+ omap3_sbc_t3x_usb_hub_init("sb-t35 usb hub", 0);
147137 }
148138
149139 static void __init omap3_evm_legacy_init(void)
@@ -187,31 +177,59 @@ static void __init am35xx_emac_reset(void) · 37 unmodified lines
187177 omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); /* OCP barrier */
188178 }
189179
190−static struct gpio cm_t3517_wlan_gpios[] __initdata = {
191− { 56, GPIOF_OUT_INIT_HIGH, "wlan pwr" },
192− { 4, GPIOF_OUT_INIT_HIGH, "xcvr noe" },
180+static struct gpiod_lookup_table cm_t3517_wlan_gpio_table = {
181+ .dev_id = NULL,
182+ .table = {
183+ GPIO_LOOKUP("gpio-48-53", 8, "power",
184+ GPIO_ACTIVE_HIGH),
185+ GPIO_LOOKUP("gpio-0-15", 4, "noe",
186+ GPIO_ACTIVE_HIGH),
187+ { }
188+ },
193189 };
194190
195191 static void __init omap3_sbc_t3517_wifi_init(void)
196192 {
197− int err = gpio_request_array(cm_t3517_wlan_gpios,
198− ARRAY_SIZE(cm_t3517_wlan_gpios));
199− if (err) {
200− pr_err("SBC-T3517: wl12xx gpios request failed: %d\n", err);
201− return;
202− }
193+ struct gpio_desc *d;
194+
195+ gpiod_add_lookup_table(&cm_t3517_wlan_gpio_table);
203196
204− gpiod_export(gpio_to_desc(cm_t3517_wlan_gpios[0].gpio), 0);
205− gpiod_export(gpio_to_desc(cm_t3517_wlan_gpios[1].gpio), 0);
197+ /* This asserts the RESET line (reverse polarity) */
198+ d = gpiod_get(NULL, "power", GPIOD_OUT_HIGH);
199+ if (IS_ERR(d)) {
200+ pr_err("Unable to get CM T3517 WLAN power GPIO descriptor\n");
201+ } else {
202+ gpiod_set_consumer_name(d, "wlan pwr");
203+ gpiod_export(d, 0);
204+ }
206205
206+ d = gpiod_get(NULL, "noe", GPIOD_OUT_HIGH);
207+ if (IS_ERR(d)) {
208+ pr_err("Unable to get CM T3517 WLAN XCVR NOE GPIO descriptor\n");
209+ } else {
210+ gpiod_set_consumer_name(d, "xcvr noe");
211+ gpiod_export(d, 0);
212+ }
207213 msleep(100);
208− gpio_set_value(cm_t3517_wlan_gpios[1].gpio, 0);
209−}
214+ gpiod_set_value(d, 0);
215+}
216+
217+static struct gpiod_lookup_table omap3_sbc_t3517_usb_gpio_table = {
218+ .dev_id = NULL,
219+ .table = {
220+ GPIO_LOOKUP_IDX("gpio-144-159", 8, "reset", 0,
221+ GPIO_ACTIVE_LOW),
222+ GPIO_LOOKUP_IDX("gpio-96-111", 2, "reset", 1,
223+ GPIO_ACTIVE_LOW),
224+ { }
225+ },
226+};
210227
211228 static void __init omap3_sbc_t3517_legacy_init(void)
212229 {
213− omap3_sbc_t3x_usb_hub_init(152, "cm-t3517 usb hub");
214− omap3_sbc_t3x_usb_hub_init(98, "sb-t35 usb hub");
230+ gpiod_add_lookup_table(&omap3_sbc_t3517_usb_gpio_table);
231+ omap3_sbc_t3x_usb_hub_init("cm-t3517 usb hub", 0);
232+ omap3_sbc_t3x_usb_hub_init("sb-t35 usb hub", 1);
215233 am35xx_emac_reset();
216234 hsmmc2_internal_input_clk();
217235 omap3_sbc_t3517_wifi_init();
@@ -393,21 +411,6 @@ static struct ti_prm_platform_data ti_prm_pdata = { · 175 unmodified lines
393411 .clkdm_lookup = clkdm_lookup,
394412 };
395413
396−/*
397− * GPIOs for TWL are initialized by the I2C bus and need custom
398− * handing until DSS has device tree bindings.
399− */
400−void omap_auxdata_legacy_init(struct device *dev)
401−{
402− if (dev->platform_data)
403− return;
404−
405− if (strcmp("twl4030-gpio", dev_name(dev)))
406− return;
407−
408− dev->platform_data = &twl_gpio_auxdata;
409−}
410−
411414 #if defined(CONFIG_ARCH_OMAP3) && IS_ENABLED(CONFIG_SND_SOC_OMAP_MCBSP)
412415 static struct omap_mcbsp_platform_data mcbsp_pdata;
413416 static void __init omap3_mcbsp_init(void)
@@ -427,9 +430,6 @@ static struct pdata_init auxdata_quirks[] __initdata = { · 13 unmodified lines
427430 { "nokia,n800", omap2420_n8x0_legacy_init, },
428431 { "nokia,n810", omap2420_n8x0_legacy_init, },
429432 { "nokia,n810-wimax", omap2420_n8x0_legacy_init, },
430−#endif
431−#ifdef CONFIG_ARCH_OMAP3
432− { "compulab,omap3-sbc-t3730", omap3_sbc_t3730_twl_init, },
433433 #endif
434434 { /* sentinel */ },
435435 };
arch/arm/mach-omap2/usb-tusb6010.c+4−16
@@ -11,12 +11,12 @@ · 10 unmodified lines
1111 #include <linux/errno.h>
1212 #include <linux/delay.h>
1313 #include <linux/platform_device.h>
14−#include <linux/gpio.h>
1514 #include <linux/export.h>
1615 #include <linux/platform_data/usb-omap.h>
1716
1817 #include <linux/usb/musb.h>
1918
19+#include "usb-tusb6010.h"
2020 #include "gpmc.h"
2121
2222 static u8 async_cs, sync_cs;
@@ -132,10 +132,6 @@ static struct resource tusb_resources[] = { · 109 unmodified lines
132132 { /* Synchronous access */
133133 .flags = IORESOURCE_MEM,
134134 },
135− { /* IRQ */
136− .name = "mc",
137− .flags = IORESOURCE_IRQ,
138− },
139135 };
140136
141137 static u64 tusb_dmamask = ~(u32)0;
@@ -154,9 +150,9 @@ static struct platform_device tusb_device = { · 12 unmodified lines
154150
155151 /* this may be called only from board-*.c setup code */
156152 int __init tusb6010_setup_interface(struct musb_hdrc_platform_data *data,
157− unsigned ps_refclk, unsigned waitpin,
158− unsigned async, unsigned sync,
159− unsigned irq, unsigned dmachan)
153+ unsigned int ps_refclk, unsigned int waitpin,
154+ unsigned int async, unsigned int sync,
155+ unsigned int dmachan)
160156 {
161157 int status;
162158 static char error[] __initdata =
@@ -192,14 +188,6 @@ int __init tusb6010_setup_interface(struct musb_hdrc_platform_data *data, · 29 unmodified lines
192188 if (status < 0)
193189 return status;
194190
195− /* IRQ */
196− status = gpio_request_one(irq, GPIOF_IN, "TUSB6010 irq");
197− if (status < 0) {
198− printk(error, 3, status);
199− return status;
200− }
201− tusb_resources[2].start = gpio_to_irq(irq);
202−
203191 /* set up memory timings ... can speed them up later */
204192 if (!ps_refclk) {
205193 printk(error, 4, status);
arch/arm/mach-omap2/usb-tusb6010.h+12−0
@@ -0,0 +1,12 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+
3+#ifndef __USB_TUSB6010_H
4+#define __USB_TUSB6010_H
5+
6+extern int __init tusb6010_setup_interface(
7+ struct musb_hdrc_platform_data *data,
8+ unsigned int ps_refclk, unsigned int waitpin,
9+ unsigned int async_cs, unsigned int sync_cs,
10+ unsigned int dmachan);
11+
12+#endif /* __USB_TUSB6010_H */
arch/arm/mach-pxa/spitz.c+10−1
@@ -506,10 +506,18 @@ static struct ads7846_platform_data spitz_ads7846_info = { · 505 unmodified lines
506506 .x_plate_ohms = 419,
507507 .y_plate_ohms = 486,
508508 .pressure_max = 1024,
509− .gpio_pendown = SPITZ_GPIO_TP_INT,
510509 .wait_for_sync = spitz_ads7846_wait_for_hsync,
511510 };
512511
512+static struct gpiod_lookup_table spitz_ads7846_gpio_table = {
513+ .dev_id = "spi2.0",
514+ .table = {
515+ GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_TP_INT,
516+ "pendown", GPIO_ACTIVE_LOW),
517+ { }
518+ },
519+};
520+
513521 static void spitz_bl_kick_battery(void)
514522 {
515523 void (*kick_batt)(void);
@@ -594,6 +602,7 @@ static void __init spitz_spi_init(void) · 78 unmodified lines
594602 else
595603 gpiod_add_lookup_table(&spitz_lcdcon_gpio_table);
596604
605+ gpiod_add_lookup_table(&spitz_ads7846_gpio_table);
597606 gpiod_add_lookup_table(&spitz_spi_gpio_table);
598607 pxa2xx_set_spi_info(2, &spitz_spi_info);
599608 spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices));
arch/mips/alchemy/devboards/db1000.c+10−1
@@ -381,13 +381,21 @@ static struct platform_device db1100_mmc1_dev = { · 380 unmodified lines
381381 static struct ads7846_platform_data db1100_touch_pd = {
382382 .model = 7846,
383383 .vref_mv = 3300,
384− .gpio_pendown = 21,
385384 };
386385
387386 static struct spi_gpio_platform_data db1100_spictl_pd = {
388387 .num_chipselect = 1,
389388 };
390389
390+static struct gpiod_lookup_table db1100_touch_gpio_table = {
391+ .dev_id = "spi0.0",
392+ .table = {
393+ GPIO_LOOKUP("alchemy-gpio2", 21,
394+ "pendown", GPIO_ACTIVE_LOW),
395+ { }
396+ },
397+};
398+
391399 static struct spi_board_info db1100_spi_info[] __initdata = {
392400 [0] = {
393401 .modalias = "ads7846",
@@ -474,6 +482,7 @@ int __init db1000_dev_setup(void) · 80 unmodified lines
474482 pfc |= (1 << 0); /* SSI0 pins as GPIOs */
475483 alchemy_wrsys(pfc, AU1000_SYS_PINFUNC);
476484
485+ gpiod_add_lookup_table(&db1100_touch_gpio_table);
477486 spi_register_board_info(db1100_spi_info,
478487 ARRAY_SIZE(db1100_spi_info));
479488
drivers/gpio/gpio-twl4030.c+36−16
@@ -17,7 +17,9 @@ · 16 unmodified lines
1717 #include <linux/interrupt.h>
1818 #include <linux/kthread.h>
1919 #include <linux/irq.h>
20+#include <linux/gpio/machine.h>
2021 #include <linux/gpio/driver.h>
22+#include <linux/gpio/consumer.h>
2123 #include <linux/platform_device.h>
2224 #include <linux/of.h>
2325 #include <linux/irqdomain.h>
@@ -465,8 +467,7 @@ static int gpio_twl4030_debounce(u32 debounce, u8 mmc_cd) · 441 unmodified lines
465467 REG_GPIO_DEBEN1, 3);
466468 }
467469
468−static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev,
469− struct twl4030_gpio_platform_data *pdata)
470+static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev)
470471 {
471472 struct twl4030_gpio_platform_data *omap_twl_info;
472473
@@ -474,9 +475,6 @@ static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev, · 1 unmodified line
474475 if (!omap_twl_info)
475476 return NULL;
476477
477− if (pdata)
478− *omap_twl_info = *pdata;
479−
480478 omap_twl_info->use_leds = of_property_read_bool(dev->of_node,
481479 "ti,use-leds");
482480
@@ -504,9 +502,18 @@ static int gpio_twl4030_remove(struct platform_device *pdev) · 21 unmodified lines
504502 return 0;
505503 }
506504
505+/* Called from the registered devm action */
506+static void gpio_twl4030_power_off_action(void *data)
507+{
508+ struct gpio_desc *d = data;
509+
510+ gpiod_unexport(d);
511+ gpiochip_free_own_desc(d);
512+}
513+
507514 static int gpio_twl4030_probe(struct platform_device *pdev)
508515 {
509− struct twl4030_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
516+ struct twl4030_gpio_platform_data *pdata;
510517 struct device_node *node = pdev->dev.of_node;
511518 struct gpio_twl4030_priv *priv;
512519 int ret, irq_base;
@@ -546,9 +553,7 @@ no_irqs: · 33 unmodified lines
546553
547554 mutex_init(&priv->mutex);
548555
549− if (node)
550− pdata = of_gpio_twl4030(&pdev->dev, pdata);
551−
556+ pdata = of_gpio_twl4030(&pdev->dev);
552557 if (pdata == NULL) {
553558 dev_err(&pdev->dev, "Platform data is missing\n");
554559 return -ENXIO;
@@ -585,17 +590,32 @@ no_irqs: · 30 unmodified lines
585590 goto out;
586591 }
587592
588− platform_set_drvdata(pdev, priv);
593+ /*
594+ * Special quirk for the OMAP3 to hog and export a WLAN power
595+ * GPIO.
596+ */
597+ if (IS_ENABLED(CONFIG_ARCH_OMAP3) &&
598+ of_machine_is_compatible("compulab,omap3-sbc-t3730")) {
599+ struct gpio_desc *d;
589600
590− if (pdata->setup) {
591− int status;
601+ d = gpiochip_request_own_desc(&priv->gpio_chip,
602+ 2, "wlan pwr",
603+ GPIO_ACTIVE_HIGH,
604+ GPIOD_OUT_HIGH);
605+ if (IS_ERR(d))
606+ return dev_err_probe(&pdev->dev, PTR_ERR(d),
607+ "unable to hog wlan pwr GPIO\n");
608+
609+ gpiod_export(d, 0);
610+
611+ ret = devm_add_action_or_reset(&pdev->dev, gpio_twl4030_power_off_action, d);
612+ if (ret)
613+ return dev_err_probe(&pdev->dev, ret,
614+ "failed to install power off handler\n");
592615
593− status = pdata->setup(&pdev->dev, priv->gpio_chip.base,
594− TWL4030_GPIO_MAX);
595− if (status)
596− dev_dbg(&pdev->dev, "setup --> %d\n", status);
597616 }
598617
618+ platform_set_drvdata(pdev, priv);
599619 out:
600620 return ret;
601621 }
drivers/input/touchscreen/ads7846.c+41−72
@@ -24,11 +24,8 @@ · 23 unmodified lines
2424 #include <linux/interrupt.h>
2525 #include <linux/slab.h>
2626 #include <linux/pm.h>
27−#include <linux/of.h>
28−#include <linux/of_gpio.h>
29−#include <linux/of_device.h>
27+#include <linux/property.h>
3028 #include <linux/gpio/consumer.h>
31−#include <linux/gpio.h>
3229 #include <linux/spi/spi.h>
3330 #include <linux/spi/ads7846.h>
3431 #include <linux/regulator/consumer.h>
@@ -140,7 +137,7 @@ struct ads7846 { · 105 unmodified lines
140137 int (*filter)(void *data, int data_idx, int *val);
141138 void *filter_data;
142139 int (*get_pendown_state)(void);
143− int gpio_pendown;
140+ struct gpio_desc *gpio_pendown;
144141
145142 void (*wait_for_sync)(void);
146143 };
@@ -223,7 +220,7 @@ static int get_pendown_state(struct ads7846 *ts) · 76 unmodified lines
223220 if (ts->get_pendown_state)
224221 return ts->get_pendown_state();
225222
226− return !gpio_get_value(ts->gpio_pendown);
223+ return gpiod_get_value(ts->gpio_pendown);
227224 }
228225
229226 static void ads7846_report_pen_up(struct ads7846 *ts)
@@ -989,8 +986,6 @@ static int ads7846_setup_pendown(struct spi_device *spi, · 759 unmodified lines
989986 struct ads7846 *ts,
990987 const struct ads7846_platform_data *pdata)
991988 {
992− int err;
993−
994989 /*
995990 * REVISIT when the irq can be triggered active-low, or if for some
996991 * reason the touchscreen isn't hooked up, we don't need to access
@@ -999,25 +994,15 @@ static int ads7846_setup_pendown(struct spi_device *spi, · 2 unmodified lines
999994
1000995 if (pdata->get_pendown_state) {
1001996 ts->get_pendown_state = pdata->get_pendown_state;
1002− } else if (gpio_is_valid(pdata->gpio_pendown)) {
1003−
1004− err = devm_gpio_request_one(&spi->dev, pdata->gpio_pendown,
1005− GPIOF_IN, "ads7846_pendown");
1006− if (err) {
1007− dev_err(&spi->dev,
1008− "failed to request/setup pendown GPIO%d: %d\n",
1009− pdata->gpio_pendown, err);
1010− return err;
997+ } else {
998+ ts->gpio_pendown = gpiod_get(&spi->dev, "pendown", GPIOD_IN);
999+ if (IS_ERR(ts->gpio_pendown)) {
1000+ dev_err(&spi->dev, "failed to request pendown GPIO\n");
1001+ return PTR_ERR(ts->gpio_pendown);
10111002 }
1012−
1013− ts->gpio_pendown = pdata->gpio_pendown;
1014−
10151003 if (pdata->gpio_pendown_debounce)
1016− gpiod_set_debounce(gpio_to_desc(ts->gpio_pendown),
1004+ gpiod_set_debounce(ts->gpio_pendown,
10171005 pdata->gpio_pendown_debounce);
1018− } else {
1019− dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n");
1020− return -EINVAL;
10211006 }
10221007
10231008 return 0;
@@ -1119,7 +1104,6 @@ static int ads7846_setup_spi_msg(struct ads7846 *ts, · 95 unmodified lines
11191104 return 0;
11201105 }
11211106
1122−#ifdef CONFIG_OF
11231107 static const struct of_device_id ads7846_dt_ids[] = {
11241108 { .compatible = "ti,tsc2046", .data = (void *) 7846 },
11251109 { .compatible = "ti,ads7843", .data = (void *) 7843 },
@@ -1130,20 +1114,14 @@ static const struct of_device_id ads7846_dt_ids[] = { · 4 unmodified lines
11301114 };
11311115 MODULE_DEVICE_TABLE(of, ads7846_dt_ids);
11321116
1133−static const struct ads7846_platform_data *ads7846_probe_dt(struct device *dev)
1117+static const struct ads7846_platform_data *ads7846_get_props(struct device *dev)
11341118 {
11351119 struct ads7846_platform_data *pdata;
1136− struct device_node *node = dev->of_node;
1137− const struct of_device_id *match;
1120+ const struct platform_device_id *pdev_id;
11381121 u32 value;
11391122
1140− if (!node) {
1141− dev_err(dev, "Device does not have associated DT data\n");
1142− return ERR_PTR(-EINVAL);
1143− }
1144−
1145− match = of_match_device(ads7846_dt_ids, dev);
1146− if (!match) {
1123+ pdev_id = device_get_match_data(dev);
1124+ if (!pdev_id) {
11471125 dev_err(dev, "Unknown device model\n");
11481126 return ERR_PTR(-EINVAL);
11491127 }
@@ -1152,60 +1130,51 @@ static const struct ads7846_platform_data *ads7846_probe_dt(struct device *dev) · 2 unmodified lines
11521130 if (!pdata)
11531131 return ERR_PTR(-ENOMEM);
11541132
1155− pdata->model = (unsigned long)match->data;
1133+ pdata->model = (unsigned long)pdev_id->driver_data;
11561134
1157− of_property_read_u16(node, "ti,vref-delay-usecs",
1158− &pdata->vref_delay_usecs);
1159− of_property_read_u16(node, "ti,vref-mv", &pdata->vref_mv);
1160− pdata->keep_vref_on = of_property_read_bool(node, "ti,keep-vref-on");
1135+ device_property_read_u16(dev, "ti,vref-delay-usecs",
1136+ &pdata->vref_delay_usecs);
1137+ device_property_read_u16(dev, "ti,vref-mv", &pdata->vref_mv);
1138+ pdata->keep_vref_on = device_property_read_bool(dev, "ti,keep-vref-on");
11611139
1162− pdata->swap_xy = of_property_read_bool(node, "ti,swap-xy");
1140+ pdata->swap_xy = device_property_read_bool(dev, "ti,swap-xy");
11631141
1164− of_property_read_u16(node, "ti,settle-delay-usec",
1165− &pdata->settle_delay_usecs);
1166− of_property_read_u16(node, "ti,penirq-recheck-delay-usecs",
1167− &pdata->penirq_recheck_delay_usecs);
1142+ device_property_read_u16(dev, "ti,settle-delay-usec",
1143+ &pdata->settle_delay_usecs);
1144+ device_property_read_u16(dev, "ti,penirq-recheck-delay-usecs",
1145+ &pdata->penirq_recheck_delay_usecs);
11681146
1169− of_property_read_u16(node, "ti,x-plate-ohms", &pdata->x_plate_ohms);
1170− of_property_read_u16(node, "ti,y-plate-ohms", &pdata->y_plate_ohms);
1147+ device_property_read_u16(dev, "ti,x-plate-ohms", &pdata->x_plate_ohms);
1148+ device_property_read_u16(dev, "ti,y-plate-ohms", &pdata->y_plate_ohms);
11711149
1172− of_property_read_u16(node, "ti,x-min", &pdata->x_min);
1173− of_property_read_u16(node, "ti,y-min", &pdata->y_min);
1174− of_property_read_u16(node, "ti,x-max", &pdata->x_max);
1175− of_property_read_u16(node, "ti,y-max", &pdata->y_max);
1150+ device_property_read_u16(dev, "ti,x-min", &pdata->x_min);
1151+ device_property_read_u16(dev, "ti,y-min", &pdata->y_min);
1152+ device_property_read_u16(dev, "ti,x-max", &pdata->x_max);
1153+ device_property_read_u16(dev, "ti,y-max", &pdata->y_max);
11761154
11771155 /*
11781156 * touchscreen-max-pressure gets parsed during
11791157 * touchscreen_parse_properties()
11801158 */
1181− of_property_read_u16(node, "ti,pressure-min", &pdata->pressure_min);
1182− if (!of_property_read_u32(node, "touchscreen-min-pressure", &value))
1159+ device_property_read_u16(dev, "ti,pressure-min", &pdata->pressure_min);
1160+ if (!device_property_read_u32(dev, "touchscreen-min-pressure", &value))
11831161 pdata->pressure_min = (u16) value;
1184− of_property_read_u16(node, "ti,pressure-max", &pdata->pressure_max);
1162+ device_property_read_u16(dev, "ti,pressure-max", &pdata->pressure_max);
11851163
1186− of_property_read_u16(node, "ti,debounce-max", &pdata->debounce_max);
1187− if (!of_property_read_u32(node, "touchscreen-average-samples", &value))
1164+ device_property_read_u16(dev, "ti,debounce-max", &pdata->debounce_max);
1165+ if (!device_property_read_u32(dev, "touchscreen-average-samples", &value))
11881166 pdata->debounce_max = (u16) value;
1189− of_property_read_u16(node, "ti,debounce-tol", &pdata->debounce_tol);
1190− of_property_read_u16(node, "ti,debounce-rep", &pdata->debounce_rep);
1167+ device_property_read_u16(dev, "ti,debounce-tol", &pdata->debounce_tol);
1168+ device_property_read_u16(dev, "ti,debounce-rep", &pdata->debounce_rep);
11911169
1192− of_property_read_u32(node, "ti,pendown-gpio-debounce",
1170+ device_property_read_u32(dev, "ti,pendown-gpio-debounce",
11931171 &pdata->gpio_pendown_debounce);
11941172
1195− pdata->wakeup = of_property_read_bool(node, "wakeup-source") ||
1196− of_property_read_bool(node, "linux,wakeup");
1197−
1198− pdata->gpio_pendown = of_get_named_gpio(dev->of_node, "pendown-gpio", 0);
1173+ pdata->wakeup = device_property_read_bool(dev, "wakeup-source") ||
1174+ device_property_read_bool(dev, "linux,wakeup");
11991175
12001176 return pdata;
12011177 }
1202−#else
1203−static const struct ads7846_platform_data *ads7846_probe_dt(struct device *dev)
1204−{
1205− dev_err(dev, "no platform data defined\n");
1206− return ERR_PTR(-EINVAL);
1207−}
1208−#endif
12091178
12101179 static void ads7846_regulator_disable(void *regulator)
12111180 {
@@ -1269,7 +1238,7 @@ static int ads7846_probe(struct spi_device *spi) · 57 unmodified lines
12691238
12701239 pdata = dev_get_platdata(dev);
12711240 if (!pdata) {
1272− pdata = ads7846_probe_dt(dev);
1241+ pdata = ads7846_get_props(dev);
12731242 if (IS_ERR(pdata))
12741243 return PTR_ERR(pdata);
12751244 }
@@ -1426,7 +1395,7 @@ static struct spi_driver ads7846_driver = { · 150 unmodified lines
14261395 .driver = {
14271396 .name = "ads7846",
14281397 .pm = pm_sleep_ptr(&ads7846_pm),
1429− .of_match_table = of_match_ptr(ads7846_dt_ids),
1398+ .of_match_table = ads7846_dt_ids,
14301399 },
14311400 .probe = ads7846_probe,
14321401 .remove = ads7846_remove,
drivers/mfd/tps65010.c+5−9
@@ -506,12 +506,8 @@ static void tps65010_remove(struct i2c_client *client) · 505 unmodified lines
506506 struct tps65010 *tps = i2c_get_clientdata(client);
507507 struct tps65010_board *board = dev_get_platdata(&client->dev);
508508
509− if (board && board->teardown) {
510− int status = board->teardown(client, board->context);
511− if (status < 0)
512− dev_dbg(&client->dev, "board %s %s err %d\n",
513− "teardown", client->name, status);
514− }
509+ if (board && board->teardown)
510+ board->teardown(client, &tps->chip);
515511 if (client->irq > 0)
516512 free_irq(client->irq, tps);
517513 cancel_delayed_work_sync(&tps->work);
@@ -619,7 +615,7 @@ static int tps65010_probe(struct i2c_client *client) · 101 unmodified lines
619615 tps, DEBUG_FOPS);
620616
621617 /* optionally register GPIOs */
622− if (board && board->base != 0) {
618+ if (board) {
623619 tps->outmask = board->outmask;
624620
625621 tps->chip.label = client->name;
@@ -632,7 +628,7 @@ static int tps65010_probe(struct i2c_client *client) · 6 unmodified lines
632628 /* NOTE: only partial support for inputs; nyet IRQs */
633629 tps->chip.get = tps65010_gpio_get;
634630
635− tps->chip.base = board->base;
631+ tps->chip.base = -1;
636632 tps->chip.ngpio = 7;
637633 tps->chip.can_sleep = 1;
638634
@@ -641,7 +637,7 @@ static int tps65010_probe(struct i2c_client *client) · 2 unmodified lines
641637 dev_err(&client->dev, "can't add gpiochip, err %d\n",
642638 status);
643639 else if (board->setup) {
644− status = board->setup(client, board->context);
640+ status = board->setup(client, &tps->chip);
645641 if (status < 0) {
646642 dev_dbg(&client->dev,
647643 "board %s %s err %d\n",
drivers/mmc/host/omap.c+44−2
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #include <linux/clk.h>
2727 #include <linux/scatterlist.h>
2828 #include <linux/slab.h>
29+#include <linux/gpio/consumer.h>
2930 #include <linux/platform_data/mmc-omap.h>
3031
3132
@@ -111,6 +112,9 @@ struct mmc_omap_slot { · 79 unmodified lines
111112 struct mmc_request *mrq;
112113 struct mmc_omap_host *host;
113114 struct mmc_host *mmc;
115+ struct gpio_desc *vsd;
116+ struct gpio_desc *vio;
117+ struct gpio_desc *cover;
114118 struct omap_mmc_slot_data *pdata;
115119 };
116120
@@ -133,6 +137,7 @@ struct mmc_omap_host { · 16 unmodified lines
133137 int irq;
134138 unsigned char bus_mode;
135139 unsigned int reg_shift;
140+ struct gpio_desc *slot_switch;
136141
137142 struct work_struct cmd_abort_work;
138143 unsigned abort:1;
@@ -216,8 +221,13 @@ no_claim: · 77 unmodified lines
216221
217222 if (host->current_slot != slot) {
218223 OMAP_MMC_WRITE(host, CON, slot->saved_con & 0xFC00);
219− if (host->pdata->switch_slot != NULL)
220− host->pdata->switch_slot(mmc_dev(slot->mmc), slot->id);
224+ if (host->slot_switch)
225+ /*
226+ * With two slots and a simple GPIO switch, setting
227+ * the GPIO to 0 selects slot ID 0, setting it to 1
228+ * selects slot ID 1.
229+ */
230+ gpiod_set_value(host->slot_switch, slot->id);
221231 host->current_slot = slot;
222232 }
223233
@@ -297,6 +307,9 @@ static void mmc_omap_release_slot(struct mmc_omap_slot *slot, int clk_enabled) · 73 unmodified lines
297307 static inline
298308 int mmc_omap_cover_is_open(struct mmc_omap_slot *slot)
299309 {
310+ /* If we have a GPIO then use that */
311+ if (slot->cover)
312+ return gpiod_get_value(slot->cover);
300313 if (slot->pdata->get_cover_state)
301314 return slot->pdata->get_cover_state(mmc_dev(slot->mmc),
302315 slot->id);
@@ -1106,6 +1119,11 @@ static void mmc_omap_set_power(struct mmc_omap_slot *slot, int power_on, · 803 unmodified lines
11061119
11071120 host = slot->host;
11081121
1122+ if (slot->vsd)
1123+ gpiod_set_value(slot->vsd, power_on);
1124+ if (slot->vio)
1125+ gpiod_set_value(slot->vio, power_on);
1126+
11091127 if (slot->pdata->set_power != NULL)
11101128 slot->pdata->set_power(mmc_dev(slot->mmc), slot->id, power_on,
11111129 vdd);
@@ -1240,6 +1258,23 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id) · 128 unmodified lines
12401258 slot->power_mode = MMC_POWER_UNDEFINED;
12411259 slot->pdata = &host->pdata->slots[id];
12421260
1261+ /* Check for some optional GPIO controls */
1262+ slot->vsd = gpiod_get_index_optional(host->dev, "vsd",
1263+ id, GPIOD_OUT_LOW);
1264+ if (IS_ERR(slot->vsd))
1265+ return dev_err_probe(host->dev, PTR_ERR(slot->vsd),
1266+ "error looking up VSD GPIO\n");
1267+ slot->vio = gpiod_get_index_optional(host->dev, "vio",
1268+ id, GPIOD_OUT_LOW);
1269+ if (IS_ERR(slot->vio))
1270+ return dev_err_probe(host->dev, PTR_ERR(slot->vio),
1271+ "error looking up VIO GPIO\n");
1272+ slot->cover = gpiod_get_index_optional(host->dev, "cover",
1273+ id, GPIOD_IN);
1274+ if (IS_ERR(slot->cover))
1275+ return dev_err_probe(host->dev, PTR_ERR(slot->cover),
1276+ "error looking up cover switch GPIO\n");
1277+
12431278 host->slots[id] = slot;
12441279
12451280 mmc->caps = 0;
@@ -1349,6 +1384,13 @@ static int mmc_omap_probe(struct platform_device *pdev) · 103 unmodified lines
13491384 if (IS_ERR(host->virt_base))
13501385 return PTR_ERR(host->virt_base);
13511386
1387+ host->slot_switch = gpiod_get_optional(host->dev, "switch",
1388+ GPIOD_OUT_LOW);
1389+ if (IS_ERR(host->slot_switch))
1390+ return dev_err_probe(host->dev, PTR_ERR(host->slot_switch),
1391+ "error looking up slot switch GPIO\n");
1392+
1393+
13521394 INIT_WORK(&host->slot_release_work, mmc_omap_slot_release_work);
13531395 INIT_WORK(&host->send_stop_work, mmc_omap_send_stop_work);
13541396
drivers/usb/musb/musb_core.c+0−1
@@ -2330,7 +2330,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) · 2329 unmodified lines
23302330
23312331 spin_lock_init(&musb->lock);
23322332 spin_lock_init(&musb->list_lock);
2333− musb->board_set_power = plat->set_power;
23342333 musb->min_power = plat->min_power;
23352334 musb->ops = plat->platform_ops;
23362335 musb->port_mode = plat->mode;
drivers/usb/musb/musb_core.h+0−2
@@ -352,8 +352,6 @@ struct musb { · 351 unmodified lines
352352 u16 epmask;
353353 u8 nr_endpoints;
354354
355− int (*board_set_power)(int state);
356−
357355 u8 min_power; /* vbus for periph, in mA/2 */
358356
359357 enum musb_mode port_mode;
drivers/usb/musb/tusb6010.c+39−14
@@ -11,6 +11,8 @@ · 10 unmodified lines
1111 * interface.
1212 */
1313
14+#include <linux/gpio/consumer.h>
15+#include <linux/delay.h>
1416 #include <linux/module.h>
1517 #include <linux/kernel.h>
1618 #include <linux/errno.h>
@@ -30,6 +32,8 @@ struct tusb6010_glue { · 13 unmodified lines
3032 struct device *dev;
3133 struct platform_device *musb;
3234 struct platform_device *phy;
35+ struct gpio_desc *enable;
36+ struct gpio_desc *intpin;
3337 };
3438
3539 static void tusb_musb_set_vbus(struct musb *musb, int is_on);
@@ -1021,16 +1025,29 @@ static void tusb_setup_cpu_interface(struct musb *musb) · 985 unmodified lines
10211025
10221026 static int tusb_musb_start(struct musb *musb)
10231027 {
1028+ struct tusb6010_glue *glue = dev_get_drvdata(musb->controller->parent);
10241029 void __iomem *tbase = musb->ctrl_base;
1025− int ret = 0;
10261030 unsigned long flags;
10271031 u32 reg;
1032+ int i;
10281033
1029− if (musb->board_set_power)
1030− ret = musb->board_set_power(1);
1031− if (ret != 0) {
1032− printk(KERN_ERR "tusb: Cannot enable TUSB6010\n");
1033− return ret;
1034+ /*
1035+ * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and
1036+ * 1.5 V voltage regulators of PM companion chip. Companion chip will then
1037+ * provide then PGOOD signal to TUSB6010 which will release it from reset.
1038+ */
1039+ gpiod_set_value(glue->enable, 1);
1040+ msleep(1);
1041+
1042+ /* Wait for 100ms until TUSB6010 pulls INT pin down */
1043+ i = 100;
1044+ while (i && gpiod_get_value(glue->intpin)) {
1045+ msleep(1);
1046+ i--;
1047+ }
1048+ if (!i) {
1049+ pr_err("tusb: Powerup respones failed\n");
1050+ return -ENODEV;
10341051 }
10351052
10361053 spin_lock_irqsave(&musb->lock, flags);
@@ -1083,8 +1100,8 @@ static int tusb_musb_start(struct musb *musb) · 46 unmodified lines
10831100 err:
10841101 spin_unlock_irqrestore(&musb->lock, flags);
10851102
1086− if (musb->board_set_power)
1087− musb->board_set_power(0);
1103+ gpiod_set_value(glue->enable, 0);
1104+ msleep(10);
10881105
10891106 return -ENODEV;
10901107 }
@@ -1158,11 +1175,13 @@ done: · 67 unmodified lines
11581175
11591176 static int tusb_musb_exit(struct musb *musb)
11601177 {
1178+ struct tusb6010_glue *glue = dev_get_drvdata(musb->controller->parent);
1179+
11611180 del_timer_sync(&musb->dev_timer);
11621181 the_musb = NULL;
11631182
1164− if (musb->board_set_power)
1165− musb->board_set_power(0);
1183+ gpiod_set_value(glue->enable, 0);
1184+ msleep(10);
11661185
11671186 iounmap(musb->sync_va);
11681187
@@ -1218,6 +1237,15 @@ static int tusb_probe(struct platform_device *pdev) · 49 unmodified lines
12181237
12191238 glue->dev = &pdev->dev;
12201239
1240+ glue->enable = devm_gpiod_get(glue->dev, "enable", GPIOD_OUT_LOW);
1241+ if (IS_ERR(glue->enable))
1242+ return dev_err_probe(glue->dev, PTR_ERR(glue->enable),
1243+ "could not obtain power on/off GPIO\n");
1244+ glue->intpin = devm_gpiod_get(glue->dev, "int", GPIOD_IN);
1245+ if (IS_ERR(glue->intpin))
1246+ return dev_err_probe(glue->dev, PTR_ERR(glue->intpin),
1247+ "could not obtain INT GPIO\n");
1248+
12211249 pdata->platform_ops = &tusb_ops;
12221250
12231251 usb_phy_generic_register();
@@ -1236,10 +1264,7 @@ static int tusb_probe(struct platform_device *pdev) · 12 unmodified lines
12361264 musb_resources[1].end = pdev->resource[1].end;
12371265 musb_resources[1].flags = pdev->resource[1].flags;
12381266
1239− musb_resources[2].name = pdev->resource[2].name;
1240− musb_resources[2].start = pdev->resource[2].start;
1241− musb_resources[2].end = pdev->resource[2].end;
1242− musb_resources[2].flags = pdev->resource[2].flags;
1267+ musb_resources[2] = DEFINE_RES_IRQ_NAMED(gpiod_to_irq(glue->intpin), "mc");
12431268
12441269 pinfo = tusb_dev_info;
12451270 pinfo.parent = &pdev->dev;
drivers/video/fbdev/omap/lcd_mipid.c+10−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 */
88 #include <linux/device.h>
99 #include <linux/delay.h>
10+#include <linux/gpio/consumer.h>
1011 #include <linux/slab.h>
1112 #include <linux/workqueue.h>
1213 #include <linux/spi/spi.h>
@@ -41,6 +42,7 @@ struct mipid_device { · 28 unmodified lines
4142 when we can issue the
4243 next sleep in/out command */
4344 unsigned long hw_guard_wait; /* max guard time in jiffies */
45+ struct gpio_desc *reset;
4446
4547 struct omapfb_device *fbdev;
4648 struct spi_device *spi;
@@ -556,6 +558,12 @@ static int mipid_spi_probe(struct spi_device *spi) · 509 unmodified lines
556558 return -ENOMEM;
557559 }
558560
561+ /* This will de-assert RESET if active */
562+ md->reset = gpiod_get(&spi->dev, "reset", GPIOD_OUT_LOW);
563+ if (IS_ERR(md->reset))
564+ return dev_err_probe(&spi->dev, PTR_ERR(md->reset),
565+ "no reset GPIO line\n");
566+
559567 spi->mode = SPI_MODE_0;
560568 md->spi = spi;
561569 dev_set_drvdata(&spi->dev, md);
@@ -574,6 +582,8 @@ static void mipid_spi_remove(struct spi_device *spi) · 12 unmodified lines
574582 {
575583 struct mipid_device *md = dev_get_drvdata(&spi->dev);
576584
585+ /* Asserts RESET */
586+ gpiod_set_value(md->reset, 1);
577587 mipid_disable(&md->panel);
578588 kfree(md);
579589 }
include/linux/mfd/tps65010.h+4−7
@@ -28,6 +28,8 @@ · 27 unmodified lines
2828 #ifndef __LINUX_I2C_TPS65010_H
2929 #define __LINUX_I2C_TPS65010_H
3030
31+struct gpio_chip;
32+
3133 /*
3234 * ----------------------------------------------------------------------------
3335 * Registers, all 8 bits
@@ -176,12 +178,10 @@ struct i2c_client; · 142 unmodified lines
176178
177179 /**
178180 * struct tps65010_board - packages GPIO and LED lines
179− * @base: the GPIO number to assign to GPIO-1
180181 * @outmask: bit (N-1) is set to allow GPIO-N to be used as an
181182 * (open drain) output
182183 * @setup: optional callback issued once the GPIOs are valid
183184 * @teardown: optional callback issued before the GPIOs are invalidated
184− * @context: optional parameter passed to setup() and teardown()
185185 *
186186 * Board data may be used to package the GPIO (and LED) lines for use
187187 * in by the generic GPIO and LED frameworks. The first four GPIOs
@@ -193,12 +193,9 @@ struct i2c_client; · 5 unmodified lines
193193 * devices in their initial states using these GPIOs.
194194 */
195195 struct tps65010_board {
196− int base;
197196 unsigned outmask;
198−
199− int (*setup)(struct i2c_client *client, void *context);
200− int (*teardown)(struct i2c_client *client, void *context);
201− void *context;
197+ int (*setup)(struct i2c_client *client, struct gpio_chip *gc);
198+ void (*teardown)(struct i2c_client *client, struct gpio_chip *gc);
202199 };
203200
204201 #endif /* __LINUX_I2C_TPS65010_H */
include/linux/mfd/twl.h+0−3
@@ -593,9 +593,6 @@ struct twl4030_gpio_platform_data { · 592 unmodified lines
593593 */
594594 u32 pullups;
595595 u32 pulldowns;
596−
597− int (*setup)(struct device *dev,
598− unsigned gpio, unsigned ngpio);
599596 };
600597
601598 struct twl4030_madc_platform_data {
include/linux/platform_data/lcd-mipid.h+0−2
@@ -15,10 +15,8 @@ enum mipid_test_result { · 14 unmodified lines
1515 #ifdef __KERNEL__
1616
1717 struct mipid_platform_data {
18− int nreset_gpio;
1918 int data_lines;
2019
21− void (*shutdown)(struct mipid_platform_data *pdata);
2220 void (*set_bklight_level)(struct mipid_platform_data *pdata,
2321 int level);
2422 int (*get_bklight_level)(struct mipid_platform_data *pdata);
include/linux/platform_data/mmc-omap.h+0−2
@@ -20,8 +20,6 @@ struct omap_mmc_platform_data { · 19 unmodified lines
2020 * maximum frequency on the MMC bus */
2121 unsigned int max_freq;
2222
23− /* switch the bus to a new slot */
24− int (*switch_slot)(struct device *dev, int slot);
2523 /* initialize board-specific MMC functionality, can be NULL if
2624 * not supported */
2725 int (*init)(struct device *dev);
include/linux/spi/ads7846.h+0−2
@@ -35,8 +35,6 @@ struct ads7846_platform_data { · 34 unmodified lines
3535 u16 debounce_tol; /* tolerance used for filtering */
3636 u16 debounce_rep; /* additional consecutive good readings
3737 * required after the first two */
38− int gpio_pendown; /* the GPIO used to decide the pendown
39− * state if get_pendown_state == NULL */
4038 int gpio_pendown_debounce; /* platform specific debounce time for
4139 * the gpio_pendown */
4240 int (*get_pendown_state)(void);
include/linux/usb/musb.h+0−13
@@ -99,9 +99,6 @@ struct musb_hdrc_platform_data { · 98 unmodified lines
9999 /* (HOST or OTG) program PHY for external Vbus */
100100 unsigned extvbus:1;
101101
102− /* Power the device on or off */
103− int (*set_power)(int state);
104−
105102 /* MUSB configuration-specific details */
106103 const struct musb_hdrc_config *config;
107104
@@ -135,14 +132,4 @@ static inline int musb_mailbox(enum musb_vbus_id_status status) · 27 unmodified lines
135132 #define TUSB6010_REFCLK_24 41667 /* psec/clk @ 24.0 MHz XI */
136133 #define TUSB6010_REFCLK_19 52083 /* psec/clk @ 19.2 MHz CLKIN */
137134
138−#ifdef CONFIG_ARCH_OMAP2
139−
140−extern int __init tusb6010_setup_interface(
141− struct musb_hdrc_platform_data *data,
142− unsigned ps_refclk, unsigned waitpin,
143− unsigned async_cs, unsigned sync_cs,
144− unsigned irq, unsigned dmachan);
145−
146−#endif /* OMAP2 */
147−
148135 #endif /* __LINUX_USB_MUSB_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t