summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2016-06-10 15:43:21 +0300
committerThierry Reding <thierry.reding@gmail.com>2016-07-11 12:07:24 +0200
commitab248b603960a4b6effaa9e16fc1ea84a33210c7 (patch)
tree116a0ba4981a5e54960d934e0b5339809f089b99 /arch
parente5ca42458b6278b7d5866e08dae7c45349af2157 (diff)
pwm: lpss: Prevent on_time_div overflow on lower frequencies
If duty_ns is large enough multiplying it by 255 overflows and results wrong duty cycle value being programmed. For example with 10ms duty when period is 20ms (50%) we get 255 * 10000000 / 20000000 = -87 because 255 * 10000000 overlows int. Whereas correct value should be 255 * 10000000 / 20000000 = 127 Fix this by using unsigned long long as type for on_time_div and changing integer literals to use proper type annotation. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'arch')
0 files changed, 0 insertions, 0 deletions