Skip to contentSkip to conversation

video: mxsfb: get supply regulator optionally

PATCH In review Stefan Agner 4 participants 8 messages Sep 4, 2016 – Nov 9, 2016

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: mxsfb: get supply regulator optionally

The lcd-supply is meant to be optional, there are several device- trees not specifying it and the code handles error values silently. Therefor, avoid creating a dummy regulator (and the associated warning) by using devm_regulator_get_optional.

While at it, document that fact also in the device-tree bindings.

---
 Documentation/devicetree/bindings/display/mxsfb.txt | 3 +++
 drivers/video/fbdev/mxsfb.c                         | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/mxsfb.txt +3 -0
index 96ec517..0bc530f 100644
@@ -7,6 +7,9 @@ Required properties:
 - interrupts: Should contain lcdif interrupts
 - display : phandle to display node (see below for details)
 
+Optional properties:
+- lcd-supply: Regulator for LCD supply voltage.
+
 * display node
 
 Required properties:
drivers/video/fbdev/mxsfb.c +1 -1
index 4e6608c..4f7570f 100644
@@ -920,7 +920,7 @@ static int mxsfb_probe(struct platform_device *pdev)
 	if (IS_ERR(host->clk_disp_axi))
 		host->clk_disp_axi = NULL;
 
-	host->reg_lcd = devm_regulator_get(&pdev->dev, "lcd");
+	host->reg_lcd = devm_regulator_get_optional(&pdev->dev, "lcd");
 	if (IS_ERR(host->reg_lcd))
 		host->reg_lcd = NULL;
 
Signature · 6 lines
2.9.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

Hi,

Quoted 6 lines · Stefan Agner

The lcd-supply is meant to be optional, there are several device- trees not specifying it and the code handles error values silently. Therefor, avoid creating a dummy regulator (and the associated warning) by using devm_regulator_get_optional.

While at it, document that fact also in the device-tree bindings.

The binding change looks correct, but using devm_regulator_get_optional() does not sound correct.

devm_regulator_get_optional() is to be used when the device in question truly can function without the power supply. But if the supply is there, it's just not controlled by the SW, devm_regulator_get() is to be used.

At least this is my understanding.

Tomi

#2 lore raw
Quoted 8 lines · Tomi Valkeinen

Hi,

Quoted 5 lines · Stefan Agner

The lcd-supply is meant to be optional, there are several device- trees not specifying it and the code handles error values silently. Therefor, avoid creating a dummy regulator (and the associated warning) by using devm_regulator_get_optional.

Quoted 8 lines
Quoted 1 line

While at it, document that fact also in the device-tree bindings.

The binding change looks correct, but using devm_regulator_get_optional() does not sound correct.

devm_regulator_get_optional() is to be used when the device in question truly can function without the power supply. But if the supply is there, it's just not controlled by the SW, devm_regulator_get() is to be used.

The framebuffer device can even function without a display, no problem there.. Probably not really useful...

devm_regulator_get creates a dummy regulator and a warning. Afaik, the dummy regulator was meant to be as an aid during development, but not as a permanent solution. This is what the initial commit of the dummy regulator says:

Quoted 5 lines

In order to ease transitions with drivers are boards start using regulators provide an option to cause all regulator_get() calls to succeed, with a dummy always on regulator being supplied where one has not been configured. A warning is printed whenever the dummy regulator is used to aid system development.

I think we should either make the property mandatory and fix the device trees or we should fix the driver to support an optional regulator. The code already supports the reg_lcd being NULL, which is probably mostly pointless right now as devm_regulator_get always returns a dummy regulator.

--
Stefan
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 8 lines · Stefan Agner
Quoted 5 lines · Tomi Valkeinen

In order to ease transitions with drivers are boards start using regulators provide an option to cause all regulator_get() calls to succeed, with a dummy always on regulator being supplied where one has not been configured. A warning is printed whenever the dummy regulator is used to aid system development.

Quoted 5 lines

I think we should either make the property mandatory and fix the device trees or we should fix the driver to support an optional regulator. The code already supports the reg_lcd being NULL, which is probably mostly pointless right now as devm_regulator_get always returns a dummy regulator.

I think you're agreeing with each other here (and me).

#4 lore raw
In reply to Stefan Agner
Quoted 14 lines · Stefan Agner
Quoted 13 lines · Tomi Valkeinen

Hi,

Quoted 6 lines · Stefan Agner

The lcd-supply is meant to be optional, there are several device- trees not specifying it and the code handles error values silently. Therefor, avoid creating a dummy regulator (and the associated warning) by using devm_regulator_get_optional.

While at it, document that fact also in the device-tree bindings.

The binding change looks correct, but using devm_regulator_get_optional() does not sound correct.

Quoted 6 lines
Quoted 3 lines

devm_regulator_get_optional() is to be used when the device in question truly can function without the power supply. But if the supply is there, it's just not controlled by the SW, devm_regulator_get() is to be used.

The framebuffer device can even function without a display, no problem there.. Probably not really useful...

Yes. Of course, the question then becomes, why is the fb driver even dealing with the LCD's regulator. But yes, I know the answer: because that's how it has been done =).

Quoted 4 lines

devm_regulator_get creates a dummy regulator and a warning. Afaik, the dummy regulator was meant to be as an aid during development, but not as a permanent solution. This is what the initial commit of the dummy regulator says:

