Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c7fd1997 authored by Junjie Wu's avatar Junjie Wu
Browse files

clk: qcom: Move set_rate ops check after checking rate



There are some clk_ops where we don't want to support setting a rate,
because its rate will be pre-configured. However, we still want
clk_set_rate() to succeed if it's called with same rate as current
rate.

Instead of requiring clk_ops put a stub set_rate ops, move this
functionality into core clock framework.

Change-Id: I40b99b2805fae526a44eb2556802819a80d29e75
Signed-off-by: default avatarJunjie Wu <junjiew@codeaurora.org>
parent a4879223
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -41,13 +41,6 @@ static DEFINE_SPINLOCK(pll_reg_lock);
#define ENABLE_WAIT_MAX_LOOPS 200
#define PLL_LOCKED_BIT BIT(16)

static int fixed_pll_clk_set_rate(struct clk *c, unsigned long rate)
{
	if (rate != c->rate)
		return -EINVAL;
	return 0;
}

static long fixed_pll_clk_round_rate(struct clk *c, unsigned long rate)
{
	return c->rate;
@@ -132,7 +125,6 @@ struct clk_ops clk_ops_pll_vote = {
	.disable = pll_vote_clk_disable,
	.is_enabled = pll_vote_clk_is_enabled,
	.round_rate = fixed_pll_clk_round_rate,
	.set_rate = fixed_pll_clk_set_rate,
	.handoff = pll_vote_clk_handoff,
	.list_registers = pll_vote_clk_list_registers,
};
@@ -520,7 +512,6 @@ struct clk_ops clk_ops_pll_acpu_vote = {
	.enable = pll_acpu_vote_clk_enable,
	.disable = pll_acpu_vote_clk_disable,
	.round_rate = fixed_pll_clk_round_rate,
	.set_rate = fixed_pll_clk_set_rate,
	.is_enabled = pll_vote_clk_is_enabled,
	.handoff = pll_acpu_vote_clk_handoff,
	.list_registers = pll_vote_clk_list_registers,
+6 −4
Original line number Diff line number Diff line
/* arch/arm/mach-msm/clock.c
 *
 * Copyright (C) 2007 Google, Inc.
 * Copyright (c) 2007-2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2007-2014, The Linux Foundation. All rights reserved.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
@@ -488,9 +488,6 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
	if (IS_ERR_OR_NULL(clk))
		return -EINVAL;

	if (!clk->ops->set_rate)
		return -ENOSYS;

	if (!is_rate_valid(clk, rate))
		return -EINVAL;

@@ -500,6 +497,11 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
	if (clk->rate == rate && !(clk->flags & CLKFLAG_NO_RATE_CACHE))
		goto out;

	if (!clk->ops->set_rate) {
		rc = -ENOSYS;
		goto out;
	}

	trace_clock_set_rate(name, rate, raw_smp_processor_id());

	start_rate = clk->rate;