From: Daniel Scally <dan.scally@ideasonboard.com>
To: linux-media@vger.kernel.org,
Dafna Hirschfeld <dafna@fastmail.com>,
Heiko Stuebner <heiko@sntech.de>
Cc: laurent.pinchart@ideasonboard.com,
linux-rockchip@lists.infradead.org,
Kieran Bingham <kieran.bingham@ideasonboard.com>,
Daniel Scally <dan.scally@ideasonboard.com>
Subject: [PATCH] media: platform: Delay registering rkisp1 media device
Date: Wed, 02 Sep 2026 10:45:43 +0100 [thread overview]
Message-ID: <20260902-enumeration-v1-1-0cb266dd6d41@ideasonboard.com> (raw)
The rkisp1 driver registers its media device before creating entities
or registering the v4l2-async notifier to which the CSI-2 driver (and
by extension the sensor driver) will bind. This means that the media
device node will be visible to userspace before the media graph is
fully prepared.
Delay the registration until the ISP's notifier's .complete()
callback. As this is the parent callback, that will mean that all
v4l2-async subdevices must have bound and the graph must therefore be
fully ready at this point.
Suggested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
---
.../media/platform/rockchip/rkisp1/rkisp1-dev.c | 35 +++++++++++++++-------
1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
index 1791c02a40ae18205f5eb2fd6edca6cda6b459bf..8d423441824ca836dacb0aa1e00cdfc774e61e2e 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
@@ -165,8 +165,31 @@ static int rkisp1_subdev_notifier_complete(struct v4l2_async_notifier *notifier)
{
struct rkisp1_device *rkisp1 =
container_of(notifier, struct rkisp1_device, notifier);
+ struct v4l2_subdev *sd;
+ int ret;
+
+ ret = v4l2_device_register_subdev_nodes(&rkisp1->v4l2_dev);
+ if (ret)
+ return ret;
+
+ ret = media_device_register(&rkisp1->media_dev);
+ if (ret) {
+ dev_err(rkisp1->dev, "Failed to register media device: %d\n", ret);
+ goto err_unreg_v4l2_subdev_nodes;
+ }
+
+ return 0;
- return v4l2_device_register_subdev_nodes(&rkisp1->v4l2_dev);
+err_unreg_v4l2_subdev_nodes:
+ list_for_each_entry(sd, &rkisp1->v4l2_dev.subdevs, list) {
+ if (!sd->devnode)
+ break;
+
+ media_devnode_remove(sd->devnode->intf_devnode);
+ video_unregister_device(sd->devnode);
+ }
+
+ return ret;
}
static void rkisp1_subdev_notifier_destroy(struct v4l2_async_connection *asc)
@@ -753,16 +776,10 @@ static int rkisp1_probe(struct platform_device *pdev)
if (ret)
goto err_media_dev_cleanup;
- ret = media_device_register(&rkisp1->media_dev);
- if (ret) {
- dev_err(dev, "Failed to register media device: %d\n", ret);
- goto err_unreg_v4l2_dev;
- }
-
if (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2) {
ret = rkisp1_csi_init(rkisp1);
if (ret)
- goto err_unreg_media_dev;
+ goto err_unreg_v4l2_dev;
}
ret = rkisp1_entities_register(rkisp1);
@@ -782,8 +799,6 @@ static int rkisp1_probe(struct platform_device *pdev)
err_cleanup_csi:
if (rkisp1_has_feature(rkisp1, MIPI_CSI2))
rkisp1_csi_cleanup(rkisp1);
-err_unreg_media_dev:
- media_device_unregister(&rkisp1->media_dev);
err_unreg_v4l2_dev:
v4l2_device_unregister(&rkisp1->v4l2_dev);
err_media_dev_cleanup:
---
base-commit: 34e31390a3b939db2e0cbfef4c40d95052572df0
change-id: 20260722-enumeration-ae42b36efd04
Best regards,
--
Daniel Scally <dan.scally@ideasonboard.com>
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
reply other threads:[~2026-09-02 9:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260902-enumeration-v1-1-0cb266dd6d41@ideasonboard.com \
--to=dan.scally@ideasonboard.com \
--cc=dafna@fastmail.com \
--cc=heiko@sntech.de \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
/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