Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2010938lqt; Sun, 21 Apr 2024 20:31:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVFQFOucVG1+Xdoo9WDOLS3weMXK8Gkzh3TGIMhBoZr7IubYzUbkvWkQadvSbxvkQzPxzCfSEvmTeZTYPgLSiGrFKGd0gCMB5om+cxQig== X-Google-Smtp-Source: AGHT+IFxpuVb5D3LRMGFsx2OG2bLC3f2j+Sr4QH0rfrfxgneAQjPb9vR9/b345+CdD5pzxcxo4dB X-Received: by 2002:a05:6512:b0b:b0:51b:398f:ce40 with SMTP id w11-20020a0565120b0b00b0051b398fce40mr1022024lfu.10.1713756697912; Sun, 21 Apr 2024 20:31:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713756697; cv=pass; d=google.com; s=arc-20160816; b=oTm2bWR4Wny81pqtjOQqC3tqtCNaydWfcmlEtaqQcjPPcNshCs+xwyEnPdZqfBbWy3 2h/issnngRQ4MijXRYdAz4OhSk21y7ui2t5njldAFzx3aFvalpP2fQaYQw7/n52r5OoB MyEbgObmLn613wrIcIC3Uwk8JlYxPwbYRNVOzHTWsr11PiFqtJs2i5SRjT3mJxq1ARmk 3U+1lDdyZf3gwGxxE3BaVvAfreTI/Q1nBBhyXv0yjyj24+1pT0KLbL7zlUN2scT68hn1 sjhbwJjdOGkBrCeBQZ6dDC8wYIsC7PlQcvBDHG/9fNqggrbpPm7qN3//zI5JWNKpbK6q /62w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=64L5h+WZFqfEYAg04oeEc9gJIgzm7hBFsbVYwICLKxY=; fh=FeRHs2WX8VAc5wtea+afpOiGBDI/QNqygA2b1gY4TiI=; b=OVcpt+RGFzMyXnklQnBz/MBzfwNOL4Wa2xrqXHA6m6aJ0E+m3AHpy4oiEwFT+jsCYd UI5MilqPvT74e0Oml3Ag9sosqmDxfNIKmYzfnN0yaZfCUr+YIUPbEU1fEWuWGokVhNGZ jyDZjkOGllWcfWjvBhY2P6CKdYSN1FgB6Rcwy+ThlcMlinwvj7OI0mLK7ds0zDU667mg IuhHwDlttSx572L65aIfmeH6ZXJf3LWs6aG4TN6q9khAODZy4c2d67Exn+AT4nRcZuyC CgCzEQXXH4vr6wu+Ce7nWKcAOElZbXsH1ayEpZu1xmkjpMiY9WJsuDMkyZtTH+I2rmMk E2iA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=bEfLJzIY; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-6623-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6623-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id s9-20020a170906a18900b00a55ac7c4b65si1460492ejy.287.2024.04.21.20.31.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Apr 2024 20:31:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6623-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=bEfLJzIY; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-6623-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6623-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 227481F21033 for ; Mon, 22 Apr 2024 03:31:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B445E554; Mon, 22 Apr 2024 03:31:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="bEfLJzIY" X-Original-To: linux-wireless@vger.kernel.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF4DDEAF6 for ; Mon, 22 Apr 2024 03:31:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713756683; cv=none; b=fgqAXTalNMfQhhUG+0P2/Zt6vuH1DT0g9zr/DVRSIq/z8alk3wLo9KouKeROcBfnj9UEP9ZjAILbw5yM7NF7/hIb+EZK4shfr0PXqsaZru6izxiCzDibSGv/rvpqb5hIgBsvYKQd2tECthCez7j5J9YcnSjFbJlQbU1BWyDNCWk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713756683; c=relaxed/simple; bh=gxGSzW4orOAqPS+ujCEUX7kG5pjdHgMjP1VYsa70BZw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sWMOXbGpngSBD/Rx8hJheuCL3vA25O6dc1SJFkXU4u1sMR9ju+BrxBQAyuxIsPK/42/BNVEAdmD2fwifyKjFmWssQ/1WOYjVvJsDYyrPINrOW0N1LjroKUe0q958vGhJcUbcVZ7RVpNMRUF07SLSN3Owmcq0LJfoLUlMI6ZLwEs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=bEfLJzIY; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43M1MqpT007768; Mon, 22 Apr 2024 03:31:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=64L5h+WZFqfEYAg04oeEc9gJIgzm7hBFsbVYwICLKxY=; b=bE fLJzIYdz60tqW7K1Zj65l/n0XJuNbXfwWMJwtBQvv2uB9Mt/p5mWpVrl/ZZauT7q Mnn2q2BavXT3c0fyzzIeDqhDq+0kSpsqfJ4o3utwcE1IzorK/YtAanKHDWSseDFI 1CZtLB/PGUhJt2LJXCmEFXOjnjSPzAePWIbuCOCiU4BAp342DswF7D/0E+VWuYBt z+1qMYxsF3aKFoK5tjNogrdEUliJquLjCqzjqPAjkXXg5pi1Ym3bXhz2BAHjX+sC w9c+DFh2PJB0Z8Vt0jr3IpIln3NTFoJmBfMHub7+ztncd9iOkVfhlBZrr1p+l0oM ootGa+dhnQJplpXzfQaA== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xm5sx34k9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 Apr 2024 03:31:18 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 43M3VHKt010221 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 Apr 2024 03:31:17 GMT Received: from lingbok.ap.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Sun, 21 Apr 2024 20:31:16 -0700 From: Lingbo Kong To: CC: , Subject: [PATCH v10 4/4] wifi: ath12k: ACPI band edge channel power support Date: Mon, 22 Apr 2024 11:30:53 +0800 Message-ID: <20240422033054.979-5-quic_lingbok@quicinc.com> X-Mailer: git-send-email 2.37.3.windows.1 In-Reply-To: <20240422033054.979-1-quic_lingbok@quicinc.com> References: <20240422033054.979-1-quic_lingbok@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: KtJVrjNojB8GysgGbzh3GsJNerPTu2z2 X-Proofpoint-GUID: KtJVrjNojB8GysgGbzh3GsJNerPTu2z2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-21_22,2024-04-19_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 phishscore=0 clxscore=1015 suspectscore=0 malwarescore=0 spamscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=998 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404220016 Currently, ath12k does not have the ability to set band edge channel power for WCN7850. In order to support this, ath12k gets band edge channel power table in ath12k_acpi_dsm_get_data() function and sets pdev_id and param_type_id, then finally sends these data and WMI_PDEV_SET_BIOS_INTERFACE_CMDID to firmware to set band edge channel power. 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 Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath12k/acpi.c | 36 ++++++++++++++++++++++++++ drivers/net/wireless/ath/ath12k/acpi.h | 5 ++++ drivers/net/wireless/ath/ath12k/core.h | 1 + drivers/net/wireless/ath/ath12k/wmi.h | 4 +++ 4 files changed, 46 insertions(+) diff --git a/drivers/net/wireless/ath/ath12k/acpi.c b/drivers/net/wireless/ath/ath12k/acpi.c index 4af80dd13535..443ba12e01f3 100644 --- a/drivers/net/wireless/ath/ath12k/acpi.c +++ b/drivers/net/wireless/ath/ath12k/acpi.c @@ -91,6 +91,18 @@ static int ath12k_acpi_dsm_get_data(struct ath12k_base *ab, int func) memcpy(&ab->acpi.cca_data, obj->buffer.pointer, obj->buffer.length); + break; + case ATH12K_ACPI_DSM_FUNC_INDEX_BAND_EDGE: + if (obj->buffer.length != ATH12K_ACPI_DSM_BAND_EDGE_DATA_SIZE) { + ath12k_warn(ab, "invalid ACPI DSM band edge data size: %d\n", + obj->buffer.length); + ret = -EINVAL; + goto out; + } + + memcpy(&ab->acpi.band_edge_power, obj->buffer.pointer, + obj->buffer.length); + break; } } else { @@ -334,6 +346,30 @@ int ath12k_acpi_start(struct ath12k_base *ab) } } + if (ATH12K_ACPI_FUNC_BIT_VALID(ab->acpi, + ATH12K_ACPI_FUNC_BIT_BAND_EDGE_CHAN_POWER)) { + ret = ath12k_acpi_dsm_get_data(ab, ATH12K_ACPI_DSM_FUNC_INDEX_BAND_EDGE); + if (ret) { + ath12k_warn(ab, "failed to get ACPI DSM band edge channel power: %d\n", + ret); + return ret; + } + + if (ab->acpi.band_edge_power[0] == ATH12K_ACPI_BAND_EDGE_VERSION && + ab->acpi.band_edge_power[1] == ATH12K_ACPI_BAND_EDGE_ENABLE_FLAG) { + ret = ath12k_wmi_set_bios_cmd(ab, + WMI_BIOS_PARAM_TYPE_BANDEDGE, + ab->acpi.band_edge_power, + sizeof(ab->acpi.band_edge_power)); + if (ret) { + ath12k_warn(ab, + "failed to set ACPI DSM band edge channel power: %d\n", + ret); + return ret; + } + } + } + status = acpi_install_notify_handler(ACPI_HANDLE(ab->dev), ACPI_DEVICE_NOTIFY, ath12k_acpi_dsm_notify, ab); diff --git a/drivers/net/wireless/ath/ath12k/acpi.h b/drivers/net/wireless/ath/ath12k/acpi.h index 0879865fd861..39e003d86a48 100644 --- a/drivers/net/wireless/ath/ath12k/acpi.h +++ b/drivers/net/wireless/ath/ath12k/acpi.h @@ -14,12 +14,14 @@ #define ATH12K_ACPI_DSM_FUNC_INDEX_CCA 6 #define ATH12K_ACPI_DSM_FUNC_TAS_CFG 8 #define ATH12K_ACPI_DSM_FUNC_TAS_DATA 9 +#define ATH12K_ACPI_DSM_FUNC_INDEX_BAND_EDGE 10 #define ATH12K_ACPI_FUNC_BIT_BIOS_SAR BIT(3) #define ATH12K_ACPI_FUNC_BIT_GEO_OFFSET BIT(4) #define ATH12K_ACPI_FUNC_BIT_CCA BIT(5) #define ATH12K_ACPI_FUNC_BIT_TAS_CFG BIT(7) #define ATH12K_ACPI_FUNC_BIT_TAS_DATA BIT(8) +#define ATH12K_ACPI_FUNC_BIT_BAND_EDGE_CHAN_POWER BIT(9) #define ATH12K_ACPI_NOTIFY_EVENT 0x86 #define ATH12K_ACPI_FUNC_BIT_VALID(_acdata, _func) (((_acdata).func_bit) & (_func)) @@ -30,6 +32,8 @@ #define ATH12K_ACPI_POWER_LIMIT_ENABLE_FLAG 0x1 #define ATH12K_ACPI_CCA_THR_VERSION 0x1 #define ATH12K_ACPI_CCA_THR_ENABLE_FLAG 0x1 +#define ATH12K_ACPI_BAND_EDGE_VERSION 0x1 +#define ATH12K_ACPI_BAND_EDGE_ENABLE_FLAG 0x1 #define ATH12K_ACPI_GEO_OFFSET_DATA_OFFSET 1 #define ATH12K_ACPI_DBS_BACKOFF_DATA_OFFSET 2 @@ -41,6 +45,7 @@ #define ATH12K_ACPI_CCA_THR_OFFSET_LEN 36 #define ATH12K_ACPI_DSM_TAS_DATA_SIZE 69 +#define ATH12K_ACPI_DSM_BAND_EDGE_DATA_SIZE 100 #define ATH12K_ACPI_DSM_TAS_CFG_SIZE 108 #define ATH12K_ACPI_DSM_GEO_OFFSET_DATA_SIZE (ATH12K_ACPI_GEO_OFFSET_DATA_OFFSET + \ diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h index 0e33cf783f62..3333f88520ce 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -914,6 +914,7 @@ struct ath12k_base { u8 bios_sar_data[ATH12K_ACPI_DSM_BIOS_SAR_DATA_SIZE]; u8 geo_offset_data[ATH12K_ACPI_DSM_GEO_OFFSET_DATA_SIZE]; u8 cca_data[ATH12K_ACPI_DSM_CCA_DATA_SIZE]; + u8 band_edge_power[ATH12K_ACPI_DSM_BAND_EDGE_DATA_SIZE]; } acpi; #endif /* CONFIG_ACPI */ diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h index 6db15a0a4735..b5285ed78534 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.h +++ b/drivers/net/wireless/ath/ath12k/wmi.h @@ -4808,6 +4808,10 @@ enum wmi_bios_param_type { WMI_BIOS_PARAM_CCA_THRESHOLD_TYPE = 0, WMI_BIOS_PARAM_TAS_CONFIG_TYPE = 1, WMI_BIOS_PARAM_TAS_DATA_TYPE = 2, + + /* bandedge control power */ + WMI_BIOS_PARAM_TYPE_BANDEDGE = 3, + WMI_BIOS_PARAM_TYPE_MAX, }; -- 2.34.1