forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 61598093bbdd283a7edc367d900f223070ead8d2
kernel/arch/arm/mach-pxa/palmte2.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Hardware definitions for Palm Tungsten|E2
34 *
....@@ -7,18 +8,14 @@
78 * Rewrite for mainline:
89 * Marek Vasut <marek.vasut@gmail.com>
910 *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License version 2 as
12
- * published by the Free Software Foundation.
13
- *
1411 * (find more info at www.hackndev.com)
15
- *
1612 */
1713
1814 #include <linux/platform_device.h>
1915 #include <linux/delay.h>
2016 #include <linux/irq.h>
2117 #include <linux/gpio_keys.h>
18
+#include <linux/gpio/machine.h>
2219 #include <linux/input.h>
2320 #include <linux/pda_power.h>
2421 #include <linux/pwm.h>
....@@ -26,7 +23,6 @@
2623 #include <linux/gpio.h>
2724 #include <linux/wm97xx.h>
2825 #include <linux/power_supply.h>
29
-#include <linux/usb/gpio_vbus.h>
3026
3127 #include <asm/mach-types.h>
3228 #include <asm/mach/arch.h>
....@@ -101,9 +97,19 @@
10197 ******************************************************************************/
10298 static struct pxamci_platform_data palmte2_mci_platform_data = {
10399 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
104
- .gpio_card_detect = GPIO_NR_PALMTE2_SD_DETECT_N,
105
- .gpio_card_ro = GPIO_NR_PALMTE2_SD_READONLY,
106
- .gpio_power = GPIO_NR_PALMTE2_SD_POWER,
100
+};
101
+
102
+static struct gpiod_lookup_table palmte2_mci_gpio_table = {
103
+ .dev_id = "pxa2xx-mci.0",
104
+ .table = {
105
+ GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTE2_SD_DETECT_N,
106
+ "cd", GPIO_ACTIVE_LOW),
107
+ GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTE2_SD_READONLY,
108
+ "wp", GPIO_ACTIVE_LOW),
109
+ GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTE2_SD_POWER,
110
+ "power", GPIO_ACTIVE_HIGH),
111
+ { },
112
+ },
107113 };
108114
109115 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
....@@ -169,7 +175,6 @@
169175 static struct platform_pwm_backlight_data palmte2_backlight_data = {
170176 .max_brightness = PALMTE2_MAX_INTENSITY,
171177 .dft_brightness = PALMTE2_MAX_INTENSITY,
172
- .enable_gpio = -1,
173178 .init = palmte2_backlight_init,
174179 .notify = palmte2_backlight_notify,
175180 .exit = palmte2_backlight_exit,
....@@ -194,18 +199,20 @@
194199 /******************************************************************************
195200 * UDC
196201 ******************************************************************************/
197
-static struct gpio_vbus_mach_info palmte2_udc_info = {
198
- .gpio_vbus = GPIO_NR_PALMTE2_USB_DETECT_N,
199
- .gpio_vbus_inverted = 1,
200
- .gpio_pullup = GPIO_NR_PALMTE2_USB_PULLUP,
202
+static struct gpiod_lookup_table palmte2_udc_gpiod_table = {
203
+ .dev_id = "gpio-vbus",
204
+ .table = {
205
+ GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTE2_USB_DETECT_N,
206
+ "vbus", GPIO_ACTIVE_LOW),
207
+ GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTE2_USB_PULLUP,
208
+ "pullup", GPIO_ACTIVE_HIGH),
209
+ { },
210
+ },
201211 };
202212
203213 static struct platform_device palmte2_gpio_vbus = {
204214 .name = "gpio-vbus",
205215 .id = -1,
206
- .dev = {
207
- .platform_data = &palmte2_udc_info,
208
- },
209216 };
210217
211218 /******************************************************************************
....@@ -354,12 +361,14 @@
354361 pxa_set_stuart_info(NULL);
355362
356363 pxa_set_fb_info(NULL, &palmte2_lcd_screen);
364
+ gpiod_add_lookup_table(&palmte2_mci_gpio_table);
357365 pxa_set_mci_info(&palmte2_mci_platform_data);
358366 palmte2_udc_init();
359367 pxa_set_ac97_info(&palmte2_ac97_pdata);
360368 pxa_set_ficp_info(&palmte2_ficp_platform_data);
361369
362370 pwm_add_table(palmte2_pwm_lookup, ARRAY_SIZE(palmte2_pwm_lookup));
371
+ gpiod_add_lookup_table(&palmte2_udc_gpiod_table);
363372 platform_add_devices(devices, ARRAY_SIZE(devices));
364373 }
365374