Skip to contentSkip to conversation

drm/panel: Support Rocktech jh057n00900 DSI panel

PATCH Superseded Guido Günther 2 participants 6 messages Mar 1, 2019 – Mar 4, 2019

Subsystems (4)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover drm/panel: Support Rocktech jh057n00900 DSI panel

It's a 5.5" 720x1440 TFT LCD MIPI DSI panel with built in touchscreen and backlight as found in the Librem 5 devkit.

These patches are against linux next as of 2019-02-08.

Changes from v1
* As per review comments from Sam Ravnborg
* Make SPDX-License-Identifier match MODULE_LICENSE
* Sort include files alphabetically
* Drop drmP.h and use individual includes
* Drop superfuous 'x' in mode printout on error path
* Allpixelson_set: Add proper space around '*'
* Drop superfluous put_device(&ctx->backlight->dev);
* Add /* Sentinel */ in jh057n_of_match
* Drop jh057n->enabled
* Drop drm_display_info_set_bus_formats
* Kconfig: Depend on BACKLIGHT_CLASS_DEVICE which somehow got lost
* Move jh057n_enable close to jh057n_disable

Guido Günther (3):
dt-bindings: Add vendor prefix for ROCKTECH DISPLAYS LIMITED
dt-bindings: Add Rocktech jh057n00900 panel bindings drm/panel: Add Rocktech jh057n00900 panel driver

 .../display/panel/rocktech,jh057n00900.txt    |  18 +
 .../devicetree/bindings/vendor-prefixes.txt   |   1 +
 drivers/gpu/drm/panel/Kconfig                 |  13 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 .../drm/panel/panel-rocktech-jh057n00900.c    | 385 ++++++++++++++++++
 5 files changed, 418 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
 create mode 100644 drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
Signature · 6 lines
2.20.1

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

PATCH v2 1/3 dt-bindings: Add vendor prefix for ROCKTECH DISPLAYS LIMITED

Add ROCKTECH DISPLAYS LIMITED (https://rocktech.com.hk) LCD panel supplier.

---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
index 413c6f30ce88..cc24619a4249 100644
@@ -338,6 +338,7 @@ ricoh	Ricoh Co. Ltd.
 rikomagic	Rikomagic Tech Corp. Ltd
 riscv	RISC-V Foundation
 rockchip	Fuzhou Rockchip Electronics Co., Ltd
+rocktech	ROCKTECH DISPLAYS LIMITED
 rohm	ROHM Semiconductor Co., Ltd
 roofull	Shenzhen Roofull Technology Co, Ltd
 samsung	Samsung Semiconductor
Signature · 6 lines
2.20.1

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

PATCH v2 2/3 dt-bindings: Add Rocktech jh057n00900 panel bindings

In reply to Guido Günther

The Rocktec jh057n00900 is a 5.5" MIPI DSI video mode panel with a 720x1440 resolution and a built in backlight.

---
 .../display/panel/rocktech,jh057n00900.txt     | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt new file +18 -0
new file mode 100644
index 000000000000..32f4001d2d6f
@@ -0,0 +1,18 @@
+Rocktech jh057n00900 5.5" 720x1440 TFT LCD panel
+
+Required properties:
+- compatible: should be "rocktech,jh057n00900"
+- reg: DSI virtual channel of the peripheral
+- reset-gpios: panel reset gpio
+- backlight: phandle of the backlight device attached to the panel
+
+Example:
+
+	&mipi_dsi {
+		panel {
+			compatible = "rocktech,jh057n00900";
+			reg = <0>;
+			backlight = <&backlight>;
+			reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>;
+		};
+	};
Signature · 6 lines
2.20.1

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

PATCH v2 3/3 drm/panel: Add Rocktech jh057n00900 panel driver

In reply to Guido Günther

Support Rocktech jh057n00900 5.5" 720x1440 TFT LCD panel. It is a MIPI DSI video mode panel.

The panel seems to use a Sitronix ST7703 look alike (most of the commands look similar to the ST7703's data sheet but use a different number of parameters). The initial version of the DSI init sequence (including sleeps) were provided by the vendor. Sleeps were reduced considerably though to speed up initialization.

---
 drivers/gpu/drm/panel/Kconfig                 |  13 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 .../drm/panel/panel-rocktech-jh057n00900.c    | 385 ++++++++++++++++++
 3 files changed, 399 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
drivers/gpu/drm/panel/Kconfig +13 -0
index 3e070153ef21..42f541fe57ae 100644
@@ -149,6 +149,19 @@ config DRM_PANEL_RAYDIUM_RM68200
 	  Say Y here if you want to enable support for Raydium RM68200
 	  720x1280 DSI video mode panel.
 
+config DRM_PANEL_ROCKTECH_JH057N00900
+	tristate "Rocktech JH057N00900 MIPI touchscreen panel"
+	depends on OF
+	depends on DRM_MIPI_DSI
+	depends on BACKLIGHT_CLASS_DEVICE
+	help
+	  Say Y here if you want to enable support for Rocktech JH057N00900
+	  MIPI DSI panel as e.g. used in the Librem 5 devkit. It has a
+	  resolution of 720x1440 pixels, a built in backlight and touch
+	  controller.
+	  Touch input support is provided by the goodix driver and needs to be
+	  selected separately.
+
 config DRM_PANEL_SAMSUNG_S6D16D0
 	tristate "Samsung S6D16D0 DSI video mode panel"
 	depends on OF
drivers/gpu/drm/panel/Makefile +1 -0
index e7ab71968bbf..902e871059d0 100644
@@ -13,6 +13,7 @@ obj-$(CONFIG_DRM_PANEL_ORISETECH_OTM8009A) += panel-orisetech-otm8009a.o
 obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += panel-panasonic-vvx10f034n00.o
 obj-$(CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN) += panel-raspberrypi-touchscreen.o
 obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o
+obj-$(CONFIG_DRM_PANEL_ROCKTECH_JH057N00900) += panel-rocktech-jh057n00900.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D16D0) += panel-samsung-s6d16d0.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c new file +385 -0

385 lines not on this page · raw message

Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v2 3/3
#4 lore raw

Re: [PATCH v2 3/3] drm/panel: Add Rocktech jh057n00900 panel driver

Hi Guido.

Thanks for addressing review comments in first round. Just a few nits in this follow-up.
With these nits addressed:

Quoted 1 line · Guido Günther

+#include <video/display_timing.h>

This include file is, as far as I could tell, no longer used and can be dropped.

drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c line 217

Quoted 11 lines
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c new file +11 -0
+
+static int jh057n_get_modes(struct drm_panel *panel)
+{
+	struct drm_display_mode *mode;
+
+	mode = drm_mode_duplicate(panel->drm, &default_mode);
+	if (!mode) {
+		DRM_ERROR("Failed to add mode %ux%u@%u",
+			  default_mode.hdisplay, default_mode.vdisplay,
+			  default_mode.vrefresh);
+		return -ENOMEM;

Use DRM_DEV_ERROR()
You can find dev via: panel->base.drm-dev

Quoted 37 lines
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c new file +37 -0
+
+static int jh057n_probe(struct mipi_dsi_device *dsi)
+{
+	struct device *dev = &dsi->dev;
+	struct jh057n *ctx;
+	int ret;
+
+	ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
+	if (!ctx)
+		return -ENOMEM;
+
+	ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
+	if (IS_ERR(ctx->reset_gpio)) {
+		DRM_DEV_ERROR(dev, "cannot get reset gpio");
+		return PTR_ERR(ctx->reset_gpio);
+	}
+
+	mipi_dsi_set_drvdata(dsi, ctx);
+
+	ctx->dev = dev;
+
+	dsi->lanes = 4;
+	dsi->format = MIPI_DSI_FMT_RGB888;
+	dsi->mode_flags = MIPI_DSI_MODE_VIDEO |
+		MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_VIDEO_SYNC_PULSE;
+
+	ctx->backlight = devm_of_find_backlight(dev);
+	if (IS_ERR(ctx->backlight))
+		return PTR_ERR(ctx->backlight);
+
+	drm_panel_init(&ctx->panel);
+	ctx->panel.dev = dev;
+	ctx->panel.funcs = &jh057n_drm_funcs;
+
+	drm_panel_add(&ctx->panel);
+
+	ret = mipi_dsi_attach(dsi);

drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c line 325

Quoted 10 lines
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c new file +10 -0
+	if (ret < 0) {
+		DRM_DEV_ERROR(dev, "mipi_dsi_attach failed. Is host ready?");
+		drm_panel_remove(&ctx->panel);
+		return ret;
+	}
+
+	DRM_INFO(DRV_NAME "_panel %ux%u@%u %ubpp dsi %udl - ready",
+		 default_mode.hdisplay, default_mode.vdisplay,
+		 default_mode.vrefresh,
+		 mipi_dsi_pixel_format_to_bpp(dsi->format), dsi->lanes);

You already have dev, so use DRM_DEV_INFO() and drop DRV_NAME

drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c line 368

Quoted 4 lines
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c new file +4 -0
+
+static const struct of_device_id jh057n_of_match[] = {
+	{ .compatible = "rocktech,jh057n00900" },
+	{ /* Sentinel */ }

Lower case 's' (sorry, likely my bad)

drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c line 377

Quoted 5 lines
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c new file +5 -0
+	.probe	= jh057n_probe,
+	.remove = jh057n_remove,
+	.shutdown = jh057n_shutdown,
+	.driver = {
+		.name = DRV_NAME "_panel",

Drop "_panel" postfix. Other drivers do not use it.

Sam

#5 lore raw

Re: [PATCH v2 3/3] drm/panel: Add Rocktech jh057n00900 panel driver

Hi,

Quoted 6 lines · Sam Ravnborg

Hi Guido.

Thanks for addressing review comments in first round. Just a few nits in this follow-up.
With these nits addressed:

Thanks! I made all the suggested changes in v3, on top of that I prepended 'panel-rockteck-' to the driver name to be more consistent with other drivers.
-- Guido

Quoted 85 lines · Guido Günther
Quoted 2 lines

+#include <video/display_timing.h>

This include file is, as far as I could tell, no longer used and can be dropped.

drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c line 217

Quoted 11 lines
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c new file +11 -0
+
+static int jh057n_get_modes(struct drm_panel *panel)
+{
+	struct drm_display_mode *mode;
+
+	mode = drm_mode_duplicate(panel->drm, &default_mode);
+	if (!mode) {
+		DRM_ERROR("Failed to add mode %ux%u@%u",
+			  default_mode.hdisplay, default_mode.vdisplay,
+			  default_mode.vrefresh);
+		return -ENOMEM;

Use DRM_DEV_ERROR()
You can find dev via: panel->base.drm-dev

Quoted 37 lines
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c new file +37 -0
+
+static int jh057n_probe(struct mipi_dsi_device *dsi)
+{
+	struct device *dev = &dsi->dev;
+	struct jh057n *ctx;
+	int ret;
+
+	ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
+	if (!ctx)
+		return -ENOMEM;
+
+	ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
+	if (IS_ERR(ctx->reset_gpio)) {
+		DRM_DEV_ERROR(dev, "cannot get reset gpio");
+		return PTR_ERR(ctx->reset_gpio);
+	}
+
+	mipi_dsi_set_drvdata(dsi, ctx);
+
+	ctx->dev = dev;
+
+	dsi->lanes = 4;
+	dsi->format = MIPI_DSI_FMT_RGB888;
+	dsi->mode_flags = MIPI_DSI_MODE_VIDEO |
+		MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_VIDEO_SYNC_PULSE;
+
+	ctx->backlight = devm_of_find_backlight(dev);
+	if (IS_ERR(ctx->backlight))
+		return PTR_ERR(ctx->backlight);
+
+	drm_panel_init(&ctx->panel);
+	ctx->panel.dev = dev;
+	ctx->panel.funcs = &jh057n_drm_funcs;
+
+	drm_panel_add(&ctx->panel);
+
+	ret = mipi_dsi_attach(dsi);

drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c line 325

Quoted 10 lines
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c new file +10 -0
+	if (ret < 0) {
+		DRM_DEV_ERROR(dev, "mipi_dsi_attach failed. Is host ready?");
+		drm_panel_remove(&ctx->panel);
+		return ret;
+	}
+
+	DRM_INFO(DRV_NAME "_panel %ux%u@%u %ubpp dsi %udl - ready",
+		 default_mode.hdisplay, default_mode.vdisplay,
+		 default_mode.vrefresh,
+		 mipi_dsi_pixel_format_to_bpp(dsi->format), dsi->lanes);

You already have dev, so use DRM_DEV_INFO() and drop DRV_NAME

drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c line 368

Quoted 4 lines
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c new file +4 -0
+
+static const struct of_device_id jh057n_of_match[] = {
+	{ .compatible = "rocktech,jh057n00900" },
+	{ /* Sentinel */ }

Lower case 's' (sorry, likely my bad)

drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c line 377

Quoted 5 lines
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c new file +5 -0
+	.probe	= jh057n_probe,
+	.remove = jh057n_remove,
+	.shutdown = jh057n_shutdown,
+	.driver = {
+		.name = DRV_NAME "_panel",

Drop "_panel" postfix. Other drivers do not use it.

Sam