Commit eb76d840 authored by Mark Brown's avatar Mark Brown

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

Merge remote-tracking branches 'regulator/topic/max77686', 'regulator/topic/max8973', 'regulator/topic/maxim', 'regulator/topic/palmas' and 'regulator/topic/pv88080' into regulator-next
...@@ -32,6 +32,13 @@ Optional properties: ...@@ -32,6 +32,13 @@ Optional properties:
Enhanced transient response (ETR) will affect the configuration of CKADV. Enhanced transient response (ETR) will affect the configuration of CKADV.
-junction-warn-millicelsius: u32, junction warning temperature threshold
in millicelsius. If die temperature crosses this level then
device generates the warning interrupts.
Please note that thermal functionality is only supported on MAX77621. The
supported threshold warning temperature for MAX77621 are 120 degC and 140 degC.
Example: Example:
max8973@1b { max8973@1b {
......
* Powerventure Semiconductor PV88080 Voltage Regulator
Required properties:
- compatible: "pvs,pv88080".
- 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, BUCK2, and BUCK3.
Optional properties:
- Any optional property defined in regulator.txt
Example
pmic: pv88080@49 {
compatible = "pvs,pv88080";
reg = <0x49>;
interrupt-parent = <&gpio>;
interrupts = <24 24>;
regulators {
BUCK1 {
regulator-name = "buck1";
regulator-min-microvolt = < 600000>;
regulator-max-microvolt = <1393750>;
regulator-min-microamp = < 220000>;
regulator-max-microamp = <7040000>;
};
BUCK2 {
regulator-name = "buck2";
regulator-min-microvolt = < 600000>;
regulator-max-microvolt = <1393750>;
regulator-min-microamp = <1496000>;
regulator-max-microamp = <4189000>;
};
BUCK3 {
regulator-name = "buck3";
regulator-min-microvolt = <1400000>;
regulator-max-microvolt = <2193750>;
regulator-min-microamp = <1496000>;
regulator-max-microamp = <4189000>;
};
};
};
...@@ -7020,9 +7020,9 @@ M: Chanwoo Choi <cw00.choi@samsung.com> ...@@ -7020,9 +7020,9 @@ M: Chanwoo Choi <cw00.choi@samsung.com>
M: Krzysztof Kozlowski <k.kozlowski@samsung.com> M: Krzysztof Kozlowski <k.kozlowski@samsung.com>
L: linux-kernel@vger.kernel.org L: linux-kernel@vger.kernel.org
S: Supported S: Supported
F: drivers/*/max14577.c F: drivers/*/max14577*.c
F: drivers/*/max77686*.c F: drivers/*/max77686*.c
F: drivers/*/max77693.c F: drivers/*/max77693*.c
F: drivers/extcon/extcon-max14577.c F: drivers/extcon/extcon-max14577.c
F: drivers/extcon/extcon-max77693.c F: drivers/extcon/extcon-max77693.c
F: drivers/rtc/rtc-max77686.c F: drivers/rtc/rtc-max77686.c
......
...@@ -418,6 +418,7 @@ config REGULATOR_MAX8952 ...@@ -418,6 +418,7 @@ config REGULATOR_MAX8952
config REGULATOR_MAX8973 config REGULATOR_MAX8973
tristate "Maxim MAX8973 voltage regulator " tristate "Maxim MAX8973 voltage regulator "
depends on I2C depends on I2C
depends on THERMAL && THERMAL_OF
select REGMAP_I2C select REGMAP_I2C
help help
The MAXIM MAX8973 high-efficiency. three phase, DC-DC step-down The MAXIM MAX8973 high-efficiency. three phase, DC-DC step-down
...@@ -557,6 +558,13 @@ config REGULATOR_PV88060 ...@@ -557,6 +558,13 @@ config REGULATOR_PV88060
Say y here to support the voltage regulators and convertors Say y here to support the voltage regulators and convertors
PV88060 PV88060
config REGULATOR_PV88080
tristate "Powerventure Semiconductor PV88080 regulator"
depends on I2C
select REGMAP_I2C
help
Say y here to support the buck convertors on PV88080
config REGULATOR_PV88090 config REGULATOR_PV88090
tristate "Powerventure Semiconductor PV88090 regulator" tristate "Powerventure Semiconductor PV88090 regulator"
depends on I2C depends on I2C
......
...@@ -47,7 +47,7 @@ obj-$(CONFIG_REGULATOR_LP8788) += lp8788-buck.o ...@@ -47,7 +47,7 @@ obj-$(CONFIG_REGULATOR_LP8788) += lp8788-buck.o
obj-$(CONFIG_REGULATOR_LP8788) += lp8788-ldo.o obj-$(CONFIG_REGULATOR_LP8788) += lp8788-ldo.o
obj-$(CONFIG_REGULATOR_LP8755) += lp8755.o obj-$(CONFIG_REGULATOR_LP8755) += lp8755.o
obj-$(CONFIG_REGULATOR_LTC3589) += ltc3589.o obj-$(CONFIG_REGULATOR_LTC3589) += ltc3589.o
obj-$(CONFIG_REGULATOR_MAX14577) += max14577.o obj-$(CONFIG_REGULATOR_MAX14577) += max14577-regulator.o
obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
obj-$(CONFIG_REGULATOR_MAX77620) += max77620-regulator.o obj-$(CONFIG_REGULATOR_MAX77620) += max77620-regulator.o
obj-$(CONFIG_REGULATOR_MAX8649) += max8649.o obj-$(CONFIG_REGULATOR_MAX8649) += max8649.o
...@@ -56,10 +56,10 @@ obj-$(CONFIG_REGULATOR_MAX8907) += max8907-regulator.o ...@@ -56,10 +56,10 @@ obj-$(CONFIG_REGULATOR_MAX8907) += max8907-regulator.o
obj-$(CONFIG_REGULATOR_MAX8925) += max8925-regulator.o obj-$(CONFIG_REGULATOR_MAX8925) += max8925-regulator.o
obj-$(CONFIG_REGULATOR_MAX8952) += max8952.o obj-$(CONFIG_REGULATOR_MAX8952) += max8952.o
obj-$(CONFIG_REGULATOR_MAX8973) += max8973-regulator.o obj-$(CONFIG_REGULATOR_MAX8973) += max8973-regulator.o
obj-$(CONFIG_REGULATOR_MAX8997) += max8997.o obj-$(CONFIG_REGULATOR_MAX8997) += max8997-regulator.o
obj-$(CONFIG_REGULATOR_MAX8998) += max8998.o obj-$(CONFIG_REGULATOR_MAX8998) += max8998.o
obj-$(CONFIG_REGULATOR_MAX77686) += max77686-regulator.o obj-$(CONFIG_REGULATOR_MAX77686) += max77686-regulator.o
obj-$(CONFIG_REGULATOR_MAX77693) += max77693.o obj-$(CONFIG_REGULATOR_MAX77693) += max77693-regulator.o
obj-$(CONFIG_REGULATOR_MAX77802) += max77802-regulator.o obj-$(CONFIG_REGULATOR_MAX77802) += max77802-regulator.o
obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o
obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o
...@@ -72,6 +72,7 @@ obj-$(CONFIG_REGULATOR_QCOM_SPMI) += qcom_spmi-regulator.o ...@@ -72,6 +72,7 @@ obj-$(CONFIG_REGULATOR_QCOM_SPMI) += qcom_spmi-regulator.o
obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o
obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o
obj-$(CONFIG_REGULATOR_PV88060) += pv88060-regulator.o obj-$(CONFIG_REGULATOR_PV88060) += pv88060-regulator.o
obj-$(CONFIG_REGULATOR_PV88080) += pv88080-regulator.o
obj-$(CONFIG_REGULATOR_PV88090) += pv88090-regulator.o obj-$(CONFIG_REGULATOR_PV88090) += pv88090-regulator.o
obj-$(CONFIG_REGULATOR_PWM) += pwm-regulator.o obj-$(CONFIG_REGULATOR_PWM) += pwm-regulator.o
obj-$(CONFIG_REGULATOR_TPS51632) += tps51632-regulator.o obj-$(CONFIG_REGULATOR_TPS51632) += tps51632-regulator.o
......
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
#define MAX77686_LDO_LOW_UVSTEP 25000 #define MAX77686_LDO_LOW_UVSTEP 25000
#define MAX77686_BUCK_MINUV 750000 #define MAX77686_BUCK_MINUV 750000
#define MAX77686_BUCK_UVSTEP 50000 #define MAX77686_BUCK_UVSTEP 50000
#define MAX77686_BUCK_ENABLE_TIME 40 /* us */
#define MAX77686_DVS_ENABLE_TIME 22 /* us */
#define MAX77686_RAMP_DELAY 100000 /* uV/us */ #define MAX77686_RAMP_DELAY 100000 /* uV/us */
#define MAX77686_DVS_RAMP_DELAY 27500 /* uV/us */ #define MAX77686_DVS_RAMP_DELAY 27500 /* uV/us */
#define MAX77686_DVS_MINUV 600000 #define MAX77686_DVS_MINUV 600000
...@@ -422,6 +424,7 @@ static struct regulator_ops max77686_buck_dvs_ops = { ...@@ -422,6 +424,7 @@ static struct regulator_ops max77686_buck_dvs_ops = {
.min_uV = MAX77686_BUCK_MINUV, \ .min_uV = MAX77686_BUCK_MINUV, \
.uV_step = MAX77686_BUCK_UVSTEP, \ .uV_step = MAX77686_BUCK_UVSTEP, \
.ramp_delay = MAX77686_RAMP_DELAY, \ .ramp_delay = MAX77686_RAMP_DELAY, \
.enable_time = MAX77686_BUCK_ENABLE_TIME, \
.n_voltages = MAX77686_VSEL_MASK + 1, \ .n_voltages = MAX77686_VSEL_MASK + 1, \
.vsel_reg = MAX77686_REG_BUCK5OUT + (num - 5) * 2, \ .vsel_reg = MAX77686_REG_BUCK5OUT + (num - 5) * 2, \
.vsel_mask = MAX77686_VSEL_MASK, \ .vsel_mask = MAX77686_VSEL_MASK, \
...@@ -439,6 +442,7 @@ static struct regulator_ops max77686_buck_dvs_ops = { ...@@ -439,6 +442,7 @@ static struct regulator_ops max77686_buck_dvs_ops = {
.min_uV = MAX77686_BUCK_MINUV, \ .min_uV = MAX77686_BUCK_MINUV, \
.uV_step = MAX77686_BUCK_UVSTEP, \ .uV_step = MAX77686_BUCK_UVSTEP, \
.ramp_delay = MAX77686_RAMP_DELAY, \ .ramp_delay = MAX77686_RAMP_DELAY, \
.enable_time = MAX77686_BUCK_ENABLE_TIME, \
.n_voltages = MAX77686_VSEL_MASK + 1, \ .n_voltages = MAX77686_VSEL_MASK + 1, \
.vsel_reg = MAX77686_REG_BUCK1OUT, \ .vsel_reg = MAX77686_REG_BUCK1OUT, \
.vsel_mask = MAX77686_VSEL_MASK, \ .vsel_mask = MAX77686_VSEL_MASK, \
...@@ -456,6 +460,7 @@ static struct regulator_ops max77686_buck_dvs_ops = { ...@@ -456,6 +460,7 @@ static struct regulator_ops max77686_buck_dvs_ops = {
.min_uV = MAX77686_DVS_MINUV, \ .min_uV = MAX77686_DVS_MINUV, \
.uV_step = MAX77686_DVS_UVSTEP, \ .uV_step = MAX77686_DVS_UVSTEP, \
.ramp_delay = MAX77686_DVS_RAMP_DELAY, \ .ramp_delay = MAX77686_DVS_RAMP_DELAY, \
.enable_time = MAX77686_DVS_ENABLE_TIME, \
.n_voltages = MAX77686_DVS_VSEL_MASK + 1, \ .n_voltages = MAX77686_DVS_VSEL_MASK + 1, \
.vsel_reg = MAX77686_REG_BUCK2DVS1 + (num - 2) * 10, \ .vsel_reg = MAX77686_REG_BUCK2DVS1 + (num - 2) * 10, \
.vsel_mask = MAX77686_DVS_VSEL_MASK, \ .vsel_mask = MAX77686_DVS_VSEL_MASK, \
...@@ -553,17 +558,7 @@ static struct platform_driver max77686_pmic_driver = { ...@@ -553,17 +558,7 @@ static struct platform_driver max77686_pmic_driver = {
.id_table = max77686_pmic_id, .id_table = max77686_pmic_id,
}; };
static int __init max77686_pmic_init(void) module_platform_driver(max77686_pmic_driver);
{
return platform_driver_register(&max77686_pmic_driver);
}
subsys_initcall(max77686_pmic_init);
static void __exit max77686_pmic_cleanup(void)
{
platform_driver_unregister(&max77686_pmic_driver);
}
module_exit(max77686_pmic_cleanup);
MODULE_DESCRIPTION("MAXIM 77686 Regulator Driver"); MODULE_DESCRIPTION("MAXIM 77686 Regulator Driver");
MODULE_AUTHOR("Chiwoong Byun <woong.byun@samsung.com>"); MODULE_AUTHOR("Chiwoong Byun <woong.byun@samsung.com>");
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Simon Glass <sjg@chromium.org> * Simon Glass <sjg@chromium.org>
* *
* Copyright (C) 2012 Samsung Electronics * Copyright (C) 2012 Samsung Electronics
* Chiwoong Byun <woong.byun@smasung.com> * Chiwoong Byun <woong.byun@samsung.com>
* Jonghwa Lee <jonghwa3.lee@samsung.com> * Jonghwa Lee <jonghwa3.lee@samsung.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
......
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/thermal.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
/* Register definitions */ /* Register definitions */
#define MAX8973_VOUT 0x0 #define MAX8973_VOUT 0x0
...@@ -74,6 +77,7 @@ ...@@ -74,6 +77,7 @@
#define MAX8973_WDTMR_ENABLE BIT(6) #define MAX8973_WDTMR_ENABLE BIT(6)
#define MAX8973_DISCH_ENBABLE BIT(5) #define MAX8973_DISCH_ENBABLE BIT(5)
#define MAX8973_FT_ENABLE BIT(4) #define MAX8973_FT_ENABLE BIT(4)
#define MAX77621_T_JUNCTION_120 BIT(7)
#define MAX8973_CKKADV_TRIP_MASK 0xC #define MAX8973_CKKADV_TRIP_MASK 0xC
#define MAX8973_CKKADV_TRIP_DISABLE 0xC #define MAX8973_CKKADV_TRIP_DISABLE 0xC
...@@ -93,6 +97,12 @@ ...@@ -93,6 +97,12 @@
#define MAX8973_VOLATGE_STEP 6250 #define MAX8973_VOLATGE_STEP 6250
#define MAX8973_BUCK_N_VOLTAGE 0x80 #define MAX8973_BUCK_N_VOLTAGE 0x80
#define MAX77621_CHIPID_TJINT_S BIT(0)
#define MAX77621_NORMAL_OPERATING_TEMP 100000
#define MAX77621_TJINT_WARNING_TEMP_120 120000
#define MAX77621_TJINT_WARNING_TEMP_140 140000
enum device_id { enum device_id {
MAX8973, MAX8973,
MAX77621 MAX77621
...@@ -112,6 +122,9 @@ struct max8973_chip { ...@@ -112,6 +122,9 @@ struct max8973_chip {
int curr_gpio_val; int curr_gpio_val;
struct regulator_ops ops; struct regulator_ops ops;
enum device_id id; enum device_id id;
int junction_temp_warning;
int irq;
struct thermal_zone_device *tz_device;
}; };
/* /*
...@@ -391,6 +404,10 @@ static int max8973_init_dcdc(struct max8973_chip *max, ...@@ -391,6 +404,10 @@ static int max8973_init_dcdc(struct max8973_chip *max,
if (pdata->control_flags & MAX8973_CONTROL_FREQ_SHIFT_9PER_ENABLE) if (pdata->control_flags & MAX8973_CONTROL_FREQ_SHIFT_9PER_ENABLE)
control1 |= MAX8973_FREQSHIFT_9PER; control1 |= MAX8973_FREQSHIFT_9PER;
if ((pdata->junction_temp_warning == MAX77621_TJINT_WARNING_TEMP_120) &&
(max->id == MAX77621))
control2 |= MAX77621_T_JUNCTION_120;
if (!(pdata->control_flags & MAX8973_CONTROL_PULL_DOWN_ENABLE)) if (!(pdata->control_flags & MAX8973_CONTROL_PULL_DOWN_ENABLE))
control2 |= MAX8973_DISCH_ENBABLE; control2 |= MAX8973_DISCH_ENBABLE;
...@@ -457,6 +474,79 @@ static int max8973_init_dcdc(struct max8973_chip *max, ...@@ -457,6 +474,79 @@ static int max8973_init_dcdc(struct max8973_chip *max,
return ret; return ret;
} }
static int max8973_thermal_read_temp(void *data, int *temp)
{
struct max8973_chip *mchip = data;
unsigned int val;
int ret;
ret = regmap_read(mchip->regmap, MAX8973_CHIPID1, &val);
if (ret < 0) {
dev_err(mchip->dev, "Failed to read register CHIPID1, %d", ret);
return ret;
}
/* +1 degC to trigger cool devive */
if (val & MAX77621_CHIPID_TJINT_S)
*temp = mchip->junction_temp_warning + 1000;
else
*temp = MAX77621_NORMAL_OPERATING_TEMP;
return 0;
}
static irqreturn_t max8973_thermal_irq(int irq, void *data)
{
struct max8973_chip *mchip = data;
thermal_zone_device_update(mchip->tz_device);
return IRQ_HANDLED;
}
static const struct thermal_zone_of_device_ops max77621_tz_ops = {
.get_temp = max8973_thermal_read_temp,
};
static int max8973_thermal_init(struct max8973_chip *mchip)
{
struct thermal_zone_device *tzd;
struct irq_data *irq_data;
unsigned long irq_flags = 0;
int ret;
if (mchip->id != MAX77621)
return 0;
tzd = devm_thermal_zone_of_sensor_register(mchip->dev, 0, mchip,
&max77621_tz_ops);
if (IS_ERR(tzd)) {
ret = PTR_ERR(tzd);
dev_err(mchip->dev, "Failed to register thermal sensor: %d\n",
ret);
return ret;
}
if (mchip->irq <= 0)
return 0;
irq_data = irq_get_irq_data(mchip->irq);
if (irq_data)
irq_flags = irqd_get_trigger_type(irq_data);
ret = devm_request_threaded_irq(mchip->dev, mchip->irq, NULL,
max8973_thermal_irq,
IRQF_ONESHOT | IRQF_SHARED | irq_flags,
dev_name(mchip->dev), mchip);
if (ret < 0) {
dev_err(mchip->dev, "Failed to request irq %d, %d\n",
mchip->irq, ret);
return ret;
}
return 0;
}
static const struct regmap_config max8973_regmap_config = { static const struct regmap_config max8973_regmap_config = {
.reg_bits = 8, .reg_bits = 8,
.val_bits = 8, .val_bits = 8,
...@@ -521,6 +611,11 @@ static struct max8973_regulator_platform_data *max8973_parse_dt( ...@@ -521,6 +611,11 @@ static struct max8973_regulator_platform_data *max8973_parse_dt(
pdata->control_flags |= MAX8973_CONTROL_CLKADV_TRIP_DISABLED; pdata->control_flags |= MAX8973_CONTROL_CLKADV_TRIP_DISABLED;
} }
pdata->junction_temp_warning = MAX77621_TJINT_WARNING_TEMP_140;
ret = of_property_read_u32(np, "junction-warn-millicelsius", &pval);
if (!ret && (pval <= MAX77621_TJINT_WARNING_TEMP_120))
pdata->junction_temp_warning = MAX77621_TJINT_WARNING_TEMP_120;
return pdata; return pdata;
} }
...@@ -608,6 +703,7 @@ static int max8973_probe(struct i2c_client *client, ...@@ -608,6 +703,7 @@ static int max8973_probe(struct i2c_client *client,
max->enable_external_control = pdata->enable_ext_control; max->enable_external_control = pdata->enable_ext_control;
max->curr_gpio_val = pdata->dvs_def_state; max->curr_gpio_val = pdata->dvs_def_state;
max->curr_vout_reg = MAX8973_VOUT + pdata->dvs_def_state; max->curr_vout_reg = MAX8973_VOUT + pdata->dvs_def_state;
max->junction_temp_warning = pdata->junction_temp_warning;
if (gpio_is_valid(max->enable_gpio)) if (gpio_is_valid(max->enable_gpio))
max->enable_external_control = true; max->enable_external_control = true;
...@@ -718,6 +814,7 @@ static int max8973_probe(struct i2c_client *client, ...@@ -718,6 +814,7 @@ static int max8973_probe(struct i2c_client *client,
return ret; return ret;
} }
max8973_thermal_init(max);
return 0; return 0;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* max8997.c - Regulator driver for the Maxim 8997/8966 * max8997.c - Regulator driver for the Maxim 8997/8966
* *
* Copyright (C) 2011 Samsung Electronics * Copyright (C) 2011 Samsung Electronics
* MyungJoo Ham <myungjoo.ham@smasung.com> * MyungJoo Ham <myungjoo.ham@samsung.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
......
...@@ -944,6 +944,8 @@ static int palmas_ldo_registration(struct palmas_pmic *pmic, ...@@ -944,6 +944,8 @@ static int palmas_ldo_registration(struct palmas_pmic *pmic,
if (id == PALMAS_REG_LDO9) { if (id == PALMAS_REG_LDO9) {
desc->ops = &palmas_ops_ldo9; desc->ops = &palmas_ops_ldo9;
desc->bypass_reg = desc->enable_reg; desc->bypass_reg = desc->enable_reg;
desc->bypass_val_on =
PALMAS_LDO9_CTRL_LDO_BYPASS_EN;
desc->bypass_mask = desc->bypass_mask =
PALMAS_LDO9_CTRL_LDO_BYPASS_EN; PALMAS_LDO9_CTRL_LDO_BYPASS_EN;
} }
...@@ -1055,6 +1057,8 @@ static int tps65917_ldo_registration(struct palmas_pmic *pmic, ...@@ -1055,6 +1057,8 @@ static int tps65917_ldo_registration(struct palmas_pmic *pmic,
id == TPS65917_REG_LDO2) { id == TPS65917_REG_LDO2) {
desc->ops = &tps65917_ops_ldo_1_2; desc->ops = &tps65917_ops_ldo_1_2;
desc->bypass_reg = desc->enable_reg; desc->bypass_reg = desc->enable_reg;
desc->bypass_val_on =
TPS65917_LDO1_CTRL_BYPASS_EN;
desc->bypass_mask = desc->bypass_mask =
TPS65917_LDO1_CTRL_BYPASS_EN; TPS65917_LDO1_CTRL_BYPASS_EN;
} }
...@@ -1206,6 +1210,7 @@ static int palmas_smps_registration(struct palmas_pmic *pmic, ...@@ -1206,6 +1210,7 @@ static int palmas_smps_registration(struct palmas_pmic *pmic,
desc->enable_mask = SMPS10_BOOST_EN; desc->enable_mask = SMPS10_BOOST_EN;
desc->bypass_reg = PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, desc->bypass_reg = PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE,
PALMAS_SMPS10_CTRL); PALMAS_SMPS10_CTRL);
desc->bypass_val_on = SMPS10_BYPASS_EN;
desc->bypass_mask = SMPS10_BYPASS_EN; desc->bypass_mask = SMPS10_BYPASS_EN;
desc->min_uV = 3750000; desc->min_uV = 3750000;
desc->uV_step = 1250000; desc->uV_step = 1250000;
...@@ -1462,10 +1467,10 @@ static struct palmas_pmic_driver_data tps65917_ddata = { ...@@ -1462,10 +1467,10 @@ static struct palmas_pmic_driver_data tps65917_ddata = {
.ldo_register = tps65917_ldo_registration, .ldo_register = tps65917_ldo_registration,
}; };
static void palmas_dt_to_pdata(struct device *dev, static int palmas_dt_to_pdata(struct device *dev,
struct device_node *node, struct device_node *node,
struct palmas_pmic_platform_data *pdata, struct palmas_pmic_platform_data *pdata,
struct palmas_pmic_driver_data *ddata) struct palmas_pmic_driver_data *ddata)
{ {
struct device_node *regulators; struct device_node *regulators;
u32 prop; u32 prop;
...@@ -1474,7 +1479,7 @@ static void palmas_dt_to_pdata(struct device *dev, ...@@ -1474,7 +1479,7 @@ static void palmas_dt_to_pdata(struct device *dev,
regulators = of_get_child_by_name(node, "regulators"); regulators = of_get_child_by_name(node, "regulators");
if (!regulators) { if (!regulators) {
dev_info(dev, "regulator node not found\n"); dev_info(dev, "regulator node not found\n");
return; return 0;
} }
ret = of_regulator_match(dev, regulators, ddata->palmas_matches, ret = of_regulator_match(dev, regulators, ddata->palmas_matches,
...@@ -1482,25 +1487,29 @@ static void palmas_dt_to_pdata(struct device *dev, ...@@ -1482,25 +1487,29 @@ static void palmas_dt_to_pdata(struct device *dev,
of_node_put(regulators); of_node_put(regulators);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "Error parsing regulator init data: %d\n", ret); dev_err(dev, "Error parsing regulator init data: %d\n", ret);
return; return 0;
} }
for (idx = 0; idx < ddata->max_reg; idx++) { for (idx = 0; idx < ddata->max_reg; idx++) {
if (!ddata->palmas_matches[idx].init_data || static struct of_regulator_match *match;
!ddata->palmas_matches[idx].of_node) struct palmas_reg_init *rinit;
continue; struct device_node *np;
pdata->reg_data[idx] = ddata->palmas_matches[idx].init_data; match = &ddata->palmas_matches[idx];
np = match->of_node;
pdata->reg_init[idx] = devm_kzalloc(dev, if (!match->init_data || !np)
sizeof(struct palmas_reg_init), GFP_KERNEL); continue;
rinit = devm_kzalloc(dev, sizeof(*rinit), GFP_KERNEL);
if (!rinit)
return -ENOMEM;
pdata->reg_init[idx]->warm_reset = pdata->reg_data[idx] = match->init_data;
of_property_read_bool(ddata->palmas_matches[idx].of_node, pdata->reg_init[idx] = rinit;
"ti,warm-reset");
ret = of_property_read_u32(ddata->palmas_matches[idx].of_node, rinit->warm_reset = of_property_read_bool(np, "ti,warm-reset");
"ti,roof-floor", &prop); ret = of_property_read_u32(np, "ti,roof-floor", &prop);
/* EINVAL: Property not found */ /* EINVAL: Property not found */
if (ret != -EINVAL) { if (ret != -EINVAL) {
int econtrol; int econtrol;
...@@ -1522,31 +1531,29 @@ static void palmas_dt_to_pdata(struct device *dev, ...@@ -1522,31 +1531,29 @@ static void palmas_dt_to_pdata(struct device *dev,
WARN_ON(1); WARN_ON(1);
dev_warn(dev, dev_warn(dev,
"%s: Invalid roof-floor option: %u\n", "%s: Invalid roof-floor option: %u\n",
palmas_matches[idx].name, prop); match->name, prop);
break; break;
} }
} }
pdata->reg_init[idx]->roof_floor = econtrol; rinit->roof_floor = econtrol;
} }
ret = of_property_read_u32(ddata->palmas_matches[idx].of_node, ret = of_property_read_u32(np, "ti,mode-sleep", &prop);
"ti,mode-sleep", &prop);
if (!ret) if (!ret)
pdata->reg_init[idx]->mode_sleep = prop; rinit->mode_sleep = prop;
ret = of_property_read_bool(ddata->palmas_matches[idx].of_node, ret = of_property_read_bool(np, "ti,smps-range");
"ti,smps-range");
if (ret) if (ret)
pdata->reg_init[idx]->vsel = rinit->vsel = PALMAS_SMPS12_VOLTAGE_RANGE;
PALMAS_SMPS12_VOLTAGE_RANGE;
if (idx == PALMAS_REG_LDO8) if (idx == PALMAS_REG_LDO8)
pdata->enable_ldo8_tracking = of_property_read_bool( pdata->enable_ldo8_tracking = of_property_read_bool(
ddata->palmas_matches[idx].of_node, np, "ti,enable-ldo8-tracking");
"ti,enable-ldo8-tracking");
} }
pdata->ldo6_vibrator = of_property_read_bool(node, "ti,ldo6-vibrator"); pdata->ldo6_vibrator = of_property_read_bool(node, "ti,ldo6-vibrator");
return 0;
} }
static const struct of_device_id of_palmas_match_tbl[] = { static const struct of_device_id of_palmas_match_tbl[] = {
...@@ -1628,7 +1635,9 @@ static int palmas_regulators_probe(struct platform_device *pdev) ...@@ -1628,7 +1635,9 @@ static int palmas_regulators_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, pmic); platform_set_drvdata(pdev, pmic);
pmic->palmas->pmic_ddata = driver_data; pmic->palmas->pmic_ddata = driver_data;
palmas_dt_to_pdata(&pdev->dev, node, pdata, driver_data); ret = palmas_dt_to_pdata(&pdev->dev, node, pdata, driver_data);
if (ret)
return ret;
ret = palmas_smps_read(palmas, PALMAS_SMPS_CTRL, &reg); ret = palmas_smps_read(palmas, PALMAS_SMPS_CTRL, &reg);
if (ret) if (ret)
......
This diff is collapsed.
/*
* pv88080-regulator.h - Regulator definitions for PV88080
* Copyright (C) 2016 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 __PV88080_REGISTERS_H__
#define __PV88080_REGISTERS_H__
/* System Control and Event Registers */
#define PV88080_REG_EVENT_A 0x04
#define PV88080_REG_MASK_A 0x09
#define PV88080_REG_MASK_B 0x0a
#define PV88080_REG_MASK_C 0x0b
/* Regulator Registers */
#define PV88080_REG_BUCK1_CONF0 0x27
#define PV88080_REG_BUCK1_CONF1 0x28
#define PV88080_REG_BUCK1_CONF2 0x59
#define PV88080_REG_BUCK1_CONF5 0x5c
#define PV88080_REG_BUCK2_CONF0 0x29
#define PV88080_REG_BUCK2_CONF1 0x2a
#define PV88080_REG_BUCK2_CONF2 0x61
#define PV88080_REG_BUCK2_CONF5 0x64
#define PV88080_REG_BUCK3_CONF0 0x2b
#define PV88080_REG_BUCK3_CONF1 0x2c
#define PV88080_REG_BUCK3_CONF2 0x69
#define PV88080_REG_BUCK3_CONF5 0x6c
/* PV88080_REG_EVENT_A (addr=0x04) */
#define PV88080_E_VDD_FLT 0x01
#define PV88080_E_OVER_TEMP 0x02
/* PV88080_REG_MASK_A (addr=0x09) */
#define PV88080_M_VDD_FLT 0x01
#define PV88080_M_OVER_TEMP 0x02
/* PV88080_REG_BUCK1_CONF0 (addr=0x27) */
#define PV88080_BUCK1_EN 0x80
#define PV88080_VBUCK1_MASK 0x7F
/* PV88080_REG_BUCK2_CONF0 (addr=0x29) */
#define PV88080_BUCK2_EN 0x80
#define PV88080_VBUCK2_MASK 0x7F
/* PV88080_REG_BUCK3_CONF0 (addr=0x2b) */
#define PV88080_BUCK3_EN 0x80
#define PV88080_VBUCK3_MASK 0x7F
/* PV88080_REG_BUCK1_CONF1 (addr=0x28) */
#define PV88080_BUCK1_ILIM_SHIFT 2
#define PV88080_BUCK1_ILIM_MASK 0x0C
#define PV88080_BUCK1_MODE_MASK 0x03
/* PV88080_REG_BUCK2_CONF1 (addr=0x2a) */
#define PV88080_BUCK2_ILIM_SHIFT 2
#define PV88080_BUCK2_ILIM_MASK 0x0C
#define PV88080_BUCK2_MODE_MASK 0x03
/* PV88080_REG_BUCK3_CONF1 (addr=0x2c) */
#define PV88080_BUCK3_ILIM_SHIFT 2
#define PV88080_BUCK3_ILIM_MASK 0x0C
#define PV88080_BUCK3_MODE_MASK 0x03
#define PV88080_BUCK_MODE_SLEEP 0x00
#define PV88080_BUCK_MODE_AUTO 0x01
#define PV88080_BUCK_MODE_SYNC 0x02
/* PV88080_REG_BUCK2_CONF2 (addr=0x61) */
/* PV88080_REG_BUCK3_CONF2 (addr=0x69) */
#define PV88080_BUCK_VDAC_RANGE_SHIFT 7
#define PV88080_BUCK_VDAC_RANGE_MASK 0x01
#define PV88080_BUCK_VDAC_RANGE_1 0x00
#define PV88080_BUCK_VDAC_RANGE_2 0x01
/* PV88080_REG_BUCK2_CONF5 (addr=0x64) */
/* PV88080_REG_BUCK3_CONF5 (addr=0x6c) */
#define PV88080_BUCK_VRANGE_GAIN_SHIFT 0
#define PV88080_BUCK_VRANGE_GAIN_MASK 0x01
#define PV88080_BUCK_VRANGE_GAIN_1 0x00
#define PV88080_BUCK_VRANGE_GAIN_2 0x01
#endif /* __PV88080_REGISTERS_H__ */
...@@ -54,6 +54,10 @@ ...@@ -54,6 +54,10 @@
* @reg_init_data: The regulator init data. * @reg_init_data: The regulator init data.
* @control_flags: Control flags which are ORed value of above flags to * @control_flags: Control flags which are ORed value of above flags to
* configure device. * configure device.
* @junction_temp_warning: Junction temp in millicelcius on which warning need
* to be set. Thermal functionality is only supported on
* MAX77621. The threshold warning supported by MAX77621
* are 120C and 140C.
* @enable_ext_control: Enable the voltage enable/disable through external * @enable_ext_control: Enable the voltage enable/disable through external
* control signal from EN input pin. If it is false then * control signal from EN input pin. If it is false then
* voltage output will be enabled/disabled through EN bit of * voltage output will be enabled/disabled through EN bit of
...@@ -67,6 +71,7 @@ ...@@ -67,6 +71,7 @@
struct max8973_regulator_platform_data { struct max8973_regulator_platform_data {
struct regulator_init_data *reg_init_data; struct regulator_init_data *reg_init_data;
unsigned long control_flags; unsigned long control_flags;
unsigned long junction_temp_warning;
bool enable_ext_control; bool enable_ext_control;
int enable_gpio; int enable_gpio;
int dvs_gpio; int dvs_gpio;
......
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