From: Jonathan Cameron <jic23@kernel.org>
To: "Nuno Sá" <noname.nuno@gmail.com>
Cc: Antoniu Miclaus <antoniu.miclaus@analog.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] iio: frequency: adf4350: add clk provider
Date: Sat, 8 Jun 2024 16:08:38 +0100 [thread overview]
Message-ID: <20240608160838.16a2a04f@jic23-huawei> (raw)
In-Reply-To: <751abd157213736e376ca43ef1082362a4ca1149.camel@gmail.com>
> > +static int adf4350_clk_register(struct adf4350_state *st)
> > +{
> > + struct spi_device *spi = st->spi;
> > + struct clk_init_data init;
> > + struct clk *clk;
> > + const char *parent_name;
> > + int ret;
> > +
> > + if (!device_property_present(&spi->dev, "#clock-cells"))
> > + return 0;
> > +
> > + init.name = devm_kasprintf(&spi->dev, GFP_KERNEL, "%s-clk",
> > + fwnode_get_name(dev_fwnode(&spi->dev)));
> > + device_property_read_string(&spi->dev, "clock-output-names",
> > + &init.name);
> > +
> > + parent_name = of_clk_get_parent_name(spi->dev.of_node, 0);
> > + if (!parent_name)
> > + return -EINVAL;
> > +
> > + init.ops = &adf4350_clk_ops;
> > + init.parent_names = &parent_name;
> > + init.num_parents = 1;
> > +
> > + st->output.hw.init = &init;
> > + clk = devm_clk_register(&spi->dev, &st->output.hw);
> > + if (IS_ERR(clk))
> > + return PTR_ERR(clk);
> > +
> > + ret = of_clk_add_provider(spi->dev.of_node, of_clk_src_simple_get,
> > clk);
> > + if (ret)
> > + return ret;
> > +
>
> I totally agree this chip should be a clock provider (maybe it should even in
> drivers/clk from the beginning) but there's one thing that comes to my mind.
> Should we still expose the IIO userspace interface in case we register it as a
> clock provider?
That's a reasonable suggestion. If it's wired up as a clock we probably don't
want to provide userspace controls via IIO.
>
> Sure, we do have clk notifiers in the kernel but I still think it's a sensible
> question :)
>
> I suspect we have another "outliers" in drivers/iio/frequency :)
We all love the blurry boundaries in the kernel. IIRC when these were orginally
proposed, the IIO thing was mostly about how they were being used in Software
Defined Radios where the were part of the modulator circuits.
I can't remember the exact reasoning though.
As to the right answer for these today, I don't have strong feelings on it
and almost all these parts are ADI ones.
Michael, this is one of yours, so what do you think?
On that note, given this is basically registering as a clock.I'd expect
to see some clk related +CC
Jonathan
>
> - Nuno Sá
>
>
next prev parent reply other threads:[~2024-06-08 15:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-07 9:57 [PATCH v2 1/2] dt-bindings: iio: adf4350: add clk provider prop Antoniu Miclaus
2024-06-07 9:57 ` [PATCH v2 2/2] iio: frequency: adf4350: add clk provider Antoniu Miclaus
2024-06-07 11:08 ` Nuno Sá
2024-06-08 15:08 ` Jonathan Cameron [this message]
2024-06-10 9:00 ` Hennerich, Michael
2024-06-08 15:15 ` Jonathan Cameron
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=20240608160838.16a2a04f@jic23-huawei \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=antoniu.miclaus@analog.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=noname.nuno@gmail.com \
--cc=robh@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