···11* Powerventure Semiconductor PV88080 Voltage Regulator2233Required properties:44-- compatible: "pvs,pv88080".55-- reg: I2C slave address, usually 0x49.44+- compatible: Must be one of the following, depending on the55+ silicon version:66+ - "pvs,pv88080" (DEPRECATED)77+88+ - "pvs,pv88080-aa" for PV88080 AA or AB silicon99+ - "pvs,pv88080-ba" for PV88080 BA or BB silicon1010+ NOTE: The use of the compatibles with no silicon version is deprecated.1111+- reg: I2C slave address, usually 0x49612- interrupts: the interrupt outputs of the controller713- regulators: A node that houses a sub-node for each regulator within the814 device. Each sub-node is identified using the node's name, with valid915 values listed below. The content of each sub-node is defined by the1016 standard binding for regulators; see regulator.txt.1111- BUCK1, BUCK2, and BUCK3.1717+ BUCK1, BUCK2, BUCK3 and HVBUCK.12181319Optional properties:1420- Any optional property defined in regulator.txt15211616-Example2222+Example:17231824 pmic: pv88080@49 {1919- compatible = "pvs,pv88080";2525+ compatible = "pvs,pv88080-ba";2026 reg = <0x49>;2127 interrupt-parent = <&gpio>;2228 interrupts = <24 24>;···5145 regulator-min-microamp = <1496000>;5246 regulator-max-microamp = <4189000>;5347 };4848+4949+ HVBUCK {5050+ regulator-name = "hvbuck";5151+ regulator-min-microvolt = < 5000>;5252+ regulator-max-microvolt = <1275000>;5353+ };5454 };5555 };5656+
···1313- regulator-allow-bypass: allow the regulator to go into bypass mode1414- regulator-allow-set-load: allow the regulator performance level to be configured1515- <name>-supply: phandle to the parent supply/regulator node1616-- regulator-ramp-delay: ramp delay for regulator(in uV/uS)1616+- regulator-ramp-delay: ramp delay for regulator(in uV/us)1717 For hardware which supports disabling ramp rate, it should be explicitly1818 initialised to zero (regulator-ramp-delay = <0>) for disabling ramp delay.1919- regulator-enable-ramp-delay: The time taken, in microseconds, for the supply
+9
drivers/mfd/tps65218.c
···219219 struct tps65218 *tps;220220 const struct of_device_id *match;221221 int ret;222222+ unsigned int chipid;222223223224 match = of_match_device(of_tps65218_match_table, &client->dev);224225 if (!match) {···250249 &tps->irq_data);251250 if (ret < 0)252251 return ret;252252+253253+ ret = tps65218_reg_read(tps, TPS65218_REG_CHIPID, &chipid);254254+ if (ret) {255255+ dev_err(tps->dev, "Failed to read chipid: %d\n", ret);256256+ return ret;257257+ }258258+259259+ tps->rev = chipid & TPS65218_CHIPID_REV_MASK;253260254261 ret = of_platform_populate(client->dev.of_node, NULL, NULL,255262 &client->dev);
+73-41
drivers/regulator/core.c
···27432743 return ret;27442744}2745274527462746+static int _regulator_set_voltage_time(struct regulator_dev *rdev,27472747+ int old_uV, int new_uV)27482748+{27492749+ unsigned int ramp_delay = 0;27502750+27512751+ if (rdev->constraints->ramp_delay)27522752+ ramp_delay = rdev->constraints->ramp_delay;27532753+ else if (rdev->desc->ramp_delay)27542754+ ramp_delay = rdev->desc->ramp_delay;27552755+27562756+ if (ramp_delay == 0) {27572757+ rdev_warn(rdev, "ramp_delay not set\n");27582758+ return 0;27592759+ }27602760+27612761+ return DIV_ROUND_UP(abs(new_uV - old_uV), ramp_delay);27622762+}27632763+27462764static int _regulator_do_set_voltage(struct regulator_dev *rdev,27472765 int min_uV, int max_uV)27482766{···27692751 int best_val = 0;27702752 unsigned int selector;27712753 int old_selector = -1;27542754+ const struct regulator_ops *ops = rdev->desc->ops;27552755+ int old_uV = _regulator_get_voltage(rdev);2772275627732757 trace_regulator_set_voltage(rdev_get_name(rdev), min_uV, max_uV);27742758···27822762 * info to call set_voltage_time_sel().27832763 */27842764 if (_regulator_is_enabled(rdev) &&27852785- rdev->desc->ops->set_voltage_time_sel &&27862786- rdev->desc->ops->get_voltage_sel) {27872787- old_selector = rdev->desc->ops->get_voltage_sel(rdev);27652765+ ops->set_voltage_time_sel && ops->get_voltage_sel) {27662766+ old_selector = ops->get_voltage_sel(rdev);27882767 if (old_selector < 0)27892768 return old_selector;27902769 }2791277027922792- if (rdev->desc->ops->set_voltage) {27712771+ if (ops->set_voltage) {27932772 ret = _regulator_call_set_voltage(rdev, min_uV, max_uV,27942773 &selector);2795277427962775 if (ret >= 0) {27972797- if (rdev->desc->ops->list_voltage)27982798- best_val = rdev->desc->ops->list_voltage(rdev,27992799- selector);27762776+ if (ops->list_voltage)27772777+ best_val = ops->list_voltage(rdev,27782778+ selector);28002779 else28012780 best_val = _regulator_get_voltage(rdev);28022781 }2803278228042804- } else if (rdev->desc->ops->set_voltage_sel) {27832783+ } else if (ops->set_voltage_sel) {28052784 ret = regulator_map_voltage(rdev, min_uV, max_uV);28062785 if (ret >= 0) {28072807- best_val = rdev->desc->ops->list_voltage(rdev, ret);27862786+ best_val = ops->list_voltage(rdev, ret);28082787 if (min_uV <= best_val && max_uV >= best_val) {28092788 selector = ret;28102789 if (old_selector == selector)···28192800 ret = -EINVAL;28202801 }2821280228222822- /* Call set_voltage_time_sel if successfully obtained old_selector */28232823- if (ret == 0 && !rdev->constraints->ramp_disable && old_selector >= 028242824- && old_selector != selector) {28032803+ if (ret)28042804+ goto out;2825280528262826- delay = rdev->desc->ops->set_voltage_time_sel(rdev,28272827- old_selector, selector);28282828- if (delay < 0) {28292829- rdev_warn(rdev, "set_voltage_time_sel() failed: %d\n",28302830- delay);28312831- delay = 0;28322832- }28332833-28342834- /* Insert any necessary delays */28352835- if (delay >= 1000) {28362836- mdelay(delay / 1000);28372837- udelay(delay % 1000);28382838- } else if (delay) {28392839- udelay(delay);28062806+ if (ops->set_voltage_time_sel) {28072807+ /*28082808+ * Call set_voltage_time_sel if successfully obtained28092809+ * old_selector28102810+ */28112811+ if (old_selector >= 0 && old_selector != selector)28122812+ delay = ops->set_voltage_time_sel(rdev, old_selector,28132813+ selector);28142814+ } else {28152815+ if (old_uV != best_val) {28162816+ if (ops->set_voltage_time)28172817+ delay = ops->set_voltage_time(rdev, old_uV,28182818+ best_val);28192819+ else28202820+ delay = _regulator_set_voltage_time(rdev,28212821+ old_uV,28222822+ best_val);28402823 }28412824 }2842282528432843- if (ret == 0 && best_val >= 0) {28262826+ if (delay < 0) {28272827+ rdev_warn(rdev, "failed to get delay: %d\n", delay);28282828+ delay = 0;28292829+ }28302830+28312831+ /* Insert any necessary delays */28322832+ if (delay >= 1000) {28332833+ mdelay(delay / 1000);28342834+ udelay(delay % 1000);28352835+ } else if (delay) {28362836+ udelay(delay);28372837+ }28382838+28392839+ if (best_val >= 0) {28442840 unsigned long data = best_val;2845284128462842 _notifier_call_chain(rdev, REGULATOR_EVENT_VOLTAGE_CHANGE,28472843 (void *)data);28482844 }2849284528462846+out:28502847 trace_regulator_set_voltage_complete(rdev_get_name(rdev), best_val);2851284828522849 return ret;···30332998 int voltage;30342999 int i;3035300030013001+ if (ops->set_voltage_time)30023002+ return ops->set_voltage_time(rdev, old_uV, new_uV);30033003+ else if (!ops->set_voltage_time_sel)30043004+ return _regulator_set_voltage_time(rdev, old_uV, new_uV);30053005+30363006 /* Currently requires operations to do this */30373037- if (!ops->list_voltage || !ops->set_voltage_time_sel30383038- || !rdev->desc->n_voltages)30073007+ if (!ops->list_voltage || !rdev->desc->n_voltages)30393008 return -EINVAL;3040300930413010 for (i = 0; i < rdev->desc->n_voltages; i++) {···30783039 unsigned int old_selector,30793040 unsigned int new_selector)30803041{30813081- unsigned int ramp_delay = 0;30823042 int old_volt, new_volt;30833083-30843084- if (rdev->constraints->ramp_delay)30853085- ramp_delay = rdev->constraints->ramp_delay;30863086- else if (rdev->desc->ramp_delay)30873087- ramp_delay = rdev->desc->ramp_delay;30883088-30893089- if (ramp_delay == 0) {30903090- rdev_warn(rdev, "ramp_delay not set\n");30913091- return 0;30923092- }3093304330943044 /* sanity check */30953045 if (!rdev->desc->ops->list_voltage)···30873059 old_volt = rdev->desc->ops->list_voltage(rdev, old_selector);30883060 new_volt = rdev->desc->ops->list_voltage(rdev, new_selector);3089306130903090- return DIV_ROUND_UP(abs(new_volt - old_volt), ramp_delay);30623062+ if (rdev->desc->ops->set_voltage_time)30633063+ return rdev->desc->ops->set_voltage_time(rdev, old_volt,30643064+ new_volt);30653065+ else30663066+ return _regulator_set_voltage_time(rdev, old_volt, new_volt);30913067}30923068EXPORT_SYMBOL_GPL(regulator_set_voltage_time_sel);30933069
···1010 * published by the Free Software Foundation.1111 */12121313-#include <linux/delay.h>1413#include <linux/module.h>1514#include <linux/init.h>1615#include <linux/err.h>···193194 unsigned int min_uV_duty = drvdata->continuous.min_uV_dutycycle;194195 unsigned int max_uV_duty = drvdata->continuous.max_uV_dutycycle;195196 unsigned int duty_unit = drvdata->continuous.dutycycle_unit;196196- unsigned int ramp_delay = rdev->constraints->ramp_delay;197197 int min_uV = rdev->constraints->min_uV;198198 int max_uV = rdev->constraints->max_uV;199199 int diff_uV = max_uV - min_uV;200200 struct pwm_state pstate;201201- int old_uV = pwm_regulator_get_voltage(rdev);202201 unsigned int diff_duty;203202 unsigned int dutycycle;204203 int ret;···229232 dev_err(&rdev->dev, "Failed to configure PWM: %d\n", ret);230233 return ret;231234 }232232-233233- if ((ramp_delay == 0) || !pwm_regulator_is_enabled(rdev))234234- return 0;235235-236236- /* Ramp delay is in uV/uS. Adjust to uS and delay */237237- ramp_delay = DIV_ROUND_UP(abs(req_min_uV - old_uV), ramp_delay);238238- usleep_range(ramp_delay, ramp_delay + DIV_ROUND_UP(ramp_delay, 10));239235240236 return 0;241237}
···180180 if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1)181181 return -EINVAL;182182183183+ /*184184+ * Certain revisions of TPS65218 will need to have DCDC3 regulator185185+ * enabled always, otherwise an immediate system reboot will occur186186+ * during poweroff.187187+ */188188+ if (rid == TPS65218_DCDC_3 && tps->rev == TPS65218_REV_2_1)189189+ return 0;190190+183191 if (!tps->info[rid]->strobe) {184192 if (rid == TPS65218_DCDC_3)185193 tps->info[rid]->strobe = 3;
···113113 * stabilise after being enabled, in microseconds.114114 * @set_ramp_delay: Set the ramp delay for the regulator. The driver should115115 * select ramp delay equal to or less than(closest) ramp_delay.116116+ * @set_voltage_time: Time taken for the regulator voltage output voltage117117+ * to stabilise after being set to a new value, in microseconds.118118+ * The function receives the from and to voltage as input, it119119+ * should return the worst case.116120 * @set_voltage_time_sel: Time taken for the regulator voltage output voltage117121 * to stabilise after being set to a new value, in microseconds.118118- * The function provides the from and to voltage selector, the119119- * function should return the worst case.122122+ * The function receives the from and to voltage selector as123123+ * input, it should return the worst case.120124 * @set_soft_start: Enable soft start for the regulator.121125 *122126 * @set_suspend_voltage: Set the voltage for the regulator when the system···172168 /* Time taken to enable or set voltage on the regulator */173169 int (*enable_time) (struct regulator_dev *);174170 int (*set_ramp_delay) (struct regulator_dev *, int ramp_delay);171171+ int (*set_voltage_time) (struct regulator_dev *, int old_uV,172172+ int new_uV);175173 int (*set_voltage_time_sel) (struct regulator_dev *,176174 unsigned int old_selector,177175 unsigned int new_selector);