]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: add flags field to struct media_v2_entity
authorHans Verkuil <hansverk@cisco.com>
Wed, 28 Feb 2018 10:41:11 +0000 (05:41 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 25 Jul 2018 11:46:24 +0000 (07:46 -0400)
The v2 entity structure never exposed the entity flags, which made it
impossible to detect connector or default entities.

It is really trivial to just expose this information, so implement this.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/media-device.c
include/uapi/linux/media.h

index 047d38372a270cda2a295e63aeee911afe1e8419..14959b19a342935b595f385c977955b1fff4d0cc 100644 (file)
@@ -266,6 +266,7 @@ static long media_device_get_topology(struct media_device *mdev, void *arg)
                memset(&kentity, 0, sizeof(kentity));
                kentity.id = entity->graph_obj.id;
                kentity.function = entity->function;
+               kentity.flags = entity->flags;
                strlcpy(kentity.name, entity->name,
                        sizeof(kentity.name));
 
index f6338bd57929f06a9c9964dde1a84a5cf952901b..ebd2cda678339789689ca59545878c5794ea867a 100644 (file)
@@ -280,11 +280,21 @@ struct media_links_enum {
  * MC next gen API definitions
  */
 
+/*
+ * Appeared in 4.19.0.
+ *
+ * The media_version argument comes from the media_version field in
+ * struct media_device_info.
+ */
+#define MEDIA_V2_ENTITY_HAS_FLAGS(media_version) \
+       ((media_version) >= ((4 << 16) | (19 << 8) | 0))
+
 struct media_v2_entity {
        __u32 id;
        char name[64];
        __u32 function;         /* Main function of the entity */
-       __u32 reserved[6];
+       __u32 flags;
+       __u32 reserved[5];
 } __attribute__ ((packed));
 
 /* Should match the specific fields at media_intf_devnode */