]> git.sur5r.net Git - u-boot/blobdiff - drivers/video/simple_panel.c
Merge branch 'master' of git://git.denx.de/u-boot-socfpga
[u-boot] / drivers / video / simple_panel.c
index c73f24295a4057893872321bc6a3fe617d9623ea..6c604f9bedb6a20f566963cdcde02582236cd51c 100644 (file)
@@ -1,8 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2016 Google, Inc
  * Written by Simon Glass <sjg@chromium.org>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -12,8 +11,6 @@
 #include <asm/gpio.h>
 #include <power/regulator.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 struct simple_panel_priv {
        struct udevice *reg;
        struct udevice *backlight;
@@ -25,8 +22,10 @@ static int simple_panel_enable_backlight(struct udevice *dev)
        struct simple_panel_priv *priv = dev_get_priv(dev);
        int ret;
 
+       debug("%s: start, backlight = '%s'\n", __func__, priv->backlight->name);
        dm_gpio_set_value(&priv->enable, 1);
        ret = backlight_enable(priv->backlight);
+       debug("%s: done, ret = %d\n", __func__, ret);
        if (ret)
                return ret;
 
@@ -38,13 +37,15 @@ static int simple_panel_ofdata_to_platdata(struct udevice *dev)
        struct simple_panel_priv *priv = dev_get_priv(dev);
        int ret;
 
-       ret = uclass_get_device_by_phandle(UCLASS_REGULATOR, dev,
-                                          "power-supply", &priv->reg);
-       if (ret) {
-               debug("%s: Warning: cnnot get power supply: ret=%d\n",
-                     __func__, ret);
-               if (ret != -ENOENT)
-                       return ret;
+       if (IS_ENABLED(CONFIG_DM_REGULATOR)) {
+               ret = uclass_get_device_by_phandle(UCLASS_REGULATOR, dev,
+                                                  "power-supply", &priv->reg);
+               if (ret) {
+                       debug("%s: Warning: cannot get power supply: ret=%d\n",
+                             __func__, ret);
+                       if (ret != -ENOENT)
+                               return ret;
+               }
        }
        ret = uclass_get_device_by_phandle(UCLASS_PANEL_BACKLIGHT, dev,
                                           "backlight", &priv->backlight);
@@ -69,7 +70,7 @@ static int simple_panel_probe(struct udevice *dev)
        struct simple_panel_priv *priv = dev_get_priv(dev);
        int ret;
 
-       if (priv->reg) {
+       if (IS_ENABLED(CONFIG_DM_REGULATOR) && priv->reg) {
                debug("%s: Enable regulator '%s'\n", __func__, priv->reg->name);
                ret = regulator_set_enable(priv->reg, true);
                if (ret)
@@ -86,6 +87,8 @@ static const struct panel_ops simple_panel_ops = {
 static const struct udevice_id simple_panel_ids[] = {
        { .compatible = "simple-panel" },
        { .compatible = "auo,b133xtn01" },
+       { .compatible = "auo,b116xw03" },
+       { .compatible = "auo,b133htn01" },
        { }
 };