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)
committerMark Brown <broonie@kernel.org>
Tue, 20 Aug 2019 12:09:55 +0000 (13:09 +0100)
commitc372a35550c8d60f673b20210eea58a06d6d38cb
treec13e0af3196fcbe7653d7fdb4ad37708e51fbe0e
parent8661ab5b23d6d30d8687fc05bc1dba8f9a64b444
ASoC: uniphier: Fix double reset assersion when transitioning to suspend state

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>
sound/soc/uniphier/aio-cpu.c
sound/soc/uniphier/aio.h