Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp486359imu; Fri, 7 Dec 2018 04:24:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/XDWd/xMvQuGdc+6+Tfov4faN6Aq5l0NQzpnBuiGJOAUV00BGLBRn/H4SQtysjIhsTmZSB+ X-Received: by 2002:a63:a552:: with SMTP id r18mr1781162pgu.176.1544185455774; Fri, 07 Dec 2018 04:24:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544185455; cv=none; d=google.com; s=arc-20160816; b=ozNq2CCPjnf9d93MizvVgzmYMPXKD3NfbEEti3TRDzuZ3RfmM2Rlmzo2hTBkfuE5bB jYHrFYgmryYG7DspHYfmvCciLbKpIAPs+90LjxM3oowb1kEsdCTWTBzRpTPjnov4SwVr ylpY2xgt/YqiaU7XLkw09fdqHGYQ9RzlqZB/WG+HUY7ixueuOcZ4F7CyXrcvSx3/d29w FoLbVQvfDHSxAMDNAWtsPP+jRrv0ND6cOhptV5attdOpYnvJOwd2XiHf3xDsxoqx9p4i t99bpMXHHe8H1EffkBf+j1Ff4NBhCIbiKQEDE49Zh0fM8INaAKAf2Rc+3B+WmM32HL5n qg/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature; bh=f7d5HdNpj+zhLYgq6cTrQvOtXR/IkWHrW8LsVTTFNgY=; b=O0A5IZwbS2cjZKV4ZWEWVJWO8MQMUfAD8y2eaEn4n0PGSkDyho4IPQFvbmdPMgUnjL WWw7n71lOrxNLBYg9asrFe2pbdxaJAVBw600jzO/P8tKyMHtLFZFb2oVs9IXxvBYdj1J Wo1eNxMLMB+zAQ05S/IgrSiZ0wIAsKv+pn9/UqCbyvjOrWUrDflN2nSH8Rmjt7KDjTvR SyPjBoGPgE4n2NXj4vwr3+LgjuuWmnNntYXMM4F+lTQCpmtq2YkxCiy5kq5danZEcqL8 NatjyRB/+C6XjY2hZ+vWfYzqAPSFpe378pLoYk7fLsIUbHfT2HFj+HdhvvrHz8K1v2zG SOsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b="Ogr/SRvK"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 39si2801126pla.352.2018.12.07.04.24.00; Fri, 07 Dec 2018 04:24:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b="Ogr/SRvK"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726077AbeLGMXX (ORCPT + 99 others); Fri, 7 Dec 2018 07:23:23 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:33252 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbeLGMXX (ORCPT ); Fri, 7 Dec 2018 07:23:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender: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:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=f7d5HdNpj+zhLYgq6cTrQvOtXR/IkWHrW8LsVTTFNgY=; b=Ogr/SRvKtZJ0 5FSk9N/QLjsiDMUZ5OF+bCdc7GMWk5ZTXS3OVoYcmzJDepGsKMmUwcritkeAcV3YfFavP2XAV4Rzu HCZVxbKFgF1cxEbJm8OnqNTeLgu/ooCfwGyP2nX1atj5HaVHKiU5DlRqw0B7na+CCda+NQW5dLIoC xj/NY=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=debutante.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpa (Exim 4.89) (envelope-from ) id 1gVFA6-0003YG-LQ; Fri, 07 Dec 2018 12:23:18 +0000 Received: by debutante.sirena.org.uk (Postfix, from userid 1000) id 5788111253E4; Fri, 7 Dec 2018 12:23:18 +0000 (GMT) From: Mark Brown To: Cheng-Yi Chiang Cc: Srinivas Kandagatla , Mark Brown , linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, tzungbi@chromium.org, Mark Brown , Rohit kumar , dgreid@chromium.org, alsa-devel@alsa-project.org Subject: Applied "ASoC: sdm845: Add TDM configuration for speaker" to the asoc tree In-Reply-To: <20181128090037.257359-3-cychiang@chromium.org> X-Patchwork-Hint: ignore Message-Id: <20181207122318.5788111253E4@debutante.sirena.org.uk> Date: Fri, 7 Dec 2018 12:23:18 +0000 (GMT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch ASoC: sdm845: Add TDM configuration for speaker has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 09b382007aa54dbe2cc142ef78d69b9a7645fcd6 Mon Sep 17 00:00:00 2001 From: Cheng-Yi Chiang Date: Wed, 28 Nov 2018 17:00:35 +0800 Subject: [PATCH] ASoC: sdm845: Add TDM configuration for speaker Set TDM time slots and DAI format for speaker codec. Signed-off-by: Cheng-Yi Chiang Acked-by: Srinivas Kandagatla Signed-off-by: Mark Brown --- sound/soc/qcom/sdm845.c | 69 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/sound/soc/qcom/sdm845.c b/sound/soc/qcom/sdm845.c index 43c03f8e8cdc..d0df7ec6042e 100644 --- a/sound/soc/qcom/sdm845.c +++ b/sound/soc/qcom/sdm845.c @@ -6,9 +6,11 @@ #include #include #include +#include #include #include #include +#include #include #include "common.h" #include "qdsp6/q6afe.h" @@ -17,6 +19,10 @@ #define DEFAULT_MCLK_RATE 24576000 #define TDM_BCLK_RATE 6144000 #define MI2S_BCLK_RATE 1536000 +#define LEFT_SPK_TDM_TX_MASK 0x30 +#define RIGHT_SPK_TDM_TX_MASK 0xC0 +#define SPK_TDM_RX_MASK 0x03 +#define NUM_TDM_SLOTS 8 struct sdm845_snd_data { struct snd_soc_jack jack; @@ -34,7 +40,7 @@ static int sdm845_tdm_snd_hw_params(struct snd_pcm_substream *substream, { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; - int ret = 0; + int ret = 0, j; int channels, slot_width; switch (params_format(params)) { @@ -81,6 +87,35 @@ static int sdm845_tdm_snd_hw_params(struct snd_pcm_substream *substream, goto end; } } + + for (j = 0; j < rtd->num_codecs; j++) { + struct snd_soc_dai *codec_dai = rtd->codec_dais[j]; + + if (!strcmp(codec_dai->component->name_prefix, "Left")) { + ret = snd_soc_dai_set_tdm_slot( + codec_dai, LEFT_SPK_TDM_TX_MASK, + SPK_TDM_RX_MASK, NUM_TDM_SLOTS, + slot_width); + if (ret < 0) { + dev_err(rtd->dev, + "DEV0 TDM slot err:%d\n", ret); + return ret; + } + } + + if (!strcmp(codec_dai->component->name_prefix, "Right")) { + ret = snd_soc_dai_set_tdm_slot( + codec_dai, RIGHT_SPK_TDM_TX_MASK, + SPK_TDM_RX_MASK, NUM_TDM_SLOTS, + slot_width); + if (ret < 0) { + dev_err(rtd->dev, + "DEV1 TDM slot err:%d\n", ret); + return ret; + } + } + } + end: return ret; } @@ -155,10 +190,14 @@ static int sdm845_dai_init(struct snd_soc_pcm_runtime *rtd) static int sdm845_snd_startup(struct snd_pcm_substream *substream) { unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS; + unsigned int codec_dai_fmt = SND_SOC_DAIFMT_CBS_CFS; struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_card *card = rtd->card; struct sdm845_snd_data *data = snd_soc_card_get_drvdata(card); struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + int j; + int ret; switch (cpu_dai->id) { case PRIMARY_MI2S_RX: @@ -190,6 +229,34 @@ static int sdm845_snd_startup(struct snd_pcm_substream *substream) Q6AFE_LPASS_CLK_ID_QUAD_TDM_IBIT, TDM_BCLK_RATE, SNDRV_PCM_STREAM_PLAYBACK); } + + codec_dai_fmt |= SND_SOC_DAIFMT_IB_NF | SND_SOC_DAIFMT_DSP_B; + + for (j = 0; j < rtd->num_codecs; j++) { + codec_dai = rtd->codec_dais[j]; + + if (!strcmp(codec_dai->component->name_prefix, + "Left")) { + ret = snd_soc_dai_set_fmt( + codec_dai, codec_dai_fmt); + if (ret < 0) { + dev_err(rtd->dev, + "Left TDM fmt err:%d\n", ret); + return ret; + } + } + + if (!strcmp(codec_dai->component->name_prefix, + "Right")) { + ret = snd_soc_dai_set_fmt( + codec_dai, codec_dai_fmt); + if (ret < 0) { + dev_err(rtd->dev, + "Right TDM slot err:%d\n", ret); + return ret; + } + } + } break; default: -- 2.19.0.rc2