diff options
author | Guru Das Srinagesh <gurus@codeaurora.org> | 2020-06-02 15:31:16 -0700 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2020-06-17 20:42:11 +0200 |
commit | a9d887dc1c60ed67f2271d66560cdcf864c4a578 (patch) | |
tree | e82d315a396940caf32c373b260ed6c9e955ac6b /include | |
parent | a6733474ba4bf3150120bacc1d2db446d89d3dbe (diff) | |
download | linux-a9d887dc1c60ed67f2271d66560cdcf864c4a578.tar.gz linux-a9d887dc1c60ed67f2271d66560cdcf864c4a578.tar.bz2 linux-a9d887dc1c60ed67f2271d66560cdcf864c4a578.zip |
pwm: Convert period and duty cycle to u64
Because period and duty cycle are defined as ints with units of
nanoseconds, the maximum time duration that can be set is limited to
~2.147 seconds. Change their definitions to u64 in the structs of the
PWM framework so that higher durations may be set.
Also use the right format specifiers in debug prints in both core.c,
pwm-stm32-lp.c as well as video/fbdev/ssd1307fb.c.
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/pwm.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/include/linux/pwm.h b/include/linux/pwm.h index 2635b2a55090..a13ff383fa1d 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h @@ -39,7 +39,7 @@ enum pwm_polarity { * current PWM hardware state. */ struct pwm_args { - unsigned int period; + u64 period; enum pwm_polarity polarity; }; @@ -56,8 +56,8 @@ enum { * @enabled: PWM enabled status */ struct pwm_state { - unsigned int period; - unsigned int duty_cycle; + u64 period; + u64 duty_cycle; enum pwm_polarity polarity; bool enabled; }; @@ -107,13 +107,13 @@ static inline bool pwm_is_enabled(const struct pwm_device *pwm) return state.enabled; } -static inline void pwm_set_period(struct pwm_device *pwm, unsigned int period) +static inline void pwm_set_period(struct pwm_device *pwm, u64 period) { if (pwm) pwm->state.period = period; } -static inline unsigned int pwm_get_period(const struct pwm_device *pwm) +static inline u64 pwm_get_period(const struct pwm_device *pwm) { struct pwm_state state; @@ -128,7 +128,7 @@ static inline void pwm_set_duty_cycle(struct pwm_device *pwm, unsigned int duty) pwm->state.duty_cycle = duty; } -static inline unsigned int pwm_get_duty_cycle(const struct pwm_device *pwm) +static inline u64 pwm_get_duty_cycle(const struct pwm_device *pwm) { struct pwm_state state; |