LP8758 pre version
authorDaniel Jeong <gshark.jeong@gmail.com>
Fri, 25 Sep 2015 09:03:31 +0000 (18:03 +0900)
committerDaniel Jeong <gshark.jeong@gmail.com>
Fri, 25 Sep 2015 09:03:31 +0000 (18:03 +0900)
Signed-off-by: Daniel Jeong <gshark.jeong@gmail.com>
Documentation/devicetree/bindings/regulator/lp8758.txt [new file with mode: 0644]
drivers/regulator/Kconfig
drivers/regulator/Makefile
drivers/regulator/lp8758.c [new file with mode: 0644]
include/linux/platform_data/lp8758.h [new file with mode: 0644]

diff --git a/Documentation/devicetree/bindings/regulator/lp8758.txt b/Documentation/devicetree/bindings/regulator/lp8758.txt
new file mode 100644 (file)
index 0000000..979a1b0
--- /dev/null
@@ -0,0 +1,46 @@
+TI LP8758 Regulator Driver
+
+Required properties:
+  - compatible: "ti,lp8758"
+  - Regulator init data from of-regulator structure.
+    Please refer to regulator.txt in this directory.
+
+Example:
+       lp8758@60 {
+               compatible = "ti,lp8758";
+               reg = <0x60>;
+
+               /* BUCKx Pin Setting 
+                  0: i2c control,
+                  1: EN1 Pin Enable/Disable control,
+                  2: EN1 Pin Roof/Floor     control,
+                  3: EN2 Pin Enable/Disable control,
+                  4: EN2 Pin Roof/Floor     control
+               */
+               buck0_pinctrl = <0>;
+               buck1_pinctrl = <0>;
+               buck2_pinctrl = <0>;
+               buck3_pinctrl = <0>;
+               /*
+                * The gpio for interrupt depends on the processor environment.
+                * For example, following GPIO means GPIO60 in OMAP335x.
+                */
+               irq-gpio = <&gpio1 28 0>;
+
+               buck0 {
+                       regulator-name = "lp8758-buck0";
+                       regulator-min-microvolt = <500000>;
+                       regulator-max-microvolt = <3360000>;
+                       regulator-min-microamp  = <1500000>;
+                       regulator-max-microamp  = <5000000>;
+                       regulator-boot-on;
+               };
+               buck2 {
+                       regulator-name = "lp8758-buck2";
+                       regulator-min-microvolt = <500000>;
+                       regulator-max-microvolt = <3360000>;
+                       regulator-min-microamp  = <1500000>;
+                       regulator-max-microamp  = <5000000>;
+                       regulator-boot-on;
+               };
+       };
index 897b80f91c9663e8a28d41e4e783ca074cc1d0b9..a65b5313ff9b7e0a1d68cd968b1a94b8b7349661 100644 (file)
@@ -251,6 +251,13 @@ config REGULATOR_LP8755
          chip contains six step-down DC/DC converters which can support
          9 mode multiphase configuration.
 
+config REGULATOR_LP8758
+       tristate "TI LP8758 Step-Down DC-DC Regulator driver"
+       depends on I2C
+       select REGMAP_I2C
+       help
+         This driver supports LP8758 Step-Down DC-DC Regulator driver.
+
 config REGULATOR_LP8788
        tristate "TI LP8788 Power Regulators"
        depends on MFD_LP8788
index d555c6f8d1dbcc561d6d04e37829955a27a544d3..c1d7b14ae9359ad8af475947085eeebf69b4ed36 100644 (file)
@@ -38,6 +38,7 @@ obj-$(CONFIG_REGULATOR_LP872X) += lp872x.o
 obj-$(CONFIG_REGULATOR_LP8788) += lp8788-buck.o
 obj-$(CONFIG_REGULATOR_LP8788) += lp8788-ldo.o
 obj-$(CONFIG_REGULATOR_LP8755) += lp8755.o
