Skip to content

Commit 672daf2

Browse files
lumagandersson
authored andcommitted
clk: qcom: mmcc-msm8960: handle LVDS clock
On APQ8064 the DSI2_PIXEL_SRC clock can be used either to drive the second DSI host or to drive the LCDC controller. Add LVDS PLL as possible source to the clock and LVDS output clock. The DSI2_PIXEL_SRC clock has separate path to be used for the LVDS clock. To represent both DSI and LVDS clocks properly, add intermediate clock which toggles the enable bit and make DSI2_PIXEL_CLK clock just check for the HALT bit. Signed-off-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent a34d21d commit 672daf2

File tree

1 file changed

+57
-4
lines changed

1 file changed

+57
-4
lines changed

drivers/clk/qcom/mmcc-msm8960.c

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ enum {
3737
P_DSI2_PLL_DSICLK,
3838
P_DSI1_PLL_BYTECLK,
3939
P_DSI2_PLL_BYTECLK,
40+
P_LVDS_PLL,
4041
};
4142

4243
#define F_MN(f, s, _m, _n) { .freq = f, .src = s, .m = _m, .n = _n }
@@ -143,6 +144,20 @@ static const struct clk_parent_data mmcc_pxo_dsi2_dsi1[] = {
143144
{ .fw_name = "dsi1pll", .name = "dsi1pll" },
144145
};
145146

147+
static const struct parent_map mmcc_pxo_dsi2_dsi1_lvds_map[] = {
148+
{ P_PXO, 0 },
149+
{ P_DSI2_PLL_DSICLK, 1 },
150+
{ P_LVDS_PLL, 2 },
151+
{ P_DSI1_PLL_DSICLK, 3 },
152+
};
153+
154+
static const struct clk_parent_data mmcc_pxo_dsi2_dsi1_lvds[] = {
155+
{ .fw_name = "pxo", .name = "pxo_board" },
156+
{ .fw_name = "dsi2pll", .name = "dsi2pll" },
157+
{ .fw_name = "lvdspll", .name = "mpd4_lvds_pll" },
158+
{ .fw_name = "dsi1pll", .name = "dsi1pll" },
159+
};
160+
146161
static const struct parent_map mmcc_pxo_dsi1_dsi2_byte_map[] = {
147162
{ P_PXO, 0 },
148163
{ P_DSI1_PLL_BYTECLK, 1 },
@@ -2439,26 +2454,42 @@ static struct clk_rcg dsi2_pixel_src = {
24392454
},
24402455
.s = {
24412456
.src_sel_shift = 0,
2442-
.parent_map = mmcc_pxo_dsi2_dsi1_map,
2457+
.parent_map = mmcc_pxo_dsi2_dsi1_lvds_map,
24432458
},
24442459
.clkr = {
24452460
.enable_reg = 0x0094,
24462461
.enable_mask = BIT(2),
24472462
.hw.init = &(struct clk_init_data){
24482463
.name = "dsi2_pixel_src",
2449-
.parent_data = mmcc_pxo_dsi2_dsi1,
2450-
.num_parents = ARRAY_SIZE(mmcc_pxo_dsi2_dsi1),
2464+
.parent_data = mmcc_pxo_dsi2_dsi1_lvds,
2465+
.num_parents = ARRAY_SIZE(mmcc_pxo_dsi2_dsi1_lvds),
24512466
.ops = &clk_rcg_pixel_ops,
24522467
},
24532468
},
24542469
};
24552470

2471+
static struct clk_branch dsi2_pixel_lvds_src = {
2472+
.clkr = {
2473+
.enable_reg = 0x0094,
2474+
.enable_mask = BIT(0),
2475+
.hw.init = &(struct clk_init_data){
2476+
.name = "dsi2_pixel_lvds_src",
2477+
.parent_hws = (const struct clk_hw*[]){
2478+
&dsi2_pixel_src.clkr.hw
2479+
},
2480+
.num_parents = 1,
2481+
.ops = &clk_branch_simple_ops,
2482+
.flags = CLK_SET_RATE_PARENT,
2483+
},
2484+
},
2485+
};
2486+
24562487
static struct clk_branch dsi2_pixel_clk = {
24572488
.halt_reg = 0x01d0,
24582489
.halt_bit = 19,
24592490
.clkr = {
24602491
.enable_reg = 0x0094,
2461-
.enable_mask = BIT(0),
2492+
.enable_mask = 0,
24622493
.hw.init = &(struct clk_init_data){
24632494
.name = "mdp_pclk2_clk",
24642495
.parent_hws = (const struct clk_hw*[]){
@@ -2471,6 +2502,24 @@ static struct clk_branch dsi2_pixel_clk = {
24712502
},
24722503
};
24732504

2505+
static struct clk_branch lvds_clk = {
2506+
.halt_reg = 0x024c,
2507+
.halt_bit = 6,
2508+
.clkr = {
2509+
.enable_reg = 0x0264,
2510+
.enable_mask = BIT(1),
2511+
.hw.init = &(struct clk_init_data){
2512+
.name = "mdp_lvds_clk",
2513+
.parent_hws = (const struct clk_hw*[]){
2514+
&dsi2_pixel_lvds_src.clkr.hw
2515+
},
2516+
.num_parents = 1,
2517+
.ops = &clk_branch_ops,
2518+
.flags = CLK_SET_RATE_PARENT,
2519+
},
2520+
},
2521+
};
2522+
24742523
static struct clk_branch gfx2d0_ahb_clk = {
24752524
.hwcg_reg = 0x0038,
24762525
.hwcg_bit = 28,
@@ -2799,6 +2848,8 @@ static struct clk_regmap *mmcc_msm8960_clks[] = {
27992848
[CSIPHY1_TIMER_CLK] = &csiphy1_timer_clk.clkr,
28002849
[CSIPHY0_TIMER_CLK] = &csiphy0_timer_clk.clkr,
28012850
[PLL2] = &pll2.clkr,
2851+
[DSI2_PIXEL_LVDS_SRC] = &dsi2_pixel_lvds_src.clkr,
2852+
[LVDS_CLK] = &lvds_clk.clkr,
28022853
};
28032854

28042855
static const struct qcom_reset_map mmcc_msm8960_resets[] = {
@@ -2983,6 +3034,8 @@ static struct clk_regmap *mmcc_apq8064_clks[] = {
29833034
[VCAP_CLK] = &vcap_clk.clkr,
29843035
[VCAP_NPL_CLK] = &vcap_npl_clk.clkr,
29853036
[PLL15] = &pll15.clkr,
3037+
[DSI2_PIXEL_LVDS_SRC] = &dsi2_pixel_lvds_src.clkr,
3038+
[LVDS_CLK] = &lvds_clk.clkr,
29863039
};
29873040

29883041
static const struct qcom_reset_map mmcc_apq8064_resets[] = {

0 commit comments

Comments
 (0)