From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Cc: Kieran Bingham <kieran.bingham@ideasonboard.com>,
Jacopo Mondi <jacopo@jmondi.org>,
linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH 1/3] i2c: adv748x: store number of CSI-2 lanes described in device tree
Date: Tue, 18 Sep 2018 13:16:13 +0300 [thread overview]
Message-ID: <3681025.rR3N9orANn@avalon> (raw)
In-Reply-To: <20180918014509.6394-2-niklas.soderlund+renesas@ragnatech.se>
Hi Niklas,
Thank you for the patch.
On Tuesday, 18 September 2018 04:45:07 EEST Niklas Söderlund wrote:
> The adv748x CSI-2 transmitters TXA and TXB can use different number of
> lines to transmit data on. In order to be able configure the device
s/lines/lanes/
s/data on/data/
s/able configure/able to configure/
> correctly this information need to be parsed from device tree and stored
> in each TX private data structure.
>
> TXA supports 1, 2 and 4 lanes while TXB supports 1 lane.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
> drivers/media/i2c/adv748x/adv748x-core.c | 49 ++++++++++++++++++++++++
> drivers/media/i2c/adv748x/adv748x.h | 1 +
> 2 files changed, 50 insertions(+)
>
> diff --git a/drivers/media/i2c/adv748x/adv748x-core.c
> b/drivers/media/i2c/adv748x/adv748x-core.c index
> 85c027bdcd56748d..a93f8ea89a228474 100644
> --- a/drivers/media/i2c/adv748x/adv748x-core.c
> +++ b/drivers/media/i2c/adv748x/adv748x-core.c
> @@ -23,6 +23,7 @@
> #include <media/v4l2-ctrls.h>
> #include <media/v4l2-device.h>
> #include <media/v4l2-dv-timings.h>
> +#include <media/v4l2-fwnode.h>
> #include <media/v4l2-ioctl.h>
>
> #include "adv748x.h"
> @@ -561,11 +562,54 @@ void adv748x_subdev_init(struct v4l2_subdev *sd,
> struct adv748x_state *state, sd->entity.ops = &adv748x_media_ops;
> }
>
> +static int adv748x_parse_csi2_lanes(struct adv748x_state *state,
> + unsigned int port,
> + struct device_node *ep)
> +{
> + struct v4l2_fwnode_endpoint vep;
> + unsigned int num_lanes;
> + int ret;
> +
> + if (port != ADV748X_PORT_TXA && port != ADV748X_PORT_TXB)
> + return 0;
> +
> + ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &vep);
> + if (ret)
> + return ret;
> +
> + num_lanes = vep.bus.mipi_csi2.num_data_lanes;
> +
> + if (vep.base.port == ADV748X_PORT_TXA) {
> + if (num_lanes != 1 && num_lanes != 2 && num_lanes != 4) {
> + adv_err(state, "TXA: Invalid number (%d) of lanes\n",
%u for unsigned int (and below as well).
> + num_lanes);
> + return -EINVAL;
> + }
> +
> + state->txa.num_lanes = num_lanes;
> + adv_dbg(state, "TXA: using %d lanes\n", state->txa.num_lanes);
I wonder if the debug message is really needed.
Apart from that,
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> + }
> +
> + if (vep.base.port == ADV748X_PORT_TXB) {
> + if (num_lanes != 1) {
> + adv_err(state, "TXB: Invalid number (%d) of lanes\n",
> + num_lanes);
> + return -EINVAL;
> + }
> +
> + state->txb.num_lanes = num_lanes;
> + adv_dbg(state, "TXB: using %d lanes\n", state->txb.num_lanes);
> + }
> +
> + return 0;
> +}
> +
> static int adv748x_parse_dt(struct adv748x_state *state)
> {
> struct device_node *ep_np = NULL;
> struct of_endpoint ep;
> bool found = false;
> + int ret;
>
> for_each_endpoint_of_node(state->dev->of_node, ep_np) {
> of_graph_parse_endpoint(ep_np, &ep);
> @@ -589,6 +633,11 @@ static int adv748x_parse_dt(struct adv748x_state
> *state) state->endpoints[ep.port] = ep_np;
>
> found = true;
> +
> + /* Store number of CSI-2 lanes used for TXA and TXB. */
> + ret = adv748x_parse_csi2_lanes(state, ep.port, ep_np);
> + if (ret)
> + return ret;
> }
>
> return found ? 0 : -ENODEV;
> diff --git a/drivers/media/i2c/adv748x/adv748x.h
> b/drivers/media/i2c/adv748x/adv748x.h index
> c9016acaba34aff2..88ad06a3045c5427 100644
> --- a/drivers/media/i2c/adv748x/adv748x.h
> +++ b/drivers/media/i2c/adv748x/adv748x.h
> @@ -78,6 +78,7 @@ struct adv748x_csi2 {
> struct adv748x_state *state;
> struct v4l2_mbus_framefmt format;
> unsigned int page;
> + unsigned int num_lanes;
>
> struct media_pad pads[ADV748X_CSI2_NR_PADS];
> struct v4l2_ctrl_handler ctrl_hdl;
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2018-09-18 10:16 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-18 1:45 [PATCH 0/3] i2c: adv748x: add support for CSI-2 TXA to work in 1-, 2- and 4-lane mode Niklas Söderlund
2018-09-18 1:45 ` [PATCH 1/3] i2c: adv748x: store number of CSI-2 lanes described in device tree Niklas Söderlund
2018-09-18 10:16 ` Laurent Pinchart [this message]
2018-09-18 10:19 ` Kieran Bingham
2018-09-18 10:28 ` Laurent Pinchart
2018-09-18 10:37 ` Kieran Bingham
2018-09-18 10:46 ` Laurent Pinchart
2018-09-18 10:51 ` Kieran Bingham
2018-09-18 11:13 ` Laurent Pinchart
2018-09-20 23:43 ` Sakari Ailus
2018-09-20 23:43 ` Sakari Ailus
2018-09-21 9:33 ` Dave Stevenson
2018-09-21 10:01 ` Laurent Pinchart
2018-09-21 12:03 ` Sakari Ailus
2018-09-21 13:46 ` Dave Stevenson
2018-11-13 9:40 ` Sakari Ailus
2018-09-21 13:38 ` Dave Stevenson
2018-09-18 19:06 ` Niklas Söderlund
2018-09-18 19:06 ` Niklas Söderlund
2018-09-18 1:45 ` [PATCH 2/3] i2c: adv748x: configure number of lanes used for TXA CSI-2 transmitter Niklas Söderlund
2018-09-18 10:13 ` Kieran Bingham
2018-09-18 19:29 ` Niklas Söderlund
2018-09-18 19:29 ` Niklas Söderlund
2018-09-18 20:35 ` Kieran Bingham
2018-09-18 22:50 ` Laurent Pinchart
2018-09-18 22:46 ` Laurent Pinchart
2018-09-18 1:45 ` [PATCH 3/3] i2c: adv748x: fix typo in comment for TXB CSI-2 transmitter power down Niklas Söderlund
2018-09-18 9:10 ` Sergei Shtylyov
2018-09-18 9:54 ` Kieran Bingham
2018-09-18 10:22 ` Kieran Bingham
2018-09-18 12:34 ` jacopo mondi
2018-09-18 16:06 ` Kieran Bingham
2018-09-18 10:17 ` Laurent Pinchart
2018-09-26 13:49 ` Kieran Bingham
2018-09-26 14:09 ` Niklas Söderlund
2018-09-26 14:09 ` 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=3681025.rR3N9orANn@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=jacopo@jmondi.org \
--cc=kieran.bingham@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=niklas.soderlund+renesas@ragnatech.se \
/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.