Skip to content

Commit 5a401f3

Browse files
Michal Kaziorkvalo
Michal Kazior
authored andcommitted
ath10k: add spectral scan support to wmi-tlv
Command structure and event flow doesn't seem to be any different compared to existing implementation for other firmware branches. This patch effectively adds in-driver support for spectral scanning on QCA61x4 and QCA9377. Tested QCA9377 w/ WLAN.TF.1.0-00267-1. Signed-off-by: Michal Kazior <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 18ae68f commit 5a401f3

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

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

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3136,6 +3136,76 @@ ath10k_wmi_tlv_op_gen_echo(struct ath10k *ar, u32 value)
31363136
return skb;
31373137
}
31383138

3139+
static struct sk_buff *
3140+
ath10k_wmi_tlv_op_gen_vdev_spectral_conf(struct ath10k *ar,
3141+
const struct wmi_vdev_spectral_conf_arg *arg)
3142+
{
3143+
struct wmi_vdev_spectral_conf_cmd *cmd;
3144+
struct sk_buff *skb;
3145+
struct wmi_tlv *tlv;
3146+
void *ptr;
3147+
size_t len;
3148+
3149+
len = sizeof(*tlv) + sizeof(*cmd);
3150+
skb = ath10k_wmi_alloc_skb(ar, len);
3151+
if (!skb)
3152+
return ERR_PTR(-ENOMEM);
3153+
3154+
ptr = (void *)skb->data;
3155+
tlv = ptr;
3156+
tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_SPECTRAL_CONFIGURE_CMD);
3157+
tlv->len = __cpu_to_le16(sizeof(*cmd));
3158+
cmd = (void *)tlv->value;
3159+
cmd->vdev_id = __cpu_to_le32(arg->vdev_id);
3160+
cmd->scan_count = __cpu_to_le32(arg->scan_count);
3161+
cmd->scan_period = __cpu_to_le32(arg->scan_period);
3162+
cmd->scan_priority = __cpu_to_le32(arg->scan_priority);
3163+
cmd->scan_fft_size = __cpu_to_le32(arg->scan_fft_size);
3164+
cmd->scan_gc_ena = __cpu_to_le32(arg->scan_gc_ena);
3165+
cmd->scan_restart_ena = __cpu_to_le32(arg->scan_restart_ena);
3166+
cmd->scan_noise_floor_ref = __cpu_to_le32(arg->scan_noise_floor_ref);
3167+
cmd->scan_init_delay = __cpu_to_le32(arg->scan_init_delay);
3168+
cmd->scan_nb_tone_thr = __cpu_to_le32(arg->scan_nb_tone_thr);
3169+
cmd->scan_str_bin_thr = __cpu_to_le32(arg->scan_str_bin_thr);
3170+
cmd->scan_wb_rpt_mode = __cpu_to_le32(arg->scan_wb_rpt_mode);
3171+
cmd->scan_rssi_rpt_mode = __cpu_to_le32(arg->scan_rssi_rpt_mode);
3172+
cmd->scan_rssi_thr = __cpu_to_le32(arg->scan_rssi_thr);
3173+
cmd->scan_pwr_format = __cpu_to_le32(arg->scan_pwr_format);
3174+
cmd->scan_rpt_mode = __cpu_to_le32(arg->scan_rpt_mode);
3175+
cmd->scan_bin_scale = __cpu_to_le32(arg->scan_bin_scale);
3176+
cmd->scan_dbm_adj = __cpu_to_le32(arg->scan_dbm_adj);
3177+
cmd->scan_chn_mask = __cpu_to_le32(arg->scan_chn_mask);
3178+
3179+
return skb;
3180+
}
3181+
3182+
static struct sk_buff *
3183+
ath10k_wmi_tlv_op_gen_vdev_spectral_enable(struct ath10k *ar, u32 vdev_id,
3184+
u32 trigger, u32 enable)
3185+
{
3186+
struct wmi_vdev_spectral_enable_cmd *cmd;
3187+
struct sk_buff *skb;
3188+
struct wmi_tlv *tlv;
3189+
void *ptr;
3190+
size_t len;
3191+
3192+
len = sizeof(*tlv) + sizeof(*cmd);
3193+
skb = ath10k_wmi_alloc_skb(ar, len);
3194+
if (!skb)
3195+
return ERR_PTR(-ENOMEM);
3196+
3197+
ptr = (void *)skb->data;
3198+
tlv = ptr;
3199+
tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_VDEV_SPECTRAL_ENABLE_CMD);
3200+
tlv->len = __cpu_to_le16(sizeof(*cmd));
3201+
cmd = (void *)tlv->value;
3202+
cmd->vdev_id = __cpu_to_le32(vdev_id);
3203+
cmd->trigger_cmd = __cpu_to_le32(trigger);
3204+
cmd->enable_cmd = __cpu_to_le32(enable);
3205+
3206+
return skb;
3207+
}
3208+
31393209
/****************/
31403210
/* TLV mappings */
31413211
/****************/
@@ -3541,6 +3611,8 @@ static const struct wmi_ops wmi_tlv_ops = {
35413611
.fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill,
35423612
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
35433613
.gen_echo = ath10k_wmi_tlv_op_gen_echo,
3614+
.gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf,
3615+
.gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable,
35443616
};
35453617

35463618
static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = {

0 commit comments

Comments
 (0)