drivers/interconnect/mediatek/icc-emi.c
Source file repositories/reference/linux-study-clean/drivers/interconnect/mediatek/icc-emi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/interconnect/mediatek/icc-emi.c- Extension
.c- Size
- 3681 bytes
- Lines
- 157
- Domain
- Driver Families
- Bucket
- drivers/interconnect
- 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/interconnect.hlinux/interconnect-provider.hlinux/module.hlinux/of.hlinux/of_platform.hlinux/overflow.hlinux/platform_device.hlinux/soc/mediatek/dvfsrc.hicc-emi.h
Detected Declarations
function Interfacefunction mtk_emi_icc_setfunction mtk_emi_icc_probefunction mtk_emi_icc_removeexport mtk_emi_icc_probeexport mtk_emi_icc_remove
Annotated Snippet
if (ret) {
dev_err(dev, "Cannot send peak bw request: %d\n", ret);
return ret;
}
ret = mtk_dvfsrc_send_request(dev, MTK_DVFSRC_CMD_BW, node->sum_avg);
if (ret) {
dev_err(dev, "Cannot send bw request: %d\n", ret);
return ret;
}
break;
case 2:
ret = mtk_dvfsrc_send_request(dev, MTK_DVFSRC_CMD_HRT_BW, node->sum_avg);
if (ret) {
dev_err(dev, "Cannot send HRT bw request: %d\n", ret);
return ret;
}
break;
default:
dev_err(src->provider->dev, "Unknown endpoint %u\n", node->ep);
return -EINVAL;
}
return 0;
}
int mtk_emi_icc_probe(struct platform_device *pdev)
{
const struct mtk_icc_desc *desc;
struct device *dev = &pdev->dev;
struct icc_node *node;
struct icc_onecell_data *data;
struct icc_provider *provider;
struct mtk_icc_node **mnodes;
int i, j, ret;
desc = of_device_get_match_data(dev);
if (!desc)
return -EINVAL;
mnodes = desc->nodes;
provider = devm_kzalloc(dev, sizeof(*provider), GFP_KERNEL);
if (!provider)
return -ENOMEM;
data = devm_kzalloc(dev, struct_size(data, nodes, desc->num_nodes), GFP_KERNEL);
if (!data)
return -ENOMEM;
provider->dev = dev;
provider->set = mtk_emi_icc_set;
provider->aggregate = mtk_emi_icc_aggregate;
provider->xlate = of_icc_xlate_onecell;
INIT_LIST_HEAD(&provider->nodes);
provider->data = data;
for (i = 0; i < desc->num_nodes; i++) {
if (!mnodes[i])
continue;
node = icc_node_create(mnodes[i]->id);
if (IS_ERR(node)) {
ret = PTR_ERR(node);
goto err;
}
node->name = mnodes[i]->name;
node->data = mnodes[i];
icc_node_add(node, provider);
for (j = 0; j < mnodes[i]->num_links; j++)
icc_link_create(node, mnodes[i]->links[j]);
data->nodes[i] = node;
}
data->num_nodes = desc->num_nodes;
ret = icc_provider_register(provider);
if (ret)
goto err;
platform_set_drvdata(pdev, provider);
return 0;
err:
icc_nodes_remove(provider);
return ret;
}
EXPORT_SYMBOL_GPL(mtk_emi_icc_probe);
Annotation
- Immediate include surface: `linux/interconnect.h`, `linux/interconnect-provider.h`, `linux/module.h`, `linux/of.h`, `linux/of_platform.h`, `linux/overflow.h`, `linux/platform_device.h`, `linux/soc/mediatek/dvfsrc.h`.
- Detected declarations: `function Interface`, `function mtk_emi_icc_set`, `function mtk_emi_icc_probe`, `function mtk_emi_icc_remove`, `export mtk_emi_icc_probe`, `export mtk_emi_icc_remove`.
- Atlas domain: Driver Families / drivers/interconnect.
- 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.