• Boris Brezillon's avatar
    pwm: Add core infrastructure to allow atomic updates · 5ec803ed
    Boris Brezillon authored
    Add an ->apply() method to the pwm_ops struct to allow PWM drivers to
    implement atomic updates. This method is preferred over the ->enable(),
    ->disable() and ->config() methods if available.
    
    Add the pwm_apply_state() function to the PWM user API.
    
    Note that the pwm_apply_state() does not guarantee the atomicity of the
    update operation, it all depends on the availability and implementation
    of the ->apply() method.
    
    pwm_enable/disable/set_polarity/config() are now implemented as wrappers
    around the pwm_apply_state() function.
    
    pwm_adjust_config() is allowing smooth handover between the bootloader
    and the kernel. This function tries to adapt the current PWM state to
    the PWM arguments coming from a PWM lookup table or a DT definition
    without changing the duty_cycle/period proportion.
    Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
    [thierry.reding@gmail.com: fix a couple of typos]
    Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
    5ec803ed
core.c 22.8 KB