linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] v4l2-subdev: Add subdev ioctl support for ENUM/GET/SET INPUT
@ 2020-06-16 10:00 Ramzi BEN MEFTAH
  2020-06-16 10:00 ` [PATCH 2/3] media: i2c: adv748x-afe: Implement enum/get/set input Ramzi BEN MEFTAH
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Ramzi BEN MEFTAH @ 2020-06-16 10:00 UTC (permalink / raw)
  To: Kieran Bingham, Mauro Carvalho Chehab, Hans Verkuil,
	Sakari Ailus, Janusz Krzysztofik, Jacopo Mondi, Steve Longerbeam,
	Ezequiel Garcia, Arnd Bergmann, linux-media, linux-kernel
  Cc: Michael Rodin, efriedrich, erosca

From: Steve Longerbeam <steve_longerbeam@mentor.com>

This commit enables VIDIOC_ENUMINPUT, VIDIOC_G_INPUT, and VIDIOC_S_INPUT
ioctls for use via v4l2 subdevice node.

This commit should probably not be pushed upstream, because the (old)
idea of video inputs conflicts with the newer concept of establishing
media links between src->sink pads.

However it might make sense for some subdevices to support enum/get/set
inputs. One example would be the analog front end subdevice for the
ADV748x. By providing these ioctls, selecting the ADV748x analog inputs
can be done without requiring the implementation of media entities that
would define the analog source for which to establish a media link.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
---
 drivers/media/v4l2-core/v4l2-subdev.c |  9 +++++++++
 include/media/v4l2-subdev.h           | 11 +++++++++++
 2 files changed, 20 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index 6b989fe..73fbfe9 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -378,6 +378,15 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
 			return -ENOTTY;
 		return v4l2_querymenu(vfh->ctrl_handler, arg);
 
+	case VIDIOC_ENUMINPUT:
+		return v4l2_subdev_call(sd, video, enuminput, arg);
+
+	case VIDIOC_G_INPUT:
+		return v4l2_subdev_call(sd, video, g_input, arg);
+
+	case VIDIOC_S_INPUT:
+		return v4l2_subdev_call(sd, video, s_input, *(u32 *)arg);
+
 	case VIDIOC_G_CTRL:
 		if (!vfh->ctrl_handler)
 			return -ENOTTY;
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index f7fe78a..6e1a9cd 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -383,6 +383,14 @@ struct v4l2_mbus_frame_desc {
  * @g_input_status: get input status. Same as the status field in the
  *	&struct &v4l2_input
  *
+ * @enuminput: enumerate inputs. Should return the same input status as
+ *      @g_input_status if the passed input index is the currently active
+ *      input.
+ *
+ * @g_input: returns the currently active input index.
+ *
+ * @s_input: set the active input.
+ *
  * @s_stream: used to notify the driver that a video stream will start or has
  *	stopped.
  *
@@ -423,6 +431,9 @@ struct v4l2_subdev_video_ops {
 	int (*g_tvnorms)(struct v4l2_subdev *sd, v4l2_std_id *std);
 	int (*g_tvnorms_output)(struct v4l2_subdev *sd, v4l2_std_id *std);
 	int (*g_input_status)(struct v4l2_subdev *sd, u32 *status);
+	int (*enuminput)(struct v4l2_subdev *sd, struct v4l2_input *input);
+	int (*g_input)(struct v4l2_subdev *sd, u32 *index);
+	int (*s_input)(struct v4l2_subdev *sd, u32 index);
 	int (*s_stream)(struct v4l2_subdev *sd, int enable);
 	int (*g_pixelaspect)(struct v4l2_subdev *sd, struct v4l2_fract *aspect);
 	int (*g_frame_interval)(struct v4l2_subdev *sd,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2020-06-29 21:04 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-16 10:00 [PATCH 1/3] v4l2-subdev: Add subdev ioctl support for ENUM/GET/SET INPUT Ramzi BEN MEFTAH
2020-06-16 10:00 ` [PATCH 2/3] media: i2c: adv748x-afe: Implement enum/get/set input Ramzi BEN MEFTAH
2020-06-16 10:00 ` [PATCH 3/3] media: i2c: adv748x: add enuminput control to adv748x hdmi subdev Ramzi BEN MEFTAH
2020-06-24  7:53 ` [PATCH 1/3] v4l2-subdev: Add subdev ioctl support for ENUM/GET/SET INPUT Jacopo Mondi
2020-06-25  2:01   ` Laurent Pinchart
2020-06-25  9:30     ` Ramzi Ben Meftah
2020-06-25  9:47       ` Laurent Pinchart
2020-06-25 10:18         ` Ramzi Ben Meftah
2020-06-25 10:29           ` Laurent Pinchart
2020-06-25 10:35             ` Hans Verkuil
2020-06-26  9:09               ` Ramzi Ben Meftah
2020-06-26  9:15                 ` Ramzi Ben Meftah
2020-06-26  9:25                 ` Hans Verkuil
2020-06-26 10:28                   ` Ramzi Ben Meftah
2020-06-25 17:41     ` Steve Longerbeam
2020-06-26  1:12       ` Laurent Pinchart
2020-06-29  9:24         ` Ramzi Ben Meftah
2020-06-29  9:34           ` Laurent Pinchart
2020-06-24 10:08 ` Hans Verkuil
2020-06-24 10:16   ` Hans Verkuil

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).