summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2018-09-04 10:19:25 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-09-10 13:33:43 -0700
commitf48bb683973e10a008eaf0d327ea15d0062bfc1e (patch)
tree1ab9fa1c3c9a72864dc9bf307dc107e56ee0abd0
parent68d10c79fb7ce9ff5ce58147465dab56b3e43233 (diff)
downloadchrome-ec-f48bb683973e10a008eaf0d327ea15d0062bfc1e.tar.gz
octopus: disable tablet mode switch for clamshells
BRANCH=none BUG=b:113837268 TEST=verified that free magnet cannot put a clamshell SKU into tablet mode Change-Id: I5d69ede2da04cb5d067b6ae5a483323054b584ab Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1204452
-rw-r--r--board/bobba/board.c20
-rw-r--r--board/fleex/board.c13
-rw-r--r--board/phaser/board.c12
3 files changed, 29 insertions, 16 deletions
diff --git a/board/bobba/board.c b/board/bobba/board.c
index ab51d2709f..d3c0625af2 100644
--- a/board/bobba/board.c
+++ b/board/bobba/board.c
@@ -44,6 +44,8 @@
#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+static uint8_t sku_id;
+
static void ppc_interrupt(enum gpio_signal signal)
{
switch (signal) {
@@ -181,19 +183,25 @@ struct motion_sensor_t motion_sensors[] = {
unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-static void setup_motion_sensors(uint8_t sku_id)
+static int board_is_convertible(void)
+{
+ /* SKU ID of Bobba360, Sparky360, & unprovisioned: 9, 25, 26, 255 */
+ return sku_id == 9 || sku_id == 25 || sku_id == 26 || sku_id == 255;
+}
+
+static void board_update_sensor_config_from_sku(void)
{
- /* SKU ID of Bobba360 and Sparky360: 9, 25, 26 */
- if (sku_id != 9 && sku_id != 25 && sku_id != 26) {
- /* Clamshell Bobba has no motion sensors. */
+ if (board_is_convertible()) {
+ motion_sensor_count = ARRAY_SIZE(motion_sensors);
+ } else {
motion_sensor_count = 0;
+ tablet_disable_switch();
}
}
/* Read CBI from i2c eeprom and initialize variables for board variants */
static void cbi_init(void)
{
- uint8_t sku_id;
uint32_t val;
if (cbi_get_sku_id(&val) != EC_SUCCESS || val > UINT8_MAX)
@@ -201,7 +209,7 @@ static void cbi_init(void)
sku_id = val;
CPRINTSUSB("SKU: %d", sku_id);
- setup_motion_sensors(sku_id);
+ board_update_sensor_config_from_sku();
}
DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1);
diff --git a/board/fleex/board.c b/board/fleex/board.c
index 6cedd0cecc..220c031c95 100644
--- a/board/fleex/board.c
+++ b/board/fleex/board.c
@@ -49,6 +49,8 @@
#define USB_PD_PORT_ANX7447 0
#define USB_PD_PORT_PS8751 1
+static uint8_t sku_id;
+
static void ppc_interrupt(enum gpio_signal signal)
{
switch (signal) {
@@ -130,7 +132,6 @@ static struct stprivate_data g_lis2dh_data;
static struct lsm6dsm_data lsm6dsm_g_data;
static struct lsm6dsm_data lsm6dsm_a_data;
-static uint16_t sku_id;
/* Drivers */
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -215,12 +216,14 @@ static int board_is_convertible(void)
return sku_id == 0x21 || sku_id == 0x22 || sku_id == 0xff;
}
-static void board_set_motion_sensor_count(void)
+static void board_update_sensor_config_from_sku(void)
{
- if (board_is_convertible())
+ if (board_is_convertible()) {
motion_sensor_count = ARRAY_SIZE(motion_sensors);
- else
+ } else {
motion_sensor_count = 0;
+ tablet_disable_switch();
+ }
}
static void cbi_init(void)
@@ -231,7 +234,7 @@ static void cbi_init(void)
sku_id = val;
ccprints("SKU: 0x%04x", sku_id);
- board_set_motion_sensor_count();
+ board_update_sensor_config_from_sku();
}
DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1);
diff --git a/board/phaser/board.c b/board/phaser/board.c
index 4fc423c33b..b529f83787 100644
--- a/board/phaser/board.c
+++ b/board/phaser/board.c
@@ -32,7 +32,7 @@
#include "util.h"
#include "battery_smart.h"
-static uint16_t sku_id;
+static uint8_t sku_id;
static void ppc_interrupt(enum gpio_signal signal)
{
@@ -196,12 +196,14 @@ static int board_is_convertible(void)
return sku_id == 2 || sku_id == 3 || sku_id == 255;
}
-static void board_set_motion_sensor_count(void)
+static void board_update_sensor_config_from_sku(void)
{
- if (board_is_convertible())
+ if (board_is_convertible()) {
motion_sensor_count = ARRAY_SIZE(motion_sensors);
- else
+ } else {
motion_sensor_count = 0;
+ tablet_disable_switch();
+ }
}
static void cbi_init(void)
@@ -212,7 +214,7 @@ static void cbi_init(void)
sku_id = val;
ccprints("SKU: 0x%04x", sku_id);
- board_set_motion_sensor_count();
+ board_update_sensor_config_from_sku();
}
DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1);