mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gokul Praveen <g-praveen@ti.com>
To: "Uwe Kleine-König" <ukleinek@kernel.org>
Cc: "Kumar, Udit" <u-kumar1@ti.com>,
	"Rafael V. Volkmer" <rafael.v.volkmer@gmail.com>,
	<j-keerthy@ti.com>, <linux-kernel@vger.kernel.org>,
	<linux-pwm@vger.kernel.org>, <n-francis@ti.com>,
	Gokul Praveen <g-praveen@ti.com>
Subject: Re: [PATCH v2] pwm: tiehrpwm: Enable EHRPWM controller before setting configuration
Date: Tue, 20 Jan 2026 14:04:42 +0530	[thread overview]
Message-ID: <e8c7d626-042f-4509-b69b-db83fd70d40d@ti.com> (raw)
In-Reply-To: <5ncoro6nmu4yoqniijjah3hernt7rigmmz6sjjzxcbbyzzpz5a@2einaw7lox32>

Hi Uwe,


On 20/01/26 13:53, Uwe Kleine-König wrote:
> Hello,
> 
> On Tue, Jan 20, 2026 at 11:23:54AM +0530, Gokul Praveen wrote:
>> On 20/01/26 10:10, Kumar, Udit wrote:
>>> On 1/20/2026 3:03 AM, Uwe Kleine-König wrote:
>>>> I doesn't look good to me, it's way to complicated. Unless I still
>>>> misunderstand something, I think
>>>>
>>>> diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
>>>> index 7a86cb090f76..4942689105f3 100644
>>>> --- a/drivers/pwm/pwm-tiehrpwm.c
>>>> +++ b/drivers/pwm/pwm-tiehrpwm.c
>>>> @@ -378,6 +378,8 @@ static int ehrpwm_pwm_apply(struct pwm_chip
>>>> *chip, struct pwm_device *pwm,
>>>>        int err;
>>>>        bool enabled = pwm->state.enabled;
>>>> +    guard(pm_runtime_active)(pwmchip_parent(chip));
>>>> +
>>>
>>>
>>> Fair point,  only need i see to keep in hardware active state after
>>> dropping count at
>>>
>>> https://elixir.bootlin.com/linux/v6.18.6/source/drivers/pwm/pwm-
>>> tiehrpwm.c#L293
> 
> Yes, with my suggested change you can drop ehrpwm_pwm_config() grabbing
> and releasing the pm_runtime reference making the whole change:
> 
> diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
> index 7a86cb090f76..2533c95b0ba9 100644
> --- a/drivers/pwm/pwm-tiehrpwm.c
> +++ b/drivers/pwm/pwm-tiehrpwm.c
> @@ -237,8 +237,6 @@ static int ehrpwm_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
>   	if (period_cycles < 1)
>   		period_cycles = 1;
>   
> -	pm_runtime_get_sync(pwmchip_parent(chip));
> -
>   	/* Update clock prescaler values */
>   	ehrpwm_modify(pc->mmio_base, TBCTL, TBCTL_CLKDIV_MASK, tb_divval);
>   
> @@ -290,8 +288,6 @@ static int ehrpwm_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
>   	if (!(duty_cycles > period_cycles))
>   		ehrpwm_write(pc->mmio_base, cmp_reg, duty_cycles);
>   
> -	pm_runtime_put_sync(pwmchip_parent(chip));
> -
>   	return 0;
>   }
>   
> @@ -378,6 +374,8 @@ static int ehrpwm_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
>   	int err;
>   	bool enabled = pwm->state.enabled;
>   
> +	guard(pm_runtime_active)(pwmchip_parent(chip));
> +
>   	if (state->polarity != pwm->state.polarity) {
>   		if (enabled) {
>   			ehrpwm_pwm_disable(chip, pwm);
> 
>> The above changes looks simpler than the one I had sent earlier.
>> Shall I send a v3 patch with these updated changes, if it is okay for you,
>> Uwe.
> 
> I guess that's the only thing that brings us forward, and as I cannot
> reproduce the issue but you can, yes please.
> 

Thanks for the confirmation. I will make the v3 changes and send it /

Thank you for you great support,Uwe.

> Best regards
> Uwe


  reply	other threads:[~2026-01-20  8:34 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-07  5:53 Gokul Praveen
2026-01-07  9:51 ` Uwe Kleine-König
2026-01-07 10:23   ` Gokul Praveen
2026-01-07 19:47   ` Rafael V. Volkmer
2026-01-08  6:40     ` Gokul Praveen
2026-01-08 18:10       ` Uwe Kleine-König
2026-01-09  5:51         ` Gokul Praveen
2026-01-09 22:53           ` Uwe Kleine-König
2026-01-12  5:51             ` Gokul Praveen
2026-01-12  7:22               ` Uwe Kleine-König
2026-01-19 15:00                 ` Kumar, Udit
2026-01-19 21:33                   ` Uwe Kleine-König
2026-01-20  4:40                     ` Kumar, Udit
2026-01-20  5:53                       ` Gokul Praveen
2026-01-20  8:23                         ` Uwe Kleine-König
2026-01-20  8:34                           ` Gokul Praveen [this message]
2026-01-15 10:32             ` Gokul Praveen
2026-01-15 17:17               ` Uwe Kleine-König
2026-01-16  8:41                 ` Gokul Praveen
2026-01-16  9:10                   ` Gokul Praveen
2026-01-19  2:55             ` Rafael V. Volkmer
2026-01-19  6:48               ` Gokul Praveen
2026-01-15  5:20           ` Kumar, Udit
2026-01-15  6:14             ` Gokul Praveen
2026-01-15  7:46               ` Kumar, Udit

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=e8c7d626-042f-4509-b69b-db83fd70d40d@ti.com \
    --to=g-praveen@ti.com \
    --cc=j-keerthy@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=n-francis@ti.com \
    --cc=rafael.v.volkmer@gmail.com \
    --cc=u-kumar1@ti.com \
    --cc=ukleinek@kernel.org \
    /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

all inboxes | Powered by JetHome®