Re: [PATCH v3] iio: potentiostat: lmp91000: Handle configuration write errors
From: Andy Shevchenko
Date: Thu Nov 19 2026 - 05:07:06 EST
On Thu, Nov 19, 2026 at 11:21:55AM +0800, Zhu Jun wrote:
> On Mon, Nov 16, 2026, Andy Shevchenko wrote:
> > How is HW being recovered from the inconsistent state(s)?
>
> 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.
Right, in each of these cases what will be the outcome to the user?
> 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.
This is a recovery mechanism! But specific question is the above: what
will happen with HW in each of these states when we try to re-probe the
driver?
> 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
--
With Best Regards,
Andy Shevchenko