From patchwork Fri May 23 00:51:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 4227601 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 705DFBF90B for ; Fri, 23 May 2014 00:52:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2C17E201DD for ; Fri, 23 May 2014 00:52:13 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id EB37E201BC for ; Fri, 23 May 2014 00:52:11 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id EBBE5265640; Fri, 23 May 2014 02:52:09 +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,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id DE821265628; Fri, 23 May 2014 02:51:58 +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 591E226562E; Fri, 23 May 2014 02:51:58 +0200 (CEST) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by alsa0.perex.cz (Postfix) with ESMTP id 32D87265614 for ; Fri, 23 May 2014 02:51:50 +0200 (CEST) Received: by mail-ve0-f174.google.com with SMTP id jw12so5429230veb.19 for ; Thu, 22 May 2014 17:51:48 -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=Kuydy3s86sJcWOU9ZkU6JqkF3LphaHRihRPlZeNv3Vo=; b=g3RwpV4aUMHxsY9dKS123oU0+Su2Vjz/XKVIkZ1R18JqtGdRM+cvdfrzvv/tWxCYup KfWhTuAa1bL1r29h1eVoVe54JdI6mXlEv4gNVBwlpv9+RAQB99iMCw/aJ4nGwO68JOEt Wb2SKcKnzxPBdr6YymOaR/lJPcDKml1CKc9Yn7hvwwLu0o/gJ1C3CBgCsREQ524wBpJf 6ucwhxQq810DQQ/jyTRu/dX2UsXsIqMndZp4umVlr1UdQFX12X0bPXpYe9as04KkF5EW Ef6pZdtkVN4OfahNNKR19lOhbqa65kq5RriHhUbncp600L70IO5DCbkTpA0qta81HlNG XVtw== X-Gm-Message-State: ALoCoQlkQYUN5yIwN5/3O8rZYpgRJorO/k/l7q6Nk+sU88lT7g0U9jGbO0bVEa5lPWzKwinmc57a X-Received: by 10.220.190.197 with SMTP id dj5mr1030441vcb.19.1400806307763; Thu, 22 May 2014 17:51:47 -0700 (PDT) Received: from [192.168.0.102] (218-164-131-40.dynamic.hinet.net. [218.164.131.40]) by mx.google.com with ESMTPSA id sy5sm2379875vdb.26.2014.05.22.17.51.45 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 22 May 2014 17:51:47 -0700 (PDT) Message-ID: <1400806302.21451.1.camel@phoenix> From: Axel Lin To: Mark Brown Date: Fri, 23 May 2014 08:51:42 +0800 X-Mailer: Evolution 3.8.4-0ubuntu1 Mime-Version: 1.0 Cc: Brian Austin , alsa-devel@alsa-project.org, Liam Girdwood , Paul Handrigan Subject: [alsa-devel] [PATCH v2] ASoC: cs42l56: Fix new value argument in snd_soc_update_bits calls 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 The new value argument needs proper shift to match the mask bit fields. Signed-off-by: Axel Lin --- sound/soc/codecs/cs42l56.c | 68 +++++++++++++++++++++------------------------- sound/soc/codecs/cs42l56.h | 13 +++++---- 2 files changed, 39 insertions(+), 42 deletions(-) diff --git a/sound/soc/codecs/cs42l56.c b/sound/soc/codecs/cs42l56.c index 5bb134b..5d7a800 100644 --- a/sound/soc/codecs/cs42l56.c +++ b/sound/soc/codecs/cs42l56.c @@ -763,14 +763,14 @@ static int cs42l56_set_sysclk(struct snd_soc_dai *codec_dai, case CS42L56_MCLK_11P2896MHZ: case CS42L56_MCLK_12MHZ: case CS42L56_MCLK_12P288MHZ: - cs42l56->mclk_div2 = 1; + cs42l56->mclk_div2 = CS42L56_MCLK_DIV2; cs42l56->mclk_prediv = 0; break; case CS42L56_MCLK_22P5792MHZ: case CS42L56_MCLK_24MHZ: case CS42L56_MCLK_24P576MHZ: - cs42l56->mclk_div2 = 1; - cs42l56->mclk_prediv = 1; + cs42l56->mclk_div2 = CS42L56_MCLK_DIV2; + cs42l56->mclk_prediv = CS42L56_MCLK_PREDIV; break; default: return -EINVAL; @@ -844,57 +844,51 @@ static int cs42l56_digital_mute(struct snd_soc_dai *dai, int mute) /* Hit the DSP Mixer first */ snd_soc_update_bits(codec, CS42L56_DSP_MUTE_CTL, CS42L56_ADCAMIX_MUTE_MASK | - CS42L56_ADCBMIX_MUTE_MASK | - CS42L56_PCMAMIX_MUTE_MASK | - CS42L56_PCMBMIX_MUTE_MASK | - CS42L56_MSTB_MUTE_MASK | - CS42L56_MSTA_MUTE_MASK, - CS42L56_MUTE); + CS42L56_ADCBMIX_MUTE_MASK | + CS42L56_PCMAMIX_MUTE_MASK | + CS42L56_PCMBMIX_MUTE_MASK | + CS42L56_MSTB_MUTE_MASK | + CS42L56_MSTA_MUTE_MASK, + CS42L56_MUTE_ALL_DSP); /* Mute ADC's */ snd_soc_update_bits(codec, CS42L56_MISC_ADC_CTL, - CS42L56_ADCA_MUTE_MASK | - CS42L56_ADCB_MUTE_MASK, - CS42L56_MUTE); + CS42L56_ADCA_MUTE_MASK | + CS42L56_ADCB_MUTE_MASK, + CS42L56_MUTE_ALL_ADC); /* HP And LO */ snd_soc_update_bits(codec, CS42L56_HPA_VOLUME, - CS42L56_HP_MUTE_MASK, - CS42L56_MUTE); + CS42L56_HP_MUTE_MASK, CS42L56_HP_MUTE_MASK); snd_soc_update_bits(codec, CS42L56_HPB_VOLUME, - CS42L56_HP_MUTE_MASK, - CS42L56_MUTE); + CS42L56_HP_MUTE_MASK, CS42L56_HP_MUTE_MASK); snd_soc_update_bits(codec, CS42L56_LOA_VOLUME, - CS42L56_LO_MUTE_MASK, - CS42L56_MUTE); + CS42L56_LO_MUTE_MASK, CS42L56_LO_MUTE_MASK); snd_soc_update_bits(codec, CS42L56_LOB_VOLUME, - CS42L56_LO_MUTE_MASK, - CS42L56_MUTE); + CS42L56_LO_MUTE_MASK, CS42L56_LO_MUTE_MASK); } else { snd_soc_update_bits(codec, CS42L56_DSP_MUTE_CTL, CS42L56_ADCAMIX_MUTE_MASK | - CS42L56_ADCBMIX_MUTE_MASK | - CS42L56_PCMAMIX_MUTE_MASK | - CS42L56_PCMBMIX_MUTE_MASK | - CS42L56_MSTB_MUTE_MASK | - CS42L56_MSTA_MUTE_MASK, - CS42L56_UNMUTE); + CS42L56_ADCBMIX_MUTE_MASK | + CS42L56_PCMAMIX_MUTE_MASK | + CS42L56_PCMBMIX_MUTE_MASK | + CS42L56_MSTB_MUTE_MASK | + CS42L56_MSTA_MUTE_MASK, + CS42L56_UNMUTE); + snd_soc_update_bits(codec, CS42L56_MISC_ADC_CTL, - CS42L56_ADCA_MUTE_MASK | - CS42L56_ADCB_MUTE_MASK, - CS42L56_UNMUTE); + CS42L56_ADCA_MUTE_MASK | + CS42L56_ADCB_MUTE_MASK, + CS42L56_UNMUTE); + snd_soc_update_bits(codec, CS42L56_HPA_VOLUME, - CS42L56_HP_MUTE_MASK, - CS42L56_UNMUTE); + CS42L56_HP_MUTE_MASK, CS42L56_UNMUTE); snd_soc_update_bits(codec, CS42L56_HPB_VOLUME, - CS42L56_HP_MUTE_MASK, - CS42L56_UNMUTE); + CS42L56_HP_MUTE_MASK, CS42L56_UNMUTE); snd_soc_update_bits(codec, CS42L56_LOA_VOLUME, - CS42L56_LO_MUTE_MASK, - CS42L56_UNMUTE); + CS42L56_LO_MUTE_MASK, CS42L56_UNMUTE); snd_soc_update_bits(codec, CS42L56_LOB_VOLUME, - CS42L56_LO_MUTE_MASK, - CS42L56_UNMUTE); + CS42L56_LO_MUTE_MASK, CS42L56_UNMUTE); } return 0; } diff --git a/sound/soc/codecs/cs42l56.h b/sound/soc/codecs/cs42l56.h index ad2b50a..3fb73dc 100644 --- a/sound/soc/codecs/cs42l56.h +++ b/sound/soc/codecs/cs42l56.h @@ -80,19 +80,21 @@ #define CS42L56_PDN_HPB_MASK 0xc0 /* serial port and clk masks */ -#define CS42L56_MASTER_MODE 1 +#define CS42L56_MASTER_MODE 0x40 #define CS42L56_SLAVE_MODE 0 #define CS42L56_MS_MODE_MASK 0x40 -#define CS42L56_SCLK_INV 1 +#define CS42L56_SCLK_INV 0x20 #define CS42L56_SCLK_INV_MASK 0x20 #define CS42L56_SCLK_MCLK_MASK 0x18 +#define CS42L56_MCLK_PREDIV 0x04 #define CS42L56_MCLK_PREDIV_MASK 0x04 +#define CS42L56_MCLK_DIV2 0x02 #define CS42L56_MCLK_DIV2_MASK 0x02 #define CS42L56_MCLK_DIS_MASK 0x01 #define CS42L56_CLK_AUTO_MASK 0x20 #define CS42L56_CLK_RATIO_MASK 0x1f #define CS42L56_DIG_FMT_I2S 0 -#define CS42L56_DIG_FMT_LEFT_J 1 +#define CS42L56_DIG_FMT_LEFT_J 0x08 #define CS42L56_DIG_FMT_MASK 0x08 /* Class H and misc ctl masks */ @@ -116,8 +118,6 @@ #define CS42L56_DEEMPH_MASK 0x40 #define CS42L56_PLYBCK_GANG_MASK 0x10 #define CS42L56_PCM_INV_MASK 0x0c -#define CS42L56_MUTE 1 -#define CS42L56_UNMUTE 0 #define CS42L56_ADCAMIX_MUTE_MASK 0x40 #define CS42L56_ADCBMIX_MUTE_MASK 0x80 #define CS42L56_PCMAMIX_MUTE_MASK 0x10 @@ -128,6 +128,9 @@ #define CS42L56_ADCB_MUTE_MASK 0x02 #define CS42L56_HP_MUTE_MASK 0x80 #define CS42L56_LO_MUTE_MASK 0x80 +#define CS42L56_MUTE_ALL_DSP 0xf3 +#define CS42L56_MUTE_ALL_ADC 0x03 +#define CS42L56_UNMUTE 0 /* Beep masks */ #define CS42L56_BEEP_FREQ_MASK 0xf0