From patchwork Wed Dec 13 11:39:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Zhou X-Patchwork-Id: 13490788 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=huaqin-corp-partner-google-com.20230601.gappssmtp.com header.i=@huaqin-corp-partner-google-com.20230601.gappssmtp.com header.b="OS/lO8Xx" Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C332CEA for ; Wed, 13 Dec 2023 03:40:07 -0800 (PST) Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-35da160de2bso29090645ab.1 for ; Wed, 13 Dec 2023 03:40:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=huaqin-corp-partner-google-com.20230601.gappssmtp.com; s=20230601; t=1702467607; x=1703072407; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OQqe+M0SciQZs03dKyyk03FflXJC4UVH/RDIGAymDmI=; b=OS/lO8XxaGDwyEKNt4VAHi5FICjbBU0QOwhUkBZ6KrUoJOU7/UjE4KZT4Nyel0bqyQ hqo1N012Pxov1uQFv+fmSkE500frgRdJHMWMI1UIJN8ZjV3ReZTRRLvroiTznyV73rfN 615RJSd9izAbefG8LEsxOR1Twob5zts7erzZpql7OF+P21AJibEqgRHtMnL9lcjX4NZq 7+jxXUzyTDZXSHrAuMubHk2E3U2DfvAx9ShThDk5v5g1U3mx1sj3EljJhCA+D/NMLrHo jHMkIdaeo3+dRJrb028OipGO52bvSJcZJE502387by9EXhQcvEzuQiz3eG0WZy/wyCQZ EgGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702467607; x=1703072407; h=content-transfer-encoding:mime-version: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=OQqe+M0SciQZs03dKyyk03FflXJC4UVH/RDIGAymDmI=; b=tLGURmPrkbz7wZ7mthQ0i81q+V1YTS2IkC+H/h+EP55wtDes0La+LnnfxfBhluYtNL mkkwiTG2qd+6uiqEtjRGlQ80HRBiDoIaXXBpPB0V08d2xZfDV6KO0L0WZ30ZmSaavQEi tXrow5iqoKgCpxyY0JnPhH8Z+JkxUGYC95fZSq7KRXlKaM9X/F2a4JKgNz/Q5ntMTv7U 8YX4v64BCNEuW3LZH7KySWaJqU5ivt75IfBErP7bzN4Rqm1PTxM6oTcSzpDYsIVwsYw6 HRDqNjXavBN33HwKd1Bqx3SeXhv3xB/M5mHMQnXfnoHgwVyk8u/uI1VDFZBlbeB9mQqj EsQg== X-Gm-Message-State: AOJu0YyqxlHL3tSa4/NkaTrgCusucVWBNU3r5kgMCDhqMLwGaY4cRMY5 O59YFDwfQWFz0DJNCQJ9U5+2Uw== X-Google-Smtp-Source: AGHT+IGGyRqBeTDdNQ7HGycNQHOaojx3Dzjx01n/acJiFtPQlEWht8+O+/tfXna6+MHjMz8iHq9CZQ== X-Received: by 2002:a92:d150:0:b0:35d:6220:ac8b with SMTP id t16-20020a92d150000000b0035d6220ac8bmr8780918ilg.58.1702467607093; Wed, 13 Dec 2023 03:40:07 -0800 (PST) Received: from localhost.localdomain ([101.78.151.194]) by smtp.gmail.com with ESMTPSA id t1-20020a170902b20100b001bb9d6b1baasm10331066plr.198.2023.12.13.03.40.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 03:40:06 -0800 (PST) From: Rui Zhou To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, perex@perex.cz, tiwai@suse.com, trevor.wu@mediatek.com, allen-kh.cheng@mediatek.com, kuninori.morimoto.gx@renesas.com Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Rui Zhou , Conor Dooley Subject: [RESEND PATCH v9 1/4] ASoC: dt-bindings: mt8188-mt6359: add es8326 support Date: Wed, 13 Dec 2023 19:39:52 +0800 Message-Id: <20231213113955.47668-2-zhourui@huaqin.corp-partner.google.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231213113955.47668-1-zhourui@huaqin.corp-partner.google.com> References: <20231213113955.47668-1-zhourui@huaqin.corp-partner.google.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add compatible string "mediatek,mt8188-es8326" to support new board with es8326 codec. Acked-by: Conor Dooley Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Rui Zhou --- .../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 4c8c95057ef7..f94ad0715e32 100644 --- a/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml +++ b/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml @@ -15,6 +15,7 @@ allOf: properties: compatible: enum: + - mediatek,mt8188-es8326 - mediatek,mt8188-mt6359-evb - mediatek,mt8188-nau8825 - mediatek,mt8188-rt5682s From patchwork Wed Dec 13 11:39:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Zhou X-Patchwork-Id: 13490789 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=huaqin-corp-partner-google-com.20230601.gappssmtp.com header.i=@huaqin-corp-partner-google-com.20230601.gappssmtp.com header.b="yyZSjVDf" Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3DABF2 for ; Wed, 13 Dec 2023 03:40:11 -0800 (PST) Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-35d725ac060so30054575ab.2 for ; Wed, 13 Dec 2023 03:40:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=huaqin-corp-partner-google-com.20230601.gappssmtp.com; s=20230601; t=1702467611; x=1703072411; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Lpd6C9NI3pbwTLe6pctih7tPOV6DJdooeIM997kH/ks=; b=yyZSjVDfqFXYTB/cBjgo5ouGH0HgrY3vlokThew+UsIPabU36YhuvaEhprAZczLBvR glmmEdGEtgBYK9DmpUmHU/PHwXZcJ30G5xRZlCQUsjxxycqphyVCysujcv36XAXPmq5G OtZsT/UshMgqlRzfAEKvEaHkF9zNoXvwVKASk2zK01wof9kWd7eJlXEo8EJxLwalhsfr tLqkfNwRovaosRaGsIAGuiQB8dPyKj+/ZUEp3myj2Jt/ORHzYdZBdPEhn+gVLtg9qH4p gU/FHcV/TPraJ7kXtGVbOA5XQ2xNwDpQ1LBw7LalFnCpavXzqsytfUYfrpKDtk17sMJG d6iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702467611; x=1703072411; h=content-transfer-encoding:mime-version: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=Lpd6C9NI3pbwTLe6pctih7tPOV6DJdooeIM997kH/ks=; b=lsTWJrzmNLpWmMCMZeyJ8ZfybFhlwEnR+1ZsmHHEOURQkQsoeXyprYCLqHwszB/SiC SSs2av7QOLxmplhE0oV5azwdi2AcqIZXhPmHbDTZLrfh0kOg1dhuqs0VeYUX0lVaYY4Y sCaVvq8jIMcc10PXBRTk0cw19ejitQZhYyq+Sz3glCujRdWlntiNR6aBE7Jhh9F4Pu2U AZi41bSrODYGhs+nU0PU/QWS+q3AVleI+qKqsqakJw06svzSrvb+g8PwMP0+Zvp0aUJ2 T5ZarKLP0EgDP/uuBYrruMFxtdhe0qwY3ghEnZxLzVbJcI9MWXHbkhA68RU+2V68chnn I/aQ== X-Gm-Message-State: AOJu0YypqPdd28mkeMFWzN1KICzMi2f4qyiw7e3uNYbel5VLhvVNwzxF SlMVeqt89u+j5im+faR2qK9kHg== X-Google-Smtp-Source: AGHT+IGvmjF29b/0IjlOkfDCEspt2ZCEMxvOjfW1EgSB2aHQLbU0s6wyRZG0gia2QEjv69orKFbHTA== X-Received: by 2002:a05:6e02:20c5:b0:35d:693a:432a with SMTP id 5-20020a056e0220c500b0035d693a432amr12086058ilq.3.1702467611039; Wed, 13 Dec 2023 03:40:11 -0800 (PST) Received: from localhost.localdomain ([101.78.151.194]) by smtp.gmail.com with ESMTPSA id t1-20020a170902b20100b001bb9d6b1baasm10331066plr.198.2023.12.13.03.40.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 03:40:10 -0800 (PST) From: Rui Zhou To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, perex@perex.cz, tiwai@suse.com, trevor.wu@mediatek.com, allen-kh.cheng@mediatek.com, kuninori.morimoto.gx@renesas.com Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Rui Zhou Subject: [RESEND PATCH v9 2/4] ASoC: mediatek: mt8188-mt6359: commonize headset codec init/exit api Date: Wed, 13 Dec 2023 19:39:53 +0800 Message-Id: <20231213113955.47668-3-zhourui@huaqin.corp-partner.google.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231213113955.47668-1-zhourui@huaqin.corp-partner.google.com> References: <20231213113955.47668-1-zhourui@huaqin.corp-partner.google.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reduce code duplication, unify the headset codec init/exit api. Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Rui Zhou --- sound/soc/mediatek/mt8188/mt8188-mt6359.c | 67 ++--------------------- 1 file changed, 6 insertions(+), 61 deletions(-) diff --git a/sound/soc/mediatek/mt8188/mt8188-mt6359.c b/sound/soc/mediatek/mt8188/mt8188-mt6359.c index 33d477cc2e54..b4606a28794c 100644 --- a/sound/soc/mediatek/mt8188/mt8188-mt6359.c +++ b/sound/soc/mediatek/mt8188/mt8188-mt6359.c @@ -726,7 +726,7 @@ static int mt8188_max98390_codec_init(struct snd_soc_pcm_runtime *rtd) return 0; } -static int mt8188_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd) +static int mt8188_headset_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); @@ -775,68 +775,13 @@ 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) +static void mt8188_headset_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 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) @@ -1407,15 +1352,15 @@ static int mt8188_mt6359_dev_probe(struct platform_device *pdev) } else if (!strcmp(dai_link->codecs->dai_name, NAU8825_CODEC_DAI)) { dai_link->ops = &mt8188_nau8825_ops; if (!init_nau8825) { - dai_link->init = mt8188_nau8825_codec_init; - dai_link->exit = mt8188_nau8825_codec_exit; + dai_link->init = mt8188_headset_codec_init; + dai_link->exit = mt8188_headset_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; + dai_link->init = mt8188_headset_codec_init; + dai_link->exit = mt8188_headset_codec_exit; init_rt5682s = true; } } else { From patchwork Wed Dec 13 11:39:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Zhou X-Patchwork-Id: 13490790 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=huaqin-corp-partner-google-com.20230601.gappssmtp.com header.i=@huaqin-corp-partner-google-com.20230601.gappssmtp.com header.b="odIOvfLS" Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1C94194 for ; Wed, 13 Dec 2023 03:40:15 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1d32c5ce32eso20837625ad.0 for ; Wed, 13 Dec 2023 03:40:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=huaqin-corp-partner-google-com.20230601.gappssmtp.com; s=20230601; t=1702467615; x=1703072415; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5MhKZsumq4MWT0PZMk1o4yZqjjymXBYPrRSLeOSmgoI=; b=odIOvfLS0jJh35rsv9403h257CY3oMeQPr+eyiGhLnMwTazjyZ9ZMgozILL2M8ueij FarKuAMA9pqkrR/rKh47N3ft1LQsz6iaVo7Nw22mKOCzf1wdMPfAr0cKnDZN3xn2ZTHB 1WJgC2UphTfKnIGc9lrlgnODXwAUYA5FwtHHSmP1Pm+k2ahYnRdGtgmPZw5j3Kn6Tc3Y T1QbqHCko5rOKL6PREYclKpzwkhzfBuVQld6aUvsTvRzl6+pzfXevZ2uzGRSjojxicw8 u+fIlwhZPEiOx8TccoHcryuSvZH58xS57OoEfPuZHTOsPj2vNiI3wyw7mJTSIxB3kfus ch5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702467615; x=1703072415; h=content-transfer-encoding:mime-version: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=5MhKZsumq4MWT0PZMk1o4yZqjjymXBYPrRSLeOSmgoI=; b=vYxe7quKQSvFUtlKqeEEAFOoZltq5ZQ91ur18/8SnEBtdfQtfWbVrUlX1Ni9J4sKT4 rxHT+V8erUDoUnMAI3zWN/50EbWGPzwfuRrzuLIy0Jx/kJO97nx5c9QiUGJkoXqSybkL XyCH7hQxjq57/mWIvu6ylbL57eA0sTahu8ut/kjkbBdsmAL9CNZXXlWpJV4gExPLLd69 jLVbO4l4QxPkl4yFHdg4JD6JG8HIHjuOQt/r2AFaWm7XYUJelHolmvrySwrsQINxqkHv PNh+3/0plQywe7nfwt8LkNCvuoEPrMNJ8vMExNDVIfBbYU+/E/M8Dv/k5MEph1lH7TUw 6Vqg== X-Gm-Message-State: AOJu0Ywk7qLC4CquS7r9JBjPc9JdPSlcMrfhrwrteq2ZvYooggHUZjOS NbyzP8A39nIn0f5bvtBZdR5nAA== X-Google-Smtp-Source: AGHT+IHPM0t2mzP01VO6cshlgighsDqYCmxGKn5nvhUslBUK1iGtE1r4KJF4obXaN6/7iR1x0S6uiA== X-Received: by 2002:a17:902:d48e:b0:1d3:5da4:68e7 with SMTP id c14-20020a170902d48e00b001d35da468e7mr88730plg.53.1702467614952; Wed, 13 Dec 2023 03:40:14 -0800 (PST) Received: from localhost.localdomain ([101.78.151.194]) by smtp.gmail.com with ESMTPSA id t1-20020a170902b20100b001bb9d6b1baasm10331066plr.198.2023.12.13.03.40.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 03:40:14 -0800 (PST) From: Rui Zhou To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, perex@perex.cz, tiwai@suse.com, trevor.wu@mediatek.com, allen-kh.cheng@mediatek.com, kuninori.morimoto.gx@renesas.com Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Rui Zhou Subject: [RESEND PATCH v9 3/4] ASoC: mediatek: mt8188-mt6359: add es8326 support Date: Wed, 13 Dec 2023 19:39:54 +0800 Message-Id: <20231213113955.47668-4-zhourui@huaqin.corp-partner.google.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231213113955.47668-1-zhourui@huaqin.corp-partner.google.com> References: <20231213113955.47668-1-zhourui@huaqin.corp-partner.google.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To use ES8326 as the codec, add a new sound card named mt8186_es8326. Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Trevor Wu Signed-off-by: Rui Zhou --- sound/soc/mediatek/Kconfig | 1 + sound/soc/mediatek/mt8188/mt8188-mt6359.c | 56 ++++++++++++++++++++++- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig index b93d455744ab..296b434caf81 100644 --- a/sound/soc/mediatek/Kconfig +++ b/sound/soc/mediatek/Kconfig @@ -252,6 +252,7 @@ config SND_SOC_MT8188_MT6359 select SND_SOC_NAU8315 select SND_SOC_NAU8825 select SND_SOC_RT5682S + select SND_SOC_ES8326 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 b4606a28794c..d1884f23a1a7 100644 --- a/sound/soc/mediatek/mt8188/mt8188-mt6359.c +++ b/sound/soc/mediatek/mt8188/mt8188-mt6359.c @@ -34,6 +34,8 @@ #define NAU8825_HS_PRESENT BIT(0) #define RT5682S_HS_PRESENT BIT(1) +#define ES8326_HS_PRESENT BIT(2) +#define MAX98390_TWO_AMP BIT(3) /* * Maxim MAX98390 */ @@ -48,6 +50,11 @@ */ #define NAU8825_CODEC_DAI "nau8825-hifi" +/* + * ES8326 + */ +#define ES8326_CODEC_DAI "ES8326 HiFi" + #define SOF_DMA_DL2 "SOF_DMA_DL2" #define SOF_DMA_DL3 "SOF_DMA_DL3" #define SOF_DMA_UL4 "SOF_DMA_UL4" @@ -888,6 +895,30 @@ static const struct snd_soc_ops mt8188_sof_be_ops = { .hw_params = mt8188_sof_be_hw_params, }; +static int mt8188_es8326_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); + 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 ret; + + /* Configure MCLK for codec */ + ret = snd_soc_dai_set_sysclk(codec_dai, 0, rate * 256, SND_SOC_CLOCK_IN); + if (ret < 0) { + dev_err(codec_dai->dev, "can't set MCLK %d\n", ret); + return ret; + } + + /* Configure MCLK for cpu */ + return snd_soc_dai_set_sysclk(cpu_dai, 0, rate * 256, SND_SOC_CLOCK_OUT); +} + +static const struct snd_soc_ops mt8188_es8326_ops = { + .hw_params = mt8188_es8326_hw_params, +}; + static struct snd_soc_dai_link mt8188_mt6359_dai_links[] = { /* FE */ [DAI_LINK_DL2_FE] = { @@ -1197,7 +1228,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 | RT5682S_HS_PRESENT)) { + if (card_data->quirk & (NAU8825_HS_PRESENT | RT5682S_HS_PRESENT | ES8326_HS_PRESENT)) { struct snd_soc_dapm_widget *w, *next_w; for_each_card_widgets_safe(card, w, next_w) { @@ -1238,6 +1269,7 @@ static int mt8188_mt6359_dev_probe(struct platform_device *pdev) struct mt8188_card_data *card_data; struct snd_soc_dai_link *dai_link; bool init_mt6359 = false; + bool init_es8326 = false; bool init_nau8825 = false; bool init_rt5682s = false; bool init_max98390 = false; @@ -1344,7 +1376,14 @@ static int mt8188_mt6359_dev_probe(struct platform_device *pdev) strcmp(dai_link->name, "ETDM1_IN_BE") == 0 || strcmp(dai_link->name, "ETDM2_IN_BE") == 0) { if (!strcmp(dai_link->codecs->dai_name, MAX98390_CODEC_DAI)) { - dai_link->ops = &mt8188_max98390_ops; + /* + * The TDM protocol settings with fixed 4 slots are defined in + * mt8188_max98390_ops. Two amps is I2S mode, + * SOC and codec don't require TDM settings. + */ + if (!(card_data->quirk & MAX98390_TWO_AMP)) { + dai_link->ops = &mt8188_max98390_ops; + } if (!init_max98390) { dai_link->init = mt8188_max98390_codec_init; init_max98390 = true; @@ -1363,6 +1402,13 @@ static int mt8188_mt6359_dev_probe(struct platform_device *pdev) dai_link->exit = mt8188_headset_codec_exit; init_rt5682s = true; } + } else if (!strcmp(dai_link->codecs->dai_name, ES8326_CODEC_DAI)) { + dai_link->ops = &mt8188_es8326_ops; + if (!init_es8326) { + dai_link->init = mt8188_headset_codec_init; + dai_link->exit = mt8188_headset_codec_exit; + init_es8326 = true; + } } else { if (strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) { if (!init_dumb) { @@ -1405,10 +1451,16 @@ static struct mt8188_card_data mt8188_rt5682s_card = { .quirk = RT5682S_HS_PRESENT, }; +static struct mt8188_card_data mt8188_es8326_card = { + .name = "mt8188_es8326", + .quirk = ES8326_HS_PRESENT | MAX98390_TWO_AMP, +}; + 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, }, + { .compatible = "mediatek,mt8188-es8326", .data = &mt8188_es8326_card, }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, mt8188_mt6359_dt_match); From patchwork Wed Dec 13 11:39:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Zhou X-Patchwork-Id: 13490791 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=huaqin-corp-partner-google-com.20230601.gappssmtp.com header.i=@huaqin-corp-partner-google-com.20230601.gappssmtp.com header.b="GhlPr9XD" Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 936281BD for ; Wed, 13 Dec 2023 03:40:19 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1d345b187bbso11949625ad.0 for ; Wed, 13 Dec 2023 03:40:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=huaqin-corp-partner-google-com.20230601.gappssmtp.com; s=20230601; t=1702467619; x=1703072419; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pkeEHXB3/T/jnmWhl5vUXIuVy5c3DWow9x1MikiYeZc=; b=GhlPr9XD9DnyMkWpTsv2qi3rSGt1BfEV2SiSrQmUdiyQnTjpzm7HR9JSS1cGZWP+L9 64NRa5VIRODXOi+eGdum3WYP959fcFLz7V94Ii+9+echZGMiM7B3S5BVBT2e+969I2ZY nJep2WBDgTKJrMTBSQPnSGS0UmAdmRv4R+jeyZape5aF7PcPw4kM6idUrkf9CciGJKq0 T2QRbphnJZAENTGHpl3LdMvAYsiozSkjJFhk3EubSo2HAcYGKohyv86ziH20kQhswTKO jVRqegdx+dhTq2w5ciDXLMGjxZ28ar4z4dax24hJL+t65jXUACxMZLR+pNORL0vGKuAU JgnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702467619; x=1703072419; h=content-transfer-encoding:mime-version: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=pkeEHXB3/T/jnmWhl5vUXIuVy5c3DWow9x1MikiYeZc=; b=DIfuVv1/xsOA2WzntPt4eTep/e9lEBO/pKEbGRSJW59ZPy4DKKKhtEXUbJD/tq5YUV uBzIK7Lgtjlvbdhw30qUFULCaoDf0Blpd3liMOruxEXHQo9Bp2eawgdvAqYKBjeWTQXs elEdMG/mHgVl95MY1WfKNBBh0YA2dGBb4Eo29wq2oso4Eb8n/LiRSAAQD5EElemW+8Yt ALCeNUsOPFWi8tdvdKD4n0q4zJxffPfKDKpx1QkGJtiVvy6/3sIaMWKbygXeT6Tyc/ys f+et2NH4f1us1/+MzGhHNtDHAlW48ofip5cUMcdXo6oQIMeapJ6Zv8+mHgNXsUNCQU6a uTWw== X-Gm-Message-State: AOJu0YwDB1C3Tah6Sgw6GS5czh8hSqhOoiUXxGIfh9RaokXuF2zW787+ n/HxQ5+1h3rRt2CnCJOK3VRwTQ== X-Google-Smtp-Source: AGHT+IEtRpE9piN/TcHjX3rZFm4N555Til6W/9RSMkR3uib8RAC7Oaqpe1Y4KsVWjCzLTxENloKduA== X-Received: by 2002:a17:902:8696:b0:1d0:6ffe:9f0 with SMTP id g22-20020a170902869600b001d06ffe09f0mr7464532plo.78.1702467618911; Wed, 13 Dec 2023 03:40:18 -0800 (PST) Received: from localhost.localdomain ([101.78.151.194]) by smtp.gmail.com with ESMTPSA id t1-20020a170902b20100b001bb9d6b1baasm10331066plr.198.2023.12.13.03.40.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 03:40:18 -0800 (PST) From: Rui Zhou To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, perex@perex.cz, tiwai@suse.com, trevor.wu@mediatek.com, allen-kh.cheng@mediatek.com, kuninori.morimoto.gx@renesas.com Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Rui Zhou Subject: [RESEND PATCH v9 4/4] ASoC: mediatek: mt8188-mt6359: Enable dual amp for mt8188-rt5682s Date: Wed, 13 Dec 2023 19:39:55 +0800 Message-Id: <20231213113955.47668-5-zhourui@huaqin.corp-partner.google.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231213113955.47668-1-zhourui@huaqin.corp-partner.google.com> References: <20231213113955.47668-1-zhourui@huaqin.corp-partner.google.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Enable support for dual MAX98390 amplifiers on the mt8188-rt5682s board. Reviewed-by: Trevor Wu Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Rui Zhou --- sound/soc/mediatek/mt8188/mt8188-mt6359.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/mediatek/mt8188/mt8188-mt6359.c b/sound/soc/mediatek/mt8188/mt8188-mt6359.c index d1884f23a1a7..a391066ab204 100644 --- a/sound/soc/mediatek/mt8188/mt8188-mt6359.c +++ b/sound/soc/mediatek/mt8188/mt8188-mt6359.c @@ -1448,7 +1448,7 @@ static struct mt8188_card_data mt8188_nau8825_card = { static struct mt8188_card_data mt8188_rt5682s_card = { .name = "mt8188_rt5682s", - .quirk = RT5682S_HS_PRESENT, + .quirk = RT5682S_HS_PRESENT | MAX98390_TWO_AMP, }; static struct mt8188_card_data mt8188_es8326_card = {