public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] regulator: max77620: Initialize values for DT properties
@ 2019-01-10  4:11 Mark Zhang
  2019-01-10  4:11 ` [PATCH 2/2] regulator: max77620: disable notifier events for FPS rails Mark Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Zhang @ 2019-01-10  4:11 UTC (permalink / raw)
  To: lgirdwood, broonie, linux-kernel; +Cc: linux-tegra, Mark Zhang, Jinyoung Park

If regulator DT node doesn't exist, its of_parse_cb callback
function isn't called. Then all values for DT properties are
filled with zero. This leads to wrong register update for
FPS and POK settings.

Signed-off-by: Jinyoung Park <jinyoungp@nvidia.com>
Signed-off-by: Mark Zhang <markz@nvidia.com>
---
 drivers/regulator/max77620-regulator.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/max77620-regulator.c b/drivers/regulator/max77620-regulator.c
index b94e3a721721..cd93cf53e23c 100644
--- a/drivers/regulator/max77620-regulator.c
+++ b/drivers/regulator/max77620-regulator.c
@@ -1,7 +1,7 @@
 /*
  * Maxim MAX77620 Regulator driver
  *
- * Copyright (c) 2016, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2016-2018, NVIDIA CORPORATION.  All rights reserved.
  *
  * Author: Mallikarjun Kasoju <mkasoju@nvidia.com>
  *	Laxman Dewangan <ldewangan@nvidia.com>
@@ -803,6 +803,14 @@ static int max77620_regulator_probe(struct platform_device *pdev)
 		rdesc = &rinfo[id].desc;
 		pmic->rinfo[id] = &max77620_regs_info[id];
 		pmic->enable_power_mode[id] = MAX77620_POWER_MODE_NORMAL;
+		pmic->reg_pdata[id].active_fps_src = -1;
+		pmic->reg_pdata[id].active_fps_pd_slot = -1;
+		pmic->reg_pdata[id].active_fps_pu_slot = -1;
+		pmic->reg_pdata[id].suspend_fps_src = -1;
+		pmic->reg_pdata[id].suspend_fps_pd_slot = -1;
+		pmic->reg_pdata[id].suspend_fps_pu_slot = -1;
+		pmic->reg_pdata[id].power_ok = -1;
+		pmic->reg_pdata[id].ramp_rate_setting = -1;
 
 		ret = max77620_read_slew_rate(pmic, id);
 		if (ret < 0)
-- 
2.19.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] regulator: max77620: disable notifier events for FPS rails
  2019-01-10  4:11 [PATCH 1/2] regulator: max77620: Initialize values for DT properties Mark Zhang
@ 2019-01-10  4:11 ` Mark Zhang
  2019-01-10 12:07   ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Zhang @ 2019-01-10  4:11 UTC (permalink / raw)
  To: lgirdwood, broonie, linux-kernel
  Cc: linux-tegra, Mark Zhang, Venkat Reddy Talla

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(+)

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;
-- 
2.19.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] regulator: max77620: disable notifier events for FPS rails
  2019-01-10  4:11 ` [PATCH 2/2] regulator: max77620: disable notifier events for FPS rails Mark Zhang
@ 2019-01-10 12:07   ` Mark Brown
  2019-01-11 13:35     ` Mark Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2019-01-10 12:07 UTC (permalink / raw)
  To: Mark Zhang; +Cc: lgirdwood, linux-kernel, linux-tegra, Venkat Reddy Talla

[-- Attachment #1: Type: text/plain, Size: 509 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] regulator: max77620: disable notifier events for FPS rails
  2019-01-10 12:07   ` Mark Brown
@ 2019-01-11 13:35     ` Mark Zhang
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Zhang @ 2019-01-11 13:35 UTC (permalink / raw)
  To: Mark Brown; +Cc: lgirdwood, linux-kernel, linux-tegra, Venkat Reddy Talla

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

> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-11 13:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-10  4:11 [PATCH 1/2] regulator: max77620: Initialize values for DT properties Mark Zhang
2019-01-10  4:11 ` [PATCH 2/2] regulator: max77620: disable notifier events for FPS rails Mark Zhang
2019-01-10 12:07   ` Mark Brown
2019-01-11 13:35     ` Mark Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox