diff mbox series

[1/2] mt76: mt7921: add debugfs knob for performing wifi reset

Message ID 1618494105-5462-1-git-send-email-sean.wang@mediatek.com (mailing list archive)
State New, archived
Headers show
Series [1/2] mt76: mt7921: add debugfs knob for performing wifi reset | expand

Commit Message

Sean Wang April 15, 2021, 1:41 p.m. UTC
From: Sean Wang <sean.wang@mediatek.com>

Introduce chip_reset knob in mt7921 debugfs to export a way to users
able to trigger wifi reset.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Lorenzo Bianconi April 15, 2021, 1:53 p.m. UTC | #1
> From: Sean Wang <sean.wang@mediatek.com>
> 
> Introduce chip_reset knob in mt7921 debugfs to export a way to users
> able to trigger wifi reset.
> 
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
> index 024524173115..1342a0b645e3 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
> @@ -302,6 +302,16 @@ static int mt7921_config(void *data, u64 val)
>  
>  DEFINE_DEBUGFS_ATTRIBUTE(fops_config, NULL, mt7921_config, "%lld\n");
>  
> +static int mt7921_chip_reset(void *data, u64 val)
> +{
> +	struct mt7921_dev *dev = data;
> +
> +	mt7921_reset(&dev->mt76);
> +
> +	return 0;
> +}
> +DEFINE_DEBUGFS_ATTRIBUTE(fops_reset, NULL, mt7921_chip_reset, "%lld\n");

can we use chip_config for this?

Regards,
Lorenzo

> +
>  int mt7921_init_debugfs(struct mt7921_dev *dev)
>  {
>  	struct dentry *dir;
> @@ -322,6 +332,7 @@ int mt7921_init_debugfs(struct mt7921_dev *dev)
>  	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;
>  }
> -- 
> 2.25.1
>
Sean Wang April 15, 2021, 2:53 p.m. UTC | #2
From: Sean Wang <sean.wang@mediatek.com>

>> From: Sean Wang <sean.wang@mediatek.com>
>>
>> Introduce chip_reset knob in mt7921 debugfs to export a way to users
>> able to trigger wifi reset.
>>
>> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
>> ---
>>  drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
>> b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
>> index 024524173115..1342a0b645e3 100644
>> --- a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
>> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
>> @@ -302,6 +302,16 @@ static int mt7921_config(void *data, u64 val)
>>
>>  DEFINE_DEBUGFS_ATTRIBUTE(fops_config, NULL, mt7921_config, "%lld\n");
>>
>> +static int mt7921_chip_reset(void *data, u64 val) {
>> +	struct mt7921_dev *dev = data;
>> +
>> +	mt7921_reset(&dev->mt76);
>> +
>> +	return 0;
>> +}
>> +DEFINE_DEBUGFS_ATTRIBUTE(fops_reset, NULL, mt7921_chip_reset,
>> +"%lld\n");
>
>can we use chip_config for this?

i think we can resue the the knob for chip_reset. i will do it in the next version.

>
>Regards,
>Lorenzo
>
>> +
>>  int mt7921_init_debugfs(struct mt7921_dev *dev)  {
>>	struct dentry *dir;
>> @@ -322,6 +332,7 @@ int mt7921_init_debugfs(struct mt7921_dev *dev)
>>	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;
>>  }
>> --
>> 2.25.1
>>
>
Lorenzo Bianconi April 15, 2021, 3:07 p.m. UTC | #3
> From: Sean Wang <sean.wang@mediatek.com>
> 
> >> From: Sean Wang <sean.wang@mediatek.com>
> >>
> >> Introduce chip_reset knob in mt7921 debugfs to export a way to users
> >> able to trigger wifi reset.
> >>
> >> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> >> ---
> >>  drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c | 11 +++++++++++
> >>  1 file changed, 11 insertions(+)
> >>
> >> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
> >> b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
> >> index 024524173115..1342a0b645e3 100644
> >> --- a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
> >> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
> >> @@ -302,6 +302,16 @@ static int mt7921_config(void *data, u64 val)
> >>
> >>  DEFINE_DEBUGFS_ATTRIBUTE(fops_config, NULL, mt7921_config, "%lld\n");
> >>
> >> +static int mt7921_chip_reset(void *data, u64 val) {
> >> +	struct mt7921_dev *dev = data;
> >> +
> >> +	mt7921_reset(&dev->mt76);
> >> +
> >> +	return 0;
> >> +}
> >> +DEFINE_DEBUGFS_ATTRIBUTE(fops_reset, NULL, mt7921_chip_reset,
> >> +"%lld\n");
> >
> >can we use chip_config for this?
> 
> i think we can resue the the knob for chip_reset. i will do it in the next version.

ack, I agree. Please rename the chip_config in something lile reset or similar.

Thanks,
Lorenzo

> 
> >
> >Regards,
> >Lorenzo
> >
> >> +
> >>  int mt7921_init_debugfs(struct mt7921_dev *dev)  {
> >>	struct dentry *dir;
> >> @@ -322,6 +332,7 @@ int mt7921_init_debugfs(struct mt7921_dev *dev)
> >>	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;
> >>  }
> >> --
> >> 2.25.1
> >>
> >
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
index 024524173115..1342a0b645e3 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
@@ -302,6 +302,16 @@  static int mt7921_config(void *data, u64 val)
 
 DEFINE_DEBUGFS_ATTRIBUTE(fops_config, NULL, mt7921_config, "%lld\n");
 
+static int mt7921_chip_reset(void *data, u64 val)
+{
+	struct mt7921_dev *dev = data;
+
+	mt7921_reset(&dev->mt76);
+
+	return 0;
+}
+DEFINE_DEBUGFS_ATTRIBUTE(fops_reset, NULL, mt7921_chip_reset, "%lld\n");
+
 int mt7921_init_debugfs(struct mt7921_dev *dev)
 {
 	struct dentry *dir;
@@ -322,6 +332,7 @@  int mt7921_init_debugfs(struct mt7921_dev *dev)
 	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;
 }