video: rockchip: vpu: clear mmu status when vpu reset
[firefly-linux-kernel-4.4.55.git] / drivers / regulator / of_regulator.c
index 499e437c7e919f2576c694ef6b6466898d006dbf..cd828dbf9d529e6d459c9e9eae65c6d252b7a1e4 100644 (file)
@@ -28,7 +28,6 @@ static void of_get_regulation_constraints(struct device_node *np,
                                        struct regulator_init_data **init_data,
                                        const struct regulator_desc *desc)
 {
-       const __be32 *min_uV, *max_uV;
        struct regulation_constraints *constraints = &(*init_data)->constraints;
        struct regulator_state *suspend_state;
        struct device_node *suspend_np;
@@ -37,18 +36,18 @@ static void of_get_regulation_constraints(struct device_node *np,
 
        constraints->name = of_get_property(np, "regulator-name", NULL);
 
-       min_uV = of_get_property(np, "regulator-min-microvolt", NULL);
-       if (min_uV)
-               constraints->min_uV = be32_to_cpu(*min_uV);
-       max_uV = of_get_property(np, "regulator-max-microvolt", NULL);
-       if (max_uV)
-               constraints->max_uV = be32_to_cpu(*max_uV);
+       if (!of_property_read_u32(np, "regulator-min-microvolt", &pval))
+               constraints->min_uV = pval;
+
+       if (!of_property_read_u32(np, "regulator-max-microvolt", &pval))
+               constraints->max_uV = pval;
 
        /* Voltage change possible? */
        if (constraints->min_uV != constraints->max_uV)
                constraints->valid_ops_mask |= REGULATOR_CHANGE_VOLTAGE;
-       /* Only one voltage?  Then make sure it's set. */
-       if (min_uV && max_uV && constraints->min_uV == constraints->max_uV)
+
+       /* Do we have a voltage range, if so try to apply it? */
+       if (constraints->min_uV && constraints->max_uV)
                constraints->apply_uV = true;
 
        if (!of_property_read_u32(np, "regulator-microvolt-offset", &pval))
@@ -93,6 +92,12 @@ static void of_get_regulation_constraints(struct device_node *np,
 
        constraints->soft_start = of_property_read_bool(np,
                                        "regulator-soft-start");
+       ret = of_property_read_u32(np, "regulator-active-discharge", &pval);
+       if (!ret) {
+               constraints->active_discharge =
+                               (pval) ? REGULATOR_ACTIVE_DISCHARGE_ENABLE :
+                                       REGULATOR_ACTIVE_DISCHARGE_DISABLE;
+       }
 
        if (!of_property_read_u32(np, "regulator-initial-mode", &pval)) {
                if (desc && desc->of_map_mode) {