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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tm57fsmijq4t4y4dpmtss63ekzpm5oefir5tz4aioxq5dx4or6@lgoqjpxc3axh>
Date: Fri, 28 Feb 2025 16:18:05 +0100
From: Uwe Kleine-König <ukleinek@...nel.org>
To: David Jander <david@...tonic.nl>
Cc: Krzysztof Kozlowski <krzk@...nel.org>, linux-kernel@...r.kernel.org, 
	linux-iio@...r.kernel.org, Jonathan Corbet <corbet@....net>, Rob Herring <robh@...nel.org>, 
	Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, devicetree@...r.kernel.org, 
	linux-doc@...r.kernel.org, Nuno Sa <nuno.sa@...log.com>, 
	Jonathan Cameron <jic23@...nel.org>, Oleksij Rempel <o.rempel@...gutronix.de>, 
	linux-pwm@...r.kernel.org
Subject: Re: [RFC PATCH 7/7] dt-bindings: motion: Add motion-simple-pwm
 bindings

Hey David,

On Fri, Feb 28, 2025 at 11:09:31AM +0100, David Jander wrote:
> On Fri, 28 Feb 2025 10:37:48 +0100
> Krzysztof Kozlowski <krzk@...nel.org> wrote:
> 
> > On 28/02/2025 10:22, David Jander wrote:
> > >   
> > >>> +
> > >>> +  motion,pwm-inverted:
> > >>> +    $ref: /schemas/types.yaml#/definitions/flag    
> > >>
> > >> And PWM flag does not work?  
> > > 
> > > I have seen PWM controllers that don't seem to support the
> > > PWM_POLARITY_INVERTED flag and those where it just doesn't work. Should all  
> > 
> > 
> > Shouldn't the controllers be fixed? Or let's rephrase the question: why
> > only this PWM consumer needs this property and none of others need it?
> 
> CCing Uwe Kleine-Koenig and linux-pwm mailing list.
> 
> I know that at least in kernel 6.11 the pwm-stm32.c PWM driver doesn't
> properly invert the PWM signal when specifying PWM_POLARITY_INVERTED. I agree
> this is a probably bug that needs fixing if still present in 6.14-rc. Besides
> that, if linux-pwm agrees that every single PWM driver _must_ properly support
> this flag, I will drop this consumer flag an start fixing broken PWM drivers
> that I encounter. I agree that it makes more sense this way, but I wanted to
> be sure.

Some hardwares cannot support PWM_POLARITY_INVERTED. Affected drivers
include:

	pwm-adp5585
	pwm-ntxec
	pwm-raspberrypi-poe
	pwm-rz-mtu3 (software limitation only)
	pwm-sunplus
	pwm-twl-led (not completely sure, that one is strange)

. ISTR that there is a driver that does only support inverted polarity,
but I don't find it. For an overview I recommend reading through the
output of:

	for f in drivers/pwm/pwm-*; do
		echo $f;
		sed -rn '/Limitations:/,/\*\/?$/p' $f;
		echo;
	done | less

. (Note not all drivers have commentary in the right format to unveil
their limitations.)

For most use-cases you can just do

	.duty_cycle = .period - .duty_cycle

instead of inverting polarity, but there is no abstraction in the PWM
bindings for that and also no helpers in the PWM framework. The problem
is more or less ignored, so if you have a device with

	pwms = <&pwm0 0 PWM_POLARITY_INVERTED>;

and the PWM chip in question doesn't support that, the pwm API functions
will fail. So the system designer better makes sure that the PWM
hardware can cope with the needed polarity.

Best regards
Uwe

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