Commit 973d1607 authored by Miles Chen's avatar Miles Chen Committed by Chen-Yu Tsai

clk: mediatek: mt2701: use mtk_clk_simple_probe to simplify driver

mtk_clk_simple_probe was added by Chun-Jie to simply common flow
of MediaTek clock drivers and ChenYu enhanced the error path of
mtk_clk_simple_probe and added mtk_clk_simple_remove.

Let's use mtk_clk_simple_probe and mtk_clk_simple_probe in other
MediaTek clock drivers as well.
Signed-off-by: default avatarMiles Chen <miles.chen@mediatek.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220922091841.4099-2-miles.chen@mediatek.comSigned-off-by: default avatarChen-Yu Tsai <wenst@chromium.org>
parent 0d363282
...@@ -94,33 +94,23 @@ static const struct mtk_gate bdp_clks[] = { ...@@ -94,33 +94,23 @@ static const struct mtk_gate bdp_clks[] = {
GATE_BDP1(CLK_BDP_HDMI_MON, "hdmi_mon", "hdmi_0_pll340m", 16), GATE_BDP1(CLK_BDP_HDMI_MON, "hdmi_mon", "hdmi_0_pll340m", 16),
}; };
static const struct of_device_id of_match_clk_mt2701_bdp[] = { static const struct mtk_clk_desc bdp_desc = {
{ .compatible = "mediatek,mt2701-bdpsys", }, .clks = bdp_clks,
{} .num_clks = ARRAY_SIZE(bdp_clks),
}; };
static int clk_mt2701_bdp_probe(struct platform_device *pdev) static const struct of_device_id of_match_clk_mt2701_bdp[] = {
{ {
struct clk_hw_onecell_data *clk_data; .compatible = "mediatek,mt2701-bdpsys",
int r; .data = &bdp_desc,
struct device_node *node = pdev->dev.of_node; }, {
/* sentinel */
clk_data = mtk_alloc_clk_data(CLK_BDP_NR); }
};
mtk_clk_register_gates(node, bdp_clks, ARRAY_SIZE(bdp_clks),
clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r)
dev_err(&pdev->dev,
"could not register clock provider: %s: %d\n",
pdev->name, r);
return r;
}
static struct platform_driver clk_mt2701_bdp_drv = { static struct platform_driver clk_mt2701_bdp_drv = {
.probe = clk_mt2701_bdp_probe, .probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = { .driver = {
.name = "clk-mt2701-bdp", .name = "clk-mt2701-bdp",
.of_match_table = of_match_clk_mt2701_bdp, .of_match_table = of_match_clk_mt2701_bdp,
......
...@@ -36,33 +36,23 @@ static const struct mtk_gate img_clks[] = { ...@@ -36,33 +36,23 @@ static const struct mtk_gate img_clks[] = {
GATE_IMG(CLK_IMG_VENC, "img_venc", "mm_sel", 9), GATE_IMG(CLK_IMG_VENC, "img_venc", "mm_sel", 9),
}; };
static const struct of_device_id of_match_clk_mt2701_img[] = { static const struct mtk_clk_desc img_desc = {
{ .compatible = "mediatek,mt2701-imgsys", }, .clks = img_clks,
{} .num_clks = ARRAY_SIZE(img_clks),
}; };
static int clk_mt2701_img_probe(struct platform_device *pdev) static const struct of_device_id of_match_clk_mt2701_img[] = {
{ {
struct clk_hw_onecell_data *clk_data; .compatible = "mediatek,mt2701-imgsys",
int r; .data = &img_desc,
struct device_node *node = pdev->dev.of_node; }, {
/* sentinel */
clk_data = mtk_alloc_clk_data(CLK_IMG_NR); }
};
mtk_clk_register_gates(node, img_clks, ARRAY_SIZE(img_clks),
clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r)
dev_err(&pdev->dev,
"could not register clock provider: %s: %d\n",
pdev->name, r);
return r;
}
static struct platform_driver clk_mt2701_img_drv = { static struct platform_driver clk_mt2701_img_drv = {
.probe = clk_mt2701_img_probe, .probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = { .driver = {
.name = "clk-mt2701-img", .name = "clk-mt2701-img",
.of_match_table = of_match_clk_mt2701_img, .of_match_table = of_match_clk_mt2701_img,
......
...@@ -47,33 +47,23 @@ static const struct mtk_gate vdec_clks[] = { ...@@ -47,33 +47,23 @@ static const struct mtk_gate vdec_clks[] = {
GATE_VDEC1(CLK_VDEC_LARB, "vdec_larb_cken", "mm_sel", 0), GATE_VDEC1(CLK_VDEC_LARB, "vdec_larb_cken", "mm_sel", 0),
}; };
static const struct of_device_id of_match_clk_mt2701_vdec[] = { static const struct mtk_clk_desc vdec_desc = {
{ .compatible = "mediatek,mt2701-vdecsys", }, .clks = vdec_clks,
{} .num_clks = ARRAY_SIZE(vdec_clks),
}; };
static int clk_mt2701_vdec_probe(struct platform_device *pdev) static const struct of_device_id of_match_clk_mt2701_vdec[] = {
{ {
struct clk_hw_onecell_data *clk_data; .compatible = "mediatek,mt2701-vdecsys",
int r; .data = &vdec_desc,
struct device_node *node = pdev->dev.of_node; }, {
/* sentinel */
clk_data = mtk_alloc_clk_data(CLK_VDEC_NR); }
};
mtk_clk_register_gates(node, vdec_clks, ARRAY_SIZE(vdec_clks),
clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r)
dev_err(&pdev->dev,
"could not register clock provider: %s: %d\n",
pdev->name, r);
return r;
}
static struct platform_driver clk_mt2701_vdec_drv = { static struct platform_driver clk_mt2701_vdec_drv = {
.probe = clk_mt2701_vdec_probe, .probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = { .driver = {
.name = "clk-mt2701-vdec", .name = "clk-mt2701-vdec",
.of_match_table = of_match_clk_mt2701_vdec, .of_match_table = of_match_clk_mt2701_vdec,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment