···11-Qualcomm Resource Power Manager (RPM) over SMD11+QCOM SMD RPM REGULATOR2233-This driver is used to interface with the Resource Power Manager (RPM) found in44-various Qualcomm platforms. The RPM allows each component in the system to vote55-for state of the system resources, such as clocks, regulators and bus66-frequencies.33+The Qualcomm RPM over SMD regulator is modelled as a subdevice of the RPM.44+Because SMD is used as the communication transport mechanism, the RPM resides as55+a subnode of the SMD. As such, the SMD-RPM regulator requires that the SMD and66+RPM nodes be present.7788-- compatible:99- Usage: required1010- Value type: <string>1111- Definition: must be one of:1212- "qcom,rpm-msm8974"88+Please refer to Documentation/devicetree/bindings/soc/qcom/qcom,smd.txt for99+information pertaining to the SMD node.13101414-- qcom,smd-channels:1515- Usage: required1616- Value type: <stringlist>1717- Definition: Shared Memory channel used for communication with the RPM1111+Please refer to Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt for1212+information regarding the RPM node.18131919-= SUBDEVICES2020-2121-The RPM exposes resources to its subnodes. The below bindings specify the set2222-of valid subnodes that can operate on these resources.2323-2424-== Regulators1414+== Regulator25152616Regulator nodes are identified by their compatible:2717···2030 Value type: <string>2131 Definition: must be one of:2232 "qcom,rpm-pm8841-regulators"3333+ "qcom,rpm-pm8916-regulators"2334 "qcom,rpm-pm8941-regulators"3535+ "qcom,rpm-pma8084-regulators"24362537- vdd_s1-supply:2638- vdd_s2-supply:···3341- vdd_s7-supply:3442- vdd_s8-supply:3543 Usage: optional (pm8841 only)4444+ Value type: <phandle>4545+ Definition: reference to regulator supplying the input pin, as4646+ described in the data sheet4747+4848+- vdd_s1-supply:4949+- vdd_s2-supply:5050+- vdd_s3-supply:5151+- vdd_s4-supply:5252+- vdd_l1_l2_l3-supply:5353+- vdd_l4_l5_l6-supply:5454+- vdd_l7-supply:5555+- vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18-supply:5656+ Usage: optional (pm8916 only)3657 Value type: <phandle>3758 Definition: reference to regulator supplying the input pin, as3859 described in the data sheet···6863 Definition: reference to regulator supplying the input pin, as6964 described in the data sheet70656666+- vdd_s1-supply:6767+- vdd_s2-supply:6868+- vdd_s3-supply:6969+- vdd_s4-supply:7070+- vdd_s5-supply:7171+- vdd_s6-supply:7272+- vdd_s7-supply:7373+- vdd_s8-supply:7474+- vdd_s9-supply:7575+- vdd_s10-supply:7676+- vdd_s11-supply:7777+- vdd_s12-supply:7878+- vdd_l1_l11-supply:7979+- vdd_l2_l3_l4_l27-supply:8080+- vdd_l5_l7-supply:8181+- vdd_l6_l12_l14_l15_l26-supply:8282+- vdd_l8-supply:8383+- vdd_l9_l10_l13_l20_l23_l24-supply:8484+- vdd_l16_l25-supply:8585+- vdd_l17-supply:8686+- vdd_l18-supply:8787+- vdd_l19-supply:8888+- vdd_l21-supply:8989+- vdd_l22-supply:9090+ Usage: optional (pma8084 only)9191+ Value type: <phandle>9292+ Definition: reference to regulator supplying the input pin, as9393+ described in the data sheet9494+7195The regulator node houses sub-nodes for each regulator within the device. Each7296sub-node is identified using the node's name, with valid values listed for each7397of the pmics below.···10470pm8841:10571 s1, s2, s3, s4, s5, s6, s7, s8106727373+pm8916:7474+ s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13,7575+ l14, l15, l16, l17, l187676+10777pm8941:10878 s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13,10979 l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2,11080 lvs3, 5vs1, 5vs28181+8282+pma8084:8383+ s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, l1, l2, l3, l4, l5,8484+ l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19, l20,8585+ l21, l22, l23, l24, l25, l26, l27, lvs1, lvs2, lvs3, lvs4, 5vs11118611287The content of each sub-node is defined by the standard binding for regulators -11388see regulator.txt.···157114 };158115 };159116 };160160-
···11+Qualcomm Resource Power Manager (RPM) over SMD22+33+This driver is used to interface with the Resource Power Manager (RPM) found in44+various Qualcomm platforms. The RPM allows each component in the system to vote55+for state of the system resources, such as clocks, regulators and bus66+frequencies.77+88+The SMD information for the RPM edge should be filled out. See qcom,smd.txt for99+the required edge properties. All SMD related properties will reside within the1010+RPM node itself.1111+1212+= SUBDEVICES1313+1414+The RPM exposes resources to its subnodes. The rpm_requests node must be1515+present and this subnode may contain children that designate regulator1616+resources.1717+1818+- compatible:1919+ Usage: required2020+ Value type: <string>2121+ Definition: must be one of:2222+ "qcom,rpm-apq8084"2323+ "qcom,rpm-msm8916"2424+ "qcom,rpm-msm8974"2525+2626+- qcom,smd-channels:2727+ Usage: required2828+ Value type: <string>2929+ Definition: must be "rpm_requests"3030+3131+Refer to Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt3232+for information on the regulator subnodes that can exist under the rpm_requests.3333+3434+Example:3535+3636+ soc {3737+ apcs: syscon@f9011000 {3838+ compatible = "syscon";3939+ reg = <0xf9011000 0x1000>;4040+ };4141+ };4242+4343+ smd {4444+ compatible = "qcom,smd";4545+4646+ rpm {4747+ interrupts = <0 168 1>;4848+ qcom,ipc = <&apcs 8 0>;4949+ qcom,smd-edge = <15>;5050+5151+ rpm_requests {5252+ compatible = "qcom,rpm-msm8974";5353+ qcom,smd-channels = "rpm_requests";5454+5555+ ...5656+ };5757+ };5858+ };
+15
drivers/regulator/Kconfig
···522522 Say y here to support the voltage regulators and convertors523523 PV88060524524525525+config REGULATOR_PV88090526526+ tristate "Powerventure Semiconductor PV88090 regulator"527527+ depends on I2C528528+ select REGMAP_I2C529529+ help530530+ Say y here to support the voltage regulators and convertors531531+ on PV88090532532+525533config REGULATOR_PWM526534 tristate "PWM voltage regulator"527535 depends on PWM···705697 This driver supports TPS6507X voltage regulator chips. TPS6507X provides706698 three step-down converters and two general-purpose LDO voltage regulators.707699 It supports TI's software based Class-2 SmartReflex implementation.700700+701701+config REGULATOR_TPS65086702702+ tristate "TI TPS65086 Power regulators"703703+ depends on MFD_TPS65086704704+ help705705+ This driver provides support for the voltage regulators on706706+ TI TPS65086 PMICs.708707709708config REGULATOR_TPS65090710709 tristate "TI TPS65090 Power regulator"
···11+/*22+ * pv88090-regulator.c - Regulator device driver for PV8809033+ * Copyright (C) 2015 Powerventure Semiconductor Ltd.44+ *55+ * This program is free software; you can redistribute it and/or66+ * modify it under the terms of the GNU General Public License77+ * as published by the Free Software Foundation; either version 288+ * of the License, or (at your option) any later version.99+ *1010+ * This program is distributed in the hope that it will be useful,1111+ * but WITHOUT ANY WARRANTY; without even the implied warranty of1212+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1313+ * GNU General Public License for more details.1414+ */1515+1616+#include <linux/err.h>1717+#include <linux/gpio.h>1818+#include <linux/i2c.h>1919+#include <linux/module.h>2020+#include <linux/init.h>2121+#include <linux/slab.h>2222+#include <linux/regulator/driver.h>2323+#include <linux/regulator/machine.h>2424+#include <linux/regmap.h>2525+#include <linux/irq.h>2626+#include <linux/interrupt.h>2727+#include <linux/regulator/of_regulator.h>2828+#include <linux/proc_fs.h>2929+#include <linux/uaccess.h>3030+#include "pv88090-regulator.h"3131+3232+#define PV88090_MAX_REGULATORS 53333+3434+/* PV88090 REGULATOR IDs */3535+enum {3636+ /* BUCKs */3737+ PV88090_ID_BUCK1,3838+ PV88090_ID_BUCK2,3939+ PV88090_ID_BUCK3,4040+4141+ /* LDOs */4242+ PV88090_ID_LDO1,4343+ PV88090_ID_LDO2,4444+};4545+4646+struct pv88090_regulator {4747+ struct regulator_desc desc;4848+ /* Current limiting */4949+ unsigned n_current_limits;5050+ const int *current_limits;5151+ unsigned int limit_mask;5252+ unsigned int conf;5353+ unsigned int conf2;5454+};5555+5656+struct pv88090 {5757+ struct device *dev;5858+ struct regmap *regmap;5959+ struct regulator_dev *rdev[PV88090_MAX_REGULATORS];6060+};6161+6262+struct pv88090_buck_voltage {6363+ int min_uV;6464+ int max_uV;6565+ int uV_step;6666+};6767+6868+static const struct regmap_config pv88090_regmap_config = {6969+ .reg_bits = 8,7070+ .val_bits = 8,7171+};7272+7373+/* Current limits array (in uA) for BUCK1, BUCK2, BUCK3.7474+ * Entry indexes corresponds to register values.7575+ */7676+7777+static const int pv88090_buck1_limits[] = {7878+ 220000, 440000, 660000, 880000, 1100000, 1320000, 1540000, 1760000,7979+ 1980000, 2200000, 2420000, 2640000, 2860000, 3080000, 3300000, 3520000,8080+ 3740000, 3960000, 4180000, 4400000, 4620000, 4840000, 5060000, 5280000,8181+ 5500000, 5720000, 5940000, 6160000, 6380000, 6600000, 6820000, 70400008282+};8383+8484+static const int pv88090_buck23_limits[] = {8585+ 1496000, 2393000, 3291000, 41890008686+};8787+8888+static const struct pv88090_buck_voltage pv88090_buck_vol[3] = {8989+ {9090+ .min_uV = 600000,9191+ .max_uV = 1393750,9292+ .uV_step = 6250,9393+ },9494+9595+ {9696+ .min_uV = 1400000,9797+ .max_uV = 2193750,9898+ .uV_step = 6250,9999+ },100100+ {101101+ .min_uV = 1250000,102102+ .max_uV = 2837500,103103+ .uV_step = 12500,104104+ },105105+};106106+107107+static unsigned int pv88090_buck_get_mode(struct regulator_dev *rdev)108108+{109109+ struct pv88090_regulator *info = rdev_get_drvdata(rdev);110110+ unsigned int data;111111+ int ret, mode = 0;112112+113113+ ret = regmap_read(rdev->regmap, info->conf, &data);114114+ if (ret < 0)115115+ return ret;116116+117117+ switch (data & PV88090_BUCK1_MODE_MASK) {118118+ case PV88090_BUCK_MODE_SYNC:119119+ mode = REGULATOR_MODE_FAST;120120+ break;121121+ case PV88090_BUCK_MODE_AUTO:122122+ mode = REGULATOR_MODE_NORMAL;123123+ break;124124+ case PV88090_BUCK_MODE_SLEEP:125125+ mode = REGULATOR_MODE_STANDBY;126126+ break;127127+ }128128+129129+ return mode;130130+}131131+132132+static int pv88090_buck_set_mode(struct regulator_dev *rdev,133133+ unsigned int mode)134134+{135135+ struct pv88090_regulator *info = rdev_get_drvdata(rdev);136136+ int val = 0;137137+138138+ switch (mode) {139139+ case REGULATOR_MODE_FAST:140140+ val = PV88090_BUCK_MODE_SYNC;141141+ break;142142+ case REGULATOR_MODE_NORMAL:143143+ val = PV88090_BUCK_MODE_AUTO;144144+ break;145145+ case REGULATOR_MODE_STANDBY:146146+ val = PV88090_BUCK_MODE_SLEEP;147147+ break;148148+ default:149149+ return -EINVAL;150150+ }151151+152152+ return regmap_update_bits(rdev->regmap, info->conf,153153+ PV88090_BUCK1_MODE_MASK, val);154154+}155155+156156+static int pv88090_set_current_limit(struct regulator_dev *rdev, int min,157157+ int max)158158+{159159+ struct pv88090_regulator *info = rdev_get_drvdata(rdev);160160+ int i;161161+162162+ /* search for closest to maximum */163163+ for (i = info->n_current_limits; i >= 0; i--) {164164+ if (min <= info->current_limits[i]165165+ && max >= info->current_limits[i]) {166166+ return regmap_update_bits(rdev->regmap,167167+ info->conf,168168+ info->limit_mask,169169+ i << PV88090_BUCK1_ILIM_SHIFT);170170+ }171171+ }172172+173173+ return -EINVAL;174174+}175175+176176+static int pv88090_get_current_limit(struct regulator_dev *rdev)177177+{178178+ struct pv88090_regulator *info = rdev_get_drvdata(rdev);179179+ unsigned int data;180180+ int ret;181181+182182+ ret = regmap_read(rdev->regmap, info->conf, &data);183183+ if (ret < 0)184184+ return ret;185185+186186+ data = (data & info->limit_mask) >> PV88090_BUCK1_ILIM_SHIFT;187187+ return info->current_limits[data];188188+}189189+190190+static struct regulator_ops pv88090_buck_ops = {191191+ .get_mode = pv88090_buck_get_mode,192192+ .set_mode = pv88090_buck_set_mode,193193+ .enable = regulator_enable_regmap,194194+ .disable = regulator_disable_regmap,195195+ .is_enabled = regulator_is_enabled_regmap,196196+ .set_voltage_sel = regulator_set_voltage_sel_regmap,197197+ .get_voltage_sel = regulator_get_voltage_sel_regmap,198198+ .list_voltage = regulator_list_voltage_linear,199199+ .set_current_limit = pv88090_set_current_limit,200200+ .get_current_limit = pv88090_get_current_limit,201201+};202202+203203+static struct regulator_ops pv88090_ldo_ops = {204204+ .enable = regulator_enable_regmap,205205+ .disable = regulator_disable_regmap,206206+ .is_enabled = regulator_is_enabled_regmap,207207+ .set_voltage_sel = regulator_set_voltage_sel_regmap,208208+ .get_voltage_sel = regulator_get_voltage_sel_regmap,209209+ .list_voltage = regulator_list_voltage_linear,210210+};211211+212212+#define PV88090_BUCK(chip, regl_name, min, step, max, limits_array) \213213+{\214214+ .desc = {\215215+ .id = chip##_ID_##regl_name,\216216+ .name = __stringify(chip##_##regl_name),\217217+ .of_match = of_match_ptr(#regl_name),\218218+ .regulators_node = of_match_ptr("regulators"),\219219+ .type = REGULATOR_VOLTAGE,\220220+ .owner = THIS_MODULE,\221221+ .ops = &pv88090_buck_ops,\222222+ .min_uV = min, \223223+ .uV_step = step, \224224+ .n_voltages = ((max) - (min))/(step) + 1, \225225+ .enable_reg = PV88090_REG_##regl_name##_CONF0, \226226+ .enable_mask = PV88090_##regl_name##_EN, \227227+ .vsel_reg = PV88090_REG_##regl_name##_CONF0, \228228+ .vsel_mask = PV88090_V##regl_name##_MASK, \229229+ },\230230+ .current_limits = limits_array, \231231+ .n_current_limits = ARRAY_SIZE(limits_array), \232232+ .limit_mask = PV88090_##regl_name##_ILIM_MASK, \233233+ .conf = PV88090_REG_##regl_name##_CONF1, \234234+ .conf2 = PV88090_REG_##regl_name##_CONF2, \235235+}236236+237237+#define PV88090_LDO(chip, regl_name, min, step, max) \238238+{\239239+ .desc = {\240240+ .id = chip##_ID_##regl_name,\241241+ .name = __stringify(chip##_##regl_name),\242242+ .of_match = of_match_ptr(#regl_name),\243243+ .regulators_node = of_match_ptr("regulators"),\244244+ .type = REGULATOR_VOLTAGE,\245245+ .owner = THIS_MODULE,\246246+ .ops = &pv88090_ldo_ops,\247247+ .min_uV = min, \248248+ .uV_step = step, \249249+ .n_voltages = ((max) - (min))/(step) + 1, \250250+ .enable_reg = PV88090_REG_##regl_name##_CONT, \251251+ .enable_mask = PV88090_##regl_name##_EN, \252252+ .vsel_reg = PV88090_REG_##regl_name##_CONT, \253253+ .vsel_mask = PV88090_V##regl_name##_MASK, \254254+ },\255255+}256256+257257+static struct pv88090_regulator pv88090_regulator_info[] = {258258+ PV88090_BUCK(PV88090, BUCK1, 600000, 6250, 1393750,259259+ pv88090_buck1_limits),260260+ PV88090_BUCK(PV88090, BUCK2, 600000, 6250, 1393750,261261+ pv88090_buck23_limits),262262+ PV88090_BUCK(PV88090, BUCK3, 600000, 6250, 1393750,263263+ pv88090_buck23_limits),264264+ PV88090_LDO(PV88090, LDO1, 1200000, 50000, 4350000),265265+ PV88090_LDO(PV88090, LDO2, 650000, 25000, 2225000),266266+};267267+268268+static irqreturn_t pv88090_irq_handler(int irq, void *data)269269+{270270+ struct pv88090 *chip = data;271271+ int i, reg_val, err, ret = IRQ_NONE;272272+273273+ err = regmap_read(chip->regmap, PV88090_REG_EVENT_A, ®_val);274274+ if (err < 0)275275+ goto error_i2c;276276+277277+ if (reg_val & PV88090_E_VDD_FLT) {278278+ for (i = 0; i < PV88090_MAX_REGULATORS; i++) {279279+ if (chip->rdev[i] != NULL) {280280+ regulator_notifier_call_chain(chip->rdev[i],281281+ REGULATOR_EVENT_UNDER_VOLTAGE,282282+ NULL);283283+ }284284+ }285285+286286+ err = regmap_update_bits(chip->regmap, PV88090_REG_EVENT_A,287287+ PV88090_E_VDD_FLT, PV88090_E_VDD_FLT);288288+ if (err < 0)289289+ goto error_i2c;290290+291291+ ret = IRQ_HANDLED;292292+ }293293+294294+ if (reg_val & PV88090_E_OVER_TEMP) {295295+ for (i = 0; i < PV88090_MAX_REGULATORS; i++) {296296+ if (chip->rdev[i] != NULL) {297297+ regulator_notifier_call_chain(chip->rdev[i],298298+ REGULATOR_EVENT_OVER_TEMP,299299+ NULL);300300+ }301301+ }302302+303303+ err = regmap_update_bits(chip->regmap, PV88090_REG_EVENT_A,304304+ PV88090_E_OVER_TEMP, PV88090_E_OVER_TEMP);305305+ if (err < 0)306306+ goto error_i2c;307307+308308+ ret = IRQ_HANDLED;309309+ }310310+311311+ return ret;312312+313313+error_i2c:314314+ dev_err(chip->dev, "I2C error : %d\n", err);315315+ return IRQ_NONE;316316+}317317+318318+/*319319+ * I2C driver interface functions320320+ */321321+static int pv88090_i2c_probe(struct i2c_client *i2c,322322+ const struct i2c_device_id *id)323323+{324324+ struct regulator_init_data *init_data = dev_get_platdata(&i2c->dev);325325+ struct pv88090 *chip;326326+ struct regulator_config config = { };327327+ int error, i, ret = 0;328328+ unsigned int conf2, range, index;329329+330330+ chip = devm_kzalloc(&i2c->dev, sizeof(struct pv88090), GFP_KERNEL);331331+ if (!chip)332332+ return -ENOMEM;333333+334334+ chip->dev = &i2c->dev;335335+ chip->regmap = devm_regmap_init_i2c(i2c, &pv88090_regmap_config);336336+ if (IS_ERR(chip->regmap)) {337337+ error = PTR_ERR(chip->regmap);338338+ dev_err(chip->dev, "Failed to allocate register map: %d\n",339339+ error);340340+ return error;341341+ }342342+343343+ i2c_set_clientdata(i2c, chip);344344+345345+ if (i2c->irq != 0) {346346+ ret = regmap_write(chip->regmap, PV88090_REG_MASK_A, 0xFF);347347+ if (ret < 0) {348348+ dev_err(chip->dev,349349+ "Failed to mask A reg: %d\n", ret);350350+ return ret;351351+ }352352+353353+ ret = regmap_write(chip->regmap, PV88090_REG_MASK_B, 0xFF);354354+ if (ret < 0) {355355+ dev_err(chip->dev,356356+ "Failed to mask B reg: %d\n", ret);357357+ return ret;358358+ }359359+360360+ ret = devm_request_threaded_irq(&i2c->dev, i2c->irq, NULL,361361+ pv88090_irq_handler,362362+ IRQF_TRIGGER_LOW|IRQF_ONESHOT,363363+ "pv88090", chip);364364+ if (ret != 0) {365365+ dev_err(chip->dev, "Failed to request IRQ: %d\n",366366+ i2c->irq);367367+ return ret;368368+ }369369+370370+ ret = regmap_update_bits(chip->regmap, PV88090_REG_MASK_A,371371+ PV88090_M_VDD_FLT | PV88090_M_OVER_TEMP, 0);372372+ if (ret < 0) {373373+ dev_err(chip->dev,374374+ "Failed to update mask reg: %d\n", ret);375375+ return ret;376376+ }377377+378378+ } else {379379+ dev_warn(chip->dev, "No IRQ configured\n");380380+ }381381+382382+ config.dev = chip->dev;383383+ config.regmap = chip->regmap;384384+385385+ for (i = 0; i < PV88090_MAX_REGULATORS; i++) {386386+ if (init_data)387387+ config.init_data = &init_data[i];388388+389389+ if (i == PV88090_ID_BUCK2 || i == PV88090_ID_BUCK3) {390390+ ret = regmap_read(chip->regmap,391391+ pv88090_regulator_info[i].conf2, &conf2);392392+ if (ret < 0)393393+ return ret;394394+395395+ conf2 = (conf2 >> PV88090_BUCK_VDAC_RANGE_SHIFT) &396396+ PV88090_BUCK_VDAC_RANGE_MASK;397397+398398+ ret = regmap_read(chip->regmap,399399+ PV88090_REG_BUCK_FOLD_RANGE, &range);400400+ if (ret < 0)401401+ return ret;402402+403403+ range = (range >>404404+ (PV88080_BUCK_VRANGE_GAIN_SHIFT + i - 1)) &405405+ PV88080_BUCK_VRANGE_GAIN_MASK;406406+ index = ((range << 1) | conf2);407407+408408+ pv88090_regulator_info[i].desc.min_uV409409+ = pv88090_buck_vol[index].min_uV;410410+ pv88090_regulator_info[i].desc.uV_step411411+ = pv88090_buck_vol[index].uV_step;412412+ pv88090_regulator_info[i].desc.n_voltages413413+ = ((pv88090_buck_vol[index].max_uV)414414+ - (pv88090_buck_vol[index].min_uV))415415+ /(pv88090_buck_vol[index].uV_step) + 1;416416+ }417417+418418+ config.driver_data = (void *)&pv88090_regulator_info[i];419419+ chip->rdev[i] = devm_regulator_register(chip->dev,420420+ &pv88090_regulator_info[i].desc, &config);421421+ if (IS_ERR(chip->rdev[i])) {422422+ dev_err(chip->dev,423423+ "Failed to register PV88090 regulator\n");424424+ return PTR_ERR(chip->rdev[i]);425425+ }426426+ }427427+428428+ return 0;429429+}430430+431431+static const struct i2c_device_id pv88090_i2c_id[] = {432432+ {"pv88090", 0},433433+ {},434434+};435435+MODULE_DEVICE_TABLE(i2c, pv88090_i2c_id);436436+437437+#ifdef CONFIG_OF438438+static const struct of_device_id pv88090_dt_ids[] = {439439+ { .compatible = "pvs,pv88090", .data = &pv88090_i2c_id[0] },440440+ {},441441+};442442+MODULE_DEVICE_TABLE(of, pv88090_dt_ids);443443+#endif444444+445445+static struct i2c_driver pv88090_regulator_driver = {446446+ .driver = {447447+ .name = "pv88090",448448+ .of_match_table = of_match_ptr(pv88090_dt_ids),449449+ },450450+ .probe = pv88090_i2c_probe,451451+ .id_table = pv88090_i2c_id,452452+};453453+454454+module_i2c_driver(pv88090_regulator_driver);455455+456456+MODULE_AUTHOR("James Ban <James.Ban.opensource@diasemi.com>");457457+MODULE_DESCRIPTION("Regulator device driver for Powerventure PV88090");458458+MODULE_LICENSE("GPL");
+98
drivers/regulator/pv88090-regulator.h
···11+/*22+ * pv88090-regulator.h - Regulator definitions for PV8809033+ * Copyright (C) 2015 Powerventure Semiconductor Ltd.44+ *55+ * This program is free software; you can redistribute it and/or66+ * modify it under the terms of the GNU General Public License77+ * as published by the Free Software Foundation; either version 288+ * of the License, or (at your option) any later version.99+ *1010+ * This program is distributed in the hope that it will be useful,1111+ * but WITHOUT ANY WARRANTY; without even the implied warranty of1212+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1313+ * GNU General Public License for more details.1414+ */1515+1616+#ifndef __PV88090_REGISTERS_H__1717+#define __PV88090_REGISTERS_H__1818+1919+/* System Control and Event Registers */2020+#define PV88090_REG_EVENT_A 0x032121+#define PV88090_REG_MASK_A 0x062222+#define PV88090_REG_MASK_B 0x072323+2424+/* Regulator Registers */2525+#define PV88090_REG_BUCK1_CONF0 0x182626+#define PV88090_REG_BUCK1_CONF1 0x192727+#define PV88090_REG_BUCK1_CONF2 0x1a2828+#define PV88090_REG_BUCK2_CONF0 0x1b2929+#define PV88090_REG_BUCK2_CONF1 0x1c3030+#define PV88090_REG_BUCK2_CONF2 0x583131+#define PV88090_REG_BUCK3_CONF0 0x1d3232+#define PV88090_REG_BUCK3_CONF1 0x1e3333+#define PV88090_REG_BUCK3_CONF2 0x5c3434+3535+#define PV88090_REG_LDO1_CONT 0x1f3636+#define PV88090_REG_LDO2_CONT 0x203737+#define PV88090_REG_LDO3_CONT 0x213838+#define PV88090_REG_BUCK_FOLD_RANGE 0x613939+4040+/* PV88090_REG_EVENT_A (addr=0x03) */4141+#define PV88090_E_VDD_FLT 0x014242+#define PV88090_E_OVER_TEMP 0x024343+4444+/* PV88090_REG_MASK_A (addr=0x06) */4545+#define PV88090_M_VDD_FLT 0x014646+#define PV88090_M_OVER_TEMP 0x024747+4848+/* PV88090_REG_BUCK1_CONF0 (addr=0x18) */4949+#define PV88090_BUCK1_EN 0x805050+#define PV88090_VBUCK1_MASK 0x7F5151+/* PV88090_REG_BUCK2_CONF0 (addr=0x1b) */5252+#define PV88090_BUCK2_EN 0x805353+#define PV88090_VBUCK2_MASK 0x7F5454+/* PV88090_REG_BUCK3_CONF0 (addr=0x1d) */5555+#define PV88090_BUCK3_EN 0x805656+#define PV88090_VBUCK3_MASK 0x7F5757+/* PV88090_REG_LDO1_CONT (addr=0x1f) */5858+#define PV88090_LDO1_EN 0x405959+#define PV88090_VLDO1_MASK 0x3F6060+/* PV88090_REG_LDO2_CONT (addr=0x20) */6161+#define PV88090_LDO2_EN 0x406262+#define PV88090_VLDO2_MASK 0x3F6363+6464+/* PV88090_REG_BUCK1_CONF1 (addr=0x19) */6565+#define PV88090_BUCK1_ILIM_SHIFT 26666+#define PV88090_BUCK1_ILIM_MASK 0x7C6767+#define PV88090_BUCK1_MODE_MASK 0x036868+6969+/* PV88090_REG_BUCK2_CONF1 (addr=0x1c) */7070+#define PV88090_BUCK2_ILIM_SHIFT 27171+#define PV88090_BUCK2_ILIM_MASK 0x0C7272+#define PV88090_BUCK2_MODE_MASK 0x037373+7474+/* PV88090_REG_BUCK3_CONF1 (addr=0x1e) */7575+#define PV88090_BUCK3_ILIM_SHIFT 27676+#define PV88090_BUCK3_ILIM_MASK 0x0C7777+#define PV88090_BUCK3_MODE_MASK 0x037878+7979+#define PV88090_BUCK_MODE_SLEEP 0x008080+#define PV88090_BUCK_MODE_AUTO 0x018181+#define PV88090_BUCK_MODE_SYNC 0x028282+8383+/* PV88090_REG_BUCK2_CONF2 (addr=0x58) */8484+/* PV88090_REG_BUCK3_CONF2 (addr=0x5c) */8585+#define PV88090_BUCK_VDAC_RANGE_SHIFT 78686+#define PV88090_BUCK_VDAC_RANGE_MASK 0x018787+8888+#define PV88090_BUCK_VDAC_RANGE_1 0x008989+#define PV88090_BUCK_VDAC_RANGE_2 0x019090+9191+/* PV88090_REG_BUCK_FOLD_RANGE (addr=0x61) */9292+#define PV88080_BUCK_VRANGE_GAIN_SHIFT 39393+#define PV88080_BUCK_VRANGE_GAIN_MASK 0x019494+9595+#define PV88080_BUCK_VRANGE_GAIN_1 0x009696+#define PV88080_BUCK_VRANGE_GAIN_2 0x019797+9898+#endif /* __PV88090_REGISTERS_H__ */
···200200 TPS65218_DCDC_4,201201 TPS65218_DCDC_5,202202 TPS65218_DCDC_6,203203+ /* LS's */204204+ TPS65218_LS_3,203205 /* LDOs */204206 TPS65218_LDO_1,205207};···212210#define TPS65218_NUM_DCDC 6213211/* Number of LDO voltage regulators available */214212#define TPS65218_NUM_LDO 1213213+/* Number of total LS current regulators available */214214+#define TPS65218_NUM_LS 1215215/* Number of total regulators available */216216-#define TPS65218_NUM_REGULATOR (TPS65218_NUM_DCDC + TPS65218_NUM_LDO)216216+#define TPS65218_NUM_REGULATOR (TPS65218_NUM_DCDC + TPS65218_NUM_LDO \217217+ + TPS65218_NUM_LS)217218218219/* Define the TPS65218 IRQ numbers */219220enum tps65218_irqs {
+2
include/linux/regulator/driver.h
···302302303303 unsigned int vsel_reg;304304 unsigned int vsel_mask;305305+ unsigned int csel_reg;306306+ unsigned int csel_mask;305307 unsigned int apply_reg;306308 unsigned int apply_bit;307309 unsigned int enable_reg;