From: "Uwe Kleine-König" <ukleinek@kernel.org>
To: Biju <biju.das.au@gmail.com>
Cc: Biju Das <biju.das.jz@bp.renesas.com>,
linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>,
Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v6 06/11] pwm: rzg2l-gpt: Convert to waveform callbacks
Date: Thu, 16 Jul 2026 10:47:01 +0200 [thread overview]
Message-ID: <aliXW2JWc6OoY9FG@monoceros> (raw)
In-Reply-To: <20260604095647.108654-7-biju.das.jz@bp.renesas.com>
[-- Attachment #1: Type: text/plain, Size: 2075 bytes --]
Hello Biju,
On Thu, Jun 04, 2026 at 10:56:36AM +0100, Biju wrote:
> @@ -291,29 +285,84 @@ static int rzg2l_gpt_config(struct pwm_chip *chip, struct pwm_device *pwm,
> if (rzg2l_gpt->channel_request_count[ch] > 1) {
> u8 sibling_ch = rzg2l_gpt_sibling(pwm->hwpwm);
>
> - if (rzg2l_gpt_is_ch_enabled(rzg2l_gpt, sibling_ch)) {
> + if (rzg2l_gpt_is_ch_enabled(rzg2l_gpt, sibling_ch, NULL)) {
> if (period_ticks < rzg2l_gpt->period_ticks[ch])
> - return -EBUSY;
> + is_small_second_period = true;
>
> period_ticks = rzg2l_gpt->period_ticks[ch];
> }
> }
>
> - prescale = rzg2l_gpt_calculate_prescale(period_ticks);
> - pv = rzg2l_gpt_calculate_pv_or_dc(period_ticks, prescale);
> + wfhw->prescale = rzg2l_gpt_calculate_prescale(period_ticks);
> + wfhw->gtpr = rzg2l_gpt_calculate_pv_or_dc(period_ticks, wfhw->prescale);
> + wfhw->gtccr = 0;
> + if (is_small_second_period)
If is_small_second_period == true, the prescale doesn't need to be
recalculated as the other twin already has this configured? But not sure
that reading the value (or storing it in drvdata) is better/faster than
recalculating. So judge yourself.
Also moving
`wfhw->gtccr = 0` into the if block reduces (my) confusion a bit.
> + return 1;
>
> - duty_ticks = mul_u64_u64_div_u64(state->duty_cycle, rzg2l_gpt->rate_khz, USEC_PER_SEC);
> + duty_ticks = mul_u64_u64_div_u64(wf->duty_length_ns, rzg2l_gpt->rate_khz, USEC_PER_SEC);
NSEC_PER_MSEC would be more logically sound here. (But this is a
pre-existing mini issue.)
> if (duty_ticks > period_ticks)
> duty_ticks = period_ticks;
> - dc = rzg2l_gpt_calculate_pv_or_dc(duty_ticks, prescale);
> + wfhw->gtccr = rzg2l_gpt_calculate_pv_or_dc(duty_ticks, wfhw->prescale);
>
> - /*
> - * GPT counter is shared by multiple channels, we cache the period ticks
> - * from the first enabled channel and use the same value for both
> - * channels.
> - */
> - rzg2l_gpt->period_ticks[ch] = period_ticks;
> + return 0;
> +}
Remainder looks good.
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2026-07-16 8:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 9:56 [PATCH v6 00/11] Add Renesas RZ/G3E GPT support Biju
2026-06-04 9:56 ` [PATCH v6 01/11] pwm: rzg2l-gpt: Fix period_ticks type from u32 to u64 Biju
2026-06-09 13:42 ` Uwe Kleine-König
2026-06-04 9:56 ` [PATCH v6 02/11] dt-bindings: pwm: rzg2l-gpt: Document renesas,poegs property Biju
2026-06-04 9:56 ` [PATCH v6 03/11] pwm: rzg2l-gpt: Add support for gpt linking with poeg Biju
2026-07-16 8:25 ` Uwe Kleine-König
2026-06-04 9:56 ` [PATCH v6 04/11] pwm: rzg2l-gpt: Add missing newlines to dev_err_probe() messages Biju
2026-06-09 13:50 ` Uwe Kleine-König
2026-06-04 9:56 ` [PATCH v6 05/11] pwm: rzg2l-gpt: Drop unused rzg2l_gpt_chip parameter from rzg2l_gpt_calculate_prescale() Biju
2026-07-16 8:29 ` Uwe Kleine-König
2026-06-04 9:56 ` [PATCH v6 06/11] pwm: rzg2l-gpt: Convert to waveform callbacks Biju
2026-07-16 8:47 ` Uwe Kleine-König [this message]
2026-06-04 9:56 ` [PATCH v6 07/11] pwm: rzg2l-gpt: Add info variable to struct rzg2l_gpt_chip Biju
2026-06-04 9:56 ` [PATCH v6 08/11] pwm: rzg2l-gpt: Add prescale_mult variable to struct rzg2l_gpt_info Biju
2026-06-04 9:56 ` [PATCH v6 09/11] pwm: rzg2l-gpt: Add calculate_prescale() callback " Biju
2026-06-04 9:56 ` [PATCH v6 10/11] dt-bindings: pwm: Document RZ/G3E GPT support Biju
2026-06-04 9:56 ` [PATCH v6 11/11] pwm: rzg2l-gpt: Add RZ/G3E support Biju
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=aliXW2JWc6OoY9FG@monoceros \
--to=ukleinek@kernel.org \
--cc=biju.das.au@gmail.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=geert+renesas@glider.be \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox