OSDN Git Service

media: adv748x: Return to endpoint matching
authorSakari Ailus <sakari.ailus@linux.intel.com>
Fri, 28 Apr 2023 15:09:57 +0000 (17:09 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Thu, 10 Aug 2023 05:57:40 +0000 (07:57 +0200)
Return the two CSI-2 transmitters of adv748x to endpoint matching. This
should make the driver work again as expected.

Fixes: 1029939b3782 ("media: v4l: async: Simplify async sub-device fwnode matching")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/i2c/adv748x/adv748x-csi2.c

index b6f93c1..a5a7cb2 100644 (file)
@@ -296,8 +296,6 @@ int adv748x_csi2_init(struct adv748x_state *state, struct adv748x_csi2 *tx)
        if (!is_tx_enabled(tx))
                return 0;
 
-       /* FIXME: Do endpoint matching again! */
-
        adv748x_subdev_init(&tx->sd, state, &adv748x_csi2_ops,
                            MEDIA_ENT_F_VID_IF_BRIDGE,
                            is_txa(tx) ? "txa" : "txb");
@@ -313,10 +311,15 @@ int adv748x_csi2_init(struct adv748x_state *state, struct adv748x_csi2 *tx)
        if (ret)
                return ret;
 
-       ret = adv748x_csi2_init_controls(tx);
+       ret = v4l2_async_subdev_endpoint_add(&tx->sd,
+                                            of_fwnode_handle(state->endpoints[tx->port]));
        if (ret)
                goto err_free_media;
 
+       ret = adv748x_csi2_init_controls(tx);
+       if (ret)
+               goto err_cleanup_subdev;
+
        ret = v4l2_async_register_subdev(&tx->sd);
        if (ret)
                goto err_free_ctrl;
@@ -325,6 +328,8 @@ int adv748x_csi2_init(struct adv748x_state *state, struct adv748x_csi2 *tx)
 
 err_free_ctrl:
        v4l2_ctrl_handler_free(&tx->ctrl_hdl);
+err_cleanup_subdev:
+       v4l2_subdev_cleanup(&tx->sd);
 err_free_media:
        media_entity_cleanup(&tx->sd.entity);
 
@@ -339,4 +344,5 @@ void adv748x_csi2_cleanup(struct adv748x_csi2 *tx)
        v4l2_async_unregister_subdev(&tx->sd);
        media_entity_cleanup(&tx->sd.entity);
        v4l2_ctrl_handler_free(&tx->ctrl_hdl);
+       v4l2_subdev_cleanup(&tx->sd);
 }