From: Yunfei Dong <yunfei.dong@mediatek.com>
To: "Chen-Yu Tsai" <wenst@chromium.org>,
"Nicolas Dufresne" <nicolas.dufresne@collabora.com>,
"Hans Verkuil" <hverkuil-cisco@xs4all.nl>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Benjamin Gaignard" <benjamin.gaignard@collabora.com>,
"Nícolas F . R . A . Prado" <nfraprado@collabora.com>,
"Nathan Hebert" <nhebert@chromium.org>
Cc: Yunfei Dong <yunfei.dong@mediatek.com>,
Hsin-Yi Wang <hsinyi@chromium.org>,
Fritz Koenig <frkoenig@chromium.org>,
Daniel Vetter <daniel@ffwll.ch>,
Steve Cho <stevecho@chromium.org>, <linux-media@vger.kernel.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
<Project_Global_Chrome_Upstream_Group@mediatek.com>
Subject: [PATCH v2,02/10] media: mediatek: vcodec: align fw interface
Date: Wed, 7 Jun 2023 16:48:53 +0800 [thread overview]
Message-ID: <20230607084901.28021-3-yunfei.dong@mediatek.com> (raw)
In-Reply-To: <20230607084901.28021-1-yunfei.dong@mediatek.com>
Align scp and vpu firmware interface, remove the depedency for
'struct mtk_vcodec_dev' and 'struct mtk_vcodec_ctx'. It will be
much easier to separate video encoder and decoder.
Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
---
.../media/platform/mediatek/vcodec/mtk_vcodec_fw.c | 7 +++----
.../media/platform/mediatek/vcodec/mtk_vcodec_fw.h | 3 +--
.../platform/mediatek/vcodec/mtk_vcodec_fw_priv.h | 11 +++++------
.../platform/mediatek/vcodec/mtk_vcodec_fw_scp.c | 9 ++++++---
.../platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c | 12 ++++++++----
5 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c
index 556e54aadac9..be9159acacf8 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c
@@ -5,15 +5,14 @@
#include "mtk_vcodec_util.h"
#include "mtk_vcodec_drv.h"
-struct mtk_vcodec_fw *mtk_vcodec_fw_select(struct mtk_vcodec_dev *dev,
- enum mtk_vcodec_fw_type type,
+struct mtk_vcodec_fw *mtk_vcodec_fw_select(void *priv, enum mtk_vcodec_fw_type type,
enum mtk_vcodec_fw_use fw_use)
{
switch (type) {
case VPU:
- return mtk_vcodec_fw_vpu_init(dev, fw_use);
+ return mtk_vcodec_fw_vpu_init(priv, fw_use);
case SCP:
- return mtk_vcodec_fw_scp_init(dev);
+ return mtk_vcodec_fw_scp_init(priv, fw_use);
default:
mtk_v4l2_err("invalid vcodec fw type");
return ERR_PTR(-EINVAL);
diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.h
index 16824114657f..d8cfbec323d5 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.h
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.h
@@ -25,8 +25,7 @@ struct mtk_vcodec_fw;
typedef void (*mtk_vcodec_ipi_handler) (void *data,
unsigned int len, void *priv);
-struct mtk_vcodec_fw *mtk_vcodec_fw_select(struct mtk_vcodec_dev *dev,
- enum mtk_vcodec_fw_type type,
+struct mtk_vcodec_fw *mtk_vcodec_fw_select(void *priv, enum mtk_vcodec_fw_type type,
enum mtk_vcodec_fw_use fw_use);
void mtk_vcodec_fw_release(struct mtk_vcodec_fw *fw);
diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_priv.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_priv.h
index b41e66185cec..3438a4917344 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_priv.h
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_priv.h
@@ -12,6 +12,7 @@ struct mtk_vcodec_fw {
const struct mtk_vcodec_fw_ops *ops;
struct platform_device *pdev;
struct mtk_scp *scp;
+ enum mtk_vcodec_fw_use fw_use;
};
struct mtk_vcodec_fw_ops {
@@ -28,22 +29,20 @@ struct mtk_vcodec_fw_ops {
};
#if IS_ENABLED(CONFIG_VIDEO_MEDIATEK_VCODEC_VPU)
-struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(struct mtk_vcodec_dev *dev,
- enum mtk_vcodec_fw_use fw_use);
+struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(void *priv, enum mtk_vcodec_fw_use fw_use);
#else
static inline struct mtk_vcodec_fw *
-mtk_vcodec_fw_vpu_init(struct mtk_vcodec_dev *dev,
- enum mtk_vcodec_fw_use fw_use)
+mtk_vcodec_fw_vpu_init(void *priv, enum mtk_vcodec_fw_use fw_use)
{
return ERR_PTR(-ENODEV);
}
#endif /* CONFIG_VIDEO_MEDIATEK_VCODEC_VPU */
#if IS_ENABLED(CONFIG_VIDEO_MEDIATEK_VCODEC_SCP)
-struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(struct mtk_vcodec_dev *dev);
+struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use fw_use);
#else
static inline struct mtk_vcodec_fw *
-mtk_vcodec_fw_scp_init(struct mtk_vcodec_dev *dev)
+mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use fw_use)
{
return ERR_PTR(-ENODEV);
}
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..9a2472442c6f 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c
@@ -53,18 +53,21 @@ static const struct mtk_vcodec_fw_ops mtk_vcodec_rproc_msg = {
.release = mtk_vcodec_scp_release,
};
-struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(struct mtk_vcodec_dev *dev)
+struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use fw_use)
{
struct mtk_vcodec_fw *fw;
+ struct mtk_vcodec_dev *dev = priv;
+ struct platform_device *plat_dev;
struct mtk_scp *scp;
- scp = scp_get(dev->plat_dev);
+ plat_dev = dev->plat_dev;
+ scp = scp_get(plat_dev);
if (!scp) {
mtk_v4l2_err("could not get vdec scp handle");
return ERR_PTR(-EPROBE_DEFER);
}
- fw = devm_kzalloc(&dev->plat_dev->dev, sizeof(*fw), GFP_KERNEL);
+ fw = devm_kzalloc(&plat_dev->dev, sizeof(*fw), GFP_KERNEL);
fw->type = SCP;
fw->ops = &mtk_vcodec_rproc_msg;
fw->scp = scp;
diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c
index cfc7ebed8fb7..46a028031133 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c
@@ -77,10 +77,11 @@ static const struct mtk_vcodec_fw_ops mtk_vcodec_vpu_msg = {
.release = mtk_vcodec_vpu_release,
};
-struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(struct mtk_vcodec_dev *dev,
- enum mtk_vcodec_fw_use fw_use)
+struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(void *priv, enum mtk_vcodec_fw_use fw_use)
{
struct platform_device *fw_pdev;
+ struct mtk_vcodec_dev *dev = priv;
+ struct platform_device *plat_dev;
struct mtk_vcodec_fw *fw;
enum rst_id rst_id;
@@ -94,19 +95,22 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(struct mtk_vcodec_dev *dev,
break;
}
- fw_pdev = vpu_get_plat_device(dev->plat_dev);
+ plat_dev = dev->plat_dev;
+ fw_pdev = vpu_get_plat_device(plat_dev);
if (!fw_pdev) {
mtk_v4l2_err("firmware device is not ready");
return ERR_PTR(-EINVAL);
}
+
vpu_wdt_reg_handler(fw_pdev, mtk_vcodec_vpu_reset_handler, dev, rst_id);
- fw = devm_kzalloc(&dev->plat_dev->dev, sizeof(*fw), GFP_KERNEL);
+ fw = devm_kzalloc(&plat_dev->dev, sizeof(*fw), GFP_KERNEL);
if (!fw)
return ERR_PTR(-ENOMEM);
fw->type = VPU;
fw->ops = &mtk_vcodec_vpu_msg;
fw->pdev = fw_pdev;
+ fw->fw_use = fw_use;
return fw;
}
--
2.18.0
next prev parent reply other threads:[~2023-06-07 8:49 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-07 8:48 [PATCH v2,0/10] media: mediatek: vcodec: separate encoder and decoder Yunfei Dong
2023-06-07 8:48 ` [PATCH v2,01/10] media: mediatek: vcodec: remove unused parameter Yunfei Dong
2023-06-07 8:48 ` Yunfei Dong [this message]
2023-06-07 8:48 ` [PATCH v2,03/10] media: mediatek: vcodec: re-write shared interface Yunfei Dong
2023-06-07 8:48 ` [PATCH v2,04/10] media: mediatek: vcodec: remove the dependency of debug log Yunfei Dong
2023-06-08 1:41 ` Nicolas Dufresne
2023-06-08 7:27 ` Yunfei Dong (董云飞)
2023-06-08 13:11 ` Nicolas Dufresne
2023-06-08 14:06 ` AngeloGioacchino Del Regno
2023-06-08 15:17 ` Nicolas Dufresne
2023-06-11 2:09 ` Yunfei Dong (董云飞)
2023-06-14 9:17 ` Yunfei Dong (董云飞)
2023-06-14 11:50 ` AngeloGioacchino Del Regno
2023-06-07 8:48 ` [PATCH v2,05/10] mediatek: vcodec: replace pr_* with dev_* for v4l2 debug message Yunfei Dong
2023-06-07 8:48 ` [PATCH v2,06/10] mediatek: vcodec: separate struct mtk_vcodec_ctx Yunfei Dong
2023-06-07 8:48 ` [PATCH v2,07/10] mediatek: vcodec: separate struct mtk_vcodec_dev Yunfei Dong
2023-06-07 8:48 ` [PATCH v2,08/10] mediatek: vcodec: fix unreasonable parameter definition and style Yunfei Dong
2023-06-07 8:49 ` [PATCH v2,09/10] mediatek: vcodec: remove unused include header Yunfei Dong
2023-06-07 8:49 ` [PATCH v2,10/10] mediatek: vcodec: separete decoder and encoder Yunfei Dong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230607084901.28021-3-yunfei.dong@mediatek.com \
--to=yunfei.dong@mediatek.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=benjamin.gaignard@collabora.com \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=frkoenig@chromium.org \
--cc=hsinyi@chromium.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=nfraprado@collabora.com \
--cc=nhebert@chromium.org \
--cc=nicolas.dufresne@collabora.com \
--cc=stevecho@chromium.org \
--cc=wenst@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).