···349349350350 This will be one of the same strings reported by351351 the "state" attribute.352352+353353+What: /sys/class/regulator/.../bypass354354+Date: September 2012355355+KernelVersion: 3.7356356+Contact: Mark Brown <broonie@opensource.wolfsonmicro.com>357357+Description:358358+ Some regulator directories will contain a field called359359+ bypass. This indicates if the device is in bypass mode.360360+361361+ This will be one of the following strings:362362+363363+ 'enabled'364364+ 'disabled'365365+ 'unknown'366366+367367+ 'enabled' means the regulator is in bypass mode.368368+369369+ 'disabled' means that the regulator is regulating.370370+371371+ 'unknown' means software cannot determine the state, or372372+ the reported state is invalid.
···1111- regulator-boot-on: bootloader/firmware enabled regulator1212- <name>-supply: phandle to the parent supply/regulator node1313- regulator-ramp-delay: ramp delay for regulator(in uV/uS)1414+1515+Deprecated properties:1416- regulator-compatible: If a regulator chip contains multiple1517 regulators, and if the chip's binding contains a child node that1618 describes each regulator, then this property indicates which regulator1717- this child node is intended to configure.1919+ this child node is intended to configure. If this property is missing,2020+ the node's name will be used instead.18211922Example:2023
···434434 regmap_update_bits(arizona->regmap, ARIZONA_JACK_DETECT_ANALOGUE,435435 ARIZONA_JD1_ENA, ARIZONA_JD1_ENA);436436437437+ ret = regulator_allow_bypass(info->micvdd, true);438438+ if (ret != 0)439439+ dev_warn(arizona->dev, "Failed to set MICVDD to bypass: %d\n",440440+ ret);441441+437442 pm_runtime_put(&pdev->dev);438443439444 return 0;
···3333 help3434 If this option is enabled then when a regulator lookup fails3535 and the board has not specified that it has provided full3636- constraints then the regulator core will provide an always3737- enabled dummy regulator will be provided, allowing consumer3838- drivers to continue.3636+ constraints the regulator core will provide an always3737+ enabled dummy regulator, allowing consumer drivers to continue.39384039 A warning will be generated when this substitution is done.4140···4950 tristate "Virtual regulator consumer support"5051 help5152 This driver provides a virtual consumer for the voltage and5252- current regulator API which provides sysfs controls for5353- configuring the supplies requested. This is mainly useful5454- for test purposes.5353+ current regulator API which provides sysfs controls for5454+ configuring the supplies requested. This is mainly useful5555+ for test purposes.55565656- If unsure, say no.5757+ If unsure, say no.57585859config REGULATOR_USERSPACE_CONSUMER5960 tristate "Userspace regulator consumer support"···6263 from user space. Userspace consumer driver provides ability to6364 control power supplies for such devices.64656565- If unsure, say no.6666+ If unsure, say no.66676768config REGULATOR_GPIO6869 tristate "GPIO regulator support"···108109 help109110 This driver supports the voltage regulators of DA9052-BC and110111 DA9053-AA/Bx PMIC.112112+113113+config REGULATOR_FAN53555114114+ tristate "Fairchild FAN53555 Regulator"115115+ depends on I2C116116+ select REGMAP_I2C117117+ help118118+ This driver supports Fairchild FAN53555 Digitally Programmable119119+ TinyBuck Regulator. The FAN53555 is a step-down switching voltage120120+ regulator that delivers a digitally programmable output from an121121+ input voltage supply of 2.5V to 5.5V. The output voltage is122122+ programmed through an I2C interface.111123112124config REGULATOR_ANATOP113125 tristate "Freescale i.MX on-chip ANATOP LDO regulators"···181171 help182172 This driver controls a Maxim 8660/8661 voltage output183173 regulator via I2C bus.174174+175175+config REGULATOR_MAX8907176176+ tristate "Maxim 8907 voltage regulator"177177+ depends on MFD_MAX8907178178+ help179179+ This driver controls a Maxim 8907 voltage output regulator180180+ via I2C bus. The provided regulator is suitable for Tegra181181+ chip to control Step-Down DC-DC and LDOs.184182185183config REGULATOR_MAX8925186184 tristate "Maxim MAX8925 Power Management IC"···265247266248config REGULATOR_PCF50633267249 tristate "NXP PCF50633 regulator driver"268268- depends on MFD_PCF50633250250+ depends on MFD_PCF50633269251 help270252 Say Y here to support the voltage regulators and convertors271253 on PCF50633···434416 depends on MFD_WM8350435417 help436418 This driver provides support for the voltage and current regulators437437- of the WM8350 AudioPlus PMIC.419419+ of the WM8350 AudioPlus PMIC.438420439421config REGULATOR_WM8400440422 tristate "Wolfson Microelectronics WM8400 AudioPlus PMIC"
···34343535extern int mc13xxx_fixed_regulator_set_voltage(struct regulator_dev *rdev,3636 int min_uV, int max_uV, unsigned *selector);3737-extern int mc13xxx_fixed_regulator_get_voltage(struct regulator_dev *rdev);38373938#ifdef CONFIG_OF4039extern int mc13xxx_get_num_regulators_dt(struct platform_device *pdev);
+12-13
drivers/regulator/of_regulator.c
···9292EXPORT_SYMBOL_GPL(of_get_regulator_init_data);93939494/**9595- * of_regulator_match - extract regulator init data when node9696- * property "regulator-compatible" matches with the regulator name.9595+ * of_regulator_match - extract multiple regulator init data from device tree.9796 * @dev: device requesting the data9897 * @node: parent device node of the regulators9998 * @matches: match table for the regulators10099 * @num_matches: number of entries in match table101100 *102102- * This function uses a match table specified by the regulator driver and103103- * looks up the corresponding init data in the device tree if104104- * regulator-compatible matches. Note that the match table is modified101101+ * This function uses a match table specified by the regulator driver to102102+ * parse regulator init data from the device tree. @node is expected to103103+ * contain a set of child nodes, each providing the init data for one104104+ * regulator. The data parsed from a child node will be matched to a regulator105105+ * based on either the deprecated property regulator-compatible if present,106106+ * or otherwise the child node's name. Note that the match table is modified105107 * in place.106108 *107109 * Returns the number of matches found or a negative error code on failure.···114112{115113 unsigned int count = 0;116114 unsigned int i;117117- const char *regulator_comp;115115+ const char *name;118116 struct device_node *child;119117120118 if (!dev || !node)121119 return -EINVAL;122120123121 for_each_child_of_node(node, child) {124124- regulator_comp = of_get_property(child,122122+ name = of_get_property(child,125123 "regulator-compatible", NULL);126126- if (!regulator_comp) {127127- dev_err(dev, "regulator-compatible is missing for node %s\n",128128- child->name);129129- continue;130130- }124124+ if (!name)125125+ name = child->name;131126 for (i = 0; i < num_matches; i++) {132127 struct of_regulator_match *match = &matches[i];133128 if (match->of_node)134129 continue;135130136136- if (strcmp(match->name, regulator_comp))131131+ if (strcmp(match->name, name))137132 continue;138133139134 match->init_data =
+5-40
drivers/regulator/palmas-regulator.c
···443443 return 850000 + (selector * 50000);444444}445445446446-static int palmas_get_voltage_ldo_sel(struct regulator_dev *dev)447447-{448448- struct palmas_pmic *pmic = rdev_get_drvdata(dev);449449- int id = rdev_get_id(dev);450450- int selector;451451- unsigned int reg;452452- unsigned int addr;453453-454454- addr = palmas_regs_info[id].vsel_addr;455455-456456- palmas_ldo_read(pmic->palmas, addr, ®);457457-458458- selector = reg & PALMAS_LDO1_VOLTAGE_VSEL_MASK;459459-460460- /* Adjust selector to match list_voltage ranges */461461- if (selector > 49)462462- selector = 49;463463-464464- return selector;465465-}466466-467467-static int palmas_set_voltage_ldo_sel(struct regulator_dev *dev,468468- unsigned selector)469469-{470470- struct palmas_pmic *pmic = rdev_get_drvdata(dev);471471- int id = rdev_get_id(dev);472472- unsigned int reg = 0;473473- unsigned int addr;474474-475475- addr = palmas_regs_info[id].vsel_addr;476476-477477- reg = selector;478478-479479- palmas_ldo_write(pmic->palmas, addr, reg);480480-481481- return 0;482482-}483483-484446static int palmas_map_voltage_ldo(struct regulator_dev *rdev,485447 int min_uV, int max_uV)486448{···467505 .is_enabled = palmas_is_enabled_ldo,468506 .enable = regulator_enable_regmap,469507 .disable = regulator_disable_regmap,470470- .get_voltage_sel = palmas_get_voltage_ldo_sel,471471- .set_voltage_sel = palmas_set_voltage_ldo_sel,508508+ .get_voltage_sel = regulator_get_voltage_sel_regmap,509509+ .set_voltage_sel = regulator_set_voltage_sel_regmap,472510 .list_voltage = palmas_list_voltage_ldo,473511 .map_voltage = palmas_map_voltage_ldo,474512};···719757720758 pmic->desc[id].type = REGULATOR_VOLTAGE;721759 pmic->desc[id].owner = THIS_MODULE;760760+ pmic->desc[id].vsel_reg = PALMAS_BASE_TO_REG(PALMAS_LDO_BASE,761761+ palmas_regs_info[id].vsel_addr);762762+ pmic->desc[id].vsel_mask = PALMAS_LDO1_VOLTAGE_VSEL_MASK;722763 pmic->desc[id].enable_reg = PALMAS_BASE_TO_REG(PALMAS_LDO_BASE,723764 palmas_regs_info[id].ctrl_addr);724765 pmic->desc[id].enable_mask = PALMAS_LDO1_CTRL_MODE_ACTIVE;
+8-19
drivers/regulator/s2mps11.c
···2424#include <linux/mfd/samsung/s2mps11.h>25252626struct s2mps11_info {2727- struct regulator_dev **rdev;2727+ struct regulator_dev *rdev[S2MPS11_REGULATOR_MAX];28282929 int ramp_delay2;3030 int ramp_delay34;···236236 struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);237237 struct sec_platform_data *pdata = dev_get_platdata(iodev->dev);238238 struct regulator_config config = { };239239- struct regulator_dev **rdev;240239 struct s2mps11_info *s2mps11;241241- int i, ret, size;240240+ int i, ret;242241 unsigned char ramp_enable, ramp_reg = 0;243242244243 if (!pdata) {···250251 if (!s2mps11)251252 return -ENOMEM;252253253253- size = sizeof(struct regulator_dev *) * S2MPS11_REGULATOR_MAX;254254- s2mps11->rdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);255255- if (!s2mps11->rdev) {256256- return -ENOMEM;257257- }258258-259259- rdev = s2mps11->rdev;260254 platform_set_drvdata(pdev, s2mps11);261255262256 s2mps11->ramp_delay2 = pdata->buck2_ramp_delay;···289297 config.init_data = pdata->regulators[i].initdata;290298 config.driver_data = s2mps11;291299292292- rdev[i] = regulator_register(®ulators[i], &config);293293- if (IS_ERR(rdev[i])) {294294- ret = PTR_ERR(rdev[i]);300300+ s2mps11->rdev[i] = regulator_register(®ulators[i], &config);301301+ if (IS_ERR(s2mps11->rdev[i])) {302302+ ret = PTR_ERR(s2mps11->rdev[i]);295303 dev_err(&pdev->dev, "regulator init failed for %d\n",296304 i);297297- rdev[i] = NULL;305305+ s2mps11->rdev[i] = NULL;298306 goto err;299307 }300308 }···302310 return 0;303311err:304312 for (i = 0; i < S2MPS11_REGULATOR_MAX; i++)305305- if (rdev[i])306306- regulator_unregister(rdev[i]);313313+ regulator_unregister(s2mps11->rdev[i]);307314308315 return ret;309316}···310319static int __devexit s2mps11_pmic_remove(struct platform_device *pdev)311320{312321 struct s2mps11_info *s2mps11 = platform_get_drvdata(pdev);313313- struct regulator_dev **rdev = s2mps11->rdev;314322 int i;315323316324 for (i = 0; i < S2MPS11_REGULATOR_MAX; i++)317317- if (rdev[i])318318- regulator_unregister(rdev[i]);325325+ regulator_unregister(s2mps11->rdev[i]);319326320327 return 0;321328}
+4-6
drivers/regulator/tps6524x-regulator.c
···502502 if (info->n_ilimsels == 1)503503 return -EINVAL;504504505505- for (i = 0; i < info->n_ilimsels; i++)505505+ for (i = info->n_ilimsels - 1; i >= 0; i--) {506506 if (min_uA <= info->ilimsels[i] &&507507 max_uA >= info->ilimsels[i])508508- break;508508+ return write_field(hw, &info->ilimsel, i);509509+ }509510510510- if (i >= info->n_ilimsels)511511- return -EINVAL;512512-513513- return write_field(hw, &info->ilimsel, i);511511+ return -EINVAL;514512}515513516514static int get_current_limit(struct regulator_dev *rdev)
···339339 u16 reg = dcdc->base + WM831X_DCDC_CONTROL_2;340340 int i;341341342342- for (i = 0; i < ARRAY_SIZE(wm831x_dcdc_ilim); i++) {342342+ for (i = ARRAY_SIZE(wm831x_dcdc_ilim) - 1; i >= 0; i--) {343343 if ((min_uA <= wm831x_dcdc_ilim[i]) &&344344 (wm831x_dcdc_ilim[i] <= max_uA))345345- break;345345+ return wm831x_set_bits(wm831x, reg,346346+ WM831X_DC1_HC_THR_MASK,347347+ i << WM831X_DC1_HC_THR_SHIFT);346348 }347347- if (i == ARRAY_SIZE(wm831x_dcdc_ilim))348348- return -EINVAL;349349350350- return wm831x_set_bits(wm831x, reg, WM831X_DC1_HC_THR_MASK,351351- i << WM831X_DC1_HC_THR_SHIFT);350350+ return -EINVAL;352351}353352354353static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev)
+12
drivers/regulator/wm831x-ldo.c
···205205206206 /* Is it reporting under voltage? */207207 ret = wm831x_reg_read(wm831x, WM831X_LDO_UV_STATUS);208208+ if (ret < 0)209209+ return ret;208210 if (ret & mask)209211 return REGULATOR_STATUS_ERROR;210212···239237 .set_mode = wm831x_gp_ldo_set_mode,240238 .get_status = wm831x_gp_ldo_get_status,241239 .get_optimum_mode = wm831x_gp_ldo_get_optimum_mode,240240+ .get_bypass = regulator_get_bypass_regmap,241241+ .set_bypass = regulator_set_bypass_regmap,242242243243 .is_enabled = regulator_is_enabled_regmap,244244 .enable = regulator_enable_regmap,···297293 ldo->desc.vsel_mask = WM831X_LDO1_ON_VSEL_MASK;298294 ldo->desc.enable_reg = WM831X_LDO_ENABLE;299295 ldo->desc.enable_mask = 1 << id;296296+ ldo->desc.bypass_reg = ldo->base;297297+ ldo->desc.bypass_mask = WM831X_LDO1_SWI;300298301299 config.dev = pdev->dev.parent;302300 if (pdata)···475469476470 /* Is it reporting under voltage? */477471 ret = wm831x_reg_read(wm831x, WM831X_LDO_UV_STATUS);472472+ if (ret < 0)473473+ return ret;478474 if (ret & mask)479475 return REGULATOR_STATUS_ERROR;480476···496488 .get_mode = wm831x_aldo_get_mode,497489 .set_mode = wm831x_aldo_set_mode,498490 .get_status = wm831x_aldo_get_status,491491+ .set_bypass = regulator_set_bypass_regmap,492492+ .get_bypass = regulator_get_bypass_regmap,499493500494 .is_enabled = regulator_is_enabled_regmap,501495 .enable = regulator_enable_regmap,···554544 ldo->desc.vsel_mask = WM831X_LDO7_ON_VSEL_MASK;555545 ldo->desc.enable_reg = WM831X_LDO_ENABLE;556546 ldo->desc.enable_mask = 1 << id;547547+ ldo->desc.bypass_reg = ldo->base;548548+ ldo->desc.bypass_mask = WM831X_LDO7_SWI;557549558550 config.dev = pdev->dev.parent;559551 if (pdata)
···177177unsigned int regulator_get_mode(struct regulator *regulator);178178int regulator_set_optimum_mode(struct regulator *regulator, int load_uA);179179180180+int regulator_allow_bypass(struct regulator *regulator, bool allow);181181+180182/* regulator notifier block */181183int regulator_register_notifier(struct regulator *regulator,182184 struct notifier_block *nb);···330328 return REGULATOR_MODE_NORMAL;331329}332330331331+static inline int regulator_allow_bypass(struct regulator *regulator,332332+ bool allow)333333+{334334+ return 0;335335+}336336+333337static inline int regulator_register_notifier(struct regulator *regulator,334338 struct notifier_block *nb)335339{···359351}360352361353#endif354354+355355+static inline int regulator_set_voltage_tol(struct regulator *regulator,356356+ int new_uV, int tol_uV)357357+{358358+ return regulator_set_voltage(regulator,359359+ new_uV - tol_uV, new_uV + tol_uV);360360+}362361363362#endif
+17-1
include/linux/regulator/driver.h
···3232 REGULATOR_STATUS_NORMAL,3333 REGULATOR_STATUS_IDLE,3434 REGULATOR_STATUS_STANDBY,3535+ /* The regulator is enabled but not regulating */3636+ REGULATOR_STATUS_BYPASS,3537 /* in case that any other status doesn't apply */3638 REGULATOR_STATUS_UNDEFINED,3739};···6058 * regulator_desc.n_voltages. Voltages may be reported in any order.6159 *6260 * @set_current_limit: Configure a limit for a current-limited regulator.6161+ * The driver should select the current closest to max_uA.6362 * @get_current_limit: Get the configured limit for a current-limited regulator.6463 *6564 * @set_mode: Set the configured operating mode for the regulator.···6966 * REGULATOR_STATUS value (or negative errno)7067 * @get_optimum_mode: Get the most efficient operating mode for the regulator7168 * when running with the specified parameters.6969+ *7070+ * @set_bypass: Set the regulator in bypass mode.7171+ * @get_bypass: Get the regulator bypass mode state.7272 *7373 * @enable_time: Time taken for the regulator voltage output voltage to7474 * stabilise after being enabled, in microseconds.···138132 /* get most efficient regulator operating mode for load */139133 unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV,140134 int output_uV, int load_uA);135135+136136+ /* control and report on bypass mode */137137+ int (*set_bypass)(struct regulator_dev *dev, bool enable);138138+ int (*get_bypass)(struct regulator_dev *dev, bool *enable);141139142140 /* the operations below are for configuration of regulator state when143141 * its parent PMIC enters a global STANDBY/HIBERNATE state */···215205 unsigned int vsel_mask;216206 unsigned int enable_reg;217207 unsigned int enable_mask;208208+ unsigned int bypass_reg;209209+ unsigned int bypass_mask;218210219211 unsigned int enable_time;220212};···233221 * @driver_data: private regulator data234222 * @of_node: OpenFirmware node to parse for device tree bindings (may be235223 * NULL).236236- * @regmap: regmap to use for core regmap helpers224224+ * @regmap: regmap to use for core regmap helpers if dev_get_regulator() is225225+ * insufficient.237226 * @ena_gpio: GPIO controlling regulator enable.238227 * @ena_gpio_invert: Sense for GPIO enable control.239228 * @ena_gpio_flags: Flags to use when calling gpio_request_one()···266253 int exclusive;267254 u32 use_count;268255 u32 open_count;256256+ u32 bypass_count;269257270258 /* lists we belong to */271259 struct list_head list; /* list of all regulators */···324310int regulator_set_voltage_time_sel(struct regulator_dev *rdev,325311 unsigned int old_selector,326312 unsigned int new_selector);313313+int regulator_set_bypass_regmap(struct regulator_dev *rdev, bool enable);314314+int regulator_get_bypass_regmap(struct regulator_dev *rdev, bool *enable);327315328316void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);329317
+60
include/linux/regulator/fan53555.h
···11+/*22+ * fan53555.h - Fairchild Regulator FAN53555 Driver33+ *44+ * Copyright (C) 2012 Marvell Technology Ltd.55+ * Yunfan Zhang <yfzhang@marvell.com>66+ *77+ * This package is free software; you can redistribute it and/or modify88+ * it under the terms of the GNU General Public License version 2 as99+ * published by the Free Software Foundation.1010+ *1111+ */1212+1313+#ifndef __FAN53555_H__1414+1515+/* VSEL ID */1616+enum {1717+ FAN53555_VSEL_ID_0 = 0,1818+ FAN53555_VSEL_ID_1,1919+};2020+2121+/* Transition slew rate limiting from a low to high voltage.2222+ * -----------------------2323+ * Bin |Slew Rate(mV/uS)2424+ * ------|----------------2525+ * 000 | 64.002626+ * ------|----------------2727+ * 001 | 32.002828+ * ------|----------------2929+ * 010 | 16.003030+ * ------|----------------3131+ * 011 | 8.003232+ * ------|----------------3333+ * 100 | 4.003434+ * ------|----------------3535+ * 101 | 2.003636+ * ------|----------------3737+ * 110 | 1.003838+ * ------|----------------3939+ * 111 | 0.504040+ * -----------------------4141+ */4242+enum {4343+ FAN53555_SLEW_RATE_64MV = 0,4444+ FAN53555_SLEW_RATE_32MV,4545+ FAN53555_SLEW_RATE_16MV,4646+ FAN53555_SLEW_RATE_8MV,4747+ FAN53555_SLEW_RATE_4MV,4848+ FAN53555_SLEW_RATE_2MV,4949+ FAN53555_SLEW_RATE_1MV,5050+ FAN53555_SLEW_RATE_0_5MV,5151+};5252+5353+struct fan53555_platform_data {5454+ struct regulator_init_data *regulator;5555+ unsigned int slew_rate;5656+ /* Sleep VSEL ID */5757+ unsigned int sleep_vsel_id;5858+};5959+6060+#endif /* __FAN53555_H__ */
+2
include/linux/regulator/machine.h
···3232 * board/machine.3333 * STATUS: Regulator can be enabled and disabled.3434 * DRMS: Dynamic Regulator Mode Switching is enabled for this regulator.3535+ * BYPASS: Regulator can be put into bypass mode3536 */36373738#define REGULATOR_CHANGE_VOLTAGE 0x1···4039#define REGULATOR_CHANGE_MODE 0x44140#define REGULATOR_CHANGE_STATUS 0x84241#define REGULATOR_CHANGE_DRMS 0x104242+#define REGULATOR_CHANGE_BYPASS 0x2043434444/**4545 * struct regulator_state - regulator state during low power system states