Skip to contentSkip to conversation

dt-bindings: panel: Add Sitronix ST7701 panel documentation

PATCH Superseded Jagan Teki 3 participants 12 messages Jan 11, 2019 – Jan 12, 2019

Subsystems (5)

v7 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Jagan Teki

author maintainer
#0 lore raw

PATCH v7 1/2 dt-bindings: panel: Add Sitronix ST7701 panel documentation

Techstar TS8550B MIPI DSI panel is 480x854, 2-lane MIPI DSI LCD panel with inbuilt ST7701 chip.

The default regulator names in ST7701 chip is renamed in Techstar TS8550B so, add specific binding names for them.

---
Changes for v7:
- collect Rob Ack
Changes for v6:
- none

 .../display/panel/sitronix,st7701.txt         | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/sitronix,st7701.txt
Documentation/devicetree/bindings/display/panel/sitronix,st7701.txt new file +30 -0
new file mode 100644
index 000000000000..ccd17597f1f6
@@ -0,0 +1,30 @@
+Sitronix ST7701 based LCD panels
+
+ST7701 designed for small and medium sizes of TFT LCD display, is
+capable of supporting up to 480RGBX864 in resolution. It provides
+several system interfaces like MIPI/RGB/SPI.
+
+Techstar TS8550B is 480x854, 2-lane MIPI DSI LCD panel which has
+inbuilt ST7701 chip.
+
+Required properties:
+- compatible: must be "sitronix,st7701" and one of
+  * "techstar,ts8550b"
+- reset-gpios: a GPIO phandle for the reset pin
+
+Required properties for techstar,ts8550b:
+- reg: DSI virtual channel used by that screen
+- VCC-supply: analog regulator for MIPI circuit
+- IOVCC-supply: I/O system regulator
+
+Optional properties:
+- backlight: phandle for the backlight control.
+
+panel@0 {
+	compatible = "techstar,ts8550b", "sitronix,st7701";
+	reg = <0>;
+	VCC-supply = <&reg_dldo2>;
+	IOVCC-supply = <&reg_dldo2>;
+	reset-gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* LCD-RST: PD24 */
+	backlight = <&backlight>;
+};
Signature · 6 lines
2.18.0.321.gffc6fa0e3

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

PATCH v7 2/2 drm/panel: Add Sitronix ST7701 panel driver

ST7701 designed for small and medium sizes of TFT LCD display, is capable of supporting up to 480RGBX864 in resolution. It provides several system interfaces like MIPI/RGB/SPI.

Currently added support for Techstar TS8550B which is ST7701 based 480x854, 2-lane MIPI DSI LCD panel.

Driver now registering mipi_dsi device, but indeed it can extendable for RGB if any requirement trigger in future.

---
Changes for v7:
- rebase on master
Changes for v6:
- use sleep delay value as per datasheet
- add panel_sleep_delay variable for panel specific delay
- use command sequnce display on and off instead panel functions
- add proper comments on the delays
- remove delays from command switch
- move mode type on struct display mode
- drop refresh rate value, let drm compute Changes for v5:
- found the chip from vendor, so added new panel driver
- here is v4: https://patchwork.kernel.org/patch/10680335/

 MAINTAINERS                                   |   6 +
 drivers/gpu/drm/panel/Kconfig                 |  10 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 drivers/gpu/drm/panel/panel-sitronix-st7701.c | 427 ++++++++++++++++++
 4 files changed, 444 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-sitronix-st7701.c
MAINTAINERS +6 -0
index 3f6db876be1f..d2928a4d2847 100644
@@ -4831,6 +4831,12 @@ S:	Orphan / Obsolete
 F:	drivers/gpu/drm/sis/
 F:	include/uapi/drm/sis_drm.h
 
+DRM DRIVER FOR SITRONIX ST7701 PANELS
+M:	Jagan Teki <[email protected]>
+S:	Maintained
+F:	drivers/gpu/drm/panel/panel-sitronix-st7701.c
+F:	Documentation/devicetree/bindings/display/panel/sitronix,st7701.txt
+
 DRM DRIVER FOR SITRONIX ST7586 PANELS
 M:	David Lechner <[email protected]>
 S:	Maintained
drivers/gpu/drm/panel/Kconfig +10 -0
index 3f3537719beb..d93b2ba709bc 100644
@@ -196,6 +196,16 @@ config DRM_PANEL_SHARP_LS043T1LE01
 	  Say Y here if you want to enable support for Sharp LS043T1LE01 qHD
 	  (540x960) DSI panel as found on the Qualcomm APQ8074 Dragonboard
 
+config DRM_PANEL_SITRONIX_ST7701
+	tristate "Sitronix ST7701 panel driver"
+	depends on OF
+	depends on DRM_MIPI_DSI
+	depends on BACKLIGHT_CLASS_DEVICE
+	help
+	  Say Y here if you want to enable support for the Sitronix
+	  ST7701 controller for 480X864 LCD panels with MIPI/RGB/SPI
+	  system interfaces.
+
 config DRM_PANEL_SITRONIX_ST7789V
 	tristate "Sitronix ST7789V panel"
 	depends on OF && SPI
drivers/gpu/drm/panel/Makefile +1 -0
index 4396658a7996..6a9b4cec1891 100644
@@ -20,5 +20,6 @@ obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0) += panel-samsung-s6e8aa0.o
 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_ST7701) += panel-sitronix-st7701.o
 obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o
 obj-$(CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA) += panel-truly-nt35597.o
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +427 -0

427 lines not on this page · raw message

Signature · 6 lines
2.18.0.321.gffc6fa0e3

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

Re: [PATCH V7 2/2] drm/panel: Add Sitronix ST7701 panel driver

Hi Jagan.

Gave this another more detailed read - triggered some additional comments. Depite the comments it looks good, and this is all more or less cosmetic improvements.

Sam

Quoted 8 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +8 -0
+struct st7701_panel_desc {
+	const struct drm_display_mode *mode;
+	unsigned int lanes;
+	unsigned long flags;
+	enum mipi_dsi_pixel_format format;
+	const char *const *supply_names;
+	unsigned int num_supplies;
+	unsigned int panel_sleep_delay;

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 108

Quoted 10 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +10 -0
+};
+
+struct st7701 {
+	struct drm_panel panel;
+	struct mipi_dsi_device *dsi;
+	const struct st7701_panel_desc *desc;
+
+	struct backlight_device *backlight;
+	struct regulator_bulk_data *supplies;
+	unsigned int num_supplies;

I cannot see that num_supplies in this struct are used?

Quoted 49 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +46 -0
+	struct gpio_desc *reset;
+	unsigned int sleep_delay;
+};
+
+static inline struct st7701 *panel_to_st7701(struct drm_panel *panel)
+{
+	return container_of(panel, struct st7701, panel);
+}
+
+static inline int st7701_dsi_write(struct st7701 *st7701, const void *seq,
+				   size_t len)
+{
+	return mipi_dsi_dcs_write_buffer(st7701->dsi, seq, len);
+}
+
 
 
+static int st7701_prepare(struct drm_panel *panel)
+{
+	struct st7701 *st7701 = panel_to_st7701(panel);
+	int ret;
+
+	gpiod_set_value(st7701->reset, 0);
+	msleep(20);
+
+	ret = regulator_bulk_enable(st7701->desc->num_supplies,
+				    st7701->supplies);
+	if (ret < 0)
+		return ret;
+	msleep(20);
+
+	gpiod_set_value(st7701->reset, 1);
+	msleep(20);
+
+	gpiod_set_value(st7701->reset, 0);
+	msleep(30);
+
+	gpiod_set_value(st7701->reset, 1);
+	msleep(150);
+
+	st7701_init_sequence(st7701);
+
+	return 0;
+}
+
 
+static int st7701_unprepare(struct drm_panel *panel)
+{
+	struct st7701 *st7701 = panel_to_st7701(panel);

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 261

Quoted 10 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +10 -0
+
+	ST7701_DSI(st7701, MIPI_DCS_EXIT_SLEEP_MODE, 0x00);
+
+	msleep(st7701->sleep_delay);
+
+	gpiod_set_value(st7701->reset, 0);
+
+	gpiod_set_value(st7701->reset, 1);
+
+	gpiod_set_value(st7701->reset, 0);

No timing constrains here? In prepare there are sleeps intermixed.

Quoted 7 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +7 -0
+
+	regulator_bulk_disable(st7701->desc->num_supplies, st7701->supplies);
+
+	return 0;
+}
+
+static int st7701_get_modes(struct drm_panel *panel)

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 278

Quoted 10 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +10 -0
+{
+	struct st7701 *st7701 = panel_to_st7701(panel);
+	const struct drm_display_mode *desc_mode = st7701->desc->mode;
+	struct drm_display_mode *mode;
+
+	mode = drm_mode_duplicate(panel->drm, desc_mode);
+	if (!mode) {
+		dev_err(&st7701->dsi->dev, "failed to add mode %ux%ux@%u\n",
+			desc_mode->hdisplay, desc_mode->vdisplay,
+			desc_mode->vrefresh);

Use something like:

		DRM_DEV_ERROR(st7701->dev, "failed to add mode" DRM_MODE_FMT ",
			      DRM_MODE_ARG(desc_mode));
Quoted 11 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +11 -0
+		return -ENOMEM;
+	}
+
+	drm_mode_set_name(mode);
+	drm_mode_probed_add(panel->connector, mode);
+
+	panel->connector->display_info.width_mm = desc_mode->width_mm;
+	panel->connector->display_info.height_mm = desc_mode->height_mm;
+
+	return 1;
+}

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 330

Quoted 10 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +9 -0
+
 
+static const struct st7701_panel_desc ts8550b_desc = {
+	.mode = &ts8550b_mode,
+	.lanes = 2,
+	.flags = MIPI_DSI_MODE_VIDEO,
+	.format = MIPI_DSI_FMT_RGB888,
+	.supply_names = ts8550b_supply_names,
+	.num_supplies = ARRAY_SIZE(ts8550b_supply_names),
+	.panel_sleep_delay = 80, /* panel need extra 80ms for sleep out cmd */

In the only place this is used there is added 120 ms too. Looks inconsistent - do we have the same delay twice?

Quoted 35 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +35 -0
+
+static int st7701_dsi_probe(struct mipi_dsi_device *dsi)
+{
+	const struct st7701_panel_desc *desc;
+	struct device_node *np;
+	struct st7701 *st7701;
+	int ret, i;
+
+	st7701 = devm_kzalloc(&dsi->dev, sizeof(*st7701), GFP_KERNEL);
+	if (!st7701)
+		return -ENOMEM;
+
+	desc = of_device_get_match_data(&dsi->dev);
+	dsi->mode_flags = desc->flags;
+	dsi->format = desc->format;
+	dsi->lanes = desc->lanes;
+
+	st7701->supplies = devm_kcalloc(&dsi->dev, desc->num_supplies,
+					sizeof(*st7701->supplies),
+					GFP_KERNEL);
+	if (!st7701->supplies)
+		return -ENOMEM;
+
+	for (i = 0; i < desc->num_supplies; i++)
+		st7701->supplies[i].supply = desc->supply_names[i];
+
+	ret = devm_regulator_bulk_get(&dsi->dev, desc->num_supplies,
+				      st7701->supplies);
+	if (ret < 0)
+		return ret;
+
+	st7701->reset = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
+	if (IS_ERR(st7701->reset)) {
+		dev_err(&dsi->dev, "Couldn't get our reset GPIO\n");
+		return PTR_ERR(st7701->reset);

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 376

Quoted 10 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +10 -0
+	}
+
+	np = of_parse_phandle(dsi->dev.of_node, "backlight", 0);
+	if (np) {
+		st7701->backlight = of_find_backlight_by_node(np);
+		of_node_put(np);
+
+		if (!st7701->backlight)
+			return -EPROBE_DEFER;
+	}

This is a simpler variant of the above:

	st7701->backlight = devm_of_find_backlight(dsi->dev);
	if (IS_ERR(st7701->backlight))
		return PTR_ERR(st7701->backlight);

Suggested by Noralf in another thread for a similar driver.

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 381

Quoted 5 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +5 -0
+
+	drm_panel_init(&st7701->panel);
+
+	/* We need to wait 120ms after a sleep out command */
+	st7701->sleep_delay = 120 + desc->panel_sleep_delay;

This is the other place where we add 120 to the previous 80 - in total 200 ms.

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 391

Quoted 11 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +10 -0
+	st7701->panel.funcs = &st7701_funcs;
+	st7701->panel.dev = &dsi->dev;
+
+	ret = drm_panel_add(&st7701->panel);
+	if (ret < 0)
+		return ret;
+
+	mipi_dsi_set_drvdata(dsi, st7701);
+	st7701->dsi = dsi;
 
+	st7701->desc = desc;

This assignment could come earlier, so we do not have it unassigned when calling other functions. As it is now it works so you can safely ignore this comment.

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 404

Quoted 13 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +13 -0
+
+	return mipi_dsi_attach(dsi);
+}
+
+static int st7701_dsi_remove(struct mipi_dsi_device *dsi)
+{
+	struct st7701 *st7701 = mipi_dsi_get_drvdata(dsi);
+
+	mipi_dsi_detach(dsi);
+	drm_panel_remove(&st7701->panel);
+
+	if (st7701->backlight)
+		put_device(&st7701->backlight->dev);

Use:

	backlight_put(st7701->backlight);

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

#3 lore raw

Re: [PATCH V7 2/2] drm/panel: Add Sitronix ST7701 panel driver

Den 11.01.2019 22.19, skrev Sam Ravnborg:

Quoted 225 lines

Hi Jagan.

Gave this another more detailed read - triggered some additional comments. Depite the comments it looks good, and this is all more or less cosmetic improvements.

Sam

Quoted 8 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +8 -0
+struct st7701_panel_desc {
+	const struct drm_display_mode *mode;
+	unsigned int lanes;
+	unsigned long flags;
+	enum mipi_dsi_pixel_format format;
+	const char *const *supply_names;
+	unsigned int num_supplies;
+	unsigned int panel_sleep_delay;

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 108

Quoted 10 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +10 -0
+};
+
+struct st7701 {
+	struct drm_panel panel;
+	struct mipi_dsi_device *dsi;
+	const struct st7701_panel_desc *desc;
+
+	struct backlight_device *backlight;
+	struct regulator_bulk_data *supplies;
+	unsigned int num_supplies;

I cannot see that num_supplies in this struct are used?

Quoted 49 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +46 -0
+	struct gpio_desc *reset;
+	unsigned int sleep_delay;
+};
+
+static inline struct st7701 *panel_to_st7701(struct drm_panel *panel)
+{
+	return container_of(panel, struct st7701, panel);
+}
+
+static inline int st7701_dsi_write(struct st7701 *st7701, const void *seq,
+				   size_t len)
+{
+	return mipi_dsi_dcs_write_buffer(st7701->dsi, seq, len);
+}
+
 
 
+static int st7701_prepare(struct drm_panel *panel)
+{
+	struct st7701 *st7701 = panel_to_st7701(panel);
+	int ret;
+
+	gpiod_set_value(st7701->reset, 0);
+	msleep(20);
+
+	ret = regulator_bulk_enable(st7701->desc->num_supplies,
+				    st7701->supplies);
+	if (ret < 0)
+		return ret;
+	msleep(20);
+
+	gpiod_set_value(st7701->reset, 1);
+	msleep(20);
+
+	gpiod_set_value(st7701->reset, 0);
+	msleep(30);
+
+	gpiod_set_value(st7701->reset, 1);
+	msleep(150);
+
+	st7701_init_sequence(st7701);
+
+	return 0;
+}
+
 
+static int st7701_unprepare(struct drm_panel *panel)
+{
+	struct st7701 *st7701 = panel_to_st7701(panel);

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 261

Quoted 10 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +10 -0
+
+	ST7701_DSI(st7701, MIPI_DCS_EXIT_SLEEP_MODE, 0x00);
+
+	msleep(st7701->sleep_delay);
+
+	gpiod_set_value(st7701->reset, 0);
+
+	gpiod_set_value(st7701->reset, 1);
+
+	gpiod_set_value(st7701->reset, 0);

No timing constrains here? In prepare there are sleeps intermixed.

Quoted 7 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +7 -0
+
+	regulator_bulk_disable(st7701->desc->num_supplies, st7701->supplies);
+
+	return 0;
+}
+
+static int st7701_get_modes(struct drm_panel *panel)

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 278

Quoted 10 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +10 -0
+{
+	struct st7701 *st7701 = panel_to_st7701(panel);
+	const struct drm_display_mode *desc_mode = st7701->desc->mode;
+	struct drm_display_mode *mode;
+
+	mode = drm_mode_duplicate(panel->drm, desc_mode);
+	if (!mode) {
+		dev_err(&st7701->dsi->dev, "failed to add mode %ux%ux@%u\n",
+			desc_mode->hdisplay, desc_mode->vdisplay,
+			desc_mode->vrefresh);

Use something like:

		DRM_DEV_ERROR(st7701->dev, "failed to add mode" DRM_MODE_FMT ",
			      DRM_MODE_ARG(desc_mode));
Quoted 11 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +11 -0
+		return -ENOMEM;
+	}
+
+	drm_mode_set_name(mode);
+	drm_mode_probed_add(panel->connector, mode);
+
+	panel->connector->display_info.width_mm = desc_mode->width_mm;
+	panel->connector->display_info.height_mm = desc_mode->height_mm;
+
+	return 1;
+}

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 330

Quoted 10 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +9 -0
+
 
+static const struct st7701_panel_desc ts8550b_desc = {
+	.mode = &ts8550b_mode,
+	.lanes = 2,
+	.flags = MIPI_DSI_MODE_VIDEO,
+	.format = MIPI_DSI_FMT_RGB888,
+	.supply_names = ts8550b_supply_names,
+	.num_supplies = ARRAY_SIZE(ts8550b_supply_names),
+	.panel_sleep_delay = 80, /* panel need extra 80ms for sleep out cmd */

In the only place this is used there is added 120 ms too. Looks inconsistent - do we have the same delay twice?

Quoted 35 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +35 -0
+
+static int st7701_dsi_probe(struct mipi_dsi_device *dsi)
+{
+	const struct st7701_panel_desc *desc;
+	struct device_node *np;
+	struct st7701 *st7701;
+	int ret, i;
+
+	st7701 = devm_kzalloc(&dsi->dev, sizeof(*st7701), GFP_KERNEL);
+	if (!st7701)
+		return -ENOMEM;
+
+	desc = of_device_get_match_data(&dsi->dev);
+	dsi->mode_flags = desc->flags;
+	dsi->format = desc->format;
+	dsi->lanes = desc->lanes;
+
+	st7701->supplies = devm_kcalloc(&dsi->dev, desc->num_supplies,
+					sizeof(*st7701->supplies),
+					GFP_KERNEL);
+	if (!st7701->supplies)
+		return -ENOMEM;
+
+	for (i = 0; i < desc->num_supplies; i++)
+		st7701->supplies[i].supply = desc->supply_names[i];
+
+	ret = devm_regulator_bulk_get(&dsi->dev, desc->num_supplies,
+				      st7701->supplies);
+	if (ret < 0)
+		return ret;
+
+	st7701->reset = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
+	if (IS_ERR(st7701->reset)) {
+		dev_err(&dsi->dev, "Couldn't get our reset GPIO\n");
+		return PTR_ERR(st7701->reset);

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 376

Quoted 10 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +10 -0
+	}
+
+	np = of_parse_phandle(dsi->dev.of_node, "backlight", 0);
+	if (np) {
+		st7701->backlight = of_find_backlight_by_node(np);
+		of_node_put(np);
+
+		if (!st7701->backlight)
+			return -EPROBE_DEFER;
+	}

This is a simpler variant of the above:

	st7701->backlight = devm_of_find_backlight(dsi->dev);
	if (IS_ERR(st7701->backlight))
		return PTR_ERR(st7701->backlight);

Suggested by Noralf in another thread for a similar driver.

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 381

Quoted 5 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +5 -0
+
+	drm_panel_init(&st7701->panel);
+
+	/* We need to wait 120ms after a sleep out command */
+	st7701->sleep_delay = 120 + desc->panel_sleep_delay;

This is the other place where we add 120 to the previous 80 - in total 200 ms.

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 391

Quoted 11 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +10 -0
+	st7701->panel.funcs = &st7701_funcs;
+	st7701->panel.dev = &dsi->dev;
+
+	ret = drm_panel_add(&st7701->panel);
+	if (ret < 0)
+		return ret;
+
+	mipi_dsi_set_drvdata(dsi, st7701);
+	st7701->dsi = dsi;
 
+	st7701->desc = desc;

This assignment could come earlier, so we do not have it unassigned when calling other functions. As it is now it works so you can safely ignore this comment.

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 404

Quoted 13 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +13 -0
+
+	return mipi_dsi_attach(dsi);
+}
+
+static int st7701_dsi_remove(struct mipi_dsi_device *dsi)
+{
+	struct st7701 *st7701 = mipi_dsi_get_drvdata(dsi);
+
+	mipi_dsi_detach(dsi);
+	drm_panel_remove(&st7701->panel);
+
+	if (st7701->backlight)
+		put_device(&st7701->backlight->dev);

Use:

Quoted 1 line
	backlight_put(st7701->backlight);

This happens automatically on driver detach if devm_of_find_backlight() is used

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

author maintainer
#4 lore raw

Re: [PATCH V7 2/2] drm/panel: Add Sitronix ST7701 panel driver

In reply to Sam Ravnborg
Quoted 6 lines · Sam Ravnborg

Hi Jagan.

Gave this another more detailed read - triggered some additional comments. Depite the comments it looks good, and this is all more or less cosmetic improvements.

Thanks for the review.

Quoted 14 lines

Sam

Quoted 11 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +11 -0
+struct st7701_panel_desc {
+     const struct drm_display_mode *mode;
+     unsigned int lanes;
+     unsigned long flags;
+     enum mipi_dsi_pixel_format format;
+     const char *const *supply_names;
+     unsigned int num_supplies;
+     unsigned int panel_sleep_delay;
+};
+
+struct st7701 {
Quoted 8 lines

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 108

Quoted 7 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +7 -0
+     struct drm_panel panel;
+     struct mipi_dsi_device *dsi;
+     const struct st7701_panel_desc *desc;
+
+     struct backlight_device *backlight;
+     struct regulator_bulk_data *supplies;
+     unsigned int num_supplies;

I cannot see that num_supplies in this struct are used?

Yes it is used in the code, please check in struct st7701_panel_desc.

Quoted 48 lines
Quoted 47 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +43 -0
+     struct gpio_desc *reset;
+     unsigned int sleep_delay;
+};
+
+static inline struct st7701 *panel_to_st7701(struct drm_panel *panel)
+{
+     return container_of(panel, struct st7701, panel);
+}
+
+static inline int st7701_dsi_write(struct st7701 *st7701, const void *seq,
+                                size_t len)
+{
+     return mipi_dsi_dcs_write_buffer(st7701->dsi, seq, len);
+}
+
 
 
+static int st7701_prepare(struct drm_panel *panel)
+{
+     struct st7701 *st7701 = panel_to_st7701(panel);
+     int ret;
+
+     gpiod_set_value(st7701->reset, 0);
+     msleep(20);
+
+     ret = regulator_bulk_enable(st7701->desc->num_supplies,
+                                 st7701->supplies);
+     if (ret < 0)
+             return ret;
+     msleep(20);
+
+     gpiod_set_value(st7701->reset, 1);
+     msleep(20);
+
+     gpiod_set_value(st7701->reset, 0);
+     msleep(30);
+
+     gpiod_set_value(st7701->reset, 1);
+     msleep(150);
+
+     st7701_init_sequence(st7701);
+
+     return 0;
+}
+
Quoted 14 lines

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 261

Quoted 13 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +13 -0
+static int st7701_unprepare(struct drm_panel *panel)
+{
+     struct st7701 *st7701 = panel_to_st7701(panel);
+
+     ST7701_DSI(st7701, MIPI_DCS_EXIT_SLEEP_MODE, 0x00);
+
+     msleep(st7701->sleep_delay);
+
+     gpiod_set_value(st7701->reset, 0);
+
+     gpiod_set_value(st7701->reset, 1);
+
+     gpiod_set_value(st7701->reset, 0);

No timing constrains here? In prepare there are sleeps intermixed.

Delay while doing unprare is not needed I suppose.

Quoted 43 lines
Quoted 8 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +7 -0
+
+     regulator_bulk_disable(st7701->desc->num_supplies, st7701->supplies);
+
+     return 0;
+}
+
+static int st7701_get_modes(struct drm_panel *panel)

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 278

Quoted 10 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +10 -0
+{
+     struct st7701 *st7701 = panel_to_st7701(panel);
+     const struct drm_display_mode *desc_mode = st7701->desc->mode;
+     struct drm_display_mode *mode;
+
+     mode = drm_mode_duplicate(panel->drm, desc_mode);
+     if (!mode) {
+             dev_err(&st7701->dsi->dev, "failed to add mode %ux%ux@%u\n",
+                     desc_mode->hdisplay, desc_mode->vdisplay,
+                     desc_mode->vrefresh);

Use something like:

                DRM_DEV_ERROR(st7701->dev, "failed to add mode" DRM_MODE_FMT ",
                              DRM_MODE_ARG(desc_mode));
Quoted 11 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +11 -0
+             return -ENOMEM;
+     }
+
+     drm_mode_set_name(mode);
+     drm_mode_probed_add(panel->connector, mode);
+
+     panel->connector->display_info.width_mm = desc_mode->width_mm;
+     panel->connector->display_info.height_mm = desc_mode->height_mm;
+
+     return 1;
+}

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 330

Quoted 10 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +9 -0
+
 
+static const struct st7701_panel_desc ts8550b_desc = {
+     .mode = &ts8550b_mode,
+     .lanes = 2,
+     .flags = MIPI_DSI_MODE_VIDEO,
+     .format = MIPI_DSI_FMT_RGB888,
+     .supply_names = ts8550b_supply_names,
+     .num_supplies = ARRAY_SIZE(ts8550b_supply_names),
+     .panel_sleep_delay = 80, /* panel need extra 80ms for sleep out cmd */
Quoted 2 lines

In the only place this is used there is added 120 ms too. Looks inconsistent - do we have the same delay twice?

120ms is the one recommended by st7701 controller delay after a sleep out command, please check it in datasheet [1], page 188. And this 80ms is specific to TS8550B panel as per BSP code this doesn't have proper documentation but the BSP code doing this extra 80ms.

Quoted 55 lines
Quoted 37 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +35 -0
+
+static int st7701_dsi_probe(struct mipi_dsi_device *dsi)
+{
+     const struct st7701_panel_desc *desc;
+     struct device_node *np;
+     struct st7701 *st7701;
+     int ret, i;
+
+     st7701 = devm_kzalloc(&dsi->dev, sizeof(*st7701), GFP_KERNEL);
+     if (!st7701)
+             return -ENOMEM;
+
+     desc = of_device_get_match_data(&dsi->dev);
+     dsi->mode_flags = desc->flags;
+     dsi->format = desc->format;
+     dsi->lanes = desc->lanes;
+
+     st7701->supplies = devm_kcalloc(&dsi->dev, desc->num_supplies,
+                                     sizeof(*st7701->supplies),
+                                     GFP_KERNEL);
+     if (!st7701->supplies)
+             return -ENOMEM;
+
+     for (i = 0; i < desc->num_supplies; i++)
+             st7701->supplies[i].supply = desc->supply_names[i];
+
+     ret = devm_regulator_bulk_get(&dsi->dev, desc->num_supplies,
+                                   st7701->supplies);
+     if (ret < 0)
+             return ret;
+
+     st7701->reset = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
+     if (IS_ERR(st7701->reset)) {
+             dev_err(&dsi->dev, "Couldn't get our reset GPIO\n");
+             return PTR_ERR(st7701->reset);

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 376

Quoted 10 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +10 -0
+     }
+
+     np = of_parse_phandle(dsi->dev.of_node, "backlight", 0);
+     if (np) {
+             st7701->backlight = of_find_backlight_by_node(np);
+             of_node_put(np);
+
+             if (!st7701->backlight)
+                     return -EPROBE_DEFER;
+     }

This is a simpler variant of the above:

        st7701->backlight = devm_of_find_backlight(dsi->dev);
        if (IS_ERR(st7701->backlight))
                return PTR_ERR(st7701->backlight);

Suggested by Noralf in another thread for a similar driver.

Quoted 6 lines

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 381

Quoted 5 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +5 -0
+
+     drm_panel_init(&st7701->panel);
+
+     /* We need to wait 120ms after a sleep out command */
+     st7701->sleep_delay = 120 + desc->panel_sleep_delay;

This is the other place where we add 120 to the previous 80 - in total 200 ms.

Please see above comment.

[1] http://www.startek-lcd.com/res/starteklcd/pdres/201705/20170512144242904.pdf
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

Re: [PATCH V7 2/2] drm/panel: Add Sitronix ST7701 panel driver

Hi Jagan.

Quoted 33 lines · Sam Ravnborg
Quoted 6 lines

Hi Jagan.

Gave this another more detailed read - triggered some additional comments. Depite the comments it looks good, and this is all more or less cosmetic improvements.

Thanks for the review.

Quoted 14 lines

Sam

Quoted 11 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +11 -0
+struct st7701_panel_desc {
+     const struct drm_display_mode *mode;
+     unsigned int lanes;
+     unsigned long flags;
+     enum mipi_dsi_pixel_format format;
+     const char *const *supply_names;
+     unsigned int num_supplies;
+     unsigned int panel_sleep_delay;
+};
+
+struct st7701 {
Quoted 8 lines

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 108

Quoted 7 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +7 -0
+     struct drm_panel panel;
+     struct mipi_dsi_device *dsi;
+     const struct st7701_panel_desc *desc;
+
+     struct backlight_device *backlight;
+     struct regulator_bulk_data *supplies;
+     unsigned int num_supplies;

I cannot see that num_supplies in this struct are used?

Quoted 1 line

Yes it is used in the code, please check in struct st7701_panel_desc.

I have applied the patch and deleted num_supplies - now build errors. So num_supplies in struct st7701 is not used and should be deleted.

Quoted 29 lines
Quoted 29 lines
Quoted 28 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +28 -0
+static int st7701_prepare(struct drm_panel *panel)
+{
+     struct st7701 *st7701 = panel_to_st7701(panel);
+     int ret;
+
+     gpiod_set_value(st7701->reset, 0);
+     msleep(20);
+
+     ret = regulator_bulk_enable(st7701->desc->num_supplies,
+                                 st7701->supplies);
+     if (ret < 0)
+             return ret;
+     msleep(20);
+
+     gpiod_set_value(st7701->reset, 1);
+     msleep(20);
+
+     gpiod_set_value(st7701->reset, 0);
+     msleep(30);
+
+     gpiod_set_value(st7701->reset, 1);
+     msleep(150);
+
+     st7701_init_sequence(st7701);
+
+     return 0;
+}
+
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 253

Quoted 5 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +5 -0
+static int st7701_unprepare(struct drm_panel *panel)
+{
+     struct st7701 *st7701 = panel_to_st7701(panel);
+
+     ST7701_DSI(st7701, MIPI_DCS_EXIT_SLEEP_MODE, 0x00);

Should this be MIPI_DCS_ENTER_SLEEP_MODE?

Note - you have shortcuts fot the standard commands like in this case:

	mipi_dsi_dcs_enter_sleep_mode(st7701->dsi);

Thay could be introduced in many palces, but I also like how all the commands follows a consistent way to be issued.
So consider this only if this was new for you.

Quoted 11 lines
Quoted 9 lines

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 218

Quoted 8 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +8 -0
+
+     msleep(st7701->sleep_delay);
+
+     gpiod_set_value(st7701->reset, 0);
+
+     gpiod_set_value(st7701->reset, 1);
+
+     gpiod_set_value(st7701->reset, 0);

No timing constrains here? In prepare there are sleeps intermixed.

Delay while doing unprare is not needed I suppose.

If the purpose is alone to reset the display then a single write '0' should do it I think
And there is a requirement that it must be low for a minimum of 10 us which would be good to have here.

I aslo found in chapter 9. (page 163 - second line) this statement:
"VDDA and VDDI must be powered down with minimum 120msec."

This is similar to the unprepare delay to be found in simple-panel.c So an unprepare delay seems in order here.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +8 -0
+static const struct st7701_panel_desc ts8550b_desc = {
+     .mode = &ts8550b_mode,
+     .lanes = 2,
+     .flags = MIPI_DSI_MODE_VIDEO,
+     .format = MIPI_DSI_FMT_RGB888,
+     .supply_names = ts8550b_supply_names,
+     .num_supplies = ARRAY_SIZE(ts8550b_supply_names),
+     .panel_sleep_delay = 80, /* panel need extra 80ms for sleep out cmd */
Quoted 7 lines
Quoted 2 lines

In the only place this is used there is added 120 ms too. Looks inconsistent - do we have the same delay twice?

120ms is the one recommended by st7701 controller delay after a sleep out command, please check it in datasheet [1], page 188. And this 80ms is specific to TS8550B panel as per BSP code this doesn't have proper documentation but the BSP code doing this extra 80ms.

OK, thanks for the pointer to the datasheet.

Quoted 1 line

[1] http://www.startek-lcd.com/res/starteklcd/pdres/201705/20170512144242904.pdf

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

author maintainer
#6 lore raw

Re: [PATCH V7 2/2] drm/panel: Add Sitronix ST7701 panel driver

Quoted 36 lines · Sam Ravnborg

Hi Jagan.

Quoted 33 lines · Sam Ravnborg
Quoted 6 lines

Hi Jagan.

Gave this another more detailed read - triggered some additional comments. Depite the comments it looks good, and this is all more or less cosmetic improvements.

Thanks for the review.

Quoted 22 lines

Sam

Quoted 8 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +8 -0
+struct st7701_panel_desc {
+     const struct drm_display_mode *mode;
+     unsigned int lanes;
+     unsigned long flags;
+     enum mipi_dsi_pixel_format format;
+     const char *const *supply_names;
+     unsigned int num_supplies;
+     unsigned int panel_sleep_delay;

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 108

Quoted 10 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +10 -0
+};
+
+struct st7701 {
+     struct drm_panel panel;
+     struct mipi_dsi_device *dsi;
+     const struct st7701_panel_desc *desc;
+
+     struct backlight_device *backlight;
+     struct regulator_bulk_data *supplies;
+     unsigned int num_supplies;

I cannot see that num_supplies in this struct are used?

Quoted 3 lines
Quoted 1 line

Yes it is used in the code, please check in struct st7701_panel_desc.

I have applied the patch and deleted num_supplies - now build errors. So num_supplies in struct st7701 is not used and should be deleted.

Sorry, now I found it thanks, will drop in next version.

Quoted 38 lines
Quoted 30 lines
Quoted 30 lines
Quoted 29 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +28 -0
+static int st7701_prepare(struct drm_panel *panel)
+{
+     struct st7701 *st7701 = panel_to_st7701(panel);
+     int ret;
+
+     gpiod_set_value(st7701->reset, 0);
+     msleep(20);
+
+     ret = regulator_bulk_enable(st7701->desc->num_supplies,
+                                 st7701->supplies);
+     if (ret < 0)
+             return ret;
+     msleep(20);
+
+     gpiod_set_value(st7701->reset, 1);
+     msleep(20);
+
+     gpiod_set_value(st7701->reset, 0);
+     msleep(30);
+
+     gpiod_set_value(st7701->reset, 1);
+     msleep(150);
+
+     st7701_init_sequence(st7701);
+
+     return 0;
+}
+
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 253

Quoted 5 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +5 -0
+static int st7701_unprepare(struct drm_panel *panel)
+{
+     struct st7701 *st7701 = panel_to_st7701(panel);
+
+     ST7701_DSI(st7701, MIPI_DCS_EXIT_SLEEP_MODE, 0x00);

Should this be MIPI_DCS_ENTER_SLEEP_MODE?

Quoted 4 lines

Note - you have shortcuts fot the standard commands like in this case:

        mipi_dsi_dcs_enter_sleep_mode(st7701->dsi);

I even tried this, but the difference wrt ST7701 can pass, same command with type MIPI_DSI_DCS_SHORT_WRITE_PARAM but the default mipi_dsi_dcs_enter_sleep_mode has length 0 so it's MIPI_DSI_DCS_SHORT_WRITE type. ie reason I have not used.

Quoted 16 lines

Thay could be introduced in many palces, but I also like how all the commands follows a consistent way to be issued.
So consider this only if this was new for you.

Quoted 10 lines
Quoted 9 lines

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 218

Quoted 8 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +8 -0
+
+     msleep(st7701->sleep_delay);
+
+     gpiod_set_value(st7701->reset, 0);
+
+     gpiod_set_value(st7701->reset, 1);
+
+     gpiod_set_value(st7701->reset, 0);

No timing constrains here? In prepare there are sleeps intermixed.

Quoted 4 lines
Quoted 1 line

Delay while doing unprare is not needed I suppose.

If the purpose is alone to reset the display then a single write '0' should do it I think

I even tried this just set 0, since prepare is doing a sequence, it good behavior to do the reverse during handoff. ie reason I just initiated this sequence.

Quoted 2 lines

And there is a requirement that it must be low for a minimum of 10 us which would be good to have here.

Sorry, I didn't get this requirement what is this for?

Quoted 3 lines

I aslo found in chapter 9. (page 163 - second line) this statement:
"VDDA and VDDI must be powered down with minimum 120msec."

Yes unprepare is doing the same, it exit from sleep out mode and wait for 120msec and do the reset.

Quoted 3 lines

This is similar to the unprepare delay to be found in simple-panel.c So an unprepare delay seems in order here.

Look like simple-panel.c is doing delay after reset initiated and regulator disabled.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw

Re: [PATCH V7 2/2] drm/panel: Add Sitronix ST7701 panel driver

Quoted 16 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 218

Quoted 9 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +8 -0
+
+     msleep(st7701->sleep_delay);
+
+     gpiod_set_value(st7701->reset, 0);
+
+     gpiod_set_value(st7701->reset, 1);
+
+     gpiod_set_value(st7701->reset, 0);

No timing constrains here? In prepare there are sleeps intermixed.

Quoted 4 lines
Quoted 1 line

Delay while doing unprare is not needed I suppose.

If the purpose is alone to reset the display then a single write '0' should do it I think

Quoted 8 lines

I even tried this just set 0, since prepare is doing a sequence, it good behavior to do the reverse during handoff. ie reason I just initiated this sequence.

Quoted 2 lines

And there is a requirement that it must be low for a minimum of 10 us which would be good to have here.

Sorry, I didn't get this requirement what is this for?

The st7701 will ignore reset pulse shorter than 10 us - see Trw in table 9 reset timing (page 54).

But as we just assert reset (set it to 0), this timing constraint can be ignored.

Quoted 7 lines
Quoted 2 lines

I aslo found in chapter 9. (page 163 - second line) this statement:
"VDDA and VDDI must be powered down with minimum 120msec."

Yes unprepare is doing the same, it exit from sleep out mode and wait for 120msec and do the reset.

Quoted 1 line
Quoted 5 lines
Quoted 2 lines

This is similar to the unprepare delay to be found in simple-panel.c So an unprepare delay seems in order here.

Look like simple-panel.c is doing delay after reset initiated and regulator disabled.

Sam

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

author maintainer
#8 lore raw

Re: [PATCH V7 2/2] drm/panel: Add Sitronix ST7701 panel driver

Quoted 21 lines · Sam Ravnborg
Quoted 21 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

drivers/gpu/drm/panel/panel-sitronix-st7701.c line 218

Quoted 10 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c new file +8 -0
+
+     msleep(st7701->sleep_delay);
+
+     gpiod_set_value(st7701->reset, 0);
+
+     gpiod_set_value(st7701->reset, 1);
+
+     gpiod_set_value(st7701->reset, 0);

No timing constrains here? In prepare there are sleeps intermixed.

Quoted 4 lines
Quoted 1 line

Delay while doing unprare is not needed I suppose.

If the purpose is alone to reset the display then a single write '0' should do it I think

I even tried this just set 0, since prepare is doing a sequence, it good behavior to do the reverse during handoff. ie reason I just initiated this sequence.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

And there is a requirement that it must be low for a minimum of 10 us which would be good to have here.

Sorry, I didn't get this requirement what is this for?

The st7701 will ignore reset pulse shorter than 10 us - see Trw in table 9 reset timing (page 54).

But as we just assert reset (set it to 0), this timing constraint can be ignored.

But we unaware of reset pulse duration right? it's the hardware that bring the reset assert if we set the line 0. am I correct or do we need to explicitly wait 10us after reset initiated?
there is family of chip Sitronix st7789v which don't taking care of this sequence (I don't know why?) in drivers/gpu/drm/panel/panel-sitronix-st7789v.c with Page 48 of datasheet[2]

[2] https://www.newhavendisplay.com/appnotes/datasheets/LCDs/ST7789V.pdf
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#9 lore raw

Re: [PATCH V7 2/2] drm/panel: Add Sitronix ST7701 panel driver

Hi Jagan.

Quoted 9 lines
Quoted 1 line

But as we just assert reset (set it to 0), this timing constraint can be ignored.

But we unaware of reset pulse duration right? it's the hardware that bring the reset assert if we set the line 0. am I correct or do we need to explicitly wait 10us after reset initiated?
there is family of chip Sitronix st7789v which don't taking care of this sequence (I don't know why?) in drivers/gpu/drm/panel/panel-sitronix-st7789v.c with Page 48 of datasheet[2]

The prepare sequence used is:
1) reset
20 ms
2) regulator enable
20 ms
3) unassert reset
20 ms
4) assert reset
30 ms
4) unassert reset
150 ms
5) SOFT RESET
5 ms
6) Exit SLEEP mode
sleep_delay (120 ms)
7) COMMANDS

The enable sequence is
1) Display ON
2) backlight enable

The disable sequence is
1) backlight disable
2) Display OFF

The unprepare sequence is
1) Exit SLEEP mode <= this should be Enter SLEEP mode (covered by previous mail) sleep_delay (120 ms)
2) assert reset
3) unassert reset
4) assert reset
5) regulator disable

The implementation in simple-panel supports a long list of panels so we can assume this is a good reference implementation.
Unless your combo of st7701 + panel has special requirements.

Prepare sequence:
-----------------
- Just set reset to 1 - no need to trigger an edge.
But if you somehow think the edge is required keep the current code but drop the delays that are not required.
We can assume power is OK when it is enabled, no extra waiting required.
- No reason to unassert and then assert and then unassert reset.

In other words:
- Delay between 1 and 2 can be dropped.
- step 3 and step 4 can be dropped

Unprepare sequence:
-------------------
Enter SLEEP mode may take 120 ms so delay between 1) and 2) is OK. No reason to do the reset dance, drop 2) and 3)
Make sure reset is completed, so wait before leaving the function. See note 3. on page 54 in datasheet:

"During the Resetting period, the display will be blanked
(The display is entering blanking sequence, which maximum time is 120 ms, when Reset Starts in Sleep Out –mode. The display remains the blank state in Sleep In –mode.) and
then return to Default condition for Hardware Reset."

We have already sent an Enter SLEEP command but we have no timing constrains when panel is in SLEEP mode, So stick to the 120 ms.
Just use sleep_delay.

Thats my best understanding, your reading of the datasheet or your testing may prove different.

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

author maintainer
#10 lore raw

Re: [PATCH V7 2/2] drm/panel: Add Sitronix ST7701 panel driver

Hi Sam,

Quoted 78 lines · Sam Ravnborg

Hi Jagan.

Quoted 9 lines
Quoted 1 line

But as we just assert reset (set it to 0), this timing constraint can be ignored.

But we unaware of reset pulse duration right? it's the hardware that bring the reset assert if we set the line 0. am I correct or do we need to explicitly wait 10us after reset initiated?
there is family of chip Sitronix st7789v which don't taking care of this sequence (I don't know why?) in drivers/gpu/drm/panel/panel-sitronix-st7789v.c with Page 48 of datasheet[2]

The prepare sequence used is:
1) reset
20 ms
2) regulator enable
20 ms
3) unassert reset
20 ms
4) assert reset
30 ms
4) unassert reset
150 ms
5) SOFT RESET
5 ms
6) Exit SLEEP mode
sleep_delay (120 ms)
7) COMMANDS

The enable sequence is
1) Display ON
2) backlight enable

