Commit d42472ec authored by Jussi Laako's avatar Jussi Laako Committed by Takashi Iwai

ALSA: pcm: Add big-endian DSD sample formats and fix XMOS DSD sample format

This patch fixes XMOS DSD sample format to DSD_U32_BE and also adds
DSD_U16_BE and DSD_U32_BE sample formats.
Signed-off-by: default avatarJussi Laako <jussi@sonarnerd.net>
Acked-by: default avatarJurgen Kramer <gtmkramer@xs4all.nl>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 911f632c
...@@ -184,6 +184,8 @@ struct snd_pcm_ops { ...@@ -184,6 +184,8 @@ struct snd_pcm_ops {
#define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8) #define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8)
#define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE) #define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE)
#define SNDRV_PCM_FMTBIT_DSD_U32_LE _SNDRV_PCM_FMTBIT(DSD_U32_LE) #define SNDRV_PCM_FMTBIT_DSD_U32_LE _SNDRV_PCM_FMTBIT(DSD_U32_LE)
#define SNDRV_PCM_FMTBIT_DSD_U16_BE _SNDRV_PCM_FMTBIT(DSD_U16_BE)
#define SNDRV_PCM_FMTBIT_DSD_U32_BE _SNDRV_PCM_FMTBIT(DSD_U32_BE)
#ifdef SNDRV_LITTLE_ENDIAN #ifdef SNDRV_LITTLE_ENDIAN
#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE #define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE
......
...@@ -220,7 +220,9 @@ typedef int __bitwise snd_pcm_format_t; ...@@ -220,7 +220,9 @@ typedef int __bitwise snd_pcm_format_t;
#define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */ #define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */
#define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */ #define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */
#define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */ #define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */
#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_LE #define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */
#define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */
#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE
#ifdef SNDRV_LITTLE_ENDIAN #ifdef SNDRV_LITTLE_ENDIAN
#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
......
...@@ -216,6 +216,8 @@ static char *snd_pcm_format_names[] = { ...@@ -216,6 +216,8 @@ static char *snd_pcm_format_names[] = {
FORMAT(DSD_U8), FORMAT(DSD_U8),
FORMAT(DSD_U16_LE), FORMAT(DSD_U16_LE),
FORMAT(DSD_U32_LE), FORMAT(DSD_U32_LE),
FORMAT(DSD_U16_BE),
FORMAT(DSD_U32_BE),
}; };
const char *snd_pcm_format_name(snd_pcm_format_t format) const char *snd_pcm_format_name(snd_pcm_format_t format)
......
...@@ -152,6 +152,14 @@ static struct pcm_format_data pcm_formats[(INT)SNDRV_PCM_FORMAT_LAST+1] = { ...@@ -152,6 +152,14 @@ static struct pcm_format_data pcm_formats[(INT)SNDRV_PCM_FORMAT_LAST+1] = {
.width = 32, .phys = 32, .le = 1, .signd = 0, .width = 32, .phys = 32, .le = 1, .signd = 0,
.silence = { 0x69, 0x69, 0x69, 0x69 }, .silence = { 0x69, 0x69, 0x69, 0x69 },
}, },
[SNDRV_PCM_FORMAT_DSD_U16_BE] = {
.width = 16, .phys = 16, .le = 0, .signd = 0,
.silence = { 0x69, 0x69 },
},
[SNDRV_PCM_FORMAT_DSD_U32_BE] = {
.width = 32, .phys = 32, .le = 0, .signd = 0,
.silence = { 0x69, 0x69, 0x69, 0x69 },
},
/* FIXME: the following three formats are not defined properly yet */ /* FIXME: the following three formats are not defined properly yet */
[SNDRV_PCM_FORMAT_MPEG] = { [SNDRV_PCM_FORMAT_MPEG] = {
.le = -1, .signd = -1, .le = -1, .signd = -1,
......
...@@ -1193,12 +1193,12 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, ...@@ -1193,12 +1193,12 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
/* iFi Audio micro/nano iDSD */ /* iFi Audio micro/nano iDSD */
case USB_ID(0x20b1, 0x3008): case USB_ID(0x20b1, 0x3008):
if (fp->altsetting == 2) if (fp->altsetting == 2)
return SNDRV_PCM_FMTBIT_DSD_U32_LE; return SNDRV_PCM_FMTBIT_DSD_U32_BE;
break; break;
/* DIYINHK DSD DXD 384kHz USB to I2S/DSD */ /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */
case USB_ID(0x20b1, 0x2009): case USB_ID(0x20b1, 0x2009):
if (fp->altsetting == 3) if (fp->altsetting == 3)
return SNDRV_PCM_FMTBIT_DSD_U32_LE; return SNDRV_PCM_FMTBIT_DSD_U32_BE;
break; break;
default: default:
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment