| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * linux/arch/arm/mach-pxa/palmtc.c |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 8 | 9 | * Based on work of: |
|---|
| 9 | 10 | * Petr Blaha <p3t3@centrum.cz> |
|---|
| 10 | 11 | * Chetan S. Kumar <shivakumar.chetan@gmail.com> |
|---|
| 11 | | - * |
|---|
| 12 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 13 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 14 | | - * published by the Free Software Foundation. |
|---|
| 15 | 12 | */ |
|---|
| 16 | 13 | |
|---|
| 17 | 14 | #include <linux/platform_device.h> |
|---|
| .. | .. |
|---|
| 20 | 17 | #include <linux/input.h> |
|---|
| 21 | 18 | #include <linux/pwm.h> |
|---|
| 22 | 19 | #include <linux/pwm_backlight.h> |
|---|
| 23 | | -#include <linux/gpio.h> |
|---|
| 20 | +#include <linux/gpio/machine.h> |
|---|
| 24 | 21 | #include <linux/input/matrix_keypad.h> |
|---|
| 25 | 22 | #include <linux/ucb1400.h> |
|---|
| 26 | 23 | #include <linux/power_supply.h> |
|---|
| 27 | 24 | #include <linux/gpio_keys.h> |
|---|
| 28 | 25 | #include <linux/mtd/physmap.h> |
|---|
| 29 | | -#include <linux/usb/gpio_vbus.h> |
|---|
| 30 | 26 | |
|---|
| 31 | 27 | #include <asm/mach-types.h> |
|---|
| 32 | 28 | #include <asm/mach/arch.h> |
|---|
| .. | .. |
|---|
| 120 | 116 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) |
|---|
| 121 | 117 | static struct pxamci_platform_data palmtc_mci_platform_data = { |
|---|
| 122 | 118 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
|---|
| 123 | | - .gpio_power = GPIO_NR_PALMTC_SD_POWER, |
|---|
| 124 | | - .gpio_card_ro = GPIO_NR_PALMTC_SD_READONLY, |
|---|
| 125 | | - .gpio_card_detect = GPIO_NR_PALMTC_SD_DETECT_N, |
|---|
| 126 | 119 | .detect_delay_ms = 200, |
|---|
| 120 | +}; |
|---|
| 121 | + |
|---|
| 122 | +static struct gpiod_lookup_table palmtc_mci_gpio_table = { |
|---|
| 123 | + .dev_id = "pxa2xx-mci.0", |
|---|
| 124 | + .table = { |
|---|
| 125 | + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_SD_DETECT_N, |
|---|
| 126 | + "cd", GPIO_ACTIVE_LOW), |
|---|
| 127 | + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_SD_READONLY, |
|---|
| 128 | + "wp", GPIO_ACTIVE_LOW), |
|---|
| 129 | + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_SD_POWER, |
|---|
| 130 | + "power", GPIO_ACTIVE_HIGH), |
|---|
| 131 | + { }, |
|---|
| 132 | + }, |
|---|
| 127 | 133 | }; |
|---|
| 128 | 134 | |
|---|
| 129 | 135 | static void __init palmtc_mmc_init(void) |
|---|
| 130 | 136 | { |
|---|
| 137 | + gpiod_add_lookup_table(&palmtc_mci_gpio_table); |
|---|
| 131 | 138 | pxa_set_mci_info(&palmtc_mci_platform_data); |
|---|
| 132 | 139 | } |
|---|
| 133 | 140 | #else |
|---|
| .. | .. |
|---|
| 167 | 174 | * Backlight |
|---|
| 168 | 175 | ******************************************************************************/ |
|---|
| 169 | 176 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) |
|---|
| 177 | + |
|---|
| 178 | +static struct gpiod_lookup_table palmtc_pwm_bl_gpio_table = { |
|---|
| 179 | + .dev_id = "pwm-backlight.0", |
|---|
| 180 | + .table = { |
|---|
| 181 | + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_BL_POWER, |
|---|
| 182 | + "enable", GPIO_ACTIVE_HIGH), |
|---|
| 183 | + }, |
|---|
| 184 | +}; |
|---|
| 185 | + |
|---|
| 170 | 186 | static struct pwm_lookup palmtc_pwm_lookup[] = { |
|---|
| 171 | 187 | PWM_LOOKUP("pxa25x-pwm.1", 0, "pwm-backlight.0", NULL, PALMTC_PERIOD_NS, |
|---|
| 172 | 188 | PWM_POLARITY_NORMAL), |
|---|
| .. | .. |
|---|
| 175 | 191 | static struct platform_pwm_backlight_data palmtc_backlight_data = { |
|---|
| 176 | 192 | .max_brightness = PALMTC_MAX_INTENSITY, |
|---|
| 177 | 193 | .dft_brightness = PALMTC_MAX_INTENSITY, |
|---|
| 178 | | - .enable_gpio = GPIO_NR_PALMTC_BL_POWER, |
|---|
| 179 | 194 | }; |
|---|
| 180 | 195 | |
|---|
| 181 | 196 | static struct platform_device palmtc_backlight = { |
|---|
| .. | .. |
|---|
| 188 | 203 | |
|---|
| 189 | 204 | static void __init palmtc_pwm_init(void) |
|---|
| 190 | 205 | { |
|---|
| 206 | + gpiod_add_lookup_table(&palmtc_pwm_bl_gpio_table); |
|---|
| 191 | 207 | pwm_add_table(palmtc_pwm_lookup, ARRAY_SIZE(palmtc_pwm_lookup)); |
|---|
| 192 | 208 | platform_device_register(&palmtc_backlight); |
|---|
| 193 | 209 | } |
|---|
| .. | .. |
|---|
| 311 | 327 | * UDC |
|---|
| 312 | 328 | ******************************************************************************/ |
|---|
| 313 | 329 | #if defined(CONFIG_USB_PXA25X)||defined(CONFIG_USB_PXA25X_MODULE) |
|---|
| 314 | | -static struct gpio_vbus_mach_info palmtc_udc_info = { |
|---|
| 315 | | - .gpio_vbus = GPIO_NR_PALMTC_USB_DETECT_N, |
|---|
| 316 | | - .gpio_vbus_inverted = 1, |
|---|
| 317 | | - .gpio_pullup = GPIO_NR_PALMTC_USB_POWER, |
|---|
| 330 | +static struct gpiod_lookup_table palmtc_udc_gpiod_table = { |
|---|
| 331 | + .dev_id = "gpio-vbus", |
|---|
| 332 | + .table = { |
|---|
| 333 | + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_USB_DETECT_N, |
|---|
| 334 | + "vbus", GPIO_ACTIVE_LOW), |
|---|
| 335 | + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_USB_POWER, |
|---|
| 336 | + "pullup", GPIO_ACTIVE_HIGH), |
|---|
| 337 | + { }, |
|---|
| 338 | + }, |
|---|
| 318 | 339 | }; |
|---|
| 319 | 340 | |
|---|
| 320 | 341 | static struct platform_device palmtc_gpio_vbus = { |
|---|
| 321 | 342 | .name = "gpio-vbus", |
|---|
| 322 | 343 | .id = -1, |
|---|
| 323 | | - .dev = { |
|---|
| 324 | | - .platform_data = &palmtc_udc_info, |
|---|
| 325 | | - }, |
|---|
| 326 | 344 | }; |
|---|
| 327 | 345 | |
|---|
| 328 | 346 | static void __init palmtc_udc_init(void) |
|---|
| 329 | 347 | { |
|---|
| 348 | + gpiod_add_lookup_table(&palmtc_udc_gpiod_table); |
|---|
| 330 | 349 | platform_device_register(&palmtc_gpio_vbus); |
|---|
| 331 | 350 | }; |
|---|
| 332 | 351 | #else |
|---|