All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Krzysztof Hałasa" <khalasa@piap.pl>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: Jacopo Mondi <jacopo@jmondi.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Matteo Lisi <matteo.lisi@engicam.com>
Subject: Re: [PATCH v5] Driver for ON Semi AR0521 camera sensor
Date: Wed, 13 Oct 2021 07:39:07 +0200	[thread overview]
Message-ID: <m335p5lc04.fsf@t19.piap.pl> (raw)
In-Reply-To: <YWXwSAm3OO/WTkOL@valkosipuli.retiisi.eu> (Sakari Ailus's message of "Tue, 12 Oct 2021 23:30:00 +0300")

Hi Sakari,

> 	https://hverkuil.home.xs4all.nl/spec/driver-api/camera-sensor.html

Ok:
"8.2.2. Devicetree

The currently preferred way to achieve this is using assigned-clocks,
assigned-clock-parents and assigned-clock-rates properties. See
Documentation/devicetree/bindings/clock/clock-bindings.txt for more
information. The driver then gets the frequency using clk_get_rate()."

Let's see:
Documentation/devicetree/bindings/clock/clock-bindings.txt:

"==Assigned clock parents and rates==

Some platforms may require initial configuration of default parent clocks
and clock frequencies. Such a configuration can be specified in a device tree
node through assigned-clocks, assigned-clock-parents and assigned-clock-rates
properties. The assigned-clock-parents property should contain a list of parent
clocks in the form of a phandle and clock specifier pair and the
assigned-clock-rates property should contain a list of frequencies in Hz. Both
these properties should correspond to the clocks listed in the assigned-clocks
property."

So I'm after "assigned-clock-rates", right?

"Configuring a clock's parent and rate through the device node that consumes
the clock can be done only for clocks that have a single user. Specifying
conflicting parent or rate configuration in multiple consumer nodes for
a shared clock is forbidden."

This sounds a bit problematic, the clock I use is at least potentially
shared by multiple parts of the system, depending on current (run time)
configuration. I am/was getting different frequencies depending of the
particular system (all based on the same i.MX6* SoC, but with different
peripherals used/enabled). I think it's quite a common situation.

> Generally camera sensor drivers that set the clock in drivers themselves
> are (very) old.

Let's have a look... ov9282 is (one of) the newest drivers. It does:
#define OV9282_INCLK_RATE    24000000

        /* Get sensor input clock */
        ov9282->inclk = devm_clk_get(ov9282->dev, NULL);
        if (IS_ERR(ov9282->inclk)) {
                dev_err(ov9282->dev, "could not get inclk");
                return PTR_ERR(ov9282->inclk);
        }

        rate = clk_get_rate(ov9282->inclk);
        if (rate != OV9282_INCLK_RATE) {
                dev_err(ov9282->dev, "inclk frequency mismatch");
                return -EINVAL;
        }

$ git grep -l ov9282
Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml
MAINTAINERS
drivers/media/i2c/Kconfig
drivers/media/i2c/Makefile
drivers/media/i2c/ov9282.c

  clocks:
    description: Clock frequency from 6 to 27MHz

No in-tree DTS exists, but the single frequency (both in the driver -
this one can be fixed - and in the DTS) is rather limiting. Maybe
another:

imx412, imx335, imx334, imx258 - same here.
imx208 is ACPI-based.

Which driver should I consult?
-- 
Krzysztof "Chris" Hałasa

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

  reply	other threads:[~2021-10-13  5:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05 12:05 [PATCH v5] Driver for ON Semi AR0521 camera sensor Krzysztof Hałasa
2021-10-06 17:10 ` Sakari Ailus
2021-10-07  9:11   ` Krzysztof Hałasa
2021-10-09  9:07     ` Jacopo Mondi
2021-10-09 20:18       ` Randy Dunlap
2021-10-09 20:34         ` Sakari Ailus
2021-10-11  6:24           ` Krzysztof Hałasa
2021-10-11  6:20       ` Krzysztof Hałasa
2021-10-11  6:31         ` Laurent Pinchart
2021-10-12  7:52           ` Krzysztof Hałasa
2021-10-09 10:24 ` Jacopo Mondi
2021-10-11 12:19   ` Krzysztof Hałasa
2021-10-11 14:34     ` Jacopo Mondi
2021-10-11 22:22       ` Daniel Scally
2021-10-12  7:16         ` Jacopo Mondi
2021-10-12 12:24       ` Krzysztof Hałasa
2021-10-12 20:30         ` Sakari Ailus
2021-10-13  5:39           ` Krzysztof Hałasa [this message]
2021-10-20 18:43             ` Sakari Ailus
2021-10-22  6:42               ` Krzysztof Hałasa
2021-10-13  8:26         ` Jacopo Mondi
2021-10-13 12:55           ` Krzysztof Hałasa
2021-10-13 15:14             ` Jacopo Mondi
2021-10-14  5:43               ` Krzysztof Hałasa
2021-10-14  7:59                 ` Jacopo Mondi
2021-10-14 10:43                   ` Krzysztof Hałasa

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=m335p5lc04.fsf@t19.piap.pl \
    --to=khalasa@piap.pl \
    --cc=jacopo@jmondi.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=matteo.lisi@engicam.com \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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.