]> git.sur5r.net Git - u-boot/blobdiff - drivers/power/regulator/max77686.c
imx6: icorem6_rqs: Update SPL board boot order for eMMC
[u-boot] / drivers / power / regulator / max77686.c
index 9d23c19122120efc3915dd9c6b78e2b465c10072..7479af734ade6617eb9ed3142c0323d25013fd85 100644 (file)
@@ -87,8 +87,8 @@ static int max77686_buck_volt2hex(int buck, int uV)
                 * hex = (uV - 750000) / 50000. We assume that dynamic voltage
                 * scaling via GPIOs is not enabled and don't support that.
                 * If this is enabled then the driver will need to take that
-                * into account anrd check different registers depending on
-                * the current setting See the datasheet for details.
+                * into account and check different registers depending on
+                * the current setting. See the datasheet for details.
                 */
                hex = (uV - MAX77686_BUCK_UV_HMIN) / MAX77686_BUCK_UV_HSTEP;
                hex_max = MAX77686_BUCK_VOLT_MAX_HEX;
@@ -515,25 +515,19 @@ static int max77686_ldo_enable(struct udevice *dev, int op, bool *enable)
 
                switch (on_off) {
                case OPMODE_OFF:
-                       *enable = 0;
+                       *enable = false;
                        break;
                case OPMODE_ON:
-                       *enable = 1;
+                       *enable = true;
                        break;
                default:
                        return -EINVAL;
                }
        } else if (op == PMIC_OP_SET) {
-               switch (*enable) {
-               case 0:
-                       on_off = OPMODE_OFF;
-                       break;
-               case 1:
+               if (*enable)
                        on_off = OPMODE_ON;
-                       break;
-               default:
-                       return -EINVAL;
-               }
+               else
+                       on_off = OPMODE_OFF;
 
                ret = max77686_ldo_mode(dev, op, &on_off);
                if (ret)
@@ -651,16 +645,10 @@ static int max77686_buck_enable(struct udevice *dev, int op, bool *enable)
                        return -EINVAL;
                }
        } else if (op == PMIC_OP_SET) {
-               switch (*enable) {
-               case 0:
-                       on_off = OPMODE_OFF;
-                       break;
-               case 1:
+               if (*enable)
                        on_off = OPMODE_ON;
-                       break;
-               default:
-                       return -EINVAL;
-               }
+               else
+                       on_off = OPMODE_OFF;
 
                ret = max77686_buck_mode(dev, op, &on_off);
                if (ret)