Skip to content

Commit aab7761

Browse files
committed
Merge tag 'gpio-v4.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO fixes from Linus Walleij: - LP87565: set the proper output level for direction_output. - stm32: fix the kernel build by selecting the hierarchical irqdomain symbol properly - this happens to be done in the pin control framework but whatever, it had dependencies to GPIO so we need to apply it here. - Select the hierarchical IRQ domain also for Xgene. - Fix wakeups to work on MXC. - Fix up the device tree binding on Exar that went astray, also add the right bindings. - Fix the unwanted events for edges from the library. - Fix the unbalanced chanined IRQ on the Tegra. * tag 'gpio-v4.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: gpio: tegra: fix unbalanced chained_irq_enter/exit gpiolib: skip unwanted events, don't convert them to opposite edge gpio: exar: Use correct property prefix and document bindings gpio: gpio-mxc: Fix: higher 16 GPIOs usable as wake source gpio: xgene-sb: select IRQ_DOMAIN_HIERARCHY pinctrl: stm32: select IRQ_DOMAIN_HIERARCHY instead of depends on gpio: lp87565: Set proper output level and direction for direction_output MAINTAINERS: Add entry for Whiskey Cove PMIC GPIO driver
2 parents ef9ca02 + 9e9509e commit aab7761

File tree

10 files changed

+54
-37
lines changed

10 files changed

+54
-37
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Exportable MPIO interface of Exar UART chips
2+
3+
Required properties of the device:
4+
- exar,first-pin: first exportable pins (0..15)
5+
- ngpios: number of exportable pins (1..16)

MAINTAINERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14218,6 +14218,12 @@ F: drivers/watchdog/
1421814218
F: include/linux/watchdog.h
1421914219
F: include/uapi/linux/watchdog.h
1422014220

14221+
WHISKEYCOVE PMIC GPIO DRIVER
14222+
M: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
14223+
L: linux-gpio@vger.kernel.org
14224+
S: Maintained
14225+
F: drivers/gpio/gpio-wcove.c
14226+
1422114227
WIIMOTE HID DRIVER
1422214228
M: David Herrmann <dh.herrmann@googlemail.com>
1422314229
L: linux-input@vger.kernel.org

drivers/gpio/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ config GPIO_XGENE_SB
504504
depends on ARCH_XGENE && OF_GPIO
505505
select GPIO_GENERIC
506506
select GPIOLIB_IRQCHIP
507+
select IRQ_DOMAIN_HIERARCHY
507508
help
508509
This driver supports the GPIO block within the APM X-Gene
509510
Standby Domain. Say yes here to enable the GPIO functionality.

drivers/gpio/gpio-exar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static int gpio_exar_probe(struct platform_device *pdev)
132132
if (!p)
133133
return -ENOMEM;
134134

