Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52776a70 authored by Kalle Valo's avatar Kalle Valo
Browse files

Merge ath-next from ath.git

ath.git patches for 4.7. Major changes:

ath6kl

* add ability to set debug uart baud rate with a module parameter

wil6210

* add debugfs file to configure firmware led functionality
parents d9739a26 ee9ca147
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -202,6 +202,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
		.name = "qca4019 hw1.0",
		.patch_load_addr = QCA4019_HW_1_0_PATCH_LOAD_ADDR,
		.uart_pin = 7,
		.has_shifted_cc_wraparound = true,
		.otp_exe_param = 0x0010000,
		.continuous_frag_desc = true,
		.channel_counters_freq_hz = 125000,
@@ -686,6 +687,9 @@ static void ath10k_core_free_firmware_files(struct ath10k *ar)
	if (!IS_ERR(ar->cal_file))
		release_firmware(ar->cal_file);

	if (!IS_ERR(ar->pre_cal_file))
		release_firmware(ar->pre_cal_file);

	ath10k_swap_code_seg_release(ar);

	ar->normal_mode_fw.fw_file.otp_data = NULL;
@@ -696,6 +700,7 @@ static void ath10k_core_free_firmware_files(struct ath10k *ar)
	ar->normal_mode_fw.fw_file.firmware_len = 0;

	ar->cal_file = NULL;
	ar->pre_cal_file = NULL;
}

static int ath10k_fetch_cal_file(struct ath10k *ar)
@@ -1392,6 +1397,7 @@ static void ath10k_core_restart(struct work_struct *work)
	complete_all(&ar->install_key_done);
	complete_all(&ar->vdev_setup_done);
	complete_all(&ar->thermal.wmi_sync);
	complete_all(&ar->bss_survey_done);
	wake_up(&ar->htt.empty_tx_wq);
	wake_up(&ar->wmi.tx_credits_wq);
	wake_up(&ar->peer_mapping_wq);
