Merge remote-tracking branches 'regulator/topic/act8865', 'regulator/topic/anatop...
authorMark Brown <broonie@kernel.org>
Wed, 4 Nov 2015 11:19:37 +0000 (11:19 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 4 Nov 2015 11:19:37 +0000 (11:19 +0000)
1  2  3  4  5  6 
drivers/regulator/anatop-regulator.c
drivers/regulator/axp20x-regulator.c

index 52ea605f813060e68d92b4c47fcf400701810373,738adfa5332bcdc5f3ef935436dcf79ca512ea62,7d99f2c8cef3e95f48667cb3f12530138adb1895,738adfa5332bcdc5f3ef935436dcf79ca512ea62,738adfa5332bcdc5f3ef935436dcf79ca512ea62,738adfa5332bcdc5f3ef935436dcf79ca512ea62..63cd5e68c86494724eae44502bed2d7f590cbf78
      #include <linux/regmap.h>
      #include <linux/regulator/driver.h>
      #include <linux/regulator/of_regulator.h>
++ +++#include <linux/regulator/machine.h>
      
      #define LDO_RAMP_UP_UNIT_IN_CYCLES      64 /* 64 cycles per step */
      #define LDO_RAMP_UP_FREQ_IN_MHZ         24 /* cycle based on 24M OSC */
@@@@@@@ -199,6 -199,6 -200,7 -199,6 -199,6 -199,6 +200,7 @@@@@@@ static int anatop_regulator_probe(struc
        rdesc->owner = THIS_MODULE;
      
        initdata = of_get_regulator_init_data(dev, np, rdesc);
++ +++  initdata->supply_regulator = "vin";
        sreg->initdata = initdata;
      
        anatop_np = of_get_parent(np);
        rdesc->vsel_reg = sreg->control_reg;
        rdesc->vsel_mask = ((1 << sreg->vol_bit_width) - 1) <<
                           sreg->vol_bit_shift;
++ +++  rdesc->min_dropout_uV = 125000;
      
        config.dev = &pdev->dev;
        config.init_data = initdata;
@@@@@@@ -318,7 -318,6 -321,6 -318,6 -318,6 -318,6 +321,7 @@@@@@@ static const struct of_device_id of_ana
        { .compatible = "fsl,anatop-regulator", },
        { /* end */ }
      };
 +++++MODULE_DEVICE_TABLE(of, of_anatop_regulator_match_tbl);
      
      static struct platform_driver anatop_regulator_driver = {
        .driver = {
index a9567af7cec02c5a13102be118010e7bb7b1c888,01bf3476a79183714f62f67efcf5d8b17b70d497,01bf3476a79183714f62f67efcf5d8b17b70d497,01bf3476a79183714f62f67efcf5d8b17b70d497,56a0805e6494b96dc32bbbdead7dd91ef9240ca9,01bf3476a79183714f62f67efcf5d8b17b70d497..35de22fdb7a06d96e0bb7bdf3e199165b5b83cc1
@@@@@@@ -192,14 -192,14 -192,14 -192,14 -192,14 -192,14 +192,14 @@@@@@@ static const struct regulator_desc axp2
        AXP_DESC(AXP22X, DCDC3, "dcdc3", "vin3", 600, 1860, 20,
                 AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)),
        AXP_DESC(AXP22X, DCDC4, "dcdc4", "vin4", 600, 1540, 20,
 -----           AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)),
 +++++           AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(4)),
        AXP_DESC(AXP22X, DCDC5, "dcdc5", "vin5", 1000, 2550, 50,
 -----           AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(4)),
 +++++           AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(5)),
        /* secondary switchable output of DCDC1 */
---- -  AXP_DESC_SW(AXP22X, DC1SW, "dc1sw", "dcdc1", 1600, 3400, 100,
++++ +  AXP_DESC_SW(AXP22X, DC1SW, "dc1sw", NULL, 1600, 3400, 100,
                    AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(7)),
        /* LDO regulator internally chained to DCDC5 */
---- -  AXP_DESC(AXP22X, DC5LDO, "dc5ldo", "dcdc5", 700, 1400, 100,
++++ +  AXP_DESC(AXP22X, DC5LDO, "dc5ldo", NULL, 700, 1400, 100,
                 AXP22X_DC5LDO_V_OUT, 0x7, AXP22X_PWR_OUT_CTRL1, BIT(0)),
        AXP_DESC(AXP22X, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
                 AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(6)),
@@@@@@@ -350,6 -350,6 -350,6 -350,6 -350,8 -350,6 +350,8 @@@@@@@ static int axp20x_regulator_probe(struc
        };
        int ret, i, nregulators;
        u32 workmode;
++++ +  const char *axp22x_dc1_name = axp22x_regulators[AXP22X_DCDC1].name;
++++ +  const char *axp22x_dc5_name = axp22x_regulators[AXP22X_DCDC5].name;
      
        switch (axp20x->variant) {
        case AXP202_ID:
        axp20x_regulator_parse_dt(pdev);
      
        for (i = 0; i < nregulators; i++) {
---- -          rdev = devm_regulator_register(&pdev->dev, &regulators[i],
---- -                                         &config);
++++ +          const struct regulator_desc *desc = &regulators[i];
++++ +          struct regulator_desc *new_desc;
++++ +
++++ +          /*
++++ +           * Regulators DC1SW and DC5LDO are connected internally,
++++ +           * so we have to handle their supply names separately.
++++ +           *
++++ +           * We always register the regulators in proper sequence,
++++ +           * so the supply names are correctly read. See the last
++++ +           * part of this loop to see where we save the DT defined
++++ +           * name.
++++ +           */
++++ +          if (regulators == axp22x_regulators) {
++++ +                  if (i == AXP22X_DC1SW) {
++++ +                          new_desc = devm_kzalloc(&pdev->dev,
++++ +                                                  sizeof(*desc),
++++ +                                                  GFP_KERNEL);
++++ +                          *new_desc = regulators[i];
++++ +                          new_desc->supply_name = axp22x_dc1_name;
++++ +                          desc = new_desc;
++++ +                  } else if (i == AXP22X_DC5LDO) {
++++ +                          new_desc = devm_kzalloc(&pdev->dev,
++++ +                                                  sizeof(*desc),
++++ +                                                  GFP_KERNEL);
++++ +                          *new_desc = regulators[i];
++++ +                          new_desc->supply_name = axp22x_dc5_name;
++++ +                          desc = new_desc;
++++ +                  }
++++ +          }
++++ +
++++ +          rdev = devm_regulator_register(&pdev->dev, desc, &config);
                if (IS_ERR(rdev)) {
                        dev_err(&pdev->dev, "Failed to register %s\n",
                                regulators[i].name);
                                dev_err(&pdev->dev, "Failed to set workmode on %s\n",
                                        rdev->desc->name);
                }
++++ +
++++ +          /*
++++ +           * Save AXP22X DCDC1 / DCDC5 regulator names for later.
++++ +           */
++++ +          if (regulators == axp22x_regulators) {
++++ +                  /* Can we use rdev->constraints->name instead? */
++++ +                  if (i == AXP22X_DCDC1)
++++ +                          of_property_read_string(rdev->dev.of_node,
++++ +                                                  "regulator-name",
++++ +                                                  &axp22x_dc1_name);
++++ +                  else if (i == AXP22X_DCDC5)
++++ +                          of_property_read_string(rdev->dev.of_node,
++++ +                                                  "regulator-name",
++++ +                                                  &axp22x_dc5_name);
++++ +          }
        }
      
        return 0;