linux-stable/drivers/remoteproc
Suman Anna 5f31b232c6 remoteproc/omap: Add support for runtime auto-suspend/resume
This patch enhances the PM support in the OMAP remoteproc driver to
support the runtime auto-suspend. A remoteproc may not be required to
be running all the time, and typically will need to be active only
during certain usecases. As such, to save power, it should be turned
off during potential long periods of inactivity between usecases.
This suspend and resume of the device is a relatively heavy process
in terms of latencies, so a remoteproc should be suspended only after
a certain period of prolonged inactivity. The OMAP remoteproc driver
leverages the runtime pm framework's auto_suspend feature to accomplish
this functionality. This feature is automatically enabled when a remote
processor has successfully booted. The 'autosuspend_delay_ms' for each
device dictates the inactivity period/time to wait for before
suspending the device.

The runtime auto-suspend design relies on marking the last busy time
on every communication (virtqueue kick) to and from the remote processor.
When there has been no activity for 'autosuspend_delay_ms' time, the
runtime PM framework invokes the driver's runtime pm suspend callback
to suspend the device. The remote processor will be woken up on the
initiation of the next communication message through the runtime pm
resume callback. The current auto-suspend design also allows a remote
processor to deny a auto-suspend attempt, if it wishes to, by sending a
NACK response to the initial suspend request message sent to the remote
processor as part of the suspend process. The auto-suspend request is
also only attempted if the remote processor is idled and in standby at
the time of inactivity timer expiry. This choice is made to avoid
unnecessary messaging, and the auto-suspend is simply rescheduled to
be attempted again after a further lapse of autosuspend_delay_ms.

The runtime pm callbacks functionality in this patch reuses most of the
core logic from the suspend/resume support code, and make use of an
additional auto_suspend flag to differentiate the logic in common code
from system suspend. The system suspend/resume sequences are also updated
to reflect the proper pm_runtime statuses, and also to really perform a
suspend/resume only if the remoteproc has not been auto-suspended at the
time of request. The remote processor is left in suspended state on a
system resume if it has been auto-suspended before, and will be woken up
only when a usecase needs to run.

The OMAP remoteproc driver currently uses a default value of 10 seconds
for all OMAP remoteprocs, and a different value can be chosen either by
choosing a positive value for the 'ti,autosuspend-delay-ms' under DT or
by updating the 'autosuspend_delay_ms' field at runtime through the
sysfs interface. A negative value is equivalent to disabling the runtime
suspend.
    Eg: To use 25 seconds for IPU2 on DRA7xx,
      echo 25000 > /sys/bus/platform/devices/55020000.ipu/power/autosuspend_delay_ms

The runtime suspend feature can also be similarly enabled or disabled by
writing 'auto' or 'on' to the device's 'control' power field. The default
is enabled.
    Eg: To disable auto-suspend for IPU2 on DRA7xx SoC,
      echo on > /sys/bus/platform/devices/55020000.ipu/power/control

Signed-off-by: Suman Anna <s-anna@ti.com>
[t-kristo@ti.com: converted to use ti-sysc instead of hwmod]
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20200324110035.29907-13-t-kristo@ti.com
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-03-25 22:29:50 -07:00
..
Kconfig remoteproc/omap: Add support for DRA7xx remote processors 2020-03-25 22:29:48 -07:00
Makefile remoteproc/mediatek: add SCP support for mt8183 2020-01-20 10:29:54 -08:00
da8xx_remoteproc.c remoteproc: Remove dev_err() usage after platform_get_irq() 2019-08-26 21:59:58 -07:00
imx_rproc.c remoteproc: Use size_t type for len in da_to_va 2020-03-25 22:29:38 -07:00
keystone_remoteproc.c remoteproc: Use size_t type for len in da_to_va 2020-03-25 22:29:38 -07:00
mtk_common.h rpmsg: add rpmsg support for mt8183 SCP. 2020-01-20 10:29:56 -08:00
mtk_scp.c remoteproc/mediatek: Use size_t type for len in scp_da_to_va 2020-03-25 22:29:42 -07:00
mtk_scp_ipi.c rpmsg: add rpmsg support for mt8183 SCP. 2020-01-20 10:29:56 -08:00
omap_remoteproc.c remoteproc/omap: Add support for runtime auto-suspend/resume 2020-03-25 22:29:50 -07:00
omap_remoteproc.h remoteproc/omap: Add support for system suspend/resume 2020-03-25 22:29:50 -07:00
qcom_common.c remoteproc: qcom: Move glink_ssr notification after stop 2019-07-24 16:01:14 -07:00
qcom_common.h remoteproc: qcom: Introduce sysmon 2018-02-12 16:57:22 -08:00
qcom_q6v5.c remoteproc: qcom: q6v5: Add common panic handler 2020-03-25 22:29:45 -07:00
qcom_q6v5.h remoteproc: qcom: q6v5: Add common panic handler 2020-03-25 22:29:45 -07:00
qcom_q6v5_adsp.c remoteproc: qcom: Introduce panic handler for PAS and ADSP 2020-03-25 22:29:45 -07:00
qcom_q6v5_mss.c remoteproc: Use size_t type for len in da_to_va 2020-03-25 22:29:38 -07:00
qcom_q6v5_pas.c remoteproc: qcom: Introduce panic handler for PAS and ADSP 2020-03-25 22:29:45 -07:00
qcom_q6v5_wcss.c remoteproc: Use size_t type for len in da_to_va 2020-03-25 22:29:38 -07:00
qcom_sysmon.c remoteproc: qcom: Remove unneeded semicolon 2019-12-18 23:13:29 -08:00
qcom_wcnss.c remoteproc: Use size_t type for len in da_to_va 2020-03-25 22:29:38 -07:00
qcom_wcnss.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
qcom_wcnss_iris.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
remoteproc_core.c remoteproc: Introduce "panic" callback in ops 2020-03-25 22:29:45 -07:00
remoteproc_debugfs.c remoteproc: return error for bad "recovery" debugfs input 2020-03-25 22:29:44 -07:00
remoteproc_elf_helpers.h remoteproc: Add elf helpers to access elf64 and elf32 fields 2020-03-25 22:29:39 -07:00
remoteproc_elf_loader.c remoteproc: Adapt coredump to generate correct elf type 2020-03-25 22:29:41 -07:00
remoteproc_internal.h remoteproc: Add elf64 support in elf loader 2020-03-25 22:29:40 -07:00
remoteproc_sysfs.c remoteproc: Add a sysfs interface for name 2019-08-26 14:50:16 -07:00
remoteproc_virtio.c remoteproc: Fix NULL pointer dereference in rproc_virtio_notify 2020-03-25 22:29:44 -07:00
st_remoteproc.c remoteproc: Rename rproc_elf_sanity_check for elf32 2020-03-25 22:29:40 -07:00
st_slim_rproc.c remoteproc: Rename rproc_elf_sanity_check for elf32 2020-03-25 22:29:40 -07:00
stm32_rproc.c remoteproc: stm32: demote warning about optional property absence 2020-03-25 22:29:42 -07:00
wkup_m3_rproc.c remoteproc: Use size_t type for len in da_to_va 2020-03-25 22:29:38 -07:00