diff options
author | Stefan Herbrechtsmeier <hbmeier@hni.uni-paderborn.de> | 2008-08-14 11:04:11 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:36:50 -0400 |
commit | 81034663159f39d005316b5c139038459cd16721 (patch) | |
tree | 8a86bc69b553bb2cb7656465b7449565427b197d /drivers/media/video/mt9m001.c | |
parent | 506c629a8eb95a3232a0aafa3b80903224ccc461 (diff) |
V4L/DVB (8687): soc-camera: Move .power and .reset from soc_camera host to sensor driver
Make .power and .reset callbacks per camera instead of per host, also move
their invocation to camera drivers.
.arch/arm/mach-pxa/include/mach/camera.h | 2 -
Signed-off-by: Stefan Herbrechtsmeier <hbmeier@hni.uni-paderborn.de>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/mt9m001.c')
-rw-r--r-- | drivers/media/video/mt9m001.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c index 3531f9352dff..0c524376b67e 100644 --- a/drivers/media/video/mt9m001.c +++ b/drivers/media/video/mt9m001.c | |||
@@ -117,13 +117,33 @@ static int reg_clear(struct soc_camera_device *icd, const u8 reg, | |||
117 | 117 | ||
118 | static int mt9m001_init(struct soc_camera_device *icd) | 118 | static int mt9m001_init(struct soc_camera_device *icd) |
119 | { | 119 | { |
120 | struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd); | ||
121 | struct soc_camera_link *icl = mt9m001->client->dev.platform_data; | ||
120 | int ret; | 122 | int ret; |
121 | 123 | ||
122 | dev_dbg(icd->vdev->parent, "%s\n", __func__); | 124 | dev_dbg(icd->vdev->parent, "%s\n", __func__); |
123 | 125 | ||
124 | ret = reg_write(icd, MT9M001_RESET, 1); | 126 | if (icl->power) { |
125 | if (!ret) | 127 | ret = icl->power(&mt9m001->client->dev, 1); |
126 | ret = reg_write(icd, MT9M001_RESET, 0); | 128 | if (ret < 0) { |
129 | dev_err(icd->vdev->parent, | ||
130 | "Platform failed to power-on the camera.\n"); | ||
131 | return ret; | ||
132 | } | ||
133 | } | ||
134 | |||
135 | /* The camera could have been already on, we reset it additionally */ | ||
136 | if (icl->reset) | ||
137 | ret = icl->reset(&mt9m001->client->dev); | ||
138 | else | ||
139 | ret = -ENODEV; | ||
140 | |||
141 | if (ret < 0) { | ||
142 | /* Either no platform reset, or platform reset failed */ | ||
143 | ret = reg_write(icd, MT9M001_RESET, 1); | ||
144 | if (!ret) | ||
145 | ret = reg_write(icd, MT9M001_RESET, 0); | ||
146 | } | ||
127 | /* Disable chip, synchronous option update */ | 147 | /* Disable chip, synchronous option update */ |
128 | if (!ret) | 148 | if (!ret) |
129 | ret = reg_write(icd, MT9M001_OUTPUT_CONTROL, 0); | 149 | ret = reg_write(icd, MT9M001_OUTPUT_CONTROL, 0); |
@@ -133,8 +153,15 @@ static int mt9m001_init(struct soc_camera_device *icd) | |||
133 | 153 | ||
134 | static int mt9m001_release(struct soc_camera_device *icd) | 154 | static int mt9m001_release(struct soc_camera_device *icd) |
135 | { | 155 | { |
156 | struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd); | ||
157 | struct soc_camera_link *icl = mt9m001->client->dev.platform_data; | ||
158 | |||
136 | /* Disable the chip */ | 159 | /* Disable the chip */ |
137 | reg_write(icd, MT9M001_OUTPUT_CONTROL, 0); | 160 | reg_write(icd, MT9M001_OUTPUT_CONTROL, 0); |
161 | |||
162 | if (icl->power) | ||
163 | icl->power(&mt9m001->client->dev, 0); | ||
164 | |||
138 | return 0; | 165 | return 0; |
139 | } | 166 | } |
140 | 167 | ||