From: Krzysztof Kozlowski <krzk@kernel.org>
To: Richard Fitzgerald <rf@opensource.cirrus.com>,
Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: Paul Handrigan <paulha@opensource.cirrus.com>,
mturquette@baylibre.com, sboyd@kernel.org,
linux-clk@vger.kernel.org, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, devicetree@vger.kernel.org,
patches@opensource.cirrus.com
Subject: Re: [PATCH v2 1/2] dt-binding: clock: cs2600: Add support for the CS2600
Date: Thu, 19 Dec 2024 16:57:35 +0100 [thread overview]
Message-ID: <c7278ed3-9361-4cd1-ad28-cdbcc3d84bcd@kernel.org> (raw)
In-Reply-To: <a23a5e89-0a55-4b17-9911-a12cfa154ef2@opensource.cirrus.com>
On 19/12/2024 14:36, Richard Fitzgerald wrote:
> On 19/12/24 13:16, Krzysztof Kozlowski wrote:
>> On 19/12/2024 13:59, Charles Keepax wrote:
>>> On Thu, Dec 19, 2024 at 12:39:38PM +0100, Krzysztof Kozlowski wrote:
>>>> On 19/12/2024 12:02, Charles Keepax wrote:
>>>>> On Thu, Dec 19, 2024 at 09:51:00AM +0100, Krzysztof Kozlowski wrote:
>>>>>> On Wed, Dec 18, 2024 at 08:46:30PM -0600, Paul Handrigan wrote:
>>>>>>> +/* CS2600 Auxiliary Output */
>>>>>>> +#define CS2600_AUX_OUTPUT_FREQ_UNLOCK 0
>>>>>>> +#define CS2600_AUX_OUTPUT_PHASE_UNLOCK 1
>>>>>>> +#define CS2600_AUX_OUTPUT_NO_CLKIN 2
>>>>>>
>>>>>> I still don't see why these three are supposed to be bindings. Drop
>>>>>> them.
>>>>>
>>>>> In a binding one would presumably do:
>>>>>
>>>>> cirrus,aux-output-source = <CS2600_AUX_OUTPUT_FREQ_UNLOCK>;
>>>>>
>>>>> Apologies but I don't quite understand what you mean by the values
>>>>> are not used in the binding? The driver reads the property and sets
>>>>
>>>> There is no user of these defines, so not a binding.
>>>>
>>>>> the pin to have the appropriate function. Admittedly one could drop
>>>>
>>>> It's not a proof that this is a binding.
>>>>
>>>>> the defines and then DTS would just have to do:
>>>>>
>>>>> cirrus,aux-output-source = <0>;
>>>>>
>>>>> But that feels a bit less helpful when reading the binding.
>>>>
>>>> Binding and being helpful are two different things. This to be the
>>>> binding, it has to be used as a binding, so some translation layer
>>>> between driver and DTS. It must have an user in DTS. I keep repeating
>>>> this over and over...
>>>>
>>>
>>> Apologies, but I not sure I totally follow this, and apologies if
>>> you have already explained this are there some docs I can look
>>> at?
>>>
>>> I think you are saying because these defines merely represent the
>>> valid values for a device tree property and are not translated
>>> into different values you can't put defines for them in the binding
>>> header?
>>>
>>> So this would not be allowed:
>>>
>>> #define CS2600_AUX_OUTPUT_FREQ_UNLOCK 0
>>>
>>> cirrus,aux-output-source = <CS2600_AUX_OUTPUT_FREQ_UNLOCK>;
>>>
>>> device_property_read_u32(dev, "cirrus,aux-output-source", &val);
>>> regmap_write(regmap, CS2600_OUTPUT_CFG2, val);
>>>
>>> But this would be fine:
>>>
>>> #define CS2600_AUX_OUTPUT_FREQ_UNLOCK 1
>>>
>>> cirrus,aux-output-source = <CS2600_AUX_OUTPUT_FREQ_UNLOCK>;
>>>
>>> device_property_read_u32(dev, "cirrus,aux-output-source", &val);
>>> switch (val) {
>>> case CS2600_AUX_OUTPUT_FREQ_UNLOCK:
>>> regmap_write(regmap, CS2600_OUTPUT_CFG2, 0);
>>> }
>>>
>>> And this would also be fine?
>>>
>>> cirrus,aux-output-source = <0>;
>>>
>>> device_property_read_u32(dev, "cirrus,aux-output-source", &val);
>>> regmap_write(regmap, CS2600_OUTPUT_CFG2, val);
>>>
>> Yes. If you want to use in DTS user-readable values, then use string.
>>
>
> I don't understand this. Why should we have to use a string value for
> something that only needs a simple integer value? Why can't we define
> constants with meaningful names?
You can and you will find plenty examples of this, but as I explained
earlier - this is not a binding. We avoid defining as a binding
something which is not a binding.
Best regards,
Krzysztof
next prev parent reply other threads:[~2024-12-19 15:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-19 2:46 [PATCH v2 0/2] Cirrus Logic CS2600 clock device Paul Handrigan
2024-12-19 2:46 ` [PATCH v2 1/2] dt-binding: clock: cs2600: Add support for the CS2600 Paul Handrigan
2024-12-19 8:51 ` Krzysztof Kozlowski
2024-12-19 11:02 ` Charles Keepax
2024-12-19 11:39 ` Krzysztof Kozlowski
2024-12-19 12:59 ` Charles Keepax
2024-12-19 13:16 ` Krzysztof Kozlowski
2024-12-19 13:36 ` Richard Fitzgerald
2024-12-19 15:57 ` Krzysztof Kozlowski [this message]
2024-12-19 16:22 ` Richard Fitzgerald
2024-12-21 20:19 ` Krzysztof Kozlowski
2024-12-19 2:46 ` [PATCH v2 2/2] clk: cs2600: Add Fractional-N clock driver Paul Handrigan
2024-12-19 8:48 ` Krzysztof Kozlowski
2024-12-19 10:51 ` Charles Keepax
2024-12-19 11:40 ` Krzysztof Kozlowski
2024-12-19 12:45 ` Charles Keepax
2024-12-19 12:52 ` Krzysztof Kozlowski
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=c7278ed3-9361-4cd1-ad28-cdbcc3d84bcd@kernel.org \
--to=krzk@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=patches@opensource.cirrus.com \
--cc=paulha@opensource.cirrus.com \
--cc=rf@opensource.cirrus.com \
--cc=robh@kernel.org \
--cc=sboyd@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;
as well as URLs for NNTP newsgroup(s).