public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: Use the new macro for HP Dock rename quirks
@ 2020-06-08  7:15 Takashi Iwai
  2020-06-08  8:37 ` Jaroslav Kysela
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2020-06-08  7:15 UTC (permalink / raw)
  To: alsa-devel; +Cc: Kai-Heng Feng

Replace the open-code with the new QUIRK_DEVICE_PROFILE() macro for
simplicity.

Fixes: 0c5086f56999 ("ALSA: usb-audio: Add vendor, product and profile name for HP Thunderbolt Dock")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/quirks-table.h | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index 90d65bfa733d..4ec491011b19 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -43,22 +43,14 @@
 /* HP Thunderbolt Dock Audio Headset */
 {
 	USB_DEVICE(0x03f0, 0x0269),
-	.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
-		.vendor_name = "HP",
-		.product_name = "Thunderbolt Dock Audio Headset",
-		.profile_name = "HP-Thunderbolt-Dock-Audio-Headset",
-		.ifnum = QUIRK_NO_INTERFACE
-	}
+	QUIRK_DEVICE_PROFILE("HP", "Thunderbolt Dock Audio Headset",
+			     "HP-Thunderbolt-Dock-Audio-Headset"),
 },
 /* HP Thunderbolt Dock Audio Module */
 {
 	USB_DEVICE(0x03f0, 0x0567),
-	.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
-		.vendor_name = "HP",
-		.product_name = "Thunderbolt Dock Audio Module",
-		.profile_name = "HP-Thunderbolt-Dock-Audio-Module",
-		.ifnum = QUIRK_NO_INTERFACE
-	}
+	QUIRK_DEVICE_PROFILE("HP", "Thunderbolt Dock Audio Module",
+			     "HP-Thunderbolt-Dock-Audio-Module"),
 },
 /* FTDI devices */
 {
-- 
2.16.4


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

* Re: [PATCH] ALSA: usb-audio: Use the new macro for HP Dock rename quirks
  2020-06-08  7:15 [PATCH] ALSA: usb-audio: Use the new macro for HP Dock rename quirks Takashi Iwai
@ 2020-06-08  8:37 ` Jaroslav Kysela
  2020-06-08  8:44   ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Jaroslav Kysela @ 2020-06-08  8:37 UTC (permalink / raw)
  To: Takashi Iwai, alsa-devel; +Cc: Kai-Heng Feng

Dne 08. 06. 20 v 9:15 Takashi Iwai napsal(a):
> Replace the open-code with the new QUIRK_DEVICE_PROFILE() macro for
> simplicity.
> 
> Fixes: 0c5086f56999 ("ALSA: usb-audio: Add vendor, product and profile name for HP Thunderbolt Dock")
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---

Takashi, could we export the profile (hint) for new USB cards via the 
components string - snd_component_add()? The long name seems not appropriate 
for this. It's a GUI string (which is mangled now).

					Jaroslav

