[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8a19febc-8662-b9f7-8250-44c23af06f91@linux.intel.com>
Date: Tue, 4 Oct 2022 13:13:10 +0300 (EEST)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Irui Wang <irui.wang@...iatek.com>
cc: Hans Verkuil <hverkuil-cisco@...all.nl>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Tzung-Bi Shih <tzungbi@...omium.org>,
angelogioacchino.delregno@...labora.com,
nicolas.dufresne@...labora.com,
Tiffany Lin <tiffany.lin@...iatek.com>,
Yunfei Dong <yunfei.dong@...iatek.com>,
Maoguang Meng <maoguang.meng@...iatek.com>,
Longfei Wang <longfei.wang@...iatek.com>,
Project_Global_Chrome_Upstream_Group@...iatek.com,
linux-media@...r.kernel.org, devicetree@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH v6, 5/8] media: mediatek: vcodec: Add venc power on/off
function
On Sat, 1 Oct 2022, Irui Wang wrote:
> when enable multi-core encoding, all available encoder cores' power need
> to be on/off, add new functions for encoder cores' power management.
>
> Signed-off-by: Irui Wang <irui.wang@...iatek.com>
> ---
> diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.c
> index 75de5031d292..213c3f50e9eb 100644
> --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.c
> +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.c
> @@ -9,6 +9,7 @@
> #include <linux/of_platform.h>
> #include <linux/pm_runtime.h>
>
> +#include "mtk_vcodec_enc_hw.h"
> #include "mtk_vcodec_enc_pm.h"
> #include "mtk_vcodec_util.h"
>
> @@ -56,6 +57,88 @@ int mtk_vcodec_init_enc_clk(struct platform_device *pdev,
> }
> EXPORT_SYMBOL_GPL(mtk_vcodec_init_enc_clk);
>
> +static int mtk_enc_core_power_on(struct mtk_vcodec_ctx *ctx)
> +{
> + struct mtk_venc_hw_dev *sub_core;
> + int ret, i;
> +
> + /* multi-core encoding need power on all available cores */
> + for (i = 0; i < MTK_VENC_HW_MAX; i++) {
> + sub_core = (struct mtk_venc_hw_dev *)ctx->dev->enc_hw_dev[i];
> + if (!sub_core)
> + continue;
> +
> + ret = pm_runtime_resume_and_get(&sub_core->plat_dev->dev);
> + if (ret) {
> + mtk_v4l2_err("power on sub_core[%d] fail %d", i, ret);
> + goto pm_on_fail;
> + }
> + }
> + return ret;
> +
> +pm_on_fail:
> + for (i -= 1; i >= 0; i--) {
while (i--) {
achieves the same.
> + sub_core = (struct mtk_venc_hw_dev *)ctx->dev->enc_hw_dev[i];
> + pm_runtime_put_sync(&sub_core->plat_dev->dev);
> + }
> + return ret;
> +}
--
i.
Powered by blists - more mailing lists