]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
[media] omap3isp: separate links creation from entities init
authorJavier Martinez Canillas <javier@osg.samsung.com>
Wed, 26 Aug 2015 12:24:45 +0000 (09:24 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 11 Jan 2016 14:18:44 +0000 (12:18 -0200)
The omap3isp driver initializes the entities and creates the pads links
before the entities are registered with the media device. This does not
work now that object IDs are used to create links so the media_device
has to be set.

Split out the pads links creation from the entity initialization so the links
are created after the entities have been registered with the media device.

Suggested-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/omap3isp/isp.c
drivers/media/platform/omap3isp/ispccdc.c
drivers/media/platform/omap3isp/ispccdc.h
drivers/media/platform/omap3isp/ispccp2.c
drivers/media/platform/omap3isp/ispccp2.h
drivers/media/platform/omap3isp/ispcsi2.c
drivers/media/platform/omap3isp/ispcsi2.h
drivers/media/platform/omap3isp/isppreview.c
drivers/media/platform/omap3isp/isppreview.h
drivers/media/platform/omap3isp/ispresizer.c
drivers/media/platform/omap3isp/ispresizer.h

index aa13b17d19a0d036775aac7987921cd55b425348..b8f6f81d2db233d85a32ddad0421b4d42084681c 100644 (file)
@@ -1933,6 +1933,100 @@ static int isp_register_entities(struct isp_device *isp)
        return ret;
 }
 
+/*
+ * isp_create_pads_links - Pads links creation for the subdevices
+ * @isp : Pointer to ISP device
+ * return negative error code or zero on success
+ */
+static int isp_create_pads_links(struct isp_device *isp)
+{
+       int ret;
+
+       ret = omap3isp_csi2_create_pads_links(isp);
+       if (ret < 0) {
+               dev_err(isp->dev, "CSI2 pads links creation failed\n");
+               return ret;
+       }
+
+       ret = omap3isp_ccp2_create_pads_links(isp);
+       if (ret < 0) {
+               dev_err(isp->dev, "CCP2 pads links creation failed\n");
+               return ret;
+       }
+
+       ret = omap3isp_ccdc_create_pads_links(isp);
+       if (ret < 0) {
+               dev_err(isp->dev, "CCDC pads links creation failed\n");
+               return ret;
+       }
+
+       ret = omap3isp_preview_create_pads_links(isp);
+       if (ret < 0) {
+               dev_err(isp->dev, "Preview pads links creation failed\n");
+               return ret;
+       }
+
+       ret = omap3isp_resizer_create_pads_links(isp);
+       if (ret < 0) {
+               dev_err(isp->dev, "Resizer pads links creation failed\n");
+               return ret;
+       }
+
+       /* Connect the submodules. */
+       ret = media_create_pad_link(
+                       &isp->isp_csi2a.subdev.entity, CSI2_PAD_SOURCE,
+                       &isp->isp_ccdc.subdev.entity, CCDC_PAD_SINK, 0);
+       if (ret < 0)
+               return ret;
+
+       ret = media_create_pad_link(
+                       &isp->isp_ccp2.subdev.entity, CCP2_PAD_SOURCE,
+                       &isp->isp_ccdc.subdev.entity, CCDC_PAD_SINK, 0);
+       if (ret < 0)
+               return ret;
+
+       ret = media_create_pad_link(
+                       &isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_VP,
+                       &isp->isp_prev.subdev.entity, PREV_PAD_SINK, 0);
+       if (ret < 0)
+               return ret;
+
+       ret = media_create_pad_link(
+                       &isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_OF,
+                       &isp->isp_res.subdev.entity, RESZ_PAD_SINK, 0);
+       if (ret < 0)
+               return ret;
+
+       ret = media_create_pad_link(
+                       &isp->isp_prev.subdev.entity, PREV_PAD_SOURCE,
+                       &isp->isp_res.subdev.entity, RESZ_PAD_SINK, 0);
+       if (ret < 0)
+               return ret;
+
+       ret = media_create_pad_link(
+                       &isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_VP,
+                       &isp->isp_aewb.subdev.entity, 0,
+                       MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE);
+       if (ret < 0)
+               return ret;
+
+       ret = media_create_pad_link(
+                       &isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_VP,
+                       &isp->isp_af.subdev.entity, 0,
+                       MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE);
+       if (ret < 0)
+               return ret;
+
+       ret = media_create_pad_link(
+                       &isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_VP,
+                       &isp->isp_hist.subdev.entity, 0,
+                       MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE);
+       if (ret < 0)
+               return ret;
+
+       return 0;
+}
+
 static void isp_cleanup_modules(struct isp_device *isp)
 {
        omap3isp_h3a_aewb_cleanup(isp);
@@ -2003,62 +2097,8 @@ static int isp_initialize_modules(struct isp_device *isp)
                goto error_h3a_af;
        }
 
