diff --git a/src/board/system76/galp3-c/pwm.c b/src/board/system76/galp3-c/pwm.c index 3a66f2a..4b97649 100644 --- a/src/board/system76/galp3-c/pwm.c +++ b/src/board/system76/galp3-c/pwm.c @@ -3,6 +3,26 @@ void pwm_init(void) { // Set T0CHSEL to TACH0A and T1CHSEL to TACH1A TSWCTLR = 0; - // Turn on the CPU fan at full blast (temperature control TODO) - DCR2 = 0xFF; + + // Disable PWM + ZTIER = 0; + + // Set prescaler to 1159 + 1 + C6CPRS = 0x87; + C6MCPRS = 0x04; + + // Set cycle time to 255 + 1 + CTR2 = 0xFF; + + // Turn on the CPU fan at half blast (temperature control TODO) + DCR2 = 0x80; + + // Set gating clock source + PCSGR = 0xFF; + + // Set PWM2 output to use C6CPRS / CTR2 + PCSSGL = (0b10 << 4); + + // Enable PWM + ZTIER = (1 << 1); }