UPSTREAM: PM / AVS: rockchip-io: make io-domains a child of the GRF
authorJacob Chen <jacob2.chen@rock-chips.com>
Fri, 9 Dec 2016 06:40:33 +0000 (14:40 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Fri, 9 Dec 2016 10:12:59 +0000 (18:12 +0800)
IO-domain handling is part of the general register files, so should live
under the grf directly. This change allows the grf to be a simple-mfd and
the io-domains fetching the syscon regmap from that parent-node.

The old binding is of course preserved, though deprecated.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Kevin Hilman <khilman@baylibre.com>
Tested-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Change-Id: I562e293fc96283edc868771851f15dba0e80d3bc
(cherry picked from commit bc19b9a81da009fd1d797d756d41b518ac7e5f14)
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
Documentation/devicetree/bindings/power/rockchip-io-domain.txt
drivers/power/avs/rockchip-io-domain.c

index 32149b7b827e09ad04a1bc39b460525305499138..132a7d79e907fe565f25a6f0b108e8787a739beb 100644 (file)
@@ -38,8 +38,10 @@ Required properties:
   - "rockchip,rk3368-pmu-io-voltage-domain" for rk3368 pmu-domains
   - "rockchip,rk3399-io-voltage-domain" for rk3399
   - "rockchip,rk3399-pmu-io-voltage-domain" for rk3399 pmu-domains
-- rockchip,grf: phandle to the syscon managing the "general register files"
 
+Deprecated properties:
+- rockchip,grf: phandle to the syscon managing the "general register files"
+    Systems should move the io-domains to a sub-node of the grf simple-mfd.
 
 You specify supplies using the standard regulator bindings by including
 a phandle the relevant regulator.  All specified supplies must be able
index f6a212ccbd6d26603ac9f719dc8de2449a4ea873..9078777187aeb186aab97d88daea9ec1257927e4 100644 (file)
@@ -378,6 +378,7 @@ static int rockchip_iodomain_probe(struct platform_device *pdev)
        struct device_node *np = pdev->dev.of_node;
        const struct of_device_id *match;
        struct rockchip_iodomain *iod;
+       struct device *parent;
        int i, ret = 0;
 
        if (!np)
@@ -393,7 +394,14 @@ static int rockchip_iodomain_probe(struct platform_device *pdev)
        match = of_match_node(rockchip_iodomain_match, np);
        iod->soc_data = (struct rockchip_iodomain_soc_data *)match->data;
 
-       iod->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf");
+       parent = pdev->dev.parent;
+       if (parent && parent->of_node) {
+               iod->grf = syscon_node_to_regmap(parent->of_node);
+       } else {
+               dev_dbg(&pdev->dev, "falling back to old binding\n");
+               iod->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf");
+       }
+
        if (IS_ERR(iod->grf)) {
                dev_err(&pdev->dev, "couldn't find grf regmap\n");
                return PTR_ERR(iod->grf);