-       /* Connect the submodules. */
-       ret = media_create_pad_link(
-                       &isp->isp_csi2a.subdev.entity, CSI2_PAD_SOURCE,
-                       &isp->isp_ccdc.subdev.entity, CCDC_PAD_SINK, 0);
-       if (ret < 0)
-               goto error_link;
-
-       ret = media_create_pad_link(
-                       &isp->isp_ccp2.subdev.entity, CCP2_PAD_SOURCE,
-                       &isp->isp_ccdc.subdev.entity, CCDC_PAD_SINK, 0);
-       if (ret < 0)
-               goto error_link;
-
-       ret = media_create_pad_link(
-                       &isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_VP,
-                       &isp->isp_prev.subdev.entity, PREV_PAD_SINK, 0);
-       if (ret < 0)
-               goto error_link;
-
-       ret = media_create_pad_link(
-                       &isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_OF,
-                       &isp->isp_res.subdev.entity, RESZ_PAD_SINK, 0);
-       if (ret < 0)
-               goto error_link;
-
-       ret = media_create_pad_link(
-                       &isp->isp_prev.subdev.entity, PREV_PAD_SOURCE,
-                       &isp->isp_res.subdev.entity, RESZ_PAD_SINK, 0);
-       if (ret < 0)
-               goto error_link;
-
-       ret = media_create_pad_link(
-                       &isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_VP,
-                       &isp->isp_aewb.subdev.entity, 0,
-                       MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE);
-       if (ret < 0)
-               goto error_link;
-
-       ret = media_create_pad_link(
-                       &isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_VP,
-                       &isp->isp_af.subdev.entity, 0,
-                       MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE);
-       if (ret < 0)
-               goto error_link;
-
-       ret = media_create_pad_link(
-                       &isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_VP,
-                       &isp->isp_hist.subdev.entity, 0,
-                       MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE);
-       if (ret < 0)
-               goto error_link;
-
        return 0;
 
-error_link:
-       omap3isp_h3a_af_cleanup(isp);
 error_h3a_af:
        omap3isp_h3a_aewb_cleanup(isp);
 error_h3a_aewb:
@@ -2468,6 +2508,10 @@ static int isp_probe(struct platform_device *pdev)
        if (ret < 0)
                goto error_modules;
 
+       ret = isp_create_pads_links(isp);
+       if (ret < 0)
+               goto error_register_entities;
+
        isp->notifier.bound = isp_subdev_notifier_bound;
        isp->notifier.complete = isp_subdev_notifier_complete;
 
index 27555e4f4aa82ddd15d5dbfad18643a72e422762..9a811f5741fa2c2027b1dbf9c7a605e0d5d4adcc 100644 (file)
@@ -2666,16 +2666,8 @@ static int ccdc_init_entities(struct isp_ccdc_device *ccdc)
        if (ret < 0)
                goto error_video;
 
