lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240520-badly-islamist-dcae9fe1303b@spud>
Date: Mon, 20 May 2024 20:41:31 +0100
From: Conor Dooley <conor@...nel.org>
To: Guenter Roeck <linux@...ck-us.net>
Cc: Chris Packham <chris.packham@...iedtelesis.co.nz>, jdelvare@...e.com,
	robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
	ukleinek@...nel.org, linux-hwmon@...r.kernel.org,
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-pwm@...r.kernel.org
Subject: Re: [PATCH v3 1/3] dt-bindings: hwmon: Add adt7475 fan/pwm properties

On Mon, May 20, 2024 at 12:03:42PM -0700, Guenter Roeck wrote:
> On 5/20/24 09:49, Conor Dooley wrote:
> > On Mon, May 20, 2024 at 03:03:19PM +1200, Chris Packham wrote:
> > > Add fan child nodes that allow describing the connections for the
> > > ADT7475 to the fans it controls. This also allows setting some
> > > initial values for the pwm duty cycle and frequency.
> > > 
> > > Signed-off-by: Chris Packham <chris.packham@...iedtelesis.co.nz>
> > > ---
> > > 
> > > Notes:
> > >      Changes in v3:
> > >      - Use the pwm provider/consumer bindings
> > >      Changes in v2:
> > >      - Document 0 as a valid value (leaves hardware as-is)
> > > 
> > >   .../devicetree/bindings/hwmon/adt7475.yaml    | 25 ++++++++++++++++++-
> > >   1 file changed, 24 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/hwmon/adt7475.yaml b/Documentation/devicetree/bindings/hwmon/adt7475.yaml
> > > index 051c976ab711..99bd689ae0cd 100644
> > > --- a/Documentation/devicetree/bindings/hwmon/adt7475.yaml
> > > +++ b/Documentation/devicetree/bindings/hwmon/adt7475.yaml
> > > @@ -51,6 +51,15 @@ properties:
> > >         enum: [0, 1]
> > >         default: 1
> > > +  "#pwm-cells":
> > > +    const: 4
> > > +    description: |
> > > +      Number of cells in a PWM specifier.
> > > +      - 0: The pwm channel
> > > +      - 1: The pwm frequency in hertz - 0, 11, 14, 22, 29, 35, 44, 58, 88, 22500
> > 
> > The standard binding is period in nanoseconds, not frequency in Hz.
> > What's gained from deviating from that?
> > 
> 
> I'd strongly suspect that Chris didn't know and didn't expect it,
> just like me.

I did point out on v2 that the information on the standard binding was
in pwm.txt, but I also said "order it has <index freq flags duty>" which
likely didn't help. I did however CC you both on a patch the other day
where I fixed pwm.yaml so that it actually contained the information on
what the cells represented.
> > > +      - 2: PWM flags 0 or PWM_POLARITY_INVERTED
> > > +      - 3: The default pwm duty cycle - 0-255
> > 
> > Same here I guess, why not match the units used for the period for the
> > duty cycle?
> > 
> 
> Same here. I am used to pwm frequency in Hz and duty cycle as percentage.
> Using the period instead is somewhat unusual, and I must admit that I
> have never encountered it while dealing with a variety of fan controllers.

If it is what makes sense to use, because it's what everyone and their
mother documents, then sure. My rationale I suppose was threefold:
- Consistency with the period
- Time would be more portable between providers, if 8 bits of precision
  is deemed insufficient for some providers.
- Last & least, the PWM APIs in the kernel use time for the dutycycle

If you're going to use percentages rather than time, would it not
make more sense to either use percent itself with a 0-100 range or use
basis points if percent doesn't provide sufficient granularity?

I think it'd be good of Uwe chimed in, given we're discussing a PWM
provider binding after all.

> Just to make sure I understand this correctly - duty cycles would

s/duty cycles/periods/

> be (rounded):
> 
> Hz	ns
> 11	90,909,091
> 14	71,428,571
> 22	45,454,545
> 29:	34,482,759
> 35:	28,571,429
> 44:	22,727,273
> 58:	17,241,379
> 88:	11,363,636
> 22500	44,444
> 
> Examples for duty cycles would be
> 
> 20%: 0,2s or 200,000,000
> 50%: 0.5s or 500,000,000
> 80%: 0.8s or 800,000,000
> 
> Is that correct ?

Assuming a 1 second period, those look as expected.

Cheers,
Conor.


Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