summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2020-02-10 13:14:36 -0700
committerCommit Bot <commit-bot@chromium.org>2020-02-18 19:27:10 +0000
commitb6adca6689753bdbe798cd1e0a56f8a4df749445 (patch)
treeceebddf3a15ca0996745c6df67f60e6d9aa2097e
parent980b7bc18f1a1e32bb24c3238d93558a02e5fe99 (diff)
downloadchrome-ec-b6adca6689753bdbe798cd1e0a56f8a4df749445.tar.gz
hatch: Add check for convertible SKUs in lid_angle_peripheral_enable
Check for a convertible SKU before turning off the keyboard in the switch to tablet mode. See go/hatch-skus for the list. BUG=b:125936966 BRANCH=firmware-hatch-12672.B TEST=On Kohaku, artificially force SKU to both convertible and non-convertible SKUs, switch to tablet mode, and then check whether Alt-Volup-R reboots the EC. Change-Id: Id29644c4e050705203b860324f14b1b87bc4ccf4 Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2047630 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
-rw-r--r--baseboard/hatch/baseboard.c9
-rw-r--r--baseboard/hatch/baseboard.h1
-rw-r--r--board/akemi/board.c8
-rw-r--r--board/hatch/board.c7
-rw-r--r--board/helios/board.c7
-rw-r--r--board/jinlon/board.c8
-rw-r--r--board/kindred/board.c2
-rw-r--r--board/kohaku/board.c7
-rw-r--r--board/mushu/board.c7
-rw-r--r--board/stryke/board.c7
10 files changed, 58 insertions, 5 deletions
diff --git a/baseboard/hatch/baseboard.c b/baseboard/hatch/baseboard.c
index 8253f11239..0651ffdc7c 100644
--- a/baseboard/hatch/baseboard.c
+++ b/baseboard/hatch/baseboard.c
@@ -355,10 +355,11 @@ void baseboard_mst_enable_control(enum mst_source src, int level)
#ifndef TEST_BUILD
void lid_angle_peripheral_enable(int enable)
{
- /* TODO(b/125936966): Need to add SKU dependency for convertibles */
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
- enable = 0;
- keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE);
+ if (board_is_convertible()) {
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
+ enable = 0;
+ keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE);
+ }
}
#endif
diff --git a/baseboard/hatch/baseboard.h b/baseboard/hatch/baseboard.h
index 200480e152..09ea0056a7 100644
--- a/baseboard/hatch/baseboard.h
+++ b/baseboard/hatch/baseboard.h
@@ -200,6 +200,7 @@ unsigned char get_board_sku(void);
unsigned char get_board_id(void);
void board_reset_pd_mcu(void);
void baseboard_mst_enable_control(enum mst_source, int level);
+bool board_is_convertible(void);
/* Check with variant about battery presence. */
enum battery_present variant_battery_present(void);
diff --git a/board/akemi/board.c b/board/akemi/board.c
index c379d68fec..c2f6b14d76 100644
--- a/board/akemi/board.c
+++ b/board/akemi/board.c
@@ -429,3 +429,11 @@ static void board_chipset_shutdown(void)
sb_quick_charge_mode(SB_QUICK_CHARGE_ENABLE);
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT);
+
+bool board_is_convertible(void)
+{
+ const uint8_t sku = get_board_sku();
+
+ return (sku == 255) || (sku == 1) || (sku == 2) || (sku == 3) ||
+ (sku == 4);
+}
diff --git a/board/hatch/board.c b/board/hatch/board.c
index ae25f66e5b..4e68b7d215 100644
--- a/board/hatch/board.c
+++ b/board/hatch/board.c
@@ -490,3 +490,10 @@ void board_overcurrent_event(int port, int is_overcurrented)
/* Note that the level is inverted because the pin is active low. */
gpio_set_level(GPIO_USB_C_OC_ODL, !is_overcurrented);
}
+
+bool board_is_convertible(void)
+{
+ const uint8_t sku = get_board_sku();
+
+ return (sku == 255);
+}
diff --git a/board/helios/board.c b/board/helios/board.c
index 008cdd6e96..dd0b2c87a3 100644
--- a/board/helios/board.c
+++ b/board/helios/board.c
@@ -405,3 +405,10 @@ int board_tcpc_post_init(int port)
return rv;
}
+
+bool board_is_convertible(void)
+{
+ const uint8_t sku = get_board_sku();
+
+ return (sku == 255) || (sku == 1);
+}
diff --git a/board/jinlon/board.c b/board/jinlon/board.c
index 1a0936615e..a9646a7794 100644
--- a/board/jinlon/board.c
+++ b/board/jinlon/board.c
@@ -427,3 +427,11 @@ const int keyboard_factory_scan_pins[][2] = {
const int keyboard_factory_scan_pins_used =
ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
+
+bool board_is_convertible(void)
+{
+ const uint8_t sku = get_board_sku();
+
+ return (sku == 255) || (sku == 1) || (sku == 2) || (sku == 21) ||
+ (sku == 22);
+}
diff --git a/board/kindred/board.c b/board/kindred/board.c
index f468851371..308ccf2eca 100644
--- a/board/kindred/board.c
+++ b/board/kindred/board.c
@@ -408,7 +408,7 @@ static void board_gpio_set_pp5000(void)
}
-static bool board_is_convertible(void)
+bool board_is_convertible(void)
{
uint8_t sku_id = get_board_sku();
/* SKU ID of Kled : 1, 2, 3, 4 */
diff --git a/board/kohaku/board.c b/board/kohaku/board.c
index 1cd8021e13..e2711433fc 100644
--- a/board/kohaku/board.c
+++ b/board/kohaku/board.c
@@ -465,3 +465,10 @@ void board_overcurrent_event(int port, int is_overcurrented)
/* Note that the level is inverted because the pin is active low. */
gpio_set_level(GPIO_USB_C_OC_ODL, !is_overcurrented);
}
+
+bool board_is_convertible(void)
+{
+ const uint8_t sku = get_board_sku();
+
+ return (sku == 255) || (sku == 1);
+}
diff --git a/board/mushu/board.c b/board/mushu/board.c
index 27d1ab4002..4670c2bb0f 100644
--- a/board/mushu/board.c
+++ b/board/mushu/board.c
@@ -490,3 +490,10 @@ void board_overcurrent_event(int port, int is_overcurrented)
/* Note that the level is inverted because the pin is active low. */
gpio_set_level(GPIO_USB_C_OC_ODL, !is_overcurrented);
}
+
+bool board_is_convertible(void)
+{
+ const uint8_t sku = get_board_sku();
+
+ return (sku == 255);
+}
diff --git a/board/stryke/board.c b/board/stryke/board.c
index 82deccbfe9..dc5de9d253 100644
--- a/board/stryke/board.c
+++ b/board/stryke/board.c
@@ -406,3 +406,10 @@ void board_overcurrent_event(int port, int is_overcurrented)
/* Note that the level is inverted because the pin is active low. */
gpio_set_level(GPIO_USB_C_OC_ODL, !is_overcurrented);
}
+
+bool board_is_convertible(void)
+{
+ const uint8_t sku = get_board_sku();
+
+ return (sku == 255);
+}