linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Chen-Yu Tsai <wens@kernel.org>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
	 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: "Ondřej Jirman" <megous@megous.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	"Linux Media Mailing List" <linux-media@vger.kernel.org>
Subject: Parallel Camera Interface Timings, Signal Definitions and Polarity?
Date: Tue, 3 Dec 2019 17:17:59 +0800	[thread overview]
Message-ID: <CAGb2v66k7+KMgVPYy0i9CF9VyNnNQEMP0y0AyCrrLX7PBKN+Jw@mail.gmail.com> (raw)

Hi everyone,

Recently, Ondřej posted a patch fixing the polarity of VSYNC/HSYNC
signals in the sun6i-csi driver [1].

Allwinner documents use the terms VSYNC and HSYNC in their camera
sensor interface hardware description, but based on the timing diagrams
included, they actually mean VREF (or inverted VSYNC) and HREF instead:
the polarity is reversed, and HSYNC is active only when valid data is
being sent over the parallel bus.

Based on my limited experience, it seems camera sensors mostly use VSYNC
and HREF, where VSYNC is defined to be a pulse that is sent after a full
frame or field has been transmitted, and HREF is a level signal which is
active when there is valid data during a horizontal line.

I'm guessing we (sunxi / Allwinner) are not the only platform to get it
wrong. Is there a concrete definition of what VSYNC and HSYNC mean, and
what active high vs active low correspond to?

For SYNC signals, I would assume the pulse portion is the active part,
so a signal such as the following would be considered active low.

    ________      ____________
            |    |
            |    |
            |____|  <- active low SYNC pulse


Also, if HSYNC is used instead of HREF, there doesn't seem to be a way
to specify how long the horizontal back porch is, i.e. how many clock
cycles should the hardware skip before capturing data. Same goes for
VSYNC instead of VREF.

Does the hardware work because we got lucky that sensors use HREF,
which means no horizontal back porch when HREF is considered an inverted
HSYNC, and no vertical back porch because HREF is only asserted starting
with the first valid line, instead of having preceding blanking lines?

The device tree bindings only have hsync-active and vsync-active. VREF
and HREF are only mentioned in passing in the header file [2], without
describing the differences or how to specify which type of signal is
used. I believe this deserves some clarification and improvement. This
would help authors of new hardware drivers immensely.

Any thoughts or comments on the matter?


Regards
ChenYu

[1] https://lkml.org/lkml/2019/11/27/1816
[2] https://elixir.bootlin.com/linux/latest/source/include/media/v4l2-mediabus.h#L27

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

                 reply	other threads:[~2019-12-03  9:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=CAGb2v66k7+KMgVPYy0i9CF9VyNnNQEMP0y0AyCrrLX7PBKN+Jw@mail.gmail.com \
    --to=wens@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=megous@megous.com \
    --cc=mripard@kernel.org \
    --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).