diff mbox series

ASoC: rt721-sdca: change interrupt mask from XU to GE

Message ID cbc81e324673467a96b70e4e219766b5@realtek.com
State Accepted
Commit b3cb7f2a3a1732a775861a2279d951e79c0e614c
Headers show
Series ASoC: rt721-sdca: change interrupt mask from XU to GE | expand

Commit Message

Jack Yu Nov. 5, 2024, 8:51 a.m. UTC
Change interrupt mask from XU to GE to fix jack detection
interrupt issue.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
---
 sound/soc/codecs/rt721-sdca-sdw.c | 13 ++++---------
 sound/soc/codecs/rt721-sdca.c     |  6 ++++--
 sound/soc/codecs/rt721-sdca.h     |  1 +
 3 files changed, 9 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/codecs/rt721-sdca-sdw.c b/sound/soc/codecs/rt721-sdca-sdw.c
index c0f8cccae3b2..c71453da088a 100644
--- a/sound/soc/codecs/rt721-sdca-sdw.c
+++ b/sound/soc/codecs/rt721-sdca-sdw.c
@@ -203,7 +203,7 @@  static int rt721_sdca_update_status(struct sdw_slave *slave,
 		 * This also could sync with the cache value as the rt721_sdca_jack_init set.
 		 */
 			sdw_write_no_pm(rt721->slave, SDW_SCP_SDCA_INTMASK1,
-				SDW_SCP_SDCA_INTMASK_SDCA_6);
+				SDW_SCP_SDCA_INTMASK_SDCA_0);
 			sdw_write_no_pm(rt721->slave, SDW_SCP_SDCA_INTMASK2,
 				SDW_SCP_SDCA_INTMASK_SDCA_8);
 		}
@@ -280,7 +280,7 @@  static int rt721_sdca_read_prop(struct sdw_slave *slave)
 	}
 
 	/* set the timeout values */
-	prop->clk_stop_timeout = 900;
+	prop->clk_stop_timeout = 1380;
 
 	/* wake-up event */
 	prop->wake_capable = 1;
@@ -337,11 +337,6 @@  static int rt721_sdca_interrupt_callback(struct sdw_slave *slave,
 				SDW_SCP_SDCA_INT_SDCA_0, SDW_SCP_SDCA_INT_SDCA_0);
 			if (ret < 0)
 				goto io_error;
-		} else if (ret & SDW_SCP_SDCA_INTMASK_SDCA_6) {
-			ret = sdw_update_no_pm(rt721->slave, SDW_SCP_SDCA_INT1,
-				SDW_SCP_SDCA_INT_SDCA_6, SDW_SCP_SDCA_INT_SDCA_6);
-			if (ret < 0)
-				goto io_error;
 		}
 		ret = sdw_read_no_pm(rt721->slave, SDW_SCP_SDCA_INT2);
 		if (ret < 0)
@@ -475,7 +470,7 @@  static int __maybe_unused rt721_sdca_dev_system_suspend(struct device *dev)
 	mutex_lock(&rt721_sdca->disable_irq_lock);
 	rt721_sdca->disable_irq = true;
 	ret1 = sdw_update_no_pm(slave, SDW_SCP_SDCA_INTMASK1,
-				SDW_SCP_SDCA_INTMASK_SDCA_0 | SDW_SCP_SDCA_INTMASK_SDCA_6, 0);
+				SDW_SCP_SDCA_INTMASK_SDCA_0, 0);
 	ret2 = sdw_update_no_pm(slave, SDW_SCP_SDCA_INTMASK2,
 				SDW_SCP_SDCA_INTMASK_SDCA_8, 0);
 	mutex_unlock(&rt721_sdca->disable_irq_lock);
@@ -502,7 +497,7 @@  static int __maybe_unused rt721_sdca_dev_resume(struct device *dev)
 	if (!slave->unattach_request) {
 		mutex_lock(&rt721->disable_irq_lock);
 		if (rt721->disable_irq == true) {
-			sdw_write_no_pm(slave, SDW_SCP_SDCA_INTMASK1, SDW_SCP_SDCA_INTMASK_SDCA_6);
+			sdw_write_no_pm(slave, SDW_SCP_SDCA_INTMASK1, SDW_SCP_SDCA_INTMASK_SDCA_0);
 			sdw_write_no_pm(slave, SDW_SCP_SDCA_INTMASK2, SDW_SCP_SDCA_INTMASK_SDCA_8);
 			rt721->disable_irq = false;
 		}
diff --git a/sound/soc/codecs/rt721-sdca.c b/sound/soc/codecs/rt721-sdca.c
index bdd160b80b64..1c9f32e405cf 100644
--- a/sound/soc/codecs/rt721-sdca.c
+++ b/sound/soc/codecs/rt721-sdca.c
@@ -39,7 +39,7 @@  static void rt721_sdca_jack_detect_handler(struct work_struct *work)
 		return;
 
 	/* SDW_SCP_SDCA_INT_SDCA_6 is used for jack detection */
-	if (rt721->scp_sdca_stat1 & SDW_SCP_SDCA_INT_SDCA_6) {
+	if (rt721->scp_sdca_stat1 & SDW_SCP_SDCA_INT_SDCA_0) {
 		rt721->jack_type = rt_sdca_headset_detect(rt721->regmap,
 							RT721_SDCA_ENT_GE49);
 		if (rt721->jack_type < 0)
@@ -286,7 +286,7 @@  static void rt721_sdca_jack_init(struct rt721_sdca_priv *rt721)
 	mutex_lock(&rt721->calibrate_mutex);
 	if (rt721->hs_jack) {
 		sdw_write_no_pm(rt721->slave, SDW_SCP_SDCA_INTMASK1,
-			SDW_SCP_SDCA_INTMASK_SDCA_0 | SDW_SCP_SDCA_INTMASK_SDCA_6);
+			SDW_SCP_SDCA_INTMASK_SDCA_0);
 		sdw_write_no_pm(rt721->slave, SDW_SCP_SDCA_INTMASK2,
 			SDW_SCP_SDCA_INTMASK_SDCA_8);
 		dev_dbg(&rt721->slave->dev, "in %s enable\n", __func__);
@@ -298,6 +298,8 @@  static void rt721_sdca_jack_init(struct rt721_sdca_priv *rt721)
 		regmap_write(rt721->regmap,
 			SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_XU0D,
 				RT721_SDCA_CTL_SELECTED_MODE, 0), 0);
+		rt_sdca_index_write(rt721->mbq_regmap, RT721_HDA_SDCA_FLOAT,
+			RT721_XU_REL_CTRL, 0x0000);
 		rt_sdca_index_update_bits(rt721->mbq_regmap, RT721_HDA_SDCA_FLOAT,
 			RT721_GE_REL_CTRL1, 0x4000, 0x4000);
 	}
diff --git a/sound/soc/codecs/rt721-sdca.h b/sound/soc/codecs/rt721-sdca.h
index e2f071909da8..0a82c107b19a 100644
--- a/sound/soc/codecs/rt721-sdca.h
+++ b/sound/soc/codecs/rt721-sdca.h
@@ -133,6 +133,7 @@  struct rt721_sdca_dmic_kctrl_priv {
 #define RT721_HDA_LEGACY_UAJ_CTL		0x02
 #define RT721_HDA_LEGACY_CTL1			0x05
 #define RT721_HDA_LEGACY_RESET_CTL		0x06
+#define RT721_XU_REL_CTRL			0x0c
 #define RT721_GE_REL_CTRL1			0x0d
 #define RT721_HDA_LEGACY_GPIO_WAKE_EN_CTL	0x0e
 #define RT721_GE_SDCA_RST_CTRL			0x10