diff options
author | Mark Brown <broonie@kernel.org> | 2020-03-24 17:33:09 +0000 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2020-03-24 17:33:09 +0000 |
commit | 24bd2afda8ce633385a3c96aa51181008d7252da (patch) | |
tree | c0ebae6e2a2481d6df18868d167198ef3a0705f7 /drivers/regulator/da9063-regulator.c | |
parent | bae4cb90541a5bb9625377f6edf94e3dd1b9bb96 (diff) | |
parent | 86332c343491c6d2228a1e0c80b1ea98a2653d20 (diff) | |
download | linux-24bd2afda8ce633385a3c96aa51181008d7252da.tar.bz2 |
Merge branch 'regulator-5.7' into regulator-next
Diffstat (limited to 'drivers/regulator/da9063-regulator.c')
-rw-r--r-- | drivers/regulator/da9063-regulator.c | 66 |
1 files changed, 37 insertions, 29 deletions
diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c index 6d07e6864173..e1d6c8f6d40b 100644 --- a/drivers/regulator/da9063-regulator.c +++ b/drivers/regulator/da9063-regulator.c @@ -66,7 +66,7 @@ struct da9063_regulator_data { }; struct da9063_regulators_pdata { - unsigned n_regulators; + unsigned int n_regulators; struct da9063_regulator_data *regulator_data; }; @@ -133,7 +133,7 @@ struct da9063_regulator_info { /* Defines asignment of regulators info table to chip model */ struct da9063_dev_model { const struct da9063_regulator_info *regulator_info; - unsigned n_regulators; + unsigned int n_regulators; enum da9063_type type; }; @@ -152,9 +152,9 @@ struct da9063_regulator { /* Encapsulates all information for the regulators driver */ struct da9063_regulators { - unsigned n_regulators; + unsigned int n_regulators; /* Array size to be defined during init. Keep at end. */ - struct da9063_regulator regulator[0]; + struct da9063_regulator regulator[]; }; /* BUCK modes for DA9063 */ @@ -167,38 +167,46 @@ enum { /* Regulator operations */ -/* Current limits array (in uA) for BCORE1, BCORE2, BPRO. - Entry indexes corresponds to register values. */ +/* + * Current limits array (in uA) for BCORE1, BCORE2, BPRO. + * Entry indexes corresponds to register values. + */ static const unsigned int da9063_buck_a_limits[] = { 500000, 600000, 700000, 800000, 900000, 1000000, 1100000, 1200000, 1300000, 1400000, 1500000, 1600000, 1700000, 1800000, 1900000, 2000000 }; -/* Current limits array (in uA) for BMEM, BIO, BPERI. - Entry indexes corresponds to register values. */ +/* + * Current limits array (in uA) for BMEM, BIO, BPERI. + * Entry indexes corresponds to register values. + */ static const unsigned int da9063_buck_b_limits[] = { 1500000, 1600000, 1700000, 1800000, 1900000, 2000000, 2100000, 2200000, 2300000, 2400000, 2500000, 2600000, 2700000, 2800000, 2900000, 3000000 }; -/* Current limits array (in uA) for merged BCORE1 and BCORE2. - Entry indexes corresponds to register values. */ +/* + * Current limits array (in uA) for merged BCORE1 and BCORE2. + * Entry indexes corresponds to register values. + */ static const unsigned int da9063_bcores_merged_limits[] = { 1000000, 1200000, 1400000, 1600000, 1800000, 2000000, 2200000, 2400000, 2600000, 2800000, 3000000, 3200000, 3400000, 3600000, 3800000, 4000000 }; -/* Current limits array (in uA) for merged BMEM and BIO. - Entry indexes corresponds to register values. */ +/* + * Current limits array (in uA) for merged BMEM and BIO. + * Entry indexes corresponds to register values. + */ static const unsigned int da9063_bmem_bio_merged_limits[] = { 3000000, 3200000, 3400000, 3600000, 3800000, 4000000, 4200000, 4400000, 4600000, 4800000, 5000000, 5200000, 5400000, 5600000, 5800000, 6000000 }; -static int da9063_buck_set_mode(struct regulator_dev *rdev, unsigned mode) +static int da9063_buck_set_mode(struct regulator_dev *rdev, unsigned int mode) { struct da9063_regulator *regl = rdev_get_drvdata(rdev); - unsigned val; + unsigned int val; switch (mode) { case REGULATOR_MODE_FAST: @@ -223,7 +231,7 @@ static int da9063_buck_set_mode(struct regulator_dev *rdev, unsigned mode) * There are 3 modes to map to: FAST, NORMAL, and STANDBY. */ -static unsigned da9063_buck_get_mode(struct regulator_dev *rdev) +static unsigned int da9063_buck_get_mode(struct regulator_dev *rdev) { struct da9063_regulator *regl = rdev_get_drvdata(rdev); unsigned int val; @@ -261,10 +269,10 @@ static unsigned da9063_buck_get_mode(struct regulator_dev *rdev) * There are 2 modes to map to: NORMAL and STANDBY (sleep) for each state. */ -static int da9063_ldo_set_mode(struct regulator_dev *rdev, unsigned mode) +static int da9063_ldo_set_mode(struct regulator_dev *rdev, unsigned int mode) { struct da9063_regulator *regl = rdev_get_drvdata(rdev); - unsigned val; + unsigned int val; switch (mode) { case REGULATOR_MODE_NORMAL: @@ -280,7 +288,7 @@ static int da9063_ldo_set_mode(struct regulator_dev *rdev, unsigned mode) return regmap_field_write(regl->sleep, val); } -static unsigned da9063_ldo_get_mode(struct regulator_dev *rdev) +static unsigned int da9063_ldo_get_mode(struct regulator_dev *rdev) { struct da9063_regulator *regl = rdev_get_drvdata(rdev); int ret, val; @@ -361,7 +369,8 @@ static int da9063_suspend_disable(struct regulator_dev *rdev) return regmap_field_write(regl->suspend, 0); } -static int da9063_buck_set_suspend_mode(struct regulator_dev *rdev, unsigned mode) +static int da9063_buck_set_suspend_mode(struct regulator_dev *rdev, + unsigned int mode) { struct da9063_regulator *regl = rdev_get_drvdata(rdev); int val; @@ -383,10 +392,11 @@ static int da9063_buck_set_suspend_mode(struct regulator_dev *rdev, unsigned mod return regmap_field_write(regl->mode, val); } -static int da9063_ldo_set_suspend_mode(struct regulator_dev *rdev, unsigned mode) +static int da9063_ldo_set_suspend_mode(struct regulator_dev *rdev, + unsigned int mode) { struct da9063_regulator *regl = rdev_get_drvdata(rdev); - unsigned val; + unsigned int val; switch (mode) { case REGULATOR_MODE_NORMAL: @@ -553,7 +563,7 @@ static irqreturn_t da9063_ldo_lim_event(int irq, void *data) struct da9063_regulators *regulators = data; struct da9063 *hw = regulators->regulator[0].hw; struct da9063_regulator *regl; - int bits, i , ret; + int bits, i, ret; ret = regmap_read(hw->regmap, DA9063_REG_STATUS_D, &bits); if (ret < 0) @@ -565,10 +575,10 @@ static irqreturn_t da9063_ldo_lim_event(int irq, void *data) continue; if (BIT(regl->info->oc_event.lsb) & bits) { - regulator_lock(regl->rdev); + regulator_lock(regl->rdev); regulator_notifier_call_chain(regl->rdev, REGULATOR_EVENT_OVER_CURRENT, NULL); - regulator_unlock(regl->rdev); + regulator_unlock(regl->rdev); } } @@ -793,7 +803,7 @@ static int da9063_regulator_probe(struct platform_device *pdev) if (regl->info->suspend_sleep.reg) { regl->suspend_sleep = devm_regmap_field_alloc(&pdev->dev, - da9063->regmap, regl->info->suspend_sleep); + da9063->regmap, regl->info->suspend_sleep); if (IS_ERR(regl->suspend_sleep)) return PTR_ERR(regl->suspend_sleep); } @@ -827,12 +837,10 @@ static int da9063_regulator_probe(struct platform_device *pdev) NULL, da9063_ldo_lim_event, IRQF_TRIGGER_LOW | IRQF_ONESHOT, "LDO_LIM", regulators); - if (ret) { + if (ret) dev_err(&pdev->dev, "Failed to request LDO_LIM IRQ.\n"); - return ret; - } - return 0; + return ret; } static struct platform_driver da9063_regulator_driver = { |