ipq806x: 6.1: manually refresh kernel patches
[openwrt/openwrt.git] / target / linux / ipq806x / patches-6.1 / 120-v6.2-clk-qcom-kpss-xcc-register-it-as-clk-provider.patch
1 From 09be1a39e685d8c5edd471fd1cac9a8f8280d2de Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Tue, 8 Nov 2022 22:17:34 +0100
4 Subject: [PATCH] clk: qcom: kpss-xcc: register it as clk provider
5
6 krait-cc use this driver for the secondary mux. Register it as a clk
7 provider to correctly use this clk in other drivers.
8
9 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
10 Signed-off-by: Bjorn Andersson <andersson@kernel.org>
11 Link: https://lore.kernel.org/r/20221108211734.3707-1-ansuelsmth@gmail.com
12 ---
13 drivers/clk/qcom/kpss-xcc.c | 13 +++++++++----
14 1 file changed, 9 insertions(+), 4 deletions(-)
15
16 diff --git a/drivers/clk/qcom/kpss-xcc.c b/drivers/clk/qcom/kpss-xcc.c
17 index b1b370274ec4..97358c98c6c9 100644
18 --- a/drivers/clk/qcom/kpss-xcc.c
19 +++ b/drivers/clk/qcom/kpss-xcc.c
20 @@ -31,12 +31,13 @@ MODULE_DEVICE_TABLE(of, kpss_xcc_match_table);
21
22 static int kpss_xcc_driver_probe(struct platform_device *pdev)
23 {
24 + struct device *dev = &pdev->dev;
25 const struct of_device_id *id;
26 void __iomem *base;
27 struct clk_hw *hw;
28 const char *name;
29
30 - id = of_match_device(kpss_xcc_match_table, &pdev->dev);
31 + id = of_match_device(kpss_xcc_match_table, dev);
32 if (!id)
33 return -ENODEV;
34
35 @@ -45,7 +46,7 @@ static int kpss_xcc_driver_probe(struct platform_device *pdev)
36 return PTR_ERR(base);
37
38 if (id->data) {
39 - if (of_property_read_string_index(pdev->dev.of_node,
40 + if (of_property_read_string_index(dev->of_node,
41 "clock-output-names",
42 0, &name))
43 return -ENODEV;
44 @@ -55,12 +56,16 @@ static int kpss_xcc_driver_probe(struct platform_device *pdev)
45 base += 0x28;
46 }
47
48 - hw = devm_clk_hw_register_mux_parent_data_table(&pdev->dev, name, aux_parents,
49 + hw = devm_clk_hw_register_mux_parent_data_table(dev, name, aux_parents,
50 ARRAY_SIZE(aux_parents), 0,
51 base, 0, 0x3,
52 0, aux_parent_map, NULL);
53 + if (IS_ERR(hw))
54 + return PTR_ERR(hw);
55
56 - return PTR_ERR_OR_ZERO(hw);
57 + of_clk_add_hw_provider(dev->of_node, of_clk_hw_simple_get, hw);
58 +
59 + return 0;
60 }
61
62 static struct platform_driver kpss_xcc_driver = {
63 --
64 2.37.2
65