Skip to contentSkip to conversation

Add support for Amlogic HCI UART

PATCH Applied Yang Li 3 participants 6 messages Aug 9, 2024

Subsystems (5)
lore
Share & tools
lore

Yang Li

author maintainer
#0 lore raw

v4 cover Add support for Amlogic HCI UART

Add support for Amlogic HCI UART, including dt-binding, and Amlogic Bluetooth driver.

---
Changes in v4:
- Modified the compatible list in the DT binding.
- Reduced the boot delay from 350ms to 60ms.
- Minor fixes.
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Updated the properties within the device tree binding file.
- Remove the "antenna-number" property.
- Performed code optimization for improved efficiency and readability.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Introduce a regulator for powering up the Bluetooth chip instead of power sequencing.
- Use the GPIO Consumer API to manipulate the GPIO pins instead of the legacy API.
- Minor fixes.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Yang Li (3):
dt-bindings: net: bluetooth: Add support for Amlogic Bluetooth
Bluetooth: hci_uart: Add support for Amlogic HCI UART
MAINTAINERS: Add an entry for Amlogic HCI UART (M: Yang Li)

 .../bindings/net/bluetooth/amlogic,w155s2-bt.yaml  |  63 ++
 MAINTAINERS                                        |   7 +
 drivers/bluetooth/Kconfig                          |  12 +
 drivers/bluetooth/Makefile                         |   1 +
 drivers/bluetooth/hci_aml.c                        | 755 +++++++++++++++++++++
 drivers/bluetooth/hci_ldisc.c                      |   8 +-
 drivers/bluetooth/hci_uart.h                       |   8 +-
 7 files changed, 851 insertions(+), 3 deletions(-)

---
base-commit: bd0b4dae74b0f0ee9ea37818e1c132b56a26d6dd
change-id: 20240418-btaml-f9d7b19724ab

Best regards,

Signature · 1 line
Yang Li <[email protected]>
author maintainer
#1 lore raw

PATCH v4 1/3 dt-bindings: net: bluetooth: Add support for Amlogic Bluetooth

Add binding document for Amlogic Bluetooth chipsets attached over UART.

---
 .../bindings/net/bluetooth/amlogic,w155s2-bt.yaml  | 63 ++++++++++++++++++++++
 1 file changed, 63 insertions(+)
Documentation/devicetree/bindings/net/bluetooth/amlogic,w155s2-bt.yaml new file +63 -0
new file mode 100644
index 000000000000..6fd7557039d2
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2024 Amlogic, Inc. All rights reserved
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/bluetooth/amlogic,w155s2-bt.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic Bluetooth chips
+
+description:
+  The W155S2 is an Amlogic Bluetooth and Wi-Fi combo chip. It works on
+  the standard H4 protocol via a 4-wire UART interface, with baud rates
+  up to 4 Mbps.
+
+maintainers:
+  - Yang Li <[email protected]>
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - amlogic,w265s1-bt
+              - amlogic,w265p1-bt
+          - const: amlogic,w155s2-bt
+      - enum:
+          - amlogic,w155s2-bt
+          - amlogic,w265s2-bt
+
+  clocks:
+    maxItems: 1
+    description: clock provided to the controller (32.768KHz)
+
+  enable-gpios:
+    maxItems: 1
+
+  vddio-supply:
+    description: VDD_IO supply regulator handle
+
+  firmware-name:
+    maxItems: 1
+    description: specify the path of firmware bin to load
+
+required:
+  - compatible
+  - clocks
+  - enable-gpios
+  - vddio-supply
+  - firmware-name
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    bluetooth {
+        compatible = "amlogic,w155s2-bt";
+        clocks = <&extclk>;
+        enable-gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
+        vddio-supply = <&wcn_3v3>;
+        firmware-name = "amlogic/aml_w155s2_bt_uart.bin";
+    };
+
Signature · 1 line
2.42.0
#2 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=878052

---Test result---

Test Summary:

