Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp11154581imu; Thu, 6 Dec 2018 12:27:19 -0800 (PST) X-Google-Smtp-Source: AFSGD/WIbQNy4CmCLJ+rUCcmKZc46L4hoWZGK7i7yK72P8esVVetGkKZFEULH6RlMmIUy62bvN8x X-Received: by 2002:a17:902:1105:: with SMTP id d5mr28454500pla.47.1544128039138; Thu, 06 Dec 2018 12:27:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544128039; cv=none; d=google.com; s=arc-20160816; b=ORpNtkwODtNRsbeXVCYI4oFLda0zDhvJTaMHD9qC2g7tvrVqVGTYahquhIvj2MmGY3 Qu5YQFJ4W1+CxXXcdIKrPB7bPjKf0EcQaoBwZpC1dg9wp7qozbD8SvChsK8MohoFthTA WTCMNqGue0He13v0S9VCI8aOOgdRBsB4xuZnEnVyAFoQED12EbAoMZpPm/gyTZ2q/3KU vmh0KqLy1QsXbFXsvvprYY/RpAkCxpK6n5+5tLr8cci8Ivl2gSQLHintviojnyFjdsl1 tXQEMwPUqbpcmEdopq6vXWbN66IGsR++Ol3i4ozzMXTxK1pJWcD0PiY9+d9kBrvM8v0f q0cA== 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=Xa+zrjGuS+IaLsvruXe4XrE+H99vY0ypP+12/NiRJQw=; b=Zd/mx3lenfv2Aun2nYOcVN5QaRqJRzyIw0vpEmgOukRhgGY/vAOwOZ2yZ+FAMGCQBf iX1lS4oBzwp/nzx0ufsw05ND2X5kHzfAg8kciqu3wgLn0R12i9GATjQ//ecBvPnyAe35 wPpHRio3BWQO+94qxofd2U3gfPPIc8DkT/6dD4IuH/V+5MEaj4ljysS6XmF/WtFsXJVf 9jIReK2gh7Wgqp3PpOMKzlM0d7306sYH4OUYMPNA/bG8ZJZSmd7Dd9x2nebR9nqEaCZy P8o7IJYV43m5FnHJAwjcUaEYw8uSwC5dOQvXsUyp7casLcjuXstOiVNINvlw3HKhdpm+ aXZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=LpDvN9Cp; 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 m75si988228pga.432.2018.12.06.12.27.03; Thu, 06 Dec 2018 12:27:19 -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=LpDvN9Cp; 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 S1726073AbeLFUZv (ORCPT + 99 others); Thu, 6 Dec 2018 15:25:51 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:36220 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725950AbeLFUZt (ORCPT ); Thu, 6 Dec 2018 15:25:49 -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=Xa+zrjGuS+IaLsvruXe4XrE+H99vY0ypP+12/NiRJQw=; b=LpDvN9CpCOP+ l2iFgBolvInL1G3tLIa3XEWdkY4u5Q07mB5vG7Wr/qAo1hTKEaZ+/2rwjKloXezzbPqG7Xbh1r85G 0KIVKk6ksn5huCqafn+OGhzqsuz2OpeB2Zeo3VdQ+OjotOhjya96jzO91am2VBq8gvtnv5gdBY5MN rhn1g=; 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 1gV0DQ-0001g8-F6; Thu, 06 Dec 2018 20:25:44 +0000 Received: by debutante.sirena.org.uk (Postfix, from userid 1000) id 2AF2111252F7; Thu, 6 Dec 2018 20:25:44 +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: <20181206202544.2AF2111252F7@debutante.sirena.org.uk> Date: Thu, 6 Dec 2018 20:25:44 +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 1d92332180659fab7d014eff5e0ab5e133424e3e 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