diff options
author | Sean Wang <sean.wang@mediatek.com> | 2021-04-16 23:30:35 +0800 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2021-04-21 11:42:23 +0200 |
commit | f1ae92bbc43b68521bc0e866327dc896f10c11ee (patch) | |
tree | a2f269e49686ecf6d7295fded609b5a2d3cfeb3b /drivers | |
parent | 987c8fb4de437344f19a23d074c06faf67520a11 (diff) | |
download | lwn-f1ae92bbc43b68521bc0e866327dc896f10c11ee.tar.gz lwn-f1ae92bbc43b68521bc0e866327dc896f10c11ee.zip |
mt76: mt7921: add wifisys reset support in debugfs
Introduce chip_reset knob in mt7921 debugfs to export a way to users
able to trigger wifi reset, and group the similar operations
previously defined in chip_config in the same knob.
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c index 1a378387b0a9..5a54cd8d2ce4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c @@ -279,19 +279,28 @@ mt7921_pm_idle_timeout_get(void *data, u64 *val) DEFINE_DEBUGFS_ATTRIBUTE(fops_pm_idle_timeout, mt7921_pm_idle_timeout_get, mt7921_pm_idle_timeout_set, "%lld\n"); -static int mt7921_config(void *data, u64 val) +static int mt7921_chip_reset(void *data, u64 val) { struct mt7921_dev *dev = data; - int ret; - - mt7921_mutex_acquire(dev); - ret = mt76_connac_mcu_chip_config(&dev->mt76); - mt7921_mutex_release(dev); + int ret = 0; + + switch (val) { + case 1: + /* Reset wifisys directly. */ + mt7921_reset(&dev->mt76); + break; + default: + /* Collect the core dump before reset wifisys. */ + mt7921_mutex_acquire(dev); + ret = mt76_connac_mcu_chip_config(&dev->mt76); + mt7921_mutex_release(dev); + break; + } return ret; } -DEFINE_DEBUGFS_ATTRIBUTE(fops_config, NULL, mt7921_config, "%lld\n"); +DEFINE_DEBUGFS_ATTRIBUTE(fops_reset, NULL, mt7921_chip_reset, "%lld\n"); int mt7921_init_debugfs(struct mt7921_dev *dev) { @@ -312,7 +321,7 @@ int mt7921_init_debugfs(struct mt7921_dev *dev) debugfs_create_file("runtime-pm", 0600, dir, dev, &fops_pm); debugfs_create_file("idle-timeout", 0600, dir, dev, &fops_pm_idle_timeout); - debugfs_create_file("chip_config", 0600, dir, dev, &fops_config); + debugfs_create_file("chip_reset", 0600, dir, dev, &fops_reset); return 0; } |