From patchwork Tue Oct 10 02:37:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhengqiao Xia X-Patchwork-Id: 13414766 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 AF0ABCD68E4 for ; Tue, 10 Oct 2023 02:38:00 +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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FBRoIXxc4ljc8DF/PDtBoqS0A6CYruv097EKMy33JAI=; b=cdOCdmtCz0xn+yEmhf4g63qFvj 4f2rXs6HcV31L0umo6D0gv1IFuhY8DE+RKZ5uukei3cocvVrWNAC9r3BxiYrIBAay/VQ3hj5+YYvE 4gDXTHG+2kQ1daIu5ldrn981HKnYNAvK4Am6j5HMZe7aSah1i5mrEmkl53/kXNRCEBKS4r6jlnrS2 JZ3R/dsC0EAuoL0pIw44adx+N1vzF90RBImZcSCvHzA5F72JQXYfXZdDcAhrbcS4AXx+49d1UNiUb kS5vFc6dC4VD8yqEFx6GTtAr629izLVo68HNQwsvywn0YWyd8AvSYE3L4NljHg/375YyGxmrdIo4L 16zzCVEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qq2dE-00C8EQ-1E; Tue, 10 Oct 2023 02:38:00 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qq2dB-00C8D6-1m for linux-mediatek@lists.infradead.org; Tue, 10 Oct 2023 02:37:58 +0000 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1c5db4925f9so38220245ad.1 for ; Mon, 09 Oct 2023 19:37:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=huaqin-corp-partner-google-com.20230601.gappssmtp.com; s=20230601; t=1696905474; x=1697510274; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=FBRoIXxc4ljc8DF/PDtBoqS0A6CYruv097EKMy33JAI=; b=ShbLkO4Z3lHeLDCIf1IHUz+RUvr4nPu8uJjOxX+zAsL+t5oTdJO9OrZg3ffMAQfuYv f1e6qma/xDIghOtV9Jl/cxXpgkcoP0mU4TLPCmSFniTewgsYS/K8GTov1HjJHXaXrhRo GYd0Gj655N0sQB/YQ6yV1SIN6qn/c6k9Id3AfNRKGMVh2Ufvh9Btz5XN/H6dRC7BU+oC D0G5S6TIpljBzgSJwut8FJiP61QfExgGoIigW5baF95su3QQ4AAp0Jj6dbpJeIen1ate utVypQsIHasrfEvzyjnMgQUprVvgNkpVpNIoQcQ4NSFGbZ5jpWulCLoeZRvrLrnxwZXL 4XsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696905474; x=1697510274; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FBRoIXxc4ljc8DF/PDtBoqS0A6CYruv097EKMy33JAI=; b=oleo1eTc3WQjyZXQyYs35ImPuAYF7XO8KZi7XeUzbjiCM/dbbO0r0ohFhGVDiLfloN AWQADgQPfzjDI3+P+SNXIKBTEA2dIc0p2JRoQdf3dk1w18heWmOGtTnGhUD27VFXSYdc lAf5W9VVbFDof98GNHjLA2cyNcHW4zv7x4+wZIvBTj2rpTSShUN/hJpWWDywjAY64w6D mRpMT49PxIrL/GskwSBabQtkWoQEqeKTNwGhWpN7fjIj0IGTX10JYIzVz1tjlwxh9DwS 6UiJe1jl8K1eHD61ECRMrR/SDIdrVPtluNfuPXOBF8tyjXTVIh4jcQoDBILx2TCWYWs1 l96Q== X-Gm-Message-State: AOJu0YwXsBg15lO0ugwrO3DONXv5mqXuBJmKS6GNHd+a6se4c1nbreRl txKziIV/vQglVKBWJn1rKVbxMw== X-Google-Smtp-Source: AGHT+IEv18QaxmdXF/vUEo7prCg0gx1O29LYJaDyQoUVhpU9JZshh+ovBSvE4QZw0O7F38u1Ae0ekQ== X-Received: by 2002:a17:902:ecd1:b0:1bc:1e17:6d70 with SMTP id a17-20020a170902ecd100b001bc1e176d70mr20438926plh.24.1696905473655; Mon, 09 Oct 2023 19:37:53 -0700 (PDT) Received: from ubuntu.huaqin.com ([101.78.151.205]) by smtp.gmail.com with ESMTPSA id e1-20020a17090301c100b001c613091aeesm10269039plh.293.2023.10.09.19.37.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 19:37:53 -0700 (PDT) From: xiazhengqiao To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, perex@perex.cz, trevor.wu@mediatek.com Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, xiazhengqiao Subject: [v5 1/2] ASoC: dt-bindings: mediatek,mt8188-mt6359: add RT5682S support Date: Tue, 10 Oct 2023 10:37:37 +0800 Message-Id: <20231010023738.8241-2-xiazhengqiao@huaqin.corp-partner.google.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231010023738.8241-1-xiazhengqiao@huaqin.corp-partner.google.com> References: <20231010023738.8241-1-xiazhengqiao@huaqin.corp-partner.google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231009_193757_587286_28B0A6D6 X-CRM114-Status: UNSURE ( 7.91 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Add compatible string "mediatek,mt8188-rt5682s" to support new board with rt5682s codec. Signed-off-by: xiazhengqiao Acked-by: Rob Herring Reviewed-by: AngeloGioacchino Del Regno --- .../devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml b/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml index 43b3b67bdf3b..4c8c95057ef7 100644 --- a/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml +++ b/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml @@ -17,6 +17,7 @@ properties: enum: - mediatek,mt8188-mt6359-evb - mediatek,mt8188-nau8825 + - mediatek,mt8188-rt5682s audio-routing: description: From patchwork Tue Oct 10 02:37:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhengqiao Xia X-Patchwork-Id: 13414767 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 406ABCD68E4 for ; Tue, 10 Oct 2023 02:38:05 +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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=w4bmb1xR8OcWB9e5UdpWJ8Bp88C+jyGpoKKuNYhtM58=; b=lMnohUFmLfNzJEayekXq0rU/23 jmHuyu6AiUxdfZoWkG5WNMzQxgqAMbn5GNVNpCwPrsKoIUCZBQ2wbCKShzVP6F92R6plzYEwyNo3L A1zjA6IBuBlvS7O1Dl8dinaAHE8cPsMrLahEnhArS1X+jPs656WVJfmeeFPzJgqHZ2YG4bOkpL1Iy qIUSr1ngUXS918Ux33c7ZQMLbg7OGVHGibZ//7y03h3VlghKoE8YOhST9LIp/zmPEG4ESG7kU85Jz R/PYZRUfcoV0f4SGQAqBAdjgCqM/V1fTJg1HK6KT5F+/KDAWsoDw6Y24eJjw1UjWNptX2zU7QtRev F+yLGnIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qq2dI-00C8Fb-2g; Tue, 10 Oct 2023 02:38:04 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qq2dF-00C8EG-2t for linux-mediatek@lists.infradead.org; Tue, 10 Oct 2023 02:38:03 +0000 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1c0ecb9a075so31898945ad.2 for ; Mon, 09 Oct 2023 19:37:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=huaqin-corp-partner-google-com.20230601.gappssmtp.com; s=20230601; t=1696905479; x=1697510279; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=w4bmb1xR8OcWB9e5UdpWJ8Bp88C+jyGpoKKuNYhtM58=; b=MqaoGh56vibaR/Fd8cIeYg4m64gp0vGVxaLru1fdzHqHxz1YkNxb0BMgqHx0iVSFxn JNzgWVEvy9MIA2qskIirB8TegtxE5sFYNV+yuJn014b72XR50kintAy6DqAB0g89HYag kOyRB2rDgr4sWneVKkR4HAChGEUk73xAwU5/IY0e1IV+/KR24Ea0WUMmwW0MVKa6uAoA 9z9clspj1SGokK8h6IF0h+2D1c+BraDfyqEzp4LPSUeomjQBd/53cxGfd9Vmgligt05B tDH2pMJOBlAdiahYHP4vUvdNKrPUu0ScoO+Yl1gLVGIebFHXDPDQriLLS+SGfLW7FzlD hCYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696905479; x=1697510279; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=w4bmb1xR8OcWB9e5UdpWJ8Bp88C+jyGpoKKuNYhtM58=; b=pfIWbnTJihTDRsPMex+ETdcMBHjFv12L+yoksyGw+uRjaEfB2LKMCTIYdPrHwYppzV K1qg/aGQpVD1lGg9TB+EE98g8pkTA2y+qmhG31BF5ZOXd3jP3/XA6xZZtt0iDDuXGBv/ eQzTRDWNcQUTrfD8PL2CKCDJF985E2siJLC/nvATfu0/dm/B+ohkVreLBVjrstSHtOVF TxhLKJD3D6+buLcdQO5Y21MVNwf3V+KOdySiG1rym1hmR6yaFESp3dQ4IvmwOUfPEwUR j/WQuEnuwTWIgsjxd9eh6WiwMR80X/ekUziFZNpwa1rzg+mdYZsd6hYVrKk3TWk7Wu38 LwgQ== X-Gm-Message-State: AOJu0Yzm6y8DUmiBNnbxWCAjRkRqX0iQ3xrvGZr09uxWjGnmzlJWNOx7 B07pJAXJS5UIJ/XZGLkJ0cWrEQ== X-Google-Smtp-Source: AGHT+IH9LOo0tQ4Yc+ymws96WFTOJEo86wA1EZW7c1AxAijqrRQc/MBForoANuU0NMiOTHa5cbR+XA== X-Received: by 2002:a17:902:ce90:b0:1c8:9d32:3397 with SMTP id f16-20020a170902ce9000b001c89d323397mr6990238plg.57.1696905478639; Mon, 09 Oct 2023 19:37:58 -0700 (PDT) Received: from ubuntu.huaqin.com ([101.78.151.205]) by smtp.gmail.com with ESMTPSA id e1-20020a17090301c100b001c613091aeesm10269039plh.293.2023.10.09.19.37.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 19:37:58 -0700 (PDT) From: xiazhengqiao To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, perex@perex.cz, trevor.wu@mediatek.com Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, xiazhengqiao Subject: [v5 2/2] ASoC: mediatek: mt8188-mt6359: add rt5682s support Date: Tue, 10 Oct 2023 10:37:38 +0800 Message-Id: <20231010023738.8241-3-xiazhengqiao@huaqin.corp-partner.google.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231010023738.8241-1-xiazhengqiao@huaqin.corp-partner.google.com> References: <20231010023738.8241-1-xiazhengqiao@huaqin.corp-partner.google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231009_193801_932027_E3439047 X-CRM114-Status: GOOD ( 20.51 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org To use RT5682S as the codec and MAX98390 as the amp, add a new sound card named mt8188_rt5682s. Signed-off-by: xiazhengqiao Reviewed-by: Trevor Wu Reviewed-by: AngeloGioacchino Del Regno --- sound/soc/mediatek/Kconfig | 1 + sound/soc/mediatek/mt8188/mt8188-mt6359.c | 122 +++++++++++++++++++++- 2 files changed, 121 insertions(+), 2 deletions(-) diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig index 8d1bc8814486..43c8fea00439 100644 --- a/sound/soc/mediatek/Kconfig +++ b/sound/soc/mediatek/Kconfig @@ -250,6 +250,7 @@ config SND_SOC_MT8188_MT6359 select SND_SOC_MAX98390 select SND_SOC_NAU8315 select SND_SOC_NAU8825 + select SND_SOC_RT5682S help This adds support for ASoC machine driver for MediaTek MT8188 boards with the MT6359 and other I2S audio codecs. diff --git a/sound/soc/mediatek/mt8188/mt8188-mt6359.c b/sound/soc/mediatek/mt8188/mt8188-mt6359.c index 1564eaa1b290..a7e569e5f76d 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/rt5682.h" #include "../common/mtk-afe-platform-driver.h" #include "../common/mtk-soundcard-driver.h" #include "../common/mtk-dsp-sof-common.h" @@ -32,7 +33,7 @@ #define TEST_MISO_DONE_2 BIT(29) #define NAU8825_HS_PRESENT BIT(0) - +#define RT5682S_HS_PRESENT BIT(1) /* * Maxim MAX98390 */ @@ -52,6 +53,8 @@ #define SOF_DMA_UL4 "SOF_DMA_UL4" #define SOF_DMA_UL5 "SOF_DMA_UL5" +#define RT5682S_CODEC_DAI "rt5682s-aif1" + /* FE */ SND_SOC_DAILINK_DEFS(playback2, DAILINK_COMP_ARRAY(COMP_CPU("DL2")), @@ -772,6 +775,55 @@ static int mt8188_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd) return 0; }; +static int mt8188_rt5682s_codec_init(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_card *card = rtd->card; + struct mtk_soc_card_data *soc_card_data = snd_soc_card_get_drvdata(card); + struct mt8188_mt6359_priv *priv = soc_card_data->mach_priv; + struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component; + struct snd_soc_jack *jack = &priv->headset_jack; + int ret; + + ret = snd_soc_dapm_new_controls(&card->dapm, mt8188_nau8825_widgets, + ARRAY_SIZE(mt8188_nau8825_widgets)); + if (ret) { + dev_err(rtd->dev, "unable to add rt5682s card widget, ret %d\n", ret); + return ret; + } + + ret = snd_soc_add_card_controls(card, mt8188_nau8825_controls, + ARRAY_SIZE(mt8188_nau8825_controls)); + if (ret) { + dev_err(rtd->dev, "unable to add rt5682s card controls, ret %d\n", ret); + return ret; + } + + 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, + nau8825_jack_pins, + ARRAY_SIZE(nau8825_jack_pins)); + if (ret) { + dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret); + return ret; + } + + snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); + snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); + snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP); + snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); + ret = snd_soc_component_set_jack(component, jack, NULL); + + if (ret) { + dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret); + return ret; + } + + return 0; +}; + static void mt8188_nau8825_codec_exit(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component; @@ -779,6 +831,13 @@ static void mt8188_nau8825_codec_exit(struct snd_soc_pcm_runtime *rtd) snd_soc_component_set_jack(component, NULL, NULL); } +static void mt8188_rt5682s_codec_exit(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component; + + snd_soc_component_set_jack(component, NULL, NULL); +} + static int mt8188_nau8825_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -813,6 +872,51 @@ static const struct snd_soc_ops mt8188_nau8825_ops = { .hw_params = mt8188_nau8825_hw_params, }; +static int mt8188_rt5682s_i2s_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_card *card = rtd->card; + struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); + struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); + unsigned int rate = params_rate(params); + int bitwidth; + int ret; + + bitwidth = snd_pcm_format_width(params_format(params)); + if (bitwidth < 0) { + dev_err(card->dev, "invalid bit width: %d\n", bitwidth); + return bitwidth; + } + + ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x00, 0x0, 0x2, bitwidth); + if (ret) { + dev_err(card->dev, "failed to set tdm slot\n"); + return ret; + } + + ret = snd_soc_dai_set_pll(codec_dai, RT5682_PLL1, RT5682_PLL1_S_BCLK1, + rate * 32, rate * 512); + if (ret) { + dev_err(card->dev, "failed to set pll\n"); + return ret; + } + + ret = snd_soc_dai_set_sysclk(codec_dai, RT5682_SCLK_S_PLL1, + rate * 512, SND_SOC_CLOCK_IN); + if (ret) { + dev_err(card->dev, "failed to set sysclk\n"); + return ret; + } + + return snd_soc_dai_set_sysclk(cpu_dai, 0, rate * 128, + SND_SOC_CLOCK_OUT); +} + +static const struct snd_soc_ops mt8188_rt5682s_i2s_ops = { + .hw_params = mt8188_rt5682s_i2s_hw_params, +}; + static int mt8188_sof_be_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -1148,7 +1252,7 @@ static void mt8188_fixup_controls(struct snd_soc_card *card) struct mt8188_card_data *card_data = (struct mt8188_card_data *)priv->private_data; struct snd_kcontrol *kctl; - if (card_data->quirk & NAU8825_HS_PRESENT) { + if (card_data->quirk & (NAU8825_HS_PRESENT | RT5682S_HS_PRESENT)) { struct snd_soc_dapm_widget *w, *next_w; for_each_card_widgets_safe(card, w, next_w) { @@ -1190,6 +1294,7 @@ static int mt8188_mt6359_dev_probe(struct platform_device *pdev) struct snd_soc_dai_link *dai_link; bool init_mt6359 = false; bool init_nau8825 = false; + bool init_rt5682s = false; bool init_max98390 = false; bool init_dumb = false; int ret, i; @@ -1306,6 +1411,13 @@ static int mt8188_mt6359_dev_probe(struct platform_device *pdev) dai_link->exit = mt8188_nau8825_codec_exit; init_nau8825 = true; } + } else if (!strcmp(dai_link->codecs->dai_name, RT5682S_CODEC_DAI)) { + dai_link->ops = &mt8188_rt5682s_i2s_ops; + if (!init_rt5682s) { + dai_link->init = mt8188_rt5682s_codec_init; + dai_link->exit = mt8188_rt5682s_codec_exit; + init_rt5682s = true; + } } else { if (strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) { if (!init_dumb) { @@ -1343,9 +1455,15 @@ static struct mt8188_card_data mt8188_nau8825_card = { .quirk = NAU8825_HS_PRESENT, }; +static struct mt8188_card_data mt8188_rt5682s_card = { + .name = "mt8188_rt5682s", + .quirk = RT5682S_HS_PRESENT, +}; + static const struct of_device_id mt8188_mt6359_dt_match[] = { { .compatible = "mediatek,mt8188-mt6359-evb", .data = &mt8188_evb_card, }, { .compatible = "mediatek,mt8188-nau8825", .data = &mt8188_nau8825_card, }, + { .compatible = "mediatek,mt8188-rt5682s", .data = &mt8188_rt5682s_card, }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, mt8188_mt6359_dt_match);