Skip to content
Snippets Groups Projects
Commit d665ac89 authored by Jacky Cheung's avatar Jacky Cheung Committed by Devin Kim
Browse files

Prevent enablement of host wake IRQ enable when Nitrous driver goes into

supsend and rfkill is blocked.

When rfkill is blocked (off state), the Nitrous driver should not enable
the host wake IRQ in nitrous_suspend().  This could cause the system to
stay wake to try to handle a phantom IRQ.

Change-Id: Idd171454b7b28192d301d43932ffb4530cadf870
parent 9cb01ded
Branches
Tags
No related merge requests found
......@@ -176,6 +176,11 @@ void nitrous_prepare_uart_tx_locked(struct uart_port *port)
return;
}
if (bt_lpm->rfkill_blocked) {
pr_err("%s: unexpected Tx when rfkill is blocked\n", __func__);
return;
}
hrtimer_cancel(&bt_lpm->tx_lpm_timer);
nitrous_wake_device_locked(bt_lpm, true);
hrtimer_start(&bt_lpm->tx_lpm_timer, ktime_set(UART_TIMEOUT_SEC, 0),
......@@ -203,6 +208,11 @@ static irqreturn_t nitrous_host_wake_isr(int irq, void *dev)
return IRQ_HANDLED;
}
if (lpm->rfkill_blocked) {
pr_err("%s: unexpected host wake IRQ\n", __func__);
return IRQ_HANDLED;
}
host_wake = gpio_get_value(lpm->gpio_host_wake);
pr_debug("%s: host wake gpio: %d\n", __func__, host_wake);
......@@ -243,8 +253,8 @@ static int nitrous_lpm_init(struct nitrous_bt_lpm *lpm)
goto err_request_irq;
}
wake_lock_init(&lpm->dev_lock, WAKE_LOCK_SUSPEND, "bt_dev_rx_wake");
wake_lock_init(&lpm->host_lock, WAKE_LOCK_SUSPEND, "bt_host_tx_wake");
wake_lock_init(&lpm->dev_lock, WAKE_LOCK_SUSPEND, "bt_dev_tx_wake");
wake_lock_init(&lpm->host_lock, WAKE_LOCK_SUSPEND, "bt_host_rx_wake");
/* Configure wake peer callback to be called at the onset of Tx. */
msm_hs_set_wake_peer(lpm->uart_port, nitrous_prepare_uart_tx_locked);
......@@ -491,11 +501,12 @@ static int nitrous_suspend(struct device *dev)
struct platform_device *pdev = to_platform_device(dev);
struct nitrous_bt_lpm *lpm = platform_get_drvdata(pdev);
if (device_may_wakeup(&pdev->dev))
if (device_may_wakeup(&pdev->dev) && !lpm->rfkill_blocked) {
enable_irq_wake(lpm->irq_host_wake);
/* Reset flag to capture pending irq before resume */
lpm->pending_irq = false;
}
lpm->is_suspended = true;
......@@ -506,7 +517,8 @@ static int nitrous_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct nitrous_bt_lpm *lpm = platform_get_drvdata(pdev);
if (device_may_wakeup(&pdev->dev))
if (device_may_wakeup(&pdev->dev) && !lpm->rfkill_blocked) {
disable_irq_wake(lpm->irq_host_wake);
/* Handle pending host wake irq. */
......@@ -515,6 +527,7 @@ static int nitrous_resume(struct device *dev)
nitrous_wake_uart(lpm, true);
lpm->pending_irq = false;
}
}
lpm->is_suspended = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment