hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/arm/mach-pxa/palm27x.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Common code for Palm LD, T5, TX, Z72
34 *
45 * Copyright (C) 2010-2011 Marek Vasut <marek.vasut@gmail.com>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
9
- *
106 */
117
128 #include <linux/platform_device.h>
....@@ -17,10 +13,10 @@
1713 #include <linux/pda_power.h>
1814 #include <linux/pwm.h>
1915 #include <linux/pwm_backlight.h>
16
+#include <linux/gpio/machine.h>
2017 #include <linux/gpio.h>
2118 #include <linux/wm97xx.h>
2219 #include <linux/power_supply.h>
23
-#include <linux/usb/gpio_vbus.h>
2420 #include <linux/regulator/max1586.h>
2521 #include <linux/platform_data/i2c-pxa.h>
2622
....@@ -49,14 +45,10 @@
4945 .detect_delay_ms = 200,
5046 };
5147
52
-void __init palm27x_mmc_init(int detect, int ro, int power,
53
- int power_inverted)
48
+void __init palm27x_mmc_init(struct gpiod_lookup_table *gtable)
5449 {
55
- palm27x_mci_platform_data.gpio_card_detect = detect;
56
- palm27x_mci_platform_data.gpio_card_ro = ro;
57
- palm27x_mci_platform_data.gpio_power = power;
58
- palm27x_mci_platform_data.gpio_power_invert = power_inverted;
59
-
50
+ if (gtable)
51
+ gpiod_add_lookup_table(gtable);
6052 pxa_set_mci_info(&palm27x_mci_platform_data);
6153 }
6254 #endif
....@@ -167,32 +159,32 @@
167159 ******************************************************************************/
168160 #if defined(CONFIG_USB_PXA27X) || \
169161 defined(CONFIG_USB_PXA27X_MODULE)
170
-static struct gpio_vbus_mach_info palm27x_udc_info = {
171
- .gpio_vbus_inverted = 1,
162
+
163
+/* The actual GPIO offsets get filled in in the palm27x_udc_init() call */
164
+static struct gpiod_lookup_table palm27x_udc_gpiod_table = {
165
+ .dev_id = "gpio-vbus",
166
+ .table = {
167
+ GPIO_LOOKUP("gpio-pxa", 0,
168
+ "vbus", GPIO_ACTIVE_HIGH),
169
+ GPIO_LOOKUP("gpio-pxa", 0,
170
+ "pullup", GPIO_ACTIVE_HIGH),
171
+ { },
172
+ },
172173 };
173174
174175 static struct platform_device palm27x_gpio_vbus = {
175176 .name = "gpio-vbus",
176177 .id = -1,
177
- .dev = {
178
- .platform_data = &palm27x_udc_info,
179
- },
180178 };
181179
182180 void __init palm27x_udc_init(int vbus, int pullup, int vbus_inverted)
183181 {
184
- palm27x_udc_info.gpio_vbus = vbus;
185
- palm27x_udc_info.gpio_pullup = pullup;
182
+ palm27x_udc_gpiod_table.table[0].chip_hwnum = vbus;
183
+ palm27x_udc_gpiod_table.table[1].chip_hwnum = pullup;
184
+ if (vbus_inverted)
185
+ palm27x_udc_gpiod_table.table[0].flags = GPIO_ACTIVE_LOW;
186186
187
- palm27x_udc_info.gpio_vbus_inverted = vbus_inverted;
188
-
189
- if (!gpio_request(pullup, "USB Pullup")) {
190
- gpio_direction_output(pullup,
191
- palm27x_udc_info.gpio_vbus_inverted);
192
- gpio_free(pullup);
193
- } else
194
- return;
195
-
187
+ gpiod_add_lookup_table(&palm27x_udc_gpiod_table);
196188 platform_device_register(&palm27x_gpio_vbus);
197189 }
198190 #endif
....@@ -326,7 +318,6 @@
326318 static struct platform_pwm_backlight_data palm27x_backlight_data = {
327319 .max_brightness = 0xfe,
328320 .dft_brightness = 0x7e,
329
- .enable_gpio = -1,
330321 .init = palm27x_backlight_init,
331322 .notify = palm27x_backlight_notify,
332323 .exit = palm27x_backlight_exit,