]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: ath12k: Add support for obtaining the buffer type ACPI function bitmap
authorLingbo Kong <quic_lingbok@quicinc.com>
Mon, 13 Jan 2025 07:48:07 +0000 (15:48 +0800)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Mon, 3 Feb 2025 22:43:29 +0000 (14:43 -0800)
Currently, ath12k does not support obtaining the buffer type ACPI function
bitmap.

To solve this issue, change the code to support obtaining the buffer type
ACPI function bitmap.

This patch will not affect QCN9274, because only WCN7850 supports ACPI.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Signed-off-by: Lingbo Kong <quic_lingbok@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://patch.msgid.link/20250113074810.29729-2-quic_lingbok@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/acpi.c
drivers/net/wireless/ath/ath12k/acpi.h

index 0555d35aab477a5f42906b4bf367f1db3dd5ee94..b6935ab1655e4dfe7d9681dd5f0b09f8ec5172aa 100644 (file)
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: BSD-3-Clause-Clear
 /*
  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include "core.h"
@@ -12,7 +12,7 @@ static int ath12k_acpi_dsm_get_data(struct ath12k_base *ab, int func)
 {
        union acpi_object *obj;
        acpi_handle root_handle;
-       int ret;
+       int ret, i;
 
        root_handle = ACPI_HANDLE(ab->dev);
        if (!root_handle) {
@@ -32,6 +32,20 @@ static int ath12k_acpi_dsm_get_data(struct ath12k_base *ab, int func)
                ab->acpi.func_bit = obj->integer.value;
        } else if (obj->type == ACPI_TYPE_BUFFER) {
                switch (func) {
+               case ATH12K_ACPI_DSM_FUNC_SUPPORT_FUNCS:
+                       if (obj->buffer.length < ATH12K_ACPI_DSM_FUNC_MIN_BITMAP_SIZE ||
+                           obj->buffer.length > ATH12K_ACPI_DSM_FUNC_MAX_BITMAP_SIZE) {
+                               ath12k_warn(ab, "invalid ACPI DSM func size: %d\n",
+                                           obj->buffer.length);
+                               ret = -EINVAL;
+                               goto out;
+                       }
+
+                       ab->acpi.func_bit = 0;
+                       for (i = 0; i < obj->buffer.length; i++)
+                               ab->acpi.func_bit += obj->buffer.pointer[i] << (i * 8);
+
+                       break;
                case ATH12K_ACPI_DSM_FUNC_TAS_CFG:
                        if (obj->buffer.length != ATH12K_ACPI_DSM_TAS_CFG_SIZE) {
                                ath12k_warn(ab, "invalid ACPI DSM TAS config size: %d\n",
index 39e003d86a48badf482f41e743e0a5dec43e46e5..6ccc26250aafb7ed19300f12353d439d4be98137 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
 /*
  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 #ifndef ATH12K_ACPI_H
 #define ATH12K_ACPI_H
@@ -48,6 +48,9 @@
 #define ATH12K_ACPI_DSM_BAND_EDGE_DATA_SIZE            100
 #define ATH12K_ACPI_DSM_TAS_CFG_SIZE                   108
 
+#define ATH12K_ACPI_DSM_FUNC_MIN_BITMAP_SIZE   1
+#define ATH12K_ACPI_DSM_FUNC_MAX_BITMAP_SIZE   4
+
 #define ATH12K_ACPI_DSM_GEO_OFFSET_DATA_SIZE (ATH12K_ACPI_GEO_OFFSET_DATA_OFFSET + \
                                              ATH12K_ACPI_BIOS_SAR_GEO_OFFSET_LEN)
 #define ATH12K_ACPI_DSM_BIOS_SAR_DATA_SIZE (ATH12K_ACPI_POWER_LIMIT_DATA_OFFSET + \