All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: Jacopo Mondi <jacopo+renesas@jmondi.org>
Cc: laurent.pinchart@ideasonboard.com, horms@verge.net.au,
	geert@glider.be, linux-media@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH 4/6] media: rcar-vin: Handle CLOCKENB pin polarity
Date: Thu, 17 May 2018 00:11:03 +0200	[thread overview]
Message-ID: <20180516221103.GE17948@bigcity.dyn.berto.se> (raw)
In-Reply-To: <1526488352-898-5-git-send-email-jacopo+renesas@jmondi.org>

Hi Jacopo,

Thanks for your patch.

I'm happy that you dig into this as it clearly needs doing!

On 2018-05-16 18:32:30 +0200, Jacopo Mondi wrote:
> Handle CLOCKENB pin polarity, or use HSYNC in its place if polarity is
> not specified.
> 
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> ---
>  drivers/media/platform/rcar-vin/rcar-dma.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c
> index ac07f99..7a84eae 100644
> --- a/drivers/media/platform/rcar-vin/rcar-dma.c
> +++ b/drivers/media/platform/rcar-vin/rcar-dma.c
> @@ -123,6 +123,8 @@
>  /* Video n Data Mode Register 2 bits */
>  #define VNDMR2_VPS		(1 << 30)
>  #define VNDMR2_HPS		(1 << 29)
> +#define VNDMR2_CES		(1 << 28)
> +#define VNDMR2_CHS		(1 << 23)
>  #define VNDMR2_FTEV		(1 << 17)
>  #define VNDMR2_VLV(n)		((n & 0xf) << 12)
>  
> @@ -691,6 +693,15 @@ static int rvin_setup(struct rvin_dev *vin)
>  		dmr2 |= VNDMR2_VPS;
>  
>  	/*
> +	 * Clock-enable active level select.
> +	 * Use HSYNC as enable if not specified
> +	 */
> +	if (vin->mbus_cfg.flags & V4L2_MBUS_DATA_ACTIVE_LOW)
> +		dmr2 |= VNDMR2_CES;
> +	else if (!(vin->mbus_cfg.flags & V4L2_MBUS_DATA_ACTIVE_HIGH))
> +		dmr2 |= VNDMR2_CHS;

After studying the datasheet for a while I'm getting more and more 
convinced this should be (with context leftout in this patch context) 
something like this:

	/* Hsync Signal Polarity Select */
	if (!(vin->mbus_cfg.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW))
	        dmr2 |= VNDMR2_HPS;

	/* Vsync Signal Polarity Select */
	if (!(vin->mbus_cfg.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW))
	        dmr2 |= VNDMR2_VPS;

	/* Clock Enable Signal Polarity Select */
	if (!(vin->mbus_cfg.flags & V4L2_MBUS_DATA_ACTIVE_LOW))
	        dmr2 |= VNDMR2_CES;

	/* Use HSYNC as clock enable if VIn_CLKENB is not available. */
	if (!(vin->mbus_cfg.flags & (V4L2_MBUS_DATA_ACTIVE_LOW | V4L2_MBUS_DATA_ACTIVE_HIGH)))
		dmr2 |= VNDMR2_CHS;

Or am I misunderstanding something?

> +
> +	/*
>  	 * Output format
>  	 */
>  	switch (vin->format.pixelformat) {
> -- 
> 2.7.4
> 

-- 
Regards,
Niklas Söderlund

WARNING: multiple messages have this Message-ID (diff)
From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: Jacopo Mondi <jacopo+renesas@jmondi.org>
Cc: laurent.pinchart@ideasonboard.com, horms@verge.net.au,
	geert@glider.be, linux-media@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH 4/6] media: rcar-vin: Handle CLOCKENB pin polarity
Date: Thu, 17 May 2018 00:11:03 +0200	[thread overview]
Message-ID: <20180516221103.GE17948@bigcity.dyn.berto.se> (raw)
In-Reply-To: <1526488352-898-5-git-send-email-jacopo+renesas@jmondi.org>

Hi Jacopo,

Thanks for your patch.

I'm happy that you dig into this as it clearly needs doing!

On 2018-05-16 18:32:30 +0200, Jacopo Mondi wrote:
> Handle CLOCKENB pin polarity, or use HSYNC in its place if polarity is
> not specified.
> 
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> ---
>  drivers/media/platform/rcar-vin/rcar-dma.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c
> index ac07f99..7a84eae 100644
> --- a/drivers/media/platform/rcar-vin/rcar-dma.c
> +++ b/drivers/media/platform/rcar-vin/rcar-dma.c
> @@ -123,6 +123,8 @@
>  /* Video n Data Mode Register 2 bits */
>  #define VNDMR2_VPS		(1 << 30)
>  #define VNDMR2_HPS		(1 << 29)
> +#define VNDMR2_CES		(1 << 28)
> +#define VNDMR2_CHS		(1 << 23)
>  #define VNDMR2_FTEV		(1 << 17)
>  #define VNDMR2_VLV(n)		((n & 0xf) << 12)
>  
> @@ -691,6 +693,15 @@ static int rvin_setup(struct rvin_dev *vin)
>  		dmr2 |= VNDMR2_VPS;
>  
>  	/*
> +	 * Clock-enable active level select.
> +	 * Use HSYNC as enable if not specified
> +	 */
> +	if (vin->mbus_cfg.flags & V4L2_MBUS_DATA_ACTIVE_LOW)
> +		dmr2 |= VNDMR2_CES;
> +	else if (!(vin->mbus_cfg.flags & V4L2_MBUS_DATA_ACTIVE_HIGH))
> +		dmr2 |= VNDMR2_CHS;