+obj-$(CONFIG_REGULATOR_LP8758) += lp8758.o
 obj-$(CONFIG_REGULATOR_MAX14577) += max14577.o
 obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
 obj-$(CONFIG_REGULATOR_MAX8649)        += max8649.o
diff --git a/drivers/regulator/lp8758.c b/drivers/regulator/lp8758.c
new file mode 100644 (file)
index 0000000..523162c
--- /dev/null
@@ -0,0 +1,449 @@
+/*
+* Simple driver for Texas Instruments lp8758 Regulator chip
+*
+* Copyright (C) 2015 Texas Instruments
+* Author: Daniel Jeong  <daniel.jeong@ti.com>
+*         Ldd Mlp <ldd-mlp@list.ti.com>
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License version 2 as
+* published by the Free Software Foundation.
+*
+*/
+
+/********************************************************************
+Notice : 
+       It is a preliminary version based on f0 for reference. 
+       A consolidated verson will be released soon.
+********************************************************************/
+
+
+
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/regmap.h>
+#include <linux/interrupt.h>
+#include <linux/gpio.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
+#include <linux/uaccess.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/of_regulator.h>
+#include <linux/platform_data/lp8758.h>
+
+struct lp8758_chip {
+       struct device *dev;
+       struct regmap *regmap;
+       struct lp8758_platform_data *pdata;
+
+       int irq;
+       struct regulator_dev *rdev[LP8758_BUCK_MAX];
+};
+
+/* voltage map */
+static const unsigned int lp8758_buck_voltage_map[] = {
+       /* 0.50V - 0.73V : 10mV steps */
+        500000,  510000,  520000,  530000,  540000,  550000,  560000,  570000,
+        580000,  590000,  600000,  610000,  620000,  630000,  640000,  650000,
+        660000,  670000,  680000,  690000,  700000,  710000,  720000,  730000,
+       /* 0.73V - 1.40V :  5mV steps */
+        735000,  740000,  745000,  750000,  755000,  760000,  765000,  770000,
+        775000,  780000,  785000,  790000,  795000,  800000,  805000,  810000,
+        815000,  820000,  825000,  830000,  835000,  840000,  845000,  850000,
+        855000,  860000,  865000,  870000,  875000,  880000,  885000,  890000, 
+        895000,  900000,  905000,  910000,  915000,  920000,  925000,  930000,
+        935000,  940000,  945000,  950000,  955000,  960000,  965000,  970000,
+        975000,  980000,  985000,  990000,  995000, 1000000, 1005000, 1010000,
+       1015000, 1020000, 1025000, 1030000, 1035000, 1040000, 1045000, 1050000,
+       1055000, 1060000, 1065000, 1070000, 1075000, 1080000, 1085000, 1090000,
+       1095000, 1100000, 1105000, 1110000, 1115000, 1120000, 1125000, 1130000,
+       1135000, 1140000, 1145000, 1150000,     1155000, 1160000, 1165000, 1170000,
+       1175000, 1180000, 1185000, 1190000, 1195000, 1200000, 1205000, 1210000,
+       1215000, 1220000, 1225000, 1230000, 1235000, 1240000, 1245000, 1250000,
+       1255000, 1260000, 1265000, 1270000, 1275000, 1280000, 1285000, 1290000,
+       1295000, 1300000, 1305000, 1310000, 1315000, 1320000, 1325000, 1330000,
+       1335000, 1340000, 1345000, 1350000,     1355000, 1360000, 1365000, 1370000,
+       1375000, 1380000, 1385000, 1390000, 1395000, 1400000,
+       /* 1.40V - 3.36V : 20mV steps */
+       1420000, 1440000, 1460000, 1480000, 1500000, 1520000, 1540000, 1560000,
+       1580000, 1600000, 1620000, 1640000, 1660000, 1680000, 1700000, 1720000,
+       1740000, 1760000, 1780000, 1800000, 1820000, 1840000, 1860000, 1880000,
+       1900000, 1920000, 1940000, 1960000, 1980000, 2000000, 2020000, 2040000,
+       2060000, 2080000, 2100000, 2120000, 2140000, 2160000, 2180000, 2200000,
+       2220000, 2240000, 2260000, 2280000, 2300000, 2320000, 2340000, 2360000,
+       2380000, 2400000, 2420000, 2440000, 2460000, 2480000, 2500000, 2520000,
+       2540000, 2560000, 2580000, 2600000, 2620000, 2640000, 2660000, 2680000,
+       2700000, 2720000, 2740000, 2760000, 2780000, 2800000, 2820000, 2840000,
+       2860000, 2880000, 2900000, 2920000, 2940000, 2960000, 2980000, 3000000,
+       3020000, 3040000, 3060000, 3080000, 3100000, 3120000, 3140000, 3160000,
+       3180000, 3200000, 3220000, 3240000, 3260000, 3280000, 3300000, 3320000,
+       3340000, 3360000,
+};
+
+/* current limit */
+static const unsigned int lp8758_current_limit_uA[] = {
+       1500000, 2000000, 2500000, 3000000, 3500000, 4000000, 4500000, 5000000
+};
+
+static int lp8758_read(struct lp8758_chip *pchip, unsigned int reg,
+                      unsigned int *val)
+{
+       return regmap_read(pchip->regmap, reg, val);
+}
+
+static int lp8758_write(struct lp8758_chip *pchip, unsigned int reg,
+                       unsigned int val)
+{
+       return regmap_write(pchip->regmap, reg, val);
+}
+
+static int lp8758_update_bits(struct lp8758_chip *pchip, unsigned int reg,
+                             unsigned int mask, unsigned int val)
+{
+       return regmap_update_bits(pchip->regmap, reg, mask, val);
+}
+
+static int lp8758_buck_set_current_limit(struct regulator_dev *rdev,
+                                       int min_uA, int max_uA)
+{
+       struct lp8758_chip *pchip = rdev_get_drvdata(rdev);
+       enum lp8758_bucks buck = rdev_get_id(rdev);
+       int icnt;
+       u8 addr;
+
+       switch (buck) {
+       case LP8758_BUCK0:
+               addr = LP8758_REG_BUCK0_CTRL2;
+               break;
+       case LP8758_BUCK2:
+               addr = LP8758_REG_BUCK2_CTRL2;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       for (icnt = ARRAY_SIZE(lp8758_current_limit_uA) - 1; icnt >= 0; icnt--) {
+               if (lp8758_current_limit_uA[icnt] >= min_uA &&
+                       lp8758_current_limit_uA[icnt] <= max_uA)
+                       return lp8758_update_bits(pchip, addr,
+                                                 LP8758_ILIM_MASK, icnt << LP8758_ILIM_SHIFT);
+       }
+
+       return -EINVAL;
+}
+
+static int lp8758_buck_get_current_limit(struct regulator_dev *rdev)
+{
+       struct lp8758_chip *pchip = rdev_get_drvdata(rdev);
+       enum lp8758_bucks buck = rdev_get_id(rdev);
+       u8 addr;
+       unsigned int val;
+       int ret;
+
+       switch (buck) {
+       case LP8758_BUCK0:
+               addr = LP8758_REG_BUCK0_CTRL2;
+               break;
+       case LP8758_BUCK2:
+               addr = LP8758_REG_BUCK2_CTRL2;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       ret = lp8758_read(pchip, addr, &val);
+       if (ret)
+               return ret;
+
+       val = (val & LP8758_ILIM_MASK) >> LP8758_ILIM_SHIFT;
+
+       return (val < ARRAY_SIZE(lp8758_current_limit_uA)) ?
+                       lp8758_current_limit_uA[val] : -EINVAL;
+}
+
+static int lp8758_buck_set_mode(struct regulator_dev *rdev, unsigned int mode)
+{
+       struct lp8758_chip *pchip = rdev_get_drvdata(rdev);
+       enum lp8758_bucks buck = rdev_get_id(rdev);
+       u8 addr;
+
+       switch (buck) {
+       case LP8758_BUCK0:
+               addr = LP8758_REG_BUCK0_CTRL1;
+               break;
+       case LP8758_BUCK2:
+               addr = LP8758_REG_BUCK2_CTRL1;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       if (mode == REGULATOR_MODE_FAST)
+               return lp8758_update_bits(pchip, addr, 0x02, 0x02);
+       else if (mode == REGULATOR_MODE_NORMAL)
+               return lp8758_update_bits(pchip, addr, 0x02, 0x00);
+       else
+               return -EINVAL;
+}
+
+static unsigned int lp8758_buck_get_mode(struct regulator_dev *rdev)
+{
+       struct lp8758_chip *pchip = rdev_get_drvdata(rdev);
+       enum lp8758_bucks buck = rdev_get_id(rdev);
+       unsigned int val;
+       u8 addr;
+       int ret;
+
+       switch (buck) {
+       case LP8758_BUCK0:
+               addr = LP8758_REG_BUCK0_CTRL1;
+               break;
+       case LP8758_BUCK2:
+               addr = LP8758_REG_BUCK2_CTRL1;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       ret = lp8758_read(pchip, addr, &val);
+       if (ret)
+               return ret;
+
+       return val & 0x02 ? REGULATOR_MODE_FAST : REGULATOR_MODE_NORMAL;
+}
+
+static struct regulator_ops lp8758_buck_ops = {
+       .map_voltage = regulator_map_voltage_ascend,
+       .list_voltage = regulator_list_voltage_table,
+       .set_voltage_sel = regulator_set_voltage_sel_regmap,
+       .get_voltage_sel = regulator_get_voltage_sel_regmap,
+       .enable = regulator_enable_regmap,
+       .disable = regulator_disable_regmap,
+       .is_enabled = regulator_is_enabled_regmap,
+       .set_mode = lp8758_buck_set_mode,
+       .get_mode = lp8758_buck_get_mode,
+       .set_current_limit = lp8758_buck_set_current_limit,
+       .get_current_limit = lp8758_buck_get_current_limit,
+};
+
+static struct regulator_desc lp8758_regulators[LP8758_BUCK_MAX] = {
+       {
+               .name = "lp8758-buck0",
+               .id = LP8758_BUCK0,
+               .ops = &lp8758_buck_ops,
+               .n_voltages = ARRAY_SIZE(lp8758_buck_voltage_map),
+               .volt_table = lp8758_buck_voltage_map,
+               .type = REGULATOR_VOLTAGE,
+               .owner = THIS_MODULE,
+               .enable_reg = LP8758_REG_BUCK0_CTRL1,
+               .enable_mask = LP8758_BUCK_EN_MASK,
+               .vsel_reg = LP8758_REG_BUCK0_VOUT,
+               .vsel_mask = LP8758_BUCK_VOUT_MASK,
+       },
+       {
+               .name = "lp8758-buck2",
+               .id = LP8758_BUCK2,
+               .ops = &lp8758_buck_ops,
+               .n_voltages = ARRAY_SIZE(lp8758_buck_voltage_map),
+               .volt_table = lp8758_buck_voltage_map,
+               .type = REGULATOR_VOLTAGE,
+               .owner = THIS_MODULE,
+               .enable_reg = LP8758_REG_BUCK2_CTRL1,
+               .enable_mask = LP8758_BUCK_EN_MASK,
+               .vsel_reg = LP8758_REG_BUCK2_VOUT,
+               .vsel_mask = LP8758_BUCK_VOUT_MASK,
+       }
+};
+
+static int lp8758_regulator_init(struct lp8758_chip *pchip)
+{
+       int ret, icnt;
+       struct lp8758_platform_data *pdata = pchip->pdata;
+       struct regulator_config rconfig = { };
+
+       rconfig.regmap = pchip->regmap;
+       rconfig.dev = pchip->dev;
+       rconfig.driver_data = pchip;
+
+       for(icnt = 0; icnt < LP8758_BUCK_MAX; icnt++){
+               rconfig.init_data = pdata->buck_data[icnt];
+               rconfig.of_node = pchip->dev->of_node;
+               pchip->rdev[icnt] =
+                   devm_regulator_register(pchip->dev,
+                                   &lp8758_regulators[icnt], &rconfig);
+               if (IS_ERR(pchip->rdev[icnt])) {
+                       ret = PTR_ERR(pchip->rdev[icnt]);
+                       pchip->rdev[icnt] = NULL;
+                       dev_err(pchip->dev,
+                                               "regulator init failed: buck %d\n",     icnt);
+                       return ret;
+               }
+               dev_info(pchip->dev, "lp8758 regulator %d\n is registered",icnt);
+       }
+       return 0;
+}
+
+static irqreturn_t lp8758_irq_handler(int irq, void *data)
+{
+       int ret, icnt;
+       unsigned int int_top;
+       struct lp8758_chip *pchip = data;
+
+       ret = lp8758_read(pchip, LP8758_REG_INT_TOP, &int_top);
+       if(int_top & LP8758_OVERTEMP_MASK)
+               for(icnt = LP8758_BUCK0; icnt < LP8758_BUCK_MAX; icnt++)
+                       regulator_notifier_call_chain(pchip->rdev[icnt],
+                                                                       REGULATOR_EVENT_OVER_TEMP, NULL);
+
+       lp8758_write(pchip, LP8758_REG_INT_BUCK_0_1, 0x77);
+       lp8758_write(pchip, LP8758_REG_INT_BUCK_2_3, 0x77);
+       lp8758_write(pchip, LP8758_REG_INT_TOP, 0x0f);
+
+       dev_info(pchip->dev, "lp8758 IRQ Handeled");
+       return IRQ_HANDLED;
+}
+
+static int lp8758_intr_config(struct lp8758_chip *pchip)
+{
+       int ret, irq;
+
+       if (pchip->irq == 0) {
+               dev_warn(pchip->dev, "not use interrupt : %s\n", __func__);
+               return 0;
+       }
+
+       lp8758_write(pchip, LP8758_REG_INT_BUCK_0_1, 0x77);
+       lp8758_write(pchip, LP8758_REG_INT_BUCK_2_3, 0x77);
+       lp8758_write(pchip, LP8758_REG_INT_TOP, 0x0f);
+
+       gpio_request_one(pchip->irq, GPIOF_DIR_IN,"lp8758-irq");
+       irq = gpio_to_irq(pchip->irq);
+       if(irq < 0){
+               dev_warn(pchip->dev, "irq can't be configurated\n");
+               return -EINVAL;
+       }
+
+       ret = request_threaded_irq(irq, NULL, lp8758_irq_handler,
+                                  IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+                                  "lp8758-irq", pchip);
+       dev_info(pchip->dev, "irq config is configured gpio %d irq %d\n",
+                                                       pchip->irq, irq);
+
+       return ret;
+}
+
+static struct of_regulator_match lp8758_matches[LP8758_BUCK_MAX] = {
+       { .name = "buck0", .driver_data = (void *)LP8758_BUCK0, },
+       { .name = "buck2", .driver_data = (void *)LP8758_BUCK2, },
+};
+
+static int lp8758_parse_dt(struct i2c_client *client,
+                                                               struct lp8758_chip *pchip)
+{
+       struct device_node *node = client->dev.of_node;
+       int count, icnt;
+
+       pchip->pdata = devm_kzalloc(&client->dev,
+                    sizeof(struct lp8758_platform_data), GFP_KERNEL);
+       if(pchip->pdata == NULL){
+               dev_err(&client->dev, "lp8758 -- platform data is null\n");
+               return -ENOMEM;
+       }
+
+       count = of_regulator_match(&client->dev, node,
+                                                               lp8758_matches, LP8758_BUCK_MAX);
+       if (count <= 0)
+               dev_err(&client->dev, "lp8758 --ERR - of regulator match\n");
+
+       for(icnt = 0; icnt < LP8758_BUCK_MAX; icnt++){
+               pchip->pdata->buck_data[icnt] = lp8758_matches[icnt].init_data;
+       }
+
+       pchip->irq = of_get_named_gpio(node,"irq-gpio", 0);
+       
+       return 0;
+}
+
+static const struct regmap_config lp8758_regmap = {
+       .reg_bits = 8,
+       .val_bits = 8,
+       .max_register = LP8758_REG_MAX,
+};
+
+static const struct of_device_id of_lp8758_bl_match[] = {
+       { .compatible = "ti,lp8758", },
+       {},
+};
+
+static int lp8758_probe(struct i2c_client *client,
+                       const struct i2c_device_id *id)
+{
+       struct lp8758_chip *pchip;
+       int ret = 0;
+
+       dev_info(&client->dev, "lp8758 module probe\n");
+       if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
+               dev_err(&client->dev, "i2c functionality check fail.\n");
+               return -EOPNOTSUPP;
+       }
+
+       pchip = devm_kzalloc(&client->dev,
+                            sizeof(struct lp8758_chip), GFP_KERNEL);
+       if (!pchip)
+               return -ENOMEM;
+
+       pchip->regmap = devm_regmap_init_i2c(client, &lp8758_regmap);
+       if (IS_ERR(pchip->regmap)) {
+               ret = PTR_ERR(pchip->regmap);
+               dev_err(&client->dev, "fail : allocate i2c register map\n");
+               return ret;
+       }
+
+       ret = lp8758_parse_dt(client, pchip);
+       if(ret < 0)
+               return ret;
+
+       pchip->dev = &client->dev;
+       i2c_set_clientdata(client, pchip);
+
+       ret = lp8758_regulator_init(pchip);
+       if (ret < 0) {
+               dev_err(&client->dev, "fail to initialize regulators\n");
+               return ret;
+       }
+
+       ret = lp8758_intr_config(pchip);
+       if (ret < 0) {
+               dev_err(&client->dev, "fail to irq config\n");
+               return ret;
+       }
+
+       dev_info(&client->dev, "lp8758 probe done\n");
+       return 0;
+}
+
+static const struct i2c_device_id lp8758_id[] = {
+       {LP8758_NAME, 0},
+       {}
+};
+
+MODULE_DEVICE_TABLE(i2c, lp8758_id);
+static struct i2c_driver lp8758_i2c_driver = {
+       .driver = {
+               .name = LP8758_NAME,
+               .owner   = THIS_MODULE,
+               .of_match_table = of_match_ptr(of_lp8758_bl_match),
+       },
+       .probe = lp8758_probe,
+       .id_table = lp8758_id,
+};
+
+module_i2c_driver(lp8758_i2c_driver);
+
+MODULE_DESCRIPTION("Texas Instruments lp8758 driver");
+MODULE_AUTHOR("Daniel Jeong <daniel.jeong@ti.com>");
+MODULE_AUTHOR("Ldd Mlp <ldd-mlp@list.ti.com>");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/platform_data/lp8758.h b/include/linux/platform_data/lp8758.h
new file mode 100644 (file)
index 0000000..8877a35
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * Simple driver for Texas Instruments lp8758 Regulator chip
+ * Copyright (C) 2015 Texas Instruments
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#ifndef __LINUX_LP8758_H
+#define __LINUX_LP8758_H
+
+#include <linux/regulator/consumer.h>
+
+#define LP8758_NAME "lp8758"
+#define LP8758_ADDR 0x60
+
+enum lp8758_bucks {
+       LP8758_BUCK0 = 0,
+       LP8758_BUCK2,
+       LP8758_BUCK_MAX
+};
+
+enum lp8758_registers {
+       LP8758_REG_DEV_REV = 0x00,
+       LP8758_REG_OTP_REV = 0x01,
+       LP8758_REG_BUCK0_CTRL1 = 0x02,
+       LP8758_REG_BUCK0_CTRL2 = 0x03,
+       LP8758_REG_BUCK1_CTRL1 = 0x04,
+       LP8758_REG_BUCK1_CTRL2 = 0x05,
+       LP8758_REG_BUCK2_CTRL1 = 0x06,
+       LP8758_REG_BUCK2_CTRL2 = 0x07,
+       LP8758_REG_BUCK3_CTRL1 = 0x08,
+       LP8758_REG_BUCK3_CTRL2 = 0x09,
+       LP8758_REG_BUCK0_VOUT           = 0x0a,
+       LP8758_REG_BUCK0_FLOORVOUT      = 0x0b,
+       LP8758_REG_BUCK1_VOUT           = 0x0c,
+       LP8758_REG_BUCK1_FLOORVOUT      = 0x0d,
+       LP8758_REG_BUCK2_VOUT           = 0x0e,
+       LP8758_REG_BUCK2_FLOORVOUT      = 0x0f,
+       LP8758_REG_BUCK3_VOUT           = 0x10,
+       LP8758_REG_BUCK3_FLOORVOUT      = 0x11,
+       LP8758_REG_BUCK0_DELAY = 0x12,
+       LP8758_REG_BUCK1_DELAY = 0x13,
+       LP8758_REG_BUCK2_DELAY = 0x14,
+       LP8758_REG_BUCK3_DELAY = 0x15,
+       LP8758_REG_RESET = 0x16,
+       LP8758_REG_CONFIG = 0x17,
+       LP8758_REG_INT_TOP = 0x18,
+       LP8758_REG_INT_BUCK_0_1 = 0x19,
+       LP8758_REG_INT_BUCK_2_3 = 0x1a,
+       LP8758_REG_STAT_TOP = 0x1b,
+       LP8758_REG_STAT_BUCK_0_1 = 0x1c,
+       LP8758_REG_STAT_BUCK_2_3 = 0x1d,
+       LP8758_REG_MASK_TOP = 0x1e,
+       LP8758_REG_MASK_BUCK_0_1 = 0x1f,
+       LP8758_REG_MASK_BUCK_2_3 = 0x20,
+       LP8758_REG_SEL_I_LOAD = 0x21,
+       LP8758_REG_SEL_I_LOAD_2 = 0x22,
+       LP8758_REG_SEL_I_LOAD_1 = 0x23,
+       LP8758_REG_MAX = 0xff
+};
+
+#define LP8758_BUCK_EN_MASK 0x80
+#define LP8758_BUCK_VOUT_MASK 0xff
+
+/*
+ * PWR FAULT : power fault detected
+ * OCP : over current protect activated
+ * OVP : over voltage protect activated
+ * TEMP_WARN : thermal warning
+ * TEMP_SHDN : thermal shutdonw detected
+ * I_LOAD : current measured
+ */
+#define LP8758_EVENT_PWR_FAULT REGULATOR_EVENT_FAIL
+#define LP8758_EVENT_OCP REGULATOR_EVENT_OVER_CURRENT
+#define LP8758_EVENT_OVP 0x10000
+#define LP8758_EVENT_TEMP_WARN 0x2000
+#define LP8758_EVENT_TEMP_SHDN REGULATOR_EVENT_OVER_TEMP
+#define LP8758_EVENT_I_LOAD    0x40000
+
+#define LP8758_BUCK0INT_MASK 0x10
+#define LP8758_BUCK1INT_MASK 0x20
+#define LP8758_BUCK2INT_MASK 0x40
+#define LP8758_BUCK3INT_MASK 0x80
+#define LP8758_OVERTEMP_MASK 0x08
+#define LP8758_OVERCURRENT_MASK 0x01
+
+#define LP8758_ILIM_MASK 0x38
+#define LP8758_ILIM_SHIFT 3
+
+/* struct lp8758 platform data
+ * @buck_data   : buck0~6 init voltage in uV
+ */
+struct lp8758_platform_data {
+
+       struct regulator_init_data *buck_data[LP8758_BUCK_MAX];
+};
+
+#endif /* __LINUX_LP8758_H */