From patchwork Sun Jul 19 14:42:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 6821981 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6E9B29F1D4 for ; Sun, 19 Jul 2015 14:43:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 95441204DE for ; Sun, 19 Jul 2015 14:43:16 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 1CFB2200E1 for ; Sun, 19 Jul 2015 14:43:15 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id DA14D2605B8; Sun, 19 Jul 2015 16:43:12 +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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 66A38260592; Sun, 19 Jul 2015 16:43:04 +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 73E29260595; Sun, 19 Jul 2015 16:43:03 +0200 (CEST) Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by alsa0.perex.cz (Postfix) with ESMTP id 3643A260583 for ; Sun, 19 Jul 2015 16:42:56 +0200 (CEST) Received: by padck2 with SMTP id ck2so87890837pad.0 for ; Sun, 19 Jul 2015 07:42:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=Tq9PU/2TH0pb4L4kBsNPYmQTO7t5io5dNLdSVvZYY0U=; b=PiEKUuKdT0D/rbG0SHiJTQx7ww2c+AYRxbmdoo8NWZY8jc/vtXGlZf+hdokutQt6Mu 3M6s4O8r0ZTq8yYQJ7zILubb8sbRW+UwbgNKuhbf3KyG5y18fNgQRbgfM6GxRpmup27T XH2ScG7XUlcFTOiZPMRLSv00yRX7SkbLMgaJVoSyjvumNmbRNK4s0c8tR7n1FQCWyaz9 PYtp6jt27gGpalzp34x/n4k9W+XGt0NEDMeO+ReUWkfwi5UomTmUQQ7jjg1tyTvxvYuT ce2a3YOz1NODKtWWpDLhzxL2Fd/1ny3p2HVRIqljJo3yaI7b67XHhJAb92W7EmJwE3D3 gF8Q== X-Gm-Message-State: ALoCoQkfc1EQ9YSDH6WxxH+ZpMtYWoFL/zwADW1LFfPj9l5ptq9r88LXu4Wtuq/O1HvJfg4xClH7 X-Received: by 10.66.118.237 with SMTP id kp13mr49795952pab.9.1437316974752; Sun, 19 Jul 2015 07:42:54 -0700 (PDT) Received: from phoenix.local (118-171-143-53.dynamic.hinet.net. [118.171.143.53]) by smtp.gmail.com with ESMTPSA id cw3sm17092428pbc.3.2015.07.19.07.42.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Jul 2015 07:42:53 -0700 (PDT) Message-ID: <1437316969.9569.1.camel@ingics.com> From: Axel Lin To: Mark Brown Date: Sun, 19 Jul 2015 22:42:49 +0800 X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Cc: Brian Austin , alsa-devel@alsa-project.org, Liam Girdwood , Paul Handrigan , Tim Howe Subject: [alsa-devel] [PATCH] ASoC: cs4349: Fix setting digital interface format 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Mode Control - Register 02h Digital Interface Format (DIF[2:0]) Bits 6-4 DIF2 DIF1 DIF0 Description 0 0 0 Left-Justified, up to 24-bit data 0 0 1 I²S, up to 24-bit data 0 1 0 Right-Justified, 16-bit data 0 1 1 Right-Justified, 24-bit data 1 0 0 TDM slot 0 1 0 1 TDM slot 1 1 1 0 TDM slot 2 1 1 1 TDM slot 3 The DIF_MASK is 0x70, so current code does not correctly set the DIFx setting. Fix it. Signed-off-by: Axel Lin Acked-by: Tim Howe --- I assume the path "ASoC: cs4349: Don't use rtd->codec" will be applied first, so this patch is on top of that patch. sound/soc/codecs/cs4349.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/cs4349.c b/sound/soc/codecs/cs4349.c index 7f5c3c70..989289d 100644 --- a/sound/soc/codecs/cs4349.c +++ b/sound/soc/codecs/cs4349.c @@ -98,17 +98,16 @@ static int cs4349_pcm_hw_params(struct snd_pcm_substream *substream, { struct snd_soc_codec *codec = dai->codec; struct cs4349_private *cs4349 = snd_soc_codec_get_drvdata(codec); - int mode, fmt, ret; + int fmt, ret; - mode = snd_soc_read(codec, CS4349_MODE); cs4349->rate = params_rate(params); switch (cs4349->mode) { case SND_SOC_DAIFMT_I2S: - mode |= MODE_FORMAT(DIF_I2S); + fmt = DIF_I2S; break; case SND_SOC_DAIFMT_LEFT_J: - mode |= MODE_FORMAT(DIF_LEFT_JST); + fmt = DIF_LEFT_JST; break; case SND_SOC_DAIFMT_RIGHT_J: switch (params_width(params)) { @@ -121,13 +120,13 @@ static int cs4349_pcm_hw_params(struct snd_pcm_substream *substream, default: return -EINVAL; } - mode |= MODE_FORMAT(fmt); break; default: return -EINVAL; } - ret = snd_soc_write(codec, CS4349_MODE, mode); + ret = snd_soc_update_bits(codec, CS4349_MODE, DIF_MASK, + MODE_FORMAT(fmt)); if (ret < 0) return ret;