Skip to content

Commit

Permalink
Merge tag 'gpio-v4.13-2' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/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
  • Loading branch information
torvalds committed Aug 5, 2017
2 parents ef9ca02 + 9e9509e commit aab7761
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 37 deletions.
5 changes: 5 additions & 0 deletions Documentation/devicetree/bindings/gpio/gpio-exar.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Exportable MPIO interface of Exar UART chips

Required properties of the device:
- exar,first-pin: first exportable pins (0..15)
- ngpios: number of exportable pins (1..16)
6 changes: 6 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -14218,6 +14218,12 @@ F: drivers/watchdog/
F: include/linux/watchdog.h
F: include/uapi/linux/watchdog.h

WHISKEYCOVE PMIC GPIO DRIVER
M: Kuppuswamy Sathyanarayanan <[email protected]>
L: [email protected]
S: Maintained
F: drivers/gpio/gpio-wcove.c

WIIMOTE HID DRIVER
M: David Herrmann <[email protected]>
L: [email protected]
Expand Down
1 change: 1 addition & 0 deletions drivers/gpio/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ config GPIO_XGENE_SB
depends on ARCH_XGENE && OF_GPIO
select GPIO_GENERIC
select GPIOLIB_IRQCHIP
select IRQ_DOMAIN_HIERARCHY
help
This driver supports the GPIO block within the APM X-Gene
Standby Domain. Say yes here to enable the GPIO functionality.
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-exar.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static int gpio_exar_probe(struct platform_device *pdev)
if (!p)
return -ENOMEM;

