power: reset: Move in_panic handling out of dload mode

* Some devices might want to use that logic
  without enabling download mode

Change-Id: Idd4a2cc8a47041740f8d4e9f43bffd84fae5830d
Signed-off-by: azrim <mirzaspc@gmail.com>
This commit is contained in:
Michael Bestas 2018-07-22 22:05:13 +03:00 committed by azrim
parent dc6603a8c8
commit 7ecf2405ae
No known key found for this signature in database
GPG Key ID: 497F8FB059B45D1C

View File

@ -68,6 +68,19 @@ static void scm_disable_sdi(void);
static int download_mode = 1;
static bool force_warm_reboot;
static int in_panic;
static int panic_prep_restart(struct notifier_block *this,
unsigned long event, void *ptr)
{
in_panic = 1;
return NOTIFY_DONE;
}
static struct notifier_block panic_blk = {
.notifier_call = panic_prep_restart,
};
#ifdef CONFIG_QCOM_DLOAD_MODE
#define EDL_MODE_PROP "qcom,msm-imem-emergency_download_mode"
#define DL_MODE_PROP "qcom,msm-imem-download_mode"
@ -75,7 +88,6 @@ static bool force_warm_reboot;
#define KASLR_OFFSET_PROP "qcom,msm-imem-kaslr_offset"
#endif
static int in_panic;
static struct kobject dload_kobj;
static int dload_type = SCM_DLOAD_FULLDUMP;
static void *dload_mode_addr;
@ -105,17 +117,6 @@ struct reset_attribute {
module_param_call(download_mode, dload_set, param_get_int,
&download_mode, 0644);
static int panic_prep_restart(struct notifier_block *this,
unsigned long event, void *ptr)
{
in_panic = 1;
return NOTIFY_DONE;
}
static struct notifier_block panic_blk = {
.notifier_call = panic_prep_restart,
};
int scm_set_dload_mode(int arg1, int arg2)
{
struct scm_desc desc = {
@ -589,11 +590,12 @@ static int msm_restart_probe(struct platform_device *pdev)
struct device_node *np;
int ret = 0;
atomic_notifier_chain_register(&panic_notifier_list, &panic_blk);
#ifdef CONFIG_QCOM_DLOAD_MODE
if (scm_is_call_available(SCM_SVC_BOOT, SCM_DLOAD_CMD) > 0)
scm_dload_supported = true;
atomic_notifier_chain_register(&panic_notifier_list, &panic_blk);
np = of_find_compatible_node(NULL, NULL, DL_MODE_PROP);
if (!np) {
pr_err("unable to find DT imem DLOAD mode node\n");