-       /* Connect the CCDC subdev to the video node. */
-       ret = media_create_pad_link(&ccdc->subdev.entity, CCDC_PAD_SOURCE_OF,
-                       &ccdc->video_out.video.entity, 0, 0);
-       if (ret < 0)
-               goto error_link;
-
        return 0;
 
-error_link:
-       omap3isp_video_cleanup(&ccdc->video_out);
 error_video:
        media_entity_cleanup(me);
        return ret;
@@ -2720,6 +2712,20 @@ int omap3isp_ccdc_init(struct isp_device *isp)
        return 0;
 }
 
+/*
+ * omap3isp_ccdc_create_pads_links - CCDC pads links creation
+ * @isp : Pointer to ISP device
+ * return negative error code or zero on success
+ */
+int omap3isp_ccdc_create_pads_links(struct isp_device *isp)
+{
+       struct isp_ccdc_device *ccdc = &isp->isp_ccdc;
+
+       /* Connect the CCDC subdev to the video node. */
+       return media_create_pad_link(&ccdc->subdev.entity, CCDC_PAD_SOURCE_OF,
+                                    &ccdc->video_out.video.entity, 0, 0);
+}
+
 /*
  * omap3isp_ccdc_cleanup - CCDC module cleanup.
  * @isp: Device pointer specific to the OMAP3 ISP.
index 3440a709794001a68513ba9300e677808b43e401..2128203ef6fb37c3368c5807e7807d5dccccbefe 100644 (file)
@@ -163,6 +163,7 @@ struct isp_ccdc_device {
 struct isp_device;
 
 int omap3isp_ccdc_init(struct isp_device *isp);
+int omap3isp_ccdc_create_pads_links(struct isp_device *isp);
 void omap3isp_ccdc_cleanup(struct isp_device *isp);
 int omap3isp_ccdc_register_entities(struct isp_ccdc_device *ccdc,
        struct v4l2_device *vdev);
index b215eb5049d65a67011aa858f3eca144786390fe..6ec7d104ab75f578833612bed7aa2127c66f6dd1 100644 (file)
@@ -1099,16 +1099,8 @@ static int ccp2_init_entities(struct isp_ccp2_device *ccp2)
        if (ret < 0)
                goto error_video;
 
-       /* Connect the video node to the ccp2 subdev. */
-       ret = media_create_pad_link(&ccp2->video_in.video.entity, 0,
-                                      &ccp2->subdev.entity, CCP2_PAD_SINK, 0);
-       if (ret < 0)
-               goto error_link;
-
        return 0;
 
-error_link:
-       omap3isp_video_cleanup(&ccp2->video_in);
 error_video:
        media_entity_cleanup(&ccp2->subdev.entity);
        return ret;
@@ -1156,6 +1148,20 @@ int omap3isp_ccp2_init(struct isp_device *isp)
        return 0;
 }
 
+/*
+ * omap3isp_ccp2_create_pads_links - CCP2 pads links creation
+ * @isp : Pointer to ISP device
+ * return negative error code or zero on success
+ */
+int omap3isp_ccp2_create_pads_links(struct isp_device *isp)
+{
+       struct isp_ccp2_device *ccp2 = &isp->isp_ccp2;
+
+       /* Connect the video node to the ccp2 subdev. */
+       return media_create_pad_link(&ccp2->video_in.video.entity, 0,
+                                    &ccp2->subdev.entity, CCP2_PAD_SINK, 0);
+}
+
 /*
  * omap3isp_ccp2_cleanup - CCP2 un-initialization
  * @isp : Pointer to ISP device
index 4662bffa79e31a0044e09efe8f09c9042f97869d..fb74bc67878b1dabcbe2e1213e9d80a5420ace12 100644 (file)
@@ -79,6 +79,7 @@ struct isp_ccp2_device {
 
 /* Function declarations */
 int omap3isp_ccp2_init(struct isp_device *isp);
