aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/soc_camera.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2012-03-14 06:22:07 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-03-19 21:11:05 -0400
commit7705b6d8eac89067e5177835468c99e71e2cd40c (patch)
tree2bedd0b37c847458ea13e9abbad7e7f662e5cf1c /drivers/media/video/soc_camera.c
parent5da6e984805786c4d96498e1c51e971007dea6dc (diff)
[media] V4L: soc-camera: call soc_camera_power_on() after adding the client to the host
soc_camera_power_on() calls client's .s_power(1) method, which can try to access the client hardware. This, however, is typically only possible, after calling host's .add() method, because that's where the host driver usually turns the master clock on. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/soc_camera.c')
-rw-r--r--drivers/media/video/soc_camera.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index b82710745ba8..eb25756a07af 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -526,10 +526,6 @@ static int soc_camera_open(struct file *file)
526 }, 526 },
527 }; 527 };
528 528
529 ret = soc_camera_power_on(icd, icl);
530 if (ret < 0)
531 goto epower;
532
533 /* The camera could have been already on, try to reset */ 529 /* The camera could have been already on, try to reset */
534 if (icl->reset) 530 if (icl->reset)
535 icl->reset(icd->pdev); 531 icl->reset(icd->pdev);
@@ -540,6 +536,10 @@ static int soc_camera_open(struct file *file)
540 goto eiciadd; 536 goto eiciadd;
541 } 537 }
542 538
539 ret = soc_camera_power_on(icd, icl);
540 if (ret < 0)
541 goto epower;
542
543 pm_runtime_enable(&icd->vdev->dev); 543 pm_runtime_enable(&icd->vdev->dev);
544 ret = pm_runtime_resume(&icd->vdev->dev); 544 ret = pm_runtime_resume(&icd->vdev->dev);
545 if (ret < 0 && ret != -ENOSYS) 545 if (ret < 0 && ret != -ENOSYS)
@@ -578,10 +578,10 @@ einitvb:
578esfmt: 578esfmt:
579 pm_runtime_disable(&icd->vdev->dev); 579 pm_runtime_disable(&icd->vdev->dev);
580eresume: 580eresume:
581 ici->ops->remove(icd);
582eiciadd:
583 soc_camera_power_off(icd, icl); 581 soc_camera_power_off(icd, icl);
584epower: 582epower:
583 ici->ops->remove(icd);
584eiciadd:
585 icd->use_count--; 585 icd->use_count--;
586 module_put(ici->ops->owner); 586 module_put(ici->ops->owner);
587 587
@@ -1050,6 +1050,14 @@ static int soc_camera_probe(struct soc_camera_device *icd)
1050 if (ret < 0) 1050 if (ret < 0)
1051 goto ereg; 1051 goto ereg;
1052 1052
1053 /* The camera could have been already on, try to reset */
1054 if (icl->reset)
1055 icl->reset(icd->pdev);
1056
1057 ret = ici->ops->add(icd);
1058 if (ret < 0)
1059 goto eadd;
1060
1053 /* 1061 /*
1054 * This will not yet call v4l2_subdev_core_ops::s_power(1), because the 1062 * This will not yet call v4l2_subdev_core_ops::s_power(1), because the
1055 * subdevice has not been initialised yet. We'll have to call it once 1063 * subdevice has not been initialised yet. We'll have to call it once
@@ -1060,14 +1068,6 @@ static int soc_camera_probe(struct soc_camera_device *icd)
1060 if (ret < 0) 1068 if (ret < 0)
1061 goto epower; 1069 goto epower;
1062 1070
1063 /* The camera could have been already on, try to reset */
1064 if (icl->reset)
1065 icl->reset(icd->pdev);
1066
1067 ret = ici->ops->add(icd);
1068 if (ret < 0)
1069 goto eadd;
1070
1071 /* Must have icd->vdev before registering the device */ 1071 /* Must have icd->vdev before registering the device */
1072 ret = video_dev_create(icd); 1072 ret = video_dev_create(icd);
1073 if (ret < 0) 1073 if (ret < 0)
@@ -1165,10 +1165,10 @@ eadddev:
1165 video_device_release(icd->vdev); 1165 video_device_release(icd->vdev);
1166 icd->vdev = NULL; 1166 icd->vdev = NULL;
1167evdc: 1167evdc:
1168 ici->ops->remove(icd);
1169eadd:
1170 soc_camera_power_off(icd, icl); 1168 soc_camera_power_off(icd, icl);
1171epower: 1169epower:
1170 ici->ops->remove(icd);
1171eadd:
1172 regulator_bulk_free(icl->num_regulators, icl->regulators); 1172 regulator_bulk_free(icl->num_regulators, icl->regulators);
1173ereg: 1173ereg:
1174 v4l2_ctrl_handler_free(&icd->ctrl_handler); 1174 v4l2_ctrl_handler_free(&icd->ctrl_handler);