From patchwork Tue Nov 5 08:51:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jack Yu X-Patchwork-Id: 13862667 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 07B1FD12663 for ; Tue, 5 Nov 2024 08:52:35 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C8BDAE67; Tue, 5 Nov 2024 09:52:22 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C8BDAE67 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1730796752; bh=RKIsP5xLOoVBBR8vbDCjqNwIWzxDDK3Eqnxu5MyeH0k=; h=From:To:CC:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=cIKg62MYjBzLZyrOYU4VZrabVRXrWSCib3/YTOcP3FpkrT+HvaZTXK4syMsvtN4W3 iOcsLErwAknn4xd2GbJA1ACyTylTd/Re5R62Kai0uFiiei6bnjHE8VY8eqzYlsSDIg 3U3yRdEdMIBuYm1Kx9TBmscVDa2qfAs+Q3G4xpiQ= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 74DD0F80534; Tue, 5 Nov 2024 09:52:00 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id BD2BCF805AC; Tue, 5 Nov 2024 09:51:59 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 52389F8013D; Tue, 5 Nov 2024 09:51:47 +0100 (CET) Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id CB9B2F800BD for ; Tue, 5 Nov 2024 09:51:41 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CB9B2F800BD Authentication-Results: alsa1.perex.cz; dkim=temperror header.d=realtek.com header.i=@realtek.com header.a=rsa-sha256 header.s=dkim header.b=TPfk/X4r X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4A58pWfD5812269, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=realtek.com; s=dkim; t=1730796692; bh=RKIsP5xLOoVBBR8vbDCjqNwIWzxDDK3Eqnxu5MyeH0k=; h=Content-Type:From:To:CC:Subject:Date:Message-ID:MIME-Version; b=TPfk/X4rB1iRTmgku3P6BcQpA63FsU0Yqfo9nK5zJA625I/SZlfN2fP42kEIdH6zB l15wUZxz1ZfB4D9pTf4b4E8X8o3oE3RA00GvGY4Ol0QxFB1LtDXtv/U3We+dHdHqao rOFU7trb1m4/d8FtL+7wM5kVwW0wxJBY2wFSGecNBgpDLOHFZ+eVVoSVQ42KkHwZUA CfvUih1gJOy0l1uqwDrLX7szclyqdBAu2kJ9z3WqrGlEWr26QEqIGSPbPjBcqMb0/H IXCcaI3yjohwC0/9wTm5WOP+6rnbLanIUnBIrac4E/T6JE+8sTz+40GwvzvfA6aqaj BnQHdpYIyByRQ== Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/3.06/5.92) with ESMTPS id 4A58pWfD5812269 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 Nov 2024 16:51:32 +0800 Received: from RTEXDAG01.realtek.com.tw (172.21.6.100) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 5 Nov 2024 16:51:33 +0800 Received: from RTEXMBS01.realtek.com.tw (172.21.6.94) by RTEXDAG01.realtek.com.tw (172.21.6.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 5 Nov 2024 16:51:32 +0800 Received: from RTEXMBS01.realtek.com.tw ([fe80::147b:e1e8:e867:41c2]) by RTEXMBS01.realtek.com.tw ([fe80::147b:e1e8:e867:41c2%7]) with mapi id 15.01.2507.035; Tue, 5 Nov 2024 16:51:32 +0800 From: Jack Yu To: "broonie@kernel.org" , "lgirdwood@gmail.com" CC: "alsa-devel@alsa-project.org" , "lars@metafoo.de" , "Flove(HsinFu)" , Oder Chiou , =?big5_tw?b?U2h1bWluZyBbrVOu0bvKXQ==?= , =?big5_tw?b?RGVyZWsgW6TovHe4cV0=?= , Jack Yu Subject: [PATCH] ASoC: rt721-sdca: change interrupt mask from XU to GE Thread-Topic: [PATCH] ASoC: rt721-sdca: change interrupt mask from XU to GE Thread-Index: AdsvX+OiRtHnULedQy2yMI0nJTlb+A== Date: Tue, 5 Nov 2024 08:51:32 +0000 Message-ID: Accept-Language: zh-TW, en-US Content-Language: zh-TW X-MS-TNEF-Correlator: x-originating-ip: [172.21.6.42] MIME-Version: 1.0 Message-ID-Hash: 533I7YQYDEW2NZMF4UK2L7HIHSFM6E2Z X-Message-ID-Hash: 533I7YQYDEW2NZMF4UK2L7HIHSFM6E2Z X-MailFrom: jack.yu@realtek.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Change interrupt mask from XU to GE to fix jack detection interrupt issue. Signed-off-by: Jack Yu --- 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 --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