diff options
author | Scott Chao <scott_chao@wistron.corp-partner.google.com> | 2022-03-25 19:49:40 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-03-26 01:29:00 +0000 |
commit | 81dff9c98a666237f2045b5d5e56cf63f98ff228 (patch) | |
tree | b6f6ddab37c1ffb89521cfd97ee4bfafd48a2e3d | |
parent | 555073594254d5be23e7bb4d8ff9267a9965c2b4 (diff) | |
download | chrome-ec-81dff9c98a666237f2045b5d5e56cf63f98ff228.tar.gz |
primus: Add SSFC field for 2nd trackpoint
BUG=b:226215983
BRANCH=none
TEST=make -j BOARD=primus
Signed-off-by: Scott Chao <scott_chao@wistron.corp-partner.google.com>
Change-Id: If7deaf7498a4e0e2f7a30b9eb3b92913ab1bd76c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3552610
Reviewed-by: caveh jalali <caveh@chromium.org>
Commit-Queue: caveh jalali <caveh@chromium.org>
-rw-r--r-- | board/primus/build.mk | 1 | ||||
-rw-r--r-- | board/primus/cbi_ssfc.c | 30 | ||||
-rw-r--r-- | board/primus/cbi_ssfc.h | 31 |
3 files changed, 62 insertions, 0 deletions
diff --git a/board/primus/build.mk b/board/primus/build.mk index 217f95da10..ddf50b46e2 100644 --- a/board/primus/build.mk +++ b/board/primus/build.mk @@ -14,6 +14,7 @@ BASEBOARD:=brya board-y= board-y+=battery.o board-y+=board.o +board-y+=cbi_ssfc.o board-y+=charger.o board-y+=fans.o board-y+=fw_config.o diff --git a/board/primus/cbi_ssfc.c b/board/primus/cbi_ssfc.c new file mode 100644 index 0000000000..dd59bb2c9f --- /dev/null +++ b/board/primus/cbi_ssfc.c @@ -0,0 +1,30 @@ +/* Copyright 2022 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "cbi_ssfc.h" +#include "common.h" +#include "compile_time_macros.h" +#include "console.h" +#include "cros_board_info.h" + +#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args) + +/* Cache SSFC on init since we don't expect it to change in runtime */ +static union primus_cbi_ssfc cached_ssfc; +BUILD_ASSERT(sizeof(cached_ssfc) == sizeof(uint32_t)); + +void board_init_ssfc(void) +{ + if (cbi_get_ssfc(&cached_ssfc.raw_value) != EC_SUCCESS) + /* Default to 0 when CBI isn't populated */ + cached_ssfc.raw_value = 0; + + CPRINTS("Read CBI SSFC : 0x%04X", cached_ssfc.raw_value); +} + +enum ec_ssfc_trackpoint get_cbi_ssfc_trackpoint(void) +{ + return cached_ssfc.trackpoint; +} diff --git a/board/primus/cbi_ssfc.h b/board/primus/cbi_ssfc.h new file mode 100644 index 0000000000..d1ad8c991f --- /dev/null +++ b/board/primus/cbi_ssfc.h @@ -0,0 +1,31 @@ +/* Copyright 2022 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#ifndef _PRIMUS_CBI_SSFC_H_ +#define _PRIMUS_CBI_SSFC_H_ +#include "stdint.h" +/**************************************************************************** + * Primus CBI Second Source Factory Cache + */ +/* + * Trackpoint (Bit 0) + */ +enum ec_ssfc_trackpoint { + SSFC_SENSOR_TRACKPOINT_ELAN = 0, + SSFC_SENSOR_TRACKPOINT_SYNAPTICS = 1, +}; +union primus_cbi_ssfc { + struct { + enum ec_ssfc_trackpoint trackpoint : 2; + uint32_t reserved_1 : 30; + }; + uint32_t raw_value; +}; +/** + * Get the trackpoint type from SSFC_CONFIG. + * + * @return the Trackpoint board type. + */ +enum ec_ssfc_trackpoint get_cbi_ssfc_trackpoint(void); +#endif /* _PRIMUS_CBI_SSFC_H_ */ |