lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
 <TY3PR01MB11346DDBABC31DBC7F94724F38615A@TY3PR01MB11346.jpnprd01.prod.outlook.com>
Date: Mon, 15 Sep 2025 11:10:59 +0000
From: Biju Das <biju.das.jz@...renesas.com>
To: Uwe Kleine-König <ukleinek@...nel.org>
CC: biju.das.au <biju.das.au@...il.com>, "linux-pwm@...r.kernel.org"
	<linux-pwm@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, Geert Uytterhoeven <geert+renesas@...der.be>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@...renesas.com>,
	"linux-renesas-soc@...r.kernel.org" <linux-renesas-soc@...r.kernel.org>
Subject: RE: [PATCH v2] pwm: rzg2l-gpt: Implementation of the waveform
 callbacks

Hi Uwe,

Thanks for the feedback.

> -----Original Message-----
> From: Uwe Kleine-König <ukleinek@...nel.org>
> Sent: 12 September 2025 13:32
> Subject: Re: [PATCH v2] pwm: rzg2l-gpt: Implementation of the waveform callbacks
> 
> Hello Biju,
> 
> On Thu, Sep 11, 2025 at 09:46:38AM +0000, Biju Das wrote:
> > > -----Original Message-----
> > > From: Uwe Kleine-König <ukleinek@...nel.org>
> > > Sent: 09 September 2025 16:19
> > > On Thu, Aug 14, 2025 at 12:50:20PM +0100, Biju wrote:
> > > > -/* Caller holds the lock while calling rzg2l_gpt_config() */
> > > > -static int rzg2l_gpt_config(struct pwm_chip *chip, struct pwm_device *pwm,
> > > > -			    const struct pwm_state *state)
> > > > +static int rzg2l_gpt_round_waveform_tohw(struct pwm_chip *chip,
> > > > +					 struct pwm_device *pwm,
> > > > +					 const struct pwm_waveform *wf,
> > > > +					 void *_wfhw)
> > > > +
> > > >  {
> > > >  	struct rzg2l_gpt_chip *rzg2l_gpt = to_rzg2l_gpt_chip(chip);
> > > > -	u8 sub_ch = rzg2l_gpt_subchannel(pwm->hwpwm);
> > > > +	struct rzg2l_gpt_waveform *wfhw = _wfhw;
> > > >  	u8 ch = RZG2L_GET_CH(pwm->hwpwm);
> > > >  	u64 period_ticks, duty_ticks;
> > > >  	unsigned long pv, dc;
> > > > -	u8 prescale;
> > > > +
> > > > +	guard(mutex)(&rzg2l_gpt->lock);
> > > > +	if (wf->period_length_ns == 0) {
> > > > +		*wfhw = (struct rzg2l_gpt_waveform){
> > > > +			.gtpr = 0,
> > > > +			.gtccr = 0,
> > > > +			.prescale = 0,
> > > > +		};
> > > > +
> > > > +		return 0;
> > > > +	}
> > > >
> > > >  	/* Limit period/duty cycle to max value supported by the HW */
> > > > -	period_ticks = mul_u64_u64_div_u64(state->period, rzg2l_gpt->rate_khz, USEC_PER_SEC);
> > > > +	period_ticks = mul_u64_u64_div_u64(wf->period_length_ns,
> > > > +rzg2l_gpt->rate_khz, USEC_PER_SEC);
> > > >  	if (period_ticks > RZG2L_MAX_TICKS)
> > > >  		period_ticks = RZG2L_MAX_TICKS;
> > > >  	/*
> > >
> > > The code that follows here needs adaption. Other than .apply(),
> > > .round_waveform_tohw() is supposed to not fail if the requested
> > > period is too small but use the smallest possible value then (and return 1).
> >
> >
> > You mean something like below
> >
> >         if (rzg2l_gpt->channel_request_count[ch] > 1) {
> >                 if (period_ticks < rzg2l_gpt->period_ticks[ch])
> > -                       return -EBUSY;
> > +                       is_small_second_period = true;
> >                 else
> >                         period_ticks = rzg2l_gpt->period_ticks[ch];
> >         }
> > @@ -272,6 +276,9 @@ static int rzg2l_gpt_round_waveform_tohw(struct pwm_chip *chip,
> >         wfhw->prescale = rzg2l_gpt_calculate_prescale(rzg2l_gpt, period_ticks);
> >         pv = rzg2l_gpt_calculate_pv_or_dc(period_ticks, wfhw->prescale);
> >         wfhw->gtpr = pv;
> > +       if (is_small_second_period)
> > +               return 1;
> 
> Just locking at the diff: Yes, that looks about right. I guess you also need `period_ticks = rzg2l_gpt-
> >period_ticks[ch]` in the is_small_second_period==true case.


OK, will send V3 incorporating these changes.

Cheers,
Biju

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