linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Helmut Grohne <helmut.grohne@intenta.de>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>
Subject: Re: [RFC PATCH] media: new driver mt9m02x for Onsemi MT9M024 and AR0141CS
Date: Thu, 22 Oct 2020 14:17:20 +0200	[thread overview]
Message-ID: <20201022121720.GA16345@laureti-dev> (raw)
In-Reply-To: <20201021123747.GG2703@paasikivi.fi.intel.com>

On Wed, Oct 21, 2020 at 02:37:47PM +0200, Sakari Ailus wrote:
> I guess this indeed might be more a question of what is the purpose of a
> PLL calculator. The SMIA PLL calculator was first merged with the SMIAPP
> driver back in 2012, and the Aptina PLL calculator soon followed. I think
> it is somewhat based on the SMIAPP PLL calculator.

I don't have an answer to that question. I originally started hard
coding the PLL parameters and then noticed that there is a calculator.
So I attempted using it and figured that "it didn't work" (for my use
case). That's how I ended up here.

> The SMIA PLL configuration depends also on e.g. binning and format
> configurations on the sensor, so there's also the runtime aspect that needs
> to be taken into account. There are other factors such as the number of
> lanes as well. It's not a static configuration.

If the PLL calculator needs to run at another time than probing, your
concerns about performance (in the earlier thread) make a lot more sense
to me. I had previously assumed that it was only ever used during probe.

> Then again, CCS PLL allows for a lot more variability than SMIA. This
> includes, but is _not limited to_, to number of physical lanes, lane vs.
> system speed model, sensor's internal lanes in OP and VT domains, whether
> OP domain SYS and PIX clocks are DDR, whether certain configurations can
> have only legacy values or if extended values are supported and which PHY
> is in use. Feel free to look at it here, it's not yet merged:
> 
> <URL:https://git.linuxtv.org/sailus/media_tree.git/tree/drivers/media/i2c/ccs-pll.c?h=ccs>
> 
> There, the configuration heavily depends on sensor's properties as well.

You have succeeded at demonstrating the complexity.

> The computational complexity of searching a "closest matching" frequency
> there would be vastly higher than aiming for a specific frequency. The
> former shouldn't be done at runtime IMHO.
>
> A PLL calculator that comes up with a closest frequency to something, given
> some input parameters, could be certainly useful when deciding what to put
> to DT source (while taking EMI considerations into account), but I think
> that's different from what a driver would use.

A consequence of that would be not using the PLL calculator for this
driver and instead hard coding pre-computed PLL values in the device
tree.  Do you agree with that?

I actually implemented my PLL approximator in Python first and converted
it to kernel C afterwards. What would be a good place to put a PLL
approximator to be used by DT authors?

> Does aptina-pll come up with a valid configuration if you specify the
> precise link frequency?

Given that my PLL approximator has the same type signature as
aptina_pll_calculate, this was easy to check. It does not find a valid
configuration and both of us should have noticed that without having to
run the code.

The resulting frequency of the PLL approximator is not exactly 74242424.
That's a rounded value. A more precise representation would be
74242424.24242424 and it is not a whole number. aptina_pll_calculate
only deals with frequencies that are whole numbers though. It cannot do
the job.

The actual error message is "pll: no valid combined N*P1 divisor." and
that's quite expected given the above.

In retrospect, it was a good decision to defer the discussion on my PLL
approximator until there is a driver that uses it. We've now quickly
discovered the mismatch in assumptions.

> ISO sensitivity control is a bit higher level control than the analogue
> gain but it mostly does the same thing. I wonder what others think. This is
> probably more user friendly but I guess it doesn't cover all values the
> hardware is capable of, or does it?

All values supported by the hardware are precisely representable in the
ISO sensitivity menu. That applies to both imagers even though their
analogue gain handling is completely different.

> This leads to an interesting question regarding runtime PM --- how does the
> driver determine the sensor needs to be powered on if it gets no s_stream
> command? One option could be to add a control for external streaming
> trigger.

I have no clue. This seems to be a show-stopper for runtime PM as is.

> How do you stop streaming? Is it level triggered, or how?

We permanently put the imager into externally triggered mode. You could
also say that we start streaming on probe and never stop. We suppress
the trigger signal during reconfiguration.

> Which receiver driver are you using this btw.?

I cannot give any details on this. Maybe the closest description would
be "custom hardware". Getting legal to sign off on this driver was hard
enough.

Helmut

  reply	other threads:[~2020-10-22 12:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20  9:27 [RFC PATCH] media: new driver mt9m02x for Onsemi MT9M024 and AR0141CS Helmut Grohne
2020-10-21  9:50 ` Sakari Ailus
2020-10-21 11:21   ` Helmut Grohne
2020-10-21 12:37     ` Sakari Ailus
2020-10-22 12:17       ` Helmut Grohne [this message]
2020-10-22 12:39         ` 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=20201022121720.GA16345@laureti-dev \
    --to=helmut.grohne@intenta.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@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).