+int omap3isp_ccp2_create_pads_links(struct isp_device *isp);
 void omap3isp_ccp2_cleanup(struct isp_device *isp);
 int omap3isp_ccp2_register_entities(struct isp_ccp2_device *ccp2,
                        struct v4l2_device *vdev);
index fcefc1e74881f6a86f43592e9e6c9287c5bfaa11..0fb057a74f69ed3db0aad9ff9cb39e688470a734 100644 (file)
@@ -1264,16 +1264,8 @@ static int csi2_init_entities(struct isp_csi2_device *csi2)
        if (ret < 0)
                goto error_video;
 
-       /* Connect the CSI2 subdev to the video node. */
-       ret = media_create_pad_link(&csi2->subdev.entity, CSI2_PAD_SOURCE,
-                                      &csi2->video_out.video.entity, 0, 0);
-       if (ret < 0)
-               goto error_link;
-
        return 0;
 
-error_link:
-       omap3isp_video_cleanup(&csi2->video_out);
 error_video:
        media_entity_cleanup(&csi2->subdev.entity);
        return ret;
@@ -1313,6 +1305,20 @@ int omap3isp_csi2_init(struct isp_device *isp)
        return 0;
 }
 
+/*
+ * omap3isp_csi2_create_pads_links - CSI2 pads links creation
+ * @isp : Pointer to ISP device
+ * return negative error code or zero on success
+ */
+int omap3isp_csi2_create_pads_links(struct isp_device *isp)
+{
+       struct isp_csi2_device *csi2a = &isp->isp_csi2a;
+
+       /* Connect the CSI2 subdev to the video node. */
+       return media_create_pad_link(&csi2a->subdev.entity, CSI2_PAD_SOURCE,
+                                    &csi2a->video_out.video.entity, 0, 0);
+}
+
 /*
  * omap3isp_csi2_cleanup - Routine for module driver cleanup
  */
