drivers/usb/dwc3/dwc3-exynos.c
Source file repositories/reference/linux-study-clean/drivers/usb/dwc3/dwc3-exynos.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/dwc3/dwc3-exynos.c- Extension
.c- Size
- 6899 bytes
- Lines
- 286
- 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/module.hlinux/kernel.hlinux/slab.hlinux/platform_device.hlinux/clk.hlinux/of.hlinux/of_platform.hlinux/regulator/consumer.h
Detected Declarations
struct dwc3_exynos_driverdatastruct dwc3_exynosfunction dwc3_exynos_probefunction dwc3_exynos_removefunction dwc3_exynos_suspendfunction dwc3_exynos_resume
Annotated Snippet
struct dwc3_exynos_driverdata {
const char *clk_names[DWC3_EXYNOS_MAX_CLOCKS];
int num_clks;
int suspend_clk_idx;
};
struct dwc3_exynos {
struct device *dev;
const char **clk_names;
struct clk *clks[DWC3_EXYNOS_MAX_CLOCKS];
int num_clks;
int suspend_clk_idx;
struct regulator *vdd33;
struct regulator *vdd10;
};
static int dwc3_exynos_probe(struct platform_device *pdev)
{
struct dwc3_exynos *exynos;
struct device *dev = &pdev->dev;
struct device_node *node = dev->of_node;
const struct dwc3_exynos_driverdata *driver_data;
int i, ret;
exynos = devm_kzalloc(dev, sizeof(*exynos), GFP_KERNEL);
if (!exynos)
return -ENOMEM;
driver_data = of_device_get_match_data(dev);
exynos->dev = dev;
exynos->num_clks = driver_data->num_clks;
exynos->clk_names = (const char **)driver_data->clk_names;
exynos->suspend_clk_idx = driver_data->suspend_clk_idx;
platform_set_drvdata(pdev, exynos);
for (i = 0; i < exynos->num_clks; i++) {
exynos->clks[i] = devm_clk_get(dev, exynos->clk_names[i]);
if (IS_ERR(exynos->clks[i])) {
dev_err(dev, "failed to get clock: %s\n",
exynos->clk_names[i]);
return PTR_ERR(exynos->clks[i]);
}
}
for (i = 0; i < exynos->num_clks; i++) {
ret = clk_prepare_enable(exynos->clks[i]);
if (ret) {
while (i-- > 0)
clk_disable_unprepare(exynos->clks[i]);
return ret;
}
}
if (exynos->suspend_clk_idx >= 0)
clk_prepare_enable(exynos->clks[exynos->suspend_clk_idx]);
exynos->vdd33 = devm_regulator_get(dev, "vdd33");
if (IS_ERR(exynos->vdd33)) {
ret = PTR_ERR(exynos->vdd33);
goto vdd33_err;
}
ret = regulator_enable(exynos->vdd33);
if (ret) {
dev_err(dev, "Failed to enable VDD33 supply\n");
goto vdd33_err;
}
exynos->vdd10 = devm_regulator_get(dev, "vdd10");
if (IS_ERR(exynos->vdd10)) {
ret = PTR_ERR(exynos->vdd10);
goto vdd10_err;
}
ret = regulator_enable(exynos->vdd10);
if (ret) {
dev_err(dev, "Failed to enable VDD10 supply\n");
goto vdd10_err;
}
if (node) {
ret = of_platform_populate(node, NULL, NULL, dev);
if (ret) {
dev_err(dev, "failed to add dwc3 core\n");
goto populate_err;
}
} else {
dev_err(dev, "no device node, failed to add dwc3 core\n");
ret = -ENODEV;
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/slab.h`, `linux/platform_device.h`, `linux/clk.h`, `linux/of.h`, `linux/of_platform.h`, `linux/regulator/consumer.h`.
- Detected declarations: `struct dwc3_exynos_driverdata`, `struct dwc3_exynos`, `function dwc3_exynos_probe`, `function dwc3_exynos_remove`, `function dwc3_exynos_suspend`, `function dwc3_exynos_resume`.
- 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.