summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordianlujitao <dianlujitao@lineageos.org>2018-09-22 20:45:05 +0800
committerMichael Bestas <mkbestas@lineageos.org>2020-05-01 18:21:40 +0300
commit4f93e862d4a39b7b98647f8905e9da37c6b83d1e (patch)
treeb8b71d30e8d331dea6268bd38f8ed8b757b6a101
parentad260d987259f894347db01cd711b7da011ec4e5 (diff)
soc: qcom: sleepstate: Import Xiaomi MI changes
Change-Id: I7063375025c92a928407be797e3d95e70cde5f46
-rw-r--r--drivers/soc/qcom/smp2p_sleepstate.c7
-rw-r--r--kernel/power/suspend.c8
2 files changed, 11 insertions, 4 deletions
diff --git a/drivers/soc/qcom/smp2p_sleepstate.c b/drivers/soc/qcom/smp2p_sleepstate.c
index 2ef25e48ce50..014687fbc781 100644
--- a/drivers/soc/qcom/smp2p_sleepstate.c
+++ b/drivers/soc/qcom/smp2p_sleepstate.c
@@ -1,4 +1,5 @@
/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+ * Copyright (C) 2019 XiaoMi, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -19,8 +20,8 @@
#include "smp2p_private.h"
#define SET_DELAY (2 * HZ)
-#define PROC_AWAKE_ID 12 /* 12th bit */
-static int slst_gpio_base_id;
+int PROC_AWAKE_ID = 12; /* 12th bit */
+int slst_gpio_base_id;
/**
* sleepstate_pm_notifier() - PM notifier callback function.
@@ -36,13 +37,11 @@ static int sleepstate_pm_notifier(struct notifier_block *nb,
{
switch (event) {
case PM_SUSPEND_PREPARE:
- gpio_set_value(slst_gpio_base_id + PROC_AWAKE_ID, 0);
msleep(25); /* To be tuned based on SMP2P latencies */
msm_ipc_router_set_ws_allowed(true);
break;
case PM_POST_SUSPEND:
- gpio_set_value(slst_gpio_base_id + PROC_AWAKE_ID, 1);
msleep(25); /* To be tuned based on SMP2P latencies */
msm_ipc_router_set_ws_allowed(false);
break;
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 6e7832ee6d74..462d147bae76 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -4,6 +4,7 @@
* Copyright (c) 2003 Patrick Mochel
* Copyright (c) 2003 Open Source Development Lab
* Copyright (c) 2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc.
+ * Copyright (C) 2019 XiaoMi, Inc.
*
* This file is released under the GPLv2.
*/
@@ -32,11 +33,14 @@
#include <linux/moduleparam.h>
#include <linux/wakeup_reason.h>
+#include <linux/gpio.h>
#include "power.h"
const char *pm_labels[] = { "mem", "standby", "freeze", NULL };
const char *pm_states[PM_SUSPEND_MAX];
+extern int PROC_AWAKE_ID; /* 12th bit */
+extern int slst_gpio_base_id;
unsigned int pm_suspend_global_flags;
EXPORT_SYMBOL_GPL(pm_suspend_global_flags);
@@ -563,7 +567,11 @@ int pm_suspend(suspend_state_t state)
return -EINVAL;
pm_suspend_marker("entry");
+ gpio_set_value (slst_gpio_base_id+PROC_AWAKE_ID, 0);
+ pr_debug("%s: PM_SUSPEND_PREPARE %d \n", __func__, slst_gpio_base_id + PROC_AWAKE_ID);
error = enter_state(state);
+ gpio_set_value (slst_gpio_base_id+PROC_AWAKE_ID, 1);
+ pr_debug("%s: PM_POST_SUSPEND %d \n", __func__, slst_gpio_base_id + PROC_AWAKE_ID);
if (error) {
suspend_stats.fail++;
dpm_save_failed_errno(error);