]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
Merge remote-tracking branches 'regulator/topic/helpers', 'regulator/topic/hi655x...
authorMark Brown <broonie@kernel.org>
Sun, 30 Apr 2017 13:17:31 +0000 (22:17 +0900)
committerMark Brown <broonie@kernel.org>
Sun, 30 Apr 2017 13:17:31 +0000 (22:17 +0900)
Documentation/devicetree/bindings/regulator/lm363x-regulator.txt
drivers/regulator/helpers.c
drivers/regulator/hi655x-regulator.c
drivers/regulator/lm363x-regulator.c
drivers/regulator/ltc3589.c
drivers/regulator/ltc3676.c
include/linux/regulator/driver.h

index 8f14df9d120555adcfca9008238d7653cc7a5675..cc5a6151d85ff40c966a88098236b9fee9a6ea74 100644 (file)
@@ -8,8 +8,8 @@ Required property:
 
 Optional properties:
   LM3632 has external enable pins for two LDOs.
-  - ti,lcm-en1-gpio: A GPIO specifier for Vpos control pin.
-  - ti,lcm-en2-gpio: A GPIO specifier for Vneg control pin.
+  - enable-gpios: Two GPIO specifiers for Vpos and Vneg control pins.
+                  The first entry is Vpos, the second is Vneg enable pin.
 
 Child nodes:
   LM3631
@@ -30,5 +30,79 @@ Child nodes:
 
 Examples: Please refer to ti-lmu dt-bindings [2].
 
+lm3631@29 {
+       compatible = "ti,lm3631";
+       reg = <0x29>;
+
+       regulators {
+               compatible = "ti,lm363x-regulator";
+
+               vboost {
+                       regulator-name = "lcd_boost";
+                       regulator-min-microvolt = <4500000>;
+                       regulator-max-microvolt = <6350000>;
+                       regulator-always-on;
+               };
+
+               vcont {
+                       regulator-name = "lcd_vcont";
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <3300000>;
+               };
+
+               voref {
+                       regulator-name = "lcd_voref";
+                       regulator-min-microvolt = <4000000>;
+                       regulator-max-microvolt = <6000000>;
+               };
+
+               vpos {
+                       regulator-name = "lcd_vpos";
+                       regulator-min-microvolt = <4000000>;
+                       regulator-max-microvolt = <6000000>;
+                       regulator-boot-on;
+               };
+
+               vneg {
+                       regulator-name = "lcd_vneg";
+                       regulator-min-microvolt = <4000000>;
+                       regulator-max-microvolt = <6000000>;
+                       regulator-boot-on;
+               };
+       };
+};
+
+lm3632@11 {
+       compatible = "ti,lm3632";
+       reg = <0x11>;
+
+       regulators {
+               compatible = "ti,lm363x-regulator";
+
+               /* GPIO1_16 for Vpos, GPIO1_28 is for Vneg */
+               enable-gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>,
+                               <&gpio1 28 GPIO_ACTIVE_HIGH>;
+
+               vboost {
+                       regulator-name = "lcd_boost";
+                       regulator-min-microvolt = <4500000>;
+                       regulator-max-microvolt = <6400000>;
+                       regulator-always-on;
+               };
+
+               vpos {
+                       regulator-name = "lcd_vpos";
+                       regulator-min-microvolt = <4000000>;
+                       regulator-max-microvolt = <6000000>;
+               };
+
+               vneg {
+                       regulator-name = "lcd_vneg";
+                       regulator-min-microvolt = <4000000>;
+                       regulator-max-microvolt = <6000000>;
+               };
+       };
+};
+
 [1] ../regulator/regulator.txt
 [2] ../mfd/ti-lmu.txt
index 379cdacc05d8ecc76465eba8f2515025c7b9fc16..2ae7c3ac5940ec29b52870f4619905e7040aaf20 100644 (file)
@@ -445,6 +445,42 @@ int regulator_set_bypass_regmap(struct regulator_dev *rdev, bool enable)
 }
 EXPORT_SYMBOL_GPL(regulator_set_bypass_regmap);
 
+/**
+ * regulator_set_soft_start_regmap - Default set_soft_start() using regmap
+ *
+ * @rdev: device to operate on.
+ */
+int regulator_set_soft_start_regmap(struct regulator_dev *rdev)
+{
+       unsigned int val;
+
+       val = rdev->desc->soft_start_val_on;
+       if (!val)
+               val = rdev->desc->soft_start_mask;
+
+       return regmap_update_bits(rdev->regmap, rdev->desc->soft_start_reg,
+                                 rdev->desc->soft_start_mask, val);
+}
+EXPORT_SYMBOL_GPL(regulator_set_soft_start_regmap);
+
+/**
+ * regulator_set_pull_down_regmap - Default set_pull_down() using regmap
+ *
+ * @rdev: device to operate on.
+ */
+int regulator_set_pull_down_regmap(struct regulator_dev *rdev)
+{
+       unsigned int val;
+
+       val = rdev->desc->pull_down_val_on;
+       if (!val)
+               val = rdev->desc->pull_down_mask;
+
+       return regmap_update_bits(rdev->regmap, rdev->desc->pull_down_reg,
+                                 rdev->desc->pull_down_mask, val);
+}
+EXPORT_SYMBOL_GPL(regulator_set_pull_down_regmap);
+
 /**
  * regulator_get_bypass_regmap - Default get_bypass() using regmap
  *
index 065c100e9a03592f53a4b981fe71899a1b236cba..36ae54b53814b36859b149993a198be1c269bf64 100644 (file)
@@ -214,7 +214,14 @@ static int hi655x_regulator_probe(struct platform_device *pdev)
        return 0;
 }
 
+static const struct platform_device_id hi655x_regulator_table[] = {
+       { .name = "hi655x-regulator" },
+       {},
+};
+MODULE_DEVICE_TABLE(platform, hi655x_regulator_table);
+
 static struct platform_driver hi655x_regulator_driver = {
+       .id_table = hi655x_regulator_table,
        .driver = {
                .name   = "hi655x-regulator",
        },
index f53e63301a2054d7a822f5017a8e9a2d7d5a35b4..ce5f7d9ad475f420c88a731ec9e1c44378a17c44 100644 (file)
@@ -227,9 +227,9 @@ static int lm363x_regulator_of_get_enable_gpio(struct device_node *np, int id)
         */
        switch (id) {
        case LM3632_LDO_POS:
-               return of_get_named_gpio(np, "ti,lcm-en1-gpio", 0);
+               return of_get_named_gpio(np, "enable-gpios", 0);
        case LM3632_LDO_NEG:
-               return of_get_named_gpio(np, "ti,lcm-en2-gpio", 0);
+               return of_get_named_gpio(np, "enable-gpios", 1);
        default:
                return -EINVAL;
        }
