qcacld-3.0: UMAC: Add support to retrieve SAR power limits

Recently change "qcacld-3.0: Add SAR power limit configuration"
(Change-Id: I137ce9bde2fa05e363d5af17e155dc739d862c5f) added the
ability to dynamically configure Specific Absorption Rate (SAR) power
limits. Now update the UMAC layer to add the ability to retrieve the
current active power limits.

Change-Id: Ifdf1d8b2e4d507348f013f1bcac1045bf13caa65
CRs-Fixed: 2161448
This commit is contained in:
Jeff Johnson 2017-12-18 15:22:25 -08:00 • committed by snandini
commit f0e54b019b
7 changed files with 188 additions and 0 deletions

View file

@ -45,6 +45,7 @@
#include "sme_internal.h"
#include "wma_tgt_cfg.h"
#include "wma_fips_public_structs.h"
#include "wma_sar_public_structs.h"
#include "sme_rrm_internal.h"
#include "sir_types.h"
@ -1466,6 +1467,19 @@ QDF_STATUS sme_power_debug_stats_req(tHalHandle hal, void (*callback_fn)
(struct power_stats_response *response,
void *context), void *power_stats_context);
#endif
/**
* sme_get_sar_power_limits() - get SAR limits
* @hal: HAL handle
* @callback: Callback function to invoke with the results
* @context: Opaque context to pass back to caller in the callback
*
* Return: QDF_STATUS_SUCCESS if the request is successfully sent
* to firmware for processing, otherwise an error status.
*/
QDF_STATUS sme_get_sar_power_limits(tHalHandle hal,
wma_sar_cb callback, void *context);
/**
* sme_set_sar_power_limits() - set sar limits
* @hal: HAL handle
@ -1475,6 +1489,7 @@ QDF_STATUS sme_power_debug_stats_req(tHalHandle hal, void (*callback_fn)
*/
QDF_STATUS sme_set_sar_power_limits(tHalHandle hal,
struct sar_limit_cmd_params *sar_limit_cmd);
void sme_set_cc_src(tHalHandle hal_handle, enum country_src);

View file

