summaryrefslogtreecommitdiff
path: root/common/tsu6721.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/tsu6721.c')
-rw-r--r--common/tsu6721.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/common/tsu6721.c b/common/tsu6721.c
index 7f3d1d0c7e..629e8e3e86 100644
--- a/common/tsu6721.c
+++ b/common/tsu6721.c
@@ -24,6 +24,9 @@
/* 8-bit I2C address */
#define TSU6721_I2C_ADDR (0x25 << 1)
+/* Delay values */
+#define TSU6721_SW_RESET_DELAY 15
+
static int saved_interrupts;
uint8_t tsu6721_read(uint8_t reg)
@@ -86,6 +89,14 @@ int tsu6721_get_device_type(void)
(tsu6721_read(TSU6721_REG_DEV_TYPE1));
}
+void tsu6721_reset(void)
+{
+ tsu6721_write(TSU6721_REG_RESET, 0x1);
+ /* TSU6721 reset takes ~10ms. Let's wait for 15ms to be safe. */
+ msleep(TSU6721_SW_RESET_DELAY);
+ tsu6721_init();
+}
+
int tsu6721_mux(enum tsu6721_mux sel)
{
uint8_t id = tsu6721_read(TSU6721_REG_ADC);