[PATCH v3 2/5] ASoC: qcom: sm8250: set card driver name from match data

Luca Weiss posted 5 patches 9 months, 3 weeks ago
There is a newer version of this series
[PATCH v3 2/5] ASoC: qcom: sm8250: set card driver name from match data
Posted by Luca Weiss 9 months, 3 weeks ago
Sound machine drivers for Qualcomm SoCs can be reused across multiple
SoCs. But user space ALSA UCM files depend on the card driver name which
should be set per board/SoC.

Allow such customization by using driver match data as sound card driver
name.

Also while we're already touching these lines, sort the compatibles
alphabetically.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
 sound/soc/qcom/sm8250.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c
index b70b2a5031dfbf69024666f8a1049c263efcde0a..e920b413b762c803cfcc4049f35deba828275478 100644
--- a/sound/soc/qcom/sm8250.c
+++ b/sound/soc/qcom/sm8250.c
@@ -16,7 +16,6 @@
 #include "usb_offload_utils.h"
 #include "sdw.h"
 
-#define DRIVER_NAME		"sm8250"
 #define MI2S_BCLK_RATE		1536000
 
 struct sm8250_snd_data {
@@ -200,15 +199,15 @@ static int sm8250_platform_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	card->driver_name = DRIVER_NAME;
+	card->driver_name = of_device_get_match_data(dev);
 	sm8250_add_be_ops(card);
 	return devm_snd_soc_register_card(dev, card);
 }
 
 static const struct of_device_id snd_sm8250_dt_match[] = {
-	{.compatible = "qcom,sm8250-sndcard"},
-	{.compatible = "qcom,qrb4210-rb2-sndcard"},
-	{.compatible = "qcom,qrb5165-rb5-sndcard"},
+	{ .compatible = "qcom,qrb4210-rb2-sndcard", .data = "sm8250" },
+	{ .compatible = "qcom,qrb5165-rb5-sndcard", .data = "sm8250" },
+	{ .compatible = "qcom,sm8250-sndcard", .data = "sm8250" },
 	{}
 };
 

-- 
2.49.0
Re: [PATCH v3 2/5] ASoC: qcom: sm8250: set card driver name from match data
Posted by Srinivas Kandagatla 9 months, 2 weeks ago
On Fri, Apr 25, 2025 at 10:07:26AM +0200, Luca Weiss wrote:
> Sound machine drivers for Qualcomm SoCs can be reused across multiple
> SoCs. But user space ALSA UCM files depend on the card driver name which
> should be set per board/SoC.
> 
> Allow such customization by using driver match data as sound card driver
> name.
> 
> Also while we're already touching these lines, sort the compatibles
> alphabetically.
> 
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
> ---
>  sound/soc/qcom/sm8250.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c
> index b70b2a5031dfbf69024666f8a1049c263efcde0a..e920b413b762c803cfcc4049f35deba828275478 100644
> --- a/sound/soc/qcom/sm8250.c
> +++ b/sound/soc/qcom/sm8250.c
> @@ -16,7 +16,6 @@
>  #include "usb_offload_utils.h"
>  #include "sdw.h"
>  
> -#define DRIVER_NAME		"sm8250"
>  #define MI2S_BCLK_RATE		1536000
>  
>  struct sm8250_snd_data {
> @@ -200,15 +199,15 @@ static int sm8250_platform_probe(struct platform_device *pdev)
>  	if (ret)
>  		return ret;
>  
> -	card->driver_name = DRIVER_NAME;
> +	card->driver_name = of_device_get_match_data(dev);
>  	sm8250_add_be_ops(card);
>  	return devm_snd_soc_register_card(dev, card);
>  }
>  
>  static const struct of_device_id snd_sm8250_dt_match[] = {
> -	{.compatible = "qcom,sm8250-sndcard"},
> -	{.compatible = "qcom,qrb4210-rb2-sndcard"},
> -	{.compatible = "qcom,qrb5165-rb5-sndcard"},
> +	{ .compatible = "qcom,qrb4210-rb2-sndcard", .data = "sm8250" },

sm4250 for rb2?

> +	{ .compatible = "qcom,qrb5165-rb5-sndcard", .data = "sm8250" },
> +	{ .compatible = "qcom,sm8250-sndcard", .data = "sm8250" },
>  	{}
>  };
>  
> 
> -- 
> 2.49.0
>
Re: [PATCH v3 2/5] ASoC: qcom: sm8250: set card driver name from match data
Posted by Luca Weiss 9 months, 2 weeks ago
Hi Srini,

