Skip to contentSkip to conversation

regulator: Fix machine constraints apply for min_uV != max_uV

PATCH In review Jarkko Nikula 2 participants 3 messages Sep 3, 2010 Voltage and current regulator framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regulator: Fix machine constraints apply for min_uV != max_uV

Constraints are not applied until both min_uV and max_uV are the same. This looks like a typo in the test.

---
 drivers/regulator/core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/core.c +1 -1
index 422a709..b092070 100644
@@ -724,7 +724,7 @@ static int machine_constraints_voltage(struct regulator_dev *rdev,
 
 	/* do we need to apply the constraint voltage */
 	if (rdev->constraints->apply_uV &&
-		rdev->constraints->min_uV == rdev->constraints->max_uV &&
+		rdev->constraints->min_uV && rdev->constraints->max_uV &&
 		ops->set_voltage) {
 		ret = ops->set_voltage(rdev,
 			rdev->constraints->min_uV, rdev->constraints->max_uV);
Signature · 1 line
1.7.1
#1 lore raw
Quoted 4 lines · Jarkko Nikula

Constraints are not applied until both min_uV and max_uV are the same. This looks like a typo in the test.

This is deliberate behaviour, apply_uV can only be used with a fixed voltage at startup in order to avoid issues with handover from the bootloader if we suddenly drop the supply voltage on a device which has not yet been claimed by a driver. The expectation is that if the voltage can vary then something that understands the hardware state needs to be involved in maintaining the voltage.

#2 lore raw
Quoted 6 lines · On Fri, 3 Sep 2010 15:54:20 +0100 Mark Brown…

This is deliberate behaviour, apply_uV can only be used with a fixed voltage at startup in order to avoid issues with handover from the bootloader if we suddenly drop the supply voltage on a device which has not yet been claimed by a driver. The expectation is that if the voltage can vary then something that understands the hardware state needs to be involved in maintaining the voltage.

Ah, true. It could be possible that machine constraints are specified broader, like they include standby state voltage which is not enough to probe & initialize the device etc.

Signature · 1 line
Jarkko