Skip to content

Commit f8d1123

Browse files
committed
pwm: Reload counters when they reach 0
Add IT5570E register that controls when the down counters are updated. Set them to update when they reach 0, instead of immediately when DCRi is written. Fixes keyboard color changing when changing brightness levels if not using 0xFF for an RGB value. Signed-off-by: Tim Crawford <[email protected]>
1 parent 76019bd commit f8d1123

File tree

2 files changed

+10
-0
lines changed
  • src

2 files changed

+10
-0
lines changed

src/board/system76/common/pwm.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ void pwm_init(void) {
2626
// Turn off CPU fan (temperature control in peci_get_fan_duty)
2727
DCR2 = 0;
2828

29+
#ifdef it5570e
30+
// Reload counters when they reach 0 instead of immediately
31+
PWMLCCR = 0xFF;
32+
#endif
33+
2934
// Enable PWM
3035
ZTIER = BIT(1);
3136
}

src/ec/ite/include/ec/pwm.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,9 @@ volatile uint8_t __xdata __at(0x1823) ZTIER;
6262
// Tachometer switch control register
6363
volatile uint8_t __xdata __at(0x1848) TSWCTLR;
6464

65+
#ifdef it5570e
66+
// PWM Load Counter Control Register
67+
volatile uint8_t __xdata __at(0x185A) PWMLCCR;
68+
#endif
69+
6570
#endif // _EC_PWM_H

0 commit comments

Comments
 (0)