Yep, the fixed regulator is afaik the correct solution to represent non-controllable regulators.

Quoted 11 lines
Quoted 5 lines

In order to ease transitions with drivers are boards start using regulators provide an option to cause all regulator_get() calls to succeed, with a dummy always on regulator being supplied where one has not been configured. A warning is printed whenever the dummy regulator is used to aid system development.

I think we should either make the property mandatory and fix the device trees or we should fix the driver to support an optional regulator. The code already supports the reg_lcd being NULL, which is probably mostly pointless right now as devm_regulator_get always returns a dummy regulator.

To really clean this up, the LCD driver should be separated from the fb driver. But that's pointless work on a framework that should be deprecated (is there a DRM driver for this in the works? =).

I'm fine with the _optional version, that's the easiest cleanup here. And, I guess, it could be even argued that it's correct in some cases, as the fb output could go outside the board, to some externally powered display.

I'm fine with doing more cleanups too, if it eases the maintenance burden in the future. But I don't see what the cleanups for the device trees would really give us here.

Mark, what do you say?

Tomi

#5 lore raw
Quoted 4 lines · Tomi Valkeinen

I'm fine with the _optional version, that's the easiest cleanup here. And, I guess, it could be even argued that it's correct in some cases, as the fb output could go outside the board, to some externally powered display.

I'd *prefer* to see the supplies being specified, if only for the encouragement of the others. But if you want to do the optional thing anyway...

#6 lore raw
In reply to Tomi Valkeinen

Hi Tomi,

I vote to merge this patch, see below:

Quoted 19 lines · Tomi Valkeinen
Quoted 18 lines · Stefan Agner
Quoted 16 lines · Tomi Valkeinen

Hi,

Quoted 6 lines · Stefan Agner

The lcd-supply is meant to be optional, there are several device- trees not specifying it and the code handles error values silently. Therefor, avoid creating a dummy regulator (and the associated warning) by using devm_regulator_get_optional.

While at it, document that fact also in the device-tree bindings.

The binding change looks correct, but using devm_regulator_get_optional() does not sound correct.

devm_regulator_get_optional() is to be used when the device in question truly can function without the power supply. But if the supply is there, it's just not controlled by the SW, devm_regulator_get() is to be used.

Quoted 6 lines
Quoted 2 lines

The framebuffer device can even function without a display, no problem there.. Probably not really useful...

Yes. Of course, the question then becomes, why is the fb driver even dealing with the LCD's regulator. But yes, I know the answer: because that's how it has been done =).

Agreed, this property really shouldn't be part of the display controller node.

The device tree should describe the hardware, and that is clearly not how the hardware is wired up...

The DRM solution to this is having a separate panel node with a (mandatory) power-supply property.

Quoted 21 lines
Quoted 5 lines

devm_regulator_get creates a dummy regulator and a warning. Afaik, the dummy regulator was meant to be as an aid during development, but not as a permanent solution. This is what the initial commit of the dummy regulator says:

Yep, the fixed regulator is afaik the correct solution to represent non-controllable regulators.

Quoted 11 lines
Quoted 5 lines

In order to ease transitions with drivers are boards start using regulators provide an option to cause all regulator_get() calls to succeed, with a dummy always on regulator being supplied where one has not been configured. A warning is printed whenever the dummy regulator is used to aid system development.

I think we should either make the property mandatory and fix the device trees or we should fix the driver to support an optional regulator. The code already supports the reg_lcd being NULL, which is probably mostly pointless right now as devm_regulator_get always returns a dummy regulator.

Quoted 3 lines

To really clean this up, the LCD driver should be separated from the fb driver. But that's pointless work on a framework that should be deprecated (is there a DRM driver for this in the works? =).

Not that I am aware of, but I am considering it actually...

Quoted 11 lines

I'm fine with the _optional version, that's the easiest cleanup here. And, I guess, it could be even argued that it's correct in some cases, as the fb output could go outside the board, to some externally powered display.

I'm fine with doing more cleanups too, if it eases the maintenance burden in the future. But I don't see what the cleanups for the device trees would really give us here.

Mark, what do you say?

So this is what mark said:

Quoted 10 lines · Mark Brown
Quoted 4 lines · Tomi Valkeinen

I'm fine with the _optional version, that's the easiest cleanup here. And, I guess, it could be even argued that it's correct in some cases, as the fb output could go outside the board, to some externally powered display.

I'd *prefer* to see the supplies being specified, if only for the encouragement of the others. But if you want to do the optional thing anyway...

In this case we really don't want people encourage using this property... Making it optional is not the solution, but a band aid until we have a proper solution (and deprecate the property...)

--
Stefan
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer Acked-by on v1 1/1
#7 lore raw
In reply to Stefan Agner
Quoted 10 lines · Stefan Agner

The lcd-supply is meant to be optional, there are several device- trees not specifying it and the code handles error values silently. Therefor, avoid creating a dummy regulator (and the associated warning) by using devm_regulator_get_optional.

While at it, document that fact also in the device-tree bindings.

---
 Documentation/devicetree/bindings/display/mxsfb.txt | 3 +++
Quoted 2 lines
 drivers/video/fbdev/mxsfb.c                         | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html