@ -14705,6 +14705,21 @@ QDF_STATUS sme_set_default_scan_ie(tHalHandle hal, uint16_t session_id,
return status;
}
QDF_STATUS sme_get_sar_power_limits(tHalHandle hal,
wma_sar_cb callback, void *context)
{
void *wma_handle;
wma_handle = cds_get_context(QDF_MODULE_ID_WMA);
if (!wma_handle) {
QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
"wma handle is NULL");
return QDF_STATUS_E_FAILURE;
}
return wma_get_sar_limit(wma_handle, callback, context);
}
QDF_STATUS sme_set_sar_power_limits(tHalHandle hal,
struct sar_limit_cmd_params *sar_limit_cmd)
{

View file

@ -40,6 +40,7 @@
#include "cds_utils.h"
#include "scheduler_api.h"
#include "wlan_policy_mgr_api.h"
#include "wma_sar_public_structs.h"
#include <cdp_txrx_ops.h>
typedef void *WMA_HANDLE;
@ -248,6 +249,20 @@ QDF_STATUS wma_set_cts2self_for_p2p_go(void *wma_handle,
uint32_t cts2self_for_p2p_go);
QDF_STATUS wma_set_tx_rx_aggregation_size
(struct sir_set_tx_rx_aggregation_size *tx_rx_aggregation_size);
/**
* wma_get_sar_limit() - get SAR limits from the target
* @handle: wma handle
* @callback: Callback function to invoke with the results
* @context: Opaque context to pass back to caller in the callback
*
* This function sends WMI command to get SAR limits.
*
* Return: QDF_STATUS enumeration
*/
QDF_STATUS wma_get_sar_limit(WMA_HANDLE handle,
wma_sar_cb callback, void *context);
/**
* wma_set_sar_limit() - set sar limits in the target
* @handle: wma handle
@ -259,6 +274,7 @@ QDF_STATUS wma_set_tx_rx_aggregation_size
*/
QDF_STATUS wma_set_sar_limit(WMA_HANDLE handle,
struct sar_limit_cmd_params *sar_limit_params);
/**
* wma_set_qpower_config() - update qpower config in wma
* @vdev_id: the Id of the vdev to configure

View file

@ -894,6 +894,18 @@ void wma_get_stats_req(WMA_HANDLE handle,
* wma_features.c functions declarations
*/
/**
* wma_sar_register_event_handlers() - Register SAR event handlers
* @handle: WMA Handle
*
* Function to be called during WMA initialization to register SAR
* event handlers with WMI
*
* Return: QDF_STATUS_SUCCESS if registration is successful, otherwise
* an error enumeration
*/
QDF_STATUS wma_sar_register_event_handlers(WMA_HANDLE handle);
void wma_process_link_status_req(tp_wma_handle wma,
tAniGetLinkStatus *pGetLinkStatus);

View file

@ -4832,6 +4832,98 @@ QDF_STATUS wma_enable_disable_caevent_ind(tp_wma_handle wma, uint8_t val)
return QDF_STATUS_SUCCESS;
}
static wma_sar_cb sar_callback;
static void *sar_context;
static int wma_sar_event_handler(void *handle, uint8_t *evt_buf, uint32_t len)
{
tp_wma_handle wma_handle;
wmi_unified_t wmi_handle;
struct sar_limit_event event;
wma_sar_cb callback;
QDF_STATUS status;
WMA_LOGI(FL("handle:%pK event:%pK len:%u"), handle, evt_buf, len);
wma_handle = handle;
if (!wma_handle) {
WMA_LOGE(FL("NULL wma_handle"));
return QDF_STATUS_E_INVAL;
}
wmi_handle = wma_handle->wmi_handle;
if (!wmi_handle) {
WMA_LOGE(FL("NULL wmi_handle"));
return QDF_STATUS_E_INVAL;
}
status = wmi_unified_extract_sar_limit_event(wmi_handle,
evt_buf, &event);
if (QDF_IS_STATUS_ERROR(status)) {
WMA_LOGE(FL("Event extract failure: %d"), status);
return QDF_STATUS_E_INVAL;
}
callback = sar_callback;
sar_callback = NULL;
if (callback)
callback(sar_context, &event);
return 0;
}
QDF_STATUS wma_sar_register_event_handlers(WMA_HANDLE handle)
{
tp_wma_handle wma_handle = handle;
wmi_unified_t wmi_handle;
if (!wma_handle) {
WMA_LOGE(FL("NULL wma_handle"));
return QDF_STATUS_E_INVAL;
}
wmi_handle = wma_handle->wmi_handle;
if (!wmi_handle) {
WMA_LOGE(FL("NULL wmi_handle"));
return QDF_STATUS_E_INVAL;
}
return wmi_unified_register_event_handler(wmi_handle,
wmi_sar_get_limits_event_id,
wma_sar_event_handler,
WMA_RX_WORK_CTX);
}
QDF_STATUS wma_get_sar_limit(WMA_HANDLE handle,
wma_sar_cb callback, void *context)
{
tp_wma_handle wma_handle = handle;
wmi_unified_t wmi_handle;
QDF_STATUS status;
if (!wma_handle) {
WMA_LOGE(FL("NULL wma_handle"));
return QDF_STATUS_E_INVAL;
}
wmi_handle = wma_handle->wmi_handle;
if (!wmi_handle) {
WMA_LOGE(FL("NULL wmi_handle"));
return QDF_STATUS_E_INVAL;
}
sar_callback = callback;
sar_context = context;
status = wmi_unified_get_sar_limit_cmd(wmi_handle);
if (QDF_IS_STATUS_ERROR(status)) {
WMA_LOGE(FL("wmi_unified_get_sar_limit_cmd() error: %u"),
status);
sar_callback = NULL;
}
return status;
}
QDF_STATUS wma_set_sar_limit(WMA_HANDLE handle,
struct sar_limit_cmd_params *sar_limit_params)
{

View file

@ -3999,6 +3999,13 @@ QDF_STATUS wma_start(void)
goto end;
}
status = wma_sar_register_event_handlers(wma_handle);
if (!QDF_IS_STATUS_SUCCESS(status)) {
WMA_LOGE("Failed to register SAR event handlers");
qdf_status = QDF_STATUS_E_FAILURE;
goto end;
}
/* Initialize the get temperature event handler */
status = wmi_unified_register_event_handler(wma_handle->wmi_handle,
wmi_pdev_temperature_event_id,

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef __WMA_SAR_PUBLIC_STRUCTS_H
#define __WMA_SAR_PUBLIC_STRUCTS_H
struct sar_limit_event;
/**
* typedef wma_sar_cb() - SAR callback function
* @context: Opaque context provided by caller in the original request
* @event: SAR limits event
*/
typedef void (*wma_sar_cb)(void *context, struct sar_limit_event *event);
#endif /* __WMA_SAR_PUBLIC_STRUCTS_H */