* [PATCH] media: platform: Delay registering rkisp1 media device
@ 2026-09-02 9:45 Daniel Scally
0 siblings, 0 replies; only message in thread
From: Daniel Scally @ 2026-09-02 9:45 UTC (permalink / raw)
To: linux-media, Dafna Hirschfeld, Heiko Stuebner
Cc: laurent.pinchart, linux-rockchip, Kieran Bingham, Daniel Scally
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-02 9:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-02 9:45 [PATCH] media: platform: Delay registering rkisp1 media device Daniel Scally
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox