]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Merge remote-tracking branch 'regulator/topic/stub' into regulator-next
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 18 Mar 2012 21:38:20 +0000 (21:38 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 18 Mar 2012 21:38:20 +0000 (21:38 +0000)
1  2 
drivers/regulator/Makefile
drivers/regulator/core.c
drivers/regulator/max8649.c

index ab06474e5eb6881cca912bdf6b7e798c0be50167,f76deb912d5ac1e4ae80f914a6a45026db0baaa7..b5042c885d8921af2d105f55dcf521bf4bd447be
@@@ -3,56 -3,50 +3,56 @@@
  #
  
  
- obj-$(CONFIG_REGULATOR) += core.o dummy.o
+ obj-$(CONFIG_REGULATOR) += core.o dummy.o fixed-helper.o
  obj-$(CONFIG_OF) += of_regulator.o
  obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o
  obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o
  obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o
  
  obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o
 +obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o
 +obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o
 +obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o
 +obj-$(CONFIG_REGULATOR_AB8500)        += ab8500.o
  obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o
 +obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
  obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o
 +obj-$(CONFIG_REGULATOR_DA903X)        += da903x.o
 +obj-$(CONFIG_REGULATOR_DA9052)        += da9052-regulator.o
 +obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
 +obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
 +obj-$(CONFIG_REGULATOR_ISL6271A) += isl6271a-regulator.o
  obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o
  obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o
  obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
 -obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o
  obj-$(CONFIG_REGULATOR_MAX8649)       += max8649.o
  obj-$(CONFIG_REGULATOR_MAX8660) += max8660.o
  obj-$(CONFIG_REGULATOR_MAX8925) += max8925-regulator.o
  obj-$(CONFIG_REGULATOR_MAX8952) += max8952.o
  obj-$(CONFIG_REGULATOR_MAX8997) += max8997.o
  obj-$(CONFIG_REGULATOR_MAX8998) += max8998.o
 -obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o
 -obj-$(CONFIG_REGULATOR_WM831X) += wm831x-isink.o
 -obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o
 -obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o
 -obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o
 -obj-$(CONFIG_REGULATOR_WM8994) += wm8994-regulator.o
 -obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o
 -obj-$(CONFIG_REGULATOR_DA903X)        += da903x.o
 -obj-$(CONFIG_REGULATOR_DA9052)        += da9052-regulator.o
 -obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
 -obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o
  obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o
  obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o
  obj-$(CONFIG_REGULATOR_MC13XXX_CORE) +=  mc13xxx-regulator-core.o
 -obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o
 +obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o
 +obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
 +obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o
  obj-$(CONFIG_REGULATOR_TPS6105X) += tps6105x-regulator.o
 +obj-$(CONFIG_REGULATOR_TPS62360) += tps62360-regulator.o
  obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o
  obj-$(CONFIG_REGULATOR_TPS6507X) += tps6507x-regulator.o
 +obj-$(CONFIG_REGULATOR_TPS65217) += tps65217-regulator.o
  obj-$(CONFIG_REGULATOR_TPS6524X) += tps6524x-regulator.o
 -obj-$(CONFIG_REGULATOR_TPS65912) += tps65912-regulator.o
 -obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o
 -obj-$(CONFIG_REGULATOR_ISL6271A) += isl6271a-regulator.o
 -obj-$(CONFIG_REGULATOR_AB8500)        += ab8500.o
 -obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
 +obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o
  obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o
 -obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o
 +obj-$(CONFIG_REGULATOR_TPS65912) += tps65912-regulator.o
 +obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o
 +obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o
 +obj-$(CONFIG_REGULATOR_WM831X) += wm831x-isink.o
 +obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o
 +obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o
 +obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o
 +obj-$(CONFIG_REGULATOR_WM8994) += wm8994-regulator.o
 +
  
  ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG
diff --combined drivers/regulator/core.c
index fc4ccf880cbc631c33ee71e61223991f69bbbde9,e9a83f84adaf53771d94bd3b3761deb7cad2ca32..8f11d0eb59a52e5073ca18a6f248a522d8da7a53
@@@ -13,6 -13,8 +13,6 @@@
   *
   */
  
 -#define pr_fmt(fmt) "%s: " fmt, __func__
 -
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/debugfs.h>
@@@ -52,7 -54,9 +52,7 @@@ static LIST_HEAD(regulator_map_list)
  static bool has_full_constraints;
  static bool board_wants_dummy_regulator;
  
 -#ifdef CONFIG_DEBUG_FS
  static struct dentry *debugfs_root;
 -#endif
  
  /*
   * struct regulator_map
@@@ -80,7 -84,9 +80,7 @@@ struct regulator 
        char *supply_name;
        struct device_attribute dev_attr;
        struct regulator_dev *rdev;
 -#ifdef CONFIG_DEBUG_FS
        struct dentry *debugfs;
 -#endif
  };
  
  static int _regulator_is_enabled(struct regulator_dev *rdev);
@@@ -148,7 -154,7 +148,7 @@@ static struct device_node *of_get_regul
        regnode = of_parse_phandle(dev->of_node, prop_name, 0);
  
        if (!regnode) {
 -              dev_warn(dev, "%s property in node %s references invalid phandle",
 +              dev_dbg(dev, "Looking up %s property in node %s failed",
                                prop_name, dev->of_node->full_name);
                return NULL;
        }
@@@ -801,11 -807,6 +801,11 @@@ static void print_constraints(struct re
                count += sprintf(buf + count, "standby");
  
        rdev_info(rdev, "%s\n", buf);
 +
 +      if ((constraints->min_uV != constraints->max_uV) &&
 +          !(constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE))
 +              rdev_warn(rdev,
 +                        "Voltage range but no REGULATOR_CHANGE_VOLTAGE\n");
  }
  
  static int machine_constraints_voltage(struct regulator_dev *rdev,
@@@ -1141,10 -1142,12 +1141,10 @@@ static struct regulator *create_regulat
                        goto attr_err;
        }
  
 -#ifdef CONFIG_DEBUG_FS
        regulator->debugfs = debugfs_create_dir(regulator->supply_name,
                                                rdev->debugfs);
 -      if (IS_ERR_OR_NULL(regulator->debugfs)) {
 +      if (!regulator->debugfs) {
                rdev_warn(rdev, "Failed to create debugfs directory\n");
 -              regulator->debugfs = NULL;
        } else {
                debugfs_create_u32("uA_load", 0444, regulator->debugfs,
                                   &regulator->uA_load);
                debugfs_create_u32("max_uV", 0444, regulator->debugfs,
                                   &regulator->max_uV);
        }
 -#endif
  
        mutex_unlock(&rdev->mutex);
        return regulator;
@@@ -1361,7 -1365,9 +1361,7 @@@ void regulator_put(struct regulator *re
        mutex_lock(&regulator_list_mutex);
        rdev = regulator->rdev;
  
 -#ifdef CONFIG_DEBUG_FS
        debugfs_remove_recursive(regulator->debugfs);
 -#endif
  
        /* remove any sysfs entries */
        if (regulator->dev) {
@@@ -1836,12 -1842,8 +1836,12 @@@ static int _regulator_do_set_voltage(st
                        if (ret < 0)
                                return ret;
                        old_selector = ret;
 -                      delay = rdev->desc->ops->set_voltage_time_sel(rdev,
 +                      ret = rdev->desc->ops->set_voltage_time_sel(rdev,
                                                old_selector, selector);
 +                      if (ret < 0)
 +                              rdev_warn(rdev, "set_voltage_time_sel() failed: %d\n", ret);
 +                      else
 +                              delay = ret;
                }
  
                if (best_val != INT_MAX) {
@@@ -2392,7 -2394,7 +2392,7 @@@ int regulator_bulk_get(struct device *d
        return 0;
  
  err:
 -      for (i = 0; i < num_consumers && consumers[i].consumer; i++)
 +      while (--i >= 0)
                regulator_put(consumers[i].consumer);
  
        return ret;
@@@ -2442,9 -2444,12 +2442,9 @@@ int regulator_bulk_enable(int num_consu
        return 0;
  
  err:
 -      for (i = 0; i < num_consumers; i++)
 -              if (consumers[i].ret == 0)
 -                      regulator_disable(consumers[i].consumer);
 -              else
 -                      pr_err("Failed to enable %s: %d\n",
 -                             consumers[i].supply, consumers[i].ret);
 +      pr_err("Failed to enable %s: %d\n", consumers[i].supply, ret);
 +      while (--i >= 0)
 +              regulator_disable(consumers[i].consumer);
  
        return ret;
  }
@@@ -2458,8 -2463,8 +2458,8 @@@ EXPORT_SYMBOL_GPL(regulator_bulk_enable
   * @return         0 on success, an errno on failure
   *
   * This convenience API allows consumers to disable multiple regulator
 - * clients in a single API call.  If any consumers cannot be enabled
 - * then any others that were disabled will be disabled again prior to
 + * clients in a single API call.  If any consumers cannot be disabled
 + * then any others that were disabled will be enabled again prior to
   * return.
   */
  int regulator_bulk_disable(int num_consumers,
        int i;
        int ret;
  
 -      for (i = 0; i < num_consumers; i++) {
 +      for (i = num_consumers - 1; i >= 0; --i) {
                ret = regulator_disable(consumers[i].consumer);
                if (ret != 0)
                        goto err;
  
  err:
        pr_err("Failed to disable %s: %d\n", consumers[i].supply, ret);
 -      for (--i; i >= 0; --i)
 +      for (++i; i < num_consumers; ++i)
                regulator_enable(consumers[i].consumer);
  
        return ret;
@@@ -2705,9 -2710,11 +2705,9 @@@ static int add_regulator_attributes(str
  
  static void rdev_init_debugfs(struct regulator_dev *rdev)
  {
 -#ifdef CONFIG_DEBUG_FS
        rdev->debugfs = debugfs_create_dir(rdev_get_name(rdev), debugfs_root);
 -      if (IS_ERR(rdev->debugfs) || !rdev->debugfs) {
 +      if (!rdev->debugfs) {
                rdev_warn(rdev, "Failed to create debugfs directory\n");
 -              rdev->debugfs = NULL;
                return;
        }
  
                           &rdev->use_count);
        debugfs_create_u32("open_count", 0444, rdev->debugfs,
                           &rdev->open_count);
 -#endif
  }
  
  /**
   * @dev: struct device for the regulator
   * @init_data: platform provided init data, passed through by driver
   * @driver_data: private regulator data
+  * @of_node: OpenFirmware node to parse for device tree bindings (may be
+  *           NULL).
   *
   * Called by regulator drivers to register a regulator.
   * Returns 0 on success.
@@@ -2892,7 -2902,9 +2894,7 @@@ void regulator_unregister(struct regula
                return;
  
        mutex_lock(&regulator_list_mutex);
 -#ifdef CONFIG_DEBUG_FS
        debugfs_remove_recursive(rdev->debugfs);
 -#endif
        flush_work_sync(&rdev->disable_work.work);
        WARN_ON(rdev->open_count);
        unset_regulator_supplies(rdev);
@@@ -3102,14 -3114,12 +3104,14 @@@ static ssize_t supply_map_read_file(str
  
        return ret;
  }
 +#endif
  
  static const struct file_operations supply_map_fops = {
 +#ifdef CONFIG_DEBUG_FS
        .read = supply_map_read_file,
        .llseek = default_llseek,
 -};
  #endif
 +};
  
  static int __init regulator_init(void)
  {
  
        ret = class_register(&regulator_class);
  
 -#ifdef CONFIG_DEBUG_FS
        debugfs_root = debugfs_create_dir("regulator", NULL);
 -      if (IS_ERR(debugfs_root) || !debugfs_root) {
 +      if (!debugfs_root)
                pr_warn("regulator: Failed to create debugfs directory\n");
 -              debugfs_root = NULL;
 -      }
  
 -      if (IS_ERR(debugfs_create_file("supply_map", 0444, debugfs_root,
 -                                     NULL, &supply_map_fops)))
 -              pr_warn("regulator: Failed to create supplies debugfs\n");
 -#endif
 +      debugfs_create_file("supply_map", 0444, debugfs_root, NULL,
 +                          &supply_map_fops);
  
        regulator_dummy_init();
  
index 82505fcb8d436da8927994311e72d63f1e26053c,d0e1180ad961c115fa55ddc4e318b2fbf5e42b31..824c650436edec5c8d3e39fb6d0d3ffcd0233b28
@@@ -101,7 -101,8 +101,7 @@@ static int max8649_set_voltage(struct r
                        min_uV, max_uV);
                return -EINVAL;
        }
 -      data = (min_uV - MAX8649_DCDC_VMIN + MAX8649_DCDC_STEP - 1)
 -              / MAX8649_DCDC_STEP;
 +      data = DIV_ROUND_UP(min_uV - MAX8649_DCDC_VMIN, MAX8649_DCDC_STEP);
        mask = MAX8649_VOL_MASK;
        *selector = data & mask;
  
@@@ -149,7 -150,7 +149,7 @@@ static int max8649_enable_time(struct r
        if (ret != 0)
                return ret;
        val &= MAX8649_VOL_MASK;
-       voltage = max8649_list_voltage(rdev, (unsigned char)ret); /* uV */
+       voltage = max8649_list_voltage(rdev, (unsigned char)val); /* uV */
  
        /* get rate */
        ret = regmap_read(info->regmap, MAX8649_RAMP, &val);
@@@ -269,7 -270,7 +269,7 @@@ static int __devinit max8649_regulator_
                        ret);
                goto out;
        }
 -      dev_info(info->dev, "Detected MAX8649 (ID:%x)\n", ret);
 +      dev_info(info->dev, "Detected MAX8649 (ID:%x)\n", val);
  
        /* enable VID0 & VID1 */
        regmap_update_bits(info->regmap, MAX8649_CONTROL, MAX8649_VID_MASK, 0);