public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] soundwire: qcom: allow multi-link on newer devices
@ 2024-04-05 14:41 Krzysztof Kozlowski
  2024-04-11  9:49 ` Vinod Koul
  2024-04-11 17:48 ` Vinod Koul
  0 siblings, 2 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-05 14:41 UTC (permalink / raw)
  To: Vinod Koul, Bard Liao, Pierre-Louis Bossart, Sanyog Kale,
	linux-arm-msm, alsa-devel, linux-kernel
  Cc: Krzysztof Kozlowski, Mark Brown

Newer Qualcomm SoCs like X1E80100 might come with four speakers spread
over two Soundwire controllers, thus they need a multi-link Soundwire
stream runtime.

Cc: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

Changes in v2:
1. Only rebase (slightly different context)
---
 drivers/soundwire/qcom.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index fb70afe64fcc..ce5cf3ecceb5 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -905,6 +905,18 @@ static int qcom_swrm_init(struct qcom_swrm_ctrl *ctrl)
 	return 0;
 }
 
+static int qcom_swrm_read_prop(struct sdw_bus *bus)
+{
+	struct qcom_swrm_ctrl *ctrl = to_qcom_sdw(bus);
+
+	if (ctrl->version >= SWRM_VERSION_2_0_0) {
+		bus->multi_link = true;
+		bus->hw_sync_min_links = 3;
+	}
+
+	return 0;
+}
+
 static enum sdw_command_response qcom_swrm_xfer_msg(struct sdw_bus *bus,
 						    struct sdw_msg *msg)
 {
@@ -1056,6 +1068,7 @@ static const struct sdw_master_port_ops qcom_swrm_port_ops = {
 };
 
 static const struct sdw_master_ops qcom_swrm_ops = {
+	.read_prop = qcom_swrm_read_prop,
 	.xfer_msg = qcom_swrm_xfer_msg,
 	.pre_bank_switch = qcom_swrm_pre_bank_switch,
 };
@@ -1173,6 +1186,15 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl,
 
 	mutex_lock(&ctrl->port_lock);
 	list_for_each_entry(m_rt, &stream->master_list, stream_node) {
+		/*
+		 * For streams with multiple masters:
+		 * Allocate ports only for devices connected to this master.
+		 * Such devices will have ports allocated by their own master
+		 * and its qcom_swrm_stream_alloc_ports() call.
+		 */
+		if (ctrl->bus.id != m_rt->bus->id)
+			continue;
+
 		if (m_rt->direction == SDW_DATA_DIR_RX) {
 			maxport = ctrl->num_dout_ports;
 			port_mask = &ctrl->dout_port_mask;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] soundwire: qcom: allow multi-link on newer devices
  2024-04-05 14:41 [PATCH v2] soundwire: qcom: allow multi-link on newer devices Krzysztof Kozlowski
@ 2024-04-11  9:49 ` Vinod Koul
  2024-04-11 10:10   ` Krzysztof Kozlowski
  2024-04-11 17:48 ` Vinod Koul
  1 sibling, 1 reply; 5+ messages in thread
From: Vinod Koul @ 2024-04-11  9:49 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Bard Liao, Pierre-Louis Bossart, Sanyog Kale, linux-arm-msm,
	alsa-devel, linux-kernel, Mark Brown

On 05-04-24, 16:41, Krzysztof Kozlowski wrote:
> Newer Qualcomm SoCs like X1E80100 might come with four speakers spread
> over two Soundwire controllers, thus they need a multi-link Soundwire
> stream runtime.
> 
> Cc: Mark Brown <broonie@kernel.org>
> Cc: alsa-devel@alsa-project.org
> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> ---
> 
> Changes in v2:
> 1. Only rebase (slightly different context)

Applying /tmp/v2_20240405_krzysztof_kozlowski_soundwire_qcom_allow_multi_link_on_newer_devices.mbx
Applying: soundwire: qcom: allow multi-link on newer devices
error: drivers/soundwire/qcom.c: does not match index
Patch failed at 0001 soundwire: qcom: allow multi-link on newer devices

This fails as well :-(


> ---
>  drivers/soundwire/qcom.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> index fb70afe64fcc..ce5cf3ecceb5 100644
> --- a/drivers/soundwire/qcom.c
> +++ b/drivers/soundwire/qcom.c
> @@ -905,6 +905,18 @@ static int qcom_swrm_init(struct qcom_swrm_ctrl *ctrl)
>  	return 0;
>  }
>  
> +static int qcom_swrm_read_prop(struct sdw_bus *bus)
> +{
> +	struct qcom_swrm_ctrl *ctrl = to_qcom_sdw(bus);
> +
> +	if (ctrl->version >= SWRM_VERSION_2_0_0) {
> +		bus->multi_link = true;
> +		bus->hw_sync_min_links = 3;
> +	}
> +
> +	return 0;
> +}
> +
>  static enum sdw_command_response qcom_swrm_xfer_msg(struct sdw_bus *bus,
>  						    struct sdw_msg *msg)
>  {
> @@ -1056,6 +1068,7 @@ static const struct sdw_master_port_ops qcom_swrm_port_ops = {
>  };
>  
>  static const struct sdw_master_ops qcom_swrm_ops = {
> +	.read_prop = qcom_swrm_read_prop,
>  	.xfer_msg = qcom_swrm_xfer_msg,
>  	.pre_bank_switch = qcom_swrm_pre_bank_switch,
>  };
> @@ -1173,6 +1186,15 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl,
>  
>  	mutex_lock(&ctrl->port_lock);
>  	list_for_each_entry(m_rt, &stream->master_list, stream_node) {
> +		/*
> +		 * For streams with multiple masters:
> +		 * Allocate ports only for devices connected to this master.
> +		 * Such devices will have ports allocated by their own master
> +		 * and its qcom_swrm_stream_alloc_ports() call.
> +		 */
> +		if (ctrl->bus.id != m_rt->bus->id)
> +			continue;
> +
>  		if (m_rt->direction == SDW_DATA_DIR_RX) {
>  			maxport = ctrl->num_dout_ports;
>  			port_mask = &ctrl->dout_port_mask;
> -- 
> 2.34.1

-- 
~Vinod

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] soundwire: qcom: allow multi-link on newer devices
  2024-04-11  9:49 ` Vinod Koul
@ 2024-04-11 10:10   ` Krzysztof Kozlowski
  2024-04-11 17:19     ` Vinod Koul
  0 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-11 10:10 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Bard Liao, Pierre-Louis Bossart, Sanyog Kale, linux-arm-msm,
	alsa-devel, linux-kernel, Mark Brown

On 11/04/2024 11:49, Vinod Koul wrote:
> On 05-04-24, 16:41, Krzysztof Kozlowski wrote:
>> Newer Qualcomm SoCs like X1E80100 might come with four speakers spread
>> over two Soundwire controllers, thus they need a multi-link Soundwire
>> stream runtime.
>>
>> Cc: Mark Brown <broonie@kernel.org>
>> Cc: alsa-devel@alsa-project.org
>> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>
>> ---
>>
>> Changes in v2:
>> 1. Only rebase (slightly different context)
> 
> Applying /tmp/v2_20240405_krzysztof_kozlowski_soundwire_qcom_allow_multi_link_on_newer_devices.mbx
> Applying: soundwire: qcom: allow multi-link on newer devices
> error: drivers/soundwire/qcom.c: does not match index
> Patch failed at 0001 soundwire: qcom: allow multi-link on newer devices
> 
> This fails as well :-(

I just applied it on v6.9-rc3 and next-20240410 with b4. No problems.

Did anything change since yesterday next? Can you point me to the tree
and branch you are using?

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] soundwire: qcom: allow multi-link on newer devices
  2024-04-11 10:10   ` Krzysztof Kozlowski
@ 2024-04-11 17:19     ` Vinod Koul
  0 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2024-04-11 17:19 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Bard Liao, Pierre-Louis Bossart, Sanyog Kale, linux-arm-msm,
	alsa-devel, linux-kernel, Mark Brown

On 11-04-24, 12:10, Krzysztof Kozlowski wrote:
> On 11/04/2024 11:49, Vinod Koul wrote:
> > On 05-04-24, 16:41, Krzysztof Kozlowski wrote:
> >> Newer Qualcomm SoCs like X1E80100 might come with four speakers spread
> >> over two Soundwire controllers, thus they need a multi-link Soundwire
> >> stream runtime.
> >>
> >> Cc: Mark Brown <broonie@kernel.org>
> >> Cc: alsa-devel@alsa-project.org
> >> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> >> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> >>
> >> ---
> >>
> >> Changes in v2:
> >> 1. Only rebase (slightly different context)
> > 
> > Applying /tmp/v2_20240405_krzysztof_kozlowski_soundwire_qcom_allow_multi_link_on_newer_devices.mbx
> > Applying: soundwire: qcom: allow multi-link on newer devices
> > error: drivers/soundwire/qcom.c: does not match index
> > Patch failed at 0001 soundwire: qcom: allow multi-link on newer devices
> > 
> > This fails as well :-(
> 
> I just applied it on v6.9-rc3 and next-20240410 with b4. No problems.
> 
> Did anything change since yesterday next? Can you point me to the tree
> and branch you are using?

Thanks for the clue, my tree was in a bad state, reset helped and the
patch is now applied

-- 
~Vinod

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] soundwire: qcom: allow multi-link on newer devices
  2024-04-05 14:41 [PATCH v2] soundwire: qcom: allow multi-link on newer devices Krzysztof Kozlowski
  2024-04-11  9:49 ` Vinod Koul
@ 2024-04-11 17:48 ` Vinod Koul
  1 sibling, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2024-04-11 17:48 UTC (permalink / raw)
  To: Bard Liao, Pierre-Louis Bossart, Sanyog Kale, linux-arm-msm,
	alsa-devel, linux-kernel, Krzysztof Kozlowski
  Cc: Mark Brown


On Fri, 05 Apr 2024 16:41:41 +0200, Krzysztof Kozlowski wrote:
> Newer Qualcomm SoCs like X1E80100 might come with four speakers spread
> over two Soundwire controllers, thus they need a multi-link Soundwire
> stream runtime.
> 
> 

Applied, thanks!

[1/1] soundwire: qcom: allow multi-link on newer devices
      commit: ce5e811e069168898ae2ff02a90de68637ed7dc4

Best regards,
-- 
~Vinod



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-11 17:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-05 14:41 [PATCH v2] soundwire: qcom: allow multi-link on newer devices Krzysztof Kozlowski
2024-04-11  9:49 ` Vinod Koul
2024-04-11 10:10   ` Krzysztof Kozlowski
2024-04-11 17:19     ` Vinod Koul
2024-04-11 17:48 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox