summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2021-08-08 21:11:49 +0200
committerFelix Fietkau <nbd@nbd.name>2021-10-20 10:36:33 +0200
commitf6e1f59885dae5a2553f8bbd328be2cb1c80ccb2 (patch)
tree2da38c7614a4286a0a5f67a80953f2a4af4bb0e9 /drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
parentmt76: mt7921: introduce mt7921_mcu_set_beacon_filter utility routine (diff)
downloadlinux-f6e1f59885dae5a2553f8bbd328be2cb1c80ccb2.tar.xz
linux-f6e1f59885dae5a2553f8bbd328be2cb1c80ccb2.zip
mt76: overwrite default reg_ops if necessary
Introduce mt76_register_debugfs_fops routine in order to define per-driver regs file operations and make sure the device is up before reading or writing its registers Fixes: 1d8efc741df8 ("mt76: mt7921: introduce Runtime PM support") Fixes: de5ff3c9d1a2 ("mt76: mt7615: introduce pm_power_save delayed work") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
index da443ece0e1d..29a24e768617 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
@@ -5,6 +5,32 @@
#include "eeprom.h"
static int
+mt7921_reg_set(void *data, u64 val)
+{
+ struct mt7921_dev *dev = data;
+
+ mt7921_mutex_acquire(dev);
+ mt76_wr(dev, dev->mt76.debugfs_reg, val);
+ mt7921_mutex_release(dev);
+
+ return 0;
+}
+
+static int
+mt7921_reg_get(void *data, u64 *val)
+{
+ struct mt7921_dev *dev = data;
+
+ mt7921_mutex_acquire(dev);
+ *val = mt76_rr(dev, dev->mt76.debugfs_reg);
+ mt7921_mutex_release(dev);
+
+ return 0;
+}
+
+DEFINE_DEBUGFS_ATTRIBUTE(fops_regval, mt7921_reg_get, mt7921_reg_set,
+ "0x%08llx\n");
+static int
mt7921_fw_debug_set(void *data, u64 val)
{
struct mt7921_dev *dev = data;
@@ -381,7 +407,7 @@ int mt7921_init_debugfs(struct mt7921_dev *dev)
{
struct dentry *dir;
- dir = mt76_register_debugfs(&dev->mt76);
+ dir = mt76_register_debugfs_fops(&dev->mt76, &fops_regval);
if (!dir)
return -ENOMEM;