Add timing data for tfc_s9700rtwv43tr_01b from Linux to the simple-panel
driver. To support hardcoded timing data as Linux does, add a new struct
simple_panel_drv_data which holds a struct display_timing pointer as
well. The hardcoded timing data is preferred over DT parsing.

Signed-off-by: Markus Schneider-Pargmann (TI.com) <[email protected]>
---
 drivers/video/simple_panel.c | 48 ++++++++++++++++++++++++++++++++++++++------
 1 file changed, 42 insertions(+), 6 deletions(-)

diff --git a/drivers/video/simple_panel.c b/drivers/video/simple_panel.c
index 
0f23df701bc3c40ea49380bbfa3743ee592d8bd3..0a399acab3b3470f0af710f69176b48166ede2d1
 100644
--- a/drivers/video/simple_panel.c
+++ b/drivers/video/simple_panel.c
@@ -22,6 +22,11 @@ struct simple_panel_priv {
        struct gpio_desc enable;
 };
 
+struct simple_panel_drv_data {
+       const struct mipi_dsi_panel_plat *mipi_dsi;
+       const struct display_timing *timing;
+};
+
 static int simple_panel_enable_backlight(struct udevice *dev)
 {
        struct simple_panel_priv *priv = dev_get_priv(dev);
@@ -107,10 +112,17 @@ static int simple_panel_get_edid_timing(struct udevice 
*dev,
 static int simple_panel_get_display_timing(struct udevice *dev,
                                           struct display_timing *timings)
 {
+       const struct simple_panel_drv_data *data =
+               (const struct simple_panel_drv_data *)dev_get_driver_data(dev);
        const void *blob = gd->fdt_blob;
        int ret;
 
-       /* Check for timing subnode if panel node first */
+       if (data->timing) {
+               memcpy(timings, data->timing, sizeof(*timings));
+               return 0;
+       }
+
+       /* Check for timing subnode in panel node */
        ret = fdtdec_decode_display_timing(blob, dev_of_offset(dev),
                                           0, timings);
        if (!ret)
@@ -158,9 +170,9 @@ 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);
+       const struct simple_panel_drv_data *data =
+               (const struct simple_panel_drv_data *)dev_get_driver_data(dev);
        struct mipi_dsi_panel_plat *plat = dev_get_plat(dev);
-       struct mipi_dsi_panel_plat *dsi_data =
-               (struct mipi_dsi_panel_plat *)dev_get_driver_data(dev);
        int ret;
 
        ret = regulator_set_enable_if_allowed(priv->reg, true);
@@ -170,8 +182,8 @@ static int simple_panel_probe(struct udevice *dev)
                return ret;
        }
 
-       if (dsi_data)
-               memcpy(plat, dsi_data, sizeof(struct mipi_dsi_panel_plat));
+       if (data->mipi_dsi)
+               memcpy(plat, data->mipi_dsi, sizeof(struct 
mipi_dsi_panel_plat));
 
        return 0;
 }
@@ -189,6 +201,28 @@ static const struct mipi_dsi_panel_plat 
panasonic_vvx10f004b00 = {
        .lanes = 4,
 };
 
+static const struct simple_panel_drv_data panasonic_vvx10f004b00_data = {
+       .mipi_dsi = &panasonic_vvx10f004b00,
+};
+
+static const struct display_timing tfc_s9700rtwv43tr_01b_timing = {
+       .pixelclock = { 30000000, 30000000, 30000000 },
+       .hactive = { 800, 800, 800 },
+       .hfront_porch = { 39, 39, 39 },
+       .hback_porch = { 39, 39, 39 },
+       .hsync_len = { 47, 47, 47 },
+       .vactive = { 480, 480, 480 },
+       .vfront_porch = { 13, 13, 13 },
+       .vback_porch = { 29, 29, 29 },
+       .vsync_len = { 2, 2, 2 },
+       .flags = DISPLAY_FLAGS_HSYNC_HIGH | DISPLAY_FLAGS_VSYNC_HIGH |
+                DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_NEGEDGE,
+};
+
+static const struct simple_panel_drv_data tfc_s9700rtwv43tr_01b_data = {
+       .timing = &tfc_s9700rtwv43tr_01b_timing,
+};
+
 static const struct udevice_id simple_panel_ids[] = {
        { .compatible = "simple-panel" },
        { .compatible = "panel-lvds" },
@@ -200,7 +234,9 @@ static const struct udevice_id simple_panel_ids[] = {
        { .compatible = "sharp,lq123p1jx31" },
        { .compatible = "boe,nv101wxmn51" },
        { .compatible = "panasonic,vvx10f004b00",
-         .data = (ulong)&panasonic_vvx10f004b00 },
+         .data = (ulong)&panasonic_vvx10f004b00_data },
+       { .compatible = "tfc,s9700rtwv43tr-01b",
+         .data = (ulong)&tfc_s9700rtwv43tr_01b_data },
        { }
 };
 

-- 
2.51.0

Reply via email to