wifi: ath12k: support calibration-variant from device tree
PATCH v2 1/2 wifi: ath12k: support calibration-variant from device tree
ath10k and ath11k support reading calibration variants from the device tree to locate the correct Board Description File (BDF). The ath12k-wsi binding already describes using qcom,calibration-variant but it is not implemented in the driver.
Many ath12k designs expose all the radios under a single phy, each of which typically require a separate BDF. Without this, the radios may not come up or will not be calibrated correctly.
Fix this by parsing the device tree for the generation-agnostic qcom,calibration-variant. This allows the driver to properly select, read and apply the correct BDF.
---
Changes in v2:
- Drop ath12k-specific binding qcom,ath12k-calibration-variant in favor
of generation agnostic qcom,calibration-variant.
- Link to v1: https://lore.kernel.org/all/[email protected]
--- drivers/net/wireless/ath/ath12k/core.c | 22 ++++++++++++++++++++++ drivers/net/wireless/ath/ath12k/qmi.c | 4 ++++ 2 files changed, 26 insertions(+)
drivers/net/wireless/ath/ath12k/core.c +22 -0
@@ -812,6 +812,28 @@ int ath12k_core_check_smbios(struct ath12k_base *ab)return 0 ; } +int ath12k_core_check_dt (struct ath12k_base *ab) +{ +size_t max_len =sizeof (ab->qmi.target.bdf_ext); +const char *variant =NULL ; +struct device_node *node; + + node = ab->dev->of_node; +if (!node) +return -ENOENT ; + +of_property_read_string (node,"qcom,calibration-variant" , + &variant); +if (!variant) +return -ENODATA ; + +if (strscpy (ab->qmi.target.bdf_ext, variant, max_len) <0 ) +ath12k_dbg (ab,ATH12K_DBG_BOOT , +"bdf variant string is longer than the buffer can accommodate (variant: %s)\n" , variant); + +return 0 ; +} +static int ath12k_core_soc_create (struct ath12k_base *ab) {int ret;
drivers/net/wireless/ath/ath12k/qmi.c +4 -0
@@ -2945,6 +2945,10 @@ int ath12k_qmi_request_target_cap(struct ath12k_base *ab)if (r)ath12k_dbg (ab,ATH12K_DBG_QMI ,"SMBIOS bdf variant name not set.\n" ); + r =ath12k_core_check_dt (ab); +if (r) +ath12k_dbg (ab,ATH12K_DBG_QMI ,"DT bdf variant name not set.\n" ); + r =ath12k_acpi_start (ab);if (r)/* ACPI is optional so continue in case of an error */
Signature · 1 line
2.43.0
PATCH v2 2/2 dt-bindings: wireless: ath12k: drop qcom,ath12k-calibration-variant
The ath12k-wsi binding documentation describes using the generation-specific qcom,ath12k-calibration-variant binding as well as the generation-agnostic qcom,calibration-variant binding to load board-specific calibration data from the device tree. However, the driver never implemented either of these.
Given that no devices currently supported use qcom,ath12k-calibration-variant and the previous patch implements qcom,calibration-variant, drop the generation-specific version from the binding to prevent future confusion.
--- .../devicetree/bindings/net/wireless/qcom,ath12k-wsi.yaml | 7 ------- 1 file changed, 7 deletions(-)
Documentation/devicetree/bindings/net/wireless/qcom,ath12k-wsi.yaml +0 -7
@@ -58,13 +58,6 @@ properties: String to uniquely identify variant of the calibration data for designs with colliding bus and device ids - qcom,ath12k-calibration-variant: - $ref: /schemas/types.yaml#/definitions/string - deprecated: true - description: - String to uniquely identify variant of the calibration data for designs - with colliding bus and device ids - qcom,wsi-controller: $ref: /schemas/types.yaml#/definitions/flag description:
Signature · 1 line
2.43.0
Re: [PATCH v2 2/2] dt-bindings: wireless: ath12k: drop qcom,ath12k-calibration-variant
Quoted 11 lines · Andrew LaMarche
The ath12k-wsi binding documentation describes using the generation-specific qcom,ath12k-calibration-variant binding as well as the generation-agnostic qcom,calibration-variant binding to load board-specific calibration data from the device tree. However, the driver never implemented either of these.
Given that no devices currently supported use qcom,ath12k-calibration-variant and the previous patch implements qcom,calibration-variant, drop the generation-specific version from the binding to prevent future confusion.
Quoted 4 lines
Signed-off-by Andrew LaMarche <[email protected]>--- .../devicetree/bindings/net/wireless/qcom,ath12k-wsi.yaml | 7 ------- 1 file changed, 7 deletions(-)
Best regards,
Krzysztof
Quoted 62 lines · Andrew LaMarche
ath10k and ath11k support reading calibration variants from the device tree to locate the correct Board Description File (BDF). The ath12k-wsi binding already describes using qcom,calibration-variant but it is not implemented in the driver.
Many ath12k designs expose all the radios under a single phy, each of which typically require a separate BDF. Without this, the radios may not come up or will not be calibrated correctly.
Fix this by parsing the device tree for the generation-agnostic qcom,calibration-variant. This allows the driver to properly select, read and apply the correct BDF.
Signed-off-by Andrew LaMarche <[email protected]>---
Changes in v2:
- Drop ath12k-specific binding qcom,ath12k-calibration-variant in favor
of generation agnostic qcom,calibration-variant.
- Link to v1: https://lore.kernel.org/all/[email protected]--- drivers/net/wireless/ath/ath12k/core.c | 22 ++++++++++++++++++++++ drivers/net/wireless/ath/ath12k/qmi.c | 4 ++++ 2 files changed, 26 insertions(+)drivers/net/wireless/ath/ath12k/core.c +22
-0@@ -812,6 +812,28 @@ int ath12k_core_check_smbios(struct ath12k_base *ab)return 0 ; } +int ath12k_core_check_dt (struct ath12k_base *ab) +{ +size_t max_len =sizeof (ab->qmi.target.bdf_ext); +const char *variant =NULL ; +struct device_node *node; + + node = ab->dev->of_node; +if (!node) +return -ENOENT ; + +of_property_read_string (node,"qcom,calibration-variant" , + &variant); +if (!variant) +return -ENODATA ; + +if (strscpy (ab->qmi.target.bdf_ext, variant, max_len) <0 ) +ath12k_dbg (ab,ATH12K_DBG_BOOT , +"bdf variant string is longer than the buffer can accommodate (variant: %s)\n" , variant); + +return 0 ; +} +static int ath12k_core_soc_create (struct ath12k_base *ab) {int ret;drivers/net/wireless/ath/ath12k/qmi.c +0
-0
drivers/net/wireless/ath/ath12k/qmi.c int ath12k_qmi_request_target_cap(struct ath12k_base *ab) · line 2948
Quoted 4 lines
drivers/net/wireless/ath/ath12k/qmi.c +1
-0@@ -2945,6 +2945,10 @@ int ath12k_qmi_request_target_cap(struct ath12k_base *ab)if (r)ath12k_dbg (ab,ATH12K_DBG_QMI ,"SMBIOS bdf variant name not set.\n" ); + r =ath12k_core_check_dt (ab);
I understand there are already some variant exacting helper (ACPI, SMBIOS) being called here, but they really should not. After all, how could a qmi message relates to ACPI or SMBIOS?
I'd like firstly move the existing helpers out and then add the new DT helper.
Quoted 5 lines
drivers/net/wireless/ath/ath12k/qmi.c +2
-0+ if (r)> + ath12k_dbg(ab, ATH12K_DBG_QMI, "DT bdf variant name not set.\n"); + r =ath12k_acpi_start (ab);if (r)/* ACPI is optional so continue in case of an error */
Quoted 9 lines · Baochen Qiang
Quoted 8 lines · Andrew LaMarche
drivers/net/wireless/ath/ath12k/qmi.c +0
-0@@ -2945,6 +2945,10 @@ int ath12k_qmi_request_target_cap(struct ath12k_base *ab)if (r)ath12k_dbg (ab,ATH12K_DBG_QMI ,"SMBIOS bdf variant name not set.\n" );
Quoted 7 lines
drivers/net/wireless/ath/ath12k/qmi.c int ath12k_qmi_request_target_cap(struct ath12k_base *ab) · line 2948
Quoted 1 line
drivers/net/wireless/ath/ath12k/qmi.c +1
-0+ r =ath12k_core_check_dt (ab);I understand there are already some variant exacting helper (ACPI, SMBIOS) being called here, but they really should not. After all, how could a qmi message relates to ACPI or SMBIOS?
I'd like firstly move the existing helpers out and then add the new DT helper.
This code is exactly following the pattern from ath11k. So I'd like to have this land, and then we can think about how we can clean this up, especially since folks are waiting for this.
Quoted 7 lines
drivers/net/wireless/ath/ath12k/qmi.c int ath12k_qmi_request_target_cap(struct ath12k_base *ab) · line 2954
Quoted 6 lines
drivers/net/wireless/ath/ath12k/qmi.c +2
-0+ if (r)> + ath12k_dbg(ab, ATH12K_DBG_QMI, "DT bdf variant name not set.\n"); + r =ath12k_acpi_start (ab);if (r)/* ACPI is optional so continue in case of an error */
/jeff
drivers/net/wireless/ath/ath12k/core.c int ath12k_core_check_smbios(struct ath12k_base *ab) · line 825
Quoted 11 lines · Andrew LaMarche
drivers/net/wireless/ath/ath12k/core.c +11
-0+int ath12k_core_check_dt (struct ath12k_base *ab) +{ +size_t max_len =sizeof (ab->qmi.target.bdf_ext); +const char *variant =NULL ; +struct device_node *node; + + node = ab->dev->of_node; +if (!node) +return -ENOENT ; + + of_property_read_string(node, "qcom,calibration-variant",
I've fixed the following in the pending branch:
● checkpatch.pl: 126: CHECK: Alignment should match open parenthesis
drivers/net/wireless/ath/ath12k/core.c int ath12k_core_check_smbios(struct ath12k_base *ab) · line 832
Quoted 7 lines
drivers/net/wireless/ath/ath12k/core.c +7
-0+ &variant); +if (!variant) +return -ENODATA ; + +if (strscpy (ab->qmi.target.bdf_ext, variant, max_len) <0 ) +ath12k_dbg (ab,ATH12K_DBG_BOOT , +"bdf variant string is longer than the buffer can accommodate (variant: %s)\n" , variant);
Also:
● checkpatch.pl: 132: WARNING: line length of 121 exceeds 100 columns ● checkpatch.pl: 132: CHECK: Alignment should match open parenthesis
Quoted 4 lines
drivers/net/wireless/ath/ath12k/core.c +4
-0+ +return 0 ; +} +
Quoted 28 lines · Jeff Johnson
drivers/net/wireless/ath/ath12k/core.c int ath12k_core_check_smbios(struct ath12k_base *ab) · line 825
Quoted 11 lines · Andrew LaMarche
drivers/net/wireless/ath/ath12k/core.c +11
-0+int ath12k_core_check_dt (struct ath12k_base *ab) +{ +size_t max_len =sizeof (ab->qmi.target.bdf_ext); +const char *variant =NULL ; +struct device_node *node; + + node = ab->dev->of_node; +if (!node) +return -ENOENT ; + + of_property_read_string(node, "qcom,calibration-variant",I've fixed the following in the pending branch:
● checkpatch.pl: 126: CHECK: Alignment should match open parenthesisdrivers/net/wireless/ath/ath12k/core.c int ath12k_core_check_smbios(struct ath12k_base *ab) · line 832
Quoted 7 lines
drivers/net/wireless/ath/ath12k/core.c +7
-0+ &variant); +if (!variant) +return -ENODATA ; + +if (strscpy (ab->qmi.target.bdf_ext, variant, max_len) <0 ) +ath12k_dbg (ab,ATH12K_DBG_BOOT , +"bdf variant string is longer than the buffer can accommodate (variant: %s)\n" , variant);Also:
● checkpatch.pl: 132: WARNING: line length of 121 exceeds 100 columns ● checkpatch.pl: 132: CHECK: Alignment should match open parenthesis
Quoted 1 line
looks good to me.
Quoted 6 lines
Quoted 5 lines
drivers/net/wireless/ath/ath12k/core.c +4
-0+ +return 0 ; +} +
Quoted 9 lines · Andrew LaMarche
ath10k and ath11k support reading calibration variants from the device tree to locate the correct Board Description File (BDF). The ath12k-wsi binding already describes using qcom,calibration-variant but it is not implemented in the driver.
Many ath12k designs expose all the radios under a single phy, each of which typically require a separate BDF. Without this, the radios may not come up or will not be calibrated correctly.
Quoted 5 lines
Fix this by parsing the device tree for the generation-agnostic qcom,calibration-variant. This allows the driver to properly select, read and apply the correct BDF.
Signed-off-by Andrew LaMarche <[email protected]>
Quoted 9 lines · Andrew LaMarche
ath10k and ath11k support reading calibration variants from the device tree to locate the correct Board Description File (BDF). The ath12k-wsi binding already describes using qcom,calibration-variant but it is not implemented in the driver.
Many ath12k designs expose all the radios under a single phy, each of which typically require a separate BDF. Without this, the radios may not come up or will not be calibrated correctly.
Quoted 5 lines
Fix this by parsing the device tree for the generation-agnostic qcom,calibration-variant. This allows the driver to properly select, read and apply the correct BDF.
Signed-off-by Andrew LaMarche <[email protected]>
Jeff Johnson
AppliedQuoted 10 lines · Andrew LaMarche
ath10k and ath11k support reading calibration variants from the device tree to locate the correct Board Description File (BDF). The ath12k-wsi binding already describes using qcom,calibration-variant but it is not implemented in the driver.
Many ath12k designs expose all the radios under a single phy, each of which typically require a separate BDF. Without this, the radios may not come up or will not be calibrated correctly.
[...]
Applied, thanks!
[1/2] wifi: ath12k: support calibration-variant from device tree
commit: 06cca100ad083609ca9cc2d1f692546369144189
[2/2] dt-bindings: wireless: ath12k: drop qcom,ath12k-calibration-variant
commit: e6c2d73f27b3948cabec1017c9443fba24f1dcc1Best regards,
Signature · 1 line
Jeff Johnson <[email protected]>