mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-15 18:03:30 +00:00
24 lines
809 B
Diff
24 lines
809 B
Diff
--- a/drivers/pwm/pwm-meson.c
|
|
+++ b/drivers/pwm/pwm-meson.c
|
|
@@ -351,8 +351,18 @@ static int meson_pwm_get_state(struct pw
|
|
channel->lo = FIELD_GET(PWM_LOW_MASK, value);
|
|
channel->hi = FIELD_GET(PWM_HIGH_MASK, value);
|
|
|
|
- state->period = meson_pwm_cnt_to_ns(chip, pwm, channel->lo + channel->hi);
|
|
- state->duty_cycle = meson_pwm_cnt_to_ns(chip, pwm, channel->hi);
|
|
+ if (channel->lo == 0) {
|
|
+ state->period = meson_pwm_cnt_to_ns(chip, pwm, channel->hi);
|
|
+ state->duty_cycle = state->period;
|
|
+ } else if (channel->lo >= channel->hi) {
|
|
+ state->period = meson_pwm_cnt_to_ns(chip, pwm,
|
|
+ channel->lo + channel->hi);
|
|
+ state->duty_cycle = meson_pwm_cnt_to_ns(chip, pwm,
|
|
+ channel->hi);
|
|
+ } else {
|
|
+ state->period = 0;
|
|
+ state->duty_cycle = 0;
|
|
+ }
|
|
|
|
state->polarity = PWM_POLARITY_NORMAL;
|
|
|