Linux Media Controller development
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-media@vger.kernel.org
Cc: Jacopo Mondi <jacopo@jmondi.org>,
	Paul Elder <paul.elder@ideasonboard.com>,
	Rui Miguel Silva <rmfrfs@gmail.com>,
	kernel@pengutronix.de, linux-imx@nxp.com
Subject: [PATCH 1/4] media: imx: imx-mipi-csis: Set the subdev fwnode for endpoint matching
Date: Wed, 15 Jun 2022 22:25:59 +0300	[thread overview]
Message-ID: <20220615192602.25472-2-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <20220615192602.25472-1-laurent.pinchart@ideasonboard.com>

Endpoint matching is preferred over device matching with the async
notifier framework. Set the fwnode in the v4l2_subdev for the CSIS to
the endpoint connected to the next device.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/platform/nxp/imx-mipi-csis.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
index 80b1c021d14a..09a220c1bfe8 100644
--- a/drivers/media/platform/nxp/imx-mipi-csis.c
+++ b/drivers/media/platform/nxp/imx-mipi-csis.c
@@ -1378,6 +1378,13 @@ static int mipi_csis_subdev_init(struct mipi_csis_device *csis)
 
 	sd->dev = csis->dev;
 
+	sd->fwnode = fwnode_graph_get_endpoint_by_id(dev_fwnode(csis->dev),
+						     1, 0, 0);
+	if (!sd->fwnode) {
+		dev_err(csis->dev, "Unable to retrieve endpoint for port@1\n");
+		return -ENOENT;
+	}
+
 	csis->csis_fmt = &mipi_csis_formats[0];
 	mipi_csis_init_cfg(sd, NULL);
 
@@ -1498,6 +1505,7 @@ static int mipi_csis_probe(struct platform_device *pdev)
 	v4l2_async_unregister_subdev(&csis->sd);
 disable_clock:
 	mipi_csis_clk_disable(csis);
+	fwnode_handle_put(csis->sd.fwnode);
 	mutex_destroy(&csis->lock);
 
 	return ret;
@@ -1517,6 +1525,7 @@ static int mipi_csis_remove(struct platform_device *pdev)
 	mipi_csis_runtime_suspend(&pdev->dev);
 	mipi_csis_clk_disable(csis);
 	media_entity_cleanup(&csis->sd.entity);
+	fwnode_handle_put(csis->sd.fwnode);
 	mutex_destroy(&csis->lock);
 	pm_runtime_set_suspended(&pdev->dev);
 
-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2022-06-15 19:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-15 19:25 [PATCH 0/4] media: imx: imx-mipi-csis: Add i.MX8MP support Laurent Pinchart
2022-06-15 19:25 ` Laurent Pinchart [this message]
2022-06-15 23:50   ` [PATCH 1/4] media: imx: imx-mipi-csis: Set the subdev fwnode for endpoint matching Rui Miguel Silva
2022-06-15 19:26 ` [PATCH 2/4] media: imx: imx-mipi-csis: Add version register Laurent Pinchart
2022-06-15 23:51   ` Rui Miguel Silva
2022-06-15 19:26 ` [PATCH 3/4] media: imx: imx-mipi-csis: Implement the .get_frame_desc() operation Laurent Pinchart
2022-06-15 23:53   ` Rui Miguel Silva
2022-06-15 23:59     ` Laurent Pinchart
2022-06-16  0:09       ` Rui Miguel Silva
2022-06-15 19:26 ` [PATCH 4/4] dt-bindings: media: nxp,imx-mipi-csi2: i.MX8MP support Laurent Pinchart
2022-06-15 21:01   ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220615192602.25472-2-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=jacopo@jmondi.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-imx@nxp.com \
    --cc=linux-media@vger.kernel.org \
    --cc=paul.elder@ideasonboard.com \
    --cc=rmfrfs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox