[PATCH v1 0/2] Simple panel improvements

Simplify platform data pass to simple DSI panels by direct asigning in udevice_id struct.
Support EDID searching in case device tree provides no specific timings or device has different panels (like paz00).
Svyatoslav Ryhel (2): video: simple_panel: simplify platform data pass video: simple_panel: add EDID support
drivers/video/Kconfig | 2 + drivers/video/simple_panel.c | 87 +++++++++++++++++++++++++----------- 2 files changed, 63 insertions(+), 26 deletions(-)

Pass MIPI DSI platform data to simple DSI panel directly from driver data on panel probe.
Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- drivers/video/simple_panel.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-)
diff --git a/drivers/video/simple_panel.c b/drivers/video/simple_panel.c index efb122b534..064c113d2d 100644 --- a/drivers/video/simple_panel.c +++ b/drivers/video/simple_panel.c @@ -19,19 +19,6 @@ 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); @@ -111,7 +98,8 @@ 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); + 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); @@ -121,15 +109,8 @@ 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; - } + if (dsi_data) + memcpy(plat, dsi_data, sizeof(struct mipi_dsi_panel_plat));
return 0; } @@ -140,6 +121,13 @@ static const struct panel_ops simple_panel_ops = { .get_display_timing = simple_panel_get_display_timing, };
+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 const struct udevice_id simple_panel_ids[] = { { .compatible = "simple-panel" }, { .compatible = "auo,b133xtn01" }, @@ -150,7 +138,7 @@ static const struct udevice_id simple_panel_ids[] = { { .compatible = "sharp,lq123p1jx31" }, { .compatible = "boe,nv101wxmn51" }, { .compatible = "panasonic,vvx10f004b00", - .data = PANASONIC_VVX10F004B00 }, + .data = (ulong)&panasonic_vvx10f004b00 }, { } };

Support timing parsing from EDID if panel device tree node provides DDC i2c bus instead of timings node.
Tested-by: Robert Eckelmann longnoserob@gmail.com # ASUS TF201 Tested-by: Agneli poczt@protonmail.ch # Toshiba AC100 T20 Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- drivers/video/Kconfig | 2 ++ drivers/video/simple_panel.c | 51 ++++++++++++++++++++++++++++++++++-- 2 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 6f319ba0d5..e2016d73d1 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -240,6 +240,7 @@ config PANEL config SIMPLE_PANEL bool "Enable simple panel support" depends on PANEL && BACKLIGHT && DM_GPIO + select I2C_EDID default y help This turns on a simple panel driver that enables a compatible @@ -1105,6 +1106,7 @@ config SPL_PANEL config SPL_SIMPLE_PANEL bool "Enable simple panel support at SPL" depends on SPL_PANEL && SPL_BACKLIGHT && SPL_DM_GPIO + select I2C_EDID default y help This turns on a simple panel driver that enables a compatible diff --git a/drivers/video/simple_panel.c b/drivers/video/simple_panel.c index 064c113d2d..f0234349da 100644 --- a/drivers/video/simple_panel.c +++ b/drivers/video/simple_panel.c @@ -7,12 +7,16 @@ #include <common.h> #include <backlight.h> #include <dm.h> +#include <edid.h> +#include <i2c.h> #include <log.h> #include <mipi_dsi.h> #include <panel.h> #include <asm/gpio.h> #include <power/regulator.h>
+#define EDID_I2C_ADDR 0x50 + struct simple_panel_priv { struct udevice *reg; struct udevice *backlight; @@ -53,9 +57,52 @@ static int simple_panel_get_display_timing(struct udevice *dev, struct display_timing *timings) { const void *blob = gd->fdt_blob; + struct display_timing edid_timing; + struct udevice *panel_ddc, *panel_edid; + u8 edid_buf[EDID_SIZE] = { 0 }; + int ret, bpc; + + /* Check for timing subnode if panel node first */ + ret = fdtdec_decode_display_timing(blob, dev_of_offset(dev), + 0, timings); + if (!ret) + return ret; + + /* Check for DDC i2c if no timings are provided */ + ret = uclass_get_device_by_phandle(UCLASS_I2C, dev, + "ddc-i2c-bus", + &panel_ddc); + if (ret) { + log_debug("%s: cannot get DDC i2c bus: error %d\n", + __func__, ret); + return ret; + } + + ret = dm_i2c_probe(panel_ddc, EDID_I2C_ADDR, 0, &panel_edid); + if (ret) { + log_debug("%s: cannot probe EDID: error %d\n", + __func__, ret); + return ret; + }
- return fdtdec_decode_display_timing(blob, dev_of_offset(dev), - 0, timings); + ret = dm_i2c_read(panel_edid, 0, edid_buf, sizeof(edid_buf)); + if (ret) { + log_debug("%s: cannot dump EDID buffer: error %d\n", + __func__, ret); + return ret; + } + + ret = edid_get_timing(edid_buf, sizeof(edid_buf), + &edid_timing, &bpc); + if (ret) { + log_debug("%s: cannot decode EDID info: error %d\n", + __func__, ret); + return ret; + } + + memcpy(timings, &edid_timing, sizeof(*timings)); + + return 0; }
static int simple_panel_of_to_plat(struct udevice *dev)

On Mon, 8 Jan 2024 18:44:59 +0200 Svyatoslav Ryhel clamor95@gmail.com wrote:
Simplify platform data pass to simple DSI panels by direct asigning in udevice_id struct.
Support EDID searching in case device tree provides no specific timings or device has different panels (like paz00).
Svyatoslav Ryhel (2): video: simple_panel: simplify platform data pass video: simple_panel: add EDID support
drivers/video/Kconfig | 2 + drivers/video/simple_panel.c | 87 +++++++++++++++++++++++++----------- 2 files changed, 63 insertions(+), 26 deletions(-)
Series applied to u-boot-video. Fixed dm_i2c_* build errors with patch 2.
-- Anatolij
participants (2)
-
Anatolij Gustschin
-
Svyatoslav Ryhel