summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/soc_camera/imx074.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-07-18 10:54:04 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-15 17:04:42 -0300
commit4bbc6d52e61a8a9c19fcc859c4acab89cb8cd4e5 (patch)
tree64ce43072ed8fa87bd8f5bc4d8fe5794a0373aef /drivers/media/i2c/soc_camera/imx074.c
parent4ec10bacd6bf08de39ebdba9e75060452cc313e0 (diff)
[media] soc-camera: Push probe-time power management to drivers
Several client drivers access the hardware at probe time, for instance to read the probe chip ID. Such chips need to be powered up when being probed. soc-camera handles this by powering chips up in the soc-camera probe implementation. However, this will break with non soc-camera hosts that don't perform the same operations. Fix the problem by pushing the power up/down from the soc-camera core down to individual drivers on a needs basis. 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/i2c/soc_camera/imx074.c')
-rw-r--r--drivers/media/i2c/soc_camera/imx074.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/media/i2c/soc_camera/imx074.c b/drivers/media/i2c/soc_camera/imx074.c
index ade19873ed8..f8534eec9de 100644
--- a/drivers/media/i2c/soc_camera/imx074.c
+++ b/drivers/media/i2c/soc_camera/imx074.c
@@ -310,26 +310,33 @@ static struct v4l2_subdev_ops imx074_subdev_ops = {
static int imx074_video_probe(struct i2c_client *client)
{
+ struct v4l2_subdev *subdev = i2c_get_clientdata(client);
int ret;
u16 id;
+ ret = imx074_s_power(subdev, 1);
+ if (ret < 0)
+ return ret;
+
/* Read sensor Model ID */
ret = reg_read(client, 0);
if (ret < 0)
- return ret;
+ goto done;
id = ret << 8;
ret = reg_read(client, 1);
if (ret < 0)
- return ret;
+ goto done;
id |= ret;
dev_info(&client->dev, "Chip ID 0x%04x detected\n", id);
- if (id != 0x74)
- return -ENODEV;
+ if (id != 0x74) {
+ ret = -ENODEV;
+ goto done;
+ }
/* PLL Setting EXTCLK=24MHz, 22.5times */
reg_write(client, PLL_MULTIPLIER, 0x2D);
@@ -411,7 +418,11 @@ static int imx074_video_probe(struct i2c_client *client)
reg_write(client, GROUPED_PARAMETER_HOLD, 0x00); /* off */
- return 0;
+ ret = 0;
+
+done:
+ imx074_s_power(subdev, 0);
+ return ret;
}
static int imx074_probe(struct i2c_client *client,