Skip to contentSkip to conversation

arm64: dts: amlogic: meson-s4-khadas-vim1s: enable LEDs, Keys and Bluetooth

PATCH Superseded Nick Xie 2 participants 13 messages Jan 23 – Feb 26

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Nick Xie

author
#0 lore raw

cover arm64: dts: amlogic: meson-s4-khadas-vim1s: enable LEDs, Keys and Bluetooth

This series enables various user interfaces and the Bluetooth module for the Khadas VIM1S board (Amlogic S905Y4).

This builds upon the existing board support to fully enable the user-facing peripherals.

Summary of changes:
- Enable UART_A and Bluetooth (AP6256)
- Enable PWM_G and the Heartbeat LED
- Enable GPIO-polled Power key
- Enable SARADC and the ADC Function key

Nick Xie (6):
arm64: dts: amlogic: meson-s4: add UART_A node
arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: enable bluetooth
arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add PWM LED support
arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add POWER key
support
arm64: dts: amlogic: meson-s4: add internal SARADC controller
arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add Function key
support

 .../amlogic/meson-s4-s905y4-khadas-vim1s.dts  | 63 +++++++++++++++++++
 arch/arm64/boot/dts/amlogic/meson-s4.dtsi     | 36 +++++++++++
 2 files changed, 99 insertions(+)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/6 arm64: dts: amlogic: meson-s4: add UART_A node

Add the UART_A node and its related pinctrl definitions to the Meson S4 SoC dtsi.

This interface is typically used for Bluetooth communication on boards like the Khadas VIM1S.

---
 arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +22 -0
index dfc0a30a6e61b..b1d66054a6e87 100644
@@ -163,6 +163,16 @@ mux {
 					};
 				};
 
