aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <lg@denx.de>2009-04-03 09:14:02 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-04-06 20:43:57 -0400
commitf982651410f00378e42d9daab274adee5c762523 (patch)
treeba5f003d6d650360bb15df26b430b5e280619e3d
parent6252d25776f7e74f22acad7acb0165338927fe1e (diff)
V4L/DVB (11347): mt9t031: use platform power hook
Use platform power hook to turn the camera on and off. Signed-off-by: Guennadi Liakhovetski <lg@denx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/mt9t031.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/media/video/mt9t031.c b/drivers/media/video/mt9t031.c
index 23f9ce9d67ef..2b0927bfd217 100644
--- a/drivers/media/video/mt9t031.c
+++ b/drivers/media/video/mt9t031.c
@@ -141,8 +141,19 @@ static int get_shutter(struct soc_camera_device *icd, u32 *data)
141 141
142static int mt9t031_init(struct soc_camera_device *icd) 142static int mt9t031_init(struct soc_camera_device *icd)
143{ 143{
144 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd);
145 struct soc_camera_link *icl = mt9t031->client->dev.platform_data;
144 int ret; 146 int ret;
145 147
148 if (icl->power) {
149 ret = icl->power(&mt9t031->client->dev, 1);
150 if (ret < 0) {
151 dev_err(icd->vdev->parent,
152 "Platform failed to power-on the camera.\n");
153 return ret;
154 }
155 }
156
146 /* Disable chip output, synchronous option update */ 157 /* Disable chip output, synchronous option update */
147 ret = reg_write(icd, MT9T031_RESET, 1); 158 ret = reg_write(icd, MT9T031_RESET, 1);
148 if (ret >= 0) 159 if (ret >= 0)
@@ -150,13 +161,23 @@ static int mt9t031_init(struct soc_camera_device *icd)
150 if (ret >= 0) 161 if (ret >= 0)
151 ret = reg_clear(icd, MT9T031_OUTPUT_CONTROL, 2); 162 ret = reg_clear(icd, MT9T031_OUTPUT_CONTROL, 2);
152 163
164 if (ret < 0 && icl->power)
165 icl->power(&mt9t031->client->dev, 0);
166
153 return ret >= 0 ? 0 : -EIO; 167 return ret >= 0 ? 0 : -EIO;
154} 168}
155 169
156static int mt9t031_release(struct soc_camera_device *icd) 170static int mt9t031_release(struct soc_camera_device *icd)
157{ 171{
172 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd);
173 struct soc_camera_link *icl = mt9t031->client->dev.platform_data;
174
158 /* Disable the chip */ 175 /* Disable the chip */
159 reg_clear(icd, MT9T031_OUTPUT_CONTROL, 2); 176 reg_clear(icd, MT9T031_OUTPUT_CONTROL, 2);
177
178 if (icl->power)
179 icl->power(&mt9t031->client->dev, 0);
180
160 return 0; 181 return 0;
161} 182}
162 183