sound/soc/rockchip/rk3399_gru_sound.c
Source file repositories/reference/linux-study-clean/sound/soc/rockchip/rk3399_gru_sound.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/rockchip/rk3399_gru_sound.c- Extension
.c- Size
- 16152 bytes
- Lines
- 628
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/module.hlinux/platform_device.hlinux/slab.hlinux/delay.hlinux/spi/spi.hlinux/i2c.hlinux/input.hsound/core.hsound/jack.hsound/pcm.hsound/pcm_params.hsound/soc.hrockchip_i2s.h../codecs/da7219.h../codecs/rt5514.h
Detected Declarations
struct rockchip_sound_routestruct dailink_match_datafunction rockchip_sound_max98357a_hw_paramsfunction rockchip_sound_rt5514_hw_paramsfunction rockchip_sound_da7219_hw_paramsfunction rockchip_sound_cdndp_initfunction rockchip_sound_da7219_initfunction rockchip_sound_dmic_hw_paramsfunction rockchip_sound_startupfunction rockchip_sound_codec_node_matchfunction rockchip_sound_of_parse_daisfunction rockchip_sound_probe
Annotated Snippet
const struct bus_type *bus_type;
};
static const struct dailink_match_data dailink_match[] = {
[DAILINK_CDNDP] = {
.compatible = "rockchip,rk3399-cdn-dp",
},
[DAILINK_DA7219] = {
.compatible = "dlg,da7219",
},
[DAILINK_DMIC] = {
.compatible = "dmic-codec",
},
[DAILINK_MAX98357A] = {
.compatible = "maxim,max98357a",
},
[DAILINK_RT5514] = {
.compatible = "realtek,rt5514",
.bus_type = &i2c_bus_type,
},
[DAILINK_RT5514_DSP] = {
.compatible = "realtek,rt5514",
.bus_type = &spi_bus_type,
},
};
static int rockchip_sound_codec_node_match(struct device_node *np_codec)
{
struct device *dev;
int i;
for (i = 0; i < ARRAY_SIZE(dailink_match); i++) {
if (!of_device_is_compatible(np_codec,
dailink_match[i].compatible))
continue;
if (dailink_match[i].bus_type) {
dev = bus_find_device_by_of_node(dailink_match[i].bus_type,
np_codec);
if (!dev)
continue;
put_device(dev);
}
return i;
}
return -1;
}
static int rockchip_sound_of_parse_dais(struct device *dev,
struct snd_soc_card *card)
{
struct device_node *np_cpu, *np_cpu0, *np_cpu1;
struct device_node *np_codec;
struct snd_soc_dai_link *dai;
struct snd_soc_dapm_route *routes;
int i, index;
int num_routes;
card->dai_link = devm_kzalloc(dev, sizeof(rockchip_dais),
GFP_KERNEL);
if (!card->dai_link)
return -ENOMEM;
num_routes = 0;
for (i = 0; i < ARRAY_SIZE(rockchip_routes); i++)
num_routes += rockchip_routes[i].num_routes;
routes = devm_kcalloc(dev, num_routes, sizeof(*routes),
GFP_KERNEL);
if (!routes)
return -ENOMEM;
card->dapm_routes = routes;
np_cpu0 = of_parse_phandle(dev->of_node, "rockchip,cpu", 0);
np_cpu1 = of_parse_phandle(dev->of_node, "rockchip,cpu", 1);
card->num_dapm_routes = 0;
card->num_links = 0;
for (i = 0; i < ARRAY_SIZE(rockchip_dais); i++) {
np_codec = of_parse_phandle(dev->of_node,
"rockchip,codec", i);
if (!np_codec)
break;
if (!of_device_is_available(np_codec))
continue;
index = rockchip_sound_codec_node_match(np_codec);
if (index < 0)
continue;
Annotation
- Immediate include surface: `linux/module.h`, `linux/platform_device.h`, `linux/slab.h`, `linux/delay.h`, `linux/spi/spi.h`, `linux/i2c.h`, `linux/input.h`, `sound/core.h`.
- Detected declarations: `struct rockchip_sound_route`, `struct dailink_match_data`, `function rockchip_sound_max98357a_hw_params`, `function rockchip_sound_rt5514_hw_params`, `function rockchip_sound_da7219_hw_params`, `function rockchip_sound_cdndp_init`, `function rockchip_sound_da7219_init`, `function rockchip_sound_dmic_hw_params`, `function rockchip_sound_startup`, `function rockchip_sound_codec_node_match`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: pattern 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.