Linux kernel -stable discussions
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] pwm: tiehrpwm: Clear period on disable to allow reconfiguration" failed to apply to 6.6-stable tree
@ 2026-11-07 10:30 Sasha Levin
  2026-11-09  8:17 ` [PATCH 6.6.y] pwm: tiehrpwm: Clear period on disable to allow reconfiguration Uwe Kleine-König
  0 siblings, 1 reply; 4+ messages in thread
From: Sasha Levin @ 2026-11-07 10:30 UTC (permalink / raw)
  To: alexander.sverdlin, ukleinek; +Cc: stable

The patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x e74b9a7ee50071aad25d3989bf985292f90b0c6e
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '20261107053048-failed-6.6-e74b9a7ee500@kernel.org' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'

Thanks,
Sasha

------------------ original commit in Linus's tree ------------------

From e74b9a7ee50071aad25d3989bf985292f90b0c6e Mon Sep 17 00:00:00 2001
From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Date: Tue, 29 Sep 2026 14:08:02 +0200
Subject: [PATCH] pwm: tiehrpwm: Clear period on disable to allow
 reconfiguration
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Both channels share one period register, so ehrpwm_pwm_config() rejects a
period differing from the sibling's period_cycles[]. That value was cleared
only in .free(), not in .disable(), so a stopped channel kept blocking the
sibling from switching to a new frequency. Clear it in .disable() too.

Testcase:

  cd /sys/class/pwm/pwmchip0; echo 0 > export; echo 1 > export
  for p in pwm0 pwm1; do
    echo 1000000 > $p/period; echo 500000 > $p/duty_cycle
    echo 1 > $p/enable; echo 0 > $p/enable; echo 2000000 > $p/period
  done
  echo 1 > pwm0/enable	# before: -EINVAL, after: succeeds

Fixes: 01b2d4536f02 ("pwm: pwm-tiehrpwm: Fix conflicting channel period setting")
Cc: stable@vger.kernel.org
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Link: https://patch.msgid.link/20260929120806.2790355-1-alexander.sverdlin@siemens.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
---
 drivers/pwm/pwm-tiehrpwm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
index 3a53489f0b982..e3407d0a1f7fe 100644
--- a/drivers/pwm/pwm-tiehrpwm.c
+++ b/drivers/pwm/pwm-tiehrpwm.c
@@ -358,6 +358,9 @@ static void ehrpwm_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
 
 	/* Disable clock on PWM disable */
 	pm_runtime_put_sync(pwmchip_parent(chip));
+
+	/* A disabled channel must not constrain the sibling's period */
+	pc->period_cycles[pwm->hwpwm] = 0;
 }
 
 static void ehrpwm_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
-- 
2.53.0





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 6.6.y] pwm: tiehrpwm: Clear period on disable to allow reconfiguration
  2026-11-07 10:30 FAILED: patch "[PATCH] pwm: tiehrpwm: Clear period on disable to allow reconfiguration" failed to apply to 6.6-stable tree Sasha Levin
@ 2026-11-09  8:17 ` Uwe Kleine-König
  2026-11-09  8:26   ` Uwe Kleine-König
  2026-11-09 15:53   ` Sasha Levin
  0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2026-11-09  8:17 UTC (permalink / raw)
  To: stable; +Cc: Alexander Sverdlin

From: Alexander Sverdlin <alexander.sverdlin@siemens.com>

[ Upstream commit e74b9a7ee50071aad25d3989bf985292f90b0c6e ]

Both channels share one period register, so ehrpwm_pwm_config() rejects a
period differing from the sibling's period_cycles[]. That value was cleared
only in .free(), not in .disable(), so a stopped channel kept blocking the
sibling from switching to a new frequency. Clear it in .disable() too.

Testcase:

  cd /sys/class/pwm/pwmchip0; echo 0 > export; echo 1 > export
  for p in pwm0 pwm1; do
    echo 1000000 > $p/period; echo 500000 > $p/duty_cycle
    echo 1 > $p/enable; echo 0 > $p/enable; echo 2000000 > $p/period
  done
  echo 1 > pwm0/enable	# before: -EINVAL, after: succeeds

