diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2009-04-03 15:14:02 +0200 |
---|---|---|
committer | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2009-04-03 15:14:02 +0200 |
commit | 13a03d748ee008767d82696fe3a61593c19d37bc (patch) | |
tree | 43f01d39d3cdff58622f58fda96ae83d60cf48bb /linux/drivers/media/video | |
parent | f6816dc0e0924644a294146b032a0a4961de55ec (diff) | |
download | mediapointer-dvb-s2-13a03d748ee008767d82696fe3a61593c19d37bc.tar.gz mediapointer-dvb-s2-13a03d748ee008767d82696fe3a61593c19d37bc.tar.bz2 |
mt9t031: use platform power hook
From: Guennadi Liakhovetski <lg@denx.de>
Use platform power hook to turn the camera on and off.
Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
---
drivers/media/video/mt9t031.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
Diffstat (limited to 'linux/drivers/media/video')
-rw-r--r-- | linux/drivers/media/video/mt9t031.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/linux/drivers/media/video/mt9t031.c b/linux/drivers/media/video/mt9t031.c index 8a9ca0b27..f4e597e6c 100644 --- a/linux/drivers/media/video/mt9t031.c +++ b/linux/drivers/media/video/mt9t031.c @@ -141,8 +141,19 @@ static int get_shutter(struct soc_camera_device *icd, u32 *data) static int mt9t031_init(struct soc_camera_device *icd) { + struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd); + struct soc_camera_link *icl = mt9t031->client->dev.platform_data; int ret; + if (icl->power) { + ret = icl->power(&mt9t031->client->dev, 1); + if (ret < 0) { + dev_err(icd->vdev->parent, + "Platform failed to power-on the camera.\n"); + return ret; + } + } + /* Disable chip output, synchronous option update */ ret = reg_write(icd, MT9T031_RESET, 1); if (ret >= 0) @@ -150,13 +161,23 @@ static int mt9t031_init(struct soc_camera_device *icd) if (ret >= 0) ret = reg_clear(icd, MT9T031_OUTPUT_CONTROL, 2); + if (ret < 0 && icl->power) + icl->power(&mt9t031->client->dev, 0); + return ret >= 0 ? 0 : -EIO; } static int mt9t031_release(struct soc_camera_device *icd) { + struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd); + struct soc_camera_link *icl = mt9t031->client->dev.platform_data; + /* Disable the chip */ reg_clear(icd, MT9T031_OUTPUT_CONTROL, 2); + + if (icl->power) + icl->power(&mt9t031->client->dev, 0); + return 0; } |