aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorMartin Kaistra <martin.kaistra@linutronix.de>2025-09-01 14:16:13 +0200
committerPing-Ke Shih <pkshih@realtek.com>2025-09-09 09:18:09 +0800
commit00afddfe4c995efc2fd46ad13a67a764cca597e4 (patch)
tree388fa5e51e9e0ad4b5d7f7936681e23a3c03384a /drivers/net
parentwifi: rtw89: 8852bt: Remove redundant off_reverse variables (diff)
downloadlinux-00afddfe4c995efc2fd46ad13a67a764cca597e4.tar.gz
linux-00afddfe4c995efc2fd46ad13a67a764cca597e4.zip
wifi: rtl8xxxu: expose efuse via debugfs
The efuse contains the mac address and calibration data. During manufacturing and testing it can be necessary to read and check this data. Add a debugfs interface to make it available to userspace. Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20250901121613.1876109-1-martin.kaistra@linutronix.de
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/realtek/rtl8xxxu/core.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index 9e00dc020e30..3ded5952729f 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -1901,6 +1901,27 @@ static void rtl8xxxu_dump_efuse(struct rtl8xxxu_priv *priv)
priv->efuse_wifi.raw, EFUSE_MAP_LEN, true);
}
+static ssize_t read_file_efuse(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct rtl8xxxu_priv *priv = file_inode(file)->i_private;
+
+ return simple_read_from_buffer(user_buf, count, ppos,
+ priv->efuse_wifi.raw, EFUSE_MAP_LEN);
+}
+
+static const struct debugfs_short_fops fops_efuse = {
+ .read = read_file_efuse,
+};
+
+static void rtl8xxxu_debugfs_init(struct rtl8xxxu_priv *priv)
+{
+ struct dentry *phydir;
+
+ phydir = debugfs_create_dir("rtl8xxxu", priv->hw->wiphy->debugfsdir);
+ debugfs_create_file("efuse", 0400, phydir, priv, &fops_efuse);
+}
+
void rtl8xxxu_reset_8051(struct rtl8xxxu_priv *priv)
{
u8 val8;
@@ -7975,6 +7996,7 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
}
rtl8xxxu_init_led(priv);
+ rtl8xxxu_debugfs_init(priv);
return 0;