Merge remote-tracking branches 'regulator/topic/rk808', 'regulator/topic/rn5t618' and 'regulator/topic/samsung' into regulator-next

This commit is contained in:
Mark Brown 2014-09-30 13:50:30 +01:00
commit 6d9deb7ad4
10 changed files with 694 additions and 313 deletions

View File

@ -505,6 +505,22 @@ config REGULATOR_RC5T583
through regulator interface. The device supports multiple DCDC/LDO
outputs which can be controlled by i2c communication.
config REGULATOR_RK808
tristate "Rockchip RK808 Power regulators"
depends on MFD_RK808
help
Select this option to enable the power regulator of ROCKCHIP
PMIC RK808.
This driver supports the control of different power rails of device
through regulator interface. The device supports multiple DCDC/LDO
outputs which can be controlled by i2c communication.
config REGULATOR_RN5T618
tristate "Ricoh RN5T618 voltage regulators"
depends on MFD_RN5T618
help
Say y here to support the regulators found on Ricoh RN5T618 PMIC.
config REGULATOR_S2MPA01
tristate "Samsung S2MPA01 voltage regulator"
depends on MFD_SEC_CORE

View File

@ -67,6 +67,8 @@ obj-$(CONFIG_REGULATOR_PBIAS) += pbias-regulator.o
obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o
obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
obj-$(CONFIG_REGULATOR_RC5T583) += rc5t583-regulator.o
obj-$(CONFIG_REGULATOR_RK808) += rk808-regulator.o
obj-$(CONFIG_REGULATOR_RN5T618) += rn5t618-regulator.o
obj-$(CONFIG_REGULATOR_S2MPA01) += s2mpa01.o
obj-$(CONFIG_REGULATOR_S2MPS11) += s2mps11.o
obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o

View File

@ -0,0 +1,381 @@
/*
* Regulator driver for Rockchip RK808
*
* Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
*
* Author: Chris Zhong <zyw@rock-chips.com>
* Author: Zhang Qing <zhangqing@rock-chips.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*/
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/mfd/rk808.h>
#include <linux/of_device.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/of_regulator.h>
/* Field Definitions */
#define RK808_BUCK_VSEL_MASK 0x3f
#define RK808_BUCK4_VSEL_MASK 0xf
#define RK808_LDO_VSEL_MASK 0x1f
/* Ramp rate definitions for buck1 / buck2 only */
#define RK808_RAMP_RATE_OFFSET 3
#define RK808_RAMP_RATE_MASK (3 << RK808_RAMP_RATE_OFFSET)
#define RK808_RAMP_RATE_2MV_PER_US (0 << RK808_RAMP_RATE_OFFSET)
#define RK808_RAMP_RATE_4MV_PER_US (1 << RK808_RAMP_RATE_OFFSET)
#define RK808_RAMP_RATE_6MV_PER_US (2 << RK808_RAMP_RATE_OFFSET)
#define RK808_RAMP_RATE_10MV_PER_US (3 << RK808_RAMP_RATE_OFFSET)
static const int rk808_buck_config_regs[] = {
RK808_BUCK1_CONFIG_REG,
RK808_BUCK2_CONFIG_REG,
RK808_BUCK3_CONFIG_REG,
RK808_BUCK4_CONFIG_REG,
};
static const struct regulator_linear_range rk808_buck_voltage_ranges[] = {
REGULATOR_LINEAR_RANGE(700000, 0, 63, 12500),
};
static const struct regulator_linear_range rk808_buck4_voltage_ranges[] = {
REGULATOR_LINEAR_RANGE(1800000, 0, 15, 100000),
};
static const struct regulator_linear_range rk808_ldo_voltage_ranges[] = {
REGULATOR_LINEAR_RANGE(1800000, 0, 16, 100000),
};
static const struct regulator_linear_range rk808_ldo3_voltage_ranges[] = {
REGULATOR_LINEAR_RANGE(800000, 0, 13, 100000),
REGULATOR_LINEAR_RANGE(2500000, 15, 15, 0),
};
static const struct regulator_linear_range rk808_ldo6_voltage_ranges[] = {
REGULATOR_LINEAR_RANGE(800000, 0, 17, 100000),
};
static int rk808_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
{
unsigned int ramp_value = RK808_RAMP_RATE_10MV_PER_US;
unsigned int reg = rk808_buck_config_regs[rdev->desc->id -
RK808_ID_DCDC1];
switch (ramp_delay) {
case 1 ... 2000:
ramp_value = RK808_RAMP_RATE_2MV_PER_US;
break;
case 2001 ... 4000:
ramp_value = RK808_RAMP_RATE_4MV_PER_US;
break;
case 4001 ... 6000:
ramp_value = RK808_RAMP_RATE_6MV_PER_US;
break;
case 6001 ... 10000:
break;
default:
pr_warn("%s ramp_delay: %d not supported, setting 10000\n",
rdev->desc->name, ramp_delay);
}
return regmap_update_bits(rdev->regmap, reg,
RK808_RAMP_RATE_MASK, ramp_value);
}
static struct regulator_ops rk808_buck1_2_ops = {
.list_voltage = regulator_list_voltage_linear_range,
.map_voltage = regulator_map_voltage_linear_range,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
.set_ramp_delay = rk808_set_ramp_delay,
};
static struct regulator_ops rk808_reg_ops = {
.list_voltage = regulator_list_voltage_linear_range,
.map_voltage = regulator_map_voltage_linear_range,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
};
static struct regulator_ops rk808_switch_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
};
static const struct regulator_desc rk808_reg[] = {
{
.name = "DCDC_REG1",
.supply_name = "vcc1",
.id = RK808_ID_DCDC1,
.ops = &rk808_buck1_2_ops,
.type = REGULATOR_VOLTAGE,
.n_voltages = 64,
.linear_ranges = rk808_buck_voltage_ranges,
.n_linear_ranges = ARRAY_SIZE(rk808_buck_voltage_ranges),
.vsel_reg = RK808_BUCK1_ON_VSEL_REG,
.vsel_mask = RK808_BUCK_VSEL_MASK,
.enable_reg = RK808_DCDC_EN_REG,
.enable_mask = BIT(0),
.owner = THIS_MODULE,
}, {
.name = "DCDC_REG2",
.supply_name = "vcc2",
.id = RK808_ID_DCDC2,
.ops = &rk808_buck1_2_ops,
.type = REGULATOR_VOLTAGE,
.n_voltages = 64,
.linear_ranges = rk808_buck_voltage_ranges,
.n_linear_ranges = ARRAY_SIZE(rk808_buck_voltage_ranges),
.vsel_reg = RK808_BUCK2_ON_VSEL_REG,
.vsel_mask = RK808_BUCK_VSEL_MASK,
.enable_reg = RK808_DCDC_EN_REG,
.enable_mask = BIT(1),
.owner = THIS_MODULE,
}, {
.name = "DCDC_REG3",
.supply_name = "vcc3",
.id = RK808_ID_DCDC3,
.ops = &rk808_switch_ops,
.type = REGULATOR_VOLTAGE,
.n_voltages = 1,
.enable_reg = RK808_DCDC_EN_REG,
.enable_mask = BIT(2),
.owner = THIS_MODULE,
}, {
.name = "DCDC_REG4",
.supply_name = "vcc4",
.id = RK808_ID_DCDC4,
.ops = &rk808_reg_ops,
.type = REGULATOR_VOLTAGE,
.n_voltages = 16,
.linear_ranges = rk808_buck4_voltage_ranges,
.n_linear_ranges = ARRAY_SIZE(rk808_buck4_voltage_ranges),
.vsel_reg = RK808_BUCK4_ON_VSEL_REG,
.vsel_mask = RK808_BUCK4_VSEL_MASK,
.enable_reg = RK808_DCDC_EN_REG,
.enable_mask = BIT(3),
.owner = THIS_MODULE,
}, {
.name = "LDO_REG1",
.supply_name = "vcc6",
.id = RK808_ID_LDO1,
.ops = &rk808_reg_ops,
.type = REGULATOR_VOLTAGE,
.n_voltages = 17,
.linear_ranges = rk808_ldo_voltage_ranges,
.n_linear_ranges = ARRAY_SIZE(rk808_ldo_voltage_ranges),
.vsel_reg = RK808_LDO1_ON_VSEL_REG,
.vsel_mask = RK808_LDO_VSEL_MASK,
.enable_reg = RK808_LDO_EN_REG,
.enable_mask = BIT(0),
.owner = THIS_MODULE,
}, {
.name = "LDO_REG2",
.supply_name = "vcc6",
.id = RK808_ID_LDO2,
.ops = &rk808_reg_ops,
.type = REGULATOR_VOLTAGE,
.n_voltages = 17,
.linear_ranges = rk808_ldo_voltage_ranges,
.n_linear_ranges = ARRAY_SIZE(rk808_ldo_voltage_ranges),
.vsel_reg = RK808_LDO2_ON_VSEL_REG,
.vsel_mask = RK808_LDO_VSEL_MASK,
.enable_reg = RK808_LDO_EN_REG,
.enable_mask = BIT(1),
.owner = THIS_MODULE,
}, {
.name = "LDO_REG3",
.supply_name = "vcc7",
.id = RK808_ID_LDO3,
.ops = &rk808_reg_ops,
.type = REGULATOR_VOLTAGE,
.n_voltages = 16,
.linear_ranges = rk808_ldo3_voltage_ranges,
.n_linear_ranges = ARRAY_SIZE(rk808_ldo3_voltage_ranges),
.vsel_reg = RK808_LDO3_ON_VSEL_REG,
.vsel_mask = RK808_BUCK4_VSEL_MASK,
.enable_reg = RK808_LDO_EN_REG,
.enable_mask = BIT(2),
.owner = THIS_MODULE,
}, {
.name = "LDO_REG4",
.supply_name = "vcc9",
.id = RK808_ID_LDO4,
.ops = &rk808_reg_ops,
.type = REGULATOR_VOLTAGE,
.n_voltages = 17,
.linear_ranges = rk808_ldo_voltage_ranges,
.n_linear_ranges = ARRAY_SIZE(rk808_ldo_voltage_ranges),
.vsel_reg = RK808_LDO4_ON_VSEL_REG,
.vsel_mask = RK808_LDO_VSEL_MASK,
.enable_reg = RK808_LDO_EN_REG,
.enable_mask = BIT(3),
.owner = THIS_MODULE,
}, {
.name = "LDO_REG5",
.supply_name = "vcc9",
.id = RK808_ID_LDO5,
.ops = &rk808_reg_ops,
.type = REGULATOR_VOLTAGE,
.n_voltages = 17,
.linear_ranges = rk808_ldo_voltage_ranges,
.n_linear_ranges = ARRAY_SIZE(rk808_ldo_voltage_ranges),
.vsel_reg = RK808_LDO5_ON_VSEL_REG,
.vsel_mask = RK808_LDO_VSEL_MASK,
.enable_reg = RK808_LDO_EN_REG,
.enable_mask = BIT(4),
.owner = THIS_MODULE,
}, {
.name = "LDO_REG6",
.supply_name = "vcc10",
.id = RK808_ID_LDO6,
.ops = &rk808_reg_ops,
.type = REGULATOR_VOLTAGE,
.n_voltages = 18,
.linear_ranges = rk808_ldo6_voltage_ranges,
.n_linear_ranges = ARRAY_SIZE(rk808_ldo6_voltage_ranges),
.vsel_reg = RK808_LDO6_ON_VSEL_REG,
.vsel_mask = RK808_LDO_VSEL_MASK,
.enable_reg = RK808_LDO_EN_REG,
.enable_mask = BIT(5),
.owner = THIS_MODULE,
}, {
.name = "LDO_REG7",
.supply_name = "vcc7",
.id = RK808_ID_LDO7,
.ops = &rk808_reg_ops,
.type = REGULATOR_VOLTAGE,
.n_voltages = 18,
.linear_ranges = rk808_ldo6_voltage_ranges,
.n_linear_ranges = ARRAY_SIZE(rk808_ldo6_voltage_ranges),
.vsel_reg = RK808_LDO7_ON_VSEL_REG,
.vsel_mask = RK808_LDO_VSEL_MASK,
.enable_reg = RK808_LDO_EN_REG,
.enable_mask = BIT(6),
.owner = THIS_MODULE,
}, {
.name = "LDO_REG8",
.supply_name = "vcc11",
.id = RK808_ID_LDO8,
.ops = &rk808_reg_ops,
.type = REGULATOR_VOLTAGE,
.n_voltages = 17,
.linear_ranges = rk808_ldo_voltage_ranges,
.n_linear_ranges = ARRAY_SIZE(rk808_ldo_voltage_ranges),
.vsel_reg = RK808_LDO8_ON_VSEL_REG,
.vsel_mask = RK808_LDO_VSEL_MASK,
.enable_reg = RK808_LDO_EN_REG,
.enable_mask = BIT(7),
.owner = THIS_MODULE,
}, {
.name = "SWITCH_REG1",
.supply_name = "vcc8",
.id = RK808_ID_SWITCH1,
.ops = &rk808_switch_ops,
.type = REGULATOR_VOLTAGE,
.enable_reg = RK808_DCDC_EN_REG,
.enable_mask = BIT(5),
.owner = THIS_MODULE,
}, {
.name = "SWITCH_REG2",
.supply_name = "vcc12",
.id = RK808_ID_SWITCH2,
.ops = &rk808_switch_ops,
.type = REGULATOR_VOLTAGE,
.enable_reg = RK808_DCDC_EN_REG,
.enable_mask = BIT(6),
.owner = THIS_MODULE,
},
};
static struct of_regulator_match rk808_reg_matches[] = {
[RK808_ID_DCDC1] = { .name = "DCDC_REG1" },
[RK808_ID_DCDC2] = { .name = "DCDC_REG2" },
[RK808_ID_DCDC3] = { .name = "DCDC_REG3" },
[RK808_ID_DCDC4] = { .name = "DCDC_REG4" },
[RK808_ID_LDO1] = { .name = "LDO_REG1" },
[RK808_ID_LDO2] = { .name = "LDO_REG2" },
[RK808_ID_LDO3] = { .name = "LDO_REG3" },
[RK808_ID_LDO4] = { .name = "LDO_REG4" },
[RK808_ID_LDO5] = { .name = "LDO_REG5" },
[RK808_ID_LDO6] = { .name = "LDO_REG6" },
[RK808_ID_LDO7] = { .name = "LDO_REG7" },
[RK808_ID_LDO8] = { .name = "LDO_REG8" },
[RK808_ID_SWITCH1] = { .name = "SWITCH_REG1" },
[RK808_ID_SWITCH2] = { .name = "SWITCH_REG2" },
};
static int rk808_regulator_probe(struct platform_device *pdev)
{
struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
struct i2c_client *client = rk808->i2c;
struct device_node *reg_np;
struct regulator_config config = {};
struct regulator_dev *rk808_rdev;
int ret, i;
reg_np = of_get_child_by_name(client->dev.of_node, "regulators");
if (!reg_np)
return -ENXIO;
ret = of_regulator_match(&pdev->dev, reg_np, rk808_reg_matches,
RK808_NUM_REGULATORS);
of_node_put(reg_np);
if (ret < 0)
return ret;
/* Instantiate the regulators */
for (i = 0; i < RK808_NUM_REGULATORS; i++) {
if (!rk808_reg_matches[i].init_data ||
!rk808_reg_matches[i].of_node)
continue;
config.dev = &client->dev;
config.driver_data = rk808;
config.regmap = rk808->regmap;
config.of_node = rk808_reg_matches[i].of_node;
config.init_data = rk808_reg_matches[i].init_data;
rk808_rdev = devm_regulator_register(&pdev->dev,
&rk808_reg[i], &config);
if (IS_ERR(rk808_rdev)) {
dev_err(&client->dev,
"failed to register %d regulator\n", i);
return PTR_ERR(rk808_rdev);
}
}
return 0;
}
static struct platform_driver rk808_regulator_driver = {
.probe = rk808_regulator_probe,
.driver = {
.name = "rk808-regulator",
.owner = THIS_MODULE,
},
};
module_platform_driver(rk808_regulator_driver);
MODULE_DESCRIPTION("regulator driver for the rk808 series PMICs");
MODULE_AUTHOR("Chris Zhong<zyw@rock-chips.com>");
MODULE_AUTHOR("Zhang Qing<zhangqing@rock-chips.com>");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:rk808-regulator");

