From: Sasha Levin Date: Mon, 4 Mar 2024 12:22:15 +0000 (-0500) Subject: Fixes for 5.4 X-Git-Tag: v4.19.309~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c4c37f51aa9b1c7678dac552c012bdba95fbd05c;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/gpio-74x164-enable-output-pins-after-registers-are-r.patch b/queue-5.4/gpio-74x164-enable-output-pins-after-registers-are-r.patch new file mode 100644 index 00000000000..82e4cd30716 --- /dev/null +++ b/queue-5.4/gpio-74x164-enable-output-pins-after-registers-are-r.patch @@ -0,0 +1,57 @@ +From f176ae952d137c9b2efc82c84a6b75fa2ce3df53 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 1 Mar 2024 09:12:04 +0200 +Subject: gpio: 74x164: Enable output pins after registers are reset + +From: Arturas Moskvinas + +[ 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 +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Sasha Levin +--- + 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 e81307f9754e3..30aa7f82fc5b4 100644 +--- a/drivers/gpio/gpio-74x164.c ++++ b/drivers/gpio/gpio-74x164.c +@@ -128,8 +128,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; +@@ -154,6 +152,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 + diff --git a/queue-5.4/series b/queue-5.4/series index a50b2ccfaf7..eef1e58edcd 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -23,3 +23,4 @@ fs-aio-make-io_cancel-generate-completions-again.patch x86-cpu-intel-detect-tme-keyid-bits-before-setting-mtrr-mask-registers.patch cachefiles-fix-memory-leak-in-cachefiles_add_cache.patch fs-hugetlb-fix-null-pointer-dereference-in-hugetlbs_fill_super.patch +gpio-74x164-enable-output-pins-after-registers-are-r.patch