[PATCH v3 0/2] gpio: pcf857x: add support for reset-gpios on (most) PCA967x

Quentin Schulz posted 2 patches 9 months, 3 weeks ago
.../devicetree/bindings/gpio/nxp,pcf8575.yaml      | 37 ++++++++++++++++++++++
drivers/gpio/gpio-pcf857x.c                        | 29 +++++++++++++++--
2 files changed, 64 insertions(+), 2 deletions(-)
[PATCH v3 0/2] gpio: pcf857x: add support for reset-gpios on (most) PCA967x
Posted by Quentin Schulz 9 months, 3 weeks ago
The PCA9670, PCA9671, PCA9672 and PCA9673 all have a RESETN input pin
that is used to reset the I2C GPIO expander.

One needs to hold this pin low for at least 4us and the reset should be
finished after about 100us according to the datasheet[1]. Once the reset
is done, the "registers and I2C-bus state machine will be held in their
default state until the RESET input is once again HIGH.".

Because the logic is reset, the latch values eventually provided in the
Device Tree via lines-initial-states property are inapplicable so they
are simply ignored if a reset GPIO is provided.
This is eventually enforced by the Device Tree binding by making sure
both cannot be present at the same time.

Finally, the reset-gpios property is specific to PCA9670, PCA9671,
PCA9672 and PCA9673 so make it specific to those chips.

[1] https://www.nxp.com/docs/en/data-sheet/PCA9670.pdf 8.5 and fig 22.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
---
Changes in v3:
- wrap description of reset-gpios in dt-binding to 80 characters like
  the reset of the binding,
- add A-b and R-b trailers,
- Link to v2: https://lore.kernel.org/r/20250221-pca976x-reset-driver-v2-0-a2bcb9fdc256@cherry.de

Changes in v2:
- init n_latch to 0 again by default,
- include linux/gpio/consumer.h,
- update reset+latch comment to match what's in the datasheet from
  RESETN input chapter instead of Power-on reset chapter,
- clarify/fix expectation in commit log and binding around active level
  for the reset-gpio wrt RESET# line (ACTIVE_LOW means reset is asserted
  when the GPIO is low),
- rename rstn_gpio to reset_gpio,
- remove curly brackets around return dev_err_probe,
- use fsleep instead of usleep_range,
- use cansleep variant for setting the gpio level,
- add T-b trailers from Heiko,
- Link to v1: https://lore.kernel.org/r/20250220-pca976x-reset-driver-v1-0-6abbf043050e@cherry.de

---
Quentin Schulz (2):
      dt-bindings: gpio: nxp,pcf8575: add reset GPIO
      gpio: pcf857x: add support for reset-gpios on (most) PCA967x

 .../devicetree/bindings/gpio/nxp,pcf8575.yaml      | 37 ++++++++++++++++++++++
 drivers/gpio/gpio-pcf857x.c                        | 29 +++++++++++++++--
 2 files changed, 64 insertions(+), 2 deletions(-)
---
base-commit: d082ecbc71e9e0bf49883ee4afd435a77a5101b6
change-id: 20250219-pca976x-reset-driver-c9aa95869426

Best regards,
-- 
Quentin Schulz <quentin.schulz@cherry.de>
Re: [PATCH v3 0/2] gpio: pcf857x: add support for reset-gpios on (most) PCA967x
Posted by Bartosz Golaszewski 9 months, 3 weeks ago
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Mon, 24 Feb 2025 11:03:20 +0100, Quentin Schulz wrote:
> The PCA9670, PCA9671, PCA9672 and PCA9673 all have a RESETN input pin
> that is used to reset the I2C GPIO expander.
> 
> One needs to hold this pin low for at least 4us and the reset should be
> finished after about 100us according to the datasheet[1]. Once the reset
> is done, the "registers and I2C-bus state machine will be held in their
> default state until the RESET input is once again HIGH.".
> 
> [...]

Applied, thanks!

[1/2] dt-bindings: gpio: nxp,pcf8575: add reset GPIO
      commit: b28037d4f375ed36ce8abbbd31107b991792db72
[2/2] gpio: pcf857x: add support for reset-gpios on (most) PCA967x
      commit: 087f8a6b8ce93d582e0b84af538da13d735e2444

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>