mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
move debugfs code to common code
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
@@ -3,7 +3,7 @@ EXTRA_CFLAGS += -Werror
|
||||
obj-m := mt76.o mt76x2e.o mt7603e.o
|
||||
|
||||
mt76-y := \
|
||||
mmio.o util.o trace.o dma.o mac80211.o
|
||||
mmio.o util.o trace.o dma.o mac80211.o debugfs.o
|
||||
|
||||
mt76x2e-y := \
|
||||
mt76x2_pci.o mt76x2_dma.o \
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Felix Fietkau <[email protected]>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
#include "mt76.h"
|
||||
|
||||
static int
|
||||
mt76_reg_set(void *data, u64 val)
|
||||
{
|
||||
struct mt76_dev *dev = data;
|
||||
|
||||
dev->bus->wr(dev, dev->debugfs_reg, val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
mt76_reg_get(void *data, u64 *val)
|
||||
{
|
||||
struct mt76_dev *dev = data;
|
||||
|
||||
*val = dev->bus->rr(dev, dev->debugfs_reg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_regval, mt76_reg_get, mt76_reg_set, "0x%08llx\n");
|
||||
|
||||
|
||||
struct dentry *mt76_register_debugfs(struct mt76_dev *dev)
|
||||
{
|
||||
struct dentry *dir;
|
||||
|
||||
dir = debugfs_create_dir("mt76", dev->hw->wiphy->debugfsdir);
|
||||
if (!dir)
|
||||
return NULL;
|
||||
|
||||
debugfs_create_u32("regidx", S_IRUSR | S_IWUSR, dir, &dev->debugfs_reg);
|
||||
debugfs_create_file("regval", S_IRUSR | S_IWUSR, dir, dev, &fops_regval);
|
||||
|
||||
return dir;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76_register_debugfs);
|
||||
@@ -106,6 +106,8 @@ struct mt76_dev {
|
||||
|
||||
struct ieee80211_supported_band sband_2g;
|
||||
struct ieee80211_supported_band sband_5g;
|
||||
|
||||
u32 debugfs_reg;
|
||||
};
|
||||
|
||||
enum mt76_phy_type {
|
||||
@@ -160,4 +162,6 @@ static inline u16 mt76_rev(struct mt76_dev *dev)
|
||||
int mt76_register_device(struct mt76_dev *dev, int bands, bool vht,
|
||||
struct ieee80211_rate *rates, int n_rates);
|
||||
|
||||
struct dentry *mt76_register_debugfs(struct mt76_dev *dev);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -167,5 +167,7 @@ int mt7603_register_device(struct mt7603_dev *dev)
|
||||
sband = wiphy->bands[IEEE80211_BAND_2GHZ];
|
||||
dev->chandef.chan = &sband->channels[0];
|
||||
|
||||
mt76_register_debugfs(&dev->mt76);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -164,8 +164,6 @@ struct mt76x2_dev {
|
||||
struct debugfs_blob_wrapper otp;
|
||||
struct mt76x2_hw_cap cap;
|
||||
|
||||
u32 debugfs_reg;
|
||||
|
||||
s8 target_power;
|
||||
s8 target_power_delta[2];
|
||||
struct mt76x2_rate_power rate_power;
|
||||
|
||||
+1
-24
@@ -14,27 +14,6 @@
|
||||
#include <linux/debugfs.h>
|
||||
#include "mt76x2.h"
|
||||
|
||||
static int
|
||||
mt76x2_reg_set(void *data, u64 val)
|
||||
{
|
||||
struct mt76x2_dev *dev = data;
|
||||
|
||||
mt76_wr(dev, dev->debugfs_reg, val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
mt76x2_reg_get(void *data, u64 *val)
|
||||
{
|
||||
struct mt76x2_dev *dev = data;
|
||||
|
||||
*val = mt76_rr(dev, dev->debugfs_reg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_regval, mt76x2_reg_get, mt76x2_reg_set, "0x%08llx\n");
|
||||
|
||||
|
||||
static int
|
||||
mt76x2_ampdu_stat_read(struct seq_file *file, void *data)
|
||||
{
|
||||
@@ -106,7 +85,7 @@ void mt76x2_init_debugfs(struct mt76x2_dev *dev)
|
||||
{
|
||||
struct dentry *dir;
|
||||
|
||||
dir = debugfs_create_dir("mt76", mt76_hw(dev)->wiphy->debugfsdir);
|
||||
dir = mt76_register_debugfs(&dev->mt76);
|
||||
if (!dir)
|
||||
return;
|
||||
|
||||
@@ -114,8 +93,6 @@ void mt76x2_init_debugfs(struct mt76x2_dev *dev)
|
||||
debugfs_create_blob("otp", S_IRUSR, dir, &dev->otp);
|
||||
debugfs_create_u8("temperature", S_IRUSR, dir, &dev->cal.temp);
|
||||
|
||||
debugfs_create_u32("regidx", S_IRUSR | S_IWUSR, dir, &dev->debugfs_reg);
|
||||
debugfs_create_file("regval", S_IRUSR | S_IWUSR, dir, dev, &fops_regval);
|
||||
debugfs_create_file("ampdu_stat", S_IRUSR, dir, dev, &fops_ampdu_stat);
|
||||
debugfs_create_devm_seqfile(dev->mt76.dev, "txpower", dir, read_txpower);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user