linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacopo Mondi <jacopo+renesas@jmondi.org>
To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
	sakari.ailus@linux.intel.com, laurent.pinchart@ideasonboard.com
Cc: Jacopo Mondi <jacopo+renesas@jmondi.org>,
	niklas.soderlund+renesas@ragnatech.se,
	kieran.bingham@ideasonboard.com, dave.stevenson@raspberrypi.com,
	hyun.kwon@xilinx.com, jmkrzyszt@gmail.com,
	robert.jarzmik@free.fr, linux-media@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org,
	Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Subject: [PATCH v6 8/9] media: i2c: adv748x: Implement get_mbus_config
Date: Tue, 14 Jul 2020 15:58:11 +0200	[thread overview]
Message-ID: <20200714135812.55158-9-jacopo+renesas@jmondi.org> (raw)
In-Reply-To: <20200714135812.55158-1-jacopo+renesas@jmondi.org>

Implement the newly introduced get_mbus_config operation to report the
number of currently used data lanes on the MIPI CSI-2 interface.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 drivers/media/i2c/adv748x/adv748x-csi2.c | 31 ++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c
index 2091cda50935..99bb63d05eef 100644
--- a/drivers/media/i2c/adv748x/adv748x-csi2.c
+++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
@@ -214,9 +214,40 @@ static int adv748x_csi2_set_format(struct v4l2_subdev *sd,
 	return ret;
 }
 
+static int adv748x_csi2_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad,
+					struct v4l2_mbus_config *config)
+{
+	struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd);
+
+	if (pad != ADV748X_CSI2_SOURCE)
+		return -EINVAL;
+
+	config->type = V4L2_MBUS_CSI2_DPHY;
+	switch (tx->active_lanes) {
+	case 1:
+		config->flags = V4L2_MBUS_CSI2_1_LANE;
+		break;
+
+	case 2:
+		config->flags = V4L2_MBUS_CSI2_2_LANE;
+		break;
+
+	case 3:
+		config->flags = V4L2_MBUS_CSI2_3_LANE;
+		break;
+
+	case 4:
+		config->flags = V4L2_MBUS_CSI2_4_LANE;
+		break;
+	}
+
+	return 0;
+}
+
 static const struct v4l2_subdev_pad_ops adv748x_csi2_pad_ops = {
 	.get_fmt = adv748x_csi2_get_format,
 	.set_fmt = adv748x_csi2_set_format,
+	.get_mbus_config = adv748x_csi2_get_mbus_config,
 };
 
 /* -----------------------------------------------------------------------------
-- 
2.27.0


  parent reply	other threads:[~2020-07-14 13:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14 13:58 [PATCH v6 0/9] v4l2-subdev: Introduce [g|s]et_mbus_format pad op Jacopo Mondi
2020-07-14 13:58 ` [PATCH v6 1/9] media: v4l2-subdev: Introduce [get|set]_mbus_config pad ops Jacopo Mondi
2020-07-15 15:08   ` Hans Verkuil
2020-07-19 11:18     ` Janusz Krzysztofik
2020-07-20  8:48       ` Hans Verkuil
2020-07-20 18:44         ` Janusz Krzysztofik
2020-07-21  7:46           ` Hans Verkuil
2020-07-29  7:35         ` Robert Jarzmik
2020-07-14 13:58 ` [PATCH v6 2/9] media: i2c: Use the new get_mbus_config pad op Jacopo Mondi
2020-07-14 13:58 ` [PATCH v6 3/9] media: i2c: ov6650: Use new [get|set]_mbus_config ops Jacopo Mondi
2020-07-14 13:58 ` [PATCH v6 4/9] media: pxa_camera: Use the new set_mbus_config op Jacopo Mondi
2020-07-14 13:58 ` [PATCH v6 5/9] media: v4l2-subdev: Remove [s|g]_mbus_config video ops Jacopo Mondi
2020-07-14 13:58 ` [PATCH v6 6/9] staging: media: imx: Update TODO entry Jacopo Mondi
2020-07-14 13:58 ` [PATCH v6 7/9] media: i2c: adv748x: Adjust TXA data lanes number Jacopo Mondi
2020-07-14 13:58 ` Jacopo Mondi [this message]
2020-07-14 13:58 ` [PATCH v6 9/9] media: rcar-csi2: Negotiate " Jacopo Mondi
2020-07-15  6:55   ` Niklas Söderlund
2020-07-15  7:13     ` Jacopo Mondi
2020-07-15  8:20       ` Niklas Söderlund
2020-07-15 14:38   ` [PATCH v6.1 " Jacopo Mondi
2020-07-15 15:14     ` Niklas Söderlund

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=20200714135812.55158-9-jacopo+renesas@jmondi.org \
    --to=jacopo+renesas@jmondi.org \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=hyun.kwon@xilinx.com \
    --cc=jmkrzyszt@gmail.com \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=robert.jarzmik@free.fr \
    --cc=sakari.ailus@linux.intel.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 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).