devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Add WCN3988 Bluetooth support for Fairphone 4
@ 2023-08-02  6:56 Luca Weiss
  2023-08-02  6:56 ` [PATCH v3 1/2] dt-bindings: net: qualcomm: Add WCN3988 Luca Weiss
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luca Weiss @ 2023-08-02  6:56 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Marcel Holtmann, Johan Hedberg,
	Luiz Augusto von Dentz, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, Conor Dooley, Balakrishna Godavarthi, Rocky Liao
  Cc: ~postmarketos/upstreaming, phone-devel, netdev, devicetree,
	linux-kernel, linux-bluetooth, linux-arm-msm, Luca Weiss,
	Krzysztof Kozlowski

Add support in the btqca/hci_qca driver for the WCN3988 and add it to
the sm7225 Fairphone 4 devicetree.

Devicetree patches go via Qualcomm tree, the rest via their respective
trees.

--
Previously with the RFC version I've had problems before with Bluetooth
scanning failing like the following:

  [bluetooth]# scan on
  Failed to start discovery: org.bluez.Error.InProgress

  [  202.371374] Bluetooth: hci0: Opcode 0x200b failed: -16

This appears to only happen with driver built-in (=y) when the supported
local commands list doesn't get updated in the Bluetooth core and
use_ext_scan() returning false. I'll try to submit this separately since
this now works well enough with =m. But in both cases (=y, =m) it's
behaving a bit weirdly before (re-)setting the MAC address with "sudo
btmgmt public-addr fo:oo:ba:ar"

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
Changes in v3:
- Drop applied patches and resend
- Link to v2: https://lore.kernel.org/r/20230421-fp4-bluetooth-v2-0-3de840d5483e@fairphone.com

Changes in v2:
- Add pinctrl & 'tlmm 64' irq to uart node
- Pick up tags
- Link to v1: https://lore.kernel.org/r/20230421-fp4-bluetooth-v1-0-0430e3a7e0a2@fairphone.com

---
Luca Weiss (2):
      dt-bindings: net: qualcomm: Add WCN3988
      Bluetooth: btqca: Add WCN3988 support

 .../bindings/net/bluetooth/qualcomm-bluetooth.yaml          |  2 ++
 drivers/bluetooth/btqca.c                                   | 13 +++++++++++--
 drivers/bluetooth/btqca.h                                   | 12 ++++++++++--
 drivers/bluetooth/hci_qca.c                                 | 12 ++++++++++++
 4 files changed, 35 insertions(+), 4 deletions(-)
---
base-commit: 7093f04e534f48181e5d5fccbcf99c37ab96929a
change-id: 20230421-fp4-bluetooth-b36a0e87b9c8

Best regards,
-- 
Luca Weiss <luca.weiss@fairphone.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 1/2] dt-bindings: net: qualcomm: Add WCN3988
  2023-08-02  6:56 [PATCH v3 0/2] Add WCN3988 Bluetooth support for Fairphone 4 Luca Weiss
@ 2023-08-02  6:56 ` Luca Weiss
  2023-08-02  6:56 ` [PATCH v3 2/2] Bluetooth: btqca: Add WCN3988 support Luca Weiss
  2023-08-02 20:30 ` [PATCH v3 0/2] Add WCN3988 Bluetooth support for Fairphone 4 patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: Luca Weiss @ 2023-08-02  6:56 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Marcel Holtmann, Johan Hedberg,
	Luiz Augusto von Dentz, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, Conor Dooley, Balakrishna Godavarthi, Rocky Liao
  Cc: ~postmarketos/upstreaming, phone-devel, netdev, devicetree,
	linux-kernel, linux-bluetooth, linux-arm-msm, Luca Weiss,
	Krzysztof Kozlowski

Add the compatible for the Bluetooth part of the Qualcomm WCN3988
chipset.

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
 Documentation/devicetree/bindings/net/bluetooth/qualcomm-bluetooth.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/bluetooth/qualcomm-bluetooth.yaml b/Documentation/devicetree/bindings/net/bluetooth/qualcomm-bluetooth.yaml
index 56cbb42b5aea..2735c6a4f336 100644
--- a/Documentation/devicetree/bindings/net/bluetooth/qualcomm-bluetooth.yaml
+++ b/Documentation/devicetree/bindings/net/bluetooth/qualcomm-bluetooth.yaml
@@ -19,6 +19,7 @@ properties:
       - qcom,qca2066-bt
       - qcom,qca6174-bt
       - qcom,qca9377-bt
