pwm: lpss: Fix base_unit calculation for PWM frequency
authorDan O'Donovan <dan@emutex.com>
Wed, 1 Jun 2016 14:31:12 +0000 (15:31 +0100)
committerThierry Reding <thierry.reding@gmail.com>
Mon, 11 Jul 2016 10:07:23 +0000 (12:07 +0200)
commite5ca42458b6278b7d5866e08dae7c45349af2157
treed9fe091c919e771fb56f11647c8b8bc743a2f4bf
parentcc37655e6bbf83ded1e4d1d7ffd977786a845a67
pwm: lpss: Fix base_unit calculation for PWM frequency

The base_unit calculation applies an offset of 0x2 which adds
significant error for lower frequencies and doesn't appear to be
warranted - rounding the division result gives a correct value.

Also, the upper limit check for base_unit is off-by-one; the upper
nibble of base_unit is invalid if >=128 according to the Table 88
in the Z8000 Processor Series Datasheet Volume 1 (Rev. 2).

Verified on UP Board (Cherry Trail) and Minnowboard Max (Bay Trail).

Signed-off-by: Dan O'Donovan <dan@emutex.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-lpss.c