>   sound/usb/quirks-table.h | 16 ++++------------
>   1 file changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
> index 90d65bfa733d..4ec491011b19 100644
> --- a/sound/usb/quirks-table.h
> +++ b/sound/usb/quirks-table.h
> @@ -43,22 +43,14 @@
>   /* HP Thunderbolt Dock Audio Headset */
>   {
>   	USB_DEVICE(0x03f0, 0x0269),
> -	.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
> -		.vendor_name = "HP",
> -		.product_name = "Thunderbolt Dock Audio Headset",
> -		.profile_name = "HP-Thunderbolt-Dock-Audio-Headset",
> -		.ifnum = QUIRK_NO_INTERFACE
> -	}
> +	QUIRK_DEVICE_PROFILE("HP", "Thunderbolt Dock Audio Headset",
> +			     "HP-Thunderbolt-Dock-Audio-Headset"),
>   },
>   /* HP Thunderbolt Dock Audio Module */
>   {
>   	USB_DEVICE(0x03f0, 0x0567),
> -	.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
> -		.vendor_name = "HP",
> -		.product_name = "Thunderbolt Dock Audio Module",
> -		.profile_name = "HP-Thunderbolt-Dock-Audio-Module",
> -		.ifnum = QUIRK_NO_INTERFACE
> -	}
> +	QUIRK_DEVICE_PROFILE("HP", "Thunderbolt Dock Audio Module",
> +			     "HP-Thunderbolt-Dock-Audio-Module"),
>   },
>   /* FTDI devices */
>   {
> 


-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

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

* Re: [PATCH] ALSA: usb-audio: Use the new macro for HP Dock rename quirks
  2020-06-08  8:37 ` Jaroslav Kysela
@ 2020-06-08  8:44   ` Takashi Iwai
  2020-06-08  9:01     ` Jaroslav Kysela
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2020-06-08  8:44 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: alsa-devel, Kai-Heng Feng

On Mon, 08 Jun 2020 10:37:12 +0200,
Jaroslav Kysela wrote:
> 
> Dne 08. 06. 20 v 9:15 Takashi Iwai napsal(a):
> > Replace the open-code with the new QUIRK_DEVICE_PROFILE() macro for
> > simplicity.
> >
> > Fixes: 0c5086f56999 ("ALSA: usb-audio: Add vendor, product and profile name for HP Thunderbolt Dock")
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > ---
> 
> Takashi, could we export the profile (hint) for new USB cards via the
> components string - snd_component_add()? The long name seems not
> appropriate for this. It's a GUI string (which is mangled now).

It's possible, and maybe we should move to it, but we'd need to
provide in card->longname for now because the component support in
user-space side isn't in major releases yet.  The longname is ugly,
but that's the only way that works stably right now.

Also, we need a common helper function for adding the component string
in the kernel side, too, not specific to USB-audio.


thanks,

Takashi

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

* Re: [PATCH] ALSA: usb-audio: Use the new macro for HP Dock rename quirks
  2020-06-08  8:44   ` Takashi Iwai
@ 2020-06-08  9:01     ` Jaroslav Kysela
  2020-06-08  9:22       ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Jaroslav Kysela @ 2020-06-08  9:01 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, Kai-Heng Feng

Dne 08. 06. 20 v 10:44 Takashi Iwai napsal(a):
> On Mon, 08 Jun 2020 10:37:12 +0200,
> Jaroslav Kysela wrote:
>>
>> Dne 08. 06. 20 v 9:15 Takashi Iwai napsal(a):
>>> Replace the open-code with the new QUIRK_DEVICE_PROFILE() macro for
>>> simplicity.
>>>
>>> Fixes: 0c5086f56999 ("ALSA: usb-audio: Add vendor, product and profile name for HP Thunderbolt Dock")
>>> Signed-off-by: Takashi Iwai <tiwai@suse.de>
>>> ---
>>
>> Takashi, could we export the profile (hint) for new USB cards via the
>> components string - snd_component_add()? The long name seems not
>> appropriate for this. It's a GUI string (which is mangled now).
> 
> It's possible, and maybe we should move to it, but we'd need to
> provide in card->longname for now because the component support in
> user-space side isn't in major releases yet.  The longname is ugly,
> but that's the only way that works stably right now.
> 
> Also, we need a common helper function for adding the component string
> in the kernel side, too, not specific to USB-audio.

There is already snd_component_add() function, so we need to settle only the 
identification prefix for those "model" strings.

It would be nice to duplicate this info for the moment (the components string 
should be shorter than used for long name).

Perhaps, we can just add "hw:<hint>" component string for the more finer 
hardware identification, like:

$ amixer -c 0 info
Components	: 'USB0bda:58fe hw:VideoMic'
	
				Jaroslav

> 
> 
> thanks,
> 
> Takashi
> 


-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

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

* Re: [PATCH] ALSA: usb-audio: Use the new macro for HP Dock rename quirks
  2020-06-08  9:01     ` Jaroslav Kysela
@ 2020-06-08  9:22       ` Takashi Iwai
  2020-06-08  9:38         ` Jaroslav Kysela
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2020-06-08  9:22 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: alsa-devel, Kai-Heng Feng

On Mon, 08 Jun 2020 11:01:43 +0200,
Jaroslav Kysela wrote:
> 
> Dne 08. 06. 20 v 10:44 Takashi Iwai napsal(a):
> > On Mon, 08 Jun 2020 10:37:12 +0200,
> > Jaroslav Kysela wrote:
> >>
> >> Dne 08. 06. 20 v 9:15 Takashi Iwai napsal(a):
> >>> Replace the open-code with the new QUIRK_DEVICE_PROFILE() macro for
> >>> simplicity.
> >>>
> >>> Fixes: 0c5086f56999 ("ALSA: usb-audio: Add vendor, product and profile name for HP Thunderbolt Dock")
> >>> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> >>> ---
> >>
> >> Takashi, could we export the profile (hint) for new USB cards via the
> >> components string - snd_component_add()? The long name seems not
> >> appropriate for this. It's a GUI string (which is mangled now).
> >
> > It's possible, and maybe we should move to it, but we'd need to
> > provide in card->longname for now because the component support in
> > user-space side isn't in major releases yet.  The longname is ugly,
> > but that's the only way that works stably right now.
> >
> > Also, we need a common helper function for adding the component string
> > in the kernel side, too, not specific to USB-audio.
> 
> There is already snd_component_add() function, so we need to settle
> only the identification prefix for those "model" strings.
> 
> It would be nice to duplicate this info for the moment (the components
> string should be shorter than used for long name).

Yes, what we need a concrete definition.  The implementation in
kernel-side must be easy :)

