Commit 3fbd90bf authored by Mark Brown's avatar Mark Brown

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

Merge remote-tracking branches 'regulator/topic/lp8788', 'regulator/topic/mt6311', 'regulator/topic/optional', 'regulator/topic/palmas' and 'regulator/topic/pv88060' into regulator-next
* Powerventure Semiconductor PV88060 Voltage Regulator
Required properties:
- compatible: "pvs,pv88060".
- reg: I2C slave address, usually 0x49.
- interrupts: the interrupt outputs of the controller
- regulators: A node that houses a sub-node for each regulator within the
device. Each sub-node is identified using the node's name, with valid
values listed below. The content of each sub-node is defined by the
standard binding for regulators; see regulator.txt.
BUCK1, LDO1, LDO2, LDO3, LDO4, LDO5, LDO6, LDO7, SW1, SW2, SW3, SW4,
SW5, and SW6.
Optional properties:
- Any optional property defined in regulator.txt
Example
pmic: pv88060@49 {
compatible = "pvs,pv88060";
reg = <0x49>;
interrupt-parent = <&gpio>;
interrupts = <24 24>;
regulators {
BUCK1 {
regulator-name = "buck1";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <4387500>;
regulator-min-microamp = <1496000>;
regulator-max-microamp = <4189000>;
regulator-boot-on;
};
LDO1 {
regulator-name = "ldo1";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <3350000>;
regulator-boot-on;
};
LDO2 {
regulator-name = "ldo2";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <3350000>;
regulator-boot-on;
};
LDO3 {
regulator-name = "ldo3";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <3350000>;
regulator-boot-on;
};
LDO4 {
regulator-name = "ldo4";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <3350000>;
regulator-boot-on;
};
LDO5 {
regulator-name = "ldo5";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <3350000>;
regulator-boot-on;
};
LDO6 {
regulator-name = "ldo6";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <3350000>;
regulator-boot-on;
};
LDO7 {
regulator-name = "ldo7";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <3350000>;
regulator-boot-on;
};
SW1 {
regulator-name = "sw1";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
};
SW2 {
regulator-name = "sw2";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-boot-on;
};
SW3 {
regulator-name = "sw3";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-boot-on;
};
SW4 {
regulator-name = "sw4";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-boot-on;
};
SW5 {
regulator-name = "sw5";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-boot-on;
};
SW6 {
regulator-name = "sw6";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
};
};
};
\ No newline at end of file
......@@ -514,6 +514,14 @@ config REGULATOR_PFUZE100
Say y here to support the regulators found on the Freescale
PFUZE100/PFUZE200 PMIC.
config REGULATOR_PV88060
tristate "Powerventure Semiconductor PV88060 regulator"
depends on I2C
select REGMAP_I2C
help
Say y here to support the voltage regulators and convertors
PV88060
config REGULATOR_PWM
tristate "PWM voltage regulator"
depends on PWM
......
......@@ -67,6 +67,7 @@ obj-$(CONFIG_REGULATOR_QCOM_SMD_RPM) += qcom_smd-regulator.o
obj-$(CONFIG_REGULATOR_QCOM_SPMI) += qcom_spmi-regulator.o
obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o
obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o
obj-$(CONFIG_REGULATOR_PV88060) += pv88060-regulator.o
obj-$(CONFIG_REGULATOR_PWM) += pwm-regulator.o
obj-$(CONFIG_REGULATOR_TPS51632) += tps51632-regulator.o
obj-$(CONFIG_REGULATOR_PBIAS) += pbias-regulator.o
......
......@@ -3446,8 +3446,10 @@ int regulator_bulk_get(struct device *dev, int num_consumers,
consumers[i].consumer = NULL;
for (i = 0; i < num_consumers; i++) {
consumers[i].consumer = regulator_get(dev,
consumers[i].supply);
consumers[i].consumer = _regulator_get(dev,
consumers[i].supply,
false,
!consumers[i].optional);
if (IS_ERR(consumers[i].consumer)) {
ret = PTR_ERR(consumers[i].consumer);
dev_err(dev, "Failed to get supply '%s': %d\n",
......
......@@ -164,8 +164,11 @@ int devm_regulator_bulk_get(struct device *dev, int num_consumers,
consumers[i].consumer = NULL;
for (i = 0; i < num_consumers; i++) {
consumers[i].consumer = devm_regulator_get(dev,
consumers[i].supply);
consumers[i].consumer = _devm_regulator_get(dev,
consumers[i].supply,
consumers[i].optional ?
OPTIONAL_GET :
NORMAL_GET);
if (IS_ERR(consumers[i].consumer)) {
ret = PTR_ERR(consumers[i].consumer);
dev_err(dev, "Failed to get supply '%s': %d\n",
......
......@@ -344,7 +344,7 @@ static unsigned int lp8788_buck_get_mode(struct regulator_dev *rdev)
REGULATOR_MODE_FAST : REGULATOR_MODE_NORMAL;
}
static struct regulator_ops lp8788_buck12_ops = {
static const struct regulator_ops lp8788_buck12_ops = {
.list_voltage = regulator_list_voltage_table,
.map_voltage = regulator_map_voltage_ascend,
.set_voltage_sel = lp8788_buck12_set_voltage_sel,
......@@ -357,7 +357,7 @@ static struct regulator_ops lp8788_buck12_ops = {
.get_mode = lp8788_buck_get_mode,
};
static struct regulator_ops lp8788_buck34_ops = {
static const struct regulator_ops lp8788_buck34_ops = {
.list_voltage = regulator_list_voltage_table,
.map_voltage = regulator_map_voltage_ascend,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
......
......@@ -170,7 +170,7 @@ static int lp8788_ldo_enable_time(struct regulator_dev *rdev)
return ENABLE_TIME_USEC * val;
}
static struct regulator_ops lp8788_ldo_voltage_table_ops = {
static const struct regulator_ops lp8788_ldo_voltage_table_ops = {
.list_voltage = regulator_list_voltage_table,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
......@@ -180,7 +180,7 @@ static struct regulator_ops lp8788_ldo_voltage_table_ops = {
.enable_time = lp8788_ldo_enable_time,
};
static struct regulator_ops lp8788_ldo_voltage_fixed_ops = {
static const struct regulator_ops lp8788_ldo_voltage_fixed_ops = {
.list_voltage = regulator_list_voltage_linear,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
......@@ -613,22 +613,20 @@ static struct platform_driver lp8788_aldo_driver = {
},
};
static struct platform_driver * const drivers[] = {
&lp8788_dldo_driver,
&lp8788_aldo_driver,
};
static int __init lp8788_ldo_init(void)
{
int ret;
ret = platform_driver_register(&lp8788_dldo_driver);
if (ret)
return ret;
return platform_driver_register(&lp8788_aldo_driver);
return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
}
subsys_initcall(lp8788_ldo_init);
static void __exit lp8788_ldo_exit(void)
{
platform_driver_unregister(&lp8788_aldo_driver);
platform_driver_unregister(&lp8788_dldo_driver);
platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
}
module_exit(lp8788_ldo_exit);
......
......@@ -30,6 +30,7 @@ static const struct regmap_config mt6311_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = MT6311_FQMTR_CON4,
.cache_type = REGCACHE_RBTREE,
};
/* Default limits measured in millivolts and milliamps */
......
......@@ -612,6 +612,18 @@ static struct regulator_ops palmas_ops_ldo = {
.map_voltage = regulator_map_voltage_linear,
};
static struct regulator_ops palmas_ops_ldo9 = {
.is_enabled = palmas_is_enabled_ldo,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
.set_bypass = regulator_set_bypass_regmap,
.get_bypass = regulator_get_bypass_regmap,
};
static struct regulator_ops palmas_ops_ext_control_ldo = {
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
......@@ -639,6 +651,19 @@ static struct regulator_ops tps65917_ops_ldo = {
.set_voltage_time_sel = regulator_set_voltage_time_sel,
};
static struct regulator_ops tps65917_ops_ldo_1_2 = {
.is_enabled = palmas_is_enabled_ldo,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
.set_voltage_time_sel = regulator_set_voltage_time_sel,
.set_bypass = regulator_set_bypass_regmap,
.get_bypass = regulator_get_bypass_regmap,
};
static int palmas_regulator_config_external(struct palmas *palmas, int id,
struct palmas_reg_init *reg_init)
{
......@@ -915,6 +940,13 @@ static int palmas_ldo_registration(struct palmas_pmic *pmic,
if (pdata && pdata->ldo6_vibrator &&
(id == PALMAS_REG_LDO6))
desc->enable_time = 2000;
if (id == PALMAS_REG_LDO9) {
desc->ops = &palmas_ops_ldo9;
desc->bypass_reg = desc->enable_reg;
desc->bypass_mask =
PALMAS_LDO9_CTRL_LDO_BYPASS_EN;
}
} else {
if (!ddata->has_regen3 && id == PALMAS_REG_REGEN3)
continue;
......@@ -1019,6 +1051,13 @@ static int tps65917_ldo_registration(struct palmas_pmic *pmic,
* It is of the order of ~60mV/uS.
*/
desc->ramp_delay = 2500;
if (id == TPS65917_REG_LDO1 ||
id == TPS65917_REG_LDO2) {
desc->ops = &tps65917_ops_ldo_1_2;
desc->bypass_reg = desc->enable_reg;
desc->bypass_mask =
TPS65917_LDO1_CTRL_BYPASS_EN;
}
} else {
desc->n_voltages = 1;
if (reg_init && reg_init->roof_floor)
......
This diff is collapsed.
/*
* pv88060-regulator.h - Regulator definitions for PV88060
* Copyright (C) 2015 Powerventure Semiconductor Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that 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.
*/
#ifndef __PV88060_REGISTERS_H__
#define __PV88060_REGISTERS_H__
/* System Control and Event Registers */
#define PV88060_REG_EVENT_A 0x04
#define PV88060_REG_MASK_A 0x08
#define PV88060_REG_MASK_B 0x09
#define PV88060_REG_MASK_C 0x0A
/* Regulator Registers */
#define PV88060_REG_BUCK1_CONF0 0x1B
#define PV88060_REG_BUCK1_CONF1 0x1C
#define PV88060_REG_LDO1_CONF 0x1D
#define PV88060_REG_LDO2_CONF 0x1E
#define PV88060_REG_LDO3_CONF 0x1F
#define PV88060_REG_LDO4_CONF 0x20
#define PV88060_REG_LDO5_CONF 0x21
#define PV88060_REG_LDO6_CONF 0x22
#define PV88060_REG_LDO7_CONF 0x23
#define PV88060_REG_SW1_CONF 0x3B
#define PV88060_REG_SW2_CONF 0x3C
#define PV88060_REG_SW3_CONF 0x3D
#define PV88060_REG_SW4_CONF 0x3E
#define PV88060_REG_SW5_CONF 0x3F
#define PV88060_REG_SW6_CONF 0x40
/* PV88060_REG_EVENT_A (addr=0x04) */
#define PV88060_E_VDD_FLT 0x01
#define PV88060_E_OVER_TEMP 0x02
/* PV88060_REG_MASK_A (addr=0x08) */
#define PV88060_M_VDD_FLT 0x01
#define PV88060_M_OVER_TEMP 0x02
/* PV88060_REG_BUCK1_CONF0 (addr=0x1B) */
#define PV88060_BUCK_EN 0x80
#define PV88060_VBUCK_MASK 0x7F
/* PV88060_REG_LDO1/2/3/4/5/6/7_CONT */
#define PV88060_LDO_EN 0x40
#define PV88060_VLDO_MASK 0x3F
/* PV88060_REG_SW1/2/3/4/5_CONF */
#define PV88060_SW_EN 0x80
/* PV88060_REG_BUCK1_CONF1 (addr=0x1C) */
#define PV88060_BUCK_ILIM_SHIFT 2
#define PV88060_BUCK_ILIM_MASK 0x0C
#define PV88060_BUCK_MODE_SHIFT 0
#define PV88060_BUCK_MODE_MASK 0x03
#define PV88060_BUCK_MODE_SLEEP 0x00
#define PV88060_BUCK_MODE_AUTO 0x01
#define PV88060_BUCK_MODE_SYNC 0x02
#endif /* __PV88060_REGISTERS_H__ */
......@@ -140,6 +140,8 @@ struct regulator;
*
* @supply: The name of the supply. Initialised by the user before
* using the bulk regulator APIs.
* @optional: The supply should be considered optional. Initialised by the user
* before using the bulk regulator APIs.
* @consumer: The regulator consumer for the supply. This will be managed
* by the bulk API.
*
......@@ -149,6 +151,7 @@ struct regulator;
*/
struct regulator_bulk_data {
const char *supply;
bool optional;
struct regulator *consumer;
/* private: Internal use */
......
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