From: Christian Marangi <ansuelsmth@gmail.com>
To: "Uwe Kleine-König" <ukleinek@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org,
Andy Shevchenko <andriy.shevchenko@intel.com>,
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 09:40:07 +0200 [thread overview]
Message-ID: <685ba7d9.df0a0220.e1b22.e6c2@mx.google.com> (raw)
In-Reply-To: <dehsalp2za4i6jgod6ej6gqhestljo7qost66jzmql52n2zecp@imtgipg24lv5>
On Wed, Jun 25, 2025 at 09:24:33AM +0200, Uwe Kleine-König wrote:
> Hello Christian,
>
> 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.
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.
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)
--
Ansuel
next prev parent reply other threads:[~2025-06-25 7:40 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 [this message]
2025-06-25 11:18 ` Andy Shevchenko
2025-06-25 12:01 ` Christian Marangi
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=685ba7d9.df0a0220.e1b22.e6c2@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®