Linux Media Controller development
 help / color / mirror / Atom feed
From: jacopo mondi <jacopo@jmondi.org>
To: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
Cc: Jacopo Mondi <jacopo+renesas@jmondi.org>,
	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 10:41:56 +0200	[thread overview]
Message-ID: <20180517084156.GW5956@w540> (raw)
In-Reply-To: <20180516221103.GE17948@bigcity.dyn.berto.se>

[-- Attachment #1: Type: text/plain, Size: 3077 bytes --]

Hi Niklas,

On Thu, May 17, 2018 at 12:11:03AM +0200, Niklas Söderlund wrote:
> 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;

No, set CES if V4L2_MBUS_DATA_ACTIVE_LOW is specified, not the other
way around. See the CES bit description:

        Clock Enable Signal Polarity Select
        This bit specifies the polarity of the input clock enable signal in the ITU-
        R BT.601.
        0: Active high
        1: Active low
>
> 	/* 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?

Isn't that what my code is doing?

if (flags & LOW)
        dmr2 |= CES;
else if (!(flags & HIGH)) // if we get here, LOW is not set too
        dmr2 |= CHS;

Anyway, if you agree with my previous replies, we should set CHS only
when running with explicit syncs (V4L2_MBUS_PARALLEL).

Thanks
  j
>
> > +
> > +	/*
> >  	 * Output format
> >  	 */
> >  	switch (vin->format.pixelformat) {
> > --
> > 2.7.4
> >
>
> --
> Regards,
> Niklas Söderlund

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2018-05-17  8:45 UTC|newest]

Thread overview: 25+ 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 21:18   ` Niklas Söderlund
2018-05-23 16:29   ` Rob Herring
2018-05-23 19:38     ` Laurent Pinchart
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 21:55   ` Niklas Söderlund
2018-05-17  8:25     ` jacopo mondi
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-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
2018-05-17  8:41     ` jacopo mondi [this message]
2018-05-16 16:32 ` [PATCH 5/6] ARM: dts: rcar-gen2: Remove unused VIN properties Jacopo Mondi
2018-05-16 22:13   ` Niklas Söderlund
2018-05-17  9:01     ` jacopo mondi
2018-05-22  8:18       ` Simon Horman
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 22:15   ` Niklas Söderlund
2018-05-16 21:16 ` [PATCH 0/6] media: rcar-vin: Brush endpoint properties 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=20180517084156.GW5956@w540 \
    --to=jacopo@jmondi.org \
    --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 \
    --cc=niklas.soderlund@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox