From patchwork Fri Jan 30 11:58:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filip Brozovic X-Patchwork-Id: 5749721 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5C530BF440 for ; Fri, 30 Jan 2015 12:36:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 864B420279 for ; Fri, 30 Jan 2015 12:36:22 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 6B7AF2026D for ; Fri, 30 Jan 2015 12:36:21 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 83051265146; Fri, 30 Jan 2015 13:36:20 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 298A0260580; Fri, 30 Jan 2015 13:34:47 +0100 (CET) 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 2541826046A; Fri, 30 Jan 2015 13:28:36 +0100 (CET) Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by alsa0.perex.cz (Postfix) with ESMTP id 6EC5C260431 for ; Fri, 30 Jan 2015 13:28:30 +0100 (CET) Received: by mail-wi0-f169.google.com with SMTP id h11so2604487wiw.0 for ; Fri, 30 Jan 2015 04:28:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=4PS8NIG4BPv8RwdTa6Znq05PkA7ihO7skc+ym5yav2U=; b=Qw+/6yNuoyHlsxicxyD7zzbtETtr2TyC7Givb1aIej6nz7KhdOIX4hm/Vuvu7fMvCh wyf9ta268lZt6ebNXpLRwKokFNC0bZq1rXjWQ4MHDNT+2oPgkk80KKu+XWElMikDymRv +w9SczQE/z0KNaZF+ssWWrq8IsB+VGaNyF0cEKL6eP1coG2z++WSynO7XpSb8Z6WlApi CClluFFLOzY6+Ss+l2CYv59wiEkkHhLV2mGrzoL0nYkfdpY0KiXi+veERxjmw+5cp8/I QYOuBnXrhZcJB8Ok9oHmY5qK+XdGQlgtwvfNg3hX4WOxD5gvPDVc6jDzxocytq8wxCWJ 64aA== X-Received: by 10.180.78.99 with SMTP id a3mr4393328wix.2.1422620910096; Fri, 30 Jan 2015 04:28:30 -0800 (PST) Received: from helix.int.xargs.net (46-126-221-123.dynamic.hispeed.ch. [46.126.221.123]) by mx.google.com with ESMTPSA id i13sm14720186wjr.7.2015.01.30.04.28.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Jan 2015 04:28:29 -0800 (PST) From: Filip Brozovic To: lgirdwood@gmail.com Date: Fri, 30 Jan 2015 12:58:24 +0100 Message-Id: <1422619104-6266-1-git-send-email-fbrozovic@gmail.com> X-Mailer: git-send-email 2.1.4 X-Mailman-Approved-At: Fri, 30 Jan 2015 13:34:42 +0100 Cc: alsa-devel@alsa-project.org, broonie@kernel.org, linux-kernel@vger.kernel.org, Filip Brozovic Subject: [alsa-devel] [PATCH] ASoC: sgtl5000: Use shift mask when setting codec mode 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 Shift the I2S mode value by the necessary amount before writing the registers. This makes Right Justified and PCM mode work in addition to the default Left Justified mode. Signed-off-by: Filip Brozovic --- sound/soc/codecs/sgtl5000.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 29cf7ce..7665016 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -483,21 +483,21 @@ static int sgtl5000_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) /* setting i2s data format */ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_DSP_A: - i2sctl |= SGTL5000_I2S_MODE_PCM; + i2sctl |= SGTL5000_I2S_MODE_PCM << SGTL5000_I2S_MODE_SHIFT; break; case SND_SOC_DAIFMT_DSP_B: - i2sctl |= SGTL5000_I2S_MODE_PCM; + i2sctl |= SGTL5000_I2S_MODE_PCM << SGTL5000_I2S_MODE_SHIFT; i2sctl |= SGTL5000_I2S_LRALIGN; break; case SND_SOC_DAIFMT_I2S: - i2sctl |= SGTL5000_I2S_MODE_I2S_LJ; + i2sctl |= SGTL5000_I2S_MODE_I2S_LJ << SGTL5000_I2S_MODE_SHIFT; break; case SND_SOC_DAIFMT_RIGHT_J: - i2sctl |= SGTL5000_I2S_MODE_RJ; + i2sctl |= SGTL5000_I2S_MODE_RJ << SGTL5000_I2S_MODE_SHIFT; i2sctl |= SGTL5000_I2S_LRPOL; break; case SND_SOC_DAIFMT_LEFT_J: - i2sctl |= SGTL5000_I2S_MODE_I2S_LJ; + i2sctl |= SGTL5000_I2S_MODE_I2S_LJ << SGTL5000_I2S_MODE_SHIFT; i2sctl |= SGTL5000_I2S_LRALIGN; break; default: