mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-28 20:37:27 +00:00
Merge remote-tracking branch 'regulator/topic/ab8500' into regulator-next
This commit is contained in:
commit
c84130e700
@ -12,7 +12,7 @@ obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.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 ab8500-ext.o
|
||||
obj-$(CONFIG_REGULATOR_AB8500) += ab8500-ext.o ab8500.o
|
||||
obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o
|
||||
obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
|
||||
|
@ -16,9 +16,11 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regulator/driver.h>
|
||||
#include <linux/regulator/machine.h>
|
||||
#include <linux/regulator/of_regulator.h>
|
||||
#include <linux/mfd/abx500.h>
|
||||
#include <linux/mfd/abx500/ab8500.h>
|
||||
#include <linux/regulator/ab8500.h>
|
||||
@ -229,6 +231,28 @@ static unsigned int ab8500_ext_regulator_get_mode(struct regulator_dev *rdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ab8500_ext_set_voltage(struct regulator_dev *rdev, int min_uV,
|
||||
int max_uV, unsigned *selector)
|
||||
{
|
||||
struct regulation_constraints *regu_constraints = rdev->constraints;
|
||||
|
||||
if (!regu_constraints) {
|
||||
dev_err(rdev_get_dev(rdev), "No regulator constraints\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (regu_constraints->min_uV == min_uV &&
|
||||
regu_constraints->max_uV == max_uV)
|
||||
return 0;
|
||||
|
||||
dev_err(rdev_get_dev(rdev),
|
||||
"Requested min %duV max %duV != constrained min %duV max %duV\n",
|
||||
min_uV, max_uV,
|
||||
regu_constraints->min_uV, regu_constraints->max_uV);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int ab8500_ext_list_voltage(struct regulator_dev *rdev,
|
||||
unsigned selector)
|
||||
{
|
||||
@ -252,6 +276,7 @@ static struct regulator_ops ab8500_ext_regulator_ops = {
|
||||
.is_enabled = ab8500_ext_regulator_is_enabled,
|
||||
.set_mode = ab8500_ext_regulator_set_mode,
|
||||
.get_mode = ab8500_ext_regulator_get_mode,
|
||||
.set_voltage = ab8500_ext_set_voltage,
|
||||
.list_voltage = ab8500_ext_list_voltage,
|
||||
};
|
||||
|
||||
@ -310,18 +335,37 @@ static struct ab8500_ext_regulator_info
|
||||
},
|
||||
};
|
||||
|
||||
int ab8500_ext_regulator_init(struct platform_device *pdev)
|
||||
static struct of_regulator_match ab8500_ext_regulator_match[] = {
|
||||
{ .name = "ab8500_ext1", .driver_data = (void *) AB8500_EXT_SUPPLY1, },
|
||||
{ .name = "ab8500_ext2", .driver_data = (void *) AB8500_EXT_SUPPLY2, },
|
||||
{ .name = "ab8500_ext3", .driver_data = (void *) AB8500_EXT_SUPPLY3, },
|
||||
};
|
||||
|
||||
static int ab8500_ext_regulator_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
|
||||
struct ab8500_platform_data *ppdata;
|
||||
struct ab8500_regulator_platform_data *pdata;
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
struct regulator_config config = { };
|
||||
int i, err;
|
||||
|
||||
if (np) {
|
||||
err = of_regulator_match(&pdev->dev, np,
|
||||
ab8500_ext_regulator_match,
|
||||
ARRAY_SIZE(ab8500_ext_regulator_match));
|
||||
if (err < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
"Error parsing regulator init data: %d\n", err);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ab8500) {
|
||||
dev_err(&pdev->dev, "null mfd parent\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ppdata = dev_get_platdata(ab8500->dev);
|
||||
if (!ppdata) {
|
||||
dev_err(&pdev->dev, "null parent pdata\n");
|
||||
@ -362,8 +406,11 @@ int ab8500_ext_regulator_init(struct platform_device *pdev)
|
||||
pdata->ext_regulator[i].driver_data;
|
||||
|
||||
config.dev = &pdev->dev;
|
||||
config.init_data = &pdata->ext_regulator[i];
|
||||
config.driver_data = info;
|
||||
config.of_node = ab8500_ext_regulator_match[i].of_node;
|
||||
config.init_data = (np) ?
|
||||
ab8500_ext_regulator_match[i].init_data :
|
||||
&pdata->ext_regulator[i];
|
||||
|
||||
/* register regulator with framework */
|
||||
info->rdev = regulator_register(&info->desc, &config);
|
||||
@ -386,7 +433,7 @@ int ab8500_ext_regulator_init(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ab8500_ext_regulator_exit(struct platform_device *pdev)
|
||||
static int ab8500_ext_regulator_remove(struct platform_device *pdev)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -399,8 +446,37 @@ void ab8500_ext_regulator_exit(struct platform_device *pdev)
|
||||
|
||||
regulator_unregister(info->rdev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver ab8500_ext_regulator_driver = {
|
||||
.probe = ab8500_ext_regulator_probe,
|
||||
.remove = ab8500_ext_regulator_remove,
|
||||
.driver = {
|
||||
.name = "ab8500-ext-regulator",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init ab8500_ext_regulator_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = platform_driver_register(&ab8500_ext_regulator_driver);
|
||||
if (ret)
|
||||
pr_err("Failed to register ab8500 ext regulator: %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
subsys_initcall(ab8500_ext_regulator_init);
|
||||
|
||||
static void __exit ab8500_ext_regulator_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&ab8500_ext_regulator_driver);
|
||||
}
|
||||
module_exit(ab8500_ext_regulator_exit);
|
||||
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_AUTHOR("Bengt Jonsson <bengt.g.jonsson@stericsson.com>");
|
||||
MODULE_DESCRIPTION("AB8500 external regulator driver");
|
||||
|
@ -719,6 +719,7 @@ static struct ab8500_regulator_info
|
||||
.n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
|
||||
.volt_table = ldo_vauxn_voltages,
|
||||
.enable_time = 200,
|
||||
.supply_name = "vin",
|
||||
},
|
||||
.load_lp_uA = 5000,
|
||||
.update_bank = 0x04,
|
||||
@ -741,6 +742,7 @@ static struct ab8500_regulator_info
|
||||
.n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
|
||||
.volt_table = ldo_vauxn_voltages,
|
||||
.enable_time = 200,
|
||||
.supply_name = "vin",
|
||||
},
|
||||
.load_lp_uA = 5000,
|
||||
.update_bank = 0x04,
|
||||
@ -763,6 +765,7 @@ static struct ab8500_regulator_info
|
||||
.n_voltages = ARRAY_SIZE(ldo_vaux3_voltages),
|
||||
.volt_table = ldo_vaux3_voltages,
|
||||
.enable_time = 450,
|
||||
.supply_name = "vin",
|
||||
},
|
||||
.load_lp_uA = 5000,
|
||||
.update_bank = 0x04,
|
||||
@ -3156,22 +3159,12 @@ static int ab8500_regulator_probe(struct platform_device *pdev)
|
||||
return err;
|
||||
}
|
||||
|
||||
if (!is_ab8505(ab8500)) {
|
||||
/* register external regulators (before Vaux1, 2 and 3) */
|
||||
err = ab8500_ext_regulator_init(pdev);
|
||||
if (err)
|
||||
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) {
|
||||
if (!is_ab8505(ab8500))
|
||||
ab8500_ext_regulator_exit(pdev);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -3180,7 +3173,6 @@ static int ab8500_regulator_probe(struct platform_device *pdev)
|
||||
static int ab8500_regulator_remove(struct platform_device *pdev)
|
||||
{
|
||||
int i, err;
|
||||
struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
|
||||
|
||||
for (i = 0; i < abx500_regulator.info_size; i++) {
|
||||
struct ab8500_regulator_info *info = NULL;
|
||||
@ -3192,10 +3184,6 @@ static int ab8500_regulator_remove(struct platform_device *pdev)
|
||||
regulator_unregister(info->regulator);
|
||||
}
|
||||
|
||||
/* remove external regulators (after Vaux1, 2 and 3) */
|
||||
if (!is_ab8505(ab8500))
|
||||
ab8500_ext_regulator_exit(pdev);
|
||||
|
||||
/* remove regulator debug */
|
||||
err = ab8500_regulator_debug_exit(pdev);
|
||||
if (err)
|
||||
|
@ -336,8 +336,4 @@ static inline int ab8500_regulator_debug_exit(struct platform_device *pdev)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* AB8500 external regulator functions. */
|
||||
int ab8500_ext_regulator_init(struct platform_device *pdev);
|
||||
void ab8500_ext_regulator_exit(struct platform_device *pdev);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user