Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 140d1d7c authored by qiuchangping's avatar qiuchangping Committed by Harshit Agarwal
Browse files

Synchronize codes for Oneplus Nord OxygenOS 10.5.7

changed for smp2p notify more eariler

Change-Id: Ic489326764c725c176b0cdb62cccf665917c1406
parent 73e3f1b0
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@

#define PROC_AWAKE_ID 12 /* 12th bit */
#define AWAKE_BIT BIT(PROC_AWAKE_ID)
static struct qcom_smem_state *state;
struct qcom_smem_state *qstate;
static struct wakeup_source notify_ws;

/**
@@ -31,11 +31,11 @@ static int sleepstate_pm_notifier(struct notifier_block *nb,
{
	switch (event) {
	case PM_SUSPEND_PREPARE:
		qcom_smem_state_update_bits(state, AWAKE_BIT, 0);
		//qcom_smem_state_update_bits(state, AWAKE_BIT, 0);
		break;

	case PM_POST_SUSPEND:
		qcom_smem_state_update_bits(state, AWAKE_BIT, AWAKE_BIT);
		//qcom_smem_state_update_bits(state, AWAKE_BIT, AWAKE_BIT);
		break;
	}

@@ -60,10 +60,10 @@ static int smp2p_sleepstate_probe(struct platform_device *pdev)
	struct device *dev = &pdev->dev;
	struct device_node *node = dev->of_node;

	state = qcom_smem_state_get(&pdev->dev, 0, &ret);
	if (IS_ERR(state))
		return PTR_ERR(state);
	qcom_smem_state_update_bits(state, AWAKE_BIT, AWAKE_BIT);
	qstate = qcom_smem_state_get(&pdev->dev, 0, &ret);
	if (IS_ERR(qstate))
		return PTR_ERR(qstate);
	qcom_smem_state_update_bits(qstate, AWAKE_BIT, AWAKE_BIT);

	ret = register_pm_notifier(&sleepstate_pm_nb);
	if (ret) {
+13 −0
Original line number Diff line number Diff line
@@ -36,6 +36,12 @@

#include "power.h"

#include <linux/gpio.h>
#include <linux/soc/qcom/smem_state.h>
extern struct qcom_smem_state *qstate;
#define PROC_AWAKE_ID 12 /* 12th bit */
#define AWAKE_BIT BIT(PROC_AWAKE_ID)

const char * const pm_labels[] = {
	[PM_SUSPEND_TO_IDLE] = "freeze",
	[PM_SUSPEND_STANDBY] = "standby",
@@ -630,8 +636,15 @@ int pm_suspend(suspend_state_t state)
	if (state <= PM_SUSPEND_ON || state >= PM_SUSPEND_MAX)
		return -EINVAL;

	qcom_smem_state_update_bits(qstate, AWAKE_BIT, 0);
	pr_err("%s: PM_SUSPEND_PREPARE smp2p_change_state", __func__);

	pr_info("suspend entry (%s)\n", mem_sleep_labels[state]);
	error = enter_state(state);

	qcom_smem_state_update_bits(qstate, AWAKE_BIT, AWAKE_BIT);
	pr_err("%s: PM_POST_SUSPEND smp2p_change_state", __func__);

	if (error) {
		suspend_stats.fail++;
		dpm_save_failed_errno(error);