diff mbox series

[v2,5/5] ASoC: sun4i-codec: change h616 card name

Message ID 20250125070458.13822-6-ryan@testtoast.com (mailing list archive)
State New
Headers show
Series ASoC: sun4i-codec: add headphone dectection for Anbernic RG35XX devices | expand

Commit Message

Ryan Walklin Jan. 25, 2025, 7 a.m. UTC
Adding jack detection requires sound servers to act on the emitted
events, which are described by ALSA Use Case Manager configurations in
userspace. These configurations include the card name in the file path,
so alter the card name for the H616 to remove spaces, making UCM
referencing easier. Add a long_name to maintain consistency with the
other drivers.

The corresponding ALSA UCM patch is here:
https://github.com/alsa-project/alsa-ucm-conf/pull/491

Signed-off-by: Ryan Walklin <ryan@testtoast.com>

--
Changelog v1..v2:
- Separate patch for card->long_name
- Note UCM patch link
---
 sound/soc/sunxi/sun4i-codec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Icenowy Zheng Jan. 26, 2025, 7:51 a.m. UTC | #1
在 2025-01-25星期六的 20:00 +1300,Ryan Walklin写道:
> Adding jack detection requires sound servers to act on the emitted
> events, which are described by ALSA Use Case Manager configurations
> in
> userspace. These configurations include the card name in the file
> path,
> so alter the card name for the H616 to remove spaces, making UCM
> referencing easier. Add a long_name to maintain consistency with the
> other drivers.
> 
> The corresponding ALSA UCM patch is here:
> https://github.com/alsa-project/alsa-ucm-conf/pull/491
> 
> Signed-off-by: Ryan Walklin <ryan@testtoast.com>
> 
> --
> Changelog v1..v2:
> - Separate patch for card->long_name
> - Note UCM patch link
> ---
>  sound/soc/sunxi/sun4i-codec.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-
> codec.c
> index 3701f56c72756..68e2d82228a0b 100644
> --- a/sound/soc/sunxi/sun4i-codec.c
> +++ b/sound/soc/sunxi/sun4i-codec.c
> @@ -2012,7 +2012,8 @@ static struct snd_soc_card
> *sun50i_h616_codec_create_card(struct device *dev)
>  
>         card->dev               = dev;
>         card->owner             = THIS_MODULE;
> -       card->name              = "H616 Audio Codec";
> +       card->name              = "h616-audio-codec";
> +       card->long_name         = "H616 Audio Codec";

I think it's part of the userspace API that should be kept stable.

>         card->driver_name       = "sun4i-codec";
>         card->controls          = sun50i_h616_card_controls;
>         card->num_controls      =
> ARRAY_SIZE(sun50i_h616_card_controls);
Ryan Walklin Jan. 28, 2025, 1:10 a.m. UTC | #2
On Sun, 26 Jan 2025, at 8:51 PM, Icenowy Zheng wrote:
> 在 2025-01-25星期六的 20:00 +1300,Ryan Walklin写道:

Hi Icenowy, thanks for reviewing!

>> -       card->name              = "H616 Audio Codec";
>> +       card->name              = "h616-audio-codec";
>> +       card->long_name         = "H616 Audio Codec";
>
> I think it's part of the userspace API that should be kept stable.

I don't have a strong feeling about this change, but can anyone suggest any other options for how to manage this name being picked up by UCM as a file path? I guess the UCM paths can include spaces, but this is slightly unwieldy and may break if proper escaping is not done.

Would appreciate if any of the ALSA devs could weigh in on best practice here.

Regards,

Ryan
diff mbox series

Patch

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 3701f56c72756..68e2d82228a0b 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -2012,7 +2012,8 @@  static struct snd_soc_card *sun50i_h616_codec_create_card(struct device *dev)
 
 	card->dev		= dev;
 	card->owner		= THIS_MODULE;
-	card->name		= "H616 Audio Codec";
+	card->name		= "h616-audio-codec";
+	card->long_name		= "H616 Audio Codec";
 	card->driver_name	= "sun4i-codec";
 	card->controls		= sun50i_h616_card_controls;
 	card->num_controls	= ARRAY_SIZE(sun50i_h616_card_controls);