drivers/soc/tegra/regulators-tegra20.c
Source file repositories/reference/linux-study-clean/drivers/soc/tegra/regulators-tegra20.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/tegra/regulators-tegra20.c- Extension
.c- Size
- 14287 bytes
- Lines
- 561
- Domain
- Driver Families
- Bucket
- drivers/soc
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/kernel.hlinux/of.hlinux/reboot.hlinux/regulator/coupler.hlinux/regulator/driver.hlinux/regulator/machine.hlinux/suspend.hsoc/tegra/fuse.hsoc/tegra/pmc.h
Detected Declarations
struct tegra_regulator_couplerfunction to_tegra_couplerfunction tegra20_core_limitfunction tegra20_core_rtc_max_spreadfunction tegra20_cpu_nominal_uVfunction tegra20_core_nominal_uVfunction tegra20_core_rtc_updatefunction tegra20_core_voltage_updatefunction tegra20_cpu_voltage_updatefunction tegra20_regulator_balance_voltagefunction tegra20_regulator_prepare_suspendfunction tegra20_regulator_suspendfunction tegra20_regulator_prepare_rebootfunction tegra20_regulator_rebootfunction tegra20_regulator_attachfunction tegra20_regulator_detachfunction tegra_regulator_coupler_init
Annotated Snippet
struct tegra_regulator_coupler {
struct regulator_coupler coupler;
struct regulator_dev *core_rdev;
struct regulator_dev *cpu_rdev;
struct regulator_dev *rtc_rdev;
struct notifier_block reboot_notifier;
struct notifier_block suspend_notifier;
int core_min_uV, cpu_min_uV;
bool sys_reboot_mode_req;
bool sys_reboot_mode;
bool sys_suspend_mode_req;
bool sys_suspend_mode;
};
static inline struct tegra_regulator_coupler *
to_tegra_coupler(struct regulator_coupler *coupler)
{
return container_of(coupler, struct tegra_regulator_coupler, coupler);
}
static int tegra20_core_limit(struct tegra_regulator_coupler *tegra,
struct regulator_dev *core_rdev)
{
int core_min_uV = 0;
int core_max_uV;
int core_cur_uV;
int err;
/*
* Tegra20 SoC has critical DVFS-capable devices that are
* permanently-active or active at a boot time, like EMC
* (DRAM controller) or Display controller for example.
*
* The voltage of a CORE SoC power domain shall not be dropped below
* a minimum level, which is determined by device's clock rate.
* This means that we can't fully allow CORE voltage scaling until
* the state of all DVFS-critical CORE devices is synced.
*/
if (tegra_pmc_core_domain_state_synced() && !tegra->sys_reboot_mode) {
pr_info_once("voltage state synced\n");
return 0;
}
if (tegra->core_min_uV > 0)
return tegra->core_min_uV;
core_cur_uV = regulator_get_voltage_rdev(core_rdev);
if (core_cur_uV < 0)
return core_cur_uV;
core_max_uV = max(core_cur_uV, 1200000);
err = regulator_check_voltage(core_rdev, &core_min_uV, &core_max_uV);
if (err)
return err;
/*
* Limit minimum CORE voltage to a value left from bootloader or,
* if it's unreasonably low value, to the most common 1.2v or to
* whatever maximum value defined via board's device-tree.
*/
tegra->core_min_uV = core_max_uV;
pr_info("core voltage initialized to %duV\n", tegra->core_min_uV);
return tegra->core_min_uV;
}
static int tegra20_core_rtc_max_spread(struct regulator_dev *core_rdev,
struct regulator_dev *rtc_rdev)
{
struct coupling_desc *c_desc = &core_rdev->coupling_desc;
struct regulator_dev *rdev;
int max_spread;
unsigned int i;
for (i = 1; i < c_desc->n_coupled; i++) {
max_spread = core_rdev->constraints->max_spread[i - 1];
rdev = c_desc->coupled_rdevs[i];
if (rdev == rtc_rdev && max_spread)
return max_spread;
}
pr_err_once("rtc-core max-spread is undefined in device-tree\n");
return 150000;
}
static int tegra20_cpu_nominal_uV(void)
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/of.h`, `linux/reboot.h`, `linux/regulator/coupler.h`, `linux/regulator/driver.h`, `linux/regulator/machine.h`, `linux/suspend.h`.
- Detected declarations: `struct tegra_regulator_coupler`, `function to_tegra_coupler`, `function tegra20_core_limit`, `function tegra20_core_rtc_max_spread`, `function tegra20_cpu_nominal_uV`, `function tegra20_core_nominal_uV`, `function tegra20_core_rtc_update`, `function tegra20_core_voltage_update`, `function tegra20_cpu_voltage_update`, `function tegra20_regulator_balance_voltage`.
- Atlas domain: Driver Families / drivers/soc.
- 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.