From patchwork Thu Mar 6 19:52:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 14005296 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 59D5EC282DE for ; Thu, 6 Mar 2025 19:56:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=XA2dfnxHcYHg30TCiKmEfVSJuNwDEcHpOWhnk5spKUk=; b=EYYDqLdlb0MdNiTKaFnsgERBdz JKECD6RJt7bAUZJdOwiK/calH5sKuS32A5d2hsLtKa9pQqvTmfEZFYWZi0hs/889KAvT28h9K1dDD 0rHhNLKCZvh7ZGQ0nLAIlQXQfcRPuc4i4K+zIkjwpt+xZw/+ckzp2NPCKwcM05RLvpbk6ARFr8uUS GdhjicWMuYHlSqcurW0UebijN3NU6l5kibWKOYVOETwtWDyqaGbVNea0qoWpkpMLHZQ2hFcsrE87U BsrbWOkW0JwMZvx1dIk6O7kDf0R4QyxXlLeAwXE/UqtDBxhstiXp5tN5kFyQXW0E5kH0eAIehAJnn iCeZ6gGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tqHKP-0000000C42w-3ujK; Thu, 06 Mar 2025 19:56:21 +0000 Received: from bali.collaboradmins.com ([148.251.105.195]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tqHHH-0000000C3c1-1DMU; Thu, 06 Mar 2025 19:53:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1741290785; bh=kqLKsRWONIOEmraC+9O8yD+AcyM64UYTSdcTa/53UAg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=iA3r5LYzxaP2yAgv5oief1N6BEqqJ6EhZdjo+YkSNPe8zEdNs4BifC1bdt8N1EH6a EAWJtBTQxcYO1oe2NBxwhelfx46ySm4NKbkKTdS2/Jd/YnikmypxOHLjmUd7bPOak/ cGm3bbkur6xk2JLEP5d5qEacWGx9xgcKlHE0/+9TgLlfxx8G3D7hVCZQ43J7QmNTun AvN1TEkV6bBoxWwzMkx3M2Z7w3b8+LrOdkJU4sISdx46kFkm8l2N5PcEI0kBmS7tmh UrpmxxDk1QL9bADW6sat5du3zi3A64BsT+LBnMidl8VvDp3KvLhLWbVuObjMT0xLw7 PDeWY+L4PyDVw== Received: from [192.168.0.47] (unknown [IPv6:2804:14c:1a9:53ee::1002]) (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) (Authenticated sender: nfraprado) by bali.collaboradmins.com (Postfix) with ESMTPSA id AAEDC17E0607; Thu, 6 Mar 2025 20:53:01 +0100 (CET) From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= Date: Thu, 06 Mar 2025 16:52:15 -0300 Subject: [PATCH v3 1/4] ASoC: dt-bindings: mediatek,mt8188-mt6359: Add mediatek,accdet MIME-Version: 1.0 Message-Id: <20250306-mt8188-accdet-v3-1-7828e835ff4b@collabora.com> References: <20250306-mt8188-accdet-v3-0-7828e835ff4b@collabora.com> In-Reply-To: <20250306-mt8188-accdet-v3-0-7828e835ff4b@collabora.com> To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Trevor Wu , Jaroslav Kysela , Takashi Iwai Cc: kernel@collabora.com, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Mailer: b4 0.14.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250306_115307_470352_46F93032 X-CRM114-Status: GOOD ( 10.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a mediatek,accdet phandle property to allow getting a reference to the MT6359 ACCDET block, which is responsible for detecting jack insertion/removal. Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Rob Herring (Arm) Signed-off-by: Nícolas F. R. A. Prado --- .../devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml b/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml index 8c77e7f68ad7b6f5b88b53cedccb291139a2eeea..76d5a437dc8f4ad1f31c21f84304bad326b0facd 100644 --- a/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml +++ b/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml @@ -40,6 +40,14 @@ properties: hardware that provides additional audio functionalities if present. The AFE will link to ADSP when the phandle is provided. + mediatek,accdet: + $ref: /schemas/types.yaml#/definitions/phandle + description: + The phandle to the MT6359 accessory detection block, which detects audio + jack insertion and removal. This property should only be present if the + accdet block is actually wired to the audio jack pins and to be used for + jack detection. + patternProperties: "^dai-link-[0-9]+$": type: object From patchwork Thu Mar 6 19:52:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 14005297 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 CDDF1C282DE for ; Thu, 6 Mar 2025 19:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mfbMC2HhA7xBMS1KzsxBLdyv9ljn14w5eWUlV3IxwTg=; b=K62FypT4RS0zwRdfDtW3JA3RGq JP9p7ZuvRSctzhHmhQkfngUITAjX4be5wMNCQUchchwk0wutdnQPO3uDFW1UWphAPt7LvTb6FXeeE xys8ytTc18OTMeIgUkZnl+dPIp5yAkn0gNyA7wdRIkDgxD9cUD/yft870E0vEaMZPhAtLtKvuQ/sO 5jDgZCnxNsREWW6vk7OeYEU4mIZYfc379EsZZje9bOzgP78khHuQkYHfq0Dwje5KVrqRllQ7/66/n 1rbiWRU1gANXWOAu/N5SiV809x738Tm5JrnuDYzh2z08/0K6VWf6WjdZGoMkUWxnug7cZUpLd9c7u 939Qntjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tqHLz-0000000C4GX-3vCH; Thu, 06 Mar 2025 19:57:59 +0000 Received: from bali.collaboradmins.com ([2a01:4f8:201:9162::2]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tqHHL-0000000C3cS-2BIf; Thu, 06 Mar 2025 19:53:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1741290789; bh=8gQkP6DepN0m7HelKsDtGxBXCqBzzbYEFfCRfOoL0DA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ThdNLfFCftGl5+VlpJzO+5pUeDX+7v2GV5+E7E/CxLH4GeG+vkDxAN7PAb9LSSP9J hs++AkY0DGrx4FHvyhUL01kwTheQuyiYYJjKdHvqpZHMKKWwdxDE3S4dmuargRwimP 3FFletfVLHEEeKuMTaijspjlsvdr0lW95B0160kHA57ZnwsHXkx1UcDNtmw1K7t27F P0DuSrwxvKHQbl2j6X98fYQbNW2/SXy6sY/BzsRLiQI02lf2EL0sEh8tRwUw3Cj3ml KMXJccAa4DmpOJwwNssfLF8Oq6K0VEoXHaI2njQyDh4Ccy9Z7eV6sFPLXB7+FVTUIf UHAgSP56hpJaA== Received: from [192.168.0.47] (unknown [IPv6:2804:14c:1a9:53ee::1002]) (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) (Authenticated sender: nfraprado) by bali.collaboradmins.com (Postfix) with ESMTPSA id 1989017E05F7; Thu, 6 Mar 2025 20:53:05 +0100 (CET) From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= Date: Thu, 06 Mar 2025 16:52:16 -0300 Subject: [PATCH v3 2/4] ASoC: mediatek: common: Handle mediatek,accdet property MIME-Version: 1.0 Message-Id: <20250306-mt8188-accdet-v3-2-7828e835ff4b@collabora.com> References: <20250306-mt8188-accdet-v3-0-7828e835ff4b@collabora.com> In-Reply-To: <20250306-mt8188-accdet-v3-0-7828e835ff4b@collabora.com> To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Trevor Wu , Jaroslav Kysela , Takashi Iwai Cc: kernel@collabora.com, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Mailer: b4 0.14.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250306_115311_729931_AA891B10 X-CRM114-Status: GOOD ( 13.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Handle the optional mediatek,accdet property. When present, retrieve the sound component from its phandle, so the machine sound driver can use it to register the audio jack and initialize the MT6359 ACCDET for jack detection. Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Nícolas F. R. A. Prado --- sound/soc/mediatek/common/mtk-soc-card.h | 1 + sound/soc/mediatek/common/mtk-soundcard-driver.c | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/sound/soc/mediatek/common/mtk-soc-card.h b/sound/soc/mediatek/common/mtk-soc-card.h index 3f6e24dd22df13ddb3aef1625a77d2e29e46fccf..a1d2794ac1f717997fb47023d5951a9ac4897788 100644 --- a/sound/soc/mediatek/common/mtk-soc-card.h +++ b/sound/soc/mediatek/common/mtk-soc-card.h @@ -16,6 +16,7 @@ struct mtk_soc_card_data { const struct mtk_sof_priv *sof_priv; struct list_head sof_dai_link_list; struct mtk_platform_card_data *card_data; + struct snd_soc_component *accdet; void *mach_priv; }; diff --git a/sound/soc/mediatek/common/mtk-soundcard-driver.c b/sound/soc/mediatek/common/mtk-soundcard-driver.c index f4314dddc46075d554b4e3f3aae8bcb5498f8ab5..713a368f79cf049f7879075c675457e91ba8332d 100644 --- a/sound/soc/mediatek/common/mtk-soundcard-driver.c +++ b/sound/soc/mediatek/common/mtk-soundcard-driver.c @@ -8,6 +8,7 @@ #include #include +#include #include #include "mtk-dsp-sof-common.h" @@ -192,7 +193,9 @@ EXPORT_SYMBOL_GPL(mtk_soundcard_common_capture_ops); int mtk_soundcard_common_probe(struct platform_device *pdev) { - struct device_node *platform_node, *adsp_node; + struct device_node *platform_node, *adsp_node, *accdet_node; + struct snd_soc_component *accdet_comp; + struct platform_device *accdet_pdev; const struct mtk_soundcard_pdata *pdata; struct mtk_soc_card_data *soc_card_data; struct snd_soc_dai_link *orig_dai_link, *dai_link; @@ -250,6 +253,20 @@ int mtk_soundcard_common_probe(struct platform_device *pdev) soc_card_data->card_data->jacks = jacks; + accdet_node = of_parse_phandle(pdev->dev.of_node, "mediatek,accdet", 0); + if (accdet_node) { + accdet_pdev = of_find_device_by_node(accdet_node); + if (accdet_pdev) { + accdet_comp = snd_soc_lookup_component(&accdet_pdev->dev, NULL); + if (accdet_comp) + soc_card_data->accdet = accdet_comp; + else + dev_err(&pdev->dev, "No sound component found from mediatek,accdet property\n"); + } else { + dev_err(&pdev->dev, "No device found from mediatek,accdet property\n"); + } + } + platform_node = of_parse_phandle(pdev->dev.of_node, "mediatek,platform", 0); if (!platform_node) return dev_err_probe(&pdev->dev, -EINVAL, From patchwork Thu Mar 6 19:52:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 14005298 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 0EC38C282DE for ; Thu, 6 Mar 2025 19:59:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2tACXAYYXiMb71YL2oZZZFWeFPiOraZcXMZ2yusj/Yc=; b=vAZk8/YzkTs6MG5gvKvogRijRw n5bg6TktUFN9OocDeXtdntkeO0T22rZ9pN3IqRg9R2wQb9WEMsG1c29GhKvkQnqJdcMX3fBBwAE85 JWX1qsVZp99meRgG0XLjU+u9pnvQ3Ap8OoZwvLuyKrFLF6CZ5nHiWUr0ayt56D15y3n+z7lkc2q9o oYk1ED+kRc0NN548kK1w3pR5WfYB5cOKORQ7+tgg5tkdxqJ6EEi/a0rJsTRWwZ8C46NtMPRQk249W zf1RregXoBqVn8oI+Rrj7Lal9oCWyHrbWHaGz7d/8sce1ZhnxBBpRmssgIIJWmej3ABIUF23dK9AN pCUD/7Ew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tqHNa-0000000C4Ni-0fwx; Thu, 06 Mar 2025 19:59:38 +0000 Received: from bali.collaboradmins.com ([148.251.105.195]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tqHHP-0000000C3dO-2AA8; Thu, 06 Mar 2025 19:53:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1741290794; bh=6hgrWNlNICsPF21r+8sMC1sCI3SX1I+SgK4MhWNZCNA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=THwrKjHSpnJe9MF+/WQbp3fdUkO/+b6howeqE7wy+b7435gmi0e37OGCvcFy7h6a6 GnHZ2bk7S8kZpenYBIZdRFDKPnygL8dOtG4bn9EVcQgMrlRnrjDdbvYarKzq7gTg6b aU/5SPfkV8qhHJGjjcByjcBLez4SFaRGbGfZrofcjN8Kg7YWpRxxaAsnb7b0HenVPs C50Hf2IEwHkd6vmMSX8HlzgxUy/544SU+AsMzy8ll4JKqcHHK77zmE0YJkN8Ta+V83 T0xpB0ptfF1SLueA59GW9l1jn6fPIq8DW7cs/BHur0IClxKNfpu4uKoxmN1XcG2hdl 93TSxCpPUwLtA== Received: from [192.168.0.47] (unknown [IPv6:2804:14c:1a9:53ee::1002]) (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) (Authenticated sender: nfraprado) by bali.collaboradmins.com (Postfix) with ESMTPSA id 635A917E0607; Thu, 6 Mar 2025 20:53:10 +0100 (CET) From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= Date: Thu, 06 Mar 2025 16:52:17 -0300 Subject: [PATCH v3 3/4] ASoC: mediatek: mt6359: Add stub for mt6359_accdet_enable_jack_detect MIME-Version: 1.0 Message-Id: <20250306-mt8188-accdet-v3-3-7828e835ff4b@collabora.com> References: <20250306-mt8188-accdet-v3-0-7828e835ff4b@collabora.com> In-Reply-To: <20250306-mt8188-accdet-v3-0-7828e835ff4b@collabora.com> To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Trevor Wu , Jaroslav Kysela , Takashi Iwai Cc: kernel@collabora.com, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Mailer: b4 0.14.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250306_115315_700455_6C074AF0 X-CRM114-Status: UNSURE ( 8.29 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a stub for mt6359_accdet_enable_jack_detect() to prevent linker failures in the machine sound drivers calling it when CONFIG_SND_SOC_MT6359_ACCDET is not enabled. Suggested-by: AngeloGioacchino Del Regno Signed-off-by: Nícolas F. R. A. Prado --- sound/soc/codecs/mt6359-accdet.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sound/soc/codecs/mt6359-accdet.h b/sound/soc/codecs/mt6359-accdet.h index c234f2f4276a12853a6fe0b13c4198dfc551b6b4..78ada3a5bfae55308135f37acc4c3857057bd203 100644 --- a/sound/soc/codecs/mt6359-accdet.h +++ b/sound/soc/codecs/mt6359-accdet.h @@ -123,6 +123,15 @@ struct mt6359_accdet { struct workqueue_struct *jd_workqueue; }; +#if IS_ENABLED(CONFIG_SND_SOC_MT6359_ACCDET) int mt6359_accdet_enable_jack_detect(struct snd_soc_component *component, struct snd_soc_jack *jack); +#else +static inline int +mt6359_accdet_enable_jack_detect(struct snd_soc_component *component, + struct snd_soc_jack *jack) +{ + return -EOPNOTSUPP; +} +#endif #endif From patchwork Thu Mar 6 19:52:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 14005300 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 CDF8CC282D1 for ; Thu, 6 Mar 2025 20:01:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mwsCU5p/+hKjfIpFpaFryIREeHoWDESBG0yzoObH5dc=; b=JUZqvwICsvpinaXTavO6/j0+wV BzT8tqq5XDbcs1Hzr+SIpZefyPyneacZMEGL8Iebcjt5pELKT7ivgbzwVzBY976ZUCNfgyc1DuR+K GUd6WvVb143uVANmEmACvzlJXO/U+k6l2K9AiVcXaulXy25tSuwGvuIAWDOpdWrgYCkQU+Ixul0W6 h8svwEeB8aQlCbsp0Adu5XfXl0Zw3aEVF0hyYvwPfabJMW+lkPyet7fuW/TkUOKpdhVrh8JrdYgKt NAwsUwSUi39JBvc2VWwozjnZQ4aejdjqYjuiMOgxGQDnstqoouycjN4m3D2CHXoDpLF+MwDd1fa7v n0u0Gwpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tqHPB-0000000C4bf-1xeb; Thu, 06 Mar 2025 20:01:17 +0000 Received: from bali.collaboradmins.com ([2a01:4f8:201:9162::2]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tqHHU-0000000C3fp-1WAY; Thu, 06 Mar 2025 19:53:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1741290799; bh=3Q8MSA2wNdR0EUiQxluJI3UNGeMjPm/pGs/aDkttMcM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=FXV0qYSdbUJaiGw7aWUOKDNl4LkS4msRrc0oNx6njVWV7DQlhLkqLmj5VQpQqANRD 4D7Z+4uFKYYy/AHdSvl6vHk4BQrWgUou6XHBNcXTJ/NtNamNcWVbFEzl0hF8UTXPBG 9VutigQjHoAuvo2RFCiRjHhGt93bD6o/Vpr2IKR2NvWJN9TxmSHF41xp1k1E28ZCnK rq3PhvRP/Pk3GsjcdqvAKBlAP+e2N42OcclOz8gx+c25U7TN/d2ttg+VCtguERQX+C NSPUFhIT250yN1S+k41q6xvN3/tRsZOQBUYmsNhQAvYkKlJKsI/fQKDBL1EUgQmI91 SChiFBIB53Vqw== Received: from [192.168.0.47] (unknown [IPv6:2804:14c:1a9:53ee::1002]) (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) (Authenticated sender: nfraprado) by bali.collaboradmins.com (Postfix) with ESMTPSA id AC36A17E05F7; Thu, 6 Mar 2025 20:53:14 +0100 (CET) From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= Date: Thu, 06 Mar 2025 16:52:18 -0300 Subject: [PATCH v3 4/4] ASoC: mediatek: mt8188-mt6359: Add accdet headset jack detect support MIME-Version: 1.0 Message-Id: <20250306-mt8188-accdet-v3-4-7828e835ff4b@collabora.com> References: <20250306-mt8188-accdet-v3-0-7828e835ff4b@collabora.com> In-Reply-To: <20250306-mt8188-accdet-v3-0-7828e835ff4b@collabora.com> To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Trevor Wu , Jaroslav Kysela , Takashi Iwai Cc: kernel@collabora.com, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= , Zoran Zhan X-Mailer: b4 0.14.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250306_115320_544891_7B92E1F7 X-CRM114-Status: GOOD ( 13.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Enable headset jack detection for MT8188 platforms that use the MT6359 ACCDET block for it, indicated by the mediatek,accdet property in DT. For those platforms, register a jack and initialize the ACCDET block to report jack events through it. Co-developed-by: Zoran Zhan Signed-off-by: Zoran Zhan Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Nícolas F. R. A. Prado --- sound/soc/mediatek/mt8188/mt8188-mt6359.c | 43 +++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/sound/soc/mediatek/mt8188/mt8188-mt6359.c b/sound/soc/mediatek/mt8188/mt8188-mt6359.c index 420b1427b71dc1424a52f7ab6140c14659036733..20dc9470ba76b2a750e79a5ae3dafabd7c597f40 100644 --- a/sound/soc/mediatek/mt8188/mt8188-mt6359.c +++ b/sound/soc/mediatek/mt8188/mt8188-mt6359.c @@ -17,6 +17,7 @@ #include "mt8188-afe-common.h" #include "../../codecs/nau8825.h" #include "../../codecs/mt6359.h" +#include "../../codecs/mt6359-accdet.h" #include "../../codecs/rt5682.h" #include "../common/mtk-afe-platform-driver.h" #include "../common/mtk-soundcard-driver.h" @@ -271,6 +272,17 @@ static struct snd_soc_jack_pin nau8825_jack_pins[] = { }, }; +static struct snd_soc_jack_pin mt8188_headset_jack_pins[] = { + { + .pin = "Headphone", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; + static const struct snd_kcontrol_new mt8188_dumb_spk_controls[] = { SOC_DAPM_PIN_SWITCH("Ext Spk"), }; @@ -506,6 +518,35 @@ static int mt8188_mt6359_mtkaif_calibration(struct snd_soc_pcm_runtime *rtd) return 0; } +static int mt8188_mt6359_accdet_init(struct snd_soc_pcm_runtime *rtd) +{ + struct mtk_soc_card_data *soc_card_data = snd_soc_card_get_drvdata(rtd->card); + struct snd_soc_jack *jack = &soc_card_data->card_data->jacks[MT8188_JACK_HEADSET]; + int ret; + + if (!soc_card_data->accdet) + return 0; + + ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack", + SND_JACK_HEADSET | SND_JACK_BTN_0 | + SND_JACK_BTN_1 | SND_JACK_BTN_2 | + SND_JACK_BTN_3, + jack, mt8188_headset_jack_pins, + ARRAY_SIZE(mt8188_headset_jack_pins)); + if (ret) { + dev_err(rtd->dev, "Headset Jack create failed: %d\n", ret); + return ret; + } + + ret = mt6359_accdet_enable_jack_detect(soc_card_data->accdet, jack); + if (ret) { + dev_err(rtd->dev, "Headset Jack enable failed: %d\n", ret); + return ret; + } + + return 0; +} + static int mt8188_mt6359_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_component *cmpnt_codec = @@ -518,6 +559,8 @@ static int mt8188_mt6359_init(struct snd_soc_pcm_runtime *rtd) /* mtkaif calibration */ mt8188_mt6359_mtkaif_calibration(rtd); + mt8188_mt6359_accdet_init(rtd); + return 0; }