summaryrefslogtreecommitdiff
path: root/Documentation/pwm.txt
diff options
context:
space:
mode:
authorThierry Reding <thierry.reding@avionic-design.de>2011-12-14 11:12:23 +0100
committerThierry Reding <thierry.reding@avionic-design.de>2012-06-15 12:56:52 +0200
commitf051c466cf690ac661d713d3ceb56b4efcecc853 (patch)
tree15291a08d3ec44e8ab81c44370e1ac2bbb366ec5 /Documentation/pwm.txt
parent0c2498f1660878339350bea8d18550b1b87ca055 (diff)
pwm: Allow chips to support multiple PWMs
Many PWM controllers provide access to more than a single PWM output and may even share some resource among them. Allowing a PWM chip to provide multiple PWM devices enables better sharing of those resources. As a side-effect this change allows easy integration with the device tree where a given PWM can be looked up based on the PWM chip's phandle and a corresponding index. This commit modifies the PWM core to support multiple PWMs per struct pwm_chip. It achieves this in a similar way to how gpiolib works, by allowing PWM ranges to be requested dynamically (pwm_chip.base == -1) or starting at a given offset (pwm_chip.base >= 0). A chip specifies how many PWMs it controls using the npwm member. Each of the functions in the pwm_ops structure gets an additional argument that specified the PWM number (it can be converted to a per-chip index by subtracting the chip's base). The total maximum number of PWM devices is currently fixed to 1024 while the data is actually stored in a radix tree, thus saving resources if not all of them are used. Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Reviewed-by: Shawn Guo <shawn.guo@linaro.org> [eric@eukrea.com: fix error handling in pwmchip_add] Signed-off-by: Eric BĂ©nard <eric@eukrea.com> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Diffstat (limited to 'Documentation/pwm.txt')
-rw-r--r--Documentation/pwm.txt9
1 files changed, 6 insertions, 3 deletions
diff --git a/Documentation/pwm.txt b/Documentation/pwm.txt
index 03e39d145911..48f598acdd16 100644
--- a/Documentation/pwm.txt
+++ b/Documentation/pwm.txt
@@ -33,9 +33,12 @@ there only has been the barebone API meaning that each driver has
to implement the pwm_*() functions itself. This means that it's impossible
to have multiple PWM drivers in the system. For this reason it's mandatory
for new drivers to use the generic PWM framework.
-A new PWM device can be added using pwmchip_add() and removed again with
-pwmchip_remove(). pwmchip_add() takes a filled in struct pwm_chip as
-argument which provides the ops and the pwm id to the framework.
+
+A new PWM controller/chip can be added using pwmchip_add() and removed
+again with pwmchip_remove(). pwmchip_add() takes a filled in struct
+pwm_chip as argument which provides a description of the PWM chip, the
+number of PWM devices provider by the chip and the chip-specific
+implementation of the supported PWM operations to the framework.
Locking
-------