From patchwork Thu Jul 23 15:23:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 6854211 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 D238B9F1D4 for ; Thu, 23 Jul 2015 15:24:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1985920770 for ; Thu, 23 Jul 2015 15:24:35 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id C4FC6206E3 for ; Thu, 23 Jul 2015 15:24:33 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 9470A2657FC; Thu, 23 Jul 2015 17:24:32 +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 0337B265887; Thu, 23 Jul 2015 17:24:06 +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 7BD7426587F; Thu, 23 Jul 2015 17:24:04 +0200 (CEST) Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by alsa0.perex.cz (Postfix) with ESMTP id 47E922657DD for ; Thu, 23 Jul 2015 17:23:47 +0200 (CEST) Received: by pdbbh15 with SMTP id bh15so113042081pdb.1 for ; Thu, 23 Jul 2015 08:23:45 -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:in-reply-to :references:content-type:mime-version:content-transfer-encoding; bh=6pk2KUSTsswqznfEmNCz0g77+aFKD85lz/fLx0ChJJk=; b=g0fKDsBUTWV2+u0uJ5mf5/rcMAx2MHHGvMma5SMTqaEuvhbwUD9BNbfszo/hQl/THK I7Ph72OVevc/KhEFDgn6NSNQo9nMTtVHglw2orU5SGaFTGzcPHFLwcHgqpOqzrfl+AEp aZ0iKXtBhs2brjy5j77yAHzUkgJdfVC0nuZfCFBn+Uh0TjXD7MzUDFsJm4vmupO2ayIV BOOHqfj9ZFnH6w0hw7Gk4inO6tdtWvW96Ady2FvLhpGUFU3yVEcmRkkhkQIs6ZptJ/wT 0qBjXc3X9qDIuik/0GmAKFWBtCHzT1XjQMdwa9D1IBN905SOYEdWVZ/1pXvVgGHsoXDB GfTg== X-Gm-Message-State: ALoCoQk26z8nvzbtg0K6JlzSg4pD7VJVW3d2eYA4Ku2nn7BojlmODynrH0k3zhzosQTujgOVJk6Y X-Received: by 10.66.161.232 with SMTP id xv8mr19549259pab.137.1437665025802; Thu, 23 Jul 2015 08:23:45 -0700 (PDT) Received: from phoenix.local (218-164-29-101.dynamic.hinet.net. [218.164.29.101]) by smtp.gmail.com with ESMTPSA id ml6sm9577409pdb.69.2015.07.23.08.23.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jul 2015 08:23:44 -0700 (PDT) Message-ID: <1437665015.20606.6.camel@ingics.com> From: Axel Lin To: Mark Brown Date: Thu, 23 Jul 2015 23:23:35 +0800 In-Reply-To: <1437664946.20606.5.camel@ingics.com> References: <1437664946.20606.5.camel@ingics.com> X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Cc: Marek Belisko , alsa-devel@alsa-project.org, Liam Girdwood Subject: [alsa-devel] [PATCH 2/2] ASoC: pcm1681: Improve the logic for de-emphasis sampling rate selection 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 Slightly improve the logic for de-emphasis sampling rate selection by break out the loop if the rate is matched. Signed-off-by: Axel Lin --- sound/soc/codecs/pcm1681.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c index 1011142..5832523 100644 --- a/sound/soc/codecs/pcm1681.c +++ b/sound/soc/codecs/pcm1681.c @@ -95,17 +95,22 @@ static int pcm1681_set_deemph(struct snd_soc_codec *codec) struct pcm1681_private *priv = snd_soc_codec_get_drvdata(codec); int i = 0, val = -1, enable = 0; - if (priv->deemph) - for (i = 0; i < ARRAY_SIZE(pcm1681_deemph); i++) - if (pcm1681_deemph[i] == priv->rate) + if (priv->deemph) { + for (i = 0; i < ARRAY_SIZE(pcm1681_deemph); i++) { + if (pcm1681_deemph[i] == priv->rate) { val = i; + break; + } + } + } if (val != -1) { regmap_update_bits(priv->regmap, PCM1681_DEEMPH_CONTROL, PCM1681_DEEMPH_RATE_MASK, val << 3); enable = 1; - } else + } else { enable = 0; + } /* enable/disable deemphasis functionality */ return regmap_update_bits(priv->regmap, PCM1681_DEEMPH_CONTROL,