Commit 78562b2c authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau
Browse files

wifi: mt76: mt7921: rename mt7921_phy in mt792x_phy



This is a preliminary patch to introduce WiFi7 chipset support

Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarDeren Wu <deren.wu@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent b7bfad2c
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ int mt7921_init_acpi_sar(struct mt7921_dev *dev)
}

static s8
mt7921_asar_get_geo_pwr(struct mt7921_phy *phy,
mt7921_asar_get_geo_pwr(struct mt792x_phy *phy,
			enum nl80211_band band, s8 dyn_power)
{
	struct mt7921_acpi_sar *asar = phy->acpisar;
@@ -248,7 +248,7 @@ mt7921_asar_get_geo_pwr(struct mt7921_phy *phy,
}

static s8
mt7921_asar_range_pwr(struct mt7921_phy *phy,
mt7921_asar_range_pwr(struct mt792x_phy *phy,
		      const struct cfg80211_sar_freq_ranges *range,
		      u8 idx)
{
@@ -280,7 +280,7 @@ mt7921_asar_range_pwr(struct mt7921_phy *phy,
	return mt7921_asar_get_geo_pwr(phy, band, limit[idx]);
}

int mt7921_init_acpi_sar_power(struct mt7921_phy *phy, bool set_default)
int mt7921_init_acpi_sar_power(struct mt792x_phy *phy, bool set_default)
{
	const struct cfg80211_sar_capa *capa = phy->mt76->hw->wiphy->sar_capa;
	int i;
@@ -306,7 +306,7 @@ int mt7921_init_acpi_sar_power(struct mt7921_phy *phy, bool set_default)
	return 0;
}

u8 mt7921_acpi_get_flags(struct mt7921_phy *phy)
u8 mt7921_acpi_get_flags(struct mt792x_phy *phy)
{
	struct mt7921_acpi_sar *acpisar = phy->acpisar;
	struct mt7921_asar_fg *fg;
+2 −2
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(fops_fw_debug, mt7921_fw_debug_get,
			 mt7921_fw_debug_set, "%lld\n");

static void
mt7921_ampdu_stat_read_phy(struct mt7921_phy *phy,
mt7921_ampdu_stat_read_phy(struct mt792x_phy *phy,
			   struct seq_file *file)
{
	struct mt7921_dev *dev = file->private;
@@ -94,7 +94,7 @@ static int
mt7921_tx_stats_show(struct seq_file *file, void *data)
{
	struct mt7921_dev *dev = file->private;
	struct mt7921_phy *phy = &dev->phy;
	struct mt792x_phy *phy = &dev->phy;
	struct mt76_mib_stats *mib = &phy->mib;
	int i;

+3 −3
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ static ssize_t mt7921_thermal_temp_show(struct device *dev,
{
	switch (to_sensor_dev_attr(attr)->index) {
	case 0: {
		struct mt7921_phy *phy = dev_get_drvdata(dev);
		struct mt792x_phy *phy = dev_get_drvdata(dev);
		struct mt7921_dev *mdev = phy->dev;
		int temperature;

@@ -85,7 +85,7 @@ static struct attribute *mt7921_hwmon_attrs[] = {
};
ATTRIBUTE_GROUPS(mt7921_hwmon);

static int mt7921_thermal_init(struct mt7921_phy *phy)
static int mt7921_thermal_init(struct mt792x_phy *phy)
{
	struct wiphy *wiphy = phy->mt76->hw->wiphy;
	struct device *hwmon;
@@ -126,7 +126,7 @@ mt7921_regd_notifier(struct wiphy *wiphy,
static int
mt7921_init_wiphy(struct ieee80211_hw *hw)
{
	struct mt7921_phy *phy = mt7921_hw_phy(hw);
	struct mt792x_phy *phy = mt7921_hw_phy(hw);
	struct mt7921_dev *dev = phy->dev;
	struct wiphy *wiphy = hw->wiphy;

+7 −7
Original line number Diff line number Diff line
@@ -240,7 +240,7 @@ mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb)
	u16 hdr_gap;
	__le32 *rxv = NULL, *rxd = (__le32 *)skb->data;
	struct mt76_phy *mphy = &dev->mt76.phy;
	struct mt7921_phy *phy = &dev->phy;
	struct mt792x_phy *phy = &dev->phy;
	struct ieee80211_supported_band *sband;
	u32 csum_status = *(u32 *)skb->cb;
	u32 rxd0 = le32_to_cpu(rxd[0]);
@@ -699,7 +699,7 @@ void mt7921_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
}
EXPORT_SYMBOL_GPL(mt7921_queue_rx_skb);

void mt7921_mac_reset_counters(struct mt7921_phy *phy)
void mt7921_mac_reset_counters(struct mt792x_phy *phy)
{
	struct mt7921_dev *dev = phy->dev;
	int i;
@@ -721,7 +721,7 @@ void mt7921_mac_reset_counters(struct mt7921_phy *phy)
	mt76_set(dev, MT_WF_RMAC_MIB_AIRTIME0(0), MT_WF_RMAC_MIB_RXTIME_CLR);
}

void mt7921_mac_set_timing(struct mt7921_phy *phy)
void mt7921_mac_set_timing(struct mt792x_phy *phy)
{
	s16 coverage_class = phy->coverage_class;
	struct mt7921_dev *dev = phy->dev;
@@ -763,7 +763,7 @@ void mt7921_mac_set_timing(struct mt7921_phy *phy)
}

static u8
mt7921_phy_get_nf(struct mt7921_phy *phy, int idx)
mt7921_phy_get_nf(struct mt792x_phy *phy, int idx)
{
	return 0;
}
@@ -772,7 +772,7 @@ static void
mt7921_phy_update_channel(struct mt76_phy *mphy, int idx)
{
	struct mt7921_dev *dev = container_of(mphy->dev, struct mt7921_dev, mt76);
	struct mt7921_phy *phy = (struct mt7921_phy *)mphy->priv;
	struct mt792x_phy *phy = (struct mt792x_phy *)mphy->priv;
	struct mt76_channel_state *state;
	u64 busy_time, tx_time, rx_time, obss_time;
	int nf;
@@ -902,7 +902,7 @@ void mt7921_reset(struct mt76_dev *mdev)
}
EXPORT_SYMBOL_GPL(mt7921_reset);

void mt7921_mac_update_mib_stats(struct mt7921_phy *phy)
void mt7921_mac_update_mib_stats(struct mt792x_phy *phy)
{
	struct mt76_mib_stats *mib = &phy->mib;
	struct mt7921_dev *dev = phy->dev;
@@ -964,7 +964,7 @@ void mt7921_mac_update_mib_stats(struct mt7921_phy *phy)

void mt7921_mac_work(struct work_struct *work)
{
	struct mt7921_phy *phy;
	struct mt792x_phy *phy;
	struct mt76_phy *mphy;

	mphy = (struct mt76_phy *)container_of(work, struct mt76_phy,
+29 −29
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@
#include "mcu.h"

static int
mt7921_init_he_caps(struct mt7921_phy *phy, enum nl80211_band band,
mt7921_init_he_caps(struct mt792x_phy *phy, enum nl80211_band band,
		    struct ieee80211_sband_iftype_data *data)
{
	int i, idx = 0;
@@ -185,7 +185,7 @@ mt7921_init_he_caps(struct mt7921_phy *phy, enum nl80211_band band,
	return idx;
}

void mt7921_set_stream_he_caps(struct mt7921_phy *phy)
void mt7921_set_stream_he_caps(struct mt792x_phy *phy)
{
	struct ieee80211_sband_iftype_data *data;
	struct ieee80211_supported_band *band;
@@ -219,7 +219,7 @@ void mt7921_set_stream_he_caps(struct mt7921_phy *phy)
	}
}

int __mt7921_start(struct mt7921_phy *phy)
int __mt7921_start(struct mt792x_phy *phy)
{
	struct mt76_phy *mphy = phy->mt76;
	int err;
@@ -252,7 +252,7 @@ EXPORT_SYMBOL_GPL(__mt7921_start);

static int mt7921_start(struct ieee80211_hw *hw)
{
	struct mt7921_phy *phy = mt7921_hw_phy(hw);
	struct mt792x_phy *phy = mt7921_hw_phy(hw);
	int err;

	mt7921_mutex_acquire(phy->dev);
@@ -265,7 +265,7 @@ static int mt7921_start(struct ieee80211_hw *hw)
void mt7921_stop(struct ieee80211_hw *hw)
{
	struct mt7921_dev *dev = mt7921_hw_dev(hw);
	struct mt7921_phy *phy = mt7921_hw_phy(hw);
	struct mt792x_phy *phy = mt7921_hw_phy(hw);

	cancel_delayed_work_sync(&phy->mt76->mac_work);

@@ -286,7 +286,7 @@ static int mt7921_add_interface(struct ieee80211_hw *hw,
{
	struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
	struct mt7921_dev *dev = mt7921_hw_dev(hw);
	struct mt7921_phy *phy = mt7921_hw_phy(hw);
	struct mt792x_phy *phy = mt7921_hw_phy(hw);
	struct mt76_txq *mtxq;
	int idx, ret = 0;

@@ -344,7 +344,7 @@ static void mt7921_remove_interface(struct ieee80211_hw *hw,
	struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
	struct mt792x_sta *msta = &mvif->sta;
	struct mt7921_dev *dev = mt7921_hw_dev(hw);
	struct mt7921_phy *phy = mt7921_hw_phy(hw);
	struct mt792x_phy *phy = mt7921_hw_phy(hw);
	int idx = msta->wcid.idx;

	mt7921_mutex_acquire(dev);
@@ -369,16 +369,16 @@ static void mt7921_roc_iter(void *priv, u8 *mac,
			    struct ieee80211_vif *vif)
{
	struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
	struct mt7921_phy *phy = priv;
	struct mt792x_phy *phy = priv;

	mt7921_mcu_abort_roc(phy, mvif, phy->roc_token_id);
}

void mt7921_roc_work(struct work_struct *work)
{
	struct mt7921_phy *phy;
	struct mt792x_phy *phy;

	phy = (struct mt7921_phy *)container_of(work, struct mt7921_phy,
	phy = (struct mt792x_phy *)container_of(work, struct mt792x_phy,
						roc_work);

	if (!test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state))
@@ -394,12 +394,12 @@ void mt7921_roc_work(struct work_struct *work)

void mt7921_roc_timer(struct timer_list *timer)
{
	struct mt7921_phy *phy = from_timer(phy, timer, roc_timer);
	struct mt792x_phy *phy = from_timer(phy, timer, roc_timer);

	ieee80211_queue_work(phy->mt76->hw, &phy->roc_work);
}

static int mt7921_abort_roc(struct mt7921_phy *phy, struct mt792x_vif *vif)
static int mt7921_abort_roc(struct mt792x_phy *phy, struct mt792x_vif *vif)
{
	int err = 0;

@@ -414,7 +414,7 @@ static int mt7921_abort_roc(struct mt7921_phy *phy, struct mt792x_vif *vif)
	return err;
}

static int mt7921_set_roc(struct mt7921_phy *phy,
static int mt7921_set_roc(struct mt792x_phy *phy,
			  struct mt792x_vif *vif,
			  struct ieee80211_channel *chan,
			  int duration,
@@ -451,7 +451,7 @@ static int mt7921_remain_on_channel(struct ieee80211_hw *hw,
				    enum ieee80211_roc_type type)
{
	struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
	struct mt7921_phy *phy = mt7921_hw_phy(hw);
	struct mt792x_phy *phy = mt7921_hw_phy(hw);
	int err;

	mt7921_mutex_acquire(phy->dev);
@@ -465,12 +465,12 @@ static int mt7921_cancel_remain_on_channel(struct ieee80211_hw *hw,
					   struct ieee80211_vif *vif)
{
	struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
	struct mt7921_phy *phy = mt7921_hw_phy(hw);
	struct mt792x_phy *phy = mt7921_hw_phy(hw);

	return mt7921_abort_roc(phy, mvif);
}

static int mt7921_set_channel(struct mt7921_phy *phy)
static int mt7921_set_channel(struct mt792x_phy *phy)
{
	struct mt7921_dev *dev = phy->dev;
	int ret;
@@ -631,7 +631,7 @@ void mt7921_set_runtime_pm(struct mt7921_dev *dev)
static int mt7921_config(struct ieee80211_hw *hw, u32 changed)
{
	struct mt7921_dev *dev = mt7921_hw_dev(hw);
	struct mt7921_phy *phy = mt7921_hw_phy(hw);
	struct mt792x_phy *phy = mt7921_hw_phy(hw);
	int ret = 0;

	if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
@@ -710,7 +710,7 @@ static void mt7921_bss_info_changed(struct ieee80211_hw *hw,
				    struct ieee80211_bss_conf *info,
				    u64 changed)
{
	struct mt7921_phy *phy = mt7921_hw_phy(hw);
	struct mt792x_phy *phy = mt7921_hw_phy(hw);
	struct mt7921_dev *dev = mt7921_hw_dev(hw);

	mt7921_mutex_acquire(dev);
@@ -994,7 +994,7 @@ static int
mt7921_get_stats(struct ieee80211_hw *hw,
		 struct ieee80211_low_level_stats *stats)
{
	struct mt7921_phy *phy = mt7921_hw_phy(hw);
	struct mt792x_phy *phy = mt7921_hw_phy(hw);
	struct mt76_mib_stats *mib = &phy->mib;

	mt7921_mutex_acquire(phy->dev);
@@ -1135,7 +1135,7 @@ void mt7921_get_et_stats(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
{
	struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
	int stats_size = ARRAY_SIZE(mt7921_gstrings_stats);
	struct mt7921_phy *phy = mt7921_hw_phy(hw);
	struct mt792x_phy *phy = mt7921_hw_phy(hw);
	struct mt7921_dev *dev = phy->dev;
	struct mt76_mib_stats *mib = &phy->mib;
	struct mt76_ethtool_worker_info wi = {
@@ -1252,7 +1252,7 @@ mt7921_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
static void
mt7921_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
{
	struct mt7921_phy *phy = mt7921_hw_phy(hw);
	struct mt792x_phy *phy = mt7921_hw_phy(hw);
	struct mt7921_dev *dev = phy->dev;

	mt7921_mutex_acquire(dev);
@@ -1263,9 +1263,9 @@ mt7921_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)

void mt7921_scan_work(struct work_struct *work)
{
	struct mt7921_phy *phy;
	struct mt792x_phy *phy;

	phy = (struct mt7921_phy *)container_of(work, struct mt7921_phy,
	phy = (struct mt792x_phy *)container_of(work, struct mt792x_phy,
						scan_work.work);

	while (true) {
@@ -1360,7 +1360,7 @@ static int
mt7921_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
{
	struct mt7921_dev *dev = mt7921_hw_dev(hw);
	struct mt7921_phy *phy = mt7921_hw_phy(hw);
	struct mt792x_phy *phy = mt7921_hw_phy(hw);
	int max_nss = hweight8(hw->wiphy->available_antennas_tx);

	if (!tx_ant || tx_ant != rx_ant || ffs(tx_ant) > max_nss)
@@ -1424,7 +1424,7 @@ static int mt7921_suspend(struct ieee80211_hw *hw,
			  struct cfg80211_wowlan *wowlan)
{
	struct mt7921_dev *dev = mt7921_hw_dev(hw);
	struct mt7921_phy *phy = mt7921_hw_phy(hw);
	struct mt792x_phy *phy = mt7921_hw_phy(hw);

	cancel_delayed_work_sync(&phy->scan_work);
	cancel_delayed_work_sync(&phy->mt76->mac_work);
@@ -1448,7 +1448,7 @@ static int mt7921_suspend(struct ieee80211_hw *hw,
static int mt7921_resume(struct ieee80211_hw *hw)
{
	struct mt7921_dev *dev = mt7921_hw_dev(hw);
	struct mt7921_phy *phy = mt7921_hw_phy(hw);
	struct mt792x_phy *phy = mt7921_hw_phy(hw);

	mt7921_mutex_acquire(dev);

@@ -1631,7 +1631,7 @@ mt7921_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
		struct ieee80211_bss_conf *link_conf)
{
	struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
	struct mt7921_phy *phy = mt7921_hw_phy(hw);
	struct mt792x_phy *phy = mt7921_hw_phy(hw);
	struct mt7921_dev *dev = mt7921_hw_dev(hw);
	int err;

@@ -1659,7 +1659,7 @@ mt7921_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
	       struct ieee80211_bss_conf *link_conf)
{
	struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
	struct mt7921_phy *phy = mt7921_hw_phy(hw);
	struct mt792x_phy *phy = mt7921_hw_phy(hw);
	struct mt7921_dev *dev = mt7921_hw_dev(hw);
	int err;

@@ -1709,7 +1709,7 @@ mt7921_change_chanctx(struct ieee80211_hw *hw,
		      struct ieee80211_chanctx_conf *ctx,
		      u32 changed)
{
	struct mt7921_phy *phy = mt7921_hw_phy(hw);
	struct mt792x_phy *phy = mt7921_hw_phy(hw);

	mt7921_mutex_acquire(phy->dev);
	ieee80211_iterate_active_interfaces(phy->mt76->hw,
Loading