// SPDX-License-Identifier: GPL-3.0-only #include void pwm_init(void) { // Set T0CHSEL to TACH0A and T1CHSEL to TACH1A TSWCTLR = 0; // Disable PWM ZTIER = 0; // Set prescalar clock frequency to EC clock PCFSR = 0b01; // Use C0CPRS and CTR0 for all channels PCSSGL = 0; PCSSGH = 0; // Set clock prescaler to 0 + 1 C0CPRS = 0; // Set cycle time to 255 + 1 CTR0 = 255; // Turn off CPU fan (temperature control in peci_event) DCR2 = 0; // Enable PWM ZTIER = (1 << 1); }