diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-13 20:14:05 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-13 20:14:05 +0100 |
commit | 1c5ff2ab7bba6757e7663302c5905e6404de324a (patch) | |
tree | 7f72452032fa5134ba6c6761556f0de04dfec6e7 /drivers/gpio | |
parent | Merge tag 'dmaengine-4.5-rc1' of git://git.infradead.org/users/vkoul/slave-dma (diff) | |
parent | Merge branch 'next' into for-linus (diff) | |
download | linux-1c5ff2ab7bba6757e7663302c5905e6404de324a.tar.xz linux-1c5ff2ab7bba6757e7663302c5905e6404de324a.zip |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov:
- new driver for eGalaxTouch serial touchscreen
- new driver for TS-4800 touchscreen
- an update for Goodix touchscreen driver
- PS/2 mouse module was reworked to limit number of protocols we try on
pass-through ports to speed up their detection time
- wacom_w8001 touchscreen driver now reports pen and touch via separate
instances of input devices
- other driver changes
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (42 commits)
Input: elantech - mark protocols v2 and v3 as semi-mt
Input: wacom_w8001 - drop use of ABS_MT_TOOL_TYPE
Input: gpio-keys - fix check for disabling unsupported keys
Input: omap-keypad - remove dead check
Input: ti_am335x_tsc - fix HWPEN interrupt handling
Input: omap-keypad - set tasklet data earlier
Input: rohm_bu21023 - fix handling of retrying firmware update
Input: ALPS - report v3 pinnacle trackstick device only if is present
Input: ALPS - detect trackstick presence for v7 protocol
Input: pcap_ts - use to_delayed_work
Input: bma150 - constify bma150_cfg structure
Input: i8042 - add Fujitsu Lifebook U745 to the nomux list
Input: egalax_ts_serial - fix potential NULL dereference on error
Input: uinput - sanity check on ff_effects_max and EV_FF
Input: uinput - rework ABS validation
Input: uinput - add new UINPUT_DEV_SETUP and UI_ABS_SETUP ioctl
Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen"
Input: goodix - add axis swapping and axis inversion support
Input: goodix - use goodix_i2c_write_u8 instead of i2c_master_send
Input: goodix - add power management support
...
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpiolib-acpi.c | 43 | ||||
-rw-r--r-- | drivers/gpio/gpiolib.c | 3 | ||||
-rw-r--r-- | drivers/gpio/gpiolib.h | 8 |
3 files changed, 54 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index cbbb67a6f1d6..bc34bc51a948 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -943,3 +943,46 @@ int acpi_gpio_count(struct device *dev, const char *con_id) } return count; } + +struct acpi_crs_lookup { + struct list_head node; + struct acpi_device *adev; + const char *con_id; +}; + +static DEFINE_MUTEX(acpi_crs_lookup_lock); +static LIST_HEAD(acpi_crs_lookup_list); + +bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id) +{ + struct acpi_crs_lookup *l, *lookup = NULL; + + /* Never allow fallback if the device has properties */ + if (adev->data.properties || adev->driver_gpios) + return false; + + mutex_lock(&acpi_crs_lookup_lock); + + list_for_each_entry(l, &acpi_crs_lookup_list, node) { + if (l->adev == adev) { + lookup = l; + break; + } + } + + if (!lookup) { + lookup = kmalloc(sizeof(*lookup), GFP_KERNEL); + if (lookup) { + lookup->adev = adev; + lookup->con_id = con_id; + list_add_tail(&lookup->node, &acpi_crs_lookup_list); + } + } + + mutex_unlock(&acpi_crs_lookup_lock); + + return lookup && + ((!lookup->con_id && !con_id) || + (lookup->con_id && con_id && + strcmp(lookup->con_id, con_id) == 0)); +} diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 5d8d7ab96916..3346abd29b52 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1874,6 +1874,9 @@ static struct gpio_desc *acpi_find_gpio(struct device *dev, const char *con_id, /* Then from plain _CRS GPIOs */ if (IS_ERR(desc)) { + if (!acpi_can_fallback_to_crs(adev, con_id)) + return ERR_PTR(-ENOENT); + desc = acpi_get_gpiod_by_index(adev, NULL, idx, &info); if (IS_ERR(desc)) return desc; diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 5ac3b88a2e0a..be3a977d0349 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -48,6 +48,8 @@ struct gpio_desc *acpi_node_get_gpiod(struct fwnode_handle *fwnode, struct acpi_gpio_info *info); int acpi_gpio_count(struct device *dev, const char *con_id); + +bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id); #else static inline void acpi_gpiochip_add(struct gpio_chip *chip) { } static inline void acpi_gpiochip_remove(struct gpio_chip *chip) { } @@ -74,6 +76,12 @@ static inline int acpi_gpio_count(struct device *dev, const char *con_id) { return -ENODEV; } + +static inline bool acpi_can_fallback_to_crs(struct acpi_device *adev, + const char *con_id) +{ + return false; +} #endif struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np, |