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>steinar/wifi_calib_4_9_kernel
parent
d770e558e2
commit
7bd3935432
|
@ -1,7 +1,7 @@
|
||||||
* Dialog Semiconductor DA9211/DA9213 Voltage Regulator
|
* Dialog Semiconductor DA9211/DA9213/DA9215 Voltage Regulator
|
||||||
|
|
||||||
Required properties:
|
Required properties:
|
||||||
- compatible: "dlg,da9211" or "dlg,da9213".
|
- compatible: "dlg,da9211" or "dlg,da9213" or "dlg,da9215"
|
||||||
- reg: I2C slave address, usually 0x68.
|
- reg: I2C slave address, usually 0x68.
|
||||||
- interrupts: the interrupt outputs of the controller
|
- interrupts: the interrupt outputs of the controller
|
||||||
- regulators: A node that houses a sub-node for each regulator within the
|
- 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.
|
interface.
|
||||||
|
|
||||||
config REGULATOR_DA9211
|
config REGULATOR_DA9211
|
||||||
tristate "Dialog Semiconductor DA9211/DA9212/DA9213/DA9214 regulator"
|
tristate "Dialog Semiconductor DA9211/DA9212/DA9213/DA9214/DA9215 regulator"
|
||||||
depends on I2C
|
depends on I2C
|
||||||
select REGMAP_I2C
|
select REGMAP_I2C
|
||||||
help
|
help
|
||||||
Say y here to support for the Dialog Semiconductor DA9211/DA9212
|
Say y here to support for the Dialog Semiconductor DA9211/DA9212
|
||||||
/DA9213/DA9214.
|
/DA9213/DA9214/DA9215.
|
||||||
The DA9211/DA9212/DA9213/DA9214 is a multi-phase synchronous
|
The DA9211/DA9212/DA9213/DA9214/DA9215 is a multi-phase synchronous
|
||||||
step down converter 12A or 16A DC-DC Buck controlled through an I2C
|
step down converter 12A or 16A DC-DC Buck controlled through an I2C
|
||||||
interface.
|
interface.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* da9211-regulator.c - Regulator device driver for DA9211/DA9213
|
* da9211-regulator.c - Regulator device driver for DA9211/DA9213/DA9215
|
||||||
* Copyright (C) 2014 Dialog Semiconductor Ltd.
|
* Copyright (C) 2015 Dialog Semiconductor Ltd.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
@ -32,6 +32,7 @@
|
||||||
/* DEVICE IDs */
|
/* DEVICE IDs */
|
||||||
#define DA9211_DEVICE_ID 0x22
|
#define DA9211_DEVICE_ID 0x22
|
||||||
#define DA9213_DEVICE_ID 0x23
|
#define DA9213_DEVICE_ID 0x23
|
||||||
|
#define DA9215_DEVICE_ID 0x24
|
||||||
|
|
||||||
#define DA9211_BUCK_MODE_SLEEP 1
|
#define DA9211_BUCK_MODE_SLEEP 1
|
||||||
#define DA9211_BUCK_MODE_SYNC 2
|
#define DA9211_BUCK_MODE_SYNC 2
|
||||||
|
@ -90,6 +91,13 @@ static const int da9213_current_limits[] = {
|
||||||
3000000, 3200000, 3400000, 3600000, 3800000, 4000000, 4200000, 4400000,
|
3000000, 3200000, 3400000, 3600000, 3800000, 4000000, 4200000, 4400000,
|
||||||
4600000, 4800000, 5000000, 5200000, 5400000, 5600000, 5800000, 6000000
|
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)
|
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;
|
current_limits = da9213_current_limits;
|
||||||
max_size = ARRAY_SIZE(da9213_current_limits)-1;
|
max_size = ARRAY_SIZE(da9213_current_limits)-1;
|
||||||
break;
|
break;
|
||||||
|
case DA9215:
|
||||||
|
current_limits = da9215_current_limits;
|
||||||
|
max_size = ARRAY_SIZE(da9215_current_limits)-1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -189,6 +201,9 @@ static int da9211_get_current_limit(struct regulator_dev *rdev)
|
||||||
case DA9213:
|
case DA9213:
|
||||||
current_limits = da9213_current_limits;
|
current_limits = da9213_current_limits;
|
||||||
break;
|
break;
|
||||||
|
case DA9215:
|
||||||
|
current_limits = da9215_current_limits;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
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
|
/* If configuration for 1/2 bucks is different between platform data
|
||||||
* and the register, driver should exit.
|
* and the register, driver should exit.
|
||||||
*/
|
*/
|
||||||
if ((chip->pdata->num_buck == 2 && data == 0x40)
|
if (chip->pdata->num_buck == 1 && data == 0x00)
|
||||||
|| (chip->pdata->num_buck == 1 && data == 0x00)) {
|
chip->num_regulator = 1;
|
||||||
if (data == 0)
|
else if (chip->pdata->num_buck == 2 && data != 0x00)
|
||||||
chip->num_regulator = 1;
|
chip->num_regulator = 2;
|
||||||
else
|
else {
|
||||||
chip->num_regulator = 2;
|
|
||||||
} else {
|
|
||||||
dev_err(chip->dev, "Configuration is mismatched\n");
|
dev_err(chip->dev, "Configuration is mismatched\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -438,6 +451,9 @@ static int da9211_i2c_probe(struct i2c_client *i2c,
|
||||||
case DA9213_DEVICE_ID:
|
case DA9213_DEVICE_ID:
|
||||||
chip->chip_id = DA9213;
|
chip->chip_id = DA9213;
|
||||||
break;
|
break;
|
||||||
|
case DA9215_DEVICE_ID:
|
||||||
|
chip->chip_id = DA9215;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
dev_err(chip->dev, "Unsupported device id = 0x%x.\n", data);
|
dev_err(chip->dev, "Unsupported device id = 0x%x.\n", data);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
@ -478,6 +494,7 @@ static int da9211_i2c_probe(struct i2c_client *i2c,
|
||||||
static const struct i2c_device_id da9211_i2c_id[] = {
|
static const struct i2c_device_id da9211_i2c_id[] = {
|
||||||
{"da9211", DA9211},
|
{"da9211", DA9211},
|
||||||
{"da9213", DA9213},
|
{"da9213", DA9213},
|
||||||
|
{"da9215", DA9215},
|
||||||
{},
|
{},
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(i2c, da9211_i2c_id);
|
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[] = {
|
static const struct of_device_id da9211_dt_ids[] = {
|
||||||
{ .compatible = "dlg,da9211", .data = &da9211_i2c_id[0] },
|
{ .compatible = "dlg,da9211", .data = &da9211_i2c_id[0] },
|
||||||
{ .compatible = "dlg,da9213", .data = &da9211_i2c_id[1] },
|
{ .compatible = "dlg,da9213", .data = &da9211_i2c_id[1] },
|
||||||
|
{ .compatible = "dlg,da9215", .data = &da9211_i2c_id[2] },
|
||||||
{},
|
{},
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(of, da9211_dt_ids);
|
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_i2c_driver(da9211_regulator_driver);
|
||||||
|
|
||||||
MODULE_AUTHOR("James Ban <James.Ban.opensource@diasemi.com>");
|
MODULE_AUTHOR("James Ban <James.Ban.opensource@diasemi.com>");
|
||||||
MODULE_DESCRIPTION("Regulator device driver for Dialog DA9211/DA9213");
|
MODULE_DESCRIPTION("Regulator device driver for Dialog DA9211/DA9213/DA9215");
|
||||||
MODULE_LICENSE("GPL v2");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
/*
|
/*
|
||||||
* da9211-regulator.h - Regulator definitions for DA9211/DA9213
|
* da9211-regulator.h - Regulator definitions for DA9211/DA9213/DA9215
|
||||||
* Copyright (C) 2014 Dialog Semiconductor Ltd.
|
* Copyright (C) 2015 Dialog Semiconductor Ltd.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU General Public License
|
||||||
* License as published by the Free Software Foundation; either
|
* as published by the Free Software Foundation; either version 2
|
||||||
* version 2 of the License, or (at your option) any later version.
|
* 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
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* Library General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __DA9211_REGISTERS_H__
|
#ifndef __DA9211_REGISTERS_H__
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
/*
|
/*
|
||||||
* da9211.h - Regulator device driver for DA9211/DA9213
|
* da9211.h - Regulator device driver for DA9211/DA9213/DA9215
|
||||||
* Copyright (C) 2014 Dialog Semiconductor Ltd.
|
* Copyright (C) 2015 Dialog Semiconductor Ltd.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU General Public License
|
||||||
* License as published by the Free Software Foundation; either
|
* as published by the Free Software Foundation; either version 2
|
||||||
* version 2 of the License, or (at your option) any later version.
|
* 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
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* Library General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __LINUX_REGULATOR_DA9211_H
|
#ifndef __LINUX_REGULATOR_DA9211_H
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
enum da9211_chip_id {
|
enum da9211_chip_id {
|
||||||
DA9211,
|
DA9211,
|
||||||
DA9213,
|
DA9213,
|
||||||
|
DA9215,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct da9211_pdata {
|
struct da9211_pdata {
|
||||||
|
|
Loading…
Reference in New Issue