From patchwork Thu Jul 23 15:13:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 6854161 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 BA6A1C05AD for ; Thu, 23 Jul 2015 15:14:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 007722077C for ; Thu, 23 Jul 2015 15:14:02 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 9897C20770 for ; Thu, 23 Jul 2015 15:14:00 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 47C8C265593; Thu, 23 Jul 2015 17:13:59 +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 27611260711; Thu, 23 Jul 2015 17:13:51 +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 2950A2610B1; Thu, 23 Jul 2015 17:13:50 +0200 (CEST) Received: from mail-pa0-f44.google.com (mail-pa0-f44.google.com [209.85.220.44]) by alsa0.perex.cz (Postfix) with ESMTP id D7B582606F9 for ; Thu, 23 Jul 2015 17:13:42 +0200 (CEST) Received: by pabkd10 with SMTP id kd10so87056798pab.2 for ; Thu, 23 Jul 2015 08:13:41 -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=lIH+SAI34Kr4L8jzYZufjmZUE39BBHxjLrfXjatW6YM=; b=XAmeQA5Hicj/xRX7OghnWnJScwtXl0SkxrbXvnVMG+B6UNca3y1/XCoY7awlz0nMVb QrW6YuYZHxWgZMTtelUZyvwq2E88jU6SzcFl2/VZjSlNKm+h7SZ9KabN/RzNWUXQM+Kl VNM2JeE5Soqy9sHKG/bcmRpPgfgC8ITwo8rSK50m8H/mR+iIJSoPxXrNDPas/fmd6TOR O2h+NllKJmUFf8p5bT3Q6k3UUOKzr/545hkLq5RqLN2m6nvGCY/XUpqEEzcbXuUEFYzK VNXBANjWIlHFZMvguyPJFRlnI6zu4qIA1qjtxSi2d7JzHPLbvKkAMoyLaoya2SnVmiQ8 I2yA== X-Gm-Message-State: ALoCoQlo8eAMarkopLPZwkH76HzAZErIDPryK5a5+VgtttfERshKA+59Kqw7OK5rIfUY0eP8n99k X-Received: by 10.70.135.129 with SMTP id ps1mr19420978pdb.110.1437664421422; Thu, 23 Jul 2015 08:13:41 -0700 (PDT) Received: from phoenix.local (218-164-29-101.dynamic.hinet.net. [218.164.29.101]) by smtp.gmail.com with ESMTPSA id b10sm9529426pdo.84.2015.07.23.08.13.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jul 2015 08:13:40 -0700 (PDT) Message-ID: <1437664416.20606.3.camel@ingics.com> From: Axel Lin To: Mark Brown Date: Thu, 23 Jul 2015 23:13:36 +0800 X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Cc: alsa-devel@alsa-project.org, Liam Girdwood , Daniel Mack Subject: [alsa-devel] [PATCH] ASoC: tas5086: 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 Acked-by: Daniel Mack --- sound/soc/codecs/tas5086.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c index 0a49fc8..d49d25d 100644 --- a/sound/soc/codecs/tas5086.c +++ b/sound/soc/codecs/tas5086.c @@ -266,10 +266,14 @@ static int tas5086_set_deemph(struct snd_soc_codec *codec) struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec); int i, val = 0; - if (priv->deemph) - for (i = 0; i < ARRAY_SIZE(tas5086_deemph); i++) - if (tas5086_deemph[i] == priv->rate) + if (priv->deemph) { + for (i = 0; i < ARRAY_SIZE(tas5086_deemph); i++) { + if (tas5086_deemph[i] == priv->rate) { val = i; + break; + } + } + } return regmap_update_bits(priv->regmap, TAS5086_SYS_CONTROL_1, TAS5086_DEEMPH_MASK, val);