diff options
author | William McVicker <willmcvicker@google.com> | 2022-08-20 00:35:14 +0000 |
---|---|---|
committer | William McVicker <willmcvicker@google.com> | 2022-08-20 00:35:14 +0000 |
commit | e09e2920dfff28357949f640d09c9eaf296a6279 (patch) | |
tree | 2573e1f6eec156685e3d58226e04188e4d3a908b | |
parent | 666cca78301315e1f35985bbf1dc5fb6e624e943 (diff) | |
parent | 914d3aa6fd19d969d347f21232a089f379268bb2 (diff) | |
download | reset-e09e2920dfff28357949f640d09c9eaf296a6279.tar.gz |
Merge "Merge partner/android13-gs-pixel-5.10-tm-qpr1 into partner/android13-gs-pixel-5.15" into android13-gs-pixel-5.15
-rw-r--r-- | exynos-gs101-reboot.c | 49 | ||||
-rw-r--r-- | exynos-gs201-reboot.c | 56 |
2 files changed, 62 insertions, 43 deletions
diff --git a/exynos-gs101-reboot.c b/exynos-gs101-reboot.c index 95ac0e6..70d5c70 100644 --- a/exynos-gs101-reboot.c +++ b/exynos-gs101-reboot.c @@ -39,6 +39,7 @@ static u32 reboot_cmd_offset; static u32 shutdown_offset, shutdown_trigger; static phys_addr_t pmu_alive_base; static bool rsbm_supported; +static bool force_warm_reboot_on_thermal_shutdown; enum pon_reboot_mode { REBOOT_MODE_NORMAL = 0x00, @@ -108,14 +109,14 @@ static void exynos_power_off(void) static void exynos_reboot_mode_set(u32 val) { int ret; - u32 reboot_mode; + u32 mode; phys_addr_t reboot_cmd_addr = pmu_alive_base + reboot_cmd_offset; set_priv_reg(reboot_cmd_addr, val); if (s2mpg10_get_rev_id() > S2MPG10_EVT0 && rsbm_supported) { - reboot_mode = val | BMS_RSBM_VALID; - ret = gbms_storage_write(GBMS_TAG_RSBM, &reboot_mode, sizeof(reboot_mode)); + mode = val | BMS_RSBM_VALID; + ret = gbms_storage_write(GBMS_TAG_RSBM, &mode, sizeof(mode)); if (ret < 0) pr_err("%s(): failed to write gbms storage: %d(%d)\n", __func__, GBMS_TAG_RSBM, ret); @@ -126,34 +127,43 @@ static void exynos_reboot_parse(const char *cmd) { if (cmd) { u32 value = U32_MAX; + bool force_warm_reboot = false; pr_info("Reboot command: '%s'\n", cmd); - if (!strcmp(cmd, "charge")) + if (!strcmp(cmd, "charge")) { value = REBOOT_MODE_CHARGE; - else if (!strcmp(cmd, "bootloader")) + } else if (!strcmp(cmd, "bootloader")) { value = REBOOT_MODE_BOOTLOADER; - else if (!strcmp(cmd, "fastboot")) + } else if (!strcmp(cmd, "fastboot")) { value = REBOOT_MODE_FASTBOOT; - else if (!strcmp(cmd, "recovery")) + } else if (!strcmp(cmd, "recovery")) { value = REBOOT_MODE_RECOVERY; - else if (!strcmp(cmd, "dm-verity device corrupted")) + } else if (!strcmp(cmd, "dm-verity device corrupted")) { value = REBOOT_MODE_DMVERITY_CORRUPTED; - else if (!strcmp(cmd, "rescue")) + } else if (!strcmp(cmd, "rescue")) { value = REBOOT_MODE_RESCUE; - else if (!strcmp(cmd, "shutdown-thermal")) + } else if (!strcmp(cmd, "shutdown-thermal") || + !strcmp(cmd, "shutdown,thermal")) { + if (force_warm_reboot_on_thermal_shutdown) + force_warm_reboot = true; value = REBOOT_MODE_SHUTDOWN_THERMAL; - else if (!strcmp(cmd, "reboot-ab-update")) + } else if (!strcmp(cmd, "reboot-ab-update")) { value = REBOOT_MODE_AB_UPDATE; - else if (!strcmp(cmd, "from_fastboot") || - !strcmp(cmd, "shell") || - !strcmp(cmd, "userrequested") || - !strcmp(cmd, "userrequested,fastboot") || - !strcmp(cmd, "userrequested,recovery") || - !strcmp(cmd, "userrequested,recovery,ui")) + } else if (!strcmp(cmd, "from_fastboot") || + !strcmp(cmd, "shell") || + !strcmp(cmd, "userrequested") || + !strcmp(cmd, "userrequested,fastboot") || + !strcmp(cmd, "userrequested,recovery") || + !strcmp(cmd, "userrequested,recovery,ui")) { value = REBOOT_MODE_NORMAL; - else + } else { pr_err("Unknown reboot command: '%s'\n", cmd); + } + + /* check for warm_reboot */ + if (force_warm_reboot) + reboot_mode = REBOOT_WARM; if (value != U32_MAX) exynos_reboot_mode_set(value); @@ -266,6 +276,9 @@ static int exynos_reboot_probe(struct platform_device *pdev) reboot_cmd_offset = EXYNOS_PMU_SYSIP_DAT0; } + force_warm_reboot_on_thermal_shutdown = of_property_read_bool(np, + "force-warm-reboot-on-thermal-shutdown"); + err = register_reboot_notifier(&exynos_reboot_nb); if (err) { dev_err(dev, "cannot register reboot handler (err=%d)\n", err); diff --git a/exynos-gs201-reboot.c b/exynos-gs201-reboot.c index a8aa509..96fa1d7 100644 --- a/exynos-gs201-reboot.c +++ b/exynos-gs201-reboot.c @@ -18,9 +18,6 @@ #include <linux/mfd/samsung/s2mpg12.h> #include <linux/platform_device.h> #include <linux/reboot.h> -#if IS_ENABLED(CONFIG_GS_ACPM) -#include <soc/google/acpm_ipc_ctrl.h> -#endif #include <soc/google/exynos-el3_mon.h> #include "../../bms/google_bms.h" @@ -30,6 +27,7 @@ static u32 reboot_cmd_offset; static phys_addr_t pmu_alive_base; +static bool force_warm_reboot_on_thermal_shutdown; enum pon_reboot_mode { REBOOT_MODE_NORMAL = 0x00, @@ -50,7 +48,7 @@ static void exynos_reboot_mode_set(u32 val) { int ret; phys_addr_t reboot_cmd_addr = pmu_alive_base + reboot_cmd_offset; - u32 reboot_mode; + u32 mode; ret = set_priv_reg(reboot_cmd_addr, val); if (ret) { @@ -58,8 +56,8 @@ static void exynos_reboot_mode_set(u32 val) __func__, &reboot_cmd_addr); } - reboot_mode = val | BMS_RSBM_VALID; - ret = gbms_storage_write(GBMS_TAG_RSBM, &reboot_mode, sizeof(reboot_mode)); + mode = val | BMS_RSBM_VALID; + ret = gbms_storage_write(GBMS_TAG_RSBM, &mode, sizeof(mode)); if (ret < 0) pr_err("%s(): failed to write gbms storage: %d(%d)\n", __func__, GBMS_TAG_RSBM, ret); @@ -69,34 +67,43 @@ static void exynos_reboot_parse(const char *cmd) { if (cmd) { u32 value = U32_MAX; + bool force_warm_reboot = false; pr_info("Reboot command: '%s'\n", cmd); - if (!strcmp(cmd, "charge")) + if (!strcmp(cmd, "charge")) { value = REBOOT_MODE_CHARGE; - else if (!strcmp(cmd, "bootloader")) + } else if (!strcmp(cmd, "bootloader")) { value = REBOOT_MODE_BOOTLOADER; - else if (!strcmp(cmd, "fastboot")) + } else if (!strcmp(cmd, "fastboot")) { value = REBOOT_MODE_FASTBOOT; - else if (!strcmp(cmd, "recovery")) + } else if (!strcmp(cmd, "recovery")) { value = REBOOT_MODE_RECOVERY; - else if (!strcmp(cmd, "dm-verity device corrupted")) + } else if (!strcmp(cmd, "dm-verity device corrupted")) { value = REBOOT_MODE_DMVERITY_CORRUPTED; - else if (!strcmp(cmd, "rescue")) + } else if (!strcmp(cmd, "rescue")) { value = REBOOT_MODE_RESCUE; - else if (!strcmp(cmd, "shutdown-thermal")) + } else if (!strcmp(cmd, "shutdown-thermal") || + !strcmp(cmd, "shutdown,thermal")) { + if (force_warm_reboot_on_thermal_shutdown) + force_warm_reboot = true; value = REBOOT_MODE_SHUTDOWN_THERMAL; - else if (!strcmp(cmd, "reboot-ab-update")) + } else if (!strcmp(cmd, "reboot-ab-update")) { value = REBOOT_MODE_AB_UPDATE; - else if (!strcmp(cmd, "from_fastboot") || - !strcmp(cmd, "shell") || - !strcmp(cmd, "userrequested") || - !strcmp(cmd, "userrequested,fastboot") || - !strcmp(cmd, "userrequested,recovery") || - !strcmp(cmd, "userrequested,recovery,ui")) + } else if (!strcmp(cmd, "from_fastboot") || + !strcmp(cmd, "shell") || + !strcmp(cmd, "userrequested") || + !strcmp(cmd, "userrequested,fastboot") || + !strcmp(cmd, "userrequested,recovery") || + !strcmp(cmd, "userrequested,recovery,ui")) { value = REBOOT_MODE_NORMAL; - else + } else { pr_err("Unknown reboot command: '%s'\n", cmd); + } + + /* check for warm_reboot */ + if (force_warm_reboot) + reboot_mode = REBOOT_WARM; if (value != U32_MAX) exynos_reboot_mode_set(value); @@ -138,10 +145,6 @@ static struct notifier_block exynos_reboot_nb = { static int exynos_restart_handler(struct notifier_block *this, unsigned long mode, void *cmd) { -#if IS_ENABLED(CONFIG_GS_ACPM) - acpm_prepare_reboot(); -#endif - pr_info("ready to do restart.\n"); return NOTIFY_DONE; @@ -185,6 +188,9 @@ static int exynos_reboot_probe(struct platform_device *pdev) reboot_cmd_offset = EXYNOS_PMU_SYSIP_DAT0; } + force_warm_reboot_on_thermal_shutdown = of_property_read_bool(np, + "force-warm-reboot-on-thermal-shutdown"); + err = register_reboot_notifier(&exynos_reboot_nb); if (err) { dev_err(dev, "cannot register reboot handler (err=%d)\n", err); |