Migrate MT8195 VPPSYS 0/1 to mtk-mmsys driver
Subsystems (3)
v6 cover Migrate MT8195 VPPSYS 0/1 to mtk-mmsys driver
Change since v5:
- Rebase on linux-next.
- Correct the compatible enumeration order in "mediatek,mmsys.yaml".
Hi,
This series splits patches from the original mailing list below:
https://patchwork.kernel.org/project/linux-mediatek/list/?series=711592
Refer to the comments of 0/8 and 1/8 in the following series:
https://patchwork.kernel.org/project/linux-mediatek/list/?series=702518
All about the MT8195 VPPSYS 0/1 should be probed from the "mtk-mmsys" driver, which then starts its own clock driver as the platform driver.
Moudy Ho (3):
dt-bindings: arm: mediatek: migrate MT8195 vppsys0/1 to mtk-mmsys
driver
dt-bindings: arm: mediatek: mmsys: Add support for MT8195 VPPSYS
clk: mediatek: remove MT8195 vppsys/0/1 simple_probe
Roy-CW.Yeh (1):
soc: mediatek: mmsys: add support for MT8195 VPPSYS
.../bindings/arm/mediatek/mediatek,mmsys.yaml | 2 + .../arm/mediatek/mediatek,mt8195-clock.yaml | 16 ----- drivers/clk/mediatek/clk-mt8195-vpp0.c | 58 ++++++++++++++----- drivers/clk/mediatek/clk-mt8195-vpp1.c | 58 ++++++++++++++----- drivers/soc/mediatek/mtk-mmsys.c | 22 +++++++ drivers/soc/mediatek/mtk-mmsys.h | 1 + 6 files changed, 111 insertions(+), 46 deletions(-)
Signature · 1 line
2.18.0
PATCH v6 1/4 dt-bindings: arm: mediatek: migrate MT8195 vppsys0/1 to mtk-mmsys driver
MT8195 VPPSYS 0/1 should be probed from mtk-mmsys driver to populate device by platform_device_register_data then start its own clock driver.
--- .../arm/mediatek/mediatek,mt8195-clock.yaml | 16 ---------------- 1 file changed, 16 deletions(-)
Documentation/devicetree/bindings/arm/mediatek/mediatek,mt8195-clock.yaml +0 -16
@@ -28,11 +28,9 @@ properties: - mediatek,mt8195-imp_iic_wrap_s - mediatek,mt8195-imp_iic_wrap_w - mediatek,mt8195-mfgcfg - - mediatek,mt8195-vppsys0 - mediatek,mt8195-wpesys - mediatek,mt8195-wpesys_vpp0 - mediatek,mt8195-wpesys_vpp1 - - mediatek,mt8195-vppsys1 - mediatek,mt8195-imgsys - mediatek,mt8195-imgsys1_dip_top - mediatek,mt8195-imgsys1_dip_nr
@@ -92,13 +90,6 @@ examples: #clock-cells = <1>; }; - - | - vppsys0: clock-controller@14000000 { - compatible = "mediatek,mt8195-vppsys0"; - reg = <0x14000000 0x1000>; - #clock-cells = <1>; - }; - - | wpesys: clock-controller@14e00000 { compatible = "mediatek,mt8195-wpesys";
@@ -120,13 +111,6 @@ examples: #clock-cells = <1>; }; - - | - vppsys1: clock-controller@14f00000 { - compatible = "mediatek,mt8195-vppsys1"; - reg = <0x14f00000 0x1000>; - #clock-cells = <1>; - }; - - | imgsys: clock-controller@15000000 { compatible = "mediatek,mt8195-imgsys";
Signature · 1 line
2.18.0
Re: [PATCH v6 1/4] dt-bindings: arm: mediatek: migrate MT8195 vppsys0/1 to mtk-mmsys driver
Quoted 8 lines · Moudy Ho
MT8195 VPPSYS 0/1 should be probed from mtk-mmsys driver to populate device by
platform_device_register_datathen start its own clock driver.Signed-off-by Moudy Ho <[email protected]>--- .../arm/mediatek/mediatek,mt8195-clock.yaml | 16 ---------------- 1 file changed, 16 deletions(-)
Best regards,
Krzysztof
Re: [PATCH v6 1/4] dt-bindings: arm: mediatek: migrate MT8195 vppsys0/1 to mtk-mmsys driver
In reply to Moudy HoQuoted 5 lines · Moudy Ho
MT8195 VPPSYS 0/1 should be probed from mtk-mmsys driver to populate device by
platform_device_register_datathen start its own clock driver.Signed-off-by Moudy Ho <[email protected]>
Stephen, if you want I can take 1/4 and 3/4 through my tree. 3/4 shouldn't be a problem, not sure about this patch. In any case if you want me to do so, I'd need a Acked-by from you.
Regards,
Matthias
Quoted 48 lines
--- .../arm/mediatek/mediatek,mt8195-clock.yaml | 16 ---------------- 1 file changed, 16 deletions(-)Documentation/devicetree/bindings/arm/mediatek/mediatek,mt8195-clock.yaml +0
-16@@ -28,11 +28,9 @@ properties: - mediatek,mt8195-imp_iic_wrap_s - mediatek,mt8195-imp_iic_wrap_w - mediatek,mt8195-mfgcfg - - mediatek,mt8195-vppsys0 - mediatek,mt8195-wpesys - mediatek,mt8195-wpesys_vpp0 - mediatek,mt8195-wpesys_vpp1 - - mediatek,mt8195-vppsys1 - mediatek,mt8195-imgsys - mediatek,mt8195-imgsys1_dip_top - mediatek,mt8195-imgsys1_dip_nr@@ -92,13 +90,6 @@ examples: #clock-cells = <1>; }; - - | - vppsys0: clock-controller@14000000 { - compatible = "mediatek,mt8195-vppsys0"; - reg = <0x14000000 0x1000>; - #clock-cells = <1>; - }; - - | wpesys: clock-controller@14e00000 { compatible = "mediatek,mt8195-wpesys";@@ -120,13 +111,6 @@ examples: #clock-cells = <1>; }; - - | - vppsys1: clock-controller@14f00000 { - compatible = "mediatek,mt8195-vppsys1"; - reg = <0x14f00000 0x1000>; - #clock-cells = <1>; - }; - - | imgsys: clock-controller@15000000 { compatible = "mediatek,mt8195-imgsys";
Stephen Boyd
maintainerRe: [PATCH v6 1/4] dt-bindings: arm: mediatek: migrate MT8195 vppsys0/1 to mtk-mmsys driver
Quoting Matthias Brugger (2023-01-19 08:08:48)
Quoted 7 lines · Moudy Ho
Quoted 4 lines
MT8195 VPPSYS 0/1 should be probed from mtk-mmsys driver to populate device by
platform_device_register_datathen start its own clock driver.
Quoted 7 lines
Quoted 1 line
Signed-off-by Moudy Ho <[email protected]>Reviewed-by Matthias Brugger <[email protected]>Stephen, if you want I can take 1/4 and 3/4 through my tree. 3/4 shouldn't be a problem, not sure about this patch. In any case if you want me to do so, I'd need a Acked-by from you.
Do you need to take them? I'm picking up mediatek patches currently so I can probably just take 1 and 3 if there isn't any build dependency.
Matthias Brugger
maintainerRe: [PATCH v6 1/4] dt-bindings: arm: mediatek: migrate MT8195 vppsys0/1 to mtk-mmsys driver
Quoted 10 lines · Stephen Boyd
Quoting Matthias Brugger (2023-01-19 08:08:48)
Quoted 9 lines · Moudy Ho
Quoted 5 lines
MT8195 VPPSYS 0/1 should be probed from mtk-mmsys driver to populate device by
platform_device_register_datathen start its own clock driver.Signed-off-by Moudy Ho <[email protected]>
Quoted 8 lines
Quoted 5 lines
Reviewed-by Matthias Brugger <[email protected]>Stephen, if you want I can take 1/4 and 3/4 through my tree. 3/4 shouldn't be a problem, not sure about this patch. In any case if you want me to do so, I'd need a Acked-by from you.
Do you need to take them? I'm picking up mediatek patches currently so I can probably just take 1 and 3 if there isn't any build dependency.
No I don't need to, no build depencies. Ok, I'll take 1 and 3 then.
Matthias Brugger
maintainerRe: [PATCH v6 1/4] dt-bindings: arm: mediatek: migrate MT8195 vppsys0/1 to mtk-mmsys driver
Quoted 15 lines · Matthias Brugger
Quoted 12 lines · Stephen Boyd
Quoting Matthias Brugger (2023-01-19 08:08:48)
Quoted 11 lines · Moudy Ho
Quoted 5 lines
MT8195 VPPSYS 0/1 should be probed from mtk-mmsys driver to populate device by
platform_device_register_datathen start its own clock driver.Signed-off-by Moudy Ho <[email protected]>Reviewed-by Matthias Brugger <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Stephen, if you want I can take 1/4 and 3/4 through my tree. 3/4 shouldn't be a problem, not sure about this patch. In any case if you want me to do so, I'd need a Acked-by from you.
Do you need to take them? I'm picking up mediatek patches currently so I can probably just take 1 and 3 if there isn't any build dependency.
No I don't need to, no build depencies. Ok, I'll take 1 and 3 then.
Argh, 2 and 4 of course. 1 and 3 will go through your tree. Sorry for the confusion.
Matthias
Re: [PATCH v6 1/4] dt-bindings: arm: mediatek: migrate MT8195 vppsys0/1 to mtk-mmsys driver
In reply to Moudy HoQuoting Moudy Ho (2023-01-17 19:15:06)
Quoted 6 lines
MT8195 VPPSYS 0/1 should be probed from mtk-mmsys driver to populate device by
platform_device_register_datathen start its own clock driver.Signed-off-by Moudy Ho <[email protected]>---
Applied to clk-next
PATCH v6 2/4 dt-bindings: arm: mediatek: mmsys: Add support for MT8195 VPPSYS
In reply to Moudy HoFor MT8195, VPPSYS0 and VPPSYS1 are 2 display pipes with hardware differences in power domains, clocks and subsystem counts, which should be determined by compatible names.
--- .../devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml +2 -0
@@ -33,6 +33,8 @@ properties: - mediatek,mt8186-mmsys - mediatek,mt8188-vdosys0 - mediatek,mt8192-mmsys + - mediatek,mt8195-vppsys0 + - mediatek,mt8195-vppsys1 - mediatek,mt8365-mmsys - const: syscon
Signature · 1 line
2.18.0
Re: [PATCH v6 2/4] dt-bindings: arm: mediatek: mmsys: Add support for MT8195 VPPSYS
Quoted 9 lines · Moudy Ho
For MT8195, VPPSYS0 and VPPSYS1 are 2 display pipes with hardware differences in power domains, clocks and subsystem counts, which should be determined by compatible names.
Signed-off-by Moudy Ho <[email protected]>--- .../devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml | 2 ++ 1 file changed, 2 insertions(+)
Please add Acked-by/Reviewed-by tags when posting new versions. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for acks received on the version they apply.
If a tag was not added on purpose, please state why and what changed.
Missing tags:
Re: [PATCH v6 2/4] dt-bindings: arm: mediatek: mmsys: Add support for MT8195 VPPSYS
In reply to Moudy HoQuoted 5 lines · Moudy Ho
For MT8195, VPPSYS0 and VPPSYS1 are 2 display pipes with hardware differences in power domains, clocks and subsystem counts, which should be determined by compatible names.
Signed-off-by Moudy Ho <[email protected]>
Applied, thanks!
Quoted 17 lines
--- .../devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml +2
-0@@ -33,6 +33,8 @@ properties: - mediatek,mt8186-mmsys - mediatek,mt8188-vdosys0 - mediatek,mt8192-mmsys + - mediatek,mt8195-vppsys0 + - mediatek,mt8195-vppsys1 - mediatek,mt8365-mmsys - const: syscon
PATCH v6 3/4 clk: mediatek: remove MT8195 vppsys/0/1 simple_probe
In reply to Moudy HoMT8195 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.
--- drivers/clk/mediatek/clk-mt8195-vpp0.c | 58 +++++++++++++++++++------- drivers/clk/mediatek/clk-mt8195-vpp1.c | 58 +++++++++++++++++++------- 2 files changed, 86 insertions(+), 30 deletions(-)
drivers/clk/mediatek/clk-mt8195-vpp0.c +43 -15
@@ -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_onecell_data *clk_data; +int r; -static const struct of_device_id of_match_clk_mt8195_vpp0[] = { - { - .compatible ="mediatek,mt8195-vppsys0" , - .data = &vpp0_desc, - }, { -/* sentinel */ - } -}; + clk_data =mtk_alloc_clk_data (CLK_VPP0_NR_CLK ); +if (!clk_data) +return -ENOMEM ; + + r =mtk_clk_register_gates (node, vpp0_clks,ARRAY_SIZE (vpp0_clks), clk_data); +if (r) + goto free_vpp0_data; + + r =of_clk_add_provider (node, of_clk_src_onecell_get, clk_data); +if (r) + goto unregister_gates; + +platform_set_drvdata (pdev, clk_data); + +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) +{ +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);
drivers/clk/mediatek/clk-mt8195-vpp1.c +43 -15
69 lines not on this page · raw message
Signature · 1 line
2.18.0
Re: [PATCH v6 3/4] clk: mediatek: remove MT8195 vppsys/0/1 simple_probe
Quoted 5 lines · Moudy Ho
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 Moudy Ho <[email protected]>
Quoted 153 lines
--- drivers/clk/mediatek/clk-mt8195-vpp0.c | 58 +++++++++++++++++++------- drivers/clk/mediatek/clk-mt8195-vpp1.c | 58 +++++++++++++++++++------- 2 files changed, 86 insertions(+), 30 deletions(-)drivers/clk/mediatek/clk-mt8195-vpp0.c +43
-15@@ -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_onecell_data *clk_data; +int r; -static const struct of_device_id of_match_clk_mt8195_vpp0[] = { - { - .compatible ="mediatek,mt8195-vppsys0" , - .data = &vpp0_desc, - }, { -/* sentinel */ - } -}; + clk_data =mtk_alloc_clk_data (CLK_VPP0_NR_CLK ); +if (!clk_data) +return -ENOMEM ; + + r =mtk_clk_register_gates (node, vpp0_clks,ARRAY_SIZE (vpp0_clks), clk_data); +if (r) + goto free_vpp0_data; + + r =of_clk_add_provider (node, of_clk_src_onecell_get, clk_data); +if (r) + goto unregister_gates; + +platform_set_drvdata (pdev, clk_data); + +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) +{ +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);drivers/clk/mediatek/clk-mt8195-vpp1.c +43
-15@@ -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_onecell_data *clk_data; +int r; -static const struct of_device_id of_match_clk_mt8195_vpp1[] = { - { - .compatible ="mediatek,mt8195-vppsys1" , - .data = &vpp1_desc, - }, { -/* sentinel */ - } -}; + clk_data =mtk_alloc_clk_data (CLK_VPP1_NR_CLK ); +if (!clk_data) +return -ENOMEM ; + + r =mtk_clk_register_gates (node, vpp1_clks,ARRAY_SIZE (vpp1_clks), clk_data); +if (r) + goto free_vpp1_data; + + r =of_clk_add_provider (node, of_clk_src_onecell_get, clk_data); +if (r) + goto unregister_gates; + +platform_set_drvdata (pdev, clk_data); + +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) +{ +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);
Re: [PATCH v6 3/4] clk: mediatek: remove MT8195 vppsys/0/1 simple_probe
In reply to Moudy HoQuoting Moudy Ho (2023-01-17 19:15:08)
Quoted 6 lines
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 Moudy Ho <[email protected]>---
Applied to clk-next
Stephen Boyd
maintainerRe: [PATCH v6 3/4] clk: mediatek: remove MT8195 vppsys/0/1 simple_probe
In reply to Moudy HoQuoting Moudy Ho (2023-01-17 19:15:08)
Quoted 22 lines
drivers/clk/mediatek/clk-mt8195-vpp0.c +6
-7@@ -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_onecell_data *clk_data; +int r; -static const struct of_device_id of_match_clk_mt8195_vpp0[] = { - { - .compatible ="mediatek,mt8195-vppsys0" ,
drivers/clk/mediatek/clk-mt8195-vpp0.c static const struct mtk_gate vpp0_clks[] = { · line 100
Quoted 10 lines
drivers/clk/mediatek/clk-mt8195-vpp0.c +5
-5- .data = &vpp0_desc, - }, { -/* sentinel */ - } -}; + clk_data =mtk_alloc_clk_data (CLK_VPP0_NR_CLK ); +if (!clk_data) +return -ENOMEM ; + + r =mtk_clk_register_gates (node, vpp0_clks,ARRAY_SIZE (vpp0_clks), clk_data);
This API is wrecked by a patch from AngeloGioacchino. Can you resend, or tell me which device should be used here?
Re: [PATCH v6 3/4] clk: mediatek: remove MT8195 vppsys/0/1 simple_probe
Quoted 32 lines · Stephen Boyd
Quoting Moudy Ho (2023-01-17 19:15:08)
Quoted 31 lines
drivers/clk/mediatek/clk-mt8195-vpp0.c +8
-12@@ -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_onecell_data *clk_data; +int r; -static const struct of_device_id of_match_clk_mt8195_vpp0[] = { - { - .compatible ="mediatek,mt8195-vppsys0" , - .data = &vpp0_desc, - }, { -/* sentinel */ - } -}; + clk_data =mtk_alloc_clk_data (CLK_VPP0_NR_CLK ); +if (!clk_data)
Quoted 8 lines
drivers/clk/mediatek/clk-mt8195-vpp0.c static const struct mtk_gate vpp0_clks[] = {
Quoted 4 lines
drivers/clk/mediatek/clk-mt8195-vpp0.c +3
-0+return -ENOMEM ; + + r =mtk_clk_register_gates (node, vpp0_clks,ARRAY_SIZE (vpp0_clks), clk_data);This API is wrecked by a patch from AngeloGioacchino. Can you resend, or
tell me which device should be used here?
Hi Stephen,
Thanks for your time and hlep.
Refer to
https://lore.kernel.org/lkml/[email protected]/
, both clk-mt8195-vpp0/1 need to add "&pdev->dev" to the 1st param. in the API to match the modification.
Regards,
Moudy
Re: [PATCH v6 3/4] clk: mediatek: remove MT8195 vppsys/0/1 simple_probe
In reply to Stephen BoydIl 30/01/23 20:36, Stephen Boyd ha scritto:
Quoted 20 lines
Quoting Moudy Ho (2023-01-17 19:15:08)
Quoted 19 lines
drivers/clk/mediatek/clk-mt8195-vpp0.c +6
-4@@ -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_onecell_data *clk_data; +int r;
Quoted 16 lines
drivers/clk/mediatek/clk-mt8195-vpp0.c static const struct mtk_gate vpp0_clks[] = { · line 100
Quoted 13 lines
drivers/clk/mediatek/clk-mt8195-vpp0.c +5
-8-static const struct of_device_id of_match_clk_mt8195_vpp0[] = { - { - .compatible ="mediatek,mt8195-vppsys0" , - .data = &vpp0_desc, - }, { -/* sentinel */ - } -}; + clk_data =mtk_alloc_clk_data (CLK_VPP0_NR_CLK ); +if (!clk_data) +return -ENOMEM ; + + r =mtk_clk_register_gates (node, vpp0_clks,ARRAY_SIZE (vpp0_clks), clk_data);This API is wrecked by a patch from AngeloGioacchino. Can you resend, or tell me which device should be used here?
mtk_clk_register_gates(&pdev->dev, node, vpp0_clks, ......);
...with that change, for this patch:
P.S.: Next cleanup round will introduce mtk_clk_pdev_simple_probe()
Cheers,
Angelo
Re: [PATCH v6 3/4] clk: mediatek: remove MT8195 vppsys/0/1 simple_probe
In reply to Moudy HoQuoted 18 lines · Moudy Ho
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 Moudy Ho <[email protected]>--- drivers/clk/mediatek/clk-mt8195-vpp0.c | 58 +++++++++++++++++++------- drivers/clk/mediatek/clk-mt8195-vpp1.c | 58 +++++++++++++++++++------- 2 files changed, 86 insertions(+), 30 deletions(-)drivers/clk/mediatek/clk-mt8195-vpp0.c +0
-0@@ -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), };
drivers/clk/mediatek/clk-mt8195-vpp0.c static const struct mtk_gate vpp0_clks[] = { · line 93
Quoted 10 lines
drivers/clk/mediatek/clk-mt8195-vpp0.c +5
-4-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_onecell_data *clk_data;
mtk_alloc_clk_data() API changed a couple releases back. So:
struct clk_hw_onecell_data
Quoted 5 lines
drivers/clk/mediatek/clk-mt8195-vpp0.c +1
-3+int r; -static const struct of_device_id of_match_clk_mt8195_vpp0[] = { - { - .compatible ="mediatek,mt8195-vppsys0" ,
drivers/clk/mediatek/clk-mt8195-vpp0.c static const struct mtk_gate vpp0_clks[] = { · line 100
Quoted 10 lines
drivers/clk/mediatek/clk-mt8195-vpp0.c +5
-5- .data = &vpp0_desc, - }, { -/* sentinel */ - } -}; + clk_data =mtk_alloc_clk_data (CLK_VPP0_NR_CLK ); +if (!clk_data) +return -ENOMEM ; + + r =mtk_clk_register_gates (node, vpp0_clks,ARRAY_SIZE (vpp0_clks), clk_data);
API changed.
drivers/clk/mediatek/clk-mt8195-vpp0.c static const struct mtk_gate vpp0_clks[] = { · line 104
Quoted 4 lines
drivers/clk/mediatek/clk-mt8195-vpp0.c +4
-0+if (r) + goto free_vpp0_data; + + r =of_clk_add_provider (node, of_clk_src_onecell_get, clk_data);
of_clk_add_provider(node, of_clk_hw_onecell_get, clk_data);
Same for the other driver.
ChenYu
Quoted 115 lines
drivers/clk/mediatek/clk-mt8195-vpp0.c +28
-3+if (r) + goto unregister_gates; + +platform_set_drvdata (pdev, clk_data); + +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) +{ +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);drivers/clk/mediatek/clk-mt8195-vpp1.c +43
-16@@ -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_onecell_data *clk_data; +int r; -static const struct of_device_id of_match_clk_mt8195_vpp1[] = { - { - .compatible ="mediatek,mt8195-vppsys1" , - .data = &vpp1_desc, - }, { -/* sentinel */ - } -}; + clk_data =mtk_alloc_clk_data (CLK_VPP1_NR_CLK ); +if (!clk_data) +return -ENOMEM ; + + r =mtk_clk_register_gates (node, vpp1_clks,ARRAY_SIZE (vpp1_clks), clk_data); +if (r) + goto free_vpp1_data; + + r =of_clk_add_provider (node, of_clk_src_onecell_get, clk_data); +if (r) + goto unregister_gates; + +platform_set_drvdata (pdev, clk_data); + +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) +{ +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); --2.18.0
Re: [PATCH v6 3/4] clk: mediatek: remove MT8195 vppsys/0/1 simple_probe
Quoted 64 lines · Chen-Yu Tsai
Quoted 22 lines · Moudy Ho
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 Moudy Ho <[email protected]>--- drivers/clk/mediatek/clk-mt8195-vpp0.c | 58 +++++++++++++++++++--- ---- drivers/clk/mediatek/clk-mt8195-vpp1.c | 58 +++++++++++++++++++--- ---- 2 files changed, 86 insertions(+), 30 deletions(-)drivers/clk/mediatek/clk-mt8195-vpp0.c +0
-0@@ -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), };drivers/clk/mediatek/clk-mt8195-vpp0.c static const struct mtk_gate vpp0_clks[] = { · line 94
Quoted 10 lines
drivers/clk/mediatek/clk-mt8195-vpp0.c +5
-4-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_onecell_data *clk_data;
mtk_alloc_clk_data()API changed a couple releases back. So:struct
clk_hw_onecell_dataQuoted 6 lines
drivers/clk/mediatek/clk-mt8195-vpp0.c +1
-4+int r; -static const struct of_device_id of_match_clk_mt8195_vpp0[] = { - { - .compatible ="mediatek,mt8195-vppsys0" , - .data = &vpp0_desc,drivers/clk/mediatek/clk-mt8195-vpp0.c static const struct mtk_gate vpp0_clks[] = {
Quoted 10 lines
drivers/clk/mediatek/clk-mt8195-vpp0.c +5
-4- }, { -/* sentinel */ - } -}; + clk_data =mtk_alloc_clk_data (CLK_VPP0_NR_CLK ); +if (!clk_data) +return -ENOMEM ; + + r =mtk_clk_register_gates (node, vpp0_clks,ARRAY_SIZE (vpp0_clks), clk_data);API changed.
drivers/clk/mediatek/clk-mt8195-vpp0.c static const struct mtk_gate vpp0_clks[] = {
Quoted 5 lines
drivers/clk/mediatek/clk-mt8195-vpp0.c +4
-0+if (r) + goto free_vpp0_data; + + r =of_clk_add_provider (node, of_clk_src_onecell_get, clk_data);
Quoted 8 lines
of_clk_add_provider(node,
of_clk_hw_onecell_get,clk_data);Same for the other driver.
ChenYu
Hi ChenYu,
Thanks for taking the time, could you please take a look at the v7?
https://lore.kernel.org/lkml/[email protected]/
Regards,
Moudy
Quoted 125 lines
Quoted 125 lines
drivers/clk/mediatek/clk-mt8195-vpp0.c +28
-3+if (r) + goto unregister_gates; + +platform_set_drvdata (pdev, clk_data); + +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) +{ +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);drivers/clk/mediatek/clk-mt8195-vpp1.c +43
-16@@ -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_onecell_data *clk_data; +int r; -static const struct of_device_id of_match_clk_mt8195_vpp1[] = { - { - .compatible ="mediatek,mt8195-vppsys1" , - .data = &vpp1_desc, - }, { -/* sentinel */ - } -}; + clk_data =mtk_alloc_clk_data (CLK_VPP1_NR_CLK ); +if (!clk_data) +return -ENOMEM ; + + r =mtk_clk_register_gates (node, vpp1_clks,ARRAY_SIZE (vpp1_clks), clk_data); +if (r) + goto free_vpp1_data; + + r =of_clk_add_provider (node, of_clk_src_onecell_get, clk_data); +if (r) + goto unregister_gates; + +platform_set_drvdata (pdev, clk_data); + +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) +{ +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); --2.18.0
PATCH v6 4/4 soc: mediatek: mmsys: add support for MT8195 VPPSYS
In reply to Moudy HoFrom: "Roy-CW.Yeh" <[email protected]>
Add MT8195 VPPSYS0 and VPPSYS1 driver data.
--- drivers/soc/mediatek/mtk-mmsys.c | 22 ++++++++++++++++++++++ drivers/soc/mediatek/mtk-mmsys.h | 1 + 2 files changed, 23 insertions(+)
drivers/soc/mediatek/mtk-mmsys.c +22 -0
@@ -88,6 +88,16 @@ static const struct mtk_mmsys_driver_data mt8195_vdosys0_driver_data = { .num_routes = ARRAY_SIZE(mmsys_mt8195_routing_table), }; +static const struct mtk_mmsys_driver_data mt8195_vppsys0_driver_data = { + .clk_driver ="clk-mt8195-vpp0" , + .is_vppsys = true, +}; + +static const struct mtk_mmsys_driver_data mt8195_vppsys1_driver_data = { + .clk_driver ="clk-mt8195-vpp1" , + .is_vppsys = true, +}; +static const struct mtk_mmsys_driver_data mt8365_mmsys_driver_data = { .clk_driver ="clk-mt8365-mm" , .routes = mt8365_mmsys_routing_table,
@@ -264,6 +274,9 @@ static int mtk_mmsys_probe(struct platform_device *pdev)if (IS_ERR (clks))return PTR_ERR (clks); +if (mmsys->data->is_vppsys) + goto out_probe_done; + drm =platform_device_register_data (&pdev->dev,"mediatek-drm" ,PLATFORM_DEVID_AUTO ,NULL ,0 );if (IS_ERR (drm)) {
@@ -271,6 +284,7 @@ static int mtk_mmsys_probe(struct platform_device *pdev)return PTR_ERR (drm); } +out_probe_done:return 0 ; }
@@ -323,6 +337,14 @@ static const struct of_device_id of_match_mtk_mmsys[] = { .compatible = "mediatek,mt8195-vdosys0", .data = &mt8195_vdosys0_driver_data, }, + { + .compatible = "mediatek,mt8195-vppsys0", + .data = &mt8195_vppsys0_driver_data, + }, + { + .compatible = "mediatek,mt8195-vppsys1", + .data = &mt8195_vppsys1_driver_data, + }, { .compatible = "mediatek,mt8365-mmsys", .data = &mt8365_mmsys_driver_data,
drivers/soc/mediatek/mtk-mmsys.h +1 -0
@@ -91,6 +91,7 @@ struct mtk_mmsys_driver_data {const struct mtk_mmsys_routes *routes;const unsigned int num_routes;const u16 sw0_rst_offset; +const bool is_vppsys; };/*
Signature · 1 line
2.18.0
Re: [PATCH v6 4/4] soc: mediatek: mmsys: add support for MT8195 VPPSYS
Quoted 7 lines · Moudy Ho
From: "Roy-CW.Yeh" <[email protected]>
Add MT8195 VPPSYS0 and VPPSYS1 driver data.
Signed-off-by Roy-CW.Yeh <[email protected]>Signed-off-by Moudy Ho <[email protected]>Reviewed-by AngeloGioacchino Del Regno <[email protected]>
Applied, thanks
Quoted 71 lines
--- drivers/soc/mediatek/mtk-mmsys.c | 22 ++++++++++++++++++++++ drivers/soc/mediatek/mtk-mmsys.h | 1 + 2 files changed, 23 insertions(+)drivers/soc/mediatek/mtk-mmsys.c +22
-0@@ -88,6 +88,16 @@ static const struct mtk_mmsys_driver_data mt8195_vdosys0_driver_data = { .num_routes = ARRAY_SIZE(mmsys_mt8195_routing_table), }; +static const struct mtk_mmsys_driver_data mt8195_vppsys0_driver_data = { + .clk_driver ="clk-mt8195-vpp0" , + .is_vppsys = true, +}; + +static const struct mtk_mmsys_driver_data mt8195_vppsys1_driver_data = { + .clk_driver ="clk-mt8195-vpp1" , + .is_vppsys = true, +}; +static const struct mtk_mmsys_driver_data mt8365_mmsys_driver_data = { .clk_driver ="clk-mt8365-mm" , .routes = mt8365_mmsys_routing_table,@@ -264,6 +274,9 @@ static int mtk_mmsys_probe(struct platform_device *pdev)if (IS_ERR (clks))return PTR_ERR (clks); +if (mmsys->data->is_vppsys) + goto out_probe_done; + drm =platform_device_register_data (&pdev->dev,"mediatek-drm" ,PLATFORM_DEVID_AUTO ,NULL ,0 );if (IS_ERR (drm)) {@@ -271,6 +284,7 @@ static int mtk_mmsys_probe(struct platform_device *pdev)return PTR_ERR (drm); } +out_probe_done:return 0 ; }@@ -323,6 +337,14 @@ static const struct of_device_id of_match_mtk_mmsys[] = { .compatible = "mediatek,mt8195-vdosys0", .data = &mt8195_vdosys0_driver_data, }, + { + .compatible = "mediatek,mt8195-vppsys0", + .data = &mt8195_vppsys0_driver_data, + }, + { + .compatible = "mediatek,mt8195-vppsys1", + .data = &mt8195_vppsys1_driver_data, + }, { .compatible = "mediatek,mt8365-mmsys", .data = &mt8365_mmsys_driver_data,drivers/soc/mediatek/mtk-mmsys.h +1
-0@@ -91,6 +91,7 @@ struct mtk_mmsys_driver_data {const struct mtk_mmsys_routes *routes;const unsigned int num_routes;const u16 sw0_rst_offset; +const bool is_vppsys; };/*