Skip to content

Commit 7b6dfa1

Browse files
committed
clk: qcom: gcc-sm8550: Don't park the USB RCG at registration time
Amit Pundir reports that audio and USB-C host mode stops working if the gcc_usb30_prim_master_clk_src clk is registered and clk_rcg2_shared_init() parks it on XO. Skip parking this clk at registration time to fix those issues. Partially revert commit 01a0a6c ("clk: qcom: Park shared RCGs upon registration") by skipping the parking bit for this clk, but keep the part where we cache the config register. That's still necessary to figure out the true parent of the clk at registration time. Fixes: 01a0a6c ("clk: qcom: Park shared RCGs upon registration") Fixes: 929c75d ("clk: qcom: gcc-sm8550: Mark RCGs shared where applicable") Cc: Konrad Dybcio <konradybcio@kernel.org> Cc: Bjorn Andersson <andersson@kernel.org> Cc: Taniya Das <quic_tdas@quicinc.com> Reported-by: Amit Pundir <amit.pundir@linaro.org> Closes: https://lore.kernel.org/CAMi1Hd1KQBE4kKUdAn8E5FV+BiKzuv+8FoyWQrrTHPDoYTuhgA@mail.gmail.com Signed-off-by: Stephen Boyd <swboyd@chromium.org> Link: https://lore.kernel.org/r/20240819233628.2074654-3-swboyd@chromium.org Tested-by: Amit Pundir <amit.pundir@linaro.org> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent d10eeb7 commit 7b6dfa1

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

drivers/clk/qcom/clk-rcg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ extern const struct clk_ops clk_byte2_ops;
198198
extern const struct clk_ops clk_pixel_ops;
199199
extern const struct clk_ops clk_gfx3d_ops;
200200
extern const struct clk_ops clk_rcg2_shared_ops;
201+
extern const struct clk_ops clk_rcg2_shared_no_init_park_ops;
201202
extern const struct clk_ops clk_dp_ops;
202203

203204
struct clk_rcg_dfs_data {

drivers/clk/qcom/clk-rcg2.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,6 +1348,36 @@ const struct clk_ops clk_rcg2_shared_ops = {
13481348
};
13491349
EXPORT_SYMBOL_GPL(clk_rcg2_shared_ops);
13501350

1351+
static int clk_rcg2_shared_no_init_park(struct clk_hw *hw)
1352+
{
1353+
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
1354+
1355+
/*
1356+
* Read the config register so that the parent is properly mapped at
1357+
* registration time.
1358+
*/
1359+
regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, &rcg->parked_cfg);
1360+
1361+
return 0;
1362+
}
1363+
1364+
/*
1365+
* Like clk_rcg2_shared_ops but skip the init so that the clk frequency is left
1366+
* unchanged at registration time.
1367+
*/
1368+
const struct clk_ops clk_rcg2_shared_no_init_park_ops = {
1369+
.init = clk_rcg2_shared_no_init_park,
1370+
.enable = clk_rcg2_shared_enable,
1371+
.disable = clk_rcg2_shared_disable,
1372+
.get_parent = clk_rcg2_shared_get_parent,
1373+
.set_parent = clk_rcg2_shared_set_parent,
1374+
.recalc_rate = clk_rcg2_shared_recalc_rate,
1375+
.determine_rate = clk_rcg2_determine_rate,
1376+
.set_rate = clk_rcg2_shared_set_rate,
1377+
.set_rate_and_parent = clk_rcg2_shared_set_rate_and_parent,
1378+
};
1379+
EXPORT_SYMBOL_GPL(clk_rcg2_shared_no_init_park_ops);
1380+
13511381
/* Common APIs to be used for DFS based RCGR */
13521382
static void clk_rcg2_dfs_populate_freq(struct clk_hw *hw, unsigned int l,
13531383
struct freq_tbl *f)

drivers/clk/qcom/gcc-sm8550.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ static struct clk_rcg2 gcc_usb30_prim_master_clk_src = {
11591159
.parent_data = gcc_parent_data_0,
11601160
.num_parents = ARRAY_SIZE(gcc_parent_data_0),
11611161
.flags = CLK_SET_RATE_PARENT,
1162-
.ops = &clk_rcg2_shared_ops,
1162+
.ops = &clk_rcg2_shared_no_init_park_ops,
11631163
},
11641164
};
11651165

0 commit comments

Comments
 (0)