@@ -88,18 +88,26 @@ static int pmu_set_power_domain(int pd, bool on)
return PTR_ERR(rstc);
}
+ if (!on)
+ reset_control_assert(rstc);
+
+ ret = regmap_update_bits(pmu, PMU_PWRDN_CON, BIT(pd), val);
+ if (ret < 0) {
+ pr_err("%s: could not update power domain\n", __func__);
+ reset_control_put(rstc);
+ return ret;
+ }
+
if (on)
reset_control_deassert(rstc);
- else
- reset_control_assert(rstc);
reset_control_put(rstc);
- }
-
- ret = regmap_update_bits(pmu, PMU_PWRDN_CON, BIT(pd), val);
- if (ret < 0) {
- pr_err("%s: could not update power domain\n", __func__);
- return ret;
+ } else {
+ ret = regmap_update_bits(pmu, PMU_PWRDN_CON, BIT(pd), val);
+ if (ret < 0) {
+ pr_err("%s: could not update power domain\n", __func__);
+ return ret;
+ }
}
ret = -1;