]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.19
authorSasha Levin <sashal@kernel.org>
Mon, 4 Mar 2024 12:22:16 +0000 (07:22 -0500)
committerSasha Levin <sashal@kernel.org>
Mon, 4 Mar 2024 12:22:16 +0000 (07:22 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.19/gpio-74x164-enable-output-pins-after-registers-are-r.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/gpio-74x164-enable-output-pins-after-registers-are-r.patch b/queue-4.19/gpio-74x164-enable-output-pins-after-registers-are-r.patch
new file mode 100644 (file)
index 0000000..9e35aba
--- /dev/null
@@ -0,0 +1,57 @@
+From 99668eb1d801a65bb3d4c1d232308dec79a12cbb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 1 Mar 2024 09:12:04 +0200
+Subject: gpio: 74x164: Enable output pins after registers are reset
+
+From: Arturas Moskvinas <arturas.moskvinas@gmail.com>
+
+[ Upstream commit 530b1dbd97846b110ea8a94c7cc903eca21786e5 ]
+
+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: 7ebc194d0fd4 (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>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpio/gpio-74x164.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c
+index fb7b620763a25..a47897f2a83de 100644
+--- a/drivers/gpio/gpio-74x164.c
++++ b/drivers/gpio/gpio-74x164.c
+@@ -132,8 +132,6 @@ static int gen_74x164_probe(struct spi_device *spi)
+       if (IS_ERR(chip->gpiod_oe))
+               return PTR_ERR(chip->gpiod_oe);
+-      gpiod_set_value_cansleep(chip->gpiod_oe, 1);
+-
+       spi_set_drvdata(spi, chip);
+       chip->gpio_chip.label = spi->modalias;
+@@ -158,6 +156,8 @@ static int gen_74x164_probe(struct spi_device *spi)
+               goto exit_destroy;
+       }
++      gpiod_set_value_cansleep(chip->gpiod_oe, 1);
++
+       ret = gpiochip_add_data(&chip->gpio_chip, chip);
+       if (!ret)
+               return 0;
+-- 
+2.43.0
+
index 78e157b7a235c008acd2aa12c3968320ca05cf9e..0796eaa8294d560d0ce2bf371dfa4aa7be0c1077 100644 (file)
@@ -14,3 +14,4 @@ btrfs-dev-replace-properly-validate-device-names.patch
 mmc-core-fix-emmc-initialization-with-1-bit-bus-connection.patch
 fs-aio-make-io_cancel-generate-completions-again.patch
 cachefiles-fix-memory-leak-in-cachefiles_add_cache.patch
+gpio-74x164-enable-output-pins-after-registers-are-r.patch