mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gokul Praveen <g-praveen@ti.com>
To: "Kumar, Udit" <u-kumar1@ti.com>,
	"Uwe Kleine-König" <ukleinek@kernel.org>
Cc: "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 11:23:54 +0530	[thread overview]
Message-ID: <77e5712b-e1f9-4fb7-85df-45e1ade6a8eb@ti.com> (raw)
In-Reply-To: <80a2c59a-fe7a-4244-a374-bfc70dc46978@ti.com>

Hi Uwe and Udit,


On 20/01/26 10:10, Kumar, Udit wrote:
> Hi Uwe,
> 
> On 1/20/2026 3:03 AM, Uwe Kleine-König wrote:
>> On Mon, Jan 19, 2026 at 08:30:08PM +0530, Kumar, Udit wrote:
>>> Hi Uwe/Gokul,
>>>
>>> On 1/12/2026 12:52 PM, Uwe Kleine-König wrote:
>>>> Hello Gokul,
>>>>
>>>> On Mon, Jan 12, 2026 at 11:21:50AM +0530, Gokul Praveen wrote:
>>>>> On 10/01/26 04:23, Uwe Kleine-König wrote:
>>>>>> As I cannot reproduce the issue, can you please check if adding
>>>>>>
>>>>>>     pm_runtime_get_sync(pwmchip_parent(chip));
>>>>>>
>>>>>> to the probe function makes the problem disappear? Also please 
>>>>>> boot with
>>>>>>
>>>>>>     trace_event=pwm
>>>>>>
>>>>>> on the command line and provide the content of
>>>>>> /sys/kernel/debug/tracing/trace after reproducing the problem.
>>>>> sure Uwe, I will try this from my side.
>>>>>
>>>>> In the meantime, will you able to test the same on TI J784S4 EVM as 
>>>>> the
>>>>> issue was reproduced on this board.
>>>> I don't have such hardware, sorry. The boards with TI SoC on my desk 
>>>> are
>>>> only a Beaglebone Black and a BeaglePlay. (And I didn't setup the
>>>> BeaglePlay yet, it was already quite a hassle to make the boneblack 
>>>> work
>>>> with a recent kernel. In the end it looks trivial, but
>>>> https://salsa.debian.org/kernel-team/linux/-/merge_requests/1777 plus
>>>> unreliable netbooting in the bootloader took me several hours to sort
>>>> out.)
>>> I am able to see this issue on J7200 hardware ,
>>>
>>> LTM, it may work on certain devices, depending upon how LPSC (Local 
>>> power
>>> state controller) and PSC (power state controller))
>>>
>>> are managed.
>>>
>>> In original code , while putting sync at
>>>
>>> https://elixir.bootlin.com/linux/v6.18.6/source/drivers/pwm/pwm- 
>>> tiehrpwm.c#L293
>>>
>>>
>>> will leads to calling genpd driver [0], which may put PWM IP in 
>>> powered down
>>> state, leading to loosing contents.
>>>
>>> So, we need retain pm count (genpd on in fact) between config and enable
>>> call.
>>>
>>> Therefore this patch LGTM
>> 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
> 

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.

Best Regards
Gokul Praveen

> Above changes will achieve same as well.
> 
> 
>>       if (state->polarity != pwm->state.polarity) {
>>           if (enabled) {
>>               ehrpwm_pwm_disable(chip, pwm);
>>
>> is enough to fix the issue. (We need something like
>> https://lore.kernel.org/linux-pwm/20251123233349.2122-1- 
>> rafael.v.volkmer@gmail.com/
>> to make this really robust.)
>>
>> Best regards
>> Uwe


  reply	other threads:[~2026-01-20  5:54 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 [this message]
2026-01-20  8:23                         ` Uwe Kleine-König
2026-01-20  8:34                           ` Gokul Praveen
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=77e5712b-e1f9-4fb7-85df-45e1ade6a8eb@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®