linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
To: Hans Verkuil <hverkuil@xs4all.nl>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	linux-media@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org,
	"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Subject: [RFC 4/5] rcar-vin: Report the completeness of the media graph
Date: Wed, 18 Mar 2020 22:30:50 +0100	[thread overview]
Message-ID: <20200318213051.3200981-5-niklas.soderlund+renesas@ragnatech.se> (raw)
In-Reply-To: <20200318213051.3200981-1-niklas.soderlund+renesas@ragnatech.se>

Implement the graph_complete callback and report if the media graph is
complete or not.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/media/platform/rcar-vin/rcar-core.c | 13 +++++++++++++
 drivers/media/platform/rcar-vin/rcar-vin.h  |  4 ++++
 2 files changed, 17 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c
index 7440c8965d27e64f..21ce3de8168c3224 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -221,8 +221,16 @@ static int rvin_group_link_notify(struct media_link *link, u32 flags,
 	return ret;
 }
 
+static bool rvin_group_graph_complete(struct media_device *mdev)
+{
+	struct rvin_group *group = container_of(mdev, struct rvin_group, mdev);
+
+	return group->complete;
+}
+
 static const struct media_device_ops rvin_media_ops = {
 	.link_notify = rvin_group_link_notify,
+	.graph_complete = rvin_group_graph_complete,
 };
 
 /* -----------------------------------------------------------------------------
@@ -735,6 +743,9 @@ static int rvin_group_notify_complete(struct v4l2_async_notifier *notifier)
 			break;
 		}
 	}
+
+	vin->group->complete = true;
+
 	mutex_unlock(&vin->group->lock);
 
 	return ret;
@@ -761,6 +772,8 @@ static void rvin_group_notify_unbind(struct v4l2_async_notifier *notifier,
 		break;
 	}
 
+	vin->group->complete = false;
+
 	mutex_unlock(&vin->group->lock);
 }
 
diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h
index c19d077ce1cb4f4b..ff04adbb969b07de 100644
--- a/drivers/media/platform/rcar-vin/rcar-vin.h
+++ b/drivers/media/platform/rcar-vin/rcar-vin.h
@@ -263,6 +263,8 @@ struct rvin_dev {
  * @vin:		VIN instances which are part of the group
  * @csi:		array of pairs of fwnode and subdev pointers
  *			to all CSI-2 subdevices.
+ * @complete:		True if all devices of the group are in the media graph,
+ *			false otherwise.
  */
 struct rvin_group {
 	struct kref refcount;
@@ -278,6 +280,8 @@ struct rvin_group {
 		struct fwnode_handle *fwnode;
 		struct v4l2_subdev *subdev;
 	} csi[RVIN_CSI_MAX];
+
+	bool complete;
 };
 
 int rvin_dma_register(struct rvin_dev *vin, int irq);
-- 
2.25.1


  parent reply	other threads:[~2020-03-18 21:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18 21:30 [RFC 0/5] media-device: Report if graph is complete or not Niklas Söderlund
2020-03-18 21:30 ` [RFC 1/5] uapi/linux/media.h: add flag field to struct media_device_info Niklas Söderlund
2020-03-19  2:37   ` Laurent Pinchart
2020-03-19  2:38     ` Laurent Pinchart
2020-06-09 15:16       ` Kieran Bingham
2020-03-18 21:30 ` [RFC 2/5] media-device: Add a graph_complete callback to struct media_device_ops Niklas Söderlund
2020-03-19  2:40   ` Laurent Pinchart
2020-03-18 21:30 ` [RFC 3/5] mc-device.c: If graph completes status is available report it to user-space Niklas Söderlund
2020-06-09 16:12   ` Kieran Bingham
2020-03-18 21:30 ` Niklas Söderlund [this message]
2020-03-19  2:41   ` [RFC 4/5] rcar-vin: Report the completeness of the media graph Laurent Pinchart
2020-03-18 21:30 ` [RFC 5/5] rcar-vin: Do not unregister video device when a subdevice is unbound Niklas Söderlund
2020-03-19  2:43   ` Laurent Pinchart

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=20200318213051.3200981-5-niklas.soderlund+renesas@ragnatech.se \
    --to=niklas.soderlund+renesas@ragnatech.se \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).