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 D44227BAF7; Mon, 4 Mar 2024 21:34:22 +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=1709588062; cv=none; b=JxLmaQVYao7t31e3Z9DSXz8hMsGxhAbCw+qMKLCuCmH/FoycO4OzSoCSqlo+46aXw5Iu440iEyJDFQeaSEo1n+11U4Y0EdtqbIP3rkdRelu7sQ/uZ/+ErKZwosX2XsPlDrpWBXE8yppTNxqvCRiD0V2rRITMCMdjrzGp/MfkZME= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709588062; c=relaxed/simple; bh=3Cm2HjSE0gjzvliEhlP1rYD/xXdCCL2UInL9HdLKVRU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DDJzIvr0LKncgUnEc1C5aVyKYmBK9MGqmQbNYr2TBGe3E+QNGOhMh8RNahMBC9gw5dsvZiSqF1JKEWjC2FlRQVb7dMfeq5XMZa2CJ0O0+eXDPPONT7TE6oernnGKNogljBiZx94TNkdgAc0GZWfmSdizGXMPHEDutCO1lOkhI6E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=sL8KJ43+; 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="sL8KJ43+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68346C43394; Mon, 4 Mar 2024 21:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709588062; bh=3Cm2HjSE0gjzvliEhlP1rYD/xXdCCL2UInL9HdLKVRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sL8KJ43+lmsCbf1Q9pd0/Cu5VEBU/vUMYpdqZAOoLT5Bc5HS5zXZf9a/S9Akod5si 0BS0vn1DUCt4CWDTyDN87HUyJT1RllN36DyB+Qe3rQmhpWDIrU3Prjq3L7uDUr3XvX hZnBRLqiDownLBSPXUVOGAS0aOk0GWoyee+pn8Xo= 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 5.4 25/25] gpio: 74x164: Enable output pins after registers are reset Date: Mon, 4 Mar 2024 21:24:01 +0000 Message-ID: <20240304211536.606584317@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240304211535.741936181@linuxfoundation.org> References: <20240304211535.741936181@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 5.4-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 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