Skip to contentSkip to conversation

drm/sun4i: dsi: Fixes/updates (A33 reworked!)

PATCH Superseded Jagan Teki 4 participants 54 messages May 20, 2019 – Jul 3, 2019

Subsystems (6)

v10 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
author
#1 lore raw

PATCH v10 1/11 drm/sun4i: dsi: Fix TCON DRQ set bits

In reply to Jagan Teki

According to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h the current driver is trying to include sync timings along with front porch value while checking and computing drq set bits in non-burst mode.

mode->hsync_end - mode->hdisplay => horizontal front porch + sync

With adding additional sync timings, the dsi controller leads to wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00026-g01f0c75b902d-dirty #13
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
 [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
 [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
 [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
 [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
 [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
 [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace b57eb1e5c64c6b8b ]---
 random: fast init done
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for non-burst DSI mode can be computed based on "horizontal front porch" value only (no sync timings included).

Detailed evidence for drq set bits based on A33 BSP [1] [2]

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20 => (tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20 => tt->hor_front_porch - 20

Which is mode->hsync_start - mode->hdisplay as per
"DRM kernel-internal display mode structure" in include/drm/drm_modes.h

So, This patch update the DRQ set bits to use front porch value.

[3] https://github.com/BPI-SINOVOIP/BPI-M64-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c#L774
[2] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2031
[1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L851

---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +2 -2
index a9ed87956f6d..c5bec0096b7c 100644
@@ -436,9 +436,9 @@ static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi,
 			     SUN6I_DSI_BURST_LINE_SYNC_POINT(SUN6I_DSI_SYNC_POINT));
 
 		val = SUN6I_DSI_TCON_DRQ_ENABLE_MODE;
-	} else if ((mode->hsync_end - mode->hdisplay) > 20) {
+	} else if ((mode->hsync_start - mode->hdisplay) > 20) {
 		/* Maaaaaagic */
-		u16 drq = (mode->hsync_end - mode->hdisplay) - 20;
+		u16 drq = (mode->hsync_start - mode->hdisplay) - 20;
 
 		drq *= mipi_dsi_pixel_format_to_bpp(device->format);
 		drq /= 32;
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#17 lore raw

PATCH v10 2/11 drm/sun4i: dsi: Update start value in video start delay

In reply to Jagan Teki

start value in video start delay computation done in below commit is as per the legacy bsp drivers/video/sunxi/legacy.. "drm/sun4i: dsi: Change the start delay calculation" (sha1: da676c6aa6413d59ab0a80c97bbc273025e640b2)

This existing start delay computation gives start value of 35, for "bananapi,s070wv20-ct16" panel timings which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Tainted: G        W         5.1.0-next-20190514-00025-gf928bc7cc146 #15
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c90>] (dump_stack+0x84/0x98)
 [<c0688c90>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c0411cb0>] (drm_fb_helper_pan_display+0xac/0x1d0)
 [<c0411cb0>] (drm_fb_helper_pan_display) from [<c03a4e84>] (fb_pan_display+0xcc/0x134)
 [<c03a4e84>] (fb_pan_display) from [<c03b1214>] (bit_update_start+0x14/0x30)
 [<c03b1214>] (bit_update_start) from [<c03afe94>] (fbcon_switch+0x3d8/0x4e0)
 [<c03afe94>] (fbcon_switch) from [<c03ec930>] (redraw_screen+0x174/0x238)
 [<c03ec930>] (redraw_screen) from [<c03aceb4>] (fbcon_prepare_logo+0x3c4/0x400)
 [<c03aceb4>] (fbcon_prepare_logo) from [<c03ad2b8>] (fbcon_init+0x3c8/0x5ac)
 [<c03ad2b8>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b5b0>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b5b0>] (try_to_bring_up_master) from [<c044b680>] (__component_add+0x94/0x140)
 [<c044b680>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452f0c>] (platform_drv_probe+0x48/0x9c)
 [<c0452f0c>] (platform_drv_probe) from [<c04512e4>] (really_probe+0x1dc/0x2c8)
 [<c04512e4>] (really_probe) from [<c0451530>] (driver_probe_device+0x60/0x160)
 [<c0451530>] (driver_probe_device) from [<c044f7bc>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7bc>] (bus_for_each_drv) from [<c0451094>] (__device_attach+0xd0/0x13c)
 [<c0451094>] (__device_attach) from [<c045048c>] (bus_probe_device+0x84/0x8c)
 [<c045048c>] (bus_probe_device) from [<c0450918>] (deferred_probe_work_func+0x64/0x90)
 [<c0450918>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 755e10f62b83f396 ]---
 Console: switching to colour frame buffer device 100x30
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But the expected start delay value is 1 which is confirmed from new bsp [2].

The important and unclear note on legacy and new bsp codes [1] [2] is both use similar start computation initially but it later reassign it to 1 in new bsp.

Unfortunately we don't have any evidence or documentation for this reassignment to 1 in new bsp, but it is working with all supported panels in A33, A64.

So, use the start as per new bsp code since it is working in all the supported panels.

[2] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L807
[1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/legacy/disp/de_bsp/de/ebios/de_dsi.c#L682

---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +11 -1
index c5bec0096b7c..b3ca85410b2c 100644
@@ -364,7 +364,17 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi,
 static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi,
 					   struct drm_display_mode *mode)
 {
-	u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100);
+	/**
+	 * Allwinner legacy (drivers/video/sunxi/legacy),
+	 * new (drivers/video/sunxi/disp/de/lowlevel_sun8iw5) bsp drivers
+	 * are evaluating start as:
+	 *
+	 *	vtotal - vdisplay - 10
+	 *
+	 * but the new drivers are reassigning start to 1, which seems to be
+	 * working in all supported panels as of now.
+	 */
+	u8 start = 1;
 	u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;
 
 	if (delay > mode->vtotal)
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#25 lore raw

PATCH v10 3/11 drm/sun4i: dsi: Fix video start delay computation

In reply to Jagan Teki

The current code is computing vertical video start delay as

delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;

On which the second parameter

mode->vsync_end - mode->vdisplay = front porch + sync timings

according to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h

With adding additional sync timings, the desired video start delay value as 510 for "bananapi,s070wv20-ct16" panel timings which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00029-g09e5b0ed0a58 #18
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
 [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
 [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
 [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
 [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
 [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
 [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 495200a78b24980e ]---
 random: fast init done
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But the expected video start delay value is 513 which states that the second parameter on the computation is "front porch" value (no sync timings included).

This is clearly confirmed from the legacy [1] and new [2] bsp codes that the second parameter on the video start delay is "front porch"

Here is the detailed evidence for calculating front porch as per bsp code.

vfp = panel->lcd_vt - panel->lcd_y - panel->lcd_vbp => (panel->lcd_vt) - panel->lcd_y - panel->lcd_vbp => (tt->ver_front_porch + lcdp->panel_info.lcd_vbp
+ lcdp->panel_info.lcd_y) - panel->lcd_y - panel->lcd_vbp
=> tt->ver_front_porch

Which is mode->vsync_start - mode->vdisplay according to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h

This patch fix this by updating the video start delay to use front porch value.

[2] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2051
[1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L803

---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +1 -1
index b3ca85410b2c..47d571d97600 100644
@@ -375,7 +375,7 @@ static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi,
 	 * working in all supported panels as of now.
 	 */
 	u8 start = 1;
-	u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;
+	u16 delay = mode->vtotal - (mode->vsync_start - mode->vdisplay) + start;
 
 	if (delay > mode->vtotal)
 		delay = delay % mode->vtotal;
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#45 lore raw

PATCH v10 6/11 drm/sun4i: dsi: Probe tcon0 during dsi_bind

In reply to Jagan Teki

Probe tcon0 during dsi_bind, so-that the tcon attributes like divider value, clock rates are available whenever it required.

---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 6 ++++++
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 1 +
 2 files changed, 7 insertions(+)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +6 -0
index 47d571d97600..1f9ed2642a47 100644
@@ -1045,6 +1045,7 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master,
 	struct drm_device *drm = data;
 	struct sun4i_drv *drv = drm->dev_private;
 	struct sun6i_dsi *dsi = dev_get_drvdata(dev);
+	struct sun4i_tcon *tcon0 = sun4i_get_tcon0(drm);
 	int ret;
 
 	if (!(dsi->panel || dsi->bridge)) {
@@ -1054,6 +1055,11 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master,
 
 	dsi->drv = drv;
 
+	if (!tcon0)
+		return -EINVAL;
+
+	dsi->tcon = tcon0;
+
 	drm_encoder_helper_add(&dsi->encoder,
 			       &sun6i_dsi_enc_helper_funcs);
 	ret = drm_encoder_init(drm,
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +1 -0
index 9c140f55b822..f2826e3ea165 100644
@@ -28,6 +28,7 @@ struct sun6i_dsi {
 
 	struct device		*dev;
 	struct sun4i_drv	*drv;
+	struct sun4i_tcon	*tcon;
 	struct mipi_dsi_device	*device;
 	struct drm_panel	*panel;
 	struct drm_bridge	*bridge;
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#46 lore raw

PATCH v10 7/11 drm/sun4i: dsi: Get tcon0_div at runtime

In reply to Jagan Teki

tcon0 divider is used while computing drq edge0 for burst mode devices, currently driver is using default macro value 4 via SUN6I_DSI_TCON_DIV.

Unfortunately not all the panel devices are working with this default divider value 4, so to make future changes on this divider value get the divider from tcon dot clock at runtime instead of static macro value.

---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 8 +++++++-
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 2 --
 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +7 -1
index 1f9ed2642a47..5584e9c2f8bd 100644
@@ -396,9 +396,15 @@ static u16 sun6i_dsi_get_drq_edge0(struct sun6i_dsi *dsi,
 				   struct drm_display_mode *mode,
 				   u16 line_num, u16 edge1)
 {
+	struct sun4i_tcon *tcon = dsi->tcon;
+	unsigned long dclk_rate, dclk_parent_rate, tcon0_div;
 	u16 edge0 = edge1;
 
-	edge0 += (mode->hdisplay + 40) * SUN6I_DSI_TCON_DIV / 8;
+	dclk_rate = clk_get_rate(tcon->dclk);
+	dclk_parent_rate = clk_get_rate(clk_get_parent(tcon->dclk));
+	tcon0_div = dclk_parent_rate / dclk_rate;
+
+	edge0 += (mode->hdisplay + 40) * tcon0_div / 8;
 
 	if (edge0 > line_num)
 		return edge0 - line_num;
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +0 -2
index f2826e3ea165..156523859d82 100644
@@ -13,8 +13,6 @@
 #include <drm/drm_encoder.h>
 #include <drm/drm_mipi_dsi.h>
 
-#define SUN6I_DSI_TCON_DIV	4
-
 struct sun6i_dsi {
 	struct drm_connector	connector;
 	struct drm_encoder	encoder;
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#52 lore raw

PATCH v10 10/11 drm/panel: Add Bananapi S070WV20-CT16 ICN6211 MIPI-DSI to RGB bridge

In reply to Jagan Teki

Bananapi S070WV20-CT16 ICN6211 is 800x480, 4-lane MIPI-DSI to RGB bridge panel which can be used to connect via DSI port on BPI-M64 board, so add a driver for it.

The same panel PCB comes with parallel RBG which is supported via panel-simple driver with "bananapi,s070wv20-ct16" compatible.

---
 drivers/gpu/drm/panel/Kconfig                 |   9 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 .../panel/panel-bananapi-s070wv20-icn6211.c   | 293 ++++++++++++++++++
 3 files changed, 303 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-bananapi-s070wv20-icn6211.c
drivers/gpu/drm/panel/Kconfig +9 -0
index e36dbb4df867..d0cb2fa3e721 100644
@@ -17,6 +17,15 @@ config DRM_PANEL_ARM_VERSATILE
 	  reference designs. The panel is detected using special registers
 	  in the Versatile family syscon registers.
 
+config DRM_PANEL_BANANAPI_S070WV20_ICN6211
+	tristate "Bananapi S070WV20-CT16 ICN6211 MIPI-DSI to RGB bridge panel driver"
+	depends on OF
+	depends on DRM_MIPI_DSI
+	depends on BACKLIGHT_CLASS_DEVICE
+	help
+	  Say Y if you want to enable support for panels based on the
+	  Bananapi S070WV20-CT16 MIPI-DSI controller.
+
 config DRM_PANEL_LVDS
 	tristate "Generic LVDS panel driver"
 	depends on OF
drivers/gpu/drm/panel/Makefile +1 -0
index 78e3dc376bdd..a68e990a4a73 100644
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_DRM_PANEL_ARM_VERSATILE) += panel-arm-versatile.o
+obj-$(CONFIG_DRM_PANEL_BANANAPI_S070WV20_ICN6211) += panel-bananapi-s070wv20-icn6211.o
 obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
 obj-$(CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D) += panel-feiyang-fy07024di26a30d.o
drivers/gpu/drm/panel/panel-bananapi-s070wv20-icn6211.c new file +293 -0

293 lines not on this page · raw message

Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#53 lore raw

PATCH v10 11/11 ARM: dts: sun8i: bananapi-m2m: Enable Bananapi S070WV20-CT16 DSI panel

In reply to Jagan Teki

This patch add support for Bananapi S070WV20-CT16 DSI panel to BPI-M2M board.

DSI panel connected via board DSI port with,
- DCDC1 as VCC-DSI supply
- DLDO1 as VDD supply
- PL5 gpio for lcd reset gpio pin
- PB7 gpio for lcd enable gpio pin
- PL4 gpio for backlight enable pin

---
 arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts | 40 ++++++++++++++++++++
 1 file changed, 40 insertions(+)
arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts +40 -0
index e1c75f7fa3ca..4e71e81d2bad 100644
@@ -44,6 +44,7 @@
 #include "sun8i-a33.dtsi"
 
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/pwm/pwm.h>
 
 / {
 	model = "BananaPi M2 Magic";
@@ -61,6 +62,14 @@
 		stdout-path = "serial0:115200n8";
 	};
 
+	backlight: backlight {
+		compatible = "pwm-backlight";
+		pwms = <&pwm 0 50000 PWM_POLARITY_INVERTED>;
+		brightness-levels = <1 2 4 8 16 32 64 128 255>;
+		default-brightness-level = <8>;
+		enable-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* LCD-BL-EN: PL4 */
+	};
+
 	leds {
 		compatible = "gpio-leds";
 
@@ -122,6 +131,27 @@
 	status = "okay";
 };
 
+&de {
+	status = "okay";
+};
+
+&dphy {
+	status = "okay";
+};
+
+&dsi {
+	vcc-dsi-supply = <&reg_dcdc1>;		/* VCC3V3-DSI */
+	status = "okay";
+
+	panel@0 {
+		compatible = "bananapi,s070wv20-ct16-icn6211";
+		reg = <0>;
+		enable-gpios = <&pio 1 7 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PB7 */
+		reset-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */
+		backlight = <&backlight>;
+	};
+};
+
 &ehci0 {
 	status = "okay";
 };
@@ -157,6 +187,12 @@
 	status = "okay";
 };
 
+&pwm {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pwm0_pin>;
+	status = "okay";
+};
+
 &r_rsb {
 	status = "okay";
 
@@ -269,6 +305,10 @@
 	status = "okay";
 };
 
+&tcon0 {
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pb_pins>;
Signature · 1 line
2.18.0.321.gffc6fa0e3

Jagan Teki

author
#0 lore raw

v10 cover drm/sun4i: dsi: Fixes/updates (A33 reworked!)

Most of these issues are reproduced while supporting Allwinner A64 MIPI-DSI [1] but to confirm it with other SoC this series is reworked on A33 since the controller tested it A33 as of now.

Since we don't have proper evidence and documentation for dsi controller in Allwinner, these changes are more likely to rely on new working BSP codes (even the initial driver written as per this rule).

All these fixes/updates are tested in "bananapi,s070wv20-ct16" panel on Allwinner A33, the same panel timings are available in panel-simple in mainline tree.

Changes for v10:
- reworked previous "Fixes/updates" patches on A33
- reworked previous A64 DSI fixes on A33
- added proper detailed commit messages with logs
- tested on BPI-M2M board.
Changes for v9:
- rebase on drm-misc
- update commit messages
- add hsync_porch overflow patch
Changes for v8:
- rebase on master
- rework on commit messages
- rework video start delay
- include drq changes from previous version
Changes for v7:
- rebase on master
- collect Merlijn Wajer Tested-by credits.
Changes for v6:
- fixed all burst mode patches as per previous version comments
- rebase on master
- update proper commit message
- dropped unneeded comments
- order the patches that make review easy
Changes for v5, v4, v3, v2:
- use existing driver code construct for hblk computation
- create separate function for vblk computation
- cleanup commit messages
- update proper commit messages
- fixed checkpatch warnings/errors
- use proper return value for tcon0 probe
- add logic to get tcon0 divider values
- simplify timings code to support burst mode
- fix drq computation return values
- rebase on master

Any inputs?
Jagan.

[1] https://patchwork.freedesktop.org/series/57834/

Jagan Teki (11):
drm/sun4i: dsi: Fix TCON DRQ set bits
drm/sun4i: dsi: Update start value in video start delay
drm/sun4i: dsi: Fix video start delay computation
drm/sun4i: tcon: Compute DCLK dividers based on format, lanes drm/sun4i: tcon: Export get tcon0 routine
drm/sun4i: dsi: Probe tcon0 during dsi_bind
drm/sun4i: dsi: Get tcon0_div at runtime
dt-bindings: sun6i-dsi: Add VCC-DSI supply property
drm/sun4i: sun6i_mipi_dsi: Add VCC-DSI regulator support
[DO NOT MERGE] drm/panel: Add Bananapi S070WV20-CT16 ICN6211 MIPI-DSI to RGB bridge [DO NOT MERGE] ARM: dts: sun8i: bananapi-m2m: Enable Bananapi S070WV20-CT16 DSI panel

 .../bindings/display/sunxi/sun6i-dsi.txt      |   1 +
 arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts  |  40 +++
 drivers/gpu/drm/panel/Kconfig                 |   9 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 .../panel/panel-bananapi-s070wv20-icn6211.c   | 293 ++++++++++++++++++
 drivers/gpu/drm/sun4i/sun4i_tcon.c            |   7 +-
 drivers/gpu/drm/sun4i/sun4i_tcon.h            |   1 +
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c        |  46 ++-
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h        |   4 +-
 9 files changed, 393 insertions(+), 9 deletions(-)
 create mode 100644 drivers/gpu/drm/panel/panel-bananapi-s070wv20-icn6211.c
Signature · 6 lines
2.18.0.321.gffc6fa0e3

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

PATCH v10 4/11 drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code is passing dsi min and max divider value as 4 via tcon driver which would ended-up triggering below vblank wait timed out warning on "bananapi,s070wv20-ct16" panel.

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00025-g5186cdf10757-dirty #6
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b588>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b588>] (try_to_bring_up_master) from [<c044b658>] (__component_add+0x94/0x140)
 [<c044b658>] (__component_add) from [<c0445e0c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e0c>] (sun6i_dsi_probe) from [<c0452ee4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ee4>] (platform_drv_probe) from [<c04512bc>] (really_probe+0x1dc/0x2c8)
 [<c04512bc>] (really_probe) from [<c0451508>] (driver_probe_device+0x60/0x160)
 [<c0451508>] (driver_probe_device) from [<c044f794>] (bus_for_each_drv+0x74/0xb8)
 [<c044f794>] (bus_for_each_drv) from [<c045106c>] (__device_attach+0xd0/0x13c)
 [<c045106c>] (__device_attach) from [<c0450464>] (bus_probe_device+0x84/0x8c)
 [<c0450464>] (bus_probe_device) from [<c04508f0>] (deferred_probe_work_func+0x64/0x90)
 [<c04508f0>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 4017fea4906ab391 ]---

But accordingly to Allwinner A33, A64 BSP codes [1] [2] this divider is clearly using 'format/lanes' for dsi divider value, dsi_clk.clk_div

Which would compute the pll_freq and set a clock rate for it in
[3] and [4] respectively.

The same issue has reproduced in A33, A64 with 4-lane and 2-lane devices and got fixed with this computation logic 'format/lanes', so this patch using dclk min and max dividers as per BSP.

[1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1106
[2] https://github.com/BPI-SINOVOIP/BPI-M64-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/disp_al.c#L213
[3] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1127
[4] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1161

---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun4i_tcon.c +2 -2
index 9d8d8124b1f6..8f93121fead4 100644
@@ -341,8 +341,8 @@ static void sun4i_tcon0_mode_set_cpu(struct sun4i_tcon *tcon,
 	u32 block_space, start_delay;
 	u32 tcon_div;
 
-	tcon->dclk_min_div = SUN6I_DSI_TCON_DIV;
-	tcon->dclk_max_div = SUN6I_DSI_TCON_DIV;
+	tcon->dclk_min_div = bpp/lanes;
+	tcon->dclk_max_div = bpp/lanes;
 
 	sun4i_tcon0_mode_set_common(tcon, mode);
 
Signature · 6 lines
2.18.0.321.gffc6fa0e3

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

PATCH v10 5/11 drm/sun4i: tcon: Export get tcon0 routine

In reply to Jagan Teki

Sometimes tcon attributes like tcon divider, clock rate etc are needed in interface drivers like DSI. So for such cases interface driver must probe the respective tcon and get the attributes.

Since tcon0 probe is already available, via sun4i_get_tcon0 function, export the same instead of probing tcon explicitly.

---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 3 ++-
 drivers/gpu/drm/sun4i/sun4i_tcon.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/sun4i_tcon.c +2 -1
index 8f93121fead4..9e9d08ee8387 100644
@@ -221,7 +221,7 @@ EXPORT_SYMBOL(sun4i_tcon_enable_vblank);
  * are located in TCON0. This helper returns a pointer to TCON0's
  * sun4i_tcon structure, or NULL if not found.
  */
-static struct sun4i_tcon *sun4i_get_tcon0(struct drm_device *drm)
+struct sun4i_tcon *sun4i_get_tcon0(struct drm_device *drm)
 {
 	struct sun4i_drv *drv = drm->dev_private;
 	struct sun4i_tcon *tcon;
@@ -235,6 +235,7 @@ static struct sun4i_tcon *sun4i_get_tcon0(struct drm_device *drm)
 
 	return NULL;
 }
+EXPORT_SYMBOL(sun4i_get_tcon0);
 
 static void sun4i_tcon_set_mux(struct sun4i_tcon *tcon, int channel,
 			       const struct drm_encoder *encoder)
drivers/gpu/drm/sun4i/sun4i_tcon.h +1 -0
index 84cfb1952ff7..88e971d5f937 100644
@@ -272,6 +272,7 @@ struct sun4i_tcon {
 struct drm_bridge *sun4i_tcon_find_bridge(struct device_node *node);
 struct drm_panel *sun4i_tcon_find_panel(struct device_node *node);
 
+struct sun4i_tcon *sun4i_get_tcon0(struct drm_device *drm);
 void sun4i_tcon_enable_vblank(struct sun4i_tcon *tcon, bool enable);
 void sun4i_tcon_mode_set(struct sun4i_tcon *tcon,
 			 const struct drm_encoder *encoder,
Signature · 6 lines
2.18.0.321.gffc6fa0e3

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

PATCH v10 8/11 dt-bindings: sun6i-dsi: Add VCC-DSI supply property

In reply to Jagan Teki

Allwinner MIPI DSI controllers are supplied with SoC DSI power rails via VCC-DSI pin.

Some board still work without supplying this but give more faith on datasheet and hardware schematics and document this supply property in required property list.

---
 Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt +1 -0
index 6a6cf5de08b0..1cc40663b7a2 100644
@@ -21,6 +21,7 @@ Required properties:
   - phys: phandle to the D-PHY
   - phy-names: must be "dphy"
   - resets: phandle to the reset controller driving the encoder
+  - vcc-dsi-supply: the VCC-DSI power supply of the DSI encoder
 
   - ports: A ports node with endpoint definitions as defined in
     Documentation/devicetree/bindings/media/video-interfaces.txt. The
Signature · 6 lines
2.18.0.321.gffc6fa0e3

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

PATCH v10 9/11 drm/sun4i: sun6i_mipi_dsi: Add VCC-DSI regulator support

In reply to Jagan Teki

Allwinner MIPI DSI controllers are supplied with SoC DSI power rails via VCC-DSI pin.

Add support for this supply pin by adding voltage regulator handling code to MIPI DSI driver.

---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 14 ++++++++++++++
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h |  3 +++
 2 files changed, 17 insertions(+)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +14 -0
index 5584e9c2f8bd..a5d73a283ed7 100644
@@ -1150,6 +1150,12 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
 		return PTR_ERR(base);
 	}
 
+	dsi->regulator = devm_regulator_get(dev, "vcc-dsi");
+	if (IS_ERR(dsi->regulator)) {
+		dev_err(dev, "Couldn't get VCC-DSI supply\n");
+		return PTR_ERR(dsi->regulator);
+	}
+
 	dsi->regs = devm_regmap_init_mmio_clk(dev, "bus", base,
 					      &sun6i_dsi_regmap_config);
 	if (IS_ERR(dsi->regs)) {
@@ -1223,6 +1229,13 @@ static int sun6i_dsi_remove(struct platform_device *pdev)
 static int __maybe_unused sun6i_dsi_runtime_resume(struct device *dev)
 {
 	struct sun6i_dsi *dsi = dev_get_drvdata(dev);
+	int err;
+
+	err = regulator_enable(dsi->regulator);
+	if (err) {
+		dev_err(dsi->dev, "failed to enable VCC-DSI supply: %d\n", err);
+		return err;
+	}
 
 	reset_control_deassert(dsi->reset);
 	clk_prepare_enable(dsi->mod_clk);
@@ -1255,6 +1268,7 @@ static int __maybe_unused sun6i_dsi_runtime_suspend(struct device *dev)
 
 	clk_disable_unprepare(dsi->mod_clk);
 	reset_control_assert(dsi->reset);
+	regulator_disable(dsi->regulator);
 
 	return 0;
 }
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +3 -0
index 156523859d82..c76b71259d2e 100644
@@ -13,6 +13,8 @@
 #include <drm/drm_encoder.h>
 #include <drm/drm_mipi_dsi.h>
 
+#include <linux/regulator/consumer.h>
+
 struct sun6i_dsi {
 	struct drm_connector	connector;
 	struct drm_encoder	encoder;
@@ -21,6 +23,7 @@ struct sun6i_dsi {
 	struct clk		*bus_clk;
 	struct clk		*mod_clk;
 	struct regmap		*regs;
+	struct regulator	*regulator;
 	struct reset_control	*reset;
 	struct phy		*dphy;
 
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 v10 01/11] drm/sun4i: dsi: Fix TCON DRQ set bits

In reply to Jagan Teki
Quoted 69 lines · Jagan Teki

According to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h the current driver is trying to include sync timings along with front porch value while checking and computing drq set bits in non-burst mode.

mode->hsync_end - mode->hdisplay => horizontal front porch + sync

With adding additional sync timings, the dsi controller leads to wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00026-g01f0c75b902d-dirty #13
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
 [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
 [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
 [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
 [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
 [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
 [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace b57eb1e5c64c6b8b ]---
 random: fast init done
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for non-burst DSI mode can be computed based on "horizontal front porch" value only (no sync timings included).

Quoted 6 lines

Detailed evidence for drq set bits based on A33 BSP [1] [2]

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20 => (tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20 => tt->hor_front_porch - 20

The thing is, while your explanation on the DRM side is sound, Allwinner has been using the hbp field of their panel description to store what DRM calls the backporch and the sync period.

And nowhere in that commit log you are describing whether it's still an issue or not, and if it's not anymore how you did test that it's not the case anymore.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#18 lore raw

Re: [PATCH v10 02/11] drm/sun4i: dsi: Update start value in video start delay

In reply to Jagan Teki
Quoted 67 lines · Jagan Teki

start value in video start delay computation done in below commit is as per the legacy bsp drivers/video/sunxi/legacy.. "drm/sun4i: dsi: Change the start delay calculation" (sha1: da676c6aa6413d59ab0a80c97bbc273025e640b2)

This existing start delay computation gives start value of 35, for "bananapi,s070wv20-ct16" panel timings which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Tainted: G        W         5.1.0-next-20190514-00025-gf928bc7cc146 #15
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c90>] (dump_stack+0x84/0x98)
 [<c0688c90>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c0411cb0>] (drm_fb_helper_pan_display+0xac/0x1d0)
 [<c0411cb0>] (drm_fb_helper_pan_display) from [<c03a4e84>] (fb_pan_display+0xcc/0x134)
 [<c03a4e84>] (fb_pan_display) from [<c03b1214>] (bit_update_start+0x14/0x30)
 [<c03b1214>] (bit_update_start) from [<c03afe94>] (fbcon_switch+0x3d8/0x4e0)
 [<c03afe94>] (fbcon_switch) from [<c03ec930>] (redraw_screen+0x174/0x238)
 [<c03ec930>] (redraw_screen) from [<c03aceb4>] (fbcon_prepare_logo+0x3c4/0x400)
 [<c03aceb4>] (fbcon_prepare_logo) from [<c03ad2b8>] (fbcon_init+0x3c8/0x5ac)
 [<c03ad2b8>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b5b0>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b5b0>] (try_to_bring_up_master) from [<c044b680>] (__component_add+0x94/0x140)
 [<c044b680>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452f0c>] (platform_drv_probe+0x48/0x9c)
 [<c0452f0c>] (platform_drv_probe) from [<c04512e4>] (really_probe+0x1dc/0x2c8)
 [<c04512e4>] (really_probe) from [<c0451530>] (driver_probe_device+0x60/0x160)
 [<c0451530>] (driver_probe_device) from [<c044f7bc>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7bc>] (bus_for_each_drv) from [<c0451094>] (__device_attach+0xd0/0x13c)
 [<c0451094>] (__device_attach) from [<c045048c>] (bus_probe_device+0x84/0x8c)
 [<c045048c>] (bus_probe_device) from [<c0450918>] (deferred_probe_work_func+0x64/0x90)
 [<c0450918>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 755e10f62b83f396 ]---
 Console: switching to colour frame buffer device 100x30
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out
Quoted 2 lines

But the expected start delay value is 1 which is confirmed from new bsp [2].

If you're saying that the "legacy" link (second one) is the new BSP.

Quoted 3 lines

The important and unclear note on legacy and new bsp codes [1] [2] is both use similar start computation initially but it later reassign it to 1 in new bsp.

Then start_delay is never reassigned to 1 in that link, and is clamped between 8 and 100 as the code that you are removing is doing.

Quoted 3 lines

Unfortunately we don't have any evidence or documentation for this reassignment to 1 in new bsp, but it is working with all supported panels in A33, A64.

No, it's not. That was added to fix a panel that is supported today.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#26 lore raw

Re: [PATCH v10 03/11] drm/sun4i: dsi: Fix video start delay computation

In reply to Jagan Teki
Quoted 76 lines · Jagan Teki

The current code is computing vertical video start delay as

delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;

On which the second parameter

mode->vsync_end - mode->vdisplay = front porch + sync timings

according to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h

With adding additional sync timings, the desired video start delay value as 510 for "bananapi,s070wv20-ct16" panel timings which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00029-g09e5b0ed0a58 #18
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
 [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
 [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
 [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
 [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
 [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
 [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 495200a78b24980e ]---
 random: fast init done
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But the expected video start delay value is 513 which states that the second parameter on the computation is "front porch" value (no sync timings included).

This is clearly confirmed from the legacy [1] and new [2] bsp codes that the second parameter on the video start delay is "front porch"

Quoted 8 lines

Here is the detailed evidence for calculating front porch as per bsp code.

vfp = panel->lcd_vt - panel->lcd_y - panel->lcd_vbp => (panel->lcd_vt) - panel->lcd_y - panel->lcd_vbp => (tt->ver_front_porch + lcdp->panel_info.lcd_vbp
+ lcdp->panel_info.lcd_y) - panel->lcd_y - panel->lcd_vbp
=> tt->ver_front_porch

The comment on patch 1 still applies on this patch

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#31 lore raw

Re: [PATCH v10 04/11] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

In reply to Jagan Teki
Quoted 67 lines · Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code is passing dsi min and max divider value as 4 via tcon driver which would ended-up triggering below vblank wait timed out warning on "bananapi,s070wv20-ct16" panel.

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00025-g5186cdf10757-dirty #6
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b588>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b588>] (try_to_bring_up_master) from [<c044b658>] (__component_add+0x94/0x140)
 [<c044b658>] (__component_add) from [<c0445e0c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e0c>] (sun6i_dsi_probe) from [<c0452ee4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ee4>] (platform_drv_probe) from [<c04512bc>] (really_probe+0x1dc/0x2c8)
 [<c04512bc>] (really_probe) from [<c0451508>] (driver_probe_device+0x60/0x160)
 [<c0451508>] (driver_probe_device) from [<c044f794>] (bus_for_each_drv+0x74/0xb8)
 [<c044f794>] (bus_for_each_drv) from [<c045106c>] (__device_attach+0xd0/0x13c)
 [<c045106c>] (__device_attach) from [<c0450464>] (bus_probe_device+0x84/0x8c)
 [<c0450464>] (bus_probe_device) from [<c04508f0>] (deferred_probe_work_func+0x64/0x90)
 [<c04508f0>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 4017fea4906ab391 ]---

But accordingly to Allwinner A33, A64 BSP codes [1] [2] this divider is clearly using 'format/lanes' for dsi divider value, dsi_clk.clk_div

Which would compute the pll_freq and set a clock rate for it in
[3] and [4] respectively.

Quoted 8 lines

The same issue has reproduced in A33, A64 with 4-lane and 2-lane devices and got fixed with this computation logic 'format/lanes', so this patch using dclk min and max dividers as per BSP.

[1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1106
[2] https://github.com/BPI-SINOVOIP/BPI-M64-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/disp_al.c#L213
[3] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1127
[4] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1161

In that mail, I've pointed out that clk_div isn't used for the TCON dclk divider:
http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629596.html

The only reply you've sent is that you indeed see that the divider is set to 4 in the BSP, but you're now saying that the BSP can change it. If so, then please point exactly the flaw in the explanation in that mail.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

author
#32 lore raw

Re: [PATCH v10 04/11] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

Quoted 78 lines · Maxime Ripard
Quoted 67 lines · Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code is passing dsi min and max divider value as 4 via tcon driver which would ended-up triggering below vblank wait timed out warning on "bananapi,s070wv20-ct16" panel.

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00025-g5186cdf10757-dirty #6
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b588>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b588>] (try_to_bring_up_master) from [<c044b658>] (__component_add+0x94/0x140)
 [<c044b658>] (__component_add) from [<c0445e0c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e0c>] (sun6i_dsi_probe) from [<c0452ee4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ee4>] (platform_drv_probe) from [<c04512bc>] (really_probe+0x1dc/0x2c8)
 [<c04512bc>] (really_probe) from [<c0451508>] (driver_probe_device+0x60/0x160)
 [<c0451508>] (driver_probe_device) from [<c044f794>] (bus_for_each_drv+0x74/0xb8)
 [<c044f794>] (bus_for_each_drv) from [<c045106c>] (__device_attach+0xd0/0x13c)
 [<c045106c>] (__device_attach) from [<c0450464>] (bus_probe_device+0x84/0x8c)
 [<c0450464>] (bus_probe_device) from [<c04508f0>] (deferred_probe_work_func+0x64/0x90)
 [<c04508f0>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 4017fea4906ab391 ]---

But accordingly to Allwinner A33, A64 BSP codes [1] [2] this divider is clearly using 'format/lanes' for dsi divider value, dsi_clk.clk_div

Which would compute the pll_freq and set a clock rate for it in
[3] and [4] respectively.

Quoted 8 lines

The same issue has reproduced in A33, A64 with 4-lane and 2-lane devices and got fixed with this computation logic 'format/lanes', so this patch using dclk min and max dividers as per BSP.

[1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1106
[2] https://github.com/BPI-SINOVOIP/BPI-M64-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/disp_al.c#L213
[3] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1127
[4] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1161

Quoted 7 lines

In that mail, I've pointed out that clk_div isn't used for the TCON dclk divider:
http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629596.html

The only reply you've sent is that you indeed see that the divider is set to 4 in the BSP, but you're now saying that the BSP can change it. If so, then please point exactly the flaw in the explanation in that mail.

Frankly, I have explained these details in commit message and previous version patch[1] with print messages on the code.

BSP has tcon_div and dsi_div. dsi_div is dynamic which depends on bpp/lanes and it indeed depends on PLL computation (not tcon_div), anyway I have explained again on this initial link you mentioned. Please have a look and get back.

[1] https://patchwork.freedesktop.org/patch/291525/

author
#3 lore raw

Re: [PATCH v10 01/11] drm/sun4i: dsi: Fix TCON DRQ set bits

In reply to Maxime Ripard
Quoted 73 lines · Maxime Ripard
Quoted 71 lines · Jagan Teki

According to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h the current driver is trying to include sync timings along with front porch value while checking and computing drq set bits in non-burst mode.

mode->hsync_end - mode->hdisplay => horizontal front porch + sync

With adding additional sync timings, the dsi controller leads to wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00026-g01f0c75b902d-dirty #13
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
 [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
 [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
 [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
 [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
 [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
 [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace b57eb1e5c64c6b8b ]---
 random: fast init done
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for non-burst DSI mode can be computed based on "horizontal front porch" value only (no sync timings included).

Detailed evidence for drq set bits based on A33 BSP [1] [2]

Quoted 8 lines
Quoted 4 lines

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20 => (tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20 => tt->hor_front_porch - 20

The thing is, while your explanation on the DRM side is sound, Allwinner has been using the hbp field of their panel description to store what DRM calls the backporch and the sync period.

Exactly, hbp = backporch + sync
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046

And the above computation is rely on that as well. If you can see the final out of the above computation you can get the front porch value (w/o sync )

Quoted 4 lines

And nowhere in that commit log you are describing whether it's still an issue or not, and if it's not anymore how you did test that it's not the case anymore.

No, I have explained 1st and 2nd para about
00. There is any additional sync timings in the drq set bits 01: issue occur due to adding addition sync timings with longs on the panel, by referring
03: and later paragraphs proved that there is no sync timings used in BSP

Am I missing anythings?
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#19 lore raw

Re: [PATCH v10 02/11] drm/sun4i: dsi: Update start value in video start delay

In reply to Maxime Ripard
Quoted 69 lines · Maxime Ripard
Quoted 67 lines · Jagan Teki

start value in video start delay computation done in below commit is as per the legacy bsp drivers/video/sunxi/legacy.. "drm/sun4i: dsi: Change the start delay calculation" (sha1: da676c6aa6413d59ab0a80c97bbc273025e640b2)

This existing start delay computation gives start value of 35, for "bananapi,s070wv20-ct16" panel timings which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Tainted: G        W         5.1.0-next-20190514-00025-gf928bc7cc146 #15
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c90>] (dump_stack+0x84/0x98)
 [<c0688c90>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c0411cb0>] (drm_fb_helper_pan_display+0xac/0x1d0)
 [<c0411cb0>] (drm_fb_helper_pan_display) from [<c03a4e84>] (fb_pan_display+0xcc/0x134)
 [<c03a4e84>] (fb_pan_display) from [<c03b1214>] (bit_update_start+0x14/0x30)
 [<c03b1214>] (bit_update_start) from [<c03afe94>] (fbcon_switch+0x3d8/0x4e0)
 [<c03afe94>] (fbcon_switch) from [<c03ec930>] (redraw_screen+0x174/0x238)
 [<c03ec930>] (redraw_screen) from [<c03aceb4>] (fbcon_prepare_logo+0x3c4/0x400)
 [<c03aceb4>] (fbcon_prepare_logo) from [<c03ad2b8>] (fbcon_init+0x3c8/0x5ac)
 [<c03ad2b8>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b5b0>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b5b0>] (try_to_bring_up_master) from [<c044b680>] (__component_add+0x94/0x140)
 [<c044b680>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452f0c>] (platform_drv_probe+0x48/0x9c)
 [<c0452f0c>] (platform_drv_probe) from [<c04512e4>] (really_probe+0x1dc/0x2c8)
 [<c04512e4>] (really_probe) from [<c0451530>] (driver_probe_device+0x60/0x160)
 [<c0451530>] (driver_probe_device) from [<c044f7bc>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7bc>] (bus_for_each_drv) from [<c0451094>] (__device_attach+0xd0/0x13c)
 [<c0451094>] (__device_attach) from [<c045048c>] (bus_probe_device+0x84/0x8c)
 [<c045048c>] (bus_probe_device) from [<c0450918>] (deferred_probe_work_func+0x64/0x90)
 [<c0450918>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 755e10f62b83f396 ]---
 Console: switching to colour frame buffer device 100x30
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out
Quoted 4 lines
Quoted 2 lines

But the expected start delay value is 1 which is confirmed from new bsp [2].

If you're saying that the "legacy" link (second one) is the new BSP.

Will update, thanks.

Quoted 7 lines
Quoted 4 lines

The important and unclear note on legacy and new bsp codes [1] [2] is both use similar start computation initially but it later reassign it to 1 in new bsp.

Then start_delay is never reassigned to 1 in that link, and is clamped between 8 and 100 as the code that you are removing is doing.

Please see the link one more please
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L807

Quoted 6 lines
Quoted 4 lines

Unfortunately we don't have any evidence or documentation for this reassignment to 1 in new bsp, but it is working with all supported panels in A33, A64.

No, it's not. That was added to fix a panel that is supported today.

No, I have see this in A33, A64. and these are controller drivers right, if it panel fix and it should be part of panel driver isn't it?

We can even see the same in pin64 longsleep kernel and others.

https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L807
https://github.com/longsleep/linux-pine64/blob/pine64-hacks-1.2/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c#L730

author
#27 lore raw

Re: [PATCH v10 03/11] drm/sun4i: dsi: Fix video start delay computation

In reply to Maxime Ripard
Quoted 81 lines · Maxime Ripard
Quoted 79 lines · Jagan Teki

The current code is computing vertical video start delay as

delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;

On which the second parameter

mode->vsync_end - mode->vdisplay = front porch + sync timings

according to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h

With adding additional sync timings, the desired video start delay value as 510 for "bananapi,s070wv20-ct16" panel timings which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00029-g09e5b0ed0a58 #18
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
 [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
 [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
 [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
 [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
 [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
 [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 495200a78b24980e ]---
 random: fast init done
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But the expected video start delay value is 513 which states that the second parameter on the computation is "front porch" value (no sync timings included).

This is clearly confirmed from the legacy [1] and new [2] bsp codes that the second parameter on the video start delay is "front porch"

Here is the detailed evidence for calculating front porch as per bsp code.

Quoted 7 lines
Quoted 5 lines

vfp = panel->lcd_vt - panel->lcd_y - panel->lcd_vbp => (panel->lcd_vt) - panel->lcd_y - panel->lcd_vbp => (tt->ver_front_porch + lcdp->panel_info.lcd_vbp
+ lcdp->panel_info.lcd_y) - panel->lcd_y - panel->lcd_vbp
=> tt->ver_front_porch

The comment on patch 1 still applies on this patch

Thanks, I have responded on that. Same applies here.

#4 lore raw

Re: [PATCH v10 01/11] drm/sun4i: dsi: Fix TCON DRQ set bits

In reply to Jagan Teki
Quoted 83 lines · Jagan Teki
Quoted 73 lines · Maxime Ripard
Quoted 71 lines · Jagan Teki

According to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h the current driver is trying to include sync timings along with front porch value while checking and computing drq set bits in non-burst mode.

mode->hsync_end - mode->hdisplay => horizontal front porch + sync

With adding additional sync timings, the dsi controller leads to wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00026-g01f0c75b902d-dirty #13
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
 [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
 [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
 [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
 [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
 [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
 [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace b57eb1e5c64c6b8b ]---
 random: fast init done
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for non-burst DSI mode can be computed based on "horizontal front porch" value only (no sync timings included).

Detailed evidence for drq set bits based on A33 BSP [1] [2]

Quoted 8 lines
Quoted 4 lines

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20 => (tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20 => tt->hor_front_porch - 20

The thing is, while your explanation on the DRM side is sound, Allwinner has been using the hbp field of their panel description to store what DRM calls the backporch and the sync period.

Quoted 6 lines

Exactly, hbp = backporch + sync
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046

And the above computation is rely on that as well. If you can see the final out of the above computation you can get the front porch value (w/o sync )

As I was saying, you are explaining it well for DRM, but in order for your last formula (the one coming from the BSP) to make sense, you have to explain that the horizontal back porch for Allwinner contains the sync period, otherwise your expansion of lcd_ht doesn't make sense.

Quoted 11 lines
Quoted 3 lines

And nowhere in that commit log you are describing whether it's still an issue or not, and if it's not anymore how you did test that it's not the case anymore.

No, I have explained 1st and 2nd para about
00. There is any additional sync timings in the drq set bits 01: issue occur due to adding addition sync timings with longs on the panel, by referring
03: and later paragraphs proved that there is no sync timings used in BSP

Am I missing anythings?

I'm sorry, but I'm not quite sure what you mean here :/

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

author
#5 lore raw

Re: [PATCH v10 01/11] drm/sun4i: dsi: Fix TCON DRQ set bits

Quoted 92 lines · Maxime Ripard
Quoted 83 lines · Jagan Teki
Quoted 73 lines · Maxime Ripard
Quoted 71 lines · Jagan Teki

According to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h the current driver is trying to include sync timings along with front porch value while checking and computing drq set bits in non-burst mode.

mode->hsync_end - mode->hdisplay => horizontal front porch + sync

With adding additional sync timings, the dsi controller leads to wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00026-g01f0c75b902d-dirty #13
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
 [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
 [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
 [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
 [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
 [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
 [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace b57eb1e5c64c6b8b ]---
 random: fast init done
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for non-burst DSI mode can be computed based on "horizontal front porch" value only (no sync timings included).

Detailed evidence for drq set bits based on A33 BSP [1] [2]

Quoted 8 lines
Quoted 4 lines

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20 => (tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20 => tt->hor_front_porch - 20

The thing is, while your explanation on the DRM side is sound, Allwinner has been using the hbp field of their panel description to store what DRM calls the backporch and the sync period.

Quoted 6 lines

Exactly, hbp = backporch + sync
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046

And the above computation is rely on that as well. If you can see the final out of the above computation you can get the front porch value (w/o sync )

Quoted 5 lines

As I was saying, you are explaining it well for DRM, but in order for your last formula (the one coming from the BSP) to make sense, you have to explain that the horizontal back porch for Allwinner contains the sync period, otherwise your expansion of lcd_ht doesn't make sense.

I'm not sure why we need to take care of back porch since the formula clearly evaluating a result as front porch, without sync timing (as current code included this sync), I keep the hbp and trying to substitute the lcd_ht value so the end result would cancel hbp.

I have used this front porch formula from BSP tt->hor_front_porch= lcdp->panel_info.lcd_ht-lcdp->panel_info.lcd_hbp
- lcdp->panel_info.lcd_x;
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2047

and evaluated drq set-bit formula

tt->hor_front_porch= lcdp->panel_info.lcd_ht-lcdp->panel_info.lcd_hbp
- lcdp->panel_info.lcd_x;
lcdp->panel_info.lcd_ht = tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp (substitute the lcd_ht)
=> tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x - panel->lcd_x - panel->lcd_hbp (here hbp and lcd_x would cancel, and the result is front porch) => tt->hor_front_porch

Quoted 11 lines
Quoted 11 lines
Quoted 4 lines

And nowhere in that commit log you are describing whether it's still an issue or not, and if it's not anymore how you did test that it's not the case anymore.

No, I have explained 1st and 2nd para about
00. There is any additional sync timings in the drq set bits 01: issue occur due to adding addition sync timings with longs on the panel, by referring
03: and later paragraphs proved that there is no sync timings used in BSP

Quoted 3 lines
Quoted 1 line

Am I missing anythings?

I'm sorry, but I'm not quite sure what you mean here :/

I'm just mentioning how I fragmented/grouped the commit message.

#20 lore raw

Re: [PATCH v10 02/11] drm/sun4i: dsi: Update start value in video start delay

In reply to Jagan Teki
Quoted 93 lines · Jagan Teki
Quoted 69 lines · Maxime Ripard
Quoted 67 lines · Jagan Teki

start value in video start delay computation done in below commit is as per the legacy bsp drivers/video/sunxi/legacy.. "drm/sun4i: dsi: Change the start delay calculation" (sha1: da676c6aa6413d59ab0a80c97bbc273025e640b2)

This existing start delay computation gives start value of 35, for "bananapi,s070wv20-ct16" panel timings which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Tainted: G        W         5.1.0-next-20190514-00025-gf928bc7cc146 #15
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c90>] (dump_stack+0x84/0x98)
 [<c0688c90>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c0411cb0>] (drm_fb_helper_pan_display+0xac/0x1d0)
 [<c0411cb0>] (drm_fb_helper_pan_display) from [<c03a4e84>] (fb_pan_display+0xcc/0x134)
 [<c03a4e84>] (fb_pan_display) from [<c03b1214>] (bit_update_start+0x14/0x30)
 [<c03b1214>] (bit_update_start) from [<c03afe94>] (fbcon_switch+0x3d8/0x4e0)
 [<c03afe94>] (fbcon_switch) from [<c03ec930>] (redraw_screen+0x174/0x238)
 [<c03ec930>] (redraw_screen) from [<c03aceb4>] (fbcon_prepare_logo+0x3c4/0x400)
 [<c03aceb4>] (fbcon_prepare_logo) from [<c03ad2b8>] (fbcon_init+0x3c8/0x5ac)
 [<c03ad2b8>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b5b0>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b5b0>] (try_to_bring_up_master) from [<c044b680>] (__component_add+0x94/0x140)
 [<c044b680>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452f0c>] (platform_drv_probe+0x48/0x9c)
 [<c0452f0c>] (platform_drv_probe) from [<c04512e4>] (really_probe+0x1dc/0x2c8)
 [<c04512e4>] (really_probe) from [<c0451530>] (driver_probe_device+0x60/0x160)
 [<c0451530>] (driver_probe_device) from [<c044f7bc>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7bc>] (bus_for_each_drv) from [<c0451094>] (__device_attach+0xd0/0x13c)
 [<c0451094>] (__device_attach) from [<c045048c>] (bus_probe_device+0x84/0x8c)
 [<c045048c>] (bus_probe_device) from [<c0450918>] (deferred_probe_work_func+0x64/0x90)
 [<c0450918>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 755e10f62b83f396 ]---
 Console: switching to colour frame buffer device 100x30
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out
Quoted 4 lines
Quoted 2 lines

But the expected start delay value is 1 which is confirmed from new bsp [2].

If you're saying that the "legacy" link (second one) is the new BSP.

Will update, thanks.

Quoted 7 lines
Quoted 4 lines

The important and unclear note on legacy and new bsp codes [1] [2] is both use similar start computation initially but it later reassign it to 1 in new bsp.

Then start_delay is never reassigned to 1 in that link, and is clamped between 8 and 100 as the code that you are removing is doing.

Please see the link one more please
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L807

Quoted 5 lines
Quoted 4 lines

Unfortunately we don't have any evidence or documentation for this reassignment to 1 in new bsp, but it is working with all supported panels in A33, A64.

Quoted 5 lines
Quoted 1 line

No, it's not. That was added to fix a panel that is supported today.

No, I have see this in A33, A64. and these are controller drivers right, if it panel fix and it should be part of panel driver isn't it?

I'm not sure to follow that argument. You're submitting that fix to allow other panels to work, right? So surely, some issues that can be found using a given panel might not be solely fixed in the panel driver.

Quoted 4 lines

We can even see the same in pin64 longsleep kernel and others.

https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L807
https://github.com/longsleep/linux-pine64/blob/pine64-hacks-1.2/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c#L730

Yeah, and both of these have the legacy driver part with the clamping too.

I'll test these patches again some time next week

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#49 lore raw

Re: [PATCH v10 09/11] drm/sun4i: sun6i_mipi_dsi: Add VCC-DSI regulator support

In reply to Jagan Teki
Quoted 8 lines · Jagan Teki

Allwinner MIPI DSI controllers are supplied with SoC DSI power rails via VCC-DSI pin.

Add support for this supply pin by adding voltage
regulator handling code to MIPI DSI driver.

This creates a lot of warnings at boot time on my board this is missing vcc-dsi-supply.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#6 lore raw

Re: [PATCH v10 01/11] drm/sun4i: dsi: Fix TCON DRQ set bits

In reply to Jagan Teki
Quoted 99 lines · Jagan Teki
Quoted 92 lines · Maxime Ripard
Quoted 83 lines · Jagan Teki
Quoted 73 lines · Maxime Ripard
Quoted 71 lines · Jagan Teki

According to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h the current driver is trying to include sync timings along with front porch value while checking and computing drq set bits in non-burst mode.

mode->hsync_end - mode->hdisplay => horizontal front porch + sync

With adding additional sync timings, the dsi controller leads to wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00026-g01f0c75b902d-dirty #13
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
 [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
 [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
 [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
 [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
 [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
 [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace b57eb1e5c64c6b8b ]---
 random: fast init done
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for non-burst DSI mode can be computed based on "horizontal front porch" value only (no sync timings included).

Detailed evidence for drq set bits based on A33 BSP [1] [2]

Quoted 8 lines
Quoted 4 lines

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20 => (tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20 => tt->hor_front_porch - 20

The thing is, while your explanation on the DRM side is sound, Allwinner has been using the hbp field of their panel description to store what DRM calls the backporch and the sync period.

Quoted 6 lines

Exactly, hbp = backporch + sync
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046

And the above computation is rely on that as well. If you can see the final out of the above computation you can get the front porch value (w/o sync )

Quoted 5 lines

As I was saying, you are explaining it well for DRM, but in order for your last formula (the one coming from the BSP) to make sense, you have to explain that the horizontal back porch for Allwinner contains the sync period, otherwise your expansion of lcd_ht doesn't make sense.

Quoted 4 lines

I'm not sure why we need to take care of back porch since the formula clearly evaluating a result as front porch, without sync timing (as current code included this sync), I keep the hbp and trying to substitute the lcd_ht value so the end result would cancel hbp.

Because it changes how lcd_ht expands. In the DRM case, it will expand to the displayed area, the front porch, the sync period and the back porch.

In your case, you expand it to the displayed area, the front porch and the back porch, precisely because in Allwinner's case, the back porch has the sync period.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#33 lore raw

Re: [PATCH v10 04/11] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

In reply to Jagan Teki
Quoted 87 lines · Jagan Teki
Quoted 78 lines · Maxime Ripard
Quoted 67 lines · Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code is passing dsi min and max divider value as 4 via tcon driver which would ended-up triggering below vblank wait timed out warning on "bananapi,s070wv20-ct16" panel.

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00025-g5186cdf10757-dirty #6
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b588>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b588>] (try_to_bring_up_master) from [<c044b658>] (__component_add+0x94/0x140)
 [<c044b658>] (__component_add) from [<c0445e0c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e0c>] (sun6i_dsi_probe) from [<c0452ee4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ee4>] (platform_drv_probe) from [<c04512bc>] (really_probe+0x1dc/0x2c8)
 [<c04512bc>] (really_probe) from [<c0451508>] (driver_probe_device+0x60/0x160)
 [<c0451508>] (driver_probe_device) from [<c044f794>] (bus_for_each_drv+0x74/0xb8)
 [<c044f794>] (bus_for_each_drv) from [<c045106c>] (__device_attach+0xd0/0x13c)
 [<c045106c>] (__device_attach) from [<c0450464>] (bus_probe_device+0x84/0x8c)
 [<c0450464>] (bus_probe_device) from [<c04508f0>] (deferred_probe_work_func+0x64/0x90)
 [<c04508f0>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 4017fea4906ab391 ]---

But accordingly to Allwinner A33, A64 BSP codes [1] [2] this divider is clearly using 'format/lanes' for dsi divider value, dsi_clk.clk_div

Which would compute the pll_freq and set a clock rate for it in
[3] and [4] respectively.

Quoted 8 lines

The same issue has reproduced in A33, A64 with 4-lane and 2-lane devices and got fixed with this computation logic 'format/lanes', so this patch using dclk min and max dividers as per BSP.

[1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1106
[2] https://github.com/BPI-SINOVOIP/BPI-M64-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/disp_al.c#L213
[3] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1127
[4] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1161

Quoted 7 lines

In that mail, I've pointed out that clk_div isn't used for the TCON dclk divider:
http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629596.html

The only reply you've sent is that you indeed see that the divider is set to 4 in the BSP, but you're now saying that the BSP can change it. If so, then please point exactly the flaw in the explanation in that mail.

Quoted 7 lines

Frankly, I have explained these details in commit message and previous version patch[1] with print messages on the code.

BSP has tcon_div and dsi_div. dsi_div is dynamic which depends on bpp/lanes and it indeed depends on PLL computation (not tcon_div), anyway I have explained again on this initial link you mentioned. Please have a look and get back.

I'll have a look, thanks.

I've given your patches a try on my setup though, and this patch breaks it with vblank timeouts and some horizontal lines that looks like what should be displayed, but blinking and on the right of the display. The previous ones are fine though.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

author
#34 lore raw

Re: [linux-sunxi] Re: [PATCH v10 04/11] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

Quoted 97 lines · Maxime Ripard
Quoted 87 lines · Jagan Teki
Quoted 78 lines · Maxime Ripard
Quoted 67 lines · Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code is passing dsi min and max divider value as 4 via tcon driver which would ended-up triggering below vblank wait timed out warning on "bananapi,s070wv20-ct16" panel.

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00025-g5186cdf10757-dirty #6
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b588>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b588>] (try_to_bring_up_master) from [<c044b658>] (__component_add+0x94/0x140)
 [<c044b658>] (__component_add) from [<c0445e0c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e0c>] (sun6i_dsi_probe) from [<c0452ee4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ee4>] (platform_drv_probe) from [<c04512bc>] (really_probe+0x1dc/0x2c8)
 [<c04512bc>] (really_probe) from [<c0451508>] (driver_probe_device+0x60/0x160)
 [<c0451508>] (driver_probe_device) from [<c044f794>] (bus_for_each_drv+0x74/0xb8)
 [<c044f794>] (bus_for_each_drv) from [<c045106c>] (__device_attach+0xd0/0x13c)
 [<c045106c>] (__device_attach) from [<c0450464>] (bus_probe_device+0x84/0x8c)
 [<c0450464>] (bus_probe_device) from [<c04508f0>] (deferred_probe_work_func+0x64/0x90)
 [<c04508f0>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 4017fea4906ab391 ]---

But accordingly to Allwinner A33, A64 BSP codes [1] [2] this divider is clearly using 'format/lanes' for dsi divider value, dsi_clk.clk_div

Which would compute the pll_freq and set a clock rate for it in
[3] and [4] respectively.

Quoted 8 lines

The same issue has reproduced in A33, A64 with 4-lane and 2-lane devices and got fixed with this computation logic 'format/lanes', so this patch using dclk min and max dividers as per BSP.

[1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1106
[2] https://github.com/BPI-SINOVOIP/BPI-M64-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/disp_al.c#L213
[3] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1127
[4] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1161

Quoted 7 lines

In that mail, I've pointed out that clk_div isn't used for the TCON dclk divider:
http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629596.html

The only reply you've sent is that you indeed see that the divider is set to 4 in the BSP, but you're now saying that the BSP can change it. If so, then please point exactly the flaw in the explanation in that mail.

Quoted 7 lines

Frankly, I have explained these details in commit message and previous version patch[1] with print messages on the code.

BSP has tcon_div and dsi_div. dsi_div is dynamic which depends on bpp/lanes and it indeed depends on PLL computation (not tcon_div), anyway I have explained again on this initial link you mentioned. Please have a look and get back.

Quoted 6 lines

I'll have a look, thanks.

I've given your patches a try on my setup though, and this patch breaks it with vblank timeouts and some horizontal lines that looks like what should be displayed, but blinking and on the right of the display. The previous ones are fine though.

Would you please send me the link of panel driver.
_______________________________________________
dri-devel mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#7 lore raw

Re: [PATCH v10 01/11] drm/sun4i: dsi: Fix TCON DRQ set bits

In reply to Maxime Ripard
Quoted 106 lines · Maxime Ripard
Quoted 99 lines · Jagan Teki
Quoted 92 lines · Maxime Ripard
Quoted 83 lines · Jagan Teki
Quoted 73 lines · Maxime Ripard
Quoted 71 lines · Jagan Teki

According to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h the current driver is trying to include sync timings along with front porch value while checking and computing drq set bits in non-burst mode.

mode->hsync_end - mode->hdisplay => horizontal front porch + sync

With adding additional sync timings, the dsi controller leads to wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00026-g01f0c75b902d-dirty #13
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
 [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
 [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
 [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
 [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
 [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
 [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace b57eb1e5c64c6b8b ]---
 random: fast init done
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for non-burst DSI mode can be computed based on "horizontal front porch" value only (no sync timings included).

Detailed evidence for drq set bits based on A33 BSP [1] [2]

Quoted 8 lines
Quoted 4 lines

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20 => (tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20 => tt->hor_front_porch - 20

The thing is, while your explanation on the DRM side is sound, Allwinner has been using the hbp field of their panel description to store what DRM calls the backporch and the sync period.

Quoted 6 lines

Exactly, hbp = backporch + sync
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046

And the above computation is rely on that as well. If you can see the final out of the above computation you can get the front porch value (w/o sync )

Quoted 5 lines

As I was saying, you are explaining it well for DRM, but in order for your last formula (the one coming from the BSP) to make sense, you have to explain that the horizontal back porch for Allwinner contains the sync period, otherwise your expansion of lcd_ht doesn't make sense.

Quoted 4 lines

I'm not sure why we need to take care of back porch since the formula clearly evaluating a result as front porch, without sync timing (as current code included this sync), I keep the hbp and trying to substitute the lcd_ht value so the end result would cancel hbp.

Quoted 7 lines

Because it changes how lcd_ht expands. In the DRM case, it will expand to the displayed area, the front porch, the sync period and the back porch.

In your case, you expand it to the displayed area, the front porch and the back porch, precisely because in Allwinner's case, the back porch has the sync period.

I understand the point, but technically it matter about the final computation result. May be we can even manage the same computation in back porch, but I'm not sure. Since the final output doesn't involve any sync length, why we can include that ie what I'm not sure. with inclusion of sync timings we have wrong tcon drq set bit, it's been verified.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#50 lore raw

Re: [PATCH v10 09/11] drm/sun4i: sun6i_mipi_dsi: Add VCC-DSI regulator support

In reply to Maxime Ripard
Quoted 5 lines · Maxime Ripard
Quoted 3 lines · Jagan Teki

Allwinner MIPI DSI controllers are supplied with SoC DSI power rails via VCC-DSI pin.

Quoted 8 lines
Quoted 5 lines

Add support for this supply pin by adding voltage regulator handling code to MIPI DSI driver.

This creates a lot of warnings at boot time on my board this is missing vcc-dsi-supply.

Is it about regulator_put or similar, would you provide the log.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#21 lore raw

Re: [PATCH v10 02/11] drm/sun4i: dsi: Update start value in video start delay

In reply to Maxime Ripard
Quoted 97 lines · Maxime Ripard
Quoted 95 lines · Jagan Teki
Quoted 69 lines · Maxime Ripard
Quoted 67 lines · Jagan Teki

start value in video start delay computation done in below commit is as per the legacy bsp drivers/video/sunxi/legacy.. "drm/sun4i: dsi: Change the start delay calculation" (sha1: da676c6aa6413d59ab0a80c97bbc273025e640b2)

This existing start delay computation gives start value of 35, for "bananapi,s070wv20-ct16" panel timings which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Tainted: G        W         5.1.0-next-20190514-00025-gf928bc7cc146 #15
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c90>] (dump_stack+0x84/0x98)
 [<c0688c90>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c0411cb0>] (drm_fb_helper_pan_display+0xac/0x1d0)
 [<c0411cb0>] (drm_fb_helper_pan_display) from [<c03a4e84>] (fb_pan_display+0xcc/0x134)
 [<c03a4e84>] (fb_pan_display) from [<c03b1214>] (bit_update_start+0x14/0x30)
 [<c03b1214>] (bit_update_start) from [<c03afe94>] (fbcon_switch+0x3d8/0x4e0)
 [<c03afe94>] (fbcon_switch) from [<c03ec930>] (redraw_screen+0x174/0x238)
 [<c03ec930>] (redraw_screen) from [<c03aceb4>] (fbcon_prepare_logo+0x3c4/0x400)
 [<c03aceb4>] (fbcon_prepare_logo) from [<c03ad2b8>] (fbcon_init+0x3c8/0x5ac)
 [<c03ad2b8>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b5b0>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b5b0>] (try_to_bring_up_master) from [<c044b680>] (__component_add+0x94/0x140)
 [<c044b680>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452f0c>] (platform_drv_probe+0x48/0x9c)
 [<c0452f0c>] (platform_drv_probe) from [<c04512e4>] (really_probe+0x1dc/0x2c8)
 [<c04512e4>] (really_probe) from [<c0451530>] (driver_probe_device+0x60/0x160)
 [<c0451530>] (driver_probe_device) from [<c044f7bc>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7bc>] (bus_for_each_drv) from [<c0451094>] (__device_attach+0xd0/0x13c)
 [<c0451094>] (__device_attach) from [<c045048c>] (bus_probe_device+0x84/0x8c)
 [<c045048c>] (bus_probe_device) from [<c0450918>] (deferred_probe_work_func+0x64/0x90)
 [<c0450918>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 755e10f62b83f396 ]---
 Console: switching to colour frame buffer device 100x30
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out
Quoted 4 lines
Quoted 2 lines

But the expected start delay value is 1 which is confirmed from new bsp [2].

If you're saying that the "legacy" link (second one) is the new BSP.

Will update, thanks.

Quoted 7 lines
Quoted 4 lines

The important and unclear note on legacy and new bsp codes [1] [2] is both use similar start computation initially but it later reassign it to 1 in new bsp.

Then start_delay is never reassigned to 1 in that link, and is clamped between 8 and 100 as the code that you are removing is doing.

Please see the link one more please
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L807

Quoted 6 lines
Quoted 4 lines

Unfortunately we don't have any evidence or documentation for this reassignment to 1 in new bsp, but it is working with all supported panels in A33, A64.

No, it's not. That was added to fix a panel that is supported today.

Quoted 7 lines
Quoted 3 lines

No, I have see this in A33, A64. and these are controller drivers right, if it panel fix and it should be part of panel driver isn't it?

I'm not sure to follow that argument. You're submitting that fix to allow other panels to work, right? So surely, some issues that can be found using a given panel might not be solely fixed in the panel driver.

I'm not sure I understand this. I have been verifying different panels to check across. and this change literally in BSP and the BSP code is using this based on the logs confirmation. all the logs and working conditions shows that the fix would required in dsi.

Quoted 8 lines
Quoted 5 lines

We can even see the same in pin64 longsleep kernel and others.

https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L807
https://github.com/longsleep/linux-pine64/blob/pine64-hacks-1.2/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c#L730

Yeah, and both of these have the legacy driver part with the clamping too.

Yes, both legacy has clamping, but not using. they used it in new version driver which I'm referring above.

Quoted 2 lines

I'll test these patches again some time next week

Any help on the testing.

#51 lore raw

Re: [PATCH v10 09/11] drm/sun4i: sun6i_mipi_dsi: Add VCC-DSI regulator support

In reply to Jagan Teki
Quoted 9 lines · Jagan Teki
Quoted 8 lines · Maxime Ripard
Quoted 6 lines · Jagan Teki

Allwinner MIPI DSI controllers are supplied with SoC DSI power rails via VCC-DSI pin.

Add support for this supply pin by adding voltage
regulator handling code to MIPI DSI driver.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

This creates a lot of warnings at boot time on my board this is missing vcc-dsi-supply.

Is it about regulator_put or similar, would you provide the log.

Sure
http://code.bulix.org/whiea9-769551?raw

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#35 lore raw

Re: [linux-sunxi] Re: [PATCH v10 04/11] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

In reply to Jagan Teki
Quoted 98 lines · Jagan Teki
Quoted 97 lines · Maxime Ripard
Quoted 94 lines · Jagan Teki
Quoted 78 lines · Maxime Ripard
Quoted 67 lines · Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code is passing dsi min and max divider value as 4 via tcon driver which would ended-up triggering below vblank wait timed out warning on "bananapi,s070wv20-ct16" panel.

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00025-g5186cdf10757-dirty #6
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b588>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b588>] (try_to_bring_up_master) from [<c044b658>] (__component_add+0x94/0x140)
 [<c044b658>] (__component_add) from [<c0445e0c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e0c>] (sun6i_dsi_probe) from [<c0452ee4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ee4>] (platform_drv_probe) from [<c04512bc>] (really_probe+0x1dc/0x2c8)
 [<c04512bc>] (really_probe) from [<c0451508>] (driver_probe_device+0x60/0x160)
 [<c0451508>] (driver_probe_device) from [<c044f794>] (bus_for_each_drv+0x74/0xb8)
 [<c044f794>] (bus_for_each_drv) from [<c045106c>] (__device_attach+0xd0/0x13c)
 [<c045106c>] (__device_attach) from [<c0450464>] (bus_probe_device+0x84/0x8c)
 [<c0450464>] (bus_probe_device) from [<c04508f0>] (deferred_probe_work_func+0x64/0x90)
 [<c04508f0>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 4017fea4906ab391 ]---

But accordingly to Allwinner A33, A64 BSP codes [1] [2] this divider is clearly using 'format/lanes' for dsi divider value, dsi_clk.clk_div

Which would compute the pll_freq and set a clock rate for it in
[3] and [4] respectively.

Quoted 8 lines

The same issue has reproduced in A33, A64 with 4-lane and 2-lane devices and got fixed with this computation logic 'format/lanes', so this patch using dclk min and max dividers as per BSP.

[1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1106
[2] https://github.com/BPI-SINOVOIP/BPI-M64-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/disp_al.c#L213
[3] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1127
[4] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1161

Quoted 7 lines

In that mail, I've pointed out that clk_div isn't used for the TCON dclk divider:
http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629596.html

The only reply you've sent is that you indeed see that the divider is set to 4 in the BSP, but you're now saying that the BSP can change it. If so, then please point exactly the flaw in the explanation in that mail.

Frankly, I have explained these details in commit message and previous version patch[1] with print messages on the code.

BSP has tcon_div and dsi_div. dsi_div is dynamic which depends on bpp/lanes and it indeed depends on PLL computation (not tcon_div), anyway I have explained again on this initial link you mentioned. Please have a look and get back.

Quoted 8 lines
Quoted 6 lines

I'll have a look, thanks.

I've given your patches a try on my setup though, and this patch breaks it with vblank timeouts and some horizontal lines that looks like what should be displayed, but blinking and on the right of the display. The previous ones are fine though.

Would you please send me the link of panel driver.

It's drivers/gpu/drm/panel/panel-ronbo-rb070d30.c

Maximey

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#8 lore raw

Re: [PATCH v10 01/11] drm/sun4i: dsi: Fix TCON DRQ set bits

In reply to Jagan Teki
Quoted 111 lines · Jagan Teki
Quoted 110 lines · Maxime Ripard
Quoted 99 lines · Jagan Teki
Quoted 92 lines · Maxime Ripard
Quoted 83 lines · Jagan Teki
Quoted 73 lines · Maxime Ripard
Quoted 71 lines · Jagan Teki

According to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h the current driver is trying to include sync timings along with front porch value while checking and computing drq set bits in non-burst mode.

mode->hsync_end - mode->hdisplay => horizontal front porch + sync

With adding additional sync timings, the dsi controller leads to wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00026-g01f0c75b902d-dirty #13
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
 [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
 [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
 [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
 [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
 [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
 [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace b57eb1e5c64c6b8b ]---
 random: fast init done
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for non-burst DSI mode can be computed based on "horizontal front porch" value only (no sync timings included).

Detailed evidence for drq set bits based on A33 BSP [1] [2]

Quoted 8 lines
Quoted 4 lines

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20 => (tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20 => tt->hor_front_porch - 20

The thing is, while your explanation on the DRM side is sound, Allwinner has been using the hbp field of their panel description to store what DRM calls the backporch and the sync period.

Quoted 6 lines

Exactly, hbp = backporch + sync
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046

And the above computation is rely on that as well. If you can see the final out of the above computation you can get the front porch value (w/o sync )

Quoted 5 lines

As I was saying, you are explaining it well for DRM, but in order for your last formula (the one coming from the BSP) to make sense, you have to explain that the horizontal back porch for Allwinner contains the sync period, otherwise your expansion of lcd_ht doesn't make sense.

Quoted 4 lines

I'm not sure why we need to take care of back porch since the formula clearly evaluating a result as front porch, without sync timing (as current code included this sync), I keep the hbp and trying to substitute the lcd_ht value so the end result would cancel hbp.

Because it changes how lcd_ht expands. In the DRM case, it will expand to the displayed area, the front porch, the sync period and the back porch.

Quoted 8 lines
Quoted 3 lines

In your case, you expand it to the displayed area, the front porch and the back porch, precisely because in Allwinner's case, the back porch has the sync period.

I understand the point, but technically it matter about the final computation result. May be we can even manage the same computation in back porch, but I'm not sure. Since the final output doesn't involve any sync length, why we can include that ie what I'm not sure.

We have the following formula:
lcd_ht - lcd_x - lcd_hbp - 20

Using the concepts as they are defined in DRM, this expands to:
x + hbp + hsync + hfp - x - hbp - 20

which ends up as
hsync + hfp - 20

Now, the same formula with how Allwinner defines it:
x + hbp + hfp - x - hbp - 20

which ends up as
hfp - 20

So it definitely matters, and the sync period is used in one but not the other.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

author
#9 lore raw

Re: [PATCH v10 01/11] drm/sun4i: dsi: Fix TCON DRQ set bits

Quoted 122 lines · Maxime Ripard
Quoted 111 lines · Jagan Teki
Quoted 110 lines · Maxime Ripard
Quoted 99 lines · Jagan Teki
Quoted 92 lines · Maxime Ripard
Quoted 83 lines · Jagan Teki
Quoted 73 lines · Maxime Ripard
Quoted 71 lines · Jagan Teki

According to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h the current driver is trying to include sync timings along with front porch value while checking and computing drq set bits in non-burst mode.

mode->hsync_end - mode->hdisplay => horizontal front porch + sync

With adding additional sync timings, the dsi controller leads to wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00026-g01f0c75b902d-dirty #13
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
 [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
 [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
 [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
 [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
 [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
 [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace b57eb1e5c64c6b8b ]---
 random: fast init done
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for non-burst DSI mode can be computed based on "horizontal front porch" value only (no sync timings included).

Detailed evidence for drq set bits based on A33 BSP [1] [2]

Quoted 8 lines
Quoted 4 lines

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20 => (tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20 => tt->hor_front_porch - 20

The thing is, while your explanation on the DRM side is sound, Allwinner has been using the hbp field of their panel description to store what DRM calls the backporch and the sync period.

Quoted 6 lines

Exactly, hbp = backporch + sync
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046

And the above computation is rely on that as well. If you can see the final out of the above computation you can get the front porch value (w/o sync )

Quoted 5 lines

As I was saying, you are explaining it well for DRM, but in order for your last formula (the one coming from the BSP) to make sense, you have to explain that the horizontal back porch for Allwinner contains the sync period, otherwise your expansion of lcd_ht doesn't make sense.

Quoted 4 lines

I'm not sure why we need to take care of back porch since the formula clearly evaluating a result as front porch, without sync timing (as current code included this sync), I keep the hbp and trying to substitute the lcd_ht value so the end result would cancel hbp.

Because it changes how lcd_ht expands. In the DRM case, it will expand to the displayed area, the front porch, the sync period and the back porch.

Quoted 8 lines
Quoted 3 lines

In your case, you expand it to the displayed area, the front porch and the back porch, precisely because in Allwinner's case, the back porch has the sync period.

I understand the point, but technically it matter about the final computation result. May be we can even manage the same computation in back porch, but I'm not sure. Since the final output doesn't involve any sync length, why we can include that ie what I'm not sure.

Quoted 5 lines

We have the following formula:
lcd_ht - lcd_x - lcd_hbp - 20

Using the concepts as they are defined in DRM, this expands to:
x + hbp + hsync + hfp - x - hbp - 20

Here is diff between allwinner hbp vs hbp in DRM.

Say hbp in DRM can call it hbackporch, so

=> x + hbackporch + hsync + hfp - -x - hbp - 20

(and here we need to substitute hbp formula from allwinner since the actual equation would coming from there
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046)

=> x + hbackporch + hsync + hfp - x - (hbackporch + hsync) - 20 => x + hbackporch + hsync + hfp - x - hbackporch - hsync - 20 => hfp - 20

Quoted 8 lines

which ends up as
hsync + hfp - 20

Now, the same formula with how Allwinner defines it:
x + hbp + hfp - x - hbp - 20
which ends up as
hfp - 20

This is true, and same I have explained in commit log. and hbp here is as per allwinner so we endedup hfp. which is satisfied by above DRM equation.

Quoted 3 lines

So it definitely matters, and the sync period is used in one but not the other.

With the above explanation there is no sync included.

author
#36 lore raw

Re: [linux-sunxi] Re: [PATCH v10 04/11] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

In reply to Maxime Ripard
Quoted 102 lines · Maxime Ripard
Quoted 100 lines · Jagan Teki
Quoted 99 lines · Maxime Ripard
Quoted 87 lines · Jagan Teki
Quoted 78 lines · Maxime Ripard
Quoted 67 lines · Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code is passing dsi min and max divider value as 4 via tcon driver which would ended-up triggering below vblank wait timed out warning on "bananapi,s070wv20-ct16" panel.

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00025-g5186cdf10757-dirty #6
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b588>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b588>] (try_to_bring_up_master) from [<c044b658>] (__component_add+0x94/0x140)
 [<c044b658>] (__component_add) from [<c0445e0c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e0c>] (sun6i_dsi_probe) from [<c0452ee4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ee4>] (platform_drv_probe) from [<c04512bc>] (really_probe+0x1dc/0x2c8)
 [<c04512bc>] (really_probe) from [<c0451508>] (driver_probe_device+0x60/0x160)
 [<c0451508>] (driver_probe_device) from [<c044f794>] (bus_for_each_drv+0x74/0xb8)
 [<c044f794>] (bus_for_each_drv) from [<c045106c>] (__device_attach+0xd0/0x13c)
 [<c045106c>] (__device_attach) from [<c0450464>] (bus_probe_device+0x84/0x8c)
 [<c0450464>] (bus_probe_device) from [<c04508f0>] (deferred_probe_work_func+0x64/0x90)
 [<c04508f0>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 4017fea4906ab391 ]---

But accordingly to Allwinner A33, A64 BSP codes [1] [2] this divider is clearly using 'format/lanes' for dsi divider value, dsi_clk.clk_div

Which would compute the pll_freq and set a clock rate for it in
[3] and [4] respectively.

Quoted 8 lines

The same issue has reproduced in A33, A64 with 4-lane and 2-lane devices and got fixed with this computation logic 'format/lanes', so this patch using dclk min and max dividers as per BSP.

[1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1106
[2] https://github.com/BPI-SINOVOIP/BPI-M64-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/disp_al.c#L213
[3] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1127
[4] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1161

Quoted 7 lines

In that mail, I've pointed out that clk_div isn't used for the TCON dclk divider:
http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629596.html

The only reply you've sent is that you indeed see that the divider is set to 4 in the BSP, but you're now saying that the BSP can change it. If so, then please point exactly the flaw in the explanation in that mail.

Quoted 7 lines

Frankly, I have explained these details in commit message and previous version patch[1] with print messages on the code.

BSP has tcon_div and dsi_div. dsi_div is dynamic which depends on bpp/lanes and it indeed depends on PLL computation (not tcon_div), anyway I have explained again on this initial link you mentioned. Please have a look and get back.

I'll have a look, thanks.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I've given your patches a try on my setup though, and this patch breaks it with vblank timeouts and some horizontal lines that looks like what should be displayed, but blinking and on the right of the display. The previous ones are fine though.

Would you please send me the link of panel driver.

It's drivers/gpu/drm/panel/panel-ronbo-rb070d30.c

Look like this panel work even w/o any vendor sequence. it's similar to the 4-lane panel I have with RGB888, so the dclk div is 6, is it working with this divider?

#22 lore raw

Re: [PATCH v10 02/11] drm/sun4i: dsi: Update start value in video start delay

In reply to Jagan Teki
Quoted 103 lines · Jagan Teki
Quoted 101 lines · Maxime Ripard
Quoted 98 lines · Jagan Teki
Quoted 69 lines · Maxime Ripard
Quoted 67 lines · Jagan Teki

start value in video start delay computation done in below commit is as per the legacy bsp drivers/video/sunxi/legacy.. "drm/sun4i: dsi: Change the start delay calculation" (sha1: da676c6aa6413d59ab0a80c97bbc273025e640b2)

This existing start delay computation gives start value of 35, for "bananapi,s070wv20-ct16" panel timings which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Tainted: G        W         5.1.0-next-20190514-00025-gf928bc7cc146 #15
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c90>] (dump_stack+0x84/0x98)
 [<c0688c90>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c0411cb0>] (drm_fb_helper_pan_display+0xac/0x1d0)
 [<c0411cb0>] (drm_fb_helper_pan_display) from [<c03a4e84>] (fb_pan_display+0xcc/0x134)
 [<c03a4e84>] (fb_pan_display) from [<c03b1214>] (bit_update_start+0x14/0x30)
 [<c03b1214>] (bit_update_start) from [<c03afe94>] (fbcon_switch+0x3d8/0x4e0)
 [<c03afe94>] (fbcon_switch) from [<c03ec930>] (redraw_screen+0x174/0x238)
 [<c03ec930>] (redraw_screen) from [<c03aceb4>] (fbcon_prepare_logo+0x3c4/0x400)
 [<c03aceb4>] (fbcon_prepare_logo) from [<c03ad2b8>] (fbcon_init+0x3c8/0x5ac)
 [<c03ad2b8>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b5b0>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b5b0>] (try_to_bring_up_master) from [<c044b680>] (__component_add+0x94/0x140)
 [<c044b680>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452f0c>] (platform_drv_probe+0x48/0x9c)
 [<c0452f0c>] (platform_drv_probe) from [<c04512e4>] (really_probe+0x1dc/0x2c8)
 [<c04512e4>] (really_probe) from [<c0451530>] (driver_probe_device+0x60/0x160)
 [<c0451530>] (driver_probe_device) from [<c044f7bc>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7bc>] (bus_for_each_drv) from [<c0451094>] (__device_attach+0xd0/0x13c)
 [<c0451094>] (__device_attach) from [<c045048c>] (bus_probe_device+0x84/0x8c)
 [<c045048c>] (bus_probe_device) from [<c0450918>] (deferred_probe_work_func+0x64/0x90)
 [<c0450918>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 755e10f62b83f396 ]---
 Console: switching to colour frame buffer device 100x30
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out
Quoted 4 lines
Quoted 2 lines

But the expected start delay value is 1 which is confirmed from new bsp [2].

If you're saying that the "legacy" link (second one) is the new BSP.

Will update, thanks.

Quoted 7 lines
Quoted 4 lines

The important and unclear note on legacy and new bsp codes [1] [2] is both use similar start computation initially but it later reassign it to 1 in new bsp.

Then start_delay is never reassigned to 1 in that link, and is clamped between 8 and 100 as the code that you are removing is doing.

Please see the link one more please
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L807

Quoted 6 lines
Quoted 4 lines

Unfortunately we don't have any evidence or documentation for this reassignment to 1 in new bsp, but it is working with all supported panels in A33, A64.

No, it's not. That was added to fix a panel that is supported today.

No, I have see this in A33, A64. and these are controller drivers right, if it panel fix and it should be part of panel driver isn't it?

Quoted 8 lines
Quoted 3 lines

I'm not sure to follow that argument. You're submitting that fix to allow other panels to work, right? So surely, some issues that can be found using a given panel might not be solely fixed in the panel driver.

I'm not sure I understand this. I have been verifying different panels to check across. and this change literally in BSP and the BSP code is using this based on the logs confirmation. all the logs and working conditions shows that the fix would required in dsi.

You were saying that your fix was working with all supported panels in A33, A64. That's simply not true, since at least one of mine will be broken by this.

You can say that it fixes all the panels *you* have, but it's certainly not all of them.

Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

We can even see the same in pin64 longsleep kernel and others.

https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L807
https://github.com/longsleep/linux-pine64/blob/pine64-hacks-1.2/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c#L730

Yeah, and both of these have the legacy driver part with the clamping too.

Yes, both legacy has clamping, but not using.

See the links above, they are being used.

Quoted 1 line

they used it in new version driver which I'm referring above.

I'm sorry, but I just don't get what you're saying. The links mentionned above are clearly showing that it's being used, while the other, !legacy, driver doesn't have them anymore. So it seems to be exactly the opposite of what you're saying.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#10 lore raw

Re: [PATCH v10 01/11] drm/sun4i: dsi: Fix TCON DRQ set bits

In reply to Jagan Teki
Quoted 131 lines · Jagan Teki
Quoted 122 lines · Maxime Ripard
Quoted 111 lines · Jagan Teki
Quoted 110 lines · Maxime Ripard
Quoted 99 lines · Jagan Teki
Quoted 92 lines · Maxime Ripard
Quoted 83 lines · Jagan Teki
Quoted 73 lines · Maxime Ripard
Quoted 71 lines · Jagan Teki

According to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h the current driver is trying to include sync timings along with front porch value while checking and computing drq set bits in non-burst mode.

mode->hsync_end - mode->hdisplay => horizontal front porch + sync

With adding additional sync timings, the dsi controller leads to wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00026-g01f0c75b902d-dirty #13
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
 [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
 [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
 [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
 [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
 [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
 [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace b57eb1e5c64c6b8b ]---
 random: fast init done
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for non-burst DSI mode can be computed based on "horizontal front porch" value only (no sync timings included).

Detailed evidence for drq set bits based on A33 BSP [1] [2]

Quoted 8 lines
Quoted 4 lines

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20 => (tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20 => tt->hor_front_porch - 20

The thing is, while your explanation on the DRM side is sound, Allwinner has been using the hbp field of their panel description to store what DRM calls the backporch and the sync period.

Quoted 6 lines

Exactly, hbp = backporch + sync
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046

And the above computation is rely on that as well. If you can see the final out of the above computation you can get the front porch value (w/o sync )

Quoted 5 lines

As I was saying, you are explaining it well for DRM, but in order for your last formula (the one coming from the BSP) to make sense, you have to explain that the horizontal back porch for Allwinner contains the sync period, otherwise your expansion of lcd_ht doesn't make sense.

Quoted 4 lines

I'm not sure why we need to take care of back porch since the formula clearly evaluating a result as front porch, without sync timing (as current code included this sync), I keep the hbp and trying to substitute the lcd_ht value so the end result would cancel hbp.

Because it changes how lcd_ht expands. In the DRM case, it will expand to the displayed area, the front porch, the sync period and the back porch.

Quoted 8 lines
Quoted 3 lines

In your case, you expand it to the displayed area, the front porch and the back porch, precisely because in Allwinner's case, the back porch has the sync period.

I understand the point, but technically it matter about the final computation result. May be we can even manage the same computation in back porch, but I'm not sure. Since the final output doesn't involve any sync length, why we can include that ie what I'm not sure.

Quoted 5 lines

We have the following formula:
lcd_ht - lcd_x - lcd_hbp - 20

Using the concepts as they are defined in DRM, this expands to:
x + hbp + hsync + hfp - x - hbp - 20

Here is diff between allwinner hbp vs hbp in DRM.

Quoted 7 lines

Say hbp in DRM can call it hbackporch, so

=> x + hbackporch + hsync + hfp - -x - hbp - 20

(and here we need to substitute hbp formula from allwinner since the actual equation would coming from there
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046)

And this is precisely what needs to be said, with an explanation about where that hor_back_porch is being used later on, and what impact it could have.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

author
#11 lore raw

Re: [PATCH v10 01/11] drm/sun4i: dsi: Fix TCON DRQ set bits

Quoted 137 lines · Maxime Ripard
Quoted 135 lines · Jagan Teki
Quoted 122 lines · Maxime Ripard
Quoted 111 lines · Jagan Teki
Quoted 110 lines · Maxime Ripard
Quoted 99 lines · Jagan Teki
Quoted 92 lines · Maxime Ripard
Quoted 83 lines · Jagan Teki
Quoted 73 lines · Maxime Ripard
Quoted 71 lines · Jagan Teki

According to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h the current driver is trying to include sync timings along with front porch value while checking and computing drq set bits in non-burst mode.

mode->hsync_end - mode->hdisplay => horizontal front porch + sync

With adding additional sync timings, the dsi controller leads to wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00026-g01f0c75b902d-dirty #13
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
 [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
 [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
 [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
 [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
 [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
 [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace b57eb1e5c64c6b8b ]---
 random: fast init done
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for non-burst DSI mode can be computed based on "horizontal front porch" value only (no sync timings included).

Detailed evidence for drq set bits based on A33 BSP [1] [2]

Quoted 8 lines
Quoted 4 lines

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20 => (tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20 => tt->hor_front_porch - 20

The thing is, while your explanation on the DRM side is sound, Allwinner has been using the hbp field of their panel description to store what DRM calls the backporch and the sync period.

Quoted 6 lines

Exactly, hbp = backporch + sync
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046

And the above computation is rely on that as well. If you can see the final out of the above computation you can get the front porch value (w/o sync )

Quoted 5 lines

As I was saying, you are explaining it well for DRM, but in order for your last formula (the one coming from the BSP) to make sense, you have to explain that the horizontal back porch for Allwinner contains the sync period, otherwise your expansion of lcd_ht doesn't make sense.

Quoted 4 lines

I'm not sure why we need to take care of back porch since the formula clearly evaluating a result as front porch, without sync timing (as current code included this sync), I keep the hbp and trying to substitute the lcd_ht value so the end result would cancel hbp.

Because it changes how lcd_ht expands. In the DRM case, it will expand to the displayed area, the front porch, the sync period and the back porch.

Quoted 8 lines
Quoted 3 lines

In your case, you expand it to the displayed area, the front porch and the back porch, precisely because in Allwinner's case, the back porch has the sync period.

I understand the point, but technically it matter about the final computation result. May be we can even manage the same computation in back porch, but I'm not sure. Since the final output doesn't involve any sync length, why we can include that ie what I'm not sure.

Quoted 5 lines

We have the following formula:
lcd_ht - lcd_x - lcd_hbp - 20

Using the concepts as they are defined in DRM, this expands to:
x + hbp + hsync + hfp - x - hbp - 20

Here is diff between allwinner hbp vs hbp in DRM.

Say hbp in DRM can call it hbackporch, so

=> x + hbackporch + hsync + hfp - -x - hbp - 20

Quoted 7 lines
Quoted 3 lines

(and here we need to substitute hbp formula from allwinner since the actual equation would coming from there
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046)

And this is precisely what needs to be said, with an explanation about where that hor_back_porch is being used later on, and what impact it could have.

Yes, it an equation and the mathematical equations can be substitute to variety kind I did agree with that, whether you can use hbackporch or not or use another-way the final resulting value is equivalent to the value of front porch. In that case we can solve based on what I explained above. If you still dought me, please run BSP and check the resulting value on this check, you can get the front porch value.

author
#23 lore raw

Re: [PATCH v10 02/11] drm/sun4i: dsi: Update start value in video start delay

In reply to Maxime Ripard
Quoted 114 lines · Maxime Ripard
Quoted 103 lines · Jagan Teki
Quoted 101 lines · Maxime Ripard
Quoted 98 lines · Jagan Teki
Quoted 69 lines · Maxime Ripard
Quoted 67 lines · Jagan Teki

start value in video start delay computation done in below commit is as per the legacy bsp drivers/video/sunxi/legacy.. "drm/sun4i: dsi: Change the start delay calculation" (sha1: da676c6aa6413d59ab0a80c97bbc273025e640b2)

This existing start delay computation gives start value of 35, for "bananapi,s070wv20-ct16" panel timings which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Tainted: G        W         5.1.0-next-20190514-00025-gf928bc7cc146 #15
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c90>] (dump_stack+0x84/0x98)
 [<c0688c90>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c0411cb0>] (drm_fb_helper_pan_display+0xac/0x1d0)
 [<c0411cb0>] (drm_fb_helper_pan_display) from [<c03a4e84>] (fb_pan_display+0xcc/0x134)
 [<c03a4e84>] (fb_pan_display) from [<c03b1214>] (bit_update_start+0x14/0x30)
 [<c03b1214>] (bit_update_start) from [<c03afe94>] (fbcon_switch+0x3d8/0x4e0)
 [<c03afe94>] (fbcon_switch) from [<c03ec930>] (redraw_screen+0x174/0x238)
 [<c03ec930>] (redraw_screen) from [<c03aceb4>] (fbcon_prepare_logo+0x3c4/0x400)
 [<c03aceb4>] (fbcon_prepare_logo) from [<c03ad2b8>] (fbcon_init+0x3c8/0x5ac)
 [<c03ad2b8>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b5b0>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b5b0>] (try_to_bring_up_master) from [<c044b680>] (__component_add+0x94/0x140)
 [<c044b680>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452f0c>] (platform_drv_probe+0x48/0x9c)
 [<c0452f0c>] (platform_drv_probe) from [<c04512e4>] (really_probe+0x1dc/0x2c8)
 [<c04512e4>] (really_probe) from [<c0451530>] (driver_probe_device+0x60/0x160)
 [<c0451530>] (driver_probe_device) from [<c044f7bc>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7bc>] (bus_for_each_drv) from [<c0451094>] (__device_attach+0xd0/0x13c)
 [<c0451094>] (__device_attach) from [<c045048c>] (bus_probe_device+0x84/0x8c)
 [<c045048c>] (bus_probe_device) from [<c0450918>] (deferred_probe_work_func+0x64/0x90)
 [<c0450918>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 755e10f62b83f396 ]---
 Console: switching to colour frame buffer device 100x30
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out
Quoted 4 lines
Quoted 2 lines

But the expected start delay value is 1 which is confirmed from new bsp [2].

If you're saying that the "legacy" link (second one) is the new BSP.

Will update, thanks.

Quoted 7 lines
Quoted 4 lines

The important and unclear note on legacy and new bsp codes [1] [2] is both use similar start computation initially but it later reassign it to 1 in new bsp.

Then start_delay is never reassigned to 1 in that link, and is clamped between 8 and 100 as the code that you are removing is doing.

Please see the link one more please
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L807

Quoted 6 lines
Quoted 4 lines

Unfortunately we don't have any evidence or documentation for this reassignment to 1 in new bsp, but it is working with all supported panels in A33, A64.

No, it's not. That was added to fix a panel that is supported today.

No, I have see this in A33, A64. and these are controller drivers right, if it panel fix and it should be part of panel driver isn't it?

Quoted 8 lines
Quoted 3 lines

I'm not sure to follow that argument. You're submitting that fix to allow other panels to work, right? So surely, some issues that can be found using a given panel might not be solely fixed in the panel driver.

I'm not sure I understand this. I have been verifying different panels to check across. and this change literally in BSP and the BSP code is using this based on the logs confirmation. all the logs and working conditions shows that the fix would required in dsi.

Quoted 6 lines

You were saying that your fix was working with all supported panels in A33, A64. That's simply not true, since at least one of mine will be broken by this.

You can say that it fixes all the panels *you* have, but it's certainly not all of them.

The panels I have are running A33, A64 AW BSP and there are not using legacy drivers. better you can use what AW BSP's are using, if something not working with AW bsp then there can be an issue on the panel init sequence or timings.

Quoted 11 lines
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines

We can even see the same in pin64 longsleep kernel and others.

https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L807
https://github.com/longsleep/linux-pine64/blob/pine64-hacks-1.2/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c#L730

Yeah, and both of these have the legacy driver part with the clamping too.

Yes, both legacy has clamping, but not using.

Quoted 8 lines

See the links above, they are being used.

Quoted 1 line

they used it in new version driver which I'm referring above.

I'm sorry, but I just don't get what you're saying. The links mentionned above are clearly showing that it's being used, while the other, !legacy, driver doesn't have them anymore. So it seems to be exactly the opposite of what you're saying.

legacy drivers have the clamping of what the current code has, I agree that point. but the new version BSP driver which is running on right now, don't have clamping instead they do have a change what this patch has.

#12 lore raw

Re: [linux-sunxi] Re: [PATCH v10 01/11] drm/sun4i: dsi: Fix TCON DRQ set bits

In reply to Jagan Teki
Quoted 147 lines · Jagan Teki
Quoted 137 lines · Maxime Ripard
Quoted 135 lines · Jagan Teki
Quoted 122 lines · Maxime Ripard
Quoted 111 lines · Jagan Teki
Quoted 110 lines · Maxime Ripard
Quoted 99 lines · Jagan Teki
Quoted 92 lines · Maxime Ripard
Quoted 83 lines · Jagan Teki
Quoted 73 lines · Maxime Ripard
Quoted 71 lines · Jagan Teki

According to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h the current driver is trying to include sync timings along with front porch value while checking and computing drq set bits in non-burst mode.

mode->hsync_end - mode->hdisplay => horizontal front porch + sync

With adding additional sync timings, the dsi controller leads to wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00026-g01f0c75b902d-dirty #13
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
 [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
 [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
 [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
 [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
 [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
 [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace b57eb1e5c64c6b8b ]---
 random: fast init done
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for non-burst DSI mode can be computed based on "horizontal front porch" value only (no sync timings included).

Detailed evidence for drq set bits based on A33 BSP [1] [2]

Quoted 8 lines
Quoted 4 lines

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20 => (tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20 => tt->hor_front_porch - 20

The thing is, while your explanation on the DRM side is sound, Allwinner has been using the hbp field of their panel description to store what DRM calls the backporch and the sync period.

Quoted 6 lines

Exactly, hbp = backporch + sync
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046

And the above computation is rely on that as well. If you can see the final out of the above computation you can get the front porch value (w/o sync )

Quoted 5 lines

As I was saying, you are explaining it well for DRM, but in order for your last formula (the one coming from the BSP) to make sense, you have to explain that the horizontal back porch for Allwinner contains the sync period, otherwise your expansion of lcd_ht doesn't make sense.

Quoted 4 lines

I'm not sure why we need to take care of back porch since the formula clearly evaluating a result as front porch, without sync timing (as current code included this sync), I keep the hbp and trying to substitute the lcd_ht value so the end result would cancel hbp.

Because it changes how lcd_ht expands. In the DRM case, it will expand to the displayed area, the front porch, the sync period and the back porch.

Quoted 8 lines
Quoted 3 lines

In your case, you expand it to the displayed area, the front porch and the back porch, precisely because in Allwinner's case, the back porch has the sync period.

I understand the point, but technically it matter about the final computation result. May be we can even manage the same computation in back porch, but I'm not sure. Since the final output doesn't involve any sync length, why we can include that ie what I'm not sure.

Quoted 5 lines

We have the following formula:
lcd_ht - lcd_x - lcd_hbp - 20

Using the concepts as they are defined in DRM, this expands to:
x + hbp + hsync + hfp - x - hbp - 20

Here is diff between allwinner hbp vs hbp in DRM.

Say hbp in DRM can call it hbackporch, so

=> x + hbackporch + hsync + hfp - -x - hbp - 20

Quoted 7 lines
Quoted 3 lines

(and here we need to substitute hbp formula from allwinner since the actual equation would coming from there
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046)

And this is precisely what needs to be said, with an explanation about where that hor_back_porch is being used later on, and what impact it could have.

Quoted 6 lines

Yes, it an equation and the mathematical equations can be substitute to variety kind I did agree with that, whether you can use hbackporch or not or use another-way the final resulting value is equivalent to the value of front porch. In that case we can solve based on what I explained above. If you still dought me, please run BSP and check the resulting value on this check, you can get the front porch value.

Maxime is not doubting you. He is saying that you need to include the detailed explanation in your commit log, and not just reference pieces of code. This is separate from the requirement of having a correct patch.

Providing just a mathematical formula isn't enough either, because it is not clear to the average reader which term expanded into what. A better way to do is to first provide the definition of each term in a form easy to understand, such as the following:

List of LCD parameters as defined by Allwinner, explained using terms from the DRM subsystem:

- lcd_ht: horizontal total size
- lcd_x: horizontal display size
- lcd_hbp: horizontal sync + backporch

Or better yet, copy the diagram from drm_modes.h and add lcd_* to the bottom to show the differences.

    <-------------------------------- lcd_[hv]t ----------------------------->
    <----- lcd_[xy] -------->                  <-------- lcd_[hv]bp --------->

             Active                 Front           Sync           Back
             Region                 Porch                          Porch
    <-----------------------><----------------><-------------><-------------->
      //////////////////////|
     ////////////////////// |
    //////////////////////  |..................               ................
                                               _______________
    <----- [hv]display ----->
    <------------- [hv]sync_start ------------>
    <--------------------- [hv]sync_end --------------------->
    <-------------------------------- [hv]total ----------------------------->

Then you can go on explain what effect the difference in the definition of "backporch" has on the piece of code you are fixing:

The DSI driver misinterpreted the hbp term from the BSP code to refer only to the backporch, when in fact it was backporch + sync. Thus the driver incorrectly used the horizontal front porch plus sync in its calculation of the DRQ value, when it should not have included the sync period.

The above explains how you came to create your fix. At this point you don't even need to include the mathematical formulas anymore.

The why you already explained, the flip_done time outs. The result you haven't explained, but it can be as simple as:

With the terms fixed, the panel displays correctly without any timeouts.

Hope this explains clearly what is needed in your commit log, and how to make it easier to understand for other, especially for people either not familiar with display internals, and/or Allwinner specifics.

Regards
ChenYu

author
#13 lore raw

Re: [linux-sunxi] Re: [PATCH v10 01/11] drm/sun4i: dsi: Fix TCON DRQ set bits

Quoted 156 lines · Chen-Yu Tsai
Quoted 147 lines · Jagan Teki
Quoted 137 lines · Maxime Ripard
Quoted 135 lines · Jagan Teki
Quoted 122 lines · Maxime Ripard
Quoted 111 lines · Jagan Teki
Quoted 110 lines · Maxime Ripard
Quoted 99 lines · Jagan Teki
Quoted 92 lines · Maxime Ripard
Quoted 83 lines · Jagan Teki
Quoted 73 lines · Maxime Ripard
Quoted 71 lines · Jagan Teki

According to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h the current driver is trying to include sync timings along with front porch value while checking and computing drq set bits in non-burst mode.

mode->hsync_end - mode->hdisplay => horizontal front porch + sync

With adding additional sync timings, the dsi controller leads to wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00026-g01f0c75b902d-dirty #13
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
 [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
 [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
 [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
 [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
 [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
 [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace b57eb1e5c64c6b8b ]---
 random: fast init done
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for non-burst DSI mode can be computed based on "horizontal front porch" value only (no sync timings included).

Detailed evidence for drq set bits based on A33 BSP [1] [2]

Quoted 8 lines
Quoted 4 lines

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20 => (tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20 => tt->hor_front_porch - 20

The thing is, while your explanation on the DRM side is sound, Allwinner has been using the hbp field of their panel description to store what DRM calls the backporch and the sync period.

Quoted 6 lines

Exactly, hbp = backporch + sync
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046

And the above computation is rely on that as well. If you can see the final out of the above computation you can get the front porch value (w/o sync )

Quoted 5 lines

As I was saying, you are explaining it well for DRM, but in order for your last formula (the one coming from the BSP) to make sense, you have to explain that the horizontal back porch for Allwinner contains the sync period, otherwise your expansion of lcd_ht doesn't make sense.

Quoted 4 lines

I'm not sure why we need to take care of back porch since the formula clearly evaluating a result as front porch, without sync timing (as current code included this sync), I keep the hbp and trying to substitute the lcd_ht value so the end result would cancel hbp.

Because it changes how lcd_ht expands. In the DRM case, it will expand to the displayed area, the front porch, the sync period and the back porch.

Quoted 8 lines
Quoted 3 lines

In your case, you expand it to the displayed area, the front porch and the back porch, precisely because in Allwinner's case, the back porch has the sync period.

I understand the point, but technically it matter about the final computation result. May be we can even manage the same computation in back porch, but I'm not sure. Since the final output doesn't involve any sync length, why we can include that ie what I'm not sure.

Quoted 5 lines

We have the following formula:
lcd_ht - lcd_x - lcd_hbp - 20

Using the concepts as they are defined in DRM, this expands to:
x + hbp + hsync + hfp - x - hbp - 20

Here is diff between allwinner hbp vs hbp in DRM.

Say hbp in DRM can call it hbackporch, so

=> x + hbackporch + hsync + hfp - -x - hbp - 20

Quoted 7 lines
Quoted 3 lines

(and here we need to substitute hbp formula from allwinner since the actual equation would coming from there
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046)

And this is precisely what needs to be said, with an explanation about where that hor_back_porch is being used later on, and what impact it could have.

Quoted 6 lines

Yes, it an equation and the mathematical equations can be substitute to variety kind I did agree with that, whether you can use hbackporch or not or use another-way the final resulting value is equivalent to the value of front porch. In that case we can solve based on what I explained above. If you still dought me, please run BSP and check the resulting value on this check, you can get the front porch value.

Quoted 6 lines

Maxime is not doubting you. He is saying that you need to include the detailed explanation in your commit log, and not just reference pieces of code. This is separate from the requirement of having a correct patch.

Providing just a mathematical formula isn't enough either, because it is not clear to the average reader which term expanded into what. A

Not sure whether you see my commit log on this version or not. Each one has it's own way of providing the details and explanation and at the end people in ML should understand it. I'm not proving a simple formula here (like I did it in initial version) instead I'm giving all the respective information along with the bug log, and the bsp links where it comes from etc. This is easier way for everyone to understand.

Just a bit to explain what I've mentioned in the log.

Paragraph 1:

"
According to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h the current driver is trying to include sync timings along with front porch value while checking and computing drq set bits in non-burst mode.

mode->hsync_end - mode->hdisplay => horizontal front porch + sync "

This paragraph explains what the existing code is using according to DRM, which indeed help new users to understand by providing include/drm/drm_modes.h file.

Paragraph 2:

"
With adding additional sync timings, the dsi controller leads to wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed trigger panel flip_done timed out as:
"

This paragraph explains what is the relevant issue with existing change.

Paragraph 3:

BUG or WARNING log

Paragraph 4:

"
But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for non-burst DSI mode can be computed based on "horizontal front porch" value only (no sync timings included).
"

This paragraph explains what is BSP is using compared with mainline.

Paragraph 5:

"
Detailed evidence for drq set bits based on A33 BSP [1] [2]

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20 => (tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20 => tt->hor_front_porch - 20
"

This paragraph explains the detailed steps of equation evaluation by providing BSP links.

Paragraph 6:

"
Which is mode->hsync_start - mode->hdisplay as per
"DRM kernel-internal display mode structure" in include/drm/drm_modes.h "

This paragraph give fix details in according to Linux DRM.

So, all the explanation which I'm trying to provide here will help to understand, what is the issue with existing code and BUG log, how it handle in BSP, with justification of equations and links where it refers. Please note that I'm providing bug log and before that I've mentioned this timeout because of additional sync. why is the timeout with additional sync time, which I'm unaware since we don't have associated datasheets for this but we have working BSP's to prove that.

Frankly, I still didn't understand what I missed here to explain the issue. request for help if you see any issues on this format or information.

#14 lore raw

Re: [linux-sunxi] Re: [PATCH v10 01/11] drm/sun4i: dsi: Fix TCON DRQ set bits

Quoted 165 lines · Jagan Teki
Quoted 156 lines · Chen-Yu Tsai
Quoted 147 lines · Jagan Teki
Quoted 137 lines · Maxime Ripard
Quoted 135 lines · Jagan Teki
Quoted 122 lines · Maxime Ripard
Quoted 111 lines · Jagan Teki
Quoted 110 lines · Maxime Ripard
Quoted 99 lines · Jagan Teki
Quoted 92 lines · Maxime Ripard
Quoted 83 lines · Jagan Teki
Quoted 73 lines · Maxime Ripard
Quoted 71 lines · Jagan Teki

According to "DRM kernel-internal display mode structure" in
include/drm/drm_modes.h the current driver is trying to include
sync timings along with front porch value while checking and
computing drq set bits in non-burst mode.

mode->hsync_end - mode->hdisplay => horizontal front porch + sync

With adding additional sync timings, the dsi controller leads to
wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed
trigger panel flip_done timed out as:

WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
[CRTC:46:crtc-0] vblank wait timed out
Modules linked in:
CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00026-g01f0c75b902d-dirty #13
Hardware name: Allwinner sun8i Family
Workqueue: events deferred_probe_work_func
[<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
[<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
[<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
[<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
[<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
[<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
[<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
[<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
[<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
[<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
[<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
[<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
[<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
[<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
[<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
[<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
[<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
[<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
[<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
[<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
[<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
[<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
[<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
[<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
[<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
[<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
[<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
[<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
[<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
[<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
[<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
[<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
[<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
[<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
[<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
[<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
[<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
[<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
Exception stack(0xde539fb0 to 0xde539ff8)
9fa0: 00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
---[ end trace b57eb1e5c64c6b8b ]---
random: fast init done
[drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
[drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
[drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for
non-burst DSI mode can be computed based on "horizontal front porch"
value only (no sync timings included).

Detailed evidence for drq set bits based on A33 BSP [1] [2]

Quoted 8 lines
Quoted 4 lines

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20
=> (tt->hor_front_porch + lcdp->panel_info.lcd_hbp +
lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20
=> tt->hor_front_porch - 20

The thing is, while your explanation on the DRM side is sound, Allwinner has been using the hbp field of their panel description to store what DRM calls the backporch and the sync period.

Quoted 6 lines

Exactly, hbp = backporch + sync
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046

And the above computation is rely on that as well. If you can see the final out of the above computation you can get the front porch value (w/o sync )

Quoted 5 lines

As I was saying, you are explaining it well for DRM, but in order for your last formula (the one coming from the BSP) to make sense, you have to explain that the horizontal back porch for Allwinner contains the sync period, otherwise your expansion of lcd_ht doesn't make sense.

Quoted 4 lines

I'm not sure why we need to take care of back porch since the formula clearly evaluating a result as front porch, without sync timing (as current code included this sync), I keep the hbp and trying to substitute the lcd_ht value so the end result would cancel hbp.

Because it changes how lcd_ht expands. In the DRM case, it will expand to the displayed area, the front porch, the sync period and the back porch.

Quoted 8 lines
Quoted 3 lines

In your case, you expand it to the displayed area, the front porch and the back porch, precisely because in Allwinner's case, the back porch has the sync period.

I understand the point, but technically it matter about the final computation result. May be we can even manage the same computation in back porch, but I'm not sure. Since the final output doesn't involve any sync length, why we can include that ie what I'm not sure.

Quoted 5 lines

We have the following formula:
lcd_ht - lcd_x - lcd_hbp - 20

Using the concepts as they are defined in DRM, this expands to:
x + hbp + hsync + hfp - x - hbp - 20

Here is diff between allwinner hbp vs hbp in DRM.

Say hbp in DRM can call it hbackporch, so

=> x + hbackporch + hsync + hfp - -x - hbp - 20

Quoted 7 lines
Quoted 3 lines

(and here we need to substitute hbp formula from allwinner since the actual equation would coming from there
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046)

And this is precisely what needs to be said, with an explanation about where that hor_back_porch is being used later on, and what impact it could have.

Quoted 6 lines

Yes, it an equation and the mathematical equations can be substitute to variety kind I did agree with that, whether you can use hbackporch or not or use another-way the final resulting value is equivalent to the value of front porch. In that case we can solve based on what I explained above. If you still dought me, please run BSP and check the resulting value on this check, you can get the front porch value.

Quoted 6 lines

Maxime is not doubting you. He is saying that you need to include the detailed explanation in your commit log, and not just reference pieces of code. This is separate from the requirement of having a correct patch.

Providing just a mathematical formula isn't enough either, because it is not clear to the average reader which term expanded into what. A

Quoted 7 lines

Not sure whether you see my commit log on this version or not. Each one has it's own way of providing the details and explanation and at the end people in ML should understand it. I'm not proving a simple formula here (like I did it in initial version) instead I'm giving all the respective information along with the bug log, and the bsp links where it comes from etc. This is easier way for everyone to understand.

I did, and I'm telling you it's not easy to follow.

Quoted 10 lines

Just a bit to explain what I've mentioned in the log.

Paragraph 1:

"
According to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h the current driver is trying to include sync timings along with front porch value while checking and computing drq set bits in non-burst mode.

Quoted 6 lines

mode->hsync_end - mode->hdisplay => horizontal front porch + sync "

This paragraph explains what the existing code is using according to DRM, which indeed help new users to understand by providing include/drm/drm_modes.h file.

This at the beginning makes no sense. It would be better placed with the formula after
the bug report

Quoted 8 lines

Paragraph 2:

"
With adding additional sync timings, the dsi controller leads to wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed trigger panel flip_done timed out as:
"

Quoted 5 lines

This paragraph explains what is the relevant issue with existing change.

Paragraph 3:

BUG or WARNING log

You should lead with these two. These explain "why".

Quoted 15 lines

Paragraph 4:

"
But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for non-burst DSI mode can be computed based on "horizontal front porch" value only (no sync timings included).
"

This paragraph explains what is BSP is using compared with mainline.

Paragraph 5:

"
Detailed evidence for drq set bits based on A33 BSP [1] [2]

Quoted 8 lines

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20 => (tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20 => tt->hor_front_porch - 20
"

This paragraph explains the detailed steps of equation evaluation by providing BSP links.

This actually makes it harder to read. For example it takes a couple passes to realize lcd_ht expands to the stuff in the parenthesis. All the while I still have no idea what all these variables mean or where they came from. As I said, please don't ask users to open links and dig through code.

You should provide a simple explanation about what went wrong. As I mentioned, you could have simply stated that when the driver was reimplemented, the DRQ formula (which you can provide in its original form) was incorrectly expanded because Allwinner's definition of "hbp" is actually "hbp + sync" in DRM terms. That is actually the root cause, which I believe is what Maxime wants detailed in the commit log. This immediately points out what went wrong and how it went wrong, without jumping through hoops.

Again the diagram helps immensely. (Well, maybe not for screen readers.) It also directly shows why you replaced hsync_end with hsync_start.

Quoted 8 lines

Paragraph 6:

"
Which is mode->hsync_start - mode->hdisplay as per
"DRM kernel-internal display mode structure" in include/drm/drm_modes.h "

This paragraph give fix details in according to Linux DRM.

Yes, and first you need to understand the formula you gave, which I already mentioned is a bit hard.

On the side, going through the code and understanding it actually is quite hard as I already did it a couple times before and it was really taxing.

Quoted 9 lines

So, all the explanation which I'm trying to provide here will help to understand, what is the issue with existing code and BUG log, how it handle in BSP, with justification of equations and links where it refers. Please note that I'm providing bug log and before that I've mentioned this timeout because of additional sync. why is the timeout with additional sync time, which I'm unaware since we don't have associated datasheets for this but we have working BSP's to prove that.

Quoted 3 lines

Frankly, I still didn't understand what I missed here to explain the issue. request for help if you see any issues on this format or information.

The one thing you missed, and that Maxime requested, was how hbp, and the misinterpretation of it plays into all of this. In fact the different definitions of terms between DRM and Allwinner code / FEX files is what led to all this. The rest is, well, somewhat hard to read. I already shared my way of explaining everything above.

ChenYu

author
#15 lore raw

Re: [linux-sunxi] Re: [PATCH v10 01/11] drm/sun4i: dsi: Fix TCON DRQ set bits

Quoted 235 lines · Chen-Yu Tsai
Quoted 165 lines · Jagan Teki
Quoted 156 lines · Chen-Yu Tsai
Quoted 147 lines · Jagan Teki
Quoted 137 lines · Maxime Ripard
Quoted 135 lines · Jagan Teki
Quoted 122 lines · Maxime Ripard
Quoted 111 lines · Jagan Teki
Quoted 110 lines · Maxime Ripard
Quoted 99 lines · Jagan Teki
Quoted 92 lines · Maxime Ripard
Quoted 83 lines · Jagan Teki
Quoted 81 lines · Maxime Ripard

On Mon, May 20, 2019 at 02:33:08PM +0530, Jagan Teki wrote:
According to "DRM kernel-internal display mode structure" in
include/drm/drm_modes.h the current driver is trying to include
sync timings along with front porch value while checking and
computing drq set bits in non-burst mode.

mode->hsync_end - mode->hdisplay => horizontal front porch + sync

With adding additional sync timings, the dsi controller leads to
wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed
trigger panel flip_done timed out as:

WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
[CRTC:46:crtc-0] vblank wait timed out
Modules linked in:
CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00026-g01f0c75b902d-dirty #13
Hardware name: Allwinner sun8i Family
Workqueue: events deferred_probe_work_func
[<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
[<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
[<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
[<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
[<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
[<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
[<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
[<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
[<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
[<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
[<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
[<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
[<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
[<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
[<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
[<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
[<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
[<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
[<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
[<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
[<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
[<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
[<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
[<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
[<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
[<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
[<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
[<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
[<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
[<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
[<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
[<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
[<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
[<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
[<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
[<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
[<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
[<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
Exception stack(0xde539fb0 to 0xde539ff8)
9fa0: 00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
---[ end trace b57eb1e5c64c6b8b ]---
random: fast init done
[drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
[drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
[drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for
non-burst DSI mode can be computed based on "horizontal front porch"
value only (no sync timings included).

Detailed evidence for drq set bits based on A33 BSP [1] [2]

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20
=> (tt->hor_front_porch + lcdp->panel_info.lcd_hbp +
lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20
=> tt->hor_front_porch - 20

The thing is, while your explanation on the DRM side is sound,
Allwinner has been using the hbp field of their panel description to
store what DRM calls the backporch and the sync period.

Quoted 6 lines

Exactly, hbp = backporch + sync
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046

And the above computation is rely on that as well. If you can see the final out of the above computation you can get the front porch value (w/o sync )

Quoted 5 lines

As I was saying, you are explaining it well for DRM, but in order for your last formula (the one coming from the BSP) to make sense, you have to explain that the horizontal back porch for Allwinner contains the sync period, otherwise your expansion of lcd_ht doesn't make sense.

Quoted 4 lines

I'm not sure why we need to take care of back porch since the formula clearly evaluating a result as front porch, without sync timing (as current code included this sync), I keep the hbp and trying to substitute the lcd_ht value so the end result would cancel hbp.

Because it changes how lcd_ht expands. In the DRM case, it will expand to the displayed area, the front porch, the sync period and the back porch.

Quoted 8 lines
Quoted 3 lines

In your case, you expand it to the displayed area, the front porch and the back porch, precisely because in Allwinner's case, the back porch has the sync period.

I understand the point, but technically it matter about the final computation result. May be we can even manage the same computation in back porch, but I'm not sure. Since the final output doesn't involve any sync length, why we can include that ie what I'm not sure.

Quoted 5 lines

We have the following formula:
lcd_ht - lcd_x - lcd_hbp - 20

Using the concepts as they are defined in DRM, this expands to:
x + hbp + hsync + hfp - x - hbp - 20

Here is diff between allwinner hbp vs hbp in DRM.

Say hbp in DRM can call it hbackporch, so

=> x + hbackporch + hsync + hfp - -x - hbp - 20

Quoted 7 lines
Quoted 3 lines

(and here we need to substitute hbp formula from allwinner since the actual equation would coming from there
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046)

And this is precisely what needs to be said, with an explanation about where that hor_back_porch is being used later on, and what impact it could have.

Quoted 6 lines

Yes, it an equation and the mathematical equations can be substitute to variety kind I did agree with that, whether you can use hbackporch or not or use another-way the final resulting value is equivalent to the value of front porch. In that case we can solve based on what I explained above. If you still dought me, please run BSP and check the resulting value on this check, you can get the front porch value.

Quoted 6 lines

Maxime is not doubting you. He is saying that you need to include the detailed explanation in your commit log, and not just reference pieces of code. This is separate from the requirement of having a correct patch.

Providing just a mathematical formula isn't enough either, because it is not clear to the average reader which term expanded into what. A

Quoted 7 lines

Not sure whether you see my commit log on this version or not. Each one has it's own way of providing the details and explanation and at the end people in ML should understand it. I'm not proving a simple formula here (like I did it in initial version) instead I'm giving all the respective information along with the bug log, and the bsp links where it comes from etc. This is easier way for everyone to understand.

I did, and I'm telling you it's not easy to follow.

Quoted 10 lines

Just a bit to explain what I've mentioned in the log.

Paragraph 1:

"
According to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h the current driver is trying to include sync timings along with front porch value while checking and computing drq set bits in non-burst mode.

Quoted 6 lines

mode->hsync_end - mode->hdisplay => horizontal front porch + sync "

This paragraph explains what the existing code is using according to DRM, which indeed help new users to understand by providing include/drm/drm_modes.h file.

This at the beginning makes no sense. It would be better placed with the formula after
the bug report

Quoted 8 lines

Paragraph 2:

"
With adding additional sync timings, the dsi controller leads to wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed trigger panel flip_done timed out as:
"

Quoted 5 lines

This paragraph explains what is the relevant issue with existing change.

Paragraph 3:

BUG or WARNING log

You should lead with these two. These explain "why".

Quoted 21 lines

Paragraph 4:

"
But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for non-burst DSI mode can be computed based on "horizontal front porch" value only (no sync timings included).
"

This paragraph explains what is BSP is using compared with mainline.

Paragraph 5:

"
Detailed evidence for drq set bits based on A33 BSP [1] [2]

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20 => (tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20 => tt->hor_front_porch - 20
"

Quoted 7 lines
Quoted 2 lines

This paragraph explains the detailed steps of equation evaluation by providing BSP links.

This actually makes it harder to read. For example it takes a couple passes to realize lcd_ht expands to the stuff in the parenthesis. All the while I still have no idea what all these variables mean or where they came from. As I said, please don't ask users to open links and dig through code.

The main reasons I have included this information and the BSP links are for future reference, to know the real proofs if anyone would want to. and even the timeout log. My idea of formula evaluation here just like what you refer in the diagram in previous mail. I thought mathematical equations are much easier to understand and provable.

Quoted 10 lines

You should provide a simple explanation about what went wrong. As I mentioned, you could have simply stated that when the driver was reimplemented, the DRQ formula (which you can provide in its original form) was incorrectly expanded because Allwinner's definition of "hbp" is actually "hbp + sync" in DRM terms. That is actually the root cause, which I believe is what Maxime wants detailed in the commit log. This immediately points out what went wrong and how it went wrong, without jumping through hoops.

Quoted 2 lines

Again the diagram helps immensely. (Well, maybe not for screen readers.) It also directly shows why you replaced hsync_end with hsync_start.

True, this indeed has different and direct understanding of what went wrong. thanks for this.

Quoted 29 lines
Quoted 9 lines

Paragraph 6:

"
Which is mode->hsync_start - mode->hdisplay as per
"DRM kernel-internal display mode structure" in include/drm/drm_modes.h "

This paragraph give fix details in according to Linux DRM.

Yes, and first you need to understand the formula you gave, which I already mentioned is a bit hard.

On the side, going through the code and understanding it actually is quite hard as I already did it a couple times before and it was really taxing.

Quoted 9 lines

So, all the explanation which I'm trying to provide here will help to understand, what is the issue with existing code and BUG log, how it handle in BSP, with justification of equations and links where it refers. Please note that I'm providing bug log and before that I've mentioned this timeout because of additional sync. why is the timeout with additional sync time, which I'm unaware since we don't have associated datasheets for this but we have working BSP's to prove that.

Quoted 3 lines

Frankly, I still didn't understand what I missed here to explain the issue. request for help if you see any issues on this format or information.

Quoted 5 lines

The one thing you missed, and that Maxime requested, was how hbp, and the misinterpretation of it plays into all of this. In fact the different definitions of terms between DRM and Allwinner code / FEX files is what led to all this. The rest is, well, somewhat hard to read. I already shared my way of explaining everything above.

Okay, will try to re-arrange the commit in next version. hope this time will more cleaner. thanks.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#16 lore raw

Re: [linux-sunxi] Re: [PATCH v10 01/11] drm/sun4i: dsi: Fix TCON DRQ set bits

Quoted 245 lines · Jagan Teki
Quoted 235 lines · Chen-Yu Tsai
Quoted 165 lines · Jagan Teki
Quoted 156 lines · Chen-Yu Tsai
Quoted 147 lines · Jagan Teki
Quoted 137 lines · Maxime Ripard
Quoted 135 lines · Jagan Teki
Quoted 122 lines · Maxime Ripard
Quoted 111 lines · Jagan Teki
Quoted 110 lines · Maxime Ripard
Quoted 99 lines · Jagan Teki
Quoted 92 lines · Maxime Ripard
Quoted 89 lines · Jagan Teki

On Fri, May 24, 2019 at 2:04 AM Maxime Ripard <[email protected]> wrote:

On Mon, May 20, 2019 at 02:33:08PM +0530, Jagan Teki wrote:
According to "DRM kernel-internal display mode structure" in
include/drm/drm_modes.h the current driver is trying to include
sync timings along with front porch value while checking and
computing drq set bits in non-burst mode.

mode->hsync_end - mode->hdisplay => horizontal front porch + sync

With adding additional sync timings, the dsi controller leads to
wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed
trigger panel flip_done timed out as:

WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
[CRTC:46:crtc-0] vblank wait timed out
Modules linked in:
CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00026-g01f0c75b902d-dirty #13
Hardware name: Allwinner sun8i Family
Workqueue: events deferred_probe_work_func
[<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
[<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
[<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
[<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
[<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
[<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
[<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
[<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
[<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
[<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
[<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
[<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
[<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
[<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
[<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
[<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
[<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
[<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
[<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
[<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
[<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
[<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
[<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
[<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
[<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
[<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
[<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
[<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
[<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
[<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
[<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
[<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
[<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
[<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
[<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
[<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
[<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
[<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
Exception stack(0xde539fb0 to 0xde539ff8)
9fa0: 00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
---[ end trace b57eb1e5c64c6b8b ]---
random: fast init done
[drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
[drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
[drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for
non-burst DSI mode can be computed based on "horizontal front porch"
value only (no sync timings included).

Detailed evidence for drq set bits based on A33 BSP [1] [2]

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20
=> (tt->hor_front_porch + lcdp->panel_info.lcd_hbp +
lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20
=> tt->hor_front_porch - 20

The thing is, while your explanation on the DRM side is sound,
Allwinner has been using the hbp field of their panel description to
store what DRM calls the backporch and the sync period.

Exactly, hbp = backporch + sync
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046

And the above computation is rely on that as well. If you can see the
final out of the above computation you can get the front porch value
(w/o sync )

Quoted 5 lines

As I was saying, you are explaining it well for DRM, but in order for your last formula (the one coming from the BSP) to make sense, you have to explain that the horizontal back porch for Allwinner contains the sync period, otherwise your expansion of lcd_ht doesn't make sense.

Quoted 4 lines

I'm not sure why we need to take care of back porch since the formula clearly evaluating a result as front porch, without sync timing (as current code included this sync), I keep the hbp and trying to substitute the lcd_ht value so the end result would cancel hbp.

Because it changes how lcd_ht expands. In the DRM case, it will expand to the displayed area, the front porch, the sync period and the back porch.

Quoted 8 lines
Quoted 3 lines

In your case, you expand it to the displayed area, the front porch and the back porch, precisely because in Allwinner's case, the back porch has the sync period.

I understand the point, but technically it matter about the final computation result. May be we can even manage the same computation in back porch, but I'm not sure. Since the final output doesn't involve any sync length, why we can include that ie what I'm not sure.

Quoted 5 lines

We have the following formula:
lcd_ht - lcd_x - lcd_hbp - 20

Using the concepts as they are defined in DRM, this expands to:
x + hbp + hsync + hfp - x - hbp - 20

Here is diff between allwinner hbp vs hbp in DRM.

Say hbp in DRM can call it hbackporch, so

=> x + hbackporch + hsync + hfp - -x - hbp - 20

Quoted 7 lines
Quoted 3 lines

(and here we need to substitute hbp formula from allwinner since the actual equation would coming from there
https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2046)

And this is precisely what needs to be said, with an explanation about where that hor_back_porch is being used later on, and what impact it could have.

Quoted 6 lines

Yes, it an equation and the mathematical equations can be substitute to variety kind I did agree with that, whether you can use hbackporch or not or use another-way the final resulting value is equivalent to the value of front porch. In that case we can solve based on what I explained above. If you still dought me, please run BSP and check the resulting value on this check, you can get the front porch value.

Quoted 6 lines

Maxime is not doubting you. He is saying that you need to include the detailed explanation in your commit log, and not just reference pieces of code. This is separate from the requirement of having a correct patch.

Providing just a mathematical formula isn't enough either, because it is not clear to the average reader which term expanded into what. A

Quoted 7 lines

Not sure whether you see my commit log on this version or not. Each one has it's own way of providing the details and explanation and at the end people in ML should understand it. I'm not proving a simple formula here (like I did it in initial version) instead I'm giving all the respective information along with the bug log, and the bsp links where it comes from etc. This is easier way for everyone to understand.

I did, and I'm telling you it's not easy to follow.

Quoted 10 lines

Just a bit to explain what I've mentioned in the log.

Paragraph 1:

"
According to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h the current driver is trying to include sync timings along with front porch value while checking and computing drq set bits in non-burst mode.

Quoted 6 lines

mode->hsync_end - mode->hdisplay => horizontal front porch + sync "

This paragraph explains what the existing code is using according to DRM, which indeed help new users to understand by providing include/drm/drm_modes.h file.

This at the beginning makes no sense. It would be better placed with the formula after
the bug report

Quoted 8 lines

Paragraph 2:

"
With adding additional sync timings, the dsi controller leads to wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed trigger panel flip_done timed out as:
"

Quoted 5 lines

This paragraph explains what is the relevant issue with existing change.

Paragraph 3:

BUG or WARNING log

You should lead with these two. These explain "why".

Quoted 21 lines

Paragraph 4:

"
But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for non-burst DSI mode can be computed based on "horizontal front porch" value only (no sync timings included).
"

This paragraph explains what is BSP is using compared with mainline.

Paragraph 5:

"
Detailed evidence for drq set bits based on A33 BSP [1] [2]

=> panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20 => (tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20 => tt->hor_front_porch - 20
"

Quoted 7 lines
Quoted 2 lines

This paragraph explains the detailed steps of equation evaluation by providing BSP links.

This actually makes it harder to read. For example it takes a couple passes to realize lcd_ht expands to the stuff in the parenthesis. All the while I still have no idea what all these variables mean or where they came from. As I said, please don't ask users to open links and dig through code.

Quoted 5 lines

The main reasons I have included this information and the BSP links are for future reference, to know the real proofs if anyone would want to. and even the timeout log. My idea of formula evaluation here just like what you refer in the diagram in previous mail. I thought mathematical equations are much easier to understand and provable.

Unfortunately the plain-text formatting sometimes doesn't help. Simple text descriptions work better in most cases, diffs in others. You can still include the formula as a reference, but it is better to explain it outright in simple sentences, rather than providing the formula and guiding the reader through it.

ChenYu

Quoted 52 lines
Quoted 11 lines

You should provide a simple explanation about what went wrong. As I mentioned, you could have simply stated that when the driver was reimplemented, the DRQ formula (which you can provide in its original form) was incorrectly expanded because Allwinner's definition of "hbp" is actually "hbp + sync" in DRM terms. That is actually the root cause, which I believe is what Maxime wants detailed in the commit log. This immediately points out what went wrong and how it went wrong, without jumping through hoops.

Again the diagram helps immensely. (Well, maybe not for screen readers.) It also directly shows why you replaced hsync_end with hsync_start.

True, this indeed has different and direct understanding of what went wrong. thanks for this.

Quoted 29 lines
Quoted 9 lines

Paragraph 6:

"
Which is mode->hsync_start - mode->hdisplay as per
"DRM kernel-internal display mode structure" in include/drm/drm_modes.h "

This paragraph give fix details in according to Linux DRM.

Yes, and first you need to understand the formula you gave, which I already mentioned is a bit hard.

On the side, going through the code and understanding it actually is quite hard as I already did it a couple times before and it was really taxing.

Quoted 9 lines

So, all the explanation which I'm trying to provide here will help to understand, what is the issue with existing code and BUG log, how it handle in BSP, with justification of equations and links where it refers. Please note that I'm providing bug log and before that I've mentioned this timeout because of additional sync. why is the timeout with additional sync time, which I'm unaware since we don't have associated datasheets for this but we have working BSP's to prove that.

Quoted 3 lines

Frankly, I still didn't understand what I missed here to explain the issue. request for help if you see any issues on this format or information.

Quoted 5 lines

The one thing you missed, and that Maxime requested, was how hbp, and the misinterpretation of it plays into all of this. In fact the different definitions of terms between DRM and Allwinner code / FEX files is what led to all this. The rest is, well, somewhat hard to read. I already shared my way of explaining everything above.

Okay, will try to re-arrange the commit in next version. hope this time will more cleaner. thanks.

#28 lore raw

Re: [linux-sunxi] Re: [PATCH v10 03/11] drm/sun4i: dsi: Fix video start delay computation

In reply to Jagan Teki
Quoted 89 lines · Jagan Teki
Quoted 87 lines · Maxime Ripard
Quoted 84 lines · Jagan Teki

The current code is computing vertical video start delay as

delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;

On which the second parameter

mode->vsync_end - mode->vdisplay = front porch + sync timings

according to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h

With adding additional sync timings, the desired video start delay value as 510 for "bananapi,s070wv20-ct16" panel timings which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00029-g09e5b0ed0a58 #18
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
 [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
 [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
 [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
 [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
 [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
 [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 495200a78b24980e ]---
 random: fast init done
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But the expected video start delay value is 513 which states that the second parameter on the computation is "front porch" value (no sync timings included).

This is clearly confirmed from the legacy [1] and new [2] bsp codes that the second parameter on the video start delay is "front porch"

Here is the detailed evidence for calculating front porch as per bsp code.

vfp = panel->lcd_vt - panel->lcd_y - panel->lcd_vbp => (panel->lcd_vt) - panel->lcd_y - panel->lcd_vbp => (tt->ver_front_porch + lcdp->panel_info.lcd_vbp
+ lcdp->panel_info.lcd_y) - panel->lcd_y - panel->lcd_vbp
=> tt->ver_front_porch

Quoted 3 lines
Quoted 1 line

The comment on patch 1 still applies on this patch

Thanks, I have responded on that. Same applies here.

So this patch fixes the misinterpretation of Allwinner's back porch value, much like patch 1, but this one is for the vertical back porch. So I think you should follow the same advice I gave you for patch 1.

ChenYu

author
#29 lore raw

Re: [linux-sunxi] Re: [PATCH v10 03/11] drm/sun4i: dsi: Fix video start delay computation

Quoted 91 lines · Chen-Yu Tsai
Quoted 89 lines · Jagan Teki
Quoted 87 lines · Maxime Ripard
Quoted 84 lines · Jagan Teki

The current code is computing vertical video start delay as

delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;

On which the second parameter

mode->vsync_end - mode->vdisplay = front porch + sync timings

according to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h

With adding additional sync timings, the desired video start delay value as 510 for "bananapi,s070wv20-ct16" panel timings which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00029-g09e5b0ed0a58 #18
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140)
 [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8)
 [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160)
 [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c)
 [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c)
 [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90)
 [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 495200a78b24980e ]---
 random: fast init done
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But the expected video start delay value is 513 which states that the second parameter on the computation is "front porch" value (no sync timings included).

This is clearly confirmed from the legacy [1] and new [2] bsp codes that the second parameter on the video start delay is "front porch"

Here is the detailed evidence for calculating front porch as per bsp code.

vfp = panel->lcd_vt - panel->lcd_y - panel->lcd_vbp => (panel->lcd_vt) - panel->lcd_y - panel->lcd_vbp => (tt->ver_front_porch + lcdp->panel_info.lcd_vbp
+ lcdp->panel_info.lcd_y) - panel->lcd_y - panel->lcd_vbp
=> tt->ver_front_porch

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

The comment on patch 1 still applies on this patch

Thanks, I have responded on that. Same applies here.

So this patch fixes the misinterpretation of Allwinner's back porch value, much like patch 1, but this one is for the vertical back porch. So I think you should follow the same advice I gave you for patch 1.

Yes, indeed I'm planning to do the same. thanks!
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#24 lore raw

Re: [PATCH v10 02/11] drm/sun4i: dsi: Update start value in video start delay

In reply to Jagan Teki

Hi,

Quoted 5 lines · Jagan Teki

start value in video start delay computation done in below commit is as per the legacy bsp drivers/video/sunxi/legacy.. "drm/sun4i: dsi: Change the start delay calculation" (sha1: da676c6aa6413d59ab0a80c97bbc273025e640b2)

There is a standard format for referencing commits. Please use it. The format is:

... commit <leading 12 characters of commit hash> ("commit subject") ...

So your commit message should read:

start value in video start delay was changed in commit
da676c6aa641 ("drm/sun4i:
dsi: Change the start delay calculation") to match the legacy BSP
driver [1].

Quoted 70 lines

This existing start delay computation gives start value of 35, for "bananapi,s070wv20-ct16" panel timings which indeed trigger panel flip_done timed out as:

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Tainted: G        W         5.1.0-next-20190514-00025-gf928bc7cc146 #15
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c90>] (dump_stack+0x84/0x98)
 [<c0688c90>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c0411cb0>] (drm_fb_helper_pan_display+0xac/0x1d0)
 [<c0411cb0>] (drm_fb_helper_pan_display) from [<c03a4e84>] (fb_pan_display+0xcc/0x134)
 [<c03a4e84>] (fb_pan_display) from [<c03b1214>] (bit_update_start+0x14/0x30)
 [<c03b1214>] (bit_update_start) from [<c03afe94>] (fbcon_switch+0x3d8/0x4e0)
 [<c03afe94>] (fbcon_switch) from [<c03ec930>] (redraw_screen+0x174/0x238)
 [<c03ec930>] (redraw_screen) from [<c03aceb4>] (fbcon_prepare_logo+0x3c4/0x400)
 [<c03aceb4>] (fbcon_prepare_logo) from [<c03ad2b8>] (fbcon_init+0x3c8/0x5ac)
 [<c03ad2b8>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b5b0>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b5b0>] (try_to_bring_up_master) from [<c044b680>] (__component_add+0x94/0x140)
 [<c044b680>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e1c>] (sun6i_dsi_probe) from [<c0452f0c>] (platform_drv_probe+0x48/0x9c)
 [<c0452f0c>] (platform_drv_probe) from [<c04512e4>] (really_probe+0x1dc/0x2c8)
 [<c04512e4>] (really_probe) from [<c0451530>] (driver_probe_device+0x60/0x160)
 [<c0451530>] (driver_probe_device) from [<c044f7bc>] (bus_for_each_drv+0x74/0xb8)
 [<c044f7bc>] (bus_for_each_drv) from [<c0451094>] (__device_attach+0xd0/0x13c)
 [<c0451094>] (__device_attach) from [<c045048c>] (bus_probe_device+0x84/0x8c)
 [<c045048c>] (bus_probe_device) from [<c0450918>] (deferred_probe_work_func+0x64/0x90)
 [<c0450918>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 755e10f62b83f396 ]---
 Console: switching to colour frame buffer device 100x30
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out
 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

But the expected start delay value is 1 which is confirmed from new bsp [2].

The important and unclear note on legacy and new bsp codes [1] [2] is both use similar start computation initially but it later reassign it to 1 in new bsp.

Quoted 6 lines

Unfortunately we don't have any evidence or documentation for this reassignment to 1 in new bsp, but it is working with all supported panels in A33, A64.

So, use the start as per new bsp code since it is working in all the supported panels.

It would be better to actually list the panels you tested. The list of "supported panels" is nowhere to be found, and would change from release to release anyways. It would be hard for anyone to realize which ones were actually tested.

It would also help if others want to verify your fix, and/or test other hardware.

Also I suggest following a similar pattern to the suggestions I gave for patch 1 for writing your commit logs:

1. Describe what you observe to be not working.

In this case, the display is not working, with the provided traceback and kernel logs.

2. Describe what you think went wrong.

This could be a git bisect result, or in this case, you are
providing evidence
from the BSP with links and actual results from hardware running
the BSP. For
actual running BSP, it would be better to provide the actual
hardware combinations
you are running on, in addition to the BSP links. Last, the best
piece of concrete
evidence might be relevant register values from functioning hardware.

3. Explain that the fix corrects the issue for you, and list the hardware that it works on.

4. Optional. Any other thoughts on the subject matter, such as suspicion of other broken hardware, or the fix might not be complete.

Quoted 2 lines

[2] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L807
[1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/legacy/disp/de_bsp/de/ebios/de_dsi.c#L682

Please list your references in increasing order:

    [1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/legacy/disp/de_bsp/de/ebios/de_dsi.c#L682
    [2] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L807

It is otherwise confusing. I believe Maxime might have mixed up the two.

Otherwise I believe the commit message matches the intent of the code. I'm afraid I don't know enough about DSI in general or the hardware to comment on why this works and if it's the right fix though.

Regards,
ChenYu

Quoted 31 lines
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +11 -2
index c5bec0096b7c..b3ca85410b2c 100644
@@ -364,7 +364,17 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi,
 static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi,
                                           struct drm_display_mode *mode)
 {
-       u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100);
+       /**
+        * Allwinner legacy (drivers/video/sunxi/legacy),
+        * new (drivers/video/sunxi/disp/de/lowlevel_sun8iw5) bsp drivers
+        * are evaluating start as:
+        *
+        *      vtotal - vdisplay - 10
+        *
+        * but the new drivers are reassigning start to 1, which seems to be
+        * working in all supported panels as of now.
+        */
+       u8 start = 1;
        u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;
 
        if (delay > mode->vtotal)
--

2.18.0.321.gffc6fa0e3

#37 lore raw

Re: [linux-sunxi] Re: [PATCH v10 04/11] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

In reply to Jagan Teki
Quoted 108 lines · Jagan Teki
Quoted 107 lines · Maxime Ripard
Quoted 105 lines · Jagan Teki
Quoted 103 lines · Maxime Ripard
Quoted 87 lines · Jagan Teki
Quoted 78 lines · Maxime Ripard
Quoted 67 lines · Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code is passing dsi min and max divider value as 4 via tcon driver which would ended-up triggering below vblank wait timed out warning on "bananapi,s070wv20-ct16" panel.

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00025-g5186cdf10757-dirty #6
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b588>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b588>] (try_to_bring_up_master) from [<c044b658>] (__component_add+0x94/0x140)
 [<c044b658>] (__component_add) from [<c0445e0c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e0c>] (sun6i_dsi_probe) from [<c0452ee4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ee4>] (platform_drv_probe) from [<c04512bc>] (really_probe+0x1dc/0x2c8)
 [<c04512bc>] (really_probe) from [<c0451508>] (driver_probe_device+0x60/0x160)
 [<c0451508>] (driver_probe_device) from [<c044f794>] (bus_for_each_drv+0x74/0xb8)
 [<c044f794>] (bus_for_each_drv) from [<c045106c>] (__device_attach+0xd0/0x13c)
 [<c045106c>] (__device_attach) from [<c0450464>] (bus_probe_device+0x84/0x8c)
 [<c0450464>] (bus_probe_device) from [<c04508f0>] (deferred_probe_work_func+0x64/0x90)
 [<c04508f0>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 4017fea4906ab391 ]---

But accordingly to Allwinner A33, A64 BSP codes [1] [2] this divider is clearly using 'format/lanes' for dsi divider value, dsi_clk.clk_div

Which would compute the pll_freq and set a clock rate for it in
[3] and [4] respectively.

Quoted 8 lines

The same issue has reproduced in A33, A64 with 4-lane and 2-lane devices and got fixed with this computation logic 'format/lanes', so this patch using dclk min and max dividers as per BSP.

[1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1106
[2] https://github.com/BPI-SINOVOIP/BPI-M64-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/disp_al.c#L213
[3] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1127
[4] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1161

Quoted 7 lines

In that mail, I've pointed out that clk_div isn't used for the TCON dclk divider:
http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629596.html

The only reply you've sent is that you indeed see that the divider is set to 4 in the BSP, but you're now saying that the BSP can change it. If so, then please point exactly the flaw in the explanation in that mail.

Quoted 7 lines

Frankly, I have explained these details in commit message and previous version patch[1] with print messages on the code.

BSP has tcon_div and dsi_div. dsi_div is dynamic which depends on bpp/lanes and it indeed depends on PLL computation (not tcon_div), anyway I have explained again on this initial link you mentioned. Please have a look and get back.

I'll have a look, thanks.

I've given your patches a try on my setup though, and this patch breaks it with vblank timeouts and some horizontal lines that looks like what should be displayed, but blinking and on the right of the display. The previous ones are fine though.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Would you please send me the link of panel driver.

It's drivers/gpu/drm/panel/panel-ronbo-rb070d30.c

Look like this panel work even w/o any vendor sequence. it's similar to the 4-lane panel I have with RGB888, so the dclk div is 6, is it working with this divider?

It works with 4, it doesn't work with 6.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

author
#38 lore raw

Re: [linux-sunxi] Re: [PATCH v10 04/11] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

Quoted 112 lines · Maxime Ripard
Quoted 110 lines · Jagan Teki
Quoted 109 lines · Maxime Ripard
Quoted 106 lines · Jagan Teki
Quoted 97 lines · Maxime Ripard
Quoted 87 lines · Jagan Teki
Quoted 78 lines · Maxime Ripard
Quoted 67 lines · Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code is passing dsi min and max divider value as 4 via tcon driver which would ended-up triggering below vblank wait timed out warning on "bananapi,s070wv20-ct16" panel.

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00025-g5186cdf10757-dirty #6
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b588>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b588>] (try_to_bring_up_master) from [<c044b658>] (__component_add+0x94/0x140)
 [<c044b658>] (__component_add) from [<c0445e0c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e0c>] (sun6i_dsi_probe) from [<c0452ee4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ee4>] (platform_drv_probe) from [<c04512bc>] (really_probe+0x1dc/0x2c8)
 [<c04512bc>] (really_probe) from [<c0451508>] (driver_probe_device+0x60/0x160)
 [<c0451508>] (driver_probe_device) from [<c044f794>] (bus_for_each_drv+0x74/0xb8)
 [<c044f794>] (bus_for_each_drv) from [<c045106c>] (__device_attach+0xd0/0x13c)
 [<c045106c>] (__device_attach) from [<c0450464>] (bus_probe_device+0x84/0x8c)
 [<c0450464>] (bus_probe_device) from [<c04508f0>] (deferred_probe_work_func+0x64/0x90)
 [<c04508f0>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 4017fea4906ab391 ]---

But accordingly to Allwinner A33, A64 BSP codes [1] [2] this divider is clearly using 'format/lanes' for dsi divider value, dsi_clk.clk_div

Which would compute the pll_freq and set a clock rate for it in
[3] and [4] respectively.

Quoted 8 lines

The same issue has reproduced in A33, A64 with 4-lane and 2-lane devices and got fixed with this computation logic 'format/lanes', so this patch using dclk min and max dividers as per BSP.

[1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1106
[2] https://github.com/BPI-SINOVOIP/BPI-M64-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/disp_al.c#L213
[3] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1127
[4] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1161

Quoted 7 lines

In that mail, I've pointed out that clk_div isn't used for the TCON dclk divider:
http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629596.html

The only reply you've sent is that you indeed see that the divider is set to 4 in the BSP, but you're now saying that the BSP can change it. If so, then please point exactly the flaw in the explanation in that mail.

Quoted 7 lines

Frankly, I have explained these details in commit message and previous version patch[1] with print messages on the code.

BSP has tcon_div and dsi_div. dsi_div is dynamic which depends on bpp/lanes and it indeed depends on PLL computation (not tcon_div), anyway I have explained again on this initial link you mentioned. Please have a look and get back.

Quoted 6 lines

I'll have a look, thanks.

I've given your patches a try on my setup though, and this patch breaks it with vblank timeouts and some horizontal lines that looks like what should be displayed, but blinking and on the right of the display. The previous ones are fine though.

Would you please send me the link of panel driver.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

It's drivers/gpu/drm/panel/panel-ronbo-rb070d30.c

Look like this panel work even w/o any vendor sequence. it's similar to the 4-lane panel I have with RGB888, so the dclk div is 6, is it working with this divider?

It works with 4, it doesn't work with 6.

Can be the pixel clock with associated timings can make this diff. Would you send me the pixel clock, pll_rate and timings this panel used it from BSP?

#39 lore raw

Re: [linux-sunxi] Re: [PATCH v10 04/11] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

Quoted 119 lines · Jagan Teki
Quoted 118 lines · Maxime Ripard
Quoted 115 lines · Jagan Teki
Quoted 102 lines · Maxime Ripard
Quoted 100 lines · Jagan Teki
Quoted 99 lines · Maxime Ripard
Quoted 87 lines · Jagan Teki
Quoted 78 lines · Maxime Ripard
Quoted 67 lines · Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code is passing dsi min and max divider value as 4 via tcon driver which would ended-up triggering below vblank wait timed out warning on "bananapi,s070wv20-ct16" panel.

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00025-g5186cdf10757-dirty #6
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b588>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b588>] (try_to_bring_up_master) from [<c044b658>] (__component_add+0x94/0x140)
 [<c044b658>] (__component_add) from [<c0445e0c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e0c>] (sun6i_dsi_probe) from [<c0452ee4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ee4>] (platform_drv_probe) from [<c04512bc>] (really_probe+0x1dc/0x2c8)
 [<c04512bc>] (really_probe) from [<c0451508>] (driver_probe_device+0x60/0x160)
 [<c0451508>] (driver_probe_device) from [<c044f794>] (bus_for_each_drv+0x74/0xb8)
 [<c044f794>] (bus_for_each_drv) from [<c045106c>] (__device_attach+0xd0/0x13c)
 [<c045106c>] (__device_attach) from [<c0450464>] (bus_probe_device+0x84/0x8c)
 [<c0450464>] (bus_probe_device) from [<c04508f0>] (deferred_probe_work_func+0x64/0x90)
 [<c04508f0>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 4017fea4906ab391 ]---

But accordingly to Allwinner A33, A64 BSP codes [1] [2] this divider is clearly using 'format/lanes' for dsi divider value, dsi_clk.clk_div

Which would compute the pll_freq and set a clock rate for it in
[3] and [4] respectively.

Quoted 8 lines

The same issue has reproduced in A33, A64 with 4-lane and 2-lane devices and got fixed with this computation logic 'format/lanes', so this patch using dclk min and max dividers as per BSP.

[1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1106
[2] https://github.com/BPI-SINOVOIP/BPI-M64-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/disp_al.c#L213
[3] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1127
[4] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1161

Quoted 7 lines

In that mail, I've pointed out that clk_div isn't used for the TCON dclk divider:
http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629596.html

The only reply you've sent is that you indeed see that the divider is set to 4 in the BSP, but you're now saying that the BSP can change it. If so, then please point exactly the flaw in the explanation in that mail.

Quoted 7 lines

Frankly, I have explained these details in commit message and previous version patch[1] with print messages on the code.

BSP has tcon_div and dsi_div. dsi_div is dynamic which depends on bpp/lanes and it indeed depends on PLL computation (not tcon_div), anyway I have explained again on this initial link you mentioned. Please have a look and get back.

I'll have a look, thanks.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I've given your patches a try on my setup though, and this patch breaks it with vblank timeouts and some horizontal lines that looks like what should be displayed, but blinking and on the right of the display. The previous ones are fine though.

Would you please send me the link of panel driver.

It's drivers/gpu/drm/panel/panel-ronbo-rb070d30.c

Look like this panel work even w/o any vendor sequence. it's similar to the 4-lane panel I have with RGB888, so the dclk div is 6, is it working with this divider?

Quoted 5 lines
Quoted 1 line

It works with 4, it doesn't work with 6.

Can be the pixel clock with associated timings can make this diff. Would you send me the pixel clock, pll_rate and timings this panel used it from BSP?

This board never had an Allwinner BSP

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

author
#40 lore raw

Re: [linux-sunxi] Re: [PATCH v10 04/11] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

Quoted 121 lines · Maxime Ripard
Quoted 119 lines · Jagan Teki
Quoted 118 lines · Maxime Ripard
Quoted 115 lines · Jagan Teki
Quoted 102 lines · Maxime Ripard
Quoted 100 lines · Jagan Teki
Quoted 99 lines · Maxime Ripard
Quoted 87 lines · Jagan Teki
Quoted 78 lines · Maxime Ripard
Quoted 67 lines · Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code is passing dsi min and max divider value as 4 via tcon driver which would ended-up triggering below vblank wait timed out warning on "bananapi,s070wv20-ct16" panel.

 WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0
 [CRTC:46:crtc-0] vblank wait timed out
 Modules linked in:
 CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00025-g5186cdf10757-dirty #6
 Hardware name: Allwinner sun8i Family
 Workqueue: events deferred_probe_work_func
 [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14)
 [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98)
 [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114)
 [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68)
 [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0)
 [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
 [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c)
 [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128)
 [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc)
 [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0)
 [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54)
 [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac)
 [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104)
 [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390)
 [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4)
 [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc)
 [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84)
 [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60)
 [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20)
 [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8)
 [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c)
 [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8)
 [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118)
 [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160)
 [<c043f060>] (sun4i_drv_bind) from [<c044b588>] (try_to_bring_up_master+0x164/0x1a0)
 [<c044b588>] (try_to_bring_up_master) from [<c044b658>] (__component_add+0x94/0x140)
 [<c044b658>] (__component_add) from [<c0445e0c>] (sun6i_dsi_probe+0x144/0x234)
 [<c0445e0c>] (sun6i_dsi_probe) from [<c0452ee4>] (platform_drv_probe+0x48/0x9c)
 [<c0452ee4>] (platform_drv_probe) from [<c04512bc>] (really_probe+0x1dc/0x2c8)
 [<c04512bc>] (really_probe) from [<c0451508>] (driver_probe_device+0x60/0x160)
 [<c0451508>] (driver_probe_device) from [<c044f794>] (bus_for_each_drv+0x74/0xb8)
 [<c044f794>] (bus_for_each_drv) from [<c045106c>] (__device_attach+0xd0/0x13c)
 [<c045106c>] (__device_attach) from [<c0450464>] (bus_probe_device+0x84/0x8c)
 [<c0450464>] (bus_probe_device) from [<c04508f0>] (deferred_probe_work_func+0x64/0x90)
 [<c04508f0>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420)
 [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0)
 [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c)
 [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
 Exception stack(0xde539fb0 to 0xde539ff8)
 9fa0:                                     00000000 00000000 00000000 00000000
 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
 ---[ end trace 4017fea4906ab391 ]---

But accordingly to Allwinner A33, A64 BSP codes [1] [2] this divider is clearly using 'format/lanes' for dsi divider value, dsi_clk.clk_div

Which would compute the pll_freq and set a clock rate for it in
[3] and [4] respectively.

Quoted 8 lines

The same issue has reproduced in A33, A64 with 4-lane and 2-lane devices and got fixed with this computation logic 'format/lanes', so this patch using dclk min and max dividers as per BSP.

[1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1106
[2] https://github.com/BPI-SINOVOIP/BPI-M64-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/disp_al.c#L213
[3] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1127
[4] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1161

Quoted 7 lines

In that mail, I've pointed out that clk_div isn't used for the TCON dclk divider:
http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629596.html

The only reply you've sent is that you indeed see that the divider is set to 4 in the BSP, but you're now saying that the BSP can change it. If so, then please point exactly the flaw in the explanation in that mail.

Quoted 7 lines

Frankly, I have explained these details in commit message and previous version patch[1] with print messages on the code.

BSP has tcon_div and dsi_div. dsi_div is dynamic which depends on bpp/lanes and it indeed depends on PLL computation (not tcon_div), anyway I have explained again on this initial link you mentioned. Please have a look and get back.

I'll have a look, thanks.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I've given your patches a try on my setup though, and this patch breaks it with vblank timeouts and some horizontal lines that looks like what should be displayed, but blinking and on the right of the display. The previous ones are fine though.

Would you please send me the link of panel driver.

It's drivers/gpu/drm/panel/panel-ronbo-rb070d30.c

Look like this panel work even w/o any vendor sequence. it's similar to the 4-lane panel I have with RGB888, so the dclk div is 6, is it working with this divider?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

It works with 4, it doesn't work with 6.

Can be the pixel clock with associated timings can make this diff. Would you send me the pixel clock, pll_rate and timings this panel used it from BSP?

This board never had an Allwinner BSP

Running on BSP would help to understand some clue, anyway would you send me the the value PLL_MIPI register (devme 0x1c20040) on this board. I'm trying to understand how it value in your case.

#41 lore raw

Re: [linux-sunxi] Re: [PATCH v10 04/11] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

Quoted 27 lines · Jagan Teki
Quoted 26 lines · Maxime Ripard
Quoted 25 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 11 lines
Quoted 4 lines

BSP has tcon_div and dsi_div. dsi_div is dynamic which depends on bpp/lanes and it indeed depends on PLL computation (not tcon_div), anyway I have explained again on this initial link you mentioned. Please have a look and get back.

I'll have a look, thanks.

I've given your patches a try on my setup though, and this patch breaks it with vblank timeouts and some horizontal lines that looks like what should be displayed, but blinking and on the right of the display. The previous ones are fine though.

Would you please send me the link of panel driver.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

It's drivers/gpu/drm/panel/panel-ronbo-rb070d30.c

Look like this panel work even w/o any vendor sequence. it's similar to the 4-lane panel I have with RGB888, so the dclk div is 6, is it working with this divider?

It works with 4, it doesn't work with 6.

Can be the pixel clock with associated timings can make this diff. Would you send me the pixel clock, pll_rate and timings this panel used it from BSP?

Quoted 5 lines
Quoted 1 line

This board never had an Allwinner BSP

Running on BSP would help to understand some clue, anyway would you send me the the value PLL_MIPI register (devme 0x1c20040) on this board. I'm trying to understand how it value in your case.

I'm sorry, but I'm not going to port a whole BSP on that board, especially for something I haven't been convinced it's the right fix.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

author
#42 lore raw

Re: [linux-sunxi] Re: [PATCH v10 04/11] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

Quoted 29 lines · Maxime Ripard
Quoted 27 lines · Jagan Teki
Quoted 26 lines · Maxime Ripard
Quoted 25 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 11 lines
Quoted 4 lines

BSP has tcon_div and dsi_div. dsi_div is dynamic which depends on bpp/lanes and it indeed depends on PLL computation (not tcon_div), anyway I have explained again on this initial link you mentioned. Please have a look and get back.

I'll have a look, thanks.

I've given your patches a try on my setup though, and this patch breaks it with vblank timeouts and some horizontal lines that looks like what should be displayed, but blinking and on the right of the display. The previous ones are fine though.

Would you please send me the link of panel driver.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

It's drivers/gpu/drm/panel/panel-ronbo-rb070d30.c

Look like this panel work even w/o any vendor sequence. it's similar to the 4-lane panel I have with RGB888, so the dclk div is 6, is it working with this divider?

It works with 4, it doesn't work with 6.

Can be the pixel clock with associated timings can make this diff. Would you send me the pixel clock, pll_rate and timings this panel used it from BSP?

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

This board never had an Allwinner BSP

Running on BSP would help to understand some clue, anyway would you send me the the value PLL_MIPI register (devme 0x1c20040) on this board. I'm trying to understand how it value in your case.

I'm sorry, but I'm not going to port a whole BSP on that board, especially for something I haven't been convinced it's the right fix.

Look like a dead lock here, this change has a conclusive evidence from BSP (which is AW datasheet or open code to outside world) and it is working with A33, A64 and R40 which was tested in 4 different panels and I don't understand the reason for not going with this (atleast check with respect to BSP).

Please suggest, what I can do further, your suggestion is very helpful here.

Jagan.

#43 lore raw

Re: [linux-sunxi] Re: [PATCH v10 04/11] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

Quoted 35 lines · Jagan Teki
Quoted 34 lines · Maxime Ripard
Quoted 32 lines · Jagan Teki
Quoted 20 lines · Maxime Ripard
Quoted 20 lines
Quoted 20 lines
Quoted 19 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

BSP has tcon_div and dsi_div. dsi_div is dynamic which depends on bpp/lanes and it indeed depends on PLL computation (not tcon_div), anyway I have explained again on this initial link you mentioned. Please have a look and get back.

I'll have a look, thanks.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I've given your patches a try on my setup though, and this patch breaks it with vblank timeouts and some horizontal lines that looks like what should be displayed, but blinking and on the right of the display. The previous ones are fine though.

Would you please send me the link of panel driver.

It's drivers/gpu/drm/panel/panel-ronbo-rb070d30.c

Look like this panel work even w/o any vendor sequence. it's similar to the 4-lane panel I have with RGB888, so the dclk div is 6, is it working with this divider?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

It works with 4, it doesn't work with 6.

Can be the pixel clock with associated timings can make this diff. Would you send me the pixel clock, pll_rate and timings this panel used it from BSP?

This board never had an Allwinner BSP

Running on BSP would help to understand some clue, anyway would you send me the the value PLL_MIPI register (devme 0x1c20040) on this board. I'm trying to understand how it value in your case.

Quoted 8 lines
Quoted 2 lines

I'm sorry, but I'm not going to port a whole BSP on that board, especially for something I haven't been convinced it's the right fix.

Look like a dead lock here, this change has a conclusive evidence from BSP (which is AW datasheet or open code to outside world) and it is working with A33, A64 and R40 which was tested in 4 different panels and I don't understand the reason for not going with this (atleast check with respect to BSP).

Because that would take a month or so?

Quoted 2 lines

Please suggest, what I can do further, your suggestion is very helpful here.

I already did, and you ignored it. Several times.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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