From patchwork Thu Aug 28 08:27:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 4812651 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 A5F7C9F38C for ; Fri, 29 Aug 2014 22:02:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E876320122 for ; Fri, 29 Aug 2014 22:02:01 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id C8DE02011B for ; Fri, 29 Aug 2014 22:01:59 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id E76C7265923; Sat, 30 Aug 2014 00:01:58 +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 11C03265D56; Fri, 29 Aug 2014 17:40:05 +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 EB68D265D56; Fri, 29 Aug 2014 17:40:03 +0200 (CEST) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by alsa0.perex.cz (Postfix) with ESMTP id 6888B268DF1 for ; Thu, 28 Aug 2014 10:28:08 +0200 (CEST) Received: by mail-pa0-f54.google.com with SMTP id fb1so1631744pad.13 for ; Thu, 28 Aug 2014 01:28:03 -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=da3NchTSAnpVuRTwS3AMAFI4swm8P8DkCUrfSTFTLHc=; b=B25o4clw/vKZexWORWXdDAQ3IgveZG7BpHT2vil5yYOHtZak2QRvwHuS1LoYOzFP7k u/U30zva3Ix6GfeP+vwX910mWPTCZb2BXdYodljZuA7BQj14p2bN9qEan24ap2Tw8GRq kfsHT9TuJBxCFEYEItiDjEPU2Yej+zRaa3sQQwu4oHkoq1WwTL6L8jjRzXG2gcDsiQqq 6EcLtVhzx75cZIoK0An+6OcRDXdKMRJF7PvbFUz9vVvo+n909T6gRqufo1drbhSkJlJI DG/+IsWm0+41y02fO2YH+ahrw1yfLrp6JF0j55bm5BqaxvB4W9cfsvpyN4LeBQtMQoa3 L0SA== X-Gm-Message-State: ALoCoQkkx09EERpKuHsGCpQH2Dmftgtsimv0O74snXgHIZAGVJpLn7YStDMpfsahBTVxnydX4xjL X-Received: by 10.68.104.98 with SMTP id gd2mr3455662pbb.13.1409214482520; Thu, 28 Aug 2014 01:28:02 -0700 (PDT) Received: from [192.168.0.105] (218-164-135-26.dynamic.hinet.net. [218.164.135.26]) by mx.google.com with ESMTPSA id oa8sm4339762pdb.20.2014.08.28.01.28.00 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Thu, 28 Aug 2014 01:28:01 -0700 (PDT) Message-ID: <1409214476.21395.2.camel@phoenix> From: Axel Lin To: Mark Brown Date: Thu, 28 Aug 2014 16:27:56 +0800 X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Cc: Brian Austin , "alsa-devel@alsa-project.org" , Liam Girdwood , Paul Handrigan Subject: [alsa-devel] [PATCH] ASoC: cs35l32: Simplify implementation of cs35l32_codec_set_sysclk 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 Use single snd_soc_update_bits() call to update the register bits. Signed-off-by: Axel Lin Tested-by: Brian Austin Acked-by: Brian Austin --- sound/soc/codecs/cs35l32.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/sound/soc/codecs/cs35l32.c b/sound/soc/codecs/cs35l32.c index 9c6b272..380c212 100644 --- a/sound/soc/codecs/cs35l32.c +++ b/sound/soc/codecs/cs35l32.c @@ -242,41 +242,27 @@ static struct snd_soc_dai_driver cs35l32_dai[] = { static int cs35l32_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id, int source, unsigned int freq, int dir) { + unsigned int val; switch (freq) { case 6000000: - snd_soc_update_bits(codec, CS35L32_CLK_CTL, - CS35L32_MCLK_DIV2_MASK, 0); - snd_soc_update_bits(codec, CS35L32_CLK_CTL, - CS35L32_MCLK_RATIO_MASK, - CS35L32_MCLK_RATIO); + val = CS35L32_MCLK_RATIO; break; case 12000000: - snd_soc_update_bits(codec, CS35L32_CLK_CTL, - CS35L32_MCLK_DIV2_MASK, - CS35L32_MCLK_DIV2_MASK); - snd_soc_update_bits(codec, CS35L32_CLK_CTL, - CS35L32_MCLK_RATIO_MASK, - CS35L32_MCLK_RATIO); + val = CS35L32_MCLK_DIV2_MASK | CS35L32_MCLK_RATIO; break; case 6144000: - snd_soc_update_bits(codec, CS35L32_CLK_CTL, - CS35L32_MCLK_DIV2_MASK, 0); - snd_soc_update_bits(codec, CS35L32_CLK_CTL, - CS35L32_MCLK_RATIO_MASK, 0); + val = 0; break; case 12288000: - snd_soc_update_bits(codec, CS35L32_CLK_CTL, - CS35L32_MCLK_DIV2_MASK, - CS35L32_MCLK_DIV2_MASK); - snd_soc_update_bits(codec, CS35L32_CLK_CTL, - CS35L32_MCLK_RATIO_MASK, 0); + val = CS35L32_MCLK_DIV2_MASK; break; default: return -EINVAL; } - return 0; + return snd_soc_update_bits(codec, CS35L32_CLK_CTL, + CS35L32_MCLK_DIV2_MASK | CS35L32_MCLK_RATIO_MASK, val); } static struct snd_soc_codec_driver soc_codec_dev_cs35l32 = {