From 71979aa3c431f0b2e00c4151f399813fceea6e0d Mon Sep 17 00:00:00 2001 From: Charles Keepax Date: Fri, 15 Nov 2013 13:13:32 +0000 Subject: regulator: arizona-micsupp: Convert to use linear ranges Signed-off-by: Charles Keepax Signed-off-by: Mark Brown --- drivers/regulator/arizona-micsupp.c | 52 ++++++++----------------------------- 1 file changed, 11 insertions(+), 41 deletions(-) diff --git a/drivers/regulator/arizona-micsupp.c b/drivers/regulator/arizona-micsupp.c index 724706a..3c75bf8 100644 --- a/drivers/regulator/arizona-micsupp.c +++ b/drivers/regulator/arizona-micsupp.c @@ -28,8 +28,6 @@ #include #include -#define ARIZONA_MICSUPP_MAX_SELECTOR 0x1f - struct arizona_micsupp { struct regulator_dev *regulator; struct arizona *arizona; @@ -40,42 +38,6 @@ struct arizona_micsupp { struct work_struct check_cp_work; }; -static int arizona_micsupp_list_voltage(struct regulator_dev *rdev, - unsigned int selector) -{ - if (selector > ARIZONA_MICSUPP_MAX_SELECTOR) - return -EINVAL; - - if (selector == ARIZONA_MICSUPP_MAX_SELECTOR) - return 3300000; - else - return (selector * 50000) + 1700000; -} - -static int arizona_micsupp_map_voltage(struct regulator_dev *rdev, - int min_uV, int max_uV) -{ - unsigned int voltage; - int selector; - - if (min_uV < 1700000) - min_uV = 1700000; - - if (min_uV > 3200000) - selector = ARIZONA_MICSUPP_MAX_SELECTOR; - else - selector = DIV_ROUND_UP(min_uV - 1700000, 50000); - - if (selector < 0) - return -EINVAL; - - voltage = arizona_micsupp_list_voltage(rdev, selector); - if (voltage < min_uV || voltage > max_uV) - return -EINVAL; - - return selector; -} - static void arizona_micsupp_check_cp(struct work_struct *work) { struct arizona_micsupp *micsupp = @@ -145,8 +107,8 @@ static struct regulator_ops arizona_micsupp_ops = { .disable = arizona_micsupp_disable, .is_enabled = regulator_is_enabled_regmap, - .list_voltage = arizona_micsupp_list_voltage, - .map_voltage = arizona_micsupp_map_voltage, + .list_voltage = regulator_list_voltage_linear_range, + .map_voltage = regulator_map_voltage_linear_range, .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap, @@ -155,11 +117,16 @@ static struct regulator_ops arizona_micsupp_ops = { .set_bypass = arizona_micsupp_set_bypass, }; +static const struct regulator_linear_range arizona_micsupp_ranges[] = { + REGULATOR_LINEAR_RANGE(1700000, 0, 0x1e, 50000), + REGULATOR_LINEAR_RANGE(3300000, 0x1f, 0x1f, 0), +}; + static const struct regulator_desc arizona_micsupp = { .name = "MICVDD", .supply_name = "CPVDD", .type = REGULATOR_VOLTAGE, - .n_voltages = ARIZONA_MICSUPP_MAX_SELECTOR + 1, + .n_voltages = 32, .ops = &arizona_micsupp_ops, .vsel_reg = ARIZONA_LDO2_CONTROL_1, @@ -169,6 +136,9 @@ static const struct regulator_desc arizona_micsupp = { .bypass_reg = ARIZONA_MIC_CHARGE_PUMP_1, .bypass_mask = ARIZONA_CPMIC_BYPASS, + .linear_ranges = arizona_micsupp_ranges, + .n_linear_ranges = ARRAY_SIZE(arizona_micsupp_ranges), + .enable_time = 3000, .owner = THIS_MODULE, -- cgit v1.1 From 34c040ce1a9d9c13121c95101164383ce516ddd6 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Tue, 3 Dec 2013 15:08:22 +0100 Subject: regulator: ab8500: delete non-devicetree probe path The Ux500 platform has been converted to do device-tree only boots, no longer supports platform data passing, so this probe path is unused. Delete it, simplifying the driver a whole lot. Signed-off-by: Linus Walleij Acked-by: Lee Jones Signed-off-by: Mark Brown --- drivers/regulator/ab8500.c | 102 ++++----------------------------------------- 1 file changed, 8 insertions(+), 94 deletions(-) diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index 603f192..0f86695 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -2998,37 +2998,6 @@ static void abx500_get_regulator_info(struct ab8500 *ab8500) } } -static int ab8500_regulator_init_registers(struct platform_device *pdev, - int id, int mask, int value) -{ - struct ab8500_reg_init *reg_init = abx500_regulator.init; - int err; - - BUG_ON(value & ~mask); - BUG_ON(mask & ~reg_init[id].mask); - - /* initialize register */ - err = abx500_mask_and_set_register_interruptible( - &pdev->dev, - reg_init[id].bank, - reg_init[id].addr, - mask, value); - if (err < 0) { - dev_err(&pdev->dev, - "Failed to initialize 0x%02x, 0x%02x.\n", - reg_init[id].bank, - reg_init[id].addr); - return err; - } - dev_vdbg(&pdev->dev, - " init: 0x%02x, 0x%02x, 0x%02x, 0x%02x\n", - reg_init[id].bank, - reg_init[id].addr, - mask, value); - - return 0; -} - static int ab8500_regulator_register(struct platform_device *pdev, struct regulator_init_data *init_data, int id, struct device_node *np) @@ -3095,9 +3064,7 @@ static int ab8500_regulator_probe(struct platform_device *pdev) { struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); struct device_node *np = pdev->dev.of_node; - struct ab8500_platform_data *ppdata; - struct ab8500_regulator_platform_data *pdata; - int i, err; + int err; if (!ab8500) { dev_err(&pdev->dev, "null mfd parent\n"); @@ -3106,68 +3073,15 @@ static int ab8500_regulator_probe(struct platform_device *pdev) abx500_get_regulator_info(ab8500); - if (np) { - err = of_regulator_match(&pdev->dev, np, - abx500_regulator.match, - abx500_regulator.match_size); - if (err < 0) { - dev_err(&pdev->dev, - "Error parsing regulator init data: %d\n", err); - return err; - } - - err = ab8500_regulator_of_probe(pdev, np); - return err; - } - - ppdata = dev_get_platdata(ab8500->dev); - if (!ppdata) { - dev_err(&pdev->dev, "null parent pdata\n"); - return -EINVAL; - } - - pdata = ppdata->regulator; - if (!pdata) { - dev_err(&pdev->dev, "null pdata\n"); - return -EINVAL; - } - - /* make sure the platform data has the correct size */ - if (pdata->num_regulator != abx500_regulator.info_size) { - dev_err(&pdev->dev, "Configuration error: size mismatch.\n"); - return -EINVAL; - } - - /* initialize debug (initial state is recorded with this call) */ - err = ab8500_regulator_debug_init(pdev); - if (err) + err = of_regulator_match(&pdev->dev, np, + abx500_regulator.match, + abx500_regulator.match_size); + if (err < 0) { + dev_err(&pdev->dev, + "Error parsing regulator init data: %d\n", err); return err; - - /* initialize registers */ - for (i = 0; i < pdata->num_reg_init; i++) { - int id, mask, value; - - id = pdata->reg_init[i].id; - mask = pdata->reg_init[i].mask; - value = pdata->reg_init[i].value; - - /* check for configuration errors */ - BUG_ON(id >= abx500_regulator.init_size); - - err = ab8500_regulator_init_registers(pdev, id, mask, value); - if (err < 0) - return err; - } - - /* register all regulators */ - for (i = 0; i < abx500_regulator.info_size; i++) { - err = ab8500_regulator_register(pdev, &pdata->regulator[i], - i, NULL); - if (err < 0) - return err; } - - return 0; + return ab8500_regulator_of_probe(pdev, np); } static int ab8500_regulator_remove(struct platform_device *pdev) -- cgit v1.1 From baafdc1d20a97c5c243f78981c95eadbd3b40caf Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Fri, 6 Dec 2013 16:07:09 +0900 Subject: regulator: ab8500: use devm_regulator_register() Use devm_regulator_register() to make cleanup paths simpler. Signed-off-by: Jingoo Han Acked-by: Lee Jones Signed-off-by: Mark Brown --- drivers/regulator/ab8500.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index 0f86695..c625468 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -3005,7 +3005,6 @@ static int ab8500_regulator_register(struct platform_device *pdev, struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); struct ab8500_regulator_info *info = NULL; struct regulator_config config = { }; - int err; /* assign per-regulator data */ info = &abx500_regulator.info[id]; @@ -3027,17 +3026,12 @@ static int ab8500_regulator_register(struct platform_device *pdev, } /* register regulator with framework */ - info->regulator = regulator_register(&info->desc, &config); + info->regulator = devm_regulator_register(&pdev->dev, &info->desc, + &config); if (IS_ERR(info->regulator)) { - err = PTR_ERR(info->regulator); dev_err(&pdev->dev, "failed to register regulator %s\n", info->desc.name); - /* when we fail, un-register all earlier regulators */ - while (--id >= 0) { - info = &abx500_regulator.info[id]; - regulator_unregister(info->regulator); - } - return err; + return PTR_ERR(info->regulator); } return 0; @@ -3086,17 +3080,7 @@ static int ab8500_regulator_probe(struct platform_device *pdev) static int ab8500_regulator_remove(struct platform_device *pdev) { - int i, err; - - for (i = 0; i < abx500_regulator.info_size; i++) { - struct ab8500_regulator_info *info = NULL; - info = &abx500_regulator.info[i]; - - dev_vdbg(rdev_get_dev(info->regulator), - "%s-remove\n", info->desc.name); - - regulator_unregister(info->regulator); - } + int err; /* remove regulator debug */ err = ab8500_regulator_debug_exit(pdev); -- cgit v1.1 From bc2571f4ba375101c9d0b7d46d8c241822652433 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 20 Dec 2013 10:57:49 +0800 Subject: regulator: as3722: Don't set min_uV/uV_step/linear_min_sel for linear_ranges These settings are not used when using linear_ranges and it makes the code looks confusing. Thus remove them. Signed-off-by: Axel Lin Acked-by: Laxman Dewangan Signed-off-by: Mark Brown --- drivers/regulator/as3722-regulator.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c index 5917fe3..fdb3137 100644 --- a/drivers/regulator/as3722-regulator.c +++ b/drivers/regulator/as3722-regulator.c @@ -842,9 +842,6 @@ static int as3722_regulator_probe(struct platform_device *pdev) ops = &as3722_ldo_extcntrl_ops; else ops = &as3722_ldo_ops; - as3722_regs->desc[id].min_uV = 825000; - as3722_regs->desc[id].uV_step = 25000; - as3722_regs->desc[id].linear_min_sel = 1; as3722_regs->desc[id].enable_time = 500; as3722_regs->desc[id].linear_ranges = as3722_ldo_ranges; as3722_regs->desc[id].n_linear_ranges = -- cgit v1.1 From 33036f48d13caaa31a568dc677cc76739f440e6e Mon Sep 17 00:00:00 2001 From: Wenyou Yang Date: Tue, 24 Dec 2013 10:34:28 +0800 Subject: regulator: act8865: add PMIC act8865 driver Signed-off-by: Wenyou Yang Signed-off-by: Mark Brown --- drivers/regulator/Kconfig | 8 + drivers/regulator/Makefile | 1 + drivers/regulator/act8865-regulator.c | 368 ++++++++++++++++++++++++++++++++++ include/linux/regulator/act8865.h | 53 +++++ 4 files changed, 430 insertions(+) create mode 100644 drivers/regulator/act8865-regulator.c create mode 100644 include/linux/regulator/act8865.h diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index ce785f4..63bc1ba 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -70,6 +70,14 @@ config REGULATOR_88PM8607 help This driver supports 88PM8607 voltage regulator chips. +config REGULATOR_ACT8865 + tristate "Active-semi act8865 voltage regulator" + depends on I2C + select REGMAP_I2C + help + This driver controls a active-semi act8865 voltage output + regulator via I2C bus. + config REGULATOR_AD5398 tristate "Analog Devices AD5398/AD5821 regulators" depends on I2C diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 01c597e..3bb3a55 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o obj-$(CONFIG_REGULATOR_AB8500) += ab8500-ext.o ab8500.o +obj-$(CONFIG_REGULATOR_ACT8865) += act8865-regulator.o obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c new file mode 100644 index 0000000..db048f2 --- /dev/null +++ b/drivers/regulator/act8865-regulator.c @@ -0,0 +1,368 @@ +/* + * act8865-regulator.c - Voltage regulation for the active-semi ACT8865 + * http://www.active-semi.com/sheets/ACT8865_Datasheet.pdf + * + * Copyright (C) 2013 Atmel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * ACT8865 Global Register Map. + */ +#define ACT8865_SYS_MODE 0x00 +#define ACT8865_SYS_CTRL 0x01 +#define ACT8865_DCDC1_VSET1 0x20 +#define ACT8865_DCDC1_VSET2 0x21 +#define ACT8865_DCDC1_CTRL 0x22 +#define ACT8865_DCDC2_VSET1 0x30 +#define ACT8865_DCDC2_VSET2 0x31 +#define ACT8865_DCDC2_CTRL 0x32 +#define ACT8865_DCDC3_VSET1 0x40 +#define ACT8865_DCDC3_VSET2 0x41 +#define ACT8865_DCDC3_CTRL 0x42 +#define ACT8865_LDO1_VSET 0x50 +#define ACT8865_LDO1_CTRL 0x51 +#define ACT8865_LDO2_VSET 0x54 +#define ACT8865_LDO2_CTRL 0x55 +#define ACT8865_LDO3_VSET 0x60 +#define ACT8865_LDO3_CTRL 0x61 +#define ACT8865_LDO4_VSET 0x64 +#define ACT8865_LDO4_CTRL 0x65 + +/* + * Field Definitions. + */ +#define ACT8865_ENA 0x80 /* ON - [7] */ +#define ACT8865_VSEL_MASK 0x3F /* VSET - [5:0] */ + +/* + * ACT8865 voltage number + */ +#define ACT8865_VOLTAGE_NUM 64 + +struct act8865 { + struct regulator_dev *rdev[ACT8865_REG_NUM]; + struct regmap *regmap; +}; + +static const struct regmap_config act8865_regmap_config = { + .reg_bits = 8, + .val_bits = 8, +}; + +static const struct regulator_linear_range act8865_volatge_ranges[] = { + REGULATOR_LINEAR_RANGE(600000, 0, 23, 25000), + REGULATOR_LINEAR_RANGE(1200000, 24, 47, 50000), + REGULATOR_LINEAR_RANGE(2400000, 48, 63, 100000), +}; + +static struct regulator_ops act8865_ops = { + .list_voltage = regulator_list_voltage_linear_range, + .map_voltage = regulator_map_voltage_linear_range, + .get_voltage_sel = regulator_get_voltage_sel_regmap, + .set_voltage_sel = regulator_set_voltage_sel_regmap, + .enable = regulator_enable_regmap, + .disable = regulator_disable_regmap, + .is_enabled = regulator_is_enabled_regmap, + .set_suspend_enable = regulator_enable_regmap, + .set_suspend_disable = regulator_disable_regmap, +}; + +static const struct regulator_desc act8865_reg[] = { + { + .name = "DCDC_REG1", + .id = ACT8865_ID_DCDC1, + .ops = &act8865_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = ACT8865_VOLTAGE_NUM, + .linear_ranges = act8865_volatge_ranges, + .n_linear_ranges = ARRAY_SIZE(act8865_volatge_ranges), + .vsel_reg = ACT8865_DCDC1_VSET1, + .vsel_mask = ACT8865_VSEL_MASK, + .enable_reg = ACT8865_DCDC1_CTRL, + .enable_mask = ACT8865_ENA, + .owner = THIS_MODULE, + }, + { + .name = "DCDC_REG2", + .id = ACT8865_ID_DCDC2, + .ops = &act8865_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = ACT8865_VOLTAGE_NUM, + .linear_ranges = act8865_volatge_ranges, + .n_linear_ranges = ARRAY_SIZE(act8865_volatge_ranges), + .vsel_reg = ACT8865_DCDC2_VSET1, + .vsel_mask = ACT8865_VSEL_MASK, + .enable_reg = ACT8865_DCDC2_CTRL, + .enable_mask = ACT8865_ENA, + .owner = THIS_MODULE, + }, + { + .name = "DCDC_REG3", + .id = ACT8865_ID_DCDC3, + .ops = &act8865_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = ACT8865_VOLTAGE_NUM, + .linear_ranges = act8865_volatge_ranges, + .n_linear_ranges = ARRAY_SIZE(act8865_volatge_ranges), + .vsel_reg = ACT8865_DCDC3_VSET1, + .vsel_mask = ACT8865_VSEL_MASK, + .enable_reg = ACT8865_DCDC3_CTRL, + .enable_mask = ACT8865_ENA, + .owner = THIS_MODULE, + }, + { + .name = "LDO_REG1", + .id = ACT8865_ID_LDO1, + .ops = &act8865_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = ACT8865_VOLTAGE_NUM, + .linear_ranges = act8865_volatge_ranges, + .n_linear_ranges = ARRAY_SIZE(act8865_volatge_ranges), + .vsel_reg = ACT8865_LDO1_VSET, + .vsel_mask = ACT8865_VSEL_MASK, + .enable_reg = ACT8865_LDO1_CTRL, + .enable_mask = ACT8865_ENA, + .owner = THIS_MODULE, + }, + { + .name = "LDO_REG2", + .id = ACT8865_ID_LDO2, + .ops = &act8865_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = ACT8865_VOLTAGE_NUM, + .linear_ranges = act8865_volatge_ranges, + .n_linear_ranges = ARRAY_SIZE(act8865_volatge_ranges), + .vsel_reg = ACT8865_LDO2_VSET, + .vsel_mask = ACT8865_VSEL_MASK, + .enable_reg = ACT8865_LDO2_CTRL, + .enable_mask = ACT8865_ENA, + .owner = THIS_MODULE, + }, + { + .name = "LDO_REG3", + .id = ACT8865_ID_LDO3, + .ops = &act8865_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = ACT8865_VOLTAGE_NUM, + .linear_ranges = act8865_volatge_ranges, + .n_linear_ranges = ARRAY_SIZE(act8865_volatge_ranges), + .vsel_reg = ACT8865_LDO3_VSET, + .vsel_mask = ACT8865_VSEL_MASK, + .enable_reg = ACT8865_LDO3_CTRL, + .enable_mask = ACT8865_ENA, + .owner = THIS_MODULE, + }, + { + .name = "LDO_REG4", + .id = ACT8865_ID_LDO4, + .ops = &act8865_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = ACT8865_VOLTAGE_NUM, + .linear_ranges = act8865_volatge_ranges, + .n_linear_ranges = ARRAY_SIZE(act8865_volatge_ranges), + .vsel_reg = ACT8865_LDO4_VSET, + .vsel_mask = ACT8865_VSEL_MASK, + .enable_reg = ACT8865_LDO4_CTRL, + .enable_mask = ACT8865_ENA, + .owner = THIS_MODULE, + }, +}; + +#ifdef CONFIG_OF +static const struct of_device_id act8865_dt_ids[] = { + { .compatible = "active-semi,act8865" }, + { } +}; +MODULE_DEVICE_TABLE(of, act8865_dt_ids); + +static struct of_regulator_match act8865_matches[] = { + [ACT8865_ID_DCDC1] = { .name = "DCDC_REG1"}, + [ACT8865_ID_DCDC2] = { .name = "DCDC_REG2"}, + [ACT8865_ID_DCDC3] = { .name = "DCDC_REG3"}, + [ACT8865_ID_LDO1] = { .name = "LDO_REG1"}, + [ACT8865_ID_LDO2] = { .name = "LDO_REG2"}, + [ACT8865_ID_LDO3] = { .name = "LDO_REG3"}, + [ACT8865_ID_LDO4] = { .name = "LDO_REG4"}, +}; + +static int act8865_pdata_from_dt(struct device *dev, + struct device_node **of_node, + struct act8865_platform_data *pdata) +{ + int matched, i; + struct device_node *np; + struct act8865_regulator_data *regulator; + + np = of_find_node_by_name(dev->of_node, "regulators"); + if (!np) { + dev_err(dev, "missing 'regulators' subnode in DT\n"); + return -EINVAL; + } + + matched = of_regulator_match(dev, np, + act8865_matches, ARRAY_SIZE(act8865_matches)); + if (matched <= 0) + return matched; + + pdata->regulators = devm_kzalloc(dev, + sizeof(struct act8865_regulator_data) * matched, + GFP_KERNEL); + if (!pdata->regulators) { + dev_err(dev, "%s: failed to allocate act8865 registor\n", + __func__); + return -ENOMEM; + } + + pdata->num_regulators = matched; + regulator = pdata->regulators; + + for (i = 0; i < matched; i++) { + if (!act8865_matches[i].init_data) + continue; + + regulator->id = i; + regulator->name = act8865_matches[i].name; + regulator->platform_data = act8865_matches[i].init_data; + of_node[i] = act8865_matches[i].of_node; + regulator++; + } + + return 0; +} +#else +static inline int act8865_pdata_from_dt(struct device *dev, + struct device_node **of_node, + struct act8865_platform_data *pdata) +{ + return 0; +} +#endif + +static int act8865_pmic_probe(struct i2c_client *client, + const struct i2c_device_id *i2c_id) +{ + struct regulator_dev **rdev; + struct device *dev = &client->dev; + struct act8865_platform_data *pdata = dev_get_platdata(dev); + struct regulator_config config = { }; + struct act8865 *act8865; + struct device_node *of_node[ACT8865_REG_NUM]; + int i, id; + int ret = -EINVAL; + int error; + + if (dev->of_node && !pdata) { + const struct of_device_id *id; + struct act8865_platform_data pdata_of; + + id = of_match_device(of_match_ptr(act8865_dt_ids), dev); + if (!id) + return -ENODEV; + + ret = act8865_pdata_from_dt(dev, of_node, &pdata_of); + if (ret < 0) + return ret; + + pdata = &pdata_of; + } + + if (pdata->num_regulators > ACT8865_REG_NUM) { + dev_err(dev, "Too many regulators found!\n"); + return -EINVAL; + } + + act8865 = devm_kzalloc(dev, sizeof(struct act8865) + + sizeof(struct regulator_dev *) * ACT8865_REG_NUM, + GFP_KERNEL); + if (!act8865) + return -ENOMEM; + + rdev = act8865->rdev; + + act8865->regmap = devm_regmap_init_i2c(client, &act8865_regmap_config); + if (IS_ERR(act8865->regmap)) { + error = PTR_ERR(act8865->regmap); + dev_err(&client->dev, "Failed to allocate register map: %d\n", + error); + return error; + } + + /* Finally register devices */ + for (i = 0; i < pdata->num_regulators; i++) { + + id = pdata->regulators[i].id; + + config.dev = dev; + config.init_data = pdata->regulators[i].platform_data; + config.of_node = of_node[i]; + config.driver_data = act8865; + config.regmap = act8865->regmap; + + rdev[i] = devm_regulator_register(&client->dev, + &act8865_reg[i], &config); + if (IS_ERR(rdev[i])) { + dev_err(dev, "failed to register %s\n", + act8865_reg[id].name); + return PTR_ERR(rdev[i]); + } + } + + i2c_set_clientdata(client, act8865); + + return 0; +} + +static int act8865_pmic_remove(struct i2c_client *client) +{ + struct act8865 *act8865 = i2c_get_clientdata(client); + int i; + + for (i = 0; i < ACT8865_REG_NUM; i++) + regulator_unregister(act8865->rdev[i]); + + return 0; +} + +static const struct i2c_device_id act8865_ids[] = { + { "act8865", 0 }, + { }, +}; +MODULE_DEVICE_TABLE(i2c, act8865_ids); + +static struct i2c_driver act8865_pmic_driver = { + .driver = { + .name = "act8865", + .owner = THIS_MODULE, + }, + .probe = act8865_pmic_probe, + .remove = act8865_pmic_remove, + .id_table = act8865_ids, +}; + +module_i2c_driver(act8865_pmic_driver); + +MODULE_DESCRIPTION("active-semi act8865 voltage regulator driver"); +MODULE_AUTHOR("Wenyou Yang "); +MODULE_LICENSE("GPL v2"); diff --git a/include/linux/regulator/act8865.h b/include/linux/regulator/act8865.h new file mode 100644 index 0000000..49206c1 --- /dev/null +++ b/include/linux/regulator/act8865.h @@ -0,0 +1,53 @@ +/* + * act8865.h -- Voltage regulation for the active-semi act8865 + * + * Copyright (C) 2013 Atmel Corporation. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __LINUX_REGULATOR_ACT8865_H +#define __LINUX_REGULATOR_ACT8865_H + +#include + +enum { + ACT8865_ID_DCDC1, + ACT8865_ID_DCDC2, + ACT8865_ID_DCDC3, + ACT8865_ID_LDO1, + ACT8865_ID_LDO2, + ACT8865_ID_LDO3, + ACT8865_ID_LDO4, + ACT8865_REG_NUM, +}; + +/** + * act8865_regulator_data - regulator data + * @id: regulator id + * @name: regulator name + * @platform_data: regulator init data + */ +struct act8865_regulator_data { + int id; + const char *name; + struct regulator_init_data *platform_data; +}; + +/** + * act8865_platform_data - platform data for act8865 + * @num_regulators: number of regulators used + * @regulators: pointer to regulators used + */ +struct act8865_platform_data { + int num_regulators; + struct act8865_regulator_data *regulators; +}; +#endif -- cgit v1.1 From cbfadd3dfb887c675702e4f9029f2c91a308c078 Mon Sep 17 00:00:00 2001 From: Wenyou Yang Date: Tue, 24 Dec 2013 10:35:14 +0800 Subject: regulator: act8865: add device tree binding doc Signed-off-by: Wenyou Yang Signed-off-by: Mark Brown --- .../bindings/regulator/act8865-regulator.txt | 60 ++++++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.txt | 1 + 2 files changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/act8865-regulator.txt diff --git a/Documentation/devicetree/bindings/regulator/act8865-regulator.txt b/Documentation/devicetree/bindings/regulator/act8865-regulator.txt new file mode 100644 index 0000000..bef1fbb --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/act8865-regulator.txt @@ -0,0 +1,60 @@ +ACT8865 regulator +------------------- + +Required properties: +- compatible: "active-semi,act8865" +- reg: I2C slave address + +Any standard regulator properties can be used to configure the single regulator. + +The valid names for regulators are: + DCDC_REG1, DCDC_REG2, DCDC_REG3, LDO_REG1, LDO_REG2, LDO_REG3, LDO_REG4. + +Example: +-------- + + i2c1: i2c@f0018000 { + pmic: act8865@5b { + compatible = "active-semi,act8865"; + reg = <0x5b>; + status = "disabled"; + + regulators { + vcc_1v8_reg: DCDC_REG1 { + regulator-name = "VCC_1V8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + + vcc_1v2_reg: DCDC_REG2 { + regulator-name = "VCC_1V2"; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1300000>; + regulator-suspend-mem-microvolt = <1150000>; + regulator-suspend-standby-microvolt = <1150000>; + regulator-always-on; + }; + + vcc_3v3_reg: DCDC_REG3 { + regulator-name = "VCC_3V3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + vddana_reg: LDO_REG1 { + regulator-name = "VDDANA"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + vddfuse_reg: LDO_REG2 { + regulator-name = "FUSE_2V5"; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <2500000>; + }; + }; + }; + }; diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index ce95ed1..5354d1a 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt @@ -3,6 +3,7 @@ Device tree binding vendor prefix registry. Keep list in alphabetical order. This isn't an exhaustive list, but you should add new prefixes to it before using them to avoid name-space collisions. +active-semi Active-Semi International Inc ad Avionic Design GmbH adi Analog Devices, Inc. aeroflexgaisler Aeroflex Gaisler AB -- cgit v1.1 From d5e17e2634a4370188e65c8839ff33911adb207b Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 24 Dec 2013 23:41:22 +0800 Subject: regulator: act8865: Remove unneeded regulator_unregister() calls This is not required because current code use devm_regulator_register() to register regulators. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/act8865-regulator.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c index db048f2..dfae294 100644 --- a/drivers/regulator/act8865-regulator.c +++ b/drivers/regulator/act8865-regulator.c @@ -334,17 +334,6 @@ static int act8865_pmic_probe(struct i2c_client *client, return 0; } -static int act8865_pmic_remove(struct i2c_client *client) -{ - struct act8865 *act8865 = i2c_get_clientdata(client); - int i; - - for (i = 0; i < ACT8865_REG_NUM; i++) - regulator_unregister(act8865->rdev[i]); - - return 0; -} - static const struct i2c_device_id act8865_ids[] = { { "act8865", 0 }, { }, @@ -357,7 +346,6 @@ static struct i2c_driver act8865_pmic_driver = { .owner = THIS_MODULE, }, .probe = act8865_pmic_probe, - .remove = act8865_pmic_remove, .id_table = act8865_ids, }; -- cgit v1.1 From 7da98aafa2bee3583d675235c6113a57b4f20697 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 25 Dec 2013 12:37:58 +0800 Subject: regulator: act8865: Remove set_suspend_[en|dis]able implementation There is no suspend enable/disable settings mentioned in datasheet, so just don't implement .set_suspend_[en|dis]able callbacks. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/act8865-regulator.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c index dfae294..e7dbdc0 100644 --- a/drivers/regulator/act8865-regulator.c +++ b/drivers/regulator/act8865-regulator.c @@ -85,8 +85,6 @@ static struct regulator_ops act8865_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap, - .set_suspend_enable = regulator_enable_regmap, - .set_suspend_disable = regulator_disable_regmap, }; static const struct regulator_desc act8865_reg[] = { -- cgit v1.1 From f1de2c2f2749ba42b87a49ae57deb346301dec02 Mon Sep 17 00:00:00 2001 From: Wenyou Yang Date: Thu, 26 Dec 2013 14:52:43 +0800 Subject: regulator: act8865: fix incorrect devm_kzalloc for act8865 Which cause to allocate more needless memory. Signed-off-by: Wenyou Yang Signed-off-by: Mark Brown --- drivers/regulator/act8865-regulator.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c index e7dbdc0..f816ad8 100644 --- a/drivers/regulator/act8865-regulator.c +++ b/drivers/regulator/act8865-regulator.c @@ -291,9 +291,7 @@ static int act8865_pmic_probe(struct i2c_client *client, return -EINVAL; } - act8865 = devm_kzalloc(dev, sizeof(struct act8865) + - sizeof(struct regulator_dev *) * ACT8865_REG_NUM, - GFP_KERNEL); + act8865 = devm_kzalloc(dev, sizeof(struct act8865), GFP_KERNEL); if (!act8865) return -ENOMEM; -- cgit v1.1 From 89705b9e35026ad75a8ba940d641aa2be7a16611 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Tue, 31 Dec 2013 10:56:00 -0200 Subject: regulator: anatop-regulator: Add MODULE_ALIAS() Provide a MODULE_ALIAS() entry to the driver. Signed-off-by: Fabio Estevam Signed-off-by: Mark Brown --- drivers/regulator/anatop-regulator.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index c734d09..a004144 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c @@ -259,3 +259,4 @@ MODULE_AUTHOR("Nancy Chen "); MODULE_AUTHOR("Ying-Chun Liu (PaulLiu) "); MODULE_DESCRIPTION("ANATOP Regulator driver"); MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:anatop_regulator"); -- cgit v1.1 From d04b755273683ed31043563b8a3a2716bd8aa6a9 Mon Sep 17 00:00:00 2001 From: Wenyou Yang Date: Tue, 31 Dec 2013 09:27:52 +0800 Subject: regulator: act8865: register all regulators regardless of how many are used As Mark pointed out, the driver should register all regulators regardless of how many are used in the system in order to aid diagnostics. But in the previous patch, only register the regulators that are used. Signed-off-by: Wenyou Yang Signed-off-by: Mark Brown --- drivers/regulator/act8865-regulator.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c index f816ad8..5e3e1d2 100644 --- a/drivers/regulator/act8865-regulator.c +++ b/drivers/regulator/act8865-regulator.c @@ -225,8 +225,8 @@ static int act8865_pdata_from_dt(struct device *dev, return matched; pdata->regulators = devm_kzalloc(dev, - sizeof(struct act8865_regulator_data) * matched, - GFP_KERNEL); + sizeof(struct act8865_regulator_data) * + ARRAY_SIZE(act8865_matches), GFP_KERNEL); if (!pdata->regulators) { dev_err(dev, "%s: failed to allocate act8865 registor\n", __func__); @@ -236,10 +236,7 @@ static int act8865_pdata_from_dt(struct device *dev, pdata->num_regulators = matched; regulator = pdata->regulators; - for (i = 0; i < matched; i++) { - if (!act8865_matches[i].init_data) - continue; - + for (i = 0; i < ARRAY_SIZE(act8865_matches); i++) { regulator->id = i; regulator->name = act8865_matches[i].name; regulator->platform_data = act8865_matches[i].init_data; @@ -306,7 +303,7 @@ static int act8865_pmic_probe(struct i2c_client *client, } /* Finally register devices */ - for (i = 0; i < pdata->num_regulators; i++) { + for (i = 0; i < ARRAY_SIZE(act8865_matches); i++) { id = pdata->regulators[i].id; -- cgit v1.1 From a8659ba461a13ef1a8a28968b3bd10220684be02 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 6 Jan 2014 15:42:53 +0800 Subject: regulator: act8865: Fix build error when !OF Fix below build error when !OF: CC [M] drivers/regulator/act8865-regulator.o drivers/regulator/act8865-regulator.c: In function 'act8865_pmic_probe': drivers/regulator/act8865-regulator.c:306:18: error: 'act8865_matches' undeclared (first use in this function) drivers/regulator/act8865-regulator.c:306:18: note: each undeclared identifier is reported only once for each function it appears in drivers/regulator/act8865-regulator.c:306:18: error: negative width in bit-field '' make[2]: *** [drivers/regulator/act8865-regulator.o] Error 1 make[1]: *** [drivers/regulator] Error 2 make: *** [drivers] Error 2 Reported-by: Stephen Rothwell Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/act8865-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c index 5e3e1d2..084cc08 100644 --- a/drivers/regulator/act8865-regulator.c +++ b/drivers/regulator/act8865-regulator.c @@ -303,7 +303,7 @@ static int act8865_pmic_probe(struct i2c_client *client, } /* Finally register devices */ - for (i = 0; i < ARRAY_SIZE(act8865_matches); i++) { + for (i = 0; i < ACT8865_REG_NUM; i++) { id = pdata->regulators[i].id; -- cgit v1.1 From f2b269b83de35a022a8df5d0133f64021f08592c Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Mon, 6 Jan 2014 10:13:15 -0200 Subject: regulator: anatop-regulator: Remove unneeded kstrdup() We can simply pass the regulator name via of_get_property() instead of making a copy via kstrdup(). This leads to some code simplification. Suggested-by: Dmitry Torokhov Signed-off-by: Fabio Estevam Signed-off-by: Mark Brown --- drivers/regulator/anatop-regulator.c | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index a004144..3d4997a 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c @@ -122,8 +122,7 @@ static int anatop_regulator_probe(struct platform_device *pdev) if (!sreg) return -ENOMEM; sreg->initdata = initdata; - sreg->name = kstrdup(of_get_property(np, "regulator-name", NULL), - GFP_KERNEL); + sreg->name = of_get_property(np, "regulator-name", NULL); rdesc = &sreg->rdesc; memset(rdesc, 0, sizeof(*rdesc)); rdesc->name = sreg->name; @@ -143,37 +142,37 @@ static int anatop_regulator_probe(struct platform_device *pdev) &sreg->control_reg); if (ret) { dev_err(dev, "no anatop-reg-offset property set\n"); - goto anatop_probe_end; + return ret; } ret = of_property_read_u32(np, "anatop-vol-bit-width", &sreg->vol_bit_width); if (ret) { dev_err(dev, "no anatop-vol-bit-width property set\n"); - goto anatop_probe_end; + return ret; } ret = of_property_read_u32(np, "anatop-vol-bit-shift", &sreg->vol_bit_shift); if (ret) { dev_err(dev, "no anatop-vol-bit-shift property set\n"); - goto anatop_probe_end; + return ret; } ret = of_property_read_u32(np, "anatop-min-bit-val", &sreg->min_bit_val); if (ret) { dev_err(dev, "no anatop-min-bit-val property set\n"); - goto anatop_probe_end; + return ret; } ret = of_property_read_u32(np, "anatop-min-voltage", &sreg->min_voltage); if (ret) { dev_err(dev, "no anatop-min-voltage property set\n"); - goto anatop_probe_end; + return ret; } ret = of_property_read_u32(np, "anatop-max-voltage", &sreg->max_voltage); if (ret) { dev_err(dev, "no anatop-max-voltage property set\n"); - goto anatop_probe_end; + return ret; } /* read LDO ramp up setting, only for core reg */ @@ -204,27 +203,11 @@ static int anatop_regulator_probe(struct platform_device *pdev) if (IS_ERR(rdev)) { dev_err(dev, "failed to register %s\n", rdesc->name); - ret = PTR_ERR(rdev); - goto anatop_probe_end; + return PTR_ERR(rdev); } platform_set_drvdata(pdev, rdev); -anatop_probe_end: - if (ret) - kfree(sreg->name); - - return ret; -} - -static int anatop_regulator_remove(struct platform_device *pdev) -{ - struct regulator_dev *rdev = platform_get_drvdata(pdev); - struct anatop_regulator *sreg = rdev_get_drvdata(rdev); - const char *name = sreg->name; - - kfree(name); - return 0; } @@ -240,7 +223,6 @@ static struct platform_driver anatop_regulator_driver = { .of_match_table = of_anatop_regulator_match_tbl, }, .probe = anatop_regulator_probe, - .remove = anatop_regulator_remove, }; static int __init anatop_regulator_init(void) -- cgit v1.1 From 762a8ee808972354ce4bca988309aa7fb63ed5ae Mon Sep 17 00:00:00 2001 From: Andrew Bresticker Date: Thu, 26 Dec 2013 13:48:46 -0800 Subject: regulator: as3722: detect SD0 low-voltage mode SD0 may operate in low-voltage mode, with a minimum of 0.41V and a maximum of 1.5V. This is indicated by bit 4 of FUSE7. Signed-off-by: Andrew Bresticker Signed-off-by: Vince Hsu broonie.e6264@m.evernote.com Signed-off-by: Mark Brown --- drivers/regulator/as3722-regulator.c | 30 ++++++++++++++++++++++++++---- include/linux/mfd/as3722.h | 4 ++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c index fdb3137..3d7fbc2 100644 --- a/drivers/regulator/as3722-regulator.c +++ b/drivers/regulator/as3722-regulator.c @@ -99,7 +99,6 @@ static const struct as3722_register_mapping as3722_reg_lookup[] = { .sleep_ctrl_mask = AS3722_SD0_EXT_ENABLE_MASK, .control_reg = AS3722_SD0_CONTROL_REG, .mode_mask = AS3722_SD0_MODE_FAST, - .n_voltages = AS3722_SD0_VSEL_MAX + 1, }, { .regulator_id = AS3722_REGULATOR_ID_SD1, @@ -112,7 +111,6 @@ static const struct as3722_register_mapping as3722_reg_lookup[] = { .sleep_ctrl_mask = AS3722_SD1_EXT_ENABLE_MASK, .control_reg = AS3722_SD1_CONTROL_REG, .mode_mask = AS3722_SD1_MODE_FAST, - .n_voltages = AS3722_SD0_VSEL_MAX + 1, }, { .regulator_id = AS3722_REGULATOR_ID_SD2, @@ -181,7 +179,6 @@ static const struct as3722_register_mapping as3722_reg_lookup[] = { .sleep_ctrl_mask = AS3722_SD6_EXT_ENABLE_MASK, .control_reg = AS3722_SD6_CONTROL_REG, .mode_mask = AS3722_SD6_MODE_FAST, - .n_voltages = AS3722_SD0_VSEL_MAX + 1, }, { .regulator_id = AS3722_REGULATOR_ID_LDO0, @@ -595,6 +592,22 @@ static int as3722_sd016_set_current_limit(struct regulator_dev *rdev, return as3722_update_bits(as3722, reg, mask, val); } +static bool as3722_sd0_is_low_voltage(struct as3722_regulators *as3722_regs) +{ + int err; + unsigned val; + + err = as3722_read(as3722_regs->as3722, AS3722_FUSE7_REG, &val); + if (err < 0) { + dev_err(as3722_regs->dev, "Reg 0x%02x read failed: %d\n", + AS3722_FUSE7_REG, err); + return false; + } + if (val & AS3722_FUSE7_SD0_LOW_VOLTAGE) + return true; + return false; +} + static const struct regulator_linear_range as3722_sd2345_ranges[] = { REGULATOR_LINEAR_RANGE(612500, 0x01, 0x40, 12500), REGULATOR_LINEAR_RANGE(1425000, 0x41, 0x70, 25000), @@ -820,7 +833,16 @@ static int as3722_regulator_probe(struct platform_device *pdev) ops = &as3722_sd016_extcntrl_ops; else ops = &as3722_sd016_ops; - as3722_regs->desc[id].min_uV = 610000; + if (id == AS3722_REGULATOR_ID_SD0 && + as3722_sd0_is_low_voltage(as3722_regs)) { + as3722_regs->desc[id].n_voltages = + AS3722_SD0_VSEL_LOW_VOL_MAX + 1; + as3722_regs->desc[id].min_uV = 410000; + } else { + as3722_regs->desc[id].n_voltages = + AS3722_SD0_VSEL_MAX + 1, + as3722_regs->desc[id].min_uV = 610000; + } as3722_regs->desc[id].uV_step = 10000; as3722_regs->desc[id].linear_min_sel = 1; break; diff --git a/include/linux/mfd/as3722.h b/include/linux/mfd/as3722.h index 16bf8a0..bb9616d 100644 --- a/include/linux/mfd/as3722.h +++ b/include/linux/mfd/as3722.h @@ -151,6 +151,7 @@ #define AS3722_ASIC_ID1_REG 0x90 #define AS3722_ASIC_ID2_REG 0x91 #define AS3722_LOCK_REG 0x9E +#define AS3722_FUSE7_REG 0xA7 #define AS3722_MAX_REGISTER 0xF4 #define AS3722_SD0_EXT_ENABLE_MASK 0x03 @@ -224,6 +225,7 @@ #define AS3722_SD_VSEL_MASK 0x7F #define AS3722_SD0_VSEL_MIN 0x01 #define AS3722_SD0_VSEL_MAX 0x5A +#define AS3722_SD0_VSEL_LOW_VOL_MAX 0x6E #define AS3722_SD2_VSEL_MIN 0x01 #define AS3722_SD2_VSEL_MAX 0x7F @@ -341,6 +343,8 @@ #define AS3722_EXT_CONTROL_ENABLE2 0x2 #define AS3722_EXT_CONTROL_ENABLE3 0x3 +#define AS3722_FUSE7_SD0_LOW_VOLTAGE BIT(4) + /* Interrupt IDs */ enum as3722_irq { AS3722_IRQ_LID, -- cgit v1.1 From fb04f1b0c0731467190d7953cf7cf1105698a666 Mon Sep 17 00:00:00 2001 From: Vince Hsu Date: Thu, 26 Dec 2013 13:48:47 -0800 Subject: regulator: as3722: set enable time for SD0/1/6 Add an enable time of 600us for SD0/1/6 to ensure that we have enough setup time for the power rail. Signed-off-by: Vince Hsu Signed-off-by: Andrew Bresticker Signed-off-by: Mark Brown --- drivers/regulator/as3722-regulator.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c index 3d7fbc2..5c84ff4 100644 --- a/drivers/regulator/as3722-regulator.c +++ b/drivers/regulator/as3722-regulator.c @@ -845,6 +845,7 @@ static int as3722_regulator_probe(struct platform_device *pdev) } as3722_regs->desc[id].uV_step = 10000; as3722_regs->desc[id].linear_min_sel = 1; + as3722_regs->desc[id].enable_time = 600; break; case AS3722_REGULATOR_ID_SD2: case AS3722_REGULATOR_ID_SD3: -- cgit v1.1 From 2243cb41dc5911a8b2a25f49c822557e7d76b790 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Fri, 3 Jan 2014 15:29:49 +0530 Subject: regulator: s5m8767: Update LDO index in s5m8767-regulator.txt LDO indices start from 1. Update the example accordingly. Signed-off-by: Sachin Kamat Signed-off-by: Mark Brown --- Documentation/devicetree/bindings/regulator/s5m8767-regulator.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/regulator/s5m8767-regulator.txt b/Documentation/devicetree/bindings/regulator/s5m8767-regulator.txt index d1660a9..fc6b38f 100644 --- a/Documentation/devicetree/bindings/regulator/s5m8767-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/s5m8767-regulator.txt @@ -83,7 +83,7 @@ as per the datasheet of s5m8767. - LDOn - valid values for n are 1 to 28 - - Example: LDO0, LD01, LDO28 + - Example: LDO1, LD02, LDO28 - BUCKn - valid values for n are 1 to 9. - Example: BUCK1, BUCK2, BUCK9 -- cgit v1.1 From 06e57b6c1e6cfabdaf6fb95207dcefe03c20b06d Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Mon, 6 Jan 2014 10:29:08 -0200 Subject: regulator: anatop-regulator: Remove unneeded memset() sreg is allocated via devm_kzalloc(), so there is no need to explicitly zero out rdesc via memset(). Signed-off-by: Fabio Estevam Signed-off-by: Mark Brown --- drivers/regulator/anatop-regulator.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index 3d4997a..862e63e 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c @@ -124,7 +124,6 @@ static int anatop_regulator_probe(struct platform_device *pdev) sreg->initdata = initdata; sreg->name = of_get_property(np, "regulator-name", NULL); rdesc = &sreg->rdesc; - memset(rdesc, 0, sizeof(*rdesc)); rdesc->name = sreg->name; rdesc->ops = &anatop_rops; rdesc->type = REGULATOR_VOLTAGE; -- cgit v1.1 From f2694383680838573262f3099f03dc4722d5efa4 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Mon, 20 Jan 2014 18:53:56 -0200 Subject: regulator: pfuze100-regulator: Improve dev_info() message 'lay' is not very meaningful, so use it 'layer' instead to let the dev_info() clearer. Signed-off-by: Fabio Estevam Signed-off-by: Mark Brown --- drivers/regulator/pfuze100-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c index 8b5e4c7..c31e048 100644 --- a/drivers/regulator/pfuze100-regulator.c +++ b/drivers/regulator/pfuze100-regulator.c @@ -323,7 +323,7 @@ static int pfuze_identify(struct pfuze_chip *pfuze_chip) if (ret) return ret; dev_info(pfuze_chip->dev, - "Full lay: %x, Metal lay: %x\n", + "Full layer: %x, Metal layer: %x\n", (value & 0xf0) >> 4, value & 0x0f); ret = regmap_read(pfuze_chip->regmap, PFUZE100_FABID, &value); -- cgit v1.1