From patchwork Thu May 18 16:37:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9734803 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 607B7601C8 for ; Thu, 18 May 2017 16:38:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EF4B285EC for ; Thu, 18 May 2017 16:38:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 430A328833; Thu, 18 May 2017 16:38:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7FAB928775 for ; Thu, 18 May 2017 16:38:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Nmct/xgUKvlkrio7gSj+ICCwwapKip9XFQd9Vdl1R/E=; b=Kzy0oQG7nz6nFZYYLC6fD6wZC4 Ael8gE4pHL+ZScyZQKBy1i67fleB9LYxwnbp7RiWpPLC+rniXHXRCLCdfEyp30NT0fYAHHQoD6Ycc Pgd2MZpAvd1j7WU7xXCMGrSPwdt5+fQp0ZMtPYJJJakyYfMMN4RSdV4Ahg0bQDLQWIwk0t0VB5ufL OLz8sP37qq19+kBzMRexhE7xP9BrSZQTxCPPRr1//YFM6+dEzXp05NW5g4pm6VE7HqKeZL3VC6NRA W62bjs2GcElsVI0ZLZQrR8HoofnkjAUJ8eMqcIEVy807TKgbXU0sjakx+XiBdMhg8SKFo+iNzo71y J1ASmwzg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dBORl-0003Mx-MO; Thu, 18 May 2017 16:38:41 +0000 Received: from mail-wr0-x22e.google.com ([2a00:1450:400c:c0c::22e]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dBORc-0003Fp-Pb for linux-amlogic@lists.infradead.org; Thu, 18 May 2017 16:38:37 +0000 Received: by mail-wr0-x22e.google.com with SMTP id l50so39796434wrc.3 for ; Thu, 18 May 2017 09:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qRER8akolsR838uxi2ZpYKUK1mYMGjQ6Q7JSj0WVZLU=; b=zeJkvGpoU9CVTYRDtXw6Gy8R+EakhGA0ozd7/KZ9vBzGPk4tzcup0jbwGlDPYVT8DD Tv/TAU9Z2jUxKQjubUi6yoA6vJjZqCNKR5yftazI6xjwu3Ndd2kc0U25SiPzkQthavSa VioqKo/malDxqrh8MeIJhecaC+zj/KpWQxgu8deNTXv7wWVqk1D3LMDgi9F5coZiXgUg Mhz2pieNdWk1FujYBhGaau5aweHwzb245WEg2m1s/Vcs8a07k1/coD8mLbkBUiLFBp9i LeHL/TTkaBpkseLH3YxTbHl2/+ePhX6eJUx9QKuzNVYWc3J+MIlacL9cBius/jNHQRqk B1bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qRER8akolsR838uxi2ZpYKUK1mYMGjQ6Q7JSj0WVZLU=; b=hHfCceeIuHBE0w5mOICAsADxNe9fA94FAVX/aNle9cTXhLf8n8xHnCwUkJbL5WGi2D GUntZlmOx/SxWq3+Q/WY3yDy+vsEEZQ/yY6ZGlU7Jtp7KA1qDM8+6e1X3rtYN5hRPZq9 +0miB0NjGP0s69HP55WDU+w9orTPNlN2xVRzyV68i7CWQ3iryIkkw/J9LJd4caSCAbxo X3C0z6vLc1d87Q1wubqFleZtMjQCsqKvusNAjCbNATZDCbNl4HPmFeogBngbtSb7W+c4 C8PM1RxQkqlZMbWI+KYfHVtFSSAIOedVyApa+SBKWXdOJz7Agp8Jy+q7ZUf26XZhyuWl EHpg== X-Gm-Message-State: AODbwcCxc5yIUCA84r7GRoy3lgWIQtgqX7SNCyE4m/zeH6fgzXOrIM9W NeAWR2UhUaNN/LvP X-Received: by 10.223.135.90 with SMTP id 26mr3207874wrz.199.1495125489781; Thu, 18 May 2017 09:38:09 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id 4sm7357655wrv.33.2017.05.18.09.38.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 May 2017 09:38:09 -0700 (PDT) From: Jerome Brunet To: Michael Turquette , Stephen Boyd , Kevin Hilman Subject: [PATCH 02/10] clk: add clk_core_set_phase_nolock function Date: Thu, 18 May 2017 18:37:56 +0200 Message-Id: <20170518163804.14123-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170518163804.14123-1-jbrunet@baylibre.com> References: <20170518163804.14123-1-jbrunet@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170518_093833_042035_9F248AA3 X-CRM114-Status: UNSURE ( 9.32 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Create a core function for set_phase, as it is done for set_rate and set_parent. This rework is done to ease the integration of "protected" clock functionality. Signed-off-by: Jerome Brunet --- drivers/clk/clk.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index f5c371532509..6031fada37f9 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1873,6 +1873,23 @@ int clk_set_parent(struct clk *clk, struct clk *parent) } EXPORT_SYMBOL_GPL(clk_set_parent); +static int clk_core_set_phase_nolock(struct clk_core *core, int degrees) +{ + int ret = -EINVAL; + + if (!core) + return 0; + + trace_clk_set_phase(clk->core, degrees); + + if (core->ops->set_phase) + ret = core->ops->set_phase(core->hw, degrees); + + trace_clk_set_phase_complete(core, degrees); + + return ret; +} + /** * clk_set_phase - adjust the phase shift of a clock signal * @clk: clock signal source @@ -1895,7 +1912,7 @@ EXPORT_SYMBOL_GPL(clk_set_parent); */ int clk_set_phase(struct clk *clk, int degrees) { - int ret = -EINVAL; + int ret; if (!clk) return 0; @@ -1906,17 +1923,7 @@ int clk_set_phase(struct clk *clk, int degrees) degrees += 360; clk_prepare_lock(); - - trace_clk_set_phase(clk->core, degrees); - - if (clk->core->ops->set_phase) - ret = clk->core->ops->set_phase(clk->core->hw, degrees); - - trace_clk_set_phase_complete(clk->core, degrees); - - if (!ret) - clk->core->phase = degrees; - + ret = clk_core_set_phase_nolock(clk->core, degrees); clk_prepare_unlock(); return ret;