> Perhaps, we can just add "hw:<hint>" component string for the more
> finer hardware identification, like:
> 
> $ amixer -c 0 info
> Components	: 'USB0bda:58fe hw:VideoMic'

I don't mind what form, but would the example above work as a UCM
profile properly?


thanks,

Takashi

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

* Re: [PATCH] ALSA: usb-audio: Use the new macro for HP Dock rename quirks
  2020-06-08  9:22       ` Takashi Iwai
@ 2020-06-08  9:38         ` Jaroslav Kysela
  0 siblings, 0 replies; 6+ messages in thread
From: Jaroslav Kysela @ 2020-06-08  9:38 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, Kai-Heng Feng

Dne 08. 06. 20 v 11:22 Takashi Iwai napsal(a):
> On Mon, 08 Jun 2020 11:01:43 +0200,
> Jaroslav Kysela wrote:
>>
>> Dne 08. 06. 20 v 10:44 Takashi Iwai napsal(a):
>>> On Mon, 08 Jun 2020 10:37:12 +0200,
>>> Jaroslav Kysela wrote:
>>>>
>>>> Dne 08. 06. 20 v 9:15 Takashi Iwai napsal(a):
>>>>> Replace the open-code with the new QUIRK_DEVICE_PROFILE() macro for
>>>>> simplicity.
>>>>>
>>>>> Fixes: 0c5086f56999 ("ALSA: usb-audio: Add vendor, product and profile name for HP Thunderbolt Dock")
>>>>> Signed-off-by: Takashi Iwai <tiwai@suse.de>
>>>>> ---
>>>>
>>>> Takashi, could we export the profile (hint) for new USB cards via the
>>>> components string - snd_component_add()? The long name seems not
>>>> appropriate for this. It's a GUI string (which is mangled now).
>>>
>>> It's possible, and maybe we should move to it, but we'd need to
>>> provide in card->longname for now because the component support in
>>> user-space side isn't in major releases yet.  The longname is ugly,
>>> but that's the only way that works stably right now.
>>>
>>> Also, we need a common helper function for adding the component string
>>> in the kernel side, too, not specific to USB-audio.
>>
>> There is already snd_component_add() function, so we need to settle
>> only the identification prefix for those "model" strings.
>>
>> It would be nice to duplicate this info for the moment (the components
>> string should be shorter than used for long name).
> 
> Yes, what we need a concrete definition.  The implementation in
> kernel-side must be easy :)
> 
>> Perhaps, we can just add "hw:<hint>" component string for the more
>> finer hardware identification, like:
>>
>> $ amixer -c 0 info
>> Components	: 'USB0bda:58fe hw:VideoMic'
> 
> I don't mind what form, but would the example above work as a UCM
> profile properly?

It should work for UCM2. UCM2 can compare the components string and load or 
use the appropriate piece of configuration. So it means that 
ucm2/USB-Audio/USB-Audio.conf will handle this.

I also added the possibility to extract 'VideoMic' (regex) from the 
'hw:VideoMic' string and include the file from the custom path (syntax 3 in 
UCM2). So we can end with the ucm2/USB-Audio/HiFi-VideoMic.conf file.

So basically, the prefix may be driver specific but consistent, so we can do a 
match against it in the user space. Or we may use 'hint:<hwid>' or so.

					Jaroslav

> 
> 
> thanks,
> 
> Takashi
> 


-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

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

end of thread, other threads:[~2020-06-08  9:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-08  7:15 [PATCH] ALSA: usb-audio: Use the new macro for HP Dock rename quirks Takashi Iwai
2020-06-08  8:37 ` Jaroslav Kysela
2020-06-08  8:44   ` Takashi Iwai
2020-06-08  9:01     ` Jaroslav Kysela
2020-06-08  9:22       ` Takashi Iwai
2020-06-08  9:38         ` Jaroslav Kysela

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