mfd: regulator: clk: Split rohm-bd718x7.h
Split the bd718x7.h to ROHM common and bd718x7 specific parts so that we do not need to add same things in every new ROHM PMIC header. Please note that this change requires changes also in bd718x7 sub-device drivers for regulators and clk. Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Acked-by: Mark Brown <broonie@kernel.org> Acked-by: Stephen Boyd <sboyd@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:

committed by
Lee Jones

parent
a188339ca5
commit
2a6a7aacd4
@@ -1152,12 +1152,12 @@ static int bd718xx_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct bd718xx *mfd;
|
||||
struct regulator_config config = { 0 };
|
||||
struct bd718xx_pmic_inits pmic_regulators[] = {
|
||||
[BD718XX_TYPE_BD71837] = {
|
||||
struct bd718xx_pmic_inits pmic_regulators[ROHM_CHIP_TYPE_AMOUNT] = {
|
||||
[ROHM_CHIP_TYPE_BD71837] = {
|
||||
.r_datas = bd71837_regulators,
|
||||
.r_amount = ARRAY_SIZE(bd71837_regulators),
|
||||
},
|
||||
[BD718XX_TYPE_BD71847] = {
|
||||
[ROHM_CHIP_TYPE_BD71847] = {
|
||||
.r_datas = bd71847_regulators,
|
||||
.r_amount = ARRAY_SIZE(bd71847_regulators),
|
||||
},
|
||||
@@ -1173,15 +1173,15 @@ static int bd718xx_probe(struct platform_device *pdev)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (mfd->chip_type >= BD718XX_TYPE_AMOUNT ||
|
||||
!pmic_regulators[mfd->chip_type].r_datas) {
|
||||
if (mfd->chip.chip_type >= ROHM_CHIP_TYPE_AMOUNT ||
|
||||
!pmic_regulators[mfd->chip.chip_type].r_datas) {
|
||||
dev_err(&pdev->dev, "Unsupported chip type\n");
|
||||
err = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Register LOCK release */
|
||||
err = regmap_update_bits(mfd->regmap, BD718XX_REG_REGLOCK,
|
||||
err = regmap_update_bits(mfd->chip.regmap, BD718XX_REG_REGLOCK,
|
||||
(REGLOCK_PWRSEQ | REGLOCK_VREG), 0);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "Failed to unlock PMIC (%d)\n", err);
|
||||
@@ -1200,7 +1200,8 @@ static int bd718xx_probe(struct platform_device *pdev)
|
||||
* bit allowing HW defaults for power rails to be used
|
||||
*/
|
||||
if (!use_snvs) {
|
||||
err = regmap_update_bits(mfd->regmap, BD718XX_REG_TRANS_COND1,
|
||||
err = regmap_update_bits(mfd->chip.regmap,
|
||||
BD718XX_REG_TRANS_COND1,
|
||||
BD718XX_ON_REQ_POWEROFF_MASK |
|
||||
BD718XX_SWRESET_POWEROFF_MASK |
|
||||
BD718XX_WDOG_POWEROFF_MASK |
|
||||
@@ -1215,17 +1216,17 @@ static int bd718xx_probe(struct platform_device *pdev)
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < pmic_regulators[mfd->chip_type].r_amount; i++) {
|
||||
for (i = 0; i < pmic_regulators[mfd->chip.chip_type].r_amount; i++) {
|
||||
|
||||
const struct regulator_desc *desc;
|
||||
struct regulator_dev *rdev;
|
||||
const struct bd718xx_regulator_data *r;
|
||||
|
||||
r = &pmic_regulators[mfd->chip_type].r_datas[i];
|
||||
r = &pmic_regulators[mfd->chip.chip_type].r_datas[i];
|
||||
desc = &r->desc;
|
||||
|
||||
config.dev = pdev->dev.parent;
|
||||
config.regmap = mfd->regmap;
|
||||
config.regmap = mfd->chip.regmap;
|
||||
|
||||
rdev = devm_regulator_register(&pdev->dev, desc, &config);
|
||||
if (IS_ERR(rdev)) {
|
||||
@@ -1254,7 +1255,7 @@ static int bd718xx_probe(struct platform_device *pdev)
|
||||
*/
|
||||
if (!use_snvs || !rdev->constraints->always_on ||
|
||||
!rdev->constraints->boot_on) {
|
||||
err = regmap_update_bits(mfd->regmap, r->init.reg,
|
||||
err = regmap_update_bits(mfd->chip.regmap, r->init.reg,
|
||||
r->init.mask, r->init.val);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev,
|
||||
@@ -1264,7 +1265,7 @@ static int bd718xx_probe(struct platform_device *pdev)
|
||||
}
|
||||
}
|
||||
for (j = 0; j < r->additional_init_amnt; j++) {
|
||||
err = regmap_update_bits(mfd->regmap,
|
||||
err = regmap_update_bits(mfd->chip.regmap,
|
||||
r->additional_inits[j].reg,
|
||||
r->additional_inits[j].mask,
|
||||
r->additional_inits[j].val);
|
||||
|
Reference in New Issue
Block a user