From e7834e9fc135a92673947a7ad1ce16aa7b259e88 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Sat, 14 Oct 2023 20:49:15 +0200 Subject: [PATCH] driver: Ensure to call set_tear_on on CMD mode panels The downstream msm-4.9 driver is unconditinally calling mdss_dsi_set_tear_on with command mode panels, replicate the same in the driver generator, but only add the call if it hasn't already been present in the commands, as is seen on some panels. When this doesn't get enabled then the panel doesn't generate any Tearing Effect output signal which is used by MDSS. --- driver.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/driver.py b/driver.py index 45a6fcc..74b501c 100644 --- a/driver.py +++ b/driver.py @@ -7,7 +7,7 @@ import simple import wrap from generator import Options, GpioFlag -from panel import Panel, BacklightControl, CommandSequence, CompressionMode +from panel import Panel, BacklightControl, CommandSequence, CompressionMode, Mode def generate_includes(p: Panel, options: Options) -> str: @@ -158,6 +158,14 @@ def generate_commands(p: Panel, options: Options, cmd_name: str) -> str: if c.wait and c.wait > options.ignore_wait: s += f'\t{dsi_msleep(c.wait)};\n' + + if cmd_name == 'on' and p.mode == Mode.CMD_MODE: + has_tear_on = any("set_tear_on" in c.generated for c in cmd.seq) + if not has_tear_on: + s += ''' + mipi_dsi_dcs_set_tear_on_multi(&dsi_ctx, MIPI_DSI_DCS_TEAR_MODE_VBLANK); +''' + s += ''' return dsi_ctx.accum_err; }