soc/tegra: pmc: Fix dual edge triggered wakes
authorPetlozu Pravareshwar <petlozup@nvidia.com>
Fri, 30 Sep 2022 16:14:52 +0000 (16:14 +0000)
committerThierry Reding <treding@nvidia.com>
Thu, 10 Nov 2022 01:48:05 +0000 (02:48 +0100)
commit1ddb8f6d44ff482c9953a06f800453bc372cfead
treea0bc82021b9609176c250d37fd77ca3825c0d72a
parentc9c4ddb20c427b19c6a2a1787bf82c7b2aac25c3
soc/tegra: pmc: Fix dual edge triggered wakes

When a wake event is defined to be triggered on both positive and
negative edge of the input wake signal, it is crucial to know the
current state of the signal when going into suspend. The intended way to
obtain the current state of the wake signals is to read the
WAKE_AOWAKE_SW_STATUS register, which should contains the raw state of
the wake signals.

However, this register is edge triggered, an edge will not be generated
for signals that are already asserted prior to the assertion of
WAKE_LATCH_SW.

To workaround this, change the polarity of the wake level from '0' to
'1' while latching the signals, as this will generate an edge for
signals that are set to '1'.

Signed-off-by: Stefan Kristiansson <stefank@nvidia.com>
Signed-off-by: Petlozu Pravareshwar <petlozup@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/soc/tegra/pmc.c