diff options
author | Francois Berder <Francois.Berder@imgtec.com> | 2016-10-25 13:24:13 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-10-27 16:42:31 +0200 |
commit | 03842c17397e14cb8bb1adc2015f5dce6c733ffe (patch) | |
tree | da2b5574afe85eac58b3d82ed73fac98b8ead2da /drivers/tty | |
parent | c03e1b8703a4a0c8bac7f6b65d8fcb539ec62d82 (diff) | |
download | linux-stable-03842c17397e14cb8bb1adc2015f5dce6c733ffe.tar.gz linux-stable-03842c17397e14cb8bb1adc2015f5dce6c733ffe.tar.bz2 linux-stable-03842c17397e14cb8bb1adc2015f5dce6c733ffe.zip |
sc16is7xx: always write state when configuring GPIO as an output
The regmap_update first reads the IOState register and then triggers
a write if needed. However, GPIOS might be configured as an input so
the read to IOState on this GPIO is the current state which might
be random.
Signed-off-by: Francois Berder <Francois.Berder@imgtec.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/sc16is7xx.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 2675792a8f59..fb0672554123 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1130,9 +1130,13 @@ static int sc16is7xx_gpio_direction_output(struct gpio_chip *chip, { struct sc16is7xx_port *s = gpiochip_get_data(chip); struct uart_port *port = &s->p[0].port; + u8 state = sc16is7xx_port_read(port, SC16IS7XX_IOSTATE_REG); - sc16is7xx_port_update(port, SC16IS7XX_IOSTATE_REG, BIT(offset), - val ? BIT(offset) : 0); + if (val) + state |= BIT(offset); + else + state &= ~BIT(offset); + sc16is7xx_port_write(port, SC16IS7XX_IOSTATE_REG, state); sc16is7xx_port_update(port, SC16IS7XX_IODIR_REG, BIT(offset), BIT(offset)); |