All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	pali.rohar@gmail.com
Subject: Re: [RFC 13/18] v4l: of: Read lane-polarity endpoint property
Date: Sun, 08 Mar 2015 01:49:26 +0200	[thread overview]
Message-ID: <5943571.XgR4Bv1QGx@avalon> (raw)
In-Reply-To: <1425764475-27691-14-git-send-email-sakari.ailus@iki.fi>

Hi Sakari,

Thank you for the patch.

On Saturday 07 March 2015 23:41:10 Sakari Ailus wrote:
> Add lane_polarity field to struct v4l2_of_bus_mipi_csi2 and write the
> contents of the lane polarity property to it. The field tells the polarity
> of the physical lanes starting from the first one. Any unused lanes are
> ignored, i.e. only the polarity of the used lanes is specified.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
> ---
>  drivers/media/v4l2-core/v4l2-of.c |   21 ++++++++++++++++-----
>  include/media/v4l2-of.h           |    3 +++
>  2 files changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-of.c
> b/drivers/media/v4l2-core/v4l2-of.c index b4ed9a9..a7a855e 100644
> --- a/drivers/media/v4l2-core/v4l2-of.c
> +++ b/drivers/media/v4l2-core/v4l2-of.c
> @@ -23,7 +23,6 @@ static void v4l2_of_parse_csi_bus(const struct device_node
> *node, struct v4l2_of_endpoint *endpoint)
>  {
>  	struct v4l2_of_bus_mipi_csi2 *bus = &endpoint->bus.mipi_csi2;
> -	u32 data_lanes[ARRAY_SIZE(bus->data_lanes)];
>  	struct property *prop;
>  	bool have_clk_lane = false;
>  	unsigned int flags = 0;
> @@ -34,14 +33,26 @@ static void v4l2_of_parse_csi_bus(const struct
> device_node *node, const __be32 *lane = NULL;
>  		int i;
> 
> -		for (i = 0; i < ARRAY_SIZE(data_lanes); i++) {
> -			lane = of_prop_next_u32(prop, lane, &data_lanes[i]);
> +		for (i = 0; i < ARRAY_SIZE(bus->data_lanes); i++) {
> +			lane = of_prop_next_u32(prop, lane, &v);
>  			if (!lane)
>  				break;
> +			bus->data_lanes[i] = v;
>  		}
>  		bus->num_data_lanes = i;
> -		while (i--)
> -			bus->data_lanes[i] = data_lanes[i];
> +	}
> +
> +	prop = of_find_property(node, "lane-polarity", NULL);
> +	if (prop) {
> +		const __be32 *polarity = NULL;
> +		int i;

Could you please use unsigned int instead of int as the loop index can't have 
negative value ? Feel free to fix the index in the previous loop too :-)

> +
> +		for (i = 0; i < ARRAY_SIZE(bus->lane_polarity); i++) {
> +			polarity = of_prop_next_u32(prop, polarity, &v);
> +			if (!polarity)
> +				break;
> +			bus->lane_polarity[i] = v;
> +		}

Should we check that i == num_data_lines + 1 ?

>  	}
> 
>  	if (!of_property_read_u32(node, "clock-lanes", &v)) {
> diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h
> index 70fa7b7..a70eb52 100644
> --- a/include/media/v4l2-of.h
> +++ b/include/media/v4l2-of.h
> @@ -29,12 +29,15 @@ struct device_node;
>   * @data_lanes: an array of physical data lane indexes
>   * @clock_lane: physical lane index of the clock lane
>   * @num_data_lanes: number of data lanes
> + * @lane_polarity: polarity of the lanes. The order is the same of
> + *		   the physical lanes.
>   */
>  struct v4l2_of_bus_mipi_csi2 {
>  	unsigned int flags;
>  	unsigned char data_lanes[4];
>  	unsigned char clock_lane;
>  	unsigned short num_data_lanes;
> +	bool lane_polarity[5];
>  };
> 
>  /**

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2015-03-07 23:49 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-07 21:40 [RFC 00/18] Device tree support for omap3isp, N9[50] primary camera Sakari Ailus
2015-03-07 21:40 ` [RFC 02/18] omap3isp: Avoid a BUG_ON() in media_entity_create_link() Sakari Ailus
2015-03-07 23:19   ` Laurent Pinchart
2015-03-07 21:41 ` [RFC 07/18] omap3isp: Rename regulators to better suit the Device Tree Sakari Ailus
2015-03-07 23:26   ` Laurent Pinchart
2015-03-07 21:41 ` [RFC 08/18] omap3isp: Calculate vpclk_div for CSI-2 Sakari Ailus
2015-03-07 23:27   ` Laurent Pinchart
2015-03-07 21:41 ` [RFC 11/18] omap3isp: Replace many MMIO regions by two Sakari Ailus
2015-03-07 23:43   ` Laurent Pinchart
2015-03-09 15:22     ` Tony Lindgren
2015-03-07 21:41 ` [RFC 12/18] dt: bindings: Add lane-polarity property to endpoint nodes Sakari Ailus
2015-03-07 23:46   ` Laurent Pinchart
2015-03-07 23:57     ` Sakari Ailus
     [not found] ` <1425764475-27691-1-git-send-email-sakari.ailus-X3B1VOXEql0@public.gmane.org>
2015-03-07 21:40   ` [RFC 01/18] omap3isp: Fix error handling in probe Sakari Ailus
2015-03-07 21:40     ` Sakari Ailus
2015-03-07 23:17     ` Laurent Pinchart
2015-03-07 21:41   ` [RFC 03/18] omap3isp: Separate external link creation from platform data parsing Sakari Ailus
2015-03-07 21:41     ` Sakari Ailus
2015-03-07 23:23     ` Laurent Pinchart
2015-03-07 21:41   ` [RFC 04/18] omap3isp: DT support for clocks Sakari Ailus
2015-03-07 21:41     ` Sakari Ailus
2015-03-07 21:41   ` [RFC 05/18] omap3isp: Platform data could be NULL Sakari Ailus
2015-03-07 21:41     ` Sakari Ailus
2015-03-07 23:50     ` Laurent Pinchart
2015-03-07 21:41   ` [RFC 06/18] omap3isp: Refactor device configuration structs for Device Tree Sakari Ailus
2015-03-07 21:41     ` Sakari Ailus
2015-03-11 23:07     ` Laurent Pinchart
2015-03-07 21:41   ` [RFC 09/18] omap3isp: Replace mmio_base_phys array with the histogram block base Sakari Ailus
2015-03-07 21:41     ` Sakari Ailus
2015-03-07 23:28     ` Laurent Pinchart
2015-03-07 21:41   ` [RFC 10/18] omap3isp: Move the syscon register out of the ISP register maps Sakari Ailus
2015-03-07 21:41     ` Sakari Ailus
2015-03-07 23:34     ` Laurent Pinchart
2015-03-07 23:43       ` Sakari Ailus
2015-03-07 23:43         ` Sakari Ailus
2015-03-09 15:20         ` Tony Lindgren
2015-03-14 15:00           ` Sakari Ailus
2015-03-16  0:19     ` Laurent Pinchart
2015-03-16 23:21       ` Sakari Ailus
2015-03-16 23:21         ` Sakari Ailus
2015-03-07 21:41   ` [RFC 13/18] v4l: of: Read lane-polarity endpoint property Sakari Ailus
2015-03-07 21:41     ` Sakari Ailus
2015-03-07 23:49     ` Laurent Pinchart [this message]
2015-03-12 22:23       ` Sakari Ailus
     [not found]         ` <20150312222327.GM11954-S+BSfZ9RZZmRSg0ZkenSGLdO1Tsj/99ntUK59QYPAWc@public.gmane.org>
2015-03-12 22:25           ` Sakari Ailus
2015-03-12 22:25             ` Sakari Ailus
2015-03-07 21:41   ` [RFC 17/18] arm: dts: n950, n9: Add primary camera support Sakari Ailus
2015-03-07 21:41     ` Sakari Ailus
     [not found]     ` <1425764475-27691-18-git-send-email-sakari.ailus-X3B1VOXEql0@public.gmane.org>
2015-03-07 23:56       ` Laurent Pinchart
2015-03-07 23:56         ` Laurent Pinchart
2015-03-08  0:03         ` Sakari Ailus
2015-03-08  0:03           ` Sakari Ailus
2015-03-07 21:41   ` [RFC 18/18] omap3isp: Deprecate platform data support Sakari Ailus
2015-03-07 21:41     ` Sakari Ailus
2015-03-07 23:35     ` Laurent Pinchart
     [not found]     ` <1425764475-27691-19-git-send-email-sakari.ailus-X3B1VOXEql0@public.gmane.org>
2015-03-13  9:40       ` Sebastian Reichel
2015-03-13  9:40         ` Sebastian Reichel
2015-03-13 16:43         ` Tony Lindgren
2015-03-13 16:43           ` Tony Lindgren
2015-03-07 21:41 ` [RFC 14/18] dt: bindings: Add bindings for omap3isp Sakari Ailus
2015-03-11 23:39   ` Laurent Pinchart
2015-03-12 23:03     ` Sakari Ailus
2015-03-12 23:03       ` Sakari Ailus
2015-03-12 23:11       ` Laurent Pinchart
2015-03-12 23:43         ` Sakari Ailus
2015-03-12 23:43           ` Sakari Ailus
     [not found]       ` <20150312230320.GO11954-S+BSfZ9RZZmRSg0ZkenSGLdO1Tsj/99ntUK59QYPAWc@public.gmane.org>
2015-03-13  9:34         ` Sebastian Reichel
2015-03-13  9:34           ` Sebastian Reichel
2015-03-14  0:33           ` Laurent Pinchart
2015-03-14 14:10           ` Sakari Ailus
2015-03-07 21:41 ` [RFC 15/18] omap3isp: Add support for the Device Tree Sakari Ailus
     [not found]   ` <1425764475-27691-16-git-send-email-sakari.ailus-X3B1VOXEql0@public.gmane.org>
2015-03-11 23:48     ` Laurent Pinchart
2015-03-11 23:48       ` Laurent Pinchart
2015-03-14 14:12       ` Sakari Ailus
2015-03-07 21:41 ` [RFC 16/18] arm: dts: omap3: Add DT entries for OMAP 3 Sakari Ailus
     [not found]   ` <1425764475-27691-17-git-send-email-sakari.ailus-X3B1VOXEql0@public.gmane.org>
2015-03-07 23:51     ` Laurent Pinchart
2015-03-07 23:51       ` Laurent Pinchart
2015-03-14 14:43       ` Sakari Ailus

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=5943571.XgR4Bv1QGx@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=pali.rohar@gmail.com \
    --cc=sakari.ailus@iki.fi \
    /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.