index a7a1a0313bbfc68625080012e681f50916fe947f..853a06ad86d6c429cc52683b88566712ae431ea2 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/regmap.h>
 #include <linux/regulator/driver.h>
 #include <linux/regulator/of_regulator.h>
@@ -470,7 +471,11 @@ static int ltc3589_probe(struct i2c_client *client,
                return -ENOMEM;
 
        i2c_set_clientdata(client, ltc3589);
-       ltc3589->variant = id->driver_data;
+       if (client->dev.of_node)
+               ltc3589->variant = (enum ltc3589_variant)
+                       of_device_get_match_data(&client->dev);
+       else
+               ltc3589->variant = id->driver_data;
        ltc3589->dev = dev;
 
        descs = ltc3589->regulator_descs;
@@ -542,9 +547,27 @@ static struct i2c_device_id ltc3589_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, ltc3589_i2c_id);
 
+static const struct of_device_id ltc3589_of_match[] = {
+       {
+               .compatible = "lltc,ltc3589",
+               .data = (void *)LTC3589,
+       },
+       {
+               .compatible = "lltc,ltc3589-1",
+               .data = (void *)LTC3589_1,
+       },
+       {
+               .compatible = "lltc,ltc3589-2",
+               .data = (void *)LTC3589_2,
+       },
+       { },
+};
+MODULE_DEVICE_TABLE(of, ltc3589_of_match);
+
 static struct i2c_driver ltc3589_driver = {
        .driver = {
                .name = DRIVER_NAME,
+               .of_match_table = of_match_ptr(ltc3589_of_match),
        },
        .probe = ltc3589_probe,
        .id_table = ltc3589_i2c_id,
index 503cd90eba393439114a05c0c8d5e788216d7653..662ee05ea44d7c0cea7d0abf69c9503d887f3529 100644 (file)
@@ -406,9 +406,16 @@ static const struct i2c_device_id ltc3676_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, ltc3676_i2c_id);
 
+static const struct of_device_id ltc3676_of_match[] = {
+       { .compatible = "lltc,ltc3676" },
+       { },
+};
+MODULE_DEVICE_TABLE(of, ltc3676_of_match);
+
 static struct i2c_driver ltc3676_driver = {
        .driver = {
                .name = DRIVER_NAME,
+               .of_match_table = of_match_ptr(ltc3676_of_match),
        },
        .probe = ltc3676_regulator_probe,
        .id_table = ltc3676_i2c_id,
index 4cb1c9be60732faef3633a1b6ea25a99a09f061c..94417b4226bd88a42d5d53c845266ee97ec30879 100644 (file)
@@ -292,6 +292,14 @@ enum regulator_type {
  *                        set_active_discharge
  * @active_discharge_reg: Register for control when using regmap
  *                       set_active_discharge
+ * @soft_start_reg: Register for control when using regmap set_soft_start
+ * @soft_start_mask: Mask for control when using regmap set_soft_start
+ * @soft_start_val_on: Enabling value for control when using regmap
+ *                     set_soft_start
+ * @pull_down_reg: Register for control when using regmap set_pull_down
+ * @pull_down_mask: Mask for control when using regmap set_pull_down
+ * @pull_down_val_on: Enabling value for control when using regmap
+ *                     set_pull_down
  *
  * @enable_time: Time taken for initial enable of regulator (in uS).
  * @off_on_delay: guard time (in uS), before re-enabling a regulator
@@ -345,6 +353,12 @@ struct regulator_desc {
        unsigned int active_discharge_off;
        unsigned int active_discharge_mask;
        unsigned int active_discharge_reg;
+       unsigned int soft_start_reg;
+       unsigned int soft_start_mask;
+       unsigned int soft_start_val_on;
+       unsigned int pull_down_reg;
+       unsigned int pull_down_mask;
+       unsigned int pull_down_val_on;
 
        unsigned int enable_time;
 
@@ -478,6 +492,8 @@ int regulator_set_voltage_time_sel(struct regulator_dev *rdev,
                                   unsigned int new_selector);
 int regulator_set_bypass_regmap(struct regulator_dev *rdev, bool enable);
 int regulator_get_bypass_regmap(struct regulator_dev *rdev, bool *enable);
+int regulator_set_soft_start_regmap(struct regulator_dev *rdev);
+int regulator_set_pull_down_regmap(struct regulator_dev *rdev);
 
 int regulator_set_active_discharge_regmap(struct regulator_dev *rdev,
                                          bool enable);