From: Christian Marangi <ansuelsmth@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Uwe Kleine-König" <ukleinek@kernel.org>,
linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org,
"Benjamin Larsson" <benjamin.larsson@genexis.eu>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Lorenzo Bianconi" <lorenzo@kernel.org>
Subject: Re: [PATCH v16 2/2] pwm: airoha: Add support for EN7581 SoC
Date: Wed, 25 Jun 2025 14:01:06 +0200 [thread overview]
Message-ID: <685be504.050a0220.1095cd.0c7f@mx.google.com> (raw)
In-Reply-To: <aFvbDdVdoroASlM6@smile.fi.intel.com>
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
next prev parent reply other threads:[~2025-06-25 12:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-25 0:00 [PATCH v16 1/2] math64.h: provide rounddown_u64 variant for rounddown macro Christian Marangi
2025-06-25 0:00 ` [PATCH v16 2/2] pwm: airoha: Add support for EN7581 SoC Christian Marangi
2025-06-25 7:24 ` Uwe Kleine-König
2025-06-25 7:40 ` Christian Marangi
2025-06-25 11:18 ` Andy Shevchenko
2025-06-25 12:01 ` Christian Marangi [this message]
2025-06-25 14:05 ` Uwe Kleine-König
2025-06-25 11:39 ` [PATCH v16 1/2] math64.h: provide rounddown_u64 variant for rounddown macro Andy Shevchenko
2025-06-25 13:16 ` Christian Marangi
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=685be504.050a0220.1095cd.0c7f@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=andriy.shevchenko@intel.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=benjamin.larsson@genexis.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=lorenzo@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.