drivers/devfreq/exynos-bus.c
Source file repositories/reference/linux-study-clean/drivers/devfreq/exynos-bus.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/devfreq/exynos-bus.c- Extension
.c- Size
- 12598 bytes
- Lines
- 509
- Domain
- Driver Families
- Bucket
- drivers/devfreq
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/devfreq.hlinux/devfreq-event.hlinux/device.hlinux/export.hlinux/module.hlinux/of.hlinux/pm_opp.hlinux/platform_device.hlinux/regulator/consumer.h
Detected Declarations
struct exynos_busfunction exynos_bus_get_eventfunction exynos_bus_targetfunction exynos_bus_get_dev_statusfunction exynos_bus_exitfunction exynos_bus_passive_exitfunction exynos_bus_parent_parse_offunction exynos_bus_parse_offunction exynos_bus_profile_initfunction exynos_bus_profile_init_passivefunction exynos_bus_probefunction exynos_bus_shutdownfunction exynos_bus_resumefunction exynos_bus_suspend
Annotated Snippet
struct exynos_bus {
struct device *dev;
struct platform_device *icc_pdev;
struct devfreq *devfreq;
struct devfreq_event_dev **edev;
unsigned int edev_count;
struct mutex lock;
unsigned long curr_freq;
int opp_token;
struct clk *clk;
unsigned int ratio;
};
/*
* Control the devfreq-event device to get the current state of bus
*/
#define exynos_bus_ops_edev(ops) \
static int exynos_bus_##ops(struct exynos_bus *bus) \
{ \
int i, ret; \
\
for (i = 0; i < bus->edev_count; i++) { \
if (!bus->edev[i]) \
continue; \
ret = devfreq_event_##ops(bus->edev[i]); \
if (ret < 0) \
return ret; \
} \
\
return 0; \
}
exynos_bus_ops_edev(enable_edev);
exynos_bus_ops_edev(disable_edev);
exynos_bus_ops_edev(set_event);
static int exynos_bus_get_event(struct exynos_bus *bus,
struct devfreq_event_data *edata)
{
struct devfreq_event_data event_data;
unsigned long load_count = 0, total_count = 0;
int i, ret = 0;
for (i = 0; i < bus->edev_count; i++) {
if (!bus->edev[i])
continue;
ret = devfreq_event_get_event(bus->edev[i], &event_data);
if (ret < 0)
return ret;
if (i == 0 || event_data.load_count > load_count) {
load_count = event_data.load_count;
total_count = event_data.total_count;
}
}
edata->load_count = load_count;
edata->total_count = total_count;
return ret;
}
/*
* devfreq function for both simple-ondemand and passive governor
*/
static int exynos_bus_target(struct device *dev, unsigned long *freq, u32 flags)
{
struct exynos_bus *bus = dev_get_drvdata(dev);
struct dev_pm_opp *new_opp;
int ret = 0;
/* Get correct frequency for bus. */
new_opp = devfreq_recommended_opp(dev, freq, flags);
if (IS_ERR(new_opp)) {
dev_err(dev, "failed to get recommended opp instance\n");
return PTR_ERR(new_opp);
}
dev_pm_opp_put(new_opp);
/* Change voltage and frequency according to new OPP level */
mutex_lock(&bus->lock);
ret = dev_pm_opp_set_rate(dev, *freq);
if (!ret)
bus->curr_freq = *freq;
mutex_unlock(&bus->lock);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/devfreq.h`, `linux/devfreq-event.h`, `linux/device.h`, `linux/export.h`, `linux/module.h`, `linux/of.h`, `linux/pm_opp.h`.
- Detected declarations: `struct exynos_bus`, `function exynos_bus_get_event`, `function exynos_bus_target`, `function exynos_bus_get_dev_status`, `function exynos_bus_exit`, `function exynos_bus_passive_exit`, `function exynos_bus_parent_parse_of`, `function exynos_bus_parse_of`, `function exynos_bus_profile_init`, `function exynos_bus_profile_init_passive`.
- Atlas domain: Driver Families / drivers/devfreq.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.