[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220927025606.26673-5-tinghan.shen@mediatek.com>
Date: Tue, 27 Sep 2022 10:55:59 +0800
From: Tinghan Shen <tinghan.shen@...iatek.com>
To: Bjorn Andersson <andersson@...nel.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@...aro.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Tiffany Lin <tiffany.lin@...iatek.com>,
"Andrew-CT Chen" <andrew-ct.chen@...iatek.com>,
Yunfei Dong <yunfei.dong@...iatek.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Tinghan Shen <tinghan.shen@...iatek.com>
CC: <linux-remoteproc@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <linux-media@...r.kernel.org>
Subject: [PATCH v3 04/11] remoteproc: mediatek: Remove redundant rproc_boot
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@...iatek.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(-)
diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c
index d8e66b645bd8..c3194f88ff31 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c
@@ -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)
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index d421a2ccaa1e..bf68bccab78b 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -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
*
diff --git a/include/linux/remoteproc/mtk_scp.h b/include/linux/remoteproc/mtk_scp.h
index 7c2b7cc9fe6c..e463105b351c 100644
--- a/include/linux/remoteproc/mtk_scp.h
+++ b/include/linux/remoteproc/mtk_scp.h
@@ -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);
--
2.18.0
Powered by blists - more mailing lists