Merge remote-tracking branches 'regulator/topic/settle', 'regulator/topic/tps65910...
authorMark Brown <broonie@kernel.org>
Mon, 3 Jul 2017 15:52:21 +0000 (16:52 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 3 Jul 2017 15:52:21 +0000 (16:52 +0100)
1  2  3  4 
drivers/regulator/core.c
drivers/regulator/palmas-regulator.c

diff --combined drivers/regulator/core.c
@@@@@ -1462,7 -1462,7 -1462,7 -1462,7 +1462,7 @@@@@ static struct regulator_dev *regulator_
    static struct regulator_dev *regulator_dev_lookup(struct device *dev,
                                                  const char *supply)
    {
 ---    struct regulator_dev *r;
 +++    struct regulator_dev *r = NULL;
        struct device_node *node;
        struct regulator_map *map;
        const char *devname = NULL;
        if (dev)
                devname = dev_name(dev);
    
 ---    r = regulator_lookup_by_name(supply);
 ---    if (r)
 ---            return r;
 ---
        mutex_lock(&regulator_list_mutex);
        list_for_each_entry(map, &regulator_map_list, list) {
                /* If the mapping has a device set up it must match */
        if (r)
                return r;
    
 +++    r = regulator_lookup_by_name(supply);
 +++    if (r)
 +++            return r;
 +++
        return ERR_PTR(-ENODEV);
    }
    
@@@@@ -2767,6 -2767,12 -2767,6 -2767,6 +2767,12 @@@@@ static int _regulator_set_voltage_time(
                ramp_delay = rdev->desc->ramp_delay;
        else if (rdev->constraints->settling_time)
                return rdev->constraints->settling_time;
+ ++    else if (rdev->constraints->settling_time_up &&
+ ++             (new_uV > old_uV))
+ ++            return rdev->constraints->settling_time_up;
+ ++    else if (rdev->constraints->settling_time_down &&
+ ++             (new_uV < old_uV))
+ ++            return rdev->constraints->settling_time_down;
    
        if (ramp_delay == 0) {
                rdev_dbg(rdev, "ramp_delay not set\n");
@@@@@ -2938,8 -2944,7 -2938,7 -2938,7 +2944,8 @@@@@ static int regulator_set_voltage_unlock
        if (rdev->supply &&
            regulator_ops_is_valid(rdev->supply->rdev,
                                   REGULATOR_CHANGE_VOLTAGE) &&
 ---        (rdev->desc->min_dropout_uV || !rdev->desc->ops->get_voltage)) {
 +++        (rdev->desc->min_dropout_uV || !(rdev->desc->ops->get_voltage ||
 +++                                       rdev->desc->ops->get_voltage_sel))) {
                int current_supply_uV;
                int selector;
    
@@@@@ -4312,31 -4317,41 -4311,41 -4311,41 +4318,31 @@@@@ void *regulator_get_init_drvdata(struc
    EXPORT_SYMBOL_GPL(regulator_get_init_drvdata);
    
    #ifdef CONFIG_DEBUG_FS
 ---static ssize_t supply_map_read_file(struct file *file, char __user *user_buf,
 ---                                size_t count, loff_t *ppos)
 +++static int supply_map_show(struct seq_file *sf, void *data)
    {
 ---    char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
 ---    ssize_t len, ret = 0;
        struct regulator_map *map;
    
 ---    if (!buf)
 ---            return -ENOMEM;
 ---
        list_for_each_entry(map, &regulator_map_list, list) {
 ---            len = snprintf(buf + ret, PAGE_SIZE - ret,
 ---                           "%s -> %s.%s\n",
 ---                           rdev_get_name(map->regulator), map->dev_name,
 ---                           map->supply);
 ---            if (len >= 0)
 ---                    ret += len;
 ---            if (ret > PAGE_SIZE) {
 ---                    ret = PAGE_SIZE;
 ---                    break;
 ---            }
 +++            seq_printf(sf, "%s -> %s.%s\n",
 +++                            rdev_get_name(map->regulator), map->dev_name,
 +++                            map->supply);
        }
    
 ---    ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
 ---
 ---    kfree(buf);
 +++    return 0;
 +++}
    
 ---    return ret;
 +++static int supply_map_open(struct inode *inode, struct file *file)
 +++{
 +++    return single_open(file, supply_map_show, inode->i_private);
    }
    #endif
    
    static const struct file_operations supply_map_fops = {
    #ifdef CONFIG_DEBUG_FS
 ---    .read = supply_map_read_file,
 ---    .llseek = default_llseek,
 +++    .open = supply_map_open,
 +++    .read = seq_read,
 +++    .llseek = seq_lseek,
 +++    .release = single_release,
    #endif
    };
    
@@@@@ -264,6 -264,6 -264,6 -264,13 +264,13 @@@@@ static struct palmas_regs_info tps65917
                .sleep_id       = TPS65917_EXTERNAL_REQSTR_ID_SMPS5,
        },
        {
+++             .name           = "SMPS12",
+++             .sname          = "smps1-in",
+++             .vsel_addr      = TPS65917_SMPS1_VOLTAGE,
+++             .ctrl_addr      = TPS65917_SMPS1_CTRL,
+++             .sleep_id       = TPS65917_EXTERNAL_REQSTR_ID_SMPS12,
+++     },
+++     {
                .name           = "LDO1",
                .sname          = "ldo1-in",
                .vsel_addr      = TPS65917_LDO1_VOLTAGE,
@@@@@ -367,6 -367,6 -367,6 -374,7 +374,7 @@@@@ static struct palmas_sleep_requestor_in
        EXTERNAL_REQUESTOR_TPS65917(SMPS3, 1, 2),
        EXTERNAL_REQUESTOR_TPS65917(SMPS4, 1, 3),
        EXTERNAL_REQUESTOR_TPS65917(SMPS5, 1, 4),
+++     EXTERNAL_REQUESTOR_TPS65917(SMPS12, 1, 5),
        EXTERNAL_REQUESTOR_TPS65917(LDO1, 2, 0),
        EXTERNAL_REQUESTOR_TPS65917(LDO2, 2, 1),
        EXTERNAL_REQUESTOR_TPS65917(LDO3, 2, 2),
@@@@@ -1305,7 -1305,7 -1305,7 -1313,8 +1313,8 @@@@@ static int tps65917_smps_registration(s
                 */
                desc = &pmic->desc[id];
                desc->n_linear_ranges = 3;
---             if ((id == TPS65917_REG_SMPS2) && pmic->smps12)
+++             if ((id == TPS65917_REG_SMPS2 || id == TPS65917_REG_SMPS1) &&
+++                 pmic->smps12)
                        continue;
    
                /* Initialise sleep/init values from platform data */
@@@@@ -1427,6 -1427,6 -1427,6 -1436,7 +1436,7 @@@@@ static struct of_regulator_match tps659
        { .name = "smps3", },
        { .name = "smps4", },
        { .name = "smps5", },
+++     { .name = "smps12",},
        { .name = "ldo1", },
        { .name = "ldo2", },
        { .name = "ldo3", },
@@@@@ -1455,7 -1455,7 -1455,7 -1465,7 +1465,7 @@@@@ static struct palmas_pmic_driver_data p
    
    static struct palmas_pmic_driver_data tps65917_ddata = {
        .smps_start = TPS65917_REG_SMPS1,
---     .smps_end = TPS65917_REG_SMPS5,
+++     .smps_end = TPS65917_REG_SMPS12,
        .ldo_begin = TPS65917_REG_LDO1,
        .ldo_end = TPS65917_REG_LDO5,
        .max_reg = TPS65917_NUM_REGS,
@@@@@ -1491,7 -1491,7 -1491,7 -1501,7 +1501,7 @@@@@ static int palmas_dt_to_pdata(struct de
        }
    
        for (idx = 0; idx < ddata->max_reg; idx++) {
 ---            static struct of_regulator_match *match;
 +++            struct of_regulator_match *match;
                struct palmas_reg_init *rinit;
                struct device_node *np;
    
@@@@@ -1643,8 -1643,8 -1643,8 -1653,10 +1653,10 @@@@@ static int palmas_regulators_probe(stru
        if (ret)
                return ret;
    
---     if (reg & PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN)
+++     if (reg & PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN) {
                pmic->smps123 = 1;
+++             pmic->smps12 = 1;
+++     }
    
        if (reg & PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN)
                pmic->smps457 = 1;