Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp952738pxu; Thu, 26 Nov 2020 17:16:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyp7RlvKr4AaP25XVftlRgnpNuebCsj4DljZbr3XuMBCPEfznTgtePTEQEwkGbHFDNQQovs X-Received: by 2002:aa7:db4e:: with SMTP id n14mr1106148edt.222.1606439798032; Thu, 26 Nov 2020 17:16:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606439798; cv=none; d=google.com; s=arc-20160816; b=JijUMI+taXmL6djhHIAUqzKxImjP+VD8uYAFIOmayvmOuLidbhu2LwMvaDf10fbb/8 xLMDbsS4DNyvFf38icyyJkputw5LMKy0ElSjMVm5fRxQWhKsZbu4/poLCN4QeitgghWJ Dyhbckn/s1vVx/TbWrFhUlWqnvofgEgaegR65hLDzMzBjV5p9SK62E60U+MkmIfFjZCd Pn7pkAf0ejBHwBPoLg/qCwERWF/CQ4Qss9PoKHa774DshumN9znyyctS0+Erbm2z367H /JEsSIBJu6XtDlsrb6Uzw2OmebiQXYwraMt8lIpxEENzwnqVv66Q2O19EdzxsaI3N8/L ptUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:to:from; bh=xDfbzQOlVKSXdAdlBgkmefX2IxOxhc86yCeD3PEVL2I=; b=A24FcaetQeqOpVnFHGwqjPbifaJBNRtuePXxVSzPNeVLuderl0QuL6k9ob4vimF9X3 tdCpgGCboEIpN+gsHDeWgIjhvUkgMOcn4VkQcvlJFkQ5Ywt301J7GK2pCbEAe/8cFA8X S6aTSXfiglSi0Tdy9AtKkaO1o31iKCQHNPjQZoiHhELNWSUjYwTZb6FUZdW3j/Ep2hOP 9gntY/k/Um9+GyBrveBdRC1rZHFjLLh3o/60vMuqh2akg2VFef4LKADIffM6Py/TwbMk R5aLFC+3bKxXlzgQlWaqGOdqHvolXKkNVisLgTy0x37n8YsjZwltM2KR8zD0TMEqYOO5 dRUA== 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=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si4055324eju.23.2020.11.26.17.15.10; Thu, 26 Nov 2020 17:16:38 -0800 (PST) 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=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727441AbgKZGoE (ORCPT + 99 others); Thu, 26 Nov 2020 01:44:04 -0500 Received: from inva020.nxp.com ([92.121.34.13]:37772 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726287AbgKZGoD (ORCPT ); Thu, 26 Nov 2020 01:44:03 -0500 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id C07C41A0A7A; Thu, 26 Nov 2020 07:44:01 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id B06021A0A76; Thu, 26 Nov 2020 07:43:56 +0100 (CET) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 74756402EB; Thu, 26 Nov 2020 07:43:50 +0100 (CET) From: Shengjiu Wang To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, cychiang@chromium.org, kuninori.morimoto.gx@renesas.com, tzungbi@google.com, shengjiu.wang@nxp.com, grandmaster@al2klimov.de, jbrunet@baylibre.com, pankaj.laxminarayan.bharadiya@intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: hdmi-codec: Add RX support Date: Thu, 26 Nov 2020 14:36:48 +0800 Message-Id: <1606372608-2329-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org HDMI interface can also be used as receiver, this patch is to add such support. The most difference compare with TX is that RX don't need to get edid information. Signed-off-by: Shengjiu Wang --- sound/soc/codecs/hdmi-codec.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index e8410b2433de..d5fcc4db8284 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -282,6 +282,7 @@ struct hdmi_codec_priv { static const struct snd_soc_dapm_widget hdmi_widgets[] = { SND_SOC_DAPM_OUTPUT("TX"), + SND_SOC_DAPM_OUTPUT("RX"), }; enum { @@ -389,6 +390,7 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); + bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; int ret = 0; mutex_lock(&hcp->lock); @@ -404,7 +406,7 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, goto err; } - if (hcp->hcd.ops->get_eld) { + if (tx && hcp->hcd.ops->get_eld) { ret = hcp->hcd.ops->get_eld(dai->dev->parent, hcp->hcd.data, hcp->eld, sizeof(hcp->eld)); if (ret) @@ -660,14 +662,20 @@ static int hdmi_dai_probe(struct snd_soc_dai *dai) { struct snd_soc_dapm_context *dapm; struct hdmi_codec_daifmt *daifmt; - struct snd_soc_dapm_route route = { - .sink = "TX", - .source = dai->driver->playback.stream_name, + struct snd_soc_dapm_route route[] = { + { + .sink = "TX", + .source = dai->driver->playback.stream_name, + }, + { + .sink = dai->driver->capture.stream_name, + .source = "RX", + }, }; int ret; dapm = snd_soc_component_get_dapm(dai->component); - ret = snd_soc_dapm_add_routes(dapm, &route, 1); + ret = snd_soc_dapm_add_routes(dapm, route, 2); if (ret) return ret; @@ -757,6 +765,14 @@ static const struct snd_soc_dai_driver hdmi_i2s_dai = { .formats = I2S_FORMATS, .sig_bits = 24, }, + .capture = { + .stream_name = "Capture", + .channels_min = 2, + .channels_max = 8, + .rates = HDMI_RATES, + .formats = I2S_FORMATS, + .sig_bits = 24, + }, .ops = &hdmi_codec_i2s_dai_ops, .pcm_new = hdmi_codec_pcm_new, }; @@ -773,6 +789,13 @@ static const struct snd_soc_dai_driver hdmi_spdif_dai = { .rates = HDMI_RATES, .formats = SPDIF_FORMATS, }, + .capture = { + .stream_name = "Capture", + .channels_min = 2, + .channels_max = 2, + .rates = HDMI_RATES, + .formats = SPDIF_FORMATS, + }, .ops = &hdmi_codec_spdif_dai_ops, .pcm_new = hdmi_codec_pcm_new, }; -- 2.27.0