From patchwork Fri Oct 24 23:48:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 5150791 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EFFF19F374 for ; Fri, 24 Oct 2014 23:50:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2E4C32026F for ; Fri, 24 Oct 2014 23:50:20 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id EAACC2025B for ; Fri, 24 Oct 2014 23:50:18 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 16900260659; Sat, 25 Oct 2014 01:50:18 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 7A28D2605E2; Sat, 25 Oct 2014 01:48:44 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3E6A72605CF; Sat, 25 Oct 2014 01:48:39 +0200 (CEST) Received: from mail-pd0-f169.google.com (mail-pd0-f169.google.com [209.85.192.169]) by alsa0.perex.cz (Postfix) with ESMTP id D607D2605B4 for ; Sat, 25 Oct 2014 01:48:27 +0200 (CEST) Received: by mail-pd0-f169.google.com with SMTP id w10so2287098pde.28 for ; Fri, 24 Oct 2014 16:48:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=KamdkgdkT/W031Myp5YxyM6PBnU0XYlrb/xLGFjJ44M=; b=L26igzNDXE6SFNLaTORn9Z8jZm7h0RNkosOPdwAjNM2vlpCNmTxycrLcQSlb0sU/Xm ALuoIYvrtz9Ztl75zK83FOiEiQt4IncbKgXCXNFgXh3vq7HKGmKEUnnS/VofGXVjW3O/ fu3mfRh3sqKPYP30YxWbHUNi5iwSl0/Geiu6OcR2lKg+OQQ1tV7RHHRR7jCRxlMo/ZJI oYCliPXRpfsB0+lSGT5G+TJzBcRyqaZrbQEsyRIP5nP6DjL17M7RiWW18cbHLpLaL6Xk jqIT6XMYwi63EO08FwHEJatZ+S5XRB6A40RDAubvKPz/xJq4FW/YE4ov8p7/s39XbGzb xt9A== X-Received: by 10.68.206.98 with SMTP id ln2mr7674433pbc.83.1414194506783; Fri, 24 Oct 2014 16:48:26 -0700 (PDT) Received: from Alpha.attlocal.net (99-189-113-45.lightspeed.sntcca.sbcglobal.net. [99.189.113.45]) by mx.google.com with ESMTPSA id pc8sm4790799pbc.10.2014.10.24.16.48.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Oct 2014 16:48:26 -0700 (PDT) From: Nicolin Chen To: broonie@kernel.org, b02247@freescale.com Date: Fri, 24 Oct 2014 16:48:13 -0700 Message-Id: <3c45318a95056000736874fe7cc0a26922b742e1.1414193668.git.nicoleotsuka@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: Cc: alsa-devel@alsa-project.org, timur@tabi.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, Li.Xiubo@freescale.com, linuxppc-dev@lists.ozlabs.org Subject: [alsa-devel] [PATCH 2/2] ASoC: fsl-asoc-card: Add slot_width setting for cpu-dai X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP ESAI may need to use fixed slot width to comply with external CODEC. So this set_tdm_slot() call will allow the ESAI driver to override its default dynamic slot width policy. Signed-off-by: Nicolin Chen --- sound/soc/fsl/fsl-asoc-card.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 14572e6..3f6959c 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -51,6 +51,7 @@ struct codec_priv { * @sysclk_freq[2]: SYSCLK rates for set_sysclk() * @sysclk_dir[2]: SYSCLK directions for set_sysclk() * @sysclk_id[2]: SYSCLK ids for set_sysclk() + * @slot_width: Slot width of each frame * * Note: [1] for tx and [0] for rx */ @@ -58,6 +59,7 @@ struct cpu_priv { unsigned long sysclk_freq[2]; u32 sysclk_dir[2]; u32 sysclk_id[2]; + u32 slot_width; }; /** @@ -142,6 +144,15 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream, return ret; } + if (cpu_priv->slot_width) { + ret = snd_soc_dai_set_tdm_slot(rtd->cpu_dai, 0x3, 0x3, 2, + cpu_priv->slot_width); + if (ret) { + dev_err(dev, "failed to set TDM slot for cpu dai\n"); + return ret; + } + } + return 0; } @@ -453,6 +464,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) priv->cpu_priv.sysclk_freq[RX] = priv->codec_priv.mclk_freq; priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_OUT; priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_OUT; + priv->cpu_priv.slot_width = 32; priv->dai_fmt |= SND_SOC_DAIFMT_CBS_CFS; } else if (of_device_is_compatible(np, "fsl,imx-audio-sgtl5000")) { priv->codec_priv.mclk_id = SGTL5000_SYSCLK;