Skip to content

Commit 84758d4

Browse files
Bhagavathi Perumal SKalle Valo
authored andcommitted
ath10k: add support to configure BB timing over wmi
Add wmi configuration cmd to configure base band(BB) power amplifier(PA) off timing values in hardware. The default PA off timings were fine tuned to make proper DFS radar detection in QCA reference design. If ODM uses different PA in their design, then the same default PA off timing values cannot be used, it requires different settling time to detect radar pulses very sooner and avoid radar detection problems. In that case it provides provision to select proper PA off timing values based on the PA hardware used. The PA component is part of FEM hardware and new device tree entry "ext-fem-name" is used to indentify the FEM hardware. And this wmi configuration cmd is enabled via wmi service flag "WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT". Other way is to apply these values through calibration data, but recalibration of all boards out there might not be feasible. This change tested on firmware ver 10.2.4-1.0-00042 in QCA988X chipset. Signed-off-by: Bhagavathi Perumal S <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent f3f5879 commit 84758d4

File tree

4 files changed

+116
-0
lines changed

4 files changed

+116
-0
lines changed

drivers/net/wireless/ath/ath10k/mac.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <net/mac80211.h>
2323
#include <linux/etherdevice.h>
2424
#include <linux/acpi.h>
25+
#include <linux/of.h>
2526

2627
#include "hif.h"
2728
#include "core.h"
@@ -4637,11 +4638,44 @@ static int ath10k_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
46374638
return ret;
46384639
}
46394640

4641+
static int __ath10k_fetch_bb_timing_dt(struct ath10k *ar,
4642+
struct wmi_bb_timing_cfg_arg *bb_timing)
4643+
{
4644+
struct device_node *node;
4645+
const char *fem_name;
4646+
int ret;
4647+
4648+
node = ar->dev->of_node;
4649+
if (!node)
4650+
return -ENOENT;
4651+
4652+
ret = of_property_read_string_index(node, "ext-fem-name", 0, &fem_name);
4653+
if (ret)
4654+
return -ENOENT;
4655+
4656+
/*
4657+
* If external Front End module used in hardware, then default base band timing
4658+
* parameter cannot be used since they were fine tuned for reference hardware,
4659+
* so choosing different value suitable for that external FEM.
4660+
*/
4661+
if (!strcmp("microsemi-lx5586", fem_name)) {
4662+
bb_timing->bb_tx_timing = 0x00;
4663+
bb_timing->bb_xpa_timing = 0x0101;
4664+
} else {
4665+
return -ENOENT;
4666+
}
4667+
4668+
ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot bb_tx_timing 0x%x bb_xpa_timing 0x%x\n",
4669+
bb_timing->bb_tx_timing, bb_timing->bb_xpa_timing);
4670+
return 0;
4671+
}
4672+
46404673
static int ath10k_start(struct ieee80211_hw *hw)
46414674
{
46424675
struct ath10k *ar = hw->priv;
46434676
u32 param;
46444677
int ret = 0;
4678+
struct wmi_bb_timing_cfg_arg bb_timing = {0};
46454679

46464680
/*
46474681
* This makes sense only when restarting hw. It is harmless to call
@@ -4796,6 +4830,19 @@ static int ath10k_start(struct ieee80211_hw *hw)
47964830
clear_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags);
47974831
}
47984832

4833+
if (test_bit(WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT, ar->wmi.svc_map)) {
4834+
ret = __ath10k_fetch_bb_timing_dt(ar, &bb_timing);
4835+
if (!ret) {
4836+
ret = ath10k_wmi_pdev_bb_timing(ar, &bb_timing);
4837+
if (ret) {
4838+
ath10k_warn(ar,
4839+
"failed to set bb timings: %d\n",
4840+
ret);
4841+
goto err_core_stop;
4842+
}
4843+
}
4844+
}
4845+
47994846
ar->num_started_vdevs = 0;
48004847
ath10k_regd_update(ar);
48014848

drivers/net/wireless/ath/ath10k/wmi-ops.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ struct wmi_ops {
219219
struct sk_buff *(*gen_echo)(struct ath10k *ar, u32 value);
220220
struct sk_buff *(*gen_pdev_get_tpc_table_cmdid)(struct ath10k *ar,
221221
u32 param);
222+
struct sk_buff *(*gen_bb_timing)
223+
(struct ath10k *ar,
224+
const struct wmi_bb_timing_cfg_arg *arg);
222225

223226
};
224227

@@ -1576,4 +1579,21 @@ ath10k_wmi_report_radar_found(struct ath10k *ar,
15761579
ar->wmi.cmd->radar_found_cmdid);
15771580
}
15781581

1582+
static inline int
1583+
ath10k_wmi_pdev_bb_timing(struct ath10k *ar,
1584+
const struct wmi_bb_timing_cfg_arg *arg)
1585+
{
1586+
struct sk_buff *skb;
1587+
1588+
if (!ar->wmi.ops->gen_bb_timing)
1589+
return -EOPNOTSUPP;
1590+
1591+
skb = ar->wmi.ops->gen_bb_timing(ar, arg);
1592+
1593+
if (IS_ERR(skb))
1594+
return PTR_ERR(skb);
1595+
1596+
return ath10k_wmi_cmd_send(ar, skb,
1597+
ar->wmi.cmd->set_bb_timing_cmdid);
1598+
}
15791599
#endif

drivers/net/wireless/ath/ath10k/wmi.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,7 @@ static struct wmi_cmd_map wmi_10_2_4_cmd_map = {
539539
WMI_10_2_PDEV_BSS_CHAN_INFO_REQUEST_CMDID,
540540
.pdev_get_tpc_table_cmdid = WMI_CMD_UNSUPPORTED,
541541
.radar_found_cmdid = WMI_CMD_UNSUPPORTED,
542+
.set_bb_timing_cmdid = WMI_10_2_PDEV_SET_BB_TIMING_CONFIG_CMDID,
542543
};
543544

544545
/* 10.4 WMI cmd track */
@@ -8843,6 +8844,27 @@ ath10k_wmi_barrier(struct ath10k *ar)
88438844
return 0;
88448845
}
88458846

