]> git.itanic.dy.fi Git - linux-stable/commit
gpio: pca953x: Add mutex_lock for regcache sync in PM
authorHaibo Chen <haibo.chen@nxp.com>
Wed, 31 Aug 2022 10:37:35 +0000 (18:37 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 Sep 2022 10:04:52 +0000 (12:04 +0200)
commitcb2684e906f959b25cffd76a0f330780676c8a95
tree845167d756c61f3ae74ad36ee89b21dfa3faf614
parent7756eb1ed124753f4d64f761fc3d84290dffcb4d
gpio: pca953x: Add mutex_lock for regcache sync in PM

[ Upstream commit 518e26f11af2fe4f5bebf9a0351595d508c7077f ]

The regcache sync will set the cache_bypass = true, at that
time, when there is regmap write operation, it will bypass
the regmap cache, then the regcache sync will write back the
value from cache to register, which is not as our expectation.

Though regmap already use its internal lock to avoid such issue,
but this driver force disable the regmap internal lock in its
regmap config: disable_locking = true

To avoid this issue, use the driver's own lock to do the protect
in system PM.

Fixes: b76574300504 ("gpio: pca953x: Restore registers after suspend/resume cycle")
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpio/gpio-pca953x.c