From: Daniel Mack <daniel@zonque.org>
To: Takashi Iwai <tiwai@suse.de>
Cc: orm.finnendahl@selma.hfmdk-frankfurt.de,
alsa-devel@alsa-project.org, clemens@ladisch.de,
jan.baumgart@selma.hfmdk-frankfurt.de
Subject: Re: [PATCH 1/2] sound: usb: add UAC2 clock sources as mixer controls
Date: Sat, 9 Apr 2016 11:09:26 +0200 [thread overview]
Message-ID: <5708C6C6.8060702@zonque.org> (raw)
In-Reply-To: <s5hlh4ncgtz.wl-tiwai@suse.de>
Hi Takashi,
On 04/09/2016 10:43 AM, Takashi Iwai wrote:
> On Fri, 08 Apr 2016 19:52:01 +0200,
> Daniel Mack wrote:
>>
>> UAC2 specifies clock sources that optionally have validity controls.
>> This patch exposes them as mixer controls, so they can be read (and
>> at least in theory even be written) by userspace applications in order
>> to make clock selection policy decisions.
>>
>> This implementation does nothing if the device is not UAC2 compliant,
>> or if the clock source does not define said validity control bits.
>>
>> Tested with a miniDSP USBStreamer (0x2752/0x0016),
>>
>> Signed-off-by: Daniel Mack <daniel@zonque.org>
>> ---
>> sound/usb/mixer.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
>> 1 file changed, 65 insertions(+), 1 deletion(-)
>>
>> diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
>> index 4f85757..973274b 100644
>> --- a/sound/usb/mixer.c
>> +++ b/sound/usb/mixer.c
>> @@ -45,6 +45,7 @@
>> #include <linux/bitops.h>
>> #include <linux/init.h>
>> #include <linux/list.h>
>> +#include <linux/log2.h>
>> #include <linux/slab.h>
>> #include <linux/string.h>
>> #include <linux/usb.h>
>> @@ -1378,6 +1379,68 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
>> snd_usb_mixer_add_control(&cval->head, kctl);
>> }
>>
>> +static int parse_clock_source_unit(struct mixer_build *state, int unitid,
>> + void *_ftr)
>> +
>> +{
>> + struct uac_clock_source_descriptor *hdr = _ftr;
>> + struct usb_mixer_elem_info *cval;
>> + struct snd_kcontrol *kctl;
>> + char name[100];
>
> No need for 100. SNDRV_CTL_ELEM_ID_NAME_MAXLEN should suffice.
>
>> + int ret;
>> +
>> + if (state->mixer->protocol != UAC_VERSION_2)
>> + return -EINVAL;
>> +
>> + if (hdr->bLength != sizeof(*hdr))
>> + return -EINVAL;
>
> I wonder whether we should abort here and return an error.
> It's a wacky firmware, and no kernel error, after all.
This is what we're doing in other parsers as well, but you're right,
it's better to just add a debug print here and handle this gracefully.
Will send a new patch soon, also addressing the other details.
Thanks,
Daniel
prev parent reply other threads:[~2016-04-09 9:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-08 17:52 [PATCH 1/2] sound: usb: add UAC2 clock sources as mixer controls Daniel Mack
2016-04-08 17:52 ` [PATCH 2/2] sound: usb: allow clock source validity interrupts Daniel Mack
2016-04-09 8:52 ` Takashi Iwai
2016-04-09 9:16 ` Daniel Mack
2016-04-09 9:51 ` Takashi Iwai
2016-04-09 14:37 ` Daniel Mack
2016-04-09 15:25 ` Takashi Iwai
2016-04-09 8:43 ` [PATCH 1/2] sound: usb: add UAC2 clock sources as mixer controls Takashi Iwai
2016-04-09 9:09 ` Daniel Mack [this message]
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=5708C6C6.8060702@zonque.org \
--to=daniel@zonque.org \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=jan.baumgart@selma.hfmdk-frankfurt.de \
--cc=orm.finnendahl@selma.hfmdk-frankfurt.de \
--cc=tiwai@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.