ARM: ux500: Provide a mechanism to over-ride regulator init values
authorLee Jones <lee.jones@linaro.org>
Thu, 28 Mar 2013 16:11:03 +0000 (16:11 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 29 Mar 2013 17:49:08 +0000 (17:49 +0000)
If particular platforms require non-standard initialisation values,
they can use this function to adapt them as required.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
arch/arm/mach-ux500/board-mop500-regulators.c

index 089cf2ae59273876aa73da80bf8db1af172e4177..22dfaf3d979aa5c56aba786b8be02fbad2568943 100644 (file)
@@ -476,3 +476,21 @@ struct ab8500_regulator_platform_data ab8500_regulator_plat_data = {
        .ext_regulator          = ab8500_ext_regulators,
        .num_ext_regulator      = ARRAY_SIZE(ab8500_ext_regulators),
 };
+
+static void ab8500_modify_reg_init(int id, u8 mask, u8 value)
+{
+       int i;
+
+       for (i = ARRAY_SIZE(ab8500_reg_init) - 1; i >= 0; i--) {
+               if (ab8500_reg_init[i].id == id) {
+                       u8 initval = ab8500_reg_init[i].value;
+                       initval = (initval & ~mask) | (value & mask);
+                       ab8500_reg_init[i].value = initval;
+
+                       BUG_ON(mask & ~ab8500_reg_init[i].mask);
+                       return;
+               }
+       }
+
+       BUG_ON(1);
+}