8847+
static struct sk_buff *
8848+
ath10k_wmi_10_2_4_op_gen_bb_timing(struct ath10k *ar,
8849+
const struct wmi_bb_timing_cfg_arg *arg)
8850+
{
8851+
struct wmi_pdev_bb_timing_cfg_cmd *cmd;
8852+
struct sk_buff *skb;
8853+
8854+
skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
8855+
if (!skb)
8856+
return ERR_PTR(-ENOMEM);
8857+
8858+
cmd = (struct wmi_pdev_bb_timing_cfg_cmd *)skb->data;
8859+
cmd->bb_tx_timing = __cpu_to_le32(arg->bb_tx_timing);
8860+
cmd->bb_xpa_timing = __cpu_to_le32(arg->bb_xpa_timing);
8861+
8862+
ath10k_dbg(ar, ATH10K_DBG_WMI,
8863+
"wmi pdev bb_tx_timing 0x%x bb_xpa_timing 0x%x\n",
8864+
arg->bb_tx_timing, arg->bb_xpa_timing);
8865+
return skb;
8866+
}
8867+
88468868
static const struct wmi_ops wmi_ops = {
88478869
.rx = ath10k_wmi_op_rx,
88488870
.map_svc = wmi_main_svc_map,
@@ -9116,6 +9138,7 @@ static const struct wmi_ops wmi_10_2_4_ops = {
91169138
.gen_pdev_enable_adaptive_cca =
91179139
ath10k_wmi_op_gen_pdev_enable_adaptive_cca,
91189140
.get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype,
9141+
.gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing,
91199142
/* .gen_bcn_tmpl not implemented */
91209143
/* .gen_prb_tmpl not implemented */
91219144
/* .gen_p2p_go_bcn_ie not implemented */

drivers/net/wireless/ath/ath10k/wmi.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ enum wmi_service {
206206
WMI_SERVICE_TX_DATA_ACK_RSSI,
207207
WMI_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT,
208208
WMI_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT,
209+
WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT,
209210

210211
/* keep last */
211212
WMI_SERVICE_MAX,
@@ -245,6 +246,9 @@ enum wmi_10x_service {
245246
WMI_10X_SERVICE_PEER_STATS,
246247
WMI_10X_SERVICE_RESET_CHIP,
247248
WMI_10X_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS,
249+
WMI_10X_SERVICE_VDEV_BCN_RATE_CONTROL,
250+
WMI_10X_SERVICE_PER_PACKET_SW_ENCRYPT,
251+
WMI_10X_SERVICE_BB_TIMING_CONFIG_SUPPORT,
248252
};
249253

250254
enum wmi_main_service {
@@ -572,6 +576,8 @@ static inline void wmi_10x_svc_map(const __le32 *in, unsigned long *out,
572576
WMI_SERVICE_RESET_CHIP, len);
573577
SVCMAP(WMI_10X_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS,
574578
WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, len);
579+
SVCMAP(WMI_10X_SERVICE_BB_TIMING_CONFIG_SUPPORT,
580+
WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT, len);
575581
}
576582

577583
static inline void wmi_main_svc_map(const __le32 *in, unsigned long *out,
@@ -992,6 +998,7 @@ struct wmi_cmd_map {
992998
u32 pdev_wds_entry_list_cmdid;
993999
u32 tdls_set_offchan_mode_cmdid;
9941000
u32 radar_found_cmdid;
1001+
u32 set_bb_timing_cmdid;
9951002
};
9961003

9971004
/*
@@ -1607,6 +1614,8 @@ enum wmi_10_2_cmd_id {
16071614
WMI_10_2_SET_LTEU_CONFIG_CMDID,
16081615
WMI_10_2_SET_CCA_PARAMS,
16091616
WMI_10_2_PDEV_BSS_CHAN_INFO_REQUEST_CMDID,
1617+
WMI_10_2_FWTEST_CMDID,
1618+
WMI_10_2_PDEV_SET_BB_TIMING_CONFIG_CMDID,
16101619
WMI_10_2_PDEV_UTF_CMDID = WMI_10_2_END_CMDID - 1,
16111620
};
16121621

@@ -7173,6 +7182,23 @@ struct wmi_pdev_chan_info_req_cmd {
71737182
__le32 reserved;
71747183
} __packed;
71757184

7185+
/* bb timing register configurations */
7186+
struct wmi_bb_timing_cfg_arg {
7187+
/* Tx_end to pa off timing */
7188+
u32 bb_tx_timing;
7189+
7190+
/* Tx_end to external pa off timing */
7191+
u32 bb_xpa_timing;
7192+
};
7193+
7194+
struct wmi_pdev_bb_timing_cfg_cmd {
7195+
/* Tx_end to pa off timing */
7196+
__le32 bb_tx_timing;
7197+
7198+
/* Tx_end to external pa off timing */
7199+
__le32 bb_xpa_timing;
7200+
} __packed;
7201+
71767202
struct ath10k;
71777203
struct ath10k_vif;
71787204
struct ath10k_fw_stats_pdev;

0 commit comments

Comments
 (0)