Srinivas Kandagatla <srini@kernel.org> schreef op 1 mei 2025 13:37:45 CEST:
>On Fri, Apr 25, 2025 at 10:07:26AM +0200, Luca Weiss wrote:
>> Sound machine drivers for Qualcomm SoCs can be reused across multiple
>> SoCs. But user space ALSA UCM files depend on the card driver name which
>> should be set per board/SoC.
>> 
>> Allow such customization by using driver match data as sound card driver
>> name.
>> 
>> Also while we're already touching these lines, sort the compatibles
>> alphabetically.
>> 
>> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
>> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
>> ---
>>  sound/soc/qcom/sm8250.c | 9 ++++-----
>>  1 file changed, 4 insertions(+), 5 deletions(-)
>> 
>> diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c
>> index b70b2a5031dfbf69024666f8a1049c263efcde0a..e920b413b762c803cfcc4049f35deba828275478 100644
>> --- a/sound/soc/qcom/sm8250.c
>> +++ b/sound/soc/qcom/sm8250.c
>> @@ -16,7 +16,6 @@
>>  #include "usb_offload_utils.h"
>>  #include "sdw.h"
>>  
>> -#define DRIVER_NAME		"sm8250"
>>  #define MI2S_BCLK_RATE		1536000
>>  
>>  struct sm8250_snd_data {
>> @@ -200,15 +199,15 @@ static int sm8250_platform_probe(struct platform_device *pdev)
>>  	if (ret)
>>  		return ret;
>>  
>> -	card->driver_name = DRIVER_NAME;
>> +	card->driver_name = of_device_get_match_data(dev);
>>  	sm8250_add_be_ops(card);
>>  	return devm_snd_soc_register_card(dev, card);
>>  }
>>  
>>  static const struct of_device_id snd_sm8250_dt_match[] = {
>> -	{.compatible = "qcom,sm8250-sndcard"},
>> -	{.compatible = "qcom,qrb4210-rb2-sndcard"},
>> -	{.compatible = "qcom,qrb5165-rb5-sndcard"},
>> +	{ .compatible = "qcom,qrb4210-rb2-sndcard", .data = "sm8250" },
>
>sm4250 for rb2?

Since this name is visible to user space and used for picking the UCM config, I don't think it's a good idea to change it.

Regards
Luca

>
>> +	{ .compatible = "qcom,qrb5165-rb5-sndcard", .data = "sm8250" },
>> +	{ .compatible = "qcom,sm8250-sndcard", .data = "sm8250" },
>>  	{}
>>  };
>>  
>> 
>> -- 
>> 2.49.0
>> 
Re: [PATCH v3 2/5] ASoC: qcom: sm8250: set card driver name from match data
Posted by Srinivas Kandagatla 9 months, 1 week ago
On 5/1/25 15:13, Luca Weiss wrote:
> Hi Srini,
> 
> Srinivas Kandagatla <srini@kernel.org> schreef op 1 mei 2025 13:37:45 CEST:
>> On Fri, Apr 25, 2025 at 10:07:26AM +0200, Luca Weiss wrote:
>>> Sound machine drivers for Qualcomm SoCs can be reused across multiple
>>> SoCs. But user space ALSA UCM files depend on the card driver name which
>>> should be set per board/SoC.
>>>
>>> Allow such customization by using driver match data as sound card driver
>>> name.
>>>
>>> Also while we're already touching these lines, sort the compatibles
>>> alphabetically.
>>>
>>> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>>> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
>>> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
>>> ---
>>>  sound/soc/qcom/sm8250.c | 9 ++++-----
>>>  1 file changed, 4 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c
>>> index b70b2a5031dfbf69024666f8a1049c263efcde0a..e920b413b762c803cfcc4049f35deba828275478 100644
>>> --- a/sound/soc/qcom/sm8250.c
>>> +++ b/sound/soc/qcom/sm8250.c
>>> @@ -16,7 +16,6 @@
>>>  #include "usb_offload_utils.h"
>>>  #include "sdw.h"
>>>  
>>> -#define DRIVER_NAME		"sm8250"
>>>  #define MI2S_BCLK_RATE		1536000
>>>  
>>>  struct sm8250_snd_data {
>>> @@ -200,15 +199,15 @@ static int sm8250_platform_probe(struct platform_device *pdev)
>>>  	if (ret)
>>>  		return ret;
>>>  
>>> -	card->driver_name = DRIVER_NAME;
>>> +	card->driver_name = of_device_get_match_data(dev);
>>>  	sm8250_add_be_ops(card);
>>>  	return devm_snd_soc_register_card(dev, card);
>>>  }
>>>  
>>>  static const struct of_device_id snd_sm8250_dt_match[] = {
>>> -	{.compatible = "qcom,sm8250-sndcard"},
>>> -	{.compatible = "qcom,qrb4210-rb2-sndcard"},
>>> -	{.compatible = "qcom,qrb5165-rb5-sndcard"},
>>> +	{ .compatible = "qcom,qrb4210-rb2-sndcard", .data = "sm8250" },
>>
>> sm4250 for rb2?
> 
> Since this name is visible to user space and used for picking the UCM config, I don't think it's a good idea to change it.
> 
It is not correct to pretend that rb2 is sm8250 for ucm cases, I agree previous code was
already doing this, Good thing is that we do not have a ucm written yet for RB2.

Lets fix this as you are already doing this for other compatibles.

--srini

> Regards
> Luca
> 
>>
>>> +	{ .compatible = "qcom,qrb5165-rb5-sndcard", .data = "sm8250" },
>>> +	{ .compatible = "qcom,sm8250-sndcard", .data = "sm8250" },
>>>  	{}
>>>  };
>>>  
>>>
>>> -- 
>>> 2.49.0
>>>
Re: [PATCH v3 2/5] ASoC: qcom: sm8250: set card driver name from match data
Posted by Luca Weiss 9 months, 1 week ago
Hi Srini,

