Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: qcom: cpu-8996: don't store parents in clk_cpu_8996_pmux

Don't store pointers to parents in struct clk_cpu_8996_pmux. Instead use
clk_hw_get_parent_by_index to fetch them.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20220714100351.1834711-6-dmitry.baryshkov@linaro.org

authored by

Dmitry Baryshkov and committed by
Bjorn Andersson
f387d1c4 81165aca

+9 -13
+9 -13
drivers/clk/qcom/clk-cpu-8996.c
··· 247 247 u8 shift; 248 248 u8 width; 249 249 struct notifier_block nb; 250 - struct clk_hw *pll; 251 - struct clk_hw *pll_div_2; 252 250 struct clk_regmap clkr; 253 251 }; 254 252 ··· 290 292 static int clk_cpu_8996_pmux_determine_rate(struct clk_hw *hw, 291 293 struct clk_rate_request *req) 292 294 { 293 - struct clk_cpu_8996_pmux *cpuclk = to_clk_cpu_8996_pmux_hw(hw); 294 - struct clk_hw *parent = cpuclk->pll; 295 + struct clk_hw *parent; 295 296 296 - if (cpuclk->pll_div_2 && req->rate < DIV_2_THRESHOLD) { 297 - if (req->rate < (DIV_2_THRESHOLD / 2)) 298 - return -EINVAL; 297 + if (req->rate < (DIV_2_THRESHOLD / 2)) 298 + return -EINVAL; 299 299 300 - parent = cpuclk->pll_div_2; 301 - } 300 + if (req->rate < DIV_2_THRESHOLD) 301 + parent = clk_hw_get_parent_by_index(hw, SMUX_INDEX); 302 + else 303 + parent = clk_hw_get_parent_by_index(hw, ACD_INDEX); 304 + if (!parent) 305 + return -EINVAL; 302 306 303 307 req->best_parent_rate = clk_hw_round_rate(parent, req->rate); 304 308 req->best_parent_hw = parent; ··· 368 368 .reg = PWRCL_REG_OFFSET + MUX_OFFSET, 369 369 .shift = 0, 370 370 .width = 2, 371 - .pll = &pwrcl_pll_acd.clkr.hw, 372 - .pll_div_2 = &pwrcl_smux.clkr.hw, 373 371 .nb.notifier_call = cpu_clk_notifier_cb, 374 372 .clkr.hw.init = &(struct clk_init_data) { 375 373 .name = "pwrcl_pmux", ··· 383 385 .reg = PERFCL_REG_OFFSET + MUX_OFFSET, 384 386 .shift = 0, 385 387 .width = 2, 386 - .pll = &perfcl_pll_acd.clkr.hw, 387 - .pll_div_2 = &perfcl_smux.clkr.hw, 388 388 .nb.notifier_call = cpu_clk_notifier_cb, 389 389 .clkr.hw.init = &(struct clk_init_data) { 390 390 .name = "perfcl_pmux",