[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210824164801.28896-16-lakshmi.sowjanya.d@intel.com>
Date: Tue, 24 Aug 2021 22:17:56 +0530
From: lakshmi.sowjanya.d@...el.com
To: linus.walleij@...aro.org
Cc: linux-gpio@...r.kernel.org, bgolaszewski@...libre.com,
linux-kernel@...r.kernel.org, mgross@...ux.intel.com,
andriy.shevchenko@...ux.intel.com, tamal.saha@...el.com,
bala.senthil@...el.com, lakshmi.sowjanya.d@...el.com
Subject: [RFC PATCH v1 15/20] pwm: Add capability for PWM Driver managed state
From: Christopher Hall <christopher.s.hall@...el.com>
Add additional flag that can be set by drivers to indicate that the
driver will manage its own PWM state. When calling pwm_ops.apply the
driver applies the requested state change to the pwm_device reconciling,
if possible, any conflicting requests.
Intel(R) Timed I/O devices support very limited PWM capabilities. The
duty cycle must always be 50% of the period. When changing one parameter
at a time through the sysfs interface, it isn't possible for the user or
the PWM subsystem to maintain this relation.
Signed-off-by: Christopher Hall <christopher.s.hall@...el.com>
Signed-off-by: Tamal Saha <tamal.saha@...el.com>
Signed-off-by: Lakshmi Sowjanya D <lakshmi.sowjanya.d@...el.com>
Reviewed-by: Mark Gross <mgross@...ux.intel.com>
---
drivers/pwm/core.c | 3 ++-
include/linux/pwm.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index 35e894f4a379..c658585ac3bc 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -554,7 +554,8 @@ int pwm_apply_state(struct pwm_device *pwm, const struct pwm_state *state)
trace_pwm_apply(pwm, state);
- pwm->state = *state;
+ if (!test_bit(PWMF_DRIVERMANAGEDSTATE, &pwm->flags))
+ pwm->state = *state;
/*
* only do this after pwm->state was applied as some
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index a0b7e43049d5..d805fee81e2c 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -46,6 +46,7 @@ struct pwm_args {
enum {
PWMF_REQUESTED = 1 << 0,
PWMF_EXPORTED = 1 << 1,
+ PWMF_DRIVERMANAGEDSTATE = 1 << 2,
};
/*
--
2.17.1
Powered by blists - more mailing lists