Skip to content

Commit

Permalink
driver: gpio: mcp23xxx: Refactor to generic.
Browse files Browse the repository at this point in the history
Refactor the mcp230xx driver to generically also support
SPI IO expanders, renaming it to mcp23xxx in the process.

Signed-off-by: Peter Johanson <[email protected]>
  • Loading branch information
petejohanson authored and cfriedt committed Dec 8, 2021
1 parent 8251a65 commit a5ad94f
Show file tree
Hide file tree
Showing 14 changed files with 677 additions and 403 deletions.
2 changes: 2 additions & 0 deletions drivers/gpio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ zephyr_library_sources_ifdef(CONFIG_GPIO_GECKO gpio_gecko.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_IMX gpio_imx.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_ITE_IT8XXX2 gpio_ite_it8xxx2.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_MCP23S17 gpio_mcp23s17.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_MCP23XXX gpio_mcp23xxx.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_MCP23SXX gpio_mcp23sxx.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_MCP230XX gpio_mcp230xx.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_MCUX gpio_mcux.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_MCUX_IGPIO gpio_mcux_igpio.c)
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ source "drivers/gpio/Kconfig.pca95xx"

source "drivers/gpio/Kconfig.mcp23s17"

source "drivers/gpio/Kconfig.mcp230xx"
source "drivers/gpio/Kconfig.mcp23xxx"

source "drivers/gpio/Kconfig.mcux"

Expand Down
26 changes: 0 additions & 26 deletions drivers/gpio/Kconfig.mcp230xx

This file was deleted.

50 changes: 50 additions & 0 deletions drivers/gpio/Kconfig.mcp23xxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# MCP23S17 GPIO configuration options

# Copyright (c) 2021 metraTec GmbH
# SPDX-License-Identifier: Apache-2.0

# Workaround for not being able to have commas in macro arguments
DT_COMPAT_MICROCHIP_MCP230xx := microchip,mcp230xx
DT_COMPAT_MICROCHIP_MCP23Sxx := microchip,mcp23sxx

config GPIO_MCP23XXX
bool
help
Enable support for the Microchip 23xxx I2C/SPI IO
expanders.

menuconfig GPIO_MCP230XX
bool "MCP230XX I2C-based GPIO chip"
default $(dt_compat_enabled,$(DT_COMPAT_MICROCHIP_MCP230xx))
depends on I2C
select GPIO_MCP23XXX
help
Enable driver for MCP230XX I2C-based GPIO chip.

if GPIO_MCP230XX

config GPIO_MCP230XX_INIT_PRIORITY
int "MCP230XX GPIO expander init priority"
default 75
help
Device driver initialization priority.

endif #GPIO_MCP230XX

menuconfig GPIO_MCP23SXX
bool "MCP23SXX SPI-based GPIO chip"
default $(dt_compat_enabled,$(DT_COMPAT_MICROCHIP_MCP23Sxx))
depends on SPI
select GPIO_MCP23XXX
help
Enable driver for MCP23SXX SPI-based GPIO chip.

if GPIO_MCP23SXX

config GPIO_MCP23SXX_INIT_PRIORITY
int "MCP23SXX GPIO expander init priority"
default 75
help
Device driver initialization priority.

endif #GPIO_MCP23SXX
Loading

0 comments on commit a5ad94f

Please sign in to comment.