ASoC: uniphier: Fix double reset assersion when transitioning to suspend state
authorKunihiko Hayashi <hayashi.kunihiko@socionext.com>
Tue, 20 Aug 2019 06:16:04 +0000 (15:16 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Oct 2019 11:09:44 +0000 (13:09 +0200)
commitb1f1b83e2583d5f41049c2457937035231e2595a
tree6d01029ae08bd563d47570d903c288e8c2385cb6
parente6bc6e2c0d1f87f64adf4fbf7594d2164e0d7bc8
ASoC: uniphier: Fix double reset assersion when transitioning to suspend state

[ Upstream commit c372a35550c8d60f673b20210eea58a06d6d38cb ]

When transitioning to supend state, uniphier_aio_dai_suspend() is called
and asserts reset lines and disables clocks.

However, if there are two or more DAIs, uniphier_aio_dai_suspend() are
called multiple times, and double reset assersion will cause.

This patch defines the counter that has the number of DAIs at first, and
whenever uniphier_aio_dai_suspend() are called, it decrements the
counter. And only if the counter is zero, it asserts reset lines and
disables clocks.

In the same way, uniphier_aio_dai_resume() are called, it increments the
counter after deasserting reset lines and enabling clocks.

Fixes: 139a34200233 ("ASoC: uniphier: add support for UniPhier AIO CPU DAI driver")
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Link: https://lore.kernel.org/r/1566281764-14059-1-git-send-email-hayashi.kunihiko@socionext.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/uniphier/aio-cpu.c
sound/soc/uniphier/aio.h