summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@baylibre.com>2025-06-24 12:05:00 +0200
committerUwe Kleine-König <ukleinek@kernel.org>2025-07-07 08:39:36 +0200
commit10e9b32d9a14edbbed902dd5447a1ca3cd487935 (patch)
tree660192c489f0ff87154c9fdc1eb10329d3240324
parent2c06a2178926993f77e52f77e6b0c540e3d771ce (diff)
docs: pwm: Adapt Locking paragraph to reality
We have the distinction between pwm_apply_atomic() and pwm_apply_might_sleep() since commit c748a6d77c06 (pwm: Rename pwm_apply_state() to pwm_apply_might_sleep()) contained in v6.8-rc1. Locking in the core was introduced in commit 1cc2e1faafb3 ("pwm: Add more locking", contained in v6.13-rc1) to serialize per-chip callbacks and device removal. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://lore.kernel.org/r/20250624100500.1429163-2-u.kleine-koenig@baylibre.com Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
-rw-r--r--Documentation/driver-api/pwm.rst13
1 files changed, 9 insertions, 4 deletions
diff --git a/Documentation/driver-api/pwm.rst b/Documentation/driver-api/pwm.rst
index b41b1c56477f..0d27a40f5818 100644
--- a/Documentation/driver-api/pwm.rst
+++ b/Documentation/driver-api/pwm.rst
@@ -173,10 +173,15 @@ Locking
-------
The PWM core list manipulations are protected by a mutex, so pwm_get()
-and pwm_put() may not be called from an atomic context. Currently the
-PWM core does not enforce any locking to pwm_enable(), pwm_disable() and
-pwm_config(), so the calling context is currently driver specific. This
-is an issue derived from the former barebone API and should be fixed soon.
+and pwm_put() may not be called from an atomic context.
+Most functions in the PWM consumer API might sleep and so must not be called
+from atomic context. The notable exception is pwm_apply_atomic() which has the
+same semantics as pwm_apply_might_sleep() but can be called from atomic context.
+(The price for that is that it doesn't work for all PWM devices, use
+pwm_might_sleep() to check if a given PWM supports atomic operation.
+
+Locking in the PWM core ensures that callbacks related to a single chip are
+serialized.
Helpers
-------