Re: [PATCH v18 3/4] pwm: Add support for RZ/G2L GPT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx
> > 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: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux