Commit 5a60b5aa authored by Stephen Boyd's avatar Stephen Boyd
Browse files

Merge tag 'clk-v5.4-samsung-fixes' of...

Merge tag 'clk-v5.4-samsung-fixes' of https://git.kernel.org/pub/scm/linux/kernel/git/snawrocki/clk into clk-fixes

Pull Samsung clk driver fixes from Sylwester Nawrocki:

 - system suspend related fixes for the exynos542x clocks driver
 - probe() error paths fixes in the exynos5433 CMU driver adding
   proper release of memory and clk resources

* tag 'clk-v5.4-samsung-fixes' of https://git.kernel.org/pub/scm/linux/kernel/git/snawrocki/clk:
  clk: samsung: exynos5420: Preserve PLL configuration during suspend/resume
  clk: samsung: exynos542x: Move G3D subsystem clocks to its sub-CMU
  clk: samsung: exynos5433: Fix error paths
parents 78bdf57e e9323b66
Loading
Loading
Loading
Loading
+25 −2
Original line number Diff line number Diff line
@@ -165,12 +165,18 @@ static const unsigned long exynos5x_clk_regs[] __initconst = {
	GATE_BUS_CPU,
	GATE_SCLK_CPU,
	CLKOUT_CMU_CPU,
	CPLL_CON0,
	DPLL_CON0,
	EPLL_CON0,
	EPLL_CON1,
	EPLL_CON2,
	RPLL_CON0,
	RPLL_CON1,
	RPLL_CON2,
	IPLL_CON0,
	SPLL_CON0,
	VPLL_CON0,
	MPLL_CON0,
	SRC_TOP0,
	SRC_TOP1,
	SRC_TOP2,
@@ -1172,8 +1178,6 @@ static const struct samsung_gate_clock exynos5x_gate_clks[] __initconst = {
	GATE(CLK_SCLK_ISP_SENSOR2, "sclk_isp_sensor2", "dout_isp_sensor2",
			GATE_TOP_SCLK_ISP, 12, CLK_SET_RATE_PARENT, 0),

	GATE(CLK_G3D, "g3d", "mout_user_aclk_g3d", GATE_IP_G3D, 9, 0, 0),

	/* CDREX */
	GATE(CLK_CLKM_PHY0, "clkm_phy0", "dout_sclk_cdrex",
			GATE_BUS_CDREX0, 0, 0, 0),
@@ -1248,6 +1252,15 @@ static struct exynos5_subcmu_reg_dump exynos5x_gsc_suspend_regs[] = {
	{ DIV2_RATIO0, 0, 0x30 },	/* DIV dout_gscl_blk_300 */
};

static const struct samsung_gate_clock exynos5x_g3d_gate_clks[] __initconst = {
	GATE(CLK_G3D, "g3d", "mout_user_aclk_g3d", GATE_IP_G3D, 9, 0, 0),
};

static struct exynos5_subcmu_reg_dump exynos5x_g3d_suspend_regs[] = {
	{ GATE_IP_G3D, 0x3ff, 0x3ff },	/* G3D gates */
	{ SRC_TOP5, 0, BIT(16) },	/* MUX mout_user_aclk_g3d */
};

static const struct samsung_div_clock exynos5x_mfc_div_clks[] __initconst = {
	DIV(0, "dout_mfc_blk", "mout_user_aclk333", DIV4_RATIO, 0, 2),
};
@@ -1320,6 +1333,14 @@ static const struct exynos5_subcmu_info exynos5x_gsc_subcmu = {
	.pd_name	= "GSC",
};

static const struct exynos5_subcmu_info exynos5x_g3d_subcmu = {
	.gate_clks	= exynos5x_g3d_gate_clks,
	.nr_gate_clks	= ARRAY_SIZE(exynos5x_g3d_gate_clks),
	.suspend_regs	= exynos5x_g3d_suspend_regs,
	.nr_suspend_regs = ARRAY_SIZE(exynos5x_g3d_suspend_regs),
	.pd_name	= "G3D",
};

static const struct exynos5_subcmu_info exynos5x_mfc_subcmu = {
	.div_clks	= exynos5x_mfc_div_clks,
	.nr_div_clks	= ARRAY_SIZE(exynos5x_mfc_div_clks),
@@ -1351,6 +1372,7 @@ static const struct exynos5_subcmu_info exynos5800_mau_subcmu = {
static const struct exynos5_subcmu_info *exynos5x_subcmus[] = {
	&exynos5x_disp_subcmu,
	&exynos5x_gsc_subcmu,
	&exynos5x_g3d_subcmu,
	&exynos5x_mfc_subcmu,
	&exynos5x_mscl_subcmu,
};
@@ -1358,6 +1380,7 @@ static const struct exynos5_subcmu_info *exynos5x_subcmus[] = {
static const struct exynos5_subcmu_info *exynos5800_subcmus[] = {
	&exynos5x_disp_subcmu,
	&exynos5x_gsc_subcmu,
	&exynos5x_g3d_subcmu,
	&exynos5x_mfc_subcmu,
	&exynos5x_mscl_subcmu,
	&exynos5800_mau_subcmu,
+12 −2
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>

#include <dt-bindings/clock/exynos5433.h>

@@ -5584,6 +5585,8 @@ static int __init exynos5433_cmu_probe(struct platform_device *pdev)

	data->clk_save = samsung_clk_alloc_reg_dump(info->clk_regs,
						    info->nr_clk_regs);
	if (!data->clk_save)
		return -ENOMEM;
	data->nr_clk_save = info->nr_clk_regs;
	data->clk_suspend = info->suspend_regs;
	data->nr_clk_suspend = info->nr_suspend_regs;
@@ -5592,12 +5595,19 @@ static int __init exynos5433_cmu_probe(struct platform_device *pdev)
	if (data->nr_pclks > 0) {
		data->pclks = devm_kcalloc(dev, sizeof(struct clk *),
					   data->nr_pclks, GFP_KERNEL);

		if (!data->pclks) {
			kfree(data->clk_save);
			return -ENOMEM;
		}
		for (i = 0; i < data->nr_pclks; i++) {
			struct clk *clk = of_clk_get(dev->of_node, i);

			if (IS_ERR(clk))
			if (IS_ERR(clk)) {
				kfree(data->clk_save);
				while (--i >= 0)
					clk_put(data->pclks[i]);
				return PTR_ERR(clk);
			}
			data->pclks[i] = clk;
		}
	}