[PATCH 3/3] media: i2c: adv748x: add enuminput control to adv748x hdmi subdev

From: Ramzi BEN MEFTAH
Date: Tue Jun 16 2020 - 06:00:48 EST


This patch adds support for enuminput control to the adv748x hdmi subdev.
This will allow userspace for example to query input hdmi signal status.

Signed-off-by: Ramzi BEN MEFTAH <rbmeftah@xxxxxxxxxxxxxx>
---
drivers/media/i2c/adv748x/adv748x-hdmi.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/drivers/media/i2c/adv748x/adv748x-hdmi.c b/drivers/media/i2c/adv748x/adv748x-hdmi.c
index c557f8f..2d748b2 100644
--- a/drivers/media/i2c/adv748x/adv748x-hdmi.c
+++ b/drivers/media/i2c/adv748x/adv748x-hdmi.c
@@ -350,6 +350,22 @@ static int adv748x_hdmi_g_input_status(struct v4l2_subdev *sd, u32 *status)
return 0;
}

+static int adv748x_hdmi_enuminput(struct v4l2_subdev *sd,
+ struct v4l2_input *input)
+{
+ if (input->index != 0)
+ return -EINVAL;
+
+ input->type = V4L2_INPUT_TYPE_CAMERA;
+ input->capabilities = V4L2_IN_CAP_DV_TIMINGS;
+ input->status = V4L2_IN_ST_NO_SIGNAL;
+ input->std = V4L2_STD_UNKNOWN;
+
+ snprintf(input->name, sizeof(input->name), "%s", sd->name);
+
+ return adv748x_hdmi_g_input_status(sd, &input->status);
+}
+
static int adv748x_hdmi_s_stream(struct v4l2_subdev *sd, int enable)
{
struct adv748x_hdmi *hdmi = adv748x_sd_to_hdmi(sd);
@@ -386,6 +402,7 @@ static const struct v4l2_subdev_video_ops adv748x_video_ops_hdmi = {
.g_dv_timings = adv748x_hdmi_g_dv_timings,
.query_dv_timings = adv748x_hdmi_query_dv_timings,
.g_input_status = adv748x_hdmi_g_input_status,
+ .enuminput = adv748x_hdmi_enuminput,
.s_stream = adv748x_hdmi_s_stream,
.g_pixelaspect = adv748x_hdmi_g_pixelaspect,
};
--
2.7.4