diff options
-rw-r--r-- | chip/mec1322/pwm.c | 11 | ||||
-rw-r--r-- | include/pwm.h | 5 |
2 files changed, 13 insertions, 3 deletions
diff --git a/chip/mec1322/pwm.c b/chip/mec1322/pwm.c index d66c03da05..1643664855 100644 --- a/chip/mec1322/pwm.c +++ b/chip/mec1322/pwm.c @@ -44,11 +44,15 @@ int pwm_get_duty(enum pwm_channel ch) return MEC1322_PWM_ON(pwm_channels[ch].channel); } -static void pwm_configure(int ch, int active_low) +static void pwm_configure(int ch, int active_low, int clock_low) { + /* + * clock_low=0 selects the 48MHz Ring Oscillator source + * clock_low=1 selects the 100kHz_Clk source + */ MEC1322_PWM_CFG(ch) = (15 << 3) | /* Pre-divider = 16 */ (active_low ? (1 << 2) : 0) | - (0 << 1); /* 48M clock */ + (clock_low ? (1 << 1) : 0); } static void pwm_init(void) @@ -57,7 +61,8 @@ static void pwm_init(void) for (i = 0; i < PWM_CH_COUNT; ++i) { pwm_configure(pwm_channels[i].channel, - pwm_channels[i].flags & PWM_CONFIG_ACTIVE_LOW); + pwm_channels[i].flags & PWM_CONFIG_ACTIVE_LOW, + pwm_channels[i].flags & PWM_CONFIG_ALT_CLOCK); pwm_set_duty(i, 0); } } diff --git a/include/pwm.h b/include/pwm.h index c4ae331b1c..66610b9240 100644 --- a/include/pwm.h +++ b/include/pwm.h @@ -41,5 +41,10 @@ int pwm_get_duty(enum pwm_channel ch); * its duty cycle to produce a given fan RPM. */ #define PWM_CONFIG_HAS_RPM_MODE (1 << 1) +/** + * PWM clock select alternate source. The actual clock and alternate + * source are chip dependent. + */ +#define PWM_CONFIG_ALT_CLOCK (1 << 2) #endif /* __CROS_EC_PWM_H */ |