All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: ALSA <alsa-devel@alsa-project.org>,
	Charles Keepax <ckeepax@opensource.cirrus.com>,
	Sudheer Papothi <spapothi@codeaurora.org>,
	Takashi <tiwai@suse.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	plai@codeaurora.org, LKML <linux-kernel@vger.kernel.org>,
	patches.audio@intel.com, Mark <broonie@kernel.org>,
	srinivas.kandagatla@linaro.org,
	Sagar Dharia <sdharia@codeaurora.org>,
	alan@linux.intel.com
Subject: Re: [PATCH v4 04/15] soundwire: Add MIPI DisCo property helpers
Date: Sun, 3 Dec 2017 22:22:03 +0530	[thread overview]
Message-ID: <20171203165203.GM32417@localhost> (raw)
In-Reply-To: <4a79c26c-db39-700c-627b-f474200f9a7f@linux.intel.com>

On Fri, Dec 01, 2017 at 04:49:01PM -0600, Pierre-Louis Bossart wrote:

> >+int sdw_master_read_prop(struct sdw_bus *bus)
> >+{
> >+	struct sdw_master_prop *prop = &bus->prop;
> >+	struct fwnode_handle *link;
> >+	unsigned int count = 0;
> >+	char name[32];
> >+	int nval, i;
> >+
> >+	device_property_read_u32(bus->dev,
> >+			"mipi-sdw-sw-interface-revision", &prop->revision);
> >+	device_property_read_u32(bus->dev, "mipi-sdw-master-count", &count);
> >+
> >+	/* Find link handle */
> >+	snprintf(name, sizeof(name),
> >+			"mipi-sdw-link-%d-subproperties", bus->link_id);
> 
> if you follow the DisCo spec, this property is at the controller level,
> isn't there a confusion between controller/master here, and consequently are
> we reading the same things multiple times or using the wrong bus parameter?

Not sure I follow, this one is for a specific master ie a specfic link.
we need to read respective master thru mipi-sdw-link-N-subproperties

> If I look at intel_probe(), there is a clear reference to a link_id, and
> then you set the pointer to this read_prop which reads the number of links,
> which looks like the wrong order. You can't assign a link ID before knowing
> how many links there are - or you may be unable to detect issues.

Sorry I dont follow this part. FWIW, when master driver is enumerated it
know the link_id value and then sets the read_prop and then these are read.

Here we are reading "a specific link property" with the knowledge of link_id
value...

> >+	fwnode_property_read_u32(link, "mipi-sdw-default-frame-rate",
> >+				&prop->default_frame_rate);
> >+	fwnode_property_read_u32(link, "mipi-sdw-default-frame-row-size",
> >+				&prop->default_row);
> >+	fwnode_property_read_u32(link, "mipi-sdw-default-frame-col-size",
> 
> This is fine, just wondering if we should warnings if the values make no
> sense, e.g. the DisCo spec states in Note1 page 15 that the values are
> interrelated.

I think we discussed in past and that would kind of form the firmware
validation. We check all the values to see if firmware gave us sane values..

> >+	/*
> >+	 * Based on each DPn port, get source and sink dpn properties.
> >+	 * Also, some ports can operate as both source or sink.
> >+	 */
> >+
> >+	/* Allocate memory for set bits in port lists */
> >+	nval = hweight32(prop->source_ports);
> >+	num_of_ports += nval;
> 
> this and...
> 
> >+	prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval,
> >+				sizeof(*prop->src_dpn_prop), GFP_KERNEL);
> >+	if (!prop->src_dpn_prop)
> >+		return -ENOMEM;
> >+
> >+	/* Read dpn properties for source port(s) */
> >+	sdw_slave_read_dpn(slave, prop->src_dpn_prop, nval,
> >+			prop->source_ports, "source");
> >+
> >+	nval = hweight32(prop->sink_ports);
> >+	num_of_ports += nval;
> 
> ... this is no longer needed since...
> 
> >+	prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval,
> >+				sizeof(*prop->sink_dpn_prop), GFP_KERNEL);
> >+	if (!prop->sink_dpn_prop)
> >+		return -ENOMEM;
> >+
> >+	/* Read dpn properties for sink port(s) */
> >+	sdw_slave_read_dpn(slave, prop->sink_dpn_prop, nval,
> >+			prop->sink_ports, "sink");
> >+
> >+	/* some ports are bidirectional so check total ports by ORing */
> >+	nval = prop->source_ports | prop->sink_ports;
> >+	num_of_ports = hweight32(nval) + 1; /* add 1 for DP0 */
> 
> ... you reassign the value here. That was one earlier feedback from me but
> you left the variable incrementation in the code.

This seems to have artifact of merge conflicts as I clearly remember removing
this, thanks for pointing will remove these..

> >+/**
> >+ * enum sdw_clk_stop_mode - Clock Stop modes
> >+ * @SDW_CLK_STOP_MODE0: Slave can continue operation seamlessly on clock
> >+ * restart
> >+ * @SDW_CLK_STOP_MODE1: Slave may have entered a deeper power-saving mode,
> >+ * not capable of continuing operation seamlessly when the clock restarts
> >+ */
> >+enum sdw_clk_stop_mode {
> >+	SDW_CLK_STOP_MODE0 = 1,
> >+	SDW_CLK_STOP_MODE1 = 2,
> 
> why not 0 and 1?

why not 1 and 2 :D

I think it was to ensure we have a non zero value, but am not sure, will
check though..

-- 
~Vinod

WARNING: multiple messages have this Message-ID (diff)
From: Vinod Koul <vinod.koul@intel.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	ALSA <alsa-devel@alsa-project.org>, Mark <broonie@kernel.org>,
	Takashi <tiwai@suse.de>,
	patches.audio@intel.com, alan@linux.intel.com,
	Charles Keepax <ckeepax@opensource.cirrus.com>,
	Sagar Dharia <sdharia@codeaurora.org>,
	srinivas.kandagatla@linaro.org, plai@codeaurora.org,
	Sudheer Papothi <spapothi@codeaurora.org>
Subject: Re: [alsa-devel] [PATCH v4 04/15] soundwire: Add MIPI DisCo property helpers
Date: Sun, 3 Dec 2017 22:22:03 +0530	[thread overview]
Message-ID: <20171203165203.GM32417@localhost> (raw)
In-Reply-To: <4a79c26c-db39-700c-627b-f474200f9a7f@linux.intel.com>

On Fri, Dec 01, 2017 at 04:49:01PM -0600, Pierre-Louis Bossart wrote:

> >+int sdw_master_read_prop(struct sdw_bus *bus)
> >+{
> >+	struct sdw_master_prop *prop = &bus->prop;
> >+	struct fwnode_handle *link;
> >+	unsigned int count = 0;
> >+	char name[32];
> >+	int nval, i;
> >+
> >+	device_property_read_u32(bus->dev,
> >+			"mipi-sdw-sw-interface-revision", &prop->revision);
> >+	device_property_read_u32(bus->dev, "mipi-sdw-master-count", &count);
> >+
> >+	/* Find link handle */
> >+	snprintf(name, sizeof(name),
> >+			"mipi-sdw-link-%d-subproperties", bus->link_id);
> 
> if you follow the DisCo spec, this property is at the controller level,
> isn't there a confusion between controller/master here, and consequently are
> we reading the same things multiple times or using the wrong bus parameter?

Not sure I follow, this one is for a specific master ie a specfic link.
we need to read respective master thru mipi-sdw-link-N-subproperties

> If I look at intel_probe(), there is a clear reference to a link_id, and
> then you set the pointer to this read_prop which reads the number of links,
> which looks like the wrong order. You can't assign a link ID before knowing
> how many links there are - or you may be unable to detect issues.

Sorry I dont follow this part. FWIW, when master driver is enumerated it
know the link_id value and then sets the read_prop and then these are read.

Here we are reading "a specific link property" with the knowledge of link_id
value...

> >+	fwnode_property_read_u32(link, "mipi-sdw-default-frame-rate",
> >+				&prop->default_frame_rate);
> >+	fwnode_property_read_u32(link, "mipi-sdw-default-frame-row-size",
> >+				&prop->default_row);
> >+	fwnode_property_read_u32(link, "mipi-sdw-default-frame-col-size",
> 
> This is fine, just wondering if we should warnings if the values make no
> sense, e.g. the DisCo spec states in Note1 page 15 that the values are
> interrelated.

I think we discussed in past and that would kind of form the firmware
validation. We check all the values to see if firmware gave us sane values..

> >+	/*
> >+	 * Based on each DPn port, get source and sink dpn properties.
> >+	 * Also, some ports can operate as both source or sink.
> >+	 */
> >+
> >+	/* Allocate memory for set bits in port lists */
> >+	nval = hweight32(prop->source_ports);
> >+	num_of_ports += nval;
> 
> this and...
> 
> >+	prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval,
> >+				sizeof(*prop->src_dpn_prop), GFP_KERNEL);
> >+	if (!prop->src_dpn_prop)
> >+		return -ENOMEM;
> >+
> >+	/* Read dpn properties for source port(s) */
> >+	sdw_slave_read_dpn(slave, prop->src_dpn_prop, nval,
> >+			prop->source_ports, "source");
> >+
> >+	nval = hweight32(prop->sink_ports);
> >+	num_of_ports += nval;
> 
> ... this is no longer needed since...
> 
> >+	prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval,
> >+				sizeof(*prop->sink_dpn_prop), GFP_KERNEL);
> >+	if (!prop->sink_dpn_prop)
> >+		return -ENOMEM;
> >+
> >+	/* Read dpn properties for sink port(s) */
> >+	sdw_slave_read_dpn(slave, prop->sink_dpn_prop, nval,
> >+			prop->sink_ports, "sink");
> >+
> >+	/* some ports are bidirectional so check total ports by ORing */
> >+	nval = prop->source_ports | prop->sink_ports;
> >+	num_of_ports = hweight32(nval) + 1; /* add 1 for DP0 */
> 
> ... you reassign the value here. That was one earlier feedback from me but
> you left the variable incrementation in the code.

This seems to have artifact of merge conflicts as I clearly remember removing
this, thanks for pointing will remove these..

> >+/**
> >+ * enum sdw_clk_stop_mode - Clock Stop modes
> >+ * @SDW_CLK_STOP_MODE0: Slave can continue operation seamlessly on clock
> >+ * restart
> >+ * @SDW_CLK_STOP_MODE1: Slave may have entered a deeper power-saving mode,
> >+ * not capable of continuing operation seamlessly when the clock restarts
> >+ */
> >+enum sdw_clk_stop_mode {
> >+	SDW_CLK_STOP_MODE0 = 1,
> >+	SDW_CLK_STOP_MODE1 = 2,
> 
> why not 0 and 1?

why not 1 and 2 :D

I think it was to ensure we have a non zero value, but am not sure, will
check though..

-- 
~Vinod

  reply	other threads:[~2017-12-03 16:48 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-01  9:56 [PATCH v4 00/15] soundwire: Add a new SoundWire subsystem Vinod Koul
2017-12-01  9:56 ` [PATCH v4 01/15] Documentation: Add SoundWire summary Vinod Koul
2017-12-01  9:56 ` [PATCH v4 02/15] soundwire: Add SoundWire bus type Vinod Koul
2017-12-01  9:56   ` Vinod Koul
2017-12-01  9:56 ` [PATCH v4 03/15] soundwire: Add Master registration Vinod Koul
2017-12-01 22:10   ` [alsa-devel] " Pierre-Louis Bossart
2017-12-03 16:41     ` Vinod Koul
2017-12-04  2:44       ` Pierre-Louis Bossart
2017-12-04  2:59         ` Vinod Koul
2017-12-01  9:56 ` [PATCH v4 04/15] soundwire: Add MIPI DisCo property helpers Vinod Koul
2017-12-01  9:56   ` Vinod Koul
2017-12-01 22:49   ` [alsa-devel] " Pierre-Louis Bossart
2017-12-03 16:52     ` Vinod Koul [this message]
2017-12-03 16:52       ` Vinod Koul
2017-12-04  2:50       ` Pierre-Louis Bossart
2017-12-04  2:50         ` [alsa-devel] " Pierre-Louis Bossart
2017-12-01  9:56 ` [PATCH v4 05/15] soundwire: Add SoundWire MIPI defined registers Vinod Koul
2017-12-01  9:56   ` Vinod Koul
2017-12-01  9:56 ` [PATCH v4 06/15] soundwire: Add IO transfer Vinod Koul
2017-12-01 23:27   ` [alsa-devel] " Pierre-Louis Bossart
2017-12-03 17:04     ` Vinod Koul
2017-12-03 17:04       ` [alsa-devel] " Vinod Koul
2017-12-04  3:01       ` Pierre-Louis Bossart
2017-12-05  6:31         ` Vinod Koul
2017-12-05 13:43           ` Pierre-Louis Bossart
2017-12-05 14:48             ` Pierre-Louis Bossart
2017-12-05 14:48               ` [alsa-devel] " Pierre-Louis Bossart
2017-12-06  5:58               ` Vinod Koul
2017-12-06 13:32                 ` Pierre-Louis Bossart
2017-12-06 13:32                   ` [alsa-devel] " Pierre-Louis Bossart
2017-12-06 14:44                   ` Vinod Koul
2017-12-01  9:56 ` [PATCH v4 07/15] regmap: Add SoundWire bus support Vinod Koul
2017-12-01  9:56   ` Vinod Koul
2017-12-01  9:56 ` [PATCH v4 08/15] soundwire: Add Slave status handling helpers Vinod Koul
2017-12-01 23:36   ` [alsa-devel] " Pierre-Louis Bossart
2017-12-03 17:08     ` Vinod Koul
2017-12-04  3:07       ` Pierre-Louis Bossart
2017-12-04  3:07         ` [alsa-devel] " Pierre-Louis Bossart
2017-12-04  3:13         ` Vinod Koul
2017-12-04  3:13           ` [alsa-devel] " Vinod Koul
2017-12-01  9:56 ` [PATCH v4 09/15] soundwire: Add slave status handling Vinod Koul
2017-12-01 23:52   ` [alsa-devel] " Pierre-Louis Bossart
2017-12-03 17:11     ` Vinod Koul
2017-12-03 17:11       ` [alsa-devel] " Vinod Koul
2017-12-04  3:11       ` Pierre-Louis Bossart
2017-12-04  3:21         ` Vinod Koul
2017-12-04  3:21           ` [alsa-devel] " Vinod Koul
2017-12-04  3:52           ` Pierre-Louis Bossart
2017-12-04  3:52             ` [alsa-devel] " Pierre-Louis Bossart
2017-12-06  9:44             ` Vinod Koul
2017-12-06  9:44               ` [alsa-devel] " Vinod Koul
2017-12-01  9:56 ` [PATCH v4 10/15] soundwire: Add sysfs for SoundWire DisCo properties Vinod Koul
2017-12-01  9:56 ` [PATCH v4 11/15] soundwire: cdns: Add cadence library Vinod Koul
2017-12-01  9:56   ` Vinod Koul
2017-12-01  9:56 ` [PATCH v4 12/15] soundwire: cdns: Add sdw_master_ops and IO transfer support Vinod Koul
2017-12-02  0:02   ` Pierre-Louis Bossart
2017-12-02  0:02     ` [alsa-devel] " Pierre-Louis Bossart
2017-12-03 17:10     ` Vinod Koul
2017-12-03 17:10       ` [alsa-devel] " Vinod Koul
2017-12-01  9:56 ` [PATCH v4 13/15] soundwire: intel: Add Intel Master driver Vinod Koul
2017-12-01  9:56 ` [PATCH v4 14/15] soundwire: intel: Add Intel init module Vinod Koul
2017-12-01  9:56 ` [PATCH v4 15/15] MAINTAINERS: Add SoundWire entry Vinod Koul
2017-12-02  0:24 ` [PATCH v4 00/15] soundwire: Add a new SoundWire subsystem Pierre-Louis Bossart
2017-12-02  0:24   ` [alsa-devel] " Pierre-Louis Bossart
2017-12-03 17:12   ` Vinod Koul
2017-12-03 17:12     ` [alsa-devel] " 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=20171203165203.GM32417@localhost \
    --to=vinod.koul@intel.com \
    --cc=alan@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches.audio@intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=plai@codeaurora.org \
    --cc=sdharia@codeaurora.org \
    --cc=spapothi@codeaurora.org \
    --cc=srinivas.kandagatla@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.