|
@@ -1831,11 +1831,6 @@ static int vpe_open(struct file *file)
|
|
|
|
|
|
vpe_dbg(dev, "vpe_open\n");
|
|
|
|
|
|
- if (!dev->vpdma->ready) {
|
|
|
- vpe_err(dev, "vpdma firmware not loaded\n");
|
|
|
- return -ENODEV;
|
|
|
- }
|
|
|
-
|
|
|
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
|
|
|
if (!ctx)
|
|
|
return -ENOMEM;
|
|
@@ -2055,10 +2050,40 @@ static void vpe_runtime_put(struct platform_device *pdev)
|
|
|
WARN_ON(r < 0 && r != -ENOSYS);
|
|
|
}
|
|
|
|
|
|
+static void vpe_fw_cb(struct platform_device *pdev)
|
|
|
+{
|
|
|
+ struct vpe_dev *dev = platform_get_drvdata(pdev);
|
|
|
+ struct video_device *vfd;
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ vfd = &dev->vfd;
|
|
|
+ *vfd = vpe_videodev;
|
|
|
+ vfd->lock = &dev->dev_mutex;
|
|
|
+ vfd->v4l2_dev = &dev->v4l2_dev;
|
|
|
+
|
|
|
+ ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0);
|
|
|
+ if (ret) {
|
|
|
+ vpe_err(dev, "Failed to register video device\n");
|
|
|
+
|
|
|
+ vpe_set_clock_enable(dev, 0);
|
|
|
+ vpe_runtime_put(pdev);
|
|
|
+ pm_runtime_disable(&pdev->dev);
|
|
|
+ v4l2_m2m_release(dev->m2m_dev);
|
|
|
+ vb2_dma_contig_cleanup_ctx(dev->alloc_ctx);
|
|
|
+ v4l2_device_unregister(&dev->v4l2_dev);
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ video_set_drvdata(vfd, dev);
|
|
|
+ snprintf(vfd->name, sizeof(vfd->name), "%s", vpe_videodev.name);
|
|
|
+ dev_info(dev->v4l2_dev.dev, "Device registered as /dev/video%d\n",
|
|
|
+ vfd->num);
|
|
|
+}
|
|
|
+
|
|
|
static int vpe_probe(struct platform_device *pdev)
|
|
|
{
|
|
|
struct vpe_dev *dev;
|
|
|
- struct video_device *vfd;
|
|
|
int ret, irq, func;
|
|
|
|
|
|
dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
|
|
@@ -2139,28 +2164,12 @@ static int vpe_probe(struct platform_device *pdev)
|
|
|
goto runtime_put;
|
|
|
}
|
|
|
|
|
|
- dev->vpdma = vpdma_create(pdev);
|
|
|
+ dev->vpdma = vpdma_create(pdev, vpe_fw_cb);
|
|
|
if (IS_ERR(dev->vpdma)) {
|
|
|
ret = PTR_ERR(dev->vpdma);
|
|
|
goto runtime_put;
|
|
|
}
|
|
|
|
|
|
- vfd = &dev->vfd;
|
|
|
- *vfd = vpe_videodev;
|
|
|
- vfd->lock = &dev->dev_mutex;
|
|
|
- vfd->v4l2_dev = &dev->v4l2_dev;
|
|
|
-
|
|
|
- ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0);
|
|
|
- if (ret) {
|
|
|
- vpe_err(dev, "Failed to register video device\n");
|
|
|
- goto runtime_put;
|
|
|
- }
|
|
|
-
|
|
|
- video_set_drvdata(vfd, dev);
|
|
|
- snprintf(vfd->name, sizeof(vfd->name), "%s", vpe_videodev.name);
|
|
|
- dev_info(dev->v4l2_dev.dev, "Device registered as /dev/video%d\n",
|
|
|
- vfd->num);
|
|
|
-
|
|
|
return 0;
|
|
|
|
|
|
runtime_put:
|