diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-07-20 09:19:50 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-15 16:03:29 -0400 |
commit | 4ec10bacd6bf08de39ebdba9e75060452cc313e0 (patch) | |
tree | e1013540a3643ed039cb96609ca1b23dcd2dcf8b /drivers/media/i2c/soc_camera/ov2640.c | |
parent | 24592adce89805c99eb23d1e37aa8a66aaacee05 (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/ov2640.c')
-rw-r--r-- | drivers/media/i2c/soc_camera/ov2640.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/media/i2c/soc_camera/ov2640.c b/drivers/media/i2c/soc_camera/ov2640.c index 7c44d1fe3c87..16ed091c702d 100644 --- a/drivers/media/i2c/soc_camera/ov2640.c +++ b/drivers/media/i2c/soc_camera/ov2640.c | |||
@@ -742,6 +742,14 @@ static int ov2640_s_register(struct v4l2_subdev *sd, | |||
742 | } | 742 | } |
743 | #endif | 743 | #endif |
744 | 744 | ||
745 | static int ov2640_s_power(struct v4l2_subdev *sd, int on) | ||
746 | { | ||
747 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
748 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); | ||
749 | |||
750 | return soc_camera_set_power(&client->dev, icl, on); | ||
751 | } | ||
752 | |||
745 | /* Select the nearest higher resolution for capture */ | 753 | /* Select the nearest higher resolution for capture */ |
746 | static const struct ov2640_win_size *ov2640_select_win(u32 *width, u32 *height) | 754 | static const struct ov2640_win_size *ov2640_select_win(u32 *width, u32 *height) |
747 | { | 755 | { |
@@ -988,6 +996,7 @@ static struct v4l2_subdev_core_ops ov2640_subdev_core_ops = { | |||
988 | .g_register = ov2640_g_register, | 996 | .g_register = ov2640_g_register, |
989 | .s_register = ov2640_s_register, | 997 | .s_register = ov2640_s_register, |
990 | #endif | 998 | #endif |
999 | .s_power = ov2640_s_power, | ||
991 | }; | 1000 | }; |
992 | 1001 | ||
993 | static int ov2640_g_mbus_config(struct v4l2_subdev *sd, | 1002 | static int ov2640_g_mbus_config(struct v4l2_subdev *sd, |