All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: "biju.das.au" <biju.das.au@gmail.com>,
	 "linux-pwm@vger.kernel.org" <linux-pwm@vger.kernel.org>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	 Geert Uytterhoeven <geert+renesas@glider.be>,
	Magnus Damm <magnus.damm@gmail.com>,
	 Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Fabrizio Castro <fabrizio.castro.jz@renesas.com>,
	 "linux-renesas-soc@vger.kernel.org"
	<linux-renesas-soc@vger.kernel.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	 Philipp Zabel <p.zabel@pengutronix.de>
Subject: Re: [PATCH v18 3/4] pwm: Add support for RZ/G2L GPT
Date: Thu, 14 Mar 2024 23:33:22 +0100	[thread overview]
Message-ID: <ipm72ujiqm4k2nuq7a6sdmqdrwjwrn7uyp4brgbvmmb5mgu6ko@ljltsjnljett> (raw)
In-Reply-To: <OSAPR01MB1587400FECDBFDB3E38A594286292@OSAPR01MB1587.jpnprd01.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 2273 bytes --]

Hello,

On Thu, Mar 14, 2024 at 06:10:50PM +0000, Biju Das wrote:
> > On Tue, Feb 20, 2024 at 07:43:17PM +0000, Biju Das wrote:
> > > +
> > > +static inline u64 rzg2l_gpt_mul_u64_u64_div_u64(u64 a, u64 b, u64 c)
> > > +{
> > > +	u64 retval;
> > > +
> > > +	if (a > b)
> > > +		retval = mul_u64_u64_div_u64(b, a, c);
> > > +	else
> > > +		retval = mul_u64_u64_div_u64(a, b, c);
> > 
> > With
> > https://lore.kernel.org/lkml/20240303092408.662449-2-u.kleine-koenig@pengutronix.de
> > this function can be replaced by a direct call to mul_u64_u64_div_u64().
> > I expect this patch to go into v6.9-rc1 as akpm picked it up before the merge window opened.
> 
> Ok, I will hold next version until v6.9-rc1 as for-pwm-nexxt doesn't have this patch??

I will rebase the stuff for the v6.10-rc1 merge window on v6.9-rc1, so
(assuming my guess is right) you can profit of the improved
mul_u64_u64_div_u64() call. (And even if the patch will go in later, we
can live with the inexact configuration for that period.)

> > > +static u32 rzg2l_gpt_calculate_pv_or_dc(u64 period_or_duty_cycle, u8
> > > +prescale) {
> > > +	return min_t(u64, (period_or_duty_cycle + (1 << (2 * prescale)) - 1) >> (2 * prescale),
> > > +		     U32_MAX);
> > 
> > Can the addition overflow? Is the addition even right? This function is used in .apply() where it's
> > usually right to round down.
> 
> No, It won't overflow. The logic is proposed by you in v17 for DIV64_U64_ROUND_UP and it is
> passing all tests with PWM_DEBUG=y.

Then believe my former self, I didn't redo all the maths in this cycle.

> > > +	pm_runtime_enable(&pdev->dev);
> > > +	ret = pm_runtime_resume_and_get(&pdev->dev);
> > > +	if (ret)
> > > +		goto err_reset;
> > > +
> > > +	ret = clk_rate_exclusive_get(rzg2l_gpt->clk);
> > 
> > There is a devm variant of this function in the mean time.
> 
> OK, currently for testing I picked it from next.

For the next submission round make sure to properly use the --base
parameter to not annoy the build bots. Or feel free to base your patch
on next.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2024-03-14 22:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20 19:43 [PATCH v18 0/4] Add support for RZ/G2L GPT Biju Das
2024-02-20 19:43 ` [PATCH v18 1/4] dt-bindings: pwm: Add RZ/G2L GPT binding Biju Das
2024-02-20 19:43 ` [PATCH v18 2/4] dt-bindings: pwm: rzg2l-gpt: Document renesas,poegs property Biju Das
2024-02-20 19:43 ` [PATCH v18 3/4] pwm: Add support for RZ/G2L GPT Biju Das
2024-03-12  7:20   ` Uwe Kleine-König
2024-03-12  8:11     ` Geert Uytterhoeven
2024-03-12  9:27       ` Uwe Kleine-König
2024-03-14 18:10     ` Biju Das
2024-03-14 22:33       ` Uwe Kleine-König [this message]
2024-03-15  7:19         ` Biju Das
2024-02-20 19:43 ` [PATCH v18 4/4] pwm: rzg2l-gpt: Add support for gpt linking with poeg Biju Das

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=ipm72ujiqm4k2nuq7a6sdmqdrwjwrn7uyp4brgbvmmb5mgu6ko@ljltsjnljett \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=biju.das.au@gmail.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=fabrizio.castro.jz@renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=kernel@pengutronix.de \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=thierry.reding@gmail.com \
    /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.