mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
regulator: da9211: support da9215
This is a patch for supporting da9215 buck converter. Signed-off-by: James Ban <james.ban.opensource@diasemi.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
d770e558e2
commit
7bd3935432
@ -1,7 +1,7 @@
|
||||
* Dialog Semiconductor DA9211/DA9213 Voltage Regulator
|
||||
* Dialog Semiconductor DA9211/DA9213/DA9215 Voltage Regulator
|
||||
|
||||
Required properties:
|
||||
- compatible: "dlg,da9211" or "dlg,da9213".
|
||||
- compatible: "dlg,da9211" or "dlg,da9213" 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
|
||||
@ -66,3 +66,31 @@ Example 2) DA9213
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Example 3) DA9215
|
||||
pmic: da9215@68 {
|
||||
compatible = "dlg,da9215";
|
||||
reg = <0x68>;
|
||||
interrupts = <3 27>;
|
||||
|
||||
regulators {
|
||||
BUCKA {
|
||||
regulator-name = "VBUCKA";
|
||||
regulator-min-microvolt = < 300000>;
|
||||
regulator-max-microvolt = <1570000>;
|
||||
regulator-min-microamp = <4000000>;
|
||||
regulator-max-microamp = <7000000>;
|
||||
enable-gpios = <&gpio 27 0>;
|
||||
};
|
||||
BUCKB {
|
||||
regulator-name = "VBUCKB";
|
||||
regulator-min-microvolt = < 300000>;
|
||||
regulator-max-microvolt = <1570000>;
|
||||
regulator-min-microamp = <4000000>;
|
||||
regulator-max-microamp = <7000000>;
|
||||
enable-gpios = <&gpio 17 0>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -209,13 +209,13 @@ config REGULATOR_DA9210
|
||||
interface.
|
||||
|
||||
config REGULATOR_DA9211
|
||||
tristate "Dialog Semiconductor DA9211/DA9212/DA9213/DA9214 regulator"
|
||||
tristate "Dialog Semiconductor DA9211/DA9212/DA9213/DA9214/DA9215 regulator"
|
||||
depends on I2C
|
||||
select REGMAP_I2C
|
||||
help
|
||||
Say y here to support for the Dialog Semiconductor DA9211/DA9212
|
||||
/DA9213/DA9214.
|
||||
The DA9211/DA9212/DA9213/DA9214 is a multi-phase synchronous
|
||||
/DA9213/DA9214/DA9215.
|
||||
The DA9211/DA9212/DA9213/DA9214/DA9215 is a multi-phase synchronous
|
||||
step down converter 12A or 16A DC-DC Buck controlled through an I2C
|
||||
interface.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* da9211-regulator.c - Regulator device driver for DA9211/DA9213
|
||||
* Copyright (C) 2014 Dialog Semiconductor Ltd.
|
||||
* da9211-regulator.c - Regulator device driver for DA9211/DA9213/DA9215
|
||||
* Copyright (C) 2015 Dialog Semiconductor Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
@ -32,6 +32,7 @@
|
||||
/* DEVICE IDs */
|
||||
#define DA9211_DEVICE_ID 0x22
|
||||
#define DA9213_DEVICE_ID 0x23
|
||||
#define DA9215_DEVICE_ID 0x24
|
||||
|
||||
#define DA9211_BUCK_MODE_SLEEP 1
|
||||
#define DA9211_BUCK_MODE_SYNC 2
|
||||
@ -90,6 +91,13 @@ static const int da9213_current_limits[] = {
|
||||
3000000, 3200000, 3400000, 3600000, 3800000, 4000000, 4200000, 4400000,
|
||||
4600000, 4800000, 5000000, 5200000, 5400000, 5600000, 5800000, 6000000
|
||||
};
|
||||
/* Current limits for DA9215 buck (uA) indices
|
||||
* corresponds with register values
|
||||
*/
|
||||
static const int da9215_current_limits[] = {
|
||||
4000000, 4200000, 4400000, 4600000, 4800000, 5000000, 5200000, 5400000,
|
||||
5600000, 5800000, 6000000, 6200000, 6400000, 6600000, 6800000, 7000000
|
||||
};
|
||||
|
||||
static unsigned int da9211_buck_get_mode(struct regulator_dev *rdev)
|
||||
{
|
||||
@ -157,6 +165,10 @@ static int da9211_set_current_limit(struct regulator_dev *rdev, int min,
|
||||
current_limits = da9213_current_limits;
|
||||
max_size = ARRAY_SIZE(da9213_current_limits)-1;
|
||||
break;
|
||||
case DA9215:
|
||||
current_limits = da9215_current_limits;
|
||||
max_size = ARRAY_SIZE(da9215_current_limits)-1;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -189,6 +201,9 @@ static int da9211_get_current_limit(struct regulator_dev *rdev)
|
||||
case DA9213:
|
||||
current_limits = da9213_current_limits;
|
||||
break;
|
||||
case DA9215:
|
||||
current_limits = da9215_current_limits;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -350,13 +365,11 @@ static int da9211_regulator_init(struct da9211 *chip)
|
||||
/* If configuration for 1/2 bucks is different between platform data
|
||||
* and the register, driver should exit.
|
||||
*/
|
||||
if ((chip->pdata->num_buck == 2 && data == 0x40)
|
||||
|| (chip->pdata->num_buck == 1 && data == 0x00)) {
|
||||
if (data == 0)
|
||||
chip->num_regulator = 1;
|
||||
else
|
||||
chip->num_regulator = 2;
|
||||
} else {
|
||||
if (chip->pdata->num_buck == 1 && data == 0x00)
|
||||
chip->num_regulator = 1;
|
||||
else if (chip->pdata->num_buck == 2 && data != 0x00)
|
||||
chip->num_regulator = 2;
|
||||
else {
|
||||
dev_err(chip->dev, "Configuration is mismatched\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -438,6 +451,9 @@ static int da9211_i2c_probe(struct i2c_client *i2c,
|
||||
case DA9213_DEVICE_ID:
|
||||
chip->chip_id = DA9213;
|
||||
break;
|
||||
case DA9215_DEVICE_ID:
|
||||
chip->chip_id = DA9215;
|
||||
break;
|
||||
default:
|
||||
dev_err(chip->dev, "Unsupported device id = 0x%x.\n", data);
|
||||
return -ENODEV;
|
||||
@ -478,6 +494,7 @@ static int da9211_i2c_probe(struct i2c_client *i2c,
|
||||
static const struct i2c_device_id da9211_i2c_id[] = {
|
||||
{"da9211", DA9211},
|
||||
{"da9213", DA9213},
|
||||
{"da9215", DA9215},
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, da9211_i2c_id);
|
||||
@ -486,6 +503,7 @@ MODULE_DEVICE_TABLE(i2c, da9211_i2c_id);
|
||||
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] },
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, da9211_dt_ids);
|
||||
@ -504,5 +522,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");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_DESCRIPTION("Regulator device driver for Dialog DA9211/DA9213/DA9215");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -1,16 +1,16 @@
|
||||
/*
|
||||
* da9211-regulator.h - Regulator definitions for DA9211/DA9213
|
||||
* Copyright (C) 2014 Dialog Semiconductor Ltd.
|
||||
* da9211-regulator.h - Regulator definitions for DA9211/DA9213/DA9215
|
||||
* Copyright (C) 2015 Dialog Semiconductor Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library 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 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 library is distributed in the hope that it will be useful,
|
||||
* 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
|
||||
* Library General Public License for more details.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __DA9211_REGISTERS_H__
|
||||
|
@ -1,16 +1,16 @@
|
||||
/*
|
||||
* da9211.h - Regulator device driver for DA9211/DA9213
|
||||
* Copyright (C) 2014 Dialog Semiconductor Ltd.
|
||||
* da9211.h - Regulator device driver for DA9211/DA9213/DA9215
|
||||
* Copyright (C) 2015 Dialog Semiconductor Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library 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 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 library is distributed in the hope that it will be useful,
|
||||
* 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
|
||||
* Library General Public License for more details.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_REGULATOR_DA9211_H
|
||||
@ -23,6 +23,7 @@
|
||||
enum da9211_chip_id {
|
||||
DA9211,
|
||||
DA9213,
|
||||
DA9215,
|
||||
};
|
||||
|
||||
struct da9211_pdata {
|
||||
|
Loading…
Reference in New Issue
Block a user