All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ramzi BEN MEFTAH <rbmeftah@de.adit-jv.com>
To: Kieran Bingham <kieran.bingham@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Janusz Krzysztofik <jmkrzyszt@gmail.com>,
	Jacopo Mondi <jacopo@jmondi.org>,
	Steve Longerbeam <steve_longerbeam@mentor.com>,
	Ezequiel Garcia <ezequiel@collabora.com>,
	Arnd Bergmann <arnd@arndb.de>, <linux-media@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: Michael Rodin <mrodin@de.adit-jv.com>,
	<efriedrich@de.adit-jv.com>, <erosca@de.adit-jv.com>
Subject: [PATCH 2/3] media: i2c: adv748x-afe: Implement enum/get/set input
Date: Tue, 16 Jun 2020 12:00:16 +0200	[thread overview]
Message-ID: <1592301619-17631-2-git-send-email-rbmeftah@de.adit-jv.com> (raw)
In-Reply-To: <1592301619-17631-1-git-send-email-rbmeftah@de.adit-jv.com>

From: Steve Longerbeam <steve_longerbeam@mentor.com>

The adv748x-afe sub-device driver does not support changing the
analog input, so enuminput returns only the status of a single
input at index=0. Likewise g_input returns only index 0, and s_input
returns -EINVAL if index is not 0, and otherwise does nothing.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
(cherry picked from ADIT v4.14 commit 8aadc35d3ae252a1eaed8506fbd1675911465bbd)
---
 drivers/media/i2c/adv748x/adv748x-afe.c | 42 ++++++++++++++++++++++++++++++---
 1 file changed, 39 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/adv748x/adv748x-afe.c b/drivers/media/i2c/adv748x/adv748x-afe.c
index dbbb1e4..6b090f4 100644
--- a/drivers/media/i2c/adv748x/adv748x-afe.c
+++ b/drivers/media/i2c/adv748x/adv748x-afe.c
@@ -154,7 +154,7 @@ static void adv748x_afe_set_video_standard(struct adv748x_state *state,
 		   (sdpstd & 0xf) << ADV748X_SDP_VID_SEL_SHIFT);
 }
 
-static int adv748x_afe_s_input(struct adv748x_afe *afe, unsigned int input)
+static int adv748x_afe_set_input(struct adv748x_afe *afe, unsigned int input)
 {
 	struct adv748x_state *state = adv748x_afe_to_state(afe);
 
@@ -267,6 +267,39 @@ static int adv748x_afe_g_input_status(struct v4l2_subdev *sd, u32 *status)
 	return ret;
 }
 
+static int adv748x_afe_enuminput(struct v4l2_subdev *sd,
+				 struct v4l2_input *input)
+{
+	struct adv748x_afe *afe = adv748x_sd_to_afe(sd);
+
+	if (input->index != 0)
+		return -EINVAL;
+
+	input->type = V4L2_INPUT_TYPE_CAMERA;
+	input->capabilities = V4L2_IN_CAP_STD;
+	input->status = V4L2_IN_ST_NO_SIGNAL;
+	/* API says we must return all supported standards */
+	input->std = V4L2_STD_ALL;
+
+	snprintf(input->name, sizeof(input->name), "%s AIN%u",
+		 sd->name, afe->input);
+
+	return adv748x_afe_g_input_status(sd, &input->status);
+}
+
+static int adv748x_afe_g_input(struct v4l2_subdev *sd, u32 *index)
+{
+	*index = 0;
+	return 0;
+}
+
+static int adv748x_afe_s_input(struct v4l2_subdev *sd, u32 index)
+{
+	if (index != 0)
+		return -EINVAL;
+	return 0;
+}
+
 static int adv748x_afe_s_stream(struct v4l2_subdev *sd, int enable)
 {
 	struct adv748x_afe *afe = adv748x_sd_to_afe(sd);
@@ -277,7 +310,7 @@ static int adv748x_afe_s_stream(struct v4l2_subdev *sd, int enable)
 	mutex_lock(&state->mutex);
 
 	if (enable) {
-		ret = adv748x_afe_s_input(afe, afe->input);
+		ret = adv748x_afe_set_input(afe, afe->input);
 		if (ret)
 			goto unlock;
 	}
@@ -306,6 +339,9 @@ static const struct v4l2_subdev_video_ops adv748x_afe_video_ops = {
 	.querystd = adv748x_afe_querystd,
 	.g_tvnorms = adv748x_afe_g_tvnorms,
 	.g_input_status = adv748x_afe_g_input_status,
+	.enuminput = adv748x_afe_enuminput,
+	.g_input = adv748x_afe_g_input,
+	.s_input = adv748x_afe_s_input,
 	.s_stream = adv748x_afe_s_stream,
 	.g_pixelaspect = adv748x_afe_g_pixelaspect,
 };
@@ -520,7 +556,7 @@ int adv748x_afe_init(struct adv748x_afe *afe)
 		}
 	}
 
-	adv748x_afe_s_input(afe, afe->input);
+	adv748x_afe_set_input(afe, afe->input);
 
 	adv_dbg(state, "AFE Default input set to %d\n", afe->input);
 
-- 
2.7.4


  reply	other threads:[~2020-06-16 10:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Ramzi BEN MEFTAH [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1592301619-17631-2-git-send-email-rbmeftah@de.adit-jv.com \
    --to=rbmeftah@de.adit-jv.com \
    --cc=arnd@arndb.de \
    --cc=efriedrich@de.adit-jv.com \
    --cc=erosca@de.adit-jv.com \
    --cc=ezequiel@collabora.com \
    --cc=hans.verkuil@cisco.com \
    --cc=jacopo@jmondi.org \
    --cc=jmkrzyszt@gmail.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mrodin@de.adit-jv.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=steve_longerbeam@mentor.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.