Browse Source

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 <[email protected]>
Vatsal Bucha 5 years ago
parent
commit
7da41c372b
1 changed files with 16 additions and 2 deletions
  1. 16 2
      soc/swr-mstr-ctrl.c

+ 16 - 2
soc/swr-mstr-ctrl.c

@@ -1682,9 +1682,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;
 	}
 }
@@ -1810,6 +1813,17 @@ handle_irq:
 				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,