diff options
author | Nikolaus Voss <nikolaus.voss@loewensteinmedical.de> | 2019-06-12 10:36:07 +0200 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2019-06-26 11:39:11 +0200 |
commit | 4a6ef8e37c4d9a40f09438068da1734fd965bd75 (patch) | |
tree | 648a522e0979f02ef20aa8431977b590c05c435f /include/linux/pwm.h | |
parent | 4a5fa56cc031274738ddc86b3ec0c5d1e21822b3 (diff) |
pwm: Add support referencing PWMs from ACPI
In analogy to referencing a GPIO using the "gpios" property from ACPI,
support referencing a PWM using the "pwms" property.
ACPI entries must look like
Package () {"pwms", Package ()
{ <PWM device reference>, <PWM index>, <PWM period> [, <PWM flags>]}}
In contrast to the DT implementation, only _one_ PWM entry in the "pwms"
property is supported. As a consequence "pwm-names"-property and
con_id lookup aren't supported.
Support for ACPI is added via the firmware-node framework which is an
abstraction layer on top of ACPI/DT. To keep this patch clean, DT and
ACPI paths are kept separate. The firmware-node framework could be used
to unify both paths in a future patch.
To support leds-pwm driver, an additional method devm_fwnode_pwm_get()
which supports both ACPI and DT configuration is exported.
Signed-off-by: Nikolaus Voss <nikolaus.voss@loewensteinmedical.de>
[thierry.reding@gmail.com: fix build failures for !ACPI]
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'include/linux/pwm.h')
-rw-r--r-- | include/linux/pwm.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/pwm.h b/include/linux/pwm.h index 8bf5d5f6267d..24632a7a7d11 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h @@ -412,6 +412,9 @@ void pwm_put(struct pwm_device *pwm); struct pwm_device *devm_pwm_get(struct device *dev, const char *con_id); struct pwm_device *devm_of_pwm_get(struct device *dev, struct device_node *np, const char *con_id); +struct pwm_device *devm_fwnode_pwm_get(struct device *dev, + struct fwnode_handle *fwnode, + const char *con_id); void devm_pwm_put(struct device *dev, struct pwm_device *pwm); #else static inline struct pwm_device *pwm_request(int pwm_id, const char *label) @@ -518,6 +521,13 @@ static inline struct pwm_device *devm_of_pwm_get(struct device *dev, return ERR_PTR(-ENODEV); } +static inline struct pwm_device * +devm_fwnode_pwm_get(struct device *dev, struct fwnode_handle *fwnode, + const char *con_id) +{ + return ERR_PTR(-ENODEV); +} + static inline void devm_pwm_put(struct device *dev, struct pwm_device *pwm) { } |