summaryrefslogtreecommitdiff
path: root/drivers/media/i2c/soc_camera/mt9t031.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-07-20 10:19:50 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-15 17:03:29 -0300
commit4ec10bacd6bf08de39ebdba9e75060452cc313e0 (patch)
treee1013540a3643ed039cb96609ca1b23dcd2dcf8b /drivers/media/i2c/soc_camera/mt9t031.c
parent24592adce89805c99eb23d1e37aa8a66aaacee05 (diff)
[media] soc-camera: Add and use soc_camera_power_[on|off]() helper functions
Instead of forcing all soc-camera drivers to go through the mid-layer to handle power management, create soc_camera_power_[on|off]() functions that can be called from the subdev .s_power() operation to manage regulators and platform-specific power handling. This allows non soc-camera hosts to use soc-camera-aware clients. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [g.liakhovetski@gmx.de: fix compile breakage] Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c/soc_camera/mt9t031.c')
-rw-r--r--drivers/media/i2c/soc_camera/mt9t031.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/media/i2c/soc_camera/mt9t031.c b/drivers/media/i2c/soc_camera/mt9t031.c
index 1415074138a5..9666e202e395 100644
--- a/drivers/media/i2c/soc_camera/mt9t031.c
+++ b/drivers/media/i2c/soc_camera/mt9t031.c
@@ -616,12 +616,19 @@ static struct device_type mt9t031_dev_type = {
static int mt9t031_s_power(struct v4l2_subdev *sd, int on)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
+ struct soc_camera_link *icl = soc_camera_i2c_to_link(client);
struct video_device *vdev = soc_camera_i2c_to_vdev(client);
+ int ret;
- if (on)
+ if (on) {
+ ret = soc_camera_power_on(&client->dev, icl);
+ if (ret < 0)
+ return ret;
vdev->dev.type = &mt9t031_dev_type;
- else
+ } else {
vdev->dev.type = NULL;
+ soc_camera_power_off(&client->dev, icl);
+ }
return 0;
}