ret = device_property_read_u32(&pdev->dev, "linux,first-pin",
ret = device_property_read_u32(&pdev->dev, "exar,first-pin",
&first_pin);
if (ret)
return ret;
Expand Down
46 changes: 24 additions & 22 deletions drivers/gpio/gpio-lp87565.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,27 @@ struct lp87565_gpio {
struct regmap *map;
};

static int lp87565_gpio_get(struct gpio_chip *chip, unsigned int offset)
{
struct lp87565_gpio *gpio = gpiochip_get_data(chip);
int ret, val;

ret = regmap_read(gpio->map, LP87565_REG_GPIO_IN, &val);
if (ret < 0)
return ret;

return !!(val & BIT(offset));
}

static void lp87565_gpio_set(struct gpio_chip *chip, unsigned int offset,
int value)
{
struct lp87565_gpio *gpio = gpiochip_get_data(chip);

regmap_update_bits(gpio->map, LP87565_REG_GPIO_OUT,
BIT(offset), value ? BIT(offset) : 0);
}

static int lp87565_gpio_get_direction(struct gpio_chip *chip,
unsigned int offset)
{
Expand Down Expand Up @@ -54,30 +75,11 @@ static int lp87565_gpio_direction_output(struct gpio_chip *chip,
{
struct lp87565_gpio *gpio = gpiochip_get_data(chip);

lp87565_gpio_set(chip, offset, value);

return regmap_update_bits(gpio->map,
LP87565_REG_GPIO_CONFIG,
BIT(offset), !value ? BIT(offset) : 0);
}

static int lp87565_gpio_get(struct gpio_chip *chip, unsigned int offset)
{
struct lp87565_gpio *gpio = gpiochip_get_data(chip);
int ret, val;

ret = regmap_read(gpio->map, LP87565_REG_GPIO_IN, &val);
if (ret < 0)
return ret;

return !!(val & BIT(offset));
}

static void lp87565_gpio_set(struct gpio_chip *chip, unsigned int offset,
int value)
{
struct lp87565_gpio *gpio = gpiochip_get_data(chip);

regmap_update_bits(gpio->map, LP87565_REG_GPIO_OUT,
BIT(offset), value ? BIT(offset) : 0);
BIT(offset), BIT(offset));
}

static int lp87565_gpio_request(struct gpio_chip *gc, unsigned int offset)
Expand Down
3 changes: 3 additions & 0 deletions drivers/gpio/gpio-mxc.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,9 @@ static int mxc_gpio_probe(struct platform_device *pdev)
return PTR_ERR(port->base);

port->irq_high = platform_get_irq(pdev, 1);
if (port->irq_high < 0)
port->irq_high = 0;

port->irq = platform_get_irq(pdev, 0);
if (port->irq < 0)
return port->irq;
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpio/gpio-tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ static void tegra_gpio_irq_handler(struct irq_desc *desc)
{
int port;
int pin;
int unmasked = 0;
bool unmasked = false;
int gpio;
u32 lvl;
unsigned long sta;
Expand All @@ -384,8 +384,8 @@ static void tegra_gpio_irq_handler(struct irq_desc *desc)
* before executing the handler so that we don't
* miss edges
*/
if (lvl & (0x100 << pin)) {
unmasked = 1;
if (!unmasked && lvl & (0x100 << pin)) {
unmasked = true;
chained_irq_exit(chip, desc);
}

Expand Down
9 changes: 4 additions & 5 deletions drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,24 +704,23 @@ static irqreturn_t lineevent_irq_thread(int irq, void *p)
{
struct lineevent_state *le = p;
struct gpioevent_data ge;
int ret;
int ret, level;

ge.timestamp = ktime_get_real_ns();
level = gpiod_get_value_cansleep(le->desc);

if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE
&& le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE) {
int level = gpiod_get_value_cansleep(le->desc);

if (level)
/* Emit low-to-high event */
ge.id = GPIOEVENT_EVENT_RISING_EDGE;
else
/* Emit high-to-low event */
ge.id = GPIOEVENT_EVENT_FALLING_EDGE;
} else if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE) {
} else if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE && level) {
/* Emit low-to-high event */
ge.id = GPIOEVENT_EVENT_RISING_EDGE;
} else if (le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE) {
} else if (le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE && !level) {
/* Emit high-to-low event */
ge.id = GPIOEVENT_EVENT_FALLING_EDGE;
} else {
Expand Down
9 changes: 5 additions & 4 deletions drivers/pinctrl/stm32/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,30 @@ config PINCTRL_STM32
select PINMUX
select GENERIC_PINCONF
select GPIOLIB
select IRQ_DOMAIN_HIERARCHY
select MFD_SYSCON

config PINCTRL_STM32F429
bool "STMicroelectronics STM32F429 pin control" if COMPILE_TEST && !MACH_STM32F429
depends on OF && IRQ_DOMAIN_HIERARCHY
depends on OF
default MACH_STM32F429
select PINCTRL_STM32

config PINCTRL_STM32F469
bool "STMicroelectronics STM32F469 pin control" if COMPILE_TEST && !MACH_STM32F469
depends on OF && IRQ_DOMAIN_HIERARCHY
depends on OF
default MACH_STM32F469
select PINCTRL_STM32

config PINCTRL_STM32F746
bool "STMicroelectronics STM32F746 pin control" if COMPILE_TEST && !MACH_STM32F746
depends on OF && IRQ_DOMAIN_HIERARCHY
depends on OF
default MACH_STM32F746
select PINCTRL_STM32

config PINCTRL_STM32H743
bool "STMicroelectronics STM32H743 pin control" if COMPILE_TEST && !MACH_STM32H743
depends on OF && IRQ_DOMAIN_HIERARCHY
depends on OF
default MACH_STM32H743
select PINCTRL_STM32
endif
4 changes: 2 additions & 2 deletions drivers/tty/serial/8250/8250_exar.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ __xr17v35x_register_gpio(struct pci_dev *pcidev,
}

static const struct property_entry exar_gpio_properties[] = {
PROPERTY_ENTRY_U32("linux,first-pin", 0),
PROPERTY_ENTRY_U32("exar,first-pin", 0),
PROPERTY_ENTRY_U32("ngpios", 16),
{ }
};
Expand Down Expand Up @@ -326,7 +326,7 @@ static int iot2040_rs485_config(struct uart_port *port,
}

static const struct property_entry iot2040_gpio_properties[] = {
PROPERTY_ENTRY_U32("linux,first-pin", 10),
PROPERTY_ENTRY_U32("exar,first-pin", 10),
PROPERTY_ENTRY_U32("ngpios", 1),
{ }
};
Expand Down

0 comments on commit aab7761

Please sign in to comment.