summaryrefslogtreecommitdiff
path: root/include/linux/pwm.h
diff options
context:
space:
mode:
authorFabrice Gasnier <fabrice.gasnier@st.com>2019-04-18 12:37:47 +0300
committerThierry Reding <thierry.reding@gmail.com>2019-06-25 15:51:43 +0300
commitb2c200e3f2fd1158f5f1c93ccb2e0a27d96c4a7a (patch)
tree37e6878972f4272b199d689de29d44d54267c9db /include/linux/pwm.h
parentcce4a833fc6dfdb43a492876ad06f506a61f8fbd (diff)
downloadlinux-b2c200e3f2fd1158f5f1c93ccb2e0a27d96c4a7a.tar.xz
pwm: Add consumer device link
Add a device link between the PWM consumer and the PWM provider. This enforces the PWM user to get suspended before the PWM provider. It allows proper synchronization of suspend/resume sequences: the PWM user is responsible for properly stopping PWM, before the provider gets suspended: see [1]. Add the device link in: - of_pwm_get() - pwm_get() - devm_*pwm_get() variants as it requires a reference to the device for the PWM consumer. [1] https://lkml.org/lkml/2019/2/5/770 Suggested-by: Thierry Reding <thierry.reding@gmail.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'include/linux/pwm.h')
-rw-r--r--include/linux/pwm.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index eaa5c6e3fc9f..8bf5d5f6267d 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -405,7 +405,8 @@ struct pwm_device *of_pwm_xlate_with_flags(struct pwm_chip *pc,
const struct of_phandle_args *args);
struct pwm_device *pwm_get(struct device *dev, const char *con_id);
-struct pwm_device *of_pwm_get(struct device_node *np, const char *con_id);
+struct pwm_device *of_pwm_get(struct device *dev, struct device_node *np,
+ const char *con_id);
void pwm_put(struct pwm_device *pwm);
struct pwm_device *devm_pwm_get(struct device *dev, const char *con_id);
@@ -493,7 +494,8 @@ static inline struct pwm_device *pwm_get(struct device *dev,
return ERR_PTR(-ENODEV);
}
-static inline struct pwm_device *of_pwm_get(struct device_node *np,
+static inline struct pwm_device *of_pwm_get(struct device *dev,
+ struct device_node *np,
const char *con_id)
{
return ERR_PTR(-ENODEV);