clk: qcom: Add support for RCGs with dynamic and fixed sources
Some RCGSs could have sources with dynamic frequencies and fixed sources where if the RCG has the flag of CLK_SET_RATE_PARENT set, it would try to propagate the clock rate to the fixed source PLLs too. To identify sources of the RCGs where the rate should propagate to parent PLL, add a member in freq_tbl to represent source frequency. This would be used by the _freq_tbl_determine_rate to set its parent frequency on the PLL. Change-Id: I7f1c0d9d84607821893a1e5d17934dae5acef5f4 Signed-off-by: Taniya Das <tdas@codeaurora.org>
This commit is contained in:
parent
1e17007652
commit
b5d4c54e33
2 changed files with 18 additions and 1 deletions
|
@ -24,6 +24,7 @@ struct freq_tbl {
|
||||||
u16 m;
|
u16 m;
|
||||||
u16 n;
|
u16 n;
|
||||||
unsigned long src_freq;
|
unsigned long src_freq;
|
||||||
|
#define FIXED_FREQ_SRC 0
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -232,9 +232,10 @@ static int _freq_tbl_determine_rate(struct clk_hw *hw,
|
||||||
const struct freq_tbl *f, struct clk_rate_request *req)
|
const struct freq_tbl *f, struct clk_rate_request *req)
|
||||||
{
|
{
|
||||||
unsigned long clk_flags, rate = req->rate;
|
unsigned long clk_flags, rate = req->rate;
|
||||||
|
struct clk_rate_request parent_req = { };
|
||||||
struct clk_hw *p;
|
struct clk_hw *p;
|
||||||
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
|
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
|
||||||
int index;
|
int index, ret = 0;
|
||||||
|
|
||||||
f = qcom_find_freq(f, rate);
|
f = qcom_find_freq(f, rate);
|
||||||
if (!f)
|
if (!f)
|
||||||
|
@ -265,6 +266,21 @@ static int _freq_tbl_determine_rate(struct clk_hw *hw,
|
||||||
req->best_parent_rate = rate;
|
req->best_parent_rate = rate;
|
||||||
req->rate = f->freq;
|
req->rate = f->freq;
|
||||||
|
|
||||||
|
if (f->src_freq != FIXED_FREQ_SRC) {
|
||||||
|
rate = parent_req.rate = f->src_freq;
|
||||||
|
parent_req.best_parent_hw = p;
|
||||||
|
ret = __clk_determine_rate(p, &parent_req);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
ret = clk_set_rate(p->clk, parent_req.rate);
|
||||||
|
if (ret) {
|
||||||
|
pr_err("Failed set rate(%lu) on parent for non-fixed source\n",
|
||||||
|
parent_req.rate);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue