diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-09-22 15:59:26 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-11-03 16:29:16 -0400 |
commit | 39099d09ae4605003696919d7c3a6e8a96607c4b (patch) | |
tree | f89d402db0ad2f54c02b58f0ce698f6aafbd679a /drivers/media | |
parent | 63b4ca23ed2b35742bebf8cb2af49b84b24442c6 (diff) |
[media] omap3isp: Move *_init_entities() functions to the init/cleanup section
Group all init/cleanup functions together to make the code more
readable.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/omap3isp/ispccdc.c | 62 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/ispccp2.c | 112 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/ispcsi2.c | 84 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/isppreview.c | 94 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/ispresizer.c | 90 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/ispstat.c | 36 |
6 files changed, 239 insertions, 239 deletions
diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c index 98804d5f89c2..c30cc59d7032 100644 --- a/drivers/media/video/omap3isp/ispccdc.c +++ b/drivers/media/video/omap3isp/ispccdc.c | |||
@@ -2152,6 +2152,37 @@ static const struct media_entity_operations ccdc_media_ops = { | |||
2152 | .link_setup = ccdc_link_setup, | 2152 | .link_setup = ccdc_link_setup, |
2153 | }; | 2153 | }; |
2154 | 2154 | ||
2155 | void omap3isp_ccdc_unregister_entities(struct isp_ccdc_device *ccdc) | ||
2156 | { | ||
2157 | v4l2_device_unregister_subdev(&ccdc->subdev); | ||
2158 | omap3isp_video_unregister(&ccdc->video_out); | ||
2159 | } | ||
2160 | |||
2161 | int omap3isp_ccdc_register_entities(struct isp_ccdc_device *ccdc, | ||
2162 | struct v4l2_device *vdev) | ||
2163 | { | ||
2164 | int ret; | ||
2165 | |||
2166 | /* Register the subdev and video node. */ | ||
2167 | ret = v4l2_device_register_subdev(vdev, &ccdc->subdev); | ||
2168 | if (ret < 0) | ||
2169 | goto error; | ||
2170 | |||
2171 | ret = omap3isp_video_register(&ccdc->video_out, vdev); | ||
2172 | if (ret < 0) | ||
2173 | goto error; | ||
2174 | |||
2175 | return 0; | ||
2176 | |||
2177 | error: | ||
2178 | omap3isp_ccdc_unregister_entities(ccdc); | ||
2179 | return ret; | ||
2180 | } | ||
2181 | |||
2182 | /* ----------------------------------------------------------------------------- | ||
2183 | * ISP CCDC initialisation and cleanup | ||
2184 | */ | ||
2185 | |||
2155 | /* | 2186 | /* |
2156 | * ccdc_init_entities - Initialize V4L2 subdev and media entity | 2187 | * ccdc_init_entities - Initialize V4L2 subdev and media entity |
2157 | * @ccdc: ISP CCDC module | 2188 | * @ccdc: ISP CCDC module |
@@ -2204,37 +2235,6 @@ static int ccdc_init_entities(struct isp_ccdc_device *ccdc) | |||
2204 | return 0; | 2235 | return 0; |
2205 | } | 2236 | } |
2206 | 2237 | ||
2207 | void omap3isp_ccdc_unregister_entities(struct isp_ccdc_device *ccdc) | ||
2208 | { | ||
2209 | v4l2_device_unregister_subdev(&ccdc->subdev); | ||
2210 | omap3isp_video_unregister(&ccdc->video_out); | ||
2211 | } | ||
2212 | |||
2213 | int omap3isp_ccdc_register_entities(struct isp_ccdc_device *ccdc, | ||
2214 | struct v4l2_device *vdev) | ||
2215 | { | ||
2216 | int ret; | ||
2217 | |||
2218 | /* Register the subdev and video node. */ | ||
2219 | ret = v4l2_device_register_subdev(vdev, &ccdc->subdev); | ||
2220 | if (ret < 0) | ||
2221 | goto error; | ||
2222 | |||
2223 | ret = omap3isp_video_register(&ccdc->video_out, vdev); | ||
2224 | if (ret < 0) | ||
2225 | goto error; | ||
2226 | |||
2227 | return 0; | ||
2228 | |||
2229 | error: | ||
2230 | omap3isp_ccdc_unregister_entities(ccdc); | ||
2231 | return ret; | ||
2232 | } | ||
2233 | |||
2234 | /* ----------------------------------------------------------------------------- | ||
2235 | * ISP CCDC initialisation and cleanup | ||
2236 | */ | ||
2237 | |||
2238 | /* | 2238 | /* |
2239 | * omap3isp_ccdc_init - CCDC module initialization. | 2239 | * omap3isp_ccdc_init - CCDC module initialization. |
2240 | * @dev: Device pointer specific to the OMAP3 ISP. | 2240 | * @dev: Device pointer specific to the OMAP3 ISP. |
diff --git a/drivers/media/video/omap3isp/ispccp2.c b/drivers/media/video/omap3isp/ispccp2.c index b8e0863b194c..883a2825cb41 100644 --- a/drivers/media/video/omap3isp/ispccp2.c +++ b/drivers/media/video/omap3isp/ispccp2.c | |||
@@ -1032,6 +1032,48 @@ static const struct media_entity_operations ccp2_media_ops = { | |||
1032 | }; | 1032 | }; |
1033 | 1033 | ||
1034 | /* | 1034 | /* |
1035 | * omap3isp_ccp2_unregister_entities - Unregister media entities: subdev | ||
1036 | * @ccp2: Pointer to ISP CCP2 device | ||
1037 | */ | ||
1038 | void omap3isp_ccp2_unregister_entities(struct isp_ccp2_device *ccp2) | ||
1039 | { | ||
1040 | v4l2_device_unregister_subdev(&ccp2->subdev); | ||
1041 | omap3isp_video_unregister(&ccp2->video_in); | ||
1042 | } | ||
1043 | |||
1044 | /* | ||
1045 | * omap3isp_ccp2_register_entities - Register the subdev media entity | ||
1046 | * @ccp2: Pointer to ISP CCP2 device | ||
1047 | * @vdev: Pointer to v4l device | ||
1048 | * return negative error code or zero on success | ||
1049 | */ | ||
1050 | |||
1051 | int omap3isp_ccp2_register_entities(struct isp_ccp2_device *ccp2, | ||
1052 | struct v4l2_device *vdev) | ||
1053 | { | ||
1054 | int ret; | ||
1055 | |||
1056 | /* Register the subdev and video nodes. */ | ||
1057 | ret = v4l2_device_register_subdev(vdev, &ccp2->subdev); | ||
1058 | if (ret < 0) | ||
1059 | goto error; | ||
1060 | |||
1061 | ret = omap3isp_video_register(&ccp2->video_in, vdev); | ||
1062 | if (ret < 0) | ||
1063 | goto error; | ||
1064 | |||
1065 | return 0; | ||
1066 | |||
1067 | error: | ||
1068 | omap3isp_ccp2_unregister_entities(ccp2); | ||
1069 | return ret; | ||
1070 | } | ||
1071 | |||
1072 | /* ----------------------------------------------------------------------------- | ||
1073 | * ISP ccp2 initialisation and cleanup | ||
1074 | */ | ||
1075 | |||
1076 | /* | ||
1035 | * ccp2_init_entities - Initialize ccp2 subdev and media entity. | 1077 | * ccp2_init_entities - Initialize ccp2 subdev and media entity. |
1036 | * @ccp2: Pointer to ISP CCP2 device | 1078 | * @ccp2: Pointer to ISP CCP2 device |
1037 | * return negative error code or zero on success | 1079 | * return negative error code or zero on success |
@@ -1095,62 +1137,6 @@ static int ccp2_init_entities(struct isp_ccp2_device *ccp2) | |||
1095 | } | 1137 | } |
1096 | 1138 | ||
1097 | /* | 1139 | /* |
1098 | * omap3isp_ccp2_unregister_entities - Unregister media entities: subdev | ||
1099 | * @ccp2: Pointer to ISP CCP2 device | ||
1100 | */ | ||
1101 | void omap3isp_ccp2_unregister_entities(struct isp_ccp2_device *ccp2) | ||
1102 | { | ||
1103 | v4l2_device_unregister_subdev(&ccp2->subdev); | ||
1104 | omap3isp_video_unregister(&ccp2->video_in); | ||
1105 | } | ||
1106 | |||
1107 | /* | ||
1108 | * omap3isp_ccp2_register_entities - Register the subdev media entity | ||
1109 | * @ccp2: Pointer to ISP CCP2 device | ||
1110 | * @vdev: Pointer to v4l device | ||
1111 | * return negative error code or zero on success | ||
1112 | */ | ||
1113 | |||
1114 | int omap3isp_ccp2_register_entities(struct isp_ccp2_device *ccp2, | ||
1115 | struct v4l2_device *vdev) | ||
1116 | { | ||
1117 | int ret; | ||
1118 | |||
1119 | /* Register the subdev and video nodes. */ | ||
1120 | ret = v4l2_device_register_subdev(vdev, &ccp2->subdev); | ||
1121 | if (ret < 0) | ||
1122 | goto error; | ||
1123 | |||
1124 | ret = omap3isp_video_register(&ccp2->video_in, vdev); | ||
1125 | if (ret < 0) | ||
1126 | goto error; | ||
1127 | |||
1128 | return 0; | ||
1129 | |||
1130 | error: | ||
1131 | omap3isp_ccp2_unregister_entities(ccp2); | ||
1132 | return ret; | ||
1133 | } | ||
1134 | |||
1135 | /* ----------------------------------------------------------------------------- | ||
1136 | * ISP ccp2 initialisation and cleanup | ||
1137 | */ | ||
1138 | |||
1139 | /* | ||
1140 | * omap3isp_ccp2_cleanup - CCP2 un-initialization | ||
1141 | * @isp : Pointer to ISP device | ||
1142 | */ | ||
1143 | void omap3isp_ccp2_cleanup(struct isp_device *isp) | ||
1144 | { | ||
1145 | struct isp_ccp2_device *ccp2 = &isp->isp_ccp2; | ||
1146 | |||
1147 | omap3isp_video_cleanup(&ccp2->video_in); | ||
1148 | media_entity_cleanup(&ccp2->subdev.entity); | ||
1149 | |||
1150 | regulator_put(ccp2->vdds_csib); | ||
1151 | } | ||
1152 | |||
1153 | /* | ||
1154 | * omap3isp_ccp2_init - CCP2 initialization. | 1140 | * omap3isp_ccp2_init - CCP2 initialization. |
1155 | * @isp : Pointer to ISP device | 1141 | * @isp : Pointer to ISP device |
1156 | * return negative error code or zero on success | 1142 | * return negative error code or zero on success |
@@ -1195,3 +1181,17 @@ out: | |||
1195 | 1181 | ||
1196 | return ret; | 1182 | return ret; |
1197 | } | 1183 | } |
1184 | |||
1185 | /* | ||
1186 | * omap3isp_ccp2_cleanup - CCP2 un-initialization | ||
1187 | * @isp : Pointer to ISP device | ||
1188 | */ | ||
1189 | void omap3isp_ccp2_cleanup(struct isp_device *isp) | ||
1190 | { | ||
1191 | struct isp_ccp2_device *ccp2 = &isp->isp_ccp2; | ||
1192 | |||
1193 | omap3isp_video_cleanup(&ccp2->video_in); | ||
1194 | media_entity_cleanup(&ccp2->subdev.entity); | ||
1195 | |||
1196 | regulator_put(ccp2->vdds_csib); | ||
1197 | } | ||
diff --git a/drivers/media/video/omap3isp/ispcsi2.c b/drivers/media/video/omap3isp/ispcsi2.c index 5612e95ac0b8..2c9bffcdc5c9 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 | ||
1190 | void 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 | |||
1196 | int 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 | |||
1212 | error: | ||
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. |
@@ -1239,48 +1270,6 @@ static int csi2_init_entities(struct isp_csi2_device *csi2) | |||
1239 | return 0; | 1270 | return 0; |
1240 | } | 1271 | } |
1241 | 1272 | ||
1242 | void omap3isp_csi2_unregister_entities(struct isp_csi2_device *csi2) | ||
1243 | { | ||
1244 | v4l2_device_unregister_subdev(&csi2->subdev); | ||
1245 | omap3isp_video_unregister(&csi2->video_out); | ||
1246 | } | ||
1247 | |||
1248 | int omap3isp_csi2_register_entities(struct isp_csi2_device *csi2, | ||
1249 | struct v4l2_device *vdev) | ||
1250 | { | ||
1251 | int ret; | ||
1252 | |||
1253 | /* Register the subdev and video nodes. */ | ||
1254 | ret = v4l2_device_register_subdev(vdev, &csi2->subdev); | ||
1255 | if (ret < 0) | ||
1256 | goto error; | ||
1257 | |||
1258 | ret = omap3isp_video_register(&csi2->video_out, vdev); | ||
1259 | if (ret < 0) | ||
1260 | goto error; | ||
1261 | |||
1262 | return 0; | ||
1263 | |||
1264 | error: | ||
1265 | omap3isp_csi2_unregister_entities(csi2); | ||
1266 | return ret; | ||
1267 | } | ||
1268 | |||
1269 | /* ----------------------------------------------------------------------------- | ||
1270 | * ISP CSI2 initialisation and cleanup | ||
1271 | */ | ||
1272 | |||
1273 | /* | ||
1274 | * omap3isp_csi2_cleanup - Routine for module driver cleanup | ||
1275 | */ | ||
1276 | void omap3isp_csi2_cleanup(struct isp_device *isp) | ||
1277 | { | ||
1278 | struct isp_csi2_device *csi2a = &isp->isp_csi2a; | ||
1279 | |||
1280 | omap3isp_video_cleanup(&csi2a->video_out); | ||
1281 | media_entity_cleanup(&csi2a->subdev.entity); | ||
1282 | } | ||
1283 | |||
1284 | /* | 1273 | /* |
1285 | * omap3isp_csi2_init - Routine for module driver init | 1274 | * omap3isp_csi2_init - Routine for module driver init |
1286 | */ | 1275 | */ |
@@ -1317,3 +1306,14 @@ fail: | |||
1317 | omap3isp_csi2_cleanup(isp); | 1306 | omap3isp_csi2_cleanup(isp); |
1318 | return ret; | 1307 | return ret; |
1319 | } | 1308 | } |
1309 | |||
1310 | /* | ||
1311 | * omap3isp_csi2_cleanup - Routine for module driver cleanup | ||
1312 | */ | ||
1313 | void omap3isp_csi2_cleanup(struct isp_device *isp) | ||
1314 | { | ||
1315 | struct isp_csi2_device *csi2a = &isp->isp_csi2a; | ||
1316 | |||
1317 | omap3isp_video_cleanup(&csi2a->video_out); | ||
1318 | media_entity_cleanup(&csi2a->subdev.entity); | ||
1319 | } | ||
diff --git a/drivers/media/video/omap3isp/isppreview.c b/drivers/media/video/omap3isp/isppreview.c index 84a18b66b23c..b926ebbaca3a 100644 --- a/drivers/media/video/omap3isp/isppreview.c +++ b/drivers/media/video/omap3isp/isppreview.c | |||
@@ -1966,8 +1966,44 @@ static const struct media_entity_operations preview_media_ops = { | |||
1966 | .link_setup = preview_link_setup, | 1966 | .link_setup = preview_link_setup, |
1967 | }; | 1967 | }; |
1968 | 1968 | ||
1969 | void omap3isp_preview_unregister_entities(struct isp_prev_device *prev) | ||
1970 | { | ||
1971 | v4l2_device_unregister_subdev(&prev->subdev); | ||
1972 | omap3isp_video_unregister(&prev->video_in); | ||
1973 | omap3isp_video_unregister(&prev->video_out); | ||
1974 | } | ||
1975 | |||
1976 | int omap3isp_preview_register_entities(struct isp_prev_device *prev, | ||
1977 | struct v4l2_device *vdev) | ||
1978 | { | ||
1979 | int ret; | ||
1980 | |||
1981 | /* Register the subdev and video nodes. */ | ||
1982 | ret = v4l2_device_register_subdev(vdev, &prev->subdev); | ||
1983 | if (ret < 0) | ||
1984 | goto error; | ||
1985 | |||
1986 | ret = omap3isp_video_register(&prev->video_in, vdev); | ||
1987 | if (ret < 0) | ||
1988 | goto error; | ||
1989 | |||
1990 | ret = omap3isp_video_register(&prev->video_out, vdev); | ||
1991 | if (ret < 0) | ||
1992 | goto error; | ||
1993 | |||
1994 | return 0; | ||
1995 | |||
1996 | error: | ||
1997 | omap3isp_preview_unregister_entities(prev); | ||
1998 | return ret; | ||
1999 | } | ||
2000 | |||
2001 | /* ----------------------------------------------------------------------------- | ||
2002 | * ISP previewer initialisation and cleanup | ||
2003 | */ | ||
2004 | |||
1969 | /* | 2005 | /* |
1970 | * review_init_entities - Initialize subdev and media entity. | 2006 | * preview_init_entities - Initialize subdev and media entity. |
1971 | * @prev : Pointer to preview structure | 2007 | * @prev : Pointer to preview structure |
1972 | * return -ENOMEM or zero on success | 2008 | * return -ENOMEM or zero on success |
1973 | */ | 2009 | */ |
@@ -2044,52 +2080,6 @@ static int preview_init_entities(struct isp_prev_device *prev) | |||
2044 | return 0; | 2080 | return 0; |
2045 | } | 2081 | } |
2046 | 2082 | ||
2047 | void omap3isp_preview_unregister_entities(struct isp_prev_device *prev) | ||
2048 | { | ||
2049 | v4l2_device_unregister_subdev(&prev->subdev); | ||
2050 | omap3isp_video_unregister(&prev->video_in); | ||
2051 | omap3isp_video_unregister(&prev->video_out); | ||
2052 | } | ||
2053 | |||
2054 | int omap3isp_preview_register_entities(struct isp_prev_device *prev, | ||
2055 | struct v4l2_device *vdev) | ||
2056 | { | ||
2057 | int ret; | ||
2058 | |||
2059 | /* Register the subdev and video nodes. */ | ||
2060 | ret = v4l2_device_register_subdev(vdev, &prev->subdev); | ||
2061 | if (ret < 0) | ||
2062 | goto error; | ||
2063 | |||
2064 | ret = omap3isp_video_register(&prev->video_in, vdev); | ||
2065 | if (ret < 0) | ||
2066 | goto error; | ||
2067 | |||
2068 | ret = omap3isp_video_register(&prev->video_out, vdev); | ||
2069 | if (ret < 0) | ||
2070 | goto error; | ||
2071 | |||
2072 | return 0; | ||
2073 | |||
2074 | error: | ||
2075 | omap3isp_preview_unregister_entities(prev); | ||
2076 | return ret; | ||
2077 | } | ||
2078 | |||
2079 | /* ----------------------------------------------------------------------------- | ||
2080 | * ISP previewer initialisation and cleanup | ||
2081 | */ | ||
2082 | |||
2083 | void omap3isp_preview_cleanup(struct isp_device *isp) | ||
2084 | { | ||
2085 | struct isp_prev_device *prev = &isp->isp_prev; | ||
2086 | |||
2087 | v4l2_ctrl_handler_free(&prev->ctrls); | ||
2088 | omap3isp_video_cleanup(&prev->video_in); | ||
2089 | omap3isp_video_cleanup(&prev->video_out); | ||
2090 | media_entity_cleanup(&prev->subdev.entity); | ||
2091 | } | ||
2092 | |||
2093 | /* | 2083 | /* |
2094 | * isp_preview_init - Previewer initialization. | 2084 | * isp_preview_init - Previewer initialization. |
2095 | * @dev : Pointer to ISP device | 2085 | * @dev : Pointer to ISP device |
@@ -2114,3 +2104,13 @@ out: | |||
2114 | 2104 | ||
2115 | return ret; | 2105 | return ret; |
2116 | } | 2106 | } |
2107 | |||
2108 | void omap3isp_preview_cleanup(struct isp_device *isp) | ||
2109 | { | ||
2110 | struct isp_prev_device *prev = &isp->isp_prev; | ||
2111 | |||
2112 | v4l2_ctrl_handler_free(&prev->ctrls); | ||
2113 | omap3isp_video_cleanup(&prev->video_in); | ||
2114 | omap3isp_video_cleanup(&prev->video_out); | ||
2115 | media_entity_cleanup(&prev->subdev.entity); | ||
2116 | } | ||
diff --git a/drivers/media/video/omap3isp/ispresizer.c b/drivers/media/video/omap3isp/ispresizer.c index 78ce0406a232..224b0b90404d 100644 --- a/drivers/media/video/omap3isp/ispresizer.c +++ b/drivers/media/video/omap3isp/ispresizer.c | |||
@@ -1608,6 +1608,42 @@ static const struct media_entity_operations resizer_media_ops = { | |||
1608 | .link_setup = resizer_link_setup, | 1608 | .link_setup = resizer_link_setup, |
1609 | }; | 1609 | }; |
1610 | 1610 | ||
1611 | void omap3isp_resizer_unregister_entities(struct isp_res_device *res) | ||
1612 | { | ||
1613 | v4l2_device_unregister_subdev(&res->subdev); | ||
1614 | omap3isp_video_unregister(&res->video_in); | ||
1615 | omap3isp_video_unregister(&res->video_out); | ||
1616 | } | ||
1617 | |||
1618 | int omap3isp_resizer_register_entities(struct isp_res_device *res, | ||
1619 | struct v4l2_device *vdev) | ||
1620 | { | ||
1621 | int ret; | ||
1622 | |||
1623 | /* Register the subdev and video nodes. */ | ||
1624 | ret = v4l2_device_register_subdev(vdev, &res->subdev); | ||
1625 | if (ret < 0) | ||
1626 | goto error; | ||
1627 | |||
1628 | ret = omap3isp_video_register(&res->video_in, vdev); | ||
1629 | if (ret < 0) | ||
1630 | goto error; | ||
1631 | |||
1632 | ret = omap3isp_video_register(&res->video_out, vdev); | ||
1633 | if (ret < 0) | ||
1634 | goto error; | ||
1635 | |||
1636 | return 0; | ||
1637 | |||
1638 | error: | ||
1639 | omap3isp_resizer_unregister_entities(res); | ||
1640 | return ret; | ||
1641 | } | ||
1642 | |||
1643 | /* ----------------------------------------------------------------------------- | ||
1644 | * ISP resizer initialization and cleanup | ||
1645 | */ | ||
1646 | |||
1611 | /* | 1647 | /* |
1612 | * resizer_init_entities - Initialize resizer subdev and media entity. | 1648 | * resizer_init_entities - Initialize resizer subdev and media entity. |
1613 | * @res : Pointer to resizer device structure | 1649 | * @res : Pointer to resizer device structure |
@@ -1672,51 +1708,6 @@ static int resizer_init_entities(struct isp_res_device *res) | |||
1672 | return 0; | 1708 | return 0; |
1673 | } | 1709 | } |
1674 | 1710 | ||
1675 | void omap3isp_resizer_unregister_entities(struct isp_res_device *res) | ||
1676 | { | ||
1677 | v4l2_device_unregister_subdev(&res->subdev); | ||
1678 | omap3isp_video_unregister(&res->video_in); | ||
1679 | omap3isp_video_unregister(&res->video_out); | ||
1680 | } | ||
1681 | |||
1682 | int omap3isp_resizer_register_entities(struct isp_res_device *res, | ||
1683 | struct v4l2_device *vdev) | ||
1684 | { | ||
1685 | int ret; | ||
1686 | |||
1687 | /* Register the subdev and video nodes. */ | ||
1688 | ret = v4l2_device_register_subdev(vdev, &res->subdev); | ||
1689 | if (ret < 0) | ||
1690 | goto error; | ||
1691 | |||
1692 | ret = omap3isp_video_register(&res->video_in, vdev); | ||
1693 | if (ret < 0) | ||
1694 | goto error; | ||
1695 | |||
1696 | ret = omap3isp_video_register(&res->video_out, vdev); | ||
1697 | if (ret < 0) | ||
1698 | goto error; | ||
1699 | |||
1700 | return 0; | ||
1701 | |||
1702 | error: | ||
1703 | omap3isp_resizer_unregister_entities(res); | ||
1704 | return ret; | ||
1705 | } | ||
1706 | |||
1707 | /* ----------------------------------------------------------------------------- | ||
1708 | * ISP resizer initialization and cleanup | ||
1709 | */ | ||
1710 | |||
1711 | void omap3isp_resizer_cleanup(struct isp_device *isp) | ||
1712 | { | ||
1713 | struct isp_res_device *res = &isp->isp_res; | ||
1714 | |||
1715 | omap3isp_video_cleanup(&res->video_in); | ||
1716 | omap3isp_video_cleanup(&res->video_out); | ||
1717 | media_entity_cleanup(&res->subdev.entity); | ||
1718 | } | ||
1719 | |||
1720 | /* | 1711 | /* |
1721 | * isp_resizer_init - Resizer initialization. | 1712 | * isp_resizer_init - Resizer initialization. |
1722 | * @isp : Pointer to ISP device | 1713 | * @isp : Pointer to ISP device |
@@ -1739,3 +1730,12 @@ out: | |||
1739 | 1730 | ||
1740 | return ret; | 1731 | return ret; |
1741 | } | 1732 | } |
1733 | |||
1734 | void omap3isp_resizer_cleanup(struct isp_device *isp) | ||
1735 | { | ||
1736 | struct isp_res_device *res = &isp->isp_res; | ||
1737 | |||
1738 | omap3isp_video_cleanup(&res->video_in); | ||
1739 | omap3isp_video_cleanup(&res->video_out); | ||
1740 | media_entity_cleanup(&res->subdev.entity); | ||
1741 | } | ||
diff --git a/drivers/media/video/omap3isp/ispstat.c b/drivers/media/video/omap3isp/ispstat.c index bf0e5a771857..b124326d1e7f 100644 --- a/drivers/media/video/omap3isp/ispstat.c +++ b/drivers/media/video/omap3isp/ispstat.c | |||
@@ -1023,24 +1023,6 @@ void omap3isp_stat_dma_isr(struct ispstat *stat) | |||
1023 | __stat_isr(stat, 1); | 1023 | __stat_isr(stat, 1); |
1024 | } | 1024 | } |
1025 | 1025 | ||
1026 | static int isp_stat_init_entities(struct ispstat *stat, const char *name, | ||
1027 | const struct v4l2_subdev_ops *sd_ops) | ||
1028 | { | ||
1029 | struct v4l2_subdev *subdev = &stat->subdev; | ||
1030 | struct media_entity *me = &subdev->entity; | ||
1031 | |||
1032 | v4l2_subdev_init(subdev, sd_ops); | ||
1033 | snprintf(subdev->name, V4L2_SUBDEV_NAME_SIZE, "OMAP3 ISP %s", name); | ||
1034 | subdev->grp_id = 1 << 16; /* group ID for isp subdevs */ | ||
1035 | subdev->flags |= V4L2_SUBDEV_FL_HAS_EVENTS | V4L2_SUBDEV_FL_HAS_DEVNODE; | ||
1036 | v4l2_set_subdevdata(subdev, stat); | ||
1037 | |||
1038 | stat->pad.flags = MEDIA_PAD_FL_SINK; | ||
1039 | me->ops = NULL; | ||
1040 | |||
1041 | return media_entity_init(me, 1, &stat->pad, 0); | ||
1042 | } | ||
1043 | |||
1044 | int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev, | 1026 | int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev, |
1045 | struct v4l2_fh *fh, | 1027 | struct v4l2_fh *fh, |
1046 | struct v4l2_event_subscription *sub) | 1028 | struct v4l2_event_subscription *sub) |
@@ -1071,6 +1053,24 @@ int omap3isp_stat_register_entities(struct ispstat *stat, | |||
1071 | return v4l2_device_register_subdev(vdev, &stat->subdev); | 1053 | return v4l2_device_register_subdev(vdev, &stat->subdev); |
1072 | } | 1054 | } |
1073 | 1055 | ||
1056 | static int isp_stat_init_entities(struct ispstat *stat, const char *name, | ||
1057 | const struct v4l2_subdev_ops *sd_ops) | ||
1058 | { | ||
1059 | struct v4l2_subdev *subdev = &stat->subdev; | ||
1060 | struct media_entity *me = &subdev->entity; | ||
1061 | |||
1062 | v4l2_subdev_init(subdev, sd_ops); | ||
1063 | snprintf(subdev->name, V4L2_SUBDEV_NAME_SIZE, "OMAP3 ISP %s", name); | ||
1064 | subdev->grp_id = 1 << 16; /* group ID for isp subdevs */ | ||
1065 | subdev->flags |= V4L2_SUBDEV_FL_HAS_EVENTS | V4L2_SUBDEV_FL_HAS_DEVNODE; | ||
1066 | v4l2_set_subdevdata(subdev, stat); | ||
1067 | |||
1068 | stat->pad.flags = MEDIA_PAD_FL_SINK; | ||
1069 | me->ops = NULL; | ||
1070 | |||
1071 | return media_entity_init(me, 1, &stat->pad, 0); | ||
1072 | } | ||
1073 | |||
1074 | int omap3isp_stat_init(struct ispstat *stat, const char *name, | 1074 | int omap3isp_stat_init(struct ispstat *stat, const char *name, |
1075 | const struct v4l2_subdev_ops *sd_ops) | 1075 | const struct v4l2_subdev_ops *sd_ops) |
1076 | { | 1076 | { |