From: "Rafael V. Volkmer" <rafael.v.volkmer@gmail.com>
To: "Uwe Kleine-König" <ukleinek@kernel.org>
Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org,
"Rafael V. Volkmer" <rafael.v.volkmer@gmail.com>
Subject: [PATCH 2/2] pwm: correct pwm->state.enabled handling to allow fops control
Date: Tue, 26 Nov 2024 18:24:14 -0300 [thread overview]
Message-ID: <20241126212414.15165-1-rafael.v.volkmer@gmail.com> (raw)
Ensure pwm->state.enabled is consistently updated during enable and
disable operations in ehrpwm_pwm_apply() to resolve this issue.
Previously, when attempting to interact with the ti PWM driver through
fops, the pwm->state.enabled field was not updated correctly after
applying enable or disable. This led to a state mismatch where the
driver's state detection logic prevented disabling the PWM through
fops once it had been activated.
Signed-off-by: Rafael V. Volkmer <rafael.v.volkmer@gmail.com>
---
drivers/pwm/pwm-tiehrpwm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
index 0125e73b98df..9f939d535440 100644
--- a/drivers/pwm/pwm-tiehrpwm.c
+++ b/drivers/pwm/pwm-tiehrpwm.c
@@ -420,6 +420,7 @@ static int ehrpwm_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
if (!state->enabled) {
if (enabled)
ehrpwm_pwm_disable(chip, pwm);
+ pwm->state.enabled = false;
return 0;
}
@@ -429,6 +430,7 @@ static int ehrpwm_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
if (!enabled)
err = ehrpwm_pwm_enable(chip, pwm);
+ pwm->state.enabled = true;
return err;
}
--
2.25.1
next reply other threads:[~2024-11-26 21:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-26 21:24 Rafael V. Volkmer [this message]
2024-11-27 8:56 ` [PATCH 2/2] pwm: correct pwm->state.enabled handling to allow fops control Uwe Kleine-König
2024-11-27 22:26 ` [PATCH v2] pwm: improve state handling in ehrpwm driver Rafael V. Volkmer
2024-11-28 9:59 ` Uwe Kleine-König
2024-11-29 3:43 ` [PATCH] pwm: tiehrpwm: ensures that state.enabled is synchronized during .probe() Rafael V. Volkmer
2024-11-29 11:30 ` kernel test robot
2024-11-29 18:40 ` kernel test robot
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=20241126212414.15165-1-rafael.v.volkmer@gmail.com \
--to=rafael.v.volkmer@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--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