]> git.itanic.dy.fi Git - linux-stable/commit
pwm: meson: Read the full hardware state in meson_pwm_get_state()
authorMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Wed, 12 Jun 2019 19:59:08 +0000 (21:59 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Wed, 26 Jun 2019 09:39:10 +0000 (11:39 +0200)
commitc375bcbaabdb92f0c007a044cda90450eef5ab43
treec8277ee6344419db7213bc09cb3a30015457bf2e
parentfb2081e870e9d59a0e6d076989e04c932c3ba23d
pwm: meson: Read the full hardware state in meson_pwm_get_state()

Update the meson_pwm_get_state() implementation to take care of all
information in the registers instead of only reading the "enabled"
state.

The PWM output is only enabled if two conditions are met:
1. the per-channel clock is enabled
2. the PWM output is enabled

Calculate the PWM period and duty cycle using the reverse formula which
we already have in meson_pwm_calc() and update struct pwm_state with the
results.

As result of this /sys/kernel/debug/pwm now shows the PWM state set by
the bootloader (or firmware) after booting Linux.

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-meson.c