diff options
author | Jurgen Kramer <gtmkramer@xs4all.nl> | 2014-09-05 04:47:56 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-09-08 11:11:00 -0400 |
commit | d4288d3fac18bbc31cb6d369679b1fa1d9321ae9 (patch) | |
tree | ae486894fa6aa5db6f1c4c7a2d5d39622b19b428 | |
parent | 7fd4394dfe1db02ba904dfa1048f718cbca822d1 (diff) |
ALSA: pcm: add new DSD sampleformat for native DSD playback on XMOS based devices
XMOS based USB DACs with native DSD support expose this feature via a USB
alternate setting. The audio format is either 32-bit raw or a 32-bit PCM format.
To utilize this feature on linux this patch introduces a new 32-bit DSD
sampleformat DSD_U32_LE.
A follow up patch will add a quirk for XMOS based devices to utilize the new format.
Further patches will add support to alsa-lib.
Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | include/sound/pcm.h | 1 | ||||
-rw-r--r-- | include/uapi/sound/asound.h | 3 | ||||
-rw-r--r-- | sound/core/pcm.c | 1 | ||||
-rw-r--r-- | sound/core/pcm_misc.c | 4 |
4 files changed, 8 insertions, 1 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 67e0bdb9f0fa..e862497f7556 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
@@ -183,6 +183,7 @@ struct snd_pcm_ops { | |||
183 | #define SNDRV_PCM_FMTBIT_G723_40_1B _SNDRV_PCM_FMTBIT(G723_40_1B) | 183 | #define SNDRV_PCM_FMTBIT_G723_40_1B _SNDRV_PCM_FMTBIT(G723_40_1B) |
184 | #define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8) | 184 | #define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8) |
185 | #define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE) | 185 | #define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE) |
186 | #define SNDRV_PCM_FMTBIT_DSD_U32_LE _SNDRV_PCM_FMTBIT(DSD_U32_LE) | ||
186 | 187 | ||
187 | #ifdef SNDRV_LITTLE_ENDIAN | 188 | #ifdef SNDRV_LITTLE_ENDIAN |
188 | #define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE | 189 | #define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE |
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h index 32168f7ffce3..6ee586728df9 100644 --- a/include/uapi/sound/asound.h +++ b/include/uapi/sound/asound.h | |||
@@ -219,7 +219,8 @@ typedef int __bitwise snd_pcm_format_t; | |||
219 | #define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */ | 219 | #define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */ |
220 | #define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */ | 220 | #define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */ |
221 | #define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */ | 221 | #define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */ |
222 | #define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U16_LE | 222 | #define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */ |
223 | #define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_LE | ||
223 | 224 | ||
224 | #ifdef SNDRV_LITTLE_ENDIAN | 225 | #ifdef SNDRV_LITTLE_ENDIAN |
225 | #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE | 226 | #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE |
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index afccdc553ef9..42ded997b223 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -215,6 +215,7 @@ static char *snd_pcm_format_names[] = { | |||
215 | FORMAT(G723_40_1B), | 215 | FORMAT(G723_40_1B), |
216 | FORMAT(DSD_U8), | 216 | FORMAT(DSD_U8), |
217 | FORMAT(DSD_U16_LE), | 217 | FORMAT(DSD_U16_LE), |
218 | FORMAT(DSD_U32_LE), | ||
218 | }; | 219 | }; |
219 | 220 | ||
220 | const char *snd_pcm_format_name(snd_pcm_format_t format) | 221 | const char *snd_pcm_format_name(snd_pcm_format_t format) |
diff --git a/sound/core/pcm_misc.c b/sound/core/pcm_misc.c index 4560ca0e5651..83f54e1dbac9 100644 --- a/sound/core/pcm_misc.c +++ b/sound/core/pcm_misc.c | |||
@@ -148,6 +148,10 @@ static struct pcm_format_data pcm_formats[(INT)SNDRV_PCM_FORMAT_LAST+1] = { | |||
148 | .width = 16, .phys = 16, .le = 1, .signd = 0, | 148 | .width = 16, .phys = 16, .le = 1, .signd = 0, |
149 | .silence = {}, | 149 | .silence = {}, |
150 | }, | 150 | }, |
151 | [SNDRV_PCM_FORMAT_DSD_U32_LE] = { | ||
152 | .width = 32, .phys = 32, .le = 1, .signd = 0, | ||
153 | .silence = { 0x69, 0x69, 0x69, 0x69 }, | ||
154 | }, | ||
151 | /* FIXME: the following three formats are not defined properly yet */ | 155 | /* FIXME: the following three formats are not defined properly yet */ |
152 | [SNDRV_PCM_FORMAT_MPEG] = { | 156 | [SNDRV_PCM_FORMAT_MPEG] = { |
153 | .le = -1, .signd = -1, | 157 | .le = -1, .signd = -1, |