summaryrefslogtreecommitdiff
path: root/driver/ioexpander/it8801.c
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 07:27:46 +0000
commit769ec0c4a84342b393d536b938b5c96e50242247 (patch)
treea192e3181e37714c7bc0f74e364aa24b2bd0e7bb /driver/ioexpander/it8801.c
parent7405848ded48b0fbb7ca463e779dc55f75a843b8 (diff)
downloadchrome-ec-769ec0c4a84342b393d536b938b5c96e50242247.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/+/2431321 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'driver/ioexpander/it8801.c')
-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)