alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soundwire: qcom: Fix enumeration of second device on the bus
@ 2023-04-05 14:29 Krzysztof Kozlowski
  2023-04-05 15:01 ` Pierre-Louis Bossart
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2023-04-05 14:29 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul,
	Bard Liao, Pierre-Louis Bossart, Sanyog Kale,
	Srinivas Kandagatla, linux-arm-msm, alsa-devel, linux-kernel
  Cc: Krzysztof Kozlowski, stable, Patrick Lai

Some Soundwire buses (like &swr0 on Qualcomm HDK8450) have two devices,
which can be brought from powerdown state one after another.  We need to
keep enumerating them on each slave attached interrupt, otherwise only
first will appear.

Cc: <stable@vger.kernel.org>
Fixes: a6e6581942ca ("soundwire: qcom: add auto enumeration support")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

Cc: Patrick Lai <quic_plai@quicinc.com>
---
 drivers/soundwire/qcom.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index c296e0bf897b..1e5077d91f59 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -587,14 +587,9 @@ static irqreturn_t qcom_swrm_irq_handler(int irq, void *dev_id)
 			case SWRM_INTERRUPT_STATUS_CHANGE_ENUM_SLAVE_STATUS:
 				dev_dbg_ratelimited(swrm->dev, "SWR new slave attached\n");
 				swrm->reg_read(swrm, SWRM_MCP_SLV_STATUS, &slave_status);
-				if (swrm->slave_status == slave_status) {
-					dev_dbg(swrm->dev, "Slave status not changed %x\n",
-						slave_status);
-				} else {
-					qcom_swrm_get_device_status(swrm);
-					qcom_swrm_enumerate(&swrm->bus);
-					sdw_handle_slave_status(&swrm->bus, swrm->status);
-				}
+				qcom_swrm_get_device_status(swrm);
+				qcom_swrm_enumerate(&swrm->bus);
+				sdw_handle_slave_status(&swrm->bus, swrm->status);
 				break;
 			case SWRM_INTERRUPT_STATUS_MASTER_CLASH_DET:
 				dev_err_ratelimited(swrm->dev,
-- 
2.34.1


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

* Re: [PATCH] soundwire: qcom: Fix enumeration of second device on the bus
  2023-04-05 14:29 [PATCH] soundwire: qcom: Fix enumeration of second device on the bus Krzysztof Kozlowski
@ 2023-04-05 15:01 ` Pierre-Louis Bossart
  2023-04-06  7:03   ` Krzysztof Kozlowski
  0 siblings, 1 reply; 3+ messages in thread
From: Pierre-Louis Bossart @ 2023-04-05 15:01 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Vinod Koul, Bard Liao, Sanyog Kale, Srinivas Kandagatla,
	linux-arm-msm, alsa-devel, linux-kernel
  Cc: stable, Patrick Lai



On 4/5/23 09:29, Krzysztof Kozlowski wrote:
> Some Soundwire buses (like &swr0 on Qualcomm HDK8450) have two devices,
> which can be brought from powerdown state one after another.  We need to
> keep enumerating them on each slave attached interrupt, otherwise only
> first will appear.
> 
> Cc: <stable@vger.kernel.org>
> Fixes: a6e6581942ca ("soundwire: qcom: add auto enumeration support")
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> ---
> 
> Cc: Patrick Lai <quic_plai@quicinc.com>
> ---
>  drivers/soundwire/qcom.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> index c296e0bf897b..1e5077d91f59 100644
> --- a/drivers/soundwire/qcom.c
> +++ b/drivers/soundwire/qcom.c
> @@ -587,14 +587,9 @@ static irqreturn_t qcom_swrm_irq_handler(int irq, void *dev_id)
>  			case SWRM_INTERRUPT_STATUS_CHANGE_ENUM_SLAVE_STATUS:
>  				dev_dbg_ratelimited(swrm->dev, "SWR new slave attached\n");
>  				swrm->reg_read(swrm, SWRM_MCP_SLV_STATUS, &slave_status);
> -				if (swrm->slave_status == slave_status) {
> -					dev_dbg(swrm->dev, "Slave status not changed %x\n",
> -						slave_status);

it's not clear to me how removing this test helps with the two-device
configuration?

Or is this a case where the status for both devices changes at the same
time but the interrupt status remains set, so the next iteration of the
loop is ignored?

> -				} else {
> -					qcom_swrm_get_device_status(swrm);
> -					qcom_swrm_enumerate(&swrm->bus);
> -					sdw_handle_slave_status(&swrm->bus, swrm->status);
> -				}
> +				qcom_swrm_get_device_status(swrm);
> +				qcom_swrm_enumerate(&swrm->bus);
> +				sdw_handle_slave_status(&swrm->bus, swrm->status);
>  				break;
>  			case SWRM_INTERRUPT_STATUS_MASTER_CLASH_DET:
>  				dev_err_ratelimited(swrm->dev,

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

* Re: [PATCH] soundwire: qcom: Fix enumeration of second device on the bus
  2023-04-05 15:01 ` Pierre-Louis Bossart
@ 2023-04-06  7:03   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2023-04-06  7:03 UTC (permalink / raw)
  To: Pierre-Louis Bossart, Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Vinod Koul, Bard Liao, Sanyog Kale, Srinivas Kandagatla,
	linux-arm-msm, alsa-devel, linux-kernel
  Cc: stable, Patrick Lai

On 05/04/2023 17:01, Pierre-Louis Bossart wrote:
> 
> 
> On 4/5/23 09:29, Krzysztof Kozlowski wrote:
>> Some Soundwire buses (like &swr0 on Qualcomm HDK8450) have two devices,
>> which can be brought from powerdown state one after another.  We need to
>> keep enumerating them on each slave attached interrupt, otherwise only
>> first will appear.
>>
>> Cc: <stable@vger.kernel.org>
>> Fixes: a6e6581942ca ("soundwire: qcom: add auto enumeration support")
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>
>> ---
>>
>> Cc: Patrick Lai <quic_plai@quicinc.com>
>> ---
>>  drivers/soundwire/qcom.c | 11 +++--------
>>  1 file changed, 3 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
>> index c296e0bf897b..1e5077d91f59 100644
>> --- a/drivers/soundwire/qcom.c
>> +++ b/drivers/soundwire/qcom.c
>> @@ -587,14 +587,9 @@ static irqreturn_t qcom_swrm_irq_handler(int irq, void *dev_id)
>>  			case SWRM_INTERRUPT_STATUS_CHANGE_ENUM_SLAVE_STATUS:
>>  				dev_dbg_ratelimited(swrm->dev, "SWR new slave attached\n");
>>  				swrm->reg_read(swrm, SWRM_MCP_SLV_STATUS, &slave_status);
>> -				if (swrm->slave_status == slave_status) {
>> -					dev_dbg(swrm->dev, "Slave status not changed %x\n",
>> -						slave_status);
> 
> it's not clear to me how removing this test helps with the two-device
> configuration?
> 
> Or is this a case where the status for both devices changes at the same
> time but the interrupt status remains set, so the next iteration of the
> loop is ignored?

I think the patch is not correct. I misinterpreted the slave status
field and after double checking I see two speakers bound. Please ignore
for now.

Best regards,
Krzysztof


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

end of thread, other threads:[~2023-04-06  7:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-05 14:29 [PATCH] soundwire: qcom: Fix enumeration of second device on the bus Krzysztof Kozlowski
2023-04-05 15:01 ` Pierre-Louis Bossart
2023-04-06  7:03   ` Krzysztof Kozlowski

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).