From: "Mathieu Dubois-Briand" <mathieu.dubois-briand@bootlin.com>
To: "Uwe Kleine-König" <ukleinek@kernel.org>
Cc: "Lee Jones" <lee@kernel.org>, "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Kamel Bouhara" <kamel.bouhara@bootlin.com>,
"Linus Walleij" <linus.walleij@linaro.org>,
"Bartosz Golaszewski" <brgl@bgdev.pl>,
"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
"Michael Walle" <mwalle@kernel.org>,
"Mark Brown" <broonie@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Danilo Krummrich" <dakr@kernel.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-input@vger.kernel.org,
linux-pwm@vger.kernel.org, andriy.shevchenko@intel.com,
"Grégory Clement" <gregory.clement@bootlin.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH v13 04/10] pwm: max7360: Add MAX7360 PWM support
Date: Fri, 22 Aug 2025 14:49:10 +0200 [thread overview]
Message-ID: <DC8YVXKCZAE4.5QJM9MP4HJZ5@bootlin.com> (raw)
In-Reply-To: <l5crrk3ugpo2ggjtykcy5eretclgntebyq52xuouekoimbrsvh@u4koyu5z2wwi>
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@bootlin.com>
>>
>> Add driver for Maxim Integrated MAX7360 PWM controller, supporting up to
>> 8 independent PWM outputs.
>>
>> Signed-off-by: Kamel Bouhara <kamel.bouhara@bootlin.com>
>> Co-developed-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
>> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
>> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.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
next prev parent reply other threads:[~2025-08-22 12:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 10:46 [PATCH v13 00/10] Add support for MAX7360 Mathieu Dubois-Briand
2025-08-11 10:46 ` [PATCH v13 01/10] dt-bindings: mfd: gpio: Add MAX7360 Mathieu Dubois-Briand
2025-08-11 10:46 ` [PATCH v13 02/10] mfd: Add max7360 support Mathieu Dubois-Briand
2025-08-11 10:46 ` [PATCH v13 03/10] pinctrl: Add MAX7360 pinctrl driver Mathieu Dubois-Briand
2025-08-11 10:46 ` [PATCH v13 04/10] pwm: max7360: Add MAX7360 PWM support Mathieu Dubois-Briand
2025-08-18 9:05 ` Uwe Kleine-König
2025-08-22 12:49 ` Mathieu Dubois-Briand [this message]
2025-08-11 10:46 ` [PATCH v13 05/10] gpio: regmap: Allow to allocate regmap-irq device Mathieu Dubois-Briand
2025-08-11 10:46 ` [PATCH v13 06/10] gpio: regmap: Allow to provide init_valid_mask callback Mathieu Dubois-Briand
2025-08-11 10:46 ` [PATCH v13 07/10] gpio: max7360: Add MAX7360 gpio support Mathieu Dubois-Briand
2025-08-11 10:46 ` [PATCH v13 08/10] input: keyboard: Add support for MAX7360 keypad Mathieu Dubois-Briand
2025-08-11 10:46 ` [PATCH v13 09/10] input: misc: Add support for MAX7360 rotary Mathieu Dubois-Briand
2025-08-11 10:46 ` [PATCH v13 10/10] MAINTAINERS: Add entry on MAX7360 driver Mathieu Dubois-Briand
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=DC8YVXKCZAE4.5QJM9MP4HJZ5@bootlin.com \
--to=mathieu.dubois-briand@bootlin.com \
--cc=andriy.shevchenko@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=dakr@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=gregory.clement@bootlin.com \
--cc=kamel.bouhara@bootlin.com \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=mwalle@kernel.org \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=ukleinek@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).