Skip to content

Commit b6adeb6

Browse files
Sylwester Nawrockibebarino
authored andcommitted
clk: samsung: exynos5800: Move MAU subsystem clocks to MAU sub-CMU
This patch fixes broken sound on Exynos5422/5800 platforms after system/suspend resume cycle in cases where the audio root clock is derived from MAU_EPLL_CLK. In order to preserve state of the USER_MUX_MAU_EPLL_CLK clock mux during system suspend/resume cycle for Exynos5800 we group the MAU block input clocks in "MAU" sub-CMU and add the clock mux control bit to .suspend_regs. This ensures that user configuration of the mux is not lost after the PMU block changes the mux setting to OSC_DIV when switching off the MAU power domain. Adding the SRC_TOP9 register to exynos5800_clk_regs[] array is not sufficient as at the time of the syscore_ops suspend call MAU power domain is already turned off and we already save and subsequently restore an incorrect register's value. Fixes: b06a532 ("clk: samsung: Add Exynos5 sub-CMU clock driver") Reported-by: Jaafar Ali <[email protected]> Suggested-by: Marek Szyprowski <[email protected]> Tested-by: Jaafar Ali <[email protected]> Signed-off-by: Sylwester Nawrocki <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent bf32e7d commit b6adeb6

File tree

1 file changed

+43
-11
lines changed

1 file changed

+43
-11
lines changed

drivers/clk/samsung/clk-exynos5420.c

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,6 @@ static const struct samsung_gate_clock exynos5800_gate_clks[] __initconst = {
534534
GATE_BUS_TOP, 24, 0, 0),
535535
GATE(CLK_ACLK432_SCALER, "aclk432_scaler", "mout_user_aclk432_scaler",
536536
GATE_BUS_TOP, 27, CLK_IS_CRITICAL, 0),
537-
GATE(CLK_MAU_EPLL, "mau_epll", "mout_user_mau_epll",
538-
SRC_MASK_TOP7, 20, CLK_SET_RATE_PARENT, 0),
539537
};
540538

