Commit b132c2a8 authored by Moudy Ho's avatar Moudy Ho Committed by Stephen Boyd
Browse files

clk: mediatek: remove MT8195 vppsys/0/1 simple_probe



MT8195 VPPSYS0/1 will be probed by the compatible name in
the mtk-mmsys driver and then probe its own clock driver as
a platform driver.

Signed-off-by: default avatarMoudy Ho <moudy.ho@mediatek.com>
Link: https://lore.kernel.org/r/20230118031509.29834-4-moudy.ho@mediatek.com


Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent dfea6ae3
Loading
Loading
Loading
Loading
+43 −15
Original line number Diff line number Diff line
@@ -86,26 +86,54 @@ static const struct mtk_gate vpp0_clks[] = {
	GATE_VPP0_2(CLK_VPP0_WARP1_MDP_DL_ASYNC, "vpp0_warp1_mdp_dl_async", "top_wpe_vpp", 3),
};

static const struct mtk_clk_desc vpp0_desc = {
	.clks = vpp0_clks,
	.num_clks = ARRAY_SIZE(vpp0_clks),
};
static int clk_mt8195_vpp0_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	struct device_node *node = dev->parent->of_node;
	struct clk_hw_onecell_data *clk_data;
	int r;

	clk_data = mtk_alloc_clk_data(CLK_VPP0_NR_CLK);
	if (!clk_data)
		return -ENOMEM;

	r = mtk_clk_register_gates(dev, node, vpp0_clks, ARRAY_SIZE(vpp0_clks), clk_data);
	if (r)
		goto free_vpp0_data;

	r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
	if (r)
		goto unregister_gates;

	platform_set_drvdata(pdev, clk_data);

static const struct of_device_id of_match_clk_mt8195_vpp0[] = {
	return r;

unregister_gates:
	mtk_clk_unregister_gates(vpp0_clks, ARRAY_SIZE(vpp0_clks), clk_data);
free_vpp0_data:
	mtk_free_clk_data(clk_data);
	return r;
}

static int clk_mt8195_vpp0_remove(struct platform_device *pdev)
{
		.compatible = "mediatek,mt8195-vppsys0",
		.data = &vpp0_desc,
	}, {
		/* sentinel */
	struct device *dev = &pdev->dev;
	struct device_node *node = dev->parent->of_node;
	struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);

	of_clk_del_provider(node);
	mtk_clk_unregister_gates(vpp0_clks, ARRAY_SIZE(vpp0_clks), clk_data);
	mtk_free_clk_data(clk_data);

	return 0;
}
};

static struct platform_driver clk_mt8195_vpp0_drv = {
	.probe = mtk_clk_simple_probe,
	.remove = mtk_clk_simple_remove,
	.probe = clk_mt8195_vpp0_probe,
	.remove = clk_mt8195_vpp0_remove,
	.driver = {
		.name = "clk-mt8195-vpp0",
		.of_match_table = of_match_clk_mt8195_vpp0,
	},
};
builtin_platform_driver(clk_mt8195_vpp0_drv);
+43 −15
Original line number Diff line number Diff line
@@ -84,26 +84,54 @@ static const struct mtk_gate vpp1_clks[] = {
	GATE_VPP1_1(CLK_VPP1_VPP_SPLIT_26M, "vpp1_vpp_split_26m", "clk26m", 26),
};

static const struct mtk_clk_desc vpp1_desc = {
	.clks = vpp1_clks,
	.num_clks = ARRAY_SIZE(vpp1_clks),
};
static int clk_mt8195_vpp1_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	struct device_node *node = dev->parent->of_node;
	struct clk_hw_onecell_data *clk_data;
	int r;

	clk_data = mtk_alloc_clk_data(CLK_VPP1_NR_CLK);
	if (!clk_data)
		return -ENOMEM;

	r = mtk_clk_register_gates(dev, node, vpp1_clks, ARRAY_SIZE(vpp1_clks), clk_data);
	if (r)
		goto free_vpp1_data;

	r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
	if (r)
		goto unregister_gates;

	platform_set_drvdata(pdev, clk_data);

static const struct of_device_id of_match_clk_mt8195_vpp1[] = {
	return r;

unregister_gates:
	mtk_clk_unregister_gates(vpp1_clks, ARRAY_SIZE(vpp1_clks), clk_data);
free_vpp1_data:
	mtk_free_clk_data(clk_data);
	return r;
}

static int clk_mt8195_vpp1_remove(struct platform_device *pdev)
{
		.compatible = "mediatek,mt8195-vppsys1",
		.data = &vpp1_desc,
	}, {
		/* sentinel */
	struct device *dev = &pdev->dev;
	struct device_node *node = dev->parent->of_node;
	struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);

	of_clk_del_provider(node);
	mtk_clk_unregister_gates(vpp1_clks, ARRAY_SIZE(vpp1_clks), clk_data);
	mtk_free_clk_data(clk_data);

	return 0;
}
};

static struct platform_driver clk_mt8195_vpp1_drv = {
	.probe = mtk_clk_simple_probe,
	.remove = mtk_clk_simple_remove,
	.probe = clk_mt8195_vpp1_probe,
	.remove = clk_mt8195_vpp1_remove,
	.driver = {
		.name = "clk-mt8195-vpp1",
		.of_match_table = of_match_clk_mt8195_vpp1,
	},
};
builtin_platform_driver(clk_mt8195_vpp1_drv);