diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/sh_mobile_ceu_camera.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index a3153ca14089..f390682629cf 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c | |||
@@ -566,16 +566,24 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd) | |||
566 | ret = sh_mobile_ceu_soft_reset(pcdev); | 566 | ret = sh_mobile_ceu_soft_reset(pcdev); |
567 | 567 | ||
568 | csi2_sd = find_csi2(pcdev); | 568 | csi2_sd = find_csi2(pcdev); |
569 | if (csi2_sd) | ||
570 | csi2_sd->grp_id = (long)icd; | ||
569 | 571 | ||
570 | ret = v4l2_subdev_call(csi2_sd, core, s_power, 1); | 572 | ret = v4l2_subdev_call(csi2_sd, core, s_power, 1); |
571 | if (ret != -ENODEV && ret != -ENOIOCTLCMD && ret < 0) { | 573 | if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV) { |
572 | pm_runtime_put_sync(ici->v4l2_dev.dev); | 574 | pm_runtime_put_sync(ici->v4l2_dev.dev); |
573 | } else { | 575 | return ret; |
574 | pcdev->icd = icd; | ||
575 | ret = 0; | ||
576 | } | 576 | } |
577 | 577 | ||
578 | return ret; | 578 | /* |
579 | * -ENODEV is special: either csi2_sd == NULL or the CSI-2 driver | ||
580 | * has not found this soc-camera device among its clients | ||
581 | */ | ||
582 | if (ret == -ENODEV && csi2_sd) | ||
583 | csi2_sd->grp_id = 0; | ||
584 | pcdev->icd = icd; | ||
585 | |||
586 | return 0; | ||
579 | } | 587 | } |
580 | 588 | ||
581 | /* Called with .video_lock held */ | 589 | /* Called with .video_lock held */ |
@@ -588,6 +596,8 @@ static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd) | |||
588 | BUG_ON(icd != pcdev->icd); | 596 | BUG_ON(icd != pcdev->icd); |
589 | 597 | ||
590 | v4l2_subdev_call(csi2_sd, core, s_power, 0); | 598 | v4l2_subdev_call(csi2_sd, core, s_power, 0); |
599 | if (csi2_sd) | ||
600 | csi2_sd->grp_id = 0; | ||
591 | /* disable capture, disable interrupts */ | 601 | /* disable capture, disable interrupts */ |
592 | ceu_write(pcdev, CEIER, 0); | 602 | ceu_write(pcdev, CEIER, 0); |
593 | sh_mobile_ceu_soft_reset(pcdev); | 603 | sh_mobile_ceu_soft_reset(pcdev); |