Commit 41a36ffc authored by Mark Brown's avatar Mark Brown

Merge branch 'for-5.12' of...

Merge branch 'for-5.12' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-5.13
parents 823543b7 a5ccccb3
......@@ -125,7 +125,7 @@ static const struct regulator_ops vid_ops = {
static const struct regulator_desc regulators[] = {
BD9571MWV_REG("VD09", "vd09", VD09, avs_ops, 0, 0x7f,
0x80, 600000, 10000, 0x3c),
0x6f, 600000, 10000, 0x3c),
BD9571MWV_REG("VD18", "vd18", VD18, vid_ops, BD9571MWV_VD18_VID, 0xf,
16, 1625000, 25000, 0),
BD9571MWV_REG("VD25", "vd25", VD25, vid_ops, BD9571MWV_VD25_VID, 0xf,
......@@ -134,7 +134,7 @@ static const struct regulator_desc regulators[] = {
11, 2800000, 100000, 0),
BD9571MWV_REG("DVFS", "dvfs", DVFS, reg_ops,
BD9571MWV_DVFS_MONIVDAC, 0x7f,
0x80, 600000, 10000, 0x3c),
0x6f, 600000, 10000, 0x3c),
};
#ifdef CONFIG_PM_SLEEP
......@@ -174,7 +174,7 @@ static ssize_t backup_mode_show(struct device *dev,
{
struct bd9571mwv_reg *bdreg = dev_get_drvdata(dev);
return sprintf(buf, "%s\n", bdreg->bkup_mode_enabled ? "on" : "off");
return sysfs_emit(buf, "%s\n", bdreg->bkup_mode_enabled ? "on" : "off");
}
static ssize_t backup_mode_store(struct device *dev,
......@@ -301,7 +301,7 @@ static int bd9571mwv_regulator_probe(struct platform_device *pdev)
&config);
if (IS_ERR(rdev)) {
dev_err(&pdev->dev, "failed to register %s regulator\n",
pdev->name);
regulators[i].name);
return PTR_ERR(rdev);
}
}
......
......@@ -1442,6 +1442,8 @@ static int set_machine_constraints(struct regulator_dev *rdev)
if (rdev->constraints->always_on)
rdev->use_count++;
} else if (rdev->desc->off_on_delay) {
rdev->last_off_jiffy = jiffies;
}
print_constraints(rdev);
......
......@@ -40,6 +40,7 @@ struct da9121 {
unsigned int passive_delay;
int chip_irq;
int variant_id;
int subvariant_id;
};
/* Define ranges for different variants, enabling translation to/from
......@@ -812,7 +813,6 @@ static struct regmap_config da9121_2ch_regmap_config = {
static int da9121_check_device_type(struct i2c_client *i2c, struct da9121 *chip)
{
u32 device_id;
u8 chip_id = chip->variant_id;
u32 variant_id;
u8 variant_mrc, variant_vrc;
char *type;
......@@ -839,22 +839,34 @@ static int da9121_check_device_type(struct i2c_client *i2c, struct da9121 *chip)
variant_vrc = variant_id & DA9121_MASK_OTP_VARIANT_ID_VRC;
switch (variant_vrc) {
case DA9121_VARIANT_VRC:
type = "DA9121/DA9130";
config_match = (chip_id == DA9121_TYPE_DA9121_DA9130);
switch (chip->subvariant_id) {
case DA9121_SUBTYPE_DA9121:
type = "DA9121";
config_match = (variant_vrc == DA9121_VARIANT_VRC);
break;
case DA9220_VARIANT_VRC:
type = "DA9220/DA9132";
config_match = (chip_id == DA9121_TYPE_DA9220_DA9132);
case DA9121_SUBTYPE_DA9130:
type = "DA9130";
config_match = (variant_vrc == DA9130_VARIANT_VRC);
break;
case DA9122_VARIANT_VRC:
type = "DA9122/DA9131";
config_match = (chip_id == DA9121_TYPE_DA9122_DA9131);
case DA9121_SUBTYPE_DA9220:
type = "DA9220";
config_match = (variant_vrc == DA9220_VARIANT_VRC);
break;
case DA9217_VARIANT_VRC:
case DA9121_SUBTYPE_DA9132:
type = "DA9132";
config_match = (variant_vrc == DA9132_VARIANT_VRC);
break;
case DA9121_SUBTYPE_DA9122:
type = "DA9122";
config_match = (variant_vrc == DA9122_VARIANT_VRC);
break;
case DA9121_SUBTYPE_DA9131:
type = "DA9131";
config_match = (variant_vrc == DA9131_VARIANT_VRC);
break;
case DA9121_SUBTYPE_DA9217:
type = "DA9217";
config_match = (chip_id == DA9121_TYPE_DA9217);
config_match = (variant_vrc == DA9217_VARIANT_VRC);
break;
default:
type = "Unknown";
......@@ -892,15 +904,27 @@ static int da9121_assign_chip_model(struct i2c_client *i2c,
chip->dev = &i2c->dev;
switch (chip->variant_id) {
case DA9121_TYPE_DA9121_DA9130:
fallthrough;
case DA9121_TYPE_DA9217:
/* Use configured subtype to select the regulator descriptor index and
* register map, common to both consumer and automotive grade variants
*/
switch (chip->subvariant_id) {
case DA9121_SUBTYPE_DA9121:
case DA9121_SUBTYPE_DA9130:
chip->variant_id = DA9121_TYPE_DA9121_DA9130;
regmap = &da9121_1ch_regmap_config;
break;
case DA9121_TYPE_DA9122_DA9131:
fallthrough;
case DA9121_TYPE_DA9220_DA9132:
case DA9121_SUBTYPE_DA9217:
chip->variant_id = DA9121_TYPE_DA9217;
regmap = &da9121_1ch_regmap_config;
break;
case DA9121_SUBTYPE_DA9122:
case DA9121_SUBTYPE_DA9131:
chip->variant_id = DA9121_TYPE_DA9122_DA9131;
regmap = &da9121_2ch_regmap_config;
break;
case DA9121_SUBTYPE_DA9220:
case DA9121_SUBTYPE_DA9132:
chip->variant_id = DA9121_TYPE_DA9220_DA9132;
regmap = &da9121_2ch_regmap_config;
break;
}
......@@ -975,13 +999,13 @@ static int da9121_config_irq(struct i2c_client *i2c,
}
static const struct of_device_id da9121_dt_ids[] = {
{ .compatible = "dlg,da9121", .data = (void *) DA9121_TYPE_DA9121_DA9130 },
{ .compatible = "dlg,da9130", .data = (void *) DA9121_TYPE_DA9121_DA9130 },
{ .compatible = "dlg,da9217", .data = (void *) DA9121_TYPE_DA9217 },
{ .compatible = "dlg,da9122", .data = (void *) DA9121_TYPE_DA9122_DA9131 },
{ .compatible = "dlg,da9131", .data = (void *) DA9121_TYPE_DA9122_DA9131 },
{ .compatible = "dlg,da9220", .data = (void *) DA9121_TYPE_DA9220_DA9132 },
{ .compatible = "dlg,da9132", .data = (void *) DA9121_TYPE_DA9220_DA9132 },
{ .compatible = "dlg,da9121", .data = (void *) DA9121_SUBTYPE_DA9121 },
{ .compatible = "dlg,da9130", .data = (void *) DA9121_SUBTYPE_DA9130 },
{ .compatible = "dlg,da9217", .data = (void *) DA9121_SUBTYPE_DA9217 },
{ .compatible = "dlg,da9122", .data = (void *) DA9121_SUBTYPE_DA9122 },
{ .compatible = "dlg,da9131", .data = (void *) DA9121_SUBTYPE_DA9131 },
{ .compatible = "dlg,da9220", .data = (void *) DA9121_SUBTYPE_DA9220 },
{ .compatible = "dlg,da9132", .data = (void *) DA9121_SUBTYPE_DA9132 },
{ }
};
MODULE_DEVICE_TABLE(of, da9121_dt_ids);
......@@ -1011,7 +1035,7 @@ static int da9121_i2c_probe(struct i2c_client *i2c,
}
chip->pdata = i2c->dev.platform_data;
chip->variant_id = da9121_of_get_id(&i2c->dev);
chip->subvariant_id = da9121_of_get_id(&i2c->dev);
ret = da9121_assign_chip_model(i2c, chip);
if (ret < 0)
......
......@@ -29,6 +29,16 @@ enum da9121_variant {
DA9121_TYPE_DA9217
};
enum da9121_subvariant {
DA9121_SUBTYPE_DA9121,
DA9121_SUBTYPE_DA9130,
DA9121_SUBTYPE_DA9220,
DA9121_SUBTYPE_DA9132,
DA9121_SUBTYPE_DA9122,
DA9121_SUBTYPE_DA9131,
DA9121_SUBTYPE_DA9217
};
/* Minimum, maximum and default polling millisecond periods are provided
* here as an example. It is expected that any final implementation will
* include a modification of these settings to match the required
......@@ -279,6 +289,9 @@ enum da9121_variant {
#define DA9220_VARIANT_VRC 0x0
#define DA9122_VARIANT_VRC 0x2
#define DA9217_VARIANT_VRC 0x7
#define DA9130_VARIANT_VRC 0x0
#define DA9131_VARIANT_VRC 0x1
#define DA9132_VARIANT_VRC 0x2
/* DA9121_REG_OTP_CUSTOMER_ID */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment