All of lore.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: vkoul@kernel.org, yung-chuan.liao@linux.intel.com
Cc: pierre-louis.bossart@linux.intel.com, sanyog.r.kale@intel.com,
	gregkh@linuxfoundation.org, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: [RFC PATCH 2/2] soundwire: qcom: add support for static port mapping
Date: Wed, 20 Jan 2021 18:01:10 +0000	[thread overview]
Message-ID: <20210120180110.8357-3-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <20210120180110.8357-1-srinivas.kandagatla@linaro.org>

On some of Qualcomm SoundWire controller instances ports are statically
mapped based on the functionalities. So add support for such mapping.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/qcom.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 6d22df01f354..0641b591037e 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -474,7 +474,10 @@ static int qcom_swrm_compute_params(struct sdw_bus *bus)
 
 		list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) {
 			list_for_each_entry(p_rt, &s_rt->port_list, port_node) {
-				pcfg = &ctrl->pconfig[i];
+				if (p_rt->is_static_map)
+					pcfg = &ctrl->pconfig[p_rt->mapped_port_num - 1];
+				else
+					pcfg = &ctrl->pconfig[i];
 				p_rt->transport_params.port_num = p_rt->num;
 				p_rt->transport_params.sample_interval =
 					pcfg->si + 1;
@@ -551,7 +554,11 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl,
 		list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) {
 			list_for_each_entry(p_rt, &s_rt->port_list, port_node) {
 				/* Port numbers start from 1 - 14*/
-				pn = find_first_zero_bit(port_mask, maxport);
+				if (p_rt->is_static_map)
+					pn = p_rt->mapped_port_num;
+				else
+					pn = find_first_zero_bit(port_mask, maxport);
+
 				if (pn > (maxport - 1)) {
 					dev_err(ctrl->dev, "All ports busy\n");
 					ret = -EBUSY;
-- 
2.21.0


WARNING: multiple messages have this Message-ID (diff)
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: vkoul@kernel.org, yung-chuan.liao@linux.intel.com
Cc: alsa-devel@alsa-project.org, gregkh@linuxfoundation.org,
	pierre-louis.bossart@linux.intel.com,
	linux-kernel@vger.kernel.org,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	sanyog.r.kale@intel.com
Subject: [RFC PATCH 2/2] soundwire: qcom: add support for static port mapping
Date: Wed, 20 Jan 2021 18:01:10 +0000	[thread overview]
Message-ID: <20210120180110.8357-3-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <20210120180110.8357-1-srinivas.kandagatla@linaro.org>

On some of Qualcomm SoundWire controller instances ports are statically
mapped based on the functionalities. So add support for such mapping.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/qcom.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 6d22df01f354..0641b591037e 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -474,7 +474,10 @@ static int qcom_swrm_compute_params(struct sdw_bus *bus)
 
 		list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) {
 			list_for_each_entry(p_rt, &s_rt->port_list, port_node) {
-				pcfg = &ctrl->pconfig[i];
+				if (p_rt->is_static_map)
+					pcfg = &ctrl->pconfig[p_rt->mapped_port_num - 1];
+				else
+					pcfg = &ctrl->pconfig[i];
 				p_rt->transport_params.port_num = p_rt->num;
 				p_rt->transport_params.sample_interval =
 					pcfg->si + 1;
@@ -551,7 +554,11 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl,
 		list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) {
 			list_for_each_entry(p_rt, &s_rt->port_list, port_node) {
 				/* Port numbers start from 1 - 14*/
-				pn = find_first_zero_bit(port_mask, maxport);
+				if (p_rt->is_static_map)
+					pn = p_rt->mapped_port_num;
+				else
+					pn = find_first_zero_bit(port_mask, maxport);
+
 				if (pn > (maxport - 1)) {
 					dev_err(ctrl->dev, "All ports busy\n");
 					ret = -EBUSY;
-- 
2.21.0


  parent reply	other threads:[~2021-01-20 18:05 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20 18:01 [RFC PATCH 0/2] soundwire: add static port mapping support Srinivas Kandagatla
2021-01-20 18:01 ` Srinivas Kandagatla
2021-01-20 18:01 ` [RFC PATCH 1/2] soundwire: add support for static port mapping Srinivas Kandagatla
2021-01-20 18:01   ` Srinivas Kandagatla
2021-01-20 22:15   ` Pierre-Louis Bossart
2021-01-20 22:15     ` Pierre-Louis Bossart
2021-01-21 11:35     ` Srinivas Kandagatla
2021-01-21 11:35       ` Srinivas Kandagatla
2021-01-21 14:56       ` Pierre-Louis Bossart
2021-01-21 15:41         ` Srinivas Kandagatla
2021-01-21 18:00           ` Pierre-Louis Bossart
2021-01-21 18:41             ` Srinivas Kandagatla
2021-01-21 21:30               ` Pierre-Louis Bossart
2021-01-22  7:05                 ` Srinivas Kandagatla
2021-01-22 15:32                   ` Pierre-Louis Bossart
2021-01-22 15:46                     ` Srinivas Kandagatla
2021-01-22 16:42                       ` Pierre-Louis Bossart
2021-01-25 16:23                         ` Srinivas Kandagatla
2021-02-01 10:27                           ` Vinod Koul
2021-02-01 10:27                             ` Vinod Koul
2021-02-19 10:35                             ` Srinivas Kandagatla
2021-02-19 10:35                               ` Srinivas Kandagatla
2021-02-19 19:52                               ` Pierre-Louis Bossart
2021-02-19 19:52                                 ` Pierre-Louis Bossart
2021-02-22 13:40                                 ` Srinivas Kandagatla
2021-02-22 13:40                                   ` Srinivas Kandagatla
2021-01-20 18:01 ` Srinivas Kandagatla [this message]
2021-01-20 18:01   ` [RFC PATCH 2/2] soundwire: qcom: " Srinivas Kandagatla

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=20210120180110.8357-3-srinivas.kandagatla@linaro.org \
    --to=srinivas.kandagatla@linaro.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=vkoul@kernel.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 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.