linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: msm: dsi: Don't attempt changing voltage of switches
@ 2015-08-18 17:34 Bjorn Andersson
  2015-08-28 10:27 ` Archit Taneja
  0 siblings, 1 reply; 2+ messages in thread
From: Bjorn Andersson @ 2015-08-18 17:34 UTC (permalink / raw)
  To: Rob Clark, Hai Li; +Cc: Archit Taneja, Stephane Viau, dri-devel, linux-kernel

In some configurations the supplies are voltage switches and not LDOs,
making the set voltage call to fail. Check with the regulator framework
if the supply can change voltage before attempting.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
---
 drivers/gpu/drm/msm/dsi/dsi_host.c    | 2 +-
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 8c16d6a3ca78..ece3de6a8157 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -278,7 +278,7 @@ static int dsi_regulator_init(struct msm_dsi_host *msm_host)
 	}
 
 	for (i = 0; i < num; i++) {
-		if ((regs[i].min_voltage >= 0) && (regs[i].max_voltage >= 0)) {
+		if (regulator_can_change_voltage(s[i].consumer)) {
 			ret = regulator_set_voltage(s[i].consumer,
 				regs[i].min_voltage, regs[i].max_voltage);
 			if (ret < 0) {
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
index 401ff58d6893..f1f955f571fa 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
@@ -178,7 +178,7 @@ static int dsi_phy_regulator_init(struct msm_dsi_phy *phy)
 	}
 
 	for (i = 0; i < num; i++) {
-		if ((regs[i].min_voltage >= 0) && (regs[i].max_voltage >= 0)) {
+		if (regulator_can_change_voltage(s[i].consumer)) {
 			ret = regulator_set_voltage(s[i].consumer,
 				regs[i].min_voltage, regs[i].max_voltage);
 			if (ret < 0) {
-- 
1.8.2.2


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

* Re: [PATCH] drm: msm: dsi: Don't attempt changing voltage of switches
  2015-08-18 17:34 [PATCH] drm: msm: dsi: Don't attempt changing voltage of switches Bjorn Andersson
@ 2015-08-28 10:27 ` Archit Taneja
  0 siblings, 0 replies; 2+ messages in thread
From: Archit Taneja @ 2015-08-28 10:27 UTC (permalink / raw)
  To: Bjorn Andersson, Rob Clark, Hai Li; +Cc: Stephane Viau, dri-devel, linux-kernel

Hi,

On 08/18/2015 11:04 PM, Bjorn Andersson wrote:
> In some configurations the supplies are voltage switches and not LDOs,
> making the set voltage call to fail. Check with the regulator framework
> if the supply can change voltage before attempting.
>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> ---
>   drivers/gpu/drm/msm/dsi/dsi_host.c    | 2 +-
>   drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index 8c16d6a3ca78..ece3de6a8157 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -278,7 +278,7 @@ static int dsi_regulator_init(struct msm_dsi_host *msm_host)
>   	}
>
>   	for (i = 0; i < num; i++) {
> -		if ((regs[i].min_voltage >= 0) && (regs[i].max_voltage >= 0)) {
> +		if (regulator_can_change_voltage(s[i].consumer)) {
>   			ret = regulator_set_voltage(s[i].consumer,
>   				regs[i].min_voltage, regs[i].max_voltage);
>   			if (ret < 0) {
> diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
> index 401ff58d6893..f1f955f571fa 100644
> --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
> +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
> @@ -178,7 +178,7 @@ static int dsi_phy_regulator_init(struct msm_dsi_phy *phy)
>   	}
>
>   	for (i = 0; i < num; i++) {
> -		if ((regs[i].min_voltage >= 0) && (regs[i].max_voltage >= 0)) {
> +		if (regulator_can_change_voltage(s[i].consumer)) {
>   			ret = regulator_set_voltage(s[i].consumer,
>   				regs[i].min_voltage, regs[i].max_voltage);
>   			if (ret < 0) {
>

Looks good to me.

Reviewed-by: Archit Taneja <architt@codeaurora.org>

Archit

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

end of thread, other threads:[~2015-08-28 10:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-18 17:34 [PATCH] drm: msm: dsi: Don't attempt changing voltage of switches Bjorn Andersson
2015-08-28 10:27 ` Archit Taneja

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).