Skip to content
  • Gaetan Hug's avatar
    pwm: mxs: Fix period divider computation · 24ccea1c
    Gaetan Hug authored
    
    
    The driver computes which clock divider it sould be using from the
    requested period. This computation assumes that the link between the
    register value and the actual divider value is raising 2 to the power of
    the registry value.
    
        div = 1 << regvalue
    
    This is true only for the first 5 values out of 8. Next values are 64,
    256 and, 1024 - instead of 32, 64, 128.
    This affects only the users requesting a period > 0.04369s.
    
    Replace the computation with a look-up table.
    
    Signed-off-by: default avatarGaetan Hug <ghug@induct.be>
    Acked-by: default avatarShawn Guo <shawn.guo@linaro.org>
    Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
    24ccea1c