* [PATCH v2] add native DSD support for XMOS based DACs
@ 2014-09-05 12:24 Jurgen Kramer
2014-09-05 13:36 ` Takashi Iwai
2014-09-05 15:26 ` Clemens Ladisch
0 siblings, 2 replies; 9+ messages in thread
From: Jurgen Kramer @ 2014-09-05 12:24 UTC (permalink / raw)
To: alsa-devel; +Cc: Jurgen Kramer
Add quirks for XMOS based DACs for native DSD playback support using the new
DSD_U32_LE sample format.
This version adds native DSD support for:
- iFi Audio micro iDSD/nano iDSD (they use the same prod. id)
- DIYINHK USB to I2S/DSD converter
Changes from v1:
- use specific product id and alt setting per XMOS based device
Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
---
sound/usb/quirks.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 19a921e..5ae0536 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -1174,5 +1174,20 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
}
}
+ /* XMOS based USB DACs */
+ if (le16_to_cpu(chip->dev->descriptor.idVendor) == 0x20b1) {
+ switch (le16_to_cpu(chip->dev->descriptor.idProduct)) {
+ /* iFi Audio micro/nano iDSD */
+ case 0x3008:
+ if (fp->altsetting == 2)
+ return SNDRV_PCM_FMTBIT_DSD_U32_LE;
+ /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */
+ case 0x2009:
+ if (fp->altsetting == 3)
+ return SNDRV_PCM_FMTBIT_DSD_U32_LE;
+ default:
+ return 0;
+ }
+ }
return 0;
}
--
1.9.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2] add native DSD support for XMOS based DACs
2014-09-05 12:24 [PATCH v2] add native DSD support for XMOS based DACs Jurgen Kramer
@ 2014-09-05 13:36 ` Takashi Iwai
2014-09-05 13:58 ` Jurgen Kramer
2014-09-05 15:26 ` Clemens Ladisch
1 sibling, 1 reply; 9+ messages in thread
From: Takashi Iwai @ 2014-09-05 13:36 UTC (permalink / raw)
To: Jurgen Kramer; +Cc: alsa-devel
At Fri, 5 Sep 2014 14:24:57 +0200,
Jurgen Kramer wrote:
>
> Add quirks for XMOS based DACs for native DSD playback support using the new
> DSD_U32_LE sample format.
>
> This version adds native DSD support for:
> - iFi Audio micro iDSD/nano iDSD (they use the same prod. id)
> - DIYINHK USB to I2S/DSD converter
>
> Changes from v1:
> - use specific product id and alt setting per XMOS based device
>
> Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
> ---
> sound/usb/quirks.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
> index 19a921e..5ae0536 100644
> --- a/sound/usb/quirks.c
> +++ b/sound/usb/quirks.c
> @@ -1174,5 +1174,20 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
> }
> }
>
> + /* XMOS based USB DACs */
> + if (le16_to_cpu(chip->dev->descriptor.idVendor) == 0x20b1) {
> + switch (le16_to_cpu(chip->dev->descriptor.idProduct)) {
> + /* iFi Audio micro/nano iDSD */
> + case 0x3008:
> + if (fp->altsetting == 2)
> + return SNDRV_PCM_FMTBIT_DSD_U32_LE;
Missing break?
> + /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */
> + case 0x2009:
> + if (fp->altsetting == 3)
> + return SNDRV_PCM_FMTBIT_DSD_U32_LE;
Ditto.
> + default:
> + return 0;
> + }
> + }
> return 0;
> }
> --
> 1.9.3
Takashi
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] add native DSD support for XMOS based DACs
2014-09-05 13:36 ` Takashi Iwai
@ 2014-09-05 13:58 ` Jurgen Kramer
2014-09-05 14:27 ` Takashi Iwai
0 siblings, 1 reply; 9+ messages in thread
From: Jurgen Kramer @ 2014-09-05 13:58 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
On Fri, 2014-09-05 at 15:36 +0200, Takashi Iwai wrote:
> At Fri, 5 Sep 2014 14:24:57 +0200,
> Jurgen Kramer wrote:
> >
> > Add quirks for XMOS based DACs for native DSD playback support using the new
> > DSD_U32_LE sample format.
> >
> > This version adds native DSD support for:
> > - iFi Audio micro iDSD/nano iDSD (they use the same prod. id)
> > - DIYINHK USB to I2S/DSD converter
> >
> > Changes from v1:
> > - use specific product id and alt setting per XMOS based device
> >
> > Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
> > ---
> > sound/usb/quirks.c | 15 +++++++++++++++
> > 1 file changed, 15 insertions(+)
> >
> > diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
> > index 19a921e..5ae0536 100644
> > --- a/sound/usb/quirks.c
> > +++ b/sound/usb/quirks.c
> > @@ -1174,5 +1174,20 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
> > }
> > }
> >
> > + /* XMOS based USB DACs */
> > + if (le16_to_cpu(chip->dev->descriptor.idVendor) == 0x20b1) {
> > + switch (le16_to_cpu(chip->dev->descriptor.idProduct)) {
> > + /* iFi Audio micro/nano iDSD */
> > + case 0x3008:
> > + if (fp->altsetting == 2)
> > + return SNDRV_PCM_FMTBIT_DSD_U32_LE;
>
> Missing break?
It is already returning. Where would the break go?
>
> > + /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */
> > + case 0x2009:
> > + if (fp->altsetting == 3)
> > + return SNDRV_PCM_FMTBIT_DSD_U32_LE;
>
> Ditto.
See above.
>
> > + default:
> > + return 0;
> > + }
> > + }
> > return 0;
> > }
> > --
Jurgen
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] add native DSD support for XMOS based DACs
2014-09-05 13:58 ` Jurgen Kramer
@ 2014-09-05 14:27 ` Takashi Iwai
2014-09-05 14:37 ` Jurgen Kramer
0 siblings, 1 reply; 9+ messages in thread
From: Takashi Iwai @ 2014-09-05 14:27 UTC (permalink / raw)
To: Jurgen Kramer; +Cc: alsa-devel
At Fri, 05 Sep 2014 15:58:39 +0200,
Jurgen Kramer wrote:
>
> On Fri, 2014-09-05 at 15:36 +0200, Takashi Iwai wrote:
> > At Fri, 5 Sep 2014 14:24:57 +0200,
> > Jurgen Kramer wrote:
> > >
> > > Add quirks for XMOS based DACs for native DSD playback support using the new
> > > DSD_U32_LE sample format.
> > >
> > > This version adds native DSD support for:
> > > - iFi Audio micro iDSD/nano iDSD (they use the same prod. id)
> > > - DIYINHK USB to I2S/DSD converter
> > >
> > > Changes from v1:
> > > - use specific product id and alt setting per XMOS based device
> > >
> > > Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
> > > ---
> > > sound/usb/quirks.c | 15 +++++++++++++++
> > > 1 file changed, 15 insertions(+)
> > >
> > > diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
> > > index 19a921e..5ae0536 100644
> > > --- a/sound/usb/quirks.c
> > > +++ b/sound/usb/quirks.c
> > > @@ -1174,5 +1174,20 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
> > > }
> > > }
> > >
> > > + /* XMOS based USB DACs */
> > > + if (le16_to_cpu(chip->dev->descriptor.idVendor) == 0x20b1) {
> > > + switch (le16_to_cpu(chip->dev->descriptor.idProduct)) {
> > > + /* iFi Audio micro/nano iDSD */
> > > + case 0x3008:
> > > + if (fp->altsetting == 2)
> > > + return SNDRV_PCM_FMTBIT_DSD_U32_LE;
> >
> > Missing break?
> It is already returning. Where would the break go?
What if fp->altsetting == 3 with 20b1:3008 chip?
Then it falls down to below, and return SNDRV_PCM_FMTBIT_DSD_U32_LE.
Is this expected?
> >
> > > + /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */
> > > + case 0x2009:
> > > + if (fp->altsetting == 3)
> > > + return SNDRV_PCM_FMTBIT_DSD_U32_LE;
> >
> > Ditto.
> See above.
If the fallthrough is intentional, you *must* put a comment it's
really a fallthrough.
Takashi
> >
> > > + default:
> > > + return 0;
> > > + }
> > > + }
> > > return 0;
> > > }
> > > --
> Jurgen
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] add native DSD support for XMOS based DACs
2014-09-05 14:27 ` Takashi Iwai
@ 2014-09-05 14:37 ` Jurgen Kramer
2014-09-05 14:51 ` Takashi Iwai
0 siblings, 1 reply; 9+ messages in thread
From: Jurgen Kramer @ 2014-09-05 14:37 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
On Fri, 2014-09-05 at 16:27 +0200, Takashi Iwai wrote:
> At Fri, 05 Sep 2014 15:58:39 +0200,
> Jurgen Kramer wrote:
> >
> > On Fri, 2014-09-05 at 15:36 +0200, Takashi Iwai wrote:
> > > At Fri, 5 Sep 2014 14:24:57 +0200,
> > > Jurgen Kramer wrote:
> > > >
> > > > Add quirks for XMOS based DACs for native DSD playback support using the new
> > > > DSD_U32_LE sample format.
> > > >
> > > > This version adds native DSD support for:
> > > > - iFi Audio micro iDSD/nano iDSD (they use the same prod. id)
> > > > - DIYINHK USB to I2S/DSD converter
> > > >
> > > > Changes from v1:
> > > > - use specific product id and alt setting per XMOS based device
> > > >
> > > > Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
> > > > ---
> > > > sound/usb/quirks.c | 15 +++++++++++++++
> > > > 1 file changed, 15 insertions(+)
> > > >
> > > > diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
> > > > index 19a921e..5ae0536 100644
> > > > --- a/sound/usb/quirks.c
> > > > +++ b/sound/usb/quirks.c
> > > > @@ -1174,5 +1174,20 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
> > > > }
> > > > }
> > > >
> > > > + /* XMOS based USB DACs */
> > > > + if (le16_to_cpu(chip->dev->descriptor.idVendor) == 0x20b1) {
> > > > + switch (le16_to_cpu(chip->dev->descriptor.idProduct)) {
> > > > + /* iFi Audio micro/nano iDSD */
> > > > + case 0x3008:
> > > > + if (fp->altsetting == 2)
> > > > + return SNDRV_PCM_FMTBIT_DSD_U32_LE;
> > >
> > > Missing break?
> > It is already returning. Where would the break go?
>
> What if fp->altsetting == 3 with 20b1:3008 chip?
> Then it falls down to below, and return SNDRV_PCM_FMTBIT_DSD_U32_LE.
> Is this expected?
With fp->altsetting == 3 for 20b1:3008 I do not see it returning
SNDRV_PCM_FMTBIT_DSD_U32_LE, it falls through to 'return 0'.
However, would this be more appropriate/readable?:
case 0x3008:
if (fp->altsetting == 2)
return SNDRV_PCM_FMTBIT_DSD_U32_LE;
else
break;
or even:
case 0x3008:
if (fp->altsetting == 2)
return SNDRV_PCM_FMTBIT_DSD_U32_LE;
else
return 0;
> > >
> > > > + /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */
> > > > + case 0x2009:
> > > > + if (fp->altsetting == 3)
> > > > + return SNDRV_PCM_FMTBIT_DSD_U32_LE;
> > >
> > > Ditto.
> > See above.
>
> If the fallthrough is intentional, you *must* put a comment it's
> really a fallthrough.
>
>
Jurgen
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] add native DSD support for XMOS based DACs
2014-09-05 14:37 ` Jurgen Kramer
@ 2014-09-05 14:51 ` Takashi Iwai
2014-09-05 15:03 ` Jurgen Kramer
0 siblings, 1 reply; 9+ messages in thread
From: Takashi Iwai @ 2014-09-05 14:51 UTC (permalink / raw)
To: Jurgen Kramer; +Cc: alsa-devel
At Fri, 05 Sep 2014 16:37:13 +0200,
Jurgen Kramer wrote:
>
> On Fri, 2014-09-05 at 16:27 +0200, Takashi Iwai wrote:
> > At Fri, 05 Sep 2014 15:58:39 +0200,
> > Jurgen Kramer wrote:
> > >
> > > On Fri, 2014-09-05 at 15:36 +0200, Takashi Iwai wrote:
> > > > At Fri, 5 Sep 2014 14:24:57 +0200,
> > > > Jurgen Kramer wrote:
> > > > >
> > > > > Add quirks for XMOS based DACs for native DSD playback support using the new
> > > > > DSD_U32_LE sample format.
> > > > >
> > > > > This version adds native DSD support for:
> > > > > - iFi Audio micro iDSD/nano iDSD (they use the same prod. id)
> > > > > - DIYINHK USB to I2S/DSD converter
> > > > >
> > > > > Changes from v1:
> > > > > - use specific product id and alt setting per XMOS based device
> > > > >
> > > > > Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
> > > > > ---
> > > > > sound/usb/quirks.c | 15 +++++++++++++++
> > > > > 1 file changed, 15 insertions(+)
> > > > >
> > > > > diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
> > > > > index 19a921e..5ae0536 100644
> > > > > --- a/sound/usb/quirks.c
> > > > > +++ b/sound/usb/quirks.c
> > > > > @@ -1174,5 +1174,20 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
> > > > > }
> > > > > }
> > > > >
> > > > > + /* XMOS based USB DACs */
> > > > > + if (le16_to_cpu(chip->dev->descriptor.idVendor) == 0x20b1) {
> > > > > + switch (le16_to_cpu(chip->dev->descriptor.idProduct)) {
> > > > > + /* iFi Audio micro/nano iDSD */
> > > > > + case 0x3008:
> > > > > + if (fp->altsetting == 2)
> > > > > + return SNDRV_PCM_FMTBIT_DSD_U32_LE;
> > > >
> > > > Missing break?
> > > It is already returning. Where would the break go?
> >
> > What if fp->altsetting == 3 with 20b1:3008 chip?
> > Then it falls down to below, and return SNDRV_PCM_FMTBIT_DSD_U32_LE.
> > Is this expected?
> With fp->altsetting == 3 for 20b1:3008 I do not see it returning
> SNDRV_PCM_FMTBIT_DSD_U32_LE, it falls through to 'return 0'.
Well, read your C text book carefully again :)
The tricky part of switch/case behavior is that it falls through to
the next case, not going out of switch block.
> However, would this be more appropriate/readable?:
>
> case 0x3008:
> if (fp->altsetting == 2)
> return SNDRV_PCM_FMTBIT_DSD_U32_LE;
> else
> break;
Just put break. The standard form of switch/case is like:
switch (cond) {
case xxx:
if (something)
return abc;
break;
case yyy:
if (another)
return def;
break;
default:
break;
}
return 0;
Takashi
>
> or even:
>
> case 0x3008:
> if (fp->altsetting == 2)
> return SNDRV_PCM_FMTBIT_DSD_U32_LE;
> else
> return 0;
>
> > > >
> > > > > + /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */
> > > > > + case 0x2009:
> > > > > + if (fp->altsetting == 3)
> > > > > + return SNDRV_PCM_FMTBIT_DSD_U32_LE;
> > > >
> > > > Ditto.
> > > See above.
> >
> > If the fallthrough is intentional, you *must* put a comment it's
> > really a fallthrough.
> >
> >
> Jurgen
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] add native DSD support for XMOS based DACs
2014-09-05 14:51 ` Takashi Iwai
@ 2014-09-05 15:03 ` Jurgen Kramer
0 siblings, 0 replies; 9+ messages in thread
From: Jurgen Kramer @ 2014-09-05 15:03 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
On Fri, 2014-09-05 at 16:51 +0200, Takashi Iwai wrote:
> At Fri, 05 Sep 2014 16:37:13 +0200,
> Jurgen Kramer wrote:
> >
> > On Fri, 2014-09-05 at 16:27 +0200, Takashi Iwai wrote:
> > > At Fri, 05 Sep 2014 15:58:39 +0200,
> > > Jurgen Kramer wrote:
> > > >
> > > > On Fri, 2014-09-05 at 15:36 +0200, Takashi Iwai wrote:
> > > > > At Fri, 5 Sep 2014 14:24:57 +0200,
> > > > > Jurgen Kramer wrote:
> > > > > >
> > > > > > Add quirks for XMOS based DACs for native DSD playback support using the new
> > > > > > DSD_U32_LE sample format.
> > > > > >
> > > > > > This version adds native DSD support for:
> > > > > > - iFi Audio micro iDSD/nano iDSD (they use the same prod. id)
> > > > > > - DIYINHK USB to I2S/DSD converter
> > > > > >
> > > > > > Changes from v1:
> > > > > > - use specific product id and alt setting per XMOS based device
> > > > > >
> > > > > > Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
> > > > > > ---
> > > > > > sound/usb/quirks.c | 15 +++++++++++++++
> > > > > > 1 file changed, 15 insertions(+)
> > > > > >
> > > > > > diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
> > > > > > index 19a921e..5ae0536 100644
> > > > > > --- a/sound/usb/quirks.c
> > > > > > +++ b/sound/usb/quirks.c
> > > > > > @@ -1174,5 +1174,20 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
> > > > > > }
> > > > > > }
> > > > > >
> > > > > > + /* XMOS based USB DACs */
> > > > > > + if (le16_to_cpu(chip->dev->descriptor.idVendor) == 0x20b1) {
> > > > > > + switch (le16_to_cpu(chip->dev->descriptor.idProduct)) {
> > > > > > + /* iFi Audio micro/nano iDSD */
> > > > > > + case 0x3008:
> > > > > > + if (fp->altsetting == 2)
> > > > > > + return SNDRV_PCM_FMTBIT_DSD_U32_LE;
> > > > >
> > > > > Missing break?
> > > > It is already returning. Where would the break go?
> > >
> > > What if fp->altsetting == 3 with 20b1:3008 chip?
> > > Then it falls down to below, and return SNDRV_PCM_FMTBIT_DSD_U32_LE.
> > > Is this expected?
> > With fp->altsetting == 3 for 20b1:3008 I do not see it returning
> > SNDRV_PCM_FMTBIT_DSD_U32_LE, it falls through to 'return 0'.
>
> Well, read your C text book carefully again :)
Haha!
> The tricky part of switch/case behavior is that it falls through to
> the next case, not going out of switch block.
>
> > However, would this be more appropriate/readable?:
> >
> > case 0x3008:
> > if (fp->altsetting == 2)
> > return SNDRV_PCM_FMTBIT_DSD_U32_LE;
> > else
> > break;
>
> Just put break. The standard form of switch/case is like:
>
> switch (cond) {
> case xxx:
> if (something)
> return abc;
> break;
> case yyy:
> if (another)
> return def;
> break;
> default:
> break;
> }
>
> return 0;
Thanks, new patch coming up.
Jurgen
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] add native DSD support for XMOS based DACs
2014-09-05 12:24 [PATCH v2] add native DSD support for XMOS based DACs Jurgen Kramer
2014-09-05 13:36 ` Takashi Iwai
@ 2014-09-05 15:26 ` Clemens Ladisch
2014-09-05 15:41 ` Jurgen Kramer
1 sibling, 1 reply; 9+ messages in thread
From: Clemens Ladisch @ 2014-09-05 15:26 UTC (permalink / raw)
To: Jurgen Kramer, alsa-devel
Jurgen Kramer wrote:
> + /* XMOS based USB DACs */
> + if (le16_to_cpu(chip->dev->descriptor.idVendor) == 0x20b1) {
> + switch (le16_to_cpu(chip->dev->descriptor.idProduct)) {
> + /* iFi Audio micro/nano iDSD */
> + case 0x3008:
And you don't need to go through the descriptors; you can test
chip->usb_id directly (see snd_usb_set_format_quirk()).
Regards,
Clemens
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] add native DSD support for XMOS based DACs
2014-09-05 15:26 ` Clemens Ladisch
@ 2014-09-05 15:41 ` Jurgen Kramer
0 siblings, 0 replies; 9+ messages in thread
From: Jurgen Kramer @ 2014-09-05 15:41 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: alsa-devel
On Fri, 2014-09-05 at 17:26 +0200, Clemens Ladisch wrote:
> Jurgen Kramer wrote:
> > + /* XMOS based USB DACs */
> > + if (le16_to_cpu(chip->dev->descriptor.idVendor) == 0x20b1) {
> > + switch (le16_to_cpu(chip->dev->descriptor.idProduct)) {
> > + /* iFi Audio micro/nano iDSD */
> > + case 0x3008:
>
> And you don't need to go through the descriptors; you can test
> chip->usb_id directly (see snd_usb_set_format_quirk()).
Thanks, will do!
Jurgen
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-09-05 15:41 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-05 12:24 [PATCH v2] add native DSD support for XMOS based DACs Jurgen Kramer
2014-09-05 13:36 ` Takashi Iwai
2014-09-05 13:58 ` Jurgen Kramer
2014-09-05 14:27 ` Takashi Iwai
2014-09-05 14:37 ` Jurgen Kramer
2014-09-05 14:51 ` Takashi Iwai
2014-09-05 15:03 ` Jurgen Kramer
2014-09-05 15:26 ` Clemens Ladisch
2014-09-05 15:41 ` Jurgen Kramer
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.