summaryrefslogtreecommitdiff
path: root/board/fleex/board.c
diff options
context:
space:
mode:
authorelthanhuang <elthan_huang@compal.corp-partner.google.com>2018-08-28 16:01:05 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-08-29 01:37:56 -0700
commit303e1bdb2cbfb9f3c19958d96a8cfb09aa4e01b2 (patch)
tree594199a97871268e6f82b4a4cfe8a1c3cbe85fc0 /board/fleex/board.c
parent2c520a2a424bf57e7e626273d0c5b5dfc6acd1d6 (diff)
downloadchrome-ec-303e1bdb2cbfb9f3c19958d96a8cfb09aa4e01b2.tar.gz
Fleex: Enable dynamic motion sensor count and
change disable the keyboard for convertible Get the motion sensor count by SKU motion_sensor_count on clamshells is 0. motion_sensor_count on convertibles is 2. lid_angle_peripheral_enable() function disable the keyboard for convertible systems. BUG=b:112286331 BRANCH=none TEST=Manual change SKUID to 0x21 for convertible and verified the motion sensor count and that the motion senors were initialized in the EC console log. change SKUID to 0x01 for clamshell and the motion senors were not initialized in the EC console log. Change-Id: Ic9d6c910c9e56479414d30f1e2c53d73515842af Signed-off-by: elthanhuang <elthan_huang@compal.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/1192903 Commit-Ready: Elthan Huang <elthan_huang@compal.corp-partner.google.com> Tested-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com> Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'board/fleex/board.c')
-rw-r--r--board/fleex/board.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/board/fleex/board.c b/board/fleex/board.c
index 11564aa73d..697d072f45 100644
--- a/board/fleex/board.c
+++ b/board/fleex/board.c
@@ -12,6 +12,7 @@
#include "charge_manager.h"
#include "charge_state.h"
#include "common.h"
+#include "console.h"
#include "cros_board_info.h"
#include "driver/accel_lis2dh.h"
#include "driver/accelgyro_lsm6dsm.h"
@@ -141,6 +142,7 @@ 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] = {
@@ -218,7 +220,32 @@ struct motion_sensor_t motion_sensors[] = {
},
};
-const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+
+static int board_is_convertible(void)
+{
+ return sku_id == 0x21 || sku_id == 0x22 || sku_id == 0xff;
+}
+
+static void board_set_motion_sensor_count(void)
+{
+ if (board_is_convertible())
+ motion_sensor_count = ARRAY_SIZE(motion_sensors);
+ else
+ motion_sensor_count = 0;
+}
+
+static void cbi_init(void)
+{
+ uint32_t val;
+
+ if (cbi_get_sku_id(&val) == EC_SUCCESS)
+ sku_id = val;
+ ccprints("SKU: 0x%04x", sku_id);
+
+ board_set_motion_sensor_count();
+}
+DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1);
/* Initialize board. */
static void board_init(void)
@@ -239,8 +266,8 @@ void lid_angle_peripheral_enable(int enable)
*/
if (tablet_get_mode())
enable = 0;
-
- keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE);
+ if (board_is_convertible())
+ keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE);
}
#endif