Fixes: 01b2d4536f02 ("pwm: pwm-tiehrpwm: Fix conflicting channel period setting")
Cc: stable@vger.kernel.org
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Link: https://patch.msgid.link/20260929120806.2790355-1-alexander.sverdlin@siemens.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
---
 drivers/pwm/pwm-tiehrpwm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
index d693b2d65ccc..9af6cb08a01c 100644
--- a/drivers/pwm/pwm-tiehrpwm.c
+++ b/drivers/pwm/pwm-tiehrpwm.c
@@ -386,6 +386,9 @@ static void ehrpwm_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
 
 	/* Disable clock on PWM disable */
 	pm_runtime_put_sync(chip->dev);
+
+	/* A disabled channel must not constrain the sibling's period */
+	pc->period_cycles[pwm->hwpwm] = 0;
 }
 
 static void ehrpwm_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
-- 
2.56.0.rc1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 6.6.y] pwm: tiehrpwm: Clear period on disable to allow reconfiguration
  2026-11-09  8:17 ` [PATCH 6.6.y] pwm: tiehrpwm: Clear period on disable to allow reconfiguration Uwe Kleine-König
@ 2026-11-09  8:26   ` Uwe Kleine-König
  2026-11-09 15:53   ` Sasha Levin
  1 sibling, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2026-11-09  8:26 UTC (permalink / raw)
  To: stable; +Cc: Alexander Sverdlin

[-- Attachment #1: Type: text/plain, Size: 1315 bytes --]

Hello again,

On Mon, Nov 09, 2026 at 09:17:29AM +0100, Uwe Kleine-König wrote:
> From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> 
> [ Upstream commit e74b9a7ee50071aad25d3989bf985292f90b0c6e ]
> 
> Both channels share one period register, so ehrpwm_pwm_config() rejects a
> period differing from the sibling's period_cycles[]. That value was cleared
> only in .free(), not in .disable(), so a stopped channel kept blocking the
> sibling from switching to a new frequency. Clear it in .disable() too.
> 
> Testcase:
> 
>   cd /sys/class/pwm/pwmchip0; echo 0 > export; echo 1 > export
>   for p in pwm0 pwm1; do
>     echo 1000000 > $p/period; echo 500000 > $p/duty_cycle
>     echo 1 > $p/enable; echo 0 > $p/enable; echo 2000000 > $p/period
>   done
>   echo 1 > pwm0/enable	# before: -EINVAL, after: succeeds
> 
> Fixes: 01b2d4536f02 ("pwm: pwm-tiehrpwm: Fix conflicting channel period setting")
> Cc: stable@vger.kernel.org
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> Link: https://patch.msgid.link/20260929120806.2790355-1-alexander.sverdlin@siemens.com
> Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>

I forgot to mention, this patch also applies to v5.10.x, so I assume
this patch is fine also for 6.1 and 5.15.

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 6.6.y] pwm: tiehrpwm: Clear period on disable to allow reconfiguration
  2026-11-09  8:17 ` [PATCH 6.6.y] pwm: tiehrpwm: Clear period on disable to allow reconfiguration Uwe Kleine-König
  2026-11-09  8:26   ` Uwe Kleine-König
@ 2026-11-09 15:53   ` Sasha Levin
  1 sibling, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2026-11-09 15:53 UTC (permalink / raw)
  To: stable; +Cc: Sasha Levin, Alexander Sverdlin, Uwe Kleine-König

> pwm: tiehrpwm: Clear period on disable to allow reconfiguration

Queued for 6.6, 6.1, 5.15 and 5.10, thanks.

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-09 15:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-07 10:30 FAILED: patch "[PATCH] pwm: tiehrpwm: Clear period on disable to allow reconfiguration" failed to apply to 6.6-stable tree Sasha Levin
2026-11-09  8:17 ` [PATCH 6.6.y] pwm: tiehrpwm: Clear period on disable to allow reconfiguration Uwe Kleine-König
2026-11-09  8:26   ` Uwe Kleine-König
2026-11-09 15:53   ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox