From patchwork Thu Apr 20 15:43:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 9690831 X-Patchwork-Delegate: geert@linux-m68k.org 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 EF48560326 for ; Thu, 20 Apr 2017 15:43:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE7832847F for ; Thu, 20 Apr 2017 15:43:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E356428481; Thu, 20 Apr 2017 15:43:24 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 655B02847F for ; Thu, 20 Apr 2017 15:43:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S970820AbdDTPnY (ORCPT ); Thu, 20 Apr 2017 11:43:24 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:35713 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S970829AbdDTPnX (ORCPT ); Thu, 20 Apr 2017 11:43:23 -0400 Received: by mail-oi0-f67.google.com with SMTP id m34so1825362oik.2; Thu, 20 Apr 2017 08:43:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=KcmBLk8I4Nhog/vNHaPN3Vg+N2hYFev8jNF/sqB5WAc=; b=IXehQhLE+bBlgBz0O0oK+pj9hYYdl7EObquMbgL81VmpdQPAIei4P8yBFcB7GOLADY Fn+XkUszBfw28djnKMyKFvSh7Qj3jzBequmZNM6ikJBF6bAVjfmSVNJ+XnbYzfi/1iR6 JGlybo+J1URj/3cUf8328T3eta+l/HXZ+wnLOHQKTH4wDVIGz2LYlzraqzaWA5YVIwW/ S87Gubjubeg8OtyMgAYWWFPqtb4vLIvpU7V30Qbn291919Kd0aQ7Xg05AWi2+/eOMFtb oS1n4VynGuxZu8p9StGwbGZOxL85InJ+RzndTyF8jb3VaUeT44XLL93U/I2FjzknwkiN DokA== 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; bh=KcmBLk8I4Nhog/vNHaPN3Vg+N2hYFev8jNF/sqB5WAc=; b=ZpfTmUhBEjLrApPV+OU3jNE8p57tJe/a1c0K67w7TXtF4YYBTynfKTI3KANZfaardI LWlWa28O+TlRuP3UrarLk+vcEwiZqEE7LgUhZ5FIV29EXWnBOPkt432F86NB6dqYcjBE BMPJBa4qWFBOG5/V0Sxko3rmJOQqEuC/oIAVgw5WsArxad/y5JC1wOy+LDAsNQ7phY+C yA98kRQddk/4jjOMuMpENotNl45coIhk3sAoF0YRZXSV3mPWdjj9JB+ytK00OGtt3q/V Y+gjeXN6tjvy7/soQgdN2A2JBMQLqh+C7MSghOAIDCtILxxrnIEQsgsXmZhbjAQJYh0T kZOw== X-Gm-Message-State: AN3rC/5N5KjHrkWNe7FRUIwXyrFkao1SE/YF0v9cLCrGlLL8uybiBKEU oJaeru97Z31vjg== X-Received: by 10.157.1.39 with SMTP id 36mr4984501otu.236.1492703002241; Thu, 20 Apr 2017 08:43:22 -0700 (PDT) Received: from kurokawa.lan ([195.140.253.167]) by smtp.gmail.com with ESMTPSA id y185sm2695766oig.1.2017.04.20.08.43.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Apr 2017 08:43:21 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-renesas-soc@vger.kernel.org Cc: linux-iio@vger.kernel.org, Marek Vasut , Geert Uytterhoeven , Jonathan Cameron Subject: [PATCH] iio: adc: Derive interface clock speed from fck clock Date: Thu, 20 Apr 2017 17:43:10 +0200 Message-Id: <20170420154310.32759-1-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.11.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The "if" interface clock speed is actually derived from the "fck" block clock, as in the hardware they are the same clock. Drop the incorrect second "if" clock and get the clock speed from "fck". Signed-off-by: Marek Vasut Cc: Geert Uytterhoeven Cc: Jonathan Cameron Cc: linux-renesas-soc@vger.kernel.org Reviewed-by: Geert Uytterhoeven --- drivers/iio/adc/rcar-gyroadc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/iio/adc/rcar-gyroadc.c b/drivers/iio/adc/rcar-gyroadc.c index 018ed360e717..27a318164619 100644 --- a/drivers/iio/adc/rcar-gyroadc.c +++ b/drivers/iio/adc/rcar-gyroadc.c @@ -73,7 +73,7 @@ enum rcar_gyroadc_model { struct rcar_gyroadc { struct device *dev; void __iomem *regs; - struct clk *iclk; + struct clk *clk; struct regulator *vref[8]; unsigned int num_channels; enum rcar_gyroadc_model model; @@ -83,7 +83,7 @@ struct rcar_gyroadc { static void rcar_gyroadc_hw_init(struct rcar_gyroadc *priv) { - const unsigned long clk_mhz = clk_get_rate(priv->iclk) / 1000000; + const unsigned long clk_mhz = clk_get_rate(priv->clk) / 1000000; const unsigned long clk_mul = (priv->mode == RCAR_GYROADC_MODE_SELECT_1_MB88101A) ? 10 : 5; unsigned long clk_len = clk_mhz * clk_mul; @@ -510,9 +510,9 @@ static int rcar_gyroadc_probe(struct platform_device *pdev) if (IS_ERR(priv->regs)) return PTR_ERR(priv->regs); - priv->iclk = devm_clk_get(dev, "if"); - if (IS_ERR(priv->iclk)) { - ret = PTR_ERR(priv->iclk); + priv->clk = devm_clk_get(dev, "fck"); + if (IS_ERR(priv->clk)) { + ret = PTR_ERR(priv->clk); if (ret != -EPROBE_DEFER) dev_err(dev, "Failed to get IF clock (ret=%i)\n", ret); return ret; @@ -536,7 +536,7 @@ static int rcar_gyroadc_probe(struct platform_device *pdev) indio_dev->info = &rcar_gyroadc_iio_info; indio_dev->modes = INDIO_DIRECT_MODE; - ret = clk_prepare_enable(priv->iclk); + ret = clk_prepare_enable(priv->clk); if (ret) { dev_err(dev, "Could not prepare or enable the IF clock.\n"); goto err_clk_if_enable; @@ -565,7 +565,7 @@ static int rcar_gyroadc_probe(struct platform_device *pdev) pm_runtime_put_sync(dev); pm_runtime_disable(dev); pm_runtime_set_suspended(dev); - clk_disable_unprepare(priv->iclk); + clk_disable_unprepare(priv->clk); err_clk_if_enable: rcar_gyroadc_deinit_supplies(indio_dev); @@ -584,7 +584,7 @@ static int rcar_gyroadc_remove(struct platform_device *pdev) pm_runtime_put_sync(dev); pm_runtime_disable(dev); pm_runtime_set_suspended(dev); - clk_disable_unprepare(priv->iclk); + clk_disable_unprepare(priv->clk); rcar_gyroadc_deinit_supplies(indio_dev); return 0;