Zork: Don't KB_SCAN_DISABLE_LID_ANGLE in S0
Keep keyboard scan enabled in tablet mode if the AP is in S0,
so AP can decide whether to ignore input devices or not.
BRANCH=none
TEST=none
@@ -204,8 +204,23 @@ __overridable int board_get_temp(int idx, int *temp_k)
#ifndef TEST_BUILD
void lid_angle_peripheral_enable(int enable)
{
- if (ec_config_has_lid_angle_tablet_mode())
- keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE);
+ if (ec_config_has_lid_angle_tablet_mode()) {
+ int chipset_in_s0 = chipset_in_state(CHIPSET_STATE_ON);
+
+ if (enable) {
+ keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE);
+ } else {
+ /*
+ * Ensure that the chipset is off before disabling the
+ * keyboard. When the chipset is on, the EC keeps the
+ * keyboard enabled and the AP decides whether to
+ * ignore input devices or not.
+ */
+ if (!chipset_in_s0)
+ keyboard_scan_enable(0,
+ KB_SCAN_DISABLE_LID_ANGLE);
+ }
+ }
}
#endif
