Message ID | 20220927025606.26673-5-tinghan.shen@mediatek.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add support for MT8195 SCP 2nd core | expand |
Il 27/09/22 04:55, Tinghan Shen ha scritto: > 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> You should Cc stable on this commit, as it's a quite important fix. Regards, Angelo
On Tue, 2022-09-27 at 13:03 +0200, AngeloGioacchino Del Regno wrote: > Il 27/09/22 04:55, Tinghan Shen ha scritto: > > 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> > > You should Cc stable on this commit, as it's a quite important fix. > > Regards, > Angelo > Hi Angelo, Ok, I'll add it at next version. Thanks, TingHan
On 9/28/2022 4:27 PM, TingHan Shen (沈廷翰) wrote: > On Tue, 2022-09-27 at 13:03 +0200, AngeloGioacchino Del Regno wrote: >> Il 27/09/22 04:55, Tinghan Shen ha scritto: >>> 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> >> >> You should Cc stable on this commit, as it's a quite important fix. >> >> Regards, >> Angelo >> > Hi Angelo, > > Ok, I'll add it at next version. If this patch is not relevant with the SCP 1 support in this patchset, better separate this patch out as a standalone fix. Regards, Peng. > > Thanks, > TingHan
On Wed, 2022-09-28 at 17:40 +0800, Peng Fan wrote: > > On 9/28/2022 4:27 PM, TingHan Shen (沈廷翰) wrote: > > On Tue, 2022-09-27 at 13:03 +0200, AngeloGioacchino Del Regno wrote: > > > Il 27/09/22 04:55, Tinghan Shen ha scritto: > > > > 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> > > > > > > You should Cc stable on this commit, as it's a quite important fix. > > > > > > Regards, > > > Angelo > > > > > > > Hi Angelo, > > > > Ok, I'll add it at next version. > > If this patch is not relevant with the SCP 1 support in this patchset, > better separate this patch out as a standalone fix. Ok, I'll send it separately. Regards, TingHan > > Regards, > Peng. > > > > > Thanks, > > TingHan
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);
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(-)