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] [day] [month] [year] [list]
Message-Id: <DC8YVXKCZAE4.5QJM9MP4HJZ5@bootlin.com>
Date: Fri, 22 Aug 2025 14:49:10 +0200
From: "Mathieu Dubois-Briand" <mathieu.dubois-briand@...tlin.com>
To: Uwe Kleine-König <ukleinek@...nel.org>
Cc: "Lee Jones" <lee@...nel.org>, "Rob Herring" <robh@...nel.org>,
 "Krzysztof Kozlowski" <krzk+dt@...nel.org>, "Conor Dooley"
 <conor+dt@...nel.org>, "Kamel Bouhara" <kamel.bouhara@...tlin.com>, "Linus
 Walleij" <linus.walleij@...aro.org>, "Bartosz Golaszewski" <brgl@...ev.pl>,
 "Dmitry Torokhov" <dmitry.torokhov@...il.com>, "Michael Walle"
 <mwalle@...nel.org>, "Mark Brown" <broonie@...nel.org>, "Greg
 Kroah-Hartman" <gregkh@...uxfoundation.org>, "Rafael J. Wysocki"
 <rafael@...nel.org>, "Danilo Krummrich" <dakr@...nel.org>,
 <devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
 <linux-gpio@...r.kernel.org>, <linux-input@...r.kernel.org>,
 <linux-pwm@...r.kernel.org>, <andriy.shevchenko@...el.com>,
 Grégory Clement <gregory.clement@...tlin.com>, "Thomas
 Petazzoni" <thomas.petazzoni@...tlin.com>, "Andy Shevchenko"
 <andriy.shevchenko@...ux.intel.com>
Subject: Re: [PATCH v13 04/10] pwm: max7360: Add MAX7360 PWM support

On Mon Aug 18, 2025 at 11:05 AM CEST, Uwe Kleine-König wrote:
> Hello,
>
> On Mon, Aug 11, 2025 at 12:46:22PM +0200, Mathieu Dubois-Briand wrote:
>> From: Kamel Bouhara <kamel.bouhara@...tlin.com>
>> 
>> Add driver for Maxim Integrated MAX7360 PWM controller, supporting up to
>> 8 independent PWM outputs.
>> 
>> Signed-off-by: Kamel Bouhara <kamel.bouhara@...tlin.com>
>> Co-developed-by: Mathieu Dubois-Briand <mathieu.dubois-briand@...tlin.com>
>> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@...tlin.com>
>> Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
>> ---
>> ...
>> +static int max7360_pwm_round_waveform_tohw(struct pwm_chip *chip,
>> +					   struct pwm_device *pwm,
>> +					   const struct pwm_waveform *wf,
>> +					   void *_wfhw)
>> +{
>> +	struct max7360_pwm_waveform *wfhw = _wfhw;
>> +	u64 duty_steps;
>> +
>> +	/*
>> +	 * Ignore user provided values for period_length_ns and duty_offset_ns:
>> +	 * we only support fixed period of MAX7360_PWM_PERIOD_NS and offset of 0.
>> +	 * Values from 0 to 254 as duty_steps will provide duty cycles of 0/256
>> +	 * to 254/256, while value 255 will provide a duty cycle of 100%.
>> +	 */
>> +	if (wf->duty_length_ns >= MAX7360_PWM_PERIOD_NS) {
>> +		duty_steps = MAX7360_PWM_MAX;
>> +	} else {
>> +		duty_steps = (u32)wf->duty_length_ns * MAX7360_PWM_STEPS / MAX7360_PWM_PERIOD_NS;
>> +		if (duty_steps == MAX7360_PWM_MAX)
>> +			duty_steps = MAX7360_PWM_MAX - 1;
>> +	}
>> +
>> +	wfhw->duty_steps = min(MAX7360_PWM_MAX, duty_steps);
>> +	wfhw->enabled = !!wf->period_length_ns;
>> +
>> +	if (wf->period_length_ns < MAX7360_PWM_PERIOD_NS)
>
> I know this code was suggested as is by me, but I think we need:
>
> 	if (wf->period_length_ns && wf->period_length_ns < MAX7360_PWM_PERIOD_NS)
>
> here to prevent to trigger a PWM_DEBUG warning. Sorry to spot this only
> now.
>

Right, this does make sense. I will send a new version shortly.

>> +		return 1;
>> +	else
>> +		return 0;
>> +}
>
> Best regards
> Uwe

Best regards,
Mathieu

-- 
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