提交 bbcc9fa0 编写于 作者: G Guennadi Liakhovetski 提交者: Mauro Carvalho Chehab

[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: NGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 4237c09a
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册