All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keerthy <j-keerthy@ti.com>
To: <vireshk@kernel.org>, <nm@ti.com>, <sboyd@kernel.org>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<d-gerlach@ti.com>, <t-kristo@ti.com>, <j-keerthy@ti.com>
Subject: [PATCH 1/2] opp: ti-opp-supply: Dynamically update u_volt_min
Date: Wed, 7 Nov 2018 10:04:22 +0530	[thread overview]
Message-ID: <1541565263-8296-2-git-send-email-j-keerthy@ti.com> (raw)
In-Reply-To: <1541565263-8296-1-git-send-email-j-keerthy@ti.com>

The voltage range (min, max) provided in the device tree is from
the data manual and is pretty big, catering to a wide range of devices.
On a i2c read/write failure the regulator_set_voltage_triplet function
falls back to set voltage between min and max. The min value from Device
Tree can be lesser than the optimal value and in that case that can lead
to a hang or crash. Hence set the u_volt_min dynamically to the optimal
voltage value.

Fixes: 9a835fa6e47 ("PM / OPP: Add ti-opp-supply driver")
Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 drivers/opp/ti-opp-supply.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/opp/ti-opp-supply.c b/drivers/opp/ti-opp-supply.c
index 9e5a9a3..29e08a4 100644
--- a/drivers/opp/ti-opp-supply.c
+++ b/drivers/opp/ti-opp-supply.c
@@ -290,6 +290,9 @@ static int ti_opp_supply_set_opp(struct dev_pm_set_opp_data *data)
 	vdd_uv = _get_optimal_vdd_voltage(dev, &opp_data,
 					  new_supply_vbb->u_volt);
 
+	if (new_supply_vdd->u_volt_min < vdd_uv)
+		new_supply_vdd->u_volt_min = vdd_uv;
+
 	/* Scaling up? Scale voltage before frequency */
 	if (freq > old_freq) {
 		ret = _opp_set_voltage(dev, new_supply_vdd, vdd_uv, vdd_reg,
-- 
1.9.1


WARNING: multiple messages have this Message-ID (diff)
From: Keerthy <j-keerthy@ti.com>
To: vireshk@kernel.org, nm@ti.com, sboyd@kernel.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	d-gerlach@ti.com, t-kristo@ti.com, j-keerthy@ti.com
Subject: [PATCH 1/2] opp: ti-opp-supply: Dynamically update u_volt_min
Date: Wed, 7 Nov 2018 10:04:22 +0530	[thread overview]
Message-ID: <1541565263-8296-2-git-send-email-j-keerthy@ti.com> (raw)
In-Reply-To: <1541565263-8296-1-git-send-email-j-keerthy@ti.com>

The voltage range (min, max) provided in the device tree is from
the data manual and is pretty big, catering to a wide range of devices.
On a i2c read/write failure the regulator_set_voltage_triplet function
falls back to set voltage between min and max. The min value from Device
Tree can be lesser than the optimal value and in that case that can lead
to a hang or crash. Hence set the u_volt_min dynamically to the optimal
voltage value.

Fixes: 9a835fa6e47 ("PM / OPP: Add ti-opp-supply driver")
Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 drivers/opp/ti-opp-supply.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/opp/ti-opp-supply.c b/drivers/opp/ti-opp-supply.c
index 9e5a9a3..29e08a4 100644
--- a/drivers/opp/ti-opp-supply.c
+++ b/drivers/opp/ti-opp-supply.c
@@ -290,6 +290,9 @@ static int ti_opp_supply_set_opp(struct dev_pm_set_opp_data *data)
 	vdd_uv = _get_optimal_vdd_voltage(dev, &opp_data,
 					  new_supply_vbb->u_volt);
 
+	if (new_supply_vdd->u_volt_min < vdd_uv)
+		new_supply_vdd->u_volt_min = vdd_uv;
+
 	/* Scaling up? Scale voltage before frequency */
 	if (freq > old_freq) {
 		ret = _opp_set_voltage(dev, new_supply_vdd, vdd_uv, vdd_reg,
-- 
1.9.1

  reply	other threads:[~2018-11-07  4:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-07  4:34 [PATCH 0/2] opp: ti-opp-supply: Fixes Keerthy
2018-11-07  4:34 ` Keerthy
2018-11-07  4:34 ` Keerthy [this message]
2018-11-07  4:34   ` [PATCH 1/2] opp: ti-opp-supply: Dynamically update u_volt_min Keerthy
2018-11-08  5:54   ` Viresh Kumar
2018-11-12  3:15     ` J, KEERTHY
2018-11-12  3:15       ` J, KEERTHY
2018-11-12 22:05       ` Dave Gerlach
2018-11-12 22:05         ` Dave Gerlach
2018-11-07  4:34 ` [PATCH 2/2] opp: ti-opp-supply: Correct the supply in _get_optimal_vdd_voltage call Keerthy
2018-11-07  4:34   ` Keerthy
2018-11-12 21:49   ` Dave Gerlach
2018-11-12 21:49     ` Dave Gerlach
2018-11-08  5:53 ` [PATCH 0/2] opp: ti-opp-supply: Fixes Viresh Kumar
2018-11-13  4:12 ` Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1541565263-8296-2-git-send-email-j-keerthy@ti.com \
    --to=j-keerthy@ti.com \
    --cc=d-gerlach@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=sboyd@kernel.org \
    --cc=t-kristo@ti.com \
    --cc=vireshk@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.