[RFC 4/5] rcar-vin: Report the completeness of the media graph

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux