diff options
author | Kalle Jokiniemi <kalle.jokiniemi@nokia.com> | 2011-05-03 06:41:22 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-07-27 16:56:06 -0400 |
commit | 65d76488f65011a68202eae7c01062390474bb1f (patch) | |
tree | 4d5ed0fe4f5a39b2d7b0be3281db5b63845710ca /drivers/media/video | |
parent | 118314c0169f25b1456232def5ca48d15e5036f0 (diff) |
[media] OMAP3: ISP: Add regulator control for omap34xx
The current omap3isp driver is missing regulator handling
for CSIb complex in omap34xx based devices. This patch
adds a mechanism for this to the omap3isp driver.
Signed-off-by: Kalle Jokiniemi <kalle.jokiniemi@nokia.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/omap3isp/ispccp2.c | 27 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/ispccp2.h | 1 |
2 files changed, 26 insertions, 2 deletions
diff --git a/drivers/media/video/omap3isp/ispccp2.c b/drivers/media/video/omap3isp/ispccp2.c index 0e16cab8e08..ec9e395f333 100644 --- a/drivers/media/video/omap3isp/ispccp2.c +++ b/drivers/media/video/omap3isp/ispccp2.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/mutex.h> | 31 | #include <linux/mutex.h> |
32 | #include <linux/uaccess.h> | 32 | #include <linux/uaccess.h> |
33 | #include <linux/regulator/consumer.h> | ||
33 | 34 | ||
34 | #include "isp.h" | 35 | #include "isp.h" |
35 | #include "ispreg.h" | 36 | #include "ispreg.h" |
@@ -163,6 +164,9 @@ static void ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) | |||
163 | struct isp_pipeline *pipe = to_isp_pipeline(&ccp2->subdev.entity); | 164 | struct isp_pipeline *pipe = to_isp_pipeline(&ccp2->subdev.entity); |
164 | int i; | 165 | int i; |
165 | 166 | ||
167 | if (enable && ccp2->vdds_csib) | ||
168 | regulator_enable(ccp2->vdds_csib); | ||
169 | |||
166 | /* Enable/Disable all the LCx channels */ | 170 | /* Enable/Disable all the LCx channels */ |
167 | for (i = 0; i < CCP2_LCx_CHANS_NUM; i++) | 171 | for (i = 0; i < CCP2_LCx_CHANS_NUM; i++) |
168 | isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_CCP2, ISPCCP2_LCx_CTRL(i), | 172 | isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_CCP2, ISPCCP2_LCx_CTRL(i), |
@@ -186,6 +190,9 @@ static void ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) | |||
186 | ISPCCP2_LC01_IRQENABLE, | 190 | ISPCCP2_LC01_IRQENABLE, |
187 | ISPCCP2_LC01_IRQSTATUS_LC0_FS_IRQ); | 191 | ISPCCP2_LC01_IRQSTATUS_LC0_FS_IRQ); |
188 | } | 192 | } |
193 | |||
194 | if (!enable && ccp2->vdds_csib) | ||
195 | regulator_disable(ccp2->vdds_csib); | ||
189 | } | 196 | } |
190 | 197 | ||
191 | /* | 198 | /* |
@@ -1137,6 +1144,9 @@ error: | |||
1137 | */ | 1144 | */ |
1138 | void omap3isp_ccp2_cleanup(struct isp_device *isp) | 1145 | void omap3isp_ccp2_cleanup(struct isp_device *isp) |
1139 | { | 1146 | { |
1147 | struct isp_ccp2_device *ccp2 = &isp->isp_ccp2; | ||
1148 | |||
1149 | regulator_put(ccp2->vdds_csib); | ||
1140 | } | 1150 | } |
1141 | 1151 | ||
1142 | /* | 1152 | /* |
@@ -1151,14 +1161,27 @@ int omap3isp_ccp2_init(struct isp_device *isp) | |||
1151 | 1161 | ||
1152 | init_waitqueue_head(&ccp2->wait); | 1162 | init_waitqueue_head(&ccp2->wait); |
1153 | 1163 | ||
1154 | /* On the OMAP36xx, the CCP2 uses the CSI PHY1 or PHY2, shared with | 1164 | /* |
1165 | * On the OMAP34xx the CSI1 receiver is operated in the CSIb IO | ||
1166 | * complex, which is powered by vdds_csib power rail. Hence the | ||
1167 | * request for the regulator. | ||
1168 | * | ||
1169 | * On the OMAP36xx, the CCP2 uses the CSI PHY1 or PHY2, shared with | ||
1155 | * the CSI2c or CSI2a receivers. The PHY then needs to be explicitly | 1170 | * the CSI2c or CSI2a receivers. The PHY then needs to be explicitly |
1156 | * configured. | 1171 | * configured. |
1157 | * | 1172 | * |
1158 | * TODO: Don't hardcode the usage of PHY1 (shared with CSI2c). | 1173 | * TODO: Don't hardcode the usage of PHY1 (shared with CSI2c). |
1159 | */ | 1174 | */ |
1160 | if (isp->revision == ISP_REVISION_15_0) | 1175 | if (isp->revision == ISP_REVISION_2_0) { |
1176 | ccp2->vdds_csib = regulator_get(isp->dev, "vdds_csib"); | ||
1177 | if (IS_ERR(ccp2->vdds_csib)) { | ||
1178 | dev_dbg(isp->dev, | ||
1179 | "Could not get regulator vdds_csib\n"); | ||
1180 | ccp2->vdds_csib = NULL; | ||
1181 | } | ||
1182 | } else if (isp->revision == ISP_REVISION_15_0) { | ||
1161 | ccp2->phy = &isp->isp_csiphy1; | 1183 | ccp2->phy = &isp->isp_csiphy1; |
1184 | } | ||
1162 | 1185 | ||
1163 | ret = ccp2_init_entities(ccp2); | 1186 | ret = ccp2_init_entities(ccp2); |
1164 | if (ret < 0) | 1187 | if (ret < 0) |
diff --git a/drivers/media/video/omap3isp/ispccp2.h b/drivers/media/video/omap3isp/ispccp2.h index 5505a86a9a7..6674e9de2cd 100644 --- a/drivers/media/video/omap3isp/ispccp2.h +++ b/drivers/media/video/omap3isp/ispccp2.h | |||
@@ -81,6 +81,7 @@ struct isp_ccp2_device { | |||
81 | struct isp_interface_mem_config mem_cfg; | 81 | struct isp_interface_mem_config mem_cfg; |
82 | struct isp_video video_in; | 82 | struct isp_video video_in; |
83 | struct isp_csiphy *phy; | 83 | struct isp_csiphy *phy; |
84 | struct regulator *vdds_csib; | ||
84 | unsigned int error; | 85 | unsigned int error; |
85 | enum isp_pipeline_stream_state state; | 86 | enum isp_pipeline_stream_state state; |
86 | wait_queue_head_t wait; | 87 | wait_queue_head_t wait; |