From: Daniel Mack <zonque@gmail.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, clemens@ladisch.de, Daniel Mack <zonque@gmail.com>,
demian@auraliti.com, ray@auraliti.com, andreas@akdesigninc.com
Subject: [PATCH v3 5/5] ALSA: snd-usb: add quirks handler for DSD streams
Date: Wed, 17 Apr 2013 00:01:40 +0800 [thread overview]
Message-ID: <1366128100-9778-6-git-send-email-zonque@gmail.com> (raw)
In-Reply-To: <1366128100-9778-1-git-send-email-zonque@gmail.com>
Unfortunately, none of the UAC standards provides a way to identify DSD
(Direct Stream Digital) formats. Hence, this patch adds a quirks
handler to identify USB interfaces that are capable of handling DSD.
That quirks handler can augment the already parsed formats bit-field,
by any of the new SNDRV_PCM_FMTBIT_DSD_{U8_U16} and setting the dsd_dop
flag in the audio format, if the driver should take care for the DOP
byte stuffing.
The only devices that are known to work with this are the ones with
a 'Playback Designs' vendor id.
Signed-off-by: Daniel Mack <zonque@gmail.com>
---
sound/usb/format.c | 3 +++
sound/usb/quirks.c | 28 ++++++++++++++++++++++++++++
sound/usb/quirks.h | 4 ++++
3 files changed, 35 insertions(+)
diff --git a/sound/usb/format.c b/sound/usb/format.c
index 20c7751..020ede0 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -136,6 +136,9 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
snd_printk(KERN_INFO "%d:%u:%d : unsupported format bits %#x\n",
chip->dev->devnum, fp->iface, fp->altsetting, format);
}
+
+ pcm_formats |= snd_usb_interface_dsd_format_quirks(chip, fp, sample_bytes);
+
return pcm_formats;
}
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 2927981..4c6366c 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -915,3 +915,31 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
mdelay(20);
}
+/*
+ * snd_usb_interface_dsd_format_quirks() is called from format.c to
+ * augment the PCM format bit-field for DSD types. The UAC standards
+ * don't have a designated bit field to denote DSD-capable interfaces,
+ * hence all hardware that is known to support this format has to be
+ * listed here.
+ */
+u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
+ struct audioformat *fp,
+ unsigned int sample_bytes)
+{
+ /* Playback Designs */
+ if (le16_to_cpu(chip->dev->descriptor.idVendor) == 0x23ba) {
+ switch (fp->altsetting) {
+ case 1:
+ fp->dsd_dop = true;
+ return SNDRV_PCM_FMTBIT_DSD_U16_LE;
+ case 2:
+ fp->dsd_bitrev = true;
+ return SNDRV_PCM_FMTBIT_DSD_U8;
+ case 3:
+ fp->dsd_bitrev = true;
+ return SNDRV_PCM_FMTBIT_DSD_U16_LE;
+ }
+ }
+
+ return 0;
+}
diff --git a/sound/usb/quirks.h b/sound/usb/quirks.h
index 7c3681f..665e972 100644
--- a/sound/usb/quirks.h
+++ b/sound/usb/quirks.h
@@ -31,4 +31,8 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
__u8 request, __u8 requesttype, __u16 value,
__u16 index, void *data, __u16 size);
+u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
+ struct audioformat *fp,
+ unsigned int sample_bytes);
+
#endif /* __USBAUDIO_QUIRKS_H */
--
1.7.10.4
next prev parent reply other threads:[~2013-04-16 16:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-16 16:01 [PATCH v3 0/5] ALSA: snd-usb: add support for DSD Daniel Mack
2013-04-16 16:01 ` [PATCH v3 1/5] ALSA: add DSD formats Daniel Mack
2013-04-16 16:01 ` [PATCH v3 2/5] ALSA: snd-usb: use ep->stride from urb callbacks Daniel Mack
2013-04-16 16:01 ` [PATCH v3 3/5] ALSA: snd-usb: add support for DSD DOP stream transport Daniel Mack
2013-04-16 16:01 ` [PATCH v3 4/5] ALSA: snd-usb: add support for bit-reversed byte formats Daniel Mack
2013-04-16 16:01 ` Daniel Mack [this message]
2013-04-16 16:13 ` [PATCH v3 0/5] ALSA: snd-usb: add support for DSD Takashi Iwai
2013-04-17 10:59 ` Takashi Iwai
2013-04-17 11:03 ` Daniel Mack
2013-04-17 17:01 ` Jussi Laako
2013-04-17 17:04 ` Daniel Mack
2013-04-17 17:13 ` Jussi Laako
2013-04-18 8:05 ` Takashi Iwai
-- strict thread matches above, loose matches on Subject: below --
2013-08-11 16:37 [PATCH v3 5/5] ALSA: snd-usb: add quirks handler for DSD streams Jesus R
2013-08-11 18:20 ` Jesus R
2013-08-12 8:52 ` Daniel Mack
[not found] ` <CANNq7HjgbBvJLRPpewWZKF1LSYmDaSndQnmaXV9XSLj7rvPeHA@mail.gmail.com>
2013-08-12 11:43 ` Daniel Mack
2013-08-12 12:17 ` Jesus R
2013-08-12 11:52 ` Daniel Mack
2013-08-12 12:25 ` Jesus R
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=1366128100-9778-6-git-send-email-zonque@gmail.com \
--to=zonque@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=andreas@akdesigninc.com \
--cc=clemens@ladisch.de \
--cc=demian@auraliti.com \
--cc=ray@auraliti.com \
--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.