msm: vidc: Refactor power collapse
Check if venus is ready to be power collapsed and if ready power
collapse it. pm_handler is called after every
"msm_vidc_pwr_collapse_delay" ms of inactivity between host driver
and video firmware. If pm_handler is called consecutively for
"VIDC_MAX_PC_SKIP_COUNT" but it fails every time then driver
assumes something is wrong with venus and raises a sys error.
Following is the logic for power collapsing:
1.Check for PC_READY register. If it indicates that venus is ready
for PC then go ahead and power collapse. This register is set by
firmware only when PC_PREP command is sent to it. This register is
unset by firmware whenever ARM9 is interrupted by host driver or
by hardware.
2. If PC_READY is not set then check that ARM9 is in WFI and IDLE
bit is set. IDLE bit indicates that both HW and ARM9 are idle.
However, we will assume it to mean that only HW Is idle since ARM9
is still working to set IDLE bit. ARM9 is IDLE only when it is in
WFI state.
3. Send PC_PREP to firmware and wait for ARM9 to go into WFI and
PC_READY state. DO NOT check for IDLE bit here as it might not be
set because of firmware limitation.
4. Power collapse venus. If any of above steps fail then retry
after "msm_vidc_pwr_collapse_delay" ms.
Change-Id: Ic25b8641a874ed80fcca02ff1ed1a7fe24704d47
Signed-off-by:
Vinay Kalia <vkalia@codeaurora.org>
Loading
Please register or sign in to comment