arch/arm/mach-omap2/voltage.c
Source file repositories/reference/linux-study-clean/arch/arm/mach-omap2/voltage.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/mach-omap2/voltage.c- Extension
.c- Size
- 8611 bytes
- Lines
- 340
- Domain
- Architecture Layer
- Bucket
- arch/arm
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/io.hlinux/err.hlinux/export.hlinux/debugfs.hlinux/slab.hlinux/clk.hcommon.hprm-regbits-34xx.hprm-regbits-44xx.hprm44xx.hprcm44xx.hprminst44xx.hcontrol.hvoltage.hpowerdomain.hvc.hvp.h
Detected Declarations
function voltdm_get_voltagefunction voltdm_scalefunction voltdm_resetfunction omap_voltage_get_volttablefunction omap_voltage_get_voltdatafunction omap_voltage_register_pmicfunction omap_voltage_late_initfunction list_for_each_entryfunction list_for_each_entryfunction _voltdm_registerfunction voltdm_init
Annotated Snippet
if (voltdm->volt_data[i].volt_nominal >= target_volt) {
volt = voltdm->volt_data[i].volt_nominal;
break;
}
}
if (!volt) {
pr_warn("%s: not scaling. OPP voltage for %lu, not found.\n",
__func__, target_volt);
return -EINVAL;
}
ret = voltdm->scale(voltdm, volt);
if (!ret)
voltdm->nominal_volt = volt;
return ret;
}
/**
* voltdm_reset() - Resets the voltage of a particular voltage domain
* to that of the current OPP.
* @voltdm: pointer to the voltage domain whose voltage is to be reset.
*
* This API finds out the correct voltage the voltage domain is supposed
* to be at and resets the voltage to that level. Should be used especially
* while disabling any voltage compensation modules.
*/
void voltdm_reset(struct voltagedomain *voltdm)
{
unsigned long target_volt;
if (IS_ERR_OR_NULL(voltdm)) {
pr_warn("%s: VDD specified does not exist!\n", __func__);
return;
}
target_volt = voltdm_get_voltage(voltdm);
if (!target_volt) {
pr_err("%s: unable to find current voltage for vdd_%s\n",
__func__, voltdm->name);
return;
}
voltdm_scale(voltdm, target_volt);
}
/**
* omap_voltage_get_volttable() - API to get the voltage table associated with a
* particular voltage domain.
* @voltdm: pointer to the VDD for which the voltage table is required
* @volt_data: the voltage table for the particular vdd which is to be
* populated by this API
*
* This API populates the voltage table associated with a VDD into the
* passed parameter pointer. Returns the count of distinct voltages
* supported by this vdd.
*
*/
void omap_voltage_get_volttable(struct voltagedomain *voltdm,
struct omap_volt_data **volt_data)
{
if (IS_ERR_OR_NULL(voltdm)) {
pr_warn("%s: VDD specified does not exist!\n", __func__);
return;
}
*volt_data = voltdm->volt_data;
}
/**
* omap_voltage_get_voltdata() - API to get the voltage table entry for a
* particular voltage
* @voltdm: pointer to the VDD whose voltage table has to be searched
* @volt: the voltage to be searched in the voltage table
*
* This API searches through the voltage table for the required voltage
* domain and tries to find a matching entry for the passed voltage volt.
* If a matching entry is found volt_data is populated with that entry.
* This API searches only through the non-compensated voltages int the
* voltage table.
* Returns pointer to the voltage table entry corresponding to volt on
* success. Returns -ENODATA if no voltage table exisits for the passed voltage
* domain or if there is no matching entry.
*/
struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
unsigned long volt)
{
int i;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/io.h`, `linux/err.h`, `linux/export.h`, `linux/debugfs.h`, `linux/slab.h`, `linux/clk.h`, `common.h`.
- Detected declarations: `function voltdm_get_voltage`, `function voltdm_scale`, `function voltdm_reset`, `function omap_voltage_get_volttable`, `function omap_voltage_get_voltdata`, `function omap_voltage_register_pmic`, `function omap_voltage_late_init`, `function list_for_each_entry`, `function list_for_each_entry`, `function _voltdm_register`.
- Atlas domain: Architecture Layer / arch/arm.
- 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.