regulator: add buck3 in da903x driver
authorHaojian Zhuang <haojian.zhuang@marvell.com>
Fri, 26 Jun 2009 11:20:59 +0000 (19:20 +0800)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Tue, 22 Sep 2009 12:32:37 +0000 (13:32 +0100)
BUCK3 is the new component in DA9035. So there're three BUCKs in DA9035.
And there're two BUCKs in DA9034.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
drivers/regulator/da903x.c
include/linux/mfd/da903x.h

index b8b89ef..33dfeeb 100644 (file)
 #define DA9034_MDTV2           (0x33)
 #define DA9034_MVRC            (0x34)
 
+/* DA9035 Registers. DA9034 Registers are comptabile to DA9035. */
+#define DA9035_OVER3           (0x12)
+#define DA9035_VCC2            (0x1f)
+#define DA9035_3DTV1           (0x2c)
+#define DA9035_3DTV2           (0x2d)
+#define DA9035_3VRC            (0x2e)
+#define DA9035_AUTOSKIP                (0x2f)
+
 struct da903x_regulator_info {
        struct regulator_desc desc;
 
@@ -388,6 +396,27 @@ static struct regulator_ops da9034_regulator_ldo12_ops = {
        .enable_bit     = (ebit),                                       \
 }
 
+#define DA9035_DVC(_id, min, max, step, vreg, nbits, ureg, ubit, ereg, ebit) \
+{                                                                      \
+       .desc   = {                                                     \
+               .name   = #_id,                                         \
+               .ops    = &da9034_regulator_dvc_ops,                    \
+               .type   = REGULATOR_VOLTAGE,                            \
+               .id     = DA9035_ID_##_id,                              \
+               .owner  = THIS_MODULE,                                  \
+       },                                                              \
+       .min_uV         = (min) * 1000,                                 \
+       .max_uV         = (max) * 1000,                                 \
+       .step_uV        = (step) * 1000,                                \
+       .vol_reg        = DA9035_##vreg,                                \
+       .vol_shift      = (0),                                          \
+       .vol_nbits      = (nbits),                                      \
+       .update_reg     = DA9035_##ureg,                                \
+       .update_bit     = (ubit),                                       \
+       .enable_reg     = DA9035_##ereg,                                \
+       .enable_bit     = (ebit),                                       \
+}
+
 #define DA9034_LDO(_id, min, max, step, vreg, shift, nbits, ereg, ebit)        \
        DA903x_LDO(DA9034, _id, min, max, step, vreg, shift, nbits, ereg, ebit)
 
@@ -435,6 +464,9 @@ static struct da903x_regulator_info da903x_regulator_info[] = {
        DA9034_LDO(14, 1800, 3300, 100, LDO1514, 0, 4, OVER3, 0),
        DA9034_LDO(15, 1800, 3300, 100, LDO1514, 4, 4, OVER3, 1),
        DA9034_LDO(5, 3100, 3100, 0, INVAL, 0, 0, OVER3, 7), /* fixed @3.1V */
+
+       /* DA9035 */
+       DA9035_DVC(BUCK3, 1800, 2200, 100, 3DTV1, 3, VCC2, 0, OVER3, 3),
 };
 
 static inline struct da903x_regulator_info *find_regulator_info(int id)
index 115dbe9..c63b65c 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef __LINUX_PMIC_DA903X_H
 #define __LINUX_PMIC_DA903X_H
 
-/* Unified sub device IDs for DA9030/DA9034 */
+/* Unified sub device IDs for DA9030/DA9034/DA9035 */
 enum {
        DA9030_ID_LED_1,
        DA9030_ID_LED_2,
@@ -57,6 +57,8 @@ enum {
        DA9034_ID_LDO13,
        DA9034_ID_LDO14,
        DA9034_ID_LDO15,
+
+       DA9035_ID_BUCK3,
 };
 
 /*