@@ -6,7 +6,7 @@
static int mtk_vcodec_scp_load_firmware(struct mtk_vcodec_fw *fw)
{
- return rproc_boot(scp_get_rproc(fw->scp));
+ return scp_boot(fw->scp);
}
static unsigned int mtk_vcodec_scp_get_vdec_capa(struct mtk_vcodec_fw *fw)
@@ -673,6 +673,23 @@ struct rproc *scp_get_rproc(struct mtk_scp *scp)
}
EXPORT_SYMBOL_GPL(scp_get_rproc);
+/**
+ * scp_boot() - Boot SCP
+ *
+ * @scp: mtk_scp structure
+ **/
+int scp_boot(struct mtk_scp *scp)
+{
+ struct rproc *rproc = scp->rproc;
+
+ /* scp already booted when power > 0 */
+ if (atomic_read(&rproc->power) > 0)
+ return 0;
+ else
+ return rproc_boot(scp->rproc);
+}
+EXPORT_SYMBOL_GPL(scp_boot);
+
/**
* scp_get_vdec_hw_capa() - get video decoder hardware capability
*
@@ -52,6 +52,7 @@ void scp_put(struct mtk_scp *scp);
struct device *scp_get_device(struct mtk_scp *scp);
struct rproc *scp_get_rproc(struct mtk_scp *scp);
+int scp_boot(struct mtk_scp *scp);
int scp_ipi_register(struct mtk_scp *scp, u32 id, scp_ipi_handler_t handler,
void *priv);
The video codec doesn't need to explicitly boot SCP in its flow because the SCP remote processor enables auto boot. The redundant usage of rproc_boot increases the number of rproc.power over 1 and prevents successfully shutting down SCP by rproc_shutdown. Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com> --- .../mediatek/vcodec/mtk_vcodec_fw_scp.c | 2 +- drivers/remoteproc/mtk_scp.c | 17 +++++++++++++++++ include/linux/remoteproc/mtk_scp.h | 1 + 3 files changed, 19 insertions(+), 1 deletion(-)