From e13cbab6840b2a453e731c90b58f5b312490ae30 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Sat, 9 May 2026 10:42:39 +1000 Subject: [PATCH] rockchip: enable SARADC; add buttons hotplug and ADC kmods to default packages 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 Link: https://github.com/openwrt/openwrt/pull/23008 Signed-off-by: Hauke Mehrtens --- package/kernel/linux/modules/input.mk | 16 ++++++++++++++++ target/linux/rockchip/armv8/config-6.12 | 2 +- target/linux/rockchip/armv8/config-6.18 | 2 +- target/linux/rockchip/image/armv8.mk | 23 +++++++++++++---------- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/package/kernel/linux/modules/input.mk b/package/kernel/linux/modules/input.mk index b780c1c4b2e..73554ba52b3 100644 --- a/package/kernel/linux/modules/input.mk +++ b/package/kernel/linux/modules/input.mk @@ -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) diff --git a/target/linux/rockchip/armv8/config-6.12 b/target/linux/rockchip/armv8/config-6.12 index a5f2ac709fc..f68e03647f9 100644 --- a/target/linux/rockchip/armv8/config-6.12 +++ b/target/linux/rockchip/armv8/config-6.12 @@ -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 diff --git a/target/linux/rockchip/armv8/config-6.18 b/target/linux/rockchip/armv8/config-6.18 index 0ce36169cb4..9c1f1d4a30d 100644 --- a/target/linux/rockchip/armv8/config-6.18 +++ b/target/linux/rockchip/armv8/config-6.18 @@ -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 diff --git a/target/linux/rockchip/image/armv8.mk b/target/linux/rockchip/image/armv8.mk index 7114a03d4e9..b105f6de0cb 100644 --- a/target/linux/rockchip/image/armv8.mk +++ b/target/linux/rockchip/image/armv8.mk @@ -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 -- 2.47.3