> Add a driver for the Startek KD070FHFID078 7" DSI panel. This panel is
> used on the MediaTek Genio 360 EVK board.
>
> The display mode and DSI mode flags follow the upstream Linux driver
> panel-himax-hx8279.c, which is what the "himax,hx8279" fallback
> compatible in the device tree binds to.
>
> Signed-off-by: David Lechner <[email protected]>
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index c1e09c7d087..0af0957e5b6 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1671,6 +1671,12 @@ R:     GSS_MTK_Uboot_upstream 
> <[email protected]>
>  S:   Maintained
>  F:   drivers/video/panel-startek-kd070fhfid015.c
>
> +STARTEK KD070FHFID078 PANEL

open question: what about merging this with KD070FHFID015 just above?

> +M:   David Lechner <[email protected]>
> +R:   GSS_MTK_Uboot_upstream <[email protected]>
> +S:   Maintained
> +F:   drivers/video/panel-startek-kd070fhfid078.c
> +
>  TARGET_BCMNS3
>  M:   Rayagonda Kokatanur <[email protected]>
>  S:   Maintained
> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
> index cfa3cccb911..500a8a54192 100644
> --- a/drivers/video/Kconfig
> +++ b/drivers/video/Kconfig
> @@ -330,6 +330,16 @@ config PANEL_STARTEK_KD070FHFID015
>         1200 x 1920 pixels. It provides a MIPI DSI interface to the host, a
>         built-in LED backlight and touch controller.
>
> +config PANEL_STARTEK_KD070FHFID078
> +     bool "STARTEK KD070FHFID078 panel"
> +     depends on PANEL && BACKLIGHT && DM_GPIO && DM_REGULATOR
> +     select VIDEO_MIPI_DSI
> +     help
> +       Say Y here if you want to enable support for STARTEK KD070FHFID078
> +       DSI panel. The panel is a 7-inch TFT LCD display with a resolution of
> +       1200 x 1920 pixels. It provides a MIPI DSI interface to the host, a
> +       built-in LED backlight and touch controller.
> +
>  config VIDEO_BOCHS
>       bool "Enable Bochs video emulation for QEMU"
>       help
> diff --git a/drivers/video/Makefile b/drivers/video/Makefile
> index 16e9ee2c11c..a4b28f3b3d8 100644
> --- a/drivers/video/Makefile
> +++ b/drivers/video/Makefile
> @@ -23,6 +23,7 @@ obj-$(CONFIG_$(PHASE_)VIDEO) += video_bmp.o
>  obj-$(CONFIG_$(PHASE_)PANEL) += panel-uclass.o
>  obj-$(CONFIG_PANEL_HX8238D) += hx8238d.o
>  obj-$(CONFIG_PANEL_STARTEK_KD070FHFID015) += panel-startek-kd070fhfid015.o
> +obj-$(CONFIG_PANEL_STARTEK_KD070FHFID078) += panel-startek-kd070fhfid078.o
>  obj-$(CONFIG_$(PHASE_)SIMPLE_PANEL) += simple_panel.o
>
>  obj-$(CONFIG_VIDEO_LOGO) += u_boot_logo.bmp.o
> diff --git a/drivers/video/panel-startek-kd070fhfid078.c 
> b/drivers/video/panel-startek-kd070fhfid078.c
> new file mode 100644
> index 00000000000..b86d5197ab4
> --- /dev/null
> +++ b/drivers/video/panel-startek-kd070fhfid078.c
> @@ -0,0 +1,276 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (C) 2025 MediaTek Inc.
> + * Copyright (C) 2026 BayLibre, SAS
> + *
> + * Authors:
> + * - Guillaume La Roque <[email protected]>
> + * - Jitao Shi <[email protected]>
> + * - David Lechner <[email protected]>
> + */
> +
> +#include <asm-generic/gpio.h>
> +#include <backlight.h>
> +#include <dm.h>
> +#include <dm/device_compat.h>
> +#include <errno.h>

nit: <errno.h> is unused. You can drop it.

> +#include <linux/delay.h>
> +#include <linux/err.h>
> +#include <mipi_dsi.h>
> +#include <panel.h>
> +#include <power/regulator.h>
> +
> +struct stk078_panel {
> +     struct gpio_desc *enable_gpio;
> +     struct gpio_desc *reset_gpio;
> +     struct mipi_dsi_device *dsi;
> +     struct udevice *iovcc;
> +     struct udevice *vdd;
> +     struct udevice *backlight;
> +};
> +
> +static const struct drm_display_mode default_mode = {
> +     .clock = 156458,
> +     .hdisplay = 1200,
> +     .hsync_start = 1200 + 50,
> +     .hsync_end = 1200 + 50 + 24,
> +     .htotal = 1200 + 50 + 24 + 66,
> +     .vdisplay = 1920,
> +     .vsync_start = 1920 + 14,
> +     .vsync_end = 1920 + 14 + 2,
> +     .vtotal = 1920 + 14 + 2 + 10,
> +};
> +
> +static int stk078_panel_init(struct stk078_panel *stk)
> +{
> +     struct mipi_dsi_device *dsi = stk->dsi;
> +     int ret;
> +
> +     mipi_dsi_generic_write_seq(dsi, 0xB0, 0x05);
> +     mipi_dsi_generic_write_seq(dsi, 0xB3, 0x52);
> +     mipi_dsi_generic_write_seq(dsi, 0xB8, 0x7F);
> +     mipi_dsi_generic_write_seq(dsi, 0xBC, 0x20);
> +     mipi_dsi_generic_write_seq(dsi, 0xD6, 0x7F);
> +     mipi_dsi_generic_write_seq(dsi, 0xB0, 0x01);
> +     mipi_dsi_generic_write_seq(dsi, 0xC0, 0x0D);
> +     mipi_dsi_generic_write_seq(dsi, 0xC1, 0x0D);
> +     mipi_dsi_generic_write_seq(dsi, 0xC2, 0x06);
> +     mipi_dsi_generic_write_seq(dsi, 0xC3, 0x06);
> +     mipi_dsi_generic_write_seq(dsi, 0xC4, 0x08);
> +     mipi_dsi_generic_write_seq(dsi, 0xC5, 0x08);
> +     mipi_dsi_generic_write_seq(dsi, 0xC6, 0x0A);
> +     mipi_dsi_generic_write_seq(dsi, 0xC7, 0x0A);
> +     mipi_dsi_generic_write_seq(dsi, 0xC8, 0x0C);
> +     mipi_dsi_generic_write_seq(dsi, 0xC9, 0x0C);
> +     mipi_dsi_generic_write_seq(dsi, 0xCA, 0x00);
> +     mipi_dsi_generic_write_seq(dsi, 0xCB, 0x00);
> +     mipi_dsi_generic_write_seq(dsi, 0xCC, 0x0E);
> +     mipi_dsi_generic_write_seq(dsi, 0xCD, 0x0E);
> +     mipi_dsi_generic_write_seq(dsi, 0xCE, 0x01);
> +     mipi_dsi_generic_write_seq(dsi, 0xCF, 0x01);
> +     mipi_dsi_generic_write_seq(dsi, 0xD0, 0x04);
> +     mipi_dsi_generic_write_seq(dsi, 0xD1, 0x04);
> +     mipi_dsi_generic_write_seq(dsi, 0xD2, 0x00);
> +     mipi_dsi_generic_write_seq(dsi, 0xD3, 0x00);
> +     mipi_dsi_generic_write_seq(dsi, 0xD4, 0x0D);
> +     mipi_dsi_generic_write_seq(dsi, 0xD5, 0x0D);
> +     mipi_dsi_generic_write_seq(dsi, 0xD6, 0x05);
> +     mipi_dsi_generic_write_seq(dsi, 0xD7, 0x05);
> +     mipi_dsi_generic_write_seq(dsi, 0xD8, 0x07);
> +     mipi_dsi_generic_write_seq(dsi, 0xD9, 0x07);
> +     mipi_dsi_generic_write_seq(dsi, 0xDA, 0x09);
> +     mipi_dsi_generic_write_seq(dsi, 0xDB, 0x09);
> +     mipi_dsi_generic_write_seq(dsi, 0xDC, 0x0B);
> +     mipi_dsi_generic_write_seq(dsi, 0xDD, 0x0B);
> +     mipi_dsi_generic_write_seq(dsi, 0xDE, 0x00);
> +     mipi_dsi_generic_write_seq(dsi, 0xDF, 0x00);
> +     mipi_dsi_generic_write_seq(dsi, 0xE0, 0x0E);
> +     mipi_dsi_generic_write_seq(dsi, 0xE1, 0x0E);
> +     mipi_dsi_generic_write_seq(dsi, 0xE2, 0x01);
> +     mipi_dsi_generic_write_seq(dsi, 0xE3, 0x01);
> +     mipi_dsi_generic_write_seq(dsi, 0xE4, 0x03);
> +     mipi_dsi_generic_write_seq(dsi, 0xE5, 0x03);
> +     mipi_dsi_generic_write_seq(dsi, 0xE6, 0x00);
> +     mipi_dsi_generic_write_seq(dsi, 0xE7, 0x00);
> +     mipi_dsi_generic_write_seq(dsi, 0xB0, 0x03);
> +     mipi_dsi_generic_write_seq(dsi, 0xBA, 0xF0);
> +     mipi_dsi_generic_write_seq(dsi, 0xC8, 0x07);
> +     mipi_dsi_generic_write_seq(dsi, 0xC9, 0x03);
> +     mipi_dsi_generic_write_seq(dsi, 0xCA, 0x41);
> +     mipi_dsi_generic_write_seq(dsi, 0xD2, 0x01);
> +     mipi_dsi_generic_write_seq(dsi, 0xD3, 0x05);
> +     mipi_dsi_generic_write_seq(dsi, 0xD4, 0x05);
> +     mipi_dsi_generic_write_seq(dsi, 0xD5, 0x8A);
> +     mipi_dsi_generic_write_seq(dsi, 0xE4, 0xC0);
> +     mipi_dsi_generic_write_seq(dsi, 0xE5, 0x00);
> +     mipi_dsi_generic_write_seq(dsi, 0xB0, 0x00);
> +     mipi_dsi_generic_write_seq(dsi, 0xBF, 0x1F);
> +     mipi_dsi_generic_write_seq(dsi, 0xC0, 0x12);
> +     mipi_dsi_generic_write_seq(dsi, 0xC2, 0x1E);
> +     mipi_dsi_generic_write_seq(dsi, 0xC4, 0x1E);
> +     mipi_dsi_generic_write_seq(dsi, 0xB0, 0x06);
> +     mipi_dsi_generic_write_seq(dsi, 0xB8, 0xA5);
> +     mipi_dsi_generic_write_seq(dsi, 0xC0, 0xA5);
> +     mipi_dsi_generic_write_seq(dsi, 0xBC, 0x11);
> +     mipi_dsi_generic_write_seq(dsi, 0xD5, 0x48);
> +     mipi_dsi_generic_write_seq(dsi, 0xB8, 0x00);
> +     mipi_dsi_generic_write_seq(dsi, 0xC0, 0x00);
> +

Looking at panel-himax-hx8279.c in the kernel, it looks like all of
these commands already have named defines. Can you use them?

> +     ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
> +     if (ret < 0)
> +             return ret;
> +
> +     mdelay(120);

Nit: Linux hx8279_prepare() waits 130 ms after exit_sleep_mode
anyreason to have 120 here?

> +
> +     ret = mipi_dsi_dcs_set_display_on(dsi);
> +     if (ret < 0)
> +             return ret;
> +
> +     mdelay(20);

any reason to wait again 20 ms? Looks like the kernel does not

-- 
Julien Stephan <[email protected]>

Reply via email to