diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2023-02-28 09:12:47 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-02-28 09:12:47 -0800 |
commit | e492250d5252635b6c97d52eddf2792ec26f1ec1 (patch) | |
tree | 56d2d4e7380bc53f3db864787b930b0e918c362b /drivers/pwm/pwm-sifive.c | |
parent | b07ce43db665a6b5a622d5bb1447950d7e1e3fb1 (diff) | |
parent | cf70d01a62c712ee715df1f7892b58c77474bcfb (diff) |
Merge tag 'pwm/for-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm
Pull pwm updates from Thierry Reding:
"This rather small set of changes includes some minor fixes and
improvements.
The AB8500 driver gained support for reading the initial hardware
state and the Synopsys DesignWare driver received some work to prepare
for device tree and platform support"
* tag 'pwm/for-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm:
pwm: dwc: Use devm_pwmchip_add()
pwm: dwc: Move memory allocation to own function
pwm: dwc: Change &pci->dev to dev in probe
dt-bindings: pwm: Document Synopsys DesignWare snps,pwm-dw-apb-timers-pwm2
pwm: iqs620a: Replace one remaining instance of regmap_update_bits()
pwm: ab8500: Implement .get_state()
pwm: ab8500: Fix calculation of duty and period
pwm: lp3943: Drop unused i2c include
dt-bindings: pwm: mediatek: Convert pwm-mediatek to DT schema
pwm: stm32-lp: fix the check on arr and cmp registers update
pwm: Move pwm_capture() dummy to restore order
pwm: sifive: Always let the first pwm_apply_state succeed
Diffstat (limited to 'drivers/pwm/pwm-sifive.c')
-rw-r--r-- | drivers/pwm/pwm-sifive.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/pwm/pwm-sifive.c b/drivers/pwm/pwm-sifive.c index 62b6acc6373d..393a4b97fc19 100644 --- a/drivers/pwm/pwm-sifive.c +++ b/drivers/pwm/pwm-sifive.c @@ -161,7 +161,13 @@ static int pwm_sifive_apply(struct pwm_chip *chip, struct pwm_device *pwm, mutex_lock(&ddata->lock); if (state->period != ddata->approx_period) { - if (ddata->user_count != 1) { + /* + * Don't let a 2nd user change the period underneath the 1st user. + * However if ddate->approx_period == 0 this is the first time we set + * any period, so let whoever gets here first set the period so other + * users who agree on the period won't fail. + */ + if (ddata->user_count != 1 && ddata->approx_period) { mutex_unlock(&ddata->lock); return -EBUSY; } |