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

Commit df38c3eb authored by Vatsal Bucha's avatar Vatsal Bucha
Browse files

soc: swr: Add wakeup source for swr device



Voice call over headset does not disconnect on button press
while device is in suspend state. This is because inband interrupt
is not made wakeup capable. Make inband interrupt for swr tx as
wakeup capable. Also add wakeup source for swr device.

Change-Id: I5f2751672675bc8d62c4d2bfbbd651e640723d52
Signed-off-by: default avatarVatsal Bucha <vbucha@codeaurora.org>
parent b1a49c6b
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -2055,6 +2055,7 @@ static int swrm_probe(struct platform_device *pdev)
	swrm->slave_status = 0;
	swrm->num_rx_chs = 0;
	swrm->clk_ref_count = 0;
	swrm->swr_irq_wakeup_capable = 0;
	swrm->mclk_freq = MCLK_FREQ;
	swrm->dev_up = true;
	swrm->state = SWR_MSTR_UP;
@@ -2107,7 +2108,15 @@ static int swrm_probe(struct platform_device *pdev)
		}

	}

	/* Make inband tx interrupts as wakeup capable for slave irq */
	ret = of_property_read_u32(pdev->dev.of_node,
				   "qcom,swr-mstr-irq-wakeup-capable",
				   &swrm->swr_irq_wakeup_capable);
	if (ret)
		dev_dbg(swrm->dev, "%s: swrm irq wakeup capable not defined\n",
			__func__);
	if (swrm->swr_irq_wakeup_capable)
		irq_set_irq_wake(swrm->irq, 1);
	ret = swr_register_master(&swrm->master);
	if (ret) {
		dev_err(&pdev->dev, "%s: error adding swr master\n", __func__);
@@ -2152,6 +2161,13 @@ static int swrm_probe(struct platform_device *pdev)
				   (void *) "swrm_reg_dump",
				   &swrm_debug_ops);
	}

	ret = device_init_wakeup(swrm->dev, true);
	if (ret) {
		dev_err(swrm->dev, "Device wakeup init failed: %d\n", ret);
		goto err_irq_wakeup_fail;
	}

	pm_runtime_set_autosuspend_delay(&pdev->dev, auto_suspend_timer);
	pm_runtime_use_autosuspend(&pdev->dev);
	pm_runtime_set_active(&pdev->dev);
@@ -2163,6 +2179,8 @@ static int swrm_probe(struct platform_device *pdev)
	msm_aud_evt_register_client(&swrm->event_notifier);

	return 0;
err_irq_wakeup_fail:
	device_init_wakeup(swrm->dev, false);
err_mstr_fail:
	if (swrm->reg_irq)
		swrm->reg_irq(swrm->handle, swr_mstr_interrupt,
@@ -2194,11 +2212,14 @@ static int swrm_remove(struct platform_device *pdev)
		free_irq(swrm->irq, swrm);
	else if (swrm->wake_irq > 0)
		free_irq(swrm->wake_irq, swrm);
	if (swrm->swr_irq_wakeup_capable)
		irq_set_irq_wake(swrm->irq, 0);
	cancel_work_sync(&swrm->wakeup_work);
	pm_runtime_disable(&pdev->dev);
	pm_runtime_set_suspended(&pdev->dev);
	swr_unregister_master(&swrm->master);
	msm_aud_evt_unregister_client(&swrm->event_notifier);
	device_init_wakeup(swrm->dev, false);
	mutex_destroy(&swrm->mlock);
	mutex_destroy(&swrm->reslock);
	mutex_destroy(&swrm->iolock);
+2 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
 */

#ifndef _SWR_WCD_CTRL_H
@@ -155,6 +155,7 @@ struct swr_mstr_ctrl {
	u32 intr_mask;
	struct port_params **port_param;
	u8 num_usecase;
	u32 swr_irq_wakeup_capable;
};

#endif /* _SWR_WCD_CTRL_H */