From patchwork Sun Nov 11 13:46:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 1725581 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id DF5A23FCAE for ; Sun, 11 Nov 2012 13:47:55 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TXXrg-0002Zg-VU; Sun, 11 Nov 2012 13:46:21 +0000 Received: from mail-da0-f49.google.com ([209.85.210.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TXXrc-0002Yy-L4 for linux-arm-kernel@lists.infradead.org; Sun, 11 Nov 2012 13:46:17 +0000 Received: by mail-da0-f49.google.com with SMTP id q27so2146725daj.36 for ; Sun, 11 Nov 2012 05:46:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :content-type:x-mailer:content-transfer-encoding:mime-version :x-gm-message-state; bh=uOa+S+IHYABxWRGuGTa2YaHGwZrOMkhd7DCuNkCcjIY=; b=lXLgtbQSK4mH0GwjKknvKeNfV6CX5mmwf7mEIMZJwGZBgzu9FzX4R5kkVl9frMGy9s XXh0kh6KHWQ9RN8RLndyrA6NfKHkNt/M/Q6ezAwnghOQjEsiAInY+VPCdY0yaTur0a12 ANCLgcot4g6n9MUlXAOMhU3yT52q9p7cm8HfTwZSFrE72Ep/uN8dPZjNDGwJ+NA/+jt2 AL+GHfZYcSM+5osKF8XkxxBflrtVcabK+4uScJI1ue9yeH5oP4mOyWFc9t3kRfG+0W9V FJrH6oy9OxrS7p2xXankK/bYRyUsA0c+c8a7K11U1UJb01seykdPyqI7WKWGThSfB2nY 5+oA== Received: by 10.66.81.42 with SMTP id w10mr47057343pax.66.1352641575118; Sun, 11 Nov 2012 05:46:15 -0800 (PST) Received: from [192.168.0.100] (114-39-110-57.dynamic.hinet.net. [114.39.110.57]) by mx.google.com with ESMTPS id x6sm2610327pav.29.2012.11.11.05.46.12 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 11 Nov 2012 05:46:14 -0800 (PST) Message-ID: <1352641569.3113.2.camel@phoenix> Subject: [PATCH RFT 2/2] pinctrl: dove: Checking valid config in dove_audio1_ctrl_set From: Axel Lin To: Linus Walleij Date: Sun, 11 Nov 2012 21:46:09 +0800 In-Reply-To: <1352641495.3113.1.camel@phoenix> References: <1352641495.3113.1.camel@phoenix> X-Mailer: Evolution 3.2.3-0ubuntu6 Mime-Version: 1.0 X-Gm-Message-State: ALoCoQktVTs2bQNXvg+Wz/EoFjIiDZbtC2NzBdmL9C0b5ZfglOJ4AYyG4x2vq469F4UnFo2shs6J X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121111_084616_993720_B33DBC28 X-CRM114-Status: GOOD ( 11.32 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.210.49 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Thomas Petazzoni , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Move the code checking valid config to dove_audio1_ctrl_set(), this ensures we always set valid config. And then dove_audio1_ctrl_get() always returns correct config. Signed-off-by: Axel Lin --- drivers/pinctrl/mvebu/pinctrl-dove.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-dove.c b/drivers/pinctrl/mvebu/pinctrl-dove.c index e5cc694..a393790 100644 --- a/drivers/pinctrl/mvebu/pinctrl-dove.c +++ b/drivers/pinctrl/mvebu/pinctrl-dove.c @@ -217,12 +217,6 @@ static int dove_audio1_ctrl_get(struct mvebu_mpp_ctrl *ctrl, if (gcfg2 & DOVE_TWSI_OPTION3_GPIO) *config |= BIT(0); - /* SSP/TWSI only if I2S1 not set*/ - if ((*config & BIT(3)) == 0) - *config &= ~(BIT(2) | BIT(0)); - /* TWSI only if SPDIFO not set*/ - if ((*config & BIT(1)) == 0) - *config &= ~BIT(0); return 0; } @@ -234,6 +228,13 @@ static int dove_audio1_ctrl_set(struct mvebu_mpp_ctrl *ctrl, unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); + /* SSP/TWSI only if I2S1 not set*/ + if ((config & BIT(3)) == 0) + config &= ~(BIT(2) | BIT(0)); + /* TWSI only if SPDIFO not set*/ + if ((config & BIT(1)) == 0) + config &= ~BIT(0); + if (config & BIT(0)) gcfg2 |= DOVE_TWSI_OPTION3_GPIO; else