devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: "Nuno Sá" <noname.nuno@gmail.com>
Cc: Nuno Sa <nuno.sa@analog.com>,
	linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org,
	devicetree@vger.kernel.org, Bartosz Golaszewski <brgl@bgdev.pl>,
	Jonathan Corbet <corbet@lwn.net>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Rob Herring <robh+dt@kernel.org>,
	Andy Shevchenko <andy@kernel.org>,
	Jean Delvare <jdelvare@suse.com>,
	Conor Dooley <conor+dt@kernel.org>
Subject: Re: [PATCH 1/2] dt-bindings: hwmon: Add LTC4282 bindings
Date: Mon, 13 Nov 2023 20:12:59 +0000	[thread overview]
Message-ID: <20231113-conclude-throat-fa7b5f63d464@squawk> (raw)
In-Reply-To: <65060d844b4cdab02079a05286b506740623ed53.camel@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3397 bytes --]

On Mon, Nov 13, 2023 at 10:32:17AM +0100, Nuno Sá wrote:
> On Fri, 2023-11-10 at 18:42 +0000, Conor Dooley wrote:
> > On Fri, Nov 10, 2023 at 04:18:45PM +0100, Nuno Sa wrote:

> > > +  adi,clkout-mode:
> > > +    description: |
> > > +      Controls in which mode the CLKOUT PIN should work:
> > > +        0 - Configures the CLKOUT pin to output the internal system clock
> > > +        1 - Configures the CLKOUT pin to output the internal conversion
> > > time
> > > +    $ref: /schemas/types.yaml#/definitions/uint32
> > > +    enum: [0, 1]
> > 
> > I really am not a fan of these types of properties. Part of me says that
> > if you're outputting clocks from this device, then you should be a clock
> > controller. How do consumers of this @clkout@ pin get the rate of the
> > clock?
> 
> I explained it to Guenter as he also argued about this. I'll wait for more
> feedback but it's likely this will just turn into a clock provider, yes.
> 
> > I'd kinda be expecting to see a clocks property with a maxItems of 1 and
> > clock-names with two, mutually exclusive, options.
> > 
> > The other part says, and it applies in multiple places here, that having
> > integer properties with non-integer meanings is a poor ABI. I'd be vastly
> > happier if the various instances in this file became enums of strings,
> > or $re┤evant-unit so that a dts containing these properties is
> > immediately understandable.
> 
> Well, I think you're mentioning the 'gpio-mode' 'and under/over-voltage-
> dividers'. I think for both it's clear that having the relevant units is not
> feasible (at least I'm not seeing a way of properly do it). As for the strings,
> well, I don't have any much to argue other than:

Yeah, sorry - I was kinda making a general point there about not liking
having integer values mapped to some sort of meaning, when units or some
other sort of more meaningful property is possible.
I really do not like these sorts of properties that you go and put
"gpio-mode = <3>;" or whatever in the devicetree.
I know its not quite units, but you could use 5, 10 & 15 as the
allowable values for the divider property and I think that'd be fine.

Oh and now that I think of it - for the divider property, how does
"adi,undervoltage-dividers = 0" differ from omitting the property
altogether? It's not entirely apparently from the binding what that
actually means. If they do differ, I think you need to mention what
the omission of the property means, and if they do not, then that = 0
case should be removed IMO.

> 1) It's pattern seen in a lot of bindings - yes, that's not an excuse to copy
> bad/wrong things over new bindings - but, honestly, it's the first time I have
> someone complaining about it so I never thought it was wrong.
> 
> 2) It makes much more easier to handle the properties in the driver (yeah, I
> know that, as far as you're concerned, this does not matter to you :))

Yeah, with one hat on, sure, I don't care. Realistically I am aware that
having these integers makes your life a little easier though.
> 
> So yeah, if you insist on it, no strong reasons on my side to not do it. As long
> as I see some consistency down the road :)).

From me at least, I try to push people away from these sorts of integer
properties and will continue to do so.

Cheers,
Conor.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2023-11-13 20:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-10 15:18 [PATCH 0/2] Add support for LTC4282 Nuno Sa
2023-11-10 15:18 ` [PATCH 1/2] dt-bindings: hwmon: Add LTC4282 bindings Nuno Sa
2023-11-10 18:42   ` Conor Dooley
2023-11-13  9:32     ` Nuno Sá
2023-11-13 20:12       ` Conor Dooley [this message]
2023-11-20 15:03       ` Guenter Roeck
2023-11-10 15:18 ` [PATCH 2/2] hwmon: ltc4282: add support for the LTC4282 chip Nuno Sa
2023-11-10 16:50   ` Andy Shevchenko
2023-11-13 10:13     ` Nuno Sá
2023-11-13 16:31       ` Andy Shevchenko
2023-11-14  8:36         ` Nuno Sá
2023-11-20 15:00       ` Guenter Roeck
2023-11-11  1:04   ` kernel test robot
2023-11-11 17:22   ` Guenter Roeck
2023-11-13  9:24     ` Nuno Sá
2023-11-20 12:10   ` Dan Carpenter
2023-11-20 14:52     ` Guenter Roeck

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=20231113-conclude-throat-fa7b5f63d464@squawk \
    --to=conor@kernel.org \
    --cc=andy@kernel.org \
    --cc=brgl@bgdev.pl \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=noname.nuno@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=robh+dt@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).