[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <685be504.050a0220.1095cd.0c7f@mx.google.com>
Date: Wed, 25 Jun 2025 14:01:06 +0200
From: Christian Marangi <ansuelsmth@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: Uwe Kleine-König <ukleinek@...nel.org>,
linux-kernel@...r.kernel.org, linux-pwm@...r.kernel.org,
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
On Wed, Jun 25, 2025 at 02:18:37PM +0300, Andy Shevchenko wrote:
> 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
> >
> > #define NSEC_PER_SEC 1000000000L
> > #define AIROHA_PWM_PERIOD_MAX_NS (1 * NSEC_PER_SEC)
> >
> > doesn't fit u32 so an u64 is needed.
>
> I'm not sure what was the exact question, but u32 can hold up to 4*10^9,
> this is just 1*10^9.
>
Ok feeling stupid... was treating 1000000000 as 0x1000000000 :D
--
Ansuel
Powered by blists - more mailing lists