Skip to content

Commit

Permalink
Merge tag 'regulator-fix-v6.9-rc6' of git://git.kernel.org/pub/scm/li…
Browse files Browse the repository at this point in the history
…nux/kernel/git/broonie/regulator

Pull regulator fixes from Mark Brown:
 "There's a few simple driver specific fixes here, plus some core
  cleanups from Matti which fix issues found with client drivers due to
  the API being confusing.

  The two fixes for the stubs provide more constructive behaviour with
  !REGULATOR configurations, issues were noticed with some hwmon drivers
  which would otherwise have needed confusing bodges in the users.

  The irq_helpers fix to duplicate the provided name for the interrupt
  controller was found because a driver got this wrong and it's again a
  case where the core is the sensible place to put the fix"

* tag 'regulator-fix-v6.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: change devm_regulator_get_enable_optional() stub to return Ok
  regulator: change stubbed devm_regulator_get_enable to return Ok
  regulator: vqmmc-ipq4019: fix module autoloading
  regulator: qcom-refgen: fix module autoloading
  regulator: mt6360: De-capitalize devicetree regulator subnodes
  regulator: irq_helpers: duplicate IRQ name
  • Loading branch information
Linus Torvalds committed May 1, 2024
2 parents 18daea7 + ff33132 commit 0106679
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
3 changes: 3 additions & 0 deletions drivers/regulator/irq_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@ void *regulator_irq_helper(struct device *dev,

h->irq = irq;
h->desc = *d;
h->desc.name = devm_kstrdup(dev, d->name, GFP_KERNEL);
if (!h->desc.name)
return ERR_PTR(-ENOMEM);

ret = init_rdev_state(dev, h, rdev, common_errs, per_rdev_errs,
rdev_amount);
Expand Down
32 changes: 20 additions & 12 deletions drivers/regulator/mt6360-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,15 +319,15 @@ static unsigned int mt6360_regulator_of_map_mode(unsigned int hw_mode)
}
}

