summaryrefslogtreecommitdiffstats
path: root/include/linux/pwm.h
diff options
context:
space:
mode:
authorFlorian Vaussard <florian.vaussard@epfl.ch>2013-01-28 15:00:57 +0100
committerThierry Reding <thierry.reding@avionic-design.de>2013-01-30 09:12:18 +0100
commit6e69ab1361c44e3ee1398158b56d114b1aef8179 (patch)
tree44994b7b6cdfebaf1de44473597bb5a9adf2f912 /include/linux/pwm.h
parent0132267d659107616eb044777f1b0be55381129a (diff)
downloadlinux-stable-6e69ab1361c44e3ee1398158b56d114b1aef8179.tar.gz
linux-stable-6e69ab1361c44e3ee1398158b56d114b1aef8179.tar.bz2
linux-stable-6e69ab1361c44e3ee1398158b56d114b1aef8179.zip
pwm: Add pwm_can_sleep() as exported API to users
Calls to some external PWM chips can sleep. To help users, add pwm_can_sleep() API. Cc: Thierry Reding <thierry.reding@avionic-design.de> Cc: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch> Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Diffstat (limited to 'include/linux/pwm.h')
-rw-r--r--include/linux/pwm.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 6d661f32e0e4..3fef47733ea3 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -146,6 +146,8 @@ struct pwm_ops {
* @base: number of first PWM controlled by this chip
* @npwm: number of PWMs controlled by this chip
* @pwms: array of PWM devices allocated by the framework
+ * @can_sleep: must be true if the .config(), .enable() or .disable()
+ * operations may sleep
*/
struct pwm_chip {
struct device *dev;
@@ -159,6 +161,7 @@ struct pwm_chip {
struct pwm_device * (*of_xlate)(struct pwm_chip *pc,
const struct of_phandle_args *args);
unsigned int of_pwm_n_cells;
+ bool can_sleep;
};
#if IS_ENABLED(CONFIG_PWM)
@@ -179,6 +182,8 @@ void pwm_put(struct pwm_device *pwm);
struct pwm_device *devm_pwm_get(struct device *dev, const char *consumer);
void devm_pwm_put(struct device *dev, struct pwm_device *pwm);
+
+bool pwm_can_sleep(struct pwm_device *pwm);
#else
static inline int pwm_set_chip_data(struct pwm_device *pwm, void *data)
{
@@ -226,6 +231,11 @@ static inline struct pwm_device *devm_pwm_get(struct device *dev,
static inline void devm_pwm_put(struct device *dev, struct pwm_device *pwm)
{
}
+
+static inline bool pwm_can_sleep(struct pwm_device *pwm)
+{
+ return false;
+}
#endif
struct pwm_lookup {