aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/wm8350-regulator.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c
index 261db94e0e7b..771eca1066b5 100644
--- a/drivers/regulator/wm8350-regulator.c
+++ b/drivers/regulator/wm8350-regulator.c
@@ -24,6 +24,9 @@
24#include <linux/regulator/driver.h> 24#include <linux/regulator/driver.h>
25#include <linux/regulator/machine.h> 25#include <linux/regulator/machine.h>
26 26
27/* Maximum value possible for VSEL */
28#define WM8350_DCDC_MAX_VSEL 0x66
29
27/* Microamps */ 30/* Microamps */
28static const int isink_cur[] = { 31static const int isink_cur[] = {
29 4, 32 4,
@@ -385,6 +388,14 @@ static int wm8350_dcdc_get_voltage(struct regulator_dev *rdev)
385 return wm8350_dcdc_val_to_mvolts(val) * 1000; 388 return wm8350_dcdc_val_to_mvolts(val) * 1000;
386} 389}
387 390
391static int wm8350_dcdc_list_voltage(struct regulator_dev *rdev,
392 unsigned selector)
393{
394 if (selector > WM8350_DCDC_MAX_VSEL)
395 return -EINVAL;
396 return wm8350_dcdc_val_to_mvolts(selector) * 1000;
397}
398
388static int wm8350_dcdc_set_suspend_voltage(struct regulator_dev *rdev, int uV) 399static int wm8350_dcdc_set_suspend_voltage(struct regulator_dev *rdev, int uV)
389{ 400{
390 struct wm8350 *wm8350 = rdev_get_drvdata(rdev); 401 struct wm8350 *wm8350 = rdev_get_drvdata(rdev);
@@ -775,6 +786,14 @@ static int wm8350_ldo_get_voltage(struct regulator_dev *rdev)
775 return wm8350_ldo_val_to_mvolts(val) * 1000; 786 return wm8350_ldo_val_to_mvolts(val) * 1000;
776} 787}
777 788
789static int wm8350_ldo_list_voltage(struct regulator_dev *rdev,
790 unsigned selector)
791{
792 if (selector > WM8350_LDO1_VSEL_MASK)
793 return -EINVAL;
794 return wm8350_ldo_val_to_mvolts(selector) * 1000;
795}
796
778int wm8350_dcdc_set_slot(struct wm8350 *wm8350, int dcdc, u16 start, 797int wm8350_dcdc_set_slot(struct wm8350 *wm8350, int dcdc, u16 start,
779 u16 stop, u16 fault) 798 u16 stop, u16 fault)
780{ 799{
@@ -1162,6 +1181,7 @@ static int wm8350_ldo_is_enabled(struct regulator_dev *rdev)
1162static struct regulator_ops wm8350_dcdc_ops = { 1181static struct regulator_ops wm8350_dcdc_ops = {
1163 .set_voltage = wm8350_dcdc_set_voltage, 1182 .set_voltage = wm8350_dcdc_set_voltage,
1164 .get_voltage = wm8350_dcdc_get_voltage, 1183 .get_voltage = wm8350_dcdc_get_voltage,
1184 .list_voltage = wm8350_dcdc_list_voltage,
1165 .enable = wm8350_dcdc_enable, 1185 .enable = wm8350_dcdc_enable,
1166 .disable = wm8350_dcdc_disable, 1186 .disable = wm8350_dcdc_disable,
1167 .get_mode = wm8350_dcdc_get_mode, 1187 .get_mode = wm8350_dcdc_get_mode,
@@ -1185,6 +1205,7 @@ static struct regulator_ops wm8350_dcdc2_5_ops = {
1185static struct regulator_ops wm8350_ldo_ops = { 1205static struct regulator_ops wm8350_ldo_ops = {
1186 .set_voltage = wm8350_ldo_set_voltage, 1206 .set_voltage = wm8350_ldo_set_voltage,
1187 .get_voltage = wm8350_ldo_get_voltage, 1207 .get_voltage = wm8350_ldo_get_voltage,
1208 .list_voltage = wm8350_ldo_list_voltage,
1188 .enable = wm8350_ldo_enable, 1209 .enable = wm8350_ldo_enable,
1189 .disable = wm8350_ldo_disable, 1210 .disable = wm8350_ldo_disable,
1190 .is_enabled = wm8350_ldo_is_enabled, 1211 .is_enabled = wm8350_ldo_is_enabled,
@@ -1209,6 +1230,7 @@ static struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = {
1209 .ops = &wm8350_dcdc_ops, 1230 .ops = &wm8350_dcdc_ops,
1210 .irq = WM8350_IRQ_UV_DC1, 1231 .irq = WM8350_IRQ_UV_DC1,
1211 .type = REGULATOR_VOLTAGE, 1232 .type = REGULATOR_VOLTAGE,
1233 .n_voltages = WM8350_DCDC_MAX_VSEL + 1,
1212 .owner = THIS_MODULE, 1234 .owner = THIS_MODULE,
1213 }, 1235 },
1214 { 1236 {
@@ -1225,6 +1247,7 @@ static struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = {
1225 .ops = &wm8350_dcdc_ops, 1247 .ops = &wm8350_dcdc_ops,
1226 .irq = WM8350_IRQ_UV_DC3, 1248 .irq = WM8350_IRQ_UV_DC3,
1227 .type = REGULATOR_VOLTAGE, 1249 .type = REGULATOR_VOLTAGE,
1250 .n_voltages = WM8350_DCDC_MAX_VSEL + 1,
1228 .owner = THIS_MODULE, 1251 .owner = THIS_MODULE,
1229 }, 1252 },
1230 { 1253 {
@@ -1233,6 +1256,7 @@ static struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = {
1233 .ops = &wm8350_dcdc_ops, 1256 .ops = &wm8350_dcdc_ops,
1234 .irq = WM8350_IRQ_UV_DC4, 1257 .irq = WM8350_IRQ_UV_DC4,
1235 .type = REGULATOR_VOLTAGE, 1258 .type = REGULATOR_VOLTAGE,
1259 .n_voltages = WM8350_DCDC_MAX_VSEL + 1,
1236 .owner = THIS_MODULE, 1260 .owner = THIS_MODULE,
1237 }, 1261 },
1238 { 1262 {
@@ -1249,6 +1273,7 @@ static struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = {
1249 .ops = &wm8350_dcdc_ops, 1273 .ops = &wm8350_dcdc_ops,
1250 .irq = WM8350_IRQ_UV_DC6, 1274 .irq = WM8350_IRQ_UV_DC6,
1251 .type = REGULATOR_VOLTAGE, 1275 .type = REGULATOR_VOLTAGE,
1276 .n_voltages = WM8350_DCDC_MAX_VSEL + 1,
1252 .owner = THIS_MODULE, 1277 .owner = THIS_MODULE,
1253 }, 1278 },
1254 { 1279 {
@@ -1257,6 +1282,7 @@ static struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = {
1257 .ops = &wm8350_ldo_ops, 1282 .ops = &wm8350_ldo_ops,
1258 .irq = WM8350_IRQ_UV_LDO1, 1283 .irq = WM8350_IRQ_UV_LDO1,
1259 .type = REGULATOR_VOLTAGE, 1284 .type = REGULATOR_VOLTAGE,
1285 .n_voltages = WM8350_LDO1_VSEL_MASK + 1,
1260 .owner = THIS_MODULE, 1286 .owner = THIS_MODULE,
1261 }, 1287 },
1262 { 1288 {
@@ -1265,6 +1291,7 @@ static struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = {
1265 .ops = &wm8350_ldo_ops, 1291 .ops = &wm8350_ldo_ops,
1266 .irq = WM8350_IRQ_UV_LDO2, 1292 .irq = WM8350_IRQ_UV_LDO2,
1267 .type = REGULATOR_VOLTAGE, 1293 .type = REGULATOR_VOLTAGE,
1294 .n_voltages = WM8350_LDO2_VSEL_MASK + 1,
1268 .owner = THIS_MODULE, 1295 .owner = THIS_MODULE,
1269 }, 1296 },
1270 { 1297 {
@@ -1273,6 +1300,7 @@ static struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = {
1273 .ops = &wm8350_ldo_ops, 1300 .ops = &wm8350_ldo_ops,
1274 .irq = WM8350_IRQ_UV_LDO3, 1301 .irq = WM8350_IRQ_UV_LDO3,
1275 .type = REGULATOR_VOLTAGE, 1302 .type = REGULATOR_VOLTAGE,
1303 .n_voltages = WM8350_LDO3_VSEL_MASK + 1,
1276 .owner = THIS_MODULE, 1304 .owner = THIS_MODULE,
1277 }, 1305 },
1278 { 1306 {
@@ -1281,6 +1309,7 @@ static struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = {
1281 .ops = &wm8350_ldo_ops, 1309 .ops = &wm8350_ldo_ops,
1282 .irq = WM8350_IRQ_UV_LDO4, 1310 .irq = WM8350_IRQ_UV_LDO4,
1283 .type = REGULATOR_VOLTAGE, 1311 .type = REGULATOR_VOLTAGE,
1312 .n_voltages = WM8350_LDO4_VSEL_MASK + 1,
1284 .owner = THIS_MODULE, 1313 .owner = THIS_MODULE,
1285 }, 1314 },
1286 { 1315 {