Lines Matching full:tegra
10 #define pr_fmt(fmt) "tegra voltage-coupler: " fmt
21 #include <soc/tegra/fuse.h>
22 #include <soc/tegra/pmc.h>
44 static int tegra20_core_limit(struct tegra_regulator_coupler *tegra, in tegra20_core_limit() argument
62 if (tegra_pmc_core_domain_state_synced() && !tegra->sys_reboot_mode) { in tegra20_core_limit()
67 if (tegra->core_min_uV > 0) in tegra20_core_limit()
68 return tegra->core_min_uV; in tegra20_core_limit()
85 tegra->core_min_uV = core_max_uV; in tegra20_core_limit()
87 pr_info("core voltage initialized to %duV\n", tegra->core_min_uV); in tegra20_core_limit()
89 return tegra->core_min_uV; in tegra20_core_limit()
135 static int tegra20_core_rtc_update(struct tegra_regulator_coupler *tegra, in tegra20_core_rtc_update() argument
161 core_min_uV = tegra20_core_limit(tegra, core_rdev); in tegra20_core_rtc_update()
175 if (tegra->sys_suspend_mode) in tegra20_core_rtc_update()
254 static int tegra20_core_voltage_update(struct tegra_regulator_coupler *tegra, in tegra20_core_voltage_update() argument
265 return tegra20_core_rtc_update(tegra, core_rdev, rtc_rdev, in tegra20_core_voltage_update()
269 static int tegra20_cpu_voltage_update(struct tegra_regulator_coupler *tegra, in tegra20_cpu_voltage_update() argument
299 if (!tegra->cpu_min_uV) in tegra20_cpu_voltage_update()
300 tegra->cpu_min_uV = cpu_uV; in tegra20_cpu_voltage_update()
311 if (tegra->sys_reboot_mode) in tegra20_cpu_voltage_update()
312 cpu_min_uV = max(cpu_min_uV, tegra->cpu_min_uV); in tegra20_cpu_voltage_update()
315 if (tegra->sys_suspend_mode) in tegra20_cpu_voltage_update()
320 err = tegra20_core_rtc_update(tegra, core_rdev, rtc_rdev, in tegra20_cpu_voltage_update()
335 err = tegra20_core_rtc_update(tegra, core_rdev, rtc_rdev, in tegra20_cpu_voltage_update()
348 struct tegra_regulator_coupler *tegra = to_tegra_coupler(coupler); in tegra20_regulator_balance_voltage() local
349 struct regulator_dev *core_rdev = tegra->core_rdev; in tegra20_regulator_balance_voltage()
350 struct regulator_dev *cpu_rdev = tegra->cpu_rdev; in tegra20_regulator_balance_voltage()
351 struct regulator_dev *rtc_rdev = tegra->rtc_rdev; in tegra20_regulator_balance_voltage()
359 tegra->sys_reboot_mode = READ_ONCE(tegra->sys_reboot_mode_req); in tegra20_regulator_balance_voltage()
360 tegra->sys_suspend_mode = READ_ONCE(tegra->sys_suspend_mode_req); in tegra20_regulator_balance_voltage()
363 return tegra20_cpu_voltage_update(tegra, cpu_rdev, in tegra20_regulator_balance_voltage()
367 return tegra20_core_voltage_update(tegra, cpu_rdev, in tegra20_regulator_balance_voltage()
375 static int tegra20_regulator_prepare_suspend(struct tegra_regulator_coupler *tegra, in tegra20_regulator_prepare_suspend() argument
380 if (!tegra->core_rdev || !tegra->rtc_rdev || !tegra->cpu_rdev) in tegra20_regulator_prepare_suspend()
390 WRITE_ONCE(tegra->sys_suspend_mode_req, sys_suspend_mode); in tegra20_regulator_prepare_suspend()
392 err = regulator_sync_voltage_rdev(tegra->cpu_rdev); in tegra20_regulator_prepare_suspend()
396 err = regulator_sync_voltage_rdev(tegra->core_rdev); in tegra20_regulator_prepare_suspend()
406 struct tegra_regulator_coupler *tegra; in tegra20_regulator_suspend() local
409 tegra = container_of(notifier, struct tegra_regulator_coupler, in tegra20_regulator_suspend()
416 ret = tegra20_regulator_prepare_suspend(tegra, true); in tegra20_regulator_suspend()
422 ret = tegra20_regulator_prepare_suspend(tegra, false); in tegra20_regulator_suspend()
432 static int tegra20_regulator_prepare_reboot(struct tegra_regulator_coupler *tegra, in tegra20_regulator_prepare_reboot() argument
437 if (!tegra->core_rdev || !tegra->rtc_rdev || !tegra->cpu_rdev) in tegra20_regulator_prepare_reboot()
440 WRITE_ONCE(tegra->sys_reboot_mode_req, true); in tegra20_regulator_prepare_reboot()
447 err = regulator_sync_voltage_rdev(tegra->cpu_rdev); in tegra20_regulator_prepare_reboot()
451 err = regulator_sync_voltage_rdev(tegra->core_rdev); in tegra20_regulator_prepare_reboot()
455 WRITE_ONCE(tegra->sys_reboot_mode_req, sys_reboot_mode); in tegra20_regulator_prepare_reboot()
463 struct tegra_regulator_coupler *tegra; in tegra20_regulator_reboot() local
469 tegra = container_of(notifier, struct tegra_regulator_coupler, in tegra20_regulator_reboot()
472 ret = tegra20_regulator_prepare_reboot(tegra, true); in tegra20_regulator_reboot()
480 struct tegra_regulator_coupler *tegra = to_tegra_coupler(coupler); in tegra20_regulator_attach() local
483 if (of_property_read_bool(np, "nvidia,tegra-core-regulator") && in tegra20_regulator_attach()
484 !tegra->core_rdev) { in tegra20_regulator_attach()
485 tegra->core_rdev = rdev; in tegra20_regulator_attach()
489 if (of_property_read_bool(np, "nvidia,tegra-rtc-regulator") && in tegra20_regulator_attach()
490 !tegra->rtc_rdev) { in tegra20_regulator_attach()
491 tegra->rtc_rdev = rdev; in tegra20_regulator_attach()
495 if (of_property_read_bool(np, "nvidia,tegra-cpu-regulator") && in tegra20_regulator_attach()
496 !tegra->cpu_rdev) { in tegra20_regulator_attach()
497 tegra->cpu_rdev = rdev; in tegra20_regulator_attach()
507 struct tegra_regulator_coupler *tegra = to_tegra_coupler(coupler); in tegra20_regulator_detach() local
517 if (tegra->core_rdev == rdev) { in tegra20_regulator_detach()
518 tegra->core_rdev = NULL; in tegra20_regulator_detach()
522 if (tegra->rtc_rdev == rdev) { in tegra20_regulator_detach()
523 tegra->rtc_rdev = NULL; in tegra20_regulator_detach()
527 if (tegra->cpu_rdev == rdev) { in tegra20_regulator_detach()
528 tegra->cpu_rdev = NULL; in tegra20_regulator_detach()