mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kumar, Udit" <u-kumar1@ti.com>
To: "Gokul Praveen" <g-praveen@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>
Subject: Re: [PATCH v2] pwm: tiehrpwm: Enable EHRPWM controller before setting configuration
Date: Thu, 15 Jan 2026 13:16:46 +0530	[thread overview]
Message-ID: <2ebce2e1-48d1-4d14-9772-b01d7f388641@ti.com> (raw)
In-Reply-To: <3527b094-5b39-473a-afc1-cfca7baeb3d1@ti.com>


On 1/15/2026 11:44 AM, Gokul Praveen wrote:
> Hi Udit,
>
> On 15/01/26 10:50, Kumar, Udit wrote:
>> Hello Gokul,
>>
>> On 1/9/2026 11:21 AM, Gokul Praveen wrote:
>>> Hi Uwe,
>>>
>>>
>>> On 08/01/26 23:40, Uwe Kleine-König wrote:
>>>> Hello Gokul,
>>>>
>>>> On Thu, Jan 08, 2026 at 12:10:35PM +0530, Gokul Praveen wrote:
>>>>> On 08/01/26 01:17, Rafael V. Volkmer wrote:
>>>>>> Thanks for CC'ing me on this thread.
>>>>>>
>>>>>> On 07/01/26 15:21, Uwe Kleine-König wrote:
>>>>>>> adding Rafael to Cc: who sent a patch series for this driver that I
>>>>>>> didn't come around to review yet. Given that neither he nor me 
>>>>>>> noticed
>>>>>>> the problem addressed in this patch I wonder if it applies to all
>>>>>>> hardware variants.
>>>>>>>
>>>>>>
>>>>>> I also didn't observe the issue described here in my testing: 
>>>>>> duty cycle and
>>>>>> period changes always appeared to take effect as expected.
>>>>>>
>>>>>> My tests were done on an AM623 EVM.
>>>>>>
>>>>>> One possible explanation is that my test flow mostly exercised 
>>>>>> configuration
>>>>>> while the PWM was already enabled/active, which could mask the 
>>>>>> effect of a
>>>>>> put_sync/reset happening after configuration.
>>>>>>
>>>>>
>>>>> Yes, this is the reason why the configuration was taking effect 
>>>>> for you ,
>>>>> Rafael, as the PWM was already enabled when setting the 
>>>>> configuration hence
>>>>> masking the effect of a put_sync/reset happening after configuration.
>>>>
>>>> Can you provide a list of commands that show the failure? That would
>>>> result in less guessing for me. My plan is to reproduce the failure
>>>> tomorrow to better understand it on my boneblack.
>>>>
>>>> Best regards
>>>> Uwe
>>>
>>> Sure Uwe. These are the commands I have tried for PWM signal 
>>> generation:
>>>
>>> cd /sys/class/pwm/pwmchip0
>>> /sys/class/pwm/pwmchip0# echo 0 > export
>>> /sys/class/pwm/pwmchip0# cd pwm0/
>>> /sys/class/pwm/pwmchip0/pwm0# echo 10000000 > period
>>> /sys/class/pwm/pwmchip0/pwm0# echo 3000000 > duty_cycle
>>> /sys/class/pwm/pwmchip0/pwm0# echo "normal" > polarity
>>> /sys/class/pwm/pwmchip0/pwm0# echo 1 > enable
>>>
>>> Once these commands were executed, I measured the PWM signal using 
>>> logic analyzer and the duty cycle was 100% even though we had set 
>>> 30% duty cycle through the sysfs nodes.
>>>
>>> However, with the below command sequence, the duty cycle was getting 
>>> set properly
>>>
>>> cd /sys/class/pwm/pwmchip0
>>> /sys/class/pwm/pwmchip0# echo 0 > export
>>> /sys/class/pwm/pwmchip0# cd pwm0/
>>> /sys/class/pwm/pwmchip0/pwm0# echo 10000000 > period
>>> /sys/class/pwm/pwmchip0/pwm0# echo 3000000 > duty_cycle
>>> /sys/class/pwm/pwmchip0/pwm0# echo "normal" > polarity
>>> /sys/class/pwm/pwmchip0/pwm0# echo 1 > enable
>>> /sys/class/pwm/pwmchip0/pwm0# echo 3000000 > duty_cycle
>>
>>
>> I don't think , this last call of setting duty_cycle , even will land 
>> in driver code .
>>
>>
>>
>
> Can you change the last command to the following. Ideally , it should 
> be a different duty cycle set to enter into the driver code.
>
> >> /sys/class/pwm/pwmchip0/pwm0# echo 6000000 > duty_cycle


Yes it will leads to entry into driver code.

But between below calls, (enable and set duty cycle again)

/sys/class/pwm/pwmchip0/pwm0# echo 1 > enable
/sys/class/pwm/pwmchip0/pwm0# echo 3000000 > duty_cycle

I don't see ehrpwm_pwm_disable will be called.


>
> Best Regards
> Gokul Praveen
>>>
>>>
>>> PWM is working only if we re-update the duty cycle after enabling 
>>> the module.
>>>
>>> If we do not re-update the duty cycle after enabling the module then 
>>> PWM signal line is being high(100 % duty) always.
>>>
>>> Test Environment: TI J784S4 EVM board.
>>>
>>> Best Regards
>>> Gokul Praveen
>>>
>>>
>>>
>

      reply	other threads:[~2026-01-15  7:46 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
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 [this message]

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=2ebce2e1-48d1-4d14-9772-b01d7f388641@ti.com \
    --to=u-kumar1@ti.com \
    --cc=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=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®