armbian_build/patch/kernel/archive/meson-6.9/generic-Revert-pwm-meson-modify-and-simplify-calculation-in-.patch
Igor f5575f64ac
Bump meson and meson64 EDGE kernel to 6.9.y (#6669)
* Bump meson and meson64 EDGE kernel to 6.9.y
* Rename patch folders
* Adjust broken patches, one remaining
* Add overlay support
* meson64: rename overlays to dtso, update makefile
* Update meson-gx-socinfo-sm driver patchset for meson64-6.9:
* add SoC ID patches for S905L, A113X
* fix memory double free in driver
* update dt bindings
---------
Signed-off-by: Patrick Yavitz <pyavitz@armbian.com>
Signed-off-by: Patrick Yavitz <pyavitz@xxxxx.com>
Signed-off-by: Viacheslav Bocharov <adeep@lexina.in>
Co-authored-by: Patrick Yavitz <pyavitz@xxxxx.com>
Co-authored-by: Paolo Sabatino <paolo.sabatino@gmail.com>
Co-authored-by: Viacheslav Bocharov <adeep@lexina.in>
2024-06-05 22:20:35 +02:00

40 lines
1.3 KiB
Diff

From 6b1a414f7bb456817cd3cb385e9f5eb9e0d9cbe7 Mon Sep 17 00:00:00 2001
From: hzy <hzyitc@outlook.com>
Date: Sat, 18 Nov 2023 01:22:04 +0800
Subject: [PATCH] Revert "pwm: meson: modify and simplify calculation in
meson_pwm_get_state"
This reverts commit 6b9352f3f8a1a35faf0efc1ad1807ee303467796.
---
drivers/pwm/pwm-meson.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
index 5bea5324..a7c9b555 100644
--- a/drivers/pwm/pwm-meson.c
+++ b/drivers/pwm/pwm-meson.c
@@ -322,8 +322,18 @@ static int meson_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
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;
--
2.34.1