Merge remote-tracking branches 'regulator/topic/act8865', 'regulator/topic/can-change-voltage', 'regulator/topic/da9210' and 'regulator/topic/da9211' into regulator-next
This commit is contained in:
commit
5fea0902ea
|
@ -1,4 +1,4 @@
|
|||
* Dialog Semiconductor DA9210 Voltage Regulator
|
||||
* Dialog Semiconductor DA9210 Multi-phase 12A DCDC BUCK Converter
|
||||
|
||||
Required properties:
|
||||
|
||||
|
@ -18,8 +18,12 @@ Example:
|
|||
compatible = "dlg,da9210";
|
||||
reg = <0x68>;
|
||||
|
||||
regulator-min-microvolt = <900000>;
|
||||
regulator-max-microvolt = <1000000>;
|
||||
interrupt-parent = <...>;
|
||||
interrupts = <...>;
|
||||
|
||||
regulator-min-microvolt = <300000>;
|
||||
regulator-max-microvolt = <1570000>;
|
||||
regulator-min-microamp = <1600000>;
|
||||
regulator-max-microamp = <4600000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
* Dialog Semiconductor DA9211/DA9213/DA9215 Voltage Regulator
|
||||
* Dialog Semiconductor DA9211/DA9212/DA9213/DA9214/DA9215 Voltage Regulator
|
||||
|
||||
Required properties:
|
||||
- compatible: "dlg,da9211" or "dlg,da9213" or "dlg,da9215"
|
||||
- compatible: "dlg,da9211" or "dlg,da9212" or "dlg,da9213"
|
||||
or "dlg,da9214" or "dlg,da9215"
|
||||
- reg: I2C slave address, usually 0x68.
|
||||
- interrupts: the interrupt outputs of the controller
|
||||
- regulators: A node that houses a sub-node for each regulator within the
|
||||
|
@ -21,6 +22,25 @@ Example 1) DA9211
|
|||
reg = <0x68>;
|
||||
interrupts = <3 27>;
|
||||
|
||||
regulators {
|
||||
BUCKA {
|
||||
regulator-name = "VBUCKA";
|
||||
regulator-min-microvolt = < 300000>;
|
||||
regulator-max-microvolt = <1570000>;
|
||||
regulator-min-microamp = <2000000>;
|
||||
regulator-max-microamp = <5000000>;
|
||||
enable-gpios = <&gpio 27 0>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Example 2) DA9212
|
||||
|
||||
pmic: da9212@68 {
|
||||
compatible = "dlg,da9212";
|
||||
reg = <0x68>;
|
||||
interrupts = <3 27>;
|
||||
|
||||
regulators {
|
||||
BUCKA {
|
||||
regulator-name = "VBUCKA";
|
||||
|
@ -41,12 +61,30 @@ Example 1) DA9211
|
|||
};
|
||||
};
|
||||
|
||||
Example 2) DA9213
|
||||
Example 3) DA9213
|
||||
pmic: da9213@68 {
|
||||
compatible = "dlg,da9213";
|
||||
reg = <0x68>;
|
||||
interrupts = <3 27>;
|
||||
|
||||
regulators {
|
||||
BUCKA {
|
||||
regulator-name = "VBUCKA";
|
||||
regulator-min-microvolt = < 300000>;
|
||||
regulator-max-microvolt = <1570000>;
|
||||
regulator-min-microamp = <3000000>;
|
||||
regulator-max-microamp = <6000000>;
|
||||
enable-gpios = <&gpio 27 0>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Example 4) DA9214
|
||||
pmic: da9214@68 {
|
||||
compatible = "dlg,da9214";
|
||||
reg = <0x68>;
|
||||
interrupts = <3 27>;
|
||||
|
||||
regulators {
|
||||
BUCKA {
|
||||
regulator-name = "VBUCKA";
|
||||
|
@ -67,8 +105,7 @@ Example 2) DA9213
|
|||
};
|
||||
};
|
||||
|
||||
|
||||
Example 3) DA9215
|
||||
Example 5) DA9215
|
||||
pmic: da9215@68 {
|
||||
compatible = "dlg,da9215";
|
||||
reg = <0x68>;
|
||||
|
|
|
@ -395,12 +395,6 @@ static int act8865_pdata_from_dt(struct device *dev,
|
|||
struct act8865_regulator_data *regulator;
|
||||
struct of_regulator_match *matches;
|
||||
|
||||
np = of_get_child_by_name(dev->of_node, "regulators");
|
||||
if (!np) {
|
||||
dev_err(dev, "missing 'regulators' subnode in DT\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case ACT8600:
|
||||
matches = act8600_matches;
|
||||
|
@ -419,6 +413,12 @@ static int act8865_pdata_from_dt(struct device *dev,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
np = of_get_child_by_name(dev->of_node, "regulators");
|
||||
if (!np) {
|
||||
dev_err(dev, "missing 'regulators' subnode in DT\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
matched = of_regulator_match(dev, np, matches, num_matches);
|
||||
of_node_put(np);
|
||||
if (matched <= 0)
|
||||
|
|
|
@ -2508,33 +2508,6 @@ int regulator_is_enabled(struct regulator *regulator)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(regulator_is_enabled);
|
||||
|
||||
/**
|
||||
* regulator_can_change_voltage - check if regulator can change voltage
|
||||
* @regulator: regulator source
|
||||
*
|
||||
* Returns positive if the regulator driver backing the source/client
|
||||
* can change its voltage, false otherwise. Useful for detecting fixed
|
||||
* or dummy regulators and disabling voltage change logic in the client
|
||||
* driver.
|
||||
*/
|
||||
int regulator_can_change_voltage(struct regulator *regulator)
|
||||
{
|
||||
struct regulator_dev *rdev = regulator->rdev;
|
||||
|
||||
if (regulator_ops_is_valid(rdev, REGULATOR_CHANGE_VOLTAGE)) {
|
||||
if (rdev->desc->n_voltages - rdev->desc->linear_min_sel > 1)
|
||||
return 1;
|
||||
|
||||
if (rdev->desc->continuous_voltage_range &&
|
||||
rdev->constraints->min_uV && rdev->constraints->max_uV &&
|
||||
rdev->constraints->min_uV != rdev->constraints->max_uV)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(regulator_can_change_voltage);
|
||||
|
||||
/**
|
||||
* regulator_count_voltages - count regulator_list_voltage() selectors
|
||||
* @regulator: regulator source
|
||||
|
|
|
@ -21,12 +21,11 @@
|
|||
#include <linux/err.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/regulator/driver.h>
|
||||
#include <linux/regulator/machine.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/regulator/of_regulator.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
|
@ -179,6 +178,13 @@ error_i2c:
|
|||
/*
|
||||
* I2C driver interface functions
|
||||
*/
|
||||
|
||||
static const struct of_device_id da9210_dt_ids[] = {
|
||||
{ .compatible = "dlg,da9210", },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, da9210_dt_ids);
|
||||
|
||||
static int da9210_i2c_probe(struct i2c_client *i2c,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
|
@ -188,6 +194,16 @@ static int da9210_i2c_probe(struct i2c_client *i2c,
|
|||
struct regulator_dev *rdev = NULL;
|
||||
struct regulator_config config = { };
|
||||
int error;
|
||||
const struct of_device_id *match;
|
||||
|
||||
if (i2c->dev.of_node && !pdata) {
|
||||
match = of_match_device(of_match_ptr(da9210_dt_ids),
|
||||
&i2c->dev);
|
||||
if (!match) {
|
||||
dev_err(&i2c->dev, "Error: No device match found\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
}
|
||||
|
||||
chip = devm_kzalloc(&i2c->dev, sizeof(struct da9210), GFP_KERNEL);
|
||||
if (!chip)
|
||||
|
@ -264,6 +280,7 @@ MODULE_DEVICE_TABLE(i2c, da9210_i2c_id);
|
|||
static struct i2c_driver da9210_regulator_driver = {
|
||||
.driver = {
|
||||
.name = "da9210",
|
||||
.of_match_table = of_match_ptr(da9210_dt_ids),
|
||||
},
|
||||
.probe = da9210_i2c_probe,
|
||||
.id_table = da9210_i2c_id,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* da9211-regulator.c - Regulator device driver for DA9211/DA9213/DA9215
|
||||
* da9211-regulator.c - Regulator device driver for DA9211/DA9212
|
||||
* /DA9213/DA9214/DA9215
|
||||
* Copyright (C) 2015 Dialog Semiconductor Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
@ -493,7 +494,9 @@ static int da9211_i2c_probe(struct i2c_client *i2c,
|
|||
|
||||
static const struct i2c_device_id da9211_i2c_id[] = {
|
||||
{"da9211", DA9211},
|
||||
{"da9212", DA9212},
|
||||
{"da9213", DA9213},
|
||||
{"da9214", DA9214},
|
||||
{"da9215", DA9215},
|
||||
{},
|
||||
};
|
||||
|
@ -502,8 +505,10 @@ MODULE_DEVICE_TABLE(i2c, da9211_i2c_id);
|
|||
#ifdef CONFIG_OF
|
||||
static const struct of_device_id da9211_dt_ids[] = {
|
||||
{ .compatible = "dlg,da9211", .data = &da9211_i2c_id[0] },
|
||||
{ .compatible = "dlg,da9213", .data = &da9211_i2c_id[1] },
|
||||
{ .compatible = "dlg,da9215", .data = &da9211_i2c_id[2] },
|
||||
{ .compatible = "dlg,da9212", .data = &da9211_i2c_id[1] },
|
||||
{ .compatible = "dlg,da9213", .data = &da9211_i2c_id[2] },
|
||||
{ .compatible = "dlg,da9214", .data = &da9211_i2c_id[3] },
|
||||
{ .compatible = "dlg,da9215", .data = &da9211_i2c_id[4] },
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, da9211_dt_ids);
|
||||
|
@ -521,5 +526,5 @@ static struct i2c_driver da9211_regulator_driver = {
|
|||
module_i2c_driver(da9211_regulator_driver);
|
||||
|
||||
MODULE_AUTHOR("James Ban <James.Ban.opensource@diasemi.com>");
|
||||
MODULE_DESCRIPTION("Regulator device driver for Dialog DA9211/DA9213/DA9215");
|
||||
MODULE_DESCRIPTION("DA9211/DA9212/DA9213/DA9214/DA9215 regulator driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* da9211-regulator.h - Regulator definitions for DA9211/DA9213/DA9215
|
||||
* da9211-regulator.h - Regulator definitions for DA9211/DA9212
|
||||
* /DA9213/DA9214/DA9215
|
||||
* Copyright (C) 2015 Dialog Semiconductor Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
|
|
@ -224,7 +224,6 @@ int regulator_bulk_force_disable(int num_consumers,
|
|||
void regulator_bulk_free(int num_consumers,
|
||||
struct regulator_bulk_data *consumers);
|
||||
|
||||
int regulator_can_change_voltage(struct regulator *regulator);
|
||||
int regulator_count_voltages(struct regulator *regulator);
|
||||
int regulator_list_voltage(struct regulator *regulator, unsigned selector);
|
||||
int regulator_is_supported_voltage(struct regulator *regulator,
|
||||
|
@ -436,11 +435,6 @@ static inline void regulator_bulk_free(int num_consumers,
|
|||
{
|
||||
}
|
||||
|
||||
static inline int regulator_can_change_voltage(struct regulator *regulator)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int regulator_set_voltage(struct regulator *regulator,
|
||||
int min_uV, int max_uV)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* da9211.h - Regulator device driver for DA9211/DA9213/DA9215
|
||||
* da9211.h - Regulator device driver for DA9211/DA9212
|
||||
* /DA9213/DA9214/DA9215
|
||||
* Copyright (C) 2015 Dialog Semiconductor Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -22,7 +23,9 @@
|
|||
|
||||
enum da9211_chip_id {
|
||||
DA9211,
|
||||
DA9212,
|
||||
DA9213,
|
||||
DA9214,
|
||||
DA9215,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue