mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-28 16:52:18 +00:00
regulator: Few constifications of static data
Merge series from Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>: Few cleanups (safer code), built tested. Last two patches should probably be tested.
This commit is contained in:
commit
5faf6daf65
@ -67,11 +67,11 @@ struct da9052_regulator_info {
|
||||
|
||||
struct da9052_regulator {
|
||||
struct da9052 *da9052;
|
||||
struct da9052_regulator_info *info;
|
||||
const struct da9052_regulator_info *info;
|
||||
struct regulator_dev *rdev;
|
||||
};
|
||||
|
||||
static int verify_range(struct da9052_regulator_info *info,
|
||||
static int verify_range(const struct da9052_regulator_info *info,
|
||||
int min_uV, int max_uV)
|
||||
{
|
||||
if (min_uV > info->max_uV || max_uV < info->min_uV)
|
||||
@ -151,7 +151,7 @@ static int da9052_list_voltage(struct regulator_dev *rdev,
|
||||
unsigned int selector)
|
||||
{
|
||||
struct da9052_regulator *regulator = rdev_get_drvdata(rdev);
|
||||
struct da9052_regulator_info *info = regulator->info;
|
||||
const struct da9052_regulator_info *info = regulator->info;
|
||||
int id = rdev_get_id(rdev);
|
||||
int volt_uV;
|
||||
|
||||
@ -175,7 +175,7 @@ static int da9052_map_voltage(struct regulator_dev *rdev,
|
||||
int min_uV, int max_uV)
|
||||
{
|
||||
struct da9052_regulator *regulator = rdev_get_drvdata(rdev);
|
||||
struct da9052_regulator_info *info = regulator->info;
|
||||
const struct da9052_regulator_info *info = regulator->info;
|
||||
int id = rdev_get_id(rdev);
|
||||
int ret, sel;
|
||||
|
||||
@ -206,7 +206,7 @@ static int da9052_regulator_set_voltage_sel(struct regulator_dev *rdev,
|
||||
unsigned int selector)
|
||||
{
|
||||
struct da9052_regulator *regulator = rdev_get_drvdata(rdev);
|
||||
struct da9052_regulator_info *info = regulator->info;
|
||||
const struct da9052_regulator_info *info = regulator->info;
|
||||
int id = rdev_get_id(rdev);
|
||||
int ret;
|
||||
|
||||
@ -237,7 +237,7 @@ static int da9052_regulator_set_voltage_time_sel(struct regulator_dev *rdev,
|
||||
unsigned int new_sel)
|
||||
{
|
||||
struct da9052_regulator *regulator = rdev_get_drvdata(rdev);
|
||||
struct da9052_regulator_info *info = regulator->info;
|
||||
const struct da9052_regulator_info *info = regulator->info;
|
||||
int id = rdev_get_id(rdev);
|
||||
int ret = 0;
|
||||
|
||||
@ -327,7 +327,7 @@ static const struct regulator_ops da9052_ldo_ops = {
|
||||
.activate_bit = (abits),\
|
||||
}
|
||||
|
||||
static struct da9052_regulator_info da9052_regulator_info[] = {
|
||||
static const struct da9052_regulator_info da9052_regulator_info[] = {
|
||||
DA9052_DCDC(BUCK1, buck1, 25, 500, 2075, 6, 6, DA9052_SUPPLY_VBCOREGO),
|
||||
DA9052_DCDC(BUCK2, buck2, 25, 500, 2075, 6, 6, DA9052_SUPPLY_VBPROGO),
|
||||
DA9052_DCDC(BUCK3, buck3, 25, 950, 2525, 6, 6, DA9052_SUPPLY_VBMEMGO),
|
||||
@ -344,7 +344,7 @@ static struct da9052_regulator_info da9052_regulator_info[] = {
|
||||
DA9052_LDO(LDO10, ldo10, 50, 1200, 3600, 6, 6, 0),
|
||||
};
|
||||
|
||||
static struct da9052_regulator_info da9053_regulator_info[] = {
|
||||
static const struct da9052_regulator_info da9053_regulator_info[] = {
|
||||
DA9052_DCDC(BUCK1, buck1, 25, 500, 2075, 6, 6, DA9052_SUPPLY_VBCOREGO),
|
||||
DA9052_DCDC(BUCK2, buck2, 25, 500, 2075, 6, 6, DA9052_SUPPLY_VBPROGO),
|
||||
DA9052_DCDC(BUCK3, buck3, 25, 950, 2525, 6, 6, DA9052_SUPPLY_VBMEMGO),
|
||||
@ -361,10 +361,10 @@ static struct da9052_regulator_info da9053_regulator_info[] = {
|
||||
DA9052_LDO(LDO10, ldo10, 50, 1200, 3600, 6, 6, 0),
|
||||
};
|
||||
|
||||
static inline struct da9052_regulator_info *find_regulator_info(u8 chip_id,
|
||||
int id)
|
||||
static inline const struct da9052_regulator_info *find_regulator_info(u8 chip_id,
|
||||
int id)
|
||||
{
|
||||
struct da9052_regulator_info *info;
|
||||
const struct da9052_regulator_info *info;
|
||||
int i;
|
||||
|
||||
switch (chip_id) {
|
||||
|
@ -73,7 +73,7 @@ struct da9055_regulator_info {
|
||||
|
||||
struct da9055_regulator {
|
||||
struct da9055 *da9055;
|
||||
struct da9055_regulator_info *info;
|
||||
const struct da9055_regulator_info *info;
|
||||
struct regulator_dev *rdev;
|
||||
enum gpio_select reg_rselect;
|
||||
};
|
||||
@ -81,7 +81,7 @@ struct da9055_regulator {
|
||||
static unsigned int da9055_buck_get_mode(struct regulator_dev *rdev)
|
||||
{
|
||||
struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
|
||||
struct da9055_regulator_info *info = regulator->info;
|
||||
const struct da9055_regulator_info *info = regulator->info;
|
||||
int ret, mode = 0;
|
||||
|
||||
ret = da9055_reg_read(regulator->da9055, info->mode.reg);
|
||||
@ -107,7 +107,7 @@ static int da9055_buck_set_mode(struct regulator_dev *rdev,
|
||||
unsigned int mode)
|
||||
{
|
||||
struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
|
||||
struct da9055_regulator_info *info = regulator->info;
|
||||
const struct da9055_regulator_info *info = regulator->info;
|
||||
int val = 0;
|
||||
|
||||
switch (mode) {
|
||||
@ -129,7 +129,7 @@ static int da9055_buck_set_mode(struct regulator_dev *rdev,
|
||||
static unsigned int da9055_ldo_get_mode(struct regulator_dev *rdev)
|
||||
{
|
||||
struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
|
||||
struct da9055_regulator_info *info = regulator->info;
|
||||
const struct da9055_regulator_info *info = regulator->info;
|
||||
int ret;
|
||||
|
||||
ret = da9055_reg_read(regulator->da9055, info->volt.reg_b);
|
||||
@ -145,7 +145,7 @@ static unsigned int da9055_ldo_get_mode(struct regulator_dev *rdev)
|
||||
static int da9055_ldo_set_mode(struct regulator_dev *rdev, unsigned int mode)
|
||||
{
|
||||
struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
|
||||
struct da9055_regulator_info *info = regulator->info;
|
||||
const struct da9055_regulator_info *info = regulator->info;
|
||||
struct da9055_volt_reg volt = info->volt;
|
||||
int val = 0;
|
||||
|
||||
@ -167,7 +167,7 @@ static int da9055_ldo_set_mode(struct regulator_dev *rdev, unsigned int mode)
|
||||
static int da9055_regulator_get_voltage_sel(struct regulator_dev *rdev)
|
||||
{
|
||||
struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
|
||||
struct da9055_regulator_info *info = regulator->info;
|
||||
const struct da9055_regulator_info *info = regulator->info;
|
||||
struct da9055_volt_reg volt = info->volt;
|
||||
int ret, sel;
|
||||
|
||||
@ -199,7 +199,7 @@ static int da9055_regulator_set_voltage_sel(struct regulator_dev *rdev,
|
||||
unsigned int selector)
|
||||
{
|
||||
struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
|
||||
struct da9055_regulator_info *info = regulator->info;
|
||||
const struct da9055_regulator_info *info = regulator->info;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
@ -242,7 +242,7 @@ static int da9055_regulator_set_suspend_voltage(struct regulator_dev *rdev,
|
||||
int uV)
|
||||
{
|
||||
struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
|
||||
struct da9055_regulator_info *info = regulator->info;
|
||||
const struct da9055_regulator_info *info = regulator->info;
|
||||
int ret;
|
||||
|
||||
/* Select register set B for suspend voltage ramping. */
|
||||
@ -264,7 +264,7 @@ static int da9055_regulator_set_suspend_voltage(struct regulator_dev *rdev,
|
||||
static int da9055_suspend_enable(struct regulator_dev *rdev)
|
||||
{
|
||||
struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
|
||||
struct da9055_regulator_info *info = regulator->info;
|
||||
const struct da9055_regulator_info *info = regulator->info;
|
||||
|
||||
/* Select register set B for voltage ramping. */
|
||||
if (regulator->reg_rselect == NO_GPIO)
|
||||
@ -277,7 +277,7 @@ static int da9055_suspend_enable(struct regulator_dev *rdev)
|
||||
static int da9055_suspend_disable(struct regulator_dev *rdev)
|
||||
{
|
||||
struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
|
||||
struct da9055_regulator_info *info = regulator->info;
|
||||
const struct da9055_regulator_info *info = regulator->info;
|
||||
|
||||
/* Diselect register set B. */
|
||||
if (regulator->reg_rselect == NO_GPIO)
|
||||
@ -396,7 +396,7 @@ static const struct regulator_ops da9055_ldo_ops = {
|
||||
},\
|
||||
}
|
||||
|
||||
static struct da9055_regulator_info da9055_regulator_info[] = {
|
||||
static const struct da9055_regulator_info da9055_regulator_info[] = {
|
||||
DA9055_BUCK(BUCK1, 25, 725, 2075, 6, 9, 0xc, 2),
|
||||
DA9055_BUCK(BUCK2, 25, 925, 2500, 6, 0, 3, 0),
|
||||
DA9055_LDO(LDO1, 50, 900, 3300, 6, 2),
|
||||
@ -417,7 +417,7 @@ static int da9055_gpio_init(struct device *dev,
|
||||
struct regulator_config *config,
|
||||
struct da9055_pdata *pdata, int id)
|
||||
{
|
||||
struct da9055_regulator_info *info = regulator->info;
|
||||
const struct da9055_regulator_info *info = regulator->info;
|
||||
struct gpio_desc *ren;
|
||||
struct gpio_desc *ena;
|
||||
struct gpio_desc *rsel;
|
||||
@ -491,9 +491,9 @@ static irqreturn_t da9055_ldo5_6_oc_irq(int irq, void *data)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static inline struct da9055_regulator_info *find_regulator_info(int id)
|
||||
static inline const struct da9055_regulator_info *find_regulator_info(int id)
|
||||
{
|
||||
struct da9055_regulator_info *info;
|
||||
const struct da9055_regulator_info *info;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(da9055_regulator_info); i++) {
|
||||
|
@ -715,7 +715,7 @@ static const struct da9063_regulator_info da9063_regulator_info[] = {
|
||||
};
|
||||
|
||||
/* Link chip model with regulators info table */
|
||||
static struct da9063_dev_model regulators_models[] = {
|
||||
static const struct da9063_dev_model regulators_models[] = {
|
||||
{
|
||||
.regulator_info = da9063_regulator_info,
|
||||
.n_regulators = ARRAY_SIZE(da9063_regulator_info),
|
||||
|
@ -53,7 +53,7 @@ struct da9121_range {
|
||||
int reg_max;
|
||||
};
|
||||
|
||||
static struct da9121_range da9121_10A_2phase_current = {
|
||||
static const struct da9121_range da9121_10A_2phase_current = {
|
||||
.val_min = 7000000,
|
||||
.val_max = 20000000,
|
||||
.val_stp = 1000000,
|
||||
@ -61,7 +61,7 @@ static struct da9121_range da9121_10A_2phase_current = {
|
||||
.reg_max = 14,
|
||||
};
|
||||
|
||||
static struct da9121_range da9121_6A_2phase_current = {
|
||||
static const struct da9121_range da9121_6A_2phase_current = {
|
||||
.val_min = 7000000,
|
||||
.val_max = 12000000,
|
||||
.val_stp = 1000000,
|
||||
@ -69,7 +69,7 @@ static struct da9121_range da9121_6A_2phase_current = {
|
||||
.reg_max = 6,
|
||||
};
|
||||
|
||||
static struct da9121_range da9121_5A_1phase_current = {
|
||||
static const struct da9121_range da9121_5A_1phase_current = {
|
||||
.val_min = 3500000,
|
||||
.val_max = 10000000,
|
||||
.val_stp = 500000,
|
||||
@ -77,7 +77,7 @@ static struct da9121_range da9121_5A_1phase_current = {
|
||||
.reg_max = 14,
|
||||
};
|
||||
|
||||
static struct da9121_range da9121_3A_1phase_current = {
|
||||
static const struct da9121_range da9121_3A_1phase_current = {
|
||||
.val_min = 3500000,
|
||||
.val_max = 6000000,
|
||||
.val_stp = 500000,
|
||||
@ -85,7 +85,7 @@ static struct da9121_range da9121_3A_1phase_current = {
|
||||
.reg_max = 6,
|
||||
};
|
||||
|
||||
static struct da9121_range da914x_40A_4phase_current = {
|
||||
static const struct da9121_range da914x_40A_4phase_current = {
|
||||
.val_min = 26000000,
|
||||
.val_max = 78000000,
|
||||
.val_stp = 4000000,
|
||||
@ -93,7 +93,7 @@ static struct da9121_range da914x_40A_4phase_current = {
|
||||
.reg_max = 14,
|
||||
};
|
||||
|
||||
static struct da9121_range da914x_20A_2phase_current = {
|
||||
static const struct da9121_range da914x_20A_2phase_current = {
|
||||
.val_min = 13000000,
|
||||
.val_max = 39000000,
|
||||
.val_stp = 2000000,
|
||||
@ -104,7 +104,7 @@ static struct da9121_range da914x_20A_2phase_current = {
|
||||
struct da9121_variant_info {
|
||||
int num_bucks;
|
||||
int num_phases;
|
||||
struct da9121_range *current_range;
|
||||
const struct da9121_range *current_range;
|
||||
};
|
||||
|
||||
static const struct da9121_variant_info variant_parameters[] = {
|
||||
@ -188,7 +188,7 @@ static int da9121_get_current_limit(struct regulator_dev *rdev)
|
||||
{
|
||||
struct da9121 *chip = rdev_get_drvdata(rdev);
|
||||
int id = rdev_get_id(rdev);
|
||||
struct da9121_range *range =
|
||||
const struct da9121_range *range =
|
||||
variant_parameters[chip->variant_id].current_range;
|
||||
unsigned int val = 0;
|
||||
int ret = 0;
|
||||
@ -219,7 +219,7 @@ static int da9121_ceiling_selector(struct regulator_dev *rdev,
|
||||
unsigned int *selector)
|
||||
{
|
||||
struct da9121 *chip = rdev_get_drvdata(rdev);
|
||||
struct da9121_range *range =
|
||||
const struct da9121_range *range =
|
||||
variant_parameters[chip->variant_id].current_range;
|
||||
unsigned int level;
|
||||
unsigned int i = 0;
|
||||
@ -259,7 +259,7 @@ static int da9121_set_current_limit(struct regulator_dev *rdev,
|
||||
{
|
||||
struct da9121 *chip = rdev_get_drvdata(rdev);
|
||||
int id = rdev_get_id(rdev);
|
||||
struct da9121_range *range =
|
||||
const struct da9121_range *range =
|
||||
variant_parameters[chip->variant_id].current_range;
|
||||
unsigned int sel = 0;
|
||||
int ret = 0;
|
||||
|
@ -303,7 +303,7 @@ static const struct regulator_ops hi6421_buck345_ops;
|
||||
}
|
||||
|
||||
/* HI6421 regulator information */
|
||||
static struct hi6421_regulator_info
|
||||
static const struct hi6421_regulator_info
|
||||
hi6421_regulator_info[HI6421_NUM_REGULATORS] = {
|
||||
HI6421_LDO(LDO0, hi6421_vout0, ldo_0_voltages, 0x20, 0x07, 0x20, 0x10,
|
||||
10000, 0x20, 8000),
|
||||
@ -384,7 +384,7 @@ static int hi6421_regulator_enable(struct regulator_dev *rdev)
|
||||
|
||||
static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev)
|
||||
{
|
||||
struct hi6421_regulator_info *info;
|
||||
const struct hi6421_regulator_info *info;
|
||||
unsigned int reg_val;
|
||||
|
||||
info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
|
||||
@ -397,7 +397,7 @@ static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev)
|
||||
|
||||
static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev)
|
||||
{
|
||||
struct hi6421_regulator_info *info;
|
||||
const struct hi6421_regulator_info *info;
|
||||
unsigned int reg_val;
|
||||
|
||||
info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
|
||||
@ -411,7 +411,7 @@ static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev)
|
||||
static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev,
|
||||
unsigned int mode)
|
||||
{
|
||||
struct hi6421_regulator_info *info;
|
||||
const struct hi6421_regulator_info *info;
|
||||
unsigned int new_mode;
|
||||
|
||||
info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
|
||||
@ -436,7 +436,7 @@ static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev,
|
||||
static int hi6421_regulator_buck_set_mode(struct regulator_dev *rdev,
|
||||
unsigned int mode)
|
||||
{
|
||||
struct hi6421_regulator_info *info;
|
||||
const struct hi6421_regulator_info *info;
|
||||
unsigned int new_mode;
|
||||
|
||||
info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
|
||||
@ -462,7 +462,7 @@ static unsigned int
|
||||
hi6421_regulator_ldo_get_optimum_mode(struct regulator_dev *rdev,
|
||||
int input_uV, int output_uV, int load_uA)
|
||||
{
|
||||
struct hi6421_regulator_info *info;
|
||||
const struct hi6421_regulator_info *info;
|
||||
|
||||
info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
|
||||
|
||||
@ -539,7 +539,7 @@ static int hi6421_regulator_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct hi6421_pmic *pmic = dev_get_drvdata(pdev->dev.parent);
|
||||
struct hi6421_regulator_pdata *pdata;
|
||||
struct hi6421_regulator_info *info;
|
||||
const struct hi6421_regulator_info *info;
|
||||
struct regulator_config config = { };
|
||||
struct regulator_dev *rdev;
|
||||
int i;
|
||||
|
@ -21,12 +21,10 @@
|
||||
* struct hi6421v530_regulator_info - hi6421v530 regulator information
|
||||
* @desc: regulator description
|
||||
* @mode_mask: ECO mode bitmask of LDOs; for BUCKs, this masks sleep
|
||||
* @eco_microamp: eco mode load upper limit (in uA), valid for LDOs only
|
||||
*/
|
||||
struct hi6421v530_regulator_info {
|
||||
struct regulator_desc rdesc;
|
||||
u8 mode_mask;
|
||||
u32 eco_microamp;
|
||||
};
|
||||
|
||||
/* HI6421v530 regulators */
|
||||
@ -68,10 +66,9 @@ static const struct regulator_ops hi6421v530_ldo_ops;
|
||||
* emask - enable mask
|
||||
* odelay - off/on delay time in uS
|
||||
* ecomask - eco mode mask
|
||||
* ecoamp - eco mode load uppler limit in uA
|
||||
*/
|
||||
#define HI6421V530_LDO(_ID, v_table, vreg, vmask, ereg, emask, \
|
||||
odelay, ecomask, ecoamp) { \
|
||||
odelay, ecomask) { \
|
||||
.rdesc = { \
|
||||
.name = #_ID, \
|
||||
.of_match = of_match_ptr(#_ID), \
|
||||
@ -90,31 +87,30 @@ static const struct regulator_ops hi6421v530_ldo_ops;
|
||||
.off_on_delay = odelay, \
|
||||
}, \
|
||||
.mode_mask = ecomask, \
|
||||
.eco_microamp = ecoamp, \
|
||||
}
|
||||
|
||||
/* HI6421V530 regulator information */
|
||||
|
||||
static struct hi6421v530_regulator_info hi6421v530_regulator_info[] = {
|
||||
static const struct hi6421v530_regulator_info hi6421v530_regulator_info[] = {
|
||||
HI6421V530_LDO(LDO3, ldo_3_voltages, 0x061, 0xf, 0x060, 0x2,
|
||||
20000, 0x6, 8000),
|
||||
20000, 0x6),
|
||||
HI6421V530_LDO(LDO9, ldo_9_11_voltages, 0x06b, 0x7, 0x06a, 0x2,
|
||||
40000, 0x6, 8000),
|
||||
40000, 0x6),
|
||||
HI6421V530_LDO(LDO11, ldo_9_11_voltages, 0x06f, 0x7, 0x06e, 0x2,
|
||||
40000, 0x6, 8000),
|
||||
40000, 0x6),
|
||||
HI6421V530_LDO(LDO15, ldo_15_16_voltages, 0x077, 0x7, 0x076, 0x2,
|
||||
40000, 0x6, 8000),
|
||||
40000, 0x6),
|
||||
HI6421V530_LDO(LDO16, ldo_15_16_voltages, 0x079, 0x7, 0x078, 0x2,
|
||||
40000, 0x6, 8000),
|
||||
40000, 0x6),
|
||||
};
|
||||
|
||||
static unsigned int hi6421v530_regulator_ldo_get_mode(
|
||||
struct regulator_dev *rdev)
|
||||
{
|
||||
struct hi6421v530_regulator_info *info;
|
||||
const struct hi6421v530_regulator_info *info;
|
||||
unsigned int reg_val;
|
||||
|
||||
info = rdev_get_drvdata(rdev);
|
||||
info = container_of(rdev->desc, struct hi6421v530_regulator_info, rdesc);
|
||||
regmap_read(rdev->regmap, rdev->desc->enable_reg, ®_val);
|
||||
|
||||
if (reg_val & (info->mode_mask))
|
||||
@ -126,10 +122,10 @@ static unsigned int hi6421v530_regulator_ldo_get_mode(
|
||||
static int hi6421v530_regulator_ldo_set_mode(struct regulator_dev *rdev,
|
||||
unsigned int mode)
|
||||
{
|
||||
struct hi6421v530_regulator_info *info;
|
||||
const struct hi6421v530_regulator_info *info;
|
||||
unsigned int new_mode;
|
||||
|
||||
info = rdev_get_drvdata(rdev);
|
||||
info = container_of(rdev->desc, struct hi6421v530_regulator_info, rdesc);
|
||||
switch (mode) {
|
||||
case REGULATOR_MODE_NORMAL:
|
||||
new_mode = 0;
|
||||
@ -176,7 +172,6 @@ static int hi6421v530_regulator_probe(struct platform_device *pdev)
|
||||
for (i = 0; i < ARRAY_SIZE(hi6421v530_regulator_info); i++) {
|
||||
config.dev = pdev->dev.parent;
|
||||
config.regmap = pmic->regmap;
|
||||
config.driver_data = &hi6421v530_regulator_info[i];
|
||||
|
||||
rdev = devm_regulator_register(&pdev->dev,
|
||||
&hi6421v530_regulator_info[i].rdesc,
|
||||
|
@ -118,7 +118,7 @@ static int hi6421_spmi_regulator_enable(struct regulator_dev *rdev)
|
||||
|
||||
static unsigned int hi6421_spmi_regulator_get_mode(struct regulator_dev *rdev)
|
||||
{
|
||||
struct hi6421_spmi_reg_info *sreg;
|
||||
const struct hi6421_spmi_reg_info *sreg;
|
||||
unsigned int reg_val;
|
||||
|
||||
sreg = container_of(rdev->desc, struct hi6421_spmi_reg_info, desc);
|
||||
@ -133,7 +133,7 @@ static unsigned int hi6421_spmi_regulator_get_mode(struct regulator_dev *rdev)
|
||||
static int hi6421_spmi_regulator_set_mode(struct regulator_dev *rdev,
|
||||
unsigned int mode)
|
||||
{
|
||||
struct hi6421_spmi_reg_info *sreg;
|
||||
const struct hi6421_spmi_reg_info *sreg;
|
||||
unsigned int val;
|
||||
|
||||
sreg = container_of(rdev->desc, struct hi6421_spmi_reg_info, desc);
|
||||
@ -160,7 +160,7 @@ hi6421_spmi_regulator_get_optimum_mode(struct regulator_dev *rdev,
|
||||
int input_uV, int output_uV,
|
||||
int load_uA)
|
||||
{
|
||||
struct hi6421_spmi_reg_info *sreg;
|
||||
const struct hi6421_spmi_reg_info *sreg;
|
||||
|
||||
sreg = container_of(rdev->desc, struct hi6421_spmi_reg_info, desc);
|
||||
|
||||
@ -195,7 +195,7 @@ enum hi6421_spmi_regulator_id {
|
||||
hi6421v600_ldo34,
|
||||
};
|
||||
|
||||
static struct hi6421_spmi_reg_info regulator_info[] = {
|
||||
static const struct hi6421_spmi_reg_info regulator_info[] = {
|
||||
HI6421V600_LDO(ldo3, range_1v5_to_2v0,
|
||||
0x16, 0x01, 0x51,
|
||||
20000, 120,
|
||||
@ -235,7 +235,7 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev)
|
||||
struct device *pmic_dev = pdev->dev.parent;
|
||||
struct regulator_config config = { };
|
||||
struct hi6421_spmi_reg_priv *priv;
|
||||
struct hi6421_spmi_reg_info *info;
|
||||
const struct hi6421_spmi_reg_info *info;
|
||||
struct device *dev = &pdev->dev;
|
||||
struct regmap *regmap;
|
||||
struct regulator_dev *rdev;
|
||||
|
@ -43,8 +43,6 @@ struct max77650_regulator_desc {
|
||||
unsigned int regB;
|
||||
};
|
||||
|
||||
static struct max77650_regulator_desc max77651_SBB1_desc;
|
||||
|
||||
static const unsigned int max77651_sbb1_volt_range_sel[] = {
|
||||
0x0, 0x1, 0x2, 0x3
|
||||
};
|
||||
@ -66,11 +64,11 @@ static const unsigned int max77650_current_limit_table[] = {
|
||||
|
||||
static int max77650_regulator_is_enabled(struct regulator_dev *rdev)
|
||||
{
|
||||
struct max77650_regulator_desc *rdesc;
|
||||
const struct max77650_regulator_desc *rdesc;
|
||||
struct regmap *map;
|
||||
int val, rv, en;
|
||||
|
||||
rdesc = rdev_get_drvdata(rdev);
|
||||
rdesc = container_of(rdev->desc, struct max77650_regulator_desc, desc);
|
||||
map = rdev_get_regmap(rdev);
|
||||
|
||||
rv = regmap_read(map, rdesc->regB, &val);
|
||||
@ -84,10 +82,10 @@ static int max77650_regulator_is_enabled(struct regulator_dev *rdev)
|
||||
|
||||
static int max77650_regulator_enable(struct regulator_dev *rdev)
|
||||
{
|
||||
struct max77650_regulator_desc *rdesc;
|
||||
const struct max77650_regulator_desc *rdesc;
|
||||
struct regmap *map;
|
||||
|
||||
rdesc = rdev_get_drvdata(rdev);
|
||||
rdesc = container_of(rdev->desc, struct max77650_regulator_desc, desc);
|
||||
map = rdev_get_regmap(rdev);
|
||||
|
||||
return regmap_update_bits(map, rdesc->regB,
|
||||
@ -97,10 +95,10 @@ static int max77650_regulator_enable(struct regulator_dev *rdev)
|
||||
|
||||
static int max77650_regulator_disable(struct regulator_dev *rdev)
|
||||
{
|
||||
struct max77650_regulator_desc *rdesc;
|
||||
const struct max77650_regulator_desc *rdesc;
|
||||
struct regmap *map;
|
||||
|
||||
rdesc = rdev_get_drvdata(rdev);
|
||||
rdesc = container_of(rdev->desc, struct max77650_regulator_desc, desc);
|
||||
map = rdev_get_regmap(rdev);
|
||||
|
||||
return regmap_update_bits(map, rdesc->regB,
|
||||
@ -145,7 +143,7 @@ static const struct regulator_ops max77651_SBB1_regulator_ops = {
|
||||
.set_active_discharge = regulator_set_active_discharge_regmap,
|
||||
};
|
||||
|
||||
static struct max77650_regulator_desc max77650_LDO_desc = {
|
||||
static const struct max77650_regulator_desc max77650_LDO_desc = {
|
||||
.desc = {
|
||||
.name = "ldo",
|
||||
.of_match = of_match_ptr("ldo"),
|
||||
@ -171,7 +169,7 @@ static struct max77650_regulator_desc max77650_LDO_desc = {
|
||||
.regB = MAX77650_REG_CNFG_LDO_B,
|
||||
};
|
||||
|
||||
static struct max77650_regulator_desc max77650_SBB0_desc = {
|
||||
static const struct max77650_regulator_desc max77650_SBB0_desc = {
|
||||
.desc = {
|
||||
.name = "sbb0",
|
||||
.of_match = of_match_ptr("sbb0"),
|
||||
@ -201,7 +199,7 @@ static struct max77650_regulator_desc max77650_SBB0_desc = {
|
||||
.regB = MAX77650_REG_CNFG_SBB0_B,
|
||||
};
|
||||
|
||||
static struct max77650_regulator_desc max77650_SBB1_desc = {
|
||||
static const struct max77650_regulator_desc max77650_SBB1_desc = {
|
||||
.desc = {
|
||||
.name = "sbb1",
|
||||
.of_match = of_match_ptr("sbb1"),
|
||||
@ -231,7 +229,7 @@ static struct max77650_regulator_desc max77650_SBB1_desc = {
|
||||
.regB = MAX77650_REG_CNFG_SBB1_B,
|
||||
};
|
||||
|
||||
static struct max77650_regulator_desc max77651_SBB1_desc = {
|
||||
static const struct max77650_regulator_desc max77651_SBB1_desc = {
|
||||
.desc = {
|
||||
.name = "sbb1",
|
||||
.of_match = of_match_ptr("sbb1"),
|
||||
@ -264,7 +262,7 @@ static struct max77650_regulator_desc max77651_SBB1_desc = {
|
||||
.regB = MAX77650_REG_CNFG_SBB1_B,
|
||||
};
|
||||
|
||||
static struct max77650_regulator_desc max77650_SBB2_desc = {
|
||||
static const struct max77650_regulator_desc max77650_SBB2_desc = {
|
||||
.desc = {
|
||||
.name = "sbb2",
|
||||
.of_match = of_match_ptr("sbb2"),
|
||||
@ -294,7 +292,7 @@ static struct max77650_regulator_desc max77650_SBB2_desc = {
|
||||
.regB = MAX77650_REG_CNFG_SBB2_B,
|
||||
};
|
||||
|
||||
static struct max77650_regulator_desc max77651_SBB2_desc = {
|
||||
static const struct max77650_regulator_desc max77651_SBB2_desc = {
|
||||
.desc = {
|
||||
.name = "sbb2",
|
||||
.of_match = of_match_ptr("sbb2"),
|
||||
@ -326,8 +324,8 @@ static struct max77650_regulator_desc max77651_SBB2_desc = {
|
||||
|
||||
static int max77650_regulator_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct max77650_regulator_desc **rdescs;
|
||||
struct max77650_regulator_desc *rdesc;
|
||||
const struct max77650_regulator_desc **rdescs;
|
||||
const struct max77650_regulator_desc *rdesc;
|
||||
struct regulator_config config = { };
|
||||
struct device *dev, *parent;
|
||||
struct regulator_dev *rdev;
|
||||
@ -376,7 +374,6 @@ static int max77650_regulator_probe(struct platform_device *pdev)
|
||||
|
||||
for (i = 0; i < MAX77650_REGULATOR_NUM_REGULATORS; i++) {
|
||||
rdesc = rdescs[i];
|
||||
config.driver_data = rdesc;
|
||||
|
||||
rdev = devm_regulator_register(dev, &rdesc->desc, &config);
|
||||
if (IS_ERR(rdev))
|
||||
|
@ -153,7 +153,6 @@ enum max77826_regulators {
|
||||
|
||||
struct max77826_regulator_info {
|
||||
struct regmap *regmap;
|
||||
struct regulator_desc *rdesc;
|
||||
};
|
||||
|
||||
static const struct regmap_config max77826_regmap_config = {
|
||||
@ -187,7 +186,7 @@ static const struct regulator_ops max77826_buck_ops = {
|
||||
.set_voltage_time_sel = max77826_set_voltage_time_sel,
|
||||
};
|
||||
|
||||
static struct regulator_desc max77826_regulators_desc[] = {
|
||||
static const struct regulator_desc max77826_regulators_desc[] = {
|
||||
MAX77826_LDO(1, NMOS),
|
||||
MAX77826_LDO(2, NMOS),
|
||||
MAX77826_LDO(3, NMOS),
|
||||
@ -246,7 +245,6 @@ static int max77826_i2c_probe(struct i2c_client *client)
|
||||
if (!info)
|
||||
return -ENOMEM;
|
||||
|
||||
info->rdesc = max77826_regulators_desc;
|
||||
regmap = devm_regmap_init_i2c(client, &max77826_regmap_config);
|
||||
if (IS_ERR(regmap)) {
|
||||
dev_err(dev, "Failed to allocate regmap!\n");
|
||||
|
@ -19,7 +19,7 @@ enum dvfsrc_regulator_id {
|
||||
};
|
||||
|
||||
struct dvfsrc_regulator_pdata {
|
||||
struct regulator_desc *descs;
|
||||
const struct regulator_desc *descs;
|
||||
u32 size;
|
||||
};
|
||||
|
||||
@ -107,7 +107,7 @@ static const unsigned int mt6873_voltages[] = {
|
||||
725000,
|
||||
};
|
||||
|
||||
static struct regulator_desc mt6873_regulators[] = {
|
||||
static const struct regulator_desc mt6873_regulators[] = {
|
||||
MTK_DVFSRC_VREG("dvfsrc-vcore", VCORE, mt6873_voltages),
|
||||
MTK_DVFSRC_VREG("dvfsrc-vscp", VSCP, mt6873_voltages),
|
||||
};
|
||||
@ -122,7 +122,7 @@ static const unsigned int mt8183_voltages[] = {
|
||||
800000,
|
||||
};
|
||||
|
||||
static struct regulator_desc mt8183_regulators[] = {
|
||||
static const struct regulator_desc mt8183_regulators[] = {
|
||||
MTK_DVFSRC_VREG("dvfsrc-vcore", VCORE, mt8183_voltages),
|
||||
};
|
||||
|
||||
@ -138,7 +138,7 @@ static const unsigned int mt8195_voltages[] = {
|
||||
750000,
|
||||
};
|
||||
|
||||
static struct regulator_desc mt8195_regulators[] = {
|
||||
static const struct regulator_desc mt8195_regulators[] = {
|
||||
MTK_DVFSRC_VREG("dvfsrc-vcore", VCORE, mt8195_voltages),
|
||||
MTK_DVFSRC_VREG("dvfsrc-vscp", VSCP, mt8195_voltages),
|
||||
};
|
||||
@ -159,7 +159,7 @@ static int dvfsrc_vcore_regulator_probe(struct platform_device *pdev)
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < pdata->size; i++) {
|
||||
struct regulator_desc *vrdesc = &pdata->descs[i];
|
||||
const struct regulator_desc *vrdesc = &pdata->descs[i];
|
||||
struct regulator_dev *rdev;
|
||||
|
||||
rdev = devm_regulator_register(&pdev->dev, vrdesc, &config);
|
||||
|
@ -105,7 +105,7 @@ struct pcap_regulator {
|
||||
.lowpwr = _lowpwr, \
|
||||
}
|
||||
|
||||
static struct pcap_regulator vreg_table[] = {
|
||||
static const struct pcap_regulator vreg_table[] = {
|
||||
VREG_INFO(V1, PCAP_REG_VREG1, 1, 2, 18, 0),
|
||||
VREG_INFO(V2, PCAP_REG_VREG1, 5, 6, 19, 22),
|
||||
VREG_INFO(V3, PCAP_REG_VREG1, 7, 8, 20, 23),
|
||||
@ -141,7 +141,7 @@ static struct pcap_regulator vreg_table[] = {
|
||||
static int pcap_regulator_set_voltage_sel(struct regulator_dev *rdev,
|
||||
unsigned selector)
|
||||
{
|
||||
struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
|
||||
const struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
|
||||
void *pcap = rdev_get_drvdata(rdev);
|
||||
|
||||
/* the regulator doesn't support voltage switching */
|
||||
@ -155,7 +155,7 @@ static int pcap_regulator_set_voltage_sel(struct regulator_dev *rdev,
|
||||
|
||||
static int pcap_regulator_get_voltage_sel(struct regulator_dev *rdev)
|
||||
{
|
||||
struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
|
||||
const struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
|
||||
void *pcap = rdev_get_drvdata(rdev);
|
||||
u32 tmp;
|
||||
|
||||
@ -169,7 +169,7 @@ static int pcap_regulator_get_voltage_sel(struct regulator_dev *rdev)
|
||||
|
||||
static int pcap_regulator_enable(struct regulator_dev *rdev)
|
||||
{
|
||||
struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
|
||||
const struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
|
||||
void *pcap = rdev_get_drvdata(rdev);
|
||||
|
||||
if (vreg->en == NA)
|
||||
@ -180,7 +180,7 @@ static int pcap_regulator_enable(struct regulator_dev *rdev)
|
||||
|
||||
static int pcap_regulator_disable(struct regulator_dev *rdev)
|
||||
{
|
||||
struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
|
||||
const struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
|
||||
void *pcap = rdev_get_drvdata(rdev);
|
||||
|
||||
if (vreg->en == NA)
|
||||
@ -191,7 +191,7 @@ static int pcap_regulator_disable(struct regulator_dev *rdev)
|
||||
|
||||
static int pcap_regulator_is_enabled(struct regulator_dev *rdev)
|
||||
{
|
||||
struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
|
||||
const struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
|
||||
void *pcap = rdev_get_drvdata(rdev);
|
||||
u32 tmp;
|
||||
|
||||
|
@ -76,7 +76,7 @@ struct pfuze_chip {
|
||||
struct device *dev;
|
||||
struct pfuze_regulator regulator_descs[PFUZE100_MAX_REGULATOR];
|
||||
struct regulator_dev *regulators[PFUZE100_MAX_REGULATOR];
|
||||
struct pfuze_regulator *pfuze_regulators;
|
||||
const struct pfuze_regulator *pfuze_regulators;
|
||||
};
|
||||
|
||||
static const int pfuze100_swbst[] = {
|
||||
@ -367,7 +367,7 @@ static const struct regulator_ops pfuze3000_sw_regulator_ops = {
|
||||
}
|
||||
|
||||
/* PFUZE100 */
|
||||
static struct pfuze_regulator pfuze100_regulators[] = {
|
||||
static const struct pfuze_regulator pfuze100_regulators[] = {
|
||||
PFUZE100_SW_REG(PFUZE100, SW1AB, PFUZE100_SW1ABVOL, 300000, 1875000, 25000),
|
||||
PFUZE100_SW_REG(PFUZE100, SW1C, PFUZE100_SW1CVOL, 300000, 1875000, 25000),
|
||||
PFUZE100_SW_REG(PFUZE100, SW2, PFUZE100_SW2VOL, 400000, 1975000, 25000),
|
||||
@ -386,7 +386,7 @@ static struct pfuze_regulator pfuze100_regulators[] = {
|
||||
PFUZE100_COIN_REG(PFUZE100, COIN, PFUZE100_COINVOL, 0x7, pfuze100_coin),
|
||||
};
|
||||
|
||||
static struct pfuze_regulator pfuze200_regulators[] = {
|
||||
static const struct pfuze_regulator pfuze200_regulators[] = {
|
||||
PFUZE100_SW_REG(PFUZE200, SW1AB, PFUZE100_SW1ABVOL, 300000, 1875000, 25000),
|
||||
PFUZE100_SW_REG(PFUZE200, SW2, PFUZE100_SW2VOL, 400000, 1975000, 25000),
|
||||
PFUZE100_SW_REG(PFUZE200, SW3A, PFUZE100_SW3AVOL, 400000, 1975000, 25000),
|
||||
@ -403,7 +403,7 @@ static struct pfuze_regulator pfuze200_regulators[] = {
|
||||
PFUZE100_COIN_REG(PFUZE200, COIN, PFUZE100_COINVOL, 0x7, pfuze100_coin),
|
||||
};
|
||||
|
||||
static struct pfuze_regulator pfuze3000_regulators[] = {
|
||||
static const struct pfuze_regulator pfuze3000_regulators[] = {
|
||||
PFUZE3000_SW_REG(PFUZE3000, SW1A, PFUZE100_SW1ABVOL, 0x1f, pfuze3000_sw1a),
|
||||
PFUZE100_SW_REG(PFUZE3000, SW1B, PFUZE100_SW1CVOL, 700000, 1475000, 25000),
|
||||
PFUZE3000_SW_REG(PFUZE3000, SW2, PFUZE100_SW2VOL, 0x7, pfuze3000_sw2lo),
|
||||
@ -419,7 +419,7 @@ static struct pfuze_regulator pfuze3000_regulators[] = {
|
||||
PFUZE100_VGEN_REG(PFUZE3000, VLDO4, PFUZE100_VGEN6VOL, 1800000, 3300000, 100000),
|
||||
};
|
||||
|
||||
static struct pfuze_regulator pfuze3001_regulators[] = {
|
||||
static const struct pfuze_regulator pfuze3001_regulators[] = {
|
||||
PFUZE3000_SW_REG(PFUZE3001, SW1, PFUZE100_SW1ABVOL, 0x1f, pfuze3000_sw1a),
|
||||
PFUZE3000_SW_REG(PFUZE3001, SW2, PFUZE100_SW2VOL, 0x7, pfuze3000_sw2lo),
|
||||
PFUZE3000_SW3_REG(PFUZE3001, SW3, PFUZE100_SW3AVOL, 900000, 1650000, 50000),
|
||||
|
@ -62,7 +62,7 @@ static int qcom_sdm845_refgen_is_enabled(struct regulator_dev *rdev)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static struct regulator_desc sdm845_refgen_desc = {
|
||||
static const struct regulator_desc sdm845_refgen_desc = {
|
||||
.enable_time = 5,
|
||||
.name = "refgen",
|
||||
.owner = THIS_MODULE,
|
||||
@ -74,7 +74,7 @@ static struct regulator_desc sdm845_refgen_desc = {
|
||||
},
|
||||
};
|
||||
|
||||
static struct regulator_desc sm8250_refgen_desc = {
|
||||
static const struct regulator_desc sm8250_refgen_desc = {
|
||||
.enable_reg = REFGEN_REG_PWRDWN_CTRL5,
|
||||
.enable_mask = REFGEN_PWRDWN_CTRL5_MASK,
|
||||
.enable_val = REFGEN_PWRDWN_CTRL5_ENABLE,
|
||||
|
@ -242,17 +242,17 @@ static const struct regulator_desc tps65023_regulators[] = {
|
||||
TPS65023_REGULATOR_LDO(2, TPS65023_LDO2_VSEL_table, 0x70),
|
||||
};
|
||||
|
||||
static struct tps_driver_data tps65020_drv_data = {
|
||||
static const struct tps_driver_data tps65020_drv_data = {
|
||||
.desc = tps65020_regulators,
|
||||
.core_regulator = TPS65023_DCDC_3,
|
||||
};
|
||||
|
||||
static struct tps_driver_data tps65021_drv_data = {
|
||||
static const struct tps_driver_data tps65021_drv_data = {
|
||||
.desc = tps65021_regulators,
|
||||
.core_regulator = TPS65023_DCDC_3,
|
||||
};
|
||||
|
||||
static struct tps_driver_data tps65023_drv_data = {
|
||||
static const struct tps_driver_data tps65023_drv_data = {
|
||||
.desc = tps65023_regulators,
|
||||
.core_regulator = TPS65023_DCDC_1,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user