From b07065b4f5ba158789d5755aeb3a452b21560bf9 Mon Sep 17 00:00:00 2001 From: Yafen Date: Wed, 19 Apr 2023 03:20:51 +0800 Subject: [PATCH] RPi: update kernel version to openEuler 5.10.0-146.0.0 --- 0000-raspberrypi-kernel.patch | 1554 ++++++++++++++------------------- raspberrypi-kernel.spec | 7 +- 2 files changed, 642 insertions(+), 919 deletions(-) diff --git a/0000-raspberrypi-kernel.patch b/0000-raspberrypi-kernel.patch index a3989f0..fe2205e 100644 --- a/0000-raspberrypi-kernel.patch +++ b/0000-raspberrypi-kernel.patch @@ -1,7 +1,7 @@ -From 483c4e1ba58a9897927d52847237ede7d78d38c2 Mon Sep 17 00:00:00 2001 -From: yafen -Date: Wed, 9 Nov 2022 22:58:47 +0800 -Subject: [PATCH] apply RPi patch of 5.10.95(openEuler 5.10.0-126.0.0) +From 66c44c6084aa288a00454ea42231001f659ddbe5 Mon Sep 17 00:00:00 2001 +From: Yafen +Date: Wed, 19 Apr 2023 00:38:17 +0800 +Subject: [PATCH] apply RPi patch of 5.10.110(openEuler 5.10.0-147.0.0) --- .../admin-guide/media/bcm2835-isp.rst | 127 + @@ -73,7 +73,7 @@ Subject: [PATCH] apply RPi patch of 5.10.95(openEuler 5.10.0-126.0.0) arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 330 +- arch/arm/boot/dts/bcm2711-rpi-400.dts | 637 ++ arch/arm/boot/dts/bcm2711-rpi-cm4.dts | 652 ++ - arch/arm/boot/dts/bcm2711-rpi-cm4s.dts | 467 ++ + arch/arm/boot/dts/bcm2711-rpi-cm4s.dts | 477 ++ arch/arm/boot/dts/bcm2711-rpi.dtsi | 205 + arch/arm/boot/dts/bcm2711.dtsi | 72 +- arch/arm/boot/dts/bcm271x-rpi-bt.dtsi | 26 + @@ -387,15 +387,17 @@ Subject: [PATCH] apply RPi patch of 5.10.95(openEuler 5.10.0-126.0.0) arch/arm/vfp/vfpmodule.c | 25 +- arch/arm64/Kconfig.platforms | 1 + arch/arm64/boot/dts/Makefile | 2 + - arch/arm64/boot/dts/broadcom/Makefile | 16 +- + arch/arm64/boot/dts/broadcom/Makefile | 18 +- .../boot/dts/broadcom/bcm2710-rpi-2-b.dts | 1 + .../dts/broadcom/bcm2710-rpi-3-b-plus.dts | 1 + .../boot/dts/broadcom/bcm2710-rpi-3-b.dts | 1 + .../boot/dts/broadcom/bcm2710-rpi-cm3.dts | 1 + + .../dts/broadcom/bcm2710-rpi-zero-2-w.dts | 1 + .../boot/dts/broadcom/bcm2710-rpi-zero-2.dts | 1 + .../boot/dts/broadcom/bcm2711-rpi-4-b.dts | 3 +- .../boot/dts/broadcom/bcm2711-rpi-400.dts | 1 + .../boot/dts/broadcom/bcm2711-rpi-cm4.dts | 1 + + .../boot/dts/broadcom/bcm2711-rpi-cm4s.dts | 1 + .../dts/broadcom/bcm283x-rpi-csi1-2lane.dtsi | 1 + .../dts/broadcom/bcm283x-rpi-lan7515.dtsi | 1 + arch/arm64/boot/dts/overlays | 1 + @@ -512,22 +514,22 @@ Subject: [PATCH] apply RPi patch of 5.10.95(openEuler 5.10.0-126.0.0) drivers/gpu/drm/vboxvideo/vbox_mode.c | 6 +- drivers/gpu/drm/vc4/Kconfig | 1 + drivers/gpu/drm/vc4/Makefile | 1 + - drivers/gpu/drm/vc4/vc4_crtc.c | 289 +- + drivers/gpu/drm/vc4/vc4_crtc.c | 276 +- drivers/gpu/drm/vc4/vc4_debugfs.c | 7 +- drivers/gpu/drm/vc4/vc4_dpi.c | 113 +- - drivers/gpu/drm/vc4/vc4_drv.c | 81 +- - drivers/gpu/drm/vc4/vc4_drv.h | 96 +- - drivers/gpu/drm/vc4/vc4_dsi.c | 277 +- + drivers/gpu/drm/vc4/vc4_drv.c | 66 +- + drivers/gpu/drm/vc4/vc4_drv.h | 95 +- + drivers/gpu/drm/vc4/vc4_dsi.c | 73 +- drivers/gpu/drm/vc4/vc4_firmware_kms.c | 1992 +++++ drivers/gpu/drm/vc4/vc4_gem.c | 3 +- - drivers/gpu/drm/vc4/vc4_hdmi.c | 2207 ++++- + drivers/gpu/drm/vc4/vc4_hdmi.c | 2294 +++++- drivers/gpu/drm/vc4/vc4_hdmi.h | 148 +- drivers/gpu/drm/vc4/vc4_hdmi_phy.c | 45 +- drivers/gpu/drm/vc4/vc4_hdmi_regs.h | 35 +- drivers/gpu/drm/vc4/vc4_hvs.c | 309 +- drivers/gpu/drm/vc4/vc4_kms.c | 181 +- drivers/gpu/drm/vc4/vc4_perfmon.c | 2 +- - drivers/gpu/drm/vc4/vc4_plane.c | 330 +- + drivers/gpu/drm/vc4/vc4_plane.c | 312 +- drivers/gpu/drm/vc4/vc4_regs.h | 90 +- drivers/gpu/drm/vc4/vc4_txp.c | 24 +- drivers/gpu/drm/vc4/vc4_vec.c | 397 +- @@ -788,10 +790,10 @@ Subject: [PATCH] apply RPi patch of 5.10.95(openEuler 5.10.0-126.0.0) .../usb/host/dwc_otg/test/test_mod_param.pl | 133 + drivers/usb/host/dwc_otg/test/test_sysfs.pl | 193 + drivers/usb/host/xhci-mem.c | 67 +- - drivers/usb/host/xhci-pci.c | 2 + - drivers/usb/host/xhci-ring.c | 34 +- + drivers/usb/host/xhci-pci.c | 3 + + drivers/usb/host/xhci-ring.c | 55 +- drivers/usb/host/xhci.c | 104 +- - drivers/usb/host/xhci.h | 7 +- + drivers/usb/host/xhci.h | 8 +- drivers/video/backlight/Kconfig | 7 + drivers/video/backlight/Makefile | 1 + drivers/video/backlight/rpi_backlight.c | 119 + @@ -846,7 +848,7 @@ Subject: [PATCH] apply RPi patch of 5.10.95(openEuler 5.10.0-126.0.0) kernel/cgroup/cgroup.c | 38 + kernel/resource.c | 6 + mm/page_alloc.c | 2 - - mm/zswap.c | 53 +- + mm/zswap.c | 61 +- net/bluetooth/smp.c | 16 +- scripts/Makefile.dtbinst | 6 +- scripts/Makefile.lib | 19 + @@ -899,7 +901,7 @@ Subject: [PATCH] apply RPi patch of 5.10.95(openEuler 5.10.0-126.0.0) sound/soc/soc-core.c | 14 +- sound/usb/quirks-table.h | 9 + sound/usb/quirks.c | 6 + - 895 files changed, 175491 insertions(+), 4848 deletions(-) + 897 files changed, 175469 insertions(+), 4751 deletions(-) create mode 100644 Documentation/admin-guide/media/bcm2835-isp.rst create mode 100644 Documentation/devicetree/bindings/clock/raspberrypi,firmware-clocks.yaml create mode 100644 Documentation/devicetree/bindings/hwmon/rpi-poe-fan.txt @@ -1223,9 +1225,11 @@ Subject: [PATCH] apply RPi patch of 5.10.95(openEuler 5.10.0-126.0.0) create mode 100644 arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dts create mode 100644 arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dts create mode 100644 arch/arm64/boot/dts/broadcom/bcm2710-rpi-cm3.dts + create mode 100644 arch/arm64/boot/dts/broadcom/bcm2710-rpi-zero-2-w.dts create mode 100644 arch/arm64/boot/dts/broadcom/bcm2710-rpi-zero-2.dts create mode 100644 arch/arm64/boot/dts/broadcom/bcm2711-rpi-400.dts create mode 100644 arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4.dts + create mode 100644 arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4s.dts create mode 120000 arch/arm64/boot/dts/broadcom/bcm283x-rpi-csi1-2lane.dtsi create mode 120000 arch/arm64/boot/dts/broadcom/bcm283x-rpi-lan7515.dtsi create mode 120000 arch/arm64/boot/dts/overlays @@ -4152,10 +4156,10 @@ index 4a05a105a9e6..ba3a5b599362 100644 pixfmt-nv16m pixfmt-nv24 diff --git a/MAINTAINERS b/MAINTAINERS -index 4a563ba62a49..b91a7bdd7a7a 100644 +index 1b5a590049fb..4f5c47b2ad9b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -3417,6 +3417,29 @@ N: bcm113* +@@ -3427,6 +3427,29 @@ N: bcm113* N: bcm216* N: kona @@ -4185,7 +4189,7 @@ index 4a563ba62a49..b91a7bdd7a7a 100644 BROADCOM BCM47XX MIPS ARCHITECTURE M: Hauke Mehrtens M: Rafał Miłecki -@@ -5513,6 +5536,14 @@ S: Maintained +@@ -5529,6 +5552,14 @@ S: Maintained F: Documentation/devicetree/bindings/display/panel/feiyang,fy07024di26a30d.yaml F: drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c @@ -4200,7 +4204,7 @@ index 4a563ba62a49..b91a7bdd7a7a 100644 DRM DRIVER FOR GRAIN MEDIA GM12U320 PROJECTORS M: Hans de Goede S: Maintained -@@ -16420,6 +16451,23 @@ S: Maintained +@@ -16466,6 +16497,23 @@ S: Maintained T: git git://linuxtv.org/media_tree.git F: drivers/media/i2c/imx355.c @@ -4225,10 +4229,10 @@ index 4a563ba62a49..b91a7bdd7a7a 100644 M: Maxim Levitsky M: Alex Dubov diff --git a/Makefile b/Makefile -index 47377bdc2656..d52391beef08 100644 +index aaa05a3e38d8..030088c396f6 100644 --- a/Makefile +++ b/Makefile -@@ -1363,6 +1363,9 @@ ifneq ($(dtstree),) +@@ -1375,6 +1375,9 @@ ifneq ($(dtstree),) %.dtb: include/config/kernel.release scripts_dtc $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ @@ -4239,7 +4243,7 @@ index 47377bdc2656..d52391beef08 100644 dtbs: include/config/kernel.release scripts_dtc $(Q)$(MAKE) $(build)=$(dtstree) diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 7e8151681597..6bcb35ad76ac 100644 +index d93f01dddc3f..432c4d76bb35 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -1,4 +1,24 @@ @@ -4275,7 +4279,7 @@ index 7e8151681597..6bcb35ad76ac 100644 bcm2835-rpi-zero.dtb \ bcm2835-rpi-zero-w.dtb dtb-$(CONFIG_ARCH_BCM_5301X) += \ -@@ -1409,3 +1428,13 @@ dtb-$(CONFIG_ARCH_ASPEED) += \ +@@ -1410,3 +1429,13 @@ dtb-$(CONFIG_ARCH_ASPEED) += \ aspeed-bmc-opp-zaius.dtb \ aspeed-bmc-portwell-neptune.dtb \ aspeed-bmc-quanta-q71l.dtb @@ -8503,10 +8507,10 @@ index 000000000000..5dbd1b77260b +}; diff --git a/arch/arm/boot/dts/bcm2711-rpi-cm4s.dts b/arch/arm/boot/dts/bcm2711-rpi-cm4s.dts new file mode 100644 -index 000000000000..f90785abc92f +index 000000000000..0346d731dd0e --- /dev/null +++ b/arch/arm/boot/dts/bcm2711-rpi-cm4s.dts -@@ -0,0 +1,467 @@ +@@ -0,0 +1,477 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; +#include "bcm2711.dtsi" @@ -8914,6 +8918,16 @@ index 000000000000..f90785abc92f +// ============================================= +// Board specific stuff here + ++/* Enable USB in OTG-aware mode */ ++&usb { ++ compatible = "brcm,bcm2835-usb"; ++ dr_mode = "otg"; ++ g-np-tx-fifo-size = <32>; ++ g-rx-fifo-size = <558>; ++ g-tx-fifo-size = <512 512 512 512 512 256 256>; ++ status = "okay"; ++}; ++ +&sdhost { + status = "disabled"; +}; @@ -42601,10 +42615,10 @@ index f0f65eb073e4..868011801521 100644 1: #ifdef CONFIG_DMA_CACHE_RWFO diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S -index 307f381eee71..b97282e76bca 100644 +index 830bbfb26ca5..097248743b4c 100644 --- a/arch/arm/mm/cache-v7.S +++ b/arch/arm/mm/cache-v7.S -@@ -364,7 +364,8 @@ ENDPROC(v7_flush_kern_dcache_area) +@@ -363,7 +363,8 @@ ENDPROC(v7_flush_kern_dcache_area) * - start - virtual start address of region * - end - virtual end address of region */ @@ -42614,7 +42628,7 @@ index 307f381eee71..b97282e76bca 100644 dcache_line_size r2, r3 sub r3, r2, #1 tst r0, r3 -@@ -394,7 +395,8 @@ ENDPROC(v7_dma_inv_range) +@@ -393,7 +394,8 @@ ENDPROC(v7_dma_inv_range) * - start - virtual start address of region * - end - virtual end address of region */ @@ -42779,10 +42793,10 @@ index 9b1170658d60..cc6c25629057 100644 + +subdir-y += overlays diff --git a/arch/arm64/boot/dts/broadcom/Makefile b/arch/arm64/boot/dts/broadcom/Makefile -index cb7de8d99223..e7c2c4fd59a8 100644 +index cb7de8d99223..7fe8ece41072 100644 --- a/arch/arm64/boot/dts/broadcom/Makefile +++ b/arch/arm64/boot/dts/broadcom/Makefile -@@ -1,9 +1,21 @@ +@@ -1,9 +1,23 @@ # SPDX-License-Identifier: GPL-2.0 -dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-4-b.dtb \ - bcm2837-rpi-3-a-plus.dtb \ @@ -42791,6 +42805,7 @@ index cb7de8d99223..e7c2c4fd59a8 100644 bcm2837-rpi-3-b-plus.dtb \ bcm2837-rpi-cm3-io3.dtb +dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-zero-2.dtb ++dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-zero-2-w.dtb +dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-2-b.dtb +dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-3-b.dtb +dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-3-b-plus.dtb @@ -42798,6 +42813,7 @@ index cb7de8d99223..e7c2c4fd59a8 100644 +dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-400.dtb +dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-cm3.dtb +dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-cm4.dtb ++dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-cm4s.dtb subdir-y += northstar2 subdir-y += stingray @@ -42834,13 +42850,20 @@ index 000000000000..e1e13784cff6 +++ b/arch/arm64/boot/dts/broadcom/bcm2710-rpi-cm3.dts @@ -0,0 +1 @@ +#include "../../../../arm/boot/dts/bcm2710-rpi-cm3.dts" +diff --git a/arch/arm64/boot/dts/broadcom/bcm2710-rpi-zero-2-w.dts b/arch/arm64/boot/dts/broadcom/bcm2710-rpi-zero-2-w.dts +new file mode 100644 +index 000000000000..4d34e0afd4cd +--- /dev/null ++++ b/arch/arm64/boot/dts/broadcom/bcm2710-rpi-zero-2-w.dts +@@ -0,0 +1 @@ ++#include "../../../../arm/boot/dts/bcm2710-rpi-zero-2-w.dts" diff --git a/arch/arm64/boot/dts/broadcom/bcm2710-rpi-zero-2.dts b/arch/arm64/boot/dts/broadcom/bcm2710-rpi-zero-2.dts new file mode 100644 -index 000000000000..f76f553599ef +index 000000000000..4d34e0afd4cd --- /dev/null +++ b/arch/arm64/boot/dts/broadcom/bcm2710-rpi-zero-2.dts @@ -0,0 +1 @@ -+#include "../../../../arm/boot/dts/bcm2710-rpi-zero-2.dts" ++#include "../../../../arm/boot/dts/bcm2710-rpi-zero-2-w.dts" diff --git a/arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b.dts b/arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b.dts index d24c53682e44..bf69a4b0b172 100644 --- a/arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b.dts @@ -42863,6 +42886,13 @@ index 000000000000..8064a58155f1 +++ b/arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4.dts @@ -0,0 +1 @@ +#include "../../../../arm/boot/dts/bcm2711-rpi-cm4.dts" +diff --git a/arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4s.dts b/arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4s.dts +new file mode 100644 +index 000000000000..28e0980a374b +--- /dev/null ++++ b/arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4s.dts +@@ -0,0 +1 @@ ++#include "../../../../arm/boot/dts/bcm2711-rpi-cm4s.dts" diff --git a/arch/arm64/boot/dts/broadcom/bcm283x-rpi-csi1-2lane.dtsi b/arch/arm64/boot/dts/broadcom/bcm283x-rpi-csi1-2lane.dtsi new file mode 120000 index 000000000000..e5c400284467 @@ -45950,7 +45980,7 @@ index fb507d569922..cc52829d426a 100644 asmlinkage void aesbs_ecb_encrypt(u8 out[], u8 const in[], u8 const rk[], diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c -index 4a0ba2800e45..d3962c3ab827 100644 +index ab955c249f37..bdc8e8ab1d81 100644 --- a/arch/arm64/kernel/armv8_deprecated.c +++ b/arch/arm64/kernel/armv8_deprecated.c @@ -183,10 +183,15 @@ static void __init register_insn_emulation(struct insn_emulation_ops *ops) @@ -46020,10 +46050,10 @@ index 97dab8f4634f..74cfb4935f4b 100644 } diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c -index 538232b4c42a..3e78f429fc49 100644 +index a699e6166aef..ffe22b5ff280 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c -@@ -436,6 +436,14 @@ static const struct usb_device_id blacklist_table[] = { +@@ -451,6 +451,14 @@ static const struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x0bda, 0xb009), .driver_info = BTUSB_REALTEK }, { USB_DEVICE(0x2ff8, 0xb011), .driver_info = BTUSB_REALTEK }, @@ -46053,7 +46083,7 @@ index 996729e78105..6d179e455721 100644 if (H5_HDR_LEN(hdr) > 2) h5->tx_win = (data[2] & 0x07); diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig -index 701811fcc0fd..f8c7070bd71b 100644 +index 6fa56a473995..6389eb91e04b 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -5,6 +5,8 @@ @@ -46066,16 +46096,15 @@ index 701811fcc0fd..f8c7070bd71b 100644 config TTY_PRINTK diff --git a/drivers/char/Makefile b/drivers/char/Makefile -index 362d4a9cd4cf..eea88cef9829 100644 +index 71d76fd62692..3ad819383e9d 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile -@@ -47,5 +47,6 @@ obj-$(CONFIG_PS3_FLASH) += ps3flash.o +@@ -47,4 +47,5 @@ obj-$(CONFIG_PS3_FLASH) += ps3flash.o obj-$(CONFIG_XILLYBUS) += xillybus/ obj-$(CONFIG_POWERNV_OP_PANEL) += powernv-op-panel.o obj-$(CONFIG_ADI) += adi.o +obj-$(CONFIG_BRCM_CHAR_DRIVERS) += broadcom/ obj-$(CONFIG_PIN_MEMORY_DEV) += pin_memory.o - obj-$(CONFIG_HISI_SVM) += svm.o diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig new file mode 100644 index 000000000000..e555e841b8db @@ -47669,7 +47698,7 @@ index 000000000000..ac314617229c +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:rpi-vcio"); diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig -index 87cebb34aecc..f62af547b111 100644 +index 53e63d68ffb1..8888a116b49d 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig @@ -104,7 +104,7 @@ config HW_RANDOM_IPROC_RNG200 @@ -48237,7 +48266,7 @@ index 178886823b90..7e74aafddbf8 100644 MODULE_AUTHOR("Eric Anholt "); MODULE_DESCRIPTION("BCM2835 clock driver"); diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspberrypi.c -index f89b9cfc4309..c307e054f805 100644 +index 969227e2df21..cbe9dd4dd446 100644 --- a/drivers/clk/bcm/clk-raspberrypi.c +++ b/drivers/clk/bcm/clk-raspberrypi.c @@ -33,6 +33,7 @@ enum rpi_firmware_clk_id { @@ -48265,7 +48294,7 @@ index f89b9cfc4309..c307e054f805 100644 }; int ret; -@@ -271,7 +273,10 @@ static int raspberrypi_discover_clocks(struct raspberrypi_clk *rpi, +@@ -276,7 +278,10 @@ static int raspberrypi_discover_clocks(struct raspberrypi_clk *rpi, case RPI_FIRMWARE_CORE_CLK_ID: case RPI_FIRMWARE_M2MC_CLK_ID: case RPI_FIRMWARE_V3D_CLK_ID: @@ -48949,7 +48978,7 @@ index 000000000000..9e2634465823 +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:clk-hifiberry-dacpro"); diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c -index 2e56cc0a3bce..fe47ba7d4045 100644 +index b355d3d40f63..2feb27ca78aa 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -77,12 +77,14 @@ struct clk_core { @@ -48980,7 +49009,7 @@ index 2e56cc0a3bce..fe47ba7d4045 100644 /*** runtime pm ***/ static int clk_pm_runtime_get(struct clk_core *core) { -@@ -1326,6 +1334,8 @@ static int clk_core_determine_round_nolock(struct clk_core *core, +@@ -1325,6 +1333,8 @@ static int clk_core_determine_round_nolock(struct clk_core *core, if (!core) return 0; @@ -48989,7 +49018,7 @@ index 2e56cc0a3bce..fe47ba7d4045 100644 /* * At this point, core protection will be disabled if * - if the provider is not protected at all -@@ -1431,10 +1441,14 @@ unsigned long clk_hw_round_rate(struct clk_hw *hw, unsigned long rate) +@@ -1430,10 +1440,14 @@ unsigned long clk_hw_round_rate(struct clk_hw *hw, unsigned long rate) { int ret; struct clk_rate_request req; @@ -49004,7 +49033,7 @@ index 2e56cc0a3bce..fe47ba7d4045 100644 ret = clk_core_round_rate_nolock(hw->core, &req); if (ret) return 0; -@@ -1455,6 +1469,7 @@ EXPORT_SYMBOL_GPL(clk_hw_round_rate); +@@ -1454,6 +1468,7 @@ EXPORT_SYMBOL_GPL(clk_hw_round_rate); long clk_round_rate(struct clk *clk, unsigned long rate) { struct clk_rate_request req; @@ -49012,7 +49041,7 @@ index 2e56cc0a3bce..fe47ba7d4045 100644 int ret; if (!clk) -@@ -1468,6 +1483,9 @@ long clk_round_rate(struct clk *clk, unsigned long rate) +@@ -1467,6 +1482,9 @@ long clk_round_rate(struct clk *clk, unsigned long rate) clk_core_get_boundaries(clk->core, &req.min_rate, &req.max_rate); req.rate = rate; @@ -49022,7 +49051,7 @@ index 2e56cc0a3bce..fe47ba7d4045 100644 ret = clk_core_round_rate_nolock(clk->core, &req); if (clk->exclusive_count) -@@ -1935,6 +1953,7 @@ static struct clk_core *clk_calc_new_rates(struct clk_core *core, +@@ -1934,6 +1952,7 @@ static struct clk_core *clk_calc_new_rates(struct clk_core *core, unsigned long new_rate; unsigned long min_rate; unsigned long max_rate; @@ -49030,7 +49059,7 @@ index 2e56cc0a3bce..fe47ba7d4045 100644 int p_index = 0; long ret; -@@ -1949,6 +1968,9 @@ static struct clk_core *clk_calc_new_rates(struct clk_core *core, +@@ -1948,6 +1967,9 @@ static struct clk_core *clk_calc_new_rates(struct clk_core *core, clk_core_get_boundaries(core, &min_rate, &max_rate); @@ -49040,7 +49069,7 @@ index 2e56cc0a3bce..fe47ba7d4045 100644 /* find the closest rate and parent clk/rate */ if (clk_core_can_round(core)) { struct clk_rate_request req; -@@ -2153,6 +2175,7 @@ static unsigned long clk_core_req_round_rate_nolock(struct clk_core *core, +@@ -2152,6 +2174,7 @@ static unsigned long clk_core_req_round_rate_nolock(struct clk_core *core, { int ret, cnt; struct clk_rate_request req; @@ -49048,7 +49077,7 @@ index 2e56cc0a3bce..fe47ba7d4045 100644 lockdep_assert_held(&prepare_lock); -@@ -2167,6 +2190,9 @@ static unsigned long clk_core_req_round_rate_nolock(struct clk_core *core, +@@ -2166,6 +2189,9 @@ static unsigned long clk_core_req_round_rate_nolock(struct clk_core *core, clk_core_get_boundaries(core, &req.min_rate, &req.max_rate); req.rate = req_rate; @@ -49058,7 +49087,7 @@ index 2e56cc0a3bce..fe47ba7d4045 100644 ret = clk_core_round_rate_nolock(core, &req); /* restore the protection */ -@@ -2260,6 +2286,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate) +@@ -2259,6 +2285,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate) ret = clk_core_set_rate_nolock(clk->core, rate); @@ -49068,7 +49097,7 @@ index 2e56cc0a3bce..fe47ba7d4045 100644 if (clk->exclusive_count) clk_core_rate_protect(clk->core); -@@ -2425,6 +2454,103 @@ int clk_set_max_rate(struct clk *clk, unsigned long rate) +@@ -2424,6 +2453,103 @@ int clk_set_max_rate(struct clk *clk, unsigned long rate) } EXPORT_SYMBOL_GPL(clk_set_max_rate); @@ -49172,7 +49201,7 @@ index 2e56cc0a3bce..fe47ba7d4045 100644 /** * clk_get_parent - return the parent of a clk * @clk: the clk whose parent gets returned -@@ -3875,6 +4001,7 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw) +@@ -3874,6 +4000,7 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw) goto fail_parents; INIT_HLIST_HEAD(&core->clks); @@ -49181,10 +49210,10 @@ index 2e56cc0a3bce..fe47ba7d4045 100644 /* * Don't call clk_hw_create_clk() here because that would pin the diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig -index 08013345d1f2..cdfb63c723f6 100644 +index 9cd7a7d86ca5..ea6ea555bb97 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig -@@ -652,6 +652,10 @@ config UNIPHIER_XDMAC +@@ -696,6 +696,10 @@ config UNIPHIER_XDMAC UniPhier platform. This DMA controller can transfer data from memory to memory, memory to peripheral and peripheral to memory. @@ -49196,7 +49225,7 @@ index 08013345d1f2..cdfb63c723f6 100644 tristate "APM X-Gene DMA support" depends on ARCH_XGENE || COMPILE_TEST diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile -index 948a8da05f8b..e543c69fa6b5 100644 +index 8928816a4f30..7c4e625709f9 100644 --- a/drivers/dma/Makefile +++ b/drivers/dma/Makefile @@ -21,6 +21,7 @@ obj-$(CONFIG_AT_XDMAC) += at_xdmac.o @@ -50625,7 +50654,7 @@ index 1d965c1252ca..849e63bb426d 100644 MODULE_AUTHOR("Eric Anholt "); MODULE_DESCRIPTION("Raspberry Pi firmware driver"); diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig -index c91355c89ec6..344405baf78e 100644 +index c9401840422a..f6bd6d10716b 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -193,6 +193,12 @@ config GPIO_BCM_XGS_IPROC @@ -50641,7 +50670,7 @@ index c91355c89ec6..344405baf78e 100644 config GPIO_BRCMSTB tristate "BRCMSTB GPIO support" default y if (ARCH_BRCMSTB || BMIPS_GENERIC) -@@ -487,6 +493,14 @@ config GPIO_PMIC_EIC_SPRD +@@ -488,6 +494,14 @@ config GPIO_PMIC_EIC_SPRD help Say yes here to support Spreadtrum PMIC EIC device. @@ -50656,7 +50685,7 @@ index c91355c89ec6..344405baf78e 100644 config GPIO_PXA bool "PXA GPIO support" depends on ARCH_PXA || ARCH_MMP || COMPILE_TEST -@@ -1178,6 +1192,15 @@ config HTC_EGPIO +@@ -1179,6 +1193,15 @@ config HTC_EGPIO several HTC phones. It provides basic support for input pins, output pins, and irqs. @@ -52322,10 +52351,10 @@ index 59d8affad343..2ab00355b37b 100644 "%s: tried to flag a GPIO set as output for IRQ\n", __func__); diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig -index ca868271f4c4..74872b157233 100644 +index af407d01e1c4..75bf087160bc 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig -@@ -392,6 +392,8 @@ source "drivers/gpu/drm/tidss/Kconfig" +@@ -394,6 +394,8 @@ source "drivers/gpu/drm/tidss/Kconfig" source "drivers/gpu/drm/xlnx/Kconfig" @@ -52335,19 +52364,19 @@ index ca868271f4c4..74872b157233 100644 menuconfig DRM_LEGACY diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile -index 81569009f884..78dd8e12525d 100644 +index e9dd6847c9fa..cc9a1da9402b 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile -@@ -124,3 +124,4 @@ obj-$(CONFIG_DRM_ASPEED_GFX) += aspeed/ +@@ -125,3 +125,4 @@ obj-$(CONFIG_DRM_ASPEED_GFX) += aspeed/ obj-$(CONFIG_DRM_MCDE) += mcde/ obj-$(CONFIG_DRM_TIDSS) += tidss/ obj-y += xlnx/ +obj-y += gud/ diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -index f069d0faba64..f45dd99cecc2 100644 +index 55ecc67592eb..c8fe42d1d17c 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -@@ -4993,7 +4993,6 @@ static void dm_disable_vblank(struct drm_crtc *crtc) +@@ -5026,7 +5026,6 @@ static void dm_disable_vblank(struct drm_crtc *crtc) static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = { .reset = dm_crtc_reset_state, .destroy = amdgpu_dm_crtc_destroy, @@ -52355,7 +52384,7 @@ index f069d0faba64..f45dd99cecc2 100644 .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip, .atomic_duplicate_state = dm_crtc_duplicate_state, -@@ -5477,25 +5476,6 @@ static int fill_hdr_info_packet(const struct drm_connector_state *state, +@@ -5510,25 +5509,6 @@ static int fill_hdr_info_packet(const struct drm_connector_state *state, return 0; } @@ -52381,7 +52410,7 @@ index f069d0faba64..f45dd99cecc2 100644 static int amdgpu_dm_connector_atomic_check(struct drm_connector *conn, struct drm_atomic_state *state) -@@ -5511,7 +5491,7 @@ amdgpu_dm_connector_atomic_check(struct drm_connector *conn, +@@ -5544,7 +5524,7 @@ amdgpu_dm_connector_atomic_check(struct drm_connector *conn, if (!crtc) return 0; @@ -52390,7 +52419,7 @@ index f069d0faba64..f45dd99cecc2 100644 struct dc_info_packet hdr_infopacket; ret = fill_hdr_info_packet(new_con_state, &hdr_infopacket); -@@ -5606,17 +5586,19 @@ static void dm_update_crtc_active_planes(struct drm_crtc *crtc, +@@ -5639,17 +5619,19 @@ static void dm_update_crtc_active_planes(struct drm_crtc *crtc, } static int dm_crtc_helper_atomic_check(struct drm_crtc *crtc, @@ -52414,7 +52443,7 @@ index f069d0faba64..f45dd99cecc2 100644 WARN_ON(1); return ret; } -@@ -5627,8 +5609,8 @@ static int dm_crtc_helper_atomic_check(struct drm_crtc *crtc, +@@ -5660,8 +5642,8 @@ static int dm_crtc_helper_atomic_check(struct drm_crtc *crtc, * planes are disabled, which is not supported by the hardware. And there is legacy * userspace which stops using the HW cursor altogether in response to the resulting EINVAL. */ @@ -52425,7 +52454,7 @@ index f069d0faba64..f45dd99cecc2 100644 return -EINVAL; /* In some use cases, like reset, no stream is attached */ -@@ -6530,9 +6512,7 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, +@@ -6563,9 +6545,7 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, if (connector_type == DRM_MODE_CONNECTOR_HDMIA || connector_type == DRM_MODE_CONNECTOR_DisplayPort || connector_type == DRM_MODE_CONNECTOR_eDP) { @@ -52436,7 +52465,7 @@ index f069d0faba64..f45dd99cecc2 100644 if (!aconnector->mst_port) drm_connector_attach_vrr_capable_property(&aconnector->base); -@@ -7782,7 +7762,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) +@@ -7815,7 +7795,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) dm_old_crtc_state->abm_level; hdr_changed = @@ -57431,7 +57460,7 @@ index 4b92c6341490..3f0c11fa60a5 100644 } diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c -index bf2c845ef3a2..0471e68dbabc 100644 +index b7b37082a9d7..860d3a784665 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -112,8 +112,6 @@ struct panel_simple { @@ -57726,7 +57755,7 @@ index 065604c5837d..41a2f8d3e992 100644 /* ----------------------------------------------------------------------------- diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -index 91568f166a8a..dd068ddc47c8 100644 +index af98bfcde518..64c7b17e3c90 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -693,7 +693,7 @@ static void rockchip_drm_set_win_enabled(struct drm_crtc *crtc, bool enabled) @@ -57786,7 +57815,7 @@ index 91568f166a8a..dd068ddc47c8 100644 struct drm_atomic_state *old_state = old_crtc_state->state; struct drm_plane_state *old_plane_state, *new_plane_state; struct vop *vop = to_vop(crtc); -@@ -1634,7 +1642,6 @@ static const struct drm_crtc_funcs vop_crtc_funcs = { +@@ -1637,7 +1645,6 @@ static const struct drm_crtc_funcs vop_crtc_funcs = { .disable_vblank = vop_crtc_disable_vblank, .set_crc_source = vop_crtc_set_crc_source, .verify_crc_source = vop_crtc_verify_crc_source, @@ -58538,7 +58567,7 @@ index d0163e18e9ca..8281a044834f 100644 vc4_gem.o \ vc4_hdmi.o \ diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c -index f4ccca922e44..f73d73425f08 100644 +index 79724fddfb4b..294105f1e012 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -279,19 +279,32 @@ static u32 vc4_crtc_get_fifo_full_level_bits(struct vc4_crtc *vc4_crtc, @@ -58584,7 +58613,7 @@ index f4ccca922e44..f73d73425f08 100644 return NULL; } -@@ -305,22 +318,29 @@ static void vc4_crtc_pixelvalve_reset(struct drm_crtc *crtc) +@@ -305,23 +318,29 @@ static void vc4_crtc_pixelvalve_reset(struct drm_crtc *crtc) CRTC_WRITE(PV_CONTROL, CRTC_READ(PV_CONTROL) | PV_CONTROL_FIFO_CLR); } @@ -58606,10 +58635,9 @@ index f4ccca922e44..f73d73425f08 100644 u32 pixel_rep = (mode->flags & DRM_MODE_FLAG_DBLCLK) ? 2 : 1; bool is_dsi = (vc4_encoder->type == VC4_ENCODER_TYPE_DSI0 || vc4_encoder->type == VC4_ENCODER_TYPE_DSI1); -- u32 format = is_dsi ? PV_CONTROL_FORMAT_DSIV_24 : PV_CONTROL_FORMAT_24; -+ bool is_dsi1 = vc4_encoder->type == VC4_ENCODER_TYPE_DSI1; + bool is_dsi1 = vc4_encoder->type == VC4_ENCODER_TYPE_DSI1; + bool is_vec = vc4_encoder->type == VC4_ENCODER_TYPE_VEC; -+ u32 format = is_dsi1 ? PV_CONTROL_FORMAT_DSIV_24 : PV_CONTROL_FORMAT_24; + u32 format = is_dsi1 ? PV_CONTROL_FORMAT_DSIV_24 : PV_CONTROL_FORMAT_24; u8 ppc = pv_data->pixels_per_clock; + + u16 vert_bp = mode->crtc_vtotal - mode->crtc_vsync_end; @@ -58619,20 +58647,9 @@ index f4ccca922e44..f73d73425f08 100644 bool debug_dump_regs = false; if (debug_dump_regs) { -@@ -344,48 +364,60 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc) - VC4_SET_FIELD(mode->hdisplay * pixel_rep / ppc, - PV_HORZB_HACTIVE)); +@@ -357,37 +376,59 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc) + VC4_SET_FIELD(mode->crtc_vdisplay, PV_VERTB_VACTIVE)); -- CRTC_WRITE(PV_VERTA, -- VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end, -- PV_VERTA_VBP) | -- VC4_SET_FIELD(mode->crtc_vsync_end - mode->crtc_vsync_start, -- PV_VERTA_VSYNC)); -- CRTC_WRITE(PV_VERTB, -- VC4_SET_FIELD(mode->crtc_vsync_start - mode->crtc_vdisplay, -- PV_VERTB_VFP) | -- VC4_SET_FIELD(mode->crtc_vdisplay, PV_VERTB_VACTIVE)); -- if (interlace) { + bool odd_field_first = false; + u32 field_delay = mode->htotal * pixel_rep / (2 * ppc); @@ -58655,7 +58672,7 @@ index f4ccca922e44..f73d73425f08 100644 + CRTC_WRITE(PV_VERTA_EVEN, - VC4_SET_FIELD(mode->crtc_vtotal - -- mode->crtc_vsync_end - 1, +- mode->crtc_vsync_end, - PV_VERTA_VBP) | - VC4_SET_FIELD(mode->crtc_vsync_end - - mode->crtc_vsync_start, @@ -58680,7 +58697,7 @@ index f4ccca922e44..f73d73425f08 100644 PV_VCONTROL_CONTINUOUS | (is_dsi ? PV_VCONTROL_DSI : 0) | PV_VCONTROL_INTERLACE | -- VC4_SET_FIELD(mode->htotal * pixel_rep / 2, +- VC4_SET_FIELD(mode->htotal * pixel_rep / (2 * ppc), - PV_VCONTROL_ODD_DELAY)); - CRTC_WRITE(PV_VSYNCD_EVEN, 0); + (odd_field_first @@ -58706,7 +58723,7 @@ index f4ccca922e44..f73d73425f08 100644 if (is_dsi) CRTC_WRITE(PV_HACT_ACT, mode->hdisplay * pixel_rep); -@@ -420,9 +452,11 @@ static void require_hvs_enabled(struct drm_device *dev) +@@ -422,9 +463,11 @@ static void require_hvs_enabled(struct drm_device *dev) SCALER_DISPCTRL_ENABLE); } @@ -58720,7 +58737,7 @@ index f4ccca922e44..f73d73425f08 100644 struct vc4_encoder *vc4_encoder = to_vc4_encoder(encoder); struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); struct drm_device *dev = crtc->dev; -@@ -452,21 +486,40 @@ static int vc4_crtc_disable(struct drm_crtc *crtc, unsigned int channel) +@@ -454,21 +497,40 @@ static int vc4_crtc_disable(struct drm_crtc *crtc, unsigned int channel) mdelay(20); if (vc4_encoder && vc4_encoder->post_crtc_disable) @@ -58763,7 +58780,7 @@ index f4ccca922e44..f73d73425f08 100644 int channel; if (!(of_device_is_compatible(vc4_crtc->pdev->dev.of_node, -@@ -485,21 +538,37 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc) +@@ -487,21 +549,37 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc) if (channel < 0) return 0; @@ -58804,7 +58821,7 @@ index f4ccca922e44..f73d73425f08 100644 /* * Make sure we issue a vblank event after disabling the CRTC if -@@ -516,13 +585,18 @@ static void vc4_crtc_atomic_disable(struct drm_crtc *crtc, +@@ -518,13 +596,18 @@ static void vc4_crtc_atomic_disable(struct drm_crtc *crtc, } static void vc4_crtc_atomic_enable(struct drm_crtc *crtc, @@ -58825,7 +58842,7 @@ index f4ccca922e44..f73d73425f08 100644 require_hvs_enabled(dev); /* Enable vblank irq handling before crtc is started otherwise -@@ -530,17 +604,17 @@ static void vc4_crtc_atomic_enable(struct drm_crtc *crtc, +@@ -532,17 +615,17 @@ static void vc4_crtc_atomic_enable(struct drm_crtc *crtc, */ drm_crtc_vblank_on(crtc); @@ -58847,7 +58864,7 @@ index f4ccca922e44..f73d73425f08 100644 /* When feeding the transposer block the pixelvalve is unneeded and * should not be enabled. -@@ -549,7 +623,7 @@ static void vc4_crtc_atomic_enable(struct drm_crtc *crtc, +@@ -551,7 +634,7 @@ static void vc4_crtc_atomic_enable(struct drm_crtc *crtc, CRTC_READ(PV_V_CONTROL) | PV_VCONTROL_VIDEN); if (vc4_encoder->post_crtc_enable) @@ -58856,7 +58873,7 @@ index f4ccca922e44..f73d73425f08 100644 } static enum drm_mode_status vc4_crtc_mode_valid(struct drm_crtc *crtc, -@@ -597,18 +671,36 @@ void vc4_crtc_get_margins(struct drm_crtc_state *state, +@@ -599,18 +682,36 @@ void vc4_crtc_get_margins(struct drm_crtc_state *state, } static int vc4_crtc_atomic_check(struct drm_crtc *crtc, @@ -58896,7 +58913,7 @@ index f4ccca922e44..f73d73425f08 100644 if (conn_state->crtc != crtc) continue; -@@ -643,14 +735,14 @@ static void vc4_crtc_handle_page_flip(struct vc4_crtc *vc4_crtc) +@@ -645,14 +746,14 @@ static void vc4_crtc_handle_page_flip(struct vc4_crtc *vc4_crtc) struct drm_crtc *crtc = &vc4_crtc->base; struct drm_device *dev = crtc->dev; struct vc4_dev *vc4 = to_vc4_dev(dev); @@ -58915,7 +58932,7 @@ index f4ccca922e44..f73d73425f08 100644 drm_crtc_send_vblank_event(crtc, vc4_crtc->event); vc4_crtc->event = NULL; drm_crtc_vblank_put(crtc); -@@ -663,6 +755,7 @@ static void vc4_crtc_handle_page_flip(struct vc4_crtc *vc4_crtc) +@@ -665,6 +766,7 @@ static void vc4_crtc_handle_page_flip(struct vc4_crtc *vc4_crtc) */ vc4_hvs_unmask_underrun(dev, chan); } @@ -58923,7 +58940,7 @@ index f4ccca922e44..f73d73425f08 100644 spin_unlock_irqrestore(&dev->event_lock, flags); } -@@ -695,6 +788,7 @@ struct vc4_async_flip_state { +@@ -697,6 +799,7 @@ struct vc4_async_flip_state { struct drm_pending_vblank_event *event; struct vc4_seqno_cb cb; @@ -58931,7 +58948,7 @@ index f4ccca922e44..f73d73425f08 100644 }; /* Called when the V3D execution for the BO being flipped to is done, so that -@@ -743,6 +837,39 @@ vc4_async_page_flip_complete(struct vc4_seqno_cb *cb) +@@ -745,6 +848,39 @@ vc4_async_page_flip_complete(struct vc4_seqno_cb *cb) up(&vc4->async_modeset); } @@ -58971,7 +58988,7 @@ index f4ccca922e44..f73d73425f08 100644 /* Implements async (non-vblank-synced) page flips. * * The page flip ioctl needs to return immediately, so we grab the -@@ -813,8 +940,7 @@ static int vc4_async_page_flip(struct drm_crtc *crtc, +@@ -815,8 +951,7 @@ static int vc4_async_page_flip(struct drm_crtc *crtc, */ drm_atomic_set_fb_for_plane(plane->state, fb); @@ -58981,7 +58998,7 @@ index f4ccca922e44..f73d73425f08 100644 /* Driver takes ownership of state on successful async commit. */ return 0; -@@ -841,7 +967,6 @@ struct drm_crtc_state *vc4_crtc_duplicate_state(struct drm_crtc *crtc) +@@ -843,7 +978,6 @@ struct drm_crtc_state *vc4_crtc_duplicate_state(struct drm_crtc *crtc) return NULL; old_vc4_state = to_vc4_crtc_state(crtc->state); @@ -58989,7 +59006,7 @@ index f4ccca922e44..f73d73425f08 100644 vc4_state->margins = old_vc4_state->margins; vc4_state->assigned_channel = old_vc4_state->assigned_channel; -@@ -894,7 +1019,6 @@ static const struct drm_crtc_funcs vc4_crtc_funcs = { +@@ -896,7 +1030,6 @@ static const struct drm_crtc_funcs vc4_crtc_funcs = { .reset = vc4_crtc_reset, .atomic_duplicate_state = vc4_crtc_duplicate_state, .atomic_destroy_state = vc4_crtc_destroy_state, @@ -58997,7 +59014,7 @@ index f4ccca922e44..f73d73425f08 100644 .enable_vblank = vc4_enable_vblank, .disable_vblank = vc4_disable_vblank, .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp, -@@ -903,6 +1027,7 @@ static const struct drm_crtc_funcs vc4_crtc_funcs = { +@@ -905,6 +1038,7 @@ static const struct drm_crtc_funcs vc4_crtc_funcs = { static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = { .mode_valid = vc4_crtc_mode_valid, .atomic_check = vc4_crtc_atomic_check, @@ -59005,7 +59022,7 @@ index f4ccca922e44..f73d73425f08 100644 .atomic_flush = vc4_hvs_atomic_flush, .atomic_enable = vc4_crtc_atomic_enable, .atomic_disable = vc4_crtc_atomic_disable, -@@ -1077,25 +1202,43 @@ int vc4_crtc_init(struct drm_device *drm, struct vc4_crtc *vc4_crtc, +@@ -1079,25 +1213,43 @@ int vc4_crtc_init(struct drm_device *drm, struct vc4_crtc *vc4_crtc, return PTR_ERR(primary_plane); } @@ -59220,7 +59237,7 @@ index a90f2545baee..0d4fb6818d51 100644 DPI_WRITE(DPI_C, dpi_c); diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c -index 839610f8092a..dec3620bc7c5 100644 +index 52426bc8edb8..dec3620bc7c5 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -36,6 +36,8 @@ @@ -59232,20 +59249,22 @@ index 839610f8092a..dec3620bc7c5 100644 #include "uapi/drm/vc4_drm.h" #include "vc4_drv.h" -@@ -246,6 +248,28 @@ static void vc4_match_add_drivers(struct device *dev, +@@ -246,15 +248,28 @@ static void vc4_match_add_drivers(struct device *dev, } } +-static const struct of_device_id vc4_dma_range_matches[] = { +- { .compatible = "brcm,bcm2711-hvs" }, +const struct of_device_id vc4_dma_range_matches[] = { -+ { .compatible = "brcm,bcm2835-hvs" }, + { .compatible = "brcm,bcm2835-hvs" }, + { .compatible = "brcm,bcm2711-hvs" }, + { .compatible = "raspberrypi,rpi-firmware-kms" }, -+ { .compatible = "brcm,bcm2835-v3d" }, -+ { .compatible = "brcm,cygnus-v3d" }, -+ { .compatible = "brcm,vc4-v3d" }, -+ {} -+}; -+ + { .compatible = "brcm,bcm2835-v3d" }, + { .compatible = "brcm,cygnus-v3d" }, + { .compatible = "brcm,vc4-v3d" }, + {} + }; + +/* + * we need this helper function for determining presence of fkms + * before it's been bound @@ -59261,24 +59280,7 @@ index 839610f8092a..dec3620bc7c5 100644 static int vc4_drm_bind(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); -@@ -263,6 +287,16 @@ static int vc4_drm_bind(struct device *dev) - vc4_drm_driver.driver_features &= ~DRIVER_RENDER; - of_node_put(node); - -+ node = of_find_matching_node_and_match(NULL, vc4_dma_range_matches, -+ NULL); -+ if (node) { -+ ret = of_dma_configure(dev, node, true); -+ of_node_put(node); -+ -+ if (ret) -+ return ret; -+ } -+ - vc4 = devm_drm_dev_alloc(dev, &vc4_drm_driver, struct vc4_dev, base); - if (IS_ERR(vc4)) - return PTR_ERR(vc4); -@@ -285,22 +319,43 @@ static int vc4_drm_bind(struct device *dev) +@@ -304,22 +319,43 @@ static int vc4_drm_bind(struct device *dev) if (ret) return ret; @@ -59329,7 +59331,7 @@ index 839610f8092a..dec3620bc7c5 100644 ret = drm_dev_register(drm, 0); if (ret < 0) -@@ -330,14 +385,24 @@ static const struct component_master_ops vc4_drm_ops = { +@@ -349,14 +385,24 @@ static const struct component_master_ops vc4_drm_ops = { .unbind = vc4_drm_unbind, }; @@ -59356,7 +59358,7 @@ index 839610f8092a..dec3620bc7c5 100644 }; diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h -index 9809c3a856c6..dd34de6e677b 100644 +index 921463625d82..dd34de6e677b 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -19,6 +19,7 @@ @@ -59367,7 +59369,7 @@ index 9809c3a856c6..dd34de6e677b 100644 struct drm_device; struct drm_gem_object; -@@ -74,12 +75,16 @@ struct vc4_perfmon { +@@ -74,11 +75,16 @@ struct vc4_perfmon { struct vc4_dev { struct drm_device base; @@ -59378,14 +59380,13 @@ index 9809c3a856c6..dd34de6e677b 100644 struct vc4_hvs *hvs; struct vc4_v3d *v3d; struct vc4_dpi *dpi; -- struct vc4_dsi *dsi1; struct vc4_vec *vec; struct vc4_txp *txp; + struct vc4_fkms *fkms; struct vc4_hang_state *hang_state; -@@ -201,9 +206,6 @@ struct vc4_dev { +@@ -200,9 +206,6 @@ struct vc4_dev { int power_refcount; @@ -59395,7 +59396,7 @@ index 9809c3a856c6..dd34de6e677b 100644 /* Set to true when the load tracker is active. */ bool load_tracker_enabled; -@@ -325,6 +327,7 @@ struct vc4_hvs { +@@ -324,6 +327,7 @@ struct vc4_hvs { u32 __iomem *dlist; struct clk *core_clk; @@ -59403,7 +59404,7 @@ index 9809c3a856c6..dd34de6e677b 100644 /* Memory manager for CRTCs to allocate space in the display * list. Units are dwords. -@@ -444,12 +447,12 @@ struct vc4_encoder { +@@ -443,12 +447,12 @@ struct vc4_encoder { enum vc4_encoder_type type; u32 clock_select; @@ -59421,7 +59422,7 @@ index 9809c3a856c6..dd34de6e677b 100644 }; static inline struct vc4_encoder * -@@ -480,6 +483,17 @@ struct vc4_pv_data { +@@ -479,6 +483,17 @@ struct vc4_pv_data { }; @@ -59439,7 +59440,7 @@ index 9809c3a856c6..dd34de6e677b 100644 struct vc4_crtc { struct drm_crtc base; struct platform_device *pdev; -@@ -489,13 +503,50 @@ struct vc4_crtc { +@@ -488,13 +503,50 @@ struct vc4_crtc { /* Timestamp at start of vblank irq - unaffected by lock delays. */ ktime_t t_vblank; @@ -59493,7 +59494,7 @@ index 9809c3a856c6..dd34de6e677b 100644 }; static inline struct vc4_crtc * -@@ -518,11 +569,16 @@ vc4_crtc_to_vc4_pv_data(const struct vc4_crtc *crtc) +@@ -517,11 +569,16 @@ vc4_crtc_to_vc4_pv_data(const struct vc4_crtc *crtc) return container_of(data, struct vc4_pv_data, base); } @@ -59511,7 +59512,7 @@ index 9809c3a856c6..dd34de6e677b 100644 bool txp_armed; unsigned int assigned_channel; -@@ -533,6 +589,8 @@ struct vc4_crtc_state { +@@ -532,6 +589,8 @@ struct vc4_crtc_state { unsigned int bottom; } margins; @@ -59520,7 +59521,7 @@ index 9809c3a856c6..dd34de6e677b 100644 /* Transitional state below, only valid during atomic commits */ bool update_muxing; }; -@@ -877,6 +935,9 @@ extern struct platform_driver vc4_dsi_driver; +@@ -876,6 +935,9 @@ extern struct platform_driver vc4_dsi_driver; /* vc4_fence.c */ extern const struct dma_fence_ops vc4_fence_ops; @@ -59530,7 +59531,7 @@ index 9809c3a856c6..dd34de6e677b 100644 /* vc4_gem.c */ int vc4_gem_init(struct drm_device *dev); int vc4_submit_cl_ioctl(struct drm_device *dev, void *data, -@@ -917,10 +978,11 @@ void vc4_irq_reset(struct drm_device *dev); +@@ -916,10 +978,11 @@ void vc4_irq_reset(struct drm_device *dev); extern struct platform_driver vc4_hvs_driver; void vc4_hvs_stop_channel(struct drm_device *dev, unsigned int output); int vc4_hvs_get_fifo_from_output(struct drm_device *dev, unsigned int output); @@ -59547,63 +59548,10 @@ index 9809c3a856c6..dd34de6e677b 100644 void vc4_hvs_unmask_underrun(struct drm_device *dev, int channel); void vc4_hvs_mask_underrun(struct drm_device *dev, int channel); diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c -index ad84b56f4091..6e50e1d2eac8 100644 +index 0bda40c2d787..6e50e1d2eac8 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c -@@ -181,8 +181,50 @@ - - #define DSI0_TXPKT_PIX_FIFO 0x20 /* AKA PIX_FIFO */ - --#define DSI0_INT_STAT 0x24 --#define DSI0_INT_EN 0x28 -+#define DSI0_INT_STAT 0x24 -+#define DSI0_INT_EN 0x28 -+# define DSI0_INT_FIFO_ERR BIT(25) -+# define DSI0_INT_CMDC_DONE_MASK VC4_MASK(24, 23) -+# define DSI0_INT_CMDC_DONE_SHIFT 23 -+# define DSI0_INT_CMDC_DONE_NO_REPEAT 1 -+# define DSI0_INT_CMDC_DONE_REPEAT 3 -+# define DSI0_INT_PHY_DIR_RTF BIT(22) -+# define DSI0_INT_PHY_D1_ULPS BIT(21) -+# define DSI0_INT_PHY_D1_STOP BIT(20) -+# define DSI0_INT_PHY_RXLPDT BIT(19) -+# define DSI0_INT_PHY_RXTRIG BIT(18) -+# define DSI0_INT_PHY_D0_ULPS BIT(17) -+# define DSI0_INT_PHY_D0_LPDT BIT(16) -+# define DSI0_INT_PHY_D0_FTR BIT(15) -+# define DSI0_INT_PHY_D0_STOP BIT(14) -+/* Signaled when the clock lane enters the given state. */ -+# define DSI0_INT_PHY_CLK_ULPS BIT(13) -+# define DSI0_INT_PHY_CLK_HS BIT(12) -+# define DSI0_INT_PHY_CLK_FTR BIT(11) -+/* Signaled on timeouts */ -+# define DSI0_INT_PR_TO BIT(10) -+# define DSI0_INT_TA_TO BIT(9) -+# define DSI0_INT_LPRX_TO BIT(8) -+# define DSI0_INT_HSTX_TO BIT(7) -+/* Contention on a line when trying to drive the line low */ -+# define DSI0_INT_ERR_CONT_LP1 BIT(6) -+# define DSI0_INT_ERR_CONT_LP0 BIT(5) -+/* Control error: incorrect line state sequence on data lane 0. */ -+# define DSI0_INT_ERR_CONTROL BIT(4) -+# define DSI0_INT_ERR_SYNC_ESC BIT(3) -+# define DSI0_INT_RX2_PKT BIT(2) -+# define DSI0_INT_RX1_PKT BIT(1) -+# define DSI0_INT_CMD_PKT BIT(0) -+ -+#define DSI0_INTERRUPTS_ALWAYS_ENABLED (DSI0_INT_ERR_SYNC_ESC | \ -+ DSI0_INT_ERR_CONTROL | \ -+ DSI0_INT_ERR_CONT_LP0 | \ -+ DSI0_INT_ERR_CONT_LP1 | \ -+ DSI0_INT_HSTX_TO | \ -+ DSI0_INT_LPRX_TO | \ -+ DSI0_INT_TA_TO | \ -+ DSI0_INT_PR_TO) -+ - # define DSI1_INT_PHY_D3_ULPS BIT(30) - # define DSI1_INT_PHY_D3_STOP BIT(29) - # define DSI1_INT_PHY_D2_ULPS BIT(28) -@@ -306,11 +348,11 @@ +@@ -348,11 +348,11 @@ # define DSI0_PHY_AFEC0_RESET BIT(11) # define DSI1_PHY_AFEC0_PD_BG BIT(11) # define DSI0_PHY_AFEC0_PD BIT(10) @@ -59617,187 +59565,16 @@ index ad84b56f4091..6e50e1d2eac8 100644 # define DSI_PHY_AFEC0_PTATADJ_MASK VC4_MASK(7, 4) # define DSI_PHY_AFEC0_PTATADJ_SHIFT 4 # define DSI_PHY_AFEC0_CTATADJ_MASK VC4_MASK(3, 0) -@@ -493,6 +535,18 @@ - */ - #define DSI1_ID 0x8c - -+struct vc4_dsi_variant { -+ /* Whether we're on bcm2835's DSI0 or DSI1. */ -+ unsigned int port; -+ -+ bool broken_axi_workaround; -+ -+ const char *debugfs_name; -+ const struct debugfs_reg32 *regs; -+ size_t nregs; -+ -+}; -+ - /* General DSI hardware state. */ - struct vc4_dsi { - struct platform_device *pdev; -@@ -509,8 +563,7 @@ struct vc4_dsi { - u32 *reg_dma_mem; - dma_addr_t reg_paddr; - -- /* Whether we're on bcm2835's DSI0 or DSI1. */ -- int port; -+ const struct vc4_dsi_variant *variant; - - /* DSI channel for the panel we're connected to. */ - u32 channel; -@@ -586,10 +639,10 @@ dsi_dma_workaround_write(struct vc4_dsi *dsi, u32 offset, u32 val) - #define DSI_READ(offset) readl(dsi->regs + (offset)) - #define DSI_WRITE(offset, val) dsi_dma_workaround_write(dsi, offset, val) - #define DSI_PORT_READ(offset) \ -- DSI_READ(dsi->port ? DSI1_##offset : DSI0_##offset) -+ DSI_READ(dsi->variant->port ? DSI1_##offset : DSI0_##offset) - #define DSI_PORT_WRITE(offset, val) \ -- DSI_WRITE(dsi->port ? DSI1_##offset : DSI0_##offset, val) --#define DSI_PORT_BIT(bit) (dsi->port ? DSI1_##bit : DSI0_##bit) -+ DSI_WRITE(dsi->variant->port ? DSI1_##offset : DSI0_##offset, val) -+#define DSI_PORT_BIT(bit) (dsi->variant->port ? DSI1_##bit : DSI0_##bit) - - /* VC4 DSI encoder KMS struct */ - struct vc4_dsi_encoder { -@@ -750,6 +803,9 @@ static void vc4_dsi_encoder_disable(struct drm_encoder *encoder) - list_for_each_entry_reverse(iter, &dsi->bridge_chain, chain_node) { - if (iter->funcs->disable) - iter->funcs->disable(iter); -+ -+ if (iter == dsi->bridge) -+ break; - } - - vc4_dsi_ulps(dsi, true); -@@ -794,11 +850,9 @@ static bool vc4_dsi_encoder_mode_fixup(struct drm_encoder *encoder, +@@ -850,7 +850,7 @@ static bool vc4_dsi_encoder_mode_fixup(struct drm_encoder *encoder, /* Find what divider gets us a faster clock than the requested * pixel clock. */ -- for (divider = 1; divider < 8; divider++) { -- if (parent_rate / divider < pll_clock) { -- divider--; +- for (divider = 1; divider < 255; divider++) { + for (divider = 1; divider < 7; divider++) { -+ if (parent_rate / (divider + 1) < pll_clock) + if (parent_rate / (divider + 1) < pll_clock) break; -- } } - - /* Now that we've picked a PLL divider, calculate back to its -@@ -837,7 +891,7 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *encoder) - - ret = pm_runtime_resume_and_get(dev); - if (ret) { -- DRM_ERROR("Failed to runtime PM enable on DSI%d\n", dsi->port); -+ DRM_ERROR("Failed to runtime PM enable on DSI%d\n", dsi->variant->port); - return; - } - -@@ -871,7 +925,7 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *encoder) - DSI_PORT_WRITE(STAT, DSI_PORT_READ(STAT)); - - /* Set AFE CTR00/CTR1 to release powerdown of analog. */ -- if (dsi->port == 0) { -+ if (dsi->variant->port == 0) { - u32 afec0 = (VC4_SET_FIELD(7, DSI_PHY_AFEC0_PTATADJ) | - VC4_SET_FIELD(7, DSI_PHY_AFEC0_CTATADJ)); - -@@ -883,6 +937,9 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *encoder) - - DSI_PORT_WRITE(PHY_AFEC0, afec0); - -+ /* AFEC reset hold time */ -+ mdelay(1); -+ - DSI_PORT_WRITE(PHY_AFEC1, - VC4_SET_FIELD(6, DSI0_PHY_AFEC1_IDR_DLANE1) | - VC4_SET_FIELD(6, DSI0_PHY_AFEC1_IDR_DLANE0) | -@@ -1017,7 +1074,7 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *encoder) - DSI_PORT_BIT(PHYC_CLANE_ENABLE) | - ((dsi->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) ? - 0 : DSI_PORT_BIT(PHYC_HS_CLK_CONTINUOUS)) | -- (dsi->port == 0 ? -+ (dsi->variant->port == 0 ? - VC4_SET_FIELD(lpx - 1, DSI0_PHYC_ESC_CLK_LPDT) : - VC4_SET_FIELD(lpx - 1, DSI1_PHYC_ESC_CLK_LPDT))); - -@@ -1043,18 +1100,15 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *encoder) - DSI_DISP1_ENABLE); - - /* Ungate the block. */ -- if (dsi->port == 0) -+ if (dsi->variant->port == 0) - DSI_PORT_WRITE(CTRL, DSI_PORT_READ(CTRL) | DSI0_CTRL_CTRL0); - else - DSI_PORT_WRITE(CTRL, DSI_PORT_READ(CTRL) | DSI1_CTRL_EN); - - /* Bring AFE out of reset. */ -- if (dsi->port == 0) { -- } else { -- DSI_PORT_WRITE(PHY_AFEC0, -- DSI_PORT_READ(PHY_AFEC0) & -- ~DSI1_PHY_AFEC0_RESET); -- } -+ DSI_PORT_WRITE(PHY_AFEC0, -+ DSI_PORT_READ(PHY_AFEC0) & -+ ~DSI_PORT_BIT(PHY_AFEC0_RESET)); - - vc4_dsi_ulps(dsi, false); - -@@ -1173,13 +1227,28 @@ static ssize_t vc4_dsi_host_transfer(struct mipi_dsi_host *host, - /* Enable the appropriate interrupt for the transfer completion. */ - dsi->xfer_result = 0; - reinit_completion(&dsi->xfer_completion); -- DSI_PORT_WRITE(INT_STAT, DSI1_INT_TXPKT1_DONE | DSI1_INT_PHY_DIR_RTF); -- if (msg->rx_len) { -- DSI_PORT_WRITE(INT_EN, (DSI1_INTERRUPTS_ALWAYS_ENABLED | -- DSI1_INT_PHY_DIR_RTF)); -+ if (dsi->variant->port == 0) { -+ DSI_PORT_WRITE(INT_STAT, -+ DSI0_INT_CMDC_DONE_MASK | DSI1_INT_PHY_DIR_RTF); -+ if (msg->rx_len) { -+ DSI_PORT_WRITE(INT_EN, (DSI0_INTERRUPTS_ALWAYS_ENABLED | -+ DSI0_INT_PHY_DIR_RTF)); -+ } else { -+ DSI_PORT_WRITE(INT_EN, -+ (DSI0_INTERRUPTS_ALWAYS_ENABLED | -+ VC4_SET_FIELD(DSI0_INT_CMDC_DONE_NO_REPEAT, -+ DSI0_INT_CMDC_DONE))); -+ } - } else { -- DSI_PORT_WRITE(INT_EN, (DSI1_INTERRUPTS_ALWAYS_ENABLED | -- DSI1_INT_TXPKT1_DONE)); -+ DSI_PORT_WRITE(INT_STAT, -+ DSI1_INT_TXPKT1_DONE | DSI1_INT_PHY_DIR_RTF); -+ if (msg->rx_len) { -+ DSI_PORT_WRITE(INT_EN, (DSI1_INTERRUPTS_ALWAYS_ENABLED | -+ DSI1_INT_PHY_DIR_RTF)); -+ } else { -+ DSI_PORT_WRITE(INT_EN, (DSI1_INTERRUPTS_ALWAYS_ENABLED | -+ DSI1_INT_TXPKT1_DONE)); -+ } - } - - /* Send the packet. */ -@@ -1196,7 +1265,7 @@ static ssize_t vc4_dsi_host_transfer(struct mipi_dsi_host *host, - ret = dsi->xfer_result; - } - -- DSI_PORT_WRITE(INT_EN, DSI1_INTERRUPTS_ALWAYS_ENABLED); -+ DSI_PORT_WRITE(INT_EN, DSI_PORT_BIT(INTERRUPTS_ALWAYS_ENABLED)); - - if (ret) - goto reset_fifo_and_return; -@@ -1242,7 +1311,7 @@ static ssize_t vc4_dsi_host_transfer(struct mipi_dsi_host *host, - DSI_PORT_BIT(CTRL_RESET_FIFOS)); - - DSI_PORT_WRITE(TXPKT1C, 0); -- DSI_PORT_WRITE(INT_EN, DSI1_INTERRUPTS_ALWAYS_ENABLED); -+ DSI_PORT_WRITE(INT_EN, DSI_PORT_BIT(INTERRUPTS_ALWAYS_ENABLED)); - return ret; - } - -@@ -1305,8 +1374,32 @@ static const struct drm_encoder_helper_funcs vc4_dsi_encoder_helper_funcs = { +@@ -1374,6 +1374,20 @@ static const struct drm_encoder_helper_funcs vc4_dsi_encoder_helper_funcs = { .mode_fixup = vc4_dsi_encoder_mode_fixup, }; @@ -59815,156 +59592,19 @@ index ad84b56f4091..6e50e1d2eac8 100644 + .nregs = ARRAY_SIZE(dsi0_regs), +}; + -+static const struct vc4_dsi_variant bcm2835_dsi1_variant = { -+ .port = 1, -+ .broken_axi_workaround = true, -+ .debugfs_name = "dsi1_regs", -+ .regs = dsi1_regs, -+ .nregs = ARRAY_SIZE(dsi1_regs), -+}; -+ - static const struct of_device_id vc4_dsi_dt_match[] = { -- { .compatible = "brcm,bcm2835-dsi1", (void *)(uintptr_t)1 }, -+ { .compatible = "brcm,bcm2711-dsi1", &bcm2711_dsi1_variant }, -+ { .compatible = "brcm,bcm2835-dsi0", &bcm2835_dsi0_variant }, -+ { .compatible = "brcm,bcm2835-dsi1", &bcm2835_dsi1_variant }, - {} + static const struct vc4_dsi_variant bcm2835_dsi1_variant = { + .port = 1, + .broken_axi_workaround = true, +@@ -1383,6 +1397,8 @@ static const struct vc4_dsi_variant bcm2835_dsi1_variant = { }; -@@ -1317,7 +1410,7 @@ static void dsi_handle_error(struct vc4_dsi *dsi, - if (!(stat & bit)) - return; - -- DRM_ERROR("DSI%d: %s error\n", dsi->port, type); -+ DRM_ERROR("DSI%d: %s error\n", dsi->variant->port, type); - *ret = IRQ_HANDLED; - } - -@@ -1351,26 +1444,28 @@ static irqreturn_t vc4_dsi_irq_handler(int irq, void *data) - DSI_PORT_WRITE(INT_STAT, stat); - - dsi_handle_error(dsi, &ret, stat, -- DSI1_INT_ERR_SYNC_ESC, "LPDT sync"); -+ DSI_PORT_BIT(INT_ERR_SYNC_ESC), "LPDT sync"); - dsi_handle_error(dsi, &ret, stat, -- DSI1_INT_ERR_CONTROL, "data lane 0 sequence"); -+ DSI_PORT_BIT(INT_ERR_CONTROL), "data lane 0 sequence"); - dsi_handle_error(dsi, &ret, stat, -- DSI1_INT_ERR_CONT_LP0, "LP0 contention"); -+ DSI_PORT_BIT(INT_ERR_CONT_LP0), "LP0 contention"); - dsi_handle_error(dsi, &ret, stat, -- DSI1_INT_ERR_CONT_LP1, "LP1 contention"); -+ DSI_PORT_BIT(INT_ERR_CONT_LP1), "LP1 contention"); - dsi_handle_error(dsi, &ret, stat, -- DSI1_INT_HSTX_TO, "HSTX timeout"); -+ DSI_PORT_BIT(INT_HSTX_TO), "HSTX timeout"); - dsi_handle_error(dsi, &ret, stat, -- DSI1_INT_LPRX_TO, "LPRX timeout"); -+ DSI_PORT_BIT(INT_LPRX_TO), "LPRX timeout"); - dsi_handle_error(dsi, &ret, stat, -- DSI1_INT_TA_TO, "turnaround timeout"); -+ DSI_PORT_BIT(INT_TA_TO), "turnaround timeout"); - dsi_handle_error(dsi, &ret, stat, -- DSI1_INT_PR_TO, "peripheral reset timeout"); -+ DSI_PORT_BIT(INT_PR_TO), "peripheral reset timeout"); - -- if (stat & (DSI1_INT_TXPKT1_DONE | DSI1_INT_PHY_DIR_RTF)) { -+ if (stat & ((dsi->variant->port ? DSI1_INT_TXPKT1_DONE : -+ DSI0_INT_CMDC_DONE_MASK) | -+ DSI_PORT_BIT(INT_PHY_DIR_RTF))) { - complete(&dsi->xfer_completion); - ret = IRQ_HANDLED; -- } else if (stat & DSI1_INT_HSTX_TO) { -+ } else if (stat & DSI_PORT_BIT(INT_HSTX_TO)) { - complete(&dsi->xfer_completion); - dsi->xfer_result = -ETIMEDOUT; - ret = IRQ_HANDLED; -@@ -1390,12 +1485,12 @@ vc4_dsi_init_phy_clocks(struct vc4_dsi *dsi) - struct device *dev = &dsi->pdev->dev; - const char *parent_name = __clk_get_name(dsi->pll_phy_clock); - static const struct { -- const char *dsi0_name, *dsi1_name; -+ const char *name; - int div; - } phy_clocks[] = { -- { "dsi0_byte", "dsi1_byte", 8 }, -- { "dsi0_ddr2", "dsi1_ddr2", 4 }, -- { "dsi0_ddr", "dsi1_ddr", 2 }, -+ { "byte", 8 }, -+ { "ddr2", 4 }, -+ { "ddr", 2 }, - }; - int i; - -@@ -1411,8 +1506,12 @@ vc4_dsi_init_phy_clocks(struct vc4_dsi *dsi) - for (i = 0; i < ARRAY_SIZE(phy_clocks); i++) { - struct clk_fixed_factor *fix = &dsi->phy_clocks[i]; - struct clk_init_data init; -+ char clk_name[16]; - int ret; - -+ snprintf(clk_name, sizeof(clk_name), -+ "dsi%u_%s", dsi->variant->port, phy_clocks[i].name); -+ - /* We just use core fixed factor clock ops for the PHY - * clocks. The clocks are actually gated by the - * PHY_AFEC0_DDRCLK_EN bits, which we should be -@@ -1429,10 +1528,7 @@ vc4_dsi_init_phy_clocks(struct vc4_dsi *dsi) - memset(&init, 0, sizeof(init)); - init.parent_names = &parent_name; - init.num_parents = 1; -- if (dsi->port == 1) -- init.name = phy_clocks[i].dsi1_name; -- else -- init.name = phy_clocks[i].dsi0_name; -+ init.name = clk_name; - init.ops = &clk_fixed_factor_ops; - - ret = devm_clk_hw_register(dev, &fix->hw); -@@ -1451,7 +1547,6 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) - { - struct platform_device *pdev = to_platform_device(dev); - struct drm_device *drm = dev_get_drvdata(master); -- struct vc4_dev *vc4 = to_vc4_dev(drm); - struct vc4_dsi *dsi = dev_get_drvdata(dev); - struct vc4_dsi_encoder *vc4_dsi_encoder; - struct drm_panel *panel; -@@ -1463,7 +1558,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) - if (!match) - return -ENODEV; - -- dsi->port = (uintptr_t)match->data; -+ dsi->variant = match->data; - - vc4_dsi_encoder = devm_kzalloc(dev, sizeof(*vc4_dsi_encoder), - GFP_KERNEL); -@@ -1471,7 +1566,8 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) - return -ENOMEM; - - INIT_LIST_HEAD(&dsi->bridge_chain); -- vc4_dsi_encoder->base.type = VC4_ENCODER_TYPE_DSI1; -+ vc4_dsi_encoder->base.type = dsi->variant->port ? -+ VC4_ENCODER_TYPE_DSI1 : VC4_ENCODER_TYPE_DSI0; - vc4_dsi_encoder->dsi = dsi; - dsi->encoder = &vc4_dsi_encoder->base.base; - -@@ -1480,13 +1576,8 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) - return PTR_ERR(dsi->regs); - - dsi->regset.base = dsi->regs; -- if (dsi->port == 0) { -- dsi->regset.regs = dsi0_regs; -- dsi->regset.nregs = ARRAY_SIZE(dsi0_regs); -- } else { -- dsi->regset.regs = dsi1_regs; -- dsi->regset.nregs = ARRAY_SIZE(dsi1_regs); -- } -+ dsi->regset.regs = dsi->variant->regs; -+ dsi->regset.nregs = dsi->variant->nregs; - - if (DSI_PORT_READ(ID) != DSI_ID_VALUE) { - dev_err(dev, "Port returned 0x%08x for ID instead of 0x%08x\n", -@@ -1494,11 +1585,11 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) + static const struct of_device_id vc4_dsi_dt_match[] = { ++ { .compatible = "brcm,bcm2711-dsi1", &bcm2711_dsi1_variant }, ++ { .compatible = "brcm,bcm2835-dsi0", &bcm2835_dsi0_variant }, + { .compatible = "brcm,bcm2835-dsi1", &bcm2835_dsi1_variant }, + {} + }; +@@ -1569,8 +1585,8 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) return -ENODEV; } @@ -59974,12 +59614,8 @@ index ad84b56f4091..6e50e1d2eac8 100644 + * writes from the ARM. It does handle writes from the DMA engine, * so set up a channel for talking to it. */ -- if (dsi->port == 1) { -+ if (dsi->variant->broken_axi_workaround) { - dsi->reg_dma_mem = dma_alloc_coherent(dev, 4, - &dsi->reg_dma_paddr, - GFP_KERNEL); -@@ -1515,7 +1606,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) + if (dsi->variant->broken_axi_workaround) { +@@ -1590,7 +1606,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) if (ret != -EPROBE_DEFER) DRM_ERROR("Failed to get DMA channel: %d\n", ret); @@ -59988,7 +59624,7 @@ index ad84b56f4091..6e50e1d2eac8 100644 } /* Get the physical address of the device's registers. The -@@ -1544,7 +1635,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) +@@ -1619,7 +1635,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) if (ret) { if (ret != -EPROBE_DEFER) dev_err(dev, "Failed to get interrupt: %d\n", ret); @@ -59997,7 +59633,7 @@ index ad84b56f4091..6e50e1d2eac8 100644 } dsi->escape_clock = devm_clk_get(dev, "escape"); -@@ -1552,7 +1643,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) +@@ -1627,7 +1643,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) ret = PTR_ERR(dsi->escape_clock); if (ret != -EPROBE_DEFER) dev_err(dev, "Failed to get escape clock: %d\n", ret); @@ -60006,7 +59642,7 @@ index ad84b56f4091..6e50e1d2eac8 100644 } dsi->pll_phy_clock = devm_clk_get(dev, "phy"); -@@ -1560,7 +1651,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) +@@ -1635,7 +1651,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) ret = PTR_ERR(dsi->pll_phy_clock); if (ret != -EPROBE_DEFER) dev_err(dev, "Failed to get phy clock: %d\n", ret); @@ -60015,7 +59651,7 @@ index ad84b56f4091..6e50e1d2eac8 100644 } dsi->pixel_clock = devm_clk_get(dev, "pixel"); -@@ -1568,7 +1659,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) +@@ -1643,7 +1659,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) ret = PTR_ERR(dsi->pixel_clock); if (ret != -EPROBE_DEFER) dev_err(dev, "Failed to get pixel clock: %d\n", ret); @@ -60024,7 +59660,7 @@ index ad84b56f4091..6e50e1d2eac8 100644 } ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, -@@ -1583,29 +1674,28 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) +@@ -1658,26 +1674,28 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) if (ret == -ENODEV) return 0; @@ -60054,14 +59690,11 @@ index ad84b56f4091..6e50e1d2eac8 100644 ret = vc4_dsi_init_phy_clocks(dsi); if (ret) - return ret; -- -- if (dsi->port == 1) -- vc4->dsi1 = dsi; + goto err_free_dma; drm_simple_encoder_init(drm, dsi->encoder, DRM_MODE_ENCODER_DSI); drm_encoder_helper_add(dsi->encoder, &vc4_dsi_encoder_helper_funcs); -@@ -1613,7 +1703,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) +@@ -1685,7 +1703,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) ret = drm_bridge_attach(dsi->encoder, dsi->bridge, NULL, 0); if (ret) { dev_err(dev, "bridge attach failed: %d\n", ret); @@ -60070,16 +59703,7 @@ index ad84b56f4091..6e50e1d2eac8 100644 } /* Disable the atomic helper calls into the bridge. We * manually call the bridge pre_enable / enable / etc. calls -@@ -1622,21 +1712,29 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) - */ - list_splice_init(&dsi->encoder->bridge_chain, &dsi->bridge_chain); - -- if (dsi->port == 0) -- vc4_debugfs_add_regset32(drm, "dsi0_regs", &dsi->regset); -- else -- vc4_debugfs_add_regset32(drm, "dsi1_regs", &dsi->regset); -+ vc4_debugfs_add_regset32(drm, dsi->variant->debugfs_name, &dsi->regset); - +@@ -1699,6 +1717,19 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) pm_runtime_enable(dev); return 0; @@ -60099,19 +59723,11 @@ index ad84b56f4091..6e50e1d2eac8 100644 } static void vc4_dsi_unbind(struct device *dev, struct device *master, - void *data) - { -- struct drm_device *drm = dev_get_drvdata(master); -- struct vc4_dev *vc4 = to_vc4_dev(drm); - struct vc4_dsi *dsi = dev_get_drvdata(dev); - - if (dsi->bridge) -@@ -1649,8 +1747,15 @@ static void vc4_dsi_unbind(struct device *dev, struct device *master, +@@ -1715,6 +1746,16 @@ static void vc4_dsi_unbind(struct device *dev, struct device *master, + */ list_splice_init(&dsi->bridge_chain, &dsi->encoder->bridge_chain); drm_encoder_cleanup(dsi->encoder); - -- if (dsi->port == 1) -- vc4->dsi1 = NULL; ++ + if (dsi->reg_dma_chan) { + dma_release_channel(dsi->reg_dma_chan); + dsi->reg_dma_chan = NULL; @@ -62144,10 +61760,10 @@ index b641252939d8..445d3bab89e0 100644 /* Scheduled when any job has been completed, this walks the list of diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c -index a308f2d05d17..f1e0e0064b09 100644 +index 08175c3dd374..b34667b9577e 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -35,6 +35,7 @@ +@@ -35,25 +35,39 @@ #include #include #include @@ -62155,7 +61771,11 @@ index a308f2d05d17..f1e0e0064b09 100644 #include #include #include -@@ -44,16 +45,27 @@ ++#include ++#include + #include + #include + #include #include #include #include @@ -62183,7 +61803,7 @@ index a308f2d05d17..f1e0e0064b09 100644 #define VC5_HDMI_HORZA_HFP_SHIFT 16 #define VC5_HDMI_HORZA_HFP_MASK VC4_MASK(28, 16) #define VC5_HDMI_HORZA_VPOS BIT(15) -@@ -76,12 +88,69 @@ +@@ -76,15 +90,74 @@ #define VC5_HDMI_VERTB_VSPO_SHIFT 16 #define VC5_HDMI_VERTB_VSPO_MASK VC4_MASK(29, 16) @@ -62209,7 +61829,12 @@ index a308f2d05d17..f1e0e0064b09 100644 #define HSM_MIN_CLOCK_FREQ 120000000 #define CEC_CLOCK_FREQ 40000 -#define VC4_HSM_MID_CLOCK 149985000 -+#define HDMI_14_MAX_TMDS_CLK (340 * 1000 * 1000) +- + #define HDMI_14_MAX_TMDS_CLK (340 * 1000 * 1000) + ++/* bit field to force hotplug detection. bit0 = HDMI0 */ ++static int force_hotplug = 0; ++module_param(force_hotplug, int, 0644); + +static const char * const output_format_str[] = { + [VC4_HDMI_OUTPUT_RGB] = "RGB", @@ -62239,8 +61864,8 @@ index a308f2d05d17..f1e0e0064b09 100644 + return clock > HDMI_14_MAX_TMDS_CLK; +} + -+static bool vc4_hdmi_is_full_range_rgb(struct vc4_hdmi *vc4_hdmi, -+ const struct drm_display_mode *mode) ++static bool vc4_hdmi_is_full_range(struct vc4_hdmi *vc4_hdmi, ++ const struct drm_display_mode *mode) +{ + struct vc4_hdmi_encoder *vc4_encoder = &vc4_hdmi->encoder; + @@ -62251,10 +61876,11 @@ index a308f2d05d17..f1e0e0064b09 100644 + return !vc4_encoder->hdmi_monitor || + drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_FULL; +} - ++ static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused) { -@@ -91,12 +160,22 @@ static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused) + struct drm_info_node *node = (struct drm_info_node *)m->private; +@@ -93,12 +166,22 @@ static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused) drm_print_regset32(&p, &vc4_hdmi->hdmi_regset); drm_print_regset32(&p, &vc4_hdmi->hd_regset); @@ -62277,7 +61903,7 @@ index a308f2d05d17..f1e0e0064b09 100644 HDMI_WRITE(HDMI_M_CTL, VC4_HD_M_SW_RST); udelay(1); HDMI_WRITE(HDMI_M_CTL, 0); -@@ -108,24 +187,36 @@ static void vc4_hdmi_reset(struct vc4_hdmi *vc4_hdmi) +@@ -110,24 +193,36 @@ static void vc4_hdmi_reset(struct vc4_hdmi *vc4_hdmi) VC4_HDMI_SW_RESET_FORMAT_DETECT); HDMI_WRITE(HDMI_SW_RESET_CONTROL, 0); @@ -62314,7 +61940,7 @@ index a308f2d05d17..f1e0e0064b09 100644 value = HDMI_READ(HDMI_CEC_CNTRL_1); value &= ~VC4_HDMI_CEC_DIV_CLK_CNT_MASK; -@@ -133,30 +224,37 @@ static void vc4_hdmi_cec_update_clk_div(struct vc4_hdmi *vc4_hdmi) +@@ -135,30 +230,39 @@ static void vc4_hdmi_cec_update_clk_div(struct vc4_hdmi *vc4_hdmi) * Set the clock divider: the hsm_clock rate and this divider * setting will give a 40 kHz CEC clock. */ @@ -62342,7 +61968,10 @@ index a308f2d05d17..f1e0e0064b09 100644 + WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev)); - if (vc4_hdmi->hpd_gpio) { +- if (vc4_hdmi->hpd_gpio) { ++ if (force_hotplug & BIT(vc4_hdmi->encoder.base.type - VC4_ENCODER_TYPE_HDMI0)) ++ connected = true; ++ else if (vc4_hdmi->hpd_gpio) { if (gpio_get_value_cansleep(vc4_hdmi->hpd_gpio) ^ vc4_hdmi->hpd_active_low) connected = true; @@ -62357,7 +61986,7 @@ index a308f2d05d17..f1e0e0064b09 100644 } if (connected) { -@@ -167,16 +265,25 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) +@@ -169,16 +273,25 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) cec_s_phys_addr_from_edid(vc4_hdmi->cec_adap, edid); vc4_hdmi->encoder.hdmi_monitor = drm_detect_hdmi_monitor(edid); kfree(edid); @@ -62386,7 +62015,7 @@ index a308f2d05d17..f1e0e0064b09 100644 } static void vc4_hdmi_connector_destroy(struct drm_connector *connector) -@@ -192,10 +299,14 @@ static int vc4_hdmi_connector_get_modes(struct drm_connector *connector) +@@ -194,10 +307,14 @@ static int vc4_hdmi_connector_get_modes(struct drm_connector *connector) int ret = 0; struct edid *edid; @@ -62403,7 +62032,7 @@ index a308f2d05d17..f1e0e0064b09 100644 vc4_encoder->hdmi_monitor = drm_detect_hdmi_monitor(edid); -@@ -203,28 +314,193 @@ static int vc4_hdmi_connector_get_modes(struct drm_connector *connector) +@@ -205,15 +322,152 @@ static int vc4_hdmi_connector_get_modes(struct drm_connector *connector) ret = drm_add_edid_modes(connector, edid); kfree(edid); @@ -62430,14 +62059,17 @@ index a308f2d05d17..f1e0e0064b09 100644 +{ + struct drm_connector_state *old_state = + drm_atomic_get_old_connector_state(state, connector); ++ struct vc4_hdmi_connector_state *old_vc4_state = conn_state_to_vc4_hdmi_conn_state(old_state); + struct drm_connector_state *new_state = + drm_atomic_get_new_connector_state(state, connector); ++ struct vc4_hdmi_connector_state *new_vc4_state = conn_state_to_vc4_hdmi_conn_state(new_state); + struct drm_crtc *crtc = new_state->crtc; + + if (!crtc) + return 0; + + if (old_state->colorspace != new_state->colorspace || ++ old_vc4_state->broadcast_rgb != new_vc4_state->broadcast_rgb || + !drm_connector_atomic_hdr_metadata_equal(old_state, new_state)) { + struct drm_crtc_state *crtc_state; + @@ -62517,8 +62149,9 @@ index a308f2d05d17..f1e0e0064b09 100644 + conn_state_to_vc4_hdmi_conn_state(connector->state); + struct vc4_hdmi_connector_state *new_state = + kzalloc(sizeof(*new_state), GFP_KERNEL); -+ -+ if (connector->state) + + if (connector->state) +- drm_atomic_helper_connector_tv_reset(connector); + __drm_atomic_helper_connector_destroy_state(connector->state); + + kfree(old_state); @@ -62530,9 +62163,9 @@ index a308f2d05d17..f1e0e0064b09 100644 + new_state->base.max_bpc = 8; + new_state->base.max_requested_bpc = 8; + new_state->output_format = VC4_HDMI_OUTPUT_RGB; - drm_atomic_helper_connector_tv_reset(connector); - } - ++ drm_atomic_helper_connector_tv_reset(connector); ++} ++ +static struct drm_connector_state * +vc4_hdmi_connector_duplicate_state(struct drm_connector *connector) +{ @@ -62551,10 +62184,10 @@ index a308f2d05d17..f1e0e0064b09 100644 + __drm_atomic_helper_connector_duplicate_state(connector, &new_state->base); + + return &new_state->base; -+} -+ + } + static const struct drm_connector_funcs vc4_hdmi_connector_funcs = { - .detect = vc4_hdmi_connector_detect, +@@ -221,14 +475,43 @@ static const struct drm_connector_funcs vc4_hdmi_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .destroy = vc4_hdmi_connector_destroy, .reset = vc4_hdmi_connector_reset, @@ -62568,14 +62201,14 @@ index a308f2d05d17..f1e0e0064b09 100644 static const struct drm_connector_helper_funcs vc4_hdmi_connector_helper_funcs = { .get_modes = vc4_hdmi_connector_get_modes, + .atomic_check = vc4_hdmi_connector_atomic_check, - }; - ++}; ++ +static const struct drm_prop_enum_list broadcast_rgb_names[] = { + { VC4_BROADCAST_RGB_AUTO, "Automatic" }, + { VC4_BROADCAST_RGB_FULL, "Full" }, + { VC4_BROADCAST_RGB_LIMITED, "Limited 16:235" }, -+}; -+ + }; + +static void +vc4_hdmi_attach_broadcast_rgb_property(struct drm_device *dev, + struct vc4_hdmi *vc4_hdmi) @@ -62599,7 +62232,7 @@ index a308f2d05d17..f1e0e0064b09 100644 static int vc4_hdmi_connector_init(struct drm_device *dev, struct vc4_hdmi *vc4_hdmi) { -@@ -238,18 +514,37 @@ static int vc4_hdmi_connector_init(struct drm_device *dev, +@@ -242,18 +525,37 @@ static int vc4_hdmi_connector_init(struct drm_device *dev, vc4_hdmi->ddc); drm_connector_helper_add(connector, &vc4_hdmi_connector_helper_funcs); @@ -62637,7 +62270,7 @@ index a308f2d05d17..f1e0e0064b09 100644 drm_connector_attach_encoder(connector, encoder); -@@ -257,13 +552,20 @@ static int vc4_hdmi_connector_init(struct drm_device *dev, +@@ -261,13 +563,20 @@ static int vc4_hdmi_connector_init(struct drm_device *dev, } static int vc4_hdmi_stop_packet(struct drm_encoder *encoder, @@ -62659,7 +62292,7 @@ index a308f2d05d17..f1e0e0064b09 100644 return wait_for(!(HDMI_READ(HDMI_RAM_PACKET_STATUS) & BIT(packet_id)), 100); -@@ -277,9 +579,12 @@ static void vc4_hdmi_write_infoframe(struct drm_encoder *encoder, +@@ -281,9 +590,12 @@ static void vc4_hdmi_write_infoframe(struct drm_encoder *encoder, const struct vc4_hdmi_register *ram_packet_start = &vc4_hdmi->variant->registers[HDMI_RAM_PACKET_START]; u32 packet_reg = ram_packet_start->offset + VC4_HDMI_PACKET_STRIDE * packet_id; @@ -62673,7 +62306,7 @@ index a308f2d05d17..f1e0e0064b09 100644 ssize_t len, i; int ret; -@@ -291,12 +596,14 @@ static void vc4_hdmi_write_infoframe(struct drm_encoder *encoder, +@@ -295,12 +607,14 @@ static void vc4_hdmi_write_infoframe(struct drm_encoder *encoder, if (len < 0) return; @@ -62689,7 +62322,7 @@ index a308f2d05d17..f1e0e0064b09 100644 for (i = 0; i < len; i += 7) { writel(buffer[i + 0] << 0 | buffer[i + 1] << 8 | -@@ -312,25 +619,62 @@ static void vc4_hdmi_write_infoframe(struct drm_encoder *encoder, +@@ -316,25 +630,62 @@ static void vc4_hdmi_write_infoframe(struct drm_encoder *encoder, packet_reg += 4; } @@ -62755,7 +62388,7 @@ index a308f2d05d17..f1e0e0064b09 100644 ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, connector, mode); if (ret < 0) { -@@ -340,10 +684,11 @@ static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder) +@@ -344,10 +695,11 @@ static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder) drm_hdmi_avi_infoframe_quant_range(&frame.avi, connector, mode, @@ -62763,7 +62396,7 @@ index a308f2d05d17..f1e0e0064b09 100644 - HDMI_QUANTIZATION_RANGE_LIMITED : - HDMI_QUANTIZATION_RANGE_FULL); - -+ vc4_hdmi_is_full_range_rgb(vc4_hdmi, mode) ? ++ vc4_hdmi_is_full_range(vc4_hdmi, mode) ? + HDMI_QUANTIZATION_RANGE_FULL : + HDMI_QUANTIZATION_RANGE_LIMITED); + drm_hdmi_avi_infoframe_colorimetry(&frame.avi, cstate); @@ -62771,7 +62404,7 @@ index a308f2d05d17..f1e0e0064b09 100644 drm_hdmi_avi_infoframe_bars(&frame.avi, cstate); vc4_hdmi_write_infoframe(encoder, &frame); -@@ -368,15 +713,30 @@ static void vc4_hdmi_set_spd_infoframe(struct drm_encoder *encoder) +@@ -372,15 +724,30 @@ static void vc4_hdmi_set_spd_infoframe(struct drm_encoder *encoder) static void vc4_hdmi_set_audio_infoframe(struct drm_encoder *encoder) { struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); @@ -62808,7 +62441,7 @@ index a308f2d05d17..f1e0e0064b09 100644 vc4_hdmi_write_infoframe(encoder, &frame); } -@@ -385,6 +745,8 @@ static void vc4_hdmi_set_infoframes(struct drm_encoder *encoder) +@@ -389,6 +756,8 @@ static void vc4_hdmi_set_infoframes(struct drm_encoder *encoder) { struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); @@ -62817,7 +62450,7 @@ index a308f2d05d17..f1e0e0064b09 100644 vc4_hdmi_set_avi_infoframe(encoder); vc4_hdmi_set_spd_infoframe(encoder); /* -@@ -393,52 +755,176 @@ static void vc4_hdmi_set_infoframes(struct drm_encoder *encoder) +@@ -397,52 +766,176 @@ static void vc4_hdmi_set_infoframes(struct drm_encoder *encoder) */ if (vc4_hdmi->audio.streaming) vc4_hdmi_set_audio_infoframe(encoder); @@ -62938,9 +62571,9 @@ index a308f2d05d17..f1e0e0064b09 100644 + HDMI_WRITE(HDMI_VID_CTL, HDMI_READ(HDMI_VID_CTL) | VC4_HD_VID_CTL_CLRRGB); + + spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); - -+ mdelay(1); + ++ mdelay(1); + + spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); HDMI_WRITE(HDMI_VID_CTL, - HDMI_READ(HDMI_VID_CTL) | VC4_HD_VID_CTL_BLANKPIX); @@ -63003,37 +62636,23 @@ index a308f2d05d17..f1e0e0064b09 100644 VC4_HD_CSC_CTL_ORDER); - if (enable) { -+ if (!vc4_hdmi_is_full_range_rgb(vc4_hdmi, mode)) { ++ if (!vc4_hdmi_is_full_range(vc4_hdmi, mode)) { /* CEA VICs other than #1 requre limited range RGB * output unless overridden by an AVI infoframe. * Apply a colorspace conversion to squash 0-255 down -@@ -464,49 +950,147 @@ static void vc4_hdmi_csc_setup(struct vc4_hdmi *vc4_hdmi, bool enable) +@@ -468,50 +961,242 @@ static void vc4_hdmi_csc_setup(struct vc4_hdmi *vc4_hdmi, bool enable) /* The RGB order applies even when CSC is disabled. */ HDMI_WRITE(HDMI_CSC_CTL, csc_ctl); -+ -+ spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); - } - +-} +- -static void vc5_hdmi_csc_setup(struct vc4_hdmi *vc4_hdmi, bool enable) -{ - u32 csc_ctl; - csc_ctl = 0x07; /* RGB_CONVERT_MODE = custom matrix, || USE_RGB_TO_YCBCR */ -+/* -+ * If we need to output Full Range RGB, then use the unity matrix -+ * -+ * [ 1 0 0 0] -+ * [ 0 1 0 0] -+ * [ 0 0 1 0] -+ * -+ * Matrix is signed 2p13 fixed point, with signed 9p6 offsets -+ */ -+static const u16 vc5_hdmi_csc_full_rgb_unity[3][4] = { -+ { 0x2000, 0x0000, 0x0000, 0x0000 }, -+ { 0x0000, 0x2000, 0x0000, 0x0000 }, -+ { 0x0000, 0x0000, 0x2000, 0x0000 }, -+}; ++ spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); ++} - if (enable) { - /* CEA VICs other than #1 requre limited range RGB @@ -63063,8 +62682,13 @@ index a308f2d05d17..f1e0e0064b09 100644 - HDMI_WRITE(HDMI_CSC_24_23, (0x0000 << 16) | 0x0000); - HDMI_WRITE(HDMI_CSC_32_31, (0x0000 << 16) | 0x0000); - HDMI_WRITE(HDMI_CSC_34_33, (0x0000 << 16) | 0x2000); -- } +/* ++ * If we need to output Full Range RGB, then use the unity matrix ++ * ++ * [ 1 0 0 0] ++ * [ 0 1 0 0] ++ * [ 0 0 1 0] ++ * + * CEA VICs other than #1 require limited range RGB output unless + * overridden by an AVI infoframe. Apply a colorspace conversion to + * squash 0-255 down to 16-235. The matrix here is: @@ -63075,46 +62699,110 @@ index a308f2d05d17..f1e0e0064b09 100644 + * + * Matrix is signed 2p13 fixed point, with signed 9p6 offsets + */ -+static const u16 vc5_hdmi_csc_full_rgb_to_limited_rgb[3][4] = { -+ { 0x1b80, 0x0000, 0x0000, 0x0400 }, -+ { 0x0000, 0x1b80, 0x0000, 0x0400 }, -+ { 0x0000, 0x0000, 0x1b80, 0x0400 }, ++static const u16 vc5_hdmi_csc_full_rgb_to_rgb[2][3][4] = { ++ { ++ /* Full range - unity */ ++ { 0x2000, 0x0000, 0x0000, 0x0000 }, ++ { 0x0000, 0x2000, 0x0000, 0x0000 }, ++ { 0x0000, 0x0000, 0x2000, 0x0000 }, ++ }, { ++ /* Limited range */ ++ { 0x1b80, 0x0000, 0x0000, 0x0400 }, ++ { 0x0000, 0x1b80, 0x0000, 0x0400 }, ++ { 0x0000, 0x0000, 0x1b80, 0x0400 }, + } +}; - HDMI_WRITE(HDMI_CSC_CTL, csc_ctl); -} +/* -+ * Conversion between Full Range RGB and Full Range YUV422 using the -+ * BT.709 Colorspace ++ * Conversion between Full Range RGB and YUV using the BT.601 Colorspace + * -+ * [ 0.212639 0.715169 0.072192 0 ] -+ * [ -0.117208 -0.394207 0.511416 128 ] -+ * [ 0.511416 -0.464524 -0.046891 128 ] ++ * Full range ++ * [ 0.299000 0.587000 0.114000 0.000000 ] ++ * [ -0.168736 -0.331264 0.500000 128.000000 ] ++ * [ 0.500000 -0.418688 -0.081312 128.000000 ] ++ * ++ * Limited range ++ * [ 0.255785 0.502160 0.097523 16.000000 ] ++ * [ -0.147644 -0.289856 0.437500 128.000000 ] ++ * [ 0.437500 -0.366352 -0.071148 128.000000 ] + * + * Matrix is signed 2p13 fixed point, with signed 9p6 offsets + */ -+static const u16 vc5_hdmi_csc_full_rgb_to_full_yuv422_bt709[3][4] = { -+ { 0x06ce, 0x16e3, 0x024f, 0x0000 }, -+ { 0xfc41, 0xf364, 0x105e, 0x2000 }, -+ { 0x105e, 0xf124, 0xfe81, 0x2000 }, ++static const u16 vc5_hdmi_csc_full_rgb_to_yuv_bt601[2][3][4] = { ++ { ++ /* Full range */ ++ { 0x0991, 0x12c9, 0x03a6, 0x0000 }, ++ { 0xfa9b, 0xf567, 0x1000, 0x2000 }, ++ { 0x1000, 0xf29b, 0xfd67, 0x2000 }, ++ }, { ++ /* Limited range */ ++ { 0x082f, 0x1012, 0x031f, 0x0400 }, ++ { 0xfb48, 0xf6ba, 0x0e00, 0x2000 }, ++ { 0x0e00, 0xf448, 0xfdba, 0x2000 }, ++ } +}; -static void vc4_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, - struct drm_display_mode *mode) +-{ +/* -+ * Conversion between Full Range RGB and Full Range YUV444 using the -+ * BT.709 Colorspace ++ * Conversion between Full Range RGB and YUV using the BT.709 Colorspace + * -+ * [ -0.117208 -0.394207 0.511416 128 ] -+ * [ 0.511416 -0.464524 -0.046891 128 ] -+ * [ 0.212639 0.715169 0.072192 0 ] ++ * Full range ++ * [ 0.212600 0.715200 0.072200 0.000000 ] ++ * [ -0.114572 -0.385428 0.500000 128.000000 ] ++ * [ 0.500000 -0.454153 -0.045847 128.000000 ] ++ * ++ * Limited range ++ * [ 0.181873 0.611831 0.061765 16.000000 ] ++ * [ -0.100251 -0.337249 0.437500 128.000000 ] ++ * [ 0.437500 -0.397384 -0.040116 128.000000 ] + * + * Matrix is signed 2p13 fixed point, with signed 9p6 offsets + */ -+static const u16 vc5_hdmi_csc_full_rgb_to_full_yuv444_bt709[3][4] = { -+ { 0xfc41, 0xf364, 0x105e, 0x2000 }, -+ { 0x105e, 0xf124, 0xfe81, 0x2000 }, -+ { 0x06ce, 0x16e3, 0x024f, 0x0000 }, ++static const u16 vc5_hdmi_csc_full_rgb_to_yuv_bt709[2][3][4] = { ++ { ++ /* Full range */ ++ { 0x06ce, 0x16e3, 0x024f, 0x0000 }, ++ { 0xfc56, 0xf3ac, 0x1000, 0x2000 }, ++ { 0x1000, 0xf179, 0xfe89, 0x2000 }, ++ }, { ++ /* Limited range */ ++ { 0x05d2, 0x1394, 0x01fa, 0x0400 }, ++ { 0xfccc, 0xf536, 0x0e00, 0x2000 }, ++ { 0x0e00, 0xf34a, 0xfeb8, 0x2000 }, ++ } ++}; ++ ++/* ++ * Conversion between Full Range RGB and YUV using the BT.2020 Colorspace ++ * ++ * Full range ++ * [ 0.262700 0.678000 0.059300 0.000000 ] ++ * [ -0.139630 -0.360370 0.500000 128.000000 ] ++ * [ 0.500000 -0.459786 -0.040214 128.000000 ] ++ * ++ * Limited range ++ * [ 0.224732 0.580008 0.050729 16.000000 ] ++ * [ -0.122176 -0.315324 0.437500 128.000000 ] ++ * [ 0.437500 -0.402312 -0.035188 128.000000 ] ++ * ++ * Matrix is signed 2p13 fixed point, with signed 9p6 offsets ++ */ ++static const u16 vc5_hdmi_csc_full_rgb_to_yuv_bt2020[2][3][4] = { ++ { ++ /* Full range */ ++ { 0x0868, 0x15b2, 0x01e6, 0x0000 }, ++ { 0xfb89, 0xf479, 0x1000, 0x2000 }, ++ { 0x1000, 0xf14a, 0xfeb8, 0x2000 }, ++ }, { ++ /* Limited range */ ++ { 0x0731, 0x128f, 0x01a0, 0x0400 }, ++ { 0xfc18, 0xf5ea, 0x0e00, 0x2000 }, ++ { 0x0e00, 0xf321, 0xfee1, 0x2000 }, ++ } +}; + +static void vc5_hdmi_set_csc_coeffs(struct vc4_hdmi *vc4_hdmi, @@ -63130,12 +62818,28 @@ index a308f2d05d17..f1e0e0064b09 100644 + HDMI_WRITE(HDMI_CSC_34_33, (coeffs[2][3] << 16) | coeffs[2][2]); +} + ++static void vc5_hdmi_set_csc_coeffs_swap(struct vc4_hdmi *vc4_hdmi, ++ const u16 coeffs[3][4]) ++{ ++ lockdep_assert_held(&vc4_hdmi->hw_lock); ++ ++ /* YUV444 needs the CSC matrices using the channels in a different order */ ++ HDMI_WRITE(HDMI_CSC_12_11, (coeffs[2][1] << 16) | coeffs[2][0]); ++ HDMI_WRITE(HDMI_CSC_14_13, (coeffs[2][3] << 16) | coeffs[2][2]); ++ HDMI_WRITE(HDMI_CSC_22_21, (coeffs[0][1] << 16) | coeffs[0][0]); ++ HDMI_WRITE(HDMI_CSC_24_23, (coeffs[0][3] << 16) | coeffs[0][2]); ++ HDMI_WRITE(HDMI_CSC_32_31, (coeffs[1][1] << 16) | coeffs[1][0]); ++ HDMI_WRITE(HDMI_CSC_34_33, (coeffs[1][3] << 16) | coeffs[1][2]); ++} ++ +static void vc5_hdmi_csc_setup(struct vc4_hdmi *vc4_hdmi, + struct drm_connector_state *state, + const struct drm_display_mode *mode) +{ + struct vc4_hdmi_connector_state *vc4_state = + conn_state_to_vc4_hdmi_conn_state(state); ++ unsigned int lim_range = vc4_hdmi_is_full_range(vc4_hdmi, mode) ? 0 : 1; ++ const u16 (*csc)[4]; + unsigned long flags; + u32 if_cfg = 0; + u32 if_xbar = 0x543210; @@ -63147,31 +62851,56 @@ index a308f2d05d17..f1e0e0064b09 100644 + + switch (vc4_state->output_format) { + case VC4_HDMI_OUTPUT_YUV444: -+ vc5_hdmi_set_csc_coeffs(vc4_hdmi, vc5_hdmi_csc_full_rgb_to_full_yuv444_bt709); -+ break; -+ + case VC4_HDMI_OUTPUT_YUV422: -+ csc_ctl |= VC4_SET_FIELD(VC5_MT_CP_CSC_CTL_FILTER_MODE_444_TO_422_STANDARD, -+ VC5_MT_CP_CSC_CTL_FILTER_MODE_444_TO_422) | -+ VC5_MT_CP_CSC_CTL_USE_444_TO_422 | -+ VC5_MT_CP_CSC_CTL_USE_RNG_SUPPRESSION; ++ switch (state->colorspace) { ++ default: ++ case DRM_MODE_COLORIMETRY_NO_DATA: ++ case DRM_MODE_COLORIMETRY_BT709_YCC: ++ case DRM_MODE_COLORIMETRY_XVYCC_709: ++ case DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED: ++ case DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT: ++ csc = vc5_hdmi_csc_full_rgb_to_yuv_bt709[lim_range]; ++ break; ++ case DRM_MODE_COLORIMETRY_SMPTE_170M_YCC: ++ case DRM_MODE_COLORIMETRY_XVYCC_601: ++ case DRM_MODE_COLORIMETRY_SYCC_601: ++ case DRM_MODE_COLORIMETRY_OPYCC_601: ++ case DRM_MODE_COLORIMETRY_BT601_YCC: ++ csc = vc5_hdmi_csc_full_rgb_to_yuv_bt601[lim_range]; ++ break; ++ case DRM_MODE_COLORIMETRY_BT2020_CYCC: ++ case DRM_MODE_COLORIMETRY_BT2020_YCC: ++ case DRM_MODE_COLORIMETRY_BT2020_RGB: ++ case DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65: ++ case DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER: ++ csc = vc5_hdmi_csc_full_rgb_to_yuv_bt2020[lim_range]; ++ break; ++ } + -+ csc_chan_ctl |= VC4_SET_FIELD(VC5_MT_CP_CHANNEL_CTL_OUTPUT_REMAP_LEGACY_STYLE, -+ VC5_MT_CP_CHANNEL_CTL_OUTPUT_REMAP); ++ if (vc4_state->output_format == VC4_HDMI_OUTPUT_YUV422) { ++ csc_ctl |= VC4_SET_FIELD(VC5_MT_CP_CSC_CTL_FILTER_MODE_444_TO_422_STANDARD, ++ VC5_MT_CP_CSC_CTL_FILTER_MODE_444_TO_422) | ++ VC5_MT_CP_CSC_CTL_USE_444_TO_422 | ++ VC5_MT_CP_CSC_CTL_USE_RNG_SUPPRESSION; + -+ if_cfg |= VC4_SET_FIELD(VC5_DVP_HT_VEC_INTERFACE_CFG_SEL_422_FORMAT_422_LEGACY, -+ VC5_DVP_HT_VEC_INTERFACE_CFG_SEL_422); ++ csc_chan_ctl |= VC4_SET_FIELD(VC5_MT_CP_CHANNEL_CTL_OUTPUT_REMAP_LEGACY_STYLE, ++ VC5_MT_CP_CHANNEL_CTL_OUTPUT_REMAP); ++ ++ if_cfg |= VC4_SET_FIELD(VC5_DVP_HT_VEC_INTERFACE_CFG_SEL_422_FORMAT_422_LEGACY, ++ VC5_DVP_HT_VEC_INTERFACE_CFG_SEL_422); ++ ++ vc5_hdmi_set_csc_coeffs(vc4_hdmi, csc); ++ } else { ++ vc5_hdmi_set_csc_coeffs_swap(vc4_hdmi, csc); ++ } + -+ vc5_hdmi_set_csc_coeffs(vc4_hdmi, vc5_hdmi_csc_full_rgb_to_full_yuv422_bt709); + break; + + case VC4_HDMI_OUTPUT_RGB: + if_xbar = 0x354021; + -+ if (!vc4_hdmi_is_full_range_rgb(vc4_hdmi, mode)) -+ vc5_hdmi_set_csc_coeffs(vc4_hdmi, vc5_hdmi_csc_full_rgb_to_limited_rgb); -+ else -+ vc5_hdmi_set_csc_coeffs(vc4_hdmi, vc5_hdmi_csc_full_rgb_unity); ++ vc5_hdmi_set_csc_coeffs(vc4_hdmi, ++ vc5_hdmi_csc_full_rgb_to_rgb[lim_range]); + break; + + default: @@ -63189,22 +62918,13 @@ index a308f2d05d17..f1e0e0064b09 100644 +static void vc4_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, + struct drm_connector_state *state, + struct drm_display_mode *mode) - { ++{ bool hsync_pos = mode->flags & DRM_MODE_FLAG_PHSYNC; bool vsync_pos = mode->flags & DRM_MODE_FLAG_PVSYNC; -@@ -518,13 +1102,16 @@ static void vc4_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, - VC4_HDMI_VERTA_VFP) | - VC4_SET_FIELD(mode->crtc_vdisplay, VC4_HDMI_VERTA_VAL)); - u32 vertb = (VC4_SET_FIELD(0, VC4_HDMI_VERTB_VSPO) | -- VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end, -+ VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end + -+ interlaced, - VC4_HDMI_VERTB_VBP)); - u32 vertb_even = (VC4_SET_FIELD(0, VC4_HDMI_VERTB_VSPO) | + bool interlaced = mode->flags & DRM_MODE_FLAG_INTERLACE; +@@ -529,6 +1214,9 @@ static void vc4_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, VC4_SET_FIELD(mode->crtc_vtotal - -- mode->crtc_vsync_end - -- interlaced, -+ mode->crtc_vsync_end, + mode->crtc_vsync_end, VC4_HDMI_VERTB_VBP)); + unsigned long flags; + @@ -63212,7 +62932,7 @@ index a308f2d05d17..f1e0e0064b09 100644 HDMI_WRITE(HDMI_HORZA, (vsync_pos ? VC4_HDMI_HORZA_VPOS : 0) | -@@ -548,10 +1135,16 @@ static void vc4_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, +@@ -552,10 +1240,16 @@ static void vc4_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, HDMI_WRITE(HDMI_VERTB0, vertb_even); HDMI_WRITE(HDMI_VERTB1, vertb); @@ -63229,18 +62949,20 @@ index a308f2d05d17..f1e0e0064b09 100644 bool hsync_pos = mode->flags & DRM_MODE_FLAG_PHSYNC; bool vsync_pos = mode->flags & DRM_MODE_FLAG_PVSYNC; bool interlaced = mode->flags & DRM_MODE_FLAG_INTERLACE; -@@ -562,15 +1155,20 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, +@@ -565,16 +1259,21 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, + VC4_SET_FIELD(mode->crtc_vsync_start - mode->crtc_vdisplay, VC5_HDMI_VERTA_VFP) | VC4_SET_FIELD(mode->crtc_vdisplay, VC5_HDMI_VERTA_VAL)); - u32 vertb = (VC4_SET_FIELD(0, VC5_HDMI_VERTB_VSPO) | +- u32 vertb = (VC4_SET_FIELD(mode->htotal >> (2 - pixel_rep), +- VC5_HDMI_VERTB_VSPO) | - VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end, ++ u32 vertb = (VC4_SET_FIELD(0, VC5_HDMI_VERTB_VSPO) | + VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end + + interlaced, VC4_HDMI_VERTB_VBP)); u32 vertb_even = (VC4_SET_FIELD(0, VC5_HDMI_VERTB_VSPO) | VC4_SET_FIELD(mode->crtc_vtotal - -- mode->crtc_vsync_end - -- interlaced, +- mode->crtc_vsync_end - interlaced, + mode->crtc_vsync_end, VC4_HDMI_VERTB_VBP)); + unsigned long flags; @@ -63254,7 +62976,7 @@ index a308f2d05d17..f1e0e0064b09 100644 HDMI_WRITE(HDMI_HORZA, (vsync_pos ? VC5_HDMI_HORZA_VPOS : 0) | (hsync_pos ? VC5_HDMI_HORZA_HPOS : 0) | -@@ -594,14 +1192,66 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, +@@ -598,14 +1297,66 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, HDMI_WRITE(HDMI_VERTB0, vertb_even); HDMI_WRITE(HDMI_VERTB1, vertb); @@ -63321,7 +63043,7 @@ index a308f2d05d17..f1e0e0064b09 100644 drift = HDMI_READ(HDMI_FIFO_CTL); drift &= VC4_HDMI_FIFO_VALID_WRITE_MASK; -@@ -609,133 +1259,164 @@ static void vc4_hdmi_recenter_fifo(struct vc4_hdmi *vc4_hdmi) +@@ -613,133 +1364,164 @@ static void vc4_hdmi_recenter_fifo(struct vc4_hdmi *vc4_hdmi) drift & ~VC4_HDMI_FIFO_CTL_RECENTER); HDMI_WRITE(HDMI_FIFO_CTL, drift | VC4_HDMI_FIFO_CTL_RECENTER); @@ -63544,7 +63266,7 @@ index a308f2d05d17..f1e0e0064b09 100644 VC4_HD_VID_CTL_UNDERFLOW_ENABLE | VC4_HD_VID_CTL_FRAME_COUNTER_RESET | (vsync_pos ? 0 : VC4_HD_VID_CTL_VSYNC_LOW) | -@@ -749,6 +1430,8 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder) +@@ -753,6 +1535,8 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder) HDMI_READ(HDMI_SCHEDULER_CONTROL) | VC4_HDMI_SCHEDULER_CONTROL_MODE_HDMI); @@ -63553,7 +63275,7 @@ index a308f2d05d17..f1e0e0064b09 100644 ret = wait_for(HDMI_READ(HDMI_SCHEDULER_CONTROL) & VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE, 1000); WARN_ONCE(ret, "Timeout waiting for " -@@ -761,6 +1444,8 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder) +@@ -765,6 +1549,8 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder) HDMI_READ(HDMI_SCHEDULER_CONTROL) & ~VC4_HDMI_SCHEDULER_CONTROL_MODE_HDMI); @@ -63562,7 +63284,7 @@ index a308f2d05d17..f1e0e0064b09 100644 ret = wait_for(!(HDMI_READ(HDMI_SCHEDULER_CONTROL) & VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE), 1000); WARN_ONCE(ret, "Timeout waiting for " -@@ -768,6 +1453,8 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder) +@@ -772,6 +1558,8 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder) } if (vc4_encoder->hdmi_monitor) { @@ -63571,7 +63293,7 @@ index a308f2d05d17..f1e0e0064b09 100644 WARN_ON(!(HDMI_READ(HDMI_SCHEDULER_CONTROL) & VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE)); HDMI_WRITE(HDMI_SCHEDULER_CONTROL, -@@ -777,14 +1464,245 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder) +@@ -781,14 +1569,245 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder) HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, VC4_HDMI_RAM_PACKET_ENABLE); @@ -63585,12 +63307,13 @@ index a308f2d05d17..f1e0e0064b09 100644 + vc4_hdmi_enable_scrambling(encoder); + + mutex_unlock(&vc4_hdmi->mutex); -+} -+ + } + +-static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) +static void vc4_hdmi_encoder_atomic_mode_set(struct drm_encoder *encoder, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) -+{ + { + struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); + struct vc4_hdmi_connector_state *vc4_state = + conn_state_to_vc4_hdmi_conn_state(conn_state); @@ -63780,14 +63503,13 @@ index a308f2d05d17..f1e0e0064b09 100644 + drm_dbg(dev, "Failed. No Format Supported for that bpc count.\n"); + + return -EINVAL; - } - --static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) ++} ++ +static int +vc4_hdmi_encoder_compute_config(const struct vc4_hdmi *vc4_hdmi, + struct vc4_hdmi_connector_state *vc4_state, + const struct drm_display_mode *mode) - { ++{ + struct drm_device *dev = vc4_hdmi->connector.dev; + struct drm_connector_state *conn_state = &vc4_state->base; + unsigned int max_bpc = clamp_t(unsigned int, conn_state->max_bpc, 8, 12); @@ -63818,35 +63540,42 @@ index a308f2d05d17..f1e0e0064b09 100644 } #define WIFI_2_4GHz_CH1_MIN_FREQ 2400000000ULL -@@ -794,10 +1712,12 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder, +@@ -798,10 +1817,15 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder, struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state) { + struct vc4_hdmi_connector_state *vc4_state = conn_state_to_vc4_hdmi_conn_state(conn_state); struct drm_display_mode *mode = &crtc_state->adjusted_mode; struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); ++ struct drm_connector *connector = &vc4_hdmi->connector; ++ struct drm_connector_state *old_conn_state = drm_atomic_get_old_connector_state(conn_state->state, connector); ++ struct vc4_hdmi_connector_state *old_vc4_state = conn_state_to_vc4_hdmi_conn_state(old_conn_state); unsigned long long pixel_rate = mode->clock * 1000; unsigned long long tmds_rate; + int ret; if (vc4_hdmi->variant->unsupported_odd_h_timings && !(mode->flags & DRM_MODE_FLAG_DBLCLK) && -@@ -819,11 +1739,9 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder, +@@ -823,11 +1847,14 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder, pixel_rate = mode->clock * 1000; } - if (mode->flags & DRM_MODE_FLAG_DBLCLK) - pixel_rate = pixel_rate * 2; -- -- if (pixel_rate > vc4_hdmi->variant->max_pixel_clock) -- return -EINVAL; + ret = vc4_hdmi_encoder_compute_config(vc4_hdmi, vc4_state, mode); + if (ret) + return ret; +- if (pixel_rate > vc4_hdmi->variant->max_pixel_clock) +- return -EINVAL; ++ /* vc4_hdmi_encoder_compute_config may have changed output_bpc and/or output_format */ ++ if (vc4_state->output_bpc != old_vc4_state->output_bpc || ++ vc4_state->output_format != old_vc4_state->output_format) ++ crtc_state->mode_changed = true; + return 0; } -@@ -840,19 +1758,48 @@ vc4_hdmi_encoder_mode_valid(struct drm_encoder *encoder, +@@ -844,19 +1871,48 @@ vc4_hdmi_encoder_mode_valid(struct drm_encoder *encoder, (mode->hsync_end % 2) || (mode->htotal % 2))) return MODE_H_ILLEGAL; @@ -63901,7 +63630,7 @@ index a308f2d05d17..f1e0e0064b09 100644 static u32 vc4_hdmi_channel_map(struct vc4_hdmi *vc4_hdmi, u32 channel_mask) { int i; -@@ -877,33 +1824,49 @@ static u32 vc5_hdmi_channel_map(struct vc4_hdmi *vc4_hdmi, u32 channel_mask) +@@ -881,33 +1937,49 @@ static u32 vc5_hdmi_channel_map(struct vc4_hdmi *vc4_hdmi, u32 channel_mask) return channel_map; } @@ -63958,7 +63687,7 @@ index a308f2d05d17..f1e0e0064b09 100644 n = 128 * samplerate / 1000; tmp = (u64)(mode->clock * 1000) * n; do_div(tmp, 128 * samplerate); -@@ -929,36 +1892,48 @@ static inline struct vc4_hdmi *dai_to_hdmi(struct snd_soc_dai *dai) +@@ -933,36 +2005,48 @@ static inline struct vc4_hdmi *dai_to_hdmi(struct snd_soc_dai *dai) return snd_soc_card_get_drvdata(card); } @@ -63986,13 +63715,13 @@ index a308f2d05d17..f1e0e0064b09 100644 - if (!encoder->crtc || !(HDMI_READ(HDMI_RAM_PACKET_CONFIG) & - VC4_HDMI_RAM_PACKET_ENABLE)) - return -ENODEV; -+ if (!vc4_hdmi->encoder.hdmi_monitor) -+ return false; - +- - ret = snd_pcm_hw_constraint_eld(substream->runtime, connector->eld); - if (ret) - return ret; -- ++ if (!vc4_hdmi->encoder.hdmi_monitor) ++ return false; + - return 0; + return true; } @@ -64029,7 +63758,7 @@ index a308f2d05d17..f1e0e0064b09 100644 return 0; } -@@ -966,60 +1941,133 @@ static void vc4_hdmi_audio_reset(struct vc4_hdmi *vc4_hdmi) +@@ -970,60 +2054,133 @@ static void vc4_hdmi_audio_reset(struct vc4_hdmi *vc4_hdmi) { struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base; struct device *dev = &vc4_hdmi->pdev->dev; @@ -64066,7 +63795,7 @@ index a308f2d05d17..f1e0e0064b09 100644 + mutex_lock(&vc4_hdmi->mutex); + + spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); - ++ + HDMI_WRITE(HDMI_MAI_CTL, + VC4_HD_MAI_CTL_DLATE | + VC4_HD_MAI_CTL_ERRORE | @@ -64076,7 +63805,7 @@ index a308f2d05d17..f1e0e0064b09 100644 + + if (vc4_hdmi->variant->phy_rng_disable) + vc4_hdmi->variant->phy_rng_disable(vc4_hdmi); -+ + + vc4_hdmi->audio.streaming = false; vc4_hdmi_audio_reset(vc4_hdmi); @@ -64164,10 +63893,10 @@ index a308f2d05d17..f1e0e0064b09 100644 + mutex_unlock(&vc4_hdmi->mutex); + return -EINVAL; + } ++ ++ vc4_hdmi_audio_set_mai_clock(vc4_hdmi, sample_rate); - vc4_hdmi_audio_set_mai_clock(vc4_hdmi); -+ vc4_hdmi_audio_set_mai_clock(vc4_hdmi, sample_rate); -+ + spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); + HDMI_WRITE(HDMI_MAI_CTL, + VC4_SET_FIELD(channels, VC4_HD_MAI_CTL_CHNUM) | @@ -64189,7 +63918,7 @@ index a308f2d05d17..f1e0e0064b09 100644 /* The B frame identifier should match the value used by alsa-lib (8) */ audio_packet_config = -@@ -1027,124 +2075,39 @@ static int vc4_hdmi_audio_hw_params(struct snd_pcm_substream *substream, +@@ -1031,7 +2188,7 @@ static int vc4_hdmi_audio_hw_params(struct snd_pcm_substream *substream, VC4_HDMI_AUDIO_PACKET_ZERO_DATA_ON_INACTIVE_CHANNELS | VC4_SET_FIELD(0x8, VC4_HDMI_AUDIO_PACKET_B_FRAME_IDENTIFIER); @@ -64198,28 +63927,7 @@ index a308f2d05d17..f1e0e0064b09 100644 audio_packet_config |= VC4_SET_FIELD(channel_mask, VC4_HDMI_AUDIO_PACKET_CEA_MASK); -- /* Set the MAI threshold. This logic mimics the firmware's. */ -- if (vc4_hdmi->audio.samplerate > 96000) { -- HDMI_WRITE(HDMI_MAI_THR, -- VC4_SET_FIELD(0x12, VC4_HD_MAI_THR_DREQHIGH) | -- VC4_SET_FIELD(0x12, VC4_HD_MAI_THR_DREQLOW)); -- } else if (vc4_hdmi->audio.samplerate > 48000) { -- HDMI_WRITE(HDMI_MAI_THR, -- VC4_SET_FIELD(0x14, VC4_HD_MAI_THR_DREQHIGH) | -- VC4_SET_FIELD(0x12, VC4_HD_MAI_THR_DREQLOW)); -- } else { -- HDMI_WRITE(HDMI_MAI_THR, -- VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_PANICHIGH) | -- VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_PANICLOW) | -- VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_DREQHIGH) | -- VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_DREQLOW)); -- } -+ /* Set the MAI threshold */ -+ HDMI_WRITE(HDMI_MAI_THR, -+ VC4_SET_FIELD(0x08, VC4_HD_MAI_THR_PANICHIGH) | -+ VC4_SET_FIELD(0x08, VC4_HD_MAI_THR_PANICLOW) | -+ VC4_SET_FIELD(0x06, VC4_HD_MAI_THR_DREQHIGH) | -+ VC4_SET_FIELD(0x08, VC4_HD_MAI_THR_DREQLOW)); +@@ -1044,101 +2201,26 @@ static int vc4_hdmi_audio_hw_params(struct snd_pcm_substream *substream, HDMI_WRITE(HDMI_MAI_CONFIG, VC4_HDMI_MAI_CONFIG_BIT_REVERSE | @@ -64230,12 +63938,13 @@ index a308f2d05d17..f1e0e0064b09 100644 HDMI_WRITE(HDMI_MAI_CHANNEL_MAP, channel_map); HDMI_WRITE(HDMI_AUDIO_PACKET_CONFIG, audio_packet_config); - vc4_hdmi_set_n_cts(vc4_hdmi); -- + - vc4_hdmi_set_audio_infoframe(encoder); -- ++ vc4_hdmi_set_n_cts(vc4_hdmi, sample_rate); + - return 0; -} - +- -static int vc4_hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd, - struct snd_soc_dai *dai) -{ @@ -64244,7 +63953,8 @@ index a308f2d05d17..f1e0e0064b09 100644 - switch (cmd) { - case SNDRV_PCM_TRIGGER_START: - vc4_hdmi->audio.streaming = true; -- ++ spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); + - if (vc4_hdmi->variant->phy_rng_enable) - vc4_hdmi->variant->phy_rng_enable(vc4_hdmi); - @@ -64260,12 +63970,10 @@ index a308f2d05d17..f1e0e0064b09 100644 - VC4_HD_MAI_CTL_DLATE | - VC4_HD_MAI_CTL_ERRORE | - VC4_HD_MAI_CTL_ERRORF); -+ vc4_hdmi_set_n_cts(vc4_hdmi, sample_rate); - +- - if (vc4_hdmi->variant->phy_rng_disable) - vc4_hdmi->variant->phy_rng_disable(vc4_hdmi); -+ spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); - +- - vc4_hdmi->audio.streaming = false; - - break; @@ -64328,11 +64036,10 @@ index a308f2d05d17..f1e0e0064b09 100644 static const struct snd_soc_dapm_widget vc4_hdmi_audio_widgets[] = { SND_SOC_DAPM_OUTPUT("TX"), }; -@@ -1154,39 +2117,15 @@ static const struct snd_soc_dapm_route vc4_hdmi_audio_routes[] = { - }; +@@ -1149,38 +2231,14 @@ static const struct snd_soc_dapm_route vc4_hdmi_audio_routes[] = { static const struct snd_soc_component_driver vc4_hdmi_audio_component_drv = { -- .name = "vc4-hdmi-codec-dai-component", + .name = "vc4-hdmi-codec-dai-component", - .controls = vc4_hdmi_audio_controls, - .num_controls = ARRAY_SIZE(vc4_hdmi_audio_controls), - .dapm_widgets = vc4_hdmi_audio_widgets, @@ -64365,7 +64072,6 @@ index a308f2d05d17..f1e0e0064b09 100644 - SNDRV_PCM_RATE_192000, - .formats = SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE, - }, -+ .name = "vc4-hdmi-codec-dai-component", + .dapm_widgets = vc4_hdmi_audio_widgets, + .num_dapm_widgets = ARRAY_SIZE(vc4_hdmi_audio_widgets), + .dapm_routes = vc4_hdmi_audio_routes, @@ -64377,7 +64083,7 @@ index a308f2d05d17..f1e0e0064b09 100644 }; static const struct snd_soc_component_driver vc4_hdmi_audio_cpu_dai_comp = { -@@ -1215,7 +2154,6 @@ static struct snd_soc_dai_driver vc4_hdmi_audio_cpu_dai_drv = { +@@ -1209,7 +2267,6 @@ static struct snd_soc_dai_driver vc4_hdmi_audio_cpu_dai_drv = { SNDRV_PCM_RATE_192000, .formats = SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE, }, @@ -64385,7 +64091,7 @@ index a308f2d05d17..f1e0e0064b09 100644 }; static const struct snd_dmaengine_pcm_config pcm_conf = { -@@ -1223,6 +2161,33 @@ static const struct snd_dmaengine_pcm_config pcm_conf = { +@@ -1217,6 +2274,33 @@ static const struct snd_dmaengine_pcm_config pcm_conf = { .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, }; @@ -64419,26 +64125,24 @@ index a308f2d05d17..f1e0e0064b09 100644 static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) { const struct vc4_hdmi_register *mai_data = -@@ -1230,13 +2195,16 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) +@@ -1224,11 +2308,14 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) struct snd_soc_dai_link *dai_link = &vc4_hdmi->audio.link; struct snd_soc_card *card = &vc4_hdmi->audio.card; struct device *dev = &vc4_hdmi->pdev->dev; + struct platform_device *codec_pdev; const __be32 *addr; - int index; +- int index, len; ++ int index; int ret; + int len; -- if (!of_find_property(dev->of_node, "dmas", NULL)) { +- if (!of_find_property(dev->of_node, "dmas", &len) || !len) { + if (!of_find_property(dev->of_node, "dmas", &len) || + len == 0) { dev_warn(dev, -- "'dmas' DT property is missing, no HDMI audio\n"); -+ "'dmas' DT property is missing or empty, no HDMI audio\n"); + "'dmas' DT property is missing or empty, no HDMI audio\n"); return 0; - } - -@@ -1276,12 +2244,13 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) +@@ -1270,12 +2357,13 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) return ret; } @@ -64458,7 +64162,7 @@ index a308f2d05d17..f1e0e0064b09 100644 } dai_link->cpus = &vc4_hdmi->audio.cpu; -@@ -1294,9 +2263,9 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) +@@ -1288,9 +2376,9 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) dai_link->name = "MAI"; dai_link->stream_name = "MAI PCM"; @@ -64470,7 +64174,7 @@ index a308f2d05d17..f1e0e0064b09 100644 dai_link->platforms->name = dev_name(dev); card->dai_link = dai_link; -@@ -1316,22 +2285,83 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) +@@ -1310,22 +2398,83 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) snd_soc_card_set_drvdata(card, vc4_hdmi); ret = devm_snd_soc_register_card(dev, card); if (ret) @@ -64561,7 +64265,7 @@ index a308f2d05d17..f1e0e0064b09 100644 cec_transmit_done(vc4_hdmi->cec_adap, CEC_TX_STATUS_OK, 0, 0, 0, 0); } else { -@@ -1345,12 +2375,27 @@ static irqreturn_t vc4_cec_irq_handler_thread(int irq, void *priv) +@@ -1339,12 +2488,27 @@ static irqreturn_t vc4_cec_irq_handler_thread(int irq, void *priv) return IRQ_HANDLED; } @@ -64589,7 +64293,7 @@ index a308f2d05d17..f1e0e0064b09 100644 msg->len = 1 + ((cntrl1 & VC4_HDMI_CEC_REC_WRD_CNT_MASK) >> VC4_HDMI_CEC_REC_WRD_CNT_SHIFT); -@@ -1369,83 +2414,208 @@ static void vc4_cec_read_msg(struct vc4_hdmi *vc4_hdmi, u32 cntrl1) +@@ -1363,83 +2527,208 @@ static void vc4_cec_read_msg(struct vc4_hdmi *vc4_hdmi, u32 cntrl1) } } @@ -64712,9 +64416,9 @@ index a308f2d05d17..f1e0e0064b09 100644 + ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); + if (ret) + return ret; - -+ spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); + ++ spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); + + val = HDMI_READ(HDMI_CEC_CNTRL_5); val &= ~(VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET | VC4_HDMI_CEC_CNT_TO_4700_US_MASK | @@ -64839,7 +64543,7 @@ index a308f2d05d17..f1e0e0064b09 100644 return 0; } -@@ -1454,14 +2624,28 @@ static int vc4_hdmi_cec_adap_transmit(struct cec_adapter *adap, u8 attempts, +@@ -1448,14 +2737,28 @@ static int vc4_hdmi_cec_adap_transmit(struct cec_adapter *adap, u8 attempts, { struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap); struct drm_device *dev = vc4_hdmi->connector.dev; @@ -64868,7 +64572,7 @@ index a308f2d05d17..f1e0e0064b09 100644 for (i = 0; i < msg->len; i += 4) HDMI_WRITE(HDMI_CEC_TX_DATA_1 + (i >> 2), (msg->msg[i]) | -@@ -1477,6 +2661,9 @@ static int vc4_hdmi_cec_adap_transmit(struct cec_adapter *adap, u8 attempts, +@@ -1471,6 +2774,9 @@ static int vc4_hdmi_cec_adap_transmit(struct cec_adapter *adap, u8 attempts, val |= VC4_HDMI_CEC_START_XMIT_BEGIN; HDMI_WRITE(HDMI_CEC_CNTRL_1, val); @@ -64878,7 +64582,7 @@ index a308f2d05d17..f1e0e0064b09 100644 return 0; } -@@ -1490,11 +2677,14 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi) +@@ -1484,11 +2790,14 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi) { struct cec_connector_info conn_info; struct platform_device *pdev = vc4_hdmi->pdev; @@ -64895,7 +64599,7 @@ index a308f2d05d17..f1e0e0064b09 100644 vc4_hdmi->cec_adap = cec_allocate_adapter(&vc4_hdmi_cec_adap_ops, vc4_hdmi, "vc4", -@@ -1507,28 +2697,49 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi) +@@ -1501,28 +2810,49 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi) cec_fill_conn_info_from_drm(&conn_info, &vc4_hdmi->connector); cec_s_conn_info(vc4_hdmi->cec_adap, &conn_info); @@ -64961,7 +64665,7 @@ index a308f2d05d17..f1e0e0064b09 100644 err_delete_cec_adap: cec_delete_adapter(vc4_hdmi->cec_adap); -@@ -1537,8 +2748,40 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi) +@@ -1531,8 +2861,40 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi) static void vc4_hdmi_cec_exit(struct vc4_hdmi *vc4_hdmi) { @@ -65002,7 +64706,7 @@ index a308f2d05d17..f1e0e0064b09 100644 #else static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi) { -@@ -1547,6 +2790,10 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi) +@@ -1541,6 +2903,10 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi) static void vc4_hdmi_cec_exit(struct vc4_hdmi *vc4_hdmi) {}; @@ -65013,7 +64717,7 @@ index a308f2d05d17..f1e0e0064b09 100644 #endif static int vc4_hdmi_build_regset(struct vc4_hdmi *vc4_hdmi, -@@ -1621,6 +2868,7 @@ static int vc4_hdmi_init_resources(struct vc4_hdmi *vc4_hdmi) +@@ -1615,6 +2981,7 @@ static int vc4_hdmi_init_resources(struct vc4_hdmi *vc4_hdmi) return PTR_ERR(vc4_hdmi->hsm_clock); } vc4_hdmi->audio_clock = vc4_hdmi->hsm_clock; @@ -65021,7 +64725,7 @@ index a308f2d05d17..f1e0e0064b09 100644 return 0; } -@@ -1630,6 +2878,7 @@ static int vc5_hdmi_init_resources(struct vc4_hdmi *vc4_hdmi) +@@ -1624,6 +2991,7 @@ static int vc5_hdmi_init_resources(struct vc4_hdmi *vc4_hdmi) struct platform_device *pdev = vc4_hdmi->pdev; struct device *dev = &pdev->dev; struct resource *res; @@ -65029,7 +64733,7 @@ index a308f2d05d17..f1e0e0064b09 100644 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hdmi"); if (!res) -@@ -1714,12 +2963,50 @@ static int vc5_hdmi_init_resources(struct vc4_hdmi *vc4_hdmi) +@@ -1708,12 +3076,50 @@ static int vc5_hdmi_init_resources(struct vc4_hdmi *vc4_hdmi) return PTR_ERR(vc4_hdmi->audio_clock); } @@ -65080,7 +64784,7 @@ index a308f2d05d17..f1e0e0064b09 100644 return 0; } -@@ -1742,6 +3029,15 @@ static int vc4_hdmi_runtime_resume(struct device *dev) +@@ -1736,6 +3142,15 @@ static int vc4_hdmi_runtime_resume(struct device *dev) if (ret) return ret; @@ -65096,7 +64800,7 @@ index a308f2d05d17..f1e0e0064b09 100644 return 0; } #endif -@@ -1760,6 +3056,9 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) +@@ -1754,6 +3169,9 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) vc4_hdmi = devm_kzalloc(dev, sizeof(*vc4_hdmi), GFP_KERNEL); if (!vc4_hdmi) return -ENOMEM; @@ -65106,7 +64810,7 @@ index a308f2d05d17..f1e0e0064b09 100644 dev_set_drvdata(dev, vc4_hdmi); encoder = &vc4_hdmi->encoder.base.base; -@@ -1772,6 +3071,15 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) +@@ -1766,6 +3184,15 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) vc4_hdmi->pdev = pdev; vc4_hdmi->variant = variant; @@ -65122,7 +64826,7 @@ index a308f2d05d17..f1e0e0064b09 100644 ret = variant->init_resources(vc4_hdmi); if (ret) return ret; -@@ -1809,6 +3117,14 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) +@@ -1803,6 +3230,14 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) vc4_hdmi->disable_wifi_frequencies = of_property_read_bool(dev->of_node, "wifi-2.4ghz-coexistence"); @@ -65137,7 +64841,7 @@ index a308f2d05d17..f1e0e0064b09 100644 /* * If we boot without any cable connected to the HDMI connector, * the firmware will skip the HSM initialization and leave it -@@ -1817,13 +3133,29 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) +@@ -1811,13 +3246,29 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) * * Let's put a sensible default at runtime_resume so that we * don't end up in this situation. @@ -65170,7 +64874,7 @@ index a308f2d05d17..f1e0e0064b09 100644 if ((of_device_is_compatible(dev->of_node, "brcm,bcm2711-hdmi0") || of_device_is_compatible(dev->of_node, "brcm,bcm2711-hdmi1")) && -@@ -1833,8 +3165,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) +@@ -1827,8 +3278,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) clk_prepare_enable(vc4_hdmi->pixel_bvb_clock); } @@ -65179,7 +64883,7 @@ index a308f2d05d17..f1e0e0064b09 100644 drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); drm_encoder_helper_add(encoder, &vc4_hdmi_encoder_helper_funcs); -@@ -1842,10 +3172,14 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) +@@ -1836,10 +3285,14 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) if (ret) goto err_destroy_encoder; @@ -65195,7 +64899,7 @@ index a308f2d05d17..f1e0e0064b09 100644 ret = vc4_hdmi_audio_init(vc4_hdmi); if (ret) goto err_free_cec; -@@ -1854,14 +3188,19 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) +@@ -1848,14 +3301,19 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) vc4_hdmi_debugfs_regs, vc4_hdmi); @@ -65215,7 +64919,7 @@ index a308f2d05d17..f1e0e0064b09 100644 pm_runtime_disable(dev); err_put_ddc: put_device(&vc4_hdmi->ddc->dev); -@@ -1899,6 +3238,7 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master, +@@ -1893,6 +3351,7 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master, kfree(vc4_hdmi->hd_regset.regs); vc4_hdmi_cec_exit(vc4_hdmi); @@ -65223,7 +64927,7 @@ index a308f2d05d17..f1e0e0064b09 100644 vc4_hdmi_connector_destroy(&vc4_hdmi->connector); drm_encoder_cleanup(&vc4_hdmi->encoder.base.base); -@@ -1928,7 +3268,6 @@ static const struct vc4_hdmi_variant bcm2835_variant = { +@@ -1922,7 +3381,6 @@ static const struct vc4_hdmi_variant bcm2835_variant = { .debugfs_name = "hdmi_regs", .card_name = "vc4-hdmi", .max_pixel_clock = 162000000, @@ -65231,7 +64935,7 @@ index a308f2d05d17..f1e0e0064b09 100644 .registers = vc4_hdmi_fields, .num_registers = ARRAY_SIZE(vc4_hdmi_fields), -@@ -1940,14 +3279,16 @@ static const struct vc4_hdmi_variant bcm2835_variant = { +@@ -1934,14 +3392,16 @@ static const struct vc4_hdmi_variant bcm2835_variant = { .phy_disable = vc4_hdmi_phy_disable, .phy_rng_enable = vc4_hdmi_phy_rng_enable, .phy_rng_disable = vc4_hdmi_phy_rng_disable, @@ -65244,12 +64948,12 @@ index a308f2d05d17..f1e0e0064b09 100644 .encoder_type = VC4_ENCODER_TYPE_HDMI0, .debugfs_name = "hdmi0_regs", .card_name = "vc4-hdmi-0", -- .max_pixel_clock = 297000000, +- .max_pixel_clock = HDMI_14_MAX_TMDS_CLK, + .max_pixel_clock = 600000000, .registers = vc5_hdmi_hdmi0_fields, .num_registers = ARRAY_SIZE(vc5_hdmi_hdmi0_fields), .phy_lane_mapping = { -@@ -1957,6 +3298,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi0_variant = { +@@ -1951,6 +3411,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi0_variant = { PHY_LANE_CK, }, .unsupported_odd_h_timings = true, @@ -65257,7 +64961,7 @@ index a308f2d05d17..f1e0e0064b09 100644 .init_resources = vc5_hdmi_init_resources, .csc_setup = vc5_hdmi_csc_setup, -@@ -1966,14 +3308,17 @@ static const struct vc4_hdmi_variant bcm2711_hdmi0_variant = { +@@ -1960,7 +3421,10 @@ static const struct vc4_hdmi_variant bcm2711_hdmi0_variant = { .phy_disable = vc5_hdmi_phy_disable, .phy_rng_enable = vc5_hdmi_phy_rng_enable, .phy_rng_disable = vc5_hdmi_phy_rng_disable, @@ -65268,15 +64972,7 @@ index a308f2d05d17..f1e0e0064b09 100644 }; static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = { - .encoder_type = VC4_ENCODER_TYPE_HDMI1, - .debugfs_name = "hdmi1_regs", - .card_name = "vc4-hdmi-1", -- .max_pixel_clock = 297000000, -+ .max_pixel_clock = HDMI_14_MAX_TMDS_CLK, - .registers = vc5_hdmi_hdmi1_fields, - .num_registers = ARRAY_SIZE(vc5_hdmi_hdmi1_fields), - .phy_lane_mapping = { -@@ -1983,6 +3328,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = { +@@ -1977,6 +3441,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = { PHY_LANE_2, }, .unsupported_odd_h_timings = true, @@ -65284,7 +64980,7 @@ index a308f2d05d17..f1e0e0064b09 100644 .init_resources = vc5_hdmi_init_resources, .csc_setup = vc5_hdmi_csc_setup, -@@ -1992,7 +3338,10 @@ static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = { +@@ -1986,7 +3451,10 @@ static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = { .phy_disable = vc5_hdmi_phy_disable, .phy_rng_enable = vc5_hdmi_phy_rng_enable, .phy_rng_disable = vc5_hdmi_phy_rng_disable, @@ -66609,7 +66305,7 @@ index f4aa75efd16b..18abc06335c1 100644 static int vc4_perfmon_idr_del(int id, void *elem, void *data) diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c -index af4b8944a603..766280a844f4 100644 +index 4df222a83049..766280a844f4 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -33,6 +33,7 @@ static const struct hvs_format { @@ -66661,55 +66357,20 @@ index af4b8944a603..766280a844f4 100644 }; static const struct hvs_format *vc4_get_hvs_format(u32 drm_format) -@@ -303,16 +338,16 @@ static int vc4_plane_margins_adj(struct drm_plane_state *pstate) - adjhdisplay, - crtc_state->mode.hdisplay); - vc4_pstate->crtc_x += left; -- if (vc4_pstate->crtc_x > crtc_state->mode.hdisplay - left) -- vc4_pstate->crtc_x = crtc_state->mode.hdisplay - left; -+ if (vc4_pstate->crtc_x > crtc_state->mode.hdisplay - right) -+ vc4_pstate->crtc_x = crtc_state->mode.hdisplay - right; - - adjvdisplay = crtc_state->mode.vdisplay - (top + bottom); - vc4_pstate->crtc_y = DIV_ROUND_CLOSEST(vc4_pstate->crtc_y * - adjvdisplay, - crtc_state->mode.vdisplay); - vc4_pstate->crtc_y += top; -- if (vc4_pstate->crtc_y > crtc_state->mode.vdisplay - top) -- vc4_pstate->crtc_y = crtc_state->mode.vdisplay - top; -+ if (vc4_pstate->crtc_y > crtc_state->mode.vdisplay - bottom) -+ vc4_pstate->crtc_y = crtc_state->mode.vdisplay - bottom; - - vc4_pstate->crtc_w = DIV_ROUND_CLOSEST(vc4_pstate->crtc_w * - adjhdisplay, -@@ -332,7 +367,6 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state) - struct vc4_plane_state *vc4_state = to_vc4_plane_state(state); - struct drm_framebuffer *fb = state->fb; - struct drm_gem_cma_object *bo = drm_fb_cma_get_gem_obj(fb, 0); -- u32 subpixel_src_mask = (1 << 16) - 1; - int num_planes = fb->format->num_planes; - struct drm_crtc_state *crtc_state; - u32 h_subsample = fb->format->hsub; -@@ -354,18 +388,14 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state) +@@ -353,15 +388,14 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state) for (i = 0; i < num_planes; i++) vc4_state->offsets[i] = bo->paddr + fb->offsets[i]; -- /* We don't support subpixel source positioning for scaling. */ -- if ((state->src.x1 & subpixel_src_mask) || -- (state->src.x2 & subpixel_src_mask) || -- (state->src.y1 & subpixel_src_mask) || -- (state->src.y2 & subpixel_src_mask)) { -- return -EINVAL; -- } -- -- vc4_state->src_x = state->src.x1 >> 16; -- vc4_state->src_y = state->src.y1 >> 16; -- vc4_state->src_w[0] = (state->src.x2 - state->src.x1) >> 16; -- vc4_state->src_h[0] = (state->src.y2 - state->src.y1) >> 16; +- /* +- * We don't support subpixel source positioning for scaling, + /* We don't support subpixel source positioning for scaling, -+ * but fractional coordinates can be generated by clipping -+ * so just round for now -+ */ + * but fractional coordinates can be generated by clipping + * so just round for now + */ +- vc4_state->src_x = DIV_ROUND_CLOSEST(state->src.x1, 1 << 16); +- vc4_state->src_y = DIV_ROUND_CLOSEST(state->src.y1, 1 << 16); +- vc4_state->src_w[0] = DIV_ROUND_CLOSEST(state->src.x2, 1 << 16) - vc4_state->src_x; +- vc4_state->src_h[0] = DIV_ROUND_CLOSEST(state->src.y2, 1 << 16) - vc4_state->src_y; + vc4_state->src_x = DIV_ROUND_CLOSEST(state->src.x1, 1<<16); + vc4_state->src_y = DIV_ROUND_CLOSEST(state->src.y1, 1<<16); + vc4_state->src_w[0] = DIV_ROUND_CLOSEST(state->src.x2, 1<<16) - vc4_state->src_x; @@ -66717,7 +66378,7 @@ index af4b8944a603..766280a844f4 100644 vc4_state->crtc_x = state->dst.x1; vc4_state->crtc_y = state->dst.y1; -@@ -532,9 +562,6 @@ static void vc4_plane_calc_load(struct drm_plane_state *state) +@@ -528,9 +562,6 @@ static void vc4_plane_calc_load(struct drm_plane_state *state) struct vc4_dev *vc4; vc4 = to_vc4_dev(state->plane->dev); @@ -66727,7 +66388,7 @@ index af4b8944a603..766280a844f4 100644 vc4_state = to_vc4_plane_state(state); crtc_state = drm_atomic_get_existing_crtc_state(state->state, state->crtc); -@@ -621,6 +648,95 @@ static int vc4_plane_allocate_lbm(struct drm_plane_state *state) +@@ -617,6 +648,95 @@ static int vc4_plane_allocate_lbm(struct drm_plane_state *state) return 0; } @@ -66823,7 +66484,7 @@ index af4b8944a603..766280a844f4 100644 /* Writes out a full display list for an active plane to the plane's * private dlist state. */ -@@ -767,47 +883,90 @@ static int vc4_plane_mode_set(struct drm_plane *plane, +@@ -763,47 +883,90 @@ static int vc4_plane_mode_set(struct drm_plane *plane, case DRM_FORMAT_MOD_BROADCOM_SAND128: case DRM_FORMAT_MOD_BROADCOM_SAND256: { uint32_t param = fourcc_mod_broadcom_param(fb->modifier); @@ -66941,7 +66602,7 @@ index af4b8944a603..766280a844f4 100644 } pitch0 = VC4_SET_FIELD(param, SCALER_TILE_HEIGHT); -@@ -860,13 +1019,8 @@ static int vc4_plane_mode_set(struct drm_plane *plane, +@@ -856,13 +1019,8 @@ static int vc4_plane_mode_set(struct drm_plane *plane, /* Position Word 2: Source Image Size, Alpha */ vc4_state->pos2_offset = vc4_state->dlist_count; vc4_dlist_write(vc4_state, @@ -66956,7 +66617,7 @@ index af4b8944a603..766280a844f4 100644 VC4_SET_FIELD(vc4_state->src_w[0], SCALER_POS2_WIDTH) | VC4_SET_FIELD(vc4_state->src_h[0], -@@ -911,14 +1065,9 @@ static int vc4_plane_mode_set(struct drm_plane *plane, +@@ -907,14 +1065,9 @@ static int vc4_plane_mode_set(struct drm_plane *plane, vc4_dlist_write(vc4_state, VC4_SET_FIELD(state->alpha >> 4, SCALER5_CTL2_ALPHA) | @@ -66973,7 +66634,7 @@ index af4b8944a603..766280a844f4 100644 ); /* Position Word 1: Scaled Image Dimensions. */ -@@ -960,7 +1109,8 @@ static int vc4_plane_mode_set(struct drm_plane *plane, +@@ -956,7 +1109,8 @@ static int vc4_plane_mode_set(struct drm_plane *plane, /* Pitch word 1/2 */ for (i = 1; i < num_planes; i++) { @@ -66983,7 +66644,7 @@ index af4b8944a603..766280a844f4 100644 vc4_dlist_write(vc4_state, VC4_SET_FIELD(fb->pitches[i], SCALER_SRC_PITCH)); -@@ -971,9 +1121,20 @@ static int vc4_plane_mode_set(struct drm_plane *plane, +@@ -967,9 +1121,20 @@ static int vc4_plane_mode_set(struct drm_plane *plane, /* Colorspace conversion words */ if (vc4_state->is_yuv) { @@ -67007,7 +66668,7 @@ index af4b8944a603..766280a844f4 100644 } vc4_state->lbm_offset = 0; -@@ -1146,7 +1307,6 @@ static void vc4_plane_atomic_async_update(struct drm_plane *plane, +@@ -1142,7 +1307,6 @@ static void vc4_plane_atomic_async_update(struct drm_plane *plane, plane->state->src_y = state->src_y; plane->state->src_w = state->src_w; plane->state->src_h = state->src_h; @@ -67015,7 +66676,7 @@ index af4b8944a603..766280a844f4 100644 plane->state->alpha = state->alpha; plane->state->pixel_blend_mode = state->pixel_blend_mode; plane->state->rotation = state->rotation; -@@ -1283,11 +1443,6 @@ static const struct drm_plane_helper_funcs vc4_plane_helper_funcs = { +@@ -1279,11 +1443,6 @@ static const struct drm_plane_helper_funcs vc4_plane_helper_funcs = { .atomic_async_update = vc4_plane_atomic_async_update, }; @@ -67027,7 +66688,7 @@ index af4b8944a603..766280a844f4 100644 static bool vc4_format_mod_supported(struct drm_plane *plane, uint32_t format, uint64_t modifier) -@@ -1320,6 +1475,13 @@ static bool vc4_format_mod_supported(struct drm_plane *plane, +@@ -1316,6 +1475,13 @@ static bool vc4_format_mod_supported(struct drm_plane *plane, default: return false; } @@ -67041,7 +66702,7 @@ index af4b8944a603..766280a844f4 100644 case DRM_FORMAT_RGBX1010102: case DRM_FORMAT_BGRX1010102: case DRM_FORMAT_RGBA1010102: -@@ -1338,7 +1500,7 @@ static bool vc4_format_mod_supported(struct drm_plane *plane, +@@ -1334,7 +1500,7 @@ static bool vc4_format_mod_supported(struct drm_plane *plane, static const struct drm_plane_funcs vc4_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, @@ -67050,7 +66711,7 @@ index af4b8944a603..766280a844f4 100644 .set_property = NULL, .reset = vc4_plane_reset, .atomic_duplicate_state = vc4_plane_duplicate_state, -@@ -1352,8 +1514,11 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev, +@@ -1348,8 +1514,11 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev, struct drm_plane *plane = NULL; struct vc4_plane *vc4_plane; u32 formats[ARRAY_SIZE(hvs_formats)]; @@ -67062,7 +66723,7 @@ index af4b8944a603..766280a844f4 100644 static const uint64_t modifiers[] = { DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED, DRM_FORMAT_MOD_BROADCOM_SAND128, -@@ -1368,13 +1533,17 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev, +@@ -1364,13 +1533,17 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev, if (!vc4_plane) return ERR_PTR(-ENOMEM); @@ -67083,7 +66744,7 @@ index af4b8944a603..766280a844f4 100644 modifiers, type, NULL); if (ret) return ERR_PTR(ret); -@@ -1382,12 +1551,25 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev, +@@ -1378,12 +1551,25 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev, drm_plane_helper_add(plane, &vc4_plane_helper_funcs); drm_plane_create_alpha_property(plane); @@ -68437,7 +68098,7 @@ index 5259ff2825f9..904f62f3bfc1 100644 struct drm_pending_vblank_event *event = crtc->state->event; diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h -index 3744c3db5140..7284ca3a2326 100644 +index bb096dfb7b36..09d605f73e10 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -221,6 +221,9 @@ @@ -68450,7 +68111,7 @@ index 3744c3db5140..7284ca3a2326 100644 #define USB_VENDOR_ID_BELKIN 0x050d #define USB_DEVICE_ID_FLIP_KVM 0x3201 -@@ -1271,6 +1274,9 @@ +@@ -1273,6 +1276,9 @@ #define USB_VENDOR_ID_XAT 0x2505 #define USB_DEVICE_ID_XAT_CSR 0x0220 @@ -69063,7 +68724,7 @@ index 000000000000..8483b6ce1db8 +MODULE_DESCRIPTION("Raspberry Pi PoE HAT fan driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig -index 9535e995ecc9..aacfd573d394 100644 +index 5763a1e9360b..e5582930c720 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -9,6 +9,25 @@ menu "I2C Hardware Bus support" @@ -69093,7 +68754,7 @@ index 9535e995ecc9..aacfd573d394 100644 tristate "ALI 1535" depends on PCI diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile -index e6d5d108e22b..b8e5bfd23158 100644 +index 280e05622d50..42c272f5205b 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile @@ -3,6 +3,8 @@ @@ -85205,7 +84866,7 @@ index 6d6d30dbbe68..2ee902f64ddc 100644 default: /* Compressed formats */ diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c -index 73190652c267..859bf4f535d4 100644 +index ad14d5214106..9ddbb7a1e96b 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c @@ -301,9 +301,10 @@ static void __v4l2_m2m_try_queue(struct v4l2_m2m_dev *m2m_dev, @@ -86515,7 +86176,7 @@ index 000000000000..f1a7f6a3e966 +MODULE_DESCRIPTION("Device driver for BCM2835's secondary memory interface"); +MODULE_AUTHOR("Luke Wren "); diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c -index 70eb3d03937f..e5deccee8673 100644 +index 66a00b7c751f..511dc5f5ee25 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -165,6 +165,13 @@ static DEFINE_MUTEX(open_lock); @@ -96313,7 +95974,7 @@ index 000000000000..2c3fabd38b16 +MODULE_DESCRIPTION("Realtek USB ECM device"); +MODULE_LICENSE("GPL"); diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -index e5b744851146..75bc32947c90 100644 +index 65d42f5d42a3..bd5ab236ca13 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -50,6 +50,7 @@ @@ -96343,7 +96004,7 @@ index e5b744851146..75bc32947c90 100644 static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, u32 *data, int in_pm) { -@@ -765,6 +778,53 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) +@@ -763,6 +776,53 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) return phy_mii_ioctl(netdev->phydev, rq, cmd); } @@ -96397,7 +96058,7 @@ index e5b744851146..75bc32947c90 100644 static void smsc95xx_init_mac_address(struct usbnet *dev) { /* maybe the boot loader passed the MAC address in devicetree */ -@@ -787,6 +847,10 @@ static void smsc95xx_init_mac_address(struct usbnet *dev) +@@ -785,6 +845,10 @@ static void smsc95xx_init_mac_address(struct usbnet *dev) } } @@ -96408,7 +96069,7 @@ index e5b744851146..75bc32947c90 100644 /* no useful static MAC address found. generate a random one */ eth_hw_addr_random(dev->net); netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); -@@ -913,13 +977,13 @@ static int smsc95xx_reset(struct usbnet *dev) +@@ -911,13 +975,13 @@ static int smsc95xx_reset(struct usbnet *dev) if (!turbo_mode) { burst_cap = 0; @@ -96427,7 +96088,7 @@ index e5b744851146..75bc32947c90 100644 } netif_dbg(dev, ifup, dev->net, "rx_urb_size=%ld\n", -@@ -1839,7 +1903,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) +@@ -1838,7 +1902,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) if (dev->net->features & NETIF_F_RXCSUM) smsc95xx_rx_csum_offload(skb); skb_trim(skb, skb->len - 4); /* remove fcs */ @@ -96437,7 +96098,7 @@ index e5b744851146..75bc32947c90 100644 return 1; } -@@ -1857,7 +1922,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) +@@ -1856,7 +1921,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) if (dev->net->features & NETIF_F_RXCSUM) smsc95xx_rx_csum_offload(ax_skb); skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */ @@ -96477,7 +96138,7 @@ index 3f5da3bb6aa5..ba3c58caac9f 100644 static inline diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -index c2b6e5c966d0..e51b42b547be 100644 +index 300c63d75df2..923b7559efb6 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -9,6 +9,7 @@ @@ -96505,7 +96166,7 @@ index c2b6e5c966d0..e51b42b547be 100644 err = brcmf_fil_iovar_int_set(ifp, "pm2_sleep_ret", min_t(u32, timeout, BRCMF_PS_MAX_TIMEOUT_MS)); if (err) -@@ -7356,12 +7358,18 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], +@@ -7361,12 +7363,18 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], struct brcmfmac_pd_cc *country_codes; struct brcmfmac_pd_cc_entry *cc; s32 found_index; @@ -96526,7 +96187,7 @@ index c2b6e5c966d0..e51b42b547be 100644 } if ((alpha2[0] == ccreq->country_abbrev[0]) && -@@ -7385,10 +7393,14 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], +@@ -7390,10 +7398,14 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], brcmf_dbg(TRACE, "No country code match found\n"); return -EINVAL; } @@ -96544,7 +96205,7 @@ index c2b6e5c966d0..e51b42b547be 100644 ccreq->country_abbrev[0] = alpha2[0]; ccreq->country_abbrev[1] = alpha2[1]; ccreq->country_abbrev[2] = 0; -@@ -7403,31 +7415,45 @@ static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy, +@@ -7408,31 +7420,45 @@ static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy, struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); struct brcmf_pub *drvr = cfg->pub; struct brcmf_fil_country_le ccreq; @@ -99197,7 +98858,7 @@ index 1e0041ec8132..6059210170bc 100644 if (id != 0x62726467 /* "BRDG" */) { dev_err(dev, "ASB register ID returned 0x%08x\n", id); diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c -index 33c32e931767..0f6a2f7c8b53 100644 +index bb9d8386ba3b..417b37084551 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c @@ -28,6 +28,7 @@ @@ -99236,7 +98897,7 @@ index 33c32e931767..0f6a2f7c8b53 100644 /* set clock */ spi_hz = tfr->speed_hz; -@@ -1285,6 +1300,11 @@ static int bcm2835_spi_probe(struct platform_device *pdev) +@@ -1289,6 +1304,11 @@ static int bcm2835_spi_probe(struct platform_device *pdev) struct bcm2835_spi *bs; int err; @@ -99248,7 +98909,7 @@ index 33c32e931767..0f6a2f7c8b53 100644 ctlr = devm_spi_alloc_master(&pdev->dev, ALIGN(sizeof(*bs), dma_get_cache_alignment())); if (!ctlr) -@@ -1329,7 +1349,8 @@ static int bcm2835_spi_probe(struct platform_device *pdev) +@@ -1333,7 +1353,8 @@ static int bcm2835_spi_probe(struct platform_device *pdev) bcm2835_wr(bs, BCM2835_SPI_CS, BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX); @@ -116069,10 +115730,10 @@ index 26f9fb9f67ca..fe8c7a85e141 100644 return i; } diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c -index bf5e37667697..0b7d73e979e0 100644 +index ac347f9d5ef0..ea7c074c98aa 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c -@@ -1966,6 +1966,16 @@ int usb_hcd_alloc_bandwidth(struct usb_device *udev, +@@ -1969,6 +1969,16 @@ int usb_hcd_alloc_bandwidth(struct usb_device *udev, return ret; } @@ -116090,7 +115751,7 @@ index bf5e37667697..0b7d73e979e0 100644 * endpoint state is gone from hardware. usb_hcd_flush_endpoint() must * have been called previously. Use for set_configuration, set_interface, diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 18ee3914b468..6ab15e05a6f9 100644 +index f2a3c0b5b535..2cb336e517fe 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -5506,7 +5506,7 @@ static void port_event(struct usb_hub *hub, int port1) @@ -176318,20 +175979,21 @@ index 4aab93d5b651..f482c43bc64e 100644 "// Write ERST size = %i to ir_set 0 (some bits preserved)", val); diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c -index c4cf3b138131..c3479d595bc7 100644 +index c4cf3b138131..8667c442475b 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -305,6 +305,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) +@@ -305,6 +305,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) { xhci->quirks |= XHCI_LPM_SUPPORT; xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; + xhci->quirks |= XHCI_AVOID_DQ_ON_LINK; + xhci->quirks |= XHCI_VLI_TRB_CACHE_BUG; ++ xhci->quirks |= XHCI_VLI_SS_BULK_OUT_BUG; } if (pdev->vendor == PCI_VENDOR_ID_ZHAOXIN && diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c -index fa3a7ac15f82..b01cc54aeef6 100644 +index fa3a7ac15f82..4fa23c9f0f87 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -87,15 +87,16 @@ static bool trb_is_link(union xhci_trb *trb) @@ -176403,7 +176065,55 @@ index fa3a7ac15f82..b01cc54aeef6 100644 continue; xhci_update_erst_dequeue(xhci, event_ring_deq); event_ring_deq = xhci->event_ring->dequeue; -@@ -4260,9 +4278,9 @@ void xhci_queue_new_dequeue_state(struct xhci_hcd *xhci, +@@ -3398,14 +3416,15 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, + unsigned int num_trbs; + unsigned int start_cycle, num_sgs = 0; + unsigned int enqd_len, block_len, trb_buff_len, full_len; +- int sent_len, ret; +- u32 field, length_field, remainder; ++ int sent_len, ret, vli_quirk = 0; ++ u32 field, length_field, remainder, maxpacket; + u64 addr, send_addr; + + ring = xhci_urb_to_transfer_ring(xhci, urb); + if (!ring) + return -EINVAL; + ++ maxpacket = usb_endpoint_maxp(&urb->ep->desc); + full_len = urb->transfer_buffer_length; + /* If we have scatter/gather list, we use it. */ + if (urb->num_sgs) { +@@ -3442,6 +3461,17 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, + start_cycle = ring->cycle_state; + send_addr = addr; + ++ if (xhci->quirks & XHCI_VLI_SS_BULK_OUT_BUG && ++ !usb_urb_dir_in(urb) && urb->dev->speed >= USB_SPEED_SUPER) { ++ /* ++ * VL805 - superspeed bulk OUT traffic can cause ++ * an internal fifo overflow if the TRB buffer is larger ++ * than wMaxPacket and the length is not an integer ++ * multiple of wMaxPacket. ++ */ ++ vli_quirk = 1; ++ } ++ + /* Queue the TRBs, even if they are zero-length */ + for (enqd_len = 0; first_trb || enqd_len < full_len; + enqd_len += trb_buff_len) { +@@ -3454,6 +3484,11 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, + if (enqd_len + trb_buff_len > full_len) + trb_buff_len = full_len - enqd_len; + ++ if (vli_quirk && trb_buff_len > maxpacket) { ++ /* SS bulk wMaxPacket is 1024B */ ++ remainder = trb_buff_len & (maxpacket - 1); ++ trb_buff_len -= remainder; ++ } + /* Don't change the cycle bit of the first TRB until later */ + if (first_trb) { + first_trb = false; +@@ -4260,9 +4295,9 @@ void xhci_queue_new_dequeue_state(struct xhci_hcd *xhci, } ep = &xhci->devs[slot_id]->eps[ep_index]; if ((ep->ep_state & SET_DEQ_PENDING)) { @@ -176417,10 +176127,10 @@ index fa3a7ac15f82..b01cc54aeef6 100644 /* This function gets called from contexts where it cannot sleep */ diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c -index 1c32b40b4316..51c86b6f8634 100644 +index e390f64d0f04..e167b67c7521 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -878,8 +878,8 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci) +@@ -869,8 +869,8 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci) seg = ring->deq_seg; do { memset(seg->trbs, 0, @@ -176431,7 +176141,7 @@ index 1c32b40b4316..51c86b6f8634 100644 cpu_to_le32(~TRB_CYCLE); seg = seg->next; } while (seg != ring->deq_seg); -@@ -890,7 +890,7 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci) +@@ -881,7 +881,7 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci) ring->enq_seg = ring->deq_seg; ring->enqueue = ring->dequeue; @@ -176440,7 +176150,7 @@ index 1c32b40b4316..51c86b6f8634 100644 /* * Ring is now zeroed, so the HW should look for change of ownership * when the cycle bit is set to 1. -@@ -1493,6 +1493,103 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, +@@ -1484,6 +1484,103 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, return ret; } @@ -176544,7 +176254,7 @@ index 1c32b40b4316..51c86b6f8634 100644 /* * non-error returns are a promise to giveback() the urb later * we drop ownership so next owner (or urb unlink) can get it -@@ -5449,6 +5546,7 @@ static const struct hc_driver xhci_hc_driver = { +@@ -5440,6 +5537,7 @@ static const struct hc_driver xhci_hc_driver = { .endpoint_reset = xhci_endpoint_reset, .check_bandwidth = xhci_check_bandwidth, .reset_bandwidth = xhci_reset_bandwidth, @@ -176553,7 +176263,7 @@ index 1c32b40b4316..51c86b6f8634 100644 .enable_device = xhci_enable_device, .update_hub_device = xhci_update_hub_device, diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h -index edf423afd545..56605cb6a276 100644 +index 02772b274224..29fe0326b9d1 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1618,6 +1618,7 @@ struct xhci_ring { @@ -176575,12 +176285,13 @@ index edf423afd545..56605cb6a276 100644 /* Initial allocated size of the ERST, in number of entries */ #define ERST_SIZE 64 /* Initial number of event segment rings allocated */ -@@ -1890,6 +1891,8 @@ struct xhci_hcd { +@@ -1890,6 +1891,9 @@ struct xhci_hcd { #define XHCI_ZHAOXIN_HOST BIT_ULL(41) #define XHCI_ZHAOXIN_TRB_FETCH BIT_ULL(42) #define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(43) +#define XHCI_AVOID_DQ_ON_LINK BIT_ULL(44) +#define XHCI_VLI_TRB_CACHE_BUG BIT_ULL(45) ++#define XHCI_VLI_SS_BULK_OUT_BUG BIT_ULL(46) unsigned int num_active_eps; unsigned int limit_active_eps; @@ -182662,10 +182373,10 @@ index 000000000000..6ca874d332a8 + +#endif /* _PLAT_BCM2708_DMA_H */ diff --git a/include/linux/usb.h b/include/linux/usb.h -index d6a41841b93e..32be892f53cf 100644 +index a093667991bb..f2da7ddacf3f 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h -@@ -1838,6 +1838,8 @@ extern int usb_clear_halt(struct usb_device *dev, int pipe); +@@ -1840,6 +1840,8 @@ extern int usb_clear_halt(struct usb_device *dev, int pipe); extern int usb_reset_configuration(struct usb_device *dev); extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate); extern void usb_reset_endpoint(struct usb_device *dev, unsigned int epaddr); @@ -182675,10 +182386,10 @@ index d6a41841b93e..32be892f53cf 100644 /* this request isn't really synchronous, but it belongs with the others */ extern int usb_driver_set_configuration(struct usb_device *udev, int config); diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h -index 9f05016d823f..710e24d74759 100644 +index c0cf20b19e63..a1bf853660c3 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h -@@ -384,6 +384,11 @@ struct hc_driver { +@@ -385,6 +385,11 @@ struct hc_driver { * or bandwidth constraints. */ void (*reset_bandwidth)(struct usb_hcd *, struct usb_device *); @@ -182690,7 +182401,7 @@ index 9f05016d823f..710e24d74759 100644 /* Returns the hardware-chosen device address */ int (*address_device)(struct usb_hcd *, struct usb_device *udev); /* prepares the hardware to send commands to the device */ -@@ -445,6 +450,8 @@ extern void usb_hcd_unmap_urb_setup_for_dma(struct usb_hcd *, struct urb *); +@@ -446,6 +451,8 @@ extern void usb_hcd_unmap_urb_setup_for_dma(struct usb_hcd *, struct urb *); extern void usb_hcd_unmap_urb_for_dma(struct usb_hcd *, struct urb *); extern void usb_hcd_flush_endpoint(struct usb_device *udev, struct usb_host_endpoint *ep); @@ -183559,10 +183270,10 @@ index 534eaa4d39bc..53d526dbe004 100644 /* priv field value to indicates that subsequent fields are valid. */ #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c -index 57f4e19df8c6..ba2f699d62cc 100644 +index 41dde1800526..6cf13f32f9b1 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c -@@ -5865,6 +5865,9 @@ int __init cgroup_init_early(void) +@@ -5910,6 +5910,9 @@ int __init cgroup_init_early(void) return 0; } @@ -183572,7 +183283,7 @@ index 57f4e19df8c6..ba2f699d62cc 100644 /** * cgroup_init - cgroup initialization * -@@ -5903,6 +5906,12 @@ int __init cgroup_init(void) +@@ -5948,6 +5951,12 @@ int __init cgroup_init(void) mutex_unlock(&cgroup_mutex); @@ -183585,7 +183296,7 @@ index 57f4e19df8c6..ba2f699d62cc 100644 for_each_subsys(ss, ssid) { if (ss->early_init) { struct cgroup_subsys_state *css = -@@ -6461,6 +6470,10 @@ static int __init cgroup_disable(char *str) +@@ -6545,6 +6554,10 @@ static int __init cgroup_disable(char *str) strcmp(token, ss->legacy_name)) continue; @@ -183596,7 +183307,7 @@ index 57f4e19df8c6..ba2f699d62cc 100644 static_branch_disable(cgroup_subsys_enabled_key[i]); pr_info("Disabling %s control group subsystem\n", ss->name); -@@ -6470,6 +6483,31 @@ static int __init cgroup_disable(char *str) +@@ -6554,6 +6567,31 @@ static int __init cgroup_disable(char *str) } __setup("cgroup_disable=", cgroup_disable); @@ -183646,10 +183357,10 @@ index 817545ff80b9..375a43d99b28 100644 for (;;) { tmp = *p; diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index ff6fffec8770..eea54e228d9e 100644 +index 12da70f39e0c..d28541e15f33 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c -@@ -8906,8 +8906,6 @@ int alloc_contig_range(unsigned long start, unsigned long end, +@@ -9155,8 +9155,6 @@ int alloc_contig_range(unsigned long start, unsigned long end, /* Make sure the range is really isolated. */ if (test_pages_isolated(outer_start, end, 0)) { @@ -183659,21 +183370,21 @@ index ff6fffec8770..eea54e228d9e 100644 goto done; } diff --git a/mm/zswap.c b/mm/zswap.c -index 358f48b173dc..030254e040b5 100644 +index d8e8d0084a22..0be41c8e8fd3 100644 --- a/mm/zswap.c +++ b/mm/zswap.c -@@ -648,8 +648,9 @@ static struct zswap_pool *zswap_pool_create(char *type, char *compressor) +@@ -653,8 +653,9 @@ static struct zswap_pool *zswap_pool_create(char *type, char *compressor) return NULL; } --static __init struct zswap_pool *__zswap_pool_create_fallback(void) +-static struct zswap_pool *__zswap_pool_create_fallback(void) +static bool zswap_try_pool_create(void) { + struct zswap_pool *pool; bool has_comp, has_zpool; has_comp = crypto_has_acomp(zswap_compressor, 0, 0); -@@ -685,9 +686,21 @@ static __init struct zswap_pool *__zswap_pool_create_fallback(void) +@@ -690,9 +691,21 @@ static struct zswap_pool *__zswap_pool_create_fallback(void) } if (!has_comp || !has_zpool) @@ -183697,24 +183408,32 @@ index 358f48b173dc..030254e040b5 100644 } static void zswap_pool_destroy(struct zswap_pool *pool) -@@ -860,16 +873,19 @@ static int zswap_zpool_param_set(const char *val, +@@ -871,24 +884,19 @@ static int zswap_zpool_param_set(const char *val, static int zswap_enabled_param_set(const char *val, const struct kernel_param *kp) { +- if (system_state == SYSTEM_RUNNING) { +- mutex_lock(&zswap_init_lock); +- if (zswap_setup()) { +- mutex_unlock(&zswap_init_lock); +- return -ENODEV; +- } +- mutex_unlock(&zswap_init_lock); +- } + int ret; + - if (zswap_init_failed) { + if (zswap_init_state == ZSWAP_INIT_FAILED) { pr_err("can't enable, initialization failed\n"); return -ENODEV; } -- if (!zswap_has_pool && zswap_init_started) { +- if (!zswap_has_pool && zswap_init_state == ZSWAP_INIT_SUCCEED) { - pr_err("can't enable, no pool configured\n"); - return -ENODEV; - } - return param_set_bool(val, kp); + ret = param_set_bool(val, kp); -+ if (!ret && zswap_enabled && zswap_init_started && !zswap_has_pool) ++ if (!ret && zswap_enabled && zswap_init_state == ZSWAP_INIT_SUCCEED && !zswap_has_pool) + if (!zswap_try_pool_create()) + ret = -ENODEV; + @@ -183722,15 +183441,15 @@ index 358f48b173dc..030254e040b5 100644 } /********************************* -@@ -1439,7 +1455,6 @@ static void __exit zswap_debugfs_exit(void) { } - **********************************/ - static int __init init_zswap(void) +@@ -1455,7 +1463,6 @@ static void __exit zswap_debugfs_exit(void) { } + + static int zswap_setup(void) { - struct zswap_pool *pool; int ret; - zswap_init_started = true; -@@ -1463,29 +1478,19 @@ static int __init init_zswap(void) + if (zswap_init_state != ZSWAP_UNINIT) +@@ -1480,30 +1487,20 @@ static int zswap_setup(void) if (ret) goto hp_fail; @@ -183753,6 +183472,7 @@ index 358f48b173dc..030254e040b5 100644 frontswap_register_ops(&zswap_frontswap_ops); if (zswap_debugfs_init()) pr_warn("debugfs initialization failed\n"); + zswap_init_state = ZSWAP_INIT_SUCCEED; + + if (zswap_enabled) + zswap_try_pool_create(); @@ -199570,7 +199290,7 @@ index 1ac91c46da3c..6dd5aac4c319 100644 /* Creative BT-D1 */ USB_DEVICE(0x041e, 0x0005), diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c -index 6333a2ecb848..e5cb6daf2747 100644 +index 41f5d8242478..6edc611e8819 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -531,6 +531,11 @@ static int setup_disable_autosuspend(struct snd_usb_audio *chip, @@ -199594,5 +199314,5 @@ index 6333a2ecb848..e5cb6daf2747 100644 } -- -2.27.0 +2.33.0 diff --git a/raspberrypi-kernel.spec b/raspberrypi-kernel.spec index 08bb87d..4ae9511 100644 --- a/raspberrypi-kernel.spec +++ b/raspberrypi-kernel.spec @@ -2,13 +2,13 @@ %global KernelVer %{version}-%{release}.raspi.%{_target_cpu} -%global hulkrelease 126.0.0 +%global hulkrelease 146.0.0 %global debug_package %{nil} Name: raspberrypi-kernel Version: 5.10.0 -Release: %{hulkrelease}.13 +Release: %{hulkrelease}.14 Summary: Linux Kernel License: GPLv2 URL: http://www.kernel.org/ @@ -166,6 +166,9 @@ install -m 644 /boot/dtb-%{KernelVer}/overlays/README /boot/overlays/ /lib/modules/%{KernelVer} %changelog +* Wed Apr 19 2023 Yafen Fang - 5.10.0-146.0.0.14 +- update kernel version to openEuler 5.10.0-146.0.0 + * Wed Nov 9 2022 Yafen Fang - 5.10.0-126.0.0.13 - update kernel version to openEuler 5.10.0-126.0.0