Skip to content

Commit 530b1db

Browse files
artmsBartosz Golaszewski
authored andcommitted
gpio: 74x164: Enable output pins after registers are reset
Chip outputs are enabled[1] before actual reset is performed[2] which might cause pin output value to flip flop if previous pin value was set to 1. Fix that behavior by making sure chip is fully reset before all outputs are enabled. Flip-flop can be noticed when module is removed and inserted again and one of the pins was changed to 1 before removal. 100 microsecond flipping is noticeable on oscilloscope (100khz SPI bus). For a properly reset chip - output is enabled around 100 microseconds (on 100khz SPI bus) later during probing process hence should be irrelevant behavioral change. Fixes: 7ebc194 (gpio: 74x164: Introduce 'enable-gpios' property) Link: https://elixir.bootlin.com/linux/v6.7.4/source/drivers/gpio/gpio-74x164.c#L130 [1] Link: https://elixir.bootlin.com/linux/v6.7.4/source/drivers/gpio/gpio-74x164.c#L150 [2] Signed-off-by: Arturas Moskvinas <arturas.moskvinas@gmail.com> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent d206a76 commit 530b1db

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpio/gpio-74x164.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ static int gen_74x164_probe(struct spi_device *spi)
127127
if (IS_ERR(chip->gpiod_oe))
128128
return PTR_ERR(chip->gpiod_oe);
129129

130-
gpiod_set_value_cansleep(chip->gpiod_oe, 1);
131-
132130
spi_set_drvdata(spi, chip);
133131

134132
chip->gpio_chip.label = spi->modalias;
@@ -153,6 +151,8 @@ static int gen_74x164_probe(struct spi_device *spi)
153151
goto exit_destroy;
154152
}
155153

154+
gpiod_set_value_cansleep(chip->gpiod_oe, 1);
155+
156156
ret = gpiochip_add_data(&chip->gpio_chip, chip);
157157
if (!ret)
158158
return 0;

0 commit comments

Comments
 (0)