From patchwork Tue Mar 21 18:33:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9637329 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 27E8E60328 for ; Tue, 21 Mar 2017 18:34:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E7AF28304 for ; Tue, 21 Mar 2017 18:34:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 135FE28420; Tue, 21 Mar 2017 18:34:19 +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 BAB1B28418 for ; Tue, 21 Mar 2017 18:34:18 +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=J6Z+S/ybMkKfqWQmcVmqjUl86cGb614JkitV7N5SLeo=; b=ZZdzJIbtPsrmlT08thrrOvwnik 7pGzlwhIWtl63Z6ZCG5TeK3RZuv6I19OHIl+rrHsy1RoIh7HZn2bSdd3HjvHbXAdbNz9G1dGSGOrB K7nv3BlV46DFkwhmvoJgPokOd9ljM1CUHlf//zS/kU647blKbJzj6wfCKZP8pCgpdimYbh3Ke/buN nxc4jpcRF8X2sGeHPyVr/WOCThvDt8dwJKN4RZ+M07p5v8JSsNqY5/52PBo+RiOcr/Y4mgUAvbZCV nDKAymx+ui+1XcZMmdY+znNXYWFN2Yva4/zlP2KJY2YcGG+k25B6jbGsNl/1+SErJnAzModV+1tlF iFNanQ8w==; 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 1cqObj-0000LM-Jq; Tue, 21 Mar 2017 18:34:11 +0000 Received: from mail-wr0-x22f.google.com ([2a00:1450:400c:c0c::22f]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqObX-000066-Hc for linux-amlogic@lists.infradead.org; Tue, 21 Mar 2017 18:34:04 +0000 Received: by mail-wr0-x22f.google.com with SMTP id u108so117390199wrb.3 for ; Tue, 21 Mar 2017 11:33:38 -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=zY3bIhu1wytfDbGnIWrd7QQft3ewmpSSgeltwc66wnA=; b=0Zr89q+v4/fI7IAdWjJG9Quq/rG/6xzSjud2yk37PM7YtFN5WEIs55uSlOMzKs9wky LQ5jAuBgtmsaatFx2y+2Zd3fMy6qJmiKORwONqUjdm30V2qMs9P/hIa8hoQ3CdxZeB0B CV/DguCSPbwKdky/OhHsgIhAfBON2svGG8h85xdK6G7PZTlkzrs9wutsLEy4lj75jQ7K GTxVbIIiVlPnhnoVegWeLyw5nHW5m2ApZX83c7kEESCyL4nkozO5PIOtI7X4baHYF3eh ABYsgeD0vGmRPQAXwedkM7NDsFzMkBFrM2ihiQhmShBdu/3xmg7vPJaJO7zrNKnkNzy+ dAGA== 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=zY3bIhu1wytfDbGnIWrd7QQft3ewmpSSgeltwc66wnA=; b=Tso93iXKBjaJQSEW32OUz/jJHaRWWnusKmezvG+UrC/x2OZ4utce2qdsuvatAWvaBq NY6adFhAZnJobpR4RDb+BvAPEQ3Je5MAOx8lcvKBweJ82OlbhZ/IpCY5GjKg6sSNon+H H7m4t8AcATNoRfq7YJ9VEUCtNELd35PCMORmlyoVmw/AN4jDyP+XXzDtAOjyueppiK/D 5EeP5NFyvh13RZ8tkI+DvUaygxwiK3ezWzHb8tzXDf5I+Ays+DUgyLfVtQfD4UYwSLkT hdZpWlCfzBKMxCCAUYNgDOYHfxo0nwa9ghu2dS3Czuh6KKLtcFT5BarzS11Msb4OZi5a sSTA== X-Gm-Message-State: AFeK/H1L6xFNeflCXQq42ssqrgPVW+ir890+vYtzChY+0jSPUVlnPbp3Nf8TUEApLR3LvokG X-Received: by 10.223.160.9 with SMTP id k9mr35459711wrk.123.1490121217575; Tue, 21 Mar 2017 11:33:37 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id q12sm18667504wmd.8.2017.03.21.11.33.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Mar 2017 11:33:37 -0700 (PDT) From: Jerome Brunet To: Michael Turquette , Stephen Boyd , Kevin Hilman Subject: [RFC 2/7] clk: add set_phase core function Date: Tue, 21 Mar 2017 19:33:25 +0100 Message-Id: <20170321183330.26722-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170321183330.26722-1-jbrunet@baylibre.com> References: <20170321183330.26722-1-jbrunet@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170321_113359_810267_A1BA9494 X-CRM114-Status: UNSURE ( 9.48 ) 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 e77f03a47da6..57982a06dbce 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1876,6 +1876,23 @@ int clk_set_parent(struct clk *clk, struct clk *parent) } EXPORT_SYMBOL_GPL(clk_set_parent); +static int clk_core_set_phase(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 @@ -1898,7 +1915,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; @@ -1909,17 +1926,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(clk->core, degrees); clk_prepare_unlock(); return ret;