From 2c9136d1dcc89e40da57837c7b799726ecb253e2 Mon Sep 17 00:00:00 2001 From: Hermes Date: Sat, 13 Jun 2026 18:49:36 -0400 Subject: [PATCH] fix: add DSI_INIT0 lane config to old panel init_sequence + fix mode_flags --- flake.nix | 7 +++++++ patches/0008-panel-cwu50-fix-init-seq1.patch | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 patches/0008-panel-cwu50-fix-init-seq1.patch diff --git a/flake.nix b/flake.nix index 8d54722..778474b 100644 --- a/flake.nix +++ b/flake.nix @@ -101,6 +101,13 @@ boot.loader.raspberry-pi.bootloader = "kernel"; } nixos-raspberrypi.nixosModules.nixpkgs-rpi + # Fix old panel init_sequence: add DSI_INIT0 lane config, remove contradictory BURST flag + ({ lib, ... }: { + boot.kernelPatches = [{ + name = "panel-cwu50-fix-lanes"; + patch = ./patches/0008-panel-cwu50-fix-init-seq1.patch; + }]; + }) nixos-raspberrypi.nixosModules.raspberry-pi-5.base nixos-raspberrypi.lib.inject-overlays nixos-raspberrypi.lib.inject-overlays-global diff --git a/patches/0008-panel-cwu50-fix-init-seq1.patch b/patches/0008-panel-cwu50-fix-init-seq1.patch new file mode 100644 index 0000000..eb0e0a5 --- /dev/null +++ b/patches/0008-panel-cwu50-fix-init-seq1.patch @@ -0,0 +1,17 @@ +--- a/drivers/gpu/drm/panel/panel-cwu50.c ++++ b/drivers/gpu/drm/panel/panel-cwu50.c +@@ -65,6 +65,8 @@ static void cwu50_init_sequence(struct cwu50 *ctx) + dcs_write_seq(0x72,0x06); + dcs_write_seq(0x75,0x03); ++ /* DSI_INIT0: set 4 lanes (bits[1:0]=11) — fixes lane count default */ ++ dcs_write_seq(0x80,0x03); + dcs_write_seq(0xE0,0x01); +@@ -162,7 +164,7 @@ static int cwu50_probe(struct mipi_dsi_device *dsi) + + dsi->lanes = 4; + dsi->format = MIPI_DSI_FMT_RGB888; +- dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_VIDEO_SYNC_PULSE; ++ dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE; + + ctx->id_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_IN); + if (IS_ERR(ctx->id_gpio)) { \ No newline at end of file