index 453ed62fe3946c7a3dc7fb7cdc2399804fcfc7e1..452ee239c7d77fa21774189e339c317a407508ef 100644 (file)
@@ -148,6 +148,7 @@ struct isp_csi2_device {
 void omap3isp_csi2_isr(struct isp_csi2_device *csi2);
 int omap3isp_csi2_reset(struct isp_csi2_device *csi2);
 int omap3isp_csi2_init(struct isp_device *isp);
+int omap3isp_csi2_create_pads_links(struct isp_device *isp);
 void omap3isp_csi2_cleanup(struct isp_device *isp);
 void omap3isp_csi2_unregister_entities(struct isp_csi2_device *csi2);
 int omap3isp_csi2_register_entities(struct isp_csi2_device *csi2,
index ad38d20c7770252efb00943180aa6ed7951d7a24..6986d2f65c19cd9cca4d35a043433785a64ab141 100644 (file)
@@ -2311,21 +2311,8 @@ static int preview_init_entities(struct isp_prev_device *prev)
        if (ret < 0)
                goto error_video_out;
 
-       /* Connect the video nodes to the previewer subdev. */
-       ret = media_create_pad_link(&prev->video_in.video.entity, 0,
-                       &prev->subdev.entity, PREV_PAD_SINK, 0);
-       if (ret < 0)
-               goto error_link;
-
-       ret = media_create_pad_link(&prev->subdev.entity, PREV_PAD_SOURCE,
-                       &prev->video_out.video.entity, 0, 0);
-       if (ret < 0)
-               goto error_link;
-
        return 0;
 
-error_link:
-       omap3isp_video_cleanup(&prev->video_out);
 error_video_out:
        omap3isp_video_cleanup(&prev->video_in);
 error_video_in:
@@ -2349,6 +2336,26 @@ int omap3isp_preview_init(struct isp_device *isp)
        return preview_init_entities(prev);
 }
 
+/*
+ * omap3isp_preview_create_pads_links - Previewer pads links creation
+ * @isp : Pointer to ISP device
+ * return negative error code or zero on success
+ */
+int omap3isp_preview_create_pads_links(struct isp_device *isp)
+{
+       struct isp_prev_device *prev = &isp->isp_prev;
+       int ret;
+
+       /* Connect the video nodes to the previewer subdev. */
+       ret = media_create_pad_link(&prev->video_in.video.entity, 0,
+                       &prev->subdev.entity, PREV_PAD_SINK, 0);
+       if (ret < 0)
+               return ret;
+
+       return media_create_pad_link(&prev->subdev.entity, PREV_PAD_SOURCE,
+                                    &prev->video_out.video.entity, 0, 0);
+}
+
 void omap3isp_preview_cleanup(struct isp_device *isp)
 {
        struct isp_prev_device *prev = &isp->isp_prev;
index 16fdc03a3d43bfb114d3ee64e6a5e04521cb5357..f3593b7cecc712bfa9e40d202e9ff8fc4e73b67c 100644 (file)
@@ -148,6 +148,7 @@ struct isp_prev_device {
 struct isp_device;
 
 int omap3isp_preview_init(struct isp_device *isp);
+int omap3isp_preview_create_pads_links(struct isp_device *isp);
 void omap3isp_preview_cleanup(struct isp_device *isp);
 
 int omap3isp_preview_register_entities(struct isp_prev_device *prv,
index b48ad4d4b8349109cbdc3ca9b2711556992e39b6..249af7f524f906e51c0e2e3f48307ddb6b05a4ec 100644 (file)
@@ -1755,21 +1755,8 @@ static int resizer_init_entities(struct isp_res_device *res)
 
        res->video_out.video.entity.flags |= MEDIA_ENT_FL_DEFAULT;
 
-       /* Connect the video nodes to the resizer subdev. */
-       ret = media_create_pad_link(&res->video_in.video.entity, 0,
-                       &res->subdev.entity, RESZ_PAD_SINK, 0);
-       if (ret < 0)
-               goto error_link;
-
-       ret = media_create_pad_link(&res->subdev.entity, RESZ_PAD_SOURCE,
-                       &res->video_out.video.entity, 0, 0);
-       if (ret < 0)
-               goto error_link;
-
        return 0;
 
-error_link:
-       omap3isp_video_cleanup(&res->video_out);
 error_video_out:
        omap3isp_video_cleanup(&res->video_in);
 error_video_in:
@@ -1793,6 +1780,26 @@ int omap3isp_resizer_init(struct isp_device *isp)
        return resizer_init_entities(res);
 }
 
+/*
+ * omap3isp_resizer_create_pads_links - Resizer pads links creation
+ * @isp : Pointer to ISP device
+ * return negative error code or zero on success
+ */
+int omap3isp_resizer_create_pads_links(struct isp_device *isp)
+{
+       struct isp_res_device *res = &isp->isp_res;
+       int ret;
+
+       /* Connect the video nodes to the resizer subdev. */
+       ret = media_create_pad_link(&res->video_in.video.entity, 0,
+                                   &res->subdev.entity, RESZ_PAD_SINK, 0);
+       if (ret < 0)
+               return ret;
+
+       return media_create_pad_link(&res->subdev.entity, RESZ_PAD_SOURCE,
+                                    &res->video_out.video.entity, 0, 0);
+}
+
 void omap3isp_resizer_cleanup(struct isp_device *isp)
 {
        struct isp_res_device *res = &isp->isp_res;
index 5414542912e2723b39f0ec034293af10ab7c279c..8b9fdcdab73d8963067f43a215785a70a7ecc3b1 100644 (file)
@@ -119,6 +119,7 @@ struct isp_res_device {
 struct isp_device;
 
 int omap3isp_resizer_init(struct isp_device *isp);
+int omap3isp_resizer_create_pads_links(struct isp_device *isp);
 void omap3isp_resizer_cleanup(struct isp_device *isp);
 
 int omap3isp_resizer_register_entities(struct isp_res_device *res,