[OpenWrt-Devel] kmod-gpio-mcp23s08 not working/available for linux-4.14

Martin Schiller ms at dev.tdt.de
Fri Aug 24 03:56:48 EDT 2018


On 2018-08-23 14:10, Martin Schiller wrote:
> On 2018-08-23 12:17, John Crispin wrote:
>> On 23/08/18 11:53, Martin Schiller wrote:
>>> The mcp23s08 drivers was moved from gpio to pinctrl "subsystem" in 
>>> linux-4.13.
>>> 
>>> As linux-4.9 is still used for some targets, how to proceed with this 
>>> mcp23s08 driver?
>>> Create a new (second) CONFIG option (kmod-pinctrl-mcp23s08) 
>>> coexisting to the kmod-gpio-mcp23s08?
>>> 
>>> Or is it possible to get this handled by the existing CONFIG option 
>>> and depend on the kernel version?
>>> Any hints are welcome.
> 
> ...
> 
>> add an ifdef guarded sections that check the kernel version inside the
>> module mk files ?
>>     John
> 
> So I tried this, but "CompareKernelPatchVer" seems not working here:
> 
> diff --git a/package/kernel/linux/modules/other.mk
> b/package/kernel/linux/modules/other.mk
> index c4cf74d98b..3befc9cba8 100644
> --- a/package/kernel/linux/modules/other.mk
> +++ b/package/kernel/linux/modules/other.mk
> @@ -224,6 +224,23 @@ endef
>  $(eval $(call KernelPackage,gpio-dev))
> 
> 
> +ifeq ($(strip $(call 
> CompareKernelPatchVer,$(KERNEL_PATCHVER),ge,4.13.0)),1)
> +define KernelPackage/pinctrl-mcp23s08
> +  SUBMENU:=$(OTHER_MENU)
> +  TITLE:=Microchip MCP23xxx I/O expander
> +  DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core
> +  KCONFIG:=CONFIG_PINCTRL_MCP23S08
> +  FILES:=$(LINUX_DIR)/drivers/pinctrl/pinctrl-mcp23s08.ko
> +  AUTOLOAD:=$(call AutoLoad,40,pinctrl-mcp23s08)
> +endef
> +
> +define KernelPackage/pinctrl-mcp23s08/description
> + Kernel module for Microchip MCP23xxx SPI/I2C I/O expander
> +endef
> +
> +$(eval $(call KernelPackage,pinctrl-mcp23s08))
> +
> +else
>  define KernelPackage/gpio-mcp23s08
>    SUBMENU:=$(OTHER_MENU)
>    TITLE:=Microchip MCP23xxx I/O expander
> @@ -238,7 +255,7 @@ define KernelPackage/gpio-mcp23s08/description
>  endef
> 
>  $(eval $(call KernelPackage,gpio-mcp23s08))
> -
> +endif
> 
>  define KernelPackage/gpio-nxp-74hc164
>    SUBMENU:=$(OTHER_MENU)
> 

OK, so my next approach is this:

diff --git a/package/kernel/linux/modules/other.mk 
b/package/kernel/linux/modules/other.mk
index c4cf74d98b..bc97376c87 100644
--- a/package/kernel/linux/modules/other.mk
+++ b/package/kernel/linux/modules/other.mk
@@ -228,9 +228,13 @@ define KernelPackage/gpio-mcp23s08
    SUBMENU:=$(OTHER_MENU)
    TITLE:=Microchip MCP23xxx I/O expander
    DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core
-  KCONFIG:=CONFIG_GPIO_MCP23S08
-  FILES:=$(LINUX_DIR)/drivers/gpio/gpio-mcp23s08.ko
-  AUTOLOAD:=$(call AutoLoad,40,gpio-mcp23s08)
+  KCONFIG:= \
+       CONFIG_GPIO_MCP23S08 \
+       CONFIG_PINCTRL_MCP23S08
+  FILES:= \
+       $(LINUX_DIR)/drivers/gpio/gpio-mcp23s08.ko at lt4.13 \
+       $(LINUX_DIR)/drivers/pinctrl/pinctrl-mcp23s08.ko at ge4.13
+  AUTOLOAD:=$(call AutoLoad,40,gpio-mcp23s08 at lt4.13 
pinctrl-mcp23s08 at ge4.13)
  endef

  define KernelPackage/gpio-mcp23s08/description


I also tried to use the "@ge4.13 / @lt4.13" flags for KCONFIG, but 
doesn't work for me, although it is used elsewhere.

Advantage of this solution is, that the package name is not changed and 
anything works like before.
On the other hand, the mcp23s08 isn't a gpio driver anymore, it's a 
pinctrl driver now (>4.13).

- Martin



_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list