qcacmn: Add SAR power limit configuration

There is a regulatory requirement for Specific Absorption
Rate (SAR) whereby the phone transmit power is reduced
when it is determined that the phone is in close
proximity to the body.
Implement a vendor command interface to set SAR power
limts dynamically.

Change-Id: I0a214a2af780e9dd8c381c4e9eaa7d8cab6ef853
CRs-Fixed: 1098102
diff --git a/wmi_unified_api.h b/wmi_unified_api.h
index 9b45c13..ef5cd6d 100644
--- a/wmi_unified_api.h
+++ b/wmi_unified_api.h
@@ -1311,6 +1311,8 @@
 
 QDF_STATUS wmi_unified_send_power_dbg_cmd(void *wmi_hdl,
 				struct wmi_power_dbg_params *param);
+QDF_STATUS wmi_unified_send_sar_limit_cmd(void *wmi_hdl,
+				struct sar_limit_cmd_params *params);
 QDF_STATUS wmi_unified_send_adapt_dwelltime_params_cmd(void *wmi_hdl,
 				   struct wmi_adaptive_dwelltime_params *
 				   wmi_param);
diff --git a/wmi_unified_param.h b/wmi_unified_param.h
index fd2c051..35690a9 100644
--- a/wmi_unified_param.h
+++ b/wmi_unified_param.h
@@ -7010,6 +7010,37 @@
 	uint32_t tx_mu_transmitted;
 } wmi_host_peer_txmu_cnt_event;
 
+#define MAX_SAR_LIMIT_ROWS_SUPPORTED 64
+/**
+ * struct sar_limit_cmd_row - sar limts row
+ * @band_id: Optional param for frequency band
+ * @chain_id: Optional param for antenna chain id
+ * @mod_id: Optional param for modulation scheme
+ * @limit_value: Mandatory param providing power limits in steps of 0.5 dbm
+ * @validity_bitmap: bitmap of valid optional params in sar_limit_cmd_row struct
+ */
+struct sar_limit_cmd_row {
+	uint32_t band_id;
+	uint32_t chain_id;
+	uint32_t mod_id;
+	uint32_t limit_value;
+	uint32_t validity_bitmap;
+};
+
+/**
+ * struct sar_limit_cmd_params - sar limts params
+ * @sar_enable: flag to enable SAR
+ * @num_limit_rows: number of items in sar_limits
+ * @commit_limits: indicates firmware to start apply new SAR values
+ * @sar_limit_row_list: pointer to array of sar limit rows
+ */
+struct sar_limit_cmd_params {
+	uint32_t sar_enable;
+	uint32_t num_limit_rows;
+	uint32_t commit_limits;
+	struct sar_limit_cmd_row *sar_limit_row_list;
+};
+
 /*
  * struct wmi_peer_gid_userpos_list_event
  * @usr_list - User list
diff --git a/wmi_unified_priv.h b/wmi_unified_priv.h
index b2dd38c..ca93c7c 100644
--- a/wmi_unified_priv.h
+++ b/wmi_unified_priv.h
@@ -1180,6 +1180,9 @@
 QDF_STATUS (*send_encrypt_decrypt_send_cmd)(wmi_unified_t wmi_handle,
 				struct encrypt_decrypt_req_params *params);
 
+QDF_STATUS (*send_sar_limit_cmd)(wmi_unified_t wmi_handle,
+				struct sar_limit_cmd_params *params);
+
 QDF_STATUS (*send_peer_rx_reorder_queue_setup_cmd)(wmi_unified_t wmi_handle,
 		struct rx_reorder_queue_setup_params *param);