media: venus: pm_helpers: Switch domains to back and forth to hwmode

The power domains the venus codec uses are GDSCs which also support HW
control. This means that when the HW control bit is set, the GDSC state
is under HW control and its enable/disbale state is unknown to genpd.
This allows a finer grained controlled as the HW knows best when to
disable/enable the GDSC. At the moment, the venus codec seems to only
work when GDSC is in HW-controlled mode. We would want to switch to
SW-controlled mode when we control the power bit and read the status
of the codec, but we obviously can't do that as the encoding/decoding
will break. If we do try to go through setting up the power control bits
and reading the status, while the GDSC is in HW-controlled mode, it
might be disabled by the HW from under the driver leaving it hanging.
On the other hand, this is how GDSCs that support HW control were
handled until recently and it wasn't a problem. This might've worked
until now because maybe the venus firmware was both expecting the
HW-controlled mode to be enable and it was never allowing the GDSC
to be disabled. Needs further investigation.

Not-Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
2 files changed