drivers/sensor: lsm6dso: Move interrupt config to after chip reset

The initialization code would configure the lsm6dso interrupt, then
configure the rest of the chip.  The chip init includes a reset that
would undo the register setting done during interrupt configuration.

It's also not a good idea to enable the interrupt on the SoC when the
lsm6dso has not yet been reset or configured.  It might be generating
interrupts.

The lsm6dso has no hardware reset line, so it will not be reset on
reboot unless a power cycle is involved.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
This commit is contained in:
Trent Piepho 2022-12-20 15:37:22 -08:00 committed by Lauren Murphy
parent d14732b541
commit 7cf6d75a11

View file

@ -823,6 +823,11 @@ static int lsm6dso_init(const struct device *dev)
LOG_INF("Initialize device %s", dev->name);
data->dev = dev;
if (lsm6dso_init_chip(dev) < 0) {
LOG_DBG("failed to initialize chip");
return -EIO;
}
#ifdef CONFIG_LSM6DSO_TRIGGER
if (cfg->trig_enabled) {
if (lsm6dso_init_interrupt(dev) < 0) {
@ -832,11 +837,6 @@ static int lsm6dso_init(const struct device *dev)
}
#endif
if (lsm6dso_init_chip(dev) < 0) {
LOG_DBG("failed to initialize chip");
return -EIO;
}
#ifdef CONFIG_LSM6DSO_SENSORHUB
data->shub_inited = true;
if (lsm6dso_shub_init(dev) < 0) {