Commit c605d0ce authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

wifi: mt76: mt7921: move mt792x_mutex_{acquire/release} in mt792x.h

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 1c42e0f2
...@@ -8,9 +8,9 @@ mt7921_reg_set(void *data, u64 val) ...@@ -8,9 +8,9 @@ mt7921_reg_set(void *data, u64 val)
{ {
struct mt792x_dev *dev = data; struct mt792x_dev *dev = data;
mt7921_mutex_acquire(dev); mt792x_mutex_acquire(dev);
mt76_wr(dev, dev->mt76.debugfs_reg, val); mt76_wr(dev, dev->mt76.debugfs_reg, val);
mt7921_mutex_release(dev); mt792x_mutex_release(dev);
return 0; return 0;
} }
...@@ -20,9 +20,9 @@ mt7921_reg_get(void *data, u64 *val) ...@@ -20,9 +20,9 @@ mt7921_reg_get(void *data, u64 *val)
{ {
struct mt792x_dev *dev = data; struct mt792x_dev *dev = data;
mt7921_mutex_acquire(dev); mt792x_mutex_acquire(dev);
*val = mt76_rr(dev, dev->mt76.debugfs_reg); *val = mt76_rr(dev, dev->mt76.debugfs_reg);
mt7921_mutex_release(dev); mt792x_mutex_release(dev);
return 0; return 0;
} }
...@@ -34,12 +34,12 @@ mt7921_fw_debug_set(void *data, u64 val) ...@@ -34,12 +34,12 @@ mt7921_fw_debug_set(void *data, u64 val)
{ {
struct mt792x_dev *dev = data; struct mt792x_dev *dev = data;
mt7921_mutex_acquire(dev); mt792x_mutex_acquire(dev);
dev->fw_debug = (u8)val; dev->fw_debug = (u8)val;
mt7921_mcu_fw_log_2_host(dev, dev->fw_debug); mt7921_mcu_fw_log_2_host(dev, dev->fw_debug);
mt7921_mutex_release(dev); mt792x_mutex_release(dev);
return 0; return 0;
} }
...@@ -98,7 +98,7 @@ mt7921_tx_stats_show(struct seq_file *file, void *data) ...@@ -98,7 +98,7 @@ mt7921_tx_stats_show(struct seq_file *file, void *data)
struct mt76_mib_stats *mib = &phy->mib; struct mt76_mib_stats *mib = &phy->mib;
int i; int i;
mt7921_mutex_acquire(dev); mt792x_mutex_acquire(dev);
mt7921_ampdu_stat_read_phy(phy, file); mt7921_ampdu_stat_read_phy(phy, file);
...@@ -113,7 +113,7 @@ mt7921_tx_stats_show(struct seq_file *file, void *data) ...@@ -113,7 +113,7 @@ mt7921_tx_stats_show(struct seq_file *file, void *data)
seq_puts(file, "\n"); seq_puts(file, "\n");
} }
mt7921_mutex_release(dev); mt792x_mutex_release(dev);
return 0; return 0;
} }
...@@ -126,7 +126,7 @@ mt7921_queues_acq(struct seq_file *s, void *data) ...@@ -126,7 +126,7 @@ mt7921_queues_acq(struct seq_file *s, void *data)
struct mt792x_dev *dev = dev_get_drvdata(s->private); struct mt792x_dev *dev = dev_get_drvdata(s->private);
int i; int i;
mt7921_mutex_acquire(dev); mt792x_mutex_acquire(dev);
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
u32 ctrl, val, qlen = 0; u32 ctrl, val, qlen = 0;
...@@ -146,7 +146,7 @@ mt7921_queues_acq(struct seq_file *s, void *data) ...@@ -146,7 +146,7 @@ mt7921_queues_acq(struct seq_file *s, void *data)
seq_printf(s, "AC%d: queued=%d\n", i, qlen); seq_printf(s, "AC%d: queued=%d\n", i, qlen);
} }
mt7921_mutex_release(dev); mt792x_mutex_release(dev);
return 0; return 0;
} }
...@@ -215,9 +215,9 @@ mt7921_txpwr(struct seq_file *s, void *data) ...@@ -215,9 +215,9 @@ mt7921_txpwr(struct seq_file *s, void *data)
struct mt7921_txpwr txpwr; struct mt7921_txpwr txpwr;
int ret; int ret;
mt7921_mutex_acquire(dev); mt792x_mutex_acquire(dev);
ret = mt7921_get_txpwr_info(dev, &txpwr); ret = mt7921_get_txpwr_info(dev, &txpwr);
mt7921_mutex_release(dev); mt792x_mutex_release(dev);
if (ret) if (ret)
return ret; return ret;
...@@ -316,7 +316,7 @@ mt7921_deep_sleep_set(void *data, u64 val) ...@@ -316,7 +316,7 @@ mt7921_deep_sleep_set(void *data, u64 val)
if (mt76_is_usb(&dev->mt76)) if (mt76_is_usb(&dev->mt76))
return -EOPNOTSUPP; return -EOPNOTSUPP;
mt7921_mutex_acquire(dev); mt792x_mutex_acquire(dev);
if (pm->ds_enable_user == enable) if (pm->ds_enable_user == enable)
goto out; goto out;
...@@ -324,7 +324,7 @@ mt7921_deep_sleep_set(void *data, u64 val) ...@@ -324,7 +324,7 @@ mt7921_deep_sleep_set(void *data, u64 val)
pm->ds_enable = enable && !monitor; pm->ds_enable = enable && !monitor;
mt76_connac_mcu_set_deep_sleep(&dev->mt76, pm->ds_enable); mt76_connac_mcu_set_deep_sleep(&dev->mt76, pm->ds_enable);
out: out:
mt7921_mutex_release(dev); mt792x_mutex_release(dev);
return 0; return 0;
} }
...@@ -400,9 +400,9 @@ static int mt7921_chip_reset(void *data, u64 val) ...@@ -400,9 +400,9 @@ static int mt7921_chip_reset(void *data, u64 val)
break; break;
default: default:
/* Collect the core dump before reset wifisys. */ /* Collect the core dump before reset wifisys. */
mt7921_mutex_acquire(dev); mt792x_mutex_acquire(dev);
ret = mt76_connac_mcu_chip_config(&dev->mt76); ret = mt76_connac_mcu_chip_config(&dev->mt76);
mt7921_mutex_release(dev); mt792x_mutex_release(dev);
break; break;
} }
......
...@@ -64,9 +64,9 @@ static ssize_t mt7921_thermal_temp_show(struct device *dev, ...@@ -64,9 +64,9 @@ static ssize_t mt7921_thermal_temp_show(struct device *dev,
struct mt792x_dev *mdev = phy->dev; struct mt792x_dev *mdev = phy->dev;
int temperature; int temperature;
mt7921_mutex_acquire(mdev); mt792x_mutex_acquire(mdev);
temperature = mt7921_mcu_get_temperature(phy); temperature = mt7921_mcu_get_temperature(phy);
mt7921_mutex_release(mdev); mt792x_mutex_release(mdev);
if (temperature < 0) if (temperature < 0)
return temperature; return temperature;
...@@ -116,11 +116,11 @@ mt7921_regd_notifier(struct wiphy *wiphy, ...@@ -116,11 +116,11 @@ mt7921_regd_notifier(struct wiphy *wiphy,
dev->mt76.region = request->dfs_region; dev->mt76.region = request->dfs_region;
dev->country_ie_env = request->country_ie_env; dev->country_ie_env = request->country_ie_env;
mt7921_mutex_acquire(dev); mt792x_mutex_acquire(dev);
mt7921_mcu_set_clc(dev, request->alpha2, request->country_ie_env); mt7921_mcu_set_clc(dev, request->alpha2, request->country_ie_env);
mt76_connac_mcu_set_channel_domain(hw->priv); mt76_connac_mcu_set_channel_domain(hw->priv);
mt7921_set_tx_sar_pwr(hw, NULL); mt7921_set_tx_sar_pwr(hw, NULL);
mt7921_mutex_release(dev); mt792x_mutex_release(dev);
} }
static int static int
......
...@@ -971,7 +971,7 @@ void mt7921_mac_work(struct work_struct *work) ...@@ -971,7 +971,7 @@ void mt7921_mac_work(struct work_struct *work)
mac_work.work); mac_work.work);
phy = mphy->priv; phy = mphy->priv;
mt7921_mutex_acquire(phy->dev); mt792x_mutex_acquire(phy->dev);
mt76_update_survey(mphy); mt76_update_survey(mphy);
if (++mphy->mac_work_count == 2) { if (++mphy->mac_work_count == 2) {
...@@ -980,7 +980,7 @@ void mt7921_mac_work(struct work_struct *work) ...@@ -980,7 +980,7 @@ void mt7921_mac_work(struct work_struct *work)
mt7921_mac_update_mib_stats(phy); mt7921_mac_update_mib_stats(phy);
} }
mt7921_mutex_release(phy->dev); mt792x_mutex_release(phy->dev);
mt76_tx_status_check(mphy->dev, false); mt76_tx_status_check(mphy->dev, false);
ieee80211_queue_delayed_work(phy->mt76->hw, &mphy->mac_work, ieee80211_queue_delayed_work(phy->mt76->hw, &mphy->mac_work,
...@@ -1191,9 +1191,9 @@ bool mt7921_usb_sdio_tx_status_data(struct mt76_dev *mdev, u8 *update) ...@@ -1191,9 +1191,9 @@ bool mt7921_usb_sdio_tx_status_data(struct mt76_dev *mdev, u8 *update)
{ {
struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
mt7921_mutex_acquire(dev); mt792x_mutex_acquire(dev);
mt7921_mac_sta_poll(dev); mt7921_mac_sta_poll(dev);
mt7921_mutex_release(dev); mt792x_mutex_release(dev);
return false; return false;
} }
...@@ -1213,10 +1213,10 @@ void mt7921_set_ipv6_ns_work(struct work_struct *work) ...@@ -1213,10 +1213,10 @@ void mt7921_set_ipv6_ns_work(struct work_struct *work)
if (!skb) if (!skb)
break; break;
mt7921_mutex_acquire(dev); mt792x_mutex_acquire(dev);
ret = mt76_mcu_skb_send_msg(&dev->mt76, skb, ret = mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_UNI_CMD(OFFLOAD), true); MCU_UNI_CMD(OFFLOAD), true);
mt7921_mutex_release(dev); mt792x_mutex_release(dev);
} while (!ret); } while (!ret);
......
...@@ -224,11 +224,6 @@ mt7921_hw_dev(struct ieee80211_hw *hw) ...@@ -224,11 +224,6 @@ mt7921_hw_dev(struct ieee80211_hw *hw)
return container_of(phy->dev, struct mt792x_dev, mt76); return container_of(phy->dev, struct mt792x_dev, mt76);
} }
#define mt7921_mutex_acquire(dev) \
mt76_connac_mutex_acquire(&(dev)->mt76, &(dev)->pm)
#define mt7921_mutex_release(dev) \
mt76_connac_mutex_release(&(dev)->mt76, &(dev)->pm)
extern const struct ieee80211_ops mt7921_ops; extern const struct ieee80211_ops mt7921_ops;
u32 mt7921_reg_map(struct mt792x_dev *dev, u32 addr); u32 mt7921_reg_map(struct mt792x_dev *dev, u32 addr);
......
...@@ -126,4 +126,9 @@ struct mt792x_dev { ...@@ -126,4 +126,9 @@ struct mt792x_dev {
u32 backup_l2; u32 backup_l2;
}; };
#define mt792x_mutex_acquire(dev) \
mt76_connac_mutex_acquire(&(dev)->mt76, &(dev)->pm)
#define mt792x_mutex_release(dev) \
mt76_connac_mutex_release(&(dev)->mt76, &(dev)->pm)
#endif /* __MT7925_H */ #endif /* __MT7925_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment