Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/2] ALSA: usb-audio: UAC2 effect unit parsing
@ 2020-02-13 11:20 Takashi Iwai
  2020-02-13 11:20 ` [PATCH 1/2] usb: audio-v2: Add uac2_effect_unit_descriptor definition Takashi Iwai
  2020-02-13 11:20 ` [PATCH 2/2] ALSA: usb-audio: Parse source ID of UAC2 effect unit Takashi Iwai
  0 siblings, 2 replies; 6+ messages in thread
From: Takashi Iwai @ 2020-02-13 11:20 UTC (permalink / raw)
  To: alsa-devel; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

Hi,

UAC2 Effect Unit needs different parsing from Processing Unit and co,
and this patch set implements the partial support for that.

As it's the fix on top of the latest USB-audio fix, I'd like to apply
through sound git tree.  So please review and ack if USB header change
is OK.


thanks,

Takashi

===

Takashi Iwai (2):
  usb: audio-v2: Add uac2_effect_unit_descriptor definition
  ALSA: usb-audio: Parse source ID of UAC2 effect unit

 include/linux/usb/audio-v2.h | 12 ++++++++++++
 sound/usb/mixer.c            |  6 ++++++
 2 files changed, 18 insertions(+)

-- 
2.16.4


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

* [PATCH 1/2] usb: audio-v2: Add uac2_effect_unit_descriptor definition
  2020-02-13 11:20 [PATCH 0/2] ALSA: usb-audio: UAC2 effect unit parsing Takashi Iwai
@ 2020-02-13 11:20 ` Takashi Iwai
  2020-02-17 14:18   ` Takashi Iwai
  2020-02-13 11:20 ` [PATCH 2/2] ALSA: usb-audio: Parse source ID of UAC2 effect unit Takashi Iwai
  1 sibling, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2020-02-13 11:20 UTC (permalink / raw)
  To: alsa-devel; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

The UAC2 Effect Unit Descriptor has a slightly different definition
from other similar ones like Processing Unit or Extension Unit.
Define it here so that it can be used in USB-audio driver in a later
patch.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 include/linux/usb/audio-v2.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h
index ba4b3e3327ff..cb9900b34b67 100644
--- a/include/linux/usb/audio-v2.h
+++ b/include/linux/usb/audio-v2.h
@@ -156,6 +156,18 @@ struct uac2_feature_unit_descriptor {
 	__u8 bmaControls[0]; /* variable length */
 } __attribute__((packed));
 
+/* 4.7.2.10 Effect Unit Descriptor */
+
+struct uac2_effect_unit_descriptor {
+	__u8 bLength;
+	__u8 bDescriptorType;
+	__u8 bDescriptorSubtype;
+	__u8 bUnitID;
+	__le16 wEffectType;
+	__u8 bSourceID;
+	__u8 bmaControls[]; /* variable length */
+} __attribute__((packed));
+
 /* 4.9.2 Class-Specific AS Interface Descriptor */
 
 struct uac2_as_header_descriptor {
-- 
2.16.4


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

* [PATCH 2/2] ALSA: usb-audio: Parse source ID of UAC2 effect unit
  2020-02-13 11:20 [PATCH 0/2] ALSA: usb-audio: UAC2 effect unit parsing Takashi Iwai
  2020-02-13 11:20 ` [PATCH 1/2] usb: audio-v2: Add uac2_effect_unit_descriptor definition Takashi Iwai
@ 2020-02-13 11:20 ` Takashi Iwai
  1 sibling, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2020-02-13 11:20 UTC (permalink / raw)
  To: alsa-devel; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

During parsing the input source, we currently cut off at the Effect
Unit node without parsing further its source id.  It's no big problem,
so far, but it should be more consistent to parse it properly.

This patch adds the recursive parsing in parse_term_effect_unit().
It doesn't add anything in the audio unit parser itself, and the
effect unit itself is still skipped, though.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206147
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/mixer.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 81b2db0edd5f..56d0878e4999 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -901,6 +901,12 @@ static int parse_term_effect_unit(struct mixer_build *state,
 				  struct usb_audio_term *term,
 				  void *p1, int id)
 {
+	struct uac2_effect_unit_descriptor *d = p1;
+	int err;
+
+	err = __check_input_term(state, d->bSourceID, term);
+	if (err < 0)
+		return err;
 	term->type = UAC3_EFFECT_UNIT << 16; /* virtual type */
 	term->id = id;
 	return 0;
-- 
2.16.4


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

* Re: [PATCH 1/2] usb: audio-v2: Add uac2_effect_unit_descriptor definition
  2020-02-13 11:20 ` [PATCH 1/2] usb: audio-v2: Add uac2_effect_unit_descriptor definition Takashi Iwai
