mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
media: iris: Add support for video encoder device
Add support for registering a V4L2 encoder video device to the iris driver. The encoder device is registered with the name "qcom-iris-encoder". Tested-by: Vikash Garodia <quic_vgarodia@quicinc.com> # X1E80100 Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Vikash Garodia <quic_vgarodia@quicinc.com> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-HDK Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com> Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # x1e80100-crd Signed-off-by: Bryan O'Donoghue <bod@kernel.org> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
parent
2dbd2645c0
commit
787c535a9f
|
|
@ -25,6 +25,11 @@ struct icc_info {
|
|||
#define IRIS_FW_VERSION_LENGTH 128
|
||||
#define IFACEQ_CORE_PKT_SIZE (1024 * 4)
|
||||
|
||||
enum domain_type {
|
||||
ENCODER = BIT(0),
|
||||
DECODER = BIT(1),
|
||||
};
|
||||
|
||||
/**
|
||||
* struct iris_core - holds core parameters valid for all instances
|
||||
*
|
||||
|
|
@ -33,6 +38,7 @@ struct icc_info {
|
|||
* @irq: iris irq
|
||||
* @v4l2_dev: a holder for v4l2 device structure
|
||||
* @vdev_dec: iris video device structure for decoder
|
||||
* @vdev_enc: iris video device structure for encoder
|
||||
* @iris_v4l2_file_ops: iris v4l2 file ops
|
||||
* @iris_v4l2_ioctl_ops: iris v4l2 ioctl ops
|
||||
* @iris_vb2_ops: iris vb2 ops
|
||||
|
|
@ -73,6 +79,7 @@ struct iris_core {
|
|||
int irq;
|
||||
struct v4l2_device v4l2_dev;
|
||||
struct video_device *vdev_dec;
|
||||
struct video_device *vdev_enc;
|
||||
const struct v4l2_file_operations *iris_v4l2_file_ops;
|
||||
const struct v4l2_ioctl_ops *iris_v4l2_ioctl_ops;
|
||||
const struct vb2_ops *iris_vb2_ops;
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ static int iris_init_resources(struct iris_core *core)
|
|||
return iris_init_resets(core);
|
||||
}
|
||||
|
||||
static int iris_register_video_device(struct iris_core *core)
|
||||
static int iris_register_video_device(struct iris_core *core, enum domain_type type)
|
||||
{
|
||||
struct video_device *vdev;
|
||||
int ret;
|
||||
|
|
@ -155,7 +155,6 @@ static int iris_register_video_device(struct iris_core *core)
|
|||
if (!vdev)
|
||||
return -ENOMEM;
|
||||
|
||||
strscpy(vdev->name, "qcom-iris-decoder", sizeof(vdev->name));
|
||||
vdev->release = video_device_release;
|
||||
vdev->fops = core->iris_v4l2_file_ops;
|
||||
vdev->ioctl_ops = core->iris_v4l2_ioctl_ops;
|
||||
|
|
@ -163,11 +162,21 @@ static int iris_register_video_device(struct iris_core *core)
|
|||
vdev->v4l2_dev = &core->v4l2_dev;
|
||||
vdev->device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
|
||||
|
||||
if (type == DECODER) {
|
||||
strscpy(vdev->name, "qcom-iris-decoder", sizeof(vdev->name));
|
||||
core->vdev_dec = vdev;
|
||||
} else if (type == ENCODER) {
|
||||
strscpy(vdev->name, "qcom-iris-encoder", sizeof(vdev->name));
|
||||
core->vdev_enc = vdev;
|
||||
} else {
|
||||
ret = -EINVAL;
|
||||
goto err_vdev_release;
|
||||
}
|
||||
|
||||
ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
|
||||
if (ret)
|
||||
goto err_vdev_release;
|
||||
|
||||
core->vdev_dec = vdev;
|
||||
video_set_drvdata(vdev, core);
|
||||
|
||||
return 0;
|
||||
|
|
@ -189,6 +198,7 @@ static void iris_remove(struct platform_device *pdev)
|
|||
iris_core_deinit(core);
|
||||
|
||||
video_unregister_device(core->vdev_dec);
|
||||
video_unregister_device(core->vdev_enc);
|
||||
|
||||
v4l2_device_unregister(&core->v4l2_dev);
|
||||
|
||||
|
|
@ -258,17 +268,21 @@ static int iris_probe(struct platform_device *pdev)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = iris_register_video_device(core);
|
||||
ret = iris_register_video_device(core, DECODER);
|
||||
if (ret)
|
||||
goto err_v4l2_unreg;
|
||||
|
||||
ret = iris_register_video_device(core, ENCODER);
|
||||
if (ret)
|
||||
goto err_vdev_unreg_dec;
|
||||
|
||||
platform_set_drvdata(pdev, core);
|
||||
|
||||
dma_mask = core->iris_platform_data->dma_mask;
|
||||
|
||||
ret = dma_set_mask_and_coherent(dev, dma_mask);
|
||||
if (ret)
|
||||
goto err_vdev_unreg;
|
||||
goto err_vdev_unreg_enc;
|
||||
|
||||
dma_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32));
|
||||
dma_set_seg_boundary(&pdev->dev, DMA_BIT_MASK(32));
|
||||
|
|
@ -277,11 +291,13 @@ static int iris_probe(struct platform_device *pdev)
|
|||
pm_runtime_use_autosuspend(core->dev);
|
||||
ret = devm_pm_runtime_enable(core->dev);
|
||||
if (ret)
|
||||
goto err_vdev_unreg;
|
||||
goto err_vdev_unreg_enc;
|
||||
|
||||
return 0;
|
||||
|
||||
err_vdev_unreg:
|
||||
err_vdev_unreg_enc:
|
||||
video_unregister_device(core->vdev_enc);
|
||||
err_vdev_unreg_dec:
|
||||
video_unregister_device(core->vdev_dec);
|
||||
err_v4l2_unreg:
|
||||
v4l2_device_unregister(&core->v4l2_dev);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user