1 // SPDX-License-Identifier: ISC
3 * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
8 mt76_reg_set(void *data
, u64 val
)
10 struct mt76_dev
*dev
= data
;
12 dev
->bus
->wr(dev
, dev
->debugfs_reg
, val
);
17 mt76_reg_get(void *data
, u64
*val
)
19 struct mt76_dev
*dev
= data
;
21 *val
= dev
->bus
->rr(dev
, dev
->debugfs_reg
);
25 DEFINE_DEBUGFS_ATTRIBUTE(fops_regval
, mt76_reg_get
, mt76_reg_set
,
28 int mt76_queues_read(struct seq_file
*s
, void *data
)
30 struct mt76_dev
*dev
= dev_get_drvdata(s
->private);
33 for (i
= 0; i
< ARRAY_SIZE(dev
->q_tx
); i
++) {
34 struct mt76_sw_queue
*q
= &dev
->q_tx
[i
];
40 "%d: queued=%d head=%d tail=%d swq_queued=%d\n",
41 i
, q
->q
->queued
, q
->q
->head
, q
->q
->tail
,
47 EXPORT_SYMBOL_GPL(mt76_queues_read
);
49 void mt76_seq_puts_array(struct seq_file
*file
, const char *str
,
54 seq_printf(file
, "%10s:", str
);
55 for (i
= 0; i
< len
; i
++)
56 seq_printf(file
, " %2d", val
[i
]);
59 EXPORT_SYMBOL_GPL(mt76_seq_puts_array
);
61 static int mt76_read_rate_txpower(struct seq_file
*s
, void *data
)
63 struct mt76_dev
*dev
= dev_get_drvdata(s
->private);
65 mt76_seq_puts_array(s
, "CCK", dev
->rate_power
.cck
,
66 ARRAY_SIZE(dev
->rate_power
.cck
));
67 mt76_seq_puts_array(s
, "OFDM", dev
->rate_power
.ofdm
,
68 ARRAY_SIZE(dev
->rate_power
.ofdm
));
69 mt76_seq_puts_array(s
, "STBC", dev
->rate_power
.stbc
,
70 ARRAY_SIZE(dev
->rate_power
.stbc
));
71 mt76_seq_puts_array(s
, "HT", dev
->rate_power
.ht
,
72 ARRAY_SIZE(dev
->rate_power
.ht
));
73 mt76_seq_puts_array(s
, "VHT", dev
->rate_power
.vht
,
74 ARRAY_SIZE(dev
->rate_power
.vht
));
78 struct dentry
*mt76_register_debugfs(struct mt76_dev
*dev
)
82 dir
= debugfs_create_dir("mt76", dev
->hw
->wiphy
->debugfsdir
);
86 debugfs_create_u8("led_pin", 0600, dir
, &dev
->led_pin
);
87 debugfs_create_u32("regidx", 0600, dir
, &dev
->debugfs_reg
);
88 debugfs_create_file_unsafe("regval", 0600, dir
, dev
,
90 debugfs_create_blob("eeprom", 0400, dir
, &dev
->eeprom
);
92 debugfs_create_blob("otp", 0400, dir
, &dev
->otp
);
93 debugfs_create_devm_seqfile(dev
->dev
, "rate_txpower", dir
,
94 mt76_read_rate_txpower
);
98 EXPORT_SYMBOL_GPL(mt76_register_debugfs
);