Skip to contentSkip to conversation

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

PATCH Applied Nick Xie 3 participants 7 messages Feb 28 – Mar 26

Subsystems (2)
lore
Share & tools
lore

Nick Xie

author
#0 lore raw

v2 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.

Changes in v2:
- Dropped the SARADC and Function Key patches from this series. As
suggested by Martin Blumenstingl, a dedicated compatible string and
driver update for the S4 SARADC will be submitted in a separate series
to ensure forward compatibility.
- Patch 1: Split the UART_A pinctrl definitions in meson-s4.dtsi into separate rx/tx and rts/cts groups to keep the SoC dtsi generic
(Martin Blumenstingl).
- Patch 2: Assigned the UART_A pinctrl groups directly in the board dts.
- Added Martin's 'Reviewed-by' tags to Patches 2, 3, and 4.
- Link to v1: https://lore.kernel.org/linux-amlogic/[email protected]/

Nick Xie (4):
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

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

PATCH v2 1/4 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.

The pinctrl groups are split into basic tx/rx and flow control (cts/rts) to allow board-level flexibility.

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

---
 arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 26 +++++++++++++++++++++++
 1 file changed, 26 insertions(+)
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +26 -0
index dfc0a30a6e61b..4a3e9ad82d280 100644
@@ -163,6 +163,22 @@ mux {
 					};
 				};
 
+				uart_a_pins: uart-a-pins {
+					mux {
+						groups = "uart_a_tx",
+						       "uart_a_rx";
+						function = "uart_a";
+					};
+				};
+
+				uart_a_cts_rts_pins: uart-a-cts-rts-pins {
+					mux {
+						groups = "uart_a_cts",
+						       "uart_a_rts";
+						function = "uart_a";
+					};
+				};
+
 				i2c0_pins1: i2c0-pins1 {
 					mux {
 						groups = "i2c0_sda",
@@ -814,6 +830,16 @@ 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";
+			status = "disabled";
+		};
+
 		sdio: mmc@fe088000 {
 			compatible = "amlogic,meson-axg-mmc";
 			reg = <0x0 0xfe088000 0x0 0x800>;
Signature · 1 line
2.34.1
reviewer Reviewed-by on v2 1/4
#2 lore raw

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

Quoted 11 lines · Nick Xie

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

The pinctrl groups are split into basic tx/rx and flow control (cts/rts) to allow board-level flexibility.

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

author
#3 lore raw

PATCH v2 2/4 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  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm64/boot/dts/amlogic/meson-s4-s905y4-khadas-vim1s.dts +15 -0
index 27d0f6134ea9d..d36533f5559a8 100644
@@ -254,6 +254,21 @@ &spicc0 {
 	cs-gpios = <&gpio GPIOX_10 GPIO_ACTIVE_LOW>;
 };
 
+&uart_a {
+	status = "okay";
+	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
+	pinctrl-names = "default";
+	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
author
#4 lore raw

PATCH v2 3/4 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 d36533f5559a8..0bd738c1e7862 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
author
#5 lore raw

PATCH v2 4/4 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 0bd738c1e7862..664d64a267f2d 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
maintainer Applied
#6 lore raw
In reply to Nick Xie

Hi,

Quoted 18 lines · Nick Xie

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.

Changes in v2:
- Dropped the SARADC and Function Key patches from this series. As
suggested by Martin Blumenstingl, a dedicated compatible string and
driver update for the S4 SARADC will be submitted in a separate series
to ensure forward compatibility.
- Patch 1: Split the UART_A pinctrl definitions in meson-s4.dtsi into separate rx/tx and rts/cts groups to keep the SoC dtsi generic
(Martin Blumenstingl).
- Patch 2: Assigned the UART_A pinctrl groups directly in the board dts.
- Added Martin's 'Reviewed-by' tags to Patches 2, 3, and 4.
- Link to v1: https://lore.kernel.org/linux-amlogic/[email protected]/

Quoted 1 line

[...]

Thanks, Applied to https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git (v7.1/arm64-dt)

[1/4] arm64: dts: amlogic: meson-s4: add UART_A node

      https://git.kernel.org/amlogic/c/6710d76d7e51a24f978eb1ae0738d1e3c25e034c
[2/4] arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: enable bluetooth
      https://git.kernel.org/amlogic/c/ad44c753b976e469f0f014b6f92e7180b6a7ba59
[3/4] arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add PWM LED support
      https://git.kernel.org/amlogic/c/b8a95d4c054d9d2e784ce5eeb6a08be0ce9031d0
[4/4] arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add POWER key support
      https://git.kernel.org/amlogic/c/31132e11e9dd97c706434e4f9e86b503c67a6bac

These changes has been applied on the intermediate git tree [1].

The v7.1/arm64-dt branch will then be sent via a formal Pull Request to the Linux SoC maintainers for inclusion in their intermediate git branches in order to be sent to Linus during the next merge window, or sooner if it's a set of fixes.

In the cases of fixes, those will be merged in the current release candidate kernel and as soon they appear on the Linux master branch they will be backported to the previous Stable and Long-Stable kernels [2].

The intermediate git branches are merged daily in the linux-next tree [3], people are encouraged testing these pre-release kernels and report issues on the relevant mailing-lists.

If problems are discovered on those changes, please submit a signed-off-by revert patch followed by a corrective changeset.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
[3] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

Signature · 1 line
Neil