@ 2020-02-17 14:18   ` Takashi Iwai
  2020-02-17 14:22     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2020-02-17 14:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: alsa-devel, linux-usb, linux-kernel

On Thu, 13 Feb 2020 12:20:58 +0100,
Takashi Iwai wrote:
> 
> The UAC2 Effect Unit Descriptor has a slightly different definition
> from other similar ones like Processing Unit or Extension Unit.
> Define it here so that it can be used in USB-audio driver in a later
> patch.
> 
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>  include/linux/usb/audio-v2.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h
> index ba4b3e3327ff..cb9900b34b67 100644
> --- a/include/linux/usb/audio-v2.h
> +++ b/include/linux/usb/audio-v2.h
> @@ -156,6 +156,18 @@ struct uac2_feature_unit_descriptor {
>  	__u8 bmaControls[0]; /* variable length */
>  } __attribute__((packed));
>  
> +/* 4.7.2.10 Effect Unit Descriptor */
> +
> +struct uac2_effect_unit_descriptor {
> +	__u8 bLength;
> +	__u8 bDescriptorType;
> +	__u8 bDescriptorSubtype;
> +	__u8 bUnitID;
> +	__le16 wEffectType;
> +	__u8 bSourceID;
> +	__u8 bmaControls[]; /* variable length */
> +} __attribute__((packed));
> +
>  /* 4.9.2 Class-Specific AS Interface Descriptor */
>  
>  struct uac2_as_header_descriptor {

Greg, I suppose you are OK with this addition?


thanks,

Takashi

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

* Re: [PATCH 1/2] usb: audio-v2: Add uac2_effect_unit_descriptor definition
  2020-02-17 14:18   ` Takashi Iwai
@ 2020-02-17 14:22     ` Greg Kroah-Hartman
  2020-02-17 14:25       ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2020-02-17 14:22 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, linux-usb, linux-kernel

On Mon, Feb 17, 2020 at 03:18:34PM +0100, Takashi Iwai wrote:
> On Thu, 13 Feb 2020 12:20:58 +0100,
> Takashi Iwai wrote:
> > 
> > The UAC2 Effect Unit Descriptor has a slightly different definition
> > from other similar ones like Processing Unit or Extension Unit.
> > Define it here so that it can be used in USB-audio driver in a later
> > patch.
> > 
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > ---
> >  include/linux/usb/audio-v2.h | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> > 
> > diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h
> > index ba4b3e3327ff..cb9900b34b67 100644
> > --- a/include/linux/usb/audio-v2.h
> > +++ b/include/linux/usb/audio-v2.h
> > @@ -156,6 +156,18 @@ struct uac2_feature_unit_descriptor {
> >  	__u8 bmaControls[0]; /* variable length */
> >  } __attribute__((packed));
> >  
> > +/* 4.7.2.10 Effect Unit Descriptor */
> > +
> > +struct uac2_effect_unit_descriptor {
> > +	__u8 bLength;
> > +	__u8 bDescriptorType;
> > +	__u8 bDescriptorSubtype;
> > +	__u8 bUnitID;
> > +	__le16 wEffectType;
> > +	__u8 bSourceID;
> > +	__u8 bmaControls[]; /* variable length */
> > +} __attribute__((packed));
> > +
> >  /* 4.9.2 Class-Specific AS Interface Descriptor */
> >  
> >  struct uac2_as_header_descriptor {
> 
> Greg, I suppose you are OK with this addition?
> 
> 

Yes, that's fine with me:

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [PATCH 1/2] usb: audio-v2: Add uac2_effect_unit_descriptor definition
  2020-02-17 14:22     ` Greg Kroah-Hartman
@ 2020-02-17 14:25       ` Takashi Iwai
  0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2020-02-17 14:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: alsa-devel, linux-usb, linux-kernel

On Mon, 17 Feb 2020 15:22:38 +0100,
Greg Kroah-Hartman wrote:
> 
> On Mon, Feb 17, 2020 at 03:18:34PM +0100, Takashi Iwai wrote:
> > On Thu, 13 Feb 2020 12:20:58 +0100,
> > Takashi Iwai wrote:
> > > 
> > > The UAC2 Effect Unit Descriptor has a slightly different definition
> > > from other similar ones like Processing Unit or Extension Unit.
> > > Define it here so that it can be used in USB-audio driver in a later
> > > patch.
> > > 
> > > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > > ---
> > >  include/linux/usb/audio-v2.h | 12 ++++++++++++
> > >  1 file changed, 12 insertions(+)
> > > 
> > > diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h
> > > index ba4b3e3327ff..cb9900b34b67 100644
> > > --- a/include/linux/usb/audio-v2.h
> > > +++ b/include/linux/usb/audio-v2.h
> > > @@ -156,6 +156,18 @@ struct uac2_feature_unit_descriptor {
> > >  	__u8 bmaControls[0]; /* variable length */
> > >  } __attribute__((packed));
> > >  
> > > +/* 4.7.2.10 Effect Unit Descriptor */
> > > +
> > > +struct uac2_effect_unit_descriptor {
> > > +	__u8 bLength;
> > > +	__u8 bDescriptorType;
> > > +	__u8 bDescriptorSubtype;
> > > +	__u8 bUnitID;
> > > +	__le16 wEffectType;
> > > +	__u8 bSourceID;
> > > +	__u8 bmaControls[]; /* variable length */
> > > +} __attribute__((packed));
> > > +
> > >  /* 4.9.2 Class-Specific AS Interface Descriptor */
> > >  
> > >  struct uac2_as_header_descriptor {
> > 
> > Greg, I suppose you are OK with this addition?
> > 
> > 
> 
> Yes, that's fine with me:
> 
> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Thanks, I'll queue the patches to sound git tree.


Takashi

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

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-13 11:20 [PATCH 0/2] ALSA: usb-audio: UAC2 effect unit parsing Takashi Iwai
2020-02-13 11:20 ` [PATCH 1/2] usb: audio-v2: Add uac2_effect_unit_descriptor definition Takashi Iwai
2020-02-17 14:18   ` Takashi Iwai
2020-02-17 14:22     ` Greg Kroah-Hartman
2020-02-17 14:25       ` Takashi Iwai
2020-02-13 11:20 ` [PATCH 2/2] ALSA: usb-audio: Parse source ID of UAC2 effect unit Takashi Iwai

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git