summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhuohao Lee <zhuohao@chromium.org>2020-09-26 20:11:41 +0800
committerCommit Bot <commit-bot@chromium.org>2020-09-28 14:27:12 +0000
commit4707c9e8ad9d0aabb7296fce5c6773f9271f3f0d (patch)
tree9116e5db14401891b1ebdef5e3c44fc5023c8c76
parent66ba1ffbeb512f0220f969653155782a027839d6 (diff)
downloadchrome-ec-4707c9e8ad9d0aabb7296fce5c6773f9271f3f0d.tar.gz
it8801: fix the it8801_pwm_(set|get)_duty
The value in PWMDCRi register is used to control the clock of the PWM. We only need to set the clock value to the register after normalized to the 255. BUG=b:162902808 BRANCH=firmware-kukui-12573.B TEST=`kblight <percentage>` is working correctly Change-Id: I6a0c012a06789eb8bbca6209a00b06ef34ee9c86 Signed-off-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2434593 Reviewed-by: Aaron Zhang <zhangjianbo@huaqin.corp-partner.google.com> Tested-by: Aaron Zhang <zhangjianbo@huaqin.corp-partner.google.com>
-rw-r--r--driver/ioexpander/it8801.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/driver/ioexpander/it8801.c b/driver/ioexpander/it8801.c
index df6ea3e76e..d59bee8e3f 100644
--- a/driver/ioexpander/it8801.c
+++ b/driver/ioexpander/it8801.c
@@ -511,15 +511,15 @@ uint16_t it8801_pwm_get_raw_duty(enum pwm_channel ch)
void it8801_pwm_set_duty(enum pwm_channel ch, int percent)
{
- return it8801_pwm_set_raw_duty(ch, (100 - percent) * 255 / 100);
+ return it8801_pwm_set_raw_duty(ch, percent * 255 / 100);
}
int it8801_pwm_get_duty(enum pwm_channel ch)
{
- return 100 - it8801_pwm_get_raw_duty(ch) * 100 / 255;
+ return it8801_pwm_get_raw_duty(ch) * 100 / 255;
}
-#if defined(SECTION_IS_RW) && defined(CONFIG_KEYBOARD_BACKLIGHT)
+#ifdef CONFIG_KEYBOARD_BACKLIGHT
const enum pwm_channel it8801_kblight_pwm_ch = IT8801_PWM_CH_KBLIGHT;
static int it8801_kblight_enable(int enable)