drivers/net/ipa/ipa_power.c
Source file repositories/reference/linux-study-clean/drivers/net/ipa/ipa_power.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ipa/ipa_power.c- Extension
.c- Size
- 7541 bytes
- Lines
- 309
- Domain
- Driver Families
- Bucket
- drivers/net
- 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/clk.hlinux/device.hlinux/interconnect.hlinux/pm.hlinux/pm_runtime.hlinux/soc/qcom/qcom_aoss.hipa.hipa_data.hipa_endpoint.hipa_interrupt.hipa_modem.hipa_power.h
Detected Declarations
struct ipa_powerfunction ipa_interconnect_initfunction ipa_interconnect_exitfunction ipa_power_enablefunction ipa_power_disablefunction ipa_runtime_suspendfunction ipa_runtime_resumefunction ipa_suspendfunction ipa_resumefunction ipa_core_clock_ratefunction ipa_power_retention_initfunction ipa_power_retention_exitfunction ipa_power_retentionfunction ipa_power_initfunction ipa_power_exit
Annotated Snippet
struct ipa_power {
struct device *dev;
struct clk *core;
struct qmp *qmp;
u32 interconnect_count;
struct icc_bulk_data interconnect[] __counted_by(interconnect_count);
};
/* Initialize interconnects required for IPA operation */
static int ipa_interconnect_init(struct ipa_power *power,
const struct ipa_interconnect_data *data)
{
struct icc_bulk_data *interconnect;
int ret;
u32 i;
/* Initialize our interconnect data array for bulk operations */
interconnect = &power->interconnect[0];
for (i = 0; i < power->interconnect_count; i++) {
/* interconnect->path is filled in by of_icc_bulk_get() */
interconnect->name = data->name;
interconnect->avg_bw = data->average_bandwidth;
interconnect->peak_bw = data->peak_bandwidth;
data++;
interconnect++;
}
ret = of_icc_bulk_get(power->dev, power->interconnect_count,
power->interconnect);
if (ret)
return ret;
/* All interconnects are initially disabled */
icc_bulk_disable(power->interconnect_count, power->interconnect);
/* Set the bandwidth values to be used when enabled */
ret = icc_bulk_set_bw(power->interconnect_count, power->interconnect);
if (ret)
icc_bulk_put(power->interconnect_count, power->interconnect);
return ret;
}
/* Inverse of ipa_interconnect_init() */
static void ipa_interconnect_exit(struct ipa_power *power)
{
icc_bulk_put(power->interconnect_count, power->interconnect);
}
/* Enable IPA power, enabling interconnects and the core clock */
static int ipa_power_enable(struct ipa *ipa)
{
struct ipa_power *power = ipa->power;
int ret;
ret = icc_bulk_enable(power->interconnect_count, power->interconnect);
if (ret)
return ret;
ret = clk_prepare_enable(power->core);
if (ret) {
dev_err(power->dev, "error %d enabling core clock\n", ret);
icc_bulk_disable(power->interconnect_count,
power->interconnect);
}
return ret;
}
/* Inverse of ipa_power_enable() */
static void ipa_power_disable(struct ipa *ipa)
{
struct ipa_power *power = ipa->power;
clk_disable_unprepare(power->core);
icc_bulk_disable(power->interconnect_count, power->interconnect);
}
static int ipa_runtime_suspend(struct device *dev)
{
struct ipa *ipa = dev_get_drvdata(dev);
/* Endpoints aren't usable until setup is complete */
if (ipa->setup_complete) {
ipa_endpoint_suspend(ipa);
gsi_suspend(&ipa->gsi);
}
ipa_power_disable(ipa);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/device.h`, `linux/interconnect.h`, `linux/pm.h`, `linux/pm_runtime.h`, `linux/soc/qcom/qcom_aoss.h`, `ipa.h`, `ipa_data.h`.
- Detected declarations: `struct ipa_power`, `function ipa_interconnect_init`, `function ipa_interconnect_exit`, `function ipa_power_enable`, `function ipa_power_disable`, `function ipa_runtime_suspend`, `function ipa_runtime_resume`, `function ipa_suspend`, `function ipa_resume`, `function ipa_core_clock_rate`.
- Atlas domain: Driver Families / drivers/net.
- 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.