]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
rockchip: enable SARADC; add buttons hotplug and ADC kmods to default packages
authorRyan Leung <untilscour@protonmail.com>
Sat, 9 May 2026 00:42:39 +0000 (10:42 +1000)
committerHauke Mehrtens <hauke@hauke-m.de>
Thu, 14 May 2026 15:52:56 +0000 (17:52 +0200)
Select `CONFIG_ROCKCHIP_SARADC=y` to enable Rockchip SAR ADC

Add ADC Ladder Buttons driver as a kernel module as well as `kmod-button-hotplug` to the list of
default packages for Rockchip targets that have buttons connected to ADC, not including some
devices (e.g. NanoPi R76S) that have ADC buttons which are not in the device tree.

This is needed to use buttons on Rockchip devices that are connected to ADC and not GPIO

Tested on FriendlyELEC NanoPi M5

Signed-off-by: Ryan Leung <untilscour@protonmail.com>
Link: https://github.com/openwrt/openwrt/pull/23008
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
package/kernel/linux/modules/input.mk
target/linux/rockchip/armv8/config-6.12
target/linux/rockchip/armv8/config-6.18
target/linux/rockchip/image/armv8.mk

index b780c1c4b2e52c84c66089755a3bd1d69a2581c7..73554ba52b3805844a2a4e09679e5d4a25e32be7 100644 (file)
@@ -53,6 +53,22 @@ endef
 
 $(eval $(call KernelPackage,hid-alps))
 
+define KernelPackage/input-adc-keys
+  SUBMENU:=$(INPUT_MODULES_MENU)
+  TITLE:=ADC Ladder Buttons support
+  DEPENDS:=+kmod-input-core +kmod-iio-core
+  KCONFIG:= \
+       CONFIG_KEYBOARD_ADC \
+       CONFIG_INPUT_KEYBOARD=y
+  FILES:=$(LINUX_DIR)/drivers/input/keyboard/adc-keys.ko
+  AUTOLOAD:=$(call AutoProbe,adc-keys,1)
+endef
+
+define KernelPackage/input-adc-keys/description
+ Buttons/keys input driver for resistor ladder connected on ADC
+endef
+
+$(eval $(call KernelPackage,input-adc-keys))
 
 define KernelPackage/input-core
   SUBMENU:=$(INPUT_MODULES_MENU)
index a5f2ac709fcbfb3f428bf4780231114161b3c397..f68e03647f90d77a6db447ea3ec7e1591a91af78 100644 (file)
@@ -580,7 +580,7 @@ CONFIG_ROCKCHIP_IOMMU=y
 CONFIG_ROCKCHIP_MBOX=y
 CONFIG_ROCKCHIP_PHY=y
 CONFIG_ROCKCHIP_PM_DOMAINS=y
-# CONFIG_ROCKCHIP_SARADC is not set
+CONFIG_ROCKCHIP_SARADC=y
 CONFIG_ROCKCHIP_THERMAL=y
 CONFIG_ROCKCHIP_TIMER=y
 CONFIG_RODATA_FULL_DEFAULT_ENABLED=y
index 0ce36169cb454f4fa02ea249fdfe18ecac056332..9c1f1d4a30d370ce4353b6236e6d93a575db8a1b 100644 (file)
@@ -592,7 +592,7 @@ CONFIG_ROCKCHIP_IOMMU=y
 CONFIG_ROCKCHIP_MBOX=y
 CONFIG_ROCKCHIP_PHY=y
 CONFIG_ROCKCHIP_PM_DOMAINS=y
-# CONFIG_ROCKCHIP_SARADC is not set
+CONFIG_ROCKCHIP_SARADC=y
 CONFIG_ROCKCHIP_THERMAL=y
 CONFIG_ROCKCHIP_TIMER=y
 CONFIG_RPS=y
index 7114a03d4e9f8b37f4ad3130c9ddfeb2399f7e04..b105f6de0cbf2ecee172221eef87d2fac8e271b9 100644 (file)
@@ -76,7 +76,7 @@ define Device/friendlyarm_nanopc-t4
   $(Device/rk3399)
   DEVICE_VENDOR := FriendlyARM
   DEVICE_MODEL := NanoPC T4
-  DEVICE_PACKAGES := kmod-brcmfmac brcmfmac-nvram-4356-sdio cypress-firmware-4356-sdio
+  DEVICE_PACKAGES := brcmfmac-nvram-4356-sdio cypress-firmware-4356-sdio kmod-brcmfmac kmod-button-hotplug kmod-input-adc-keys
 endef
 TARGET_DEVICES += friendlyarm_nanopc-t4
 
@@ -84,7 +84,7 @@ define Device/friendlyarm_nanopc-t6
   $(Device/rk3588)
   DEVICE_VENDOR := FriendlyARM
   DEVICE_MODEL := NanoPC T6
-  DEVICE_PACKAGES := kmod-r8169
+  DEVICE_PACKAGES := kmod-button-hotplug kmod-input-adc-keys kmod-r8169
 endef
 TARGET_DEVICES += friendlyarm_nanopc-t6
 
@@ -159,7 +159,7 @@ define Device/friendlyarm_nanopi-r6c
   $(Device/rk3588s)
   DEVICE_VENDOR := FriendlyARM
   DEVICE_MODEL := NanoPi R6C
-  DEVICE_PACKAGES := kmod-r8169
+  DEVICE_PACKAGES := kmod-button-hotplug kmod-input-adc-keys kmod-r8169
 endef
 TARGET_DEVICES += friendlyarm_nanopi-r6c
 
