public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Krzysztof Hałasa" <khalasa@piap.pl>
To: linux-media@vger.kernel.org
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	linux-kernel@vger.kernel.org
Subject: Re: RFC: MEDIA: Driver for ON Semi AR0521 camera sensor
Date: Wed, 28 Apr 2021 14:35:32 +0200	[thread overview]
Message-ID: <m3k0om8u3v.fsf@t19.piap.pl> (raw)
In-Reply-To: <YFEE3WYdECCQRYxl@pendragon.ideasonboard.com> (Laurent Pinchart's message of "Tue, 16 Mar 2021 21:19:57 +0200")

Hi,

I'm working on AR0521 MIPI camera sensor driver update and I'm still not
sure how the timings should be programmed. V4L2 has:

- V4L2_CID_LINK_FREQ
  I understand it's a menu with fixed integers (frequencies in Hz).
Documentation/driver-api/media/camera-sensor.rst:
"For camera sensors that are connected to a bus where transmitter and receiver
require common configuration set by drivers, such as CSI-2 or parallel (BT.601
or BT.656) bus, the ``V4L2_CID_LINK_FREQ`` control is mandatory on transmitter
drivers. Receiver drivers can use the ``V4L2_CID_LINK_FREQ`` to query the
frequency used on the bus."

How (and if) do I use the above when the sensor in question uses PLLs
and can generate arbitrary link frequencies?

- V4L2_CID_VBLANK and V4L2_CID_HBLANK
These are fine for setting the timings (and the AR0521 can use them).
There is, however, another value needed for precise timing control, the
so called "extra" timing (a hw register), specified in pixels.
The calculated frame rate is thus:
fr = pixel_clock / (width + hblank) * (height + vblank) + extra.

How do I specify the "extra"?

Currently, I'm using the [sg]_frame_interval() functions, should it stay
this way (so there are [HV]BLANK controls AND [sg]_frame_interval() in
parallel on the same device)?

It appears the userspace should be able to set, in addition to *BLANK,
the pixel clock. How do I do that? The V4L2_CID_PIXEL_RATE appears to be
a good candidate, but v4l2_ctrl_fill() sets a read-only flag on it.

Any ideas?

At present I'm about to use two (orthogonal) interfaces (frame interval
based and the - incomplete - [hv]blank-based) - but perhaps I'm missing
something important?
-- 
Krzysztof Hałasa

Sieć Badawcza Łukasiewicz
Przemysłowy Instytut Automatyki i Pomiarów PIAP
Al. Jerozolimskie 202, 02-486 Warszawa

      parent reply	other threads:[~2021-04-28 12:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16 13:25 RFC: MEDIA: Driver for ON Semi AR0521 camera sensor Krzysztof Hałasa
2021-03-16 19:19 ` Laurent Pinchart
2021-03-17  6:04   ` Krzysztof Hałasa
2021-03-30 10:47   ` Krzysztof Hałasa
2021-04-28 12:35   ` Krzysztof Hałasa [this message]

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=m3k0om8u3v.fsf@t19.piap.pl \
    --to=khalasa@piap.pl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox