power: Fix compilation without QCOM_DLOAD_MODE
* Add ifdef for OP additions. Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
This commit is contained in:
parent
8779ddc899
commit
1c38c5a897
2 changed files with 19 additions and 2 deletions
|
@ -104,10 +104,12 @@ struct reset_attribute {
|
|||
module_param_call(download_mode, dload_set, param_get_int,
|
||||
&download_mode, 0644);
|
||||
|
||||
#ifdef CONFIG_QCOM_DLOAD_MODE
|
||||
int oem_get_download_mode(void)
|
||||
{
|
||||
return download_mode;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int panic_prep_restart(struct notifier_block *this,
|
||||
unsigned long event, void *ptr)
|
||||
|
@ -157,12 +159,14 @@ static void set_dload_mode(int on)
|
|||
ret = scm_set_dload_mode(on ? dload_type : 0, 0);
|
||||
if (ret)
|
||||
pr_err("Failed to set secure DLOAD mode: %d\n", ret);
|
||||
#ifdef CONFIG_QCOM_DLOAD_MODE
|
||||
if (on)
|
||||
qpnp_pon_set_restart_reason(0x00);
|
||||
else
|
||||
qpnp_pon_set_restart_reason(PON_RESTART_REASON_PANIC);
|
||||
if (!on)
|
||||
scm_disable_sdi();
|
||||
#endif
|
||||
|
||||
dload_mode_enabled = on;
|
||||
}
|
||||
|
@ -286,7 +290,9 @@ static void halt_spmi_pmic_arbiter(void)
|
|||
static void msm_restart_prepare(const char *cmd)
|
||||
{
|
||||
bool need_warm_reset = false;
|
||||
#ifdef CONFIG_QCOM_DLOAD_MODE
|
||||
bool oem_panic_record = false;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_QCOM_DLOAD_MODE
|
||||
|
||||
|
@ -310,13 +316,17 @@ static void msm_restart_prepare(const char *cmd)
|
|||
need_warm_reset = (get_dload_mode() ||
|
||||
(cmd != NULL && cmd[0] != '\0'));
|
||||
}
|
||||
#ifdef CONFIG_QCOM_DLOAD_MODE
|
||||
if (!download_mode &&
|
||||
(in_panic || restart_mode == RESTART_DLOAD)) {
|
||||
oem_panic_record = true;
|
||||
}
|
||||
qpnp_pon_set_restart_reason(0x00);
|
||||
need_warm_reset == need_warm_reset || oem_panic_record;
|
||||
#endif
|
||||
|
||||
/* Hard reset the PMIC unless memory contents must be maintained. */
|
||||
if (need_warm_reset || oem_panic_record) {
|
||||
if (need_warm_reset) {
|
||||
qpnp_pon_system_pwr_off(PON_POWER_OFF_WARM_RESET);
|
||||
} else {
|
||||
qpnp_pon_system_pwr_off(PON_POWER_OFF_HARD_RESET);
|
||||
|
@ -402,10 +412,12 @@ static void msm_restart_prepare(const char *cmd)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_QCOM_DLOAD_MODE
|
||||
if (oem_panic_record) {
|
||||
qpnp_pon_set_restart_reason(PON_RESTART_REASON_PANIC);
|
||||
__raw_writel(OEM_PANIC, restart_reason);
|
||||
}
|
||||
#endif
|
||||
flush_cache_all();
|
||||
|
||||
/*outer_flush_all is not supported by 64bit kernel*/
|
||||
|
@ -467,7 +479,9 @@ static void do_msm_poweroff(void)
|
|||
pr_notice("Powering off the SoC\n");
|
||||
|
||||
set_dload_mode(0);
|
||||
#ifdef CONFIG_QCOM_DLOAD_MODE
|
||||
qpnp_pon_set_restart_reason(0x00);
|
||||
#endif
|
||||
scm_disable_sdi();
|
||||
qpnp_pon_system_pwr_off(PON_POWER_OFF_SHUTDOWN);
|
||||
|
||||
|
|
|
@ -16,8 +16,10 @@
|
|||
#include <linux/syscalls.h>
|
||||
#include <linux/syscore_ops.h>
|
||||
#include <linux/uaccess.h>
|
||||
#ifdef CONFIG_QCOM_DLOAD_MODE
|
||||
#include <linux/delay.h>
|
||||
#include <linux/oem_force_dump.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* this indicates whether you can reboot with ctrl-alt-del: the default is yes
|
||||
|
@ -46,7 +48,6 @@ int reboot_cpu;
|
|||
enum reboot_type reboot_type = BOOT_ACPI;
|
||||
int reboot_force;
|
||||
|
||||
|
||||
/*
|
||||
* If set, this is used for preparing the system to power off.
|
||||
*/
|
||||
|
@ -224,6 +225,7 @@ void kernel_restart(char *cmd)
|
|||
else
|
||||
pr_emerg("Restarting system with command '%s'\n", cmd);
|
||||
|
||||
#ifdef CONFIG_QCOM_DLOAD_MODE
|
||||
/*if enable dump, if dm-verity device corrupted, force enter dump */
|
||||
if (oem_get_download_mode()) {
|
||||
if (((cmd != NULL && cmd[0] != '\0') &&
|
||||
|
@ -233,6 +235,7 @@ void kernel_restart(char *cmd)
|
|||
msleep(10000);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
kmsg_dump(KMSG_DUMP_RESTART);
|
||||
machine_restart(cmd);
|
||||
|
|
Loading…
Add table
Reference in a new issue