FROMLIST: 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 make the relevant fixes to those drivers that use the period and duty_cycle struct members in division operations, viz. replacing the division operations with 64-bit division macros as appropriate. Bug: 140290586 Link: https://www.spinics.net/lists/linux-pwm/msg11133.html Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org> Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Todd Kjos <tkjos@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: Ife96637115f8f704aef938291eb189cb29378afb
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8885e88692
commit
d2ee0ef1e0
@@ -42,7 +42,7 @@ static ssize_t period_show(struct device *child,
|
||||
|
||||
pwm_get_state(pwm, &state);
|
||||
|
||||
return sprintf(buf, "%u\n", state.period);
|
||||
return sprintf(buf, "%llu\n", state.period);
|
||||
}
|
||||
|
||||
static ssize_t period_store(struct device *child,
|
||||
@@ -52,10 +52,10 @@ static ssize_t period_store(struct device *child,
|
||||
struct pwm_export *export = child_to_pwm_export(child);
|
||||
struct pwm_device *pwm = export->pwm;
|
||||
struct pwm_state state;
|
||||
unsigned int val;
|
||||
u64 val;
|
||||
int ret;
|
||||
|
||||
ret = kstrtouint(buf, 0, &val);
|
||||
ret = kstrtou64(buf, 0, &val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -77,7 +77,7 @@ static ssize_t duty_cycle_show(struct device *child,
|
||||
|
||||
pwm_get_state(pwm, &state);
|
||||
|
||||
return sprintf(buf, "%u\n", state.duty_cycle);
|
||||
return sprintf(buf, "%llu\n", state.duty_cycle);
|
||||
}
|
||||
|
||||
static ssize_t duty_cycle_store(struct device *child,
|
||||
@@ -212,7 +212,7 @@ static ssize_t capture_show(struct device *child,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return sprintf(buf, "%u %u\n", result.period, result.duty_cycle);
|
||||
return sprintf(buf, "%llu %llu\n", result.period, result.duty_cycle);
|
||||
}
|
||||
|
||||
static ssize_t output_type_show(struct device *child,
|
||||
|
||||
Reference in New Issue
Block a user