Merge remote-tracking branches 'regulator/topic/lp8755', 'regulator/topic/ltc3589', 'regulator/topic/max8952', 'regulator/topic/mc13xxx' and 'regulator/topic/palmas' into regulator-next
This commit is contained in:
@@ -339,22 +339,18 @@ static int lp8755_regulator_init(struct lp8755_chip *pchip)
|
||||
rconfig.init_data = pdata->buck_data[buck_num];
|
||||
rconfig.of_node = pchip->dev->of_node;
|
||||
pchip->rdev[buck_num] =
|
||||
regulator_register(&lp8755_regulators[buck_num], &rconfig);
|
||||
devm_regulator_register(pchip->dev,
|
||||
&lp8755_regulators[buck_num], &rconfig);
|
||||
if (IS_ERR(pchip->rdev[buck_num])) {
|
||||
ret = PTR_ERR(pchip->rdev[buck_num]);
|
||||
pchip->rdev[buck_num] = NULL;
|
||||
dev_err(pchip->dev, "regulator init failed: buck %d\n",
|
||||
buck_num);
|
||||
goto err_buck;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_buck:
|
||||
for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++)
|
||||
regulator_unregister(pchip->rdev[icnt]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static irqreturn_t lp8755_irq_handler(int irq, void *data)
|
||||
@@ -490,23 +486,19 @@ static int lp8755_probe(struct i2c_client *client,
|
||||
ret = lp8755_regulator_init(pchip);
|
||||
if (ret < 0) {
|
||||
dev_err(&client->dev, "fail to initialize regulators\n");
|
||||
goto err_regulator;
|
||||
goto err;
|
||||
}
|
||||
|
||||
pchip->irq = client->irq;
|
||||
ret = lp8755_int_config(pchip);
|
||||
if (ret < 0) {
|
||||
dev_err(&client->dev, "fail to irq config\n");
|
||||
goto err_irq;
|
||||
goto err;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
err_irq:
|
||||
for (icnt = 0; icnt < mphase_buck[pchip->mphase].nreg; icnt++)
|
||||
regulator_unregister(pchip->rdev[icnt]);
|
||||
|
||||
err_regulator:
|
||||
err:
|
||||
/* output disable */
|
||||
for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++)
|
||||
lp8755_write(pchip, icnt, 0x00);
|
||||
@@ -519,9 +511,6 @@ static int lp8755_remove(struct i2c_client *client)
|
||||
int icnt;
|
||||
struct lp8755_chip *pchip = i2c_get_clientdata(client);
|
||||
|
||||
for (icnt = 0; icnt < mphase_buck[pchip->mphase].nreg; icnt++)
|
||||
regulator_unregister(pchip->rdev[icnt]);
|
||||
|
||||
for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++)
|
||||
lp8755_write(pchip, icnt, 0x00);
|
||||
|
||||
|
@@ -377,7 +377,7 @@ static bool ltc3589_volatile_reg(struct device *dev, unsigned int reg)
|
||||
return false;
|
||||
}
|
||||
|
||||
struct reg_default ltc3589_reg_defaults[] = {
|
||||
static struct reg_default ltc3589_reg_defaults[] = {
|
||||
{ LTC3589_SCR1, 0x00 },
|
||||
{ LTC3589_OVEN, 0x00 },
|
||||
{ LTC3589_SCR2, 0x00 },
|
||||
|
@@ -229,7 +229,6 @@ static int max8952_pmic_probe(struct i2c_client *client,
|
||||
config.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH;
|
||||
|
||||
rdev = devm_regulator_register(&client->dev, ®ulator, &config);
|
||||
|
||||
if (IS_ERR(rdev)) {
|
||||
ret = PTR_ERR(rdev);
|
||||
dev_err(&client->dev, "regulator init failed (%d)\n", ret);
|
||||
@@ -241,21 +240,19 @@ static int max8952_pmic_probe(struct i2c_client *client,
|
||||
|
||||
if (gpio_is_valid(pdata->gpio_vid0) &&
|
||||
gpio_is_valid(pdata->gpio_vid1)) {
|
||||
if (!gpio_request(pdata->gpio_vid0, "MAX8952 VID0"))
|
||||
gpio_direction_output(pdata->gpio_vid0,
|
||||
(pdata->default_mode) & 0x1);
|
||||
else
|
||||
unsigned long gpio_flags;
|
||||
|
||||
gpio_flags = max8952->vid0 ?
|
||||
GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
|
||||
if (devm_gpio_request_one(&client->dev, pdata->gpio_vid0,
|
||||
gpio_flags, "MAX8952 VID0"))
|
||||
err = 1;
|
||||
|
||||
if (!gpio_request(pdata->gpio_vid1, "MAX8952 VID1"))
|
||||
gpio_direction_output(pdata->gpio_vid1,
|
||||
(pdata->default_mode >> 1) & 0x1);
|
||||
else {
|
||||
if (!err)
|
||||
gpio_free(pdata->gpio_vid0);
|
||||
gpio_flags = max8952->vid1 ?
|
||||
GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
|
||||
if (devm_gpio_request_one(&client->dev, pdata->gpio_vid1,
|
||||
gpio_flags, "MAX8952 VID1"))
|
||||
err = 2;
|
||||
}
|
||||
|
||||
} else
|
||||
err = 3;
|
||||
|
||||
@@ -314,16 +311,6 @@ static int max8952_pmic_probe(struct i2c_client *client,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int max8952_pmic_remove(struct i2c_client *client)
|
||||
{
|
||||
struct max8952_data *max8952 = i2c_get_clientdata(client);
|
||||
struct max8952_platform_data *pdata = max8952->pdata;
|
||||
|
||||
gpio_free(pdata->gpio_vid0);
|
||||
gpio_free(pdata->gpio_vid1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id max8952_ids[] = {
|
||||
{ "max8952", 0 },
|
||||
{ },
|
||||
@@ -332,7 +319,6 @@ MODULE_DEVICE_TABLE(i2c, max8952_ids);
|
||||
|
||||
static struct i2c_driver max8952_pmic_driver = {
|
||||
.probe = max8952_pmic_probe,
|
||||
.remove = max8952_pmic_remove,
|
||||
.driver = {
|
||||
.name = "max8952",
|
||||
.of_match_table = of_match_ptr(max8952_dt_match),
|
||||
|
@@ -33,17 +33,12 @@ static int mc13xxx_regulator_enable(struct regulator_dev *rdev)
|
||||
struct mc13xxx_regulator_priv *priv = rdev_get_drvdata(rdev);
|
||||
struct mc13xxx_regulator *mc13xxx_regulators = priv->mc13xxx_regulators;
|
||||
int id = rdev_get_id(rdev);
|
||||
int ret;
|
||||
|
||||
dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id);
|
||||
|
||||
mc13xxx_lock(priv->mc13xxx);
|
||||
ret = mc13xxx_reg_rmw(priv->mc13xxx, mc13xxx_regulators[id].reg,
|
||||
mc13xxx_regulators[id].enable_bit,
|
||||
mc13xxx_regulators[id].enable_bit);
|
||||
mc13xxx_unlock(priv->mc13xxx);
|
||||
|
||||
return ret;
|
||||
return mc13xxx_reg_rmw(priv->mc13xxx, mc13xxx_regulators[id].reg,
|
||||
mc13xxx_regulators[id].enable_bit,
|
||||
mc13xxx_regulators[id].enable_bit);
|
||||
}
|
||||
|
||||
static int mc13xxx_regulator_disable(struct regulator_dev *rdev)
|
||||
@@ -51,16 +46,11 @@ static int mc13xxx_regulator_disable(struct regulator_dev *rdev)
|
||||
struct mc13xxx_regulator_priv *priv = rdev_get_drvdata(rdev);
|
||||
struct mc13xxx_regulator *mc13xxx_regulators = priv->mc13xxx_regulators;
|
||||
int id = rdev_get_id(rdev);
|
||||
int ret;
|
||||
|
||||
dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id);
|
||||
|
||||
mc13xxx_lock(priv->mc13xxx);
|
||||
ret = mc13xxx_reg_rmw(priv->mc13xxx, mc13xxx_regulators[id].reg,
|
||||
mc13xxx_regulators[id].enable_bit, 0);
|
||||
mc13xxx_unlock(priv->mc13xxx);
|
||||
|
||||
return ret;
|
||||
return mc13xxx_reg_rmw(priv->mc13xxx, mc13xxx_regulators[id].reg,
|
||||
mc13xxx_regulators[id].enable_bit, 0);
|
||||
}
|
||||
|
||||
static int mc13xxx_regulator_is_enabled(struct regulator_dev *rdev)
|
||||
@@ -70,10 +60,7 @@ static int mc13xxx_regulator_is_enabled(struct regulator_dev *rdev)
|
||||
int ret, id = rdev_get_id(rdev);
|
||||
unsigned int val;
|
||||
|
||||
mc13xxx_lock(priv->mc13xxx);
|
||||
ret = mc13xxx_reg_read(priv->mc13xxx, mc13xxx_regulators[id].reg, &val);
|
||||
mc13xxx_unlock(priv->mc13xxx);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -86,15 +73,10 @@ static int mc13xxx_regulator_set_voltage_sel(struct regulator_dev *rdev,
|
||||
struct mc13xxx_regulator_priv *priv = rdev_get_drvdata(rdev);
|
||||
struct mc13xxx_regulator *mc13xxx_regulators = priv->mc13xxx_regulators;
|
||||
int id = rdev_get_id(rdev);
|
||||
int ret;
|
||||
|
||||
mc13xxx_lock(priv->mc13xxx);
|
||||
ret = mc13xxx_reg_rmw(priv->mc13xxx, mc13xxx_regulators[id].vsel_reg,
|
||||
mc13xxx_regulators[id].vsel_mask,
|
||||
selector << mc13xxx_regulators[id].vsel_shift);
|
||||
mc13xxx_unlock(priv->mc13xxx);
|
||||
|
||||
return ret;
|
||||
return mc13xxx_reg_rmw(priv->mc13xxx, mc13xxx_regulators[id].vsel_reg,
|
||||
mc13xxx_regulators[id].vsel_mask,
|
||||
selector << mc13xxx_regulators[id].vsel_shift);
|
||||
}
|
||||
|
||||
static int mc13xxx_regulator_get_voltage(struct regulator_dev *rdev)
|
||||
@@ -106,11 +88,8 @@ static int mc13xxx_regulator_get_voltage(struct regulator_dev *rdev)
|
||||
|
||||
dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id);
|
||||
|
||||
mc13xxx_lock(priv->mc13xxx);
|
||||
ret = mc13xxx_reg_read(priv->mc13xxx,
|
||||
mc13xxx_regulators[id].vsel_reg, &val);
|
||||
mc13xxx_unlock(priv->mc13xxx);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@@ -21,7 +21,6 @@ struct mc13xxx_regulator {
|
||||
int vsel_reg;
|
||||
int vsel_shift;
|
||||
int vsel_mask;
|
||||
int hi_bit;
|
||||
};
|
||||
|
||||
struct mc13xxx_regulator_priv {
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user