Hi Linus On Thu, Nov 01, 2018 at 10:32:56PM +0100, Linus Walleij wrote: > 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. > > Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx> > --- > 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 | 506 +++++++++++++++++++++++ > 4 files changed, 524 insertions(+) > create mode 100644 drivers/gpu/drm/panel/panel-tpo-tpg110.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index 690c2f68a401..c3ca56c2a7a6 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -4746,6 +4746,13 @@ DRM DRIVER FOR TDFX VIDEO CARDS > S: Orphan / Obsolete > F: drivers/gpu/drm/tdfx/ > > +DRM DRIVER FOR TPO TPG110 PANELS > +M: Linus Walleij <linus.walleij@xxxxxxxxxx> > +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 <airlied@xxxxxxxxxx> > R: Sean Paul <sean@xxxxxxxxxx> > diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig > index 6020c30a33b3..b2c8b02894b1 100644 > --- a/drivers/gpu/drm/panel/Kconfig > +++ b/drivers/gpu/drm/panel/Kconfig > @@ -186,4 +186,14 @@ 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. > + > endmenu > diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile > index 5ccaaa9d13af..9b3a0629d255 100644 > --- a/drivers/gpu/drm/panel/Makefile > +++ b/drivers/gpu/drm/panel/Makefile > @@ -19,3 +19,4 @@ 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 > diff --git a/drivers/gpu/drm/panel/panel-tpo-tpg110.c b/drivers/gpu/drm/panel/panel-tpo-tpg110.c > new file mode 100644 > index 000000000000..8e517ea5e73b > --- /dev/null > +++ b/drivers/gpu/drm/panel/panel-tpo-tpg110.c > @@ -0,0 +1,506 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Panel driver for the TPO TPG110 400CH LTPS TFT LCD Single Chip > + * Digital Driver. > + * > + * This chip drives a TFT LCD, so it does not know what kind of > + * display is actually connected to it, so the width and height of that > + * display needs to be supplied from the machine configuration. > + * > + * Author: > + * Linus Walleij <linus.wallei@xxxxxxxxxx> > + */ > +#include <drm/drmP.h> > +#include <drm/drm_panel.h> > + > +#include <linux/backlight.h> > +#include <linux/bitops.h> > +#include <linux/gpio/consumer.h> > +#include <linux/init.h> > +#include <linux/kernel.h> > +#include <linux/module.h> > +#include <linux/platform_device.h> > +#include <linux/spi/spi.h> > + > +#include <video/of_videomode.h> > +#include <video/videomode.h> > + > +#define TPG110_TEST 0x00 > +#define TPG110_CHIPID 0x01 > +#define TPG110_CTRL1 0x02 > +#define TPG110_RES_MASK GENMASK(2, 0) > +#define TPG110_RES_800X480 0x07 > +#define TPG110_RES_640X480 0x06 > +#define TPG110_RES_480X272 0x05 > +#define TPG110_RES_480X640 0x04 > +#define TPG110_RES_480X272_D 0x01 /* Dual scan: outputs 800x480 */ > +#define TPG110_RES_400X240_D 0x00 /* Dual scan: outputs 800x480 */ > +#define TPG110_CTRL2 0x03 > +#define TPG110_CTRL2_PM BIT(0) > +#define TPG110_CTRL2_RES_PM_CTRL BIT(7) > + > +/** > + * struct tpg110_panel_mode - lookup struct for the supported modes > + */ > +struct tpg110_panel_mode { > + /** > + * @name: the name of this panel > + */ > + const char *name; > + /** > + * @magic: the magic value from the detection register > + */ > + u32 magic; > + /** > + * @mode: the DRM display mode for this panel > + */ > + struct drm_display_mode mode; > + /** > + * @bus_flags: the DRM bus flags for this panel e.g. inverted clock > + */ > + u32 bus_flags; bus_flags is never assigned. Should it maybe be left out? Or is this just preparation for extra panels? Sam _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel