Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: pcm: Define G723 3-bit and 5-bit formats

This defines the 24bps and 40bps (8khz sample rate) G.723 codec
formats. They are going to be used once I submit the driver for
an mpeg4/g723 compression card.

I've updated the signed value to -1 as per Takashi's comments
since these are non-linear formats.

Signed-off-by: Ben Collins <bcollins@bluecherry.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Ben Collins and committed by
Takashi Iwai
15c0cee6 67a3e12b

+25 -1
+5 -1
include/sound/asound.h
··· 212 212 #define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */ 213 213 #define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */ 214 214 #define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */ 215 - #define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_U18_3BE 215 + #define SNDRV_PCM_FORMAT_G723_24 ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */ 216 + #define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */ 217 + #define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */ 218 + #define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */ 219 + #define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_G723_40_1B 216 220 217 221 #ifdef SNDRV_LITTLE_ENDIAN 218 222 #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
+4
include/sound/pcm.h
··· 174 174 #define SNDRV_PCM_FMTBIT_U18_3LE (1ULL << SNDRV_PCM_FORMAT_U18_3LE) 175 175 #define SNDRV_PCM_FMTBIT_S18_3BE (1ULL << SNDRV_PCM_FORMAT_S18_3BE) 176 176 #define SNDRV_PCM_FMTBIT_U18_3BE (1ULL << SNDRV_PCM_FORMAT_U18_3BE) 177 + #define SNDRV_PCM_FMTBIT_G723_24 (1ULL << SNDRV_PCM_FORMAT_G723_24) 178 + #define SNDRV_PCM_FMTBIT_G723_24_1B (1ULL << SNDRV_PCM_FORMAT_G723_24_1B) 179 + #define SNDRV_PCM_FMTBIT_G723_40 (1ULL << SNDRV_PCM_FORMAT_G723_40) 180 + #define SNDRV_PCM_FMTBIT_G723_40_1B (1ULL << SNDRV_PCM_FORMAT_G723_40_1B) 177 181 178 182 #ifdef SNDRV_LITTLE_ENDIAN 179 183 #define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE
+16
sound/core/pcm_misc.c
··· 128 128 .width = 4, .phys = 4, .le = -1, .signd = -1, 129 129 .silence = {}, 130 130 }, 131 + [SNDRV_PCM_FORMAT_G723_24] = { 132 + .width = 3, .phys = 3, .le = -1, .signd = -1, 133 + .silence = {}, 134 + }, 135 + [SNDRV_PCM_FORMAT_G723_40] = { 136 + .width = 5, .phys = 5, .le = -1, .signd = -1, 137 + .silence = {}, 138 + }, 131 139 /* FIXME: the following three formats are not defined properly yet */ 132 140 [SNDRV_PCM_FORMAT_MPEG] = { 133 141 .le = -1, .signd = -1, ··· 193 185 [SNDRV_PCM_FORMAT_U18_3BE] = { 194 186 .width = 18, .phys = 24, .le = 0, .signd = 0, 195 187 .silence = { 0x02, 0x00, 0x00 }, 188 + }, 189 + [SNDRV_PCM_FORMAT_G723_24_1B] = { 190 + .width = 3, .phys = 8, .le = -1, .signd = -1, 191 + .silence = {}, 192 + }, 193 + [SNDRV_PCM_FORMAT_G723_40_1B] = { 194 + .width = 5, .phys = 8, .le = -1, .signd = -1, 195 + .silence = {}, 196 196 }, 197 197 }; 198 198