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 6F23A242D90; Mon, 23 Jun 2025 13:20:49 +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=1750684849; cv=none; b=tU4kGj7s2hE/j5WkPiGwpWz+6/s4JccuAf9I5zzZVBylzgv2MKI9Ef+ci48s6wOnaFDHqFQDDCGcVT/TTiLsIesnNptrdb8ADbEk4hAyyQuS5k9H1LnrnIq8Mo5qf0odUUeYILaW2qtLYWVOr6KiU8CkSNIjALEVfqx10U0an1c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750684849; c=relaxed/simple; bh=4Ot9r9fih76jgoQoh2NBJ3I26n9PJiq4lhev3JQk+RQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hb/TsNGhD+je4dNZSa5ob8AnNmQ2vQob/zOKtSpltGTv+oT6oSzHSyRxhRMGSnJymyKCmqfL0rmtT3+bLuVE5lvyVBDgoKPAolGQ0wzvpTnDLXX7cPdxVmqN2xJP7qO8dsPArCf+Tr2ZRcz9qtYVFOI+K2+Fa3OZwxWYM2Xy/9g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1WHrUY1G; 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="1WHrUY1G" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1EA4C4CEEA; Mon, 23 Jun 2025 13:20:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750684849; bh=4Ot9r9fih76jgoQoh2NBJ3I26n9PJiq4lhev3JQk+RQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1WHrUY1GiaO9gGKLLim2tdUBFS3NGFL4VIS58FCFKiGiZQ6Wxu8Xh9jz8mYmoVw0v bCroGcEMfXPav+2vzH2pwUrb2r5TwOUOMsQS7SV6gW3HurqJQT4LUA2IwcK9XhfmQk ci5The9eRFm8oGBHLnvRb731Ww2699kkxjnBUYSs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Imre Kaloz , Andrew Lunn , Gabor Juhos , Linus Walleij Subject: [PATCH 5.10 003/355] pinctrl: armada-37xx: set GPIO output value before setting direction Date: Mon, 23 Jun 2025 15:03:24 +0200 Message-ID: <20250623130626.824818631@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250623130626.716971725@linuxfoundation.org> References: <20250623130626.716971725@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Gabor Juhos commit e6ebd4942981f8ad37189bbb36a3c8495e21ef4c upstream. Changing the direction before updating the output value in the OUTPUT_VAL register may result in a glitch on the output line if the previous value in the OUTPUT_VAL register is different from the one we want to set. In order to avoid that, update the output value before changing the direction. Cc: stable@vger.kernel.org Fixes: 6702abb3bf23 ("pinctrl: armada-37xx: Fix direction_output() callback behavior") Signed-off-by: Imre Kaloz Reviewed-by: Andrew Lunn Signed-off-by: Gabor Juhos Link: https://lore.kernel.org/20250514-pinctrl-a37xx-fixes-v2-2-07e9ac1ab737@gmail.com Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -413,23 +413,22 @@ static int armada_37xx_gpio_direction_ou unsigned int offset, int value) { struct armada_37xx_pinctrl *info = gpiochip_get_data(chip); - unsigned int val_offset = offset; - unsigned int reg = OUTPUT_EN; + unsigned int en_offset = offset; + unsigned int reg = OUTPUT_VAL; unsigned int mask, val, ret; armada_37xx_update_reg(®, &offset); mask = BIT(offset); + val = value ? mask : 0; - ret = regmap_update_bits(info->regmap, reg, mask, mask); - + ret = regmap_update_bits(info->regmap, reg, mask, val); if (ret) return ret; - reg = OUTPUT_VAL; - armada_37xx_update_reg(®, &val_offset); + reg = OUTPUT_EN; + armada_37xx_update_reg(®, &en_offset); - val = value ? mask : 0; - regmap_update_bits(info->regmap, reg, mask, val); + regmap_update_bits(info->regmap, reg, mask, mask); return 0; }