xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8852bs/phl/phl_txpwr.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /******************************************************************************
2*4882a593Smuzhiyun  *
3*4882a593Smuzhiyun  * Copyright(c) 2021 Realtek Corporation.
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * This program is free software; you can redistribute it and/or modify it
6*4882a593Smuzhiyun  * under the terms of version 2 of the GNU General Public License as
7*4882a593Smuzhiyun  * published by the Free Software Foundation.
8*4882a593Smuzhiyun  *
9*4882a593Smuzhiyun  * This program is distributed in the hope that it will be useful, but WITHOUT
10*4882a593Smuzhiyun  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11*4882a593Smuzhiyun  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12*4882a593Smuzhiyun  * more details.
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  *****************************************************************************/
15*4882a593Smuzhiyun #define _PHL_TXPWR_C_
16*4882a593Smuzhiyun #include "phl_headers.h"
17*4882a593Smuzhiyun 
rtw_phl_get_pw_lmt_regu_type_str(void * phl,enum band_type band)18*4882a593Smuzhiyun const char *rtw_phl_get_pw_lmt_regu_type_str(void *phl, enum band_type band)
19*4882a593Smuzhiyun {
20*4882a593Smuzhiyun 	struct phl_info_t *phl_info = phl;
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun 	return rtw_hal_get_pw_lmt_regu_type_str(phl_info->hal, band);
23*4882a593Smuzhiyun }
24*4882a593Smuzhiyun 
rtw_phl_get_pwr_lmt_en(void * phl,u8 band_idx)25*4882a593Smuzhiyun bool rtw_phl_get_pwr_lmt_en(void *phl, u8 band_idx)
26*4882a593Smuzhiyun {
27*4882a593Smuzhiyun 	struct phl_info_t *phl_info = phl;
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun 	return rtw_hal_get_pwr_lmt_en(phl_info->hal, band_idx);
30*4882a593Smuzhiyun }
31*4882a593Smuzhiyun 
rtw_phl_set_tx_power(void * phl,u8 band_idx)32*4882a593Smuzhiyun enum rtw_phl_status rtw_phl_set_tx_power(void *phl, u8 band_idx)
33*4882a593Smuzhiyun {
34*4882a593Smuzhiyun 	struct phl_info_t *phl_info = phl;
35*4882a593Smuzhiyun 	enum rtw_hal_status hstatus = RTW_HAL_STATUS_FAILURE;
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun 	hstatus = rtw_hal_set_tx_power(phl_info->hal, band_idx, PWR_BY_RATE | PWR_LIMIT | PWR_LIMIT_RU);
38*4882a593Smuzhiyun 	if (hstatus != RTW_HAL_STATUS_SUCCESS)
39*4882a593Smuzhiyun 		PHL_ERR("%s rtw_hal_set_tx_power: statuts = %u\n", __func__, hstatus);
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun 	return hstatus == RTW_HAL_STATUS_SUCCESS ? RTW_PHL_STATUS_SUCCESS : RTW_PHL_STATUS_FAILURE;
42*4882a593Smuzhiyun }
43*4882a593Smuzhiyun 
44