summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-06-14 21:10:46 +0200
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-07-17 13:06:35 +0200
commitcf7a8e248028009c314996b0a285bf8a35949736 (patch)
tree6af3dd75930cea84d93fa9a5fe0737ba6e627f3e /drivers/media
parentmedia: rkisp1: Create link from sensor to ISP at notifier bound time (diff)
downloadlinux-cf7a8e248028009c314996b0a285bf8a35949736.tar.xz
linux-cf7a8e248028009c314996b0a285bf8a35949736.zip
media: rkisp1: Create internal links at probe time
There's no need to wait until all async subdevs are bound before creating internal links. Create them at probe time. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c105
1 files changed, 49 insertions, 56 deletions
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
index 1b3c3881ca89..4400dc0117a5 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
@@ -109,50 +109,6 @@ struct rkisp1_isr_data {
* Sensor DT bindings
*/
-static int rkisp1_create_links(struct rkisp1_device *rkisp1)
-{
- unsigned int i;
- int ret;
-
- /* create ISP->RSZ->CAP links */
- for (i = 0; i < 2; i++) {
- struct media_entity *resizer =
- &rkisp1->resizer_devs[i].sd.entity;
- struct media_entity *capture =
- &rkisp1->capture_devs[i].vnode.vdev.entity;
-
- ret = media_create_pad_link(&rkisp1->isp.sd.entity,
- RKISP1_ISP_PAD_SOURCE_VIDEO,
- resizer, RKISP1_RSZ_PAD_SINK,
- MEDIA_LNK_FL_ENABLED);
- if (ret)
- return ret;
-
- ret = media_create_pad_link(resizer, RKISP1_RSZ_PAD_SRC,
- capture, 0,
- MEDIA_LNK_FL_ENABLED |
- MEDIA_LNK_FL_IMMUTABLE);
- if (ret)
- return ret;
- }
-
- /* params links */
- ret = media_create_pad_link(&rkisp1->params.vnode.vdev.entity, 0,
- &rkisp1->isp.sd.entity,
- RKISP1_ISP_PAD_SINK_PARAMS,
- MEDIA_LNK_FL_ENABLED |
- MEDIA_LNK_FL_IMMUTABLE);
- if (ret)
- return ret;
-
- /* 3A stats links */
- return media_create_pad_link(&rkisp1->isp.sd.entity,
- RKISP1_ISP_PAD_SOURCE_STATS,
- &rkisp1->stats.vnode.vdev.entity, 0,
- MEDIA_LNK_FL_ENABLED |
- MEDIA_LNK_FL_IMMUTABLE);
-}
-
static int rkisp1_subdev_notifier_bound(struct v4l2_async_notifier *notifier,
struct v4l2_subdev *sd,
struct v4l2_async_subdev *asd)
@@ -210,19 +166,8 @@ static int rkisp1_subdev_notifier_complete(struct v4l2_async_notifier *notifier)
{
struct rkisp1_device *rkisp1 =
container_of(notifier, struct rkisp1_device, notifier);
- int ret;
-
- ret = rkisp1_create_links(rkisp1);
- if (ret)
- return ret;
-
- ret = v4l2_device_register_subdev_nodes(&rkisp1->v4l2_dev);
- if (ret)
- return ret;
-
- dev_dbg(rkisp1->dev, "Async subdev notifier completed\n");
- return 0;
+ return v4l2_device_register_subdev_nodes(&rkisp1->v4l2_dev);
}
static const struct v4l2_async_notifier_operations rkisp1_subdev_notifier_ops = {
@@ -332,6 +277,50 @@ static const struct dev_pm_ops rkisp1_pm_ops = {
* Core
*/
+static int rkisp1_create_links(struct rkisp1_device *rkisp1)
+{
+ unsigned int i;
+ int ret;
+
+ /* create ISP->RSZ->CAP links */
+ for (i = 0; i < 2; i++) {
+ struct media_entity *resizer =
+ &rkisp1->resizer_devs[i].sd.entity;
+ struct media_entity *capture =
+ &rkisp1->capture_devs[i].vnode.vdev.entity;
+
+ ret = media_create_pad_link(&rkisp1->isp.sd.entity,
+ RKISP1_ISP_PAD_SOURCE_VIDEO,
+ resizer, RKISP1_RSZ_PAD_SINK,
+ MEDIA_LNK_FL_ENABLED);
+ if (ret)
+ return ret;
+
+ ret = media_create_pad_link(resizer, RKISP1_RSZ_PAD_SRC,
+ capture, 0,
+ MEDIA_LNK_FL_ENABLED |
+ MEDIA_LNK_FL_IMMUTABLE);
+ if (ret)
+ return ret;
+ }
+
+ /* params links */
+ ret = media_create_pad_link(&rkisp1->params.vnode.vdev.entity, 0,
+ &rkisp1->isp.sd.entity,
+ RKISP1_ISP_PAD_SINK_PARAMS,
+ MEDIA_LNK_FL_ENABLED |
+ MEDIA_LNK_FL_IMMUTABLE);
+ if (ret)
+ return ret;
+
+ /* 3A stats links */
+ return media_create_pad_link(&rkisp1->isp.sd.entity,
+ RKISP1_ISP_PAD_SOURCE_STATS,
+ &rkisp1->stats.vnode.vdev.entity, 0,
+ MEDIA_LNK_FL_ENABLED |
+ MEDIA_LNK_FL_IMMUTABLE);
+}
+
static void rkisp1_entities_unregister(struct rkisp1_device *rkisp1)
{
rkisp1_params_unregister(rkisp1);
@@ -365,6 +354,10 @@ static int rkisp1_entities_register(struct rkisp1_device *rkisp1)
if (ret)
goto error;
+ ret = rkisp1_create_links(rkisp1);
+ if (ret)
+ goto error;
+
ret = rkisp1_subdev_notifier(rkisp1);
if (ret) {
dev_err(rkisp1->dev,