After studying the datasheet for a while I'm getting more and more 
convinced this should be (with context leftout in this patch context) 
something like this:

	/* Hsync Signal Polarity Select */
	if (!(vin->mbus_cfg.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW))
	        dmr2 |= VNDMR2_HPS;

	/* Vsync Signal Polarity Select */
	if (!(vin->mbus_cfg.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW))
	        dmr2 |= VNDMR2_VPS;

	/* Clock Enable Signal Polarity Select */
	if (!(vin->mbus_cfg.flags & V4L2_MBUS_DATA_ACTIVE_LOW))
	        dmr2 |= VNDMR2_CES;

	/* Use HSYNC as clock enable if VIn_CLKENB is not available. */
	if (!(vin->mbus_cfg.flags & (V4L2_MBUS_DATA_ACTIVE_LOW | V4L2_MBUS_DATA_ACTIVE_HIGH)))
		dmr2 |= VNDMR2_CHS;

Or am I misunderstanding something?

> +
> +	/*
>  	 * Output format
>  	 */
>  	switch (vin->format.pixelformat) {
> -- 
> 2.7.4
> 

-- 
Regards,
Niklas S�derlund

  reply	other threads:[~2018-05-16 22:11 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-16 16:32 [PATCH 0/6] media: rcar-vin: Brush endpoint properties Jacopo Mondi
2018-05-16 16:32 ` [PATCH 1/6] dt-bindings: media: rcar-vin: Describe optional ep properties Jacopo Mondi
2018-05-16 16:32   ` Jacopo Mondi
2018-05-16 16:32   ` Jacopo Mondi
2018-05-16 21:18   ` Niklas Söderlund
2018-05-16 21:18     ` Niklas Söderlund
2018-05-16 21:18     ` Niklas Söderlund
2018-05-16 21:18     ` Niklas Söderlund
2018-05-23 16:29   ` Rob Herring
2018-05-23 16:29     ` Rob Herring
2018-05-23 16:29     ` Rob Herring
2018-05-23 19:38     ` Laurent Pinchart
2018-05-23 19:38       ` Laurent Pinchart
2018-05-23 19:38       ` Laurent Pinchart
2018-05-23 19:55       ` Rob Herring
2018-05-23 19:55         ` Rob Herring
2018-05-23 19:55         ` Rob Herring
2018-05-16 16:32 ` [PATCH 2/6] dt-bindings: media: rcar-vin: Document data-active Jacopo Mondi
2018-05-16 16:32   ` Jacopo Mondi
2018-05-16 16:32   ` Jacopo Mondi
2018-05-16 21:55   ` Niklas Söderlund
2018-05-16 21:55     ` Niklas Söderlund
2018-05-16 21:55     ` Niklas Söderlund
2018-05-16 21:55     ` Niklas Söderlund
2018-05-17  8:25     ` jacopo mondi
2018-05-17  8:25       ` jacopo mondi
2018-05-17  8:25       ` jacopo mondi
2018-05-23 16:37   ` Rob Herring
2018-05-23 16:37     ` Rob Herring
2018-05-23 16:37     ` Rob Herring
2018-05-16 16:32 ` [PATCH 3/6] media: rcar-vin: Handle data-active property Jacopo Mondi
2018-05-16 21:58   ` Niklas Söderlund
2018-05-16 21:58     ` Niklas Söderlund
2018-05-17  8:30     ` jacopo mondi
2018-05-17  8:48   ` Sergei Shtylyov
2018-05-16 16:32 ` [PATCH 4/6] media: rcar-vin: Handle CLOCKENB pin polarity Jacopo Mondi
2018-05-16 22:11   ` Niklas Söderlund [this message]
2018-05-16 22:11     ` Niklas Söderlund
2018-05-17  8:41     ` jacopo mondi
2018-05-16 16:32 ` [PATCH 5/6] ARM: dts: rcar-gen2: Remove unused VIN properties Jacopo Mondi
2018-05-16 16:32   ` Jacopo Mondi
2018-05-16 16:32   ` Jacopo Mondi
2018-05-16 22:13   ` Niklas Söderlund
2018-05-16 22:13     ` Niklas Söderlund
2018-05-16 22:13     ` Niklas Söderlund
2018-05-16 22:13     ` Niklas Söderlund
2018-05-17  9:01     ` jacopo mondi
2018-05-17  9:01       ` jacopo mondi
2018-05-17  9:01       ` jacopo mondi
2018-05-22  8:18       ` Simon Horman
2018-05-22  8:18         ` Simon Horman
2018-05-22  8:18         ` Simon Horman
2018-05-23 16:33     ` Rob Herring
2018-05-23 16:33       ` Rob Herring
2018-05-23 16:33       ` Rob Herring
2018-05-23 16:33       ` Rob Herring
2018-05-16 16:32 ` [PATCH 6/6] ARM: dts: rcar-gen2: Add 'data-active' property Jacopo Mondi
2018-05-16 16:32   ` Jacopo Mondi
2018-05-16 16:32   ` Jacopo Mondi
2018-05-16 22:15   ` Niklas Söderlund
2018-05-16 22:15     ` Niklas Söderlund
2018-05-16 22:15     ` Niklas Söderlund
2018-05-16 22:15     ` Niklas Söderlund
2018-05-16 21:16 ` [PATCH 0/6] media: rcar-vin: Brush endpoint properties Niklas Söderlund
2018-05-16 21:16   ` 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=20180516221103.GE17948@bigcity.dyn.berto.se \
    --to=niklas.soderlund@ragnatech.se \
    --cc=geert@glider.be \
    --cc=horms@verge.net.au \
    --cc=jacopo+renesas@jmondi.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    /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.