[PATCH v2 21/27] media: uapi: Add 'flags' to media_device_info
Jacopo Mondi
jacopo.mondi at ideasonboard.com
Thu Jul 24 07:10:28 PDT 2025
The 'struct media_device_info' type is used to return information
on the media device using the MEDIA_IOC_DEVICE_INFO ioctl.
Add a 'flags' field to the structure by using a 32-bit integers from
the reserved space to report the media device flags to userspace.
Introduce a new flag MEDIA_DEVICE_FL_CONTEXT that allows drivers to
report support for multi-context operations.
Signed-off-by: Jacopo Mondi <jacopo.mondi at ideasonboard.com>
---
.../userspace-api/media/mediactl/media-ioc-device-info.rst | 6 +++++-
Documentation/userspace-api/media/mediactl/media-types.rst | 13 +++++++++++++
drivers/media/mc/mc-device.c | 1 +
include/media/media-device.h | 7 +++++++
include/uapi/linux/media.h | 6 +++++-
5 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/Documentation/userspace-api/media/mediactl/media-ioc-device-info.rst b/Documentation/userspace-api/media/mediactl/media-ioc-device-info.rst
index d56ee6669ab9eb17a77f3714ecd5e3ef9ad65358..f2ff7a2b860cb848683a31d5731a06c782c70316 100644
--- a/Documentation/userspace-api/media/mediactl/media-ioc-device-info.rst
+++ b/Documentation/userspace-api/media/mediactl/media-ioc-device-info.rst
@@ -87,7 +87,11 @@ ioctl never fails.
this identifies a particular driver.
* - __u32
- - ``reserved``\ [31]
+ - ``flags``
+ - Media device flags, see :ref:`media-device-flag` for more details.
+
+ * - __u32
+ - ``reserved``\ [30]
- Reserved for future extensions. Drivers and applications must set
this array to zero.
diff --git a/Documentation/userspace-api/media/mediactl/media-types.rst b/Documentation/userspace-api/media/mediactl/media-types.rst
index 6332e8395263b04935758d42a17adfe690fcd042..40e943af37c08339af928ff89e937740a48893a8 100644
--- a/Documentation/userspace-api/media/mediactl/media-types.rst
+++ b/Documentation/userspace-api/media/mediactl/media-types.rst
@@ -235,6 +235,19 @@ Types and flags used to represent the media graph elements
.. tabularcolumns:: |p{5.5cm}|p{12.0cm}|
+.. _media-device-flag:
+.. _MEDIA-DEVICE-FL-CONTEXT:
+
+.. flat-table:: Media device flags
+ :header-rows: 0
+ :stub-columns: 0
+
+ * - ``MEDIA_DEVICE_FL_CONTEXT``
+ - The media device supports multi-context operations
+
+
+.. tabularcolumns:: |p{5.5cm}|p{12.0cm}|
+
.. _media-entity-flag:
.. _MEDIA-ENT-FL-DEFAULT:
.. _MEDIA-ENT-FL-CONNECTOR:
diff --git a/drivers/media/mc/mc-device.c b/drivers/media/mc/mc-device.c
index e1f34f884fee2e8c3750f9c1e85142ff2f6b7bf0..a5cdc679a4ef11c7ec35dd69ac9987eb5718069f 100644
--- a/drivers/media/mc/mc-device.c
+++ b/drivers/media/mc/mc-device.c
@@ -121,6 +121,7 @@ static long media_device_get_info(struct media_device *dev, void *arg)
info->media_version = LINUX_VERSION_CODE;
info->driver_version = info->media_version;
info->hw_revision = dev->hw_revision;
+ info->flags = dev->flags;
return 0;
}
diff --git a/include/media/media-device.h b/include/media/media-device.h
index b3cc6793a8b5eff4c26e57b01e1a62ab71e8195b..e53334fc21fa353cb3e0e7948b08739855dd07ca 100644
--- a/include/media/media-device.h
+++ b/include/media/media-device.h
@@ -157,6 +157,7 @@ struct media_device_ops {
* @serial: Device serial number (optional)
* @bus_info: Unique and stable device location identifier
* @hw_revision: Hardware device revision
+ * @flags: Media device flags
* @topology_version: Monotonic counter for storing the version of the graph
* topology. Should be incremented each time the topology changes.
* @id: Unique ID used on the last registered graph object
@@ -221,6 +222,11 @@ struct media_device_ops {
* necessary to run @enable_source and @disable_source handlers.
* Callers should hold graph_mutex to access and call @enable_source
* and @disable_source handlers.
+ *
+ * The @flags field reports the media device capabilities:
+ *
+ * %MEDIA_DEVICE_FL_CONTEXT
+ * indicates that the media device supports multi-context operations.
*/
struct media_device {
/* dev->driver_data points to this struct. */
@@ -232,6 +238,7 @@ struct media_device {
char serial[40];
char bus_info[32];
u32 hw_revision;
+ u32 flags;
u64 topology_version;
diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
index 1c80b1d6bbaf36b76aaf1363dec50751469d8fed..f711bdda595718092a294336d4d364ba8296e08d 100644
--- a/include/uapi/linux/media.h
+++ b/include/uapi/linux/media.h
@@ -23,6 +23,9 @@
#include <linux/ioctl.h>
#include <linux/types.h>
+/* Media device flags. */
+#define MEDIA_DEVICE_FL_CONTEXT 0x00000001
+
struct media_device_info {
char driver[16];
char model[32];
@@ -31,7 +34,8 @@ struct media_device_info {
__u32 media_version;
__u32 hw_revision;
__u32 driver_version;
- __u32 reserved[31];
+ __u32 flags;
+ __u32 reserved[30];
};
/*
--
2.49.0
More information about the linux-arm-kernel
mailing list