sound/core/pcm_misc.c
Source file repositories/reference/linux-study-clean/sound/core/pcm_misc.c
File Facts
- System
- Linux kernel
- Corpus path
sound/core/pcm_misc.c- Extension
.c- Size
- 14817 bytes
- Lines
- 574
- Domain
- Driver Families
- Bucket
- sound/core
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/time.hlinux/export.hsound/core.hsound/pcm.hpcm_local.h
Detected Declarations
struct pcm_format_datafunction valid_formatfunction snd_pcm_format_signedfunction snd_pcm_format_unsignedfunction snd_pcm_format_linearfunction snd_pcm_format_little_endianfunction snd_pcm_format_big_endianfunction snd_pcm_format_widthfunction snd_pcm_format_physical_widthfunction snd_pcm_format_sizefunction snd_pcm_format_set_silencefunction snd_pcm_hw_limit_ratesfunction snd_pcm_rate_to_rate_bitfunction snd_pcm_rate_bit_to_ratefunction snd_pcm_rate_mask_sanitizefunction snd_pcm_rate_mask_intersectexport snd_pcm_format_signedexport snd_pcm_format_unsignedexport snd_pcm_format_linearexport snd_pcm_format_little_endianexport snd_pcm_format_big_endianexport snd_pcm_format_widthexport snd_pcm_format_physical_widthexport snd_pcm_format_sizeexport snd_pcm_format_silence_64export snd_pcm_format_set_silenceexport snd_pcm_hw_limit_ratesexport snd_pcm_rate_to_rate_bitexport snd_pcm_rate_bit_to_rateexport snd_pcm_rate_mask_intersect
Annotated Snippet
struct pcm_format_data {
unsigned char width; /* bit width */
unsigned char phys; /* physical bit width */
signed char le; /* 0 = big-endian, 1 = little-endian, -1 = others */
signed char signd; /* 0 = unsigned, 1 = signed, -1 = others */
unsigned char silence[8]; /* silence data to fill */
};
/* we do lots of calculations on snd_pcm_format_t; shut up sparse */
#define INT __force int
static bool valid_format(snd_pcm_format_t format)
{
return (INT)format >= 0 && (INT)format <= (INT)SNDRV_PCM_FORMAT_LAST;
}
static const struct pcm_format_data pcm_formats[(INT)SNDRV_PCM_FORMAT_LAST+1] = {
[SNDRV_PCM_FORMAT_S8] = {
.width = 8, .phys = 8, .le = -1, .signd = 1,
.silence = {},
},
[SNDRV_PCM_FORMAT_U8] = {
.width = 8, .phys = 8, .le = -1, .signd = 0,
.silence = { 0x80 },
},
[SNDRV_PCM_FORMAT_S16_LE] = {
.width = 16, .phys = 16, .le = 1, .signd = 1,
.silence = {},
},
[SNDRV_PCM_FORMAT_S16_BE] = {
.width = 16, .phys = 16, .le = 0, .signd = 1,
.silence = {},
},
[SNDRV_PCM_FORMAT_U16_LE] = {
.width = 16, .phys = 16, .le = 1, .signd = 0,
.silence = { 0x00, 0x80 },
},
[SNDRV_PCM_FORMAT_U16_BE] = {
.width = 16, .phys = 16, .le = 0, .signd = 0,
.silence = { 0x80, 0x00 },
},
[SNDRV_PCM_FORMAT_S24_LE] = {
.width = 24, .phys = 32, .le = 1, .signd = 1,
.silence = {},
},
[SNDRV_PCM_FORMAT_S24_BE] = {
.width = 24, .phys = 32, .le = 0, .signd = 1,
.silence = {},
},
[SNDRV_PCM_FORMAT_U24_LE] = {
.width = 24, .phys = 32, .le = 1, .signd = 0,
.silence = { 0x00, 0x00, 0x80 },
},
[SNDRV_PCM_FORMAT_U24_BE] = {
.width = 24, .phys = 32, .le = 0, .signd = 0,
.silence = { 0x00, 0x80, 0x00, 0x00 },
},
[SNDRV_PCM_FORMAT_S32_LE] = {
.width = 32, .phys = 32, .le = 1, .signd = 1,
.silence = {},
},
[SNDRV_PCM_FORMAT_S32_BE] = {
.width = 32, .phys = 32, .le = 0, .signd = 1,
.silence = {},
},
[SNDRV_PCM_FORMAT_U32_LE] = {
.width = 32, .phys = 32, .le = 1, .signd = 0,
.silence = { 0x00, 0x00, 0x00, 0x80 },
},
[SNDRV_PCM_FORMAT_U32_BE] = {
.width = 32, .phys = 32, .le = 0, .signd = 0,
.silence = { 0x80, 0x00, 0x00, 0x00 },
},
[SNDRV_PCM_FORMAT_FLOAT_LE] = {
.width = 32, .phys = 32, .le = 1, .signd = -1,
.silence = {},
},
[SNDRV_PCM_FORMAT_FLOAT_BE] = {
.width = 32, .phys = 32, .le = 0, .signd = -1,
.silence = {},
},
[SNDRV_PCM_FORMAT_FLOAT64_LE] = {
.width = 64, .phys = 64, .le = 1, .signd = -1,
.silence = {},
},
[SNDRV_PCM_FORMAT_FLOAT64_BE] = {
.width = 64, .phys = 64, .le = 0, .signd = -1,
.silence = {},
},
[SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE] = {
Annotation
- Immediate include surface: `linux/time.h`, `linux/export.h`, `sound/core.h`, `sound/pcm.h`, `pcm_local.h`.
- Detected declarations: `struct pcm_format_data`, `function valid_format`, `function snd_pcm_format_signed`, `function snd_pcm_format_unsigned`, `function snd_pcm_format_linear`, `function snd_pcm_format_little_endian`, `function snd_pcm_format_big_endian`, `function snd_pcm_format_width`, `function snd_pcm_format_physical_width`, `function snd_pcm_format_size`.
- Atlas domain: Driver Families / sound/core.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.