From patchwork Fri Oct 24 23:48:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 5150781 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0B11EC11AC for ; Fri, 24 Oct 2014 23:49:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3D5C52026D for ; Fri, 24 Oct 2014 23:49:48 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id DB8702025B for ; Fri, 24 Oct 2014 23:49:46 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id EA5C3260638; Sat, 25 Oct 2014 01:49:45 +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 87A562605D7; Sat, 25 Oct 2014 01:48:40 +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 3DD9B2605B9; Sat, 25 Oct 2014 01:48:35 +0200 (CEST) Received: from mail-pd0-f182.google.com (mail-pd0-f182.google.com [209.85.192.182]) by alsa0.perex.cz (Postfix) with ESMTP id C6FAC2605C2 for ; Sat, 25 Oct 2014 01:48:26 +0200 (CEST) Received: by mail-pd0-f182.google.com with SMTP id y10so2287217pdj.27 for ; Fri, 24 Oct 2014 16:48:25 -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=bTLNy1xX72oS06BJeu0DD5dZtUaFwD8xi7GdouWCaaY=; b=ne9+5Bmo8202n/hbq14Hx/lneXtX72ukpMJuul4OEwSPa9x3DEHbP/VpLy+K2N22lF ZkvzY3tHm0tlX1qcVR5kZcnw1VKbbyuXfTqydLJpYX+MEclLLfVUlpsJawmeyn8u0ZDT y6K+61FaLvW/d9C3QbT5/we0I9q84rVocZQDk1eTtor1T812I9xIQqAuSrpRwCoJeNT4 lUD/ak9Gt2uJxPp/wiUMK5CVq1JzyoX8bvbYgJwps5OKptkNgCETpPALV2IHUn5FyFCx 6UO/I2FuypZtS3cvv34wYuaz8hDL82wil6A8oT1MHNaBFqWRnwyI7peD19AeP11G94yk yPDw== X-Received: by 10.68.111.161 with SMTP id ij1mr1256688pbb.10.1414194505633; Fri, 24 Oct 2014 16:48:25 -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.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Oct 2014 16:48:25 -0700 (PDT) From: Nicolin Chen To: broonie@kernel.org, b02247@freescale.com Date: Fri, 24 Oct 2014 16:48:12 -0700 Message-Id: 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 1/2] ASoC: fsl_esai: Use dynamic slot width as default 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 The driver previously used 32-bit fixed slot width as default. In result, ESAI might use 32-bit length to capture 16-bit width audio slot from CODEC side when ESAI is running as DAI slave. So this patch just removes the default slot_width so as to use dynamic slot width. If there comes a specific situation that needs a fixed width, the machine driver shall set slot_width via set_tdm_slot() so as to let the ESAI driver replace the dynamic width policy with the fixed value. Signed-off-by: Nicolin Chen --- sound/soc/fsl/fsl_esai.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c index a645e29..ca319d5 100644 --- a/sound/soc/fsl/fsl_esai.c +++ b/sound/soc/fsl/fsl_esai.c @@ -513,10 +513,15 @@ static int fsl_esai_hw_params(struct snd_pcm_substream *substream, u32 width = snd_pcm_format_width(params_format(params)); u32 channels = params_channels(params); u32 pins = DIV_ROUND_UP(channels, esai_priv->slots); + u32 slot_width = width; u32 bclk, mask, val; int ret; - bclk = params_rate(params) * esai_priv->slot_width * esai_priv->slots; + /* Override slot_width if being specifially set */ + if (esai_priv->slot_width) + slot_width = esai_priv->slot_width; + + bclk = params_rate(params) * slot_width * esai_priv->slots; ret = fsl_esai_set_bclk(dai, tx, bclk); if (ret) @@ -538,7 +543,7 @@ static int fsl_esai_hw_params(struct snd_pcm_substream *substream, regmap_update_bits(esai_priv->regmap, REG_ESAI_xFCR(tx), mask, val); mask = ESAI_xCR_xSWS_MASK | (tx ? ESAI_xCR_PADC : 0); - val = ESAI_xCR_xSWS(esai_priv->slot_width, width) | (tx ? ESAI_xCR_PADC : 0); + val = ESAI_xCR_xSWS(slot_width, width) | (tx ? ESAI_xCR_PADC : 0); regmap_update_bits(esai_priv->regmap, REG_ESAI_xCR(tx), mask, val); @@ -780,9 +785,6 @@ static int fsl_esai_probe(struct platform_device *pdev) return ret; } - /* Set a default slot size */ - esai_priv->slot_width = 32; - /* Set a default slot number */ esai_priv->slots = 2;