Add support for setting up SimpleFB for LCD display output in DE2
SimpleFB setup code.

Signed-off-by: Icenowy Zheng <[email protected]>
---
 drivers/video/sunxi/sunxi_de2.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/video/sunxi/sunxi_de2.c b/drivers/video/sunxi/sunxi_de2.c
index e8903400ec..a41944e645 100644
--- a/drivers/video/sunxi/sunxi_de2.c
+++ b/drivers/video/sunxi/sunxi_de2.c
@@ -319,7 +319,7 @@ U_BOOT_DEVICE(sunxi_de2) = {
 #if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_VIDEO_DT_SIMPLEFB)
 int sunxi_simplefb_setup(void *blob)
 {
-       struct udevice *de2, *hdmi;
+       struct udevice *de2, *disp;
        struct video_priv *de2_priv;
        struct video_uc_platdata *de2_plat;
        int mux;
@@ -343,16 +343,27 @@ int sunxi_simplefb_setup(void *blob)
        }
 
        ret = uclass_find_device_by_name(UCLASS_DISPLAY,
-                                        "sunxi_dw_hdmi", &hdmi);
+                                        "sunxi_dw_hdmi", &disp);
        if (ret) {
                debug("HDMI not present\n");
-               return 0;
+       } else if (device_active(disp)) {
+               if (mux == 0)
+                       pipeline = "mixer0-lcd0-hdmi";
+               else
+                       pipeline = "mixer1-lcd1-hdmi";
        }
 
-       if (mux == 0)
-               pipeline = "mixer0-lcd0-hdmi";
-       else
-               pipeline = "mixer1-lcd1-hdmi";
+       ret = uclass_find_device_by_name(UCLASS_DISPLAY,
+                                        "sunxi_lcd", &disp);
+       if (ret)
+               debug("LCD not present\n");
+       else if (device_active(disp))
+               pipeline = "mixer0-lcd0";
+
+       if (!pipeline) {
+               debug("No active display present\n");
+               return 0;
+       }
 
        de2_priv = dev_get_uclass_priv(de2);
        de2_plat = dev_get_uclass_platdata(de2);
-- 
2.13.6

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to