Commit 6d9deb7a authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'regulator/topic/rk808',...

Merge remote-tracking branches 'regulator/topic/rk808', 'regulator/topic/rn5t618' and 'regulator/topic/samsung' into regulator-next
......@@ -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
......
......@@ -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
......
This diff is collapsed.
/*
* 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");
......@@ -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)
......
This diff is collapsed.
......@@ -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,
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment