diff options
Diffstat (limited to 'sys/contrib/dev/mediatek/mt76/mt7915/debugfs.c')
| -rw-r--r-- | sys/contrib/dev/mediatek/mt76/mt7915/debugfs.c | 81 | 
1 files changed, 51 insertions, 30 deletions
| diff --git a/sys/contrib/dev/mediatek/mt76/mt7915/debugfs.c b/sys/contrib/dev/mediatek/mt76/mt7915/debugfs.c index 578013884e43..b287b7d9394e 100644 --- a/sys/contrib/dev/mediatek/mt76/mt7915/debugfs.c +++ b/sys/contrib/dev/mediatek/mt76/mt7915/debugfs.c @@ -211,13 +211,28 @@ static const struct file_operations mt7915_sys_recovery_ops = {  static int  mt7915_radar_trigger(void *data, u64 val)  { -	struct mt7915_dev *dev = data; +#define RADAR_MAIN_CHAIN	1 +#define RADAR_BACKGROUND	2 +	struct mt7915_phy *phy = data; +	struct mt7915_dev *dev = phy->dev; +	int rdd_idx; + +	if (!val || val > RADAR_BACKGROUND) +		return -EINVAL; -	if (val > MT_RX_SEL2) +	if (val == RADAR_BACKGROUND && !dev->rdd2_phy) { +		dev_err(dev->mt76.dev, "Background radar is not enabled\n");  		return -EINVAL; +	} + +	rdd_idx = mt7915_get_rdd_idx(phy, val == RADAR_BACKGROUND); +	if (rdd_idx < 0) { +		dev_err(dev->mt76.dev, "No RDD found\n"); +		return -EINVAL; +	}  	return mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_RADAR_EMULATE, -				       val, 0, 0); +				       rdd_idx, 0, 0);  }  DEFINE_DEBUGFS_ATTRIBUTE(fops_radar_trigger, NULL, @@ -303,9 +318,9 @@ static int mt7915_muru_stats_show(struct seq_file *file, void *data)  		   phy->mib.dl_vht_3mu_cnt,  		   phy->mib.dl_vht_4mu_cnt); -	sub_total_cnt = phy->mib.dl_vht_2mu_cnt + -			phy->mib.dl_vht_3mu_cnt + -			phy->mib.dl_vht_4mu_cnt; +	sub_total_cnt = (u64)phy->mib.dl_vht_2mu_cnt + +			     phy->mib.dl_vht_3mu_cnt + +			     phy->mib.dl_vht_4mu_cnt;  	seq_printf(file, "\nTotal non-HE MU-MIMO DL PPDU count: %lld",  		   sub_total_cnt); @@ -353,26 +368,27 @@ static int mt7915_muru_stats_show(struct seq_file *file, void *data)  		   phy->mib.dl_he_9to16ru_cnt,  		   phy->mib.dl_he_gtr16ru_cnt); -	sub_total_cnt = phy->mib.dl_he_2mu_cnt + -			phy->mib.dl_he_3mu_cnt + -			phy->mib.dl_he_4mu_cnt; +	sub_total_cnt = (u64)phy->mib.dl_he_2mu_cnt + +			     phy->mib.dl_he_3mu_cnt + +			     phy->mib.dl_he_4mu_cnt;  	total_ppdu_cnt = sub_total_cnt;  	seq_printf(file, "\nTotal HE MU-MIMO DL PPDU count: %lld",  		   sub_total_cnt); -	sub_total_cnt = phy->mib.dl_he_2ru_cnt + -			phy->mib.dl_he_3ru_cnt + -			phy->mib.dl_he_4ru_cnt + -			phy->mib.dl_he_5to8ru_cnt + -			phy->mib.dl_he_9to16ru_cnt + -			phy->mib.dl_he_gtr16ru_cnt; +	sub_total_cnt = (u64)phy->mib.dl_he_2ru_cnt + +			     phy->mib.dl_he_3ru_cnt + +			     phy->mib.dl_he_4ru_cnt + +			     phy->mib.dl_he_5to8ru_cnt + +			     phy->mib.dl_he_9to16ru_cnt + +			     phy->mib.dl_he_gtr16ru_cnt;  	total_ppdu_cnt += sub_total_cnt;  	seq_printf(file, "\nTotal HE OFDMA DL PPDU count: %lld",  		   sub_total_cnt); -	total_ppdu_cnt += phy->mib.dl_he_su_cnt + phy->mib.dl_he_ext_su_cnt; +	total_ppdu_cnt += (u64)phy->mib.dl_he_su_cnt + +			       phy->mib.dl_he_ext_su_cnt;  	seq_printf(file, "\nAll HE DL PPDU count: %lld", total_ppdu_cnt); @@ -404,20 +420,20 @@ static int mt7915_muru_stats_show(struct seq_file *file, void *data)  		   phy->mib.ul_hetrig_9to16ru_cnt,  		   phy->mib.ul_hetrig_gtr16ru_cnt); -	sub_total_cnt = phy->mib.ul_hetrig_2mu_cnt + -			phy->mib.ul_hetrig_3mu_cnt + -			phy->mib.ul_hetrig_4mu_cnt; +	sub_total_cnt = (u64)phy->mib.ul_hetrig_2mu_cnt + +			     phy->mib.ul_hetrig_3mu_cnt + +			     phy->mib.ul_hetrig_4mu_cnt;  	total_ppdu_cnt = sub_total_cnt;  	seq_printf(file, "\nTotal HE MU-MIMO UL TB PPDU count: %lld",  		   sub_total_cnt); -	sub_total_cnt = phy->mib.ul_hetrig_2ru_cnt + -			phy->mib.ul_hetrig_3ru_cnt + -			phy->mib.ul_hetrig_4ru_cnt + -			phy->mib.ul_hetrig_5to8ru_cnt + -			phy->mib.ul_hetrig_9to16ru_cnt + -			phy->mib.ul_hetrig_gtr16ru_cnt; +	sub_total_cnt = (u64)phy->mib.ul_hetrig_2ru_cnt + +			     phy->mib.ul_hetrig_3ru_cnt + +			     phy->mib.ul_hetrig_4ru_cnt + +			     phy->mib.ul_hetrig_5to8ru_cnt + +			     phy->mib.ul_hetrig_9to16ru_cnt + +			     phy->mib.ul_hetrig_gtr16ru_cnt;  	total_ppdu_cnt += sub_total_cnt;  	seq_printf(file, "\nTotal HE OFDMA UL TB PPDU count: %lld", @@ -444,6 +460,11 @@ mt7915_rdd_monitor(struct seq_file *s, void *data)  	mutex_lock(&dev->mt76.mutex); +	if (!mt7915_eeprom_has_background_radar(dev)) { +		seq_puts(s, "no background radar capability\n"); +		goto out; +	} +  	if (!cfg80211_chandef_valid(chandef)) {  		ret = -EINVAL;  		goto out; @@ -1084,13 +1105,13 @@ mt7915_rate_txpower_set(struct file *file, const char __user *user_buf,  		return -EINVAL;  	if (pwr160) -		pwr160 = mt7915_get_power_bound(phy, pwr160); +		pwr160 = mt76_get_power_bound(mphy, pwr160);  	if (pwr80) -		pwr80 = mt7915_get_power_bound(phy, pwr80); +		pwr80 = mt76_get_power_bound(mphy, pwr80);  	if (pwr40) -		pwr40 = mt7915_get_power_bound(phy, pwr40); +		pwr40 = mt76_get_power_bound(mphy, pwr40);  	if (pwr20) -		pwr20 = mt7915_get_power_bound(phy, pwr20); +		pwr20 = mt76_get_power_bound(mphy, pwr20);  	if (pwr160 < 0 || pwr80 < 0 || pwr40 < 0 || pwr20 < 0)  		return -EINVAL; @@ -1241,7 +1262,7 @@ int mt7915_init_debugfs(struct mt7915_phy *phy)  	if (!dev->dbdc_support || phy->mt76->band_idx) {  		debugfs_create_u32("dfs_hw_pattern", 0400, dir,  				   &dev->hw_pattern); -		debugfs_create_file("radar_trigger", 0200, dir, dev, +		debugfs_create_file("radar_trigger", 0200, dir, phy,  				    &fops_radar_trigger);  		debugfs_create_devm_seqfile(dev->mt76.dev, "rdd_monitor", dir,  					    mt7915_rdd_monitor); | 
