Re-use simple panel driver for MIPI DSI panels
which do not require additional DSI commands
for setup.

Tested-by: Robert Eckelmann <longnose...@gmail.com> # ASUS TF101 T20
Tested-by: Nicolas Chauvet <kwiz...@gmail.com> # Paz00
Tested-by: Andreas Westman Dorcsak <hed...@yahoo.com> # ASUS TF700T T30
Signed-off-by: Svyatoslav Ryhel <clamo...@gmail.com>
---
 drivers/video/simple_panel.c | 37 ++++++++++++++++++++++++++++++++----
 1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/drivers/video/simple_panel.c b/drivers/video/simple_panel.c
index 5a8262669a..81fcafb9f5 100644
--- a/drivers/video/simple_panel.c
+++ b/drivers/video/simple_panel.c
@@ -8,6 +8,7 @@
 #include <backlight.h>
 #include <dm.h>
 #include <log.h>
+#include <mipi_dsi.h>
 #include <panel.h>
 #include <asm/gpio.h>
 #include <power/regulator.h>
@@ -18,6 +19,19 @@ struct simple_panel_priv {
        struct gpio_desc enable;
 };
 
+/* List of supported DSI panels */
+enum {
+       PANEL_NON_DSI,
+       PANASONIC_VVX10F004B00,
+};
+
+static const struct mipi_dsi_panel_plat panasonic_vvx10f004b00 = {
+       .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
+                     MIPI_DSI_CLOCK_NON_CONTINUOUS,
+       .format = MIPI_DSI_FMT_RGB888,
+       .lanes = 4,
+};
+
 static int simple_panel_enable_backlight(struct udevice *dev)
 {
        struct simple_panel_priv *priv = dev_get_priv(dev);
@@ -96,6 +110,8 @@ static int simple_panel_of_to_plat(struct udevice *dev)
 static int simple_panel_probe(struct udevice *dev)
 {
        struct simple_panel_priv *priv = dev_get_priv(dev);
+       struct mipi_dsi_panel_plat *plat = dev_get_plat(dev);
+       const u32 dsi_data = dev_get_driver_data(dev);
        int ret;
 
        if (IS_ENABLED(CONFIG_DM_REGULATOR) && priv->reg) {
@@ -105,6 +121,16 @@ static int simple_panel_probe(struct udevice *dev)
                        return ret;
        }
 
+       switch (dsi_data) {
+       case PANASONIC_VVX10F004B00:
+               memcpy(plat, &panasonic_vvx10f004b00,
+                      sizeof(panasonic_vvx10f004b00));
+               break;
+       case PANEL_NON_DSI:
+       default:
+               break;
+       }
+
        return 0;
 }
 
@@ -123,15 +149,18 @@ static const struct udevice_id simple_panel_ids[] = {
        { .compatible = "lg,lb070wv8" },
        { .compatible = "sharp,lq123p1jx31" },
        { .compatible = "boe,nv101wxmn51" },
+       { .compatible = "panasonic,vvx10f004b00",
+         .data = PANASONIC_VVX10F004B00 },
        { }
 };
 
 U_BOOT_DRIVER(simple_panel) = {
-       .name   = "simple_panel",
-       .id     = UCLASS_PANEL,
-       .of_match = simple_panel_ids,
-       .ops    = &simple_panel_ops,
+       .name           = "simple_panel",
+       .id             = UCLASS_PANEL,
+       .of_match       = simple_panel_ids,
+       .ops            = &simple_panel_ops,
        .of_to_plat     = simple_panel_of_to_plat,
        .probe          = simple_panel_probe,
        .priv_auto      = sizeof(struct simple_panel_priv),
+       .plat_auto      = sizeof(struct mipi_dsi_panel_plat),
 };
-- 
2.37.2

Reply via email to