Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: lp8755: new driver for LP8755

This patch is for new lp8755 regulator dirver and
several unsed variables were deleted and then test was done.

LP8755 :
The LP8755 is a high performance power management unit.It contains
six step-down DC-DC converters which can can be filexibly bundled
together in multiphase converters as required by application.
www.ti.com

Signed-off-by: Daniel Jeong <gshark.jeong@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

authored by

Daniel Jeong and committed by
Mark Brown
b59320cc a49f0d1e

+661
+9
drivers/regulator/Kconfig
··· 277 277 help 278 278 This driver supports LP8720/LP8725 PMIC 279 279 280 + config REGULATOR_LP8755 281 + tristate "TI LP8755 High Performance PMU driver" 282 + depends on I2C 283 + select REGMAP_I2C 284 + help 285 + This driver supports LP8755 High Performance PMU driver. This 286 + chip contains six step-down DC/DC converters which can support 287 + 9 mode multiphase configuration. 288 + 280 289 config REGULATOR_LP8788 281 290 bool "TI LP8788 Power Regulators" 282 291 depends on MFD_LP8788
+1
drivers/regulator/Makefile
··· 30 30 obj-$(CONFIG_REGULATOR_LP872X) += lp872x.o 31 31 obj-$(CONFIG_REGULATOR_LP8788) += lp8788-buck.o 32 32 obj-$(CONFIG_REGULATOR_LP8788) += lp8788-ldo.o 33 + obj-$(CONFIG_REGULATOR_LP8755) += lp8755.o 33 34 obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o 34 35 obj-$(CONFIG_REGULATOR_MAX8649) += max8649.o 35 36 obj-$(CONFIG_REGULATOR_MAX8660) += max8660.o
+580
drivers/regulator/lp8755.c
··· 1 + /* 2 + * LP8755 High Performance Power Management Unit : System Interface Driver 3 + * (based on rev. 0.26) 4 + * Copyright 2012 Texas Instruments 5 + * 6 + * Author: Daniel(Geon Si) Jeong <daniel.jeong@ti.com> 7 + * 8 + * This program is free software; you can redistribute it and/or modify 9 + * it under the terms of the GNU General Public License version 2 as 10 + * published by the Free Software Foundation. 11 + * 12 + */ 13 + 14 + #include <linux/module.h> 15 + #include <linux/slab.h> 16 + #include <linux/i2c.h> 17 + #include <linux/err.h> 18 + #include <linux/irq.h> 19 + #include <linux/interrupt.h> 20 + #include <linux/gpio.h> 21 + #include <linux/regmap.h> 22 + #include <linux/delay.h> 23 + #include <linux/uaccess.h> 24 + #include <linux/regulator/driver.h> 25 + #include <linux/regulator/machine.h> 26 + #include <linux/platform_data/lp8755.h> 27 + 28 + #define LP8755_REG_BUCK0 0x00 29 + #define LP8755_REG_BUCK1 0x03 30 + #define LP8755_REG_BUCK2 0x04 31 + #define LP8755_REG_BUCK3 0x01 32 + #define LP8755_REG_BUCK4 0x05 33 + #define LP8755_REG_BUCK5 0x02 34 + #define LP8755_REG_MAX 0xFF 35 + 36 + #define LP8755_BUCK_EN_M BIT(7) 37 + #define LP8755_BUCK_LINEAR_OUT_MAX 0x76 38 + #define LP8755_BUCK_VOUT_M 0x7F 39 + 40 + enum bucks { 41 + BUCK0 = 0, 42 + BUCK1, 43 + BUCK2, 44 + BUCK3, 45 + BUCK4, 46 + BUCK5, 47 + }; 48 + 49 + struct lp8755_mphase { 50 + int nreg; 51 + int buck_num[LP8755_BUCK_MAX]; 52 + }; 53 + 54 + struct lp8755_chip { 55 + struct device *dev; 56 + struct regmap *regmap; 57 + struct lp8755_platform_data *pdata; 58 + 59 + int irq; 60 + unsigned int irqmask; 61 + 62 + int mphase; 63 + struct regulator_dev *rdev[LP8755_BUCK_MAX]; 64 + }; 65 + 66 + /** 67 + *lp8755_read : read a single register value from lp8755. 68 + *@pchip : device to read from 69 + *@reg : register to read from 70 + *@val : pointer to store read value 71 + */ 72 + static int lp8755_read(struct lp8755_chip *pchip, unsigned int reg, 73 + unsigned int *val) 74 + { 75 + return regmap_read(pchip->regmap, reg, val); 76 + } 77 + 78 + /** 79 + *lp8755_write : write a single register value to lp8755. 80 + *@pchip : device to write to 81 + *@reg : register to write to 82 + *@val : value to be written 83 + */ 84 + static int lp8755_write(struct lp8755_chip *pchip, unsigned int reg, 85 + unsigned int val) 86 + { 87 + return regmap_write(pchip->regmap, reg, val); 88 + } 89 + 90 + /** 91 + *lp8755_update_bits : set the values of bit fields in lp8755 register. 92 + *@pchip : device to read from 93 + *@reg : register to update 94 + *@mask : bitmask to be changed 95 + *@val : value for bitmask 96 + */ 97 + static int lp8755_update_bits(struct lp8755_chip *pchip, unsigned int reg, 98 + unsigned int mask, unsigned int val) 99 + { 100 + return regmap_update_bits(pchip->regmap, reg, mask, val); 101 + } 102 + 103 + static int lp8755_buck_enable_time(struct regulator_dev *rdev) 104 + { 105 + int ret; 106 + unsigned int regval; 107 + enum lp8755_bucks id = rdev_get_id(rdev); 108 + struct lp8755_chip *pchip = rdev_get_drvdata(rdev); 109 + 110 + ret = lp8755_read(pchip, 0x12 + id, &regval); 111 + if (ret < 0) { 112 + dev_err(pchip->dev, "i2c acceess error %s\n", __func__); 113 + return ret; 114 + } 115 + return (regval & 0xff) * 100; 116 + } 117 + 118 + static int lp8755_buck_set_mode(struct regulator_dev *rdev, unsigned int mode) 119 + { 120 + int ret; 121 + unsigned int regbval = 0x0; 122 + enum lp8755_bucks id = rdev_get_id(rdev); 123 + struct lp8755_chip *pchip = rdev_get_drvdata(rdev); 124 + 125 + switch (mode) { 126 + case REGULATOR_MODE_FAST: 127 + /* forced pwm mode */ 128 + regbval = (0x01 << id); 129 + break; 130 + case REGULATOR_MODE_NORMAL: 131 + /* enable automatic pwm/pfm mode */ 132 + ret = lp8755_update_bits(pchip, 0x08 + id, 0x20, 0x00); 133 + if (ret < 0) 134 + goto err_i2c; 135 + break; 136 + case REGULATOR_MODE_IDLE: 137 + /* enable automatic pwm/pfm/lppfm mode */ 138 + ret = lp8755_update_bits(pchip, 0x08 + id, 0x20, 0x20); 139 + if (ret < 0) 140 + goto err_i2c; 141 + 142 + ret = lp8755_update_bits(pchip, 0x10, 0x01, 0x01); 143 + if (ret < 0) 144 + goto err_i2c; 145 + break; 146 + default: 147 + dev_err(pchip->dev, "Not supported buck mode %s\n", __func__); 148 + /* forced pwm mode */ 149 + regbval = (0x01 << id); 150 + } 151 + 152 + ret = lp8755_update_bits(pchip, 0x06, 0x01 << id, regbval); 153 + if (ret < 0) 154 + goto err_i2c; 155 + return ret; 156 + err_i2c: 157 + dev_err(pchip->dev, "i2c acceess error %s\n", __func__); 158 + return ret; 159 + } 160 + 161 + static unsigned int lp8755_buck_get_mode(struct regulator_dev *rdev) 162 + { 163 + int ret; 164 + unsigned int regval; 165 + enum lp8755_bucks id = rdev_get_id(rdev); 166 + struct lp8755_chip *pchip = rdev_get_drvdata(rdev); 167 + 168 + ret = lp8755_read(pchip, 0x06, &regval); 169 + if (ret < 0) 170 + goto err_i2c; 171 + 172 + /* mode fast means forced pwm mode */ 173 + if (regval & (0x01 << id)) 174 + return REGULATOR_MODE_FAST; 175 + 176 + ret = lp8755_read(pchip, 0x08 + id, &regval); 177 + if (ret < 0) 178 + goto err_i2c; 179 + 180 + /* mode idle means automatic pwm/pfm/lppfm mode */ 181 + if (regval & 0x20) 182 + return REGULATOR_MODE_IDLE; 183 + 184 + /* mode normal means automatic pwm/pfm mode */ 185 + return REGULATOR_MODE_NORMAL; 186 + 187 + err_i2c: 188 + dev_err(pchip->dev, "i2c acceess error %s\n", __func__); 189 + return 0; 190 + } 191 + 192 + static int lp8755_buck_set_ramp(struct regulator_dev *rdev, int ramp) 193 + { 194 + int ret; 195 + unsigned int regval = 0x00; 196 + enum lp8755_bucks id = rdev_get_id(rdev); 197 + struct lp8755_chip *pchip = rdev_get_drvdata(rdev); 198 + 199 + /* uV/us */ 200 + switch (ramp) { 201 + case 0 ... 230: 202 + regval = 0x07; 203 + break; 204 + case 231 ... 470: 205 + regval = 0x06; 206 + break; 207 + case 471 ... 940: 208 + regval = 0x05; 209 + break; 210 + case 941 ... 1900: 211 + regval = 0x04; 212 + break; 213 + case 1901 ... 3800: 214 + regval = 0x03; 215 + break; 216 + case 3801 ... 7500: 217 + regval = 0x02; 218 + break; 219 + case 7501 ... 15000: 220 + regval = 0x01; 221 + break; 222 + case 15001 ... 30000: 223 + regval = 0x00; 224 + break; 225 + default: 226 + dev_err(pchip->dev, 227 + "Not supported ramp value %d %s\n", ramp, __func__); 228 + return -EINVAL; 229 + } 230 + 231 + ret = lp8755_update_bits(pchip, 0x07 + id, 0x07, regval); 232 + if (ret < 0) 233 + goto err_i2c; 234 + return ret; 235 + err_i2c: 236 + dev_err(pchip->dev, "i2c acceess error %s\n", __func__); 237 + return ret; 238 + } 239 + 240 + static struct regulator_ops lp8755_buck_ops = { 241 + .list_voltage = regulator_list_voltage_linear, 242 + .set_voltage_sel = regulator_set_voltage_sel_regmap, 243 + .get_voltage_sel = regulator_get_voltage_sel_regmap, 244 + .enable = regulator_enable_regmap, 245 + .disable = regulator_disable_regmap, 246 + .is_enabled = regulator_is_enabled_regmap, 247 + .enable_time = lp8755_buck_enable_time, 248 + .set_mode = lp8755_buck_set_mode, 249 + .get_mode = lp8755_buck_get_mode, 250 + .set_ramp_delay = lp8755_buck_set_ramp, 251 + }; 252 + 253 + #define lp8755_rail(_id) "lp8755_buck"#_id 254 + #define lp8755_buck_init(_id)\ 255 + {\ 256 + .constraints = {\ 257 + .name = lp8755_rail(_id),\ 258 + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,\ 259 + .min_uV = 500000,\ 260 + .max_uV = 1675000,\ 261 + },\ 262 + } 263 + 264 + static struct regulator_init_data lp8755_reg_default[LP8755_BUCK_MAX] = { 265 + [BUCK0] = lp8755_buck_init(0), 266 + [BUCK1] = lp8755_buck_init(1), 267 + [BUCK2] = lp8755_buck_init(2), 268 + [BUCK3] = lp8755_buck_init(3), 269 + [BUCK4] = lp8755_buck_init(4), 270 + [BUCK5] = lp8755_buck_init(5), 271 + }; 272 + 273 + static const struct lp8755_mphase mphase_buck[MPHASE_CONF_MAX] = { 274 + {3, {BUCK0, BUCK3, BUCK5} 275 + }, 276 + {6, {BUCK0, BUCK1, BUCK2, BUCK3, BUCK4, BUCK5} 277 + }, 278 + {5, {BUCK0, BUCK2, BUCK3, BUCK4, BUCK5} 279 + }, 280 + {4, {BUCK0, BUCK3, BUCK4, BUCK5} 281 + }, 282 + {3, {BUCK0, BUCK4, BUCK5} 283 + }, 284 + {2, {BUCK0, BUCK5} 285 + }, 286 + {1, {BUCK0} 287 + }, 288 + {2, {BUCK0, BUCK3} 289 + }, 290 + {4, {BUCK0, BUCK2, BUCK3, BUCK5} 291 + }, 292 + }; 293 + 294 + static int lp8755_init_data(struct lp8755_chip *pchip) 295 + { 296 + unsigned int regval; 297 + int ret, icnt, buck_num; 298 + struct lp8755_platform_data *pdata = pchip->pdata; 299 + 300 + /* read back muti-phase configuration */ 301 + ret = lp8755_read(pchip, 0x3D, &regval); 302 + if (ret < 0) 303 + goto out_i2c_error; 304 + pchip->mphase = regval & 0x07; 305 + 306 + /* set default data based on multi-phase config */ 307 + for (icnt = 0; icnt < mphase_buck[pchip->mphase].nreg; icnt++) { 308 + buck_num = mphase_buck[pchip->mphase].buck_num[icnt]; 309 + pdata->buck_data[buck_num] = &lp8755_reg_default[buck_num]; 310 + } 311 + return ret; 312 + 313 + out_i2c_error: 314 + dev_err(pchip->dev, "i2c acceess error %s\n", __func__); 315 + return ret; 316 + } 317 + 318 + #define lp8755_buck_desc(_id)\ 319 + {\ 320 + .name = lp8755_rail(_id),\ 321 + .id = LP8755_BUCK##_id,\ 322 + .ops = &lp8755_buck_ops,\ 323 + .n_voltages = LP8755_BUCK_LINEAR_OUT_MAX+1,\ 324 + .uV_step = 10000,\ 325 + .min_uV = 500000,\ 326 + .type = REGULATOR_VOLTAGE,\ 327 + .owner = THIS_MODULE,\ 328 + .enable_reg = LP8755_REG_BUCK##_id,\ 329 + .enable_mask = LP8755_BUCK_EN_M,\ 330 + .vsel_reg = LP8755_REG_BUCK##_id,\ 331 + .vsel_mask = LP8755_BUCK_VOUT_M,\ 332 + } 333 + 334 + static struct regulator_desc lp8755_regulators[] = { 335 + lp8755_buck_desc(0), 336 + lp8755_buck_desc(1), 337 + lp8755_buck_desc(2), 338 + lp8755_buck_desc(3), 339 + lp8755_buck_desc(4), 340 + lp8755_buck_desc(5), 341 + }; 342 + 343 + static int lp8755_regulator_init(struct lp8755_chip *pchip) 344 + { 345 + int ret, icnt, buck_num; 346 + struct lp8755_platform_data *pdata = pchip->pdata; 347 + struct regulator_config rconfig = { }; 348 + 349 + rconfig.regmap = pchip->regmap; 350 + rconfig.dev = pchip->dev; 351 + rconfig.driver_data = pchip; 352 + 353 + for (icnt = 0; icnt < mphase_buck[pchip->mphase].nreg; icnt++) { 354 + buck_num = mphase_buck[pchip->mphase].buck_num[icnt]; 355 + rconfig.init_data = pdata->buck_data[buck_num]; 356 + rconfig.of_node = pchip->dev->of_node; 357 + pchip->rdev[buck_num] = 358 + regulator_register(&lp8755_regulators[buck_num], &rconfig); 359 + if (IS_ERR(pchip->rdev[buck_num])) { 360 + ret = PTR_ERR(pchip->rdev[buck_num]); 361 + dev_err(pchip->dev, "regulator init failed: buck 0\n"); 362 + goto err_buck; 363 + } 364 + } 365 + 366 + return 0; 367 + 368 + err_buck: 369 + for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++) 370 + if (pchip->rdev[icnt] != NULL) 371 + regulator_unregister(pchip->rdev[icnt]); 372 + return ret; 373 + } 374 + 375 + static irqreturn_t lp8755_irq_handler(int irq, void *data) 376 + { 377 + int ret, icnt; 378 + unsigned int flag0, flag1; 379 + struct lp8755_chip *pchip = data; 380 + 381 + /* read flag0 register */ 382 + ret = lp8755_read(pchip, 0x0D, &flag0); 383 + if (ret < 0) 384 + goto err_i2c; 385 + /* clear flag register to pull up int. pin */ 386 + ret = lp8755_write(pchip, 0x0D, 0x00); 387 + if (ret < 0) 388 + goto err_i2c; 389 + 390 + /* sent power fault detection event to specific regulator */ 391 + for (icnt = 0; icnt < 6; icnt++) 392 + if ((flag0 & (0x4 << icnt)) 393 + && (pchip->irqmask & (0x04 << icnt)) 394 + && (pchip->rdev[icnt] != NULL)) 395 + regulator_notifier_call_chain(pchip->rdev[icnt], 396 + LP8755_EVENT_PWR_FAULT, 397 + NULL); 398 + 399 + /* read flag1 register */ 400 + ret = lp8755_read(pchip, 0x0E, &flag1); 401 + if (ret < 0) 402 + goto err_i2c; 403 + /* clear flag register to pull up int. pin */ 404 + ret = lp8755_write(pchip, 0x0E, 0x00); 405 + if (ret < 0) 406 + goto err_i2c; 407 + 408 + /* send OCP event to all regualtor devices */ 409 + if ((flag1 & 0x01) && (pchip->irqmask & 0x01)) 410 + for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++) 411 + if (pchip->rdev[icnt] != NULL) 412 + regulator_notifier_call_chain(pchip->rdev[icnt], 413 + LP8755_EVENT_OCP, 414 + NULL); 415 + 416 + /* send OVP event to all regualtor devices */ 417 + if ((flag1 & 0x02) && (pchip->irqmask & 0x02)) 418 + for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++) 419 + if (pchip->rdev[icnt] != NULL) 420 + regulator_notifier_call_chain(pchip->rdev[icnt], 421 + LP8755_EVENT_OVP, 422 + NULL); 423 + return IRQ_HANDLED; 424 + 425 + err_i2c: 426 + dev_err(pchip->dev, "i2c acceess error %s\n", __func__); 427 + return IRQ_NONE; 428 + } 429 + 430 + static int lp8755_int_config(struct lp8755_chip *pchip) 431 + { 432 + int ret; 433 + unsigned int regval; 434 + 435 + if (pchip->irq == 0) { 436 + dev_warn(pchip->dev, "not use interrupt : %s\n", __func__); 437 + return 0; 438 + } 439 + 440 + ret = lp8755_read(pchip, 0x0F, &regval); 441 + if (ret < 0) 442 + goto err_i2c; 443 + pchip->irqmask = regval; 444 + ret = request_threaded_irq(pchip->irq, NULL, lp8755_irq_handler, 445 + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 446 + "lp8755-irq", pchip); 447 + if (ret) 448 + return ret; 449 + 450 + return ret; 451 + 452 + err_i2c: 453 + dev_err(pchip->dev, "i2c acceess error %s\n", __func__); 454 + return ret; 455 + } 456 + 457 + static const struct regmap_config lp8755_regmap = { 458 + .reg_bits = 8, 459 + .val_bits = 8, 460 + .max_register = LP8755_REG_MAX, 461 + }; 462 + 463 + static int lp8755_probe(struct i2c_client *client, 464 + const struct i2c_device_id *id) 465 + { 466 + int ret, icnt; 467 + struct lp8755_chip *pchip; 468 + struct lp8755_platform_data *pdata = client->dev.platform_data; 469 + 470 + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { 471 + dev_err(&client->dev, "i2c functionality check fail.\n"); 472 + return -EOPNOTSUPP; 473 + } 474 + 475 + pchip = devm_kzalloc(&client->dev, 476 + sizeof(struct lp8755_chip), GFP_KERNEL); 477 + if (!pchip) 478 + return -ENOMEM; 479 + 480 + pchip->dev = &client->dev; 481 + pchip->regmap = devm_regmap_init_i2c(client, &lp8755_regmap); 482 + if (IS_ERR(pchip->regmap)) { 483 + ret = PTR_ERR(pchip->regmap); 484 + dev_err(&client->dev, "fail to allocate regmap %d\n", ret); 485 + return ret; 486 + } 487 + i2c_set_clientdata(client, pchip); 488 + 489 + if (pdata != NULL) { 490 + pchip->pdata = pdata; 491 + pchip->mphase = pdata->mphase; 492 + } else { 493 + pchip->pdata = devm_kzalloc(pchip->dev, 494 + sizeof(struct lp8755_platform_data), 495 + GFP_KERNEL); 496 + if (!pchip->pdata) 497 + return -ENOMEM; 498 + ret = lp8755_init_data(pchip); 499 + if (ret < 0) 500 + goto err_chip_init; 501 + } 502 + 503 + ret = lp8755_regulator_init(pchip); 504 + if (ret < 0) 505 + goto err_regulator; 506 + 507 + pchip->irq = client->irq; 508 + ret = lp8755_int_config(pchip); 509 + if (ret < 0) 510 + goto err_irq; 511 + 512 + return ret; 513 + 514 + err_irq: 515 + dev_err(&client->dev, "fail to irq config\n"); 516 + 517 + for (icnt = 0; icnt < mphase_buck[pchip->mphase].nreg; icnt++) 518 + regulator_unregister(pchip->rdev[icnt]); 519 + 520 + err_regulator: 521 + dev_err(&client->dev, "fail to initialize regulators\n"); 522 + /* output disable */ 523 + for (icnt = 0; icnt < 0x06; icnt++) 524 + lp8755_write(pchip, icnt, 0x00); 525 + 526 + err_chip_init: 527 + dev_err(&client->dev, "fail to initialize chip\n"); 528 + return ret; 529 + } 530 + 531 + static int lp8755_remove(struct i2c_client *client) 532 + { 533 + int icnt; 534 + struct lp8755_chip *pchip = i2c_get_clientdata(client); 535 + 536 + for (icnt = 0; icnt < mphase_buck[pchip->mphase].nreg; icnt++) 537 + regulator_unregister(pchip->rdev[icnt]); 538 + 539 + for (icnt = 0; icnt < 0x06; icnt++) 540 + lp8755_write(pchip, icnt, 0x00); 541 + 542 + if (pchip->irq != 0) 543 + free_irq(pchip->irq, pchip); 544 + 545 + return 0; 546 + } 547 + 548 + static const struct i2c_device_id lp8755_id[] = { 549 + {LP8755_NAME, 0}, 550 + {} 551 + }; 552 + 553 + MODULE_DEVICE_TABLE(i2c, lp8755_id); 554 + 555 + static struct i2c_driver lp8755_i2c_driver = { 556 + .driver = { 557 + .name = LP8755_NAME, 558 + }, 559 + .probe = lp8755_probe, 560 + .remove = __devexit_p(lp8755_remove), 561 + .id_table = lp8755_id, 562 + }; 563 + 564 + static int __init lp8755_init(void) 565 + { 566 + return i2c_add_driver(&lp8755_i2c_driver); 567 + } 568 + 569 + subsys_initcall(lp8755_init); 570 + 571 + static void __exit lp8755_exit(void) 572 + { 573 + i2c_del_driver(&lp8755_i2c_driver); 574 + } 575 + 576 + module_exit(lp8755_exit); 577 + 578 + MODULE_DESCRIPTION("Texas Instruments lp8755 driver"); 579 + MODULE_AUTHOR("Daniel Jeong <daniel.jeong@ti.com>"); 580 + MODULE_LICENSE("GPL v2");
+71
include/linux/platform_data/lp8755.h
··· 1 + /* 2 + * LP8755 High Performance Power Management Unit Driver:System Interface Driver 3 + * 4 + * Copyright (C) 2012 Texas Instruments 5 + * 6 + * Author: Daniel(Geon Si) Jeong <daniel.jeong@ti.com> 7 + * G.Shark Jeong <gshark.jeong@gmail.com> 8 + * 9 + * This program is free software; you can redistribute it and/or modify 10 + * it under the terms of the GNU General Public License version 2 as 11 + * published by the Free Software Foundation. 12 + * 13 + */ 14 + 15 + #ifndef _LP8755_H 16 + #define _LP8755_H 17 + 18 + #include <linux/regulator/consumer.h> 19 + 20 + #define LP8755_NAME "lp8755-regulator" 21 + /* 22 + *PWR FAULT : power fault detected 23 + *OCP : over current protect activated 24 + *OVP : over voltage protect activated 25 + *TEMP_WARN : thermal warning 26 + *TEMP_SHDN : thermal shutdonw detected 27 + *I_LOAD : current measured 28 + */ 29 + #define LP8755_EVENT_PWR_FAULT REGULATOR_EVENT_FAIL 30 + #define LP8755_EVENT_OCP REGULATOR_EVENT_OVER_CURRENT 31 + #define LP8755_EVENT_OVP 0x10000 32 + #define LP8755_EVENT_TEMP_WARN 0x2000 33 + #define LP8755_EVENT_TEMP_SHDN REGULATOR_EVENT_OVER_TEMP 34 + #define LP8755_EVENT_I_LOAD 0x40000 35 + 36 + enum lp8755_bucks { 37 + LP8755_BUCK0 = 0, 38 + LP8755_BUCK1, 39 + LP8755_BUCK2, 40 + LP8755_BUCK3, 41 + LP8755_BUCK4, 42 + LP8755_BUCK5, 43 + LP8755_BUCK_MAX, 44 + }; 45 + 46 + /** 47 + * multiphase configuration options 48 + */ 49 + enum lp8755_mphase_config { 50 + MPHASE_CONF0, 51 + MPHASE_CONF1, 52 + MPHASE_CONF2, 53 + MPHASE_CONF3, 54 + MPHASE_CONF4, 55 + MPHASE_CONF5, 56 + MPHASE_CONF6, 57 + MPHASE_CONF7, 58 + MPHASE_CONF8, 59 + MPHASE_CONF_MAX 60 + }; 61 + 62 + /** 63 + * struct lp8755_platform_data 64 + * @mphase_type : Multiphase Switcher Configurations. 65 + * @buck_data : buck0~6 init voltage in uV 66 + */ 67 + struct lp8755_platform_data { 68 + int mphase; 69 + struct regulator_init_data *buck_data[LP8755_BUCK_MAX]; 70 + }; 71 + #endif