Skip to content
  • Uwe Kleine-König's avatar
    pwm: lpc18xx-sct: Don't reconfigure PWM in .request and .free · f82d15e2
    Uwe Kleine-König authored and Thierry Reding's avatar Thierry Reding committed
    
    
    Regarding the .request case: The consumer might be interested in taking
    over the configured state from the boot loader. So the initially
    configured state should be retained.
    
    For the free case the PWM consumer is responsible for disabling the PWM
    before calling pwm_put() and there are three subcases to consider:
    
     a) The PWM is already off. Then there is no gain in disabling the PWM
        once more.
     b) The PWM is still running and there is a good reason for that. (Not
        sure this is a valid case, I cannot imagine such a good reason.)
        Then it is counterproductive to disable the PWM.
     c) The PWM is still running because the consumer failed to disable the
        PWM. Then the consumer needs fixing and there is little incentive to
        paper over the problem in the backend driver.
    
    This aligns the lpc18xx-sct driver to the other PWM drivers that also
    don't reconfigure the hardware in .request and .free.
    
    Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
    f82d15e2