···11+* Samsung S5M8767 Voltage and Current Regulator22+33+The Samsung S5M8767 is a multi-function device which includes volatage and44+current regulators, rtc, charger controller and other sub-blocks. It is55+interfaced to the host controller using a i2c interface. Each sub-block is66+addressed by the host system using different i2c slave address. This document77+describes the bindings for 'pmic' sub-block of s5m8767.88+99+Required properties:1010+- compatible: Should be "samsung,s5m8767-pmic".1111+- reg: Specifies the i2c slave address of the pmic block. It should be 0x66.1212+1313+- s5m8767,pmic-buck2-dvs-voltage: A set of 8 voltage values in micro-volt (uV)1414+ units for buck2 when changing voltage using gpio dvs. Refer to [1] below1515+ for additional information.1616+1717+- s5m8767,pmic-buck3-dvs-voltage: A set of 8 voltage values in micro-volt (uV)1818+ units for buck3 when changing voltage using gpio dvs. Refer to [1] below1919+ for additional information.2020+2121+- s5m8767,pmic-buck4-dvs-voltage: A set of 8 voltage values in micro-volt (uV)2222+ units for buck4 when changing voltage using gpio dvs. Refer to [1] below2323+ for additional information.2424+2525+- s5m8767,pmic-buck-ds-gpios: GPIO specifiers for three host gpio's used2626+ for selecting GPIO DVS lines. It is one-to-one mapped to dvs gpio lines.2727+2828+[1] If none of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional2929+ property is specified, the 's5m8767,pmic-buck[2/3/4]-dvs-voltage'3030+ property should specify atleast one voltage level (which would be a3131+ safe operating voltage).3232+3333+ If either of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional3434+ property is specified, then all the eight voltage values for the3535+ 's5m8767,pmic-buck[2/3/4]-dvs-voltage' should be specified.3636+3737+Optional properties:3838+- interrupt-parent: Specifies the phandle of the interrupt controller to which3939+ the interrupts from s5m8767 are delivered to.4040+- interrupts: Interrupt specifiers for two interrupt sources.4141+ - First interrupt specifier is for 'irq1' interrupt.4242+ - Second interrupt specifier is for 'alert' interrupt.4343+- s5m8767,pmic-buck2-uses-gpio-dvs: 'buck2' can be controlled by gpio dvs.4444+- s5m8767,pmic-buck3-uses-gpio-dvs: 'buck3' can be controlled by gpio dvs.4545+- s5m8767,pmic-buck4-uses-gpio-dvs: 'buck4' can be controlled by gpio dvs.4646+4747+Additional properties required if either of the optional properties are used:4848+4949+- s5m8767,pmic-buck234-default-dvs-idx: Default voltage setting selected from5050+ the possible 8 options selectable by the dvs gpios. The value of this5151+ property should be between 0 and 7. If not specified or if out of range, the5252+ default value of this property is set to 0.5353+5454+- s5m8767,pmic-buck-dvs-gpios: GPIO specifiers for three host gpio's used5555+ for dvs. The format of the gpio specifier depends in the gpio controller.5656+5757+Regulators: The regulators of s5m8767 that have to be instantiated should be5858+included in a sub-node named 'regulators'. Regulator nodes included in this5959+sub-node should be of the format as listed below.6060+6161+ regulator_name {6262+ ldo1_reg: LDO1 {6363+ regulator-name = "VDD_ALIVE_1.0V";6464+ regulator-min-microvolt = <1100000>;6565+ regulator-max-microvolt = <1100000>;6666+ regulator-always-on;6767+ regulator-boot-on;6868+ op_mode = <1>; /* Normal Mode */6969+ };7070+ };7171+The above regulator entries are defined in regulator bindings documentation7272+except op_mode description.7373+ - op_mode: describes the different operating modes of the LDO's with7474+ power mode change in SOC. The different possible values are,7575+ 0 - always off mode7676+ 1 - on in normal mode7777+ 2 - low power mode7878+ 3 - suspend mode7979+8080+The following are the names of the regulators that the s5m8767 pmic block8181+supports. Note: The 'n' in LDOn and BUCKn represents the LDO or BUCK number8282+as per the datasheet of s5m8767.8383+8484+ - LDOn8585+ - valid values for n are 1 to 288686+ - Example: LDO0, LD01, LDO288787+ - BUCKn8888+ - valid values for n are 1 to 9.8989+ - Example: BUCK1, BUCK2, BUCK99090+9191+The bindings inside the regulator nodes use the standard regulator bindings9292+which are documented elsewhere.9393+9494+Example:9595+9696+ s5m8767_pmic@66 {9797+ compatible = "samsung,s5m8767-pmic";9898+ reg = <0x66>;9999+100100+ s5m8767,pmic-buck2-uses-gpio-dvs;101101+ s5m8767,pmic-buck3-uses-gpio-dvs;102102+ s5m8767,pmic-buck4-uses-gpio-dvs;103103+104104+ s5m8767,pmic-buck-default-dvs-idx = <0>;105105+106106+ s5m8767,pmic-buck-dvs-gpios = <&gpx0 0 1 0 0>, /* DVS1 */107107+ <&gpx0 1 1 0 0>, /* DVS2 */108108+ <&gpx0 2 1 0 0>; /* DVS3 */109109+110110+ s5m8767,pmic-buck-ds-gpios = <&gpx2 3 1 0 0>, /* SET1 */111111+ <&gpx2 4 1 0 0>, /* SET2 */112112+ <&gpx2 5 1 0 0>; /* SET3 */113113+114114+ s5m8767,pmic-buck2-dvs-voltage = <1350000>, <1300000>,115115+ <1250000>, <1200000>,116116+ <1150000>, <1100000>,117117+ <1000000>, <950000>;118118+119119+ s5m8767,pmic-buck3-dvs-voltage = <1100000>, <1100000>,120120+ <1100000>, <1100000>,121121+ <1000000>, <1000000>,122122+ <1000000>, <1000000>;123123+124124+ s5m8767,pmic-buck4-dvs-voltage = <1200000>, <1200000>,125125+ <1200000>, <1200000>,126126+ <1200000>, <1200000>,127127+ <1200000>, <1200000>;128128+129129+ regulators {130130+ ldo1_reg: LDO1 {131131+ regulator-name = "VDD_ABB_3.3V";132132+ regulator-min-microvolt = <3300000>;133133+ regulator-max-microvolt = <3300000>;134134+ op_mode = <1>; /* Normal Mode */135135+ };136136+137137+ ldo2_reg: LDO2 {138138+ regulator-name = "VDD_ALIVE_1.1V";139139+ regulator-min-microvolt = <1100000>;140140+ regulator-max-microvolt = <1100000>;141141+ regulator-always-on;142142+ };143143+144144+ buck1_reg: BUCK1 {145145+ regulator-name = "VDD_MIF_1.2V";146146+ regulator-min-microvolt = <950000>;147147+ regulator-max-microvolt = <1350000>;148148+ regulator-always-on;149149+ regulator-boot-on;150150+ };151151+ };152152+ };
+72-1
drivers/mfd/sec-core.c
···1717#include <linux/err.h>1818#include <linux/slab.h>1919#include <linux/i2c.h>2020+#include <linux/of_irq.h>2021#include <linux/interrupt.h>2122#include <linux/pm_runtime.h>2223#include <linux/mutex.h>···6160 },6261};63626363+#ifdef CONFIG_OF6464+static struct of_device_id sec_dt_match[] = {6565+ { .compatible = "samsung,s5m8767-pmic",6666+ .data = (void *)S5M8767X,6767+ },6868+ {},6969+};7070+#endif7171+6472int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest)6573{6674 return regmap_read(sec_pmic->regmap, reg, dest);···10595 .val_bits = 8,10696};107979898+9999+#ifdef CONFIG_OF100100+/*101101+ * Only the common platform data elements for s5m8767 are parsed here from the102102+ * device tree. Other sub-modules of s5m8767 such as pmic, rtc , charger and103103+ * others have to parse their own platform data elements from device tree.104104+ *105105+ * The s5m8767 platform data structure is instantiated here and the drivers for106106+ * the sub-modules need not instantiate another instance while parsing their107107+ * platform data.108108+ */109109+static struct sec_platform_data *sec_pmic_i2c_parse_dt_pdata(110110+ struct device *dev)111111+{112112+ struct sec_platform_data *pd;113113+114114+ pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);115115+ if (!pd) {116116+ dev_err(dev, "could not allocate memory for pdata\n");117117+ return ERR_PTR(-ENOMEM);118118+ }119119+120120+ /*121121+ * ToDo: the 'wakeup' member in the platform data is more of a linux122122+ * specfic information. Hence, there is no binding for that yet and123123+ * not parsed here.124124+ */125125+126126+ return pd;127127+}128128+#else129129+static struct sec_platform_data *sec_pmic_i2c_parse_dt_pdata(130130+ struct device *dev)131131+{132132+ return 0;133133+}134134+#endif135135+136136+static inline int sec_i2c_get_driver_data(struct i2c_client *i2c,137137+ const struct i2c_device_id *id)138138+{139139+#ifdef CONFIG_OF140140+ if (i2c->dev.of_node) {141141+ const struct of_device_id *match;142142+ match = of_match_node(sec_dt_match, i2c->dev.of_node);143143+ return (int)match->data;144144+ }145145+#endif146146+ return (int)id->driver_data;147147+}148148+108149static int sec_pmic_probe(struct i2c_client *i2c,109150 const struct i2c_device_id *id)110151{···172111 sec_pmic->dev = &i2c->dev;173112 sec_pmic->i2c = i2c;174113 sec_pmic->irq = i2c->irq;175175- sec_pmic->type = id->driver_data;114114+ sec_pmic->type = sec_i2c_get_driver_data(i2c, id);176115116116+ if (sec_pmic->dev->of_node) {117117+ pdata = sec_pmic_i2c_parse_dt_pdata(sec_pmic->dev);118118+ if (IS_ERR(pdata)) {119119+ ret = PTR_ERR(pdata);120120+ return ret;121121+ }122122+ pdata->device_type = sec_pmic->type;123123+ }177124 if (pdata) {178125 sec_pmic->device_type = pdata->device_type;179126 sec_pmic->ono = pdata->ono;180127 sec_pmic->irq_base = pdata->irq_base;181128 sec_pmic->wakeup = pdata->wakeup;129129+ sec_pmic->pdata = pdata;182130 }183131184132 sec_pmic->regmap = devm_regmap_init_i2c(i2c, &sec_regmap_config);···262192 .driver = {263193 .name = "sec_pmic",264194 .owner = THIS_MODULE,195195+ .of_match_table = of_match_ptr(sec_dt_match),265196 },266197 .probe = sec_pmic_probe,267198 .remove = sec_pmic_remove,
+206-62
drivers/regulator/s5m8767.c
···1414#include <linux/bug.h>1515#include <linux/err.h>1616#include <linux/gpio.h>1717+#include <linux/of_gpio.h>1718#include <linux/slab.h>1819#include <linux/module.h>1920#include <linux/platform_device.h>···2221#include <linux/regulator/machine.h>2322#include <linux/mfd/samsung/core.h>2423#include <linux/mfd/samsung/s5m8767.h>2424+#include <linux/regulator/of_regulator.h>2525+2626+#define S5M8767_OPMODE_NORMAL_MODE 0x125272628struct s5m8767_info {2729 struct device *dev;···259255 return sec_reg_update(s5m8767->iodev, reg, ~mask, mask);260256}261257262262-static int s5m8767_get_voltage_register(struct regulator_dev *rdev, int *_reg)258258+static int s5m8767_get_vsel_reg(int reg_id, struct s5m8767_info *s5m8767)263259{264264- struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);265265- int reg_id = rdev_get_id(rdev);266260 int reg;267261268262 switch (reg_id) {···298296 return -EINVAL;299297 }300298301301- *_reg = reg;302302-303303- return 0;299299+ return reg;304300}305301306306-static int s5m8767_get_voltage_sel(struct regulator_dev *rdev)307307-{308308- struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);309309- int reg, mask, ret;310310- int reg_id = rdev_get_id(rdev);311311- unsigned int val;312312-313313- ret = s5m8767_get_voltage_register(rdev, ®);314314- if (ret)315315- return ret;316316-317317- mask = (reg_id < S5M8767_BUCK1) ? 0x3f : 0xff;318318-319319- ret = sec_reg_read(s5m8767->iodev, reg, &val);320320- if (ret)321321- return ret;322322-323323- val &= mask;324324-325325- return val;326326-}327327-328328-static int s5m8767_convert_voltage_to_sel(329329- const struct sec_voltage_desc *desc,330330- int min_vol, int max_vol)302302+static int s5m8767_convert_voltage_to_sel(const struct sec_voltage_desc *desc,303303+ int min_vol)331304{332305 int selector = 0;333306334307 if (desc == NULL)335308 return -EINVAL;336309337337- if (max_vol < desc->min || min_vol > desc->max)310310+ if (min_vol > desc->max)338311 return -EINVAL;339312340313 if (min_vol < desc->min)···317340318341 selector = DIV_ROUND_UP(min_vol - desc->min, desc->step);319342320320- if (desc->min + desc->step * selector > max_vol)343343+ if (desc->min + desc->step * selector > desc->max)321344 return -EINVAL;322345323346 return selector;···350373{351374 struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);352375 int reg_id = rdev_get_id(rdev);353353- int reg, mask, ret = 0, old_index, index = 0;376376+ int old_index, index = 0;354377 u8 *buck234_vol = NULL;355378356379 switch (reg_id) {357380 case S5M8767_LDO1 ... S5M8767_LDO28:358358- mask = 0x3f;359381 break;360382 case S5M8767_BUCK1 ... S5M8767_BUCK6:361361- mask = 0xff;362383 if (reg_id == S5M8767_BUCK2 && s5m8767->buck2_gpiodvs)363384 buck234_vol = &s5m8767->buck2_vol[0];364385 else if (reg_id == S5M8767_BUCK3 && s5m8767->buck3_gpiodvs)···367392 case S5M8767_BUCK7 ... S5M8767_BUCK8:368393 return -EINVAL;369394 case S5M8767_BUCK9:370370- mask = 0xff;371395 break;372396 default:373397 return -EINVAL;···386412 else387413 return s5m8767_set_low(s5m8767);388414 } else {389389- ret = s5m8767_get_voltage_register(rdev, ®);390390- if (ret)391391- return ret;392392-393393- return sec_reg_update(s5m8767->iodev, reg, selector, mask);415415+ return regulator_set_voltage_sel_regmap(rdev, selector);394416 }395417}396418···411441 .is_enabled = s5m8767_reg_is_enabled,412442 .enable = s5m8767_reg_enable,413443 .disable = s5m8767_reg_disable,414414- .get_voltage_sel = s5m8767_get_voltage_sel,444444+ .get_voltage_sel = regulator_get_voltage_sel_regmap,415445 .set_voltage_sel = s5m8767_set_voltage_sel,416446 .set_voltage_time_sel = s5m8767_set_voltage_time_sel,417447};···478508 s5m8767_regulator_desc(BUCK9),479509};480510511511+#ifdef CONFIG_OF512512+static int s5m8767_pmic_dt_parse_dvs_gpio(struct sec_pmic_dev *iodev,513513+ struct sec_platform_data *pdata,514514+ struct device_node *pmic_np)515515+{516516+ int i, gpio;517517+518518+ for (i = 0; i < 3; i++) {519519+ gpio = of_get_named_gpio(pmic_np,520520+ "s5m8767,pmic-buck-dvs-gpios", i);521521+ if (!gpio_is_valid(gpio)) {522522+ dev_err(iodev->dev, "invalid gpio[%d]: %d\n", i, gpio);523523+ return -EINVAL;524524+ }525525+ pdata->buck_gpios[i] = gpio;526526+ }527527+ return 0;528528+}529529+530530+static int s5m8767_pmic_dt_parse_ds_gpio(struct sec_pmic_dev *iodev,531531+ struct sec_platform_data *pdata,532532+ struct device_node *pmic_np)533533+{534534+ int i, gpio;535535+536536+ for (i = 0; i < 3; i++) {537537+ gpio = of_get_named_gpio(pmic_np,538538+ "s5m8767,pmic-buck-ds-gpios", i);539539+ if (!gpio_is_valid(gpio)) {540540+ dev_err(iodev->dev, "invalid gpio[%d]: %d\n", i, gpio);541541+ return -EINVAL;542542+ }543543+ pdata->buck_ds[i] = gpio;544544+ }545545+ return 0;546546+}547547+548548+static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,549549+ struct sec_platform_data *pdata)550550+{551551+ struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);552552+ struct device_node *pmic_np, *regulators_np, *reg_np;553553+ struct sec_regulator_data *rdata;554554+ struct sec_opmode_data *rmode;555555+ unsigned int i, dvs_voltage_nr = 1, ret;556556+557557+ pmic_np = iodev->dev->of_node;558558+ if (!pmic_np) {559559+ dev_err(iodev->dev, "could not find pmic sub-node\n");560560+ return -ENODEV;561561+ }562562+563563+ regulators_np = of_find_node_by_name(pmic_np, "regulators");564564+ if (!regulators_np) {565565+ dev_err(iodev->dev, "could not find regulators sub-node\n");566566+ return -EINVAL;567567+ }568568+569569+ /* count the number of regulators to be supported in pmic */570570+ pdata->num_regulators = of_get_child_count(regulators_np);571571+572572+ rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) *573573+ pdata->num_regulators, GFP_KERNEL);574574+ if (!rdata) {575575+ dev_err(iodev->dev,576576+ "could not allocate memory for regulator data\n");577577+ return -ENOMEM;578578+ }579579+580580+ rmode = devm_kzalloc(&pdev->dev, sizeof(*rmode) *581581+ pdata->num_regulators, GFP_KERNEL);582582+ if (!rdata) {583583+ dev_err(iodev->dev,584584+ "could not allocate memory for regulator mode\n");585585+ return -ENOMEM;586586+ }587587+588588+ pdata->regulators = rdata;589589+ pdata->opmode = rmode;590590+ for_each_child_of_node(regulators_np, reg_np) {591591+ for (i = 0; i < ARRAY_SIZE(regulators); i++)592592+ if (!of_node_cmp(reg_np->name, regulators[i].name))593593+ break;594594+595595+ if (i == ARRAY_SIZE(regulators)) {596596+ dev_warn(iodev->dev,597597+ "don't know how to configure regulator %s\n",598598+ reg_np->name);599599+ continue;600600+ }601601+602602+ rdata->id = i;603603+ rdata->initdata = of_get_regulator_init_data(604604+ &pdev->dev, reg_np);605605+ rdata->reg_node = reg_np;606606+ rdata++;607607+ rmode->id = i;608608+ if (of_property_read_u32(reg_np, "op_mode",609609+ &rmode->mode)) {610610+ dev_warn(iodev->dev,611611+ "no op_mode property property at %s\n",612612+ reg_np->full_name);613613+614614+ rmode->mode = S5M8767_OPMODE_NORMAL_MODE;615615+ }616616+ rmode++;617617+ }618618+619619+ if (of_get_property(pmic_np, "s5m8767,pmic-buck2-uses-gpio-dvs", NULL))620620+ pdata->buck2_gpiodvs = true;621621+622622+ if (of_get_property(pmic_np, "s5m8767,pmic-buck3-uses-gpio-dvs", NULL))623623+ pdata->buck3_gpiodvs = true;624624+625625+ if (of_get_property(pmic_np, "s5m8767,pmic-buck4-uses-gpio-dvs", NULL))626626+ pdata->buck4_gpiodvs = true;627627+628628+ if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs ||629629+ pdata->buck4_gpiodvs) {630630+ ret = s5m8767_pmic_dt_parse_dvs_gpio(iodev, pdata, pmic_np);631631+ if (ret)632632+ return -EINVAL;633633+634634+ if (of_property_read_u32(pmic_np,635635+ "s5m8767,pmic-buck-default-dvs-idx",636636+ &pdata->buck_default_idx)) {637637+ pdata->buck_default_idx = 0;638638+ } else {639639+ if (pdata->buck_default_idx >= 8) {640640+ pdata->buck_default_idx = 0;641641+ dev_info(iodev->dev,642642+ "invalid value for default dvs index, use 0\n");643643+ }644644+ }645645+ dvs_voltage_nr = 8;646646+ }647647+648648+ ret = s5m8767_pmic_dt_parse_ds_gpio(iodev, pdata, pmic_np);649649+ if (ret)650650+ return -EINVAL;651651+652652+ if (of_property_read_u32_array(pmic_np,653653+ "s5m8767,pmic-buck2-dvs-voltage",654654+ pdata->buck2_voltage, dvs_voltage_nr)) {655655+ dev_err(iodev->dev, "buck2 voltages not specified\n");656656+ return -EINVAL;657657+ }658658+659659+ if (of_property_read_u32_array(pmic_np,660660+ "s5m8767,pmic-buck3-dvs-voltage",661661+ pdata->buck3_voltage, dvs_voltage_nr)) {662662+ dev_err(iodev->dev, "buck3 voltages not specified\n");663663+ return -EINVAL;664664+ }665665+666666+ if (of_property_read_u32_array(pmic_np,667667+ "s5m8767,pmic-buck4-dvs-voltage",668668+ pdata->buck4_voltage, dvs_voltage_nr)) {669669+ dev_err(iodev->dev, "buck4 voltages not specified\n");670670+ return -EINVAL;671671+ }672672+673673+ return 0;674674+}675675+#else676676+static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,677677+ struct sec_platform_data *pdata)678678+{679679+ return 0;680680+}681681+#endif /* CONFIG_OF */682682+481683static int s5m8767_pmic_probe(struct platform_device *pdev)482684{483685 struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);484484- struct sec_platform_data *pdata = dev_get_platdata(iodev->dev);686686+ struct sec_platform_data *pdata = iodev->pdata;485687 struct regulator_config config = { };486688 struct regulator_dev **rdev;487689 struct s5m8767_info *s5m8767;···662520 if (!pdata) {663521 dev_err(pdev->dev.parent, "Platform data not supplied\n");664522 return -ENODEV;523523+ }524524+525525+ if (iodev->dev->of_node) {526526+ ret = s5m8767_pmic_dt_parse_pdata(pdev, pdata);527527+ if (ret)528528+ return ret;665529 }666530667531 if (pdata->buck2_gpiodvs) {···725577 s5m8767->opmode = pdata->opmode;726578727579 buck_init = s5m8767_convert_voltage_to_sel(&buck_voltage_val2,728728- pdata->buck2_init,729729- pdata->buck2_init +730730- buck_voltage_val2.step);580580+ pdata->buck2_init);731581732582 sec_reg_write(s5m8767->iodev, S5M8767_REG_BUCK2DVS2, buck_init);733583734584 buck_init = s5m8767_convert_voltage_to_sel(&buck_voltage_val2,735735- pdata->buck3_init,736736- pdata->buck3_init +737737- buck_voltage_val2.step);585585+ pdata->buck3_init);738586739587 sec_reg_write(s5m8767->iodev, S5M8767_REG_BUCK3DVS2, buck_init);740588741589 buck_init = s5m8767_convert_voltage_to_sel(&buck_voltage_val2,742742- pdata->buck4_init,743743- pdata->buck4_init +744744- buck_voltage_val2.step);590590+ pdata->buck4_init);745591746592 sec_reg_write(s5m8767->iodev, S5M8767_REG_BUCK4DVS2, buck_init);747593···744602 s5m8767->buck2_vol[i] =745603 s5m8767_convert_voltage_to_sel(746604 &buck_voltage_val2,747747- pdata->buck2_voltage[i],748748- pdata->buck2_voltage[i] +749749- buck_voltage_val2.step);605605+ pdata->buck2_voltage[i]);750606 }751607752608 if (s5m8767->buck3_gpiodvs) {753609 s5m8767->buck3_vol[i] =754610 s5m8767_convert_voltage_to_sel(755611 &buck_voltage_val2,756756- pdata->buck3_voltage[i],757757- pdata->buck3_voltage[i] +758758- buck_voltage_val2.step);612612+ pdata->buck3_voltage[i]);759613 }760614761615 if (s5m8767->buck4_gpiodvs) {762616 s5m8767->buck4_vol[i] =763617 s5m8767_convert_voltage_to_sel(764618 &buck_voltage_val2,765765- pdata->buck4_voltage[i],766766- pdata->buck4_voltage[i] +767767- buck_voltage_val2.step);619619+ pdata->buck4_voltage[i]);768620 }769621 }770622···896760 (desc->max - desc->min) / desc->step + 1;897761 regulators[id].min_uV = desc->min;898762 regulators[id].uV_step = desc->step;763763+ regulators[id].vsel_reg =764764+ s5m8767_get_vsel_reg(id, s5m8767);765765+ if (id < S5M8767_BUCK1)766766+ regulators[id].vsel_mask = 0x3f;767767+ else768768+ regulators[id].vsel_mask = 0xff;899769 }900770901771 config.dev = s5m8767->dev;902772 config.init_data = pdata->regulators[i].initdata;903773 config.driver_data = s5m8767;774774+ config.regmap = iodev->regmap;775775+ config.of_node = pdata->regulators[i].reg_node;904776905777 rdev[i] = regulator_register(®ulators[id], &config);906778 if (IS_ERR(rdev[i])) {
+7-4
include/linux/mfd/samsung/core.h
···2626/**2727 * struct sec_pmic_dev - s5m87xx master device for sub-drivers2828 * @dev: master device of the chip (can be used to access platform data)2929+ * @pdata: pointer to private data used to pass platform data to child2930 * @i2c: i2c client private data for regulator3031 * @rtc: i2c client private data for rtc3132 * @iolock: mutex for serializing io access···4039 */4140struct sec_pmic_dev {4241 struct device *dev;4242+ struct sec_platform_data *pdata;4343 struct regmap *regmap;4444 struct i2c_client *i2c;4545 struct i2c_client *rtc;···84828583 int buck_gpios[3];8684 int buck_ds[3];8787- int buck2_voltage[8];8585+ unsigned int buck2_voltage[8];8886 bool buck2_gpiodvs;8989- int buck3_voltage[8];8787+ unsigned int buck3_voltage[8];9088 bool buck3_gpiodvs;9191- int buck4_voltage[8];8989+ unsigned int buck4_voltage[8];9290 bool buck4_gpiodvs;93919492 int buck_set1;···129127struct sec_regulator_data {130128 int id;131129 struct regulator_init_data *initdata;130130+ struct device_node *reg_node;132131};133132134133/*···139136 */140137struct sec_opmode_data {141138 int id;142142- int mode;139139+ unsigned int mode;143140};144141145142/*