[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220819043459.32584-1-m.shams@samsung.com>
Date: Fri, 19 Aug 2022 10:04:59 +0530
From: Tamseel Shams <m.shams@...sung.com>
To: thierry.reding@...il.com, u.kleine-koenig@...gutronix.de,
lee.jones@...aro.org
Cc: linux-pwm@...r.kernel.org, linux-kernel@...r.kernel.org,
alim.akhtar@...sung.com, Tamseel Shams <m.shams@...sung.com>
Subject: [PATCH v2] pwm: Fixes dpm_run_callback() error in pwm_apply_state()
Return invalid argument error from pwm_apply_state()
call when 'period is not set' or 'duty_cycle is greater
than period' only when PWM is enabled, so as to fix the
dpm_run_callback() error seen on exynos SoC during
Suspend
There may be situation when PWM is exported using sysfs,
but at that point period is not set for PWM. At this
point if we do suspend, then during pwm_apply_state
function call from pwm_class_suspend, it checks whether
period is set or not. It is not set now, so it returns
an invalid argument error which issues dpm_run_callback()
error
Suggested-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
Signed-off-by: Tamseel Shams <m.shams@...sung.com>
---
drivers/pwm/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index c7552df32082..10b4e39aaac0 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -634,8 +634,8 @@ int pwm_apply_state(struct pwm_device *pwm, const struct pwm_state *state)
*/
might_sleep();
- if (!pwm || !state || !state->period ||
- state->duty_cycle > state->period)
+ if (!pwm || !state || (state->enabled && (!state->period ||
+ state->duty_cycle > state->period)))
return -EINVAL;
chip = pwm->chip;
--
2.17.1
Powered by blists - more mailing lists