alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: alsa-devel@alsa-project.org, gregkh@linuxfoundation.org,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	linux-kernel@vger.kernel.org, sanyog.r.kale@intel.com,
	yung-chuan.liao@linux.intel.com
Subject: Re: [PATCH] soundwire: debugfs: use controller id instead of link_id
Date: Mon, 1 Feb 2021 15:44:14 +0530	[thread overview]
Message-ID: <20210201101414.GS2771@vkoul-mobl> (raw)
In-Reply-To: <feee8676-33fe-7929-8b6c-6abe3a09159a@linaro.org>

On 21-01-21, 17:23, Srinivas Kandagatla wrote:
> 
> 
> On 21/01/2021 15:12, Pierre-Louis Bossart wrote:
> > 
> > 
> > On 1/21/21 6:03 AM, Srinivas Kandagatla wrote:
> > > 
> > > 
> > > On 19/01/2021 19:09, Pierre-Louis Bossart wrote:
> > > > 
> > > > > currently we have
> > > > > /sys/kernel/debug/soundwire/master-*
> > > > > 
> > > > > Are you suggesting that we have something like this:
> > > > > 
> > > > > /sys/kernel/debug/soundwire/xyz-controller/master-<LINK-ID> ??
> > > > 
> > > > Yes this is what I was thinking about.
> > > 
> > > Vinod/Pierre,
> > > 
> > > One Question here,
> > > 
> > > Why is link_id part of "struct sdw_bus", should it not be part of
> > > "struct sdw_master_device " ?
> > > 
> > > Given that "There is one Link per each Master"
> > 
> > it's true that link == master == bus at the concept level.
> > 
> > but we have an existing code base with different structures and we can't
> > break too many things at once.
> > 
> > In the existing flow, the 'bus' is created and setup first, the
> > sdw_bus_master_add() routine takes a 'bus' argument, and the link_id is
> > already set. This routine only creates a device and in the rest of the
> > code we keep using the 'bus' pointer, so there's no real short-term
> > scope for moving the information into the 'sdw_master_device' structure
> > - that would be a lot of surgery when nothing is really broken.
> 
> I totally agree!
> 
> If I understand it correctly in Intel case there will be only one Link ID
> per bus.

Yes IIUC there would be one link id per bus.

the ida approach gives us unique id for each master,bus I would like to
propose using that everywhere

> 
> 
> Does this change look good to you?
> 
> ---------------->cut<---------------
> 
> diff --git a/drivers/soundwire/debugfs.c b/drivers/soundwire/debugfs.c
> index b6cad0d59b7b..f22868614f09 100644
> --- a/drivers/soundwire/debugfs.c
> +++ b/drivers/soundwire/debugfs.c
> @@ -19,13 +19,14 @@ void sdw_bus_debugfs_init(struct sdw_bus *bus)
>                 return;
> 
>         /* create the debugfs master-N */
> +       bus->controller_debugfs = debugfs_create_dir(dev_name(bus->dev),
> sdw_debugfs_root);
>         snprintf(name, sizeof(name), "master-%d", bus->link_id);
> -       bus->debugfs = debugfs_create_dir(name, sdw_debugfs_root);
> +       bus->debugfs = debugfs_create_dir(name, bus->controller_debugfs);
>  }
> 
>  void sdw_bus_debugfs_exit(struct sdw_bus *bus)
>  {
> -       debugfs_remove_recursive(bus->debugfs);
> +       debugfs_remove_recursive(bus->controller_debugfs);
>  }
> 
>  #define RD_BUF (3 * PAGE_SIZE)
> diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h
> index b198f471bea8..242bde30d8bd 100644
> --- a/include/linux/soundwire/sdw.h
> +++ b/include/linux/soundwire/sdw.h
> @@ -877,6 +877,7 @@ struct sdw_bus {
>         struct sdw_master_prop prop;
>         struct list_head m_rt_list;
>  #ifdef CONFIG_DEBUG_FS
> +       struct dentry *controller_debugfs;
>         struct dentry *debugfs;
>  #endif
>         struct sdw_defer defer_msg;
> 
> ---------------->cut<---------------
> 
> With this change I get something like this on my board:
> 
> ~# find /sys/kernel/debug/soundwire/
> /sys/kernel/debug/soundwire/
> /sys/kernel/debug/soundwire/sdw-master-2
> /sys/kernel/debug/soundwire/sdw-master-2/master-0
> /sys/kernel/debug/soundwire/sdw-master-2/master-0/sdw:0:217:2110:0:4
> /sys/kernel/debug/soundwire/sdw-master-2/master-0/sdw:0:217:2110:0:4/registers
> /sys/kernel/debug/soundwire/sdw-master-2/master-0/sdw:0:217:2110:0:3
> /sys/kernel/debug/soundwire/sdw-master-2/master-0/sdw:0:217:2110:0:3/registers
> /sys/kernel/debug/soundwire/sdw-master-1
> /sys/kernel/debug/soundwire/sdw-master-1/master-0
> /sys/kernel/debug/soundwire/sdw-master-1/master-0/sdw:0:217:10d:0:3
> /sys/kernel/debug/soundwire/sdw-master-1/master-0/sdw:0:217:10d:0:3/registers
> /sys/kernel/debug/soundwire/sdw-master-0
> /sys/kernel/debug/soundwire/sdw-master-0/master-0
> /sys/kernel/debug/soundwire/sdw-master-0/master-0/sdw:0:217:10d:0:4
> /sys/kernel/debug/soundwire/sdw-master-0/master-0/sdw:0:217:10d:0:4/registers
> 
> 
> 
> Thanks,
> srini

-- 
~Vinod

  parent reply	other threads:[~2021-02-01 10:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 16:25 [PATCH] soundwire: debugfs: use controller id instead of link_id Srinivas Kandagatla
2021-01-19 14:52 ` Vinod Koul
2021-01-19 15:54   ` Pierre-Louis Bossart
2021-01-19 17:17     ` Srinivas Kandagatla
2021-01-19 19:09       ` Pierre-Louis Bossart
2021-01-21 12:03         ` Srinivas Kandagatla
2021-01-21 15:12           ` Pierre-Louis Bossart
2021-01-21 17:23             ` Srinivas Kandagatla
2021-01-21 18:22               ` Pierre-Louis Bossart
2021-02-01 10:14               ` Vinod Koul [this message]
2021-02-01 16:10                 ` Pierre-Louis Bossart
2021-02-02  4:18                   ` Vinod Koul
2021-02-02 16:43                     ` Pierre-Louis Bossart
2021-02-03 11:14                       ` Vinod Koul
2021-02-06 10:22                         ` Vinod Koul

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=20210201101414.GS2771@vkoul-mobl \
    --to=vkoul@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=sanyog.r.kale@intel.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=yung-chuan.liao@linux.intel.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;
as well as URLs for NNTP newsgroup(s).