Skip to content

Commit db0fe1e

Browse files
committed
input: pinnacle: Perform software reset on init
Don't rely on power-on-reset for the connected device, issue a software reset on init to be sure we're reset before continuing. Signed-off-by: Peter Johanson <peter@peterjohanson.com>
1 parent f0cbba0 commit db0fe1e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

drivers/input/input_pinnacle.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,14 +761,29 @@ static int pinnacle_init(const struct device *dev)
761761
return -ENODEV;
762762
}
763763

764+
/* Clear CC */
765+
rc = pinnacle_write(dev, PINNACLE_REG_STATUS1, 0);
766+
if (rc < 0) {
767+
LOG_ERR("Failed to clear CC from STATUS1 register (%d)", rc);
768+
return rc;
769+
}
770+
771+
k_usleep(50);
772+
rc = pinnacle_write(dev, PINNACLE_REG_SYS_CONFIG1, PINNACLE_SYS_CONFIG1_RESET);
773+
774+
if (rc < 0) {
775+
LOG_ERR("Failed to write reset to SYS_CONFIG1 (%d)", rc);
776+
return rc;
777+
}
778+
764779
/* Wait until the calibration is completed (SW_CC is asserted) */
765780
ret = WAIT_FOR(pinnacle_read(dev, PINNACLE_REG_STATUS1, &value) == 0 &&
766781
(value & PINNACLE_STATUS1_SW_CC) == PINNACLE_STATUS1_SW_CC,
767782
PINNACLE_CALIBRATION_AWAIT_RETRY_COUNT *
768783
PINNACLE_CALIBRATION_AWAIT_DELAY_POLL_US,
769784
k_sleep(K_USEC(PINNACLE_CALIBRATION_AWAIT_DELAY_POLL_US)));
770785
if (!ret) {
771-
LOG_ERR("Failed to wait for calibration complition");
786+
LOG_ERR("Failed to wait for calibration completion");
772787
return -EIO;
773788
}
774789

0 commit comments

Comments
 (0)