• Martin Blumenstingl's avatar
    pwm: meson: Add support PWM_POLARITY_INVERSED when disabling · 7341c785
    Martin Blumenstingl authored
    meson_pwm_apply() has to consider the PWM polarity when disabling the
    output.
    With enabled=false and polarity=PWM_POLARITY_NORMAL the output needs to
    be LOW. The driver already supports this.
    With enabled=false and polarity=PWM_POLARITY_INVERSED the output needs
    to be HIGH. Implement this in the driver by internally enabling the
    output with the same settings that we already use for "period == duty".
    
    This fixes a PWM API violation which expects that the driver honors the
    polarity also for enabled=false. Due to the IP block not supporting this
    natively we only get "an as close as possible" to 100% HIGH signal (in
    my test setup with input clock of 24MHz and measuring the output with a
    logic analyzer at 24MHz sampling rate I got a duty cycle of 99.998475%
    on a Khadas VIM).
    Reviewed-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
    Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
    Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
    7341c785
pwm-meson.c 14.4 KB