]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
OPP: Identify and mark genpd OPP tables
authorViresh Kumar <viresh.kumar@linaro.org>
Wed, 13 Jun 2018 10:30:11 +0000 (16:00 +0530)
committerViresh Kumar <viresh.kumar@linaro.org>
Mon, 5 Nov 2018 02:10:42 +0000 (07:40 +0530)
We need to handle genpd OPP tables differently, this is already the case
at one location and will be extended going forward. Add another field to
the OPP table to check if the table belongs to a genpd or not.

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/opp/of.c
drivers/opp/opp.h

index 5a4b47958073ee4526772f35e8b5614cc3c63418..5f114cd3d88c4aa49cf86b1e82dff9e782fa0b60 100644 (file)
@@ -92,6 +92,9 @@ void _of_init_opp_table(struct opp_table *opp_table, struct device *dev,
        of_property_read_u32(np, "voltage-tolerance",
                             &opp_table->voltage_tolerance_v1);
 
+       if (of_find_property(np, "#power-domain-cells", NULL))
+               opp_table->is_genpd = true;
+
        /* Get OPP table node */
        opp_np = _opp_of_get_opp_desc_node(np, index);
        of_node_put(np);
@@ -326,8 +329,7 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table,
        ret = of_property_read_u64(np, "opp-hz", &rate);
        if (ret < 0) {
                /* "opp-hz" is optional for devices like power domains. */
-               if (!of_find_property(dev->of_node, "#power-domain-cells",
-                                     NULL)) {
+               if (!opp_table->is_genpd) {
                        dev_err(dev, "%s: opp-hz not found\n", __func__);
                        goto free_opp;
                }
index 9c6544b4f4f901027c645c1d3bfdb223f6610826..cdb0c2b095e2fecebc450725fbc5fa4ab93d3b1b 100644 (file)
@@ -140,6 +140,7 @@ enum opp_table_access {
  * @regulators: Supply regulators
  * @regulator_count: Number of power supply regulators
  * @genpd_performance_state: Device's power domain support performance state.
+ * @is_genpd: Marks if the OPP table belongs to a genpd.
  * @set_opp: Platform specific set_opp callback
  * @set_opp_data: Data to be passed to set_opp callback
  * @dentry:    debugfs dentry pointer of the real device directory (not links).
@@ -178,6 +179,7 @@ struct opp_table {
        struct regulator **regulators;
        unsigned int regulator_count;
        bool genpd_performance_state;
+       bool is_genpd;
 
        int (*set_opp)(struct dev_pm_set_opp_data *data);
        struct dev_pm_set_opp_data *set_opp_data;