Hi Uwe, > -----Original Message----- > From: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> > Sent: Thursday, March 14, 2024 10:33 PM > Subject: Re: [PATCH v18 3/4] pwm: Add support for RZ/G2L GPT > > 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.) OK. > > > > > +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. OK, I will rebase to next and send v19. Note: 6.9-rc1 on for-nexxt is still missing a patch[1] for cpu performance on ARM64 [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v6.8&id=98323e9d70172f1b46d1cadb20d6c54abf62870d Cheers, Biju