From fa6e4bb2d829f2456f8dccdb258b70209e02dd15 Mon Sep 17 00:00:00 2001 From: The-going <48602507+The-going@users.noreply.github.com> Date: Wed, 28 May 2025 15:01:15 +0300 Subject: [PATCH] sunxi=6.12: re-extracting megous patches --- ...-New-codec-driver-for-the-EC25-modem.patch | 8 +- ...-with-information-and-u-boot-patches.patch | 215 ------- ...etected-CPU-bin-for-easier-debugging.patch | 8 +- ...drm-sun4i-Implement-gamma-correction.patch | 131 ----- ...one-of-the-UI-planes-as-a-cursor-one.patch | 73 --- ...er-display-pipeline-state-from-p-boo.patch | 547 ------------------ ...2145-Galaxycore-camera-module-driver.patch | 6 +- ...river-for-Himax-HM5065-camera-sensor.patch | 6 +- ...-on-poweroff-reboot-on-Orange-Pi-5-P.patch | 8 +- ...gling-pointer-in-netdev-private-data.patch | 32 +- ...set_resume-callback-for-WWAN-devices.patch | 6 +- patch/kernel/archive/sunxi-6.12/series.megous | 4 - 12 files changed, 37 insertions(+), 1007 deletions(-) delete mode 100644 patch/kernel/archive/sunxi-6.12/patches.megous/Add-README.md-with-information-and-u-boot-patches.patch delete mode 100644 patch/kernel/archive/sunxi-6.12/patches.megous/drm-sun4i-Implement-gamma-correction.patch delete mode 100644 patch/kernel/archive/sunxi-6.12/patches.megous/drm-sun4i-Mark-one-of-the-UI-planes-as-a-cursor-one.patch delete mode 100644 patch/kernel/archive/sunxi-6.12/patches.megous/drm-sun4i-Support-taking-over-display-pipeline-state-from-p-boo.patch diff --git a/patch/kernel/archive/sunxi-6.12/patches.megous/ASoC-ec25-New-codec-driver-for-the-EC25-modem.patch b/patch/kernel/archive/sunxi-6.12/patches.megous/ASoC-ec25-New-codec-driver-for-the-EC25-modem.patch index daea81c1e..fed009d33 100644 --- a/patch/kernel/archive/sunxi-6.12/patches.megous/ASoC-ec25-New-codec-driver-for-the-EC25-modem.patch +++ b/patch/kernel/archive/sunxi-6.12/patches.megous/ASoC-ec25-New-codec-driver-for-the-EC25-modem.patch @@ -1,4 +1,4 @@ -From 2a82156c12d9eb10f0f4591c65b4fb9cedb49d47 Mon Sep 17 00:00:00 2001 +From e09b611829829f817a79e3feb10fec2252922f81 Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Fri, 25 Sep 2020 21:42:52 -0500 Subject: ASoC: ec25: New codec driver for the EC25 modem @@ -16,10 +16,10 @@ Signed-off-by: Samuel Holland create mode 100644 sound/soc/codecs/ec25.c diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index 7092842480ef..602a815dfaee 100644 +index 6a72561c4189..d44196e801c4 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig -@@ -1125,6 +1125,9 @@ config SND_SOC_HDMI_CODEC +@@ -1124,6 +1124,9 @@ config SND_SOC_HDMI_CODEC select SND_PCM_IEC958 select HDMI @@ -30,7 +30,7 @@ index 7092842480ef..602a815dfaee 100644 tristate "Everest Semi ES7134 CODEC" diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile -index 54cbc3feae32..76db4d730730 100644 +index 69cb0b39f220..3d06bbc2dca9 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -120,6 +120,7 @@ snd-soc-da7219-y := da7219.o da7219-aad.o diff --git a/patch/kernel/archive/sunxi-6.12/patches.megous/Add-README.md-with-information-and-u-boot-patches.patch b/patch/kernel/archive/sunxi-6.12/patches.megous/Add-README.md-with-information-and-u-boot-patches.patch deleted file mode 100644 index f1b86cac6..000000000 --- a/patch/kernel/archive/sunxi-6.12/patches.megous/Add-README.md-with-information-and-u-boot-patches.patch +++ /dev/null @@ -1,215 +0,0 @@ -From 21d723b8f75ffedff2e56144c1d03bb4f9327a5f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= -Date: Tue, 22 Nov 2016 01:01:49 +0100 -Subject: Add README.md with information and u-boot patches - -Signed-off-by: Ondrej Jirman ---- - ...Fix-PLL1-setup-to-never-use-dividers.patch | 33 ++++ - README.md | 154 ++++++++++++++++++ - 2 files changed, 187 insertions(+) - create mode 100644 0001-sunxi-h3-Fix-PLL1-setup-to-never-use-dividers.patch - create mode 100644 README.md - -diff --git a/0001-sunxi-h3-Fix-PLL1-setup-to-never-use-dividers.patch b/0001-sunxi-h3-Fix-PLL1-setup-to-never-use-dividers.patch -new file mode 100644 -index 000000000000..2b892e805a2b ---- /dev/null -+++ b/0001-sunxi-h3-Fix-PLL1-setup-to-never-use-dividers.patch -@@ -0,0 +1,33 @@ -+From 7f5071f906f79bdc99d6b4b0ccf0cb280abe740b Mon Sep 17 00:00:00 2001 -+From: Ondrej Jirman -+Date: Tue, 20 Dec 2016 11:25:12 +0100 -+Subject: [PATCH] sunxi: h3: Fix PLL1 setup to never use dividers -+ -+Kernel would lower the divider on first CLK change and cause the -+lock up. -+--- -+ arch/arm/mach-sunxi/clock_sun6i.c | 7 +++---- -+ 1 file changed, 3 insertions(+), 4 deletions(-) -+ -+diff --git a/arch/arm/mach-sunxi/clock_sun6i.c b/arch/arm/mach-sunxi/clock_sun6i.c -+index 50fb302a19..91aa2a0478 100644 -+--- a/arch/arm/mach-sunxi/clock_sun6i.c -++++ b/arch/arm/mach-sunxi/clock_sun6i.c -+@@ -94,11 +94,10 @@ void clock_set_pll1(unsigned int clk) -+ int k = 1; -+ int m = 1; -+ -+- if (clk > 1152000000) { -+- k = 2; -+- } else if (clk > 768000000) { -++ if (clk >= 1368000000) { -+ k = 3; -+- m = 2; -++ } else if (clk >= 768000000) { -++ k = 2; -+ } -+ -+ /* Switch to 24MHz clock while changing PLL1 */ -+-- -+2.11.0 -+ -diff --git a/README.md b/README.md -new file mode 100644 -index 000000000000..74c4c16416d3 ---- /dev/null -+++ b/README.md -@@ -0,0 +1,154 @@ -+Mainline linux kernel for Orange Pi PC/PC2/PC3/One, TBS A711, PinePhone (Pro), PocketBook Touch Lux 3 -+------------------------------------------------------------------------------------------------------ -+ -+This kernel tree is meant for: -+ -+- Orange Pi One -+- Orange Pi PC -+- Orange Pi PC 2 -+- Orange Pi 3 -+- PinePhone 1.0, 1.1 and 1.2(a/b) -+- TBS A711 Tablet -+- PocketBook Touch Lux 3 -+- Pinebook Pro -+- Pinephone Pro -+ -+Features in addition to mainline: -+ -+- [Orange Pi One/PC/PC2] More aggressive OPPs for CPU -+- [All] Mark one of DRM planes as a cursor plane, speeding up Xorg based desktop with modesetting driver -+- [Orange Pi One/PC/PC2] Configure on-board micro-switches to perform system power off function -+- [Orange Pi One/PC/PC2/3] HDMI audio -+- [Orange Pi 3] Ethernet -+- [TBS A711] HM5065 (back camera) / GC2145 (front camera) -+- [PinePhone] WiFi, Bluetooth, Audio, Modem power, HDMI out over USB-C, USB-C support, cameras, PMIC improvements, power management, fixes here and there -+- [PocketBook Touch Lux 3] Display and Touchscreen support -+- [Pinephone Pro] Everything -+ -+Pre-built u-boot and kernels are available at https://xff.cz/kernels/ -+ -+You may need some firmware files for some part of the functionality. Those are -+available at: https://megous.com/git/linux-firmware -+ -+If you want to reproduce my pre-built kernels exactly, you'll need to uncomment -+CONFIG_EXTRA_FIRMWARE_DIR and CONFIG_EXTRA_FIRMWARE in the defconfigs, and -+point CONFIG_EXTRA_FIRMWARE_DIR to a directory on your computer where the -+clone of https://megous.com/git/linux-firmware resides. -+ -+You can also leave those two config options commented out, and copy the contents -+of https://megous.com/git/linux-firmware to /lib/firmware/ on the target device. -+ -+You can use this kernel to run a desktop environment on Orange Pi SBCs, -+Arch Linux on your Pinephone, or to have a completely opensource OS on -+a Pocketbook e-ink book reader. -+ -+Have fun! -+ -+ -+Build instructions -+------------------ -+ -+These are rudimentary instructions and you need to understand what you're doing. -+These are just core steps required to build the ATF/u-boot/kernel. Downloading, -+verifying, renaming to correct directories is not described or mentioned. You -+should be able to infer missing necessary steps yourself for your particular needs. -+ -+Get necessary toolchains from: -+ -+- https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/ for 64bit Orange Pi PC2 and Orange Pi 3, PinePhone -+- https://releases.linaro.org/components/toolchain/binaries/latest/arm-linux-gnueabihf/ for 32bit Orange Pis, Pocketbook, TBS tablet -+ -+Extract toolchains and prepare the environment: -+ -+ CWD=`pwd` -+ OUT=$CWD/builds -+ SRC=$CWD/u-boot -+ export PATH="$PATH:$CWD/Toolchains/arm/bin:$CWD/Toolchains/aarch64/bin" -+ -+For Orange Pi PC2, Orange Pi 3 or PinePhone: -+ -+ export CROSS_COMPILE=aarch64-linux-gnu- -+ export KBUILD_OUTPUT=$OUT/.tmp/uboot-pc2 -+ rm -rf "$KBUILD_OUTPUT" -+ mkdir -p $KBUILD_OUTPUT $OUT/pc2 -+ -+Get and build ATF from https://github.com/ARM-software/arm-trusted-firmware: -+ -+ make -C "$CWD/arm-trusted-firmware" PLAT=sun50i_a64 DEBUG=1 bl31 -+ cp "$CWD/arm-trusted-firmware/build/sun50i_a64/debug/bl31.bin" "$KBUILD_OUTPUT" -+ -+Use sun50i_a64 for Orange Pi PC2 or PinePhone and sun50i_h6 for Orange Pi 3. -+ -+Build u-boot from https://megous.com/git/u-boot/ (opi-v2020.04 branch) with appropriate -+defconfig (orangepi_one_defconfig, orangepi_pc2_defconfig, orangepi_pc_defconfig, orangepi_3_defconfig, tbs_a711_defconfig, pinephone_defconfig). -+ -+My u-boot branch already has all the necessary patches integrated and is configured for quick u-boot/kernel startup. -+ -+ make -C u-boot orangepi_pc2_defconfig -+ make -C u-boot -j5 -+ -+ cp $KBUILD_OUTPUT/.config $OUT/pc2/uboot.config -+ cat $KBUILD_OUTPUT/{spl/sunxi-spl.bin,u-boot.itb} > $OUT/pc2/uboot.bin -+ -+Get kernel from this repository and checkout the latest orange-pi-5.18 branch. -+ -+Build the kernel for 64-bit boards: -+ -+ export ARCH=arm64 -+ export CROSS_COMPILE=aarch64-linux-gnu- -+ export KBUILD_OUTPUT=$OUT/.tmp/linux-arm64 -+ mkdir -p $KBUILD_OUTPUT $OUT/pc2 -+ -+ make -C linux orangepi_defconfig -+ # or make -C linux pocketbook_touch_lux_3_defconfig -+ # or make -C linux tbs_a711_defconfig -+ make -C linux -j5 clean -+ make -C linux -j5 Image dtbs -+ -+ cp -f $KBUILD_OUTPUT/arch/arm64/boot/Image $OUT/pc2/ -+ cp -f $KBUILD_OUTPUT/.config $OUT/pc2/linux.config -+ cp -f $KBUILD_OUTPUT/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dtb $OUT/pc2/board.dtb -+ -+Build the kernel for 32-bit boards: -+ -+ export ARCH=arm -+ export CROSS_COMPILE=arm-linux-gnueabihf- -+ export KBUILD_OUTPUT=$OUT/.tmp/linux-arm -+ mkdir -p $KBUILD_OUTPUT $OUT/pc -+ -+ make orangepi_defconfig -+ # or make pinephone_defconfig -+ make -C linux orangepi_defconfig -+ make -C linux -j5 clean -+ make -C linux -j5 zImage dtbs -+ -+ cp -f $KBUILD_OUTPUT/arch/arm/boot/zImage $OUT/pc/ -+ cp -f $KBUILD_OUTPUT/.config $OUT/pc/linux.config -+ cp -f $KBUILD_OUTPUT/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dtb $OUT/pc/board.dtb -+ # Or use sun8i-h3-orangepi-one.dtb for Orange Pi One -+ -+ -+PinePhone -+--------- -+ -+I don't run u-boot on PinePhone, so my pre-built kernel packages don't come -+with u-boot built for PinePhone. -+ -+ -+Kernel lockup issues -+-------------------- -+ -+*If you're getting lockups on boot or later during thermal regulation, -+you're missing an u-boot patch.* -+ -+This patch is necessary to run this kernel! -+ -+These lockups are caused by improper NKMP clock factors selection -+in u-boot for PLL_CPUX. (M divider should not be used. P divider -+should be used only for frequencies below 240MHz.) -+ -+This patch for u-boot fixes it: -+ -+ 0001-sunxi-h3-Fix-PLL1-setup-to-never-use-dividers.patch -+ -+Kernel side is already fixed in this kernel tree. --- -2.35.3 - diff --git a/patch/kernel/archive/sunxi-6.12/patches.megous/cpufreq-sun50i-Show-detected-CPU-bin-for-easier-debugging.patch b/patch/kernel/archive/sunxi-6.12/patches.megous/cpufreq-sun50i-Show-detected-CPU-bin-for-easier-debugging.patch index e7b92367f..c06446f2a 100644 --- a/patch/kernel/archive/sunxi-6.12/patches.megous/cpufreq-sun50i-Show-detected-CPU-bin-for-easier-debugging.patch +++ b/patch/kernel/archive/sunxi-6.12/patches.megous/cpufreq-sun50i-Show-detected-CPU-bin-for-easier-debugging.patch @@ -1,4 +1,4 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From 8bb2d91bd36f4e447c323c0017cce6f18189b36d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= Date: Thu, 31 Oct 2019 18:31:32 +0100 Subject: cpufreq: sun50i: Show detected CPU bin, for easier debugging @@ -12,10 +12,10 @@ Signed-off-by: Ondrej Jirman 1 file changed, 2 insertions(+) diff --git a/drivers/cpufreq/sun50i-cpufreq-nvmem.c b/drivers/cpufreq/sun50i-cpufreq-nvmem.c -index 111111111111..222222222222 100644 +index 0599dbf851eb..b054ec1bf2d0 100644 --- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c +++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c -@@ -235,6 +235,8 @@ static int sun50i_cpufreq_nvmem_probe(struct platform_device *pdev) +@@ -241,6 +241,8 @@ static int sun50i_cpufreq_nvmem_probe(struct platform_device *pdev) snprintf(name, sizeof(name), "speed%d", speed); config.prop_name = name; @@ -25,5 +25,5 @@ index 111111111111..222222222222 100644 struct device *cpu_dev = get_cpu_device(cpu); -- -Armbian +2.35.3 diff --git a/patch/kernel/archive/sunxi-6.12/patches.megous/drm-sun4i-Implement-gamma-correction.patch b/patch/kernel/archive/sunxi-6.12/patches.megous/drm-sun4i-Implement-gamma-correction.patch deleted file mode 100644 index 9634007a0..000000000 --- a/patch/kernel/archive/sunxi-6.12/patches.megous/drm-sun4i-Implement-gamma-correction.patch +++ /dev/null @@ -1,131 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Vasily Khoruzhick -Date: Wed, 13 Mar 2019 19:50:17 -0700 -Subject: drm/sun4i: Implement gamma correction - -Add support for gamma corretion to sun4i TCON driver. Its LUT has 256 -entries and can be updated only when gamma correction is disabled. - -Signed-off-by: Vasily Khoruzhick ---- - drivers/gpu/drm/sun4i/sun4i_crtc.c | 14 ++++ - drivers/gpu/drm/sun4i/sun4i_tcon.c | 33 ++++++++++ - drivers/gpu/drm/sun4i/sun4i_tcon.h | 12 +++- - 3 files changed, 58 insertions(+), 1 deletion(-) - -diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c -index 111111111111..222222222222 100644 ---- a/drivers/gpu/drm/sun4i/sun4i_crtc.c -+++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c -@@ -103,6 +103,20 @@ static void sun4i_crtc_atomic_flush(struct drm_crtc *crtc, - drm_crtc_send_vblank_event(crtc, event); - spin_unlock_irq(&crtc->dev->event_lock); - } -+ -+ if (crtc->state->color_mgmt_changed) { -+ if (crtc->state->gamma_lut) { -+ /* LUT can be only updated when gamma correction is -+ * disabled -+ */ -+ sun4i_tcon_enable_gamma(scrtc->tcon, false); -+ sun4i_tcon_load_gamma_lut(scrtc->tcon, -+ crtc->state->gamma_lut->data); -+ sun4i_tcon_enable_gamma(scrtc->tcon, true); -+ } else -+ sun4i_tcon_enable_gamma(scrtc->tcon, false); -+ } -+ - } - - static void sun4i_crtc_atomic_disable(struct drm_crtc *crtc, -diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c -index 111111111111..222222222222 100644 ---- a/drivers/gpu/drm/sun4i/sun4i_tcon.c -+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c -@@ -240,6 +240,34 @@ void sun4i_tcon_enable_vblank(struct sun4i_tcon *tcon, bool enable) - } - EXPORT_SYMBOL(sun4i_tcon_enable_vblank); - -+void sun4i_tcon_load_gamma_lut(struct sun4i_tcon *tcon, -+ struct drm_color_lut *lut) -+{ -+ int i; -+ -+ for (i = 0; i < SUN4I_TCON_GAMMA_LUT_SIZE; i++) { -+ u32 r, g, b; -+ -+ r = drm_color_lut_extract(lut[i].red, 8); -+ g = drm_color_lut_extract(lut[i].green, 8); -+ b = drm_color_lut_extract(lut[i].blue, 8); -+ -+ regmap_write(tcon->regs, SUN4I_TCON_GAMMA_TABLE_REG + 4 * i, -+ SUN4I_TCON_GAMMA_TABLE_R(r) | -+ SUN4I_TCON_GAMMA_TABLE_G(g) | -+ SUN4I_TCON_GAMMA_TABLE_B(b)); -+ } -+} -+EXPORT_SYMBOL(sun4i_tcon_load_gamma_lut); -+ -+void sun4i_tcon_enable_gamma(struct sun4i_tcon *tcon, bool enable) -+{ -+ regmap_update_bits(tcon->regs, SUN4I_TCON_GCTL_REG, -+ SUN4I_TCON_GCTL_GAMMA_ENABLE, -+ enable ? SUN4I_TCON_GCTL_GAMMA_ENABLE : 0); -+} -+EXPORT_SYMBOL(sun4i_tcon_enable_gamma); -+ - /* - * This function is a helper for TCON output muxing. The TCON output - * muxing control register in earlier SoCs (without the TCON TOP block) -@@ -1288,6 +1316,11 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master, - - list_add_tail(&tcon->list, &drv->tcon_list); - -+ drm_mode_crtc_set_gamma_size(&tcon->crtc->crtc, -+ SUN4I_TCON_GAMMA_LUT_SIZE); -+ drm_crtc_enable_color_mgmt(&tcon->crtc->crtc, 0, false, -+ tcon->crtc->crtc.gamma_size); -+ - return 0; - - err_free_dclk: -diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h -index 111111111111..222222222222 100644 ---- a/drivers/gpu/drm/sun4i/sun4i_tcon.h -+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h -@@ -19,6 +19,7 @@ - - #define SUN4I_TCON_GCTL_REG 0x0 - #define SUN4I_TCON_GCTL_TCON_ENABLE BIT(31) -+#define SUN4I_TCON_GCTL_GAMMA_ENABLE BIT(30) - #define SUN4I_TCON_GCTL_IOMAP_MASK BIT(0) - #define SUN4I_TCON_GCTL_IOMAP_TCON1 (1 << 0) - #define SUN4I_TCON_GCTL_IOMAP_TCON0 (0 << 0) -@@ -229,7 +230,13 @@ - #define SUN4I_TCON1_FILL_BEG2_REG 0x31c - #define SUN4I_TCON1_FILL_END2_REG 0x320 - #define SUN4I_TCON1_FILL_DATA2_REG 0x324 --#define SUN4I_TCON1_GAMMA_TABLE_REG 0x400 -+ -+#define SUN4I_TCON_GAMMA_TABLE_REG 0x400 -+#define SUN4I_TCON_GAMMA_TABLE_B(x) ((x) & 0xff) -+#define SUN4I_TCON_GAMMA_TABLE_G(x) (((x) & 0xff) << 8) -+#define SUN4I_TCON_GAMMA_TABLE_R(x) (((x) & 0xff) << 16) -+ -+#define SUN4I_TCON_GAMMA_LUT_SIZE 256 - - #define SUN4I_TCON_MAX_CHANNELS 2 - -@@ -297,6 +304,9 @@ void sun4i_tcon_mode_set(struct sun4i_tcon *tcon, - const struct drm_display_mode *mode); - void sun4i_tcon_set_status(struct sun4i_tcon *crtc, - const struct drm_encoder *encoder, bool enable); -+void sun4i_tcon_load_gamma_lut(struct sun4i_tcon *tcon, -+ struct drm_color_lut *lut); -+void sun4i_tcon_enable_gamma(struct sun4i_tcon *tcon, bool enable); - - extern const struct of_device_id sun4i_tcon_of_table[]; - --- -Armbian - diff --git a/patch/kernel/archive/sunxi-6.12/patches.megous/drm-sun4i-Mark-one-of-the-UI-planes-as-a-cursor-one.patch b/patch/kernel/archive/sunxi-6.12/patches.megous/drm-sun4i-Mark-one-of-the-UI-planes-as-a-cursor-one.patch deleted file mode 100644 index 78f64d086..000000000 --- a/patch/kernel/archive/sunxi-6.12/patches.megous/drm-sun4i-Mark-one-of-the-UI-planes-as-a-cursor-one.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ondrej Jirman -Date: Mon, 31 Oct 2022 03:23:11 +0100 -Subject: drm/sun4i: Mark one of the UI planes as a cursor one - -Signed-off-by: Ondrej Jirman ---- - drivers/gpu/drm/sun4i/sun8i_mixer.c | 7 ++++++- - drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 7 ++----- - drivers/gpu/drm/sun4i/sun8i_ui_layer.h | 4 +++- - 3 files changed, 11 insertions(+), 7 deletions(-) - -diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c -index 111111111111..222222222222 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_mixer.c -+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c -@@ -349,8 +349,13 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm, - - for (i = 0; i < mixer->cfg->ui_num; i++) { - struct sun8i_layer *layer; -+ enum drm_plane_type type = DRM_PLANE_TYPE_OVERLAY; -+ if (i == 0) -+ type = DRM_PLANE_TYPE_PRIMARY; -+ else if (i == (mixer->cfg->ui_num - 1)) -+ type = DRM_PLANE_TYPE_CURSOR; - -- layer = sun8i_ui_layer_init_one(drm, mixer, i); -+ layer = sun8i_ui_layer_init_one(drm, mixer, i, type); - if (IS_ERR(layer)) { - dev_err(drm->dev, "Couldn't initialize %s plane\n", - i ? "overlay" : "primary"); -diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c -index 111111111111..222222222222 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c -+++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c -@@ -277,9 +277,9 @@ static const uint64_t sun8i_layer_modifiers[] = { - - struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm, - struct sun8i_mixer *mixer, -- int index) -+ int index, -+ enum drm_plane_type type) - { -- enum drm_plane_type type = DRM_PLANE_TYPE_OVERLAY; - int channel = mixer->cfg->vi_num + index; - struct sun8i_layer *layer; - unsigned int plane_cnt; -@@ -289,9 +289,6 @@ struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm, - if (!layer) - return ERR_PTR(-ENOMEM); - -- if (index == 0) -- type = DRM_PLANE_TYPE_PRIMARY; -- - /* possible crtcs are set later */ - ret = drm_universal_plane_init(drm, &layer->plane, 0, - &sun8i_ui_layer_funcs, -diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.h b/drivers/gpu/drm/sun4i/sun8i_ui_layer.h -index 111111111111..222222222222 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.h -+++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.h -@@ -51,5 +51,7 @@ struct sun8i_layer; - - struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm, - struct sun8i_mixer *mixer, -- int index); -+ int index, -+ enum drm_plane_type type); -+ - #endif /* _SUN8I_UI_LAYER_H_ */ --- -Armbian - diff --git a/patch/kernel/archive/sunxi-6.12/patches.megous/drm-sun4i-Support-taking-over-display-pipeline-state-from-p-boo.patch b/patch/kernel/archive/sunxi-6.12/patches.megous/drm-sun4i-Support-taking-over-display-pipeline-state-from-p-boo.patch deleted file mode 100644 index 5870e3676..000000000 --- a/patch/kernel/archive/sunxi-6.12/patches.megous/drm-sun4i-Support-taking-over-display-pipeline-state-from-p-boo.patch +++ /dev/null @@ -1,547 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ondrej Jirman -Date: Sun, 30 Apr 2023 18:19:16 +0200 -Subject: drm/sun4i: Support taking over display pipeline state from p-boot - -For perfect, flickerless and fast boot. - -Signed-off-by: Ondrej Jirman ---- - drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 4 +- - drivers/gpu/drm/drm_fbdev_ttm.c | 14 +++ - drivers/gpu/drm/panel/panel-sitronix-st7703.c | 17 +++ - drivers/gpu/drm/sun4i/sun4i_tcon.c | 23 ++++ - drivers/gpu/drm/sun4i/sun4i_tcon.h | 2 + - drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 13 +++ - drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 2 + - drivers/gpu/drm/sun4i/sun8i_mixer.c | 52 ++++++++++ - drivers/gpu/drm/sun4i/sun8i_mixer.h | 3 + - drivers/phy/allwinner/phy-sun6i-mipi-dphy.c | 14 +++ - drivers/video/backlight/pwm_bl.c | 25 ++++- - 11 files changed, 167 insertions(+), 2 deletions(-) - -diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c -index 111111111111..222222222222 100644 ---- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c -+++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c -@@ -980,7 +980,9 @@ static int sun50i_a64_ccu_probe(struct platform_device *pdev) - /* Decrease the PLL AUDIO bias current to reduce noise. */ - writel(0x10040000, reg + SUN50I_A64_PLL_AUDIO_BIAS_REG); - -- writel(0x515, reg + SUN50I_A64_PLL_MIPI_REG); -+ ret = of_property_read_u32_index(of_chosen, "p-boot,framebuffer-start", 0, &val); -+ if (ret) -+ writel(0x515, reg + SUN50I_A64_PLL_MIPI_REG); - - /* Set PLL MIPI as parent for TCON0 */ - val = readl(reg + SUN50I_A64_TCON0_CLK_REG); -diff --git a/drivers/gpu/drm/drm_fbdev_ttm.c b/drivers/gpu/drm/drm_fbdev_ttm.c -index 111111111111..222222222222 100644 ---- a/drivers/gpu/drm/drm_fbdev_ttm.c -+++ b/drivers/gpu/drm/drm_fbdev_ttm.c -@@ -78,6 +78,7 @@ static int drm_fbdev_ttm_helper_fb_probe(struct drm_fb_helper *fb_helper, - size_t screen_size; - void *screen_buffer; - u32 format; -+ u32 fb_start; - int ret; - - drm_dbg_kms(dev, "surface width(%d), height(%d) and bpp(%d)\n", -@@ -125,6 +126,19 @@ static int drm_fbdev_ttm_helper_fb_probe(struct drm_fb_helper *fb_helper, - if (ret) - goto err_drm_fb_helper_release_info; - -+ ret = of_property_read_u32_index(of_chosen, "p-boot,framebuffer-start", 0, &fb_start); -+ if (ret == 0) { -+ // copy framebuffer contents from p-boot if reasonable -+ if (screen_size != 720 * 1440 * 4) { -+ drm_err(dev, "surface width(%d), height(%d) and bpp(%d) does not match p-boot requirements\n", -+ sizes->surface_width, sizes->surface_height, -+ sizes->surface_bpp); -+ return 0; -+ } -+ -+ memcpy(screen_buffer, __va(fb_start), screen_size); -+ } -+ - return 0; - - err_drm_fb_helper_release_info: -diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c -index 111111111111..222222222222 100644 ---- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c -+++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c -@@ -62,6 +62,7 @@ struct st7703 { - struct dentry *debugfs; - const struct st7703_panel_desc *desc; - enum drm_panel_orientation orientation; -+ bool hw_preenabled; - }; - - struct st7703_panel_desc { -@@ -679,6 +680,11 @@ static int st7703_enable(struct drm_panel *panel) - struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); - struct mipi_dsi_multi_context dsi_ctx = {.dsi = dsi}; - -+ if (ctx->hw_preenabled) { -+ ctx->hw_preenabled = false; -+ return 0; -+ } -+ - ctx->desc->init_sequence(&dsi_ctx); - - mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx); -@@ -726,8 +732,10 @@ static int st7703_prepare(struct drm_panel *panel) - struct st7703 *ctx = panel_to_st7703(panel); - int ret; - -+ if (!ctx->hw_preenabled) { - dev_dbg(ctx->dev, "Resetting the panel\n"); - gpiod_set_value_cansleep(ctx->reset_gpio, 1); -+ } - - ret = regulator_enable(ctx->iovcc); - if (ret < 0) { -@@ -743,10 +751,12 @@ static int st7703_prepare(struct drm_panel *panel) - } - - /* Give power supplies time to stabilize before deasserting reset. */ -+ if (!ctx->hw_preenabled) { - usleep_range(10000, 20000); - - gpiod_set_value_cansleep(ctx->reset_gpio, 0); - usleep_range(15000, 20000); -+ } - - return 0; - } -@@ -844,12 +854,19 @@ static int st7703_probe(struct mipi_dsi_device *dsi) - { - struct device *dev = &dsi->dev; - struct st7703 *ctx; -+ u32 fb_start; - int ret; - - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); - if (!ctx) - return -ENOMEM; - -+ ret = of_property_read_u32_index(of_chosen, "p-boot,framebuffer-start", 0, &fb_start); -+ if (ret == 0) { -+ /* the display pipeline is already initialized by p-boot */ -+ ctx->hw_preenabled = true; -+ } -+ - ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); - if (IS_ERR(ctx->reset_gpio)) - return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), "Failed to get reset gpio\n"); -diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c -index 111111111111..222222222222 100644 ---- a/drivers/gpu/drm/sun4i/sun4i_tcon.c -+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c -@@ -40,6 +40,8 @@ - #include "sun8i_tcon_top.h" - #include "sunxi_engine.h" - -+static bool hw_preconfigured; -+ - static struct drm_connector *sun4i_tcon_get_connector(const struct drm_encoder *encoder) - { - struct drm_connector *connector; -@@ -743,6 +745,13 @@ void sun4i_tcon_mode_set(struct sun4i_tcon *tcon, - const struct drm_encoder *encoder, - const struct drm_display_mode *mode) - { -+ if (tcon->hw_preconfigured) { -+ // avoid the first modeset -+ tcon->hw_preconfigured = false; -+ hw_preconfigured = false; -+ return; -+ } -+ - switch (encoder->encoder_type) { - case DRM_MODE_ENCODER_DSI: - /* DSI is tied to special case of CPU interface */ -@@ -883,6 +892,7 @@ static int sun4i_tcon_init_regmap(struct device *dev, - return PTR_ERR(tcon->regs); - } - -+ if (!tcon->hw_preconfigured) { - /* Make sure the TCON is disabled and all IRQs are off */ - regmap_write(tcon->regs, SUN4I_TCON_GCTL_REG, 0); - regmap_write(tcon->regs, SUN4I_TCON_GINT0_REG, 0); -@@ -891,6 +901,7 @@ static int sun4i_tcon_init_regmap(struct device *dev, - /* Disable IO lines and set them to tristate */ - regmap_write(tcon->regs, SUN4I_TCON0_IO_TRI_REG, ~0); - regmap_write(tcon->regs, SUN4I_TCON1_IO_TRI_REG, ~0); -+ } - - return 0; - } -@@ -1162,6 +1173,9 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master, - tcon->dev = dev; - tcon->id = engine->id; - tcon->quirks = of_device_get_match_data(dev); -+ -+ if (tcon->id == 0) -+ tcon->hw_preconfigured = hw_preconfigured; - - tcon->lcd_rst = devm_reset_control_get(dev, "lcd"); - if (IS_ERR(tcon->lcd_rst)) { -@@ -1183,12 +1197,14 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master, - } - } - -+ if (!tcon->hw_preconfigured) { - /* Make sure our TCON is reset */ - ret = reset_control_reset(tcon->lcd_rst); - if (ret) { - dev_err(dev, "Couldn't deassert our reset line\n"); - return ret; - } -+ } - - if (tcon->quirks->supports_lvds) { - /* -@@ -1352,8 +1368,15 @@ static int sun4i_tcon_probe(struct platform_device *pdev) - const struct sun4i_tcon_quirks *quirks; - struct drm_bridge *bridge; - struct drm_panel *panel; -+ u32 fb_start; - int ret; - -+ ret = of_property_read_u32_index(of_chosen, "p-boot,framebuffer-start", 0, &fb_start); -+ if (ret == 0) { -+ /* the display pipeline is already initialized by p-boot */ -+ hw_preconfigured = true; -+ } -+ - quirks = of_device_get_match_data(&pdev->dev); - - /* panels and bridges are present only on TCONs with channel 0 */ -diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h -index 111111111111..222222222222 100644 ---- a/drivers/gpu/drm/sun4i/sun4i_tcon.h -+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h -@@ -293,6 +293,8 @@ struct sun4i_tcon { - - /* TCON list management */ - struct list_head list; -+ -+ bool hw_preconfigured; - }; - - struct drm_bridge *sun4i_tcon_find_bridge(struct device_node *node); -diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c -index 111111111111..222222222222 100644 ---- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c -+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c -@@ -732,6 +732,7 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) - reset_control_deassert(dsi->reset); - clk_prepare_enable(dsi->mod_clk); - -+ if (!dsi->hw_preconfigured) { - /* - * Enable the DSI block. - */ -@@ -758,6 +759,7 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) - sun6i_dsi_setup_inst_loop(dsi, mode); - sun6i_dsi_setup_format(dsi, mode); - sun6i_dsi_setup_timings(dsi, mode); -+ } - - phy_init(dsi->dphy); - -@@ -787,11 +789,15 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) - if (dsi->panel) - drm_panel_enable(dsi->panel); - -+ if (!dsi->hw_preconfigured) { - sun6i_dsi_start(dsi, DSI_START_HSC); - - udelay(1000); - - sun6i_dsi_start(dsi, DSI_START_HSD); -+ } -+ -+ dsi->hw_preconfigured = false; - } - - static void sun6i_dsi_encoder_disable(struct drm_encoder *encoder) -@@ -1105,6 +1111,7 @@ static int sun6i_dsi_probe(struct platform_device *pdev) - struct device *dev = &pdev->dev; - struct sun6i_dsi *dsi; - void __iomem *base; -+ u32 fb_start; - int ret; - - variant = device_get_match_data(dev); -@@ -1120,6 +1127,12 @@ static int sun6i_dsi_probe(struct platform_device *pdev) - dsi->host.dev = dev; - dsi->variant = variant; - -+ ret = of_property_read_u32_index(of_chosen, "p-boot,framebuffer-start", 0, &fb_start); -+ if (ret == 0) { -+ /* the display pipeline is already initialized by p-boot */ -+ dsi->hw_preconfigured = true; -+ } -+ - base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(base)) { - dev_err(dev, "Couldn't map the DSI encoder registers\n"); -diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h -index 111111111111..222222222222 100644 ---- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h -+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h -@@ -38,6 +38,8 @@ struct sun6i_dsi { - struct drm_panel *panel; - - const struct sun6i_dsi_variant *variant; -+ -+ bool hw_preconfigured; - }; - - static inline struct sun6i_dsi *host_to_sun6i_dsi(struct mipi_dsi_host *host) -diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c -index 111111111111..222222222222 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_mixer.c -+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c -@@ -24,6 +24,7 @@ - #include - - #include "sun4i_drv.h" -+#include "sun4i_tcon.h" - #include "sun8i_mixer.h" - #include "sun8i_ui_layer.h" - #include "sun8i_vi_layer.h" -@@ -34,6 +35,8 @@ struct de2_fmt_info { - u32 de2_fmt; - }; - -+static bool hw_preconfigured; -+ - static const struct de2_fmt_info de2_formats[] = { - { - .drm_fmt = DRM_FORMAT_ARGB8888, -@@ -278,6 +281,33 @@ static void sun8i_mixer_commit(struct sunxi_engine *engine, - struct drm_plane *plane; - u32 route = 0, pipe_en = 0; - -+ if (mixer->hw_preconfigured && engine->id == 0) { -+ struct sun4i_tcon* tcon; -+ u32 val, saved, ret; -+ -+ /* -+ * This is the first commit, wait for vblank on tcon0 before continuing. -+ */ -+ list_for_each_entry(tcon, &mixer->drv->tcon_list, list) { -+ if (tcon->id == 0) { -+ regmap_read(tcon->regs, SUN4I_TCON_GINT0_REG, &saved); -+ saved &= 0xffff0000; -+ -+ regmap_write(tcon->regs, SUN4I_TCON_GINT0_REG, 0); -+ -+ ret = regmap_read_poll_timeout(tcon->regs, SUN4I_TCON_GINT0_REG, val, -+ val & (SUN4I_TCON_GINT0_VBLANK_INT(0) | -+ SUN4I_TCON_GINT0_VBLANK_INT(1) | -+ SUN4I_TCON_GINT0_TCON0_TRI_FINISH_INT), -+ 100, 40000); -+ -+ regmap_write(tcon->regs, SUN4I_TCON_GINT0_REG, saved); -+ } -+ } -+ -+ mixer->hw_preconfigured = false; -+ } -+ - DRM_DEBUG_DRIVER("Committing changes\n"); - - drm_for_each_plane(plane, state->dev) { -@@ -461,6 +491,7 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master, - dev_set_drvdata(dev, mixer); - mixer->engine.ops = &sun8i_engine_ops; - mixer->engine.node = dev->of_node; -+ mixer->drv = drv; - - if (of_property_present(dev->of_node, "iommus")) { - /* -@@ -485,6 +516,11 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master, - */ - mixer->engine.id = sun8i_mixer_of_get_id(dev->of_node); - -+ if (mixer->engine.id == 0) { -+ mixer->hw_preconfigured = hw_preconfigured; -+ hw_preconfigured = false; -+ } -+ - mixer->cfg = of_device_get_match_data(dev); - if (!mixer->cfg) - return -EINVAL; -@@ -532,8 +568,11 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master, - * reason for the mixer to be functional. Make sure it's the - * case. - */ -+ -+ if (!mixer->hw_preconfigured) { - if (mixer->cfg->mod_rate) - clk_set_rate(mixer->mod_clk, mixer->cfg->mod_rate); -+ } - - clk_prepare_enable(mixer->mod_clk); - -@@ -541,6 +580,7 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master, - - base = sun8i_blender_base(mixer); - -+ if (!mixer->hw_preconfigured) { - /* Reset registers and disable unused sub-engines */ - if (mixer->cfg->is_de3) { - for (i = 0; i < DE3_MIXER_UNIT_SIZE; i += 4) -@@ -572,6 +612,7 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master, - /* Enable the mixer */ - regmap_write(mixer->engine.regs, SUN8I_MIXER_GLOBAL_CTL, - SUN8I_MIXER_GLOBAL_CTL_RT_EN); -+ } /* hw_preconfigured */ - - /* Set background color to black */ - regmap_write(mixer->engine.regs, SUN8I_MIXER_BLEND_BKCOLOR(base), -@@ -592,8 +633,10 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master, - SUN8I_MIXER_BLEND_MODE(base, i), - SUN8I_MIXER_BLEND_MODE_DEF); - -+ if (!mixer->hw_preconfigured) { - regmap_update_bits(mixer->engine.regs, SUN8I_MIXER_BLEND_PIPE_CTL(base), - SUN8I_MIXER_BLEND_PIPE_CTL_EN_MSK, 0); -+ } - - return 0; - -@@ -623,6 +666,15 @@ static const struct component_ops sun8i_mixer_ops = { - - static int sun8i_mixer_probe(struct platform_device *pdev) - { -+ int ret; -+ u32 fb_start; -+ -+ ret = of_property_read_u32_index(of_chosen, "p-boot,framebuffer-start", 0, &fb_start); -+ if (ret == 0) { -+ /* the display pipeline is already initialized by p-boot */ -+ hw_preconfigured = true; -+ } -+ - return component_add(&pdev->dev, &sun8i_mixer_ops); - } - -diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h b/drivers/gpu/drm/sun4i/sun8i_mixer.h -index 111111111111..222222222222 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_mixer.h -+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h -@@ -184,6 +184,9 @@ struct sun8i_mixer { - - struct clk *bus_clk; - struct clk *mod_clk; -+ -+ struct sun4i_drv *drv; -+ bool hw_preconfigured; - }; - - enum { -diff --git a/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c b/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c -index 111111111111..222222222222 100644 ---- a/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c -+++ b/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c -@@ -195,6 +195,8 @@ struct sun6i_dphy { - - const struct sun6i_dphy_variant *variant; - enum sun6i_dphy_direction direction; -+ -+ bool hw_preconfigured; - }; - - static int sun6i_dphy_init(struct phy *phy) -@@ -226,6 +228,11 @@ static void sun6i_a31_mipi_dphy_tx_power_on(struct sun6i_dphy *dphy) - { - u8 lanes_mask = GENMASK(dphy->config.lanes - 1, 0); - -+ if (dphy->hw_preconfigured) { -+ dphy->hw_preconfigured = false; -+ return; -+ } -+ - regmap_write(dphy->regs, SUN6I_DPHY_ANA0_REG, - SUN6I_DPHY_ANA0_REG_PWS | - SUN6I_DPHY_ANA0_REG_DMPC | -@@ -551,6 +558,7 @@ static int sun6i_dphy_probe(struct platform_device *pdev) - struct sun6i_dphy *dphy; - const char *direction; - void __iomem *regs; -+ u32 fb_start; - int ret; - - dphy = devm_kzalloc(&pdev->dev, sizeof(*dphy), GFP_KERNEL); -@@ -561,6 +569,12 @@ static int sun6i_dphy_probe(struct platform_device *pdev) - if (!dphy->variant) - return -EINVAL; - -+ ret = of_property_read_u32_index(of_chosen, "p-boot,framebuffer-start", 0, &fb_start); -+ if (ret == 0) { -+ /* the display pipeline is already initialized by p-boot */ -+ dphy->hw_preconfigured = true; -+ } -+ - regs = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(regs)) { - dev_err(&pdev->dev, "Couldn't map the DPHY encoder registers\n"); -diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c -index 111111111111..222222222222 100644 ---- a/drivers/video/backlight/pwm_bl.c -+++ b/drivers/video/backlight/pwm_bl.c -@@ -444,7 +444,7 @@ static int pwm_backlight_probe(struct platform_device *pdev) - struct backlight_properties props; - struct backlight_device *bl; - struct pwm_bl_data *pb; -- struct pwm_state state; -+ struct pwm_state state, state_real; - unsigned int i; - int ret; - -@@ -509,6 +509,11 @@ static int pwm_backlight_probe(struct platform_device *pdev) - /* Sync up PWM state. */ - pwm_init_state(pb->pwm, &state); - -+ /* Read real state, but only if the PWM is enabled. */ -+ pwm_get_state(pb->pwm, &state_real); -+ if (state_real.enabled) -+ state = state_real; -+ - /* - * The DT case will set the pwm_period_ns field to 0 and store the - * period, parsed from the DT, in the PWM device. For the non-DT case, -@@ -601,6 +606,24 @@ static int pwm_backlight_probe(struct platform_device *pdev) - - bl->props.brightness = data->dft_brightness; - bl->props.power = pwm_backlight_initial_power_state(pb); -+ if (bl->props.power == FB_BLANK_UNBLANK && pb->levels) { -+ u64 level; -+ -+ /* If the backlight is already on, determine the default -+ * brightness from PWM duty cycle instead of forcing -+ * the brightness determined by the driver -+ */ -+ pwm_get_state(pb->pwm, &state); -+ level = (u64)state.duty_cycle * pb->scale; -+ do_div(level, (u64)state.period); -+ -+ for (i = 0; i <= data->max_brightness; i++) { -+ if (data->levels[i] > level) { -+ bl->props.brightness = i; -+ break; -+ } -+ } -+ } - backlight_update_status(bl); - - platform_set_drvdata(pdev, bl); --- -Armbian - diff --git a/patch/kernel/archive/sunxi-6.12/patches.megous/media-gc2145-Galaxycore-camera-module-driver.patch b/patch/kernel/archive/sunxi-6.12/patches.megous/media-gc2145-Galaxycore-camera-module-driver.patch index 644ed911c..4a18ccd65 100644 --- a/patch/kernel/archive/sunxi-6.12/patches.megous/media-gc2145-Galaxycore-camera-module-driver.patch +++ b/patch/kernel/archive/sunxi-6.12/patches.megous/media-gc2145-Galaxycore-camera-module-driver.patch @@ -1,4 +1,4 @@ -From 54a8d9a823a07010fcec9f5ea2f7d61916e486cb Mon Sep 17 00:00:00 2001 +From 7a72d750c8442792b6d06f9ab1db6922b3058c2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= Date: Tue, 23 Jun 2020 19:51:18 +0200 Subject: media: gc2145: Galaxycore camera module driver @@ -14,10 +14,10 @@ Signed-off-by: Ondrej Jirman create mode 100644 drivers/media/i2c/gc2145.c diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig -index 43be07cc5b37..2b3b4635c2f0 100644 +index 0cc793fc7910..017d993a8c49 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig -@@ -711,6 +711,16 @@ config VIDEO_HM5065 +@@ -712,6 +712,16 @@ config VIDEO_HM5065 This is a V4L2 sensor-level driver for Himax HM5065 5 Mpixel camera. diff --git a/patch/kernel/archive/sunxi-6.12/patches.megous/media-hm5065-Add-subdev-driver-for-Himax-HM5065-camera-sensor.patch b/patch/kernel/archive/sunxi-6.12/patches.megous/media-hm5065-Add-subdev-driver-for-Himax-HM5065-camera-sensor.patch index ac5c67ce8..7ce978a2b 100644 --- a/patch/kernel/archive/sunxi-6.12/patches.megous/media-hm5065-Add-subdev-driver-for-Himax-HM5065-camera-sensor.patch +++ b/patch/kernel/archive/sunxi-6.12/patches.megous/media-hm5065-Add-subdev-driver-for-Himax-HM5065-camera-sensor.patch @@ -1,4 +1,4 @@ -From 670d184d6fd97edcf502edddca9f0ad89ce7e9d3 Mon Sep 17 00:00:00 2001 +From 8f018a158998fbdac9ef062f37ece6f67df274f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= Date: Sat, 30 Sep 2017 02:39:48 +0200 Subject: media: hm5065: Add subdev driver for Himax HM5065 camera sensor @@ -21,10 +21,10 @@ Signed-off-by: Ondrej Jirman create mode 100644 drivers/media/i2c/hm5065.c diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig -index 8ba096b8ebca..e7da18f3da3c 100644 +index 85ecb2aeefdb..2be73870045c 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig -@@ -701,6 +701,16 @@ config VIDEO_VGXY61 +@@ -702,6 +702,16 @@ config VIDEO_VGXY61 source "drivers/media/i2c/ccs/Kconfig" source "drivers/media/i2c/et8ek8/Kconfig" diff --git a/patch/kernel/archive/sunxi-6.12/patches.megous/pci-Workaround-ITS-timeouts-on-poweroff-reboot-on-Orange-Pi-5-P.patch b/patch/kernel/archive/sunxi-6.12/patches.megous/pci-Workaround-ITS-timeouts-on-poweroff-reboot-on-Orange-Pi-5-P.patch index ba31528c2..74caed7bc 100644 --- a/patch/kernel/archive/sunxi-6.12/patches.megous/pci-Workaround-ITS-timeouts-on-poweroff-reboot-on-Orange-Pi-5-P.patch +++ b/patch/kernel/archive/sunxi-6.12/patches.megous/pci-Workaround-ITS-timeouts-on-poweroff-reboot-on-Orange-Pi-5-P.patch @@ -1,4 +1,4 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From f59cd1bb68125718616d4950187b9b6d43e82cd0 Mon Sep 17 00:00:00 2001 From: Ondrej Jirman Date: Wed, 14 Jun 2023 00:48:21 +0200 Subject: pci: Workaround ITS timeouts on poweroff/reboot on Orange Pi 5 Plus @@ -15,10 +15,10 @@ Signed-off-by: Ondrej Jirman 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c -index 111111111111..222222222222 100644 +index 604c055f6078..53313c577176 100644 --- a/drivers/pci/pcie/portdrv.c +++ b/drivers/pci/pcie/portdrv.c -@@ -739,7 +739,7 @@ static void pcie_portdrv_shutdown(struct pci_dev *dev) +@@ -741,7 +741,7 @@ static void pcie_portdrv_shutdown(struct pci_dev *dev) pm_runtime_dont_use_autosuspend(&dev->dev); } @@ -28,5 +28,5 @@ index 111111111111..222222222222 100644 static pci_ers_result_t pcie_portdrv_error_detected(struct pci_dev *dev, -- -Armbian +2.35.3 diff --git a/patch/kernel/archive/sunxi-6.12/patches.megous/usb-gadget-Fix-dangling-pointer-in-netdev-private-data.patch b/patch/kernel/archive/sunxi-6.12/patches.megous/usb-gadget-Fix-dangling-pointer-in-netdev-private-data.patch index 3f31550a2..c44cde571 100644 --- a/patch/kernel/archive/sunxi-6.12/patches.megous/usb-gadget-Fix-dangling-pointer-in-netdev-private-data.patch +++ b/patch/kernel/archive/sunxi-6.12/patches.megous/usb-gadget-Fix-dangling-pointer-in-netdev-private-data.patch @@ -1,4 +1,4 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From 645bb870c8ecdd2f9bbddbbfe46dc2644c43ccc4 Mon Sep 17 00:00:00 2001 From: Ondrej Jirman Date: Thu, 7 Sep 2023 14:07:26 +0200 Subject: usb: gadget: Fix dangling pointer in netdev private data @@ -13,16 +13,16 @@ issues. Signed-off-by: Ondrej Jirman --- - drivers/usb/gadget/function/f_ecm.c | 12 ++-- - drivers/usb/gadget/function/f_eem.c | 28 +++++----- - drivers/usb/gadget/function/f_ncm.c | 9 ++- - drivers/usb/gadget/function/f_rndis.c | 26 ++++----- - drivers/usb/gadget/function/f_subset.c | 18 ++++-- - drivers/usb/gadget/function/u_ether.c | 10 ++-- + drivers/usb/gadget/function/f_ecm.c | 12 ++++++----- + drivers/usb/gadget/function/f_eem.c | 28 +++++++++++++------------- + drivers/usb/gadget/function/f_ncm.c | 9 ++++++--- + drivers/usb/gadget/function/f_rndis.c | 26 ++++++++++++------------ + drivers/usb/gadget/function/f_subset.c | 18 +++++++++++------ + drivers/usb/gadget/function/u_ether.c | 10 ++++----- 6 files changed, 56 insertions(+), 47 deletions(-) diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c -index 111111111111..222222222222 100644 +index 549efc84dd83..274d1461abb7 100644 --- a/drivers/usb/gadget/function/f_ecm.c +++ b/drivers/usb/gadget/function/f_ecm.c @@ -685,14 +685,12 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f) @@ -42,7 +42,7 @@ index 111111111111..222222222222 100644 mutex_unlock(&ecm_opts->lock); if (status) return status; -@@ -907,7 +905,9 @@ static void ecm_free(struct usb_function *f) +@@ -913,7 +911,9 @@ static void ecm_free(struct usb_function *f) static void ecm_unbind(struct usb_configuration *c, struct usb_function *f) { @@ -53,7 +53,7 @@ index 111111111111..222222222222 100644 DBG(c->cdev, "ecm unbind\n"); -@@ -920,6 +920,8 @@ static void ecm_unbind(struct usb_configuration *c, struct usb_function *f) +@@ -926,6 +926,8 @@ static void ecm_unbind(struct usb_configuration *c, struct usb_function *f) kfree(ecm->notify_req->buf); usb_ep_free_request(ecm->notify, ecm->notify_req); @@ -63,7 +63,7 @@ index 111111111111..222222222222 100644 static struct usb_function *ecm_alloc(struct usb_function_instance *fi) diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c -index 111111111111..222222222222 100644 +index 6de81ea17274..b1e1a26808dd 100644 --- a/drivers/usb/gadget/function/f_eem.c +++ b/drivers/usb/gadget/function/f_eem.c @@ -247,28 +247,23 @@ static int eem_bind(struct usb_configuration *c, struct usb_function *f) @@ -120,7 +120,7 @@ index 111111111111..222222222222 100644 static struct usb_function *eem_alloc(struct usb_function_instance *fi) diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c -index 111111111111..222222222222 100644 +index 8e761249d672..49b41da779ed 100644 --- a/drivers/usb/gadget/function/f_ncm.c +++ b/drivers/usb/gadget/function/f_ncm.c @@ -1454,14 +1454,13 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f) @@ -159,7 +159,7 @@ index 111111111111..222222222222 100644 static struct usb_function *ncm_alloc(struct usb_function_instance *fi) diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c -index 111111111111..222222222222 100644 +index 7cec19d65fb5..c2138f17a1c4 100644 --- a/drivers/usb/gadget/function/f_rndis.c +++ b/drivers/usb/gadget/function/f_rndis.c @@ -658,7 +658,7 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) @@ -220,7 +220,7 @@ index 111111111111..222222222222 100644 static struct usb_function *rndis_alloc(struct usb_function_instance *fi) diff --git a/drivers/usb/gadget/function/f_subset.c b/drivers/usb/gadget/function/f_subset.c -index 111111111111..222222222222 100644 +index ea3fdd842462..b595beb5f474 100644 --- a/drivers/usb/gadget/function/f_subset.c +++ b/drivers/usb/gadget/function/f_subset.c @@ -308,15 +308,16 @@ geth_bind(struct usb_configuration *c, struct usb_function *f) @@ -261,7 +261,7 @@ index 111111111111..222222222222 100644 static struct usb_function *geth_alloc(struct usb_function_instance *fi) diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c -index 111111111111..222222222222 100644 +index f58590bf5e02..a522e9d43a3a 100644 --- a/drivers/usb/gadget/function/u_ether.c +++ b/drivers/usb/gadget/function/u_ether.c @@ -112,8 +112,10 @@ static void eth_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *p) @@ -303,5 +303,5 @@ index 111111111111..222222222222 100644 EXPORT_SYMBOL_GPL(gether_set_gadget); -- -Armbian +2.35.3 diff --git a/patch/kernel/archive/sunxi-6.12/patches.megous/usb-serial-option-add-reset_resume-callback-for-WWAN-devices.patch b/patch/kernel/archive/sunxi-6.12/patches.megous/usb-serial-option-add-reset_resume-callback-for-WWAN-devices.patch index 12a16a67c..63d681933 100644 --- a/patch/kernel/archive/sunxi-6.12/patches.megous/usb-serial-option-add-reset_resume-callback-for-WWAN-devices.patch +++ b/patch/kernel/archive/sunxi-6.12/patches.megous/usb-serial-option-add-reset_resume-callback-for-WWAN-devices.patch @@ -1,4 +1,4 @@ -From 86bd1ff575fb7fa688b28e91b225ddcbc8e857d2 Mon Sep 17 00:00:00 2001 +From 4bbaab4b405d623fb5c390971387e1f2a4185820 Mon Sep 17 00:00:00 2001 From: Thomas Thorne Date: Tue, 20 Sep 2022 20:34:57 -0400 Subject: usb: serial: option: add 'reset_resume' callback for WWAN devices @@ -17,10 +17,10 @@ However the rest of the patch is not needed/already upstreamed. 1 file changed, 1 insertion(+) diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c -index 5cd26dac2069..f65c1d78a2cc 100644 +index 27879cc57536..4adc2f535ce4 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c -@@ -2471,6 +2471,7 @@ static struct usb_serial_driver option_1port_device = { +@@ -2474,6 +2474,7 @@ static struct usb_serial_driver option_1port_device = { #ifdef CONFIG_PM .suspend = usb_wwan_suspend, .resume = usb_wwan_resume, diff --git a/patch/kernel/archive/sunxi-6.12/series.megous b/patch/kernel/archive/sunxi-6.12/series.megous index d8b4fe2a0..ee4491ed8 100644 --- a/patch/kernel/archive/sunxi-6.12/series.megous +++ b/patch/kernel/archive/sunxi-6.12/series.megous @@ -186,10 +186,7 @@ patches.megous/drm-rockchip-dw-mipi-dsi-rockchip-Fix-ISP1-PHY-initialization.patch patches.megous/arm64-dts-rk3399-Add-dmc_opp_table.patch patches.megous/bluetooth-h5-Don-t-re-initialize-rtl8723cs-on-resume.patch - patches.megous/drm-sun4i-Mark-one-of-the-UI-planes-as-a-cursor-one.patch - patches.megous/drm-sun4i-Implement-gamma-correction.patch patches.megous/drm-panel-st7703-Fix-xbd599-timings-to-make-refresh-rate-exactl.patch - patches.megous/drm-sun4i-Support-taking-over-display-pipeline-state-from-p-boo.patch patches.megous/video-pwm_bl-Allow-to-change-lth_brightness-via-sysfs.patch patches.megous/clk-sunxi-ng-sun50i-a64-Switch-parent-of-MIPI-DSI-to-periph0-1x.patch patches.megous/drm-sun4i-tcon-Support-keeping-dclk-rate-upon-ancestor-clock-ch.patch @@ -250,5 +247,4 @@ patches.megous/Add-support-for-my-private-Sapomat-device.patch patches.megous/ARM-dts-sun8i-h3-orange-pi-one-Enable-all-gpio-header-UARTs.patch patches.megous/mtd-spi-nor-Add-Alliance-memory-support.patch - patches.megous/Add-README.md-with-information-and-u-boot-patches.patch patches.megous/Defconfigs-for-all-my-devices.patch