summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/nautilus/board.c28
-rw-r--r--board/nautilus/board.h1
2 files changed, 29 insertions, 0 deletions
diff --git a/board/nautilus/board.c b/board/nautilus/board.c
index 6503225c83..0f39bbf9b7 100644
--- a/board/nautilus/board.c
+++ b/board/nautilus/board.c
@@ -570,6 +570,34 @@ void board_hibernate(void)
;
}
+int board_get_version(void)
+{
+ static int ver = -1;
+ uint8_t id3;
+
+ if (ver != -1)
+ return ver;
+
+ ver = 0;
+
+ /* First 2 strappings are binary. */
+ if (gpio_get_level(GPIO_BOARD_VERSION1))
+ ver |= 0x01;
+ if (gpio_get_level(GPIO_BOARD_VERSION2))
+ ver |= 0x02;
+
+ /*
+ * The 3rd strapping pin is tristate.
+ * id3 = 2 if Hi-Z, id3 = 1 if high, and id3 = 0 if low.
+ */
+ id3 = gpio_get_ternary(GPIO_BOARD_VERSION3);
+ ver |= id3 * 0x04;
+
+ CPRINTS("Board ID = %d", ver);
+
+ return ver;
+}
+
/* Lid Sensor mutex */
static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
diff --git a/board/nautilus/board.h b/board/nautilus/board.h
index 997ebfbb0f..f16b37cbb2 100644
--- a/board/nautilus/board.h
+++ b/board/nautilus/board.h
@@ -12,6 +12,7 @@
#define CONFIG_ADC
#define CONFIG_BACKLIGHT_LID
#define CONFIG_BOARD_VERSION
+#define CONFIG_BOARD_SPECIFIC_VERSION
#define CONFIG_BOARD_FORCE_RESET_PIN
#define CONFIG_CASE_CLOSED_DEBUG_EXTERNAL
#define CONFIG_DPTF