[2/2] regulator: max77620: disable notifier events for FPS rails

Message ID 20190110041117.8216-2-markz@nvidia.com
State Deferred
Headers show
Series
  • [1/2] regulator: max77620: Initialize values for DT properties
Related show

Commit Message

Mark Zhang Jan. 10, 2019, 4:11 a.m.
Disabling regulator notifier events if regulator is
configured part of flexible power sequencer(FPS),
there is no SW control to enable/disable if regulator
is configured part of FPS, so disabling notifier events
if client driver try to enable/disable FPS rails.

Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
Signed-off-by: Mark Zhang <markz@nvidia.com>
---
 drivers/regulator/max77620-regulator.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Mark Brown Jan. 10, 2019, 12:07 p.m. | #1
On Thu, Jan 10, 2019 at 12:11:17PM +0800, Mark Zhang wrote:

> +		/* there is no SW control for rails which are part of FPS
> +		 * set always no contraint to true to avoid regulator
> +		 * enable/disable notification
> +		 */
> +		if (pmic->reg_pdata[id].active_fps_src != MAX77620_FPS_SRC_NONE)
> +			rdev->constraints->always_on = true;

A driver should never modify the constraints, you should register a
different set of operations without an enable operation instead and let
the framework handle this.
Mark Zhang Jan. 11, 2019, 1:35 p.m. | #2
On 1/10/2019 8:07 PM, Mark Brown wrote:
> On Thu, Jan 10, 2019 at 12:11:17PM +0800, Mark Zhang wrote:
> 
>> +		/* there is no SW control for rails which are part of FPS
>> +		 * set always no contraint to true to avoid regulator
>> +		 * enable/disable notification
>> +		 */
>> +		if (pmic->reg_pdata[id].active_fps_src != MAX77620_FPS_SRC_NONE)
>> +			rdev->constraints->always_on = true;
> 
> A driver should never modify the constraints, you should register a
> different set of operations without an enable operation instead and let
> the framework handle this.

Oh right, today I checked the codes based on your suggestion so I think we don't need this patch now. We can find another way to fix our issue without touching the framework constraints. Thanks.

Mark

>

Patch

diff --git a/drivers/regulator/max77620-regulator.c b/drivers/regulator/max77620-regulator.c
index cd93cf53e23c..20e985071bfc 100644
--- a/drivers/regulator/max77620-regulator.c
+++ b/drivers/regulator/max77620-regulator.c
@@ -823,6 +823,13 @@  static int max77620_regulator_probe(struct platform_device *pdev)
 				rdesc->name, ret);
 			return ret;
 		}
+
+		/* there is no SW control for rails which are part of FPS
+		 * set always no contraint to true to avoid regulator
+		 * enable/disable notification
+		 */
+		if (pmic->reg_pdata[id].active_fps_src != MAX77620_FPS_SRC_NONE)
+			rdev->constraints->always_on = true;
 	}
 
 	return 0;