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>
diff --git a/soc/swr-mstr-ctrl.c b/soc/swr-mstr-ctrl.c
index 5f6329d..3150e23 100644
--- a/soc/swr-mstr-ctrl.c
+++ b/soc/swr-mstr-ctrl.c
@@ -1636,9 +1636,12 @@
}
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 @@
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,