Skip to content

Commit

Permalink
regulator: add buck3 in da903x driver
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Mark Brown <[email protected]>
Acked-by: Eric Miao <[email protected]>
Signed-off-by: Liam Girdwood <[email protected]>
  • Loading branch information
Haojian Zhuang authored and Liam Girdwood committed Sep 22, 2009
1 parent 9c19bc0 commit 0198d11
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
32 changes: 32 additions & 0 deletions drivers/regulator/da903x.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@
#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;

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion include/linux/mfd/da903x.h
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -57,6 +57,8 @@ enum {
DA9034_ID_LDO13,
DA9034_ID_LDO14,
DA9034_ID_LDO15,

DA9035_ID_BUCK3,
};

/*
Expand Down

0 comments on commit 0198d11

Please sign in to comment.