summaryrefslogtreecommitdiff
path: root/common/fpsensor
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2020-01-02 15:36:04 -0800
committerCommit Bot <commit-bot@chromium.org>2020-01-08 00:47:29 +0000
commit0b838e162b35c6115de2cc049df699a65f9ee019 (patch)
tree84d4e83e193f1c884695f12673f3b0f9028ac19a /common/fpsensor
parentceaa05993490943b19cdf61bcd195cf016d31827 (diff)
downloadchrome-ec-0b838e162b35c6115de2cc049df699a65f9ee019.tar.gz
bloonchipper: Add transport and sensor detection
bloonchipper (aka hatch_fp aka dragonclaw) has a voltage divider that can be used to select the sensor and the transport type. Supported designs: * Dragonclaw rev 0.2 (green with Google logo): go/dragonclaw-schematic-rev-0.2 * Hatch reference v3.0: go/hatch-schematic-rev-3.0 The selection lines are connected to ADC inputs, so a future change will use the ADC to allow more than two transports or sensors. BRANCH=none BUG=b:147113851 TEST=flash dragonclaw rev 0.2 and view console output Change-Id: If2e4b150d34cfe41477be528c70e1645043d4d82 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1986322 Reviewed-by: Craig Hesling <hesling@chromium.org>
Diffstat (limited to 'common/fpsensor')
-rw-r--r--common/fpsensor/build.mk1
-rw-r--r--common/fpsensor/fpsensor.c6
-rw-r--r--common/fpsensor/fpsensor_detect_common.c32
3 files changed, 39 insertions, 0 deletions
diff --git a/common/fpsensor/build.mk b/common/fpsensor/build.mk
index a1eeaa9932..0a5ec373de 100644
--- a/common/fpsensor/build.mk
+++ b/common/fpsensor/build.mk
@@ -10,3 +10,4 @@ _fpsensor_dir:=$(dir $(lastword $(MAKEFILE_LIST)))
all-obj-$(HAS_TASK_FPSENSOR)+=$(_fpsensor_dir)fpsensor_state.o
all-obj-$(HAS_TASK_FPSENSOR)+=$(_fpsensor_dir)fpsensor_crypto.o
all-obj-$(HAS_TASK_FPSENSOR)+=$(_fpsensor_dir)fpsensor.o
+all-obj-$(HAS_TASK_FPSENSOR)+=$(_fpsensor_dir)fpsensor_detect_common.o
diff --git a/common/fpsensor/fpsensor.c b/common/fpsensor/fpsensor.c
index 8aa9a1d09e..dd228ade09 100644
--- a/common/fpsensor/fpsensor.c
+++ b/common/fpsensor/fpsensor.c
@@ -11,6 +11,7 @@
#include "ec_commands.h"
#include "fpsensor.h"
#include "fpsensor_crypto.h"
+#include "fpsensor_detect.h"
#include "fpsensor_private.h"
#include "fpsensor_state.h"
#include "gpio.h"
@@ -203,6 +204,11 @@ void fp_task(void)
gpio_config_module(MODULE_SPI_MASTER, 1);
spi_enable(CONFIG_SPI_FP_PORT, 1);
+ CPRINTS("TRANSPORT_SEL: %s",
+ fp_transport_type_to_str(get_fp_transport_type()));
+ CPRINTS("FP_SENSOR_SEL: %s",
+ fp_sensor_type_to_str(get_fp_sensor_type()));
+
#ifdef HAVE_FP_PRIVATE_DRIVER
/* Reset and initialize the sensor IC */
fp_sensor_init();
diff --git a/common/fpsensor/fpsensor_detect_common.c b/common/fpsensor/fpsensor_detect_common.c
new file mode 100644
index 0000000000..b9bcf9bb3b
--- /dev/null
+++ b/common/fpsensor/fpsensor_detect_common.c
@@ -0,0 +1,32 @@
+/* Copyright 2020 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 "fpsensor_detect.h"
+
+const char *fp_transport_type_to_str(enum fp_transport_type type)
+{
+ switch (type) {
+ case FP_TRANSPORT_TYPE_UNKNOWN:
+ default:
+ return "UNKNOWN";
+ case FP_TRANSPORT_TYPE_SPI:
+ return "SPI";
+ case FP_TRANSPORT_TYPE_UART:
+ return "UART";
+ }
+}
+
+const char *fp_sensor_type_to_str(enum fp_sensor_type type)
+{
+ switch (type) {
+ case FP_SENSOR_TYPE_UNKNOWN:
+ default:
+ return "UNKNOWN";
+ case FP_SENSOR_TYPE_FPC:
+ return "FPC";
+ case FP_SENSOR_TYPE_ELAN:
+ return "ELAN";
+ }
+}
+