Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions drivers/media/platform/raspberrypi/hevc_dec/Kconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# SPDX-License-Identifier: GPL-2.0

config VIDEO_RPI_HEVC_DEC
tristate "Rasperry Pi HEVC decoder"
depends on VIDEO_DEV && VIDEO_DEV
tristate "Raspberry Pi HEVC decoder"
depends on VIDEO_DEV
depends on OF
select MEDIA_CONTROLLER
select MEDIA_CONTROLLER_REQUEST_API
Expand Down
24 changes: 13 additions & 11 deletions drivers/media/platform/raspberrypi/hevc_dec/hevc_d.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static const struct v4l2_ctrl_config hevc_d_ctrls[] = {
}, {
.name = "Slice param array",
.id = V4L2_CID_STATELESS_HEVC_SLICE_PARAMS,
.ops = &hevc_d_hevc_slice_params_ctrl_ops,
.type = V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS,
.flags = V4L2_CTRL_FLAG_DYNAMIC_ARRAY,
.dims = { 600 },
Expand All @@ -78,7 +79,6 @@ void *hevc_d_find_control_data(struct hevc_d_ctx *ctx, u32 id)
static int hevc_d_init_ctrls(struct hevc_d_dev *dev, struct hevc_d_ctx *ctx)
{
struct v4l2_ctrl_handler *hdl = &ctx->hdl;
struct v4l2_ctrl *ctrl;
unsigned int i;

v4l2_ctrl_handler_init(hdl, ARRAY_SIZE(hevc_d_ctrls));
Expand All @@ -89,7 +89,7 @@ static int hevc_d_init_ctrls(struct hevc_d_dev *dev, struct hevc_d_ctx *ctx)
}

for (i = 0; i < ARRAY_SIZE(hevc_d_ctrls); i++) {
ctrl = v4l2_ctrl_new_custom(hdl, &hevc_d_ctrls[i], ctx);
v4l2_ctrl_new_custom(hdl, &hevc_d_ctrls[i], ctx);
if (hdl->error) {
v4l2_err(&dev->v4l2_dev,
"Failed to create new custom control id=%#x\n",
Expand Down Expand Up @@ -154,16 +154,13 @@ static int hevc_d_release(struct file *file)
struct hevc_d_ctx *ctx = container_of(file->private_data,
struct hevc_d_ctx, fh);

v4l2_fh_del(&ctx->fh, file);

v4l2_ctrl_handler_free(&ctx->hdl);

v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);

v4l2_fh_del(&ctx->fh, file);
v4l2_fh_exit(&ctx->fh);
v4l2_ctrl_handler_free(&ctx->hdl);
mutex_destroy(&ctx->ctx_mutex);

kfree(ctx);

return 0;
}

Expand Down Expand Up @@ -221,14 +218,14 @@ static int hevc_d_probe(struct platform_device *pdev)
return ret;
}

mutex_init(&dev->dev_mutex);

ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev);
if (ret) {
dev_err_probe(&pdev->dev, ret, "Failed to register V4L2 device\n");
return ret;
goto err_hw;
}

mutex_init(&dev->dev_mutex);

vfd = &dev->vfd;
vfd->lock = &dev->dev_mutex;
vfd->v4l2_dev = &dev->v4l2_dev;
Expand Down Expand Up @@ -293,9 +290,13 @@ static int hevc_d_probe(struct platform_device *pdev)
err_video:
video_unregister_device(&dev->vfd);
err_m2m:
media_device_cleanup(&dev->mdev);
v4l2_m2m_release(dev->m2m_dev);
err_v4l2:
mutex_destroy(&dev->dev_mutex);
Comment thread
6by9 marked this conversation as resolved.
v4l2_device_unregister(&dev->v4l2_dev);
err_hw:
hevc_d_hw_remove(dev);

return ret;
}
Expand All @@ -310,6 +311,7 @@ static void hevc_d_remove(struct platform_device *pdev)

v4l2_m2m_release(dev->m2m_dev);
video_unregister_device(&dev->vfd);
mutex_destroy(&dev->dev_mutex);
Comment thread
6by9 marked this conversation as resolved.
v4l2_device_unregister(&dev->v4l2_dev);

hevc_d_hw_remove(dev);
Expand Down
4 changes: 3 additions & 1 deletion drivers/media/platform/raspberrypi/hevc_dec/hevc_d.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ struct hevc_d_ctx {
unsigned int p2idx;
struct hevc_d_hwbuf pu_bufs[HEVC_D_P2BUF_COUNT];
struct hevc_d_hwbuf coeff_bufs[HEVC_D_P2BUF_COUNT];
/* Last sizes we expanded to */
size_t pu_size_max;
size_t coeff_size_max;

/* Aux structures only used in setup so no locking needed */
struct hevc_d_q_aux *aux_free;
Expand Down Expand Up @@ -194,7 +197,6 @@ extern int hevc_d_v4l2_debug;
#define hevc_d_dbg(level, dev, fmt, arg...)\
v4l2_dbg((level), hevc_d_v4l2_debug, (dev), fmt, ## arg)

struct v4l2_ctrl *hevc_d_find_ctrl(struct hevc_d_ctx *ctx, u32 id);
void *hevc_d_find_control_data(struct hevc_d_ctx *ctx, u32 id);

#endif
Loading