summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-10 11:14:56 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-10 11:14:56 -0700
commit34ae0a6f05aee9f51fca17001b4a90703d434ae1 (patch)
tree3ccc8bedae647eb37f46e8ff9f39cdcd84a2f2ac /include
parent7d3107d26b522a0fe92af6279256fa65fe3db771 (diff)
parentb388f15fd14c3ae62deb9a059464aa99b524ea4a (diff)
downloadlinux-34ae0a6f05aee9f51fca17001b4a90703d434ae1.tar.bz2
Merge tag 'for-3.11-rc1' of git://gitorious.org/linux-pwm/linux-pwm
Pull pwm changes from Thierry Reding: "A new driver supports driving PWM signals using the TPU unit found on various Renesas SoCs. Furthermore support is added for the NXP PCA9685 LED controller. Another big chunk is the sysfs interface which has been in the works for quite some time. The remaining patches are a random assortment of cleanups and fixes" * tag 'for-3.11-rc1' of git://gitorious.org/linux-pwm/linux-pwm: pwm: pwm-tiehrpwm: Use clk_enable/disable instead clk_prepare/unprepare. pwm: pca9685: Fix wrong argument to set MODE1_SLEEP bit pwm: renesas-tpu: Add MODULE_ALIAS to make module auto loading work pwm: renesas-tpu: fix return value check in tpu_probe() pwm: Add Renesas TPU PWM driver pwm: Add sysfs interface pwm: Fill in missing .owner fields pwm: add pca9685 driver pwm: atmel-tcb: prepare clk before calling enable pwm: devm: alloc correct pointer size pwm: mxs: Let device core handle pinctrl MAINTAINERS: Update PWM subsystem entry
Diffstat (limited to 'include')
-rw-r--r--include/linux/platform_data/pwm-renesas-tpu.h16
-rw-r--r--include/linux/pwm.h29
2 files changed, 44 insertions, 1 deletions
diff --git a/include/linux/platform_data/pwm-renesas-tpu.h b/include/linux/platform_data/pwm-renesas-tpu.h
new file mode 100644
index 000000000000..a7220b10ddab
--- /dev/null
+++ b/include/linux/platform_data/pwm-renesas-tpu.h
@@ -0,0 +1,16 @@
+#ifndef __PWM_RENESAS_TPU_H__
+#define __PWM_RENESAS_TPU_H__
+
+#include <linux/pwm.h>
+
+#define TPU_CHANNEL_MAX 4
+
+struct tpu_pwm_channel_data {
+ enum pwm_polarity polarity;
+};
+
+struct tpu_pwm_platform_data {
+ struct tpu_pwm_channel_data channels[TPU_CHANNEL_MAX];
+};
+
+#endif /* __PWM_RENESAS_TPU_H__ */
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index a4df2042b79c..f0feafd184a0 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -76,6 +76,7 @@ enum pwm_polarity {
enum {
PWMF_REQUESTED = 1 << 0,
PWMF_ENABLED = 1 << 1,
+ PWMF_EXPORTED = 1 << 2,
};
struct pwm_device {
@@ -86,7 +87,9 @@ struct pwm_device {
struct pwm_chip *chip;
void *chip_data;
- unsigned int period; /* in nanoseconds */
+ unsigned int period; /* in nanoseconds */
+ unsigned int duty_cycle; /* in nanoseconds */
+ enum pwm_polarity polarity;
};
static inline void pwm_set_period(struct pwm_device *pwm, unsigned int period)
@@ -100,6 +103,17 @@ static inline unsigned int pwm_get_period(struct pwm_device *pwm)
return pwm ? pwm->period : 0;
}
+static inline void pwm_set_duty_cycle(struct pwm_device *pwm, unsigned int duty)
+{
+ if (pwm)
+ pwm->duty_cycle = duty;
+}
+
+static inline unsigned int pwm_get_duty_cycle(struct pwm_device *pwm)
+{
+ return pwm ? pwm->duty_cycle : 0;
+}
+
/*
* pwm_set_polarity - configure the polarity of a PWM signal
*/
@@ -278,4 +292,17 @@ static inline void pwm_add_table(struct pwm_lookup *table, size_t num)
}
#endif
+#ifdef CONFIG_PWM_SYSFS
+void pwmchip_sysfs_export(struct pwm_chip *chip);
+void pwmchip_sysfs_unexport(struct pwm_chip *chip);
+#else
+static inline void pwmchip_sysfs_export(struct pwm_chip *chip)
+{
+}
+
+static inline void pwmchip_sysfs_unexport(struct pwm_chip *chip)
+{
+}
+#endif /* CONFIG_PWM_SYSFS */
+
#endif /* __LINUX_PWM_H */