aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-07-18 09:54:02 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-15 15:54:53 -0400
commit24592adce89805c99eb23d1e37aa8a66aaacee05 (patch)
treebf178d38e2c0581a605f58a07ddb9f1c2faf5452 /drivers/media
parent37ad4e734bbc27ad1bec2d1cc3ffaa79b1def262 (diff)
[media] soc-camera: Continue the power off sequence if one of the steps fails
Powering off a device is a "best effort" task: failure to execute one of the steps should not prevent the next steps to be executed. For instance, an I2C communication error when putting the chip in stand-by mode should not prevent the more agressive next step of turning the chip's power supply off. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/soc_camera.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/media/platform/soc_camera.c b/drivers/media/platform/soc_camera.c
index a6d484f38a8..3feb43b4f28 100644
--- a/drivers/media/platform/soc_camera.c
+++ b/drivers/media/platform/soc_camera.c
@@ -89,24 +89,30 @@ static int soc_camera_power_off(struct soc_camera_device *icd,
89 struct soc_camera_link *icl) 89 struct soc_camera_link *icl)
90{ 90{
91 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 91 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
92 int ret = v4l2_subdev_call(sd, core, s_power, 0); 92 int ret = 0;
93 int err;
93 94
94 if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV) 95 err = v4l2_subdev_call(sd, core, s_power, 0);
95 return ret; 96 if (err < 0 && err != -ENOIOCTLCMD && err != -ENODEV) {
97 dev_err(icd->pdev, "Subdev failed to power-off the camera.\n");
98 ret = err;
99 }
96 100
97 if (icl->power) { 101 if (icl->power) {
98 ret = icl->power(icd->control, 0); 102 err = icl->power(icd->control, 0);
99 if (ret < 0) { 103 if (err < 0) {
100 dev_err(icd->pdev, 104 dev_err(icd->pdev,
101 "Platform failed to power-off the camera.\n"); 105 "Platform failed to power-off the camera.\n");
102 return ret; 106 ret = ret ? : err;
103 } 107 }
104 } 108 }
105 109
106 ret = regulator_bulk_disable(icl->num_regulators, 110 err = regulator_bulk_disable(icl->num_regulators,
107 icl->regulators); 111 icl->regulators);
108 if (ret < 0) 112 if (err < 0) {
109 dev_err(icd->pdev, "Cannot disable regulators\n"); 113 dev_err(icd->pdev, "Cannot disable regulators\n");
114 ret = ret ? : err;
115 }
110 116
111 return ret; 117 return ret;
112} 118}