diff options
author | Aaron Massey <aaronmassey@google.com> | 2022-10-07 16:48:35 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-10-10 23:53:16 +0000 |
commit | 5a0519d8018e9a3280d486a4ff3985b5492ee9e8 (patch) | |
tree | f3fe07c27c524444d0e00d5847deac17a97c8822 /common | |
parent | 6045f083da62a46cbb0d37f30893eb877a9b7b62 (diff) | |
download | chrome-ec-5a0519d8018e9a3280d486a4ff3985b5492ee9e8.tar.gz |
pwm: Factor out PWM_RAW/PERCENT_TO_PERCENT/RAW()
The shim and common pwm code both define the exact same macros to
convert to PWM raw and percentage values.
Factor these macros out as a single macro included in the pwm.h header
that is already included by both the shim and common code. This has the
other side-effect of exposing these macros for testing purposes.
BRANCH=none
BUG=b:236132469
BUG=b:236132199
TEST=zmake build -a
TEST=make runhosttests
TEST=CQ
Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: I8a8c19242b0122a1a18c26bba3eda08a0613d824
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3939620
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/pwm.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/common/pwm.c b/common/pwm.c index 9019a329b4..e630ddd58e 100644 --- a/common/pwm.c +++ b/common/pwm.c @@ -13,9 +13,6 @@ #ifdef CONFIG_PWM -#define PWM_RAW_TO_PERCENT(v) DIV_ROUND_NEAREST((uint32_t)(v)*100, UINT16_MAX) -#define PWM_PERCENT_TO_RAW(v) ((uint32_t)(v)*UINT16_MAX / 100) - /* * Get target channel based on type / index host command parameters. * Returns 0 if a valid channel is selected, -1 on error. |