[media] s5p-fimc: Allow probe() to succeed with null platform data
The "s5p-fimc-md" platform device platform_data is used to pass attached camera sensor data. Not allowing device probe() to succeed when it's null prevents using FIMC as a mem-to-mem device only. Fix this by removing the platform_data check against null and registering sensors only if platform_data is specified. Also add logging of the information which /dev/video is assigned to which device during probe(). Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
2c1bb62e21
commit
5cbf6f16ec
1 changed files with 21 additions and 14 deletions
|
@ -385,20 +385,28 @@ static void fimc_md_unregister_entities(struct fimc_md *fmd)
|
||||||
|
|
||||||
static int fimc_md_register_video_nodes(struct fimc_md *fmd)
|
static int fimc_md_register_video_nodes(struct fimc_md *fmd)
|
||||||
{
|
{
|
||||||
|
struct video_device *vdev;
|
||||||
int i, ret = 0;
|
int i, ret = 0;
|
||||||
|
|
||||||
for (i = 0; i < FIMC_MAX_DEVS && !ret; i++) {
|
for (i = 0; i < FIMC_MAX_DEVS && !ret; i++) {
|
||||||
if (!fmd->fimc[i])
|
if (!fmd->fimc[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (fmd->fimc[i]->m2m.vfd)
|
vdev = fmd->fimc[i]->m2m.vfd;
|
||||||
ret = video_register_device(fmd->fimc[i]->m2m.vfd,
|
if (vdev) {
|
||||||
VFL_TYPE_GRABBER, -1);
|
ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1);
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
if (fmd->fimc[i]->vid_cap.vfd)
|
v4l2_info(&fmd->v4l2_dev, "Registered %s as /dev/%s\n",
|
||||||
ret = video_register_device(fmd->fimc[i]->vid_cap.vfd,
|
vdev->name, video_device_node_name(vdev));
|
||||||
VFL_TYPE_GRABBER, -1);
|
}
|
||||||
|
|
||||||
|
vdev = fmd->fimc[i]->vid_cap.vfd;
|
||||||
|
if (vdev == NULL)
|
||||||
|
continue;
|
||||||
|
ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1);
|
||||||
|
v4l2_info(&fmd->v4l2_dev, "Registered %s as /dev/%s\n",
|
||||||
|
vdev->name, video_device_node_name(vdev));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -746,9 +754,6 @@ static int __devinit fimc_md_probe(struct platform_device *pdev)
|
||||||
struct fimc_md *fmd;
|
struct fimc_md *fmd;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (WARN(!pdev->dev.platform_data, "Platform data not specified!\n"))
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
fmd = kzalloc(sizeof(struct fimc_md), GFP_KERNEL);
|
fmd = kzalloc(sizeof(struct fimc_md), GFP_KERNEL);
|
||||||
if (!fmd)
|
if (!fmd)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -786,9 +791,11 @@ static int __devinit fimc_md_probe(struct platform_device *pdev)
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err3;
|
goto err3;
|
||||||
|
|
||||||
ret = fimc_md_register_sensor_entities(fmd);
|
if (pdev->dev.platform_data) {
|
||||||
if (ret)
|
ret = fimc_md_register_sensor_entities(fmd);
|
||||||
goto err3;
|
if (ret)
|
||||||
|
goto err3;
|
||||||
|
}
|
||||||
ret = fimc_md_create_links(fmd);
|
ret = fimc_md_create_links(fmd);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err3;
|
goto err3;
|
||||||
|
|
Loading…
Add table
Reference in a new issue