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 <tcrawford@system76.com>
This commit is contained in:
committed by
Tim Crawford
parent
76019bdb61
commit
f8d1123934
@ -26,6 +26,11 @@ void pwm_init(void) {
|
|||||||
// Turn off CPU fan (temperature control in peci_get_fan_duty)
|
// Turn off CPU fan (temperature control in peci_get_fan_duty)
|
||||||
DCR2 = 0;
|
DCR2 = 0;
|
||||||
|
|
||||||
|
#ifdef it5570e
|
||||||
|
// Reload counters when they reach 0 instead of immediately
|
||||||
|
PWMLCCR = 0xFF;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Enable PWM
|
// Enable PWM
|
||||||
ZTIER = BIT(1);
|
ZTIER = BIT(1);
|
||||||
}
|
}
|
||||||
|
@ -62,4 +62,9 @@ volatile uint8_t __xdata __at(0x1823) ZTIER;
|
|||||||
// Tachometer switch control register
|
// Tachometer switch control register
|
||||||
volatile uint8_t __xdata __at(0x1848) TSWCTLR;
|
volatile uint8_t __xdata __at(0x1848) TSWCTLR;
|
||||||
|
|
||||||
|
#ifdef it5570e
|
||||||
|
// PWM Load Counter Control Register
|
||||||
|
volatile uint8_t __xdata __at(0x185A) PWMLCCR;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // _EC_PWM_H
|
#endif // _EC_PWM_H
|
||||||
|
Reference in New Issue
Block a user