diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2013-04-18 23:35:39 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-05-21 12:48:58 +0200 |
commit | bbcc9fa0afe4f8a36e8777e14f7b016090605306 (patch) | |
tree | 33a36a4222528de0bf04d86143b3bd1577fea206 /drivers/media/i2c/mt9p031.c | |
parent | Merge tag 'v3.10-rc1' into patchwork (diff) | |
download | linux-bbcc9fa0afe4f8a36e8777e14f7b016090605306.tar.xz linux-bbcc9fa0afe4f8a36e8777e14f7b016090605306.zip |
[media] mt9p031: Power down the sensor if no supported device has been detected
The mt9p031 driver first accesses the I2C device in its .registered()
method. While doing that it first powers the device up, but if probing
fails, it doesn't power the chip back down. This patch fixes that bug.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to '')
-rw-r--r-- | drivers/media/i2c/mt9p031.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c index 28cf95b37285..8de84c0a48dc 100644 --- a/drivers/media/i2c/mt9p031.c +++ b/drivers/media/i2c/mt9p031.c @@ -849,18 +849,18 @@ static int mt9p031_registered(struct v4l2_subdev *subdev) /* Read out the chip version register */ data = mt9p031_read(client, MT9P031_CHIP_VERSION); + mt9p031_power_off(mt9p031); + if (data != MT9P031_CHIP_VERSION_VALUE) { dev_err(&client->dev, "MT9P031 not detected, wrong version " "0x%04x\n", data); return -ENODEV; } - mt9p031_power_off(mt9p031); - dev_info(&client->dev, "MT9P031 detected at address 0x%02x\n", client->addr); - return ret; + return 0; } static int mt9p031_open(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh) |