soc: swr-mstr: Fix headset detect issue during clk stop wakeup

When ext clk stop wakeup and slave_pending_irq come together
then interrupt at swrslave is cleared due to calling
enable_slave_irq. Do not clear interrupts for enable_slave_irq
when its called from clk stop wakeup.

Change-Id: Ia710030ab80306d6750bea7264f0d4c07053d701
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
This commit is contained in:
Vatsal Bucha 2020-12-30 19:05:37 +05:30 committed by Shashi Kant Maurya
parent 74c97bf056
commit 673d4a9777
2 changed files with 11 additions and 4 deletions

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/irq.h>
@ -1944,10 +1944,12 @@ static void swrm_enable_slave_irq(struct swr_mstr_ctrl *swrm)
dev_dbg(swrm->dev, "%s: slave status: 0x%x\n", __func__, status);
for (i = 0; i < (swrm->master.num_dev + 1); i++) {
if (status & SWRM_MCP_SLV_STATUS_MASK) {
swrm_cmd_fifo_rd_cmd(swrm, &temp, i, 0x0,
if (!swrm->clk_stop_wakeup) {
swrm_cmd_fifo_rd_cmd(swrm, &temp, i, 0x0,
SWRS_SCP_INT_STATUS_CLEAR_1, 1);
swrm_cmd_fifo_wr_cmd(swrm, 0xFF, i, 0x0,
swrm_cmd_fifo_wr_cmd(swrm, 0xFF, i, 0x0,
SWRS_SCP_INT_STATUS_CLEAR_1);
}
swrm_cmd_fifo_wr_cmd(swrm, 0x4, i, 0x0,
SWRS_SCP_INT_STATUS_MASK_1);
}
@ -2193,7 +2195,9 @@ handle_irq:
* re-enable Host IRQ and process slave pending
* interrupts, if any.
*/
swrm->clk_stop_wakeup = true;
swrm_enable_slave_irq(swrm);
swrm->clk_stop_wakeup = false;
}
break;
default:
@ -2827,6 +2831,8 @@ static int swrm_probe(struct platform_device *pdev)
swrm->dev_up = true;
swrm->state = SWR_MSTR_UP;
swrm->ipc_wakeup = false;
swrm->enable_slave_irq = false;
swrm->clk_stop_wakeup = false;
swrm->ipc_wakeup_triggered = false;
swrm->disable_div2_clk_switch = FALSE;
init_completion(&swrm->reset);

View File

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
*/
#ifndef _SWR_WCD_CTRL_H
@ -198,6 +198,7 @@ struct swr_mstr_ctrl {
u64 phy_dev[SWRM_NUM_AUTO_ENUM_SLAVES + 1];
bool use_custom_phy_addr;
u32 is_always_on;
bool clk_stop_wakeup;
#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_swrm_dent;
struct dentry *debugfs_peek;