From 1bd0eed253a959a53962cf6d2880926a53d3f551 Mon Sep 17 00:00:00 2001 From: Vatsal Bucha Date: Fri, 14 Aug 2020 13:54:10 +0530 Subject: [PATCH] soc: swr-mstr: Fix headset detect issue due to master.num_dev not updated Headset is not detected sometimes due to master.num_dev not being updated when we call GET_ENUM_SLAVE_STATUS as get_logical address may not have been called. Also enable slave irq only when swr wokeup from clk stop and not when master is already up. This will prevent valid irq to be discarded as spurious irq. Change-Id: I00284e9340668c853d0bd604fe66801118982780 Signed-off-by: Vatsal Bucha --- soc/swr-mstr-ctrl.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/soc/swr-mstr-ctrl.c b/soc/swr-mstr-ctrl.c index 26ca18f1fcf7..a345aa82102c 100644 --- a/soc/swr-mstr-ctrl.c +++ b/soc/swr-mstr-ctrl.c @@ -2066,20 +2066,21 @@ handle_irq: case SWRM_INTERRUPT_STATUS_CLK_STOP_FINISHED: break; case SWRM_INTERRUPT_STATUS_EXT_CLK_STOP_WAKEUP: - if (swrm->state == SWR_MSTR_UP) + if (swrm->state == SWR_MSTR_UP) { dev_dbg(swrm->dev, "%s:SWR Master is already up\n", __func__); - else + } else { dev_err_ratelimited(swrm->dev, "%s: SWR wokeup during clock stop\n", __func__); - /* It might be possible the slave device gets reset - * and slave interrupt gets missed. So re-enable - * Host IRQ and process slave pending - * interrupts, if any. - */ - swrm_enable_slave_irq(swrm); + /* It might be possible the slave device gets + * reset and slave interrupt gets missed. So + * re-enable Host IRQ and process slave pending + * interrupts, if any. + */ + swrm_enable_slave_irq(swrm); + } break; default: dev_err_ratelimited(swrm->dev, @@ -2574,6 +2575,8 @@ static int swrm_probe(struct platform_device *pdev) SWRM_NUM_AUTO_ENUM_SLAVES); ret = -EINVAL; goto err_pdata_fail; + } else { + swrm->master.num_dev = swrm->num_dev; } }