Merge branches 'topic/tps51632', 'topic/tps80031', 'topic/vexpress', 'topic/max8925', 'topic/gpio' and 'topic/tps65090' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-hotplug
···11+GPIO controlled regulators22+33+Required properties:44+- compatible : Must be "regulator-gpio".55+- states : Selection of available voltages and GPIO configs.66+ if there are no states, then use a fixed regulator77+88+Optional properties:99+- enable-gpio : GPIO to use to enable/disable the regulator.1010+- gpios : GPIO group used to control voltage.1111+- startup-delay-us : Startup time in microseconds.1212+- enable-active-high : Polarity of GPIO is active high (default is low).1313+1414+Any property defined as part of the core regulator binding defined in1515+regulator.txt can also be used.1616+1717+Example:1818+1919+ mmciv: gpio-regulator {2020+ compatible = "regulator-gpio";2121+2222+ regulator-name = "mmci-gpio-supply";2323+ regulator-min-microvolt = <1800000>;2424+ regulator-max-microvolt = <2600000>;2525+ regulator-boot-on;2626+2727+ enable-gpio = <&gpio0 23 0x4>;2828+ gpios = <&gpio0 24 0x42929+ &gpio0 25 0x4>;3030+ states = <1800000 0x33131+ 2200000 0x23232+ 2600000 0x13333+ 2900000 0x0>;3434+3535+ startup-delay-us = <100000>;3636+ enable-active-high;3737+ };
···11+Versatile Express voltage regulators22+------------------------------------33+44+Requires node properties:55+- "compatible" value: "arm,vexpress-volt"66+- "arm,vexpress-sysreg,func" when controlled via vexpress-sysreg77+ (see Documentation/devicetree/bindings/arm/vexpress-sysreg.txt88+ for more details)99+1010+Required regulator properties:1111+- "regulator-name"1212+- "regulator-always-on"1313+1414+Optional regulator properties:1515+- "regulator-min-microvolt"1616+- "regulator-max-microvolt"1717+1818+See Documentation/devicetree/bindings/regulator/regulator.txt1919+for more details about the regulator properties.2020+2121+When no "regulator-[min|max]-microvolt" properties are defined,2222+the device is treated as fixed (or rather "read-only") regulator.2323+2424+Example:2525+ volt@0 {2626+ compatible = "arm,vexpress-volt";2727+ arm,vexpress-sysreg,func = <2 0>;2828+ regulator-name = "Cores";2929+ regulator-min-microvolt = <800000>;3030+ regulator-max-microvolt = <1050000>;3131+ regulator-always-on;3232+ };
+27
drivers/regulator/Kconfig
···335335 on the muxing. This is handled automatically in the driver by336336 reading the mux info from OTP.337337338338+config REGULATOR_TPS51632339339+ tristate "TI TPS51632 Power Regulator"340340+ depends on I2C341341+ select REGMAP_I2C342342+ help343343+ This driver supports TPS51632 voltage regulator chip.344344+ The TPS51632 is 3-2-1 Phase D-Cap+ Step Down Driverless Controller345345+ with Serial VID control and DVFS.346346+ The voltage output can be configure through I2C interface or PWM347347+ interface.348348+338349config REGULATOR_TPS6105X339350 tristate "TI TPS6105X Power regulators"340351 depends on TPS6105X···426415 help427416 This driver supports TPS65912 voltage regulator chip.428417418418+config REGULATOR_TPS80031419419+ tristate "TI TPS80031/TPS80032 power regualtor driver"420420+ depends on MFD_TPS80031421421+ help422422+ TPS80031/ TPS80032 Fully Integrated Power Management with Power423423+ Path and Battery Charger. It has 5 configurable step-down424424+ converters, 11 general purpose LDOs, VBUS generator and digital425425+ output to control regulators.426426+429427config REGULATOR_TWL4030430428 bool "TI TWL4030/TWL5030/TWL6030/TPS659x0 PMIC"431429 depends on TWL4030_CORE432430 help433431 This driver supports the voltage regulators provided by434432 this family of companion chips.433433+434434+config REGULATOR_VEXPRESS435435+ tristate "Versatile Express regulators"436436+ depends on VEXPRESS_CONFIG437437+ help438438+ This driver provides support for voltage regulators available439439+ on the ARM Ltd's Versatile Express platform.435440436441config REGULATOR_WM831X437442 tristate "Wolfson Microelectronics WM831x PMIC regulators"
···19851985 return ret;19861986 }1987198719881988+ /* Any voltage within constrains range is fine? */19891989+ if (rdev->desc->continuous_voltage_range)19901990+ return min_uV >= rdev->constraints->min_uV &&19911991+ max_uV <= rdev->constraints->max_uV;19921992+19881993 ret = regulator_count_voltages(regulator);19891994 if (ret < 0)19901995 return ret;
···11+/*22+ * tps51632-regulator.c -- TI TPS5163233+ *44+ * Regulator driver for TPS51632 3-2-1 Phase D-Cap Step Down Driverless55+ * Controller with serial VID control and DVFS.66+ *77+ * Copyright (c) 2012, NVIDIA Corporation.88+ *99+ * Author: Laxman Dewangan <ldewangan@nvidia.com>1010+ *1111+ * This program is free software; you can redistribute it and/or1212+ * modify it under the terms of the GNU General Public License as1313+ * published by the Free Software Foundation version 2.1414+ *1515+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,1616+ * whether express or implied; without even the implied warranty of1717+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU1818+ * General Public License for more details.1919+ *2020+ * You should have received a copy of the GNU General Public License2121+ * along with this program; if not, write to the Free Software2222+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA2323+ * 02111-1307, USA2424+ */2525+2626+#include <linux/err.h>2727+#include <linux/i2c.h>2828+#include <linux/init.h>2929+#include <linux/kernel.h>3030+#include <linux/module.h>3131+#include <linux/platform_device.h>3232+#include <linux/regmap.h>3333+#include <linux/regulator/driver.h>3434+#include <linux/regulator/machine.h>3535+#include <linux/regulator/tps51632-regulator.h>3636+#include <linux/slab.h>3737+3838+/* Register definitions */3939+#define TPS51632_VOLTAGE_SELECT_REG 0x04040+#define TPS51632_VOLTAGE_BASE_REG 0x14141+#define TPS51632_OFFSET_REG 0x24242+#define TPS51632_IMON_REG 0x34343+#define TPS51632_VMAX_REG 0x44444+#define TPS51632_DVFS_CONTROL_REG 0x54545+#define TPS51632_POWER_STATE_REG 0x64646+#define TPS51632_SLEW_REGS 0x74747+#define TPS51632_FAULT_REG 0x144848+4949+#define TPS51632_MAX_REG 0x155050+5151+#define TPS51632_VOUT_MASK 0x7F5252+#define TPS51632_VOUT_OFFSET_MASK 0x1F5353+#define TPS51632_VMAX_MASK 0x7F5454+#define TPS51632_VMAX_LOCK 0x805555+5656+/* TPS51632_DVFS_CONTROL_REG */5757+#define TPS51632_DVFS_PWMEN 0x15858+#define TPS51632_DVFS_STEP_20 0x25959+#define TPS51632_DVFS_VMAX_PG 0x46060+#define TPS51632_DVFS_PWMRST 0x86161+#define TPS51632_DVFS_OCA_EN 0x106262+#define TPS51632_DVFS_FCCM 0x206363+6464+/* TPS51632_POWER_STATE_REG */6565+#define TPS51632_POWER_STATE_MASK 0x036666+#define TPS51632_POWER_STATE_MULTI_PHASE_CCM 0x06767+#define TPS51632_POWER_STATE_SINGLE_PHASE_CCM 0x16868+#define TPS51632_POWER_STATE_SINGLE_PHASE_DCM 0x26969+7070+#define TPS51632_MIN_VOLATGE 5000007171+#define TPS51632_MAX_VOLATGE 15200007272+#define TPS51632_VOLATGE_STEP_10mV 100007373+#define TPS51632_VOLATGE_STEP_20mV 200007474+#define TPS51632_MAX_VSEL 0x7F7575+#define TPS51632_MIN_VSEL 0x197676+#define TPS51632_DEFAULT_RAMP_DELAY 60007777+#define TPS51632_VOLT_VSEL(uV) \7878+ (DIV_ROUND_UP(uV - TPS51632_MIN_VOLATGE, \7979+ TPS51632_VOLATGE_STEP_10mV) + \8080+ TPS51632_MIN_VSEL)8181+8282+/* TPS51632 chip information */8383+struct tps51632_chip {8484+ struct device *dev;8585+ struct regulator_desc desc;8686+ struct regulator_dev *rdev;8787+ struct regmap *regmap;8888+ bool enable_pwm_dvfs;8989+};9090+9191+static int tps51632_dcdc_get_voltage_sel(struct regulator_dev *rdev)9292+{9393+ struct tps51632_chip *tps = rdev_get_drvdata(rdev);9494+ unsigned int data;9595+ int ret;9696+ unsigned int reg = TPS51632_VOLTAGE_SELECT_REG;9797+ int vsel;9898+9999+ if (tps->enable_pwm_dvfs)100100+ reg = TPS51632_VOLTAGE_BASE_REG;101101+102102+ ret = regmap_read(tps->regmap, reg, &data);103103+ if (ret < 0) {104104+ dev_err(tps->dev, "reg read failed, err %d\n", ret);105105+ return ret;106106+ }107107+108108+ vsel = data & TPS51632_VOUT_MASK;109109+110110+ if (vsel < TPS51632_MIN_VSEL)111111+ return 0;112112+ else113113+ return vsel - TPS51632_MIN_VSEL;114114+}115115+116116+static int tps51632_dcdc_set_voltage_sel(struct regulator_dev *rdev,117117+ unsigned selector)118118+{119119+ struct tps51632_chip *tps = rdev_get_drvdata(rdev);120120+ int vsel;121121+ int ret;122122+ unsigned int reg = TPS51632_VOLTAGE_SELECT_REG;123123+124124+ if (tps->enable_pwm_dvfs)125125+ reg = TPS51632_VOLTAGE_BASE_REG;126126+127127+ vsel = selector + TPS51632_MIN_VSEL;128128+ if (vsel > TPS51632_MAX_VSEL)129129+ return -EINVAL;130130+131131+ ret = regmap_write(tps->regmap, TPS51632_VOLTAGE_SELECT_REG, vsel);132132+ if (ret < 0)133133+ dev_err(tps->dev, "reg write failed, err %d\n", ret);134134+ return ret;135135+}136136+137137+static int tps51632_dcdc_set_ramp_delay(struct regulator_dev *rdev,138138+ int ramp_delay)139139+{140140+ struct tps51632_chip *tps = rdev_get_drvdata(rdev);141141+ int bit = ramp_delay/6000;142142+ int ret;143143+144144+ if (bit)145145+ bit--;146146+ ret = regmap_write(tps->regmap, TPS51632_SLEW_REGS, BIT(bit));147147+ if (ret < 0)148148+ dev_err(tps->dev, "SLEW reg write failed, err %d\n", ret);149149+ return ret;150150+}151151+152152+static struct regulator_ops tps51632_dcdc_ops = {153153+ .get_voltage_sel = tps51632_dcdc_get_voltage_sel,154154+ .set_voltage_sel = tps51632_dcdc_set_voltage_sel,155155+ .list_voltage = regulator_list_voltage_linear,156156+ .set_voltage_time_sel = regulator_set_voltage_time_sel,157157+ .set_ramp_delay = tps51632_dcdc_set_ramp_delay,158158+};159159+160160+static int __devinit tps51632_init_dcdc(struct tps51632_chip *tps,161161+ struct tps51632_regulator_platform_data *pdata)162162+{163163+ int ret;164164+ uint8_t control = 0;165165+ int vsel;166166+167167+ if (!pdata->enable_pwm_dvfs)168168+ goto skip_pwm_config;169169+170170+ control |= TPS51632_DVFS_PWMEN;171171+ tps->enable_pwm_dvfs = pdata->enable_pwm_dvfs;172172+ vsel = TPS51632_VOLT_VSEL(pdata->base_voltage_uV);173173+ ret = regmap_write(tps->regmap, TPS51632_VOLTAGE_BASE_REG, vsel);174174+ if (ret < 0) {175175+ dev_err(tps->dev, "BASE reg write failed, err %d\n", ret);176176+ return ret;177177+ }178178+179179+ if (pdata->dvfs_step_20mV)180180+ control |= TPS51632_DVFS_STEP_20;181181+182182+ if (pdata->max_voltage_uV) {183183+ unsigned int vmax;184184+ /**185185+ * TPS51632 hw behavior: VMAX register can be write only186186+ * once as it get locked after first write. The lock get187187+ * reset only when device is power-reset.188188+ * Write register only when lock bit is not enabled.189189+ */190190+ ret = regmap_read(tps->regmap, TPS51632_VMAX_REG, &vmax);191191+ if (ret < 0) {192192+ dev_err(tps->dev, "VMAX read failed, err %d\n", ret);193193+ return ret;194194+ }195195+ if (!(vmax & TPS51632_VMAX_LOCK)) {196196+ vsel = TPS51632_VOLT_VSEL(pdata->max_voltage_uV);197197+ ret = regmap_write(tps->regmap, TPS51632_VMAX_REG,198198+ vsel);199199+ if (ret < 0) {200200+ dev_err(tps->dev,201201+ "VMAX write failed, err %d\n", ret);202202+ return ret;203203+ }204204+ }205205+ }206206+207207+skip_pwm_config:208208+ ret = regmap_write(tps->regmap, TPS51632_DVFS_CONTROL_REG, control);209209+ if (ret < 0)210210+ dev_err(tps->dev, "DVFS reg write failed, err %d\n", ret);211211+ return ret;212212+}213213+214214+static bool rd_wr_reg(struct device *dev, unsigned int reg)215215+{216216+ if ((reg >= 0x8) && (reg <= 0x10))217217+ return false;218218+ return true;219219+}220220+221221+static const struct regmap_config tps51632_regmap_config = {222222+ .reg_bits = 8,223223+ .val_bits = 8,224224+ .writeable_reg = rd_wr_reg,225225+ .readable_reg = rd_wr_reg,226226+ .max_register = TPS51632_MAX_REG - 1,227227+ .cache_type = REGCACHE_RBTREE,228228+};229229+230230+static int __devinit tps51632_probe(struct i2c_client *client,231231+ const struct i2c_device_id *id)232232+{233233+ struct tps51632_regulator_platform_data *pdata;234234+ struct regulator_dev *rdev;235235+ struct tps51632_chip *tps;236236+ int ret;237237+ struct regulator_config config = { };238238+239239+ pdata = client->dev.platform_data;240240+ if (!pdata) {241241+ dev_err(&client->dev, "No Platform data\n");242242+ return -EINVAL;243243+ }244244+245245+ tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);246246+ if (!tps) {247247+ dev_err(&client->dev, "Memory allocation failed\n");248248+ return -ENOMEM;249249+ }250250+251251+ tps->dev = &client->dev;252252+ tps->desc.name = id->name;253253+ tps->desc.id = 0;254254+ tps->desc.ramp_delay = TPS51632_DEFAULT_RAMP_DELAY;255255+ tps->desc.min_uV = TPS51632_MIN_VOLATGE;256256+ tps->desc.uV_step = TPS51632_VOLATGE_STEP_10mV;257257+ tps->desc.n_voltages = (TPS51632_MAX_VSEL - TPS51632_MIN_VSEL) + 1;258258+ tps->desc.ops = &tps51632_dcdc_ops;259259+ tps->desc.type = REGULATOR_VOLTAGE;260260+ tps->desc.owner = THIS_MODULE;261261+262262+ tps->regmap = devm_regmap_init_i2c(client, &tps51632_regmap_config);263263+ if (IS_ERR(tps->regmap)) {264264+ ret = PTR_ERR(tps->regmap);265265+ dev_err(&client->dev, "regmap init failed, err %d\n", ret);266266+ return ret;267267+ }268268+ i2c_set_clientdata(client, tps);269269+270270+ ret = tps51632_init_dcdc(tps, pdata);271271+ if (ret < 0) {272272+ dev_err(tps->dev, "Init failed, err = %d\n", ret);273273+ return ret;274274+ }275275+276276+ /* Register the regulators */277277+ config.dev = &client->dev;278278+ config.init_data = pdata->reg_init_data;279279+ config.driver_data = tps;280280+ config.regmap = tps->regmap;281281+ config.of_node = client->dev.of_node;282282+283283+ rdev = regulator_register(&tps->desc, &config);284284+ if (IS_ERR(rdev)) {285285+ dev_err(tps->dev, "regulator register failed\n");286286+ return PTR_ERR(rdev);287287+ }288288+289289+ tps->rdev = rdev;290290+ return 0;291291+}292292+293293+static int __devexit tps51632_remove(struct i2c_client *client)294294+{295295+ struct tps51632_chip *tps = i2c_get_clientdata(client);296296+297297+ regulator_unregister(tps->rdev);298298+ return 0;299299+}300300+301301+static const struct i2c_device_id tps51632_id[] = {302302+ {.name = "tps51632",},303303+ {},304304+};305305+306306+MODULE_DEVICE_TABLE(i2c, tps51632_id);307307+308308+static struct i2c_driver tps51632_i2c_driver = {309309+ .driver = {310310+ .name = "tps51632",311311+ .owner = THIS_MODULE,312312+ },313313+ .probe = tps51632_probe,314314+ .remove = __devexit_p(tps51632_remove),315315+ .id_table = tps51632_id,316316+};317317+318318+static int __init tps51632_init(void)319319+{320320+ return i2c_add_driver(&tps51632_i2c_driver);321321+}322322+subsys_initcall(tps51632_init);323323+324324+static void __exit tps51632_cleanup(void)325325+{326326+ i2c_del_driver(&tps51632_i2c_driver);327327+}328328+module_exit(tps51632_cleanup);329329+330330+MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>");331331+MODULE_DESCRIPTION("TPS51632 voltage regulator driver");332332+MODULE_LICENSE("GPL v2");
+184-63
drivers/regulator/tps65090-regulator.c
···18181919#include <linux/module.h>2020#include <linux/init.h>2121+#include <linux/gpio.h>2122#include <linux/slab.h>2223#include <linux/err.h>2324#include <linux/platform_device.h>2425#include <linux/regulator/driver.h>2526#include <linux/regulator/machine.h>2627#include <linux/mfd/tps65090.h>2727-#include <linux/regulator/tps65090-regulator.h>28282929struct tps65090_regulator {3030- int id;3131- /* used by regulator core */3232- struct regulator_desc desc;3333-3434- /* Device */3530 struct device *dev;3131+ struct regulator_desc *desc;3232+ struct regulator_dev *rdev;3633};37343838-static struct regulator_ops tps65090_ops = {3939- .enable = regulator_enable_regmap,4040- .disable = regulator_disable_regmap,4141- .is_enabled = regulator_is_enabled_regmap,3535+static struct regulator_ops tps65090_ext_control_ops = {4236};43374444-#define tps65090_REG(_id) \3838+static struct regulator_ops tps65090_reg_contol_ops = {3939+ .enable = regulator_enable_regmap,4040+ .disable = regulator_disable_regmap,4141+ .is_enabled = regulator_is_enabled_regmap,4242+};4343+4444+static struct regulator_ops tps65090_ldo_ops = {4545+};4646+4747+#define tps65090_REG_DESC(_id, _sname, _en_reg, _ops) \4548{ \4646- .id = TPS65090_ID_##_id, \4747- .desc = { \4848- .name = tps65090_rails(_id), \4949- .id = TPS65090_ID_##_id, \5050- .ops = &tps65090_ops, \5151- .type = REGULATOR_VOLTAGE, \5252- .owner = THIS_MODULE, \5353- .enable_reg = (TPS65090_ID_##_id) + 12, \5454- .enable_mask = BIT(0), \5555- }, \4949+ .name = "TPS65090_RAILS"#_id, \5050+ .supply_name = _sname, \5151+ .id = TPS65090_REGULATOR_##_id, \5252+ .ops = &_ops, \5353+ .enable_reg = _en_reg, \5454+ .enable_mask = BIT(0), \5555+ .type = REGULATOR_VOLTAGE, \5656+ .owner = THIS_MODULE, \5657}57585858-static struct tps65090_regulator TPS65090_regulator[] = {5959- tps65090_REG(DCDC1),6060- tps65090_REG(DCDC2),6161- tps65090_REG(DCDC3),6262- tps65090_REG(FET1),6363- tps65090_REG(FET2),6464- tps65090_REG(FET3),6565- tps65090_REG(FET4),6666- tps65090_REG(FET5),6767- tps65090_REG(FET6),6868- tps65090_REG(FET7),5959+static struct regulator_desc tps65090_regulator_desc[] = {6060+ tps65090_REG_DESC(DCDC1, "vsys1", 0x0C, tps65090_reg_contol_ops),6161+ tps65090_REG_DESC(DCDC2, "vsys2", 0x0D, tps65090_reg_contol_ops),6262+ tps65090_REG_DESC(DCDC3, "vsys3", 0x0E, tps65090_reg_contol_ops),6363+ tps65090_REG_DESC(FET1, "infet1", 0x0F, tps65090_reg_contol_ops),6464+ tps65090_REG_DESC(FET2, "infet2", 0x10, tps65090_reg_contol_ops),6565+ tps65090_REG_DESC(FET3, "infet3", 0x11, tps65090_reg_contol_ops),6666+ tps65090_REG_DESC(FET4, "infet4", 0x12, tps65090_reg_contol_ops),6767+ tps65090_REG_DESC(FET5, "infet5", 0x13, tps65090_reg_contol_ops),6868+ tps65090_REG_DESC(FET6, "infet6", 0x14, tps65090_reg_contol_ops),6969+ tps65090_REG_DESC(FET7, "infet7", 0x15, tps65090_reg_contol_ops),7070+ tps65090_REG_DESC(LDO1, "vsys_l1", 0, tps65090_ldo_ops),7171+ tps65090_REG_DESC(LDO2, "vsys_l2", 0, tps65090_ldo_ops),6972};70737171-static inline struct tps65090_regulator *find_regulator_info(int id)7474+static inline bool is_dcdc(int id)7275{7373- struct tps65090_regulator *ri;7474- int i;7575-7676- for (i = 0; i < ARRAY_SIZE(TPS65090_regulator); i++) {7777- ri = &TPS65090_regulator[i];7878- if (ri->desc.id == id)7979- return ri;7676+ switch (id) {7777+ case TPS65090_REGULATOR_DCDC1:7878+ case TPS65090_REGULATOR_DCDC2:7979+ case TPS65090_REGULATOR_DCDC3:8080+ return true;8181+ default:8282+ return false;8083 }8181- return NULL;8484+}8585+8686+static int __devinit tps65090_config_ext_control(8787+ struct tps65090_regulator *ri, bool enable)8888+{8989+ int ret;9090+ struct device *parent = ri->dev->parent;9191+ unsigned int reg_en_reg = ri->desc->enable_reg;9292+9393+ if (enable)9494+ ret = tps65090_set_bits(parent, reg_en_reg, 1);9595+ else9696+ ret = tps65090_clr_bits(parent, reg_en_reg, 1);9797+ if (ret < 0)9898+ dev_err(ri->dev, "Error in updating reg 0x%x\n", reg_en_reg);9999+ return ret;100100+}101101+102102+static int __devinit tps65090_regulator_disable_ext_control(103103+ struct tps65090_regulator *ri,104104+ struct tps65090_regulator_plat_data *tps_pdata)105105+{106106+ int ret = 0;107107+ struct device *parent = ri->dev->parent;108108+ unsigned int reg_en_reg = ri->desc->enable_reg;109109+110110+ /*111111+ * First enable output for internal control if require.112112+ * And then disable external control.113113+ */114114+ if (tps_pdata->reg_init_data->constraints.always_on ||115115+ tps_pdata->reg_init_data->constraints.boot_on) {116116+ ret = tps65090_set_bits(parent, reg_en_reg, 0);117117+ if (ret < 0) {118118+ dev_err(ri->dev, "Error in set reg 0x%x\n", reg_en_reg);119119+ return ret;120120+ }121121+ }122122+ return tps65090_config_ext_control(ri, false);123123+}124124+125125+static void __devinit tps65090_configure_regulator_config(126126+ struct tps65090_regulator_plat_data *tps_pdata,127127+ struct regulator_config *config)128128+{129129+ if (gpio_is_valid(tps_pdata->gpio)) {130130+ int gpio_flag = GPIOF_OUT_INIT_LOW;131131+132132+ if (tps_pdata->reg_init_data->constraints.always_on ||133133+ tps_pdata->reg_init_data->constraints.boot_on)134134+ gpio_flag = GPIOF_OUT_INIT_HIGH;135135+136136+ config->ena_gpio = tps_pdata->gpio;137137+ config->ena_gpio_flags = gpio_flag;138138+ }82139}8314084141static int __devinit tps65090_regulator_probe(struct platform_device *pdev)···14487 struct tps65090_regulator *ri = NULL;14588 struct regulator_config config = { };14689 struct regulator_dev *rdev;147147- struct tps65090_regulator_platform_data *tps_pdata;148148- int id = pdev->id;9090+ struct tps65090_regulator_plat_data *tps_pdata;9191+ struct tps65090_regulator *pmic;9292+ struct tps65090_platform_data *tps65090_pdata;9393+ int num;9494+ int ret;14995150150- dev_dbg(&pdev->dev, "Probing regulator %d\n", id);9696+ dev_dbg(&pdev->dev, "Probing regulator\n");15197152152- ri = find_regulator_info(id);153153- if (ri == NULL) {154154- dev_err(&pdev->dev, "invalid regulator ID specified\n");9898+ tps65090_pdata = dev_get_platdata(pdev->dev.parent);9999+ if (!tps65090_pdata) {100100+ dev_err(&pdev->dev, "Platform data missing\n");155101 return -EINVAL;156102 }157157- tps_pdata = pdev->dev.platform_data;158158- ri->dev = &pdev->dev;159103160160- config.dev = &pdev->dev;161161- config.init_data = &tps_pdata->regulator;162162- config.driver_data = ri;163163- config.regmap = tps65090_mfd->rmap;164164-165165- rdev = regulator_register(&ri->desc, &config);166166- if (IS_ERR(rdev)) {167167- dev_err(&pdev->dev, "failed to register regulator %s\n",168168- ri->desc.name);169169- return PTR_ERR(rdev);104104+ pmic = devm_kzalloc(&pdev->dev, TPS65090_REGULATOR_MAX * sizeof(*pmic),105105+ GFP_KERNEL);106106+ if (!pmic) {107107+ dev_err(&pdev->dev, "mem alloc for pmic failed\n");108108+ return -ENOMEM;170109 }171110172172- platform_set_drvdata(pdev, rdev);111111+ for (num = 0; num < TPS65090_REGULATOR_MAX; num++) {112112+ tps_pdata = tps65090_pdata->reg_pdata[num];113113+114114+ ri = &pmic[num];115115+ ri->dev = &pdev->dev;116116+ ri->desc = &tps65090_regulator_desc[num];117117+118118+ /*119119+ * TPS5090 DCDC support the control from external digital input.120120+ * Configure it as per platform data.121121+ */122122+ if (tps_pdata && is_dcdc(num) && tps_pdata->reg_init_data) {123123+ if (tps_pdata->enable_ext_control) {124124+ tps65090_configure_regulator_config(125125+ tps_pdata, &config);126126+ ri->desc->ops = &tps65090_ext_control_ops;127127+ } else {128128+ ret = tps65090_regulator_disable_ext_control(129129+ ri, tps_pdata);130130+ if (ret < 0) {131131+ dev_err(&pdev->dev,132132+ "failed disable ext control\n");133133+ goto scrub;134134+ }135135+ }136136+ }137137+138138+ config.dev = &pdev->dev;139139+ config.driver_data = ri;140140+ config.regmap = tps65090_mfd->rmap;141141+ if (tps_pdata)142142+ config.init_data = tps_pdata->reg_init_data;143143+ else144144+ config.init_data = NULL;145145+146146+ rdev = regulator_register(ri->desc, &config);147147+ if (IS_ERR(rdev)) {148148+ dev_err(&pdev->dev, "failed to register regulator %s\n",149149+ ri->desc->name);150150+ ret = PTR_ERR(rdev);151151+ goto scrub;152152+ }153153+ ri->rdev = rdev;154154+155155+ /* Enable external control if it is require */156156+ if (tps_pdata && is_dcdc(num) && tps_pdata->reg_init_data &&157157+ tps_pdata->enable_ext_control) {158158+ ret = tps65090_config_ext_control(ri, true);159159+ if (ret < 0) {160160+ /* Increment num to get unregister rdev */161161+ num++;162162+ goto scrub;163163+ }164164+ }165165+ }166166+167167+ platform_set_drvdata(pdev, pmic);173168 return 0;169169+170170+scrub:171171+ while (--num >= 0) {172172+ ri = &pmic[num];173173+ regulator_unregister(ri->rdev);174174+ }175175+ return ret;174176}175177176178static int __devexit tps65090_regulator_remove(struct platform_device *pdev)177179{178178- struct regulator_dev *rdev = platform_get_drvdata(pdev);180180+ struct tps65090_regulator *pmic = platform_get_drvdata(pdev);181181+ struct tps65090_regulator *ri;182182+ int num;179183180180- regulator_unregister(rdev);184184+ for (num = 0; num < TPS65090_REGULATOR_MAX; ++num) {185185+ ri = &pmic[num];186186+ regulator_unregister(ri->rdev);187187+ }181188 return 0;182189}183190184191static struct platform_driver tps65090_regulator_driver = {185192 .driver = {186186- .name = "tps65090-regulator",193193+ .name = "tps65090-pmic",187194 .owner = THIS_MODULE,188195 },189196 .probe = tps65090_regulator_probe,
+793
drivers/regulator/tps80031-regulator.c
···11+/*22+ * tps80031-regulator.c -- TI TPS80031 regulator driver.33+ *44+ * Regulator driver for TITPS80031/TPS80032 Fully Integrated Power55+ * Management with Power Path and Battery Charger.66+ *77+ * Copyright (c) 2012, NVIDIA Corporation.88+ *99+ * Author: Laxman Dewangan <ldewangan@nvidia.com>1010+ *1111+ * This program is free software; you can redistribute it and/or1212+ * modify it under the terms of the GNU General Public License as1313+ * published by the Free Software Foundation version 2.1414+ *1515+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,1616+ * whether express or implied; without even the implied warranty of1717+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU1818+ * General Public License for more details.1919+ *2020+ * You should have received a copy of the GNU General Public License2121+ * along with this program; if not, write to the Free Software2222+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA2323+ * 02111-1307, USA2424+ */2525+2626+#include <linux/delay.h>2727+#include <linux/err.h>2828+#include <linux/init.h>2929+#include <linux/kernel.h>3030+#include <linux/mfd/tps80031.h>3131+#include <linux/module.h>3232+#include <linux/platform_device.h>3333+#include <linux/regulator/driver.h>3434+#include <linux/regulator/machine.h>3535+#include <linux/slab.h>3636+3737+/* Flags for DCDC Voltage reading */3838+#define DCDC_OFFSET_EN BIT(0)3939+#define DCDC_EXTENDED_EN BIT(1)4040+#define TRACK_MODE_ENABLE BIT(2)4141+4242+#define SMPS_MULTOFFSET_VIO BIT(1)4343+#define SMPS_MULTOFFSET_SMPS1 BIT(3)4444+#define SMPS_MULTOFFSET_SMPS2 BIT(4)4545+#define SMPS_MULTOFFSET_SMPS3 BIT(6)4646+#define SMPS_MULTOFFSET_SMPS4 BIT(0)4747+4848+#define SMPS_CMD_MASK 0xC04949+#define SMPS_VSEL_MASK 0x3F5050+#define LDO_VSEL_MASK 0x1F5151+#define LDO_TRACK_VSEL_MASK 0x3F5252+5353+#define MISC2_LDOUSB_IN_VSYS BIT(4)5454+#define MISC2_LDOUSB_IN_PMID BIT(3)5555+#define MISC2_LDOUSB_IN_MASK 0x185656+5757+#define MISC2_LDO3_SEL_VIB_VAL BIT(0)5858+#define MISC2_LDO3_SEL_VIB_MASK 0x15959+6060+#define BOOST_HW_PWR_EN BIT(5)6161+#define BOOST_HW_PWR_EN_MASK BIT(5)6262+6363+#define OPA_MODE_EN BIT(6)6464+#define OPA_MODE_EN_MASK BIT(6)6565+6666+#define USB_VBUS_CTRL_SET 0x046767+#define USB_VBUS_CTRL_CLR 0x056868+#define VBUS_DISCHRG 0x206969+7070+struct tps80031_regulator_info {7171+ /* Regulator register address.*/7272+ u8 trans_reg;7373+ u8 state_reg;7474+ u8 force_reg;7575+ u8 volt_reg;7676+ u8 volt_id;7777+7878+ /*Power request bits */7979+ int preq_bit;8080+8181+ /* used by regulator core */8282+ struct regulator_desc desc;8383+8484+};8585+8686+struct tps80031_regulator {8787+ struct device *dev;8888+ struct regulator_dev *rdev;8989+ struct tps80031_regulator_info *rinfo;9090+9191+ u8 device_flags;9292+ unsigned int config_flags;9393+ unsigned int ext_ctrl_flag;9494+};9595+9696+static inline struct device *to_tps80031_dev(struct regulator_dev *rdev)9797+{9898+ return rdev_get_dev(rdev)->parent->parent;9999+}100100+101101+static int tps80031_reg_is_enabled(struct regulator_dev *rdev)102102+{103103+ struct tps80031_regulator *ri = rdev_get_drvdata(rdev);104104+ struct device *parent = to_tps80031_dev(rdev);105105+ u8 reg_val;106106+ int ret;107107+108108+ if (ri->ext_ctrl_flag & TPS80031_EXT_PWR_REQ)109109+ return true;110110+111111+ ret = tps80031_read(parent, TPS80031_SLAVE_ID1, ri->rinfo->state_reg,112112+ ®_val);113113+ if (ret < 0) {114114+ dev_err(&rdev->dev, "Reg 0x%02x read failed, err = %d\n",115115+ ri->rinfo->state_reg, ret);116116+ return ret;117117+ }118118+ return ((reg_val & TPS80031_STATE_MASK) == TPS80031_STATE_ON);119119+}120120+121121+static int tps80031_reg_enable(struct regulator_dev *rdev)122122+{123123+ struct tps80031_regulator *ri = rdev_get_drvdata(rdev);124124+ struct device *parent = to_tps80031_dev(rdev);125125+ int ret;126126+127127+ if (ri->ext_ctrl_flag & TPS80031_EXT_PWR_REQ)128128+ return 0;129129+130130+ ret = tps80031_update(parent, TPS80031_SLAVE_ID1, ri->rinfo->state_reg,131131+ TPS80031_STATE_ON, TPS80031_STATE_MASK);132132+ if (ret < 0) {133133+ dev_err(&rdev->dev, "Reg 0x%02x update failed, err = %d\n",134134+ ri->rinfo->state_reg, ret);135135+ return ret;136136+ }137137+ return ret;138138+}139139+140140+static int tps80031_reg_disable(struct regulator_dev *rdev)141141+{142142+ struct tps80031_regulator *ri = rdev_get_drvdata(rdev);143143+ struct device *parent = to_tps80031_dev(rdev);144144+ int ret;145145+146146+ if (ri->ext_ctrl_flag & TPS80031_EXT_PWR_REQ)147147+ return 0;148148+149149+ ret = tps80031_update(parent, TPS80031_SLAVE_ID1, ri->rinfo->state_reg,150150+ TPS80031_STATE_OFF, TPS80031_STATE_MASK);151151+ if (ret < 0)152152+ dev_err(&rdev->dev, "Reg 0x%02x update failed, err = %d\n",153153+ ri->rinfo->state_reg, ret);154154+ return ret;155155+}156156+157157+/* DCDC voltages for the selector of 58 to 63 */158158+static int tps80031_dcdc_voltages[4][5] = {159159+ { 1350, 1500, 1800, 1900, 2100},160160+ { 1350, 1500, 1800, 1900, 2100},161161+ { 2084, 2315, 2778, 2932, 3241},162162+ { 4167, 2315, 2778, 2932, 3241},163163+};164164+165165+static int tps80031_dcdc_list_voltage(struct regulator_dev *rdev, unsigned sel)166166+{167167+ struct tps80031_regulator *ri = rdev_get_drvdata(rdev);168168+ int volt_index = ri->device_flags & 0x3;169169+170170+ if (sel == 0)171171+ return 0;172172+ else if (sel < 58)173173+ return regulator_list_voltage_linear(rdev, sel - 1);174174+ else175175+ return tps80031_dcdc_voltages[volt_index][sel - 58] * 1000;176176+}177177+178178+static int tps80031_dcdc_set_voltage_sel(struct regulator_dev *rdev,179179+ unsigned vsel)180180+{181181+ struct tps80031_regulator *ri = rdev_get_drvdata(rdev);182182+ struct device *parent = to_tps80031_dev(rdev);183183+ int ret;184184+ u8 reg_val;185185+186186+ if (ri->rinfo->force_reg) {187187+ ret = tps80031_read(parent, ri->rinfo->volt_id,188188+ ri->rinfo->force_reg, ®_val);189189+ if (ret < 0) {190190+ dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n",191191+ ri->rinfo->force_reg, ret);192192+ return ret;193193+ }194194+ if (!(reg_val & SMPS_CMD_MASK)) {195195+ ret = tps80031_update(parent, ri->rinfo->volt_id,196196+ ri->rinfo->force_reg, vsel, SMPS_VSEL_MASK);197197+ if (ret < 0)198198+ dev_err(ri->dev,199199+ "reg 0x%02x update failed, e = %d\n",200200+ ri->rinfo->force_reg, ret);201201+ return ret;202202+ }203203+ }204204+ ret = tps80031_update(parent, ri->rinfo->volt_id,205205+ ri->rinfo->volt_reg, vsel, SMPS_VSEL_MASK);206206+ if (ret < 0)207207+ dev_err(ri->dev, "reg 0x%02x update failed, e = %d\n",208208+ ri->rinfo->volt_reg, ret);209209+ return ret;210210+}211211+212212+static int tps80031_dcdc_get_voltage_sel(struct regulator_dev *rdev)213213+{214214+ struct tps80031_regulator *ri = rdev_get_drvdata(rdev);215215+ struct device *parent = to_tps80031_dev(rdev);216216+ uint8_t vsel = 0;217217+ int ret;218218+219219+ if (ri->rinfo->force_reg) {220220+ ret = tps80031_read(parent, ri->rinfo->volt_id,221221+ ri->rinfo->force_reg, &vsel);222222+ if (ret < 0) {223223+ dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n",224224+ ri->rinfo->force_reg, ret);225225+ return ret;226226+ }227227+228228+ if (!(vsel & SMPS_CMD_MASK))229229+ return vsel & SMPS_VSEL_MASK;230230+ }231231+ ret = tps80031_read(parent, ri->rinfo->volt_id,232232+ ri->rinfo->volt_reg, &vsel);233233+ if (ret < 0) {234234+ dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n",235235+ ri->rinfo->volt_reg, ret);236236+ return ret;237237+ }238238+ return vsel & SMPS_VSEL_MASK;239239+}240240+241241+static int tps80031_ldo_set_voltage_sel(struct regulator_dev *rdev,242242+ unsigned sel)243243+{244244+ struct tps80031_regulator *ri = rdev_get_drvdata(rdev);245245+ struct device *parent = to_tps80031_dev(rdev);246246+ int ret;247247+248248+ /* Check for valid setting for TPS80031 or TPS80032-ES1.0 */249249+ if ((ri->rinfo->desc.id == TPS80031_REGULATOR_LDO2) &&250250+ (ri->device_flags & TRACK_MODE_ENABLE)) {251251+ unsigned nvsel = (sel) & 0x1F;252252+ if (((tps80031_get_chip_info(parent) == TPS80031) ||253253+ ((tps80031_get_chip_info(parent) == TPS80032) &&254254+ (tps80031_get_pmu_version(parent) == 0x0))) &&255255+ ((nvsel == 0x0) || (nvsel >= 0x19 && nvsel <= 0x1F))) {256256+ dev_err(ri->dev,257257+ "Invalid sel %d in track mode LDO2\n",258258+ nvsel);259259+ return -EINVAL;260260+ }261261+ }262262+263263+ ret = tps80031_write(parent, ri->rinfo->volt_id,264264+ ri->rinfo->volt_reg, sel);265265+ if (ret < 0)266266+ dev_err(ri->dev, "Error in writing reg 0x%02x, e = %d\n",267267+ ri->rinfo->volt_reg, ret);268268+ return ret;269269+}270270+271271+static int tps80031_ldo_get_voltage_sel(struct regulator_dev *rdev)272272+{273273+ struct tps80031_regulator *ri = rdev_get_drvdata(rdev);274274+ struct device *parent = to_tps80031_dev(rdev);275275+ uint8_t vsel;276276+ int ret;277277+278278+ ret = tps80031_read(parent, ri->rinfo->volt_id,279279+ ri->rinfo->volt_reg, &vsel);280280+ if (ret < 0) {281281+ dev_err(ri->dev, "Error in writing the Voltage register\n");282282+ return ret;283283+ }284284+ return vsel & rdev->desc->vsel_mask;285285+}286286+287287+static int tps80031_ldo_list_voltage(struct regulator_dev *rdev, unsigned sel)288288+{289289+ if (sel == 0)290290+ return 0;291291+ else292292+ return regulator_list_voltage_linear(rdev, sel - 1);293293+}294294+295295+static int tps80031_vbus_is_enabled(struct regulator_dev *rdev)296296+{297297+ struct tps80031_regulator *ri = rdev_get_drvdata(rdev);298298+ struct device *parent = to_tps80031_dev(rdev);299299+ int ret = -EIO;300300+ uint8_t ctrl1 = 0;301301+ uint8_t ctrl3 = 0;302302+303303+ ret = tps80031_read(parent, TPS80031_SLAVE_ID2,304304+ TPS80031_CHARGERUSB_CTRL1, &ctrl1);305305+ if (ret < 0) {306306+ dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n",307307+ TPS80031_CHARGERUSB_CTRL1, ret);308308+ return ret;309309+ }310310+ ret = tps80031_read(parent, TPS80031_SLAVE_ID2,311311+ TPS80031_CHARGERUSB_CTRL3, &ctrl3);312312+ if (ret < 0) {313313+ dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n",314314+ TPS80031_CHARGERUSB_CTRL1, ret);315315+ return ret;316316+ }317317+ if ((ctrl1 & OPA_MODE_EN) && (ctrl3 & BOOST_HW_PWR_EN))318318+ return 1;319319+ return ret;320320+}321321+322322+static int tps80031_vbus_enable(struct regulator_dev *rdev)323323+{324324+ struct tps80031_regulator *ri = rdev_get_drvdata(rdev);325325+ struct device *parent = to_tps80031_dev(rdev);326326+ int ret;327327+328328+ ret = tps80031_set_bits(parent, TPS80031_SLAVE_ID2,329329+ TPS80031_CHARGERUSB_CTRL1, OPA_MODE_EN);330330+ if (ret < 0) {331331+ dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n",332332+ TPS80031_CHARGERUSB_CTRL1, ret);333333+ return ret;334334+ }335335+336336+ ret = tps80031_set_bits(parent, TPS80031_SLAVE_ID2,337337+ TPS80031_CHARGERUSB_CTRL3, BOOST_HW_PWR_EN);338338+ if (ret < 0) {339339+ dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n",340340+ TPS80031_CHARGERUSB_CTRL3, ret);341341+ return ret;342342+ }343343+ return ret;344344+}345345+346346+static int tps80031_vbus_disable(struct regulator_dev *rdev)347347+{348348+ struct tps80031_regulator *ri = rdev_get_drvdata(rdev);349349+ struct device *parent = to_tps80031_dev(rdev);350350+ int ret = 0;351351+352352+ if (ri->config_flags & TPS80031_VBUS_DISCHRG_EN_PDN) {353353+ ret = tps80031_write(parent, TPS80031_SLAVE_ID2,354354+ USB_VBUS_CTRL_SET, VBUS_DISCHRG);355355+ if (ret < 0) {356356+ dev_err(ri->dev, "reg 0x%02x write failed, e = %d\n",357357+ USB_VBUS_CTRL_SET, ret);358358+ return ret;359359+ }360360+ }361361+362362+ ret = tps80031_clr_bits(parent, TPS80031_SLAVE_ID2,363363+ TPS80031_CHARGERUSB_CTRL1, OPA_MODE_EN);364364+ if (ret < 0) {365365+ dev_err(ri->dev, "reg 0x%02x clearbit failed, e = %d\n",366366+ TPS80031_CHARGERUSB_CTRL1, ret);367367+ return ret;368368+ }369369+370370+ ret = tps80031_clr_bits(parent, TPS80031_SLAVE_ID2,371371+ TPS80031_CHARGERUSB_CTRL3, BOOST_HW_PWR_EN);372372+ if (ret < 0) {373373+ dev_err(ri->dev, "reg 0x%02x clearbit failed, e = %d\n",374374+ TPS80031_CHARGERUSB_CTRL3, ret);375375+ return ret;376376+ }377377+378378+ mdelay(DIV_ROUND_UP(ri->rinfo->desc.enable_time, 1000));379379+ if (ri->config_flags & TPS80031_VBUS_DISCHRG_EN_PDN) {380380+ ret = tps80031_write(parent, TPS80031_SLAVE_ID2,381381+ USB_VBUS_CTRL_CLR, VBUS_DISCHRG);382382+ if (ret < 0) {383383+ dev_err(ri->dev, "reg 0x%02x write failed, e = %d\n",384384+ USB_VBUS_CTRL_CLR, ret);385385+ return ret;386386+ }387387+ }388388+ return ret;389389+}390390+391391+static struct regulator_ops tps80031_dcdc_ops = {392392+ .list_voltage = tps80031_dcdc_list_voltage,393393+ .set_voltage_sel = tps80031_dcdc_set_voltage_sel,394394+ .get_voltage_sel = tps80031_dcdc_get_voltage_sel,395395+ .enable = tps80031_reg_enable,396396+ .disable = tps80031_reg_disable,397397+ .is_enabled = tps80031_reg_is_enabled,398398+};399399+400400+static struct regulator_ops tps80031_ldo_ops = {401401+ .list_voltage = tps80031_ldo_list_voltage,402402+ .set_voltage_sel = tps80031_ldo_set_voltage_sel,403403+ .get_voltage_sel = tps80031_ldo_get_voltage_sel,404404+ .enable = tps80031_reg_enable,405405+ .disable = tps80031_reg_disable,406406+ .is_enabled = tps80031_reg_is_enabled,407407+};408408+409409+static struct regulator_ops tps80031_vbus_sw_ops = {410410+ .enable = tps80031_vbus_enable,411411+ .disable = tps80031_vbus_disable,412412+ .is_enabled = tps80031_vbus_is_enabled,413413+};414414+415415+static struct regulator_ops tps80031_vbus_hw_ops = {416416+};417417+418418+static struct regulator_ops tps80031_ext_reg_ops = {419419+ .enable = tps80031_reg_enable,420420+ .disable = tps80031_reg_disable,421421+ .is_enabled = tps80031_reg_is_enabled,422422+};423423+424424+/* Non-exiting default definition for some register */425425+#define TPS80031_SMPS3_CFG_FORCE 0426426+#define TPS80031_SMPS4_CFG_FORCE 0427427+428428+#define TPS80031_VBUS_CFG_TRANS 0429429+#define TPS80031_VBUS_CFG_STATE 0430430+431431+#define TPS80031_REG_SMPS(_id, _volt_id, _pbit) \432432+{ \433433+ .trans_reg = TPS80031_##_id##_CFG_TRANS, \434434+ .state_reg = TPS80031_##_id##_CFG_STATE, \435435+ .force_reg = TPS80031_##_id##_CFG_FORCE, \436436+ .volt_reg = TPS80031_##_id##_CFG_VOLTAGE, \437437+ .volt_id = TPS80031_SLAVE_##_volt_id, \438438+ .preq_bit = _pbit, \439439+ .desc = { \440440+ .name = "tps80031_"#_id, \441441+ .id = TPS80031_REGULATOR_##_id, \442442+ .n_voltages = 63, \443443+ .ops = &tps80031_dcdc_ops, \444444+ .type = REGULATOR_VOLTAGE, \445445+ .owner = THIS_MODULE, \446446+ .enable_time = 500, \447447+ }, \448448+}449449+450450+#define TPS80031_REG_LDO(_id, _preq_bit) \451451+{ \452452+ .trans_reg = TPS80031_##_id##_CFG_TRANS, \453453+ .state_reg = TPS80031_##_id##_CFG_STATE, \454454+ .volt_reg = TPS80031_##_id##_CFG_VOLTAGE, \455455+ .volt_id = TPS80031_SLAVE_ID1, \456456+ .preq_bit = _preq_bit, \457457+ .desc = { \458458+ .owner = THIS_MODULE, \459459+ .name = "tps80031_"#_id, \460460+ .id = TPS80031_REGULATOR_##_id, \461461+ .ops = &tps80031_ldo_ops, \462462+ .type = REGULATOR_VOLTAGE, \463463+ .min_uV = 1000000, \464464+ .uV_step = 100000, \465465+ .n_voltages = 25, \466466+ .vsel_mask = LDO_VSEL_MASK, \467467+ .enable_time = 500, \468468+ }, \469469+}470470+471471+#define TPS80031_REG_FIXED(_id, max_mV, _ops, _delay, _pbit) \472472+{ \473473+ .trans_reg = TPS80031_##_id##_CFG_TRANS, \474474+ .state_reg = TPS80031_##_id##_CFG_STATE, \475475+ .volt_id = TPS80031_SLAVE_ID1, \476476+ .preq_bit = _pbit, \477477+ .desc = { \478478+ .name = "tps80031_"#_id, \479479+ .id = TPS80031_REGULATOR_##_id, \480480+ .n_voltages = 2, \481481+ .ops = &_ops, \482482+ .type = REGULATOR_VOLTAGE, \483483+ .owner = THIS_MODULE, \484484+ .enable_time = _delay, \485485+ }, \486486+}487487+488488+static struct tps80031_regulator_info tps80031_rinfo[TPS80031_REGULATOR_MAX] = {489489+ TPS80031_REG_SMPS(VIO, ID0, 4),490490+ TPS80031_REG_SMPS(SMPS1, ID0, 0),491491+ TPS80031_REG_SMPS(SMPS2, ID0, 1),492492+ TPS80031_REG_SMPS(SMPS3, ID1, 2),493493+ TPS80031_REG_SMPS(SMPS4, ID1, 3),494494+ TPS80031_REG_LDO(VANA, -1),495495+ TPS80031_REG_LDO(LDO1, 8),496496+ TPS80031_REG_LDO(LDO2, 9),497497+ TPS80031_REG_LDO(LDO3, 10),498498+ TPS80031_REG_LDO(LDO4, 11),499499+ TPS80031_REG_LDO(LDO5, 12),500500+ TPS80031_REG_LDO(LDO6, 13),501501+ TPS80031_REG_LDO(LDO7, 14),502502+ TPS80031_REG_LDO(LDOLN, 15),503503+ TPS80031_REG_LDO(LDOUSB, 5),504504+ TPS80031_REG_FIXED(VBUS, 5000, tps80031_vbus_hw_ops, 100000, -1),505505+ TPS80031_REG_FIXED(REGEN1, 3300, tps80031_ext_reg_ops, 0, 16),506506+ TPS80031_REG_FIXED(REGEN2, 3300, tps80031_ext_reg_ops, 0, 17),507507+ TPS80031_REG_FIXED(SYSEN, 3300, tps80031_ext_reg_ops, 0, 18),508508+};509509+510510+static int tps80031_power_req_config(struct device *parent,511511+ struct tps80031_regulator *ri,512512+ struct tps80031_regulator_platform_data *tps80031_pdata)513513+{514514+ int ret = 0;515515+516516+ if (ri->rinfo->preq_bit < 0)517517+ goto skip_pwr_req_config;518518+519519+ ret = tps80031_ext_power_req_config(parent, ri->ext_ctrl_flag,520520+ ri->rinfo->preq_bit, ri->rinfo->state_reg,521521+ ri->rinfo->trans_reg);522522+ if (ret < 0) {523523+ dev_err(ri->dev, "ext powerreq config failed, err = %d\n", ret);524524+ return ret;525525+ }526526+527527+skip_pwr_req_config:528528+ if (tps80031_pdata->ext_ctrl_flag & TPS80031_PWR_ON_ON_SLEEP) {529529+ ret = tps80031_update(parent, TPS80031_SLAVE_ID1,530530+ ri->rinfo->trans_reg, TPS80031_TRANS_SLEEP_ON,531531+ TPS80031_TRANS_SLEEP_MASK);532532+ if (ret < 0) {533533+ dev_err(ri->dev, "Reg 0x%02x update failed, e %d\n",534534+ ri->rinfo->trans_reg, ret);535535+ return ret;536536+ }537537+ }538538+ return ret;539539+}540540+541541+static int tps80031_regulator_config(struct device *parent,542542+ struct tps80031_regulator *ri,543543+ struct tps80031_regulator_platform_data *tps80031_pdata)544544+{545545+ int ret = 0;546546+547547+ switch (ri->rinfo->desc.id) {548548+ case TPS80031_REGULATOR_LDOUSB:549549+ if (ri->config_flags & (TPS80031_USBLDO_INPUT_VSYS |550550+ TPS80031_USBLDO_INPUT_PMID)) {551551+ unsigned val = 0;552552+ if (ri->config_flags & TPS80031_USBLDO_INPUT_VSYS)553553+ val = MISC2_LDOUSB_IN_VSYS;554554+ else555555+ val = MISC2_LDOUSB_IN_PMID;556556+557557+ ret = tps80031_update(parent, TPS80031_SLAVE_ID1,558558+ TPS80031_MISC2, val,559559+ MISC2_LDOUSB_IN_MASK);560560+ if (ret < 0) {561561+ dev_err(ri->dev,562562+ "LDOUSB config failed, e= %d\n", ret);563563+ return ret;564564+ }565565+ }566566+ break;567567+568568+ case TPS80031_REGULATOR_LDO3:569569+ if (ri->config_flags & TPS80031_LDO3_OUTPUT_VIB) {570570+ ret = tps80031_update(parent, TPS80031_SLAVE_ID1,571571+ TPS80031_MISC2, MISC2_LDO3_SEL_VIB_VAL,572572+ MISC2_LDO3_SEL_VIB_MASK);573573+ if (ret < 0) {574574+ dev_err(ri->dev,575575+ "LDO3 config failed, e = %d\n", ret);576576+ return ret;577577+ }578578+ }579579+ break;580580+581581+ case TPS80031_REGULATOR_VBUS:582582+ /* Provide SW control Ops if VBUS is SW control */583583+ if (!(ri->config_flags & TPS80031_VBUS_SW_ONLY))584584+ ri->rinfo->desc.ops = &tps80031_vbus_sw_ops;585585+ break;586586+ default:587587+ break;588588+ }589589+590590+ /* Configure Active state to ON, SLEEP to OFF and OFF_state to OFF */591591+ ret = tps80031_update(parent, TPS80031_SLAVE_ID1, ri->rinfo->trans_reg,592592+ TPS80031_TRANS_ACTIVE_ON | TPS80031_TRANS_SLEEP_OFF |593593+ TPS80031_TRANS_OFF_OFF, TPS80031_TRANS_ACTIVE_MASK |594594+ TPS80031_TRANS_SLEEP_MASK | TPS80031_TRANS_OFF_MASK);595595+ if (ret < 0) {596596+ dev_err(ri->dev, "trans reg update failed, e %d\n", ret);597597+ return ret;598598+ }599599+600600+ return ret;601601+}602602+603603+static int check_smps_mode_mult(struct device *parent,604604+ struct tps80031_regulator *ri)605605+{606606+ int mult_offset;607607+ int ret;608608+ u8 smps_offset;609609+ u8 smps_mult;610610+611611+ ret = tps80031_read(parent, TPS80031_SLAVE_ID1,612612+ TPS80031_SMPS_OFFSET, &smps_offset);613613+ if (ret < 0) {614614+ dev_err(parent, "Error in reading smps offset register\n");615615+ return ret;616616+ }617617+618618+ ret = tps80031_read(parent, TPS80031_SLAVE_ID1,619619+ TPS80031_SMPS_MULT, &smps_mult);620620+ if (ret < 0) {621621+ dev_err(parent, "Error in reading smps mult register\n");622622+ return ret;623623+ }624624+625625+ switch (ri->rinfo->desc.id) {626626+ case TPS80031_REGULATOR_VIO:627627+ mult_offset = SMPS_MULTOFFSET_VIO;628628+ break;629629+ case TPS80031_REGULATOR_SMPS1:630630+ mult_offset = SMPS_MULTOFFSET_SMPS1;631631+ break;632632+ case TPS80031_REGULATOR_SMPS2:633633+ mult_offset = SMPS_MULTOFFSET_SMPS2;634634+ break;635635+ case TPS80031_REGULATOR_SMPS3:636636+ mult_offset = SMPS_MULTOFFSET_SMPS3;637637+ break;638638+ case TPS80031_REGULATOR_SMPS4:639639+ mult_offset = SMPS_MULTOFFSET_SMPS4;640640+ break;641641+ case TPS80031_REGULATOR_LDO2:642642+ ri->device_flags = smps_mult & BIT(5) ? TRACK_MODE_ENABLE : 0;643643+ /* TRACK mode the ldo2 varies from 600mV to 1300mV */644644+ if (ri->device_flags & TRACK_MODE_ENABLE) {645645+ ri->rinfo->desc.min_uV = 600000;646646+ ri->rinfo->desc.uV_step = 12500;647647+ ri->rinfo->desc.n_voltages = 57;648648+ ri->rinfo->desc.vsel_mask = LDO_TRACK_VSEL_MASK;649649+ }650650+ return 0;651651+ default:652652+ return 0;653653+ }654654+655655+ ri->device_flags = (smps_offset & mult_offset) ? DCDC_OFFSET_EN : 0;656656+ ri->device_flags |= (smps_mult & mult_offset) ? DCDC_EXTENDED_EN : 0;657657+ switch (ri->device_flags) {658658+ case 0:659659+ ri->rinfo->desc.min_uV = 607700;660660+ ri->rinfo->desc.uV_step = 12660;661661+ break;662662+ case DCDC_OFFSET_EN:663663+ ri->rinfo->desc.min_uV = 700000;664664+ ri->rinfo->desc.uV_step = 12500;665665+ break;666666+ case DCDC_EXTENDED_EN:667667+ ri->rinfo->desc.min_uV = 1852000;668668+ ri->rinfo->desc.uV_step = 38600;669669+ break;670670+ case DCDC_OFFSET_EN | DCDC_EXTENDED_EN:671671+ ri->rinfo->desc.min_uV = 2161000;672672+ ri->rinfo->desc.uV_step = 38600;673673+ break;674674+ }675675+ return 0;676676+}677677+678678+static int __devinit tps80031_regulator_probe(struct platform_device *pdev)679679+{680680+ struct tps80031_platform_data *pdata;681681+ struct tps80031_regulator_platform_data *tps_pdata;682682+ struct tps80031_regulator_info *rinfo;683683+ struct tps80031_regulator *ri;684684+ struct tps80031_regulator *pmic;685685+ struct regulator_dev *rdev;686686+ struct regulator_config config = { };687687+ int ret;688688+ int num;689689+690690+ pdata = dev_get_platdata(pdev->dev.parent);691691+692692+ if (!pdata) {693693+ dev_err(&pdev->dev, "No platform data\n");694694+ return -EINVAL;695695+ }696696+697697+ pmic = devm_kzalloc(&pdev->dev,698698+ TPS80031_REGULATOR_MAX * sizeof(*pmic), GFP_KERNEL);699699+ if (!pmic) {700700+ dev_err(&pdev->dev, "mem alloc for pmic failed\n");701701+ return -ENOMEM;702702+ }703703+704704+ for (num = 0; num < TPS80031_REGULATOR_MAX; ++num) {705705+ tps_pdata = pdata->regulator_pdata[num];706706+ rinfo = &tps80031_rinfo[num];707707+ ri = &pmic[num];708708+ ri->rinfo = rinfo;709709+ ri->dev = &pdev->dev;710710+711711+ check_smps_mode_mult(pdev->dev.parent, ri);712712+ config.dev = &pdev->dev;713713+ config.init_data = NULL;714714+ config.driver_data = ri;715715+ if (tps_pdata) {716716+ config.init_data = tps_pdata->reg_init_data;717717+ ri->config_flags = tps_pdata->config_flags;718718+ ri->ext_ctrl_flag = tps_pdata->ext_ctrl_flag;719719+ ret = tps80031_regulator_config(pdev->dev.parent,720720+ ri, tps_pdata);721721+ if (ret < 0) {722722+ dev_err(&pdev->dev,723723+ "regulator config failed, e %d\n", ret);724724+ goto fail;725725+ }726726+727727+ ret = tps80031_power_req_config(pdev->dev.parent,728728+ ri, tps_pdata);729729+ if (ret < 0) {730730+ dev_err(&pdev->dev,731731+ "pwr_req config failed, err %d\n", ret);732732+ goto fail;733733+ }734734+ }735735+ rdev = regulator_register(&ri->rinfo->desc, &config);736736+ if (IS_ERR_OR_NULL(rdev)) {737737+ dev_err(&pdev->dev,738738+ "register regulator failed %s\n",739739+ ri->rinfo->desc.name);740740+ ret = PTR_ERR(rdev);741741+ goto fail;742742+ }743743+ ri->rdev = rdev;744744+ }745745+746746+ platform_set_drvdata(pdev, pmic);747747+ return 0;748748+fail:749749+ while (--num >= 0) {750750+ ri = &pmic[num];751751+ regulator_unregister(ri->rdev);752752+ }753753+ return ret;754754+}755755+756756+static int __devexit tps80031_regulator_remove(struct platform_device *pdev)757757+{758758+ struct tps80031_regulator *pmic = platform_get_drvdata(pdev);759759+ struct tps80031_regulator *ri = NULL;760760+ int num;761761+762762+ for (num = 0; num < TPS80031_REGULATOR_MAX; ++num) {763763+ ri = &pmic[num];764764+ regulator_unregister(ri->rdev);765765+ }766766+ return 0;767767+}768768+769769+static struct platform_driver tps80031_regulator_driver = {770770+ .driver = {771771+ .name = "tps80031-pmic",772772+ .owner = THIS_MODULE,773773+ },774774+ .probe = tps80031_regulator_probe,775775+ .remove = __devexit_p(tps80031_regulator_remove),776776+};777777+778778+static int __init tps80031_regulator_init(void)779779+{780780+ return platform_driver_register(&tps80031_regulator_driver);781781+}782782+subsys_initcall(tps80031_regulator_init);783783+784784+static void __exit tps80031_regulator_exit(void)785785+{786786+ platform_driver_unregister(&tps80031_regulator_driver);787787+}788788+module_exit(tps80031_regulator_exit);789789+790790+MODULE_ALIAS("platform:tps80031-regulator");791791+MODULE_DESCRIPTION("Regulator Driver for TI TPS80031 PMIC");792792+MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>");793793+MODULE_LICENSE("GPL v2");
+147
drivers/regulator/vexpress.c
···11+/*22+ * This program is free software; you can redistribute it and/or modify33+ * it under the terms of the GNU General Public License version 2 as44+ * published by the Free Software Foundation.55+ *66+ * This program is distributed in the hope that it will be useful,77+ * but WITHOUT ANY WARRANTY; without even the implied warranty of88+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the99+ * GNU General Public License for more details.1010+ *1111+ * Copyright (C) 2012 ARM Limited1212+ */1313+1414+#define DRVNAME "vexpress-regulator"1515+#define pr_fmt(fmt) DRVNAME ": " fmt1616+1717+#include <linux/device.h>1818+#include <linux/err.h>1919+#include <linux/module.h>2020+#include <linux/of_device.h>2121+#include <linux/regulator/driver.h>2222+#include <linux/regulator/machine.h>2323+#include <linux/regulator/of_regulator.h>2424+#include <linux/vexpress.h>2525+2626+struct vexpress_regulator {2727+ struct regulator_desc desc;2828+ struct regulator_dev *regdev;2929+ struct vexpress_config_func *func;3030+};3131+3232+static int vexpress_regulator_get_voltage(struct regulator_dev *regdev)3333+{3434+ struct vexpress_regulator *reg = rdev_get_drvdata(regdev);3535+ u32 uV;3636+ int err = vexpress_config_read(reg->func, 0, &uV);3737+3838+ return err ? err : uV;3939+}4040+4141+static int vexpress_regulator_set_voltage(struct regulator_dev *regdev,4242+ int min_uV, int max_uV, unsigned *selector)4343+{4444+ struct vexpress_regulator *reg = rdev_get_drvdata(regdev);4545+4646+ return vexpress_config_write(reg->func, 0, min_uV);4747+}4848+4949+static struct regulator_ops vexpress_regulator_ops_ro = {5050+ .get_voltage = vexpress_regulator_get_voltage,5151+};5252+5353+static struct regulator_ops vexpress_regulator_ops = {5454+ .get_voltage = vexpress_regulator_get_voltage,5555+ .set_voltage = vexpress_regulator_set_voltage,5656+};5757+5858+static int vexpress_regulator_probe(struct platform_device *pdev)5959+{6060+ int err;6161+ struct vexpress_regulator *reg;6262+ struct regulator_init_data *init_data;6363+ struct regulator_config config = { };6464+6565+ reg = devm_kzalloc(&pdev->dev, sizeof(*reg), GFP_KERNEL);6666+ if (!reg) {6767+ err = -ENOMEM;6868+ goto error_kzalloc;6969+ }7070+7171+ reg->func = vexpress_config_func_get_by_dev(&pdev->dev);7272+ if (!reg->func) {7373+ err = -ENXIO;7474+ goto error_get_func;7575+ }7676+7777+ reg->desc.name = dev_name(&pdev->dev);7878+ reg->desc.type = REGULATOR_VOLTAGE;7979+ reg->desc.owner = THIS_MODULE;8080+ reg->desc.continuous_voltage_range = true;8181+8282+ init_data = of_get_regulator_init_data(&pdev->dev, pdev->dev.of_node);8383+ if (!init_data) {8484+ err = -EINVAL;8585+ goto error_get_regulator_init_data;8686+ }8787+8888+ init_data->constraints.apply_uV = 0;8989+ if (init_data->constraints.min_uV && init_data->constraints.max_uV)9090+ reg->desc.ops = &vexpress_regulator_ops;9191+ else9292+ reg->desc.ops = &vexpress_regulator_ops_ro;9393+9494+ config.dev = &pdev->dev;9595+ config.init_data = init_data;9696+ config.driver_data = reg;9797+ config.of_node = pdev->dev.of_node;9898+9999+ reg->regdev = regulator_register(®->desc, &config);100100+ if (IS_ERR(reg->regdev)) {101101+ err = PTR_ERR(reg->regdev);102102+ goto error_regulator_register;103103+ }104104+105105+ platform_set_drvdata(pdev, reg);106106+107107+ return 0;108108+109109+error_regulator_register:110110+error_get_regulator_init_data:111111+ vexpress_config_func_put(reg->func);112112+error_get_func:113113+error_kzalloc:114114+ return err;115115+}116116+117117+static int __devexit vexpress_regulator_remove(struct platform_device *pdev)118118+{119119+ struct vexpress_regulator *reg = platform_get_drvdata(pdev);120120+121121+ vexpress_config_func_put(reg->func);122122+ regulator_unregister(reg->regdev);123123+124124+ return 0;125125+}126126+127127+static struct of_device_id vexpress_regulator_of_match[] = {128128+ { .compatible = "arm,vexpress-volt", },129129+ { }130130+};131131+132132+static struct platform_driver vexpress_regulator_driver = {133133+ .probe = vexpress_regulator_probe,134134+ .remove = __devexit_p(vexpress_regulator_remove),135135+ .driver = {136136+ .name = DRVNAME,137137+ .owner = THIS_MODULE,138138+ .of_match_table = vexpress_regulator_of_match,139139+ },140140+};141141+142142+module_platform_driver(vexpress_regulator_driver);143143+144144+MODULE_AUTHOR("Pawel Moll <pawel.moll@arm.com>");145145+MODULE_DESCRIPTION("Versatile Express regulator");146146+MODULE_LICENSE("GPL");147147+MODULE_ALIAS("platform:vexpress-regulator");
+35
include/linux/mfd/tps65090.h
···24242525#include <linux/irq.h>26262727+/* TPS65090 Regulator ID */2828+enum {2929+ TPS65090_REGULATOR_DCDC1,3030+ TPS65090_REGULATOR_DCDC2,3131+ TPS65090_REGULATOR_DCDC3,3232+ TPS65090_REGULATOR_FET1,3333+ TPS65090_REGULATOR_FET2,3434+ TPS65090_REGULATOR_FET3,3535+ TPS65090_REGULATOR_FET4,3636+ TPS65090_REGULATOR_FET5,3737+ TPS65090_REGULATOR_FET6,3838+ TPS65090_REGULATOR_FET7,3939+ TPS65090_REGULATOR_LDO1,4040+ TPS65090_REGULATOR_LDO2,4141+4242+ /* Last entry for maximum ID */4343+ TPS65090_REGULATOR_MAX,4444+};4545+2746struct tps65090 {2847 struct mutex lock;2948 struct device *dev;···6041 void *platform_data;6142};62434444+/*4545+ * struct tps65090_regulator_plat_data4646+ *4747+ * @reg_init_data: The regulator init data.4848+ * @enable_ext_control: Enable extrenal control or not. Only available for4949+ * DCDC1, DCDC2 and DCDC3.5050+ * @gpio: Gpio number if external control is enabled and controlled through5151+ * gpio.5252+ */5353+struct tps65090_regulator_plat_data {5454+ struct regulator_init_data *reg_init_data;5555+ bool enable_ext_control;5656+ int gpio;5757+};5858+6359struct tps65090_platform_data {6460 int irq_base;6561 int num_subdevs;6662 struct tps65090_subdev_info *subdevs;6363+ struct tps65090_regulator_plat_data *reg_pdata[TPS65090_REGULATOR_MAX];6764};68656966/*
+3
include/linux/regulator/driver.h
···181181 * @type: Indicates if the regulator is a voltage or current regulator.182182 * @owner: Module providing the regulator, used for refcounting.183183 *184184+ * @continuous_voltage_range: Indicates if the regulator can set any185185+ * voltage within constrains range.184186 * @n_voltages: Number of selectors available for ops.list_voltage().185187 *186188 * @min_uV: Voltage given by the lowest selector (if linear mapping)···201199 const char *name;202200 const char *supply_name;203201 int id;202202+ bool continuous_voltage_range;204203 unsigned n_voltages;205204 struct regulator_ops *ops;206205 int irq;
+47
include/linux/regulator/tps51632-regulator.h
···11+/*22+ * tps51632-regulator.h -- TPS51632 regulator33+ *44+ * Interface for regulator driver for TPS51632 3-2-1 Phase D-Cap Step Down55+ * Driverless Controller with serial VID control and DVFS.66+ *77+ * Copyright (C) 2012 NVIDIA Corporation88+99+ * Author: Laxman Dewangan <ldewangan@nvidia.com>1010+ *1111+ * This program is free software; you can redistribute it and/or modify1212+ * it under the terms of the GNU General Public License as published by1313+ * the Free Software Foundation; either version 2 of the License, or1414+ * (at your option) any later version.1515+ *1616+ * This program is distributed in the hope that it will be useful, but WITHOUT1717+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1818+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1919+ * more details.2020+ *2121+ * You should have received a copy of the GNU General Public License along2222+ * with this program; if not, write to the Free Software Foundation, Inc.,2323+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.2424+ *2525+ */2626+2727+#ifndef __LINUX_REGULATOR_TPS51632_H2828+#define __LINUX_REGULATOR_TPS51632_H2929+3030+/*3131+ * struct tps51632_regulator_platform_data - tps51632 regulator platform data.3232+ *3333+ * @reg_init_data: The regulator init data.3434+ * @enable_pwm_dvfs: Enable PWM DVFS or not.3535+ * @dvfs_step_20mV: Step for DVFS is 20mV or 10mV.3636+ * @max_voltage_uV: Maximum possible voltage in PWM-DVFS mode.3737+ * @base_voltage_uV: Base voltage when PWM-DVFS enabled.3838+ */3939+struct tps51632_regulator_platform_data {4040+ struct regulator_init_data *reg_init_data;4141+ bool enable_pwm_dvfs;4242+ bool dvfs_step_20mV;4343+ int max_voltage_uV;4444+ int base_voltage_uV;4545+};4646+4747+#endif /* __LINUX_REGULATOR_TPS51632_H */
-50
include/linux/regulator/tps65090-regulator.h
···11-/*22- * Regulator driver interface for TI TPS65090 PMIC family33- *44- * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.55-66- * This program is free software; you can redistribute it and/or modify it77- * under the terms and conditions of the GNU General Public License,88- * version 2, as published by the Free Software Foundation.99-1010- * This program is distributed in the hope it will be useful, but WITHOUT1111- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1212- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1313- * more details.1414-1515- * You should have received a copy of the GNU General Public License1616- * along with this program. If not, see <http://www.gnu.org/licenses/>.1717- */1818-1919-#ifndef __REGULATOR_TPS65090_H2020-#define __REGULATOR_TPS65090_H2121-2222-#include <linux/regulator/machine.h>2323-2424-#define tps65090_rails(_name) "tps65090_"#_name2525-2626-enum {2727- TPS65090_ID_DCDC1,2828- TPS65090_ID_DCDC2,2929- TPS65090_ID_DCDC3,3030- TPS65090_ID_FET1,3131- TPS65090_ID_FET2,3232- TPS65090_ID_FET3,3333- TPS65090_ID_FET4,3434- TPS65090_ID_FET5,3535- TPS65090_ID_FET6,3636- TPS65090_ID_FET7,3737-};3838-3939-/*4040- * struct tps65090_regulator_platform_data4141- *4242- * @regulator: The regulator init data.4343- * @slew_rate_uV_per_us: Slew rate microvolt per microsec.4444- */4545-4646-struct tps65090_regulator_platform_data {4747- struct regulator_init_data regulator;4848-};4949-5050-#endif /* __REGULATOR_TPS65090_H */