From: Vinod Koul <vkoul@kernel.org>
To: "Chunfeng Yun (云春峰)" <Chunfeng.Yun@mediatek.com>
Cc: "linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"linux-phy@lists.infradead.org" <linux-phy@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Eddie Hung (洪正鑫)" <Eddie.Hung@mediatek.com>
Subject: Re: [PATCH v8] phy: mediatek: tphy: add debugfs files
Date: Tue, 14 Feb 2023 19:30:09 +0530 [thread overview]
Message-ID: <Y+uT6VoJra+056zj@matsya> (raw)
In-Reply-To: <eec940a49f4f9ec9e5bd7ad763e436d34b42be22.camel@mediatek.com>
On 13-02-23, 08:22, Chunfeng Yun (云春峰) wrote:
> On Mon, 2023-02-13 at 16:21 +0800, chunfeng yun wrote:
> > On Fri, 2023-02-10 at 21:01 +0530, Vinod Koul wrote:
> > > On 10-02-23, 16:58, Chunfeng Yun wrote:
> > > > These debugfs files are mainly used to make eye diagram test
> > > > easier,
> > > > especially helpful to do HQA test for a new IC without efuse
> > > > enabled.
> > > >
> > > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > > > ---
> > > > v8: abandon patch to create phy debug root file
> > > > /sys/kernel/debug/phy/ suggested by Vinod
> > >
> > > Sorry that was not my suggestion
> >
> > Sorry, I misunderstood you means
> > >
> > > >
> > > > v6~v7: no changes
> > > >
> > > > v5: using common debugfs config CONFIG_DEBUG_FS
> > > >
> > > > v4: fix build warning of sometimes uninitialized variable
> > > >
> > > > v3: fix typo of "debugfs" suggested by AngeloGioacchino
> > > >
> > > > v2: add CONFIG_PHY_MTK_TPHY_DEBUGFS suggested by AngeloGioacchino
> > > > ---
> > > > drivers/phy/mediatek/phy-mtk-tphy.c | 405
> > > > +++++++++++++++++++++++++++-
> > > > 1 file changed, 404 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c
> > > > b/drivers/phy/mediatek/phy-mtk-tphy.c
> > > > index e906a82791bd..65a95c3726bf 100644
> > > > --- a/drivers/phy/mediatek/phy-mtk-tphy.c
> > > > +++ b/drivers/phy/mediatek/phy-mtk-tphy.c
> > > > @@ -7,6 +7,7 @@
> > > >
> > > > #include <dt-bindings/phy/phy.h>
> > > > #include <linux/clk.h>
> > > > +#include <linux/debugfs.h>
> > > > #include <linux/delay.h>
> > > > #include <linux/iopoll.h>
> > > > #include <linux/mfd/syscon.h>
> > > > @@ -264,6 +265,8 @@
> > > >
> > > > #define TPHY_CLKS_CNT 2
> > > >
> > > > +#define USER_BUF_LEN(count) min_t(size_t, 8, (count))
> > > > +
> > > > enum mtk_phy_version {
> > > > MTK_PHY_V1 = 1,
> > > > MTK_PHY_V2,
> > > > @@ -310,6 +313,7 @@ struct mtk_phy_instance {
> > > > struct clk_bulk_data clks[TPHY_CLKS_CNT];
> > > > u32 index;
> > > > u32 type;
> > > > + struct dentry *dbgfs;
> > > > struct regmap *type_sw;
> > > > u32 type_sw_reg;
> > > > u32 type_sw_index;
> > > > @@ -332,10 +336,391 @@ struct mtk_tphy {
> > > > const struct mtk_phy_pdata *pdata;
> > > > struct mtk_phy_instance **phys;
> > > > int nphys;
> > > > + struct dentry *dbgfs_root;
> > > > int src_ref_clk; /* MHZ, reference clock for slew rate
> > > > calibrate */
> > > > int src_coef; /* coefficient for slew rate calibrate */
> > > > };
> > >
> > > I asked the struct dentry *debugfs be part of struct phy. Debugfs
> > > would
> > > be created by core but rather than exported, it should be populated
> > > in
> > > phy and you can use it here in the driver
> > >
> > > >
> >
> > Ok, I'll do the following steps:
> >
> > 0. put a struct dentry *debugfs in struct phy;
> > 1. define a static struct dentry *phy_debugfs_root in phy-core.c,
> > then
> > create a root directory (/sys/kernel/debug/phy/) for phy
> > subsystem
> > in phy_core_init();
> > 2. create directory for each phy under the root directory
> > (/sys/kernel/debug/phy/);
> > this step has two ways:
> > A: create the directory @debugfs of struct phy in phy_create() by
> > default;
That sounds good to me
> > B: provide some api for user to create/destory the directory
> > @debugfs or others when need;
> > 3. add private debugfs files in @debugfs of struct phy;
> >
> > For the case in tphy driver, it provides some struct phy, the driver
> > may want to create debugfs files which not belongs to any struct phy
> > in
> > the root directory (/sys/kernel/debug/phy/), then need provide a api.
> >
> > Do you have any suggestions?
> > Which way do you prefer to use in step 2?
> >
> > Thanks a lot;
> >
> > > <skip>
> > > > +
> > > > static struct platform_driver mtk_tphy_driver = {
> > > > .probe = mtk_tphy_probe,
> > > > + .remove = mtk_tphy_remove,
> > > > .driver = {
> > > > .name = "mtk-tphy",
> > > > .of_match_table = mtk_tphy_id_table,
> > > > --
> > > > 2.18.0
> > >
> > >
--
~Vinod
prev parent reply other threads:[~2023-02-14 14:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-10 8:58 [PATCH v8] phy: mediatek: tphy: add debugfs files Chunfeng Yun
2023-02-10 15:31 ` Vinod Koul
2023-03-16 7:12 ` Chunfeng Yun (云春峰)
2023-02-13 8:22 ` Chunfeng Yun (云春峰)
2023-02-14 14:00 ` Vinod Koul [this message]
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=Y+uT6VoJra+056zj@matsya \
--to=vkoul@kernel.org \
--cc=Chunfeng.Yun@mediatek.com \
--cc=Eddie.Hung@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-phy@lists.infradead.org \
--cc=matthias.bgg@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