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

Commit 28aae37a authored by Hanumant Singh's avatar Hanumant Singh Committed by Matt Wagantall
Browse files

esoc: mdm-4x: Add support to send shutdown request



The shutdown request must be sent from mdm driver
to prevent a race condition between the request being
processed by the mdm followed by its reset and the
APQ disabling the monitoring the mdms status line.
If the request was sent by SSR, in some cases, the mdm
would shutdown, before APQ could disable the status
interrupt, and it would be interpreted by APQ as
an erroneous hard reset of the md.

Change-Id: I413df861ff5ef413a84fdf4778829e8af0cf8df5
Signed-off-by: default avatarHanumant Singh <hanumant@codeaurora.org>
parent b1312afc
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
 *
 * 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
@@ -336,7 +336,8 @@ static int mdm_cmd_exe(enum esoc_cmd cmd, struct esoc_clink *esoc)
	bool status_down = false;
	struct mdm_ctrl *mdm = get_esoc_clink_data(esoc);
	struct device *dev = mdm->dev;
	bool graceful_shutdown;
	int ret;
	bool graceful_shutdown = false;

	switch (cmd) {
	case ESOC_PWR_ON:
@@ -351,7 +352,13 @@ static int mdm_cmd_exe(enum esoc_cmd cmd, struct esoc_clink *esoc)
		mdm->ready = false;
		mdm->trig_cnt = 0;
		graceful_shutdown = true;

		ret = sysmon_send_shutdown(&esoc->subsys);
		if (ret) {
			dev_err(mdm->dev, "sysmon shutdown fail, ret = %d\n",
									ret);
			graceful_shutdown = false;
			goto force_poff;
		}
		dev_dbg(mdm->dev, "Waiting for status gpio go low\n");
		status_down = false;
		end_time = jiffies + msecs_to_jiffies(10000);
@@ -368,6 +375,7 @@ static int mdm_cmd_exe(enum esoc_cmd cmd, struct esoc_clink *esoc)
			dev_dbg(dev, "shutdown successful\n");
		else
			dev_err(mdm->dev, "graceful poff ipc fail\n");
force_poff:
	case ESOC_FORCE_PWR_OFF:
		if (!graceful_shutdown) {
			mdm_disable_irqs(mdm);