@@ -2298,6 +2298,7 @@ static int camss_init_subdevices(struct camss *camss)
22982298}
22992299
23002300/*
2301+ * camss_link_entities - Register subdev nodes and create links
23012302 * camss_link_err - print error in case link creation fails
23022303 * @src_name: name for source of the link
23032304 * @sink_name: name for sink of the link
@@ -2315,64 +2316,14 @@ inline void camss_link_err(struct camss *camss,
23152316}
23162317
23172318/*
2318- * camss_link_entities_csid - Register subdev nodes and create links
2319- * @camss: CAMSS device
2320- *
2321- * Return 0 on success or a negative error code on failure
2322- */
2323- static int camss_link_entities_csid (struct camss * camss )
2324- {
2325- struct media_entity * src_entity ;
2326- struct media_entity * sink_entity ;
2327- int ret , line_num ;
2328- u16 sink_pad ;
2329- u16 src_pad ;
2330- int i , j ;
2331-
2332- for (i = 0 ; i < camss -> res -> csid_num ; i ++ ) {
2333- if (camss -> ispif )
2334- line_num = camss -> ispif -> line_num ;
2335- else
2336- line_num = camss -> vfe [i ].res -> line_num ;
2337-
2338- src_entity = & camss -> csid [i ].subdev .entity ;
2339- for (j = 0 ; j < line_num ; j ++ ) {
2340- if (camss -> ispif ) {
2341- sink_entity = & camss -> ispif -> line [j ].subdev .entity ;
2342- src_pad = MSM_CSID_PAD_SRC ;
2343- sink_pad = MSM_ISPIF_PAD_SINK ;
2344- } else {
2345- sink_entity = & camss -> vfe [i ].line [j ].subdev .entity ;
2346- src_pad = MSM_CSID_PAD_FIRST_SRC + j ;
2347- sink_pad = MSM_VFE_PAD_SINK ;
2348- }
2349-
2350- ret = media_create_pad_link (src_entity ,
2351- src_pad ,
2352- sink_entity ,
2353- sink_pad ,
2354- 0 );
2355- if (ret < 0 ) {
2356- camss_link_err (camss , src_entity -> name ,
2357- sink_entity -> name ,
2358- ret );
2359- return ret ;
2360- }
2361- }
2362- }
2363-
2364- return 0 ;
2365- }
2366-
2367- /*
2368- * camss_link_entities_csiphy - Register subdev nodes and create links
2319+ * camss_link_entities - Register subdev nodes and create links
23692320 * @camss: CAMSS device
23702321 *
23712322 * Return 0 on success or a negative error code on failure
23722323 */
2373- static int camss_link_entities_csiphy (struct camss * camss )
2324+ static int camss_link_entities (struct camss * camss )
23742325{
2375- int i , j ;
2326+ int i , j , k ;
23762327 int ret ;
23772328
23782329 for (i = 0 ; i < camss -> res -> csiphy_num ; i ++ ) {
@@ -2392,68 +2343,66 @@ static int camss_link_entities_csiphy(struct camss *camss)
23922343 }
23932344 }
23942345
2395- return 0 ;
2396- }
2397-
2398- /*
2399- * camss_link_entities_ispif - Register subdev nodes and create links
2400- * @camss: CAMSS device
2401- *
2402- * Return 0 on success or a negative error code on failure
2403- */
2404- static int camss_link_entities_ispif (struct camss * camss )
2405- {
2406- int i , j , k ;
2407- int ret ;
2408-
2409- for (i = 0 ; i < camss -> ispif -> line_num ; i ++ ) {
2410- for (k = 0 ; k < camss -> res -> vfe_num ; k ++ ) {
2411- for (j = 0 ; j < camss -> vfe [k ].res -> line_num ; j ++ ) {
2412- struct v4l2_subdev * ispif = & camss -> ispif -> line [i ].subdev ;
2413- struct v4l2_subdev * vfe = & camss -> vfe [k ].line [j ].subdev ;
2414-
2415- ret = media_create_pad_link (& ispif -> entity ,
2416- MSM_ISPIF_PAD_SRC ,
2417- & vfe -> entity ,
2418- MSM_VFE_PAD_SINK ,
2346+ if (camss -> ispif ) {
2347+ for (i = 0 ; i < camss -> res -> csid_num ; i ++ ) {
2348+ for (j = 0 ; j < camss -> ispif -> line_num ; j ++ ) {
2349+ ret = media_create_pad_link (& camss -> csid [i ].subdev .entity ,
2350+ MSM_CSID_PAD_SRC ,
2351+ & camss -> ispif -> line [j ].subdev .entity ,
2352+ MSM_ISPIF_PAD_SINK ,
24192353 0 );
24202354 if (ret < 0 ) {
2421- camss_link_err (camss , ispif -> entity .name ,
2422- vfe -> entity .name ,
2355+ camss_link_err (camss ,
2356+ camss -> csid [i ].subdev .entity .name ,
2357+ camss -> ispif -> line [j ].subdev .entity .name ,
24232358 ret );
24242359 return ret ;
24252360 }
24262361 }
24272362 }
2363+
2364+ for (i = 0 ; i < camss -> ispif -> line_num ; i ++ )
2365+ for (k = 0 ; k < camss -> res -> vfe_num ; k ++ )
2366+ for (j = 0 ; j < camss -> vfe [k ].res -> line_num ; j ++ ) {
2367+ struct v4l2_subdev * ispif = & camss -> ispif -> line [i ].subdev ;
2368+ struct v4l2_subdev * vfe = & camss -> vfe [k ].line [j ].subdev ;
2369+
2370+ ret = media_create_pad_link (& ispif -> entity ,
2371+ MSM_ISPIF_PAD_SRC ,
2372+ & vfe -> entity ,
2373+ MSM_VFE_PAD_SINK ,
2374+ 0 );
2375+ if (ret < 0 ) {
2376+ camss_link_err (camss , ispif -> entity .name ,
2377+ vfe -> entity .name ,
2378+ ret );
2379+ return ret ;
2380+ }
2381+ }
2382+ } else {
2383+ for (i = 0 ; i < camss -> res -> csid_num ; i ++ )
2384+ for (k = 0 ; k < camss -> res -> vfe_num ; k ++ )
2385+ for (j = 0 ; j < camss -> vfe [k ].res -> line_num ; j ++ ) {
2386+ struct v4l2_subdev * csid = & camss -> csid [i ].subdev ;
2387+ struct v4l2_subdev * vfe = & camss -> vfe [k ].line [j ].subdev ;
2388+
2389+ ret = media_create_pad_link (& csid -> entity ,
2390+ MSM_CSID_PAD_FIRST_SRC + j ,
2391+ & vfe -> entity ,
2392+ MSM_VFE_PAD_SINK ,
2393+ 0 );
2394+ if (ret < 0 ) {
2395+ camss_link_err (camss , csid -> entity .name ,
2396+ vfe -> entity .name ,
2397+ ret );
2398+ return ret ;
2399+ }
2400+ }
24282401 }
24292402
24302403 return 0 ;
24312404}
24322405
2433- /*
2434- * camss_link_entities - Register subdev nodes and create links
2435- * @camss: CAMSS device
2436- *
2437- * Return 0 on success or a negative error code on failure
2438- */
2439- static int camss_link_entities (struct camss * camss )
2440- {
2441- int ret ;
2442-
2443- ret = camss_link_entities_csiphy (camss );
2444- if (ret < 0 )
2445- return ret ;
2446-
2447- ret = camss_link_entities_csid (camss );
2448- if (ret < 0 )
2449- return ret ;
2450-
2451- if (camss -> ispif )
2452- ret = camss_link_entities_ispif (camss );
2453-
2454- return ret ;
2455- }
2456-
24572406/*
24582407 * camss_register_entities - Register subdev nodes and create links
24592408 * @camss: CAMSS device
0 commit comments