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

Commit 2fc1ac30 authored by Avaneesh Kumar Dwivedi's avatar Avaneesh Kumar Dwivedi
Browse files

soc: qcom: Disable Blackghost interrupts before MSM is shutdown



During system reboot, SSR signal from BG delays reboot of MSM.
Disable Blackghost interrupt to avoid this.

Change-Id: I874f033dc318b8653015bc909527411cf3645b7f
Signed-off-by: default avatarAvaneesh Kumar Dwivedi <akdwived@codeaurora.org>
parent 32750801
Loading
Loading
Loading
Loading
+27 −9
Original line number Diff line number Diff line
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2018, 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
@@ -90,10 +90,19 @@ static irqreturn_t bg_status_change(int irq, void *dev_id);
static void bg_app_shutdown_notify(const struct subsys_desc *subsys)
{
	struct pil_bg_data *bg_data = subsys_to_data(subsys);

	/* Disable irq if already BG is up */
	if (bg_data->is_ready) {
		disable_irq(bg_data->status_irq);
		disable_irq(bg_data->errfatal_irq);
		bg_data->is_ready = false;
	}
	/* Toggle AP2BG err fatal gpio here to inform apps err fatal event */
	if (gpio_is_valid(bg_data->gpios[2]))
	if (gpio_is_valid(bg_data->gpios[2])) {
		pr_debug("Sending Apps shutdown signal\n");
		gpio_set_value(bg_data->gpios[2], 1);
	}
}

/**
 * bg_app_reboot_notify() - Toggle AP2BG err fatal gpio.
@@ -106,9 +115,18 @@ static int bg_app_reboot_notify(struct notifier_block *nb,
{
	struct pil_bg_data *bg_data = container_of(nb,
					struct pil_bg_data, reboot_blk);

	/* Disable irq if already BG is up */
	if (bg_data->is_ready) {
		disable_irq(bg_data->status_irq);
		disable_irq(bg_data->errfatal_irq);
		bg_data->is_ready = false;
	}
	/* Toggle AP2BG err fatal gpio here to inform apps err fatal event */
	if (gpio_is_valid(bg_data->gpios[2]))
	if (gpio_is_valid(bg_data->gpios[2])) {
		pr_debug("Sending reboot signal\n");
		gpio_set_value(bg_data->gpios[2], 1);
	}
	return NOTIFY_DONE;
}

@@ -266,7 +284,6 @@ static int bg_powerup(const struct subsys_desc *subsys)
		return ret;
	}
	enable_irq(bg_data->status_irq);
	enable_irq(bg_data->errfatal_irq);
	ret = wait_for_err_ready(bg_data);
	if (ret) {
		dev_err(bg_data->desc.dev,
@@ -289,10 +306,12 @@ static int bg_shutdown(const struct subsys_desc *subsys, bool force_stop)
{
	struct pil_bg_data *bg_data = subsys_to_data(subsys);

	if (bg_data->is_ready) {
		disable_irq(bg_data->status_irq);
		devm_free_irq(bg_data->desc.dev, bg_data->status_irq, bg_data);
		disable_irq(bg_data->errfatal_irq);
		bg_data->is_ready = false;
	}
	return 0;
}

@@ -581,7 +600,6 @@ static int setup_bg_gpio_irq(struct platform_device *pdev,
		goto err;
	}
	drvdata->errfatal_irq = irq;
	enable_irq(drvdata->errfatal_irq);
	/* Configure outgoing GPIO's */
	if (gpio_request(drvdata->gpios[2], "AP2BG_ERRFATAL")) {
		dev_err(&pdev->dev,