Linux real-time development
 help / color / mirror / Atom feed
From: Rosen Penev <rosenp@gmail.com>
To: Linus Walleij <linusw@kernel.org>,
	Bartosz Golaszewski <brgl@kernel.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Clark Williams <clrkwllms@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Gregory CLEMENT <gregory.clement@bootlin.com>,
	Rosen Penev <rosenp@gmail.com>, Rob Herring <robh@kernel.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Ralph Sennhauser <ralph.sennhauser@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>
Cc: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
	linux-gpio@vger.kernel.org, linux-rt-devel@lists.linux.dev
Subject: [PATCH v2 5/5] gpio: mvebu: report the PWM line's own enable bit
Date: Fri,  4 Dec 2026 19:11:11 -0800	[thread overview]
Message-ID: <20261205031111.12306-6-rosenp@gmail.com> (raw)
In-Reply-To: <20261205031111.12306-1-rosenp@gmail.com>

mvebu_pwm_get_state() reads GPIO_BLINK_EN and reports the PWM as
enabled if any bit in it is set.  The register has one bit per line,
so any blink bit on another line of the bank, for example one left set
by the boot loader, makes a disabled PWM read back as enabled.  The PWM
core uses get_state() to read the initial state of the PWM, so a
consumer then starts from the wrong state.

Check only the bit for this PWM's line.

Fixes: 757642f9a584 ("gpio: mvebu: Add limited PWM support")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/gpio/gpio-mvebu.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 0672528e97dc..bfe4721eaa9a 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -720,10 +720,7 @@ static int mvebu_pwm_get_state(struct pwm_chip *chip,
 	state->period = DIV_ROUND_UP_ULL(val * NSEC_PER_SEC, mvpwm->clk_rate);
 
 	regmap_read(mvchip->regs, GPIO_BLINK_EN_OFF + mvchip->offset, &u);
-	if (u)
-		state->enabled = true;
-	else
-		state->enabled = false;
+	state->enabled = !!(u & BIT(pwm->hwpwm));
 
 	spin_unlock_irqrestore(&mvpwm->lock, flags);
 
-- 
2.56.1


      parent reply	other threads:[~2026-12-05  3:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05  3:11 [PATCH v2 0/5] gpio: mvebu: resume, PREEMPT_RT and PWM fixes Rosen Penev
2026-12-05  3:11 ` [PATCH v2 1/5] gpio: mvebu: use a raw-locked regmap on Armada 7K/8K too Rosen Penev
2026-12-05  3:11 ` [PATCH v2 2/5] gpio: mvebu: restore suspend-time irq masks under gc->lock Rosen Penev
2026-12-05  3:11 ` [PATCH v2 3/5] gpio: mvebu: don't re-mask irqs unmasked during early resume Rosen Penev
2026-12-05  3:25   ` sashiko-bot
2026-12-05  3:11 ` [PATCH v2 4/5] gpio: mvebu: don't request the PWM GPIO under a spinlock Rosen Penev
2026-12-05  3:11 ` Rosen Penev [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=20261205031111.12306-6-rosenp@gmail.com \
    --to=rosenp@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=bigeasy@linutronix.de \
    --cc=brgl@kernel.org \
    --cc=clrkwllms@kernel.org \
    --cc=gregory.clement@bootlin.com \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=ralph.sennhauser@gmail.com \
    --cc=robh@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=thierry.reding@gmail.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