From 0f97da9d0eab2ada4e0e237e0ecc89e56943e56c Mon Sep 17 00:00:00 2001 From: Ryan Lattrel Date: Fri, 26 Oct 2018 15:09:55 -0500 Subject: [PATCH] muc_uart: wake on wake_irq and attach Wake up the system from suspend with either the wake_irq or the attach_irq. Change-Id: Ia635fdbc24d0bcc138f7416cfa52740175ef126c Signed-off-by: Ryan Lattrel Reviewed-on: https://gerrit.mot.com/1261634 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Kenneth Kessler Submit-Approved: Jira Key --- drivers/mmi_muc_uart/muc_uart.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/mmi_muc_uart/muc_uart.c b/drivers/mmi_muc_uart/muc_uart.c index 3a11620de29d..43e6173ae84d 100644 --- a/drivers/mmi_muc_uart/muc_uart.c +++ b/drivers/mmi_muc_uart/muc_uart.c @@ -1184,6 +1184,14 @@ static void muc_uart_wake_work(struct work_struct *w) if (!booted) { if (muc_uart_send_bootmode(mm_data) >= 0); booted = true; + /* Else if there was something in the queue when + * we went to sleep start sending it + */ + } else { + cancel_delayed_work(&mm_data->write_work); + queue_delayed_work(mm_data->write_wq, + &mm_data->write_work, + msecs_to_jiffies(0)); } } } @@ -1402,6 +1410,10 @@ static int muc_uart_probe(struct platform_device *pdev) mm_data)) goto err2; + /* Let wake irq take us out of suspend */ + if (irq_set_irq_wake(mm_data->wake_irq, 1)) + MUC_ERR("Failed to set wake irq as wake source"); + mm_data->mod_attached_gpio = of_get_gpio(np, 2); if (mm_data->mod_attached_gpio >= 0) mm_data->mod_attached_irq = @@ -1433,6 +1445,10 @@ static int muc_uart_probe(struct platform_device *pdev) mm_data)) goto err2; + /* Let attach irq take us out of suspend */ + if (irq_set_irq_wake(mm_data->mod_attached_irq, 1)) + MUC_ERR("Failed to set attach irq as wake source"); + if (sysfs_create_groups(&pdev->dev.kobj, muc_uart_groups)) { dev_err(&pdev->dev, "Failed to create sysfs attributes\n"); goto err2; @@ -1492,6 +1508,9 @@ static int muc_uart_remove(struct platform_device *pdev) { struct mod_muc_data_t *mm_data = platform_get_drvdata(pdev); + irq_set_irq_wake(mm_data->wake_irq, 0); + irq_set_irq_wake(mm_data->mod_attached_irq, 0); + if (gpio_is_valid(mm_data->wake_in_gpio)) gpio_free(mm_data->wake_in_gpio);