CheckPatch                    FAIL      6.16 seconds
GitLint                       PASS      0.95 seconds
SubjectPrefix                 FAIL      0.72 seconds
BuildKernel                   PASS      29.97 seconds
CheckAllWarning               PASS      32.70 seconds
CheckSparse                   PASS      37.91 seconds
CheckSmatch                   PASS      103.23 seconds
BuildKernel32                 PASS      29.10 seconds
TestRunnerSetup               PASS      527.95 seconds
TestRunner_l2cap-tester       PASS      20.03 seconds
TestRunner_iso-tester         FAIL      37.09 seconds
TestRunner_bnep-tester        PASS      4.92 seconds
TestRunner_mgmt-tester        PASS      109.18 seconds
TestRunner_rfcomm-tester      PASS      7.48 seconds
TestRunner_sco-tester         PASS      15.05 seconds
TestRunner_ioctl-tester       PASS      7.98 seconds
TestRunner_mesh-tester        PASS      6.00 seconds
TestRunner_smp-tester         PASS      8.97 seconds
TestRunner_userchan-tester    PASS      5.08 seconds
IncrementalBuild              PASS      40.12 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[v4,1/3] dt-bindings: net: bluetooth: Add support for Amlogic Bluetooth
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #95:
new file mode 100644

total: 0 errors, 1 warnings, 63 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13758411.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

[v4,2/3] Bluetooth: hci_uart: Add support for Amlogic HCI UART
WARNING: please write a help paragraph that fully describes the config symbol #123: FILE: drivers/bluetooth/Kconfig:277:
+config BT_HCIUART_AML
+ bool "Amlogic protocol support"
+ depends on BT_HCIUART
+ depends on BT_HCIUART_SERDEV
+ select BT_HCIUART_H4
+ select FW_LOADER
+ help
+ The Amlogic protocol support enables Bluetooth HCI over serial
+ port interface for Amlogic Bluetooth controllers.
+
+ Say Y here to compile support for HCI AML protocol.
+

WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #149:
new file mode 100644

total: 0 errors, 2 warnings, 821 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13758410.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

##############################
Test: SubjectPrefix - FAIL
Desc: Check subject contains "Bluetooth" prefix Output:
"Bluetooth: " prefix is not specified in the subject "Bluetooth: " prefix is not specified in the subject
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 122, Passed: 117 (95.9%), Failed: 1, Not Run: 4

Failed Test Cases
ISO Connect Suspend - Success Failed 8.212 seconds

---
Regards,
Linux Bluetooth

author maintainer
#3 lore raw

PATCH v4 2/3 Bluetooth: hci_uart: Add support for Amlogic HCI UART

In reply to Yang Li

Add a new HCI protocol HCI_UART_AML for the Amlogic Bluetooth controller. It works on the standard H4 protocol via a 4-wire UART interface, with baud rates up to 4 Mbps.

The controller supports two types of commands: the TCI commands and the vendor command. The former is for initial setup including setting baud rates, downloading fw, starting chip and etc, while the latter is for dumping firmware versions and setting public address after firmware updates and normal startup.

It was verified on board of T602 (S905X4 + W265S2).

dmesg:
..

[    5.313450] Bluetooth: HCI UART protocol AML registered
[    6.506052] Bluetooth: hci0: fw_version: date = 42.28, number = 0xb2fd

...

---
 drivers/bluetooth/Kconfig     |  12 +
 drivers/bluetooth/Makefile    |   1 +
 drivers/bluetooth/hci_aml.c   | 755 ++++++++++++++++++++++++++++++++++++++++++
 drivers/bluetooth/hci_ldisc.c |   8 +-
 drivers/bluetooth/hci_uart.h  |   8 +-
 5 files changed, 781 insertions(+), 3 deletions(-)
drivers/bluetooth/Kconfig +12 -0
index 769fa288179d..18767b54df35 100644
@@ -274,6 +274,18 @@ config BT_HCIUART_MRVL
 
 	  Say Y here to compile support for HCI MRVL protocol.
 
+config BT_HCIUART_AML
+	bool "Amlogic protocol support"
+	depends on BT_HCIUART
+	depends on BT_HCIUART_SERDEV
+	select BT_HCIUART_H4
+	select FW_LOADER
+	help
+	  The Amlogic protocol support enables Bluetooth HCI over serial
+	  port interface for Amlogic Bluetooth controllers.
+
+	  Say Y here to compile support for HCI AML protocol.
+
 config BT_HCIBCM203X
 	tristate "HCI BCM203x USB driver"
 	depends on USB
drivers/bluetooth/Makefile +1 -0
index 0730d6684d1a..81856512ddd0 100644
@@ -51,4 +51,5 @@ hci_uart-$(CONFIG_BT_HCIUART_BCM)	+= hci_bcm.o
 hci_uart-$(CONFIG_BT_HCIUART_QCA)	+= hci_qca.o
 hci_uart-$(CONFIG_BT_HCIUART_AG6XX)	+= hci_ag6xx.o
 hci_uart-$(CONFIG_BT_HCIUART_MRVL)	+= hci_mrvl.o
+hci_uart-$(CONFIG_BT_HCIUART_AML)	+= hci_aml.o
 hci_uart-objs				:= $(hci_uart-y)
drivers/bluetooth/hci_aml.c new file +755 -0

755 lines not on this page · raw message

drivers/bluetooth/hci_ldisc.c +6 -2
index 30192bb08354..d307c41a5470 100644
@@ -870,7 +870,9 @@ static int __init hci_uart_init(void)
 #ifdef CONFIG_BT_HCIUART_MRVL
 	mrvl_init();
 #endif
-
+#ifdef CONFIG_BT_HCIUART_AML
+	aml_init();
+#endif
 	return 0;
 }
 
@@ -906,7 +908,9 @@ static void __exit hci_uart_exit(void)
 #ifdef CONFIG_BT_HCIUART_MRVL
 	mrvl_deinit();
 #endif
-
+#ifdef CONFIG_BT_HCIUART_AML
+	aml_deinit();
+#endif
 	tty_unregister_ldisc(&hci_uart_ldisc);
 }
 
drivers/bluetooth/hci_uart.h +7 -1
index 00bf7ae82c5b..fbf3079b92a5 100644
@@ -20,7 +20,7 @@
 #define HCIUARTGETFLAGS		_IOR('U', 204, int)
 
 /* UART protocols */
-#define HCI_UART_MAX_PROTO	12
+#define HCI_UART_MAX_PROTO	13
 
 #define HCI_UART_H4	0
 #define HCI_UART_BCSP	1
@@ -34,6 +34,7 @@
 #define HCI_UART_AG6XX	9
 #define HCI_UART_NOKIA	10
 #define HCI_UART_MRVL	11
+#define HCI_UART_AML	12
 
 #define HCI_UART_RAW_DEVICE	0
 #define HCI_UART_RESET_ON_INIT	1
@@ -209,3 +210,8 @@ int ag6xx_deinit(void);
 int mrvl_init(void);
 int mrvl_deinit(void);
 #endif
+
+#ifdef CONFIG_BT_HCIUART_AML
+int aml_init(void);
+int aml_deinit(void);
+#endif
Signature · 1 line
2.42.0
author maintainer
#4 lore raw

PATCH v4 3/3 MAINTAINERS: Add an entry for Amlogic HCI UART (M: Yang Li)

In reply to Yang Li

Add Amlogic Bluetooth entry to MAINTAINERS to clarify the maintainers

---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index 0b73a6e2d78c..b106217933b2 100644
@@ -1149,6 +1149,13 @@ S:	Supported
 F:	arch/arm64/boot/dts/amd/amd-seattle-xgbe*.dtsi
 F:	drivers/net/ethernet/amd/xgbe/
 
+AMLOGIC BLUETOOTH DRIVER
+M:	Yang Li <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/net/bluetooth/amlogic,w155s2-bt.yaml
+F:	drivers/bluetooth/hci_aml.c
+
 AMLOGIC DDR PMU DRIVER
 M:	Jiucheng Xu <[email protected]>
 L:	[email protected]
Signature · 1 line
2.42.0
#5 lore raw
In reply to Yang Li
This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 4 lines · On Fri, 09 Aug 2024 13:42:23 +0800 you wrote:

Add support for Amlogic HCI UART, including dt-binding, and Amlogic Bluetooth driver.

Quoted 8 lines

---
Changes in v4:
- Modified the compatible list in the DT binding.
- Reduced the boot delay from 350ms to 60ms.
- Minor fixes.
- Link to v3: https://lore.kernel.org/r/[email protected]

[...]

Here is the summary with links:
- [v4,1/3] dt-bindings: net: bluetooth: Add support for Amlogic Bluetooth

    https://git.kernel.org/bluetooth/bluetooth-next/c/8802f81065c3
  - [v4,2/3] Bluetooth: hci_uart: Add support for Amlogic HCI UART
    https://git.kernel.org/bluetooth/bluetooth-next/c/58803465ec1a
  - [v4,3/3] MAINTAINERS: Add an entry for Amlogic HCI UART (M: Yang Li)
    https://git.kernel.org/bluetooth/bluetooth-next/c/f173b220f9dc

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html