From patchwork Wed May 5 16:36:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 431682 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90704C433ED for ; Wed, 5 May 2021 16:47:21 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B67C36141B for ; Wed, 5 May 2021 16:47:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B67C36141B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id EB012175E; Wed, 5 May 2021 18:46:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EB012175E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1620233239; bh=Y2VUWYraSN5FyUcYUeBh1M7kKcw5J7BRqrpQwrz/wn0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=BkSERvlfITnFlN8YjZMJzGsZnt+wYCcjFFTBM0BMMzsHeThfZ++XBEQzbHIFAIqug MonxV3bvvCUt+4msD7EkYRQx+5MhPaw8Zidd24d9JA0P5Gi3tcuFyVilRTBOlI88pN YkLY7PSfZaY4rALkrhxmf6jUmkum+N/mnyd5tei4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 17D99F805B2; Wed, 5 May 2021 18:37:34 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E4055F805A0; Wed, 5 May 2021 18:37:32 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6732DF805A0 for ; Wed, 5 May 2021 18:37:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6732DF805A0 IronPort-SDR: Dwb2N2JMRrDRgDRsYwKAjORcBo+2ND5wbt+yz7d+G/FIqRQg7ALjp8L0GqjbASIO8t1ykrrALI MV31P0ukc3Zg== X-IronPort-AV: E=McAfee;i="6200,9189,9975"; a="196219157" X-IronPort-AV: E=Sophos;i="5.82,276,1613462400"; d="scan'208";a="196219157" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2021 09:37:18 -0700 IronPort-SDR: xbD4sgDqYlh9Q7gHQOt0eyFYfK1U6Fc3563Wq9FR6QT8HQUV+9ir+gX0C+s8A1qrIVZY6J+2qn OJqKp+2poykg== X-IronPort-AV: E=Sophos;i="5.82,276,1613462400"; d="scan'208";a="458800002" Received: from rtsagpan-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.51.38]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2021 09:37:17 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 01/13] ASoC: Intel: Boards: tgl_max98373: Add BT offload support Date: Wed, 5 May 2021 11:36:53 -0500 Message-Id: <20210505163705.305616-2-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210505163705.305616-1-pierre-louis.bossart@linux.intel.com> References: <20210505163705.305616-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: tiwai@suse.de, broonie@kernel.org, Pierre-Louis Bossart , Kai Vehmanen , Yong Zhi X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Yong Zhi BT audio offload is internally configured with virtual GPIOs, the port assignment is fixed on SSP2 for TGL/ADL platforms. Reviewed-by: Kai Vehmanen Signed-off-by: Yong Zhi Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_rt5682.c | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c index 58548ea0d915..5e8f1022a21a 100644 --- a/sound/soc/intel/boards/sof_rt5682.c +++ b/sound/soc/intel/boards/sof_rt5682.c @@ -50,6 +50,13 @@ #define SOF_MAX98373_SPEAKER_AMP_PRESENT BIT(17) #define SOF_MAX98360A_SPEAKER_AMP_PRESENT BIT(18) +/* BT audio offload: reserve 3 bits for future */ +#define SOF_BT_OFFLOAD_SSP_SHIFT 19 +#define SOF_BT_OFFLOAD_SSP_MASK (GENMASK(21, 19)) +#define SOF_BT_OFFLOAD_SSP(quirk) \ + (((quirk) << SOF_BT_OFFLOAD_SSP_SHIFT) & SOF_BT_OFFLOAD_SSP_MASK) +#define SOF_SSP_BT_OFFLOAD_PRESENT BIT(22) + /* Default: MCLK on, MCLK 19.2M, SSP0 */ static unsigned long sof_rt5682_quirk = SOF_RT5682_MCLK_EN | SOF_RT5682_SSP_CODEC(0); @@ -591,6 +598,13 @@ static struct snd_soc_dai_link_component rt1015_components[] = { }, }; +static struct snd_soc_dai_link_component dummy_component[] = { + { + .name = "snd-soc-dummy", + .dai_name = "snd-soc-dummy-dai", + } +}; + static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, int ssp_codec, int ssp_amp, @@ -780,6 +794,31 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, if (!links[id].cpus->dai_name) goto devm_err; } + id++; + } + + /* BT audio offload */ + if (sof_rt5682_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) { + int port = (sof_rt5682_quirk & SOF_BT_OFFLOAD_SSP_MASK) >> + SOF_BT_OFFLOAD_SSP_SHIFT; + + links[id].id = id; + links[id].cpus = &cpus[id]; + links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, + "SSP%d Pin", port); + if (!links[id].cpus->dai_name) + goto devm_err; + links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port); + if (!links[id].name) + goto devm_err; + links[id].codecs = dummy_component; + links[id].num_codecs = ARRAY_SIZE(dummy_component); + links[id].platforms = platform_component; + links[id].num_platforms = ARRAY_SIZE(platform_component); + links[id].dpcm_playback = 1; + links[id].dpcm_capture = 1; + links[id].no_pcm = 1; + links[id].num_cpus = 1; } return links; @@ -869,6 +908,9 @@ static int sof_audio_probe(struct platform_device *pdev) else if (sof_rt5682_quirk & SOF_RT1015P_SPEAKER_AMP_PRESENT) sof_rt1015p_codec_conf(&sof_audio_card_rt5682); + if (sof_rt5682_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) + sof_audio_card_rt5682.num_links++; + dai_links = sof_card_dai_links_create(&pdev->dev, ssp_codec, ssp_amp, dmic_be_num, hdmi_num); if (!dai_links)