soc: swr-mstr: Fix headset not detetcted issue on devnum 0 detached

Headset is not detected if devnum 0 gets detached at bootup.
This is because on detach being called hw will mask interrupt
at slave side but will not unmask it afterwards.
Also device 0 is used only for discovery purpose and
interrupt shouldnt be masked if it detaches.

Change-Id: I78d47243ef67ea5ee1fe3badaec94e596bc8faf3
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
This commit is contained in:
Vatsal Bucha 2020-02-28 20:36:46 +05:30 committed by Gerrit - the friendly Code Review server
parent 4e8e51f80e
commit 21ba077504

View file

@ -1636,9 +1636,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)
if (status & SWRM_MCP_SLV_STATUS_MASK) {
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);
SWRS_SCP_INT_STATUS_MASK_1);
}
status >>= 2;
}
}
@ -1943,6 +1946,17 @@ static irqreturn_t swr_mstr_interrupt_v2(int irq, void *dev)
dev_dbg(swrm->dev,
"%s: device %d got detached\n",
__func__, devnum);
if (devnum == 0) {
/*
* enable host irq if device 0 detached
* as hw will mask host_irq at slave
* but will not unmask it afterwards.
*/
swrm_cmd_fifo_wr_cmd(swrm, 0xFF, devnum, 0x0,
SWRS_SCP_INT_STATUS_CLEAR_1);
swrm_cmd_fifo_wr_cmd(swrm, 0x4, devnum, 0x0,
SWRS_SCP_INT_STATUS_MASK_1);
}
break;
case SWR_ATTACHED_OK:
dev_dbg(swrm->dev,