On Fri May 2, 2025 at 1:06 PM CEST, Srinivas Kandagatla wrote:
> On 5/1/25 15:13, Luca Weiss wrote:
>> Hi Srini,
>> 
>> Srinivas Kandagatla <srini@kernel.org> schreef op 1 mei 2025 13:37:45 CEST:
>>> On Fri, Apr 25, 2025 at 10:07:26AM +0200, Luca Weiss wrote:
>>>> Sound machine drivers for Qualcomm SoCs can be reused across multiple
>>>> SoCs. But user space ALSA UCM files depend on the card driver name which
>>>> should be set per board/SoC.
>>>>
>>>> Allow such customization by using driver match data as sound card driver
>>>> name.
>>>>
>>>> Also while we're already touching these lines, sort the compatibles
>>>> alphabetically.
>>>>
>>>> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>>>> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
>>>> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
>>>> ---
>>>>  sound/soc/qcom/sm8250.c | 9 ++++-----
>>>>  1 file changed, 4 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c
>>>> index b70b2a5031dfbf69024666f8a1049c263efcde0a..e920b413b762c803cfcc4049f35deba828275478 100644
>>>> --- a/sound/soc/qcom/sm8250.c
>>>> +++ b/sound/soc/qcom/sm8250.c
>>>> @@ -16,7 +16,6 @@
>>>>  #include "usb_offload_utils.h"
>>>>  #include "sdw.h"
>>>>  
>>>> -#define DRIVER_NAME		"sm8250"
>>>>  #define MI2S_BCLK_RATE		1536000
>>>>  
>>>>  struct sm8250_snd_data {
>>>> @@ -200,15 +199,15 @@ static int sm8250_platform_probe(struct platform_device *pdev)
>>>>  	if (ret)
>>>>  		return ret;
>>>>  
>>>> -	card->driver_name = DRIVER_NAME;
>>>> +	card->driver_name = of_device_get_match_data(dev);
>>>>  	sm8250_add_be_ops(card);
>>>>  	return devm_snd_soc_register_card(dev, card);
>>>>  }
>>>>  
>>>>  static const struct of_device_id snd_sm8250_dt_match[] = {
>>>> -	{.compatible = "qcom,sm8250-sndcard"},
>>>> -	{.compatible = "qcom,qrb4210-rb2-sndcard"},
>>>> -	{.compatible = "qcom,qrb5165-rb5-sndcard"},
>>>> +	{ .compatible = "qcom,qrb4210-rb2-sndcard", .data = "sm8250" },
>>>
>>> sm4250 for rb2?
>> 
>> Since this name is visible to user space and used for picking the UCM config, I don't think it's a good idea to change it.
>> 
> It is not correct to pretend that rb2 is sm8250 for ucm cases, I agree previous code was
> already doing this, Good thing is that we do not have a ucm written yet for RB2.
>
> Lets fix this as you are already doing this for other compatibles.

Okay, will change this in v4.

Regards
Luca

>
> --srini
>
>> Regards
>> Luca
>> 
>>>
>>>> +	{ .compatible = "qcom,qrb5165-rb5-sndcard", .data = "sm8250" },
>>>> +	{ .compatible = "qcom,sm8250-sndcard", .data = "sm8250" },
>>>>  	{}
>>>>  };
>>>>  
>>>>
>>>> -- 
>>>> 2.49.0
>>>>
Re: [PATCH v3 2/5] ASoC: qcom: sm8250: set card driver name from match data
Posted by Mark Brown 9 months, 2 weeks ago
On Fri, Apr 25, 2025 at 10:07:26AM +0200, Luca Weiss wrote:
> Sound machine drivers for Qualcomm SoCs can be reused across multiple
> SoCs. But user space ALSA UCM files depend on the card driver name which
> should be set per board/SoC.

