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

Commit 2d83dfa6 authored by Avaneesh Kumar Dwivedi's avatar Avaneesh Kumar Dwivedi Committed by Gerrit - the friendly Code Review server
Browse files

soc: qcom: ssr: Force shutdown of modem during adb reboot



Modem may need to do certain housekeeping during user initiated
reboot, hence invoke modem force shutdown during system reboot.

Change-Id: I1fc53b4bc32a9ef172b9e87fc41c73c990a7c6b4
Signed-off-by: default avatarAvaneesh Kumar Dwivedi <akdwived@codeaurora.org>
parent cc339a2a
Loading
Loading
Loading
Loading
+33 −2
Original line number Diff line number Diff line
/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2016, 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
@@ -33,6 +33,7 @@
#include <linux/of_gpio.h>
#include <linux/cdev.h>
#include <linux/platform_device.h>
#include <linux/reboot.h>
#include <soc/qcom/subsystem_restart.h>
#include <soc/qcom/subsystem_notif.h>
#include <soc/qcom/socinfo.h>
@@ -1766,6 +1767,32 @@ static struct notifier_block panic_nb = {
	.notifier_call  = ssr_panic_handler,
};

static int subsys_reboot(struct device *dev, void *data)
{
	struct subsys_device *subsys = to_subsys(dev);

	if (subsys->desc->err_ready_irq)
		disable_irq(subsys->desc->err_ready_irq);
	if (subsys->desc->err_fatal_irq)
		disable_irq(subsys->desc->err_fatal_irq);
	if (subsys->desc->crash_shutdown)
		subsys->desc->crash_shutdown(subsys->desc);
	return 0;
}

static int ssr_reboot_handler(struct notifier_block *this,
				unsigned long event, void *ptr)
{
	bus_for_each_dev(&subsys_bus_type, NULL, NULL, subsys_reboot);
	return NOTIFY_DONE;
}

static struct notifier_block ssr_reboot_notifier = {
	ssr_reboot_handler,
	NULL,
	0
};

static int __init subsys_restart_init(void)
{
	int ret;
@@ -1791,7 +1818,11 @@ static int __init subsys_restart_init(void)
			&panic_nb);
	if (ret)
		goto err_soc;

	ret = register_reboot_notifier(&ssr_reboot_notifier);
	if (ret) {
		pr_err("Failed to register reboot notifier\n");
		return ret;
	}
	return 0;

err_soc: