This series extracts the cleanup patches from the RFC of MT8183 support [1] as
these patches can already be merged. MT8183 support will be sent separately.
[1] https://patchwork.kernel.org/cover/10963769/
Changes since RFC:
- Replaced all GPLv2 headers with SPDX
- Replaced EXPORT_SYMBOL with EXPORT_SYMBOL_GPL
Alexandre Courbot (4):
media: mtk-vcodec: replace GPLv2 with SPDX
media: mtk-vcodec: avoid unneeded pointer-to-long conversions
media: mtk-vcodec: remove unneeded proxy functions
media: mtk-vcodec: constify formats
Yunfei Dong (1):
media: mtk-vcodec: support single-buffer frames
.../platform/mtk-vcodec/mtk_vcodec_dec.c | 45 ++++++++-----------
.../platform/mtk-vcodec/mtk_vcodec_dec.h | 15 +------
.../platform/mtk-vcodec/mtk_vcodec_dec_drv.c | 15 +------
.../platform/mtk-vcodec/mtk_vcodec_dec_pm.c | 14 +-----
.../platform/mtk-vcodec/mtk_vcodec_dec_pm.h | 14 +-----
.../platform/mtk-vcodec/mtk_vcodec_drv.h | 19 ++------
.../platform/mtk-vcodec/mtk_vcodec_enc.c | 34 +++++---------
.../platform/mtk-vcodec/mtk_vcodec_enc.h | 15 +------
.../platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 15 +------
.../platform/mtk-vcodec/mtk_vcodec_enc_pm.c | 14 +-----
.../platform/mtk-vcodec/mtk_vcodec_enc_pm.h | 14 +-----
.../platform/mtk-vcodec/mtk_vcodec_intr.c | 14 +-----
.../platform/mtk-vcodec/mtk_vcodec_intr.h | 14 +-----
.../platform/mtk-vcodec/mtk_vcodec_util.c | 15 +------
.../platform/mtk-vcodec/mtk_vcodec_util.h | 15 +------
.../platform/mtk-vcodec/vdec/vdec_h264_if.c | 35 ++++-----------
.../platform/mtk-vcodec/vdec/vdec_vp8_if.c | 36 ++++-----------
.../platform/mtk-vcodec/vdec/vdec_vp9_if.c | 37 ++++-----------
.../media/platform/mtk-vcodec/vdec_drv_base.h | 22 +++------
.../media/platform/mtk-vcodec/vdec_drv_if.c | 29 ++++--------
.../media/platform/mtk-vcodec/vdec_drv_if.h | 15 +------
.../media/platform/mtk-vcodec/vdec_ipi_msg.h | 15 +------
.../media/platform/mtk-vcodec/vdec_vpu_if.c | 14 +-----
.../media/platform/mtk-vcodec/vdec_vpu_if.h | 14 +-----
.../platform/mtk-vcodec/venc/venc_h264_if.c | 36 +++------------
.../platform/mtk-vcodec/venc/venc_vp8_if.c | 35 +++------------
.../media/platform/mtk-vcodec/venc_drv_base.h | 25 +++--------
.../media/platform/mtk-vcodec/venc_drv_if.c | 27 +++--------
.../media/platform/mtk-vcodec/venc_drv_if.h | 17 +------
.../media/platform/mtk-vcodec/venc_ipi_msg.h | 17 +------
.../media/platform/mtk-vcodec/venc_vpu_if.c | 15 +------
.../media/platform/mtk-vcodec/venc_vpu_if.h | 15 +------
32 files changed, 114 insertions(+), 562 deletions(-)
--
2.22.0.rc1.311.g5d7573a151-goog
The interface used to communicate with the firmware casts pointers
into unsigned longs and back again in order to store private
references, all of this for pointers that remain purely in the kernel.
Replace these unsigned longs with void pointers to make the code a bit
sturdier and easier to follow.
Also simplify some interfaces by removing arguments that could be
infered from others.
Signed-off-by: Alexandre Courbot <[email protected]>
---
drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h | 2 +-
.../media/platform/mtk-vcodec/vdec/vdec_h264_if.c | 12 ++++++------
drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c | 12 ++++++------
drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c | 12 ++++++------
drivers/media/platform/mtk-vcodec/vdec_drv_base.h | 8 ++++----
drivers/media/platform/mtk-vcodec/vdec_drv_if.c | 2 +-
.../media/platform/mtk-vcodec/venc/venc_h264_if.c | 10 +++++-----
drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c | 10 +++++-----
drivers/media/platform/mtk-vcodec/venc_drv_base.h | 8 ++++----
drivers/media/platform/mtk-vcodec/venc_drv_if.c | 2 +-
10 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
index d7b43caf7988..4b10996e6532 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
@@ -268,7 +268,7 @@ struct mtk_vcodec_ctx {
const struct vdec_common_if *dec_if;
const struct venc_common_if *enc_if;
- unsigned long drv_handle;
+ void *drv_handle;
struct vdec_pic_info picinfo;
int dpb_size;
diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c
index d725ea54b1c1..0c0660d2560b 100644
--- a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c
@@ -262,7 +262,7 @@ static void get_dpb_size(struct vdec_h264_inst *inst, unsigned int *dpb_sz)
mtk_vcodec_debug(inst, "sz=%d", *dpb_sz);
}
-static int vdec_h264_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
+static int vdec_h264_init(struct mtk_vcodec_ctx *ctx)
{
struct vdec_h264_inst *inst = NULL;
int err;
@@ -291,7 +291,7 @@ static int vdec_h264_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
mtk_vcodec_debug(inst, "H264 Instance >> %p", inst);
- *h_vdec = (unsigned long)inst;
+ ctx->drv_handle = inst;
return 0;
error_deinit:
@@ -302,7 +302,7 @@ static int vdec_h264_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
return err;
}
-static void vdec_h264_deinit(unsigned long h_vdec)
+static void vdec_h264_deinit(void *h_vdec)
{
struct vdec_h264_inst *inst = (struct vdec_h264_inst *)h_vdec;
@@ -327,7 +327,7 @@ static int find_start_code(unsigned char *data, unsigned int data_sz)
return -1;
}
-static int vdec_h264_decode(unsigned long h_vdec, struct mtk_vcodec_mem *bs,
+static int vdec_h264_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
struct vdec_fb *fb, bool *res_chg)
{
struct vdec_h264_inst *inst = (struct vdec_h264_inst *)h_vdec;
@@ -447,8 +447,8 @@ static void vdec_h264_get_fb(struct vdec_h264_inst *inst,
list->count--;
}
-static int vdec_h264_get_param(unsigned long h_vdec,
- enum vdec_get_param_type type, void *out)
+static int vdec_h264_get_param(void *h_vdec, enum vdec_get_param_type type,
+ void *out)
{
struct vdec_h264_inst *inst = (struct vdec_h264_inst *)h_vdec;
diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c
index 8de997875b6b..1e3763881e0d 100644
--- a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c
@@ -383,7 +383,7 @@ static void free_working_buf(struct vdec_vp8_inst *inst)
inst->vsi->dec.working_buf_dma = 0;
}
-static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
+static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx)
{
struct vdec_vp8_inst *inst;
int err;
@@ -414,7 +414,7 @@ static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
get_hw_reg_base(inst);
mtk_vcodec_debug(inst, "VP8 Instance >> %p", inst);
- *h_vdec = (unsigned long)inst;
+ ctx->drv_handle = inst;
return 0;
error_deinit:
@@ -424,7 +424,7 @@ static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
return err;
}
-static int vdec_vp8_decode(unsigned long h_vdec, struct mtk_vcodec_mem *bs,
+static int vdec_vp8_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
struct vdec_fb *fb, bool *res_chg)
{
struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec;
@@ -560,8 +560,8 @@ static void get_crop_info(struct vdec_vp8_inst *inst, struct v4l2_rect *cr)
cr->left, cr->top, cr->width, cr->height);
}
-static int vdec_vp8_get_param(unsigned long h_vdec,
- enum vdec_get_param_type type, void *out)
+static int vdec_vp8_get_param(void *h_vdec, enum vdec_get_param_type type,
+ void *out)
{
struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec;
@@ -594,7 +594,7 @@ static int vdec_vp8_get_param(unsigned long h_vdec,
return 0;
}
-static void vdec_vp8_deinit(unsigned long h_vdec)
+static void vdec_vp8_deinit(void *h_vdec)
{
struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec;
diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
index 02b65298c87e..589b2fc91da2 100644
--- a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
@@ -751,7 +751,7 @@ static int validate_vsi_array_indexes(struct vdec_vp9_inst *inst,
return 0;
}
-static void vdec_vp9_deinit(unsigned long h_vdec)
+static void vdec_vp9_deinit(void *h_vdec)
{
struct vdec_vp9_inst *inst = (struct vdec_vp9_inst *)h_vdec;
struct mtk_vcodec_mem *mem;
@@ -773,7 +773,7 @@ static void vdec_vp9_deinit(unsigned long h_vdec)
vp9_free_inst(inst);
}
-static int vdec_vp9_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
+static int vdec_vp9_init(struct mtk_vcodec_ctx *ctx)
{
struct vdec_vp9_inst *inst;
@@ -797,7 +797,7 @@ static int vdec_vp9_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
inst->vsi = (struct vdec_vp9_vsi *)inst->vpu.vsi;
init_all_fb_lists(inst);
- (*h_vdec) = (unsigned long)inst;
+ ctx->drv_handle = inst;
return 0;
err_deinit_inst:
@@ -806,7 +806,7 @@ static int vdec_vp9_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
return -EINVAL;
}
-static int vdec_vp9_decode(unsigned long h_vdec, struct mtk_vcodec_mem *bs,
+static int vdec_vp9_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
struct vdec_fb *fb, bool *res_chg)
{
int ret = 0;
@@ -963,8 +963,8 @@ static void get_crop_info(struct vdec_vp9_inst *inst, struct v4l2_rect *cr)
cr->left, cr->top, cr->width, cr->height);
}
-static int vdec_vp9_get_param(unsigned long h_vdec,
- enum vdec_get_param_type type, void *out)
+static int vdec_vp9_get_param(void *h_vdec, enum vdec_get_param_type type,
+ void *out)
{
struct vdec_vp9_inst *inst = (struct vdec_vp9_inst *)h_vdec;
int ret = 0;
diff --git a/drivers/media/platform/mtk-vcodec/vdec_drv_base.h b/drivers/media/platform/mtk-vcodec/vdec_drv_base.h
index 014712b1312e..4453f7de9f87 100644
--- a/drivers/media/platform/mtk-vcodec/vdec_drv_base.h
+++ b/drivers/media/platform/mtk-vcodec/vdec_drv_base.h
@@ -13,7 +13,7 @@ struct vdec_common_if {
* @ctx : [in] mtk v4l2 context
* @h_vdec : [out] driver handle
*/
- int (*init)(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec);
+ int (*init)(struct mtk_vcodec_ctx *ctx);
/**
* (*decode)() - trigger decode
@@ -22,7 +22,7 @@ struct vdec_common_if {
* @fb : [in] frame buffer to store decoded frame
* @res_chg : [out] resolution change happen
*/
- int (*decode)(unsigned long h_vdec, struct mtk_vcodec_mem *bs,
+ int (*decode)(void *h_vdec, struct mtk_vcodec_mem *bs,
struct vdec_fb *fb, bool *res_chg);
/**
@@ -31,14 +31,14 @@ struct vdec_common_if {
* @type : [in] input parameter type
* @out : [out] buffer to store query result
*/
- int (*get_param)(unsigned long h_vdec, enum vdec_get_param_type type,
+ int (*get_param)(void *h_vdec, enum vdec_get_param_type type,
void *out);
/**
* (*deinit)() - deinitialize driver.
* @h_vdec : [in] driver handle to be deinit
*/
- void (*deinit)(unsigned long h_vdec);
+ void (*deinit)(void *h_vdec);
};
#endif
diff --git a/drivers/media/platform/mtk-vcodec/vdec_drv_if.c b/drivers/media/platform/mtk-vcodec/vdec_drv_if.c
index 6835cb7d090a..5d8d76d55005 100644
--- a/drivers/media/platform/mtk-vcodec/vdec_drv_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec_drv_if.c
@@ -34,7 +34,7 @@ int vdec_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)
mtk_vdec_lock(ctx);
mtk_vcodec_dec_clock_on(&ctx->dev->pm);
- ret = ctx->dec_if->init(ctx, &ctx->drv_handle);
+ ret = ctx->dec_if->init(ctx);
mtk_vcodec_dec_clock_off(&ctx->dev->pm);
mtk_vdec_unlock(ctx);
diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
index 0cf08dd7b6e3..bfe61d5dc1cb 100644
--- a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
+++ b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
@@ -452,7 +452,7 @@ static void h264_encode_filler(struct venc_h264_inst *inst, void *buf,
memset(p, 0xff, size);
}
-static int h264_enc_init(struct mtk_vcodec_ctx *ctx, unsigned long *handle)
+static int h264_enc_init(struct mtk_vcodec_ctx *ctx)
{
int ret = 0;
struct venc_h264_inst *inst;
@@ -478,12 +478,12 @@ static int h264_enc_init(struct mtk_vcodec_ctx *ctx, unsigned long *handle)
if (ret)
kfree(inst);
else
- (*handle) = (unsigned long)inst;
+ ctx->drv_handle = inst;
return ret;
}
-static int h264_enc_encode(unsigned long handle,
+static int h264_enc_encode(void *handle,
enum venc_start_opt opt,
struct venc_frm_buf *frm_buf,
struct mtk_vcodec_mem *bs_buf,
@@ -578,7 +578,7 @@ static int h264_enc_encode(unsigned long handle,
return ret;
}
-static int h264_enc_set_param(unsigned long handle,
+static int h264_enc_set_param(void *handle,
enum venc_set_param_type type,
struct venc_enc_param *enc_prm)
{
@@ -631,7 +631,7 @@ static int h264_enc_set_param(unsigned long handle,
return ret;
}
-static int h264_enc_deinit(unsigned long handle)
+static int h264_enc_deinit(void *handle)
{
int ret = 0;
struct venc_h264_inst *inst = (struct venc_h264_inst *)handle;
diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
index 3fb9e0c79b4f..af23367cf1dd 100644
--- a/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
+++ b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
@@ -318,7 +318,7 @@ static int vp8_enc_encode_frame(struct venc_vp8_inst *inst,
return ret;
}
-static int vp8_enc_init(struct mtk_vcodec_ctx *ctx, unsigned long *handle)
+static int vp8_enc_init(struct mtk_vcodec_ctx *ctx)
{
int ret = 0;
struct venc_vp8_inst *inst;
@@ -344,12 +344,12 @@ static int vp8_enc_init(struct mtk_vcodec_ctx *ctx, unsigned long *handle)
if (ret)
kfree(inst);
else
- (*handle) = (unsigned long)inst;
+ ctx->drv_handle = inst;
return ret;
}
-static int vp8_enc_encode(unsigned long handle,
+static int vp8_enc_encode(void *handle,
enum venc_start_opt opt,
struct venc_frm_buf *frm_buf,
struct mtk_vcodec_mem *bs_buf,
@@ -386,7 +386,7 @@ static int vp8_enc_encode(unsigned long handle,
return ret;
}
-static int vp8_enc_set_param(unsigned long handle,
+static int vp8_enc_set_param(void *handle,
enum venc_set_param_type type,
struct venc_enc_param *enc_prm)
{
@@ -437,7 +437,7 @@ static int vp8_enc_set_param(unsigned long handle,
return ret;
}
-static int vp8_enc_deinit(unsigned long handle)
+static int vp8_enc_deinit(void *handle)
{
int ret = 0;
struct venc_vp8_inst *inst = (struct venc_vp8_inst *)handle;
diff --git a/drivers/media/platform/mtk-vcodec/venc_drv_base.h b/drivers/media/platform/mtk-vcodec/venc_drv_base.h
index 2de37b47fe73..be368fcb01e6 100644
--- a/drivers/media/platform/mtk-vcodec/venc_drv_base.h
+++ b/drivers/media/platform/mtk-vcodec/venc_drv_base.h
@@ -13,7 +13,7 @@ struct venc_common_if {
* @ctx: [in] mtk v4l2 context
* @handle: [out] driver handle
*/
- int (*init)(struct mtk_vcodec_ctx *ctx, unsigned long *handle);
+ int (*init)(struct mtk_vcodec_ctx *ctx);
/**
* (*encode)() - trigger encode
@@ -23,7 +23,7 @@ struct venc_common_if {
* @bs_buf: [in] bitstream buffer to store output bitstream
* @result: [out] encode result
*/
- int (*encode)(unsigned long handle, enum venc_start_opt opt,
+ int (*encode)(void *handle, enum venc_start_opt opt,
struct venc_frm_buf *frm_buf,
struct mtk_vcodec_mem *bs_buf,
struct venc_done_result *result);
@@ -34,14 +34,14 @@ struct venc_common_if {
* @type: [in] parameter type
* @in: [in] buffer to store the parameter
*/
- int (*set_param)(unsigned long handle, enum venc_set_param_type type,
+ int (*set_param)(void *handle, enum venc_set_param_type type,
struct venc_enc_param *in);
/**
* (*deinit)() - deinitialize driver.
* @handle: [in] driver handle
*/
- int (*deinit)(unsigned long handle);
+ int (*deinit)(void *handle);
};
#endif
diff --git a/drivers/media/platform/mtk-vcodec/venc_drv_if.c b/drivers/media/platform/mtk-vcodec/venc_drv_if.c
index 25c1e100f5a1..318af1b4b6e7 100644
--- a/drivers/media/platform/mtk-vcodec/venc_drv_if.c
+++ b/drivers/media/platform/mtk-vcodec/venc_drv_if.c
@@ -31,7 +31,7 @@ int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)
mtk_venc_lock(ctx);
mtk_vcodec_enc_clock_on(&ctx->dev->pm);
- ret = ctx->enc_if->init(ctx, (unsigned long *)&ctx->drv_handle);
+ ret = ctx->enc_if->init(ctx);
mtk_vcodec_enc_clock_off(&ctx->dev->pm);
mtk_venc_unlock(ctx);
--
2.22.0.rc1.311.g5d7573a151-goog
Replace the GPLv2 boilerplate with the corresponding SPDX reference.
Signed-off-by: Alexandre Courbot <[email protected]>
---
.../media/platform/mtk-vcodec/mtk_vcodec_dec.c | 15 +--------------
.../media/platform/mtk-vcodec/mtk_vcodec_dec.h | 15 +--------------
.../platform/mtk-vcodec/mtk_vcodec_dec_drv.c | 15 +--------------
.../platform/mtk-vcodec/mtk_vcodec_dec_pm.c | 14 +-------------
.../platform/mtk-vcodec/mtk_vcodec_dec_pm.h | 14 +-------------
.../media/platform/mtk-vcodec/mtk_vcodec_drv.h | 15 +--------------
.../media/platform/mtk-vcodec/mtk_vcodec_enc.c | 15 +--------------
.../media/platform/mtk-vcodec/mtk_vcodec_enc.h | 15 +--------------
.../platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 15 +--------------
.../platform/mtk-vcodec/mtk_vcodec_enc_pm.c | 14 +-------------
.../platform/mtk-vcodec/mtk_vcodec_enc_pm.h | 14 +-------------
.../media/platform/mtk-vcodec/mtk_vcodec_intr.c | 14 +-------------
.../media/platform/mtk-vcodec/mtk_vcodec_intr.h | 14 +-------------
.../media/platform/mtk-vcodec/mtk_vcodec_util.c | 15 +--------------
.../media/platform/mtk-vcodec/mtk_vcodec_util.h | 15 +--------------
.../platform/mtk-vcodec/vdec/vdec_h264_if.c | 14 +-------------
.../platform/mtk-vcodec/vdec/vdec_vp8_if.c | 15 +--------------
.../platform/mtk-vcodec/vdec/vdec_vp9_if.c | 16 +---------------
.../media/platform/mtk-vcodec/vdec_drv_base.h | 14 +-------------
drivers/media/platform/mtk-vcodec/vdec_drv_if.c | 15 +--------------
drivers/media/platform/mtk-vcodec/vdec_drv_if.h | 15 +--------------
.../media/platform/mtk-vcodec/vdec_ipi_msg.h | 15 +--------------
drivers/media/platform/mtk-vcodec/vdec_vpu_if.c | 14 +-------------
drivers/media/platform/mtk-vcodec/vdec_vpu_if.h | 14 +-------------
.../platform/mtk-vcodec/venc/venc_h264_if.c | 17 +----------------
.../platform/mtk-vcodec/venc/venc_vp8_if.c | 16 +---------------
.../media/platform/mtk-vcodec/venc_drv_base.h | 17 +----------------
drivers/media/platform/mtk-vcodec/venc_drv_if.c | 17 +----------------
drivers/media/platform/mtk-vcodec/venc_drv_if.h | 17 +----------------
.../media/platform/mtk-vcodec/venc_ipi_msg.h | 17 +----------------
drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 15 +--------------
drivers/media/platform/mtk-vcodec/venc_vpu_if.h | 15 +--------------
32 files changed, 32 insertions(+), 450 deletions(-)
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
index 851903867bc9..371e70d6a803 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
@@ -1,17 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: PC Chen <[email protected]>
- * Tiffany Lin <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+// SPDX-License-Identifier: GPL-2.0
#include <media/v4l2-event.h>
#include <media/v4l2-mem2mem.h>
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.h
index e4984edec4f8..a18268694646 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.h
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.h
@@ -1,17 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: PC Chen <[email protected]>
- * Tiffany Lin <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _MTK_VCODEC_DEC_H_
#define _MTK_VCODEC_DEC_H_
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
index 4334b7394861..dbe957aa138d 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
@@ -1,17 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: PC Chen <[email protected]>
- * Tiffany Lin <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+// SPDX-License-Identifier: GPL-2.0
#include <linux/slab.h>
#include <linux/interrupt.h>
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
index 11c45c556e88..b09242b1470d 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
@@ -1,16 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: Tiffany Lin <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+// SPDX-License-Identifier: GPL-2.0
#include <linux/clk.h>
#include <linux/of_address.h>
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.h
index 86a7825353e3..b44621ad15d8 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.h
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.h
@@ -1,16 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: Tiffany Lin <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _MTK_VCODEC_DEC_PM_H_
#define _MTK_VCODEC_DEC_PM_H_
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
index 662a84b822af..d7b43caf7988 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
@@ -1,17 +1,4 @@
-/*
-* Copyright (c) 2016 MediaTek Inc.
-* Author: PC Chen <[email protected]>
-* Tiffany Lin <[email protected]>
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License version 2 as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*/
+/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _MTK_VCODEC_DRV_H_
#define _MTK_VCODEC_DRV_H_
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 50351adafc47..1a3845809b92 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -1,17 +1,4 @@
-/*
-* Copyright (c) 2016 MediaTek Inc.
-* Author: PC Chen <[email protected]>
-* Tiffany Lin <[email protected]>
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License version 2 as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*/
+// SPDX-License-Identifier: GPL-2.0
#include <media/v4l2-event.h>
#include <media/v4l2-mem2mem.h>
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h
index d7a154a97510..e372e5ddff8a 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h
@@ -1,17 +1,4 @@
-/*
-* Copyright (c) 2016 MediaTek Inc.
-* Author: PC Chen <[email protected]>
-* Tiffany Lin <[email protected]>
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License version 2 as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*/
+/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _MTK_VCODEC_ENC_H_
#define _MTK_VCODEC_ENC_H_
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
index 83f859e8509c..b6d7c602c2ad 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
@@ -1,17 +1,4 @@
-/*
-* Copyright (c) 2016 MediaTek Inc.
-* Author: PC Chen <[email protected]>
-* Tiffany Lin <[email protected]>
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License version 2 as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*/
+// SPDX-License-Identifier: GPL-2.0
#include <linux/slab.h>
#include <linux/interrupt.h>
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
index 39375b8ea27c..90bdad5c71b0 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
@@ -1,16 +1,4 @@
-/*
-* Copyright (c) 2016 MediaTek Inc.
-* Author: Tiffany Lin <[email protected]>
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License version 2 as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*/
+// SPDX-License-Identifier: GPL-2.0
#include <linux/clk.h>
#include <linux/of_address.h>
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.h
index f32167138976..dddbbe02a109 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.h
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.h
@@ -1,16 +1,4 @@
-/*
-* Copyright (c) 2016 MediaTek Inc.
-* Author: Tiffany Lin <[email protected]>
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License version 2 as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*/
+/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _MTK_VCODEC_ENC_PM_H_
#define _MTK_VCODEC_ENC_PM_H_
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c
index 113b2097f061..693888e4987f 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c
@@ -1,16 +1,4 @@
-/*
-* Copyright (c) 2016 MediaTek Inc.
-* Author: Tiffany Lin <[email protected]>
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License version 2 as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*/
+// SPDX-License-Identifier: GPL-2.0
#include <linux/errno.h>
#include <linux/wait.h>
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h
index 12131855b46a..55f046cd93a5 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h
@@ -1,16 +1,4 @@
-/*
-* Copyright (c) 2016 MediaTek Inc.
-* Author: Tiffany Lin <[email protected]>
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License version 2 as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*/
+/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _MTK_VCODEC_INTR_H_
#define _MTK_VCODEC_INTR_H_
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
index 060c0ad6243a..e1a9ac9694e3 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
@@ -1,17 +1,4 @@
-/*
-* Copyright (c) 2016 MediaTek Inc.
-* Author: PC Chen <[email protected]>
-* Tiffany Lin <[email protected]>
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License version 2 as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*/
+// SPDX-License-Identifier: GPL-2.0
#include <linux/module.h>
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h
index 9bf6e8d1b9c9..daabb63548d0 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h
@@ -1,17 +1,4 @@
-/*
-* Copyright (c) 2016 MediaTek Inc.
-* Author: PC Chen <[email protected]>
-* Tiffany Lin <[email protected]>
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License version 2 as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*/
+/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _MTK_VCODEC_UTIL_H_
#define _MTK_VCODEC_UTIL_H_
diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c
index cdbcd6909728..d725ea54b1c1 100644
--- a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c
@@ -1,16 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: PC Chen <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+// SPDX-License-Identifier: GPL-2.0
#include <linux/module.h>
#include <linux/slab.h>
diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c
index ba79136421ef..8de997875b6b 100644
--- a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c
@@ -1,17 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: Jungchang Tsao <[email protected]>
- * PC Chen <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+// SPDX-License-Identifier: GPL-2.0
#include <linux/slab.h>
#include "../vdec_drv_if.h"
diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
index 939ea14bf6c5..02b65298c87e 100644
--- a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
@@ -1,18 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: Daniel Hsiao <[email protected]>
- * Kai-Sean Yang <[email protected]>
- * Tiffany Lin <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+// SPDX-License-Identifier: GPL-2.0
#include <linux/fs.h>
#include <linux/slab.h>
diff --git a/drivers/media/platform/mtk-vcodec/vdec_drv_base.h b/drivers/media/platform/mtk-vcodec/vdec_drv_base.h
index 7e4c1a92bbd8..014712b1312e 100644
--- a/drivers/media/platform/mtk-vcodec/vdec_drv_base.h
+++ b/drivers/media/platform/mtk-vcodec/vdec_drv_base.h
@@ -1,16 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: PC Chen <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _VDEC_DRV_BASE_
#define _VDEC_DRV_BASE_
diff --git a/drivers/media/platform/mtk-vcodec/vdec_drv_if.c b/drivers/media/platform/mtk-vcodec/vdec_drv_if.c
index 5ffc468dd910..6835cb7d090a 100644
--- a/drivers/media/platform/mtk-vcodec/vdec_drv_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec_drv_if.c
@@ -1,17 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: PC Chen <[email protected]>
- * Tiffany Lin <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+// SPDX-License-Identifier: GPL-2.0
#include <linux/interrupt.h>
#include <linux/kernel.h>
diff --git a/drivers/media/platform/mtk-vcodec/vdec_drv_if.h b/drivers/media/platform/mtk-vcodec/vdec_drv_if.h
index 9a21591f3818..ceba7f55a526 100644
--- a/drivers/media/platform/mtk-vcodec/vdec_drv_if.h
+++ b/drivers/media/platform/mtk-vcodec/vdec_drv_if.h
@@ -1,17 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: PC Chen <[email protected]>
- * Tiffany Lin <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _VDEC_DRV_IF_H_
#define _VDEC_DRV_IF_H_
diff --git a/drivers/media/platform/mtk-vcodec/vdec_ipi_msg.h b/drivers/media/platform/mtk-vcodec/vdec_ipi_msg.h
index 5a8a629f4ac9..6370f1285a63 100644
--- a/drivers/media/platform/mtk-vcodec/vdec_ipi_msg.h
+++ b/drivers/media/platform/mtk-vcodec/vdec_ipi_msg.h
@@ -1,17 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: PC Chen <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _VDEC_IPI_MSG_H_
#define _VDEC_IPI_MSG_H_
diff --git a/drivers/media/platform/mtk-vcodec/vdec_vpu_if.c b/drivers/media/platform/mtk-vcodec/vdec_vpu_if.c
index 1abd14e79565..9b240d325a84 100644
--- a/drivers/media/platform/mtk-vcodec/vdec_vpu_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec_vpu_if.c
@@ -1,16 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: PC Chen <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+// SPDX-License-Identifier: GPL-2.0
#include "mtk_vcodec_drv.h"
#include "mtk_vcodec_util.h"
diff --git a/drivers/media/platform/mtk-vcodec/vdec_vpu_if.h b/drivers/media/platform/mtk-vcodec/vdec_vpu_if.h
index 79d8eac7f5e2..3c417493ccca 100644
--- a/drivers/media/platform/mtk-vcodec/vdec_vpu_if.h
+++ b/drivers/media/platform/mtk-vcodec/vdec_vpu_if.h
@@ -1,16 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: PC Chen <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _VDEC_VPU_IF_H_
#define _VDEC_VPU_IF_H_
diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
index 6cf31b366aad..0cf08dd7b6e3 100644
--- a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
+++ b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
@@ -1,19 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: Jungchang Tsao <[email protected]>
- * Daniel Hsiao <[email protected]>
- * PoChun Lin <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+// SPDX-License-Identifier: GPL-2.0
#include <linux/interrupt.h>
#include <linux/kernel.h>
diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
index 957420dd60de..3fb9e0c79b4f 100644
--- a/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
+++ b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
@@ -1,18 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: Daniel Hsiao <[email protected]>
- * PoChun Lin <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+// SPDX-License-Identifier: GPL-2.0
#include <linux/interrupt.h>
#include <linux/kernel.h>
diff --git a/drivers/media/platform/mtk-vcodec/venc_drv_base.h b/drivers/media/platform/mtk-vcodec/venc_drv_base.h
index 6308d44dedf6..2de37b47fe73 100644
--- a/drivers/media/platform/mtk-vcodec/venc_drv_base.h
+++ b/drivers/media/platform/mtk-vcodec/venc_drv_base.h
@@ -1,19 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: Daniel Hsiao <[email protected]>
- * Jungchang Tsao <[email protected]>
- * Tiffany Lin <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _VENC_DRV_BASE_
#define _VENC_DRV_BASE_
diff --git a/drivers/media/platform/mtk-vcodec/venc_drv_if.c b/drivers/media/platform/mtk-vcodec/venc_drv_if.c
index d02d5f1df279..25c1e100f5a1 100644
--- a/drivers/media/platform/mtk-vcodec/venc_drv_if.c
+++ b/drivers/media/platform/mtk-vcodec/venc_drv_if.c
@@ -1,19 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: Daniel Hsiao <[email protected]>
- * Jungchang Tsao <[email protected]>
- * Tiffany Lin <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+// SPDX-License-Identifier: GPL-2.0
#include <linux/interrupt.h>
#include <linux/kernel.h>
diff --git a/drivers/media/platform/mtk-vcodec/venc_drv_if.h b/drivers/media/platform/mtk-vcodec/venc_drv_if.h
index 55ecda844894..d6605812ebb0 100644
--- a/drivers/media/platform/mtk-vcodec/venc_drv_if.h
+++ b/drivers/media/platform/mtk-vcodec/venc_drv_if.h
@@ -1,19 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: Daniel Hsiao <[email protected]>
- * Jungchang Tsao <[email protected]>
- * Tiffany Lin <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _VENC_DRV_IF_H_
#define _VENC_DRV_IF_H_
diff --git a/drivers/media/platform/mtk-vcodec/venc_ipi_msg.h b/drivers/media/platform/mtk-vcodec/venc_ipi_msg.h
index 4c869cb6fbf7..d5282f24f934 100644
--- a/drivers/media/platform/mtk-vcodec/venc_ipi_msg.h
+++ b/drivers/media/platform/mtk-vcodec/venc_ipi_msg.h
@@ -1,19 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: Jungchang Tsao <[email protected]>
- * Daniel Hsiao <[email protected]>
- * Tiffany Lin <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _VENC_IPI_MSG_H_
#define _VENC_IPI_MSG_H_
diff --git a/drivers/media/platform/mtk-vcodec/venc_vpu_if.c b/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
index 0d882acf8830..a6906db74718 100644
--- a/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
+++ b/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
@@ -1,17 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: PoChun Lin <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+// SPDX-License-Identifier: GPL-2.0
#include "mtk_vpu.h"
#include "venc_ipi_msg.h"
diff --git a/drivers/media/platform/mtk-vcodec/venc_vpu_if.h b/drivers/media/platform/mtk-vcodec/venc_vpu_if.h
index 215d1e01362e..fd4f85646aa5 100644
--- a/drivers/media/platform/mtk-vcodec/venc_vpu_if.h
+++ b/drivers/media/platform/mtk-vcodec/venc_vpu_if.h
@@ -1,17 +1,4 @@
-/*
- * Copyright (c) 2016 MediaTek Inc.
- * Author: PoChun Lin <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _VENC_VPU_IF_H_
#define _VENC_VPU_IF_H_
--
2.22.0.rc1.311.g5d7573a151-goog
We were getting the codec interface through a proxy function that does
not bring anything compared to just accessing the interface definition
directly, so just do that. Also make the decoder interfaces const.
Signed-off-by: Alexandre Courbot <[email protected]>
---
.../media/platform/mtk-vcodec/vdec/vdec_h264_if.c | 9 +--------
drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c | 9 +--------
drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c | 9 +--------
drivers/media/platform/mtk-vcodec/vdec_drv_if.c | 12 ++++++------
.../media/platform/mtk-vcodec/venc/venc_h264_if.c | 9 +--------
drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c | 9 +--------
drivers/media/platform/mtk-vcodec/venc_drv_if.c | 8 ++++----
7 files changed, 15 insertions(+), 50 deletions(-)
diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c
index 0c0660d2560b..85afdd6ab093 100644
--- a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c
@@ -481,16 +481,9 @@ static int vdec_h264_get_param(void *h_vdec, enum vdec_get_param_type type,
return 0;
}
-static struct vdec_common_if vdec_h264_if = {
+const struct vdec_common_if vdec_h264_if = {
.init = vdec_h264_init,
.decode = vdec_h264_decode,
.get_param = vdec_h264_get_param,
.deinit = vdec_h264_deinit,
};
-
-struct vdec_common_if *get_h264_dec_comm_if(void);
-
-struct vdec_common_if *get_h264_dec_comm_if(void)
-{
- return &vdec_h264_if;
-}
diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c
index 1e3763881e0d..a8ca762eac76 100644
--- a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c
@@ -605,16 +605,9 @@ static void vdec_vp8_deinit(void *h_vdec)
kfree(inst);
}
-static struct vdec_common_if vdec_vp8_if = {
+const struct vdec_common_if vdec_vp8_if = {
.init = vdec_vp8_init,
.decode = vdec_vp8_decode,
.get_param = vdec_vp8_get_param,
.deinit = vdec_vp8_deinit,
};
-
-struct vdec_common_if *get_vp8_dec_comm_if(void);
-
-struct vdec_common_if *get_vp8_dec_comm_if(void)
-{
- return &vdec_vp8_if;
-}
diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
index 589b2fc91da2..1f99febdfbbe 100644
--- a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
@@ -994,16 +994,9 @@ static int vdec_vp9_get_param(void *h_vdec, enum vdec_get_param_type type,
return ret;
}
-static struct vdec_common_if vdec_vp9_if = {
+const struct vdec_common_if vdec_vp9_if = {
.init = vdec_vp9_init,
.decode = vdec_vp9_decode,
.get_param = vdec_vp9_get_param,
.deinit = vdec_vp9_deinit,
};
-
-struct vdec_common_if *get_vp9_dec_comm_if(void);
-
-struct vdec_common_if *get_vp9_dec_comm_if(void)
-{
- return &vdec_vp9_if;
-}
diff --git a/drivers/media/platform/mtk-vcodec/vdec_drv_if.c b/drivers/media/platform/mtk-vcodec/vdec_drv_if.c
index 5d8d76d55005..aa614eea3cc5 100644
--- a/drivers/media/platform/mtk-vcodec/vdec_drv_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec_drv_if.c
@@ -10,9 +10,9 @@
#include "mtk_vcodec_dec_pm.h"
#include "mtk_vpu.h"
-const struct vdec_common_if *get_h264_dec_comm_if(void);
-const struct vdec_common_if *get_vp8_dec_comm_if(void);
-const struct vdec_common_if *get_vp9_dec_comm_if(void);
+extern const struct vdec_common_if vdec_h264_if;
+extern const struct vdec_common_if vdec_vp8_if;
+extern const struct vdec_common_if vdec_vp9_if;
int vdec_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)
{
@@ -20,13 +20,13 @@ int vdec_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)
switch (fourcc) {
case V4L2_PIX_FMT_H264:
- ctx->dec_if = get_h264_dec_comm_if();
+ ctx->dec_if = &vdec_h264_if;
break;
case V4L2_PIX_FMT_VP8:
- ctx->dec_if = get_vp8_dec_comm_if();
+ ctx->dec_if = &vdec_vp8_if;
break;
case V4L2_PIX_FMT_VP9:
- ctx->dec_if = get_vp9_dec_comm_if();
+ ctx->dec_if = &vdec_vp9_if;
break;
default:
return -EINVAL;
diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
index bfe61d5dc1cb..4e1d933395cd 100644
--- a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
+++ b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
@@ -649,16 +649,9 @@ static int h264_enc_deinit(void *handle)
return ret;
}
-static const struct venc_common_if venc_h264_if = {
+const struct venc_common_if venc_h264_if = {
.init = h264_enc_init,
.encode = h264_enc_encode,
.set_param = h264_enc_set_param,
.deinit = h264_enc_deinit,
};
-
-const struct venc_common_if *get_h264_enc_comm_if(void);
-
-const struct venc_common_if *get_h264_enc_comm_if(void)
-{
- return &venc_h264_if;
-}
diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
index af23367cf1dd..2d1372ab6486 100644
--- a/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
+++ b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
@@ -455,16 +455,9 @@ static int vp8_enc_deinit(void *handle)
return ret;
}
-static const struct venc_common_if venc_vp8_if = {
+const struct venc_common_if venc_vp8_if = {
.init = vp8_enc_init,
.encode = vp8_enc_encode,
.set_param = vp8_enc_set_param,
.deinit = vp8_enc_deinit,
};
-
-const struct venc_common_if *get_vp8_enc_comm_if(void);
-
-const struct venc_common_if *get_vp8_enc_comm_if(void)
-{
- return &venc_vp8_if;
-}
diff --git a/drivers/media/platform/mtk-vcodec/venc_drv_if.c b/drivers/media/platform/mtk-vcodec/venc_drv_if.c
index 318af1b4b6e7..cf5bfa296d20 100644
--- a/drivers/media/platform/mtk-vcodec/venc_drv_if.c
+++ b/drivers/media/platform/mtk-vcodec/venc_drv_if.c
@@ -11,8 +11,8 @@
#include "mtk_vcodec_enc_pm.h"
#include "mtk_vpu.h"
-const struct venc_common_if *get_h264_enc_comm_if(void);
-const struct venc_common_if *get_vp8_enc_comm_if(void);
+extern const struct venc_common_if venc_h264_if;
+extern const struct venc_common_if venc_vp8_if;
int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)
{
@@ -20,10 +20,10 @@ int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)
switch (fourcc) {
case V4L2_PIX_FMT_VP8:
- ctx->enc_if = get_vp8_enc_comm_if();
+ ctx->enc_if = &venc_vp8_if;
break;
case V4L2_PIX_FMT_H264:
- ctx->enc_if = get_h264_enc_comm_if();
+ ctx->enc_if = &venc_h264_if;
break;
default:
return -EINVAL;
--
2.22.0.rc1.311.g5d7573a151-goog
Formats are read-only internal memory structures, so make them const.
Signed-off-by: Alexandre Courbot <[email protected]>
---
.../platform/mtk-vcodec/mtk_vcodec_dec.c | 19 ++++++++++---------
.../platform/mtk-vcodec/mtk_vcodec_drv.h | 2 +-
.../platform/mtk-vcodec/mtk_vcodec_enc.c | 19 ++++++++++---------
3 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
index 371e70d6a803..131a8117ece2 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
@@ -19,7 +19,7 @@
#define DFT_CFG_WIDTH MTK_VDEC_MIN_W
#define DFT_CFG_HEIGHT MTK_VDEC_MIN_H
-static struct mtk_video_fmt mtk_video_formats[] = {
+static const struct mtk_video_fmt mtk_video_formats[] = {
{
.fourcc = V4L2_PIX_FMT_H264,
.type = MTK_FMT_DEC,
@@ -63,9 +63,9 @@ static const struct mtk_codec_framesizes mtk_vdec_framesizes[] = {
#define NUM_SUPPORTED_FRAMESIZE ARRAY_SIZE(mtk_vdec_framesizes)
#define NUM_FORMATS ARRAY_SIZE(mtk_video_formats)
-static struct mtk_video_fmt *mtk_vdec_find_format(struct v4l2_format *f)
+static const struct mtk_video_fmt *mtk_vdec_find_format(struct v4l2_format *f)
{
- struct mtk_video_fmt *fmt;
+ const struct mtk_video_fmt *fmt;
unsigned int k;
for (k = 0; k < NUM_FORMATS; k++) {
@@ -266,7 +266,7 @@ static void mtk_vdec_flush_decoder(struct mtk_vcodec_ctx *ctx)
static void mtk_vdec_update_fmt(struct mtk_vcodec_ctx *ctx,
unsigned int pixelformat)
{
- struct mtk_video_fmt *fmt;
+ const struct mtk_video_fmt *fmt;
struct mtk_q_data *dst_q_data;
unsigned int k;
@@ -639,7 +639,8 @@ static int vidioc_vdec_subscribe_evt(struct v4l2_fh *fh,
}
}
-static int vidioc_try_fmt(struct v4l2_format *f, struct mtk_video_fmt *fmt)
+static int vidioc_try_fmt(struct v4l2_format *f,
+ const struct mtk_video_fmt *fmt)
{
struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
int i;
@@ -712,7 +713,7 @@ static int vidioc_try_fmt(struct v4l2_format *f, struct mtk_video_fmt *fmt)
static int vidioc_try_fmt_vid_cap_mplane(struct file *file, void *priv,
struct v4l2_format *f)
{
- struct mtk_video_fmt *fmt;
+ const struct mtk_video_fmt *fmt;
fmt = mtk_vdec_find_format(f);
if (!fmt) {
@@ -727,7 +728,7 @@ static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv,
struct v4l2_format *f)
{
struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
- struct mtk_video_fmt *fmt;
+ const struct mtk_video_fmt *fmt;
fmt = mtk_vdec_find_format(f);
if (!fmt) {
@@ -821,7 +822,7 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv,
struct v4l2_pix_format_mplane *pix_mp;
struct mtk_q_data *q_data;
int ret = 0;
- struct mtk_video_fmt *fmt;
+ const struct mtk_video_fmt *fmt;
mtk_v4l2_debug(3, "[%d]", ctx->id);
@@ -920,7 +921,7 @@ static int vidioc_enum_framesizes(struct file *file, void *priv,
static int vidioc_enum_fmt(struct v4l2_fmtdesc *f, bool output_queue)
{
- struct mtk_video_fmt *fmt;
+ const struct mtk_video_fmt *fmt;
int i, j = 0;
for (i = 0; i < NUM_FORMATS; i++) {
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
index 4b10996e6532..0a29a0694124 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
@@ -124,7 +124,7 @@ struct mtk_q_data {
enum v4l2_field field;
unsigned int bytesperline[MTK_VCODEC_MAX_PLANES];
unsigned int sizeimage[MTK_VCODEC_MAX_PLANES];
- struct mtk_video_fmt *fmt;
+ const struct mtk_video_fmt *fmt;
};
/**
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 1a3845809b92..868147616da7 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -24,7 +24,7 @@
static void mtk_venc_worker(struct work_struct *work);
-static struct mtk_video_fmt mtk_video_formats[] = {
+static const struct mtk_video_fmt mtk_video_formats[] = {
{
.fourcc = V4L2_PIX_FMT_NV12M,
.type = MTK_FMT_FRAME,
@@ -153,7 +153,7 @@ static const struct v4l2_ctrl_ops mtk_vcodec_enc_ctrl_ops = {
static int vidioc_enum_fmt(struct v4l2_fmtdesc *f, bool output_queue)
{
- struct mtk_video_fmt *fmt;
+ const struct mtk_video_fmt *fmt;
int i, j = 0;
for (i = 0; i < NUM_FORMATS; ++i) {
@@ -261,9 +261,9 @@ static struct mtk_q_data *mtk_venc_get_q_data(struct mtk_vcodec_ctx *ctx,
return &ctx->q_data[MTK_Q_DATA_DST];
}
-static struct mtk_video_fmt *mtk_venc_find_format(struct v4l2_format *f)
+static const struct mtk_video_fmt *mtk_venc_find_format(struct v4l2_format *f)
{
- struct mtk_video_fmt *fmt;
+ const struct mtk_video_fmt *fmt;
unsigned int k;
for (k = 0; k < NUM_FORMATS; k++) {
@@ -278,7 +278,8 @@ static struct mtk_video_fmt *mtk_venc_find_format(struct v4l2_format *f)
/* V4L2 specification suggests the driver corrects the format struct if any of
* the dimensions is unsupported
*/
-static int vidioc_try_fmt(struct v4l2_format *f, struct mtk_video_fmt *fmt)
+static int vidioc_try_fmt(struct v4l2_format *f,
+ const struct mtk_video_fmt *fmt)
{
struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
int i;
@@ -414,7 +415,7 @@ static int vidioc_venc_s_fmt_cap(struct file *file, void *priv,
struct vb2_queue *vq;
struct mtk_q_data *q_data;
int i, ret;
- struct mtk_video_fmt *fmt;
+ const struct mtk_video_fmt *fmt;
vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type);
if (!vq) {
@@ -476,7 +477,7 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
struct vb2_queue *vq;
struct mtk_q_data *q_data;
int ret, i;
- struct mtk_video_fmt *fmt;
+ const struct mtk_video_fmt *fmt;
struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type);
@@ -575,7 +576,7 @@ static int vidioc_venc_g_fmt(struct file *file, void *priv,
static int vidioc_try_fmt_vid_cap_mplane(struct file *file, void *priv,
struct v4l2_format *f)
{
- struct mtk_video_fmt *fmt;
+ const struct mtk_video_fmt *fmt;
struct mtk_vcodec_ctx *ctx = fh_to_ctx(priv);
fmt = mtk_venc_find_format(f);
@@ -594,7 +595,7 @@ static int vidioc_try_fmt_vid_cap_mplane(struct file *file, void *priv,
static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv,
struct v4l2_format *f)
{
- struct mtk_video_fmt *fmt;
+ const struct mtk_video_fmt *fmt;
fmt = mtk_venc_find_format(f);
if (!fmt) {
--
2.22.0.rc1.311.g5d7573a151-goog
From: Yunfei Dong <[email protected]>
MT8183 will use a multi-planar format backed by a single buffer. Adapt
the existing code to be able to handle such frames instead of assuming
each frame is backed by two buffers.
Signed-off-by: Yunfei Dong <[email protected]>
Co-developed-by: Alexandre Courbot <[email protected]>
Signed-off-by: Alexandre Courbot <[email protected]>
[acourbot: refactor, cleanup and split]
---
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
index 131a8117ece2..6b99b877a3b4 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
@@ -117,8 +117,9 @@ static struct vb2_buffer *get_display_buffer(struct mtk_vcodec_ctx *ctx)
if (dstbuf->used) {
vb2_set_plane_payload(&dstbuf->vb.vb2_buf, 0,
ctx->picinfo.fb_sz[0]);
- vb2_set_plane_payload(&dstbuf->vb.vb2_buf, 1,
- ctx->picinfo.fb_sz[1]);
+ if (ctx->q_data[MTK_Q_DATA_DST].fmt->num_planes == 2)
+ vb2_set_plane_payload(&dstbuf->vb.vb2_buf, 1,
+ ctx->picinfo.fb_sz[1]);
mtk_v4l2_debug(2,
"[%d]status=%x queue id=%d to done_list %d",
@@ -389,7 +390,8 @@ static void mtk_vdec_worker(struct work_struct *work)
vdec_if_decode(ctx, NULL, NULL, &res_chg);
clean_display_buffer(ctx);
vb2_set_plane_payload(&dst_buf_info->vb.vb2_buf, 0, 0);
- vb2_set_plane_payload(&dst_buf_info->vb.vb2_buf, 1, 0);
+ if (ctx->q_data[MTK_Q_DATA_DST].fmt->num_planes == 2)
+ vb2_set_plane_payload(&dst_buf_info->vb.vb2_buf, 1, 0);
dst_buf->flags |= V4L2_BUF_FLAG_LAST;
v4l2_m2m_buf_done(&dst_buf_info->vb, VB2_BUF_STATE_DONE);
clean_free_buffer(ctx);
@@ -1320,7 +1322,8 @@ static void vb2ops_vdec_stop_streaming(struct vb2_queue *q)
while ((dst_buf = v4l2_m2m_dst_buf_remove(ctx->m2m_ctx))) {
vb2_set_plane_payload(&dst_buf->vb2_buf, 0, 0);
- vb2_set_plane_payload(&dst_buf->vb2_buf, 1, 0);
+ if (ctx->q_data[MTK_Q_DATA_DST].fmt->num_planes == 2)
+ vb2_set_plane_payload(&dst_buf->vb2_buf, 1, 0);
v4l2_m2m_buf_done(dst_buf, VB2_BUF_STATE_ERROR);
}
--
2.22.0.rc1.311.g5d7573a151-goog
On 6/4/19 11:37 AM, Alexandre Courbot wrote:
> We were getting the codec interface through a proxy function that does
> not bring anything compared to just accessing the interface definition
> directly, so just do that. Also make the decoder interfaces const.
>
> Signed-off-by: Alexandre Courbot <[email protected]>
> ---
> .../media/platform/mtk-vcodec/vdec/vdec_h264_if.c | 9 +--------
> drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c | 9 +--------
> drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c | 9 +--------
> drivers/media/platform/mtk-vcodec/vdec_drv_if.c | 12 ++++++------
> .../media/platform/mtk-vcodec/venc/venc_h264_if.c | 9 +--------
> drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c | 9 +--------
> drivers/media/platform/mtk-vcodec/venc_drv_if.c | 8 ++++----
> 7 files changed, 15 insertions(+), 50 deletions(-)
>
> diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c
> index 0c0660d2560b..85afdd6ab093 100644
> --- a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c
> +++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c
> @@ -481,16 +481,9 @@ static int vdec_h264_get_param(void *h_vdec, enum vdec_get_param_type type,
> return 0;
> }
>
> -static struct vdec_common_if vdec_h264_if = {
> +const struct vdec_common_if vdec_h264_if = {
> .init = vdec_h264_init,
> .decode = vdec_h264_decode,
> .get_param = vdec_h264_get_param,
> .deinit = vdec_h264_deinit,
> };
> -
> -struct vdec_common_if *get_h264_dec_comm_if(void);
> -
> -struct vdec_common_if *get_h264_dec_comm_if(void)
> -{
> - return &vdec_h264_if;
> -}
> diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c
> index 1e3763881e0d..a8ca762eac76 100644
> --- a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c
> +++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c
> @@ -605,16 +605,9 @@ static void vdec_vp8_deinit(void *h_vdec)
> kfree(inst);
> }
>
> -static struct vdec_common_if vdec_vp8_if = {
> +const struct vdec_common_if vdec_vp8_if = {
> .init = vdec_vp8_init,
> .decode = vdec_vp8_decode,
> .get_param = vdec_vp8_get_param,
> .deinit = vdec_vp8_deinit,
> };
> -
> -struct vdec_common_if *get_vp8_dec_comm_if(void);
> -
> -struct vdec_common_if *get_vp8_dec_comm_if(void)
> -{
> - return &vdec_vp8_if;
> -}
> diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
> index 589b2fc91da2..1f99febdfbbe 100644
> --- a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
> +++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
> @@ -994,16 +994,9 @@ static int vdec_vp9_get_param(void *h_vdec, enum vdec_get_param_type type,
> return ret;
> }
>
> -static struct vdec_common_if vdec_vp9_if = {
> +const struct vdec_common_if vdec_vp9_if = {
> .init = vdec_vp9_init,
> .decode = vdec_vp9_decode,
> .get_param = vdec_vp9_get_param,
> .deinit = vdec_vp9_deinit,
> };
> -
> -struct vdec_common_if *get_vp9_dec_comm_if(void);
> -
> -struct vdec_common_if *get_vp9_dec_comm_if(void)
> -{
> - return &vdec_vp9_if;
> -}
> diff --git a/drivers/media/platform/mtk-vcodec/vdec_drv_if.c b/drivers/media/platform/mtk-vcodec/vdec_drv_if.c
> index 5d8d76d55005..aa614eea3cc5 100644
> --- a/drivers/media/platform/mtk-vcodec/vdec_drv_if.c
> +++ b/drivers/media/platform/mtk-vcodec/vdec_drv_if.c
> @@ -10,9 +10,9 @@
> #include "mtk_vcodec_dec_pm.h"
> #include "mtk_vpu.h"
>
> -const struct vdec_common_if *get_h264_dec_comm_if(void);
> -const struct vdec_common_if *get_vp8_dec_comm_if(void);
> -const struct vdec_common_if *get_vp9_dec_comm_if(void);
> +extern const struct vdec_common_if vdec_h264_if;
> +extern const struct vdec_common_if vdec_vp8_if;
> +extern const struct vdec_common_if vdec_vp9_if;
>
> int vdec_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)
> {
> @@ -20,13 +20,13 @@ int vdec_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)
>
> switch (fourcc) {
> case V4L2_PIX_FMT_H264:
> - ctx->dec_if = get_h264_dec_comm_if();
> + ctx->dec_if = &vdec_h264_if;
> break;
> case V4L2_PIX_FMT_VP8:
> - ctx->dec_if = get_vp8_dec_comm_if();
> + ctx->dec_if = &vdec_vp8_if;
> break;
> case V4L2_PIX_FMT_VP9:
> - ctx->dec_if = get_vp9_dec_comm_if();
> + ctx->dec_if = &vdec_vp9_if;
> break;
> default:
> return -EINVAL;
> diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
> index bfe61d5dc1cb..4e1d933395cd 100644
> --- a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
> +++ b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
> @@ -649,16 +649,9 @@ static int h264_enc_deinit(void *handle)
> return ret;
> }
>
> -static const struct venc_common_if venc_h264_if = {
> +const struct venc_common_if venc_h264_if = {
> .init = h264_enc_init,
> .encode = h264_enc_encode,
> .set_param = h264_enc_set_param,
> .deinit = h264_enc_deinit,
> };
> -
> -const struct venc_common_if *get_h264_enc_comm_if(void);
> -
> -const struct venc_common_if *get_h264_enc_comm_if(void)
> -{
> - return &venc_h264_if;
> -}
> diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
> index af23367cf1dd..2d1372ab6486 100644
> --- a/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
> +++ b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
> @@ -455,16 +455,9 @@ static int vp8_enc_deinit(void *handle)
> return ret;
> }
>
> -static const struct venc_common_if venc_vp8_if = {
> +const struct venc_common_if venc_vp8_if = {
> .init = vp8_enc_init,
> .encode = vp8_enc_encode,
> .set_param = vp8_enc_set_param,
> .deinit = vp8_enc_deinit,
> };
> -
> -const struct venc_common_if *get_vp8_enc_comm_if(void);
> -
> -const struct venc_common_if *get_vp8_enc_comm_if(void)
> -{
> - return &venc_vp8_if;
> -}
> diff --git a/drivers/media/platform/mtk-vcodec/venc_drv_if.c b/drivers/media/platform/mtk-vcodec/venc_drv_if.c
> index 318af1b4b6e7..cf5bfa296d20 100644
> --- a/drivers/media/platform/mtk-vcodec/venc_drv_if.c
> +++ b/drivers/media/platform/mtk-vcodec/venc_drv_if.c
> @@ -11,8 +11,8 @@
> #include "mtk_vcodec_enc_pm.h"
> #include "mtk_vpu.h"
>
> -const struct venc_common_if *get_h264_enc_comm_if(void);
> -const struct venc_common_if *get_vp8_enc_comm_if(void);
> +extern const struct venc_common_if venc_h264_if;
> +extern const struct venc_common_if venc_vp8_if;
This should be moved to a header. checkpatch gives me:
Applying: media: mtk-vcodec: remove unneeded proxy functions
WARNING: externs should be avoided in .c files
#79: FILE: drivers/media/platform/mtk-vcodec/vdec_drv_if.c:14:
+extern const struct vdec_common_if vdec_vp8_if;
WARNING: externs should be avoided in .c files
#80: FILE: drivers/media/platform/mtk-vcodec/vdec_drv_if.c:15:
+extern const struct vdec_common_if vdec_vp9_if;
WARNING: externs should be avoided in .c files
#156: FILE: drivers/media/platform/mtk-vcodec/venc_drv_if.c:15:
+extern const struct venc_common_if venc_vp8_if;
And I agree with checkpatch here.
I'll drop this patch from the series, but I'll take the others.
Regards,
Hans
>
> int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)
> {
> @@ -20,10 +20,10 @@ int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)
>
> switch (fourcc) {
> case V4L2_PIX_FMT_VP8:
> - ctx->enc_if = get_vp8_enc_comm_if();
> + ctx->enc_if = &venc_vp8_if;
> break;
> case V4L2_PIX_FMT_H264:
> - ctx->enc_if = get_h264_enc_comm_if();
> + ctx->enc_if = &venc_h264_if;
> break;
> default:
> return -EINVAL;
>
Em Tue, 4 Jun 2019 18:37:34 +0900
Alexandre Courbot <[email protected]> escreveu:
> The interface used to communicate with the firmware casts pointers
> into unsigned longs and back again in order to store private
> references, all of this for pointers that remain purely in the kernel.
> Replace these unsigned longs with void pointers to make the code a bit
> sturdier and easier to follow.
>
> Also simplify some interfaces by removing arguments that could be
> infered from others.
This generate lots of sparse warnings:
drivers/media/platform/mtk-vcodec/vdec_drv_if.c:64:32: warning: Using plain integer as NULL pointer
drivers/media/platform/mtk-vcodec/vdec_drv_if.c:87:32: warning: Using plain integer as NULL pointer
drivers/media/platform/mtk-vcodec/vdec_drv_if.c:99:32: warning: Using plain integer as NULL pointer
drivers/media/platform/mtk-vcodec/vdec_drv_if.c:108:27: warning: Using plain integer as NULL pointer
drivers/media/platform/mtk-vcodec/venc_drv_if.c:86:32: warning: Using plain integer as NULL pointer
drivers/media/platform/mtk-vcodec/venc_drv_if.c:95:27: warning: Using plain integer as NULL pointer
Please fix and re-submit.
Regards,
Mauro
>
> Signed-off-by: Alexandre Courbot <[email protected]>
> ---
> drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h | 2 +-
> .../media/platform/mtk-vcodec/vdec/vdec_h264_if.c | 12 ++++++------
> drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c | 12 ++++++------
> drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c | 12 ++++++------
> drivers/media/platform/mtk-vcodec/vdec_drv_base.h | 8 ++++----
> drivers/media/platform/mtk-vcodec/vdec_drv_if.c | 2 +-
> .../media/platform/mtk-vcodec/venc/venc_h264_if.c | 10 +++++-----
> drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c | 10 +++++-----
> drivers/media/platform/mtk-vcodec/venc_drv_base.h | 8 ++++----
> drivers/media/platform/mtk-vcodec/venc_drv_if.c | 2 +-
> 10 files changed, 39 insertions(+), 39 deletions(-)
>
> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> index d7b43caf7988..4b10996e6532 100644
> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> @@ -268,7 +268,7 @@ struct mtk_vcodec_ctx {
>
> const struct vdec_common_if *dec_if;
> const struct venc_common_if *enc_if;
> - unsigned long drv_handle;
> + void *drv_handle;
>
> struct vdec_pic_info picinfo;
> int dpb_size;
> diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c
> index d725ea54b1c1..0c0660d2560b 100644
> --- a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c
> +++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c
> @@ -262,7 +262,7 @@ static void get_dpb_size(struct vdec_h264_inst *inst, unsigned int *dpb_sz)
> mtk_vcodec_debug(inst, "sz=%d", *dpb_sz);
> }
>
> -static int vdec_h264_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
> +static int vdec_h264_init(struct mtk_vcodec_ctx *ctx)
> {
> struct vdec_h264_inst *inst = NULL;
> int err;
> @@ -291,7 +291,7 @@ static int vdec_h264_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
>
> mtk_vcodec_debug(inst, "H264 Instance >> %p", inst);
>
> - *h_vdec = (unsigned long)inst;
> + ctx->drv_handle = inst;
> return 0;
>
> error_deinit:
> @@ -302,7 +302,7 @@ static int vdec_h264_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
> return err;
> }
>
> -static void vdec_h264_deinit(unsigned long h_vdec)
> +static void vdec_h264_deinit(void *h_vdec)
> {
> struct vdec_h264_inst *inst = (struct vdec_h264_inst *)h_vdec;
>
> @@ -327,7 +327,7 @@ static int find_start_code(unsigned char *data, unsigned int data_sz)
> return -1;
> }
>
> -static int vdec_h264_decode(unsigned long h_vdec, struct mtk_vcodec_mem *bs,
> +static int vdec_h264_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
> struct vdec_fb *fb, bool *res_chg)
> {
> struct vdec_h264_inst *inst = (struct vdec_h264_inst *)h_vdec;
> @@ -447,8 +447,8 @@ static void vdec_h264_get_fb(struct vdec_h264_inst *inst,
> list->count--;
> }
>
> -static int vdec_h264_get_param(unsigned long h_vdec,
> - enum vdec_get_param_type type, void *out)
> +static int vdec_h264_get_param(void *h_vdec, enum vdec_get_param_type type,
> + void *out)
> {
> struct vdec_h264_inst *inst = (struct vdec_h264_inst *)h_vdec;
>
> diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c
> index 8de997875b6b..1e3763881e0d 100644
> --- a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c
> +++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c
> @@ -383,7 +383,7 @@ static void free_working_buf(struct vdec_vp8_inst *inst)
> inst->vsi->dec.working_buf_dma = 0;
> }
>
> -static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
> +static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx)
> {
> struct vdec_vp8_inst *inst;
> int err;
> @@ -414,7 +414,7 @@ static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
> get_hw_reg_base(inst);
> mtk_vcodec_debug(inst, "VP8 Instance >> %p", inst);
>
> - *h_vdec = (unsigned long)inst;
> + ctx->drv_handle = inst;
> return 0;
>
> error_deinit:
> @@ -424,7 +424,7 @@ static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
> return err;
> }
>
> -static int vdec_vp8_decode(unsigned long h_vdec, struct mtk_vcodec_mem *bs,
> +static int vdec_vp8_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
> struct vdec_fb *fb, bool *res_chg)
> {
> struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec;
> @@ -560,8 +560,8 @@ static void get_crop_info(struct vdec_vp8_inst *inst, struct v4l2_rect *cr)
> cr->left, cr->top, cr->width, cr->height);
> }
>
> -static int vdec_vp8_get_param(unsigned long h_vdec,
> - enum vdec_get_param_type type, void *out)
> +static int vdec_vp8_get_param(void *h_vdec, enum vdec_get_param_type type,
> + void *out)
> {
> struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec;
>
> @@ -594,7 +594,7 @@ static int vdec_vp8_get_param(unsigned long h_vdec,
> return 0;
> }
>
> -static void vdec_vp8_deinit(unsigned long h_vdec)
> +static void vdec_vp8_deinit(void *h_vdec)
> {
> struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec;
>
> diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
> index 02b65298c87e..589b2fc91da2 100644
> --- a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
> +++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
> @@ -751,7 +751,7 @@ static int validate_vsi_array_indexes(struct vdec_vp9_inst *inst,
> return 0;
> }
>
> -static void vdec_vp9_deinit(unsigned long h_vdec)
> +static void vdec_vp9_deinit(void *h_vdec)
> {
> struct vdec_vp9_inst *inst = (struct vdec_vp9_inst *)h_vdec;
> struct mtk_vcodec_mem *mem;
> @@ -773,7 +773,7 @@ static void vdec_vp9_deinit(unsigned long h_vdec)
> vp9_free_inst(inst);
> }
>
> -static int vdec_vp9_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
> +static int vdec_vp9_init(struct mtk_vcodec_ctx *ctx)
> {
> struct vdec_vp9_inst *inst;
>
> @@ -797,7 +797,7 @@ static int vdec_vp9_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
> inst->vsi = (struct vdec_vp9_vsi *)inst->vpu.vsi;
> init_all_fb_lists(inst);
>
> - (*h_vdec) = (unsigned long)inst;
> + ctx->drv_handle = inst;
> return 0;
>
> err_deinit_inst:
> @@ -806,7 +806,7 @@ static int vdec_vp9_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
> return -EINVAL;
> }
>
> -static int vdec_vp9_decode(unsigned long h_vdec, struct mtk_vcodec_mem *bs,
> +static int vdec_vp9_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
> struct vdec_fb *fb, bool *res_chg)
> {
> int ret = 0;
> @@ -963,8 +963,8 @@ static void get_crop_info(struct vdec_vp9_inst *inst, struct v4l2_rect *cr)
> cr->left, cr->top, cr->width, cr->height);
> }
>
> -static int vdec_vp9_get_param(unsigned long h_vdec,
> - enum vdec_get_param_type type, void *out)
> +static int vdec_vp9_get_param(void *h_vdec, enum vdec_get_param_type type,
> + void *out)
> {
> struct vdec_vp9_inst *inst = (struct vdec_vp9_inst *)h_vdec;
> int ret = 0;
> diff --git a/drivers/media/platform/mtk-vcodec/vdec_drv_base.h b/drivers/media/platform/mtk-vcodec/vdec_drv_base.h
> index 014712b1312e..4453f7de9f87 100644
> --- a/drivers/media/platform/mtk-vcodec/vdec_drv_base.h
> +++ b/drivers/media/platform/mtk-vcodec/vdec_drv_base.h
> @@ -13,7 +13,7 @@ struct vdec_common_if {
> * @ctx : [in] mtk v4l2 context
> * @h_vdec : [out] driver handle
> */
> - int (*init)(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec);
> + int (*init)(struct mtk_vcodec_ctx *ctx);
>
> /**
> * (*decode)() - trigger decode
> @@ -22,7 +22,7 @@ struct vdec_common_if {
> * @fb : [in] frame buffer to store decoded frame
> * @res_chg : [out] resolution change happen
> */
> - int (*decode)(unsigned long h_vdec, struct mtk_vcodec_mem *bs,
> + int (*decode)(void *h_vdec, struct mtk_vcodec_mem *bs,
> struct vdec_fb *fb, bool *res_chg);
>
> /**
> @@ -31,14 +31,14 @@ struct vdec_common_if {
> * @type : [in] input parameter type
> * @out : [out] buffer to store query result
> */
> - int (*get_param)(unsigned long h_vdec, enum vdec_get_param_type type,
> + int (*get_param)(void *h_vdec, enum vdec_get_param_type type,
> void *out);
>
> /**
> * (*deinit)() - deinitialize driver.
> * @h_vdec : [in] driver handle to be deinit
> */
> - void (*deinit)(unsigned long h_vdec);
> + void (*deinit)(void *h_vdec);
> };
>
> #endif
> diff --git a/drivers/media/platform/mtk-vcodec/vdec_drv_if.c b/drivers/media/platform/mtk-vcodec/vdec_drv_if.c
> index 6835cb7d090a..5d8d76d55005 100644
> --- a/drivers/media/platform/mtk-vcodec/vdec_drv_if.c
> +++ b/drivers/media/platform/mtk-vcodec/vdec_drv_if.c
> @@ -34,7 +34,7 @@ int vdec_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)
>
> mtk_vdec_lock(ctx);
> mtk_vcodec_dec_clock_on(&ctx->dev->pm);
> - ret = ctx->dec_if->init(ctx, &ctx->drv_handle);
> + ret = ctx->dec_if->init(ctx);
> mtk_vcodec_dec_clock_off(&ctx->dev->pm);
> mtk_vdec_unlock(ctx);
>
> diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
> index 0cf08dd7b6e3..bfe61d5dc1cb 100644
> --- a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
> +++ b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
> @@ -452,7 +452,7 @@ static void h264_encode_filler(struct venc_h264_inst *inst, void *buf,
> memset(p, 0xff, size);
> }
>
> -static int h264_enc_init(struct mtk_vcodec_ctx *ctx, unsigned long *handle)
> +static int h264_enc_init(struct mtk_vcodec_ctx *ctx)
> {
> int ret = 0;
> struct venc_h264_inst *inst;
> @@ -478,12 +478,12 @@ static int h264_enc_init(struct mtk_vcodec_ctx *ctx, unsigned long *handle)
> if (ret)
> kfree(inst);
> else
> - (*handle) = (unsigned long)inst;
> + ctx->drv_handle = inst;
>
> return ret;
> }
>
> -static int h264_enc_encode(unsigned long handle,
> +static int h264_enc_encode(void *handle,
> enum venc_start_opt opt,
> struct venc_frm_buf *frm_buf,
> struct mtk_vcodec_mem *bs_buf,
> @@ -578,7 +578,7 @@ static int h264_enc_encode(unsigned long handle,
> return ret;
> }
>
> -static int h264_enc_set_param(unsigned long handle,
> +static int h264_enc_set_param(void *handle,
> enum venc_set_param_type type,
> struct venc_enc_param *enc_prm)
> {
> @@ -631,7 +631,7 @@ static int h264_enc_set_param(unsigned long handle,
> return ret;
> }
>
> -static int h264_enc_deinit(unsigned long handle)
> +static int h264_enc_deinit(void *handle)
> {
> int ret = 0;
> struct venc_h264_inst *inst = (struct venc_h264_inst *)handle;
> diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
> index 3fb9e0c79b4f..af23367cf1dd 100644
> --- a/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
> +++ b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
> @@ -318,7 +318,7 @@ static int vp8_enc_encode_frame(struct venc_vp8_inst *inst,
> return ret;
> }
>
> -static int vp8_enc_init(struct mtk_vcodec_ctx *ctx, unsigned long *handle)
> +static int vp8_enc_init(struct mtk_vcodec_ctx *ctx)
> {
> int ret = 0;
> struct venc_vp8_inst *inst;
> @@ -344,12 +344,12 @@ static int vp8_enc_init(struct mtk_vcodec_ctx *ctx, unsigned long *handle)
> if (ret)
> kfree(inst);
> else
> - (*handle) = (unsigned long)inst;
> + ctx->drv_handle = inst;
>
> return ret;
> }
>
> -static int vp8_enc_encode(unsigned long handle,
> +static int vp8_enc_encode(void *handle,
> enum venc_start_opt opt,
> struct venc_frm_buf *frm_buf,
> struct mtk_vcodec_mem *bs_buf,
> @@ -386,7 +386,7 @@ static int vp8_enc_encode(unsigned long handle,
> return ret;
> }
>
> -static int vp8_enc_set_param(unsigned long handle,
> +static int vp8_enc_set_param(void *handle,
> enum venc_set_param_type type,
> struct venc_enc_param *enc_prm)
> {
> @@ -437,7 +437,7 @@ static int vp8_enc_set_param(unsigned long handle,
> return ret;
> }
>
> -static int vp8_enc_deinit(unsigned long handle)
> +static int vp8_enc_deinit(void *handle)
> {
> int ret = 0;
> struct venc_vp8_inst *inst = (struct venc_vp8_inst *)handle;
> diff --git a/drivers/media/platform/mtk-vcodec/venc_drv_base.h b/drivers/media/platform/mtk-vcodec/venc_drv_base.h
> index 2de37b47fe73..be368fcb01e6 100644
> --- a/drivers/media/platform/mtk-vcodec/venc_drv_base.h
> +++ b/drivers/media/platform/mtk-vcodec/venc_drv_base.h
> @@ -13,7 +13,7 @@ struct venc_common_if {
> * @ctx: [in] mtk v4l2 context
> * @handle: [out] driver handle
> */
> - int (*init)(struct mtk_vcodec_ctx *ctx, unsigned long *handle);
> + int (*init)(struct mtk_vcodec_ctx *ctx);
>
> /**
> * (*encode)() - trigger encode
> @@ -23,7 +23,7 @@ struct venc_common_if {
> * @bs_buf: [in] bitstream buffer to store output bitstream
> * @result: [out] encode result
> */
> - int (*encode)(unsigned long handle, enum venc_start_opt opt,
> + int (*encode)(void *handle, enum venc_start_opt opt,
> struct venc_frm_buf *frm_buf,
> struct mtk_vcodec_mem *bs_buf,
> struct venc_done_result *result);
> @@ -34,14 +34,14 @@ struct venc_common_if {
> * @type: [in] parameter type
> * @in: [in] buffer to store the parameter
> */
> - int (*set_param)(unsigned long handle, enum venc_set_param_type type,
> + int (*set_param)(void *handle, enum venc_set_param_type type,
> struct venc_enc_param *in);
>
> /**
> * (*deinit)() - deinitialize driver.
> * @handle: [in] driver handle
> */
> - int (*deinit)(unsigned long handle);
> + int (*deinit)(void *handle);
> };
>
> #endif
> diff --git a/drivers/media/platform/mtk-vcodec/venc_drv_if.c b/drivers/media/platform/mtk-vcodec/venc_drv_if.c
> index 25c1e100f5a1..318af1b4b6e7 100644
> --- a/drivers/media/platform/mtk-vcodec/venc_drv_if.c
> +++ b/drivers/media/platform/mtk-vcodec/venc_drv_if.c
> @@ -31,7 +31,7 @@ int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)
>
> mtk_venc_lock(ctx);
> mtk_vcodec_enc_clock_on(&ctx->dev->pm);
> - ret = ctx->enc_if->init(ctx, (unsigned long *)&ctx->drv_handle);
> + ret = ctx->enc_if->init(ctx);
> mtk_vcodec_enc_clock_off(&ctx->dev->pm);
> mtk_venc_unlock(ctx);
>
Thanks,
Mauro