+      - qcom,wcn3988-bt
       - qcom,wcn3990-bt
       - qcom,wcn3991-bt
       - qcom,wcn3998-bt
@@ -111,6 +112,7 @@ allOf:
         compatible:
           contains:
             enum:
+              - qcom,wcn3988-bt
               - qcom,wcn3990-bt
               - qcom,wcn3991-bt
               - qcom,wcn3998-bt

-- 
2.41.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 2/2] Bluetooth: btqca: Add WCN3988 support
  2023-08-02  6:56 [PATCH v3 0/2] Add WCN3988 Bluetooth support for Fairphone 4 Luca Weiss
  2023-08-02  6:56 ` [PATCH v3 1/2] dt-bindings: net: qualcomm: Add WCN3988 Luca Weiss
@ 2023-08-02  6:56 ` Luca Weiss
  2023-08-02 20:30 ` [PATCH v3 0/2] Add WCN3988 Bluetooth support for Fairphone 4 patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: Luca Weiss @ 2023-08-02  6:56 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Marcel Holtmann, Johan Hedberg,
	Luiz Augusto von Dentz, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, Conor Dooley, Balakrishna Godavarthi, Rocky Liao
  Cc: ~postmarketos/upstreaming, phone-devel, netdev, devicetree,
	linux-kernel, linux-bluetooth, linux-arm-msm, Luca Weiss

Add support for the Bluetooth chip codenamed APACHE which is part of
WCN3988.

The firmware for this chip has a slightly different naming scheme
compared to most others. For ROM Version 0x0200 we need to use
apbtfw10.tlv + apnv10.bin and for ROM version 0x201 apbtfw11.tlv +
apnv11.bin

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
 drivers/bluetooth/btqca.c   | 13 +++++++++++--
 drivers/bluetooth/btqca.h   | 12 ++++++++++--
 drivers/bluetooth/hci_qca.c | 12 ++++++++++++
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index e7e58a956d15..6f2187fab55f 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -594,14 +594,20 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 	/* Firmware files to download are based on ROM version.
 	 * ROM version is derived from last two bytes of soc_ver.
 	 */
-	rom_ver = ((soc_ver & 0x00000f00) >> 0x04) | (soc_ver & 0x0000000f);
+	if (soc_type == QCA_WCN3988)
+		rom_ver = ((soc_ver & 0x00000f00) >> 0x05) | (soc_ver & 0x0000000f);
+	else
+		rom_ver = ((soc_ver & 0x00000f00) >> 0x04) | (soc_ver & 0x0000000f);
 
 	if (soc_type == QCA_WCN6750)
 		qca_send_patch_config_cmd(hdev);
 
 	/* Download rampatch file */
 	config.type = TLV_TYPE_PATCH;
-	if (qca_is_wcn399x(soc_type)) {
+	if (soc_type == QCA_WCN3988) {
+		snprintf(config.fwname, sizeof(config.fwname),
+			 "qca/apbtfw%02x.tlv", rom_ver);
+	} else if (qca_is_wcn399x(soc_type)) {
 		snprintf(config.fwname, sizeof(config.fwname),
 			 "qca/crbtfw%02x.tlv", rom_ver);
 	} else if (soc_type == QCA_QCA6390) {
@@ -636,6 +642,9 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 	if (firmware_name)
 		snprintf(config.fwname, sizeof(config.fwname),
 			 "qca/%s", firmware_name);
+	else if (soc_type == QCA_WCN3988)
+		snprintf(config.fwname, sizeof(config.fwname),
+			 "qca/apnv%02x.bin", rom_ver);
 	else if (qca_is_wcn399x(soc_type)) {
 		if (le32_to_cpu(ver.soc_id) == QCA_WCN3991_SOC_ID) {
 			snprintf(config.fwname, sizeof(config.fwname),
diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
index b884095bcd9d..fc6cf314eb0e 100644
--- a/drivers/bluetooth/btqca.h
+++ b/drivers/bluetooth/btqca.h
@@ -142,6 +142,7 @@ enum qca_btsoc_type {
 	QCA_INVALID = -1,
 	QCA_AR3002,
 	QCA_ROME,
+	QCA_WCN3988,
 	QCA_WCN3990,
 	QCA_WCN3998,
 	QCA_WCN3991,
@@ -162,8 +163,15 @@ int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
 int qca_send_pre_shutdown_cmd(struct hci_dev *hdev);
 static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type)
 {
-	return soc_type == QCA_WCN3990 || soc_type == QCA_WCN3991 ||
-	       soc_type == QCA_WCN3998;
+	switch (soc_type) {
+	case QCA_WCN3988:
+	case QCA_WCN3990:
+	case QCA_WCN3991:
+	case QCA_WCN3998:
+		return true;
+	default:
+		return false;
+	}
 }
 static inline bool qca_is_wcn6750(enum qca_btsoc_type soc_type)
 {
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 9b785c947d96..011822519602 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1874,6 +1874,17 @@ static const struct hci_uart_proto qca_proto = {
 	.dequeue	= qca_dequeue,
 };
 
+static const struct qca_device_data qca_soc_data_wcn3988 __maybe_unused = {
+	.soc_type = QCA_WCN3988,
+	.vregs = (struct qca_vreg []) {
+		{ "vddio", 15000  },
+		{ "vddxo", 80000  },
+		{ "vddrf", 300000 },
+		{ "vddch0", 450000 },
+	},
+	.num_vregs = 4,
+};
+
 static const struct qca_device_data qca_soc_data_wcn3990 __maybe_unused = {
 	.soc_type = QCA_WCN3990,
 	.vregs = (struct qca_vreg []) {
@@ -2398,6 +2409,7 @@ static const struct of_device_id qca_bluetooth_of_match[] = {
 	{ .compatible = "qcom,qca6174-bt" },
 	{ .compatible = "qcom,qca6390-bt", .data = &qca_soc_data_qca6390},
 	{ .compatible = "qcom,qca9377-bt" },
+	{ .compatible = "qcom,wcn3988-bt", .data = &qca_soc_data_wcn3988},
 	{ .compatible = "qcom,wcn3990-bt", .data = &qca_soc_data_wcn3990},
 	{ .compatible = "qcom,wcn3991-bt", .data = &qca_soc_data_wcn3991},
 	{ .compatible = "qcom,wcn3998-bt", .data = &qca_soc_data_wcn3998},

-- 
2.41.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 0/2] Add WCN3988 Bluetooth support for Fairphone 4
  2023-08-02  6:56 [PATCH v3 0/2] Add WCN3988 Bluetooth support for Fairphone 4 Luca Weiss
  2023-08-02  6:56 ` [PATCH v3 1/2] dt-bindings: net: qualcomm: Add WCN3988 Luca Weiss
  2023-08-02  6:56 ` [PATCH v3 2/2] Bluetooth: btqca: Add WCN3988 support Luca Weiss
@ 2023-08-02 20:30 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2023-08-02 20:30 UTC (permalink / raw)
  To: Luca Weiss
  Cc: davem, edumazet, kuba, pabeni, robh+dt, krzysztof.kozlowski+dt,
	marcel, johan.hedberg, luiz.dentz, agross, andersson,
	konrad.dybcio, conor+dt, quic_bgodavar, quic_rjliao,
	~postmarketos/upstreaming, phone-devel, netdev, devicetree,
	linux-kernel, linux-bluetooth, linux-arm-msm, krzysztof.kozlowski

Hello:

This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Wed, 02 Aug 2023 08:56:27 +0200 you wrote:
> Add support in the btqca/hci_qca driver for the WCN3988 and add it to
> the sm7225 Fairphone 4 devicetree.
> 
> Devicetree patches go via Qualcomm tree, the rest via their respective
> trees.
> 
> --
> Previously with the RFC version I've had problems before with Bluetooth
> scanning failing like the following:
> 
> [...]

Here is the summary with links:
  - [v3,1/2] dt-bindings: net: qualcomm: Add WCN3988
    https://git.kernel.org/bluetooth/bluetooth-next/c/d2a31b6f9701
  - [v3,2/2] Bluetooth: btqca: Add WCN3988 support
    https://git.kernel.org/bluetooth/bluetooth-next/c/f2e1dd87c9cd

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-02 20:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-02  6:56 [PATCH v3 0/2] Add WCN3988 Bluetooth support for Fairphone 4 Luca Weiss
2023-08-02  6:56 ` [PATCH v3 1/2] dt-bindings: net: qualcomm: Add WCN3988 Luca Weiss
2023-08-02  6:56 ` [PATCH v3 2/2] Bluetooth: btqca: Add WCN3988 support Luca Weiss
2023-08-02 20:30 ` [PATCH v3 0/2] Add WCN3988 Bluetooth support for Fairphone 4 patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).