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>
This commit is contained in:

committed by
Thierry Reding

parent
a6733474ba
commit
a9d887dc1c
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user