All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tero Kristo <t-kristo@ti.com>
To: <linux-clk@vger.kernel.org>, <ssantosh@kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: <sboyd@kernel.org>, <mturquette@baylibre.com>
Subject: [PATCH 3/3] clk: keystone: sci-clk: add 10% slack to set_rate
Date: Mon, 7 Sep 2020 11:57:40 +0300	[thread overview]
Message-ID: <20200907085740.1083-4-t-kristo@ti.com> (raw)
In-Reply-To: <20200907085740.1083-1-t-kristo@ti.com>

Currently, we request exact clock rates from the firmware to be set with
set_rate. Due to some rounding errors and internal functionality of the
firmware itself, this can fail. Thus, add some slack to the set_rate
functionality so that we are always guaranteed to pass. The firmware
always attempts to use frequency as close to the target freq as
possible despite the slack given here.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 drivers/clk/keystone/sci-clk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c
index b6477b08af04..aaf31abe1c8f 100644
--- a/drivers/clk/keystone/sci-clk.c
+++ b/drivers/clk/keystone/sci-clk.c
@@ -221,7 +221,8 @@ static int sci_clk_set_rate(struct clk_hw *hw, unsigned long rate,
 	struct sci_clk *clk = to_sci_clk(hw);
 
 	return clk->provider->ops->set_freq(clk->provider->sci, clk->dev_id,
-					    clk->clk_id, rate, rate, rate);
+					    clk->clk_id, rate / 10 * 9, rate,
+					    rate / 10 * 11);
 }
 
 /**
-- 
2.17.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

  parent reply	other threads:[~2020-09-07  8:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-07  8:57 [PATCH 0/3] clk: keystone: some minor fixes Tero Kristo
2020-09-07  8:57 ` [PATCH 1/3] clk: keystone: sci-clk: fix parsing assigned-clock data during probe Tero Kristo
2020-09-22 19:59   ` Stephen Boyd
2020-09-07  8:57 ` [PATCH 2/3] clk: keystone: sci-clk: cache results of last query rate operation Tero Kristo
2020-09-22 19:59   ` Stephen Boyd
2020-09-07  8:57 ` Tero Kristo [this message]
2020-09-22 19:59   ` [PATCH 3/3] clk: keystone: sci-clk: add 10% slack to set_rate Stephen Boyd
2020-09-08 17:19 ` [PATCH 0/3] clk: keystone: some minor fixes santosh.shilimkar
2020-09-10 21:29   ` Stephen Boyd
2020-09-10 22:41     ` santosh.shilimkar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200907085740.1083-4-t-kristo@ti.com \
    --to=t-kristo@ti.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    --cc=ssantosh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.