linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rajendra Nayak <rnayak@codeaurora.org>
To: vireshk@kernel.org, sboyd@kernel.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org,
	Rajendra Nayak <rnayak@codeaurora.org>
Subject: [PATCH 2/2] opp: Manage empty OPP tables with clk handle
Date: Tue,  2 Jul 2019 10:06:43 +0530	[thread overview]
Message-ID: <20190702043643.1746-2-rnayak@codeaurora.org> (raw)
In-Reply-To: <20190702043643.1746-1-rnayak@codeaurora.org>

With OPP core now supporting DVFS for IO devices, we have instances of
IO devices (same IP block) with require an OPP on some platforms/SoCs
while just needing to scale the clock on some others.
In order to avoid conditional code in every driver, (to check for 
availability of OPPs and then deciding to do either dev_pm_opp_set_rate()
or clk_set_rate()) add support to manage empty OPP tables with a clk handle.
This makes dev_pm_opp_set_rate() equivalent of a clk_set_rate() for devices
with just a clk and no OPPs specified.

Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
---
 drivers/opp/core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index ae033bb1e5b7..fa7d4d6d37b3 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -801,6 +801,11 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
 		goto put_opp_table;
 	}
 
+	if (!_get_opp_count(opp_table)) {
+		ret = _generic_set_opp_clk_only(dev, clk, freq);
+		goto put_opp_table;
+	}
+
 	temp_freq = old_freq;
 	old_opp = _find_freq_ceil(opp_table, &temp_freq);
 	if (IS_ERR(old_opp)) {
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


  reply	other threads:[~2019-07-02  4:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-02  4:36 [PATCH 1/2] opp: Export dev_pm_opp_set_genpd_virt_dev() Rajendra Nayak
2019-07-02  4:36 ` Rajendra Nayak [this message]
2019-07-03  8:50   ` [PATCH 2/2] opp: Manage empty OPP tables with clk handle Viresh Kumar
2019-07-03  9:11     ` Rajendra Nayak
2019-07-03  9:47       ` Viresh Kumar
2019-07-03 10:47         ` Rajendra Nayak

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=20190702043643.1746-2-rnayak@codeaurora.org \
    --to=rnayak@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=vireshk@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).