#define MT6360_REGULATOR_DESC(_name, _sname, ereg, emask, vreg, vmask, \
mreg, mmask, streg, stmask, vranges, \
vcnts, offon_delay, irq_tbls) \
#define MT6360_REGULATOR_DESC(match, _name, _sname, ereg, emask, vreg, \
vmask, mreg, mmask, streg, stmask, \
vranges, vcnts, offon_delay, irq_tbls) \
{ \
.desc = { \
.name = #_name, \
.supply_name = #_sname, \
.id = MT6360_REGULATOR_##_name, \
.of_match = of_match_ptr(#_name), \
.of_match = of_match_ptr(match), \
.regulators_node = of_match_ptr("regulator"), \
.of_map_mode = mt6360_regulator_of_map_mode, \
.owner = THIS_MODULE, \
Expand All @@ -351,21 +351,29 @@ static unsigned int mt6360_regulator_of_map_mode(unsigned int hw_mode)
}

static const struct mt6360_regulator_desc mt6360_regulator_descs[] = {
MT6360_REGULATOR_DESC(BUCK1, BUCK1_VIN, 0x117, 0x40, 0x110, 0xff, 0x117, 0x30, 0x117, 0x04,
MT6360_REGULATOR_DESC("buck1", BUCK1, BUCK1_VIN,
0x117, 0x40, 0x110, 0xff, 0x117, 0x30, 0x117, 0x04,
buck_vout_ranges, 256, 0, buck1_irq_tbls),
MT6360_REGULATOR_DESC(BUCK2, BUCK2_VIN, 0x127, 0x40, 0x120, 0xff, 0x127, 0x30, 0x127, 0x04,
MT6360_REGULATOR_DESC("buck2", BUCK2, BUCK2_VIN,
0x127, 0x40, 0x120, 0xff, 0x127, 0x30, 0x127, 0x04,
buck_vout_ranges, 256, 0, buck2_irq_tbls),
MT6360_REGULATOR_DESC(LDO6, LDO_VIN3, 0x137, 0x40, 0x13B, 0xff, 0x137, 0x30, 0x137, 0x04,
MT6360_REGULATOR_DESC("ldo6", LDO6, LDO_VIN3,
0x137, 0x40, 0x13B, 0xff, 0x137, 0x30, 0x137, 0x04,
ldo_vout_ranges1, 256, 0, ldo6_irq_tbls),
MT6360_REGULATOR_DESC(LDO7, LDO_VIN3, 0x131, 0x40, 0x135, 0xff, 0x131, 0x30, 0x131, 0x04,
MT6360_REGULATOR_DESC("ldo7", LDO7, LDO_VIN3,
0x131, 0x40, 0x135, 0xff, 0x131, 0x30, 0x131, 0x04,
ldo_vout_ranges1, 256, 0, ldo7_irq_tbls),
MT6360_REGULATOR_DESC(LDO1, LDO_VIN1, 0x217, 0x40, 0x21B, 0xff, 0x217, 0x30, 0x217, 0x04,
MT6360_REGULATOR_DESC("ldo1", LDO1, LDO_VIN1,
0x217, 0x40, 0x21B, 0xff, 0x217, 0x30, 0x217, 0x04,
ldo_vout_ranges2, 256, 0, ldo1_irq_tbls),
MT6360_REGULATOR_DESC(LDO2, LDO_VIN1, 0x211, 0x40, 0x215, 0xff, 0x211, 0x30, 0x211, 0x04,
MT6360_REGULATOR_DESC("ldo2", LDO2, LDO_VIN1,
0x211, 0x40, 0x215, 0xff, 0x211, 0x30, 0x211, 0x04,
ldo_vout_ranges2, 256, 0, ldo2_irq_tbls),
MT6360_REGULATOR_DESC(LDO3, LDO_VIN1, 0x205, 0x40, 0x209, 0xff, 0x205, 0x30, 0x205, 0x04,
MT6360_REGULATOR_DESC("ldo3", LDO3, LDO_VIN1,
0x205, 0x40, 0x209, 0xff, 0x205, 0x30, 0x205, 0x04,
ldo_vout_ranges2, 256, 100, ldo3_irq_tbls),
MT6360_REGULATOR_DESC(LDO5, LDO_VIN2, 0x20B, 0x40, 0x20F, 0x7f, 0x20B, 0x30, 0x20B, 0x04,
MT6360_REGULATOR_DESC("ldo5", LDO5, LDO_VIN2,
0x20B, 0x40, 0x20F, 0x7f, 0x20B, 0x30, 0x20B, 0x04,
ldo_vout_ranges3, 128, 100, ldo5_irq_tbls),
};

Expand Down
1 change: 1 addition & 0 deletions drivers/regulator/qcom-refgen-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ static const struct of_device_id qcom_refgen_match_table[] = {
{ .compatible = "qcom,sm8250-refgen-regulator", .data = &sm8250_refgen_desc },
{ }
};
MODULE_DEVICE_TABLE(of, qcom_refgen_match_table);

static struct platform_driver qcom_refgen_driver = {
.probe = qcom_refgen_probe,
Expand Down
1 change: 1 addition & 0 deletions drivers/regulator/vqmmc-ipq4019-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ static const struct of_device_id regulator_ipq4019_of_match[] = {
{ .compatible = "qcom,vqmmc-ipq4019-regulator", },
{},
};
MODULE_DEVICE_TABLE(of, regulator_ipq4019_of_match);

static struct platform_driver ipq4019_regulator_driver = {
.probe = ipq4019_regulator_probe,
Expand Down
4 changes: 2 additions & 2 deletions include/linux/regulator/consumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,13 @@ devm_regulator_get_exclusive(struct device *dev, const char *id)

static inline int devm_regulator_get_enable(struct device *dev, const char *id)
{
return -ENODEV;
return 0;
}

static inline int devm_regulator_get_enable_optional(struct device *dev,
const char *id)
{
return -ENODEV;
return 0;
}

static inline struct regulator *__must_check
Expand Down

0 comments on commit 0106679

Please sign in to comment.