diff options
Diffstat (limited to 'board/spherion')
-rw-r--r-- | board/spherion/board.c | 31 | ||||
-rw-r--r-- | board/spherion/board.h | 9 | ||||
-rw-r--r-- | board/spherion/gpio.inc | 2 |
3 files changed, 41 insertions, 1 deletions
diff --git a/board/spherion/board.c b/board/spherion/board.c index eccd0a21c6..1e7e90b7c3 100644 --- a/board/spherion/board.c +++ b/board/spherion/board.c @@ -166,3 +166,34 @@ struct motion_sensor_t motion_sensors[] = { }, }; const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); + +/* PWM */ + +/* + * PWM channels. Must be in the exactly same order as in enum pwm_channel. + * There total three 16 bits clock prescaler registers for all pwm channels, + * so use the same frequency and prescaler register setting is required if + * number of pwm channel greater than three. + */ +const struct pwm_t pwm_channels[] = { + [PWM_CH_KBLIGHT] = { + .channel = 2, + .flags = 0, + .freq_hz = 10000, + .pcfsr_sel = PWM_PRESCALER_C4 + }, +}; +BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); + + +static void kb_backlight_enable(void) +{ + gpio_set_level(GPIO_EC_KB_BL_EN, 1); +} +DECLARE_HOOK(HOOK_CHIPSET_RESUME, kb_backlight_enable, HOOK_PRIO_DEFAULT); + +static void kb_backlight_disable(void) +{ + gpio_set_level(GPIO_EC_KB_BL_EN, 0); +} +DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, kb_backlight_disable, HOOK_PRIO_DEFAULT); diff --git a/board/spherion/board.h b/board/spherion/board.h index 135be0d6a6..8bce87a17a 100644 --- a/board/spherion/board.h +++ b/board/spherion/board.h @@ -25,6 +25,10 @@ /* LED */ #define CONFIG_LED_ONOFF_STATES +/* Keyboard features */ +/* Keyboard backliht */ +#define CONFIG_PWM_KBLIGHT + /* PD / USB-C / PPC */ #define CONFIG_USB_PD_DEBUG_LEVEL 3 @@ -77,5 +81,10 @@ enum sensor_id { SENSOR_COUNT, }; +enum pwm_channel { + PWM_CH_KBLIGHT, + PWM_CH_COUNT, +}; + #endif /* !__ASSEMBLER__ */ #endif /* __CROS_EC_BOARD_H */ diff --git a/board/spherion/gpio.inc b/board/spherion/gpio.inc index 5b07faf43d..89abf26d37 100644 --- a/board/spherion/gpio.inc +++ b/board/spherion/gpio.inc @@ -83,6 +83,7 @@ GPIO(BC12_DET_EN, PIN(J, 5), GPIO_OUT_LOW) /* EN_USB_C0_BC12_DET */ GPIO(EN_EC_ID_ODL, PIN(H, 5), GPIO_ODR_LOW) GPIO(ENTERING_RW, PIN(C, 5), GPIO_OUT_LOW) /* EC_ENTERING_RW */ GPIO(EC_USB_C0_MUX_RESET_L, PIN(D, 7), GPIO_OUT_HIGH) +GPIO(EC_KB_BL_EN, PIN(I, 7), GPIO_OUT_LOW) /* Keyboard backlight enable */ /* I2C pins - Alternate function below configures I2C module on these pins */ GPIO(I2C_A_SCL, PIN(B, 3), GPIO_INPUT) /* I2C_CHG_BATT_SCL */ @@ -140,7 +141,6 @@ GPIO(CCD_MODE_ODL, PIN(C, 4), GPIO_INPUT) * so we set them as output low. */ GPIO(NC_GPI5, PIN(I, 5), GPIO_OUT_LOW) -GPIO(NC_GPI7, PIN(I, 7), GPIO_OUT_LOW) /* NC pins, enable internal pull-up/down to avoid floating state. */ GPIO(NC_GPM2, PIN(M, 2), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(NC_GPM3, PIN(M, 3), GPIO_INPUT | GPIO_PULL_DOWN) |