135-
ret = device_property_read_u32(&pdev->dev, "linux,first-pin",
135+
ret = device_property_read_u32(&pdev->dev, "exar,first-pin",
136136
&first_pin);
137137
if (ret)
138138
return ret;

drivers/gpio/gpio-lp87565.c

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,27 @@ struct lp87565_gpio {
2626
struct regmap *map;
2727
};
2828

29+
static int lp87565_gpio_get(struct gpio_chip *chip, unsigned int offset)
30+
{
31+
struct lp87565_gpio *gpio = gpiochip_get_data(chip);
32+
int ret, val;
33+
34+
ret = regmap_read(gpio->map, LP87565_REG_GPIO_IN, &val);
35+
if (ret < 0)
36+
return ret;
37+
38+
return !!(val & BIT(offset));
39+
}
40+
41+
static void lp87565_gpio_set(struct gpio_chip *chip, unsigned int offset,
42+
int value)
43+
{
44+
struct lp87565_gpio *gpio = gpiochip_get_data(chip);
45+
46+
regmap_update_bits(gpio->map, LP87565_REG_GPIO_OUT,
47+
BIT(offset), value ? BIT(offset) : 0);
48+
}
49+
2950
static int lp87565_gpio_get_direction(struct gpio_chip *chip,
3051
unsigned int offset)
3152
{
@@ -54,30 +75,11 @@ static int lp87565_gpio_direction_output(struct gpio_chip *chip,
5475
{
5576
struct lp87565_gpio *gpio = gpiochip_get_data(chip);
5677

78+
lp87565_gpio_set(chip, offset, value);
79+
5780
return regmap_update_bits(gpio->map,
5881
LP87565_REG_GPIO_CONFIG,
59-
BIT(offset), !value ? BIT(offset) : 0);
60-
}
61-
62-
static int lp87565_gpio_get(struct gpio_chip *chip, unsigned int offset)
63-
{
64-
struct lp87565_gpio *gpio = gpiochip_get_data(chip);
65-
int ret, val;
66-
67-
ret = regmap_read(gpio->map, LP87565_REG_GPIO_IN, &val);
68-
if (ret < 0)
69-
return ret;
70-
71-
return !!(val & BIT(offset));
72-
}
73-
74-
static void lp87565_gpio_set(struct gpio_chip *chip, unsigned int offset,
75-
int value)
76-
{
77-
struct lp87565_gpio *gpio = gpiochip_get_data(chip);
78-
79-
regmap_update_bits(gpio->map, LP87565_REG_GPIO_OUT,
80-
BIT(offset), value ? BIT(offset) : 0);
82+
BIT(offset), BIT(offset));
8183
}
8284

8385
static int lp87565_gpio_request(struct gpio_chip *gc, unsigned int offset)

drivers/gpio/gpio-mxc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,9 @@ static int mxc_gpio_probe(struct platform_device *pdev)
424424
return PTR_ERR(port->base);
425425

426426
port->irq_high = platform_get_irq(pdev, 1);
427+
if (port->irq_high < 0)
428+
port->irq_high = 0;
429+
427430
port->irq = platform_get_irq(pdev, 0);
428431
if (port->irq < 0)
429432
return port->irq;

drivers/gpio/gpio-tegra.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ static void tegra_gpio_irq_handler(struct irq_desc *desc)
360360
{
361361
int port;
362362
int pin;
363-
int unmasked = 0;
363+
bool unmasked = false;
364364
int gpio;
365365
u32 lvl;
366366
unsigned long sta;
@@ -384,8 +384,8 @@ static void tegra_gpio_irq_handler(struct irq_desc *desc)
384384
* before executing the handler so that we don't
385385
* miss edges
386386
*/
387-
if (lvl & (0x100 << pin)) {
388-
unmasked = 1;
387+
if (!unmasked && lvl & (0x100 << pin)) {
388+
unmasked = true;
389389
chained_irq_exit(chip, desc);
390390
}
391391

drivers/gpio/gpiolib.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -704,24 +704,23 @@ static irqreturn_t lineevent_irq_thread(int irq, void *p)
704704
{
705705
struct lineevent_state *le = p;
706706
struct gpioevent_data ge;
707-
int ret;
707+
int ret, level;
708708

709709
ge.timestamp = ktime_get_real_ns();
710+
level = gpiod_get_value_cansleep(le->desc);
710711

711712
if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE
712713
&& le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE) {
713-
int level = gpiod_get_value_cansleep(le->desc);
714-
715714
if (level)
716715
/* Emit low-to-high event */
717716
ge.id = GPIOEVENT_EVENT_RISING_EDGE;
718717
else
719718
/* Emit high-to-low event */
720719
ge.id = GPIOEVENT_EVENT_FALLING_EDGE;
721-
} else if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE) {
720+
} else if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE && level) {
722721
/* Emit low-to-high event */
723722
ge.id = GPIOEVENT_EVENT_RISING_EDGE;
724-
} else if (le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE) {
723+
} else if (le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE && !level) {
725724
/* Emit high-to-low event */
726725
ge.id = GPIOEVENT_EVENT_FALLING_EDGE;
727726
} else {

drivers/pinctrl/stm32/Kconfig

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,30 @@ config PINCTRL_STM32
66
select PINMUX
77
select GENERIC_PINCONF
88
select GPIOLIB
9+
select IRQ_DOMAIN_HIERARCHY
910
select MFD_SYSCON
1011

1112
config PINCTRL_STM32F429
1213
bool "STMicroelectronics STM32F429 pin control" if COMPILE_TEST && !MACH_STM32F429
13-
depends on OF && IRQ_DOMAIN_HIERARCHY
14+
depends on OF
1415
default MACH_STM32F429
1516
select PINCTRL_STM32
1617

1718
config PINCTRL_STM32F469
1819
bool "STMicroelectronics STM32F469 pin control" if COMPILE_TEST && !MACH_STM32F469
19-
depends on OF && IRQ_DOMAIN_HIERARCHY
20+
depends on OF
2021
default MACH_STM32F469
2122
select PINCTRL_STM32
2223

2324
config PINCTRL_STM32F746
2425
bool "STMicroelectronics STM32F746 pin control" if COMPILE_TEST && !MACH_STM32F746
25-
depends on OF && IRQ_DOMAIN_HIERARCHY
26+
depends on OF
2627
default MACH_STM32F746
2728
select PINCTRL_STM32
2829

2930
config PINCTRL_STM32H743
3031
bool "STMicroelectronics STM32H743 pin control" if COMPILE_TEST && !MACH_STM32H743
31-
depends on OF && IRQ_DOMAIN_HIERARCHY
32+
depends on OF
3233
default MACH_STM32H743
3334
select PINCTRL_STM32
3435
endif

drivers/tty/serial/8250/8250_exar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ __xr17v35x_register_gpio(struct pci_dev *pcidev,
261261
}
262262

263263
static const struct property_entry exar_gpio_properties[] = {
264-
PROPERTY_ENTRY_U32("linux,first-pin", 0),
264+
PROPERTY_ENTRY_U32("exar,first-pin", 0),
265265
PROPERTY_ENTRY_U32("ngpios", 16),
266266
{ }
267267
};
@@ -326,7 +326,7 @@ static int iot2040_rs485_config(struct uart_port *port,
326326
}
327327

328328
static const struct property_entry iot2040_gpio_properties[] = {
329-
PROPERTY_ENTRY_U32("linux,first-pin", 10),
329+
PROPERTY_ENTRY_U32("exar,first-pin", 10),
330330
PROPERTY_ENTRY_U32("ngpios", 1),
331331
{ }
332332
};

0 commit comments

Comments
 (0)