Em Tue, 13 Oct 2015 01:25:35 +0300 Sakari Ailus sakari.ailus@iki.fi escreveu:
Hi Mauro,
On Mon, Oct 12, 2015 at 01:43:32PM -0300, Mauro Carvalho Chehab wrote:
Instead of abusing MEDIA_ENT_T_V4L2_SUBDEV, initialize new subdev entities as MEDIA_ENT_T_UNKNOWN.
Change-Id: I294ee20f49b6c40dd95339d6730d90fa85b0dea9 Signed-off-by: Mauro Carvalho Chehab mchehab@osg.samsung.com Acked-by: Hans Verkuil hans.verkuil@cisco.com
drivers/media/media-device.c | 6 ++++++ drivers/media/v4l2-core/v4l2-subdev.c | 2 +- include/uapi/linux/media.h | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index 659507bce63f..134fe7510195 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c @@ -435,6 +435,12 @@ int __must_check media_device_register_entity(struct media_device *mdev, { int i;
- if (entity->type == MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN ||
entity->type == MEDIA_ENT_T_UNKNOWN)
dev_warn(mdev->dev,
"Entity type for entity %s was not initialized!\n",
entity->name);
I don't think I'd warn about MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN --- there are entities that do not fall into any category of existing functions. For instance image signal processors have such; they are hardware specific and often their functionality is somewhat so as well. Some of them perform a variety of functions (image processing algorithms) but I doubt it'd make sense to start e.g. listing those until we have any standardised interface for them.
The two entities in smiapp don't have a specific function either. Adding a new one (scaler) might make sense for the two, but I think I'd leave that out from this set.
IMHO, if the entity function is really unknown, it shouldn't even be at the graph in the first place, as an unknown entity can't be controlled.
So, I think we should either add a new function for those entities, for them to be used on userspace, or simply remove them, if they won't be used on userspace, because they aren't documented.
Regards, Mauro
- /* Warn if we apparently re-register an entity */ WARN_ON(entity->graph_obj.mdev != NULL); entity->graph_obj.mdev = mdev;
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 60da43772de9..b3bcc8253182 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -584,7 +584,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops) sd->host_priv = NULL; #if defined(CONFIG_MEDIA_CONTROLLER) sd->entity.name = sd->name;
- sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
- sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN;
#endif } EXPORT_SYMBOL(v4l2_subdev_init); diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h index f8725b881a1d..3d6210095336 100644 --- a/include/uapi/linux/media.h +++ b/include/uapi/linux/media.h @@ -42,6 +42,14 @@ struct media_device_info {
#define MEDIA_ENT_ID_FLAG_NEXT (1 << 31)
+/* Used values for media_entity_desc::type */
+/*
- Initial value to be used when a new entity is created
- Drivers should change it to something useful
- */
+#define MEDIA_ENT_T_UNKNOWN 0x00000000
/*
- Base numbers for entity types
@@ -75,6 +83,15 @@ struct media_device_info { #define MEDIA_ENT_T_V4L2_SWRADIO (MEDIA_ENT_T_V4L2_BASE + 6)
/* V4L2 Sub-device entities */
- /*
* Subdevs are initialized with MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN,
* in order to preserve backward compatibility.
* Drivers should change to the proper subdev type before
* registering the entity.
*/
+#define MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN MEDIA_ENT_T_V4L2_SUBDEV_BASE
#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 1) #define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 2) #define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 3)