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

Commit 8fac2a49 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "esoc: Reorder the events in graceful shutdown case."

parents c1ca430b fd822c54
Loading
Loading
Loading
Loading
+2 −26
Original line number Diff line number Diff line
@@ -170,10 +170,7 @@ static void mdm_trigger_dbg(struct mdm_ctrl *mdm)

static int mdm_cmd_exe(enum esoc_cmd cmd, struct esoc_clink *esoc)
{
	unsigned long end_time;
	bool status_down = false;
	struct mdm_ctrl *mdm = get_esoc_clink_data(esoc);
	struct device *dev = mdm->dev;
	int ret;
	bool graceful_shutdown = false;
	u32 status, err_fatal;
@@ -214,34 +211,13 @@ static int mdm_cmd_exe(enum esoc_cmd cmd, struct esoc_clink *esoc)
				dev_err(mdm->dev,
				 "sysmon shutdown fail, ret = %d\n", ret);
				graceful_shutdown = false;
				goto force_poff;
			}
		} else {
			esoc_clink_queue_request(ESOC_REQ_SEND_SHUTDOWN, esoc);
		}
		dev_dbg(mdm->dev, "Waiting for status gpio go low\n");
		status_down = false;
		end_time = jiffies + msecs_to_jiffies(mdm->shutdown_timeout_ms);
		while (time_before(jiffies, end_time)) {
			if (gpio_get_value(MDM_GPIO(mdm, MDM2AP_STATUS))
									== 0) {
				dev_dbg(dev, "Status went low\n");
				status_down = true;
		break;
			}
			msleep(100);
		}
		if (status_down)
			dev_dbg(dev, "shutdown successful\n");
		else
			dev_err(mdm->dev, "graceful poff ipc fail\n");
force_poff:
	/* The case is a fallthrough of the previous case,
	 * where, after sending the shutdown command, we
	 * are actually turning off the modem.
	 */
	case ESOC_FORCE_PWR_OFF:
		if (!graceful_shutdown) {
		if (!graceful_shutdown && esoc->subsys.sysmon_shutdown_ret) {
			mdm_disable_irqs(mdm);
			mdm->debug = 0;
			mdm->ready = false;
+4 −1
Original line number Diff line number Diff line
@@ -190,14 +190,17 @@ static int mdm_subsys_shutdown(const struct subsys_desc *crashed_subsys,
				 * of the command engine as is.
				 */
				return 0;
			dev_dbg(&esoc_clink->dev, "Sending sysmon-shutdown\n");
			ret = clink_ops->cmd_exe(ESOC_PWR_OFF, esoc_clink);
		}
		if (ret) {
			dev_err(&esoc_clink->dev, "failed to exe power off\n");
			return ret;
		}
		mdm_drv->mode = PWR_OFF;
		esoc_client_link_power_off(esoc_clink, false);
		/* Pull the reset line low to turn off the device */
		clink_ops->cmd_exe(ESOC_FORCE_PWR_OFF, esoc_clink);
		mdm_drv->mode = PWR_OFF;
	}
	return 0;
}