regulator: Add MAX8997_VOLTAGE_REGULATOR and MAX8997_CURRENT_REGULATOR macros
MAX8997_VOLTAGE_REGULATOR macro has _name and _ops parameters so we can use it for all regulators with REGULATOR_VOLTAGE type. The MAX8997_VOLTAGE_REGULATOR now replaces regulator_desc_ldo and regulator_desc_buck macros. MAX8997_CURRENT_REGULATOR is for CHARGER and CHARGER_TOPOFF. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
6f43c3809e
commit
4533f80ef8
|
@ -855,103 +855,58 @@ static struct regulator_ops max8997_charger_fixedstate_ops = {
|
||||||
.set_current_limit = max8997_set_voltage_ldobuck_wrap,
|
.set_current_limit = max8997_set_voltage_ldobuck_wrap,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define regulator_desc_ldo(num) { \
|
#define MAX8997_VOLTAGE_REGULATOR(_name, _ops) {\
|
||||||
.name = "LDO"#num, \
|
.name = #_name, \
|
||||||
.id = MAX8997_LDO##num, \
|
.id = MAX8997_##_name, \
|
||||||
.ops = &max8997_ldo_ops, \
|
.ops = &_ops, \
|
||||||
.type = REGULATOR_VOLTAGE, \
|
|
||||||
.owner = THIS_MODULE, \
|
|
||||||
}
|
|
||||||
#define regulator_desc_buck(num) { \
|
|
||||||
.name = "BUCK"#num, \
|
|
||||||
.id = MAX8997_BUCK##num, \
|
|
||||||
.ops = &max8997_buck_ops, \
|
|
||||||
.type = REGULATOR_VOLTAGE, \
|
.type = REGULATOR_VOLTAGE, \
|
||||||
.owner = THIS_MODULE, \
|
.owner = THIS_MODULE, \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MAX8997_CURRENT_REGULATOR(_name, _ops) {\
|
||||||
|
.name = #_name, \
|
||||||
|
.id = MAX8997_##_name, \
|
||||||
|
.ops = &_ops, \
|
||||||
|
.type = REGULATOR_CURRENT, \
|
||||||
|
.owner = THIS_MODULE, \
|
||||||
|
}
|
||||||
|
|
||||||
static struct regulator_desc regulators[] = {
|
static struct regulator_desc regulators[] = {
|
||||||
regulator_desc_ldo(1),
|
MAX8997_VOLTAGE_REGULATOR(LDO1, max8997_ldo_ops),
|
||||||
regulator_desc_ldo(2),
|
MAX8997_VOLTAGE_REGULATOR(LDO2, max8997_ldo_ops),
|
||||||
regulator_desc_ldo(3),
|
MAX8997_VOLTAGE_REGULATOR(LDO3, max8997_ldo_ops),
|
||||||
regulator_desc_ldo(4),
|
MAX8997_VOLTAGE_REGULATOR(LDO4, max8997_ldo_ops),
|
||||||
regulator_desc_ldo(5),
|
MAX8997_VOLTAGE_REGULATOR(LDO5, max8997_ldo_ops),
|
||||||
regulator_desc_ldo(6),
|
MAX8997_VOLTAGE_REGULATOR(LDO6, max8997_ldo_ops),
|
||||||
regulator_desc_ldo(7),
|
MAX8997_VOLTAGE_REGULATOR(LDO7, max8997_ldo_ops),
|
||||||
regulator_desc_ldo(8),
|
MAX8997_VOLTAGE_REGULATOR(LDO8, max8997_ldo_ops),
|
||||||
regulator_desc_ldo(9),
|
MAX8997_VOLTAGE_REGULATOR(LDO9, max8997_ldo_ops),
|
||||||
regulator_desc_ldo(10),
|
MAX8997_VOLTAGE_REGULATOR(LDO10, max8997_ldo_ops),
|
||||||
regulator_desc_ldo(11),
|
MAX8997_VOLTAGE_REGULATOR(LDO11, max8997_ldo_ops),
|
||||||
regulator_desc_ldo(12),
|
MAX8997_VOLTAGE_REGULATOR(LDO12, max8997_ldo_ops),
|
||||||
regulator_desc_ldo(13),
|
MAX8997_VOLTAGE_REGULATOR(LDO13, max8997_ldo_ops),
|
||||||
regulator_desc_ldo(14),
|
MAX8997_VOLTAGE_REGULATOR(LDO14, max8997_ldo_ops),
|
||||||
regulator_desc_ldo(15),
|
MAX8997_VOLTAGE_REGULATOR(LDO15, max8997_ldo_ops),
|
||||||
regulator_desc_ldo(16),
|
MAX8997_VOLTAGE_REGULATOR(LDO16, max8997_ldo_ops),
|
||||||
regulator_desc_ldo(17),
|
MAX8997_VOLTAGE_REGULATOR(LDO17, max8997_ldo_ops),
|
||||||
regulator_desc_ldo(18),
|
MAX8997_VOLTAGE_REGULATOR(LDO18, max8997_ldo_ops),
|
||||||
regulator_desc_ldo(21),
|
MAX8997_VOLTAGE_REGULATOR(LDO21, max8997_ldo_ops),
|
||||||
regulator_desc_buck(1),
|
MAX8997_VOLTAGE_REGULATOR(BUCK1, max8997_buck_ops),
|
||||||
regulator_desc_buck(2),
|
MAX8997_VOLTAGE_REGULATOR(BUCK2, max8997_buck_ops),
|
||||||
regulator_desc_buck(3),
|
MAX8997_VOLTAGE_REGULATOR(BUCK3, max8997_buck_ops),
|
||||||
regulator_desc_buck(4),
|
MAX8997_VOLTAGE_REGULATOR(BUCK4, max8997_buck_ops),
|
||||||
regulator_desc_buck(5),
|
MAX8997_VOLTAGE_REGULATOR(BUCK5, max8997_buck_ops),
|
||||||
{
|
MAX8997_VOLTAGE_REGULATOR(BUCK6, max8997_fixedvolt_ops),
|
||||||
.name = "BUCK6",
|
MAX8997_VOLTAGE_REGULATOR(BUCK7, max8997_buck_ops),
|
||||||
.id = MAX8997_BUCK6,
|
MAX8997_VOLTAGE_REGULATOR(EN32KHZ_AP, max8997_fixedvolt_ops),
|
||||||
.ops = &max8997_fixedvolt_ops,
|
MAX8997_VOLTAGE_REGULATOR(EN32KHZ_CP, max8997_fixedvolt_ops),
|
||||||
.type = REGULATOR_VOLTAGE,
|
MAX8997_VOLTAGE_REGULATOR(ENVICHG, max8997_fixedvolt_ops),
|
||||||
.owner = THIS_MODULE,
|
MAX8997_VOLTAGE_REGULATOR(ESAFEOUT1, max8997_safeout_ops),
|
||||||
},
|
MAX8997_VOLTAGE_REGULATOR(ESAFEOUT2, max8997_safeout_ops),
|
||||||
regulator_desc_buck(7),
|
MAX8997_VOLTAGE_REGULATOR(CHARGER_CV, max8997_fixedstate_ops),
|
||||||
{
|
MAX8997_CURRENT_REGULATOR(CHARGER, max8997_charger_ops),
|
||||||
.name = "EN32KHz_AP",
|
MAX8997_CURRENT_REGULATOR(CHARGER_TOPOFF,
|
||||||
.id = MAX8997_EN32KHZ_AP,
|
max8997_charger_fixedstate_ops),
|
||||||
.ops = &max8997_fixedvolt_ops,
|
|
||||||
.type = REGULATOR_VOLTAGE,
|
|
||||||
.owner = THIS_MODULE,
|
|
||||||
}, {
|
|
||||||
.name = "EN32KHz_CP",
|
|
||||||
.id = MAX8997_EN32KHZ_CP,
|
|
||||||
.ops = &max8997_fixedvolt_ops,
|
|
||||||
.type = REGULATOR_VOLTAGE,
|
|
||||||
.owner = THIS_MODULE,
|
|
||||||
}, {
|
|
||||||
.name = "ENVICHG",
|
|
||||||
.id = MAX8997_ENVICHG,
|
|
||||||
.ops = &max8997_fixedvolt_ops,
|
|
||||||
.type = REGULATOR_VOLTAGE,
|
|
||||||
.owner = THIS_MODULE,
|
|
||||||
}, {
|
|
||||||
.name = "ESAFEOUT1",
|
|
||||||
.id = MAX8997_ESAFEOUT1,
|
|
||||||
.ops = &max8997_safeout_ops,
|
|
||||||
.type = REGULATOR_VOLTAGE,
|
|
||||||
.owner = THIS_MODULE,
|
|
||||||
}, {
|
|
||||||
.name = "ESAFEOUT2",
|
|
||||||
.id = MAX8997_ESAFEOUT2,
|
|
||||||
.ops = &max8997_safeout_ops,
|
|
||||||
.type = REGULATOR_VOLTAGE,
|
|
||||||
.owner = THIS_MODULE,
|
|
||||||
}, {
|
|
||||||
.name = "CHARGER_CV",
|
|
||||||
.id = MAX8997_CHARGER_CV,
|
|
||||||
.ops = &max8997_fixedstate_ops,
|
|
||||||
.type = REGULATOR_VOLTAGE,
|
|
||||||
.owner = THIS_MODULE,
|
|
||||||
}, {
|
|
||||||
.name = "CHARGER",
|
|
||||||
.id = MAX8997_CHARGER,
|
|
||||||
.ops = &max8997_charger_ops,
|
|
||||||
.type = REGULATOR_CURRENT,
|
|
||||||
.owner = THIS_MODULE,
|
|
||||||
}, {
|
|
||||||
.name = "CHARGER_TOPOFF",
|
|
||||||
.id = MAX8997_CHARGER_TOPOFF,
|
|
||||||
.ops = &max8997_charger_fixedstate_ops,
|
|
||||||
.type = REGULATOR_CURRENT,
|
|
||||||
.owner = THIS_MODULE,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static __devinit int max8997_pmic_probe(struct platform_device *pdev)
|
static __devinit int max8997_pmic_probe(struct platform_device *pdev)
|
||||||
|
|
Loading…
Reference in New Issue