Skip to content
Commit 9974bb04 authored by Gerard Marull-Paretas's avatar Gerard Marull-Paretas Committed by Fabio Baltieri
Browse files

drivers: i2c: nrfx_twim: disable and restore state for bus recovery



TWIM peripheral needs to be disabled for bus recovery, otherwise SCL/SDA
lines will not be released. This patch makes sure to disable peripheral
if active, and, restore its state afterwards (including pin
configuration).

It is worth to note that a better solution would be to:

1. Define scl/sda pins as `-gpios` in DT
2. Use GPIO API in the driver to perform recovery (as some other drivers
   do)
3. Potentially use a "gpio" pinctrl state for this case

Unfortunately HAL is doing everything under the hood, so we have little
options to improve this unless we don't use it for such case. GPIO based
recovery should likely be generalized as many drivers seem to replicate
such _algorithm_.

Signed-off-by: default avatarGerard Marull-Paretas <gerard.marull@nordicsemi.no>
parent 2828578c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment