summaryrefslogtreecommitdiff
path: root/drivers/pwm/core.c
diff options
context:
space:
mode:
authorClemens Gruber <clemens.gruber@pqgruber.com>2021-05-07 15:18:42 +0200
committerThierry Reding <thierry.reding@gmail.com>2021-06-04 11:43:52 +0200
commit9e40ee18a1dc1623a5368d6232aaed52fd29dada (patch)
tree64b448d33a1be29dc1543c7679cbe58ffc99643b /drivers/pwm/core.c
parent98761ce4b91b77e0602b1551d11925e817e8a9a5 (diff)
pwm: core: Support new usage_power setting in PWM state
If usage_power is set, the PWM driver is only required to maintain the power output but has more freedom regarding signal form. If supported, the signal can be optimized, for example to improve EMI by phase shifting individual channels. Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers/pwm/core.c')
-rw-r--r--drivers/pwm/core.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index c165c5822703..a42999f877d2 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -536,7 +536,8 @@ int pwm_apply_state(struct pwm_device *pwm, const struct pwm_state *state)
if (state->period == pwm->state.period &&
state->duty_cycle == pwm->state.duty_cycle &&
state->polarity == pwm->state.polarity &&
- state->enabled == pwm->state.enabled)
+ state->enabled == pwm->state.enabled &&
+ state->usage_power == pwm->state.usage_power)
return 0;
if (chip->ops->apply) {
@@ -1241,6 +1242,9 @@ static void pwm_dbg_show(struct pwm_chip *chip, struct seq_file *s)
seq_printf(s, " polarity: %s",
state.polarity ? "inverse" : "normal");
+ if (state.usage_power)
+ seq_puts(s, " usage_power");
+
seq_puts(s, "\n");
}
}