Linux wireless drivers development
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Martin Kaistra <martin.kaistra@linutronix.de>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Jes Sorensen <Jes.Sorensen@gmail.com>,
	Bitterblue Smith <rtl8821cerfe2@gmail.com>
Subject: RE: [PATCH rtw-next v2] wifi: rtl8xxxu: expose efuse via debugfs
Date: Tue, 2 Sep 2025 01:12:10 +0000	[thread overview]
Message-ID: <a2bc752666524249b19dfafb7912f6cc@realtek.com> (raw)
In-Reply-To: <20250901121613.1876109-1-martin.kaistra@linutronix.de>

Martin Kaistra <martin.kaistra@linutronix.de> wrote:
> 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>
> ---
> Changes in v2:
> - remove unnecessary comment
> - use debugfs_short_fops
> 
>  drivers/net/wireless/realtek/rtl8xxxu/core.c | 22 ++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c
> b/drivers/net/wireless/realtek/rtl8xxxu/core.c
> index 831b5025c6349..aea706f0251d8 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);
> +}
> +

Could you please try if this would encounter build error without
CFG80211_DEBUGFS?

Otherwise, looks good to me.

>  void rtl8xxxu_reset_8051(struct rtl8xxxu_priv *priv)
>  {
>         u8 val8;
> @@ -7974,6 +7995,7 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
>         }
> 
>         rtl8xxxu_init_led(priv);
> +       rtl8xxxu_debugfs_init(priv);
> 
>         return 0;
> 
> --
> 2.39.5


  reply	other threads:[~2025-09-02  1:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-01 12:16 [PATCH rtw-next v2] wifi: rtl8xxxu: expose efuse via debugfs Martin Kaistra
2025-09-02  1:12 ` Ping-Ke Shih [this message]
2025-09-02  7:41   ` Martin Kaistra
2025-09-02  7:46     ` Ping-Ke Shih
2025-09-09  1:21 ` Ping-Ke Shih

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a2bc752666524249b19dfafb7912f6cc@realtek.com \
    --to=pkshih@realtek.com \
    --cc=Jes.Sorensen@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=martin.kaistra@linutronix.de \
    --cc=rtl8821cerfe2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox