mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
regulator: Fixes for v3.13
A bunch of fixes, a few driver specific ones and a framework fix for voltage enumeration on fixed voltage regulators which had previously worked but had been misplaced during some refactoring causing problems for users that needed to know the voltage. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) iQIcBAABAgAGBQJSkgsOAAoJELSic+t+oim9soIQAIQL1Im2MKVa0M2Kj9npsf2G QKgyobmpQRyjcVrEJp8waOG8WEdIY2s7iJOUNWWnBsyLJ88wMsRPYbloE87DO2nA dBjYUI25YcTHOlqVYqCrhH5rJfS3m1PsbMJBgrW7vB0IvseobY63sk64hdfyO8Z+ zgroggEI6JXo6IYprtLYgIEOhDt3izZBvyFZyCdlpiGPPlMaD2UQFaJ/qwqQdwpY FR5o4DbXmggILIhjl5TjH1u6UKinJDdS1n027626zsGSoVz3DJbgcwiDIUkbawfo lucRQc4tESbr8D05TvTY1BuyKCU6Z1Ejf5DTPn7H5ESCfTer1TZ5BT5Vfgc5YDGq my7vEZfpw2OndgunqG8bCG5MuWrA4mQ05sg7FFSbdWIbM3FfKB2bfPg3MHE4F3q6 pi7hFnnjdG0cVee+Dxn/vYn1KJ8JqaqutnFdVRmeB5PWqQUhafbIlNEpOoIaTtdq 8cMG9px9yKCC7NmI6pOEbQx9tjkJzvuLNOfuzYsehMKorFa0mqdyzBVYzhKFboCp lSwA0B3slp1CcKda4WzCq3y7bSEf9+1xOW2kIfaGWfdJQTn4i7Pb0mp19f4++lDQ GVtpmCP9fanpi+Xq6J5CnLCIZLZOLFz1PFQvjbD10vUbhW/9aJ7t4+dKdd3KwZxL LvAzBohVYJc5VKoZYlRQ =2BEl -----END PGP SIGNATURE----- Merge tag 'regulator-v3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator Pull regulator fixes from Mark Brown: "A bunch of fixes, a few driver specific ones and a framework fix for voltage enumeration on fixed voltage regulators which had previously worked but had been misplaced during some refactoring causing problems for users that needed to know the voltage" * tag 'regulator-v3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: regulator: arizona-micsupp: Correct wm5110 voltage selection regulator: pfuze100: allow misprogrammed ID regulator: fixed: fix regulator_list_voltage() for regression regulator: gpio-regulator: Don't oops on missing regulator-type property
This commit is contained in:
commit
8e45099e02
4 changed files with 70 additions and 6 deletions
|
@ -174,6 +174,33 @@ static const struct regulator_desc arizona_micsupp = {
|
|||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static const struct regulator_linear_range arizona_micsupp_ext_ranges[] = {
|
||||
REGULATOR_LINEAR_RANGE(900000, 0, 0x14, 25000),
|
||||
REGULATOR_LINEAR_RANGE(1500000, 0x15, 0x27, 100000),
|
||||
};
|
||||
|
||||
static const struct regulator_desc arizona_micsupp_ext = {
|
||||
.name = "MICVDD",
|
||||
.supply_name = "CPVDD",
|
||||
.type = REGULATOR_VOLTAGE,
|
||||
.n_voltages = 40,
|
||||
.ops = &arizona_micsupp_ops,
|
||||
|
||||
.vsel_reg = ARIZONA_LDO2_CONTROL_1,
|
||||
.vsel_mask = ARIZONA_LDO2_VSEL_MASK,
|
||||
.enable_reg = ARIZONA_MIC_CHARGE_PUMP_1,
|
||||
.enable_mask = ARIZONA_CPMIC_ENA,
|
||||
.bypass_reg = ARIZONA_MIC_CHARGE_PUMP_1,
|
||||
.bypass_mask = ARIZONA_CPMIC_BYPASS,
|
||||
|
||||
.linear_ranges = arizona_micsupp_ext_ranges,
|
||||
.n_linear_ranges = ARRAY_SIZE(arizona_micsupp_ext_ranges),
|
||||
|
||||
.enable_time = 3000,
|
||||
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static const struct regulator_init_data arizona_micsupp_default = {
|
||||
.constraints = {
|
||||
.valid_ops_mask = REGULATOR_CHANGE_STATUS |
|
||||
|
@ -186,9 +213,22 @@ static const struct regulator_init_data arizona_micsupp_default = {
|
|||
.num_consumer_supplies = 1,
|
||||
};
|
||||
|
||||
static const struct regulator_init_data arizona_micsupp_ext_default = {
|
||||
.constraints = {
|
||||
.valid_ops_mask = REGULATOR_CHANGE_STATUS |
|
||||
REGULATOR_CHANGE_VOLTAGE |
|
||||
REGULATOR_CHANGE_BYPASS,
|
||||
.min_uV = 900000,
|
||||
.max_uV = 3300000,
|
||||
},
|
||||
|
||||
.num_consumer_supplies = 1,
|
||||
};
|
||||
|
||||
static int arizona_micsupp_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
|
||||
const struct regulator_desc *desc;
|
||||
struct regulator_config config = { };
|
||||
struct arizona_micsupp *micsupp;
|
||||
int ret;
|
||||
|
@ -207,7 +247,17 @@ static int arizona_micsupp_probe(struct platform_device *pdev)
|
|||
* default init_data for it. This will be overridden with
|
||||
* platform data if provided.
|
||||
*/
|
||||
micsupp->init_data = arizona_micsupp_default;
|
||||
switch (arizona->type) {
|
||||
case WM5110:
|
||||
desc = &arizona_micsupp_ext;
|
||||
micsupp->init_data = arizona_micsupp_ext_default;
|
||||
break;
|
||||
default:
|
||||
desc = &arizona_micsupp;
|
||||
micsupp->init_data = arizona_micsupp_default;
|
||||
break;
|
||||
}
|
||||
|
||||
micsupp->init_data.consumer_supplies = &micsupp->supply;
|
||||
micsupp->supply.supply = "MICVDD";
|
||||
micsupp->supply.dev_name = dev_name(arizona->dev);
|
||||
|
@ -226,7 +276,7 @@ static int arizona_micsupp_probe(struct platform_device *pdev)
|
|||
ARIZONA_CPMIC_BYPASS, 0);
|
||||
|
||||
micsupp->regulator = devm_regulator_register(&pdev->dev,
|
||||
&arizona_micsupp,
|
||||
desc,
|
||||
&config);
|
||||
if (IS_ERR(micsupp->regulator)) {
|
||||
ret = PTR_ERR(micsupp->regulator);
|
||||
|
|
|
@ -2184,6 +2184,9 @@ int regulator_list_voltage(struct regulator *regulator, unsigned selector)
|
|||
struct regulator_ops *ops = rdev->desc->ops;
|
||||
int ret;
|
||||
|
||||
if (rdev->desc->fixed_uV && rdev->desc->n_voltages == 1 && !selector)
|
||||
return rdev->desc->fixed_uV;
|
||||
|
||||
if (!ops->list_voltage || selector >= rdev->desc->n_voltages)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
|
@ -139,6 +139,7 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np)
|
|||
struct property *prop;
|
||||
const char *regtype;
|
||||
int proplen, gpio, i;
|
||||
int ret;
|
||||
|
||||
config = devm_kzalloc(dev,
|
||||
sizeof(struct gpio_regulator_config),
|
||||
|
@ -202,7 +203,11 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np)
|
|||
}
|
||||
config->nr_states = i;
|
||||
|
||||
of_property_read_string(np, "regulator-type", ®type);
|
||||
ret = of_property_read_string(np, "regulator-type", ®type);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Missing 'regulator-type' property\n");
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
if (!strncmp("voltage", regtype, 7))
|
||||
config->type = REGULATOR_VOLTAGE;
|
||||
|
|
|
@ -308,9 +308,15 @@ static int pfuze_identify(struct pfuze_chip *pfuze_chip)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (value & 0x0f) {
|
||||
dev_warn(pfuze_chip->dev, "Illegal ID: %x\n", value);
|
||||
return -ENODEV;
|
||||
switch (value & 0x0f) {
|
||||
/* Freescale misprogrammed 1-3% of parts prior to week 8 of 2013 as ID=8 */
|
||||
case 0x8:
|
||||
dev_info(pfuze_chip->dev, "Assuming misprogrammed ID=0x8");
|
||||
case 0x0:
|
||||
break;
|
||||
default:
|
||||
dev_warn(pfuze_chip->dev, "Illegal ID: %x\n", value);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = regmap_read(pfuze_chip->regmap, PFUZE100_REVID, &value);
|
||||
|
|
Loading…
Reference in a new issue