public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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 v14 04/10] pwm: max7360: Add MAX7360 PWM support
Date: Fri, 12 Sep 2025 14:05:24 +0200	[thread overview]
Message-ID: <DCQT3UNG2Y41.2V411GFLLDVEP@bootlin.com> (raw)
In-Reply-To: <7jytyub4v7tn6vbwh4drusaagnskl2dsfg2xr6eqp4leqpfq3y@a7g3de5echs4>

On Fri Sep 12, 2025 at 10:57 AM CEST, Uwe Kleine-König wrote:
> On Sun, Aug 24, 2025 at 01:57:23PM +0200, Mathieu Dubois-Briand wrote:
>> +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);
>
> duty_steps is never bigger than MAX7360_PWM_MAX, isn't it? Then this can
> be simplified to just
>
> 	wfhw->duty_steps = duty_steps;
>

Ok, I reviewed this section and I do agree with you. I will prepare a
new patch to fix this line and will send it separately.

> Otherwise looks fine to me.
>
> To get this series forward, it's OK for me to apply the series as is via
> Lee's MFD tree and cope for this minor optimisation later. So:
>
> Acked-by: Uwe Kleine-König <ukleinek@kernel.org>
>
> Best regards
> Uwe

Thanks,
Mathieu

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


  reply	other threads:[~2025-09-12 12:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-24 11:57 [PATCH v14 00/10] Add support for MAX7360 Mathieu Dubois-Briand
2025-08-24 11:57 ` [PATCH v14 01/10] dt-bindings: mfd: gpio: Add MAX7360 Mathieu Dubois-Briand
2025-08-24 11:57 ` [PATCH v14 02/10] mfd: Add max7360 support Mathieu Dubois-Briand
2025-08-24 11:57 ` [PATCH v14 03/10] pinctrl: Add MAX7360 pinctrl driver Mathieu Dubois-Briand
2025-08-24 11:57 ` [PATCH v14 04/10] pwm: max7360: Add MAX7360 PWM support Mathieu Dubois-Briand
2025-09-12  6:23   ` Mathieu Dubois-Briand
2025-09-12  8:57   ` Uwe Kleine-König
2025-09-12 12:05     ` Mathieu Dubois-Briand [this message]
2025-08-24 11:57 ` [PATCH v14 05/10] gpio: regmap: Allow to allocate regmap-irq device Mathieu Dubois-Briand
2025-08-24 11:57 ` [PATCH v14 06/10] gpio: regmap: Allow to provide init_valid_mask callback Mathieu Dubois-Briand
2025-08-24 11:57 ` [PATCH v14 07/10] gpio: max7360: Add MAX7360 gpio support Mathieu Dubois-Briand
2025-08-24 11:57 ` [PATCH v14 08/10] input: keyboard: Add support for MAX7360 keypad Mathieu Dubois-Briand
2025-08-24 11:57 ` [PATCH v14 09/10] input: misc: Add support for MAX7360 rotary Mathieu Dubois-Briand
2025-08-24 11:57 ` [PATCH v14 10/10] MAINTAINERS: Add entry on MAX7360 driver Mathieu Dubois-Briand
2025-09-02 15:23 ` [PATCH v14 00/10] Add support for MAX7360 Lee Jones
2025-09-12 12:07   ` Mathieu Dubois-Briand
2025-09-16 14:34 ` Lee Jones
2025-09-16 14:35   ` Lee Jones
2025-09-17 10:16 ` [GIT PULL] Immutable branch between MFD, GPIO, Input, Pinctrl and PWM due for the v6.18 merge window Lee Jones

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=DCQT3UNG2Y41.2V411GFLLDVEP@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