+				a_uart_pins: a_uart {
+					mux {
+						groups = "uart_a_tx",
+						       "uart_a_rx",
+						       "uart_a_cts",
+						       "uart_a_rts";
+						function = "uart_a";
+					};
+				};
+
 				i2c0_pins1: i2c0-pins1 {
 					mux {
 						groups = "i2c0_sda",
@@ -814,6 +824,18 @@ mdio0: mdio {
 			};
 		};
 
+		uart_a: serial@fe078000 {
+			compatible = "amlogic,meson-s4-uart",
+				     "amlogic,meson-ao-uart";
+			reg = <0x0 0xfe078000 0x0 0x18>;
+			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+			clocks = <&xtal>, <&clkc_periphs CLKID_UART_A>, <&xtal>;
+			clock-names = "xtal", "pclk", "baud";
+			pinctrl-names = "default";
+			pinctrl-0 = <&a_uart_pins>;
+			status = "disabled";
+		};
+
 		sdio: mmc@fe088000 {
 			compatible = "amlogic,meson-axg-mmc";
 			reg = <0x0 0xfe088000 0x0 0x800>;
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH 1/6] arm64: dts: amlogic: meson-s4: add UART_A node

Hi Nick,

On Fri, Jan 23, 2026 at 3:23 AM Nick Xie <[email protected]> wrote:
[...]

arch/arm64/boot/dts/amlogic/meson-s4.dtsi mux { · line 174

Quoted 9 lines
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +9 -0
+                               a_uart_pins: a_uart {
+                                       mux {
+                                               groups = "uart_a_tx",
+                                                      "uart_a_rx",
+                                                      "uart_a_cts",
+                                                      "uart_a_rts";
+                                               function = "uart_a";
+                                       };
+                               };

Can we please keep the split between rx/tx and rts/cts pins (as we have it on other SoCs)?
It is likely that many boards follow the same path as Khadas VIM1S (and Amlogic's reference design). For those boards that aren't it would be great if they don't have to update meson-s4.dtsi.

Quoted 6 lines
                                i2c0_pins1: i2c0-pins1 {
                                        mux {
                                                groups = "i2c0_sda",
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +0 -0
@@ -814,6 +824,18 @@ mdio0: mdio {
                        };
                };

arch/arm64/boot/dts/amlogic/meson-s4.dtsi mdio0: mdio { · line 835

Quoted 10 lines
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +9 -0
 
+               uart_a: serial@fe078000 {
+                       compatible = "amlogic,meson-s4-uart",
+                                    "amlogic,meson-ao-uart";
+                       reg = <0x0 0xfe078000 0x0 0x18>;
+                       interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+                       clocks = <&xtal>, <&clkc_periphs CLKID_UART_A>, <&xtal>;
+                       clock-names = "xtal", "pclk", "baud";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&a_uart_pins>;

For consistency I also prefer if you could move this to meson-s4-s905y4-khadas-vim1s.dts (patch 2)

Thank you!
Martin

author
#3 lore raw

PATCH 2/6 arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: enable bluetooth

In reply to Nick Xie

The Khadas VIM1S board uses the Ampak AP6256 Wi-Fi/Bluetooth module. The Bluetooth controller is connected via UART_A and requires the external 32k clock (LPO).

Enable the UART_A node and add the bluetooth child node to support it.

---
 .../dts/amlogic/meson-s4-s905y4-khadas-vim1s.dts    | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm64/boot/dts/amlogic/meson-s4-s905y4-khadas-vim1s.dts +13 -0
index 27d0f6134ea9d..041291999bc8c 100644
@@ -254,6 +254,19 @@ &spicc0 {
 	cs-gpios = <&gpio GPIOX_10 GPIO_ACTIVE_LOW>;
 };
 
+&uart_a {
+	status = "okay";
+	uart-has-rtscts;
+
+	bluetooth {
+		compatible = "brcm,bcm4345c5";
+		shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
+		max-speed = <2000000>;
+		clocks = <&sdio_32k>;
+		clock-names = "lpo";
+	};
+};
+
 &uart_b {
 	status = "okay";
 };
Signature · 1 line
2.34.1
reviewer Reviewed-by on v1 2/6
#4 lore raw

Re: [PATCH 2/6] arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: enable bluetooth

Quoted 8 lines · Nick Xie

The Khadas VIM1S board uses the Ampak AP6256 Wi-Fi/Bluetooth module. The Bluetooth controller is connected via UART_A and requires the external 32k clock (LPO).

Enable the UART_A node and add the bluetooth child node to support it.

You can keep my Reviewed-by when updating this patch to include the pinctrl properties.

author
#5 lore raw

PATCH 3/6 arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add PWM LED support

In reply to Nick Xie

The Khadas VIM1S board features a white LED connected to the PWM_G controller (PWM channel 0).

Enable the PWM_G controller and add the pwm-leds node to support using this LED as a heartbeat indicator.

---
 .../amlogic/meson-s4-s905y4-khadas-vim1s.dts  | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
arch/arm64/boot/dts/amlogic/meson-s4-s905y4-khadas-vim1s.dts +19 -0
index 041291999bc8c..4bae6d46defb5 100644
@@ -6,6 +6,7 @@
 /dts-v1/;
 
 #include "meson-s4.dtsi"
+#include <dt-bindings/leds/common.h>
 
 / {
 	model = "Khadas VIM1S";
@@ -43,6 +44,18 @@ emmc_pwrseq: emmc-pwrseq {
 		reset-gpios = <&gpio GPIOB_9 GPIO_ACTIVE_LOW>;
 	};
 
+	pwm-leds {
+		compatible = "pwm-leds";
+
+		led-1 {
+			color = <LED_COLOR_ID_WHITE>;
+			function = LED_FUNCTION_STATUS;
+			linux,default-trigger = "heartbeat";
+			max-brightness = <255>;
+			pwms = <&pwm_gh 0 30040 0>;
+		};
+	};
+
 	sdio_32k: sdio-32k {
 		compatible = "pwm-clock";
 		#clock-cells = <0>;
@@ -196,6 +209,12 @@ &pwm_ef {
 	pinctrl-names = "default";
 };
 
+&pwm_gh {
+	status = "okay";
+	pinctrl-0 = <&pwm_g_pins1>;
+	pinctrl-names = "default";
+};
+
 &pwm_ij {
 	status = "okay";
 };
Signature · 1 line
2.34.1
reviewer Reviewed-by on v1 3/6
#6 lore raw

Re: [PATCH 3/6] arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add PWM LED support

Quoted 8 lines · Nick Xie

The Khadas VIM1S board features a white LED connected to the PWM_G controller (PWM channel 0).

Enable the PWM_G controller and add the pwm-leds node to support using this LED as a heartbeat indicator.

author
#7 lore raw

PATCH 4/6 arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add POWER key support

In reply to Nick Xie

Add the gpio-keys-polled node to support the Power button found on the Khadas VIM1S board. The button is connected to the GPIOD_8 pin.

Use polled mode instead of gpio-keys because the GPIO interrupt controller support for Meson S4 SoC is not yet available upstream.

---
 .../dts/amlogic/meson-s4-s905y4-khadas-vim1s.dts     | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/amlogic/meson-s4-s905y4-khadas-vim1s.dts +12 -0
index 4bae6d46defb5..cf65c079e675a 100644
@@ -6,6 +6,7 @@
 /dts-v1/;
 
 #include "meson-s4.dtsi"
+#include <dt-bindings/input/input.h>
 #include <dt-bindings/leds/common.h>
 
 / {
@@ -44,6 +45,17 @@ emmc_pwrseq: emmc-pwrseq {
 		reset-gpios = <&gpio GPIOB_9 GPIO_ACTIVE_LOW>;
 	};
 
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		poll-interval = <100>;
+
+		power-button {
+			label = "power";
+			linux,code = <KEY_POWER>;
+			gpios = <&gpio GPIOD_8 GPIO_ACTIVE_LOW>;
+		};
+	};
+
 	pwm-leds {
 		compatible = "pwm-leds";
 
Signature · 1 line
2.34.1
reviewer Reviewed-by on v1 4/6
#8 lore raw

Re: [PATCH 4/6] arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add POWER key support

Quoted 8 lines · Nick Xie

Add the gpio-keys-polled node to support the Power button found on the Khadas VIM1S board. The button is connected to the GPIOD_8 pin.

Use polled mode instead of gpio-keys because the GPIO interrupt controller support for Meson S4 SoC is not yet available upstream.

author
#9 lore raw

PATCH 5/6 arm64: dts: amlogic: meson-s4: add internal SARADC controller

In reply to Nick Xie

Add the SARADC (Successive Approximation Register ADC) controller node to the Meson S4 SoC dtsi.

---
 arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +14 -0
index b1d66054a6e87..cd768f9f4db80 100644
@@ -77,6 +77,20 @@ pwrc: power-controller {
 		};
 	};
 
+	saradc: adc@fe026000 {
+		compatible = "amlogic,meson-g12a-saradc",
+			     "amlogic,meson-saradc";
+		reg = <0x0 0xfe026000 0x0 0x48>;
+		#io-channel-cells = <1>;
+		interrupts = <GIC_SPI 181 IRQ_TYPE_EDGE_RISING>;
+		clocks = <&xtal>,
+			 <&clkc_periphs CLKID_SAR_ADC>,
+			 <&clkc_periphs CLKID_SARADC>,
+			 <&clkc_periphs CLKID_SARADC_SEL>;
+		clock-names = "clkin", "core", "adc_clk", "adc_sel";
+		status = "disabled";
+	};
+
 	soc {
 		compatible = "simple-bus";
 		#address-cells = <2>;
Signature · 7 lines
2.34.1


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
#10 lore raw

Re: [PATCH 5/6] arm64: dts: amlogic: meson-s4: add internal SARADC controller

Hi Nick,

On Fri, Jan 23, 2026 at 3:23 AM Nick Xie <[email protected]> wrote:
[...]

arch/arm64/boot/dts/amlogic/meson-s4.dtsi pwrc: power-controller { · line 82

Quoted 3 lines
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +3 -0
+       saradc: adc@fe026000 {
+               compatible = "amlogic,meson-g12a-saradc",
+                            "amlogic,meson-saradc";

It seems that the engineers at Amlogic are constantly updating the SARADC core. To avoid any problems in the future, can you please add a new compatible string for the s4-saradc?
For reference you can take a look at:
- commit e415a1659ec9 ("iio: adc: meson-saradc: add support for Meson G12A") which added the g12a compatible string to the driver (note that meson_sar_adc_gxl_param since then has been replaced by meson_sar_adc_g12a_param - you can re-use the latter)
- commit b2729cdf2bc0 ("dt-bindings: iio: adc: amlogic,meson-saradc:
Add GXLX SoC compatible") which documented a new compatible string in the dt-bindings

I think it is best to do this in a separate series.

In case we discover anything that needs changing in the SARADC driver in future:
Having a dedicated compatible string means we can just update the driver and be done with it.
One example where this has happened for G12A is commit 48dc1abde015 ("iio: adc: meson-saradc: Disable BL30 integration on G12A and newer SoCs").

Thank you!
Martin

author
#11 lore raw

PATCH 6/6 arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add Function key support

In reply to Nick Xie

Enable the SARADC controller and add the adc-keys node to support the Function key found on the Khadas VIM1S board.

---
 .../amlogic/meson-s4-s905y4-khadas-vim1s.dts  | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
arch/arm64/boot/dts/amlogic/meson-s4-s905y4-khadas-vim1s.dts +19 -0
index cf65c079e675a..2fa2ed941cb98 100644
@@ -40,6 +40,20 @@ secmon_reserved: secmon@5000000 {
 		};
 	};
 
+	adc-keys {
+		compatible = "adc-keys";
+		io-channels = <&saradc 0>;
+		io-channel-names = "buttons";
+		keyup-threshold-microvolt = <1710000>;
+		poll-interval = <100>;
+
+		button-function {
+			label = "Function";
+			linux,code = <KEY_FN>;
+			press-threshold-microvolt = <10000>;
+		};
+	};
+
 	emmc_pwrseq: emmc-pwrseq {
 		compatible = "mmc-pwrseq-emmc";
 		reset-gpios = <&gpio GPIOB_9 GPIO_ACTIVE_LOW>;
@@ -278,6 +292,11 @@ brcmf: wifi@1 {
 	};
 };
 
+&saradc {
+	status = "okay";
+	vref-supply = <&vddio_ao1v8>;
+};
+
 &spicc0 {
 	status = "okay";
 	pinctrl-names = "default";
Signature · 7 lines
2.34.1


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
reviewer Reviewed-by on v1 6/6
#12 lore raw

Re: [PATCH 6/6] arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add Function key support

Quoted 5 lines · Nick Xie

Enable the SARADC controller and add the adc-keys node to support the Function key found on the Khadas VIM1S board.

Applying this patch will require the previous one to be updated with the compatible string.
Even when the compatible string changes (in meson-s4.dtsi) this patch will still be good, so please add my: