diff mbox series

[U-Boot,v2,1/2] video: sunxi: de2: fix SimpleFB node creation when HDMI not initialized

Message ID 20171101141807.38705-2-icenowy@aosc.io
State Accepted
Commit 460b15adc9baab3dd403191b14c34647a24c1fcc
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series Fix DE2 SimpleFB node creation and support LCD SimpleFB | expand

Commit Message

Icenowy Zheng Nov. 1, 2017, 2:18 p.m. UTC
When HDMI is not initialized (e.g. no monitor is plugged), the current
SimpleFB code will still create a broken SimpleFB node.

Detect whether HDMI is initialized when creating SimpleFB node.

Fixes: be5b96f0e411 ("sunxi: setup simplefb for Allwinner DE2")
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/video/sunxi/sunxi_de2.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

Comments

Jagan Teki Nov. 1, 2017, 2:41 p.m. UTC | #1
On Wed, Nov 1, 2017 at 7:48 PM, Icenowy Zheng <icenowy@aosc.io> wrote:
> When HDMI is not initialized (e.g. no monitor is plugged), the current
> SimpleFB code will still create a broken SimpleFB node.
>
> Detect whether HDMI is initialized when creating SimpleFB node.
>
> Fixes: be5b96f0e411 ("sunxi: setup simplefb for Allwinner DE2")
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---

Reviewed-by: Jagan Teki <jagan@openedev.com>

thanks!
Maxime Ripard Nov. 2, 2017, 12:24 p.m. UTC | #2
On Wed, Nov 01, 2017 at 10:18:06PM +0800, Icenowy Zheng wrote:
> When HDMI is not initialized (e.g. no monitor is plugged), the current
> SimpleFB code will still create a broken SimpleFB node.
> 
> Detect whether HDMI is initialized when creating SimpleFB node.
> 
> Fixes: be5b96f0e411 ("sunxi: setup simplefb for Allwinner DE2")
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>

Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Jagan Teki Nov. 6, 2017, 8:19 a.m. UTC | #3
On Thu, Nov 2, 2017 at 5:54 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> On Wed, Nov 01, 2017 at 10:18:06PM +0800, Icenowy Zheng wrote:
>> When HDMI is not initialized (e.g. no monitor is plugged), the current
>> SimpleFB code will still create a broken SimpleFB node.
>>
>> Detect whether HDMI is initialized when creating SimpleFB node.
>>
>> Fixes: be5b96f0e411 ("sunxi: setup simplefb for Allwinner DE2")
>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>
> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Applied to u-boot-sunxi/master

thanks!
diff mbox series

Patch

diff --git a/drivers/video/sunxi/sunxi_de2.c b/drivers/video/sunxi/sunxi_de2.c
index e8903400ec..6d6bb2e0c3 100644
--- a/drivers/video/sunxi/sunxi_de2.c
+++ b/drivers/video/sunxi/sunxi_de2.c
@@ -346,13 +346,19 @@  int sunxi_simplefb_setup(void *blob)
 					 "sunxi_dw_hdmi", &hdmi);
 	if (ret) {
 		debug("HDMI not present\n");
-		return 0;
+	} else if (device_active(hdmi)) {
+		if (mux == 0)
+			pipeline = "mixer0-lcd0-hdmi";
+		else
+			pipeline = "mixer1-lcd1-hdmi";
+	} else {
+		debug("HDMI present but not probed\n");
 	}
 
-	if (mux == 0)
-		pipeline = "mixer0-lcd0-hdmi";
-	else
-		pipeline = "mixer1-lcd1-hdmi";
+	if (!pipeline) {
+		debug("No active display present\n");
+		return 0;
+	}
 
 	de2_priv = dev_get_uclass_priv(de2);
 	de2_plat = dev_get_uclass_platdata(de2);