SPI based lcd bringup (ST7789V controller)

Hi Support team,

We are using one of the sitronix SPI controller ST7789V based LCD with Qualcomm410 platform. and Kernel version is 4.14.15 We are using SPI-LCD driver (drivers/gpu/drm/panel/panel-sitronix-st7789v.c) to enabling it. We need your help to bring up LCD with Linux.

Driver probed successfully. below are dmesg short logs. A detailed log file is attached.
[ 1.541250] ## DEBUG : func : st7789v_probe line : 390
[ 1.548451] st7789v spi0.0: spi0.0 supply power not found, using dummy regulator
[ 1.553683] ## DEBUG : func : st7789v_probe line : 424

Below changes we have applied in apq8016-sbc.dtsi: We refer Documentation/devicetree/bindings/display/panel/sitronix,st7789v.txt document.

spi@78b9000 {
/ On Low speed expansion /
label = “LS-SPI0”;
status = “okay”;
ports {
port@1 {
reg = <1>;
spi_out: endpoint {
remote-endpoint = <&truly_in>;
};
};
};

panel@0 {
label = “reset_gpios”;
compatible = “sitronix,st7789v”;
reg = <0>;
backlight = <&backlight>;
reset-gpio = <&msmgpio 10 GPIO_ACTIVE_LOW>;
spi-max-frequency = <100000>;
spi-cpol;
spi-cpha;
port {
truly_in: endpoint {
remote-endpoint = <&spi_out>;
};
};
};
};

Configuration:

CONFIG_DRM_PANEL_SITRONIX_ST7789V = y
HAS_IOMEM [=y] && DRM [=y] && DRM_PANEL [=y] && OF [=y] && SPI [=y] && BACKLIGHT_CLASS_DEVICE [=y]

We are suspecting at DRM subsystem call. DRM entry not registered in the /sys/class/DRM. No DRM calls called after probing like st7789v_enable, st7789v_get_modes, st7789v_prepare.

Can you please guide us here, what could be the missing part to enable the DRM subsystem for SPI based LCD? Because we have successfully enabled the with MIPI - DSI based LCD with Q410 platform.

We are waiting for your response.

Regards,
Arjun Salariya

Can you fix the indentation in the post (pre-formatted text either needs to be indented by 4 spaces or wrapped in a delimiter (3 ~ characters works).

This block commenced with ~~~ at the start of a line and ends in the same way.

By the way, did you spot this comment from when the ST7789V driver was upstreamed:

It is controlled through an SPI bus, with a twist, since each byte sent
must be prefixed by a bit, which needs an 9-bits-per-word SPI controller,
which is quite rare. Else, you would need to bitbang it.

I’m not sure if this is compatible with the DB410C. What is the return value from the probe?

Hi Danielt,

We have tried with the ST7789V upstreamed driver as well. However, we are not able to get the DRM initialization. Its failed from "ret = drm_panel_add(&ctx->panel)"

We used 8bit SPI instead of 9bit SPI controller and its working fine with framebuffer stagging driver.

Regards,
Arjun

This call cannot fail. It unconditionally returns success.

Also did you notice that this driver only supports the RGB data bus at present? The upstream driver is a panel only driver that is designed to allow ST7789V to be interfaced via a display controller. It would need to be partnered with a suitable TinyDRM driver to operate in SPI only mode (and such a driver has not yet been written).

This is described in the commit comment:

commit 7142afb3a186ed2cd028318205a4852f04283380
Author: Maxime Ripard <maxime.ripard@free-electrons.com>
Date:   Mon Apr 3 15:38:32 2017 +0200

    drm/panel: Add driver for sitronix ST7789V LCD controller
    
    The Sitronix ST7789v controller is used to drive 240x320 LCD panels through
    various interfaces, including SPI and RGB/Parallel.
    
    The current driver is configuring it for the latter. Support for tinyDRM
    can always be added later.
    
    Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
    Signed-off-by: Thierry Reding <treding@nvidia.com>