sound/soc/generic/test-component.c
Source file repositories/reference/linux-study-clean/sound/soc/generic/test-component.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/generic/test-component.c- Extension
.c- Size
- 16605 bytes
- Lines
- 651
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/slab.hlinux/of.hlinux/of_graph.hlinux/module.hlinux/workqueue.hsound/pcm.hsound/soc.h
Detected Declarations
struct test_dai_namestruct test_privstruct test_adatafunction test_dai_set_sysclkfunction test_dai_set_pllfunction test_dai_set_clkdivfunction test_dai_set_fmtfunction test_dai_set_tdm_slotfunction test_dai_mute_streamfunction test_dai_startupfunction test_dai_shutdownfunction test_dai_hw_paramsfunction test_dai_hw_freefunction test_dai_triggerfunction test_component_probefunction test_component_removefunction test_component_suspendfunction test_component_resumefunction test_component_pcm_newfunction test_component_pcm_freefunction test_component_set_sysclkfunction test_component_set_pllfunction test_component_set_jackfunction test_component_seq_notifierfunction test_component_stream_eventfunction test_component_set_bias_levelfunction test_component_openfunction test_component_closefunction test_component_ioctlfunction test_component_hw_paramsfunction test_component_hw_freefunction test_component_preparefunction test_component_timer_stopfunction test_component_timer_startfunction test_component_dworkfunction test_component_triggerfunction test_component_sync_stopfunction test_component_pointerfunction test_component_get_time_infofunction test_component_be_hw_params_fixupfunction test_driver_probefunction test_driver_remove
Annotated Snippet
struct test_dai_name {
char name[TEST_NAME_LEN];
char name_playback[TEST_NAME_LEN];
char name_capture[TEST_NAME_LEN];
};
struct test_priv {
struct device *dev;
struct snd_pcm_substream *substream;
struct delayed_work dwork;
struct snd_soc_component_driver *component_driver;
struct snd_soc_dai_driver *dai_driver;
struct test_dai_name *name;
};
struct test_adata {
u32 is_cpu:1;
u32 cmp_v:1;
u32 dai_v:1;
};
#define mile_stone(d) dev_info((d)->dev, "%s() : %s", __func__, (d)->driver->name)
#define mile_stone_x(dev) dev_info(dev, "%s()", __func__)
static int test_dai_set_sysclk(struct snd_soc_dai *dai,
int clk_id, unsigned int freq, int dir)
{
mile_stone(dai);
return 0;
}
static int test_dai_set_pll(struct snd_soc_dai *dai, int pll_id, int source,
unsigned int freq_in, unsigned int freq_out)
{
mile_stone(dai);
return 0;
}
static int test_dai_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div)
{
mile_stone(dai);
return 0;
}
static int test_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{
unsigned int format = fmt & SND_SOC_DAIFMT_FORMAT_MASK;
unsigned int clock = fmt & SND_SOC_DAIFMT_CLOCK_MASK;
unsigned int inv = fmt & SND_SOC_DAIFMT_INV_MASK;
unsigned int master = fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK;
char *str;
dev_info(dai->dev, "name : %s", dai->name);
str = "unknown";
switch (format) {
case SND_SOC_DAIFMT_I2S:
str = "i2s";
break;
case SND_SOC_DAIFMT_RIGHT_J:
str = "right_j";
break;
case SND_SOC_DAIFMT_LEFT_J:
str = "left_j";
break;
case SND_SOC_DAIFMT_DSP_A:
str = "dsp_a";
break;
case SND_SOC_DAIFMT_DSP_B:
str = "dsp_b";
break;
case SND_SOC_DAIFMT_AC97:
str = "ac97";
break;
case SND_SOC_DAIFMT_PDM:
str = "pdm";
break;
}
dev_info(dai->dev, "format : %s", str);
if (clock == SND_SOC_DAIFMT_CONT)
str = "continuous";
else
str = "gated";
dev_info(dai->dev, "clock : %s", str);
str = "unknown";
Annotation
- Immediate include surface: `linux/slab.h`, `linux/of.h`, `linux/of_graph.h`, `linux/module.h`, `linux/workqueue.h`, `sound/pcm.h`, `sound/soc.h`.
- Detected declarations: `struct test_dai_name`, `struct test_priv`, `struct test_adata`, `function test_dai_set_sysclk`, `function test_dai_set_pll`, `function test_dai_set_clkdiv`, `function test_dai_set_fmt`, `function test_dai_set_tdm_slot`, `function test_dai_mute_stream`, `function test_dai_startup`.
- 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.