mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Zipdox <zipdox@zipdox.net>
Cc: Takashi Iwai <tiwai@suse.de>,
	linux-sound@vger.kernel.org, perex@perex.cz,
	linux-kernel@vger.kernel.org, tiwai@suse.com
Subject: Re: [PATCH] USB Audio Class 2 Mixer unit support for GET_CUR, SET_CUR and RANGE
Date: Thu, 17 Sep 2026 18:15:29 +0200	[thread overview]
Message-ID: <87se37g8gu.wl-tiwai@suse.de> (raw)
In-Reply-To: <05a53b37-8de3-4075-93c0-21129a839356@zipdox.net>

On Thu, 17 Sep 2026 16:54:50 +0200,
Zipdox wrote:
> 
> On 9/17/26 4:23 PM, Zipdox wrote:
> > 
> > 
> > On 9/16/26 8:22 PM, Takashi Iwai wrote:
> >> 
> >> ... or maybe a less cryptic version like below.
> >> 
> >> 
> >> Takashi
> >> 
> >> -- 8< --
> >> diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
> >> index 33a6a1281410..c6639a45fb24 100644
> >> --- a/sound/usb/mixer.c
> >> +++ b/sound/usb/mixer.c
> >> @@ -335,6 +335,16 @@ static int get_ctl_value_v1(struct
> >> usb_mixer_elem_info *cval, int request,
> >>       return -EINVAL;
> >>   }
> >> +/* convert the given UAC1 wValue (ICN+1|OCN+1) to UAC2 MCN */
> >> +static unsigned int to_mcn(const struct usb_mixer_elem_info *cval,
> >> +               unsigned int validx)
> >> +{
> >> +    unsigned char m = (validx >> 8) & 0xff;
> >> +    unsigned char v = validx & 0xff;
> >> +
> >> +    return (m - 1) * cval->num_outputs * (v - 1);
> >> +}
> > You used multiplication instead of addition for the last part. I
> > assume this is a mistake? Also you should probably also bitwise and
> > that with 0xFF to make sure it's not more than one byte. The product
> > of the number of input and output channels must be no greater than
> > 256 according to the spec. I don't know if this is checked
> > elsewhere. Other than that it looks good for a patch to get it
> > working. I'll try it out and send a follow-up email shortly.
> > 
> If you fix the code like this:
> 
> static unsigned int to_mcn(const struct usb_mixer_elem_info *cval,
> 			   unsigned int validx)
> {
> 	unsigned char icn = (validx >> 8) & 0xff;
> 	unsigned char ocn = validx & 0xff;
> 
> 	return (icn - 1) * cval->num_outputs + (ocn - 1);
> }
> 
> then it works correctly. As far as I'm concerned you can merge that
> as-is. It would be good to try on some other hardware as well to check
> for regressions though.

Good to hear.  If you have a chance to test my last series of patches,
it'd be appreciated.

BTW, I'll be off from tomorrow, and the issue is no new bug to be
urgently fixed, so I'll handle after back to work again :)


thanks,

Takashi

  reply	other threads:[~2026-09-17 16:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15  8:54 Zipdox
2026-09-15 11:08 ` Takashi Iwai
2026-09-15 12:54   ` Zipdox
2026-09-15 14:19     ` Takashi Iwai
2026-09-16  7:43       ` Zipdox
2026-09-16 15:40         ` Takashi Iwai
2026-09-16 16:58           ` Takashi Iwai
2026-09-16 18:22             ` Takashi Iwai
2026-09-17 14:23               ` Zipdox
2026-09-17 14:49                 ` Takashi Iwai
2026-09-17 14:54                 ` Zipdox
2026-09-17 16:15                   ` Takashi Iwai [this message]
2026-09-17 16:33                     ` Zipdox
2026-09-17 16:40                       ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87se37g8gu.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=zipdox@zipdox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®