Skip to content

Commit

Permalink
mt76x2: add debugfs entry to enable/disable per packet TPC
Browse files Browse the repository at this point in the history
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  • Loading branch information
LorenzoBianconi authored and nbd168 committed Aug 25, 2016
1 parent 2637e6b commit c3127d2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions mt76x2.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ struct mt76x2_dev {
s8 target_power;
s8 target_power_delta[2];
struct mt76_rate_power rate_power;
bool enable_tpc;

u8 coverage_class;
u8 slottime;
Expand Down
1 change: 1 addition & 0 deletions mt76x2_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ void mt76x2_init_debugfs(struct mt76x2_dev *dev)
return;

debugfs_create_u8("temperature", S_IRUSR, dir, &dev->cal.temp);
debugfs_create_bool("tpc", S_IRUSR | S_IWUSR, dir, &dev->enable_tpc);

debugfs_create_file("ampdu_stat", S_IRUSR, dir, dev, &fops_ampdu_stat);
debugfs_create_devm_seqfile(dev->mt76.dev, "txpower", dir, read_txpower);
Expand Down
4 changes: 3 additions & 1 deletion mt76x2_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ s8 mt76x2_tx_get_txpwr_adj(struct mt76x2_dev *dev, s8 txpwr, s8 max_txpwr_adj)
txpwr -= (dev->target_power + dev->target_power_delta[0]);
txpwr = min_t(s8, txpwr, max_txpwr_adj);

if (txpwr >= 0)
if (!dev->enable_tpc)
return 0;
else if (txpwr >= 0)
return min_t(s8, txpwr, 7);
else
return (txpwr < -16) ? 8 : (txpwr + 32) / 2;
Expand Down

0 comments on commit c3127d2

Please sign in to comment.