summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ath/ath12k/acpi.c
diff options
context:
space:
mode:
authorLingbo Kong <quic_lingbok@quicinc.com>2024-04-22 16:18:45 +0300
committerKalle Valo <quic_kvalo@quicinc.com>2024-04-23 12:29:14 +0300
commit12bccacbcd9e4f83bb26994634b4da388cebb476 (patch)
tree3bb1ab97ba32c8549c66e84f6584697911275153 /drivers/net/wireless/ath/ath12k/acpi.c
parent764883be7ed05fedc20cad59b6740764ee1bcaf0 (diff)
downloadlinux-12bccacbcd9e4f83bb26994634b4da388cebb476.tar.xz
wifi: ath12k: ACPI CCA threshold support
Currently, ath12k does not have the ability to adjust Clear Channel Assessment (CCA) threshold values to meet the regulatory requirements. Get the values from ACPI and send them to the firmware using ath12k_wmi_set_bios_cmd() function. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4 Signed-off-by: Lingbo Kong <quic_lingbok@quicinc.com> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com> Link: https://msgid.link/20240422033054.979-4-quic_lingbok@quicinc.com
Diffstat (limited to 'drivers/net/wireless/ath/ath12k/acpi.c')
-rw-r--r--drivers/net/wireless/ath/ath12k/acpi.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath12k/acpi.c b/drivers/net/wireless/ath/ath12k/acpi.c
index 177babc50f25..4af80dd13535 100644
--- a/drivers/net/wireless/ath/ath12k/acpi.c
+++ b/drivers/net/wireless/ath/ath12k/acpi.c
@@ -80,6 +80,18 @@ static int ath12k_acpi_dsm_get_data(struct ath12k_base *ab, int func)
obj->buffer.length);
break;
+ case ATH12K_ACPI_DSM_FUNC_INDEX_CCA:
+ if (obj->buffer.length != ATH12K_ACPI_DSM_CCA_DATA_SIZE) {
+ ath12k_warn(ab, "invalid ACPI DSM CCA data size: %d\n",
+ obj->buffer.length);
+ ret = -EINVAL;
+ goto out;
+ }
+
+ memcpy(&ab->acpi.cca_data, obj->buffer.pointer,
+ obj->buffer.length);
+
+ break;
}
} else {
ath12k_warn(ab, "ACPI DSM method returned an unsupported object type: %d\n",
@@ -226,6 +238,7 @@ static int ath12k_acpi_set_tas_params(struct ath12k_base *ab)
int ath12k_acpi_start(struct ath12k_base *ab)
{
acpi_status status;
+ u8 *buf;
int ret;
if (!ab->hw_params->acpi_guid)
@@ -297,6 +310,30 @@ int ath12k_acpi_start(struct ath12k_base *ab)
return ret;
}
+ if (ATH12K_ACPI_FUNC_BIT_VALID(ab->acpi, ATH12K_ACPI_FUNC_BIT_CCA)) {
+ ret = ath12k_acpi_dsm_get_data(ab, ATH12K_ACPI_DSM_FUNC_INDEX_CCA);
+ if (ret) {
+ ath12k_warn(ab, "failed to get ACPI DSM CCA threshold configuration: %d\n",
+ ret);
+ return ret;
+ }
+
+ if (ab->acpi.cca_data[0] == ATH12K_ACPI_CCA_THR_VERSION &&
+ ab->acpi.cca_data[ATH12K_ACPI_CCA_THR_OFFSET_DATA_OFFSET] ==
+ ATH12K_ACPI_CCA_THR_ENABLE_FLAG) {
+ buf = ab->acpi.cca_data + ATH12K_ACPI_CCA_THR_OFFSET_DATA_OFFSET;
+ ret = ath12k_wmi_set_bios_cmd(ab,
+ WMI_BIOS_PARAM_CCA_THRESHOLD_TYPE,
+ buf,
+ ATH12K_ACPI_CCA_THR_OFFSET_LEN);
+ if (ret) {
+ ath12k_warn(ab, "failed to set ACPI DSM CCA threshold: %d\n",
+ ret);
+ return ret;
+ }
+ }
+ }
+
status = acpi_install_notify_handler(ACPI_HANDLE(ab->dev),
ACPI_DEVICE_NOTIFY,
ath12k_acpi_dsm_notify, ab);