541539
static const struct samsung_mux_clock exynos5420_mux_clks[] __initconst = {
@@ -577,8 +575,13 @@ static const struct samsung_div_clock exynos5420_div_clks[] __initconst = {
577575

578576
static const struct samsung_gate_clock exynos5420_gate_clks[] __initconst = {
579577
GATE(CLK_SECKEY, "seckey", "aclk66_psgen", GATE_BUS_PERIS1, 1, 0, 0),
578+
/* Maudio Block */
580579
GATE(CLK_MAU_EPLL, "mau_epll", "mout_mau_epll_clk",
581580
SRC_MASK_TOP7, 20, CLK_SET_RATE_PARENT, 0),
581+
GATE(CLK_SCLK_MAUDIO0, "sclk_maudio0", "dout_maudio0",
582+
GATE_TOP_SCLK_MAU, 0, CLK_SET_RATE_PARENT, 0),
583+
GATE(CLK_SCLK_MAUPCM0, "sclk_maupcm0", "dout_maupcm0",
584+
GATE_TOP_SCLK_MAU, 1, CLK_SET_RATE_PARENT, 0),
582585
};
583586

584587
static const struct samsung_mux_clock exynos5x_mux_clks[] __initconst = {
@@ -1017,12 +1020,6 @@ static const struct samsung_gate_clock exynos5x_gate_clks[] __initconst = {
10171020
GATE(CLK_SCLK_DP1, "sclk_dp1", "dout_dp1",
10181021
GATE_TOP_SCLK_DISP1, 20, CLK_SET_RATE_PARENT, 0),
10191022

1020-
/* Maudio Block */
1021-
GATE(CLK_SCLK_MAUDIO0, "sclk_maudio0", "dout_maudio0",
1022-
GATE_TOP_SCLK_MAU, 0, CLK_SET_RATE_PARENT, 0),
1023-
GATE(CLK_SCLK_MAUPCM0, "sclk_maupcm0", "dout_maupcm0",
1024-
GATE_TOP_SCLK_MAU, 1, CLK_SET_RATE_PARENT, 0),
1025-
10261023
/* FSYS Block */
10271024
GATE(CLK_TSI, "tsi", "aclk200_fsys", GATE_BUS_FSYS0, 0, 0, 0),
10281025
GATE(CLK_PDMA0, "pdma0", "aclk200_fsys", GATE_BUS_FSYS0, 1, 0, 0),
@@ -1281,6 +1278,20 @@ static struct exynos5_subcmu_reg_dump exynos5x_mfc_suspend_regs[] = {
12811278
{ DIV4_RATIO, 0, 0x3 }, /* DIV dout_mfc_blk */
12821279
};
12831280

1281+
1282+
static const struct samsung_gate_clock exynos5800_mau_gate_clks[] __initconst = {
1283+
GATE(CLK_MAU_EPLL, "mau_epll", "mout_user_mau_epll",
1284+
SRC_MASK_TOP7, 20, CLK_SET_RATE_PARENT, 0),
1285+
GATE(CLK_SCLK_MAUDIO0, "sclk_maudio0", "dout_maudio0",
1286+
GATE_TOP_SCLK_MAU, 0, CLK_SET_RATE_PARENT, 0),
1287+
GATE(CLK_SCLK_MAUPCM0, "sclk_maupcm0", "dout_maupcm0",
1288+
GATE_TOP_SCLK_MAU, 1, CLK_SET_RATE_PARENT, 0),
1289+
};
1290+
1291+
static struct exynos5_subcmu_reg_dump exynos5800_mau_suspend_regs[] = {
1292+
{ SRC_TOP9, 0, BIT(8) }, /* MUX mout_user_mau_epll */
1293+
};
1294+
12841295
static const struct exynos5_subcmu_info exynos5x_disp_subcmu = {
12851296
.div_clks = exynos5x_disp_div_clks,
12861297
.nr_div_clks = ARRAY_SIZE(exynos5x_disp_div_clks),
@@ -1311,12 +1322,27 @@ static const struct exynos5_subcmu_info exynos5x_mfc_subcmu = {
13111322
.pd_name = "MFC",
13121323
};
13131324

1325+
static const struct exynos5_subcmu_info exynos5800_mau_subcmu = {
1326+
.gate_clks = exynos5800_mau_gate_clks,
1327+
.nr_gate_clks = ARRAY_SIZE(exynos5800_mau_gate_clks),
1328+
.suspend_regs = exynos5800_mau_suspend_regs,
1329+
.nr_suspend_regs = ARRAY_SIZE(exynos5800_mau_suspend_regs),
1330+
.pd_name = "MAU",
1331+
};
1332+
13141333
static const struct exynos5_subcmu_info *exynos5x_subcmus[] = {
13151334
&exynos5x_disp_subcmu,
13161335
&exynos5x_gsc_subcmu,
13171336
&exynos5x_mfc_subcmu,
13181337
};
13191338

1339+
static const struct exynos5_subcmu_info *exynos5800_subcmus[] = {
1340+
&exynos5x_disp_subcmu,
1341+
&exynos5x_gsc_subcmu,
1342+
&exynos5x_mfc_subcmu,
1343+
&exynos5800_mau_subcmu,
1344+
};
1345+
13201346
static const struct samsung_pll_rate_table exynos5420_pll2550x_24mhz_tbl[] __initconst = {
13211347
PLL_35XX_RATE(24 * MHZ, 2000000000, 250, 3, 0),
13221348
PLL_35XX_RATE(24 * MHZ, 1900000000, 475, 6, 0),
@@ -1547,11 +1573,17 @@ static void __init exynos5x_clk_init(struct device_node *np,
15471573
samsung_clk_extended_sleep_init(reg_base,
15481574
exynos5x_clk_regs, ARRAY_SIZE(exynos5x_clk_regs),
15491575
exynos5420_set_clksrc, ARRAY_SIZE(exynos5420_set_clksrc));
1550-
if (soc == EXYNOS5800)
1576+
1577+
if (soc == EXYNOS5800) {
15511578
samsung_clk_sleep_init(reg_base, exynos5800_clk_regs,
15521579
ARRAY_SIZE(exynos5800_clk_regs));
1553-
exynos5_subcmus_init(ctx, ARRAY_SIZE(exynos5x_subcmus),
1554-
exynos5x_subcmus);
1580+
1581+
exynos5_subcmus_init(ctx, ARRAY_SIZE(exynos5800_subcmus),
1582+
exynos5800_subcmus);
1583+
} else {
1584+
exynos5_subcmus_init(ctx, ARRAY_SIZE(exynos5x_subcmus),
1585+
exynos5x_subcmus);
1586+
}
15551587

15561588
samsung_clk_of_add_provider(np, ctx);
15571589
}

0 commit comments

Comments
 (0)