@@ -1724,6 +1730,9 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
		if (ath10k_peer_stats_enabled(ar))
			val = WMI_10_4_PEER_STATS;

		if (test_bit(WMI_SERVICE_BSS_CHANNEL_INFO_64, ar->wmi.svc_map))
			val |= WMI_10_4_BSS_CHANNEL_INFO_64;

		status = ath10k_mac_ext_resource_config(ar, val);
		if (status) {
			ath10k_err(ar,
@@ -1758,6 +1767,10 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
		goto err_hif_stop;
	}

	ar->free_vdev_map = (1LL << ar->max_num_vdevs) - 1;

	INIT_LIST_HEAD(&ar->arvifs);

	/* we don't care about HTT in UTF mode */
	if (mode == ATH10K_FIRMWARE_MODE_NORMAL) {
		status = ath10k_htt_setup(&ar->htt);
@@ -1771,10 +1784,6 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
	if (status)
		goto err_hif_stop;

	ar->free_vdev_map = (1LL << ar->max_num_vdevs) - 1;

	INIT_LIST_HEAD(&ar->arvifs);

	return 0;

err_hif_stop:
@@ -2085,6 +2094,7 @@ struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,
	init_completion(&ar->install_key_done);
	init_completion(&ar->vdev_setup_done);
	init_completion(&ar->thermal.wmi_sync);
	init_completion(&ar->bss_survey_done);

	INIT_DELAYED_WORK(&ar->scan.timeout, ath10k_scan_timeout_work);

+2 −2
Original line number Diff line number Diff line
@@ -876,6 +876,7 @@ struct ath10k {
	 * avoid reporting garbage data.
	 */
	bool ch_info_can_report_survey;
	struct completion bss_survey_done;

	struct dfs_pattern_detector *dfs_detector;

@@ -883,8 +884,6 @@ struct ath10k {

#ifdef CONFIG_ATH10K_DEBUGFS
	struct ath10k_debug debug;
#endif

	struct {
		/* relay(fs) channel for spectral scan */
		struct rchan *rfs_chan_spec_scan;
@@ -893,6 +892,7 @@ struct ath10k {
		enum ath10k_spectral_mode mode;
		struct ath10k_spec_scan config;
	} spectral;
#endif

	struct {
		/* protected by conf_mutex */
+36 −4
Original line number Diff line number Diff line
@@ -4278,9 +4278,6 @@ static void ath10k_mac_setup_ht_vht_cap(struct ath10k *ar)
	if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) {
		band = &ar->mac.sbands[NL80211_BAND_2GHZ];
		band->ht_cap = ht_cap;

		/* Enable the VHT support at 2.4 GHz */
		band->vht_cap = vht_cap;
	}
	if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) {
		band = &ar->mac.sbands[NL80211_BAND_5GHZ];
@@ -4346,7 +4343,7 @@ static int ath10k_start(struct ieee80211_hw *hw)

	/*
	 * This makes sense only when restarting hw. It is harmless to call
	 * uncoditionally. This is necessary to make sure no HTT/WMI tx
	 * unconditionally. This is necessary to make sure no HTT/WMI tx
	 * commands will be submitted while restarting.
	 */
	ath10k_drain_tx(ar);
@@ -6407,6 +6404,39 @@ static void ath10k_reconfig_complete(struct ieee80211_hw *hw,
	mutex_unlock(&ar->conf_mutex);
}

static void
ath10k_mac_update_bss_chan_survey(struct ath10k *ar,
				  struct ieee80211_channel *channel)
{
	int ret;
	enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ_CLEAR;

	lockdep_assert_held(&ar->conf_mutex);

	if (!test_bit(WMI_SERVICE_BSS_CHANNEL_INFO_64, ar->wmi.svc_map) ||
	    (ar->rx_channel != channel))
		return;

	if (ar->scan.state != ATH10K_SCAN_IDLE) {
		ath10k_dbg(ar, ATH10K_DBG_MAC, "ignoring bss chan info request while scanning..\n");
		return;
	}

	reinit_completion(&ar->bss_survey_done);

	ret = ath10k_wmi_pdev_bss_chan_info_request(ar, type);
	if (ret) {
		ath10k_warn(ar, "failed to send pdev bss chan info request\n");
		return;
	}

	ret = wait_for_completion_timeout(&ar->bss_survey_done, 3 * HZ);
	if (!ret) {
		ath10k_warn(ar, "bss channel survey timed out\n");
		return;
	}
}

static int ath10k_get_survey(struct ieee80211_hw *hw, int idx,
			     struct survey_info *survey)
{
@@ -6431,6 +6461,8 @@ static int ath10k_get_survey(struct ieee80211_hw *hw, int idx,
		goto exit;
	}

	ath10k_mac_update_bss_chan_survey(ar, survey->channel);

	spin_lock_bh(&ar->data_lock);
	memcpy(survey, ar_survey, sizeof(*survey));
	spin_unlock_bh(&ar->data_lock);
+21 −0
Original line number Diff line number Diff line
@@ -191,6 +191,9 @@ struct wmi_ops {
					       u32 fw_feature_bitmap);
	int (*get_vdev_subtype)(struct ath10k *ar,
				enum wmi_vdev_subtype subtype);
	struct sk_buff *(*gen_pdev_bss_chan_info_req)
					(struct ath10k *ar,
					 enum wmi_bss_survey_req_type type);
};

int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id);
@@ -1361,4 +1364,22 @@ ath10k_wmi_get_vdev_subtype(struct ath10k *ar, enum wmi_vdev_subtype subtype)
	return ar->wmi.ops->get_vdev_subtype(ar, subtype);
}

static inline int
ath10k_wmi_pdev_bss_chan_info_request(struct ath10k *ar,
				      enum wmi_bss_survey_req_type type)
{
	struct ath10k_wmi *wmi = &ar->wmi;
	struct sk_buff *skb;

	if (!wmi->ops->gen_pdev_bss_chan_info_req)
		return -EOPNOTSUPP;

	skb = wmi->ops->gen_pdev_bss_chan_info_req(ar, type);
	if (IS_ERR(skb))
		return PTR_ERR(skb);

	return ath10k_wmi_cmd_send(ar, skb,
				   wmi->cmd->pdev_bss_chan_info_request_cmdid);
}

#endif
+87 −1
Original line number Diff line number Diff line
@@ -521,7 +521,8 @@ static struct wmi_cmd_map wmi_10_2_4_cmd_map = {
	.vdev_filter_neighbor_rx_packets_cmdid = WMI_CMD_UNSUPPORTED,
	.mu_cal_start_cmdid = WMI_CMD_UNSUPPORTED,
	.set_cca_params_cmdid = WMI_CMD_UNSUPPORTED,
	.pdev_bss_chan_info_request_cmdid = WMI_CMD_UNSUPPORTED,
	.pdev_bss_chan_info_request_cmdid =
		WMI_10_2_PDEV_BSS_CHAN_INFO_REQUEST_CMDID,
};

/* 10.4 WMI cmd track */
@@ -1633,6 +1634,7 @@ void ath10k_wmi_put_wmi_channel(struct wmi_channel *ch,
	ch->max_power = arg->max_power;
	ch->reg_power = arg->max_reg_power;
	ch->antenna_max = arg->max_antenna_gain;
	ch->max_tx_power = arg->max_power;

	/* mode & flags share storage */
	ch->mode = arg->mode;
@@ -4792,6 +4794,58 @@ static int ath10k_wmi_event_temperature(struct ath10k *ar, struct sk_buff *skb)
	return 0;
}

static int ath10k_wmi_event_pdev_bss_chan_info(struct ath10k *ar,
					       struct sk_buff *skb)
{
	struct wmi_pdev_bss_chan_info_event *ev;
	struct survey_info *survey;
	u64 busy, total, tx, rx, rx_bss;
	u32 freq, noise_floor;
	u32 cc_freq_hz = ar->hw_params.channel_counters_freq_hz;
	int idx;

	ev = (struct wmi_pdev_bss_chan_info_event *)skb->data;
	if (WARN_ON(skb->len < sizeof(*ev)))
		return -EPROTO;

	freq        = __le32_to_cpu(ev->freq);
	noise_floor = __le32_to_cpu(ev->noise_floor);
	busy        = __le64_to_cpu(ev->cycle_busy);
	total       = __le64_to_cpu(ev->cycle_total);
	tx          = __le64_to_cpu(ev->cycle_tx);
	rx          = __le64_to_cpu(ev->cycle_rx);
	rx_bss      = __le64_to_cpu(ev->cycle_rx_bss);

	ath10k_dbg(ar, ATH10K_DBG_WMI,
		   "wmi event pdev bss chan info:\n freq: %d noise: %d cycle: busy %llu total %llu tx %llu rx %llu rx_bss %llu\n",
		   freq, noise_floor, busy, total, tx, rx, rx_bss);

	spin_lock_bh(&ar->data_lock);
	idx = freq_to_idx(ar, freq);
	if (idx >= ARRAY_SIZE(ar->survey)) {
		ath10k_warn(ar, "bss chan info: invalid frequency %d (idx %d out of bounds)\n",
			    freq, idx);
		goto exit;
	}

	survey = &ar->survey[idx];

	survey->noise     = noise_floor;
	survey->time      = div_u64(total, cc_freq_hz);
	survey->time_busy = div_u64(busy, cc_freq_hz);
	survey->time_rx   = div_u64(rx_bss, cc_freq_hz);
	survey->time_tx   = div_u64(tx, cc_freq_hz);
	survey->filled   |= (SURVEY_INFO_NOISE_DBM |
			     SURVEY_INFO_TIME |
			     SURVEY_INFO_TIME_BUSY |
			     SURVEY_INFO_TIME_RX |
			     SURVEY_INFO_TIME_TX);
exit:
	spin_unlock_bh(&ar->data_lock);
	complete(&ar->bss_survey_done);
	return 0;
}

static void ath10k_wmi_op_rx(struct ath10k *ar, struct sk_buff *skb)
{
	struct wmi_cmd_hdr *cmd_hdr;
@@ -5135,6 +5189,9 @@ static void ath10k_wmi_10_2_op_rx(struct ath10k *ar, struct sk_buff *skb)
	case WMI_10_2_PDEV_TEMPERATURE_EVENTID:
		ath10k_wmi_event_temperature(ar, skb);
		break;
	case WMI_10_2_PDEV_BSS_CHAN_INFO_EVENTID:
		ath10k_wmi_event_pdev_bss_chan_info(ar, skb);
		break;
	case WMI_10_2_RTT_KEEPALIVE_EVENTID:
	case WMI_10_2_GPIO_INPUT_EVENTID:
	case WMI_10_2_PEER_RATECODE_LIST_EVENTID:
@@ -5212,6 +5269,7 @@ static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, struct sk_buff *skb)
		ath10k_wmi_event_vdev_stopped(ar, skb);
		break;
	case WMI_10_4_WOW_WAKEUP_HOST_EVENTID:
	case WMI_10_4_PEER_RATECODE_LIST_EVENTID:
		ath10k_dbg(ar, ATH10K_DBG_WMI,
			   "received event id %d not implemented\n", id);
		break;
@@ -5221,6 +5279,9 @@ static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, struct sk_buff *skb)
	case WMI_10_4_PDEV_TEMPERATURE_EVENTID:
		ath10k_wmi_event_temperature(ar, skb);
		break;
	case WMI_10_4_PDEV_BSS_CHAN_INFO_EVENTID:
		ath10k_wmi_event_pdev_bss_chan_info(ar, skb);
		break;
	default:
		ath10k_warn(ar, "Unknown eventid: %d\n", id);
		break;
@@ -5606,6 +5667,9 @@ static struct sk_buff *ath10k_wmi_10_2_op_gen_init(struct ath10k *ar)
	if (ath10k_peer_stats_enabled(ar))
		features |= WMI_10_2_PEER_STATS;

	if (test_bit(WMI_SERVICE_BSS_CHANNEL_INFO_64, ar->wmi.svc_map))
		features |= WMI_10_2_BSS_CHAN_INFO;

	cmd->resource_config.feature_mask = __cpu_to_le32(features);

	memcpy(&cmd->resource_config.common, &config, sizeof(config));
@@ -6636,6 +6700,26 @@ ath10k_wmi_10_2_op_gen_pdev_get_temperature(struct ath10k *ar)
	return skb;
}

static struct sk_buff *
ath10k_wmi_10_2_op_gen_pdev_bss_chan_info(struct ath10k *ar,
					  enum wmi_bss_survey_req_type type)
{
	struct wmi_pdev_chan_info_req_cmd *cmd;
	struct sk_buff *skb;

	skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
	if (!skb)
		return ERR_PTR(-ENOMEM);

	cmd = (struct wmi_pdev_chan_info_req_cmd *)skb->data;
	cmd->type = __cpu_to_le32(type);

	ath10k_dbg(ar, ATH10K_DBG_WMI,
		   "wmi pdev bss info request type %d\n", type);

	return skb;
}

/* This function assumes the beacon is already DMA mapped */
static struct sk_buff *
ath10k_wmi_op_gen_beacon_dma(struct ath10k *ar, u32 vdev_id, const void *bcn,
@@ -7735,6 +7819,7 @@ static const struct wmi_ops wmi_10_2_4_ops = {
	.gen_init = ath10k_wmi_10_2_op_gen_init,
	.gen_peer_assoc = ath10k_wmi_10_2_op_gen_peer_assoc,
	.gen_pdev_get_temperature = ath10k_wmi_10_2_op_gen_pdev_get_temperature,
	.gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,

	/* shared with 10.1 */
	.map_svc = wmi_10x_svc_map,
@@ -7861,6 +7946,7 @@ static const struct wmi_ops wmi_10_4_ops = {
	.gen_request_stats = ath10k_wmi_op_gen_request_stats,
	.gen_pdev_get_temperature = ath10k_wmi_10_2_op_gen_pdev_get_temperature,
	.get_vdev_subtype = ath10k_wmi_10_4_op_get_vdev_subtype,
	.gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,
};

int ath10k_wmi_attach(struct ath10k *ar)
Loading