Skip to content

Commit

Permalink
drivers: gpio: PCF857x: Modify PCF8574 driver
Browse files Browse the repository at this point in the history
Modify existing PCF8574 driver as PCF857x for:
PCF8574 - 8 channel I/O expander
PCF8575 - 16 channel I/O expander

Signed-off-by: Amrith Venkat Kesavamoorthi <amrith@mr-beam.org>
  • Loading branch information
amrithvenkat committed Jan 15, 2024
1 parent e5b3231 commit 6e447aa
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 121 deletions.
16 changes: 8 additions & 8 deletions boards/xtensa/kincony_kc868_a32/kincony_kc868_a32.dts
Expand Up @@ -52,31 +52,31 @@
pinctrl-names = "default";

i2c0_pcf8574@21 {
compatible = "nxp,pcf8574";
compatible = "nxp,pcf857x";
reg = <0x21>;
gpio-controller;
#gpio-cells = <2>;
ngpios = <8>;
};

i2c0_pcf8574@22 {
compatible = "nxp,pcf8574";
compatible = "nxp,pcf857x";
reg = <0x22>;
gpio-controller;
#gpio-cells = <2>;
ngpios = <8>;
};

i2c0_pcf8574@24 {
compatible = "nxp,pcf8574";
compatible = "nxp,pcf857x";
reg = <0x24>;
gpio-controller;
#gpio-cells = <2>;
ngpios = <8>;
};

i2c0_pcf8574@25 {
compatible = "nxp,pcf8574";
compatible = "nxp,pcf857x";
reg = <0x25>;
gpio-controller;
#gpio-cells = <2>;
Expand All @@ -93,31 +93,31 @@
pinctrl-names = "default";

i2c1_pcf8574@21 {
compatible = "nxp,pcf8574";
compatible = "nxp,pcf857x";
reg = <0x21>;
gpio-controller;
#gpio-cells = <2>;
ngpios = <8>;
};

i2c1_pcf8574@22 {
compatible = "nxp,pcf8574";
compatible = "nxp,pcf857x";
reg = <0x22>;
gpio-controller;
#gpio-cells = <2>;
ngpios = <8>;
};

i2c1_pcf8574@24 {
compatible = "nxp,pcf8574";
compatible = "nxp,pcf857x";
reg = <0x24>;
gpio-controller;
#gpio-cells = <2>;
ngpios = <8>;
};

i2c1_pcf8574@25 {
compatible = "nxp,pcf8574";
compatible = "nxp,pcf857x";
reg = <0x25>;
gpio-controller;
#gpio-cells = <2>;
Expand Down
29 changes: 29 additions & 0 deletions doc/releases/migration-guide-3.6.rst
Expand Up @@ -56,6 +56,35 @@ enable all optional modules, and then run ``west update`` again.
Device Drivers and Device Tree
==============================

* The :dtcompatible:`nxp,pcf8574` driver has been renamed to
:dtcompatible:`nxp,pcf857x`. (:github:`67054`) to support pcf8574 and pcf8575.
The Kconfig option has been renamed from :kconfig:option:`CONFIG_GPIO_PCF8574` to
:kconfig:option:`CONFIG_GPIO_PCF857X`.
The Device Tree can be configured as follows:

.. code-block:: devicetree
&i2c {
status = "okay";
pcf8574: pcf857x@20 {
compatible = "nxp,pcf857x";
status = "okay";
reg = <0x20>;
gpio-controller;
#gpio-cells = <2>;
ngpios = <8>;
};
pcf8575: pcf857x@21 {
compatible = "nxp,pcf857x";
status = "okay";
reg = <0x21>;
gpio-controller;
#gpio-cells = <2>;
ngpios = <16>;
};
};
* The :dtcompatible:`st,lsm6dsv16x` sensor driver has been changed to support
configuration of both int1 and int2 pins. The DT attribute ``irq-gpios`` has been
removed and substituted by two new attributes, ``int1-gpios`` and ``int2-gpios``.
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/CMakeLists.txt
Expand Up @@ -56,7 +56,7 @@ zephyr_library_sources_ifdef(CONFIG_GPIO_SNPS_CREG gpio_creg_gpio.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_STMPE1600 gpio_stmpe1600.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_XEC_V2 gpio_mchp_xec_v2.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_PCA953X gpio_pca953x.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_PCF8574 gpio_pcf8574.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_PCF857X gpio_pcf857x.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_FXL6408 gpio_fxl6408.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_ANDES_ATCGPIO100 gpio_andes_atcgpio100.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_NEORV32 gpio_neorv32.c)
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/Kconfig
Expand Up @@ -179,7 +179,7 @@ source "drivers/gpio/Kconfig.stmpe1600"

source "drivers/gpio/Kconfig.pca953x"

source "drivers/gpio/Kconfig.pcf8574"
source "drivers/gpio/Kconfig.pcf857x"

source "drivers/gpio/Kconfig.fxl6408"

Expand Down
19 changes: 0 additions & 19 deletions drivers/gpio/Kconfig.pcf8574

This file was deleted.

21 changes: 21 additions & 0 deletions drivers/gpio/Kconfig.pcf857x
@@ -0,0 +1,21 @@
# PCF857x GPIO configuration options

# Copyright (c) 2022 Ithinx
# Copyright (c) 2023 Mr Beam Lasers GmbH
# Copyright (c) 2023 Amrith Venkat Kesavamoorthi <amrith@mr-beam.org>
# SPDX-License-Identifier: Apache-2.0

menuconfig GPIO_PCF857X
bool "PCF857X I2C GPIO chip"
default y
depends on DT_HAS_NXP_PCF857X_ENABLED
select I2C
help
Enable driver for PCF857X I2C GPIO chip.

config GPIO_PCF857X_INIT_PRIORITY
int "Init priority"
default 70
depends on GPIO_PCF857X
help
Device driver initialization priority.

0 comments on commit 6e447aa

Please sign in to comment.