Prechádzať zdrojové kódy

cnss2: Send AOP msg to disable WLAN PDC in case of specific Board ID

Send the AOP msg to disable WLAN PDC for boards which support
on chip PMIC.

Change-Id: I572799a727000b3f124f01919c013c637dee0e10
CRs-Fixed: 3386507
Anuj Khera 2 rokov pred
rodič
commit
640497899b
4 zmenil súbory, kde vykonal 37 pridanie a 1 odobranie
  1. 1 0
      cnss2/main.c
  2. 2 0
      cnss2/main.h
  3. 18 1
      cnss2/power.c
  4. 16 0
      cnss2/qmi.c

+ 1 - 0
cnss2/main.c

@@ -4281,6 +4281,7 @@ static void cnss_misc_deinit(struct cnss_plat_data *plat_priv)
 	wakeup_source_unregister(plat_priv->recovery_ws);
 	cnss_deinit_sol_gpio(plat_priv);
 	kfree(plat_priv->sram_dump);
+	kfree(plat_priv->on_chip_pmic_board_ids);
 }
 
 static void cnss_init_control_params(struct cnss_plat_data *plat_priv)

+ 2 - 0
cnss2/main.h

@@ -605,6 +605,8 @@ struct cnss_plat_data {
 	int qrtr_node_id;
 	unsigned int wlfw_service_instance_id;
 	const char *pld_bus_ops_name;
+	u32 on_chip_pmic_devices_count;
+	u32 *on_chip_pmic_board_ids;
 };
 
 #if IS_ENABLED(CONFIG_ARCH_QCOM)

+ 18 - 1
cnss2/power.c

@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <linux/clk.h>
@@ -1607,6 +1607,7 @@ void cnss_power_misc_params_init(struct cnss_plat_data *plat_priv)
 {
 	struct device *dev = &plat_priv->plat_dev->dev;
 	int ret;
+	u32 cfg_arr_size = 0, *cfg_arr = NULL;
 
 	/* common DT Entries */
 	plat_priv->pdc_init_table_len =
@@ -1676,6 +1677,22 @@ void cnss_power_misc_params_init(struct cnss_plat_data *plat_priv)
 		if (ret)
 			cnss_pr_dbg("VReg for QCA6490 Int Power Amp not configured\n");
 	}
+	ret = of_property_count_u32_elems(plat_priv->plat_dev->dev.of_node,
+					  "qcom,on-chip-pmic-support");
+	if (ret > 0) {
+		cfg_arr_size = ret;
+		cfg_arr = kcalloc(cfg_arr_size, sizeof(*cfg_arr), GFP_KERNEL);
+
+		ret = of_property_read_u32_array(plat_priv->plat_dev->dev.of_node,
+						 "qcom,on-chip-pmic-support", cfg_arr,
+						 cfg_arr_size);
+		if (!ret) {
+			plat_priv->on_chip_pmic_devices_count = cfg_arr_size;
+			plat_priv->on_chip_pmic_board_ids = cfg_arr;
+		}
+	} else {
+		cnss_pr_dbg("On chip PMIC device ids not configured\n");
+	}
 }
 
 int cnss_update_cpr_info(struct cnss_plat_data *plat_priv)

+ 16 - 0
cnss2/qmi.c

@@ -597,6 +597,22 @@ int cnss_wlfw_tgt_cap_send_sync(struct cnss_plat_data *plat_priv)
 	if (resp->ol_cpr_cfg_valid)
 		cnss_aop_ol_cpr_cfg_setup(plat_priv, &resp->ol_cpr_cfg);
 
+	/* Disable WLAN PDC in AOP firmware for boards which support on chip PMIC
+	 * so AOP will ignore SW_CTRL changes and do not update regulator votes.
+	 **/
+	for (i = 0; i < plat_priv->on_chip_pmic_devices_count; i++) {
+		if (plat_priv->board_info.board_id ==
+		    plat_priv->on_chip_pmic_board_ids[i]) {
+			cnss_pr_dbg("Disabling WLAN PDC for board_id: %02x\n",
+				    plat_priv->board_info.board_id);
+			ret = cnss_aop_send_msg(plat_priv,
+						"{class: wlan_pdc, ss: rf, res: pdc, enable: 0}");
+			if (ret < 0)
+				cnss_pr_dbg("Failed to Send AOP Msg");
+			break;
+		}
+	}
+
 	cnss_pr_dbg("Target capability: chip_id: 0x%x, chip_family: 0x%x, board_id: 0x%x, soc_id: 0x%x, otp_version: 0x%x\n",
 		    plat_priv->chip_info.chip_id,
 		    plat_priv->chip_info.chip_family,