Lines Matching refs:tegra
10 #define pr_fmt(fmt) "tegra voltage-coupler: " fmt
21 #include <soc/tegra/fuse.h>
22 #include <soc/tegra/pmc.h>
43 static int tegra30_core_limit(struct tegra_regulator_coupler *tegra,
61 if (tegra_pmc_core_domain_state_synced() && !tegra->sys_reboot_mode) {
66 if (tegra->core_min_uV > 0)
67 return tegra->core_min_uV;
84 tegra->core_min_uV = core_max_uV;
86 pr_info("core voltage initialized to %duV\n", tegra->core_min_uV);
88 return tegra->core_min_uV;
166 static int tegra30_voltage_update(struct tegra_regulator_coupler *tegra,
212 core_min_uV = tegra30_core_limit(tegra, core_rdev);
222 if (tegra->sys_suspend_mode)
251 if (!tegra->cpu_min_uV)
252 tegra->cpu_min_uV = cpu_uV;
278 if (tegra->sys_reboot_mode)
279 cpu_min_uV = max(cpu_min_uV, tegra->cpu_min_uV);
282 if (tegra->sys_suspend_mode)
345 struct tegra_regulator_coupler *tegra = to_tegra_coupler(coupler);
346 struct regulator_dev *core_rdev = tegra->core_rdev;
347 struct regulator_dev *cpu_rdev = tegra->cpu_rdev;
354 tegra->sys_reboot_mode = READ_ONCE(tegra->sys_reboot_mode_req);
355 tegra->sys_suspend_mode = READ_ONCE(tegra->sys_suspend_mode_req);
357 return tegra30_voltage_update(tegra, cpu_rdev, core_rdev);
360 static int tegra30_regulator_prepare_suspend(struct tegra_regulator_coupler *tegra,
365 if (!tegra->core_rdev || !tegra->cpu_rdev)
375 WRITE_ONCE(tegra->sys_suspend_mode_req, sys_suspend_mode);
377 err = regulator_sync_voltage_rdev(tegra->cpu_rdev);
381 err = regulator_sync_voltage_rdev(tegra->core_rdev);
391 struct tegra_regulator_coupler *tegra;
394 tegra = container_of(notifier, struct tegra_regulator_coupler,
401 ret = tegra30_regulator_prepare_suspend(tegra, true);
407 ret = tegra30_regulator_prepare_suspend(tegra, false);
417 static int tegra30_regulator_prepare_reboot(struct tegra_regulator_coupler *tegra,
422 if (!tegra->core_rdev || !tegra->cpu_rdev)
425 WRITE_ONCE(tegra->sys_reboot_mode_req, true);
432 err = regulator_sync_voltage_rdev(tegra->cpu_rdev);
436 err = regulator_sync_voltage_rdev(tegra->core_rdev);
440 WRITE_ONCE(tegra->sys_reboot_mode_req, sys_reboot_mode);
448 struct tegra_regulator_coupler *tegra;
454 tegra = container_of(notifier, struct tegra_regulator_coupler,
457 ret = tegra30_regulator_prepare_reboot(tegra, true);
465 struct tegra_regulator_coupler *tegra = to_tegra_coupler(coupler);
468 if (of_property_read_bool(np, "nvidia,tegra-core-regulator") &&
469 !tegra->core_rdev) {
470 tegra->core_rdev = rdev;
474 if (of_property_read_bool(np, "nvidia,tegra-cpu-regulator") &&
475 !tegra->cpu_rdev) {
476 tegra->cpu_rdev = rdev;
486 struct tegra_regulator_coupler *tegra = to_tegra_coupler(coupler);
496 if (tegra->core_rdev == rdev) {
497 tegra->core_rdev = NULL;
501 if (tegra->cpu_rdev == rdev) {
502 tegra->cpu_rdev = NULL;