diff options
Diffstat (limited to 'drivers/media/video/mt9t031.c')
-rw-r--r-- | drivers/media/video/mt9t031.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/media/video/mt9t031.c b/drivers/media/video/mt9t031.c index 23f9ce9d67e..2b0927bfd21 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 | ||
142 | static int mt9t031_init(struct soc_camera_device *icd) | 142 | static 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 | ||
156 | static int mt9t031_release(struct soc_camera_device *icd) | 170 | static 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 | ||