View File

@ -0,0 +1,143 @@
/*
* Regulator driver for Ricoh RN5T618 PMIC
*
* Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <linux/mfd/rn5t618.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/of_regulator.h>
static struct regulator_ops rn5t618_reg_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.list_voltage = regulator_list_voltage_linear,
};
#define REG(rid, ereg, emask, vreg, vmask, min, max, step) \
[RN5T618_##rid] = { \
.name = #rid, \
.id = RN5T618_##rid, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.ops = &rn5t618_reg_ops, \
.n_voltages = ((max) - (min)) / (step) + 1, \
.min_uV = (min), \
.uV_step = (step), \
.enable_reg = RN5T618_##ereg, \
.enable_mask = (emask), \
.vsel_reg = RN5T618_##vreg, \
.vsel_mask = (vmask), \
}
static struct regulator_desc rn5t618_regulators[] = {
/* DCDC */
REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 600000, 3500000, 12500),
REG(DCDC2, DC2CTL, BIT(0), DC2DAC, 0xff, 600000, 3500000, 12500),
REG(DCDC3, DC3CTL, BIT(0), DC3DAC, 0xff, 600000, 3500000, 12500),
/* LDO */
REG(LDO1, LDOEN1, BIT(0), LDO1DAC, 0x7f, 900000, 3500000, 25000),
REG(LDO2, LDOEN1, BIT(1), LDO2DAC, 0x7f, 900000, 3500000, 25000),
REG(LDO3, LDOEN1, BIT(2), LDO3DAC, 0x7f, 600000, 3500000, 25000),
REG(LDO4, LDOEN1, BIT(3), LDO4DAC, 0x7f, 900000, 3500000, 25000),
REG(LDO5, LDOEN1, BIT(4), LDO5DAC, 0x7f, 900000, 3500000, 25000),
/* LDO RTC */
REG(LDORTC1, LDOEN2, BIT(4), LDORTCDAC, 0x7f, 1700000, 3500000, 25000),
REG(LDORTC2, LDOEN2, BIT(5), LDORTC2DAC, 0x7f, 900000, 3500000, 25000),
};
static struct of_regulator_match rn5t618_matches[] = {
[RN5T618_DCDC1] = { .name = "DCDC1" },
[RN5T618_DCDC2] = { .name = "DCDC2" },
[RN5T618_DCDC3] = { .name = "DCDC3" },
[RN5T618_LDO1] = { .name = "LDO1" },
[RN5T618_LDO2] = { .name = "LDO2" },
[RN5T618_LDO3] = { .name = "LDO3" },
[RN5T618_LDO4] = { .name = "LDO4" },
[RN5T618_LDO5] = { .name = "LDO5" },
[RN5T618_LDORTC1] = { .name = "LDORTC1" },
[RN5T618_LDORTC2] = { .name = "LDORTC2" },
};
static int rn5t618_regulator_parse_dt(struct platform_device *pdev)
{
struct device_node *np, *regulators;
int ret;
np = of_node_get(pdev->dev.parent->of_node);
if (!np)
return 0;
regulators = of_get_child_by_name(np, "regulators");
if (!regulators) {
dev_err(&pdev->dev, "regulators node not found\n");
return -EINVAL;
}
ret = of_regulator_match(&pdev->dev, regulators, rn5t618_matches,
ARRAY_SIZE(rn5t618_matches));
of_node_put(regulators);
if (ret < 0) {
dev_err(&pdev->dev, "error parsing regulator init data: %d\n",
ret);
}
return 0;
}
static int rn5t618_regulator_probe(struct platform_device *pdev)
{
struct rn5t618 *rn5t618 = dev_get_drvdata(pdev->dev.parent);
struct regulator_config config = { };
struct regulator_dev *rdev;
int ret, i;
ret = rn5t618_regulator_parse_dt(pdev);
if (ret)
return ret;
for (i = 0; i < RN5T618_REG_NUM; i++) {
config.dev = &pdev->dev;
config.init_data = rn5t618_matches[i].init_data;
config.of_node = rn5t618_matches[i].of_node;
config.regmap = rn5t618->regmap;
rdev = devm_regulator_register(&pdev->dev,
&rn5t618_regulators[i],
&config);
if (IS_ERR(rdev)) {
dev_err(&pdev->dev, "failed to register %s regulator\n",
rn5t618_regulators[i].name);
return PTR_ERR(rdev);
}
}
return 0;
}
static struct platform_driver rn5t618_regulator_driver = {
.probe = rn5t618_regulator_probe,
.driver = {
.name = "rn5t618-regulator",
},
};
module_platform_driver(rn5t618_regulator_driver);
MODULE_AUTHOR("Beniamino Galvani <b.galvani@gmail.com>");
MODULE_DESCRIPTION("RN5T618 regulator driver");
MODULE_LICENSE("GPL v2");

