From 49e1a85afbed75087447580650b2a83950c978b2 Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 10 Jun 2024 03:47:35 +0000 Subject: [PATCH] linux-postmarketos-exynos5: test some patches for enabling graphics output on later kernels --- .../linux-postmarketos-exynos5/default.nix | 27 ++++- .../snow-panel-fix.patch | 13 +++ .../snow-panel-revert-b116xw03.patch | 100 ++++++++++++++++++ 3 files changed, 137 insertions(+), 3 deletions(-) create mode 100644 pkgs/additional/linux-postmarketos-exynos5/snow-panel-fix.patch create mode 100644 pkgs/additional/linux-postmarketos-exynos5/snow-panel-revert-b116xw03.patch diff --git a/pkgs/additional/linux-postmarketos-exynos5/default.nix b/pkgs/additional/linux-postmarketos-exynos5/default.nix index 3ec6ccb5..31e7f881 100644 --- a/pkgs/additional/linux-postmarketos-exynos5/default.nix +++ b/pkgs/additional/linux-postmarketos-exynos5/default.nix @@ -2,6 +2,8 @@ , linux ? linux_6_1, linux_6_1 , linuxManualConfig , optimizeForSize ? false +, useEdpPanel ? false #< use `edp-panel` driver in snow device tree (fails to fix graphics) +, revertPanelSimplePatch ? false #< revert the commit which removed B116XW03 panel from panel-edp driver (fixes display output) , sane-kernel-tools , writeTextFile #v nixpkgs calls `.override` on the kernel to configure additional things @@ -13,6 +15,17 @@ let defconfigPmos = builtins.readFile ./config-postmarketos-exynos5.arm7; + patches = { + useEdpPanel = { + name = "snow: use edp-panel driver"; + patch = ./snow-panel-fix.patch; + }; + revertPanelSimplePatch = { + name = "revert ad3e33fe071dffea07279f96dab4f3773c430fe2, and get snow to use edp-panel again"; + patch = ./snow-panel-revert-b116xw03.patch; + }; + }; + # remove CONFIG_LOCALVERSION else nixpkgs complains about mismatched modDirVersion withoutOsFlavor = defconfig: lib.replaceStrings [ ''CONFIG_LOCALVERSION="-postmarketos-exynos5"'' ] @@ -64,10 +77,14 @@ let ) ) ); -in linuxManualConfig { +in (linuxManualConfig { inherit (linux) extraMakeFlags modDirVersion src version; inherit features randstructSeed; - kernelPatches = args.kernelPatches or []; + kernelPatches = (args.kernelPatches or []) ++ lib.optionals useEdpPanel [ + patches.useEdpPanel + ] ++ lib.optionals revertPanelSimplePatch [ + patches.revertPanelSimplePatch + ]; configfile = writeTextFile { name = "config-postmarketos-exynos5.arm7"; @@ -76,4 +93,8 @@ in linuxManualConfig { # nixpkgs requires to know the config as an attrset, to do various eval-time assertions. # this forces me to include the defconfig inline, instead of fetching it the way i do all the other pmOS kernel stuff. config = sane-kernel-tools.parseDefconfig defconfigStr; -} +}).overrideAttrs (base: { + passthru = (base.passthru or {}) // { + sanePatches = patches; + }; +}) diff --git a/pkgs/additional/linux-postmarketos-exynos5/snow-panel-fix.patch b/pkgs/additional/linux-postmarketos-exynos5/snow-panel-fix.patch new file mode 100644 index 00000000..cd925630 --- /dev/null +++ b/pkgs/additional/linux-postmarketos-exynos5/snow-panel-fix.patch @@ -0,0 +1,13 @@ +diff --git a/arch/arm/boot/dts/samsung/exynos5250-snow-common.dtsi b/arch/arm/boot/dts/samsung/exynos5250-snow-common.dtsi +index 65b000df176e..bc8060890137 100644 +--- a/arch/arm/boot/dts/samsung/exynos5250-snow-common.dtsi ++++ b/arch/arm/boot/dts/samsung/exynos5250-snow-common.dtsi +@@ -205,7 +205,7 @@ backlight: backlight { + }; + + panel: panel { +- compatible = "auo,b116xw03"; ++ compatible = "edp-panel"; + power-supply = <&fet6>; + backlight = <&backlight>; + diff --git a/pkgs/additional/linux-postmarketos-exynos5/snow-panel-revert-b116xw03.patch b/pkgs/additional/linux-postmarketos-exynos5/snow-panel-revert-b116xw03.patch new file mode 100644 index 00000000..45eba46f --- /dev/null +++ b/pkgs/additional/linux-postmarketos-exynos5/snow-panel-revert-b116xw03.patch @@ -0,0 +1,100 @@ +diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c +index 95c8472d878a..feb665df35a1 100644 +--- a/drivers/gpu/drm/panel/panel-edp.c ++++ b/drivers/gpu/drm/panel/panel-edp.c +@@ -976,6 +976,32 @@ static const struct panel_desc auo_b116xak01 = { + }, + }; + ++static const struct drm_display_mode auo_b116xw03_mode = { ++ .clock = 70589, ++ .hdisplay = 1366, ++ .hsync_start = 1366 + 40, ++ .hsync_end = 1366 + 40 + 40, ++ .htotal = 1366 + 40 + 40 + 32, ++ .vdisplay = 768, ++ .vsync_start = 768 + 10, ++ .vsync_end = 768 + 10 + 12, ++ .vtotal = 768 + 10 + 12 + 6, ++ .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC, ++}; ++ ++static const struct panel_desc auo_b116xw03 = { ++ .modes = &auo_b116xw03_mode, ++ .num_modes = 1, ++ .bpc = 6, ++ .size = { ++ .width = 256, ++ .height = 144, ++ }, ++ .delay = { ++ .enable = 400, ++ }, ++}; ++ + static const struct drm_display_mode auo_b133han05_mode = { + .clock = 142600, + .hdisplay = 1920, +@@ -1699,6 +1725,9 @@ static const struct of_device_id platform_of_match[] = { + }, { + .compatible = "auo,b116xa01", + .data = &auo_b116xak01, ++ }, { ++ .compatible = "auo,b116xw03", ++ .data = &auo_b116xw03, + }, { + .compatible = "auo,b133han05", + .data = &auo_b133han05, +diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c +index dd7928d9570f..95959dcc6e0e 100644 +--- a/drivers/gpu/drm/panel/panel-simple.c ++++ b/drivers/gpu/drm/panel/panel-simple.c +@@ -919,38 +919,6 @@ static const struct panel_desc auo_b101xtn01 = { + }, + }; + +-static const struct drm_display_mode auo_b116xw03_mode = { +- .clock = 70589, +- .hdisplay = 1366, +- .hsync_start = 1366 + 40, +- .hsync_end = 1366 + 40 + 40, +- .htotal = 1366 + 40 + 40 + 32, +- .vdisplay = 768, +- .vsync_start = 768 + 10, +- .vsync_end = 768 + 10 + 12, +- .vtotal = 768 + 10 + 12 + 6, +- .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC, +-}; +- +-static const struct panel_desc auo_b116xw03 = { +- .modes = &auo_b116xw03_mode, +- .num_modes = 1, +- .bpc = 6, +- .size = { +- .width = 256, +- .height = 144, +- }, +- .delay = { +- .prepare = 1, +- .enable = 200, +- .disable = 200, +- .unprepare = 500, +- }, +- .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG, +- .bus_flags = DRM_BUS_FLAG_DE_HIGH, +- .connector_type = DRM_MODE_CONNECTOR_LVDS, +-}; +- + static const struct display_timing auo_g070vvn01_timings = { + .pixelclock = { 33300000, 34209000, 45000000 }, + .hactive = { 800, 800, 800 }, +@@ -4134,9 +4102,6 @@ static const struct of_device_id platform_of_match[] = { + }, { + .compatible = "auo,b101xtn01", + .data = &auo_b101xtn01, +- }, { +- .compatible = "auo,b116xw03", +- .data = &auo_b116xw03, + }, { + .compatible = "auo,g070vvn01", + .data = &auo_g070vvn01,