Re: [PATCH 06/15] spi: spi-offload-trigger-pwm: Use duty offset

From: Andy Shevchenko
Date: Sat Aug 30 2025 - 01:03:31 EST


On Sat, Aug 30, 2025 at 3:42 AM Marcelo Schmitt
<marcelo.schmitt@xxxxxxxxxx> wrote:
>
> Pass the duty offset to the waveform pwm.

...

> wf.period_length_ns = DIV_ROUND_UP_ULL(NSEC_PER_SEC, periodic->frequency_hz);
> /* REVISIT: 50% duty-cycle for now - may add config parameter later */
> wf.duty_length_ns = wf.period_length_ns / 2;
> -

Stray - line

> + wf.duty_offset_ns = periodic->offset_ns;
> ret = pwm_round_waveform_might_sleep(st->pwm, &wf);
> if (ret < 0)
> return ret;
>
> periodic->frequency_hz = DIV_ROUND_UP_ULL(NSEC_PER_SEC, wf.period_length_ns);
> -

Ditto.

> + periodic->offset_ns = wf.duty_offset_ns;
> return 0;
> }
>
> @@ -77,6 +77,7 @@ static int spi_offload_trigger_pwm_enable(struct spi_offload_trigger *trigger,
> wf.period_length_ns = DIV_ROUND_UP_ULL(NSEC_PER_SEC, periodic->frequency_hz);
> /* REVISIT: 50% duty-cycle for now - may add config parameter later */
> wf.duty_length_ns = wf.period_length_ns / 2;
> + wf.duty_offset_ns = periodic->offset_ns;

>

Especially as it seems that the pattern is to have a blank line before
last return statements.

> return pwm_set_waveform_might_sleep(st->pwm, &wf, false);
> }


--
With Best Regards,
Andy Shevchenko