Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

regulator: bd71828: rename IC specific entities

The new ROHM BD72720 PMIC has similarities with the BD71828. It makes
sense to support the regulator control for both PMICs using the same
driver. It is often more clear to have the IC specific functions and
globals named starting with the chip-name. So, as a preparatory step,
prefix the BD71828 specific functions and globals with the bd71828.

It would be tempting to try also removing the chip ID from those
functions which will be common for both PMICs. I have bad experiences on
this as it tends to lead to problems when yet another IC is being
supported with the same driver, and we will have some functions used for
all, some for two of the three, and some for just one. At this point
I used to start inventing wildcards like BD718XX or BD7272X. This
approach is pretty much always failing as we tend to eventually have
something like BD73900 - where all the wildcard stuff will break down.

So, my approach these days is to:
- keep the original chip-id prefix for anything that had it already
(and avoid the churn).
- use same prefix for all things that are used by multiple ICs -
typically the chip-ID of the first chip. This typically matches also
the driver and file names.
- use specific chip-ID as a prefix for anything which is specific to
just one chip.

As a preparatory step to adding the BD72720, add bd71828 prefix to all
commonly usable functions and globals.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://patch.msgid.link/df5c98c6392c3b52cd41e3d98d60b65a1585b2dd.1765804226.git.mazziesaccount@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Matti Vaittinen and committed by
Lee Jones
8dc33b7c af25277b

+16 -16
+16 -16
drivers/regulator/bd71828-regulator.c
··· 28 28 int reg_init_amnt; 29 29 }; 30 30 31 - static const struct reg_init buck1_inits[] = { 31 + static const struct reg_init bd71828_buck1_inits[] = { 32 32 /* 33 33 * DVS Buck voltages can be changed by register values or via GPIO. 34 34 * Use register accesses by default. ··· 40 40 }, 41 41 }; 42 42 43 - static const struct reg_init buck2_inits[] = { 43 + static const struct reg_init bd71828_buck2_inits[] = { 44 44 { 45 45 .reg = BD71828_REG_PS_CTRL_1, 46 46 .mask = BD71828_MASK_DVS_BUCK2_CTRL, ··· 48 48 }, 49 49 }; 50 50 51 - static const struct reg_init buck6_inits[] = { 51 + static const struct reg_init bd71828_buck6_inits[] = { 52 52 { 53 53 .reg = BD71828_REG_PS_CTRL_1, 54 54 .mask = BD71828_MASK_DVS_BUCK6_CTRL, ··· 56 56 }, 57 57 }; 58 58 59 - static const struct reg_init buck7_inits[] = { 59 + static const struct reg_init bd71828_buck7_inits[] = { 60 60 { 61 61 .reg = BD71828_REG_PS_CTRL_1, 62 62 .mask = BD71828_MASK_DVS_BUCK7_CTRL, ··· 102 102 return rohm_regulator_set_dvs_levels(&data->dvs, np, desc, cfg->regmap); 103 103 } 104 104 105 - static int ldo6_parse_dt(struct device_node *np, 106 - const struct regulator_desc *desc, 107 - struct regulator_config *cfg) 105 + static int bd71828_ldo6_parse_dt(struct device_node *np, 106 + const struct regulator_desc *desc, 107 + struct regulator_config *cfg) 108 108 { 109 109 int ret, i; 110 110 uint32_t uv = 0; ··· 212 212 */ 213 213 .lpsr_on_mask = BD71828_MASK_LPSR_EN, 214 214 }, 215 - .reg_inits = buck1_inits, 216 - .reg_init_amnt = ARRAY_SIZE(buck1_inits), 215 + .reg_inits = bd71828_buck1_inits, 216 + .reg_init_amnt = ARRAY_SIZE(bd71828_buck1_inits), 217 217 }, 218 218 { 219 219 .desc = { ··· 253 253 .lpsr_reg = BD71828_REG_BUCK2_SUSP_VOLT, 254 254 .lpsr_mask = BD71828_MASK_BUCK1267_VOLT, 255 255 }, 256 - .reg_inits = buck2_inits, 257 - .reg_init_amnt = ARRAY_SIZE(buck2_inits), 256 + .reg_inits = bd71828_buck2_inits, 257 + .reg_init_amnt = ARRAY_SIZE(bd71828_buck2_inits), 258 258 }, 259 259 { 260 260 .desc = { ··· 399 399 .lpsr_reg = BD71828_REG_BUCK6_SUSP_VOLT, 400 400 .lpsr_mask = BD71828_MASK_BUCK1267_VOLT, 401 401 }, 402 - .reg_inits = buck6_inits, 403 - .reg_init_amnt = ARRAY_SIZE(buck6_inits), 402 + .reg_inits = bd71828_buck6_inits, 403 + .reg_init_amnt = ARRAY_SIZE(bd71828_buck6_inits), 404 404 }, 405 405 { 406 406 .desc = { ··· 440 440 .lpsr_reg = BD71828_REG_BUCK7_SUSP_VOLT, 441 441 .lpsr_mask = BD71828_MASK_BUCK1267_VOLT, 442 442 }, 443 - .reg_inits = buck7_inits, 444 - .reg_init_amnt = ARRAY_SIZE(buck7_inits), 443 + .reg_inits = bd71828_buck7_inits, 444 + .reg_init_amnt = ARRAY_SIZE(bd71828_buck7_inits), 445 445 }, 446 446 { 447 447 .desc = { ··· 633 633 * LDO6 only supports enable/disable for all states. 634 634 * Voltage for LDO6 is fixed. 635 635 */ 636 - .of_parse_cb = ldo6_parse_dt, 636 + .of_parse_cb = bd71828_ldo6_parse_dt, 637 637 }, 638 638 }, { 639 639 .desc = {