| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Common code for Palm LD, T5, TX, Z72 |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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 | | - * |
|---|
| 10 | 6 | */ |
|---|
| 11 | 7 | |
|---|
| 12 | 8 | #include <linux/platform_device.h> |
|---|
| .. | .. |
|---|
| 17 | 13 | #include <linux/pda_power.h> |
|---|
| 18 | 14 | #include <linux/pwm.h> |
|---|
| 19 | 15 | #include <linux/pwm_backlight.h> |
|---|
| 16 | +#include <linux/gpio/machine.h> |
|---|
| 20 | 17 | #include <linux/gpio.h> |
|---|
| 21 | 18 | #include <linux/wm97xx.h> |
|---|
| 22 | 19 | #include <linux/power_supply.h> |
|---|
| 23 | | -#include <linux/usb/gpio_vbus.h> |
|---|
| 24 | 20 | #include <linux/regulator/max1586.h> |
|---|
| 25 | 21 | #include <linux/platform_data/i2c-pxa.h> |
|---|
| 26 | 22 | |
|---|
| .. | .. |
|---|
| 49 | 45 | .detect_delay_ms = 200, |
|---|
| 50 | 46 | }; |
|---|
| 51 | 47 | |
|---|
| 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) |
|---|
| 54 | 49 | { |
|---|
| 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); |
|---|
| 60 | 52 | pxa_set_mci_info(&palm27x_mci_platform_data); |
|---|
| 61 | 53 | } |
|---|
| 62 | 54 | #endif |
|---|
| .. | .. |
|---|
| 167 | 159 | ******************************************************************************/ |
|---|
| 168 | 160 | #if defined(CONFIG_USB_PXA27X) || \ |
|---|
| 169 | 161 | 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 | + }, |
|---|
| 172 | 173 | }; |
|---|
| 173 | 174 | |
|---|
| 174 | 175 | static struct platform_device palm27x_gpio_vbus = { |
|---|
| 175 | 176 | .name = "gpio-vbus", |
|---|
| 176 | 177 | .id = -1, |
|---|
| 177 | | - .dev = { |
|---|
| 178 | | - .platform_data = &palm27x_udc_info, |
|---|
| 179 | | - }, |
|---|
| 180 | 178 | }; |
|---|
| 181 | 179 | |
|---|
| 182 | 180 | void __init palm27x_udc_init(int vbus, int pullup, int vbus_inverted) |
|---|
| 183 | 181 | { |
|---|
| 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; |
|---|
| 186 | 186 | |
|---|
| 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); |
|---|
| 196 | 188 | platform_device_register(&palm27x_gpio_vbus); |
|---|
| 197 | 189 | } |
|---|
| 198 | 190 | #endif |
|---|
| .. | .. |
|---|
| 326 | 318 | static struct platform_pwm_backlight_data palm27x_backlight_data = { |
|---|
| 327 | 319 | .max_brightness = 0xfe, |
|---|
| 328 | 320 | .dft_brightness = 0x7e, |
|---|
| 329 | | - .enable_gpio = -1, |
|---|
| 330 | 321 | .init = palm27x_backlight_init, |
|---|
| 331 | 322 | .notify = palm27x_backlight_notify, |
|---|
| 332 | 323 | .exit = palm27x_backlight_exit, |
|---|