sound/soc/soc-utils-test.c
Source file repositories/reference/linux-study-clean/sound/soc/soc-utils-test.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/soc-utils-test.c- Extension
.c- Size
- 9813 bytes
- Lines
- 233
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
kunit/test.hlinux/module.hsound/pcm.hsound/pcm_params.hsound/soc.huapi/sound/asound.h
Detected Declarations
function test_tdm_params_to_bclk_onefunction test_tdm_params_to_bclkfunction test_snd_soc_params_to_bclk_onefunction test_snd_soc_params_to_bclk
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
// Copyright (C) 2022 Cirrus Logic, Inc. and
// Cirrus Logic International Semiconductor Ltd.
#include <kunit/test.h>
#include <linux/module.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <uapi/sound/asound.h>
static const struct {
u32 rate;
snd_pcm_format_t fmt;
u8 channels;
u8 tdm_width;
u8 tdm_slots;
u8 slot_multiple;
u32 bclk;
} tdm_params_to_bclk_cases[] = {
/* rate fmt channels tdm_width tdm_slots slot_multiple bclk */
/* From params only */
{ 8000, SNDRV_PCM_FORMAT_S16_LE, 1, 0, 0, 0, 128000 },
{ 8000, SNDRV_PCM_FORMAT_S16_LE, 2, 0, 0, 0, 256000 },
{ 8000, SNDRV_PCM_FORMAT_S24_LE, 1, 0, 0, 0, 192000 },
{ 8000, SNDRV_PCM_FORMAT_S24_LE, 2, 0, 0, 0, 384000 },
{ 8000, SNDRV_PCM_FORMAT_S32_LE, 1, 0, 0, 0, 256000 },
{ 8000, SNDRV_PCM_FORMAT_S32_LE, 2, 0, 0, 0, 512000 },
{ 44100, SNDRV_PCM_FORMAT_S16_LE, 1, 0, 0, 0, 705600 },
{ 44100, SNDRV_PCM_FORMAT_S16_LE, 2, 0, 0, 0, 1411200 },
{ 44100, SNDRV_PCM_FORMAT_S24_LE, 1, 0, 0, 0, 1058400 },
{ 44100, SNDRV_PCM_FORMAT_S24_LE, 2, 0, 0, 0, 2116800 },
{ 44100, SNDRV_PCM_FORMAT_S32_LE, 1, 0, 0, 0, 1411200 },
{ 44100, SNDRV_PCM_FORMAT_S32_LE, 2, 0, 0, 0, 2822400 },
{ 384000, SNDRV_PCM_FORMAT_S16_LE, 1, 0, 0, 0, 6144000 },
{ 384000, SNDRV_PCM_FORMAT_S16_LE, 2, 0, 0, 0, 12288000 },
{ 384000, SNDRV_PCM_FORMAT_S24_LE, 1, 0, 0, 0, 9216000 },
{ 384000, SNDRV_PCM_FORMAT_S24_LE, 2, 0, 0, 0, 18432000 },
{ 384000, SNDRV_PCM_FORMAT_S32_LE, 1, 0, 0, 0, 12288000 },
{ 384000, SNDRV_PCM_FORMAT_S32_LE, 2, 0, 0, 0, 24576000 },
/* I2S from params */
{ 8000, SNDRV_PCM_FORMAT_S16_LE, 1, 0, 0, 2, 256000 },
{ 8000, SNDRV_PCM_FORMAT_S16_LE, 2, 0, 0, 2, 256000 },
{ 8000, SNDRV_PCM_FORMAT_S24_LE, 1, 0, 0, 2, 384000 },
{ 8000, SNDRV_PCM_FORMAT_S24_LE, 2, 0, 0, 2, 384000 },
{ 8000, SNDRV_PCM_FORMAT_S32_LE, 1, 0, 0, 2, 512000 },
{ 8000, SNDRV_PCM_FORMAT_S32_LE, 2, 0, 0, 2, 512000 },
{ 44100, SNDRV_PCM_FORMAT_S16_LE, 1, 0, 0, 2, 1411200 },
{ 44100, SNDRV_PCM_FORMAT_S16_LE, 2, 0, 0, 2, 1411200 },
{ 44100, SNDRV_PCM_FORMAT_S24_LE, 1, 0, 0, 2, 2116800 },
{ 44100, SNDRV_PCM_FORMAT_S24_LE, 2, 0, 0, 2, 2116800 },
{ 44100, SNDRV_PCM_FORMAT_S32_LE, 1, 0, 0, 2, 2822400 },
{ 44100, SNDRV_PCM_FORMAT_S32_LE, 2, 0, 0, 2, 2822400 },
{ 384000, SNDRV_PCM_FORMAT_S16_LE, 1, 0, 0, 2, 12288000 },
{ 384000, SNDRV_PCM_FORMAT_S16_LE, 2, 0, 0, 2, 12288000 },
{ 384000, SNDRV_PCM_FORMAT_S24_LE, 1, 0, 0, 2, 18432000 },
{ 384000, SNDRV_PCM_FORMAT_S24_LE, 2, 0, 0, 2, 18432000 },
{ 384000, SNDRV_PCM_FORMAT_S32_LE, 1, 0, 0, 2, 24576000 },
{ 384000, SNDRV_PCM_FORMAT_S32_LE, 2, 0, 0, 2, 24576000 },
/* Fixed 8-slot TDM, other values from params */
{ 8000, SNDRV_PCM_FORMAT_S16_LE, 1, 0, 8, 0, 1024000 },
{ 8000, SNDRV_PCM_FORMAT_S16_LE, 2, 0, 8, 0, 1024000 },
{ 8000, SNDRV_PCM_FORMAT_S16_LE, 3, 0, 8, 0, 1024000 },
{ 8000, SNDRV_PCM_FORMAT_S16_LE, 4, 0, 8, 0, 1024000 },
{ 8000, SNDRV_PCM_FORMAT_S32_LE, 1, 0, 8, 0, 2048000 },
{ 8000, SNDRV_PCM_FORMAT_S32_LE, 2, 0, 8, 0, 2048000 },
{ 8000, SNDRV_PCM_FORMAT_S32_LE, 3, 0, 8, 0, 2048000 },
{ 8000, SNDRV_PCM_FORMAT_S32_LE, 4, 0, 8, 0, 2048000 },
{ 384000, SNDRV_PCM_FORMAT_S16_LE, 1, 0, 8, 0, 49152000 },
{ 384000, SNDRV_PCM_FORMAT_S16_LE, 2, 0, 8, 0, 49152000 },
{ 384000, SNDRV_PCM_FORMAT_S16_LE, 3, 0, 8, 0, 49152000 },
{ 384000, SNDRV_PCM_FORMAT_S16_LE, 4, 0, 8, 0, 49152000 },
{ 384000, SNDRV_PCM_FORMAT_S32_LE, 1, 0, 8, 0, 98304000 },
{ 384000, SNDRV_PCM_FORMAT_S32_LE, 2, 0, 8, 0, 98304000 },
{ 384000, SNDRV_PCM_FORMAT_S32_LE, 3, 0, 8, 0, 98304000 },
{ 384000, SNDRV_PCM_FORMAT_S32_LE, 4, 0, 8, 0, 98304000 },
/* Fixed 32-bit TDM, other values from params */
{ 8000, SNDRV_PCM_FORMAT_S16_LE, 1, 32, 0, 0, 256000 },
{ 8000, SNDRV_PCM_FORMAT_S16_LE, 2, 32, 0, 0, 512000 },
{ 8000, SNDRV_PCM_FORMAT_S16_LE, 3, 32, 0, 0, 768000 },
{ 8000, SNDRV_PCM_FORMAT_S16_LE, 4, 32, 0, 0, 1024000 },
{ 8000, SNDRV_PCM_FORMAT_S32_LE, 1, 32, 0, 0, 256000 },
{ 8000, SNDRV_PCM_FORMAT_S32_LE, 2, 32, 0, 0, 512000 },
{ 8000, SNDRV_PCM_FORMAT_S32_LE, 3, 32, 0, 0, 768000 },
{ 8000, SNDRV_PCM_FORMAT_S32_LE, 4, 32, 0, 0, 1024000 },
{ 384000, SNDRV_PCM_FORMAT_S16_LE, 1, 32, 0, 0, 12288000 },
Annotation
- Immediate include surface: `kunit/test.h`, `linux/module.h`, `sound/pcm.h`, `sound/pcm_params.h`, `sound/soc.h`, `uapi/sound/asound.h`.
- Detected declarations: `function test_tdm_params_to_bclk_one`, `function test_tdm_params_to_bclk`, `function test_snd_soc_params_to_bclk_one`, `function test_snd_soc_params_to_bclk`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source 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.