@@ -167,7 +167,7 @@ define Device/friendlyarm_nanopi-r6s
   $(Device/rk3588s)
   DEVICE_VENDOR := FriendlyARM
   DEVICE_MODEL := NanoPi R6S
-  DEVICE_PACKAGES := kmod-r8169
+  DEVICE_PACKAGES := kmod-button-hotplug kmod-input-adc-keys kmod-r8169
 endef
 TARGET_DEVICES += friendlyarm_nanopi-r6s
 
@@ -188,7 +188,7 @@ define Device/hinlink_h28k
   DEVICE_ALT0_MODEL := H28K
   DEVICE_DTS := rk3528-hinlink-h28k
   UBOOT_DEVICE_NAME := hinlink-h28k-rk3528
-  DEVICE_PACKAGES := kmod-r8169
+  DEVICE_PACKAGES := kmod-button-hotplug kmod-input-adc-keys kmod-r8169
 endef
 TARGET_DEVICES += hinlink_h28k
 
@@ -220,7 +220,7 @@ define Device/linkease_easepi-r1
   $(Device/rk3568)
   DEVICE_VENDOR := LinkEase
   DEVICE_MODEL := EasePi R1
-  DEVICE_PACKAGES := blkdiscard block-mount kmod-button-hotplug kmod-nvme kmod-r8169
+  DEVICE_PACKAGES := blkdiscard block-mount kmod-button-hotplug kmod-input-adc-keys kmod-nvme kmod-r8169
 endef
 TARGET_DEVICES += linkease_easepi-r1
 
@@ -262,7 +262,7 @@ define Device/radxa_e20c
   DEVICE_MODEL := E20C
   DEVICE_DTS := rk3528-radxa-e20c
   UBOOT_DEVICE_NAME := radxa-e20c-rk3528
-  DEVICE_PACKAGES := kmod-r8169
+  DEVICE_PACKAGES := kmod-button-hotplug kmod-input-adc-keys kmod-r8169
 endef
 TARGET_DEVICES += radxa_e20c
 
@@ -283,7 +283,7 @@ define Device/radxa_e52c
   DEVICE_MODEL := E52C
   UBOOT_DEVICE_NAME := generic-rk3588
   DEVICE_DTS := rk3582-radxa-e52c
-  DEVICE_PACKAGES := blkdiscard kmod-r8169
+  DEVICE_PACKAGES := blkdiscard kmod-button-hotplug kmod-input-adc-keys kmod-r8169
   DEVICE_COMPAT_VERSION := 1.1
   DEVICE_COMPAT_MESSAGE := Network interface names have been changed
 endef
@@ -294,6 +294,7 @@ define Device/radxa_rock-2a
   DEVICE_VENDOR := Radxa
   DEVICE_MODEL := ROCK 2A
   UBOOT_DEVICE_NAME := rock-2-rk3528
+  DEVICE_PACKAGES := kmod-button-hotplug kmod-input-adc-keys
 endef
 TARGET_DEVICES += radxa_rock-2a
 
@@ -302,6 +303,7 @@ define Device/radxa_rock-2f
   DEVICE_VENDOR := Radxa
   DEVICE_MODEL := ROCK 2F
   UBOOT_DEVICE_NAME := rock-2-rk3528
+  DEVICE_PACKAGES := kmod-button-hotplug kmod-input-adc-keys
 endef
 TARGET_DEVICES += radxa_rock-2f
 
@@ -355,7 +357,7 @@ define Device/radxa_rock-5-itx
   $(Device/rk3588)
   DEVICE_VENDOR := Radxa
   DEVICE_MODEL := ROCK 5 ITX/ITX+
-  DEVICE_PACKAGES := blkdiscard block-mount kmod-ata-ahci kmod-hwmon-pwmfan kmod-nvme kmod-r8169 kmod-rtw89-8852be wpad-basic-mbedtls
+  DEVICE_PACKAGES := blkdiscard block-mount kmod-ata-ahci kmod-button-hotplug kmod-hwmon-pwmfan kmod-input-adc-keys kmod-nvme kmod-r8169 kmod-rtw89-8852be wpad-basic-mbedtls
 endef
 TARGET_DEVICES += radxa_rock-5-itx
 
@@ -418,6 +420,7 @@ define Device/radxa_rock-pi-e
   $(Device/rk3328)
   DEVICE_VENDOR := Radxa
   DEVICE_MODEL := ROCK Pi E
+  DEVICE_PACKAGES := kmod-button-hotplug kmod-input-adc-keys
 endef
 TARGET_DEVICES += radxa_rock-pi-e
 
@@ -426,7 +429,7 @@ define Device/radxa_rock-pi-e-v3
   DEVICE_VENDOR := Radxa
   DEVICE_MODEL := ROCK Pi E v3.0
   DEVICE_DTS := rk3328-rock-pi-e
-  DEVICE_PACKAGES := kmod-rtw88-8723du kmod-rtw88-8821cu kmod-usb-net-cdc-ncm kmod-usb-net-rndis wpad-basic-mbedtls
+  DEVICE_PACKAGES := kmod-button-hotplug kmod-input-adc-keys kmod-rtw88-8723du kmod-rtw88-8821cu kmod-usb-net-cdc-ncm kmod-usb-net-rndis wpad-basic-mbedtls
 endef
 TARGET_DEVICES += radxa_rock-pi-e-v3