Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

clk: mediatek: clk-mt8186-topckgen: Migrate to mtk_clk_simple_probe()

As done with MT8192, migrate MT8186 topckgen away from a custom probe
function and use mtk_clk_simple_{probe, remove}().

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Miles Chen <miles.chen@mediatek.com>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Link: https://lore.kernel.org/r/20230120092053.182923-21-angelogioacchino.delregno@collabora.com
Tested-by: Mingming Su <mingming.su@mediatek.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

AngeloGioacchino Del Regno and committed by
Stephen Boyd
75c12ea3 e09eb9d2

+19 -84
+19 -84
drivers/clk/mediatek/clk-mt8186-topckgen.c
··· 681 681 0x0320, 4, 0x0334, 8, 0), 682 682 }; 683 683 684 - static const struct of_device_id of_match_clk_mt8186_topck[] = { 685 - { .compatible = "mediatek,mt8186-topckgen", }, 686 - {} 687 - }; 688 - 689 684 /* Register mux notifier for MFG mux */ 690 685 static int clk_mt8186_reg_mfg_mux_notifier(struct device *dev, struct clk *clk) 691 686 { ··· 703 708 return devm_mtk_clk_mux_notifier_register(dev, clk, mfg_mux_nb); 704 709 } 705 710 706 - static int clk_mt8186_topck_probe(struct platform_device *pdev) 707 - { 708 - struct clk_hw_onecell_data *clk_data; 709 - struct device_node *node = pdev->dev.of_node; 710 - int r; 711 - void __iomem *base; 711 + static const struct mtk_clk_desc topck_desc = { 712 + .fixed_clks = top_fixed_clks, 713 + .num_fixed_clks = ARRAY_SIZE(top_fixed_clks), 714 + .factor_clks = top_divs, 715 + .num_factor_clks = ARRAY_SIZE(top_divs), 716 + .mux_clks = top_mtk_muxes, 717 + .num_mux_clks = ARRAY_SIZE(top_mtk_muxes), 718 + .composite_clks = top_muxes, 719 + .num_composite_clks = ARRAY_SIZE(top_muxes), 720 + .clk_lock = &mt8186_clk_lock, 721 + .clk_notifier_func = clk_mt8186_reg_mfg_mux_notifier, 722 + .mfg_clk_idx = CLK_TOP_MFG, 723 + }; 712 724 713 - clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK); 714 - if (!clk_data) 715 - return -ENOMEM; 716 - 717 - base = devm_platform_ioremap_resource(pdev, 0); 718 - if (IS_ERR(base)) { 719 - r = PTR_ERR(base); 720 - goto free_top_data; 721 - } 722 - 723 - r = mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), 724 - clk_data); 725 - if (r) 726 - goto free_top_data; 727 - 728 - r = mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data); 729 - if (r) 730 - goto unregister_fixed_clks; 731 - 732 - r = mtk_clk_register_muxes(&pdev->dev, top_mtk_muxes, 733 - ARRAY_SIZE(top_mtk_muxes), node, 734 - &mt8186_clk_lock, clk_data); 735 - if (r) 736 - goto unregister_factors; 737 - 738 - r = mtk_clk_register_composites(&pdev->dev, top_muxes, 739 - ARRAY_SIZE(top_muxes), base, 740 - &mt8186_clk_lock, clk_data); 741 - if (r) 742 - goto unregister_muxes; 743 - 744 - r = clk_mt8186_reg_mfg_mux_notifier(&pdev->dev, 745 - clk_data->hws[CLK_TOP_MFG]->clk); 746 - if (r) 747 - goto unregister_composite_muxes; 748 - 749 - r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); 750 - if (r) 751 - goto unregister_composite_muxes; 752 - 753 - platform_set_drvdata(pdev, clk_data); 754 - 755 - return r; 756 - 757 - unregister_composite_muxes: 758 - mtk_clk_unregister_composites(top_muxes, ARRAY_SIZE(top_muxes), clk_data); 759 - unregister_muxes: 760 - mtk_clk_unregister_muxes(top_mtk_muxes, ARRAY_SIZE(top_mtk_muxes), clk_data); 761 - unregister_factors: 762 - mtk_clk_unregister_factors(top_divs, ARRAY_SIZE(top_divs), clk_data); 763 - unregister_fixed_clks: 764 - mtk_clk_unregister_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), clk_data); 765 - free_top_data: 766 - mtk_free_clk_data(clk_data); 767 - return r; 768 - } 769 - 770 - static int clk_mt8186_topck_remove(struct platform_device *pdev) 771 - { 772 - struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev); 773 - struct device_node *node = pdev->dev.of_node; 774 - 775 - of_clk_del_provider(node); 776 - mtk_clk_unregister_composites(top_muxes, ARRAY_SIZE(top_muxes), clk_data); 777 - mtk_clk_unregister_muxes(top_mtk_muxes, ARRAY_SIZE(top_mtk_muxes), clk_data); 778 - mtk_clk_unregister_factors(top_divs, ARRAY_SIZE(top_divs), clk_data); 779 - mtk_clk_unregister_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), clk_data); 780 - mtk_free_clk_data(clk_data); 781 - 782 - return 0; 783 - } 725 + static const struct of_device_id of_match_clk_mt8186_topck[] = { 726 + { .compatible = "mediatek,mt8186-topckgen", .data = &topck_desc }, 727 + { /* sentinel */ } 728 + }; 784 729 785 730 static struct platform_driver clk_mt8186_topck_drv = { 786 - .probe = clk_mt8186_topck_probe, 787 - .remove = clk_mt8186_topck_remove, 731 + .probe = mtk_clk_simple_probe, 732 + .remove = mtk_clk_simple_remove, 788 733 .driver = { 789 734 .name = "clk-mt8186-topck", 790 735 .of_match_table = of_match_clk_mt8186_topck,