sound/soc/generic/audio-graph-card2.c
Source file repositories/reference/linux-study-clean/sound/soc/generic/audio-graph-card2.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/generic/audio-graph-card2.c- Extension
.c- Size
- 36589 bytes
- Lines
- 1425
- Domain
- Driver Families
- Bucket
- sound/soc
- 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.
- 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/clk.hlinux/device.hlinux/gpio/consumer.hlinux/module.hlinux/of.hlinux/of_graph.hlinux/platform_device.hlinux/string.hsound/graph_card.h
Detected Declarations
enum graph_typefunction _graph_retfunction __graph_get_typefunction graph_get_typefunction graph_lnk_is_multifunction graph_parse_convertfunction __graph_parse_nodefunction graph_parse_node_multi_nmfunction for_each_of_graph_port_endpointfunction for_each_of_graph_portfunction graph_parse_node_multifunction graph_parse_node_singlefunction graph_parse_nodefunction graph_parse_daifmtfunction graph_parse_bitframefunction graph_link_initfunction for_each_link_cpusfunction for_each_link_codecsfunction audio_graph2_link_normalfunction audio_graph2_link_dpcmfunction audio_graph2_link_c2cfunction graph_linkfunction graph_counterfunction graph_count_normalfunction graph_count_dpcmfunction graph_count_c2cfunction graph_countfunction graph_for_each_linkfunction audio_graph2_parse_offunction graph_probeexport audio_graph2_link_normalexport audio_graph2_link_dpcmexport audio_graph2_link_c2cexport audio_graph2_parse_of
Annotated Snippet
switch (type) {
case GRAPH_DPCM:
if (graph_util_is_ports0(lnk))
str = "DPCM Front-End";
else
str = "DPCM Back-End";
break;
case GRAPH_C2C:
str = "Codec2Codec";
break;
default:
break;
}
dev_dbg(dev, "%pOF (%s)", lnk, str);
}
#endif
return type;
}
static int graph_lnk_is_multi(struct device_node *lnk)
{
return __graph_get_type(lnk) == GRAPH_MULTI;
}
static struct device_node *graph_get_next_multi_ep(struct device_node **port, int idx)
{
struct device_node *ports __free(device_node) = port_to_ports(*port);
struct device_node *rep = NULL;
/*
* multi {
* ports {
* => lnk: port@0 { ... }; // to pair
* port@1 { ep { ... = rep0 } }; // Multi Element
* port@2 { ep { ... = rep1 } }; // Multi Element
* ...
* };
* };
*
* xxx {
* port@0 { rep0 };
* port@1 { rep1 };
* };
*/
/*
* Don't use of_graph_get_next_port() here
*
* In overlay case, "port" are not necessarily in order. So we need to use
* of_graph_get_port_by_id() instead
*/
of_node_put(*port);
*port = of_graph_get_port_by_id(ports, idx);
if (*port) {
struct device_node *ep __free(device_node) = of_graph_get_next_port_endpoint(*port, NULL);
rep = of_graph_get_remote_endpoint(ep);
}
return rep;
}
static const struct snd_soc_ops graph_ops = {
.startup = simple_util_startup,
.shutdown = simple_util_shutdown,
.hw_params = simple_util_hw_params,
};
static void graph_parse_convert(struct device_node *ep,
struct simple_dai_props *props)
{
struct device_node *port __free(device_node) = ep_to_port(ep);
struct device_node *ports __free(device_node) = port_to_ports(port);
struct simple_util_data *adata = &props->adata;
simple_util_parse_convert(ports, NULL, adata);
simple_util_parse_convert(port, NULL, adata);
simple_util_parse_convert(ep, NULL, adata);
}
static int __graph_parse_node(struct simple_util_priv *priv,
enum graph_type gtype,
struct device_node *ep,
struct link_info *li,
int is_cpu, int idx)
{
struct device *dev = simple_priv_to_dev(priv);
struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/device.h`, `linux/gpio/consumer.h`, `linux/module.h`, `linux/of.h`, `linux/of_graph.h`, `linux/platform_device.h`, `linux/string.h`.
- Detected declarations: `enum graph_type`, `function _graph_ret`, `function __graph_get_type`, `function graph_get_type`, `function graph_lnk_is_multi`, `function graph_parse_convert`, `function __graph_parse_node`, `function graph_parse_node_multi_nm`, `function for_each_of_graph_port_endpoint`, `function for_each_of_graph_port`.
- Atlas domain: Driver Families / sound/soc.
- 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.