This doesn't apply against current code, please check and resend.
Re: [PATCH v3 2/5] ASoC: qcom: sm8250: set card driver name from match data
Posted by Luca Weiss 9 months, 2 weeks ago
Hi Mark,

On Fri Apr 25, 2025 at 2:12 PM CEST, Mark Brown wrote:
> On Fri, Apr 25, 2025 at 10:07:26AM +0200, Luca Weiss wrote:
>> Sound machine drivers for Qualcomm SoCs can be reused across multiple
>> SoCs. But user space ALSA UCM files depend on the card driver name which
>> should be set per board/SoC.
>
> This doesn't apply against current code, please check and resend.

I've based this series on next-20250417 tag, so this is probably due to
the changes from the USB sound offloading series that Greg has picked
up.

So either Greg also picks up these changes when they're ready, or we
wait until 6.17?

Regards
Luca
Re: [PATCH v3 2/5] ASoC: qcom: sm8250: set card driver name from match data
Posted by Mark Brown 9 months, 2 weeks ago
On Fri, Apr 25, 2025 at 08:19:39PM +0200, Luca Weiss wrote:

> I've based this series on next-20250417 tag, so this is probably due to
> the changes from the USB sound offloading series that Greg has picked
> up.

> So either Greg also picks up these changes when they're ready, or we
> wait until 6.17?

Or base it on my tree and let things get sorted in the merge, I don't
know what the conflicts might be?
Re: [PATCH v3 2/5] ASoC: qcom: sm8250: set card driver name from match data
Posted by Luca Weiss 9 months, 2 weeks ago
On Fri Apr 25, 2025 at 9:03 PM CEST, Mark Brown wrote:
> On Fri, Apr 25, 2025 at 08:19:39PM +0200, Luca Weiss wrote:
>
>> I've based this series on next-20250417 tag, so this is probably due to
>> the changes from the USB sound offloading series that Greg has picked
>> up.
>
>> So either Greg also picks up these changes when they're ready, or we
>> wait until 6.17?
>
> Or base it on my tree and let things get sorted in the merge, I don't
> know what the conflicts might be?

For this patch here it might be okay but patch 3/5 from this series very
much depends on the patch in Greg's tree, given it refactors/expands on
the USB_RX if there. Resolving this through merge wouldn't be very
pretty.

Regards
Luca
Re: [PATCH v3 2/5] ASoC: qcom: sm8250: set card driver name from match data
Posted by Mark Brown 9 months, 2 weeks ago
On Fri, Apr 25, 2025 at 10:47:42PM +0200, Luca Weiss wrote:
> On Fri Apr 25, 2025 at 9:03 PM CEST, Mark Brown wrote:

> > Or base it on my tree and let things get sorted in the merge, I don't
> > know what the conflicts might be?

> For this patch here it might be okay but patch 3/5 from this series very
> much depends on the patch in Greg's tree, given it refactors/expands on
> the USB_RX if there. Resolving this through merge wouldn't be very
> pretty.

Well, unfortunately Greg didn't put things on a branch so yeah waiting
for next release might be easiest.