The disable sequence is
1) backlight disable
2) Display OFF

The unprepare sequence is
1) Exit SLEEP mode <= this should be Enter SLEEP mode (covered by previous mail) sleep_delay (120 ms)
2) assert reset
3) unassert reset
4) assert reset
5) regulator disable

The implementation in simple-panel supports a long list of panels so we can assume this is a good reference implementation.
Unless your combo of st7701 + panel has special requirements.

Prepare sequence:
-----------------
- Just set reset to 1 - no need to trigger an edge.
But if you somehow think the edge is required keep the current code but drop the delays that are not required.
We can assume power is OK when it is enabled, no extra waiting required.
- No reason to unassert and then assert and then unassert reset.

In other words:
- Delay between 1 and 2 can be dropped.
- step 3 and step 4 can be dropped

Unprepare sequence:
-------------------
Enter SLEEP mode may take 120 ms so delay between 1) and 2) is OK. No reason to do the reset dance, drop 2) and 3)
Make sure reset is completed, so wait before leaving the function. See note 3. on page 54 in datasheet:

"During the Resetting period, the display will be blanked
(The display is entering blanking sequence, which maximum time is 120 ms, when Reset Starts in Sleep Out –mode. The display remains the blank state in Sleep In –mode.) and
then return to Default condition for Hardware Reset."

Quoted 3 lines

We have already sent an Enter SLEEP command but we have no timing constrains when panel is in SLEEP mode, So stick to the 120 ms.
Just use sleep_delay.

So we need this delay even after reset unlike SLEEP mode delay. OK, thanks for the points will try to check all these points.

When did .unprepare and .disable are actually called? I turn-off the backlight by echo 1 > /sys/class/backlight/backlight/bl_power and even power of the board I assume the video transmission stop so it would ended-up calling these, but I couldn't see prints. does it the same time uart dead or something? do you have any inputs on sanity testing of typical panels, if yes please share.

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

#11 lore raw

Re: [PATCH V7 2/2] drm/panel: Add Sitronix ST7701 panel driver

Hi Jagan.

Quoted 6 lines

When did .unprepare and .disable are actually called? I turn-off the backlight by echo 1 > /sys/class/backlight/backlight/bl_power and even power of the board I assume the video transmission stop so it would ended-up calling these, but I couldn't see prints. does it the same time uart dead or something? do you have any inputs on sanity testing of typical panels, if yes please share.

Sorry, I do not rememebr the details to help you here. Maybe module unload and then manipulating the panel in /sys/ would do the trick.

Sam