ipq806x: move to kernel 6.1 by default
[openwrt/openwrt.git] / target / linux / ipq806x / patches-5.15 / 118-v6.1-04-clk-qcom-kpss-xcc-convert-to-parent-data-API.patch
1 From d08c79b818767f24c3c9cbba585d8a3ec896c1a1 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Thu, 17 Feb 2022 22:43:34 +0100
4 Subject: [PATCH 4/4] clk: qcom: kpss-xcc: convert to parent data API
5
6 Convert the driver to parent data API. From the Documentation pll8_vote
7 and pxo should be declared in the DTS so fw_name can be used instead of
8 parent_names. Name is still used to save regression on old definition.
9
10 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
11 ---
12 drivers/clk/qcom/kpss-xcc.c | 26 +++++++++-----------------
13 1 file changed, 9 insertions(+), 17 deletions(-)
14
15 --- a/drivers/clk/qcom/kpss-xcc.c
16 +++ b/drivers/clk/qcom/kpss-xcc.c
17 @@ -12,9 +12,9 @@
18 #include <linux/clk.h>
19 #include <linux/clk-provider.h>
20
21 -static const char *aux_parents[] = {
22 - "pll8_vote",
23 - "pxo",
24 +static const struct clk_parent_data aux_parents[] = {
25 + { .name = "pll8_vote", .fw_name = "pll8_vote" },
26 + { .name = "pxo", .fw_name = "pxo" },
27 };
28
29 static unsigned int aux_parent_map[] = {
30 @@ -32,9 +32,9 @@ MODULE_DEVICE_TABLE(of, kpss_xcc_match_t
31 static int kpss_xcc_driver_probe(struct platform_device *pdev)
32 {
33 const struct of_device_id *id;
34 - struct clk *clk;
35 struct resource *res;
36 void __iomem *base;
37 + struct clk_hw *hw;
38 const char *name;
39
40 id = of_match_device(kpss_xcc_match_table, &pdev->dev);
41 @@ -57,24 +57,16 @@ static int kpss_xcc_driver_probe(struct
42 base += 0x28;
43 }
44
45 - clk = clk_register_mux_table(&pdev->dev, name, aux_parents,
46 - ARRAY_SIZE(aux_parents), 0, base, 0, 0x3,
47 - 0, aux_parent_map, NULL);
48 + hw = devm_clk_hw_register_mux_parent_data_table(&pdev->dev, name, aux_parents,
49 + ARRAY_SIZE(aux_parents), 0,
50 + base, 0, 0x3,
51 + 0, aux_parent_map, NULL);
52
53 - platform_set_drvdata(pdev, clk);
54 -
55 - return PTR_ERR_OR_ZERO(clk);
56 -}
57 -
58 -static int kpss_xcc_driver_remove(struct platform_device *pdev)
59 -{
60 - clk_unregister_mux(platform_get_drvdata(pdev));
61 - return 0;
62 + return PTR_ERR_OR_ZERO(hw);
63 }
64
65 static struct platform_driver kpss_xcc_driver = {
66 .probe = kpss_xcc_driver_probe,
67 - .remove = kpss_xcc_driver_remove,
68 .driver = {
69 .name = "kpss-xcc",
70 .of_match_table = kpss_xcc_match_table,