* [PATCH] regulator: act8865: support regulator-pull-down property
@ 2019-07-22 18:13 Michał Mirosław
2019-07-23 10:54 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Michał Mirosław @ 2019-07-22 18:13 UTC (permalink / raw)
To: linux-kernel; +Cc: Liam Girdwood, Mark Brown
AC8865 has internal 1.5k pull-down resistor that can be enabled when LDO
is shut down.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
* against broonie/regulator/for-next tree
---
drivers/regulator/act8865-regulator.c | 45 ++++++++++++++++++++-------
1 file changed, 33 insertions(+), 12 deletions(-)
diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c
index cf72d7c6b8c9..921f8f03b84e 100644
--- a/drivers/regulator/act8865-regulator.c
+++ b/drivers/regulator/act8865-regulator.c
@@ -112,6 +112,8 @@
* Field Definitions.
*/
#define ACT8865_ENA 0x80 /* ON - [7] */
+#define ACT8865_DIS 0x40 /* DIS - [6] */
+
#define ACT8865_VSEL_MASK 0x3F /* VSET - [5:0] */
@@ -228,12 +230,23 @@ static const struct regulator_ops act8865_ops = {
};
static const struct regulator_ops act8865_ldo_ops = {
+ .list_voltage = regulator_list_voltage_linear_range,
+ .map_voltage = regulator_map_voltage_linear_range,
+ .get_voltage_sel = regulator_get_voltage_sel_regmap,
+ .set_voltage_sel = regulator_set_voltage_sel_regmap,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
+ .set_pull_down = regulator_set_pull_down_regmap,
};
-#define ACT88xx_REG(_name, _family, _id, _vsel_reg, _supply) \
+static const struct regulator_ops act8865_fixed_ldo_ops = {
+ .enable = regulator_enable_regmap,
+ .disable = regulator_disable_regmap,
+ .is_enabled = regulator_is_enabled_regmap,
+};
+
+#define ACT88xx_REG_(_name, _family, _id, _vsel_reg, _supply, _ops) \
[_family##_ID_##_id] = { \
.name = _name, \
.of_match = of_match_ptr(_name), \
@@ -241,7 +254,7 @@ static const struct regulator_ops act8865_ldo_ops = {
.supply_name = _supply, \
.id = _family##_ID_##_id, \
.type = REGULATOR_VOLTAGE, \
- .ops = &act8865_ops, \
+ .ops = _ops, \
.n_voltages = ACT8865_VOLTAGE_NUM, \
.linear_ranges = act8865_voltage_ranges, \
.n_linear_ranges = ARRAY_SIZE(act8865_voltage_ranges), \
@@ -249,9 +262,17 @@ static const struct regulator_ops act8865_ldo_ops = {
.vsel_mask = ACT8865_VSEL_MASK, \
.enable_reg = _family##_##_id##_CTRL, \
.enable_mask = ACT8865_ENA, \
+ .pull_down_reg = _family##_##_id##_CTRL, \
+ .pull_down_mask = ACT8865_DIS, \
.owner = THIS_MODULE, \
}
+#define ACT88xx_REG(_name, _family, _id, _vsel_reg, _supply) \
+ ACT88xx_REG_(_name, _family, _id, _vsel_reg, _supply, &act8865_ops)
+
+#define ACT88xx_LDO(_name, _family, _id, _vsel_reg, _supply) \
+ ACT88xx_REG_(_name, _family, _id, _vsel_reg, _supply, &act8865_ldo_ops)
+
static const struct regulator_desc act8600_regulators[] = {
ACT88xx_REG("DCDC1", ACT8600, DCDC1, VSET, "vp1"),
ACT88xx_REG("DCDC2", ACT8600, DCDC2, VSET, "vp2"),
@@ -281,7 +302,7 @@ static const struct regulator_desc act8600_regulators[] = {
.of_match = of_match_ptr("LDO_REG9"),
.regulators_node = of_match_ptr("regulators"),
.id = ACT8600_ID_LDO9,
- .ops = &act8865_ldo_ops,
+ .ops = &act8865_fixed_ldo_ops,
.type = REGULATOR_VOLTAGE,
.n_voltages = 1,
.fixed_uV = 3300000,
@@ -294,7 +315,7 @@ static const struct regulator_desc act8600_regulators[] = {
.of_match = of_match_ptr("LDO_REG10"),
.regulators_node = of_match_ptr("regulators"),
.id = ACT8600_ID_LDO10,
- .ops = &act8865_ldo_ops,
+ .ops = &act8865_fixed_ldo_ops,
.type = REGULATOR_VOLTAGE,
.n_voltages = 1,
.fixed_uV = 1200000,
@@ -323,20 +344,20 @@ static const struct regulator_desc act8865_regulators[] = {
ACT88xx_REG("DCDC_REG1", ACT8865, DCDC1, VSET1, "vp1"),
ACT88xx_REG("DCDC_REG2", ACT8865, DCDC2, VSET1, "vp2"),
ACT88xx_REG("DCDC_REG3", ACT8865, DCDC3, VSET1, "vp3"),
- ACT88xx_REG("LDO_REG1", ACT8865, LDO1, VSET, "inl45"),
- ACT88xx_REG("LDO_REG2", ACT8865, LDO2, VSET, "inl45"),
- ACT88xx_REG("LDO_REG3", ACT8865, LDO3, VSET, "inl67"),
- ACT88xx_REG("LDO_REG4", ACT8865, LDO4, VSET, "inl67"),
+ ACT88xx_LDO("LDO_REG1", ACT8865, LDO1, VSET, "inl45"),
+ ACT88xx_LDO("LDO_REG2", ACT8865, LDO2, VSET, "inl45"),
+ ACT88xx_LDO("LDO_REG3", ACT8865, LDO3, VSET, "inl67"),
+ ACT88xx_LDO("LDO_REG4", ACT8865, LDO4, VSET, "inl67"),
};
static const struct regulator_desc act8865_alt_regulators[] = {
ACT88xx_REG("DCDC_REG1", ACT8865, DCDC1, VSET2, "vp1"),
ACT88xx_REG("DCDC_REG2", ACT8865, DCDC2, VSET2, "vp2"),
ACT88xx_REG("DCDC_REG3", ACT8865, DCDC3, VSET2, "vp3"),
- ACT88xx_REG("LDO_REG1", ACT8865, LDO1, VSET, "inl45"),
- ACT88xx_REG("LDO_REG2", ACT8865, LDO2, VSET, "inl45"),
- ACT88xx_REG("LDO_REG3", ACT8865, LDO3, VSET, "inl67"),
- ACT88xx_REG("LDO_REG4", ACT8865, LDO4, VSET, "inl67"),
+ ACT88xx_LDO("LDO_REG1", ACT8865, LDO1, VSET, "inl45"),
+ ACT88xx_LDO("LDO_REG2", ACT8865, LDO2, VSET, "inl45"),
+ ACT88xx_LDO("LDO_REG3", ACT8865, LDO3, VSET, "inl67"),
+ ACT88xx_LDO("LDO_REG4", ACT8865, LDO4, VSET, "inl67"),
};
#ifdef CONFIG_OF
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] regulator: act8865: support regulator-pull-down property
2019-07-22 18:13 [PATCH] regulator: act8865: support regulator-pull-down property Michał Mirosław
@ 2019-07-23 10:54 ` Mark Brown
2019-07-23 12:09 ` Michał Mirosław
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2019-07-23 10:54 UTC (permalink / raw)
To: Michał Mirosław; +Cc: linux-kernel, Liam Girdwood
[-- Attachment #1: Type: text/plain, Size: 613 bytes --]
On Mon, Jul 22, 2019 at 08:13:29PM +0200, Michał Mirosław wrote:
> AC8865 has internal 1.5k pull-down resistor that can be enabled when LDO
> is shut down.
This changelog...
> static const struct regulator_ops act8865_ldo_ops = {
> + .list_voltage = regulator_list_voltage_linear_range,
> + .map_voltage = regulator_map_voltage_linear_range,
> + .get_voltage_sel = regulator_get_voltage_sel_regmap,
> + .set_voltage_sel = regulator_set_voltage_sel_regmap,
...doesn't obviously match this code change which looks to be
implementing voltage setting (as well as the pull down stuff but still).
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] regulator: act8865: support regulator-pull-down property
2019-07-23 10:54 ` Mark Brown
@ 2019-07-23 12:09 ` Michał Mirosław
2019-07-23 14:39 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Michał Mirosław @ 2019-07-23 12:09 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel, Liam Girdwood
On Tue, Jul 23, 2019 at 11:54:32AM +0100, Mark Brown wrote:
> On Mon, Jul 22, 2019 at 08:13:29PM +0200, Michał Mirosław wrote:
> > AC8865 has internal 1.5k pull-down resistor that can be enabled when LDO
> > is shut down.
>
> This changelog...
>
> > static const struct regulator_ops act8865_ldo_ops = {
> > + .list_voltage = regulator_list_voltage_linear_range,
> > + .map_voltage = regulator_map_voltage_linear_range,
> > + .get_voltage_sel = regulator_get_voltage_sel_regmap,
> > + .set_voltage_sel = regulator_set_voltage_sel_regmap,
>
> ...doesn't obviously match this code change which looks to be
> implementing voltage setting (as well as the pull down stuff but still).
It's just an diff-artifact of changing act8865_ldo_ops meaning. It's
now a copy of act8865_ops with .set_pull_down added. Previous
act8865_ldo_ops is act8865_fixed_ldo_ops now.
Best Regards,
Michał Mirosław
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] regulator: act8865: support regulator-pull-down property
2019-07-23 12:09 ` Michał Mirosław
@ 2019-07-23 14:39 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2019-07-23 14:39 UTC (permalink / raw)
To: Michał Mirosław; +Cc: linux-kernel, Liam Girdwood
[-- Attachment #1: Type: text/plain, Size: 1180 bytes --]
On Tue, Jul 23, 2019 at 02:09:38PM +0200, Michał Mirosław wrote:
> On Tue, Jul 23, 2019 at 11:54:32AM +0100, Mark Brown wrote:
> > On Mon, Jul 22, 2019 at 08:13:29PM +0200, Michał Mirosław wrote:
> > > AC8865 has internal 1.5k pull-down resistor that can be enabled when LDO
> > > is shut down.
> > This changelog...
> > > static const struct regulator_ops act8865_ldo_ops = {
> > > + .list_voltage = regulator_list_voltage_linear_range,
> > > + .map_voltage = regulator_map_voltage_linear_range,
> > > + .get_voltage_sel = regulator_get_voltage_sel_regmap,
> > > + .set_voltage_sel = regulator_set_voltage_sel_regmap,
> > ...doesn't obviously match this code change which looks to be
> > implementing voltage setting (as well as the pull down stuff but still).
> It's just an diff-artifact of changing act8865_ldo_ops meaning. It's
> now a copy of act8865_ops with .set_pull_down added. Previous
> act8865_ldo_ops is act8865_fixed_ldo_ops now.
If there's that big a refactoring it probably warrants a separate patch,
and it definitely should be called out in the changelog. Like I say the
changbelog does not describe the change at all well.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-07-23 14:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-22 18:13 [PATCH] regulator: act8865: support regulator-pull-down property Michał Mirosław
2019-07-23 10:54 ` Mark Brown
2019-07-23 12:09 ` Michał Mirosław
2019-07-23 14:39 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.