Re: [PATCH v3] iio: potentiostat: lmp91000: Handle configuration write errors

From: Zhu Jun

Date: Wed Nov 18 2026 - 22:22:12 EST


On Mon, Nov 16, 2026, Andy Shevchenko wrote:
> How is HW being recovered from the inconsistent state(s)?

Hi Andy,

v3 has no hardware recovery step. The LOCK bit only controls write
access to TIACN and REFCN (datasheet section 7.6.2). Setting it again
leaves the register values as they are.

If the unlock write fails, we stop before writing either configuration
register. The resulting lock state is unconfirmed. If a configuration
write fails, the chip may be partly configured. We try to restore write
protection and return the configuration error. If both configuration
writes succeed and the relock write fails, we return the relock error.
In that case the configuration writes succeeded, but write protection
is unconfirmed. If both a configuration write and the relock fail, v3
only reports the configuration error.

In all three cases probe exits before registering the IIO device. If
the device is probed again and I2C is working, the same sequence writes
LOCK=0, rewrites both registers and writes LOCK=1. That would restore
these register settings regardless of the previous lock state. The
driver does not schedule a retry or reset the chip after these errors,
and I have not verified recovery on hardware.

Datasheet: https://www.ti.com/lit/ds/symlink/lmp91000.pdf

Thanks,
Zhu Jun