View File

@ -235,28 +235,14 @@ static struct regulator_ops s2mpa01_buck_ops = {
.set_ramp_delay = s2mpa01_set_ramp_delay,
};
#define regulator_desc_ldo1(num) { \
#define regulator_desc_ldo(num, step) { \
.name = "LDO"#num, \
.id = S2MPA01_LDO##num, \
.ops = &s2mpa01_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPA01_LDO_MIN, \
.uV_step = S2MPA01_LDO_STEP1, \
.n_voltages = S2MPA01_LDO_N_VOLTAGES, \
.vsel_reg = S2MPA01_REG_L1CTRL + num - 1, \
.vsel_mask = S2MPA01_LDO_VSEL_MASK, \
.enable_reg = S2MPA01_REG_L1CTRL + num - 1, \
.enable_mask = S2MPA01_ENABLE_MASK \
}
#define regulator_desc_ldo2(num) { \
.name = "LDO"#num, \
.id = S2MPA01_LDO##num, \
.ops = &s2mpa01_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPA01_LDO_MIN, \
.uV_step = S2MPA01_LDO_STEP2, \
.min_uV = MIN_800_MV, \
.uV_step = step, \
.n_voltages = S2MPA01_LDO_N_VOLTAGES, \
.vsel_reg = S2MPA01_REG_L1CTRL + num - 1, \
.vsel_mask = S2MPA01_LDO_VSEL_MASK, \
@ -270,8 +256,8 @@ static struct regulator_ops s2mpa01_buck_ops = {
.ops = &s2mpa01_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPA01_BUCK_MIN1, \
.uV_step = S2MPA01_BUCK_STEP1, \
.min_uV = MIN_600_MV, \
.uV_step = STEP_6_25_MV, \
.n_voltages = S2MPA01_BUCK_N_VOLTAGES, \
.ramp_delay = S2MPA01_RAMP_DELAY, \
.vsel_reg = S2MPA01_REG_B1CTRL2 + (num - 1) * 2, \
@ -286,8 +272,8 @@ static struct regulator_ops s2mpa01_buck_ops = {
.ops = &s2mpa01_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPA01_BUCK_MIN2, \
.uV_step = S2MPA01_BUCK_STEP1, \
.min_uV = MIN_800_MV, \
.uV_step = STEP_6_25_MV, \
.n_voltages = S2MPA01_BUCK_N_VOLTAGES, \
.ramp_delay = S2MPA01_RAMP_DELAY, \
.vsel_reg = S2MPA01_REG_B5CTRL2, \
@ -296,14 +282,14 @@ static struct regulator_ops s2mpa01_buck_ops = {
.enable_mask = S2MPA01_ENABLE_MASK \
}
#define regulator_desc_buck6_7(num) { \
#define regulator_desc_buck6_10(num, min, step) { \
.name = "BUCK"#num, \
.id = S2MPA01_BUCK##num, \
.ops = &s2mpa01_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPA01_BUCK_MIN1, \
.uV_step = S2MPA01_BUCK_STEP1, \
.min_uV = min, \
.uV_step = step, \
.n_voltages = S2MPA01_BUCK_N_VOLTAGES, \
.ramp_delay = S2MPA01_RAMP_DELAY, \
.vsel_reg = S2MPA01_REG_B6CTRL2 + (num - 6) * 2, \
@ -312,91 +298,43 @@ static struct regulator_ops s2mpa01_buck_ops = {
.enable_mask = S2MPA01_ENABLE_MASK \
}
#define regulator_desc_buck8 { \
.name = "BUCK8", \
.id = S2MPA01_BUCK8, \
.ops = &s2mpa01_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPA01_BUCK_MIN2, \
.uV_step = S2MPA01_BUCK_STEP2, \
.n_voltages = S2MPA01_BUCK_N_VOLTAGES, \
.ramp_delay = S2MPA01_RAMP_DELAY, \
.vsel_reg = S2MPA01_REG_B8CTRL2, \
.vsel_mask = S2MPA01_BUCK_VSEL_MASK, \
.enable_reg = S2MPA01_REG_B8CTRL1, \
.enable_mask = S2MPA01_ENABLE_MASK \
}
#define regulator_desc_buck9 { \
.name = "BUCK9", \
.id = S2MPA01_BUCK9, \
.ops = &s2mpa01_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPA01_BUCK_MIN4, \
.uV_step = S2MPA01_BUCK_STEP2, \
.n_voltages = S2MPA01_BUCK_N_VOLTAGES, \
.ramp_delay = S2MPA01_RAMP_DELAY, \
.vsel_reg = S2MPA01_REG_B9CTRL2, \
.vsel_mask = S2MPA01_BUCK_VSEL_MASK, \
.enable_reg = S2MPA01_REG_B9CTRL1, \
.enable_mask = S2MPA01_ENABLE_MASK \
}
#define regulator_desc_buck10 { \
.name = "BUCK10", \
.id = S2MPA01_BUCK10, \
.ops = &s2mpa01_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPA01_BUCK_MIN3, \
.uV_step = S2MPA01_BUCK_STEP2, \
.n_voltages = S2MPA01_BUCK_N_VOLTAGES, \
.ramp_delay = S2MPA01_RAMP_DELAY, \
.vsel_reg = S2MPA01_REG_B10CTRL2, \
.vsel_mask = S2MPA01_BUCK_VSEL_MASK, \
.enable_reg = S2MPA01_REG_B10CTRL1, \
.enable_mask = S2MPA01_ENABLE_MASK \
}
static struct regulator_desc regulators[] = {
regulator_desc_ldo2(1),
regulator_desc_ldo1(2),
regulator_desc_ldo1(3),
regulator_desc_ldo1(4),
regulator_desc_ldo1(5),
regulator_desc_ldo2(6),
regulator_desc_ldo1(7),
regulator_desc_ldo1(8),
regulator_desc_ldo1(9),
regulator_desc_ldo1(10),
regulator_desc_ldo2(11),
regulator_desc_ldo1(12),
regulator_desc_ldo1(13),
regulator_desc_ldo1(14),
regulator_desc_ldo1(15),
regulator_desc_ldo1(16),
regulator_desc_ldo1(17),
regulator_desc_ldo1(18),
regulator_desc_ldo1(19),
regulator_desc_ldo1(20),
regulator_desc_ldo1(21),
regulator_desc_ldo2(22),
regulator_desc_ldo2(23),
regulator_desc_ldo1(24),
regulator_desc_ldo1(25),
regulator_desc_ldo1(26),
regulator_desc_ldo(1, STEP_25_MV),
regulator_desc_ldo(2, STEP_50_MV),
regulator_desc_ldo(3, STEP_50_MV),
regulator_desc_ldo(4, STEP_50_MV),
regulator_desc_ldo(5, STEP_50_MV),
regulator_desc_ldo(6, STEP_25_MV),
regulator_desc_ldo(7, STEP_50_MV),
regulator_desc_ldo(8, STEP_50_MV),
regulator_desc_ldo(9, STEP_50_MV),
regulator_desc_ldo(10, STEP_50_MV),
regulator_desc_ldo(11, STEP_25_MV),
regulator_desc_ldo(12, STEP_50_MV),
regulator_desc_ldo(13, STEP_50_MV),
regulator_desc_ldo(14, STEP_50_MV),
regulator_desc_ldo(15, STEP_50_MV),
regulator_desc_ldo(16, STEP_50_MV),
regulator_desc_ldo(17, STEP_50_MV),
regulator_desc_ldo(18, STEP_50_MV),
regulator_desc_ldo(19, STEP_50_MV),
regulator_desc_ldo(20, STEP_50_MV),
regulator_desc_ldo(21, STEP_50_MV),
regulator_desc_ldo(22, STEP_25_MV),
regulator_desc_ldo(23, STEP_25_MV),
regulator_desc_ldo(24, STEP_50_MV),
regulator_desc_ldo(25, STEP_50_MV),
regulator_desc_ldo(26, STEP_50_MV),
regulator_desc_buck1_4(1),
regulator_desc_buck1_4(2),
regulator_desc_buck1_4(3),
regulator_desc_buck1_4(4),
regulator_desc_buck5,
regulator_desc_buck6_7(6),
regulator_desc_buck6_7(7),
regulator_desc_buck8,
regulator_desc_buck9,
regulator_desc_buck10,
regulator_desc_buck6_10(6, MIN_600_MV, STEP_6_25_MV),
regulator_desc_buck6_10(7, MIN_600_MV, STEP_6_25_MV),
regulator_desc_buck6_10(8, MIN_800_MV, STEP_12_5_MV),
regulator_desc_buck6_10(9, MIN_1500_MV, STEP_12_5_MV),
regulator_desc_buck6_10(10, MIN_1000_MV, STEP_12_5_MV),
};
static int s2mpa01_pmic_probe(struct platform_device *pdev)

