Skip to contentSkip to conversation

drm/panel: Add a driver for the TPO TPG110

PATCH Superseded Linus Walleij 5 participants 7 messages Jan 9, 2019 – Jan 11, 2019

Subsystems (4)

v6 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 drm/panel: Add a driver for the TPO TPG110

The TPO (Toppoly) TPG110 is a pretty generic display driver similar in vein to the Ilitek 93xx devices. It is not a panel per se but a driver used with several low-cost noname panels.

This is used on the Nomadik NHK15 combined with a OSD OSD057VA01CT display for WVGA 800x480.

The driver is pretty minimalistic right now but can be extended to handle non-default polarities, gamma correction etc.

The driver is based on the baked-in code in drivers/video/fbdev/amba-clcd-nomadik.c which will be decomissioned once this us upstream.

---
ChangeLog v5->v6:
- Collected Sam's ACK.
ChangeLog v4->v5:
- Assign proper bus_flags.
- This is now the only remaining patch. ChangeLog v3->v4:
- Tag on the SPI_3WIRE_HIZ flag to the SPI slave mode. ChangeLog v2->v3:
- Rewrite as an SPI child device.

---
 MAINTAINERS                              |   7 +
 drivers/gpu/drm/panel/Kconfig            |  10 +
 drivers/gpu/drm/panel/Makefile           |   1 +
 drivers/gpu/drm/panel/panel-tpo-tpg110.c | 511 +++++++++++++++++++++++
 4 files changed, 529 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-tpo-tpg110.c
MAINTAINERS +7 -0
index 32d444476a90..e177473d5417 100644
@@ -4909,6 +4909,13 @@ DRM DRIVER FOR TDFX VIDEO CARDS
 S:	Orphan / Obsolete
 F:	drivers/gpu/drm/tdfx/
 
+DRM DRIVER FOR TPO TPG110 PANELS
+M:	Linus Walleij <[email protected]>
+T:	git git://anongit.freedesktop.org/drm/drm-misc
+S:	Maintained
+F:	drivers/gpu/drm/panel/panel-tpo-tpg110.c
+F:	Documentation/devicetree/bindings/display/panel/tpo,tpg110.txt
+
 DRM DRIVER FOR USB DISPLAYLINK VIDEO ADAPTERS
 M:	Dave Airlie <[email protected]>
 R:	Sean Paul <[email protected]>
drivers/gpu/drm/panel/Kconfig +10 -0
index 3f3537719beb..e3821180b6cd 100644
@@ -204,6 +204,16 @@ config DRM_PANEL_SITRONIX_ST7789V
 	  Say Y here if you want to enable support for the Sitronix
 	  ST7789V controller for 240x320 LCD panels
 
+config DRM_PANEL_TPO_TPG110
+	tristate "TPO TPG 800x400 panel"
+	depends on OF && SPI && GPIOLIB
+	depends on BACKLIGHT_CLASS_DEVICE
+	select VIDEOMODE_HELPERS
+	help
+	  Say Y here if you want to enable support for TPO TPG110
+	  400CH LTPS TFT LCD Single Chip Digital Driver for up to
+	  800x400 LCD panels.
+
 config DRM_PANEL_TRULY_NT35597_WQXGA
 	tristate "Truly WQXGA"
 	depends on OF
drivers/gpu/drm/panel/Makefile +1 -0
index 4396658a7996..cd14ca39c6e0 100644
@@ -21,4 +21,5 @@ obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += panel-seiko-43wvf1g.o
 obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o
 obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o
 obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o
+obj-$(CONFIG_DRM_PANEL_TPO_TPG110) += panel-tpo-tpg110.o
 obj-$(CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA) += panel-truly-nt35597.o
drivers/gpu/drm/panel/panel-tpo-tpg110.c new file +511 -0

511 lines not on this page · raw message

Signature · 6 lines
2.19.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

Hi Linus.

Quoted 11 lines · Linus Walleij

The TPO (Toppoly) TPG110 is a pretty generic display driver similar in vein to the Ilitek 93xx devices. It is not a panel per se but a driver used with several low-cost noname panels.

This is used on the Nomadik NHK15 combined with a OSD OSD057VA01CT display for WVGA 800x480.

The driver is pretty minimalistic right now but can be extended to handle non-default polarities, gamma correction etc.

Quoted 6 lines

The driver is based on the baked-in code in drivers/video/fbdev/amba-clcd-nomadik.c which will be decomissioned once this us upstream.

While browsing this code again a few things jumped at me.
- we try to kill use of drmP.h
- DRM_DEV_XXX rather than dev_xxx (not all like these, but they are used in other panels)
- drop videomode - not used anymore.

I went ahead and made a patch. Build tested on top of drm-misc-next (had to define SPI_3WIRE_HIZ, because we miss a backmerge of -rc1)

Apply what you think is relevant, and sorry for the late feedback.

Sam

drivers/gpu/drm/panel/Kconfig +0 -1
index e3821180b6cd..a71f44191273 100644
@@ -208,7 +208,6 @@ config DRM_PANEL_TPO_TPG110
 	tristate "TPO TPG 800x400 panel"
 	depends on OF && SPI && GPIOLIB
 	depends on BACKLIGHT_CLASS_DEVICE
-	select VIDEOMODE_HELPERS
 	help
 	  Say Y here if you want to enable support for TPO TPG110
 	  400CH LTPS TFT LCD Single Chip Digital Driver for up to
drivers/gpu/drm/panel/panel-tpo-tpg110.c +24 -24

134 lines not on this page · raw message

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
In reply to Linus Walleij

On Wed, Jan 09, 2019 at 02:53:31PM +0100, Linus Walleij wrote:
[...]

Quoted 1 line
drivers/gpu/drm/panel/panel-tpo-tpg110.c +0 -0

[...]

drivers/gpu/drm/panel/panel-tpo-tpg110.c line 277

Quoted 8 lines
drivers/gpu/drm/panel/panel-tpo-tpg110.c +8 -0
+static int tpg110_startup(struct tpg110 *tpg)
+{
+	u8 val;
+	int i;
+
+	/* De-assert the reset signal */
+	gpiod_set_value_cansleep(tpg->grestb, 0);
+	mdelay(1);

Does this have to be the spinning variant? This seems to be only used in the probe path, so doesn't have to be atomic.

drivers/gpu/drm/panel/panel-tpo-tpg110.c line 278

Quoted 1 line
drivers/gpu/drm/panel/panel-tpo-tpg110.c +1 -0
+	dev_info(tpg->dev, "de-asserted GRESTB\n");

Maybe turn this into dev_dbg()?

Quoted 29 lines
drivers/gpu/drm/panel/panel-tpo-tpg110.c +29 -0
+
+	/* Test display communication */
+	tpg110_write_reg(tpg, TPG110_TEST, 0x55);
+	val = tpg110_read_reg(tpg, TPG110_TEST);
+	if (val != 0x55) {
+		dev_err(tpg->dev, "failed communication test\n");
+		return -ENODEV;
+	}
+
+	val = tpg110_read_reg(tpg, TPG110_CHIPID);
+	dev_info(tpg->dev, "TPG110 chip ID: %d version: %d\n",
+		 val >> 4, val & 0x0f);
+
+	/* Show display resolution */
+	val = tpg110_read_reg(tpg, TPG110_CTRL1);
+	val &= TPG110_RES_MASK;
+	switch (val) {
+	case TPG110_RES_400X240_D:
+		dev_info(tpg->dev,
+			 "IN 400x240 RGB -> OUT 800x480 RGB (dual scan)");
+		break;
+	case TPG110_RES_480X272_D:
+		dev_info(tpg->dev,
+			 "IN 480x272 RGB -> OUT 800x480 RGB (dual scan)");
+		break;
+	case TPG110_RES_480X640:
+		dev_info(tpg->dev, "480x640 RGB");
+		break;
+	case TPG110_RES_480X272:

drivers/gpu/drm/panel/panel-tpo-tpg110.c line 317

Quoted 10 lines
drivers/gpu/drm/panel/panel-tpo-tpg110.c +10 -0
+		dev_info(tpg->dev, "480x272 RGB");
+		break;
+	case TPG110_RES_640X480:
+		dev_info(tpg->dev, "640x480 RGB");
+		break;
+	case TPG110_RES_800X480:
+		dev_info(tpg->dev, "800x480 RGB");
+		break;
+	default:
+		dev_info(tpg->dev, "ILLEGAL RESOLUTION");

dev_err()? Also, perhaps make this some proper error message and include the invalid value?

Also I just noticed that the above informational messages all lack a \n at the end.

The above is also very verbose, do we really need all that information in the kernel log?

Quoted 37 lines
drivers/gpu/drm/panel/panel-tpo-tpg110.c +37 -0
+		break;
+	}
+
+	/* From the producer side, this is the same resolution */
+	if (val == TPG110_RES_480X272_D)
+		val = TPG110_RES_480X272;
+
+	for (i = 0; i < ARRAY_SIZE(tpg110_modes); i++) {
+		const struct tpg110_panel_mode *pm;
+
+		pm = &tpg110_modes[i];
+		if (pm->magic == val) {
+			tpg->panel_mode = pm;
+			break;
+		}
+	}
+	if (i == ARRAY_SIZE(tpg110_modes)) {
+		dev_err(tpg->dev, "unsupported mode (%02x) detected\n",
+			val);
+		return -ENODEV;
+	}
+
+	val = tpg110_read_reg(tpg, TPG110_CTRL2);
+	dev_info(tpg->dev, "resolution and standby is controlled by %s\n",
+		 (val & TPG110_CTRL2_RES_PM_CTRL) ? "software" : "hardware");
+	/* Take control over resolution and standby */
+	val |= TPG110_CTRL2_RES_PM_CTRL;
+	tpg110_write_reg(tpg, TPG110_CTRL2, val);
+
+	return 0;
+}
+
+static int tpg110_disable(struct drm_panel *panel)
+{
+	struct tpg110 *tpg = to_tpg110(panel);
+	u8 val;
+

drivers/gpu/drm/panel/panel-tpo-tpg110.c line 364

Quoted 10 lines
drivers/gpu/drm/panel/panel-tpo-tpg110.c +10 -0
+	/* Put chip into standby */
+	val = tpg110_read_reg(tpg, TPG110_CTRL2_PM);
+	val &= ~TPG110_CTRL2_PM;
+	tpg110_write_reg(tpg, TPG110_CTRL2_PM, val);
+
+	if (tpg->backlight) {
+		tpg->backlight->props.power = FB_BLANK_POWERDOWN;
+		tpg->backlight->props.state |= BL_CORE_FBBLANK;
+		backlight_update_status(tpg->backlight);
+	}

backlight_disable()?

Quoted 4 lines
drivers/gpu/drm/panel/panel-tpo-tpg110.c +4 -0
+
+	return 0;
+}
+

drivers/gpu/drm/panel/panel-tpo-tpg110.c line 378

Quoted 10 lines
drivers/gpu/drm/panel/panel-tpo-tpg110.c +10 -0
+static int tpg110_enable(struct drm_panel *panel)
+{
+	struct tpg110 *tpg = to_tpg110(panel);
+	u8 val;
+
+	if (tpg->backlight) {
+		tpg->backlight->props.state &= ~BL_CORE_FBBLANK;
+		tpg->backlight->props.power = FB_BLANK_UNBLANK;
+		backlight_update_status(tpg->backlight);
+	}

backlight_enable()?

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

Hi Thierry.

Quoted 15 lines

drivers/gpu/drm/panel/panel-tpo-tpg110.c line 317

Quoted 11 lines
drivers/gpu/drm/panel/panel-tpo-tpg110.c new file +11 -0
+	case TPG110_RES_480X272:
+		dev_info(tpg->dev, "480x272 RGB");
+		break;
+	case TPG110_RES_640X480:
+		dev_info(tpg->dev, "640x480 RGB");
+		break;
+	case TPG110_RES_800X480:
+		dev_info(tpg->dev, "800x480 RGB");
+		break;
+	default:
+		dev_info(tpg->dev, "ILLEGAL RESOLUTION");

dev_err()? Also, perhaps make this some proper error message and include the invalid value?

Quoted 2 lines

Also I just noticed that the above informational messages all lack a \n at the end.

The "\n" is optional these days.

Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw
In reply to Linus Walleij

Hi Linus,

Quoted 41 lines · Linus Walleij

The TPO (Toppoly) TPG110 is a pretty generic display driver similar in vein to the Ilitek 93xx devices. It is not a panel per se but a driver used with several low-cost noname panels.

This is used on the Nomadik NHK15 combined with a OSD OSD057VA01CT display for WVGA 800x480.

The driver is pretty minimalistic right now but can be extended to handle non-default polarities, gamma correction etc.

The driver is based on the baked-in code in drivers/video/fbdev/amba-clcd-nomadik.c which will be decomissioned once this us upstream.

---
ChangeLog v5->v6:
- Collected Sam's ACK.
ChangeLog v4->v5:
- Assign proper bus_flags.
- This is now the only remaining patch. ChangeLog v3->v4:
- Tag on the SPI_3WIRE_HIZ flag to the SPI slave mode. ChangeLog v2->v3:
- Rewrite as an SPI child device.

---
 MAINTAINERS                              |   7 +
 drivers/gpu/drm/panel/Kconfig            |  10 +
 drivers/gpu/drm/panel/Makefile           |   1 +
 drivers/gpu/drm/panel/panel-tpo-tpg110.c | 511 +++++++++++++++++++++++
 4 files changed, 529 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-tpo-tpg110.c
MAINTAINERS +0 -0
index 32d444476a90..e177473d5417 100644

MAINTAINERS DRM DRIVER FOR TDFX VIDEO CARDS · line 4917

Quoted 9 lines
MAINTAINERS +6 -0
@@ -4909,6 +4909,13 @@ DRM DRIVER FOR TDFX VIDEO CARDS
 S:     Orphan / Obsolete
 F:     drivers/gpu/drm/tdfx/
 
+DRM DRIVER FOR TPO TPG110 PANELS
+M:     Linus Walleij <[email protected]>
+T:     git git://anongit.freedesktop.org/drm/drm-misc
+S:     Maintained
+F:     drivers/gpu/drm/panel/panel-tpo-tpg110.c
+F:     Documentation/devicetree/bindings/display/panel/tpo,tpg110.txt

Just for my information, for each new panel addition, is MAINTAINERS file will update only by drm-misc members or anyone who submitted the patch? The last communication with seanpaul mentioned this context[1] just want to understand how this panels were maintained.

[1] https://lkml.org/lkml/2018/12/14/1275
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
Quoted 6 lines · Jagan Teki

Just for my information, for each new panel addition, is MAINTAINERS file will update only by drm-misc members or anyone who submitted the patch? The last communication with seanpaul mentioned this context[1] just want to understand how this panels were maintained.

[1] https://lkml.org/lkml/2018/12/14/1275

Aha I see. Well this per-panel entry is good because then get_maintainer.pl will also get me specifically and not just the people listed for panel/drm-misc (whether I am, was or will be a member of that group or not).

get_maintainer.pl will present all of them with me on top:

$ scripts/get_maintainer.pl -f drivers/gpu/drm/panel/panel-tpo-tpg110.c
Linus Walleij <[email protected]> (maintainer:DRM DRIVER FOR
TPO TPG110 PANELS)
Thierry Reding <[email protected]> (maintainer:DRM PANEL DRIVERS)
David Airlie <[email protected]> (maintainer:DRM DRIVERS)
Daniel Vetter <[email protected]> (maintainer:DRM DRIVERS)
[email protected] (open list:DRM PANEL DRIVERS)
[email protected] (open list)

So I would advice against the above practice: one does not exclude the other.

Yours,
Linus Walleij
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw
Quoted 27 lines · Linus Walleij
Quoted 6 lines · Jagan Teki

Just for my information, for each new panel addition, is MAINTAINERS file will update only by drm-misc members or anyone who submitted the patch? The last communication with seanpaul mentioned this context[1] just want to understand how this panels were maintained.

[1] https://lkml.org/lkml/2018/12/14/1275

Aha I see. Well this per-panel entry is good because then get_maintainer.pl will also get me specifically and not just the people listed for panel/drm-misc (whether I am, was or will be a member of that group or not).

get_maintainer.pl will present all of them with me on top:

$ scripts/get_maintainer.pl -f drivers/gpu/drm/panel/panel-tpo-tpg110.c
Linus Walleij <[email protected]> (maintainer:DRM DRIVER FOR
TPO TPG110 PANELS)
Thierry Reding <[email protected]> (maintainer:DRM PANEL DRIVERS)
David Airlie <[email protected]> (maintainer:DRM DRIVERS)
Daniel Vetter <[email protected]> (maintainer:DRM DRIVERS)
[email protected] (open list:DRM PANEL DRIVERS)
[email protected] (open list)
Quoted 2 lines

So I would advice against the above practice: one does not exclude the other.

Yeah we have lots of MAINTAINERS entries for all the various things maintained as part of drm-misc. Only thing I'm encouraging is that everything has at least a T: git repo entry pointing at drm-misc somewhere, to have some easy overview of what's under the drm-misc umbrella. But the overall drm panel entry has that covered already. And we also have some other more specific entries for individual panels already.
-Daniel

Quoted 7 lines

Yours,
Linus Walleij
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel