drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
Source file repositories/reference/linux-study-clean/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c- Extension
.c- Size
- 4033 bytes
- Lines
- 173
- Domain
- Driver Families
- Bucket
- drivers/usb
- 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/err.hlinux/interrupt.hlinux/kernel.hlinux/mod_devicetable.hlinux/module.hlinux/of.hlinux/of_graph.hlinux/platform_device.hlinux/regmap.hlinux/regulator/consumer.hlinux/slab.hlinux/usb/role.hlinux/usb/tcpm.hlinux/usb/typec_mux.hdrm/bridge/aux-bridge.hqcom_pmic_typec.hqcom_pmic_typec_pdphy.hqcom_pmic_typec_port.h
Detected Declarations
struct pmic_typec_resourcesfunction qcom_pmic_typec_initfunction qcom_pmic_typec_probefunction qcom_pmic_typec_remove
Annotated Snippet
struct pmic_typec_resources {
const struct pmic_typec_pdphy_resources *pdphy_res;
const struct pmic_typec_port_resources *port_res;
};
static int qcom_pmic_typec_init(struct tcpc_dev *tcpc)
{
return 0;
}
static int qcom_pmic_typec_probe(struct platform_device *pdev)
{
struct pmic_typec *tcpm;
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
const struct pmic_typec_resources *res;
struct regmap *regmap;
struct auxiliary_device *bridge_dev;
u32 base;
int ret;
res = of_device_get_match_data(dev);
if (!res)
return -ENODEV;
tcpm = devm_kzalloc(dev, sizeof(*tcpm), GFP_KERNEL);
if (!tcpm)
return -ENOMEM;
tcpm->dev = dev;
tcpm->tcpc.init = qcom_pmic_typec_init;
regmap = dev_get_regmap(dev->parent, NULL);
if (!regmap) {
dev_err(dev, "Failed to get regmap\n");
return -ENODEV;
}
ret = of_property_read_u32_index(np, "reg", 0, &base);
if (ret)
return ret;
ret = qcom_pmic_typec_port_probe(pdev, tcpm,
res->port_res, regmap, base);
if (ret)
return ret;
if (res->pdphy_res) {
ret = of_property_read_u32_index(np, "reg", 1, &base);
if (ret)
return ret;
ret = qcom_pmic_typec_pdphy_probe(pdev, tcpm,
res->pdphy_res, regmap, base);
if (ret)
return ret;
} else {
ret = qcom_pmic_typec_pdphy_stub_probe(pdev, tcpm);
if (ret)
return ret;
}
platform_set_drvdata(pdev, tcpm);
tcpm->tcpc.fwnode = device_get_named_child_node(tcpm->dev, "connector");
if (!tcpm->tcpc.fwnode)
return -EINVAL;
bridge_dev = devm_drm_dp_hpd_bridge_alloc(tcpm->dev, to_of_node(tcpm->tcpc.fwnode));
if (IS_ERR(bridge_dev)) {
ret = PTR_ERR(bridge_dev);
goto fwnode_remove;
}
tcpm->tcpm_port = tcpm_register_port(tcpm->dev, &tcpm->tcpc);
if (IS_ERR(tcpm->tcpm_port)) {
ret = PTR_ERR(tcpm->tcpm_port);
goto fwnode_remove;
}
ret = tcpm->port_start(tcpm, tcpm->tcpm_port);
if (ret)
goto port_unregister;
ret = tcpm->pdphy_start(tcpm, tcpm->tcpm_port);
if (ret)
goto port_stop;
ret = devm_drm_dp_hpd_bridge_add(tcpm->dev, bridge_dev);
if (ret)
Annotation
- Immediate include surface: `linux/err.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/of.h`, `linux/of_graph.h`, `linux/platform_device.h`.
- Detected declarations: `struct pmic_typec_resources`, `function qcom_pmic_typec_init`, `function qcom_pmic_typec_probe`, `function qcom_pmic_typec_remove`.
- Atlas domain: Driver Families / drivers/usb.
- 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.