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: <ucygzs2tom6ukfaqg5gujt2uiluawhfccaxjrxyisxuut2u4zi@rlhjecrfwkyz>
Date: Wed, 25 Jun 2025 16:05:22 +0200
From: Uwe Kleine-König <ukleinek@...nel.org>
To: Christian Marangi <ansuelsmth@...il.com>
Cc: linux-kernel@...r.kernel.org, linux-pwm@...r.kernel.org, 
	Andy Shevchenko <andriy.shevchenko@...el.com>, Benjamin Larsson <benjamin.larsson@...exis.eu>, 
	AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>, Lorenzo Bianconi <lorenzo@...nel.org>
Subject: Re: [PATCH v16 2/2] pwm: airoha: Add support for EN7581 SoC

Hello Christian,

On Wed, Jun 25, 2025 at 09:40:07AM +0200, Christian Marangi wrote:
> On Wed, Jun 25, 2025 at 09:24:33AM +0200, Uwe Kleine-König wrote:
> > On Wed, Jun 25, 2025 at 02:00:39AM +0200, Christian Marangi wrote:
> > > +	/*
> > > +	 * Period goes at 4ns step, normalize it to check if we can
> > > +	 * share a generator.
> > > +	 */
> > > +	period_ns = rounddown_u64(period_ns, AIROHA_PWM_PERIOD_TICK_NS);
> > 
> > I don't understand why you need that. If you clamp to
> > AIROHA_PWM_PERIOD_MAX_NS first, you don't need the (expensive) 64-bit
> > operation. If you compare using ticks instead of ns you don't even need
> > to round down, but just do the division that you end up doing anyhow.
> 
> Correct me if I'm wrong but 

I will :-)
 
> #define NSEC_PER_SEC	1000000000L
> #define AIROHA_PWM_PERIOD_MAX_NS       (1 * NSEC_PER_SEC)
> 
> doesn't fit u32 so an u64 is needed.

1000000000 = 0x3b9aca00, that are 30 bits.
 
> And using ns until the apply process is handy for bucket sharing. I can
> change it to reference ticks but I think the round is necessary.

It's only handy as you track ns for the buckets. Changing that to
ticks, too, makes this all naturally fit again.
 
> You want to change everything to reference tick? (honestly this is a
> good chance to introduce this missing API, since I feel also other might
> benefits from this)

I don't understand that, but I think yes. Doing the bucket selection in
ticks sounds right.

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