1 /******************************************************************************
2 *
3 * Copyright(c) 2021 Realtek Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 *****************************************************************************/
15 #define _HAL_TXPWR_C_
16 #include "hal_headers.h"
17
rtw_hal_get_pw_lmt_regu_type_str(void * hal,enum band_type band)18 const char *rtw_hal_get_pw_lmt_regu_type_str(void *hal, enum band_type band)
19 {
20 struct hal_info_t *hal_info = (struct hal_info_t *)hal;
21
22 return rtw_hal_rf_get_pw_lmt_regu_type_str(hal_info, band);
23 }
24
rtw_hal_get_pwr_lmt_en(void * hal,u8 band_idx)25 bool rtw_hal_get_pwr_lmt_en(void *hal, u8 band_idx)
26 {
27 struct hal_info_t *hal_info = (struct hal_info_t *)hal;
28
29 return rtw_hal_mac_get_pwr_lmt_en_val(hal_info->hal_com, band_idx);
30 }
31
rtw_hal_set_tx_power(void * hal,u8 band_idx,enum phl_pwr_table pwr_table)32 enum rtw_hal_status rtw_hal_set_tx_power(void *hal, u8 band_idx,
33 enum phl_pwr_table pwr_table)
34 {
35 struct hal_info_t *hal_info = (struct hal_info_t *)hal;
36 enum phl_phy_idx phy_idx = HW_PHY_0;
37
38 if (band_idx == 1)
39 phy_idx = HW_PHY_1;
40
41 return rtw_hal_rf_set_power(hal_info, phy_idx, pwr_table);
42 }
43
rtw_hal_get_txinfo_power(void * hal,s16 * txinfo_power_dbm)44 enum rtw_hal_status rtw_hal_get_txinfo_power(void *hal,
45 s16 *txinfo_power_dbm)
46 {
47 struct hal_info_t *hal_info = (struct hal_info_t *)hal;
48 enum rtw_hal_status hal_status = RTW_HAL_STATUS_SUCCESS;
49 s16 power_dbm = 0;
50
51 hal_status = rtw_hal_bb_get_txinfo_power(hal_info, &power_dbm);
52 *txinfo_power_dbm = power_dbm;
53
54 return hal_status;
55 }
56
57