View File

@ -255,28 +255,14 @@ static struct regulator_ops s2mps11_buck_ops = {
.set_ramp_delay = s2mps11_set_ramp_delay,
};
#define regulator_desc_s2mps11_ldo1(num) { \
#define regulator_desc_s2mps11_ldo(num, step) { \
.name = "LDO"#num, \
.id = S2MPS11_LDO##num, \
.ops = &s2mps11_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPS11_LDO_MIN, \
.uV_step = S2MPS11_LDO_STEP1, \
.n_voltages = S2MPS11_LDO_N_VOLTAGES, \
.vsel_reg = S2MPS11_REG_L1CTRL + num - 1, \
.vsel_mask = S2MPS11_LDO_VSEL_MASK, \
.enable_reg = S2MPS11_REG_L1CTRL + num - 1, \
.enable_mask = S2MPS11_ENABLE_MASK \
}
#define regulator_desc_s2mps11_ldo2(num) { \
.name = "LDO"#num, \
.id = S2MPS11_LDO##num, \
.ops = &s2mps11_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPS11_LDO_MIN, \
.uV_step = S2MPS11_LDO_STEP2, \
.min_uV = MIN_800_MV, \
.uV_step = step, \
.n_voltages = S2MPS11_LDO_N_VOLTAGES, \
.vsel_reg = S2MPS11_REG_L1CTRL + num - 1, \
.vsel_mask = S2MPS11_LDO_VSEL_MASK, \
@ -290,8 +276,8 @@ static struct regulator_ops s2mps11_buck_ops = {
.ops = &s2mps11_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPS11_BUCK_MIN1, \
.uV_step = S2MPS11_BUCK_STEP1, \
.min_uV = MIN_600_MV, \
.uV_step = STEP_6_25_MV, \
.n_voltages = S2MPS11_BUCK_N_VOLTAGES, \
.ramp_delay = S2MPS11_RAMP_DELAY, \
.vsel_reg = S2MPS11_REG_B1CTRL2 + (num - 1) * 2, \
@ -306,8 +292,8 @@ static struct regulator_ops s2mps11_buck_ops = {
.ops = &s2mps11_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPS11_BUCK_MIN1, \
.uV_step = S2MPS11_BUCK_STEP1, \
.min_uV = MIN_600_MV, \
.uV_step = STEP_6_25_MV, \
.n_voltages = S2MPS11_BUCK_N_VOLTAGES, \
.ramp_delay = S2MPS11_RAMP_DELAY, \
.vsel_reg = S2MPS11_REG_B5CTRL2, \
@ -316,14 +302,14 @@ static struct regulator_ops s2mps11_buck_ops = {
.enable_mask = S2MPS11_ENABLE_MASK \
}
#define regulator_desc_s2mps11_buck6_8(num) { \
#define regulator_desc_s2mps11_buck6_10(num, min, step) { \
.name = "BUCK"#num, \
.id = S2MPS11_BUCK##num, \
.ops = &s2mps11_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPS11_BUCK_MIN1, \
.uV_step = S2MPS11_BUCK_STEP1, \
.min_uV = min, \
.uV_step = step, \
.n_voltages = S2MPS11_BUCK_N_VOLTAGES, \
.ramp_delay = S2MPS11_RAMP_DELAY, \
.vsel_reg = S2MPS11_REG_B6CTRL2 + (num - 6) * 2, \
@ -332,87 +318,55 @@ static struct regulator_ops s2mps11_buck_ops = {
.enable_mask = S2MPS11_ENABLE_MASK \
}
#define regulator_desc_s2mps11_buck9 { \
.name = "BUCK9", \
.id = S2MPS11_BUCK9, \
.ops = &s2mps11_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPS11_BUCK_MIN3, \
.uV_step = S2MPS11_BUCK_STEP3, \
.n_voltages = S2MPS11_BUCK_N_VOLTAGES, \
.ramp_delay = S2MPS11_RAMP_DELAY, \
.vsel_reg = S2MPS11_REG_B9CTRL2, \
.vsel_mask = S2MPS11_BUCK_VSEL_MASK, \
.enable_reg = S2MPS11_REG_B9CTRL1, \
.enable_mask = S2MPS11_ENABLE_MASK \
}
#define regulator_desc_s2mps11_buck10 { \
.name = "BUCK10", \
.id = S2MPS11_BUCK10, \
.ops = &s2mps11_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPS11_BUCK_MIN2, \
.uV_step = S2MPS11_BUCK_STEP2, \
.n_voltages = S2MPS11_BUCK_N_VOLTAGES, \
.ramp_delay = S2MPS11_RAMP_DELAY, \
.vsel_reg = S2MPS11_REG_B10CTRL2, \
.vsel_mask = S2MPS11_BUCK_VSEL_MASK, \
.enable_reg = S2MPS11_REG_B10CTRL1, \
.enable_mask = S2MPS11_ENABLE_MASK \
}
static const struct regulator_desc s2mps11_regulators[] = {
regulator_desc_s2mps11_ldo2(1),
regulator_desc_s2mps11_ldo1(2),
regulator_desc_s2mps11_ldo1(3),
regulator_desc_s2mps11_ldo1(4),
regulator_desc_s2mps11_ldo1(5),
regulator_desc_s2mps11_ldo2(6),
regulator_desc_s2mps11_ldo1(7),
regulator_desc_s2mps11_ldo1(8),
regulator_desc_s2mps11_ldo1(9),
regulator_desc_s2mps11_ldo1(10),
regulator_desc_s2mps11_ldo2(11),
regulator_desc_s2mps11_ldo1(12),
regulator_desc_s2mps11_ldo1(13),
regulator_desc_s2mps11_ldo1(14),
regulator_desc_s2mps11_ldo1(15),
regulator_desc_s2mps11_ldo1(16),
regulator_desc_s2mps11_ldo1(17),
regulator_desc_s2mps11_ldo1(18),
regulator_desc_s2mps11_ldo1(19),
regulator_desc_s2mps11_ldo1(20),
regulator_desc_s2mps11_ldo1(21),
regulator_desc_s2mps11_ldo2(22),
regulator_desc_s2mps11_ldo2(23),
regulator_desc_s2mps11_ldo1(24),
regulator_desc_s2mps11_ldo1(25),
regulator_desc_s2mps11_ldo1(26),
regulator_desc_s2mps11_ldo2(27),
regulator_desc_s2mps11_ldo1(28),
regulator_desc_s2mps11_ldo1(29),
regulator_desc_s2mps11_ldo1(30),
regulator_desc_s2mps11_ldo1(31),
regulator_desc_s2mps11_ldo1(32),
regulator_desc_s2mps11_ldo1(33),
regulator_desc_s2mps11_ldo1(34),
regulator_desc_s2mps11_ldo1(35),
regulator_desc_s2mps11_ldo1(36),
regulator_desc_s2mps11_ldo1(37),
regulator_desc_s2mps11_ldo1(38),
regulator_desc_s2mps11_ldo(1, STEP_25_MV),
regulator_desc_s2mps11_ldo(2, STEP_50_MV),
regulator_desc_s2mps11_ldo(3, STEP_50_MV),
regulator_desc_s2mps11_ldo(4, STEP_50_MV),
regulator_desc_s2mps11_ldo(5, STEP_50_MV),
regulator_desc_s2mps11_ldo(6, STEP_25_MV),
regulator_desc_s2mps11_ldo(7, STEP_50_MV),
regulator_desc_s2mps11_ldo(8, STEP_50_MV),
regulator_desc_s2mps11_ldo(9, STEP_50_MV),
regulator_desc_s2mps11_ldo(10, STEP_50_MV),
regulator_desc_s2mps11_ldo(11, STEP_25_MV),
regulator_desc_s2mps11_ldo(12, STEP_50_MV),
regulator_desc_s2mps11_ldo(13, STEP_50_MV),
regulator_desc_s2mps11_ldo(14, STEP_50_MV),
regulator_desc_s2mps11_ldo(15, STEP_50_MV),
regulator_desc_s2mps11_ldo(16, STEP_50_MV),
regulator_desc_s2mps11_ldo(17, STEP_50_MV),
regulator_desc_s2mps11_ldo(18, STEP_50_MV),
regulator_desc_s2mps11_ldo(19, STEP_50_MV),
regulator_desc_s2mps11_ldo(20, STEP_50_MV),
regulator_desc_s2mps11_ldo(21, STEP_50_MV),
regulator_desc_s2mps11_ldo(22, STEP_25_MV),
regulator_desc_s2mps11_ldo(23, STEP_25_MV),
regulator_desc_s2mps11_ldo(24, STEP_50_MV),
regulator_desc_s2mps11_ldo(25, STEP_50_MV),
regulator_desc_s2mps11_ldo(26, STEP_50_MV),
regulator_desc_s2mps11_ldo(27, STEP_25_MV),
regulator_desc_s2mps11_ldo(28, STEP_50_MV),
regulator_desc_s2mps11_ldo(29, STEP_50_MV),
regulator_desc_s2mps11_ldo(30, STEP_50_MV),
regulator_desc_s2mps11_ldo(31, STEP_50_MV),
regulator_desc_s2mps11_ldo(32, STEP_50_MV),
regulator_desc_s2mps11_ldo(33, STEP_50_MV),
regulator_desc_s2mps11_ldo(34, STEP_50_MV),
regulator_desc_s2mps11_ldo(35, STEP_50_MV),
regulator_desc_s2mps11_ldo(36, STEP_50_MV),
regulator_desc_s2mps11_ldo(37, STEP_50_MV),
regulator_desc_s2mps11_ldo(38, STEP_50_MV),
regulator_desc_s2mps11_buck1_4(1),
regulator_desc_s2mps11_buck1_4(2),
regulator_desc_s2mps11_buck1_4(3),
regulator_desc_s2mps11_buck1_4(4),
regulator_desc_s2mps11_buck5,
regulator_desc_s2mps11_buck6_8(6),
regulator_desc_s2mps11_buck6_8(7),
regulator_desc_s2mps11_buck6_8(8),
regulator_desc_s2mps11_buck9,
regulator_desc_s2mps11_buck10,
regulator_desc_s2mps11_buck6_10(6, MIN_600_MV, STEP_6_25_MV),
regulator_desc_s2mps11_buck6_10(7, MIN_600_MV, STEP_6_25_MV),
regulator_desc_s2mps11_buck6_10(8, MIN_600_MV, STEP_6_25_MV),
regulator_desc_s2mps11_buck6_10(9, MIN_3000_MV, STEP_25_MV),
regulator_desc_s2mps11_buck6_10(10, MIN_750_MV, STEP_12_5_MV),
};
static int s2mps14_regulator_enable(struct regulator_dev *rdev)
@ -510,56 +464,29 @@ static struct regulator_ops s2mps14_reg_ops = {
.set_suspend_disable = s2mps14_regulator_set_suspend_disable,
};
#define regulator_desc_s2mps14_ldo1(num) { \
#define regulator_desc_s2mps14_ldo(num, min, step) { \
.name = "LDO"#num, \
.id = S2MPS14_LDO##num, \
.ops = &s2mps14_reg_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPS14_LDO_MIN_800MV, \
.uV_step = S2MPS14_LDO_STEP_25MV, \
.min_uV = min, \
.uV_step = step, \
.n_voltages = S2MPS14_LDO_N_VOLTAGES, \
.vsel_reg = S2MPS14_REG_L1CTRL + num - 1, \
.vsel_mask = S2MPS14_LDO_VSEL_MASK, \
.enable_reg = S2MPS14_REG_L1CTRL + num - 1, \
.enable_mask = S2MPS14_ENABLE_MASK \
}
#define regulator_desc_s2mps14_ldo2(num) { \
.name = "LDO"#num, \
.id = S2MPS14_LDO##num, \
.ops = &s2mps14_reg_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPS14_LDO_MIN_1800MV, \
.uV_step = S2MPS14_LDO_STEP_25MV, \
.n_voltages = S2MPS14_LDO_N_VOLTAGES, \
.vsel_reg = S2MPS14_REG_L1CTRL + num - 1, \
.vsel_mask = S2MPS14_LDO_VSEL_MASK, \
.enable_reg = S2MPS14_REG_L1CTRL + num - 1, \
.enable_mask = S2MPS14_ENABLE_MASK \
}
#define regulator_desc_s2mps14_ldo3(num) { \
.name = "LDO"#num, \
.id = S2MPS14_LDO##num, \
.ops = &s2mps14_reg_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPS14_LDO_MIN_800MV, \
.uV_step = S2MPS14_LDO_STEP_12_5MV, \
.n_voltages = S2MPS14_LDO_N_VOLTAGES, \
.vsel_reg = S2MPS14_REG_L1CTRL + num - 1, \
.vsel_mask = S2MPS14_LDO_VSEL_MASK, \
.enable_reg = S2MPS14_REG_L1CTRL + num - 1, \
.enable_mask = S2MPS14_ENABLE_MASK \
}
#define regulator_desc_s2mps14_buck1235(num) { \
#define regulator_desc_s2mps14_buck(num, min, step) { \
.name = "BUCK"#num, \
.id = S2MPS14_BUCK##num, \
.ops = &s2mps14_reg_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPS14_BUCK1235_MIN_600MV, \
.uV_step = S2MPS14_BUCK1235_STEP_6_25MV, \
.min_uV = min, \
.uV_step = step, \
.n_voltages = S2MPS14_BUCK_N_VOLTAGES, \
.linear_min_sel = S2MPS14_BUCK1235_START_SEL, \
.ramp_delay = S2MPS14_BUCK_RAMP_DELAY, \
@ -568,54 +495,38 @@ static struct regulator_ops s2mps14_reg_ops = {
.enable_reg = S2MPS14_REG_B1CTRL1 + (num - 1) * 2, \
.enable_mask = S2MPS14_ENABLE_MASK \
}
#define regulator_desc_s2mps14_buck4(num) { \
.name = "BUCK"#num, \
.id = S2MPS14_BUCK##num, \
.ops = &s2mps14_reg_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = S2MPS14_BUCK4_MIN_1400MV, \
.uV_step = S2MPS14_BUCK4_STEP_12_5MV, \
.n_voltages = S2MPS14_BUCK_N_VOLTAGES, \
.linear_min_sel = S2MPS14_BUCK4_START_SEL, \
.ramp_delay = S2MPS14_BUCK_RAMP_DELAY, \
.vsel_reg = S2MPS14_REG_B1CTRL2 + (num - 1) * 2, \
.vsel_mask = S2MPS14_BUCK_VSEL_MASK, \
.enable_reg = S2MPS14_REG_B1CTRL1 + (num - 1) * 2, \
.enable_mask = S2MPS14_ENABLE_MASK \
}
static const struct regulator_desc s2mps14_regulators[] = {
regulator_desc_s2mps14_ldo3(1),
regulator_desc_s2mps14_ldo3(2),
regulator_desc_s2mps14_ldo1(3),
regulator_desc_s2mps14_ldo1(4),
regulator_desc_s2mps14_ldo3(5),
regulator_desc_s2mps14_ldo3(6),
regulator_desc_s2mps14_ldo1(7),
regulator_desc_s2mps14_ldo2(8),
regulator_desc_s2mps14_ldo3(9),
regulator_desc_s2mps14_ldo3(10),
regulator_desc_s2mps14_ldo1(11),
regulator_desc_s2mps14_ldo2(12),
regulator_desc_s2mps14_ldo2(13),
regulator_desc_s2mps14_ldo2(14),
regulator_desc_s2mps14_ldo2(15),
regulator_desc_s2mps14_ldo2(16),
regulator_desc_s2mps14_ldo2(17),
regulator_desc_s2mps14_ldo2(18),
regulator_desc_s2mps14_ldo1(19),
regulator_desc_s2mps14_ldo1(20),
regulator_desc_s2mps14_ldo1(21),
regulator_desc_s2mps14_ldo3(22),
regulator_desc_s2mps14_ldo1(23),
regulator_desc_s2mps14_ldo2(24),
regulator_desc_s2mps14_ldo2(25),
regulator_desc_s2mps14_buck1235(1),
regulator_desc_s2mps14_buck1235(2),
regulator_desc_s2mps14_buck1235(3),
regulator_desc_s2mps14_buck4(4),
regulator_desc_s2mps14_buck1235(5),
regulator_desc_s2mps14_ldo(1, MIN_800_MV, STEP_12_5_MV),
regulator_desc_s2mps14_ldo(2, MIN_800_MV, STEP_12_5_MV),
regulator_desc_s2mps14_ldo(3, MIN_800_MV, STEP_25_MV),
regulator_desc_s2mps14_ldo(4, MIN_800_MV, STEP_25_MV),
regulator_desc_s2mps14_ldo(5, MIN_800_MV, STEP_12_5_MV),
regulator_desc_s2mps14_ldo(6, MIN_800_MV, STEP_12_5_MV),
regulator_desc_s2mps14_ldo(7, MIN_800_MV, STEP_25_MV),
regulator_desc_s2mps14_ldo(8, MIN_1800_MV, STEP_25_MV),
regulator_desc_s2mps14_ldo(9, MIN_800_MV, STEP_12_5_MV),
regulator_desc_s2mps14_ldo(10, MIN_800_MV, STEP_12_5_MV),
regulator_desc_s2mps14_ldo(11, MIN_800_MV, STEP_25_MV),
regulator_desc_s2mps14_ldo(12, MIN_1800_MV, STEP_25_MV),
regulator_desc_s2mps14_ldo(13, MIN_1800_MV, STEP_25_MV),
regulator_desc_s2mps14_ldo(14, MIN_1800_MV, STEP_25_MV),
regulator_desc_s2mps14_ldo(15, MIN_1800_MV, STEP_25_MV),
regulator_desc_s2mps14_ldo(16, MIN_1800_MV, STEP_25_MV),
regulator_desc_s2mps14_ldo(17, MIN_1800_MV, STEP_25_MV),
regulator_desc_s2mps14_ldo(18, MIN_1800_MV, STEP_25_MV),
regulator_desc_s2mps14_ldo(19, MIN_800_MV, STEP_25_MV),
regulator_desc_s2mps14_ldo(20, MIN_800_MV, STEP_25_MV),
regulator_desc_s2mps14_ldo(21, MIN_800_MV, STEP_25_MV),
regulator_desc_s2mps14_ldo(22, MIN_800_MV, STEP_12_5_MV),
regulator_desc_s2mps14_ldo(23, MIN_800_MV, STEP_25_MV),
regulator_desc_s2mps14_ldo(24, MIN_1800_MV, STEP_25_MV),
regulator_desc_s2mps14_ldo(25, MIN_1800_MV, STEP_25_MV),
regulator_desc_s2mps14_buck(1, MIN_600_MV, STEP_6_25_MV),
regulator_desc_s2mps14_buck(2, MIN_600_MV, STEP_6_25_MV),
regulator_desc_s2mps14_buck(3, MIN_600_MV, STEP_6_25_MV),
regulator_desc_s2mps14_buck(4, MIN_1400_MV, STEP_12_5_MV),
regulator_desc_s2mps14_buck(5, MIN_600_MV, STEP_6_25_MV),
};
static int s2mps14_pmic_enable_ext_control(struct s2mps11_info *s2mps11,

View File

@ -14,6 +14,27 @@
#ifndef __LINUX_MFD_SEC_CORE_H
#define __LINUX_MFD_SEC_CORE_H
/* Macros to represent minimum voltages for LDO/BUCK */
#define MIN_3000_MV 3000000
#define MIN_2500_MV 2500000
#define MIN_2000_MV 2000000
#define MIN_1800_MV 1800000
#define MIN_1500_MV 1500000
#define MIN_1400_MV 1400000
#define MIN_1000_MV 1000000
#define MIN_900_MV 900000
#define MIN_850_MV 850000
#define MIN_800_MV 800000
#define MIN_750_MV 750000
#define MIN_600_MV 600000
/* Macros to represent steps for LDO/BUCK */
#define STEP_50_MV 50000
#define STEP_25_MV 25000
#define STEP_12_5_MV 12500
#define STEP_6_25_MV 6250
enum sec_device_type {
S5M8751X,
S5M8763X,

View File

@ -155,18 +155,6 @@ enum s2mpa01_regulators {
S2MPA01_REGULATOR_MAX,
};
#define S2MPA01_BUCK_MIN1 600000
#define S2MPA01_BUCK_MIN2 800000
#define S2MPA01_BUCK_MIN3 1000000
#define S2MPA01_BUCK_MIN4 1500000
#define S2MPA01_LDO_MIN 800000
#define S2MPA01_BUCK_STEP1 6250
#define S2MPA01_BUCK_STEP2 12500
#define S2MPA01_LDO_STEP1 50000
#define S2MPA01_LDO_STEP2 25000
#define S2MPA01_LDO_VSEL_MASK 0x3F
#define S2MPA01_BUCK_VSEL_MASK 0xFF
#define S2MPA01_ENABLE_MASK (0x03 << S2MPA01_ENABLE_SHIFT)

View File

@ -171,15 +171,6 @@ enum s2mps11_regulators {
S2MPS11_REGULATOR_MAX,
};
#define S2MPS11_BUCK_MIN1 600000
#define S2MPS11_BUCK_MIN2 750000
#define S2MPS11_BUCK_MIN3 3000000
#define S2MPS11_LDO_MIN 800000
#define S2MPS11_BUCK_STEP1 6250
#define S2MPS11_BUCK_STEP2 12500
#define S2MPS11_BUCK_STEP3 25000
#define S2MPS11_LDO_STEP1 50000
#define S2MPS11_LDO_STEP2 25000
#define S2MPS11_LDO_VSEL_MASK 0x3F
#define S2MPS11_BUCK_VSEL_MASK 0xFF
#define S2MPS11_ENABLE_MASK (0x03 << S2MPS11_ENABLE_SHIFT)

View File

@ -123,10 +123,6 @@ enum s2mps14_regulators {
};
/* Regulator constraints for BUCKx */
#define S2MPS14_BUCK1235_MIN_600MV 600000
#define S2MPS14_BUCK4_MIN_1400MV 1400000
#define S2MPS14_BUCK1235_STEP_6_25MV 6250
#define S2MPS14_BUCK4_STEP_12_5MV 12500
#define S2MPS14_BUCK1235_START_SEL 0x20
#define S2MPS14_BUCK4_START_SEL 0x40
/*
@ -136,12 +132,6 @@ enum s2mps14_regulators {
*/
#define S2MPS14_BUCK_RAMP_DELAY 12500
/* Regulator constraints for different types of LDOx */
#define S2MPS14_LDO_MIN_800MV 800000
#define S2MPS14_LDO_MIN_1800MV 1800000
#define S2MPS14_LDO_STEP_12_5MV 12500
#define S2MPS14_LDO_STEP_25MV 25000
#define S2MPS14_LDO_VSEL_MASK 0x3F
#define S2MPS14_BUCK_VSEL_MASK 0xFF
#define S2MPS14_ENABLE_MASK (0x03 << S2MPS14_ENABLE_SHIFT)