Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp332645pxb; Wed, 18 Aug 2021 03:35:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvD79jiIm5CT4eaXAGxhyopd2nfMxm4ThRJjS7XXPXM849SDWC09xWq0+ejZSrCqPoyZYh X-Received: by 2002:a02:a50d:: with SMTP id e13mr7267590jam.124.1629282912383; Wed, 18 Aug 2021 03:35:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629282912; cv=none; d=google.com; s=arc-20160816; b=TVnmpiDF+4rFtKfLCBC8RV2R/INYt3zJW5hcGf/tQKTN+Zhi5LVJx+HX2SNc9M6L9+ Sndcw5Stzp94uMWXadZo6V0uTt2R2xYBNlnEaVHReDVPBneL9z9MVHF8QO1WWLBrGIQp fH+Rfmx8SVsw6s53ZqbrDGypG2DBKwC5w/t/XXrbcIMKhjFPoCqPmcCqWc1eriJir7gV uv+iI7T8cxFCYN1BcSjdLOnVALYrHxkHYmfk4Aizmhpmskg9m8naMfboyhucXnqQ28JE nK+MidfkCZw4xI+S0aILwAEx3uoJXbXv5WL5kbU8Z5FTALv4mE6Ct6JuXwV4PEIllHRR ke9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=zf9QdTkoSVfxm60qQscLYWAixTB4nwTNweRHu++5jAk=; b=KnIoXAkNdpudrogzIY2zgrbend7c46aXDnFrjDMs3mcKj1A4pb7HkzEf+VoNRroJyi 5U0q0l8olGf6hWdtka8xr/m7b12ALZd+VFZ1us7bpBSox+ES7sutZ16xqwHH65qan8M6 /qyzkm5NOxjX/r7S1PtRclyeY9YDi0rO8jZUCLrGs6B7f6klndEKYLzjCttsA72bTHWG tIfxmdnYqFF0L/z6iszEjOvAT84I268YQT1UZenRsb1WJWPTDZHEckNlNedAgWv5D5/Z nYPof4BaxAlTw+pyNHQWy7QkulBeZY9jrxhQ3iQ5vm65hvw1eibj/Ma6xuZhPEpxrIKN ppUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p17si5294494jak.93.2021.08.18.03.35.01; Wed, 18 Aug 2021 03:35:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234645AbhHRKej (ORCPT + 99 others); Wed, 18 Aug 2021 06:34:39 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:49620 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S234477AbhHRKdD (ORCPT ); Wed, 18 Aug 2021 06:33:03 -0400 X-UUID: 92ee899d91504b73bcdf5351bc6d0ec0-20210818 X-UUID: 92ee899d91504b73bcdf5351bc6d0ec0-20210818 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1060562664; Wed, 18 Aug 2021 18:32:24 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs05n2.mediatek.inc (172.21.101.140) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 18 Aug 2021 18:32:23 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 18 Aug 2021 18:32:23 +0800 From: Trevor Wu To: , , , , CC: , , , , , , , , , , Subject: [PATCH v4 10/11] ASoC: mediatek: mt8195: add HDMITX audio support Date: Wed, 18 Aug 2021 18:32:14 +0800 Message-ID: <20210818103215.9186-11-trevor.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210818103215.9186-1-trevor.wu@mediatek.com> References: <20210818103215.9186-1-trevor.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds HDMITX audio support on mt8195-mt6359-rt1019-rt5682 board. Signed-off-by: Trevor Wu --- .../mt8195/mt8195-mt6359-rt1019-rt5682.c | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c index d853bc445753..e4472bbc9f01 100644 --- a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +++ b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c @@ -28,6 +28,7 @@ struct mt8195_mt6359_rt1019_rt5682_priv { struct snd_soc_jack headset_jack; struct snd_soc_jack dp_jack; + struct snd_soc_jack hdmi_jack; }; static const struct snd_soc_dapm_widget @@ -407,6 +408,22 @@ static int mt8195_dptx_codec_init(struct snd_soc_pcm_runtime *rtd) return snd_soc_component_set_jack(cmpnt_codec, &priv->dp_jack, NULL); } +static int mt8195_hdmi_codec_init(struct snd_soc_pcm_runtime *rtd) +{ + struct mt8195_mt6359_rt1019_rt5682_priv *priv = + snd_soc_card_get_drvdata(rtd->card); + struct snd_soc_component *cmpnt_codec = + asoc_rtd_to_codec(rtd, 0)->component; + int ret = 0; + + ret = snd_soc_card_jack_new(rtd->card, "HDMI Jack", SND_JACK_LINEOUT, + &priv->hdmi_jack, NULL, 0); + if (ret) + return ret; + + return snd_soc_component_set_jack(cmpnt_codec, &priv->hdmi_jack, NULL); +} + static int mt8195_hdmitx_dptx_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) @@ -936,6 +953,7 @@ static struct snd_soc_dai_link mt8195_mt6359_rt1019_rt5682_dai_links[] = { SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, .dpcm_playback = 1, + .be_hw_params_fixup = mt8195_hdmitx_dptx_hw_params_fixup, SND_SOC_DAILINK_REG(ETDM3_OUT_BE), }, [DAI_LINK_PCM1_BE] = { @@ -1008,6 +1026,26 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev) dai_link->codecs->dai_name = "i2s-hifi"; dai_link->init = mt8195_dptx_codec_init; } + + if (strcmp(dai_link->name, "ETDM3_OUT_BE") == 0) { +#if IS_ENABLED(CONFIG_SND_SOC_SOF_MT8195) + dai_link->codecs->of_node = + of_parse_phandle(machine_node, + "mediatek,hdmi-codec", 0); +#else + dai_link->codecs->of_node = + of_parse_phandle(pdev->dev.of_node, + "mediatek,hdmi-codec", 0); +#endif + if (!dai_link->codecs->of_node) { + dev_err(&pdev->dev, "Property 'hdmi-codec' missing or invalid\n"); + return -EINVAL; + } + + dai_link->codecs->name = NULL; + dai_link->codecs->dai_name = "i2s-hifi"; + dai_link->init = mt8195_hdmi_codec_init; + } } priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); -- 2.18.0