From: Vinod Koul <vinod.koul@intel.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: ALSA <alsa-devel@alsa-project.org>,
tiwai@suse.de, Greg KH <gregkh@linuxfoundation.org>,
liam.r.girdwood@linux.intel.com, patches.audio@intel.com,
broonie@kernel.org, Sanyog Kale <sanyog.r.kale@intel.com>
Subject: Re: [PATCH v2 03/13] soundwire: Add support for port management
Date: Fri, 6 Apr 2018 10:30:29 +0530 [thread overview]
Message-ID: <20180406050029.GF6014@localhost> (raw)
In-Reply-To: <a5240b66-759a-7a46-8274-e975075ad682@linux.intel.com>
On Thu, Apr 05, 2018 at 06:04:32PM -0500, Pierre-Louis Bossart wrote:
> On 4/5/18 11:48 AM, Vinod Koul wrote:
> >@@ -70,6 +93,7 @@ struct sdw_slave_runtime {
> > * @ch_count: Number of channels handled by the Master for
> > * this stream
> > * @slave_rt_list: Slave runtime list
> >+ * @port_list: List of Master Ports configured for this stream
>
> possibly empty for device to device communication.
Not in scope, will add in that series
> >+static void sdw_master_port_deconfig(struct sdw_bus *bus,
> >+ struct sdw_master_runtime *m_rt)
> >+{
> >+ struct sdw_port_runtime *p_rt, *_p_rt;
> >+
> >+ list_for_each_entry_safe(p_rt, _p_rt,
> >+ &m_rt->port_list, port_node) {
> >+
> >+ list_del(&p_rt->port_node);
> >+ kfree(p_rt);
> >+ }
> >+}
>
> I still don't get the naming conventions. There is no DECONFIGURED state,
> why not call it release? In which state is this called?
it is NOT about stream state, but deconfigure the ports. Well we can make it
sdw_master_port_release() if that makes you happy!
>
> >+
> >+static void sdw_slave_port_deconfig(struct sdw_bus *bus,
> >+ struct sdw_slave *slave,
> >+ struct sdw_stream_runtime *stream)
> >+{
> >+ struct sdw_port_runtime *p_rt, *_p_rt;
> >+ struct sdw_master_runtime *m_rt = stream->m_rt;
> >+ struct sdw_slave_runtime *s_rt;
> >+
> >+ list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) {
> >+
> >+ if (s_rt->slave != slave)
> >+ continue;
> >+
> >+ list_for_each_entry_safe(p_rt, _p_rt,
> >+ &s_rt->port_list, port_node) {
> >+
> >+ list_del(&p_rt->port_node);
> >+ kfree(p_rt);
> >+ }
>
> can we use common code between master and slaves? This looks virtually
> identical.
Nope it is not, we tried in past and end result looked uglier.
Only 4 lines of code are same and previous one iterates
over master and here we have slave...
> > int sdw_stream_remove_slave(struct sdw_slave *slave,
> > struct sdw_stream_runtime *stream)
> > {
> > mutex_lock(&slave->bus->bus_lock);
> >+ sdw_slave_port_deconfig(slave->bus, slave, stream);
>
> then call it sdw_slave_port_release as I mentioned above...
ok
> >+static int sdw_master_port_config(struct sdw_bus *bus,
> >+ struct sdw_master_runtime *m_rt,
> >+ struct sdw_port_config *port_config,
> >+ unsigned int num_ports)
> >+{
> >+ struct sdw_port_runtime *p_rt;
> >+ int i, ret;
> >+
> >+ /* Iterate for number of ports to perform initialization */
> >+ for (i = 0; i < num_ports; i++) {
> >+
> >+ p_rt = sdw_port_alloc(bus->dev, port_config, i);
> >+ if (!p_rt)
> >+ return -ENOMEM; > +
> >+ ret = sdw_is_valid_port_range(bus->dev, p_rt);
>
> a master has no definition of ports. You could have more than 14 ports.
> Even if you have a description of those ports, it has to be checking not for
> the standard definition but what the hardware can support
ok will remove check for master
> >+static int sdw_slave_port_config(struct sdw_slave *slave,
> >+ struct sdw_slave_runtime *s_rt,
> >+ struct sdw_port_config *port_config,
> >+ unsigned int num_config)
> >+{
> >+ struct sdw_port_runtime *p_rt;
> >+ int i, ret;
> >+
> >+ /* Iterate for number of ports to perform initialization */
> >+ for (i = 0; i < num_config; i++) {
> >+
> >+ p_rt = sdw_port_alloc(&slave->dev, port_config, i);
> >+ if (!p_rt)
> >+ return -ENOMEM;
> >+
> >+ ret = sdw_is_valid_port_range(&slave->dev, p_rt);
>
> this is optimistic. You should check the actual port range (as defined in
> DisCo properties or driver), not just the worst case allowed by the
> standard.
> This should include a check that the bi-dir ports are configured for the
> right role and that the direction is compatible for regular fixed-direction
> ports.
well this is better that no check but yes that can be further improved in
future to comprehend DisCo properties and port direction. I will add that to
my list
--
~Vinod
next prev parent reply other threads:[~2018-04-06 4:56 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-05 16:48 [PATCH v2 00/13] soundwire: Add stream support Vinod Koul
2018-04-05 16:48 ` [PATCH v2 01/13] soundwire: Add more documentation Vinod Koul
2018-04-05 21:37 ` Pierre-Louis Bossart
2018-04-06 3:24 ` Vinod Koul
2018-04-06 15:24 ` Pierre-Louis Bossart
2018-04-10 4:04 ` Vinod Koul
2018-04-05 16:48 ` [PATCH v2 02/13] soundwire: Add support for SoundWire stream management Vinod Koul
2018-04-05 22:34 ` Pierre-Louis Bossart
2018-04-06 4:53 ` Vinod Koul
2018-04-06 15:21 ` Pierre-Louis Bossart
2018-04-10 4:43 ` Vinod Koul
2018-04-10 15:47 ` Pierre-Louis Bossart
2018-04-11 3:41 ` [alsa-devel] " Vinod Koul
2018-04-05 16:48 ` [PATCH v2 03/13] soundwire: Add support for port management Vinod Koul
2018-04-05 23:04 ` Pierre-Louis Bossart
2018-04-06 5:00 ` Vinod Koul [this message]
2018-04-06 15:26 ` Pierre-Louis Bossart
2018-04-05 16:48 ` [PATCH v2 04/13] soundwire: Add Master and Slave port programming Vinod Koul
2018-04-05 23:14 ` Pierre-Louis Bossart
2018-04-06 5:01 ` Vinod Koul
2018-04-05 16:48 ` [PATCH v2 05/13] soundwire: Add helpers for ports operations Vinod Koul
2018-04-05 23:27 ` Pierre-Louis Bossart
2018-04-06 5:05 ` Vinod Koul
2018-04-05 16:48 ` [PATCH v2 06/13] soundwire: Add bank switch routine Vinod Koul
2018-04-05 23:35 ` Pierre-Louis Bossart
2018-04-06 8:33 ` Vinod Koul
2018-04-05 16:48 ` [PATCH v2 07/13] soundwire: Add stream configuration APIs Vinod Koul
2018-04-05 23:40 ` Pierre-Louis Bossart
2018-04-06 8:48 ` Vinod Koul
2018-04-06 15:28 ` Pierre-Louis Bossart
2018-04-05 16:48 ` [PATCH v2 08/13] ASoC: Add SoundWire stream programming interface Vinod Koul
2018-04-05 23:42 ` Pierre-Louis Bossart
2018-04-06 8:49 ` Vinod Koul
2018-04-05 16:48 ` [PATCH v2 09/13] soundwire: Remove cdns_master_ops Vinod Koul
2018-04-05 16:48 ` [PATCH v2 10/13] soundwire: cdns: Add port routines Vinod Koul
2018-04-06 0:19 ` Pierre-Louis Bossart
2018-04-06 8:55 ` Vinod Koul
2018-04-06 15:29 ` Pierre-Louis Bossart
2018-04-05 16:48 ` [PATCH v2 11/13] soundwire: cdns: Add stream routines Vinod Koul
2018-04-06 0:29 ` Pierre-Louis Bossart
2018-04-06 8:57 ` Vinod Koul
2018-04-05 16:48 ` [PATCH v2 12/13] soundwire: intel: Add stream initialization Vinod Koul
2018-04-05 16:48 ` [PATCH v2 13/13] soundwire: intel: Add audio DAI ops Vinod Koul
2018-04-06 0:46 ` [PATCH v2 00/13] soundwire: Add stream support Pierre-Louis Bossart
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=20180406050029.GF6014@localhost \
--to=vinod.koul@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=liam.r.girdwood@linux.intel.com \
--cc=patches.audio@intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=sanyog.r.kale@intel.com \
--cc=tiwai@suse.de \
/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