aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/omap3isp/ispcsi2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/omap3isp/ispcsi2.c')
-rw-r--r--drivers/media/video/omap3isp/ispcsi2.c91
1 files changed, 48 insertions, 43 deletions
diff --git a/drivers/media/video/omap3isp/ispcsi2.c b/drivers/media/video/omap3isp/ispcsi2.c
index 69161a682b3d..0c5f1cb9d99d 100644
--- a/drivers/media/video/omap3isp/ispcsi2.c
+++ b/drivers/media/video/omap3isp/ispcsi2.c
@@ -1187,6 +1187,37 @@ static const struct media_entity_operations csi2_media_ops = {
1187 .link_setup = csi2_link_setup, 1187 .link_setup = csi2_link_setup,
1188}; 1188};
1189 1189
1190void omap3isp_csi2_unregister_entities(struct isp_csi2_device *csi2)
1191{
1192 v4l2_device_unregister_subdev(&csi2->subdev);
1193 omap3isp_video_unregister(&csi2->video_out);
1194}
1195
1196int omap3isp_csi2_register_entities(struct isp_csi2_device *csi2,
1197 struct v4l2_device *vdev)
1198{
1199 int ret;
1200
1201 /* Register the subdev and video nodes. */
1202 ret = v4l2_device_register_subdev(vdev, &csi2->subdev);
1203 if (ret < 0)
1204 goto error;
1205
1206 ret = omap3isp_video_register(&csi2->video_out, vdev);
1207 if (ret < 0)
1208 goto error;
1209
1210 return 0;
1211
1212error:
1213 omap3isp_csi2_unregister_entities(csi2);
1214 return ret;
1215}
1216
1217/* -----------------------------------------------------------------------------
1218 * ISP CSI2 initialisation and cleanup
1219 */
1220
1190/* 1221/*
1191 * csi2_init_entities - Initialize subdev and media entity. 1222 * csi2_init_entities - Initialize subdev and media entity.
1192 * @csi2: Pointer to csi2 structure. 1223 * @csi2: Pointer to csi2 structure.
@@ -1228,57 +1259,23 @@ static int csi2_init_entities(struct isp_csi2_device *csi2)
1228 1259
1229 ret = omap3isp_video_init(&csi2->video_out, "CSI2a"); 1260 ret = omap3isp_video_init(&csi2->video_out, "CSI2a");
1230 if (ret < 0) 1261 if (ret < 0)
1231 return ret; 1262 goto error_video;
1232 1263
1233 /* Connect the CSI2 subdev to the video node. */ 1264 /* Connect the CSI2 subdev to the video node. */
1234 ret = media_entity_create_link(&csi2->subdev.entity, CSI2_PAD_SOURCE, 1265 ret = media_entity_create_link(&csi2->subdev.entity, CSI2_PAD_SOURCE,
1235 &csi2->video_out.video.entity, 0, 0); 1266 &csi2->video_out.video.entity, 0, 0);
1236 if (ret < 0) 1267 if (ret < 0)
1237 return ret; 1268 goto error_link;
1238 1269
1239 return 0; 1270 return 0;
1240}
1241 1271
1242void omap3isp_csi2_unregister_entities(struct isp_csi2_device *csi2) 1272error_link:
1243{ 1273 omap3isp_video_cleanup(&csi2->video_out);
1274error_video:
1244 media_entity_cleanup(&csi2->subdev.entity); 1275 media_entity_cleanup(&csi2->subdev.entity);
1245
1246 v4l2_device_unregister_subdev(&csi2->subdev);
1247 omap3isp_video_unregister(&csi2->video_out);
1248}
1249
1250int omap3isp_csi2_register_entities(struct isp_csi2_device *csi2,
1251 struct v4l2_device *vdev)
1252{
1253 int ret;
1254
1255 /* Register the subdev and video nodes. */
1256 ret = v4l2_device_register_subdev(vdev, &csi2->subdev);
1257 if (ret < 0)
1258 goto error;
1259
1260 ret = omap3isp_video_register(&csi2->video_out, vdev);
1261 if (ret < 0)
1262 goto error;
1263
1264 return 0;
1265
1266error:
1267 omap3isp_csi2_unregister_entities(csi2);
1268 return ret; 1276 return ret;
1269} 1277}
1270 1278
1271/* -----------------------------------------------------------------------------
1272 * ISP CSI2 initialisation and cleanup
1273 */
1274
1275/*
1276 * omap3isp_csi2_cleanup - Routine for module driver cleanup
1277 */
1278void omap3isp_csi2_cleanup(struct isp_device *isp)
1279{
1280}
1281
1282/* 1279/*
1283 * omap3isp_csi2_init - Routine for module driver init 1280 * omap3isp_csi2_init - Routine for module driver init
1284 */ 1281 */
@@ -1298,7 +1295,7 @@ int omap3isp_csi2_init(struct isp_device *isp)
1298 1295
1299 ret = csi2_init_entities(csi2a); 1296 ret = csi2_init_entities(csi2a);
1300 if (ret < 0) 1297 if (ret < 0)
1301 goto fail; 1298 return ret;
1302 1299
1303 if (isp->revision == ISP_REVISION_15_0) { 1300 if (isp->revision == ISP_REVISION_15_0) {
1304 csi2c->isp = isp; 1301 csi2c->isp = isp;
@@ -1311,7 +1308,15 @@ int omap3isp_csi2_init(struct isp_device *isp)
1311 } 1308 }
1312 1309
1313 return 0; 1310 return 0;
1314fail: 1311}
1315 omap3isp_csi2_cleanup(isp); 1312
1316 return ret; 1313/*
1314 * omap3isp_csi2_cleanup - Routine for module driver cleanup
1315 */
1316void omap3isp_csi2_cleanup(struct isp_device *isp)
1317{
1318 struct isp_csi2_device *csi2a = &isp->isp_csi2a;
1319
1320 omap3isp_video_cleanup(&csi2a->video_out);
1321 media_entity_cleanup(&csi2a->subdev.entity);
1317} 1322}