From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86FAB7BAE6; Mon, 4 Mar 2024 21:33:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709587987; cv=none; b=gsuiO1wvIkv6gVjE78Jcbpl8SaQKXQut4fFj8gOZqRGyqnS+W8f8OgG5ld3EyFbkQECIytj4DUrSdBvClCh9K23P0bSjXiVkwv1CL2cICDFXfFUG2TB97I5DPceNlwEjvnKQgF+FCdhTQ33GgWukh37pL8Ia9nV6kUQ9mABSoPs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709587987; c=relaxed/simple; bh=wvkvUyZ7uBfnz5dYg/HXDZW3NWpCebAP5nOH1sjPscY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nfcF+2EVhLdudAVGc9C3m1Cv3tSNEIbSwN6NOHdX2WwvgjQYG2mlWzkK2d4m2/6PTwwNCW8MI224rp5Gdvs3mEq3+KF91AM1rODnZv4IrAneqVLu28uzmDEHVUhCTvpNuAPmBr2a00ZZbt4/tPtBoo084e/ZVqBIORi1f4PldUE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=NJxrVfZa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="NJxrVfZa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 186D5C43394; Mon, 4 Mar 2024 21:33:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709587987; bh=wvkvUyZ7uBfnz5dYg/HXDZW3NWpCebAP5nOH1sjPscY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NJxrVfZa0cIPYv2faxtyxaII6xXsyMZvZbhDGs62e42QZyfwjVQdd3+M1w/7AAqaP D9dJivWAeinRJkphwBhvvE8lztUhbj6vrtmQHJZj5Ig7qBEwO92rRcLAfH9Why2J+M Lbwibdo499Rs4XKPX22S8t54UhNZt0XaOUFN6YDE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Arturas Moskvinas , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 6.7 148/162] gpio: 74x164: Enable output pins after registers are reset Date: Mon, 4 Mar 2024 21:23:33 +0000 Message-ID: <20240304211556.430759114@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240304211551.833500257@linuxfoundation.org> References: <20240304211551.833500257@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.7-stable review patch. If anyone has any objections, please let me know. ------------------ 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 e00c333105170..753e7be039e4d 100644 --- a/drivers/gpio/gpio-74x164.c +++ b/drivers/gpio/gpio-74x164.c @@ -127,8 +127,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; @@ -153,6 +151,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