From 06bfa28004e1c2f9039454b8949a394f771bbf19 Mon Sep 17 00:00:00 2001 From: Jernej Skrabec Date: Sun, 11 Oct 2020 21:49:23 +0200 Subject: [PATCH 1/6] linux: Update to 5.9 --- packages/linux/package.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/linux/package.mk b/packages/linux/package.mk index 3892cd485a..d7f1d41fa4 100644 --- a/packages/linux/package.mk +++ b/packages/linux/package.mk @@ -22,8 +22,8 @@ case "$LINUX" in PKG_SOURCE_NAME="linux-$LINUX-$PKG_VERSION.tar.gz" ;; *) - PKG_VERSION="5.8.7" - PKG_SHA256="7b0bf5029c94df72d1244b6b77e79e376cff2817a782c3ac50767a4121fd17fe" + PKG_VERSION="5.9" + PKG_SHA256="3239a4ee1250bf2048be988cc8cb46c487b2c8a0de5b1b032d38394d5c6b1a06" PKG_URL="https://www.kernel.org/pub/linux/kernel/v5.x/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_PATCH_DIRS="default" ;; From 136b66990b026b8879bf5a59e98cee808e7f6cec Mon Sep 17 00:00:00 2001 From: Jernej Skrabec Date: Mon, 12 Oct 2020 18:06:53 +0200 Subject: [PATCH 2/6] Generic: Update kernel config to 5.9 --- projects/Generic/linux/linux.x86_64.conf | 81 ++++++++++++++---------- 1 file changed, 48 insertions(+), 33 deletions(-) diff --git a/projects/Generic/linux/linux.x86_64.conf b/projects/Generic/linux/linux.x86_64.conf index 83135e9b40..075b34f7c1 100644 --- a/projects/Generic/linux/linux.x86_64.conf +++ b/projects/Generic/linux/linux.x86_64.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86 5.8.7 Kernel Configuration +# Linux/x86 5.9.0 Kernel Configuration # CONFIG_CC_VERSION_TEXT="x86_64-libreelec-linux-gnu-gcc-10.2.0 (GCC) 10.2.0" CONFIG_CC_IS_GCC=y @@ -29,12 +29,14 @@ CONFIG_HAVE_KERNEL_LZMA=y CONFIG_HAVE_KERNEL_XZ=y CONFIG_HAVE_KERNEL_LZO=y CONFIG_HAVE_KERNEL_LZ4=y +CONFIG_HAVE_KERNEL_ZSTD=y # CONFIG_KERNEL_GZIP is not set # CONFIG_KERNEL_BZIP2 is not set # CONFIG_KERNEL_LZMA is not set CONFIG_KERNEL_XZ=y # CONFIG_KERNEL_LZO is not set # CONFIG_KERNEL_LZ4 is not set +# CONFIG_KERNEL_ZSTD is not set CONFIG_DEFAULT_INIT="" CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" CONFIG_SWAP=y @@ -77,6 +79,8 @@ CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y CONFIG_GENERIC_CMOS_UPDATE=y +CONFIG_HAVE_POSIX_CPU_TIMERS_TASK_WORK=y +CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y # # Timers subsystem @@ -101,7 +105,6 @@ CONFIG_TICK_CPU_ACCOUNTING=y # CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set # CONFIG_IRQ_TIME_ACCOUNTING is not set CONFIG_HAVE_SCHED_AVG_IRQ=y -# CONFIG_SCHED_THERMAL_PRESSURE is not set CONFIG_BSD_PROCESS_ACCT=y # CONFIG_BSD_PROCESS_ACCT_V3 is not set # CONFIG_TASKSTATS is not set @@ -186,6 +189,8 @@ CONFIG_INITRAMFS_ROOT_GID=0 # CONFIG_RD_XZ is not set # CONFIG_RD_LZO is not set # CONFIG_RD_LZ4 is not set +CONFIG_RD_ZSTD=y +# CONFIG_INITRAMFS_COMPRESSION_ZSTD is not set CONFIG_INITRAMFS_COMPRESSION_NONE=y CONFIG_BOOT_CONFIG=y CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y @@ -314,6 +319,7 @@ CONFIG_HYPERVISOR_GUEST=y CONFIG_PARAVIRT=y # CONFIG_PARAVIRT_DEBUG is not set CONFIG_PARAVIRT_SPINLOCKS=y +CONFIG_X86_HV_CALLBACK_VECTOR=y # CONFIG_XEN is not set CONFIG_KVM_GUEST=y CONFIG_ARCH_CPUIDLE_HALTPOLL=y @@ -482,7 +488,6 @@ CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT=y CONFIG_ACPI_SPCR_TABLE=y CONFIG_ACPI_LPIT=y CONFIG_ACPI_SLEEP=y -# CONFIG_ACPI_PROCFS_POWER is not set CONFIG_ACPI_REV_OVERRIDE_POSSIBLE=y # CONFIG_ACPI_EC_DEBUGFS is not set # CONFIG_ACPI_AC is not set @@ -650,6 +655,7 @@ CONFIG_AS_TPAUSE=y # CONFIG_CRASH_CORE=y CONFIG_HOTPLUG_SMT=y +CONFIG_GENERIC_ENTRY=y CONFIG_HAVE_OPROFILE=y CONFIG_OPROFILE_NMI_TIMER=y CONFIG_KPROBES=y @@ -700,7 +706,6 @@ CONFIG_HAVE_ARCH_SECCOMP_FILTER=y CONFIG_SECCOMP_FILTER=y CONFIG_HAVE_ARCH_STACKLEAK=y CONFIG_HAVE_STACKPROTECTOR=y -CONFIG_CC_HAS_STACKPROTECTOR_NONE=y CONFIG_STACKPROTECTOR=y CONFIG_STACKPROTECTOR_STRONG=y CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES=y @@ -722,7 +727,6 @@ CONFIG_ARCH_MMAP_RND_BITS=28 CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y CONFIG_ARCH_MMAP_RND_COMPAT_BITS=8 CONFIG_HAVE_ARCH_COMPAT_MMAP_BASES=y -CONFIG_HAVE_COPY_THREAD_TLS=y CONFIG_HAVE_STACK_VALIDATION=y CONFIG_HAVE_RELIABLE_STACKTRACE=y CONFIG_OLD_SIGSUSPEND3=y @@ -856,7 +860,6 @@ CONFIG_SELECT_MEMORY_MODEL=y CONFIG_SPARSEMEM_MANUAL=y CONFIG_SPARSEMEM=y CONFIG_NEED_MULTIPLE_NODES=y -CONFIG_HAVE_MEMORY_PRESENT=y CONFIG_SPARSEMEM_EXTREME=y CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y CONFIG_SPARSEMEM_VMEMMAP=y @@ -2034,6 +2037,7 @@ CONFIG_VIA_VELOCITY=y # CONFIG_NET_SB1000 is not set CONFIG_MDIO_DEVICE=y CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVRES=y # CONFIG_MDIO_BCM_UNIMAC is not set # CONFIG_MDIO_BITBANG is not set # CONFIG_MDIO_MSCC_MIIM is not set @@ -2280,8 +2284,12 @@ CONFIG_MT76x2U=m CONFIG_MT7603E=m CONFIG_MT7615_COMMON=m CONFIG_MT7615E=m +CONFIG_MT7663_USB_SDIO_COMMON=m CONFIG_MT7663U=m +# CONFIG_MT7663S is not set CONFIG_MT7915E=m +CONFIG_WLAN_VENDOR_MICROCHIP=y +# CONFIG_WILC1000_SDIO is not set CONFIG_WLAN_VENDOR_RALINK=y CONFIG_RT2X00=m CONFIG_RT2400PCI=m @@ -2341,6 +2349,7 @@ CONFIG_RTW88_8723D=m CONFIG_RTW88_8822BE=m CONFIG_RTW88_8822CE=m CONFIG_RTW88_8723DE=m +CONFIG_RTW88_8821CE=m # CONFIG_RTW88_DEBUG is not set # CONFIG_RTW88_DEBUGFS is not set CONFIG_WLAN_VENDOR_RSI=y @@ -2685,6 +2694,7 @@ CONFIG_HW_RANDOM=m # CONFIG_HW_RANDOM_TIMERIOMEM is not set CONFIG_HW_RANDOM_INTEL=m CONFIG_HW_RANDOM_AMD=m +# CONFIG_HW_RANDOM_BA431 is not set # CONFIG_HW_RANDOM_VIA is not set CONFIG_HW_RANDOM_VIRTIO=m # CONFIG_APPLICOM is not set @@ -2845,6 +2855,7 @@ CONFIG_PINCTRL_BROXTON=y CONFIG_PINCTRL_CANNONLAKE=y CONFIG_PINCTRL_CEDARFORK=y CONFIG_PINCTRL_DENVERTON=y +CONFIG_PINCTRL_EMMITSBURG=y CONFIG_PINCTRL_GEMINILAKE=y CONFIG_PINCTRL_ICELAKE=y CONFIG_PINCTRL_JASPERLAKE=y @@ -2890,6 +2901,7 @@ CONFIG_GPIO_SYSFS=y # CONFIG_GPIO_MAX7300 is not set # CONFIG_GPIO_MAX732X is not set # CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCA9570 is not set # CONFIG_GPIO_PCF857X is not set # CONFIG_GPIO_TPIC2810 is not set # end of I2C GPIO expanders @@ -2943,6 +2955,7 @@ CONFIG_POWER_SUPPLY_HWMON=y # CONFIG_CHARGER_BQ2415X is not set # CONFIG_CHARGER_BQ24257 is not set # CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_BQ2515X is not set # CONFIG_CHARGER_BQ25890 is not set # CONFIG_CHARGER_SMB347 is not set # CONFIG_BATTERY_GAUGE_LTC2941 is not set @@ -2982,6 +2995,7 @@ CONFIG_SENSORS_AMD_ENERGY=m # CONFIG_SENSORS_ASB100 is not set # CONFIG_SENSORS_ASPEED is not set # CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_CORSAIR_CPRO is not set # CONFIG_SENSORS_DRIVETEMP is not set # CONFIG_SENSORS_DS620 is not set # CONFIG_SENSORS_DS1621 is not set @@ -3098,6 +3112,7 @@ CONFIG_SENSORS_W83627EHF=y # CONFIG_SENSORS_ACPI_POWER is not set CONFIG_SENSORS_ATK0110=m CONFIG_THERMAL=y +# CONFIG_THERMAL_NETLINK is not set CONFIG_THERMAL_STATISTICS=y CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 CONFIG_THERMAL_HWMON=y @@ -3207,7 +3222,6 @@ CONFIG_MFD_INTEL_LPSS_PCI=y # CONFIG_MFD_SI476X_CORE is not set # CONFIG_MFD_SM501 is not set # CONFIG_MFD_SKY81452 is not set -# CONFIG_MFD_SMSC is not set # CONFIG_ABX500_CORE is not set # CONFIG_MFD_SYSCON is not set # CONFIG_MFD_TI_AM335X_TSCADC is not set @@ -3267,6 +3281,7 @@ CONFIG_REGULATOR=y # CONFIG_REGULATOR_MAX77826 is not set # CONFIG_REGULATOR_MP8859 is not set # CONFIG_REGULATOR_MT6311 is not set +# CONFIG_REGULATOR_PCA9450 is not set # CONFIG_REGULATOR_PFUZE100 is not set # CONFIG_REGULATOR_PV88060 is not set # CONFIG_REGULATOR_PV88080 is not set @@ -3313,6 +3328,7 @@ CONFIG_IR_SERIAL=m CONFIG_IR_SERIAL_TRANSMITTER=y # CONFIG_IR_SIR is not set CONFIG_RC_XBOX_DVD=m +# CONFIG_IR_TOY is not set CONFIG_CEC_CORE=y # CONFIG_MEDIA_CEC_RC is not set # CONFIG_MEDIA_CEC_SUPPORT is not set @@ -3765,6 +3781,7 @@ CONFIG_SDR_MAX2175=m # CONFIG_VIDEO_SR030PC30 is not set # CONFIG_VIDEO_NOON010PC30 is not set # CONFIG_VIDEO_M5MOLS is not set +# CONFIG_VIDEO_RDACM20 is not set # CONFIG_VIDEO_RJ54N1 is not set # CONFIG_VIDEO_S5K6AA is not set # CONFIG_VIDEO_S5K6A3 is not set @@ -3780,6 +3797,7 @@ CONFIG_SDR_MAX2175=m # CONFIG_VIDEO_AD5820 is not set # CONFIG_VIDEO_AK7375 is not set # CONFIG_VIDEO_DW9714 is not set +# CONFIG_VIDEO_DW9768 is not set # CONFIG_VIDEO_DW9807_VCM is not set # end of Lens drivers @@ -4072,6 +4090,7 @@ CONFIG_DRM_AMD_ACP=y # CONFIG_DRM_AMD_DC=y CONFIG_DRM_AMD_DC_DCN=y +# CONFIG_DRM_AMD_DC_DCN3_0 is not set # CONFIG_DRM_AMD_DC_HDCP is not set # CONFIG_DEBUG_KERNEL_DC is not set # end of Display Engine Configuration @@ -4219,7 +4238,6 @@ CONFIG_FB_UDL=m # # CONFIG_LCD_CLASS_DEVICE is not set CONFIG_BACKLIGHT_CLASS_DEVICE=y -# CONFIG_BACKLIGHT_GENERIC is not set # CONFIG_BACKLIGHT_APPLE is not set # CONFIG_BACKLIGHT_QCOM_WLED is not set # CONFIG_BACKLIGHT_SAHARA is not set @@ -4238,9 +4256,6 @@ CONFIG_HDMI=y # Console display driver support # CONFIG_VGA_CONSOLE=y -CONFIG_VGACON_SOFT_SCROLLBACK=y -CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=256 -# CONFIG_VGACON_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT is not set CONFIG_DUMMY_CONSOLE=y CONFIG_DUMMY_CONSOLE_COLUMNS=80 CONFIG_DUMMY_CONSOLE_ROWS=25 @@ -4357,6 +4372,7 @@ CONFIG_SND_VIRTUOSO=m # HD-Audio # CONFIG_SND_HDA=m +CONFIG_SND_HDA_GENERIC_LEDS=y CONFIG_SND_HDA_INTEL=m CONFIG_SND_HDA_HWDEP=y CONFIG_SND_HDA_RECONFIG=y @@ -4377,6 +4393,7 @@ CONFIG_SND_HDA_CODEC_CMEDIA=m CONFIG_SND_HDA_CODEC_SI3054=m CONFIG_SND_HDA_GENERIC=m CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0 +# CONFIG_SND_HDA_INTEL_HDMI_SILENT_STREAM is not set # end of HD-Audio CONFIG_SND_HDA_CORE=m @@ -4565,7 +4582,7 @@ CONFIG_SND_SOC_MAX98357A=m # CONFIG_SND_SOC_MAX98504 is not set # CONFIG_SND_SOC_MAX9867 is not set CONFIG_SND_SOC_MAX98927=m -# CONFIG_SND_SOC_MAX98373 is not set +# CONFIG_SND_SOC_MAX98373_I2C is not set # CONFIG_SND_SOC_MAX98390 is not set # CONFIG_SND_SOC_MAX9860 is not set # CONFIG_SND_SOC_MSM8916_WCD_DIGITAL is not set @@ -4802,8 +4819,8 @@ CONFIG_USB_PCI=y CONFIG_USB_DEFAULT_PERSIST=y # CONFIG_USB_DYNAMIC_MINORS is not set # CONFIG_USB_OTG is not set -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_OTG_PRODUCTLIST is not set +# CONFIG_USB_OTG_DISABLE_EXTERNAL_HUB is not set # CONFIG_USB_LEDS_TRIGGER_USBPORT is not set CONFIG_USB_AUTOSUSPEND_DELAY=2 CONFIG_USB_MON=m @@ -5031,6 +5048,7 @@ CONFIG_MMC_TOSHIBA_PCI=y CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y CONFIG_LEDS_CLASS_FLASH=y +# CONFIG_LEDS_CLASS_MULTICOLOR is not set # CONFIG_LEDS_BRIGHTNESS_HW_CHANGED is not set # @@ -5046,10 +5064,6 @@ CONFIG_LEDS_CLASS_FLASH=y # CONFIG_LEDS_GPIO is not set # CONFIG_LEDS_LP3944 is not set # CONFIG_LEDS_LP3952 is not set -# CONFIG_LEDS_LP5521 is not set -# CONFIG_LEDS_LP5523 is not set -# CONFIG_LEDS_LP5562 is not set -# CONFIG_LEDS_LP8501 is not set # CONFIG_LEDS_CLEVO_MAIL is not set # CONFIG_LEDS_PCA955X is not set # CONFIG_LEDS_PCA963X is not set @@ -5093,7 +5107,7 @@ CONFIG_LEDS_TRIGGERS=y # CONFIG_LEDS_TRIGGER_PANIC is not set # CONFIG_LEDS_TRIGGER_NETDEV is not set # CONFIG_LEDS_TRIGGER_PATTERN is not set -# CONFIG_LEDS_TRIGGER_AUDIO is not set +CONFIG_LEDS_TRIGGER_AUDIO=m # CONFIG_ACCESSIBILITY is not set # CONFIG_INFINIBAND is not set CONFIG_EDAC_ATOMIC_SCRUB=y @@ -5202,6 +5216,7 @@ CONFIG_INTEL_IDMA64=m # CONFIG_INTEL_IDXD is not set CONFIG_INTEL_IOATDMA=m # CONFIG_PLX_DMA is not set +# CONFIG_XILINX_ZYNQMP_DPDMA is not set # CONFIG_QCOM_HIDMA_MGMT is not set # CONFIG_QCOM_HIDMA is not set CONFIG_DW_DMAC_CORE=m @@ -5275,20 +5290,9 @@ CONFIG_RTS5208=y # CONFIG_VT6655 is not set CONFIG_VT6656=m # CONFIG_FB_SM750 is not set - -# -# Speakup console speech -# -# CONFIG_SPEAKUP is not set -# end of Speakup console speech - CONFIG_STAGING_MEDIA=y # CONFIG_INTEL_ATOMISP is not set CONFIG_VIDEO_IPU3_IMGU=m - -# -# soc_camera sensor drivers -# # CONFIG_VIDEO_USBVISION is not set # @@ -5300,7 +5304,6 @@ CONFIG_VIDEO_IPU3_IMGU=m # CONFIG_FIREWIRE_SERIAL is not set # CONFIG_GS_FPGABOOT is not set # CONFIG_UNISYSSPAR is not set -# CONFIG_WILC1000_SDIO is not set # CONFIG_KS7010 is not set # @@ -5686,6 +5689,7 @@ CONFIG_SYSFS=y CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TMPFS_XATTR=y +# CONFIG_TMPFS_INODE64 is not set # CONFIG_HUGETLBFS is not set CONFIG_MEMFD_CREATE=y CONFIG_ARCH_HAS_GIGANTIC_PAGE=y @@ -6142,6 +6146,7 @@ CONFIG_XZ_DEC=y # CONFIG_XZ_DEC_ARMTHUMB is not set # CONFIG_XZ_DEC_SPARC is not set # CONFIG_XZ_DEC_TEST is not set +CONFIG_DECOMPRESS_ZSTD=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_INTERVAL_TREE=y CONFIG_XARRAY_MULTI=y @@ -6149,6 +6154,7 @@ CONFIG_ASSOCIATIVE_ARRAY=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y CONFIG_HAS_DMA=y +CONFIG_DMA_OPS=y CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y @@ -6182,6 +6188,8 @@ CONFIG_SBITMAP=y # CONFIG_STRING_SELFTEST is not set # end of Library routines +CONFIG_PLDMFW=y + # # Kernel hacking # @@ -6212,6 +6220,7 @@ CONFIG_STRIP_ASM_SYMS=y # CONFIG_HEADERS_INSTALL is not set # CONFIG_DEBUG_SECTION_MISMATCH is not set CONFIG_SECTION_MISMATCH_WARN_ONLY=y +# CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_32B is not set CONFIG_FRAME_POINTER=y CONFIG_STACK_VALIDATION=y # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set @@ -6225,10 +6234,14 @@ CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 CONFIG_MAGIC_SYSRQ_SERIAL=y CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE="" CONFIG_DEBUG_FS=y +CONFIG_DEBUG_FS_ALLOW_ALL=y +# CONFIG_DEBUG_FS_DISALLOW_MOUNT is not set +# CONFIG_DEBUG_FS_ALLOW_NONE is not set CONFIG_HAVE_ARCH_KGDB=y # CONFIG_KGDB is not set CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y # CONFIG_UBSAN is not set +CONFIG_HAVE_ARCH_KCSAN=y # end of Generic Kernel Debugging Instruments CONFIG_DEBUG_KERNEL=y @@ -6266,7 +6279,6 @@ CONFIG_HAVE_ARCH_KASAN_VMALLOC=y CONFIG_CC_HAS_KASAN_GENERIC=y CONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y # CONFIG_KASAN is not set -CONFIG_KASAN_STACK=1 # end of Memory Debugging # CONFIG_DEBUG_SHIRQ is not set @@ -6322,6 +6334,7 @@ CONFIG_LOCK_DEBUGGING_SUPPORT=y # end of Lock Debugging (spinlocks, mutexes, etc...) CONFIG_TRACE_IRQFLAGS=y +CONFIG_TRACE_IRQFLAGS_NMI=y CONFIG_STACKTRACE=y # CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set # CONFIG_DEBUG_KOBJECT is not set @@ -6343,6 +6356,7 @@ CONFIG_STACKTRACE=y # # CONFIG_RCU_PERF_TEST is not set # CONFIG_RCU_TORTURE_TEST is not set +# CONFIG_RCU_REF_SCALE_TEST is not set CONFIG_RCU_CPU_STALL_TIMEOUT=60 # CONFIG_RCU_TRACE is not set # CONFIG_RCU_EQS_DEBUG is not set @@ -6413,7 +6427,6 @@ CONFIG_FTRACE_MCOUNT_RECORD=y # CONFIG_KPROBE_EVENT_GEN_TEST is not set # CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set # CONFIG_SAMPLES is not set -CONFIG_HAVE_ARCH_KCSAN=y CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y CONFIG_STRICT_DEVMEM=y # CONFIG_IO_STRICT_DEVMEM is not set @@ -6422,6 +6435,7 @@ CONFIG_STRICT_DEVMEM=y # x86 Debugging # CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y # CONFIG_X86_VERBOSE_BOOTUP is not set # CONFIG_EARLY_PRINTK is not set # CONFIG_EFI_PGT_DUMP is not set @@ -6494,6 +6508,7 @@ CONFIG_RUNTIME_TESTING_MENU=y # CONFIG_TEST_MEMCAT_P is not set # CONFIG_TEST_STACKINIT is not set # CONFIG_TEST_MEMINIT is not set +# CONFIG_TEST_FPU is not set # CONFIG_MEMTEST is not set # end of Kernel Testing and Coverage # end of Kernel hacking From 2b6c562890b7f34449bf02faaab70b6987543f78 Mon Sep 17 00:00:00 2001 From: Jernej Skrabec Date: Sun, 11 Oct 2020 21:49:51 +0200 Subject: [PATCH 3/6] Allwinner: Update patches for Linux 5.9 --- .../linux/03_pine64_plus_ethernet_fixes.patch | 6 +- projects/Allwinner/linux/linux.aarch64.conf | 103 +++-- projects/Allwinner/linux/linux.arm.conf | 103 +++-- .../linux/0003-hdmi-improvements.patch | 410 ------------------ .../patches/linux/0007-drm-fixes.patch | 2 +- 5 files changed, 133 insertions(+), 491 deletions(-) diff --git a/projects/Allwinner/devices/A64/patches/linux/03_pine64_plus_ethernet_fixes.patch b/projects/Allwinner/devices/A64/patches/linux/03_pine64_plus_ethernet_fixes.patch index 6a02a0553e..3939673e64 100644 --- a/projects/Allwinner/devices/A64/patches/linux/03_pine64_plus_ethernet_fixes.patch +++ b/projects/Allwinner/devices/A64/patches/linux/03_pine64_plus_ethernet_fixes.patch @@ -62,9 +62,9 @@ index a669945eb829a..ace1a6340ca9c 100644 #include @@ -32,6 +33,13 @@ - #define RTL8211E_TX_DELAY BIT(1) - #define RTL8211E_RX_DELAY BIT(2) - #define RTL8211E_MODE_MII_GMII BIT(3) + #define RTL8211E_CTRL_DELAY BIT(13) + #define RTL8211E_TX_DELAY BIT(12) + #define RTL8211E_RX_DELAY BIT(11) +/* + * The following number resides in the same register with + * the delay bits and mode bit above. However, no known diff --git a/projects/Allwinner/linux/linux.aarch64.conf b/projects/Allwinner/linux/linux.aarch64.conf index ebf0a9b901..6b74b43dcc 100644 --- a/projects/Allwinner/linux/linux.aarch64.conf +++ b/projects/Allwinner/linux/linux.aarch64.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 5.8.0 Kernel Configuration +# Linux/arm64 5.9.0 Kernel Configuration # CONFIG_CC_VERSION_TEXT="aarch64-none-linux-gnu-gcc.real (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 20191025" CONFIG_CC_IS_GCC=y @@ -89,7 +89,7 @@ CONFIG_TICK_CPU_ACCOUNTING=y # CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set CONFIG_IRQ_TIME_ACCOUNTING=y CONFIG_HAVE_SCHED_AVG_IRQ=y -# CONFIG_SCHED_THERMAL_PRESSURE is not set +CONFIG_SCHED_THERMAL_PRESSURE=y CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT_V3=y CONFIG_TASKSTATS=y @@ -159,6 +159,7 @@ CONFIG_CGROUP_BPF=y CONFIG_SOCK_CGROUP_DATA=y CONFIG_NAMESPACES=y CONFIG_UTS_NS=y +CONFIG_TIME_NS=y CONFIG_IPC_NS=y CONFIG_USER_NS=y CONFIG_PID_NS=y @@ -177,7 +178,9 @@ CONFIG_INITRAMFS_ROOT_GID=0 # CONFIG_RD_XZ is not set # CONFIG_RD_LZO is not set CONFIG_RD_LZ4=y +CONFIG_RD_ZSTD=y CONFIG_INITRAMFS_COMPRESSION_LZ4=y +# CONFIG_INITRAMFS_COMPRESSION_ZSTD is not set # CONFIG_INITRAMFS_COMPRESSION_NONE is not set # CONFIG_BOOT_CONFIG is not set CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y @@ -286,10 +289,12 @@ CONFIG_ARCH_SUNXI=y # CONFIG_ARCH_BITMAIN is not set # CONFIG_ARCH_BRCMSTB is not set # CONFIG_ARCH_EXYNOS is not set +# CONFIG_ARCH_SPARX5 is not set # CONFIG_ARCH_K3 is not set # CONFIG_ARCH_LAYERSCAPE is not set # CONFIG_ARCH_LG1K is not set # CONFIG_ARCH_HISI is not set +# CONFIG_ARCH_KEEMBAY is not set # CONFIG_ARCH_MEDIATEK is not set # CONFIG_ARCH_MESON is not set # CONFIG_ARCH_MVEBU is not set @@ -399,7 +404,6 @@ CONFIG_CRASH_DUMP=y CONFIG_FORCE_MAX_ZONEORDER=11 CONFIG_UNMAP_KERNEL_AT_EL0=y CONFIG_HARDEN_BRANCH_PREDICTOR=y -CONFIG_HARDEN_EL2_VECTORS=y CONFIG_ARM64_SSBD=y CONFIG_RODATA_FULL_DEFAULT_ENABLED=y # CONFIG_ARM64_SW_TTBR0_PAN is not set @@ -441,6 +445,8 @@ CONFIG_AS_HAS_CFI_NEGATE_RA_STATE=y # ARMv8.4 architectural features # CONFIG_ARM64_AMU_EXTN=y +CONFIG_AS_HAS_ARMV8_4=y +CONFIG_ARM64_TLB_RANGE=y # end of ARMv8.4 architectural features # @@ -563,6 +569,7 @@ CONFIG_ARM_PSCI_FW=y # CONFIG_ARM_PSCI_CHECKER is not set CONFIG_HAVE_ARM_SMCCC=y CONFIG_HAVE_ARM_SMCCC_DISCOVERY=y +CONFIG_ARM_SMCCC_SOC_ID=y # # Tegra firmware driver @@ -634,7 +641,6 @@ CONFIG_HAVE_ARCH_SECCOMP_FILTER=y CONFIG_SECCOMP_FILTER=y CONFIG_HAVE_ARCH_STACKLEAK=y CONFIG_HAVE_STACKPROTECTOR=y -CONFIG_CC_HAS_STACKPROTECTOR_NONE=y CONFIG_STACKPROTECTOR=y CONFIG_STACKPROTECTOR_STRONG=y CONFIG_HAVE_CONTEXT_TRACKING=y @@ -650,7 +656,6 @@ CONFIG_ARCH_MMAP_RND_BITS=18 CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11 CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y -CONFIG_HAVE_COPY_THREAD_TLS=y CONFIG_CLONE_BACKWARDS=y CONFIG_OLD_SIGSUSPEND3=y CONFIG_COMPAT_OLD_SIGACTION=y @@ -765,7 +770,6 @@ CONFIG_SELECT_MEMORY_MODEL=y CONFIG_SPARSEMEM_MANUAL=y CONFIG_SPARSEMEM=y CONFIG_NEED_MULTIPLE_NODES=y -CONFIG_HAVE_MEMORY_PRESENT=y CONFIG_SPARSEMEM_EXTREME=y CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y CONFIG_SPARSEMEM_VMEMMAP=y @@ -1478,9 +1482,13 @@ CONFIG_MTD_CFI_I2=y # CONFIG_MTD_DOCG3 is not set # end of Self-contained MTD device drivers +# +# NAND +# # CONFIG_MTD_ONENAND is not set # CONFIG_MTD_RAW_NAND is not set # CONFIG_MTD_SPI_NAND is not set +# end of NAND # # LPDDR & LPDDR2 PCM memory drivers @@ -1490,7 +1498,6 @@ CONFIG_MTD_CFI_I2=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y -# CONFIG_SPI_CADENCE_QUADSPI is not set # CONFIG_MTD_UBI is not set # CONFIG_MTD_HYPERBUS is not set CONFIG_DTC=y @@ -1824,6 +1831,7 @@ CONFIG_NET_VENDOR_WIZNET=y # CONFIG_NET_VENDOR_XILINX is not set CONFIG_MDIO_DEVICE=y CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVRES=y # CONFIG_MDIO_BCM_UNIMAC is not set CONFIG_MDIO_BITBANG=y CONFIG_MDIO_BUS_MUX=y @@ -2007,7 +2015,10 @@ CONFIG_MT76x0U=m CONFIG_MT76x2_COMMON=m CONFIG_MT76x2U=m CONFIG_MT7615_COMMON=m +CONFIG_MT7663_USB_SDIO_COMMON=m CONFIG_MT7663U=m +# CONFIG_MT7663S is not set +# CONFIG_WLAN_VENDOR_MICROCHIP is not set CONFIG_WLAN_VENDOR_RALINK=y CONFIG_RT2X00=m CONFIG_RT2500USB=m @@ -2345,6 +2356,7 @@ CONFIG_SERIAL_DEV_CTRL_TTYPORT=y # CONFIG_IPMB_DEVICE_INTERFACE is not set CONFIG_HW_RANDOM=m # CONFIG_HW_RANDOM_TIMERIOMEM is not set +# CONFIG_HW_RANDOM_BA431 is not set # CONFIG_HW_RANDOM_CCTRNG is not set CONFIG_DEVMEM=y # CONFIG_RAW_DRIVER is not set @@ -2446,6 +2458,7 @@ CONFIG_SPI_MEM=y # CONFIG_SPI_AXI_SPI_ENGINE is not set # CONFIG_SPI_BITBANG is not set # CONFIG_SPI_CADENCE is not set +# CONFIG_SPI_CADENCE_QUADSPI is not set # CONFIG_SPI_DESIGNWARE is not set # CONFIG_SPI_NXP_FLEXSPI is not set # CONFIG_SPI_GPIO is not set @@ -2475,6 +2488,7 @@ CONFIG_SPI_SPIDEV=m # CONFIG_SPI_LOOPBACK_TEST is not set # CONFIG_SPI_TLE62X0 is not set # CONFIG_SPI_SLAVE is not set +CONFIG_SPI_DYNAMIC=y # CONFIG_SPMI is not set # CONFIG_HSI is not set CONFIG_PPS=y @@ -2578,6 +2592,7 @@ CONFIG_GPIO_XGENE=y # CONFIG_GPIO_MAX732X is not set CONFIG_GPIO_PCA953X=y CONFIG_GPIO_PCA953X_IRQ=y +# CONFIG_GPIO_PCA9570 is not set # CONFIG_GPIO_PCF857X is not set # CONFIG_GPIO_TPIC2810 is not set # end of I2C GPIO expanders @@ -2655,6 +2670,7 @@ CONFIG_AXP20X_POWER=y # CONFIG_CHARGER_BQ24190 is not set # CONFIG_CHARGER_BQ24257 is not set # CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_BQ2515X is not set # CONFIG_CHARGER_BQ25890 is not set # CONFIG_CHARGER_SMB347 is not set # CONFIG_BATTERY_GAUGE_LTC2941 is not set @@ -2689,6 +2705,7 @@ CONFIG_HWMON=y CONFIG_SENSORS_ARM_SCPI=y # CONFIG_SENSORS_ASPEED is not set # CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_CORSAIR_CPRO is not set # CONFIG_SENSORS_DRIVETEMP is not set # CONFIG_SENSORS_DS620 is not set # CONFIG_SENSORS_DS1621 is not set @@ -2804,6 +2821,7 @@ CONFIG_SENSORS_INA2XX=m # CONFIG_SENSORS_W83627HF is not set # CONFIG_SENSORS_W83627EHF is not set CONFIG_THERMAL=y +# CONFIG_THERMAL_NETLINK is not set # CONFIG_THERMAL_STATISTICS is not set CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 CONFIG_THERMAL_HWMON=y @@ -2818,7 +2836,6 @@ CONFIG_THERMAL_GOV_STEP_WISE=y # CONFIG_THERMAL_GOV_USER_SPACE is not set CONFIG_CPU_THERMAL=y CONFIG_CPU_FREQ_THERMAL=y -# CONFIG_CLOCK_THERMAL is not set # CONFIG_DEVFREQ_THERMAL is not set CONFIG_THERMAL_EMULATION=y # CONFIG_THERMAL_MMIO is not set @@ -2929,7 +2946,6 @@ CONFIG_MFD_SEC_CORE=y # CONFIG_MFD_SI476X_CORE is not set # CONFIG_MFD_SM501 is not set # CONFIG_MFD_SKY81452 is not set -# CONFIG_MFD_SMSC is not set # CONFIG_ABX500_CORE is not set # CONFIG_MFD_STMPE is not set # CONFIG_MFD_SUN6I_PRCM is not set @@ -2988,6 +3004,7 @@ CONFIG_REGULATOR_AXP20X=y # CONFIG_REGULATOR_DA9210 is not set # CONFIG_REGULATOR_DA9211 is not set CONFIG_REGULATOR_FAN53555=y +# CONFIG_REGULATOR_FAN53880 is not set CONFIG_REGULATOR_GPIO=y # CONFIG_REGULATOR_HI6421 is not set CONFIG_REGULATOR_HI6421V530=y @@ -3012,6 +3029,7 @@ CONFIG_REGULATOR_MAX77620=y # CONFIG_REGULATOR_MP886X is not set # CONFIG_REGULATOR_MPQ7920 is not set # CONFIG_REGULATOR_MT6311 is not set +# CONFIG_REGULATOR_PCA9450 is not set # CONFIG_REGULATOR_PFUZE100 is not set # CONFIG_REGULATOR_PV88060 is not set # CONFIG_REGULATOR_PV88080 is not set @@ -3024,6 +3042,7 @@ CONFIG_REGULATOR_S2MPS11=y # CONFIG_REGULATOR_SLG51000 is not set # CONFIG_REGULATOR_SY8106A is not set # CONFIG_REGULATOR_SY8824X is not set +# CONFIG_REGULATOR_SY8827N is not set # CONFIG_REGULATOR_TPS51632 is not set # CONFIG_REGULATOR_TPS62360 is not set # CONFIG_REGULATOR_TPS65023 is not set @@ -3064,16 +3083,18 @@ CONFIG_IR_TTUSBIR=m CONFIG_IR_GPIO_CIR=m CONFIG_IR_GPIO_TX=m # CONFIG_IR_PWM_TX is not set -CONFIG_IR_SUNXI=y +CONFIG_IR_SUNXI=m # CONFIG_IR_SERIAL is not set # CONFIG_IR_SIR is not set CONFIG_RC_XBOX_DVD=y +# CONFIG_IR_TOY is not set CONFIG_CEC_CORE=y CONFIG_CEC_NOTIFIER=y CONFIG_CEC_PIN=y # CONFIG_MEDIA_CEC_RC is not set # CONFIG_CEC_PIN_ERROR_INJ is not set CONFIG_MEDIA_CEC_SUPPORT=y +# CONFIG_CEC_CH7322 is not set # CONFIG_CEC_GPIO is not set CONFIG_USB_PULSE8_CEC=m CONFIG_USB_RAINSHADOW_CEC=m @@ -3339,7 +3360,6 @@ CONFIG_VIDEO_OV2640=m # CONFIG_VIDEO_OV2659 is not set # CONFIG_VIDEO_OV2680 is not set # CONFIG_VIDEO_OV2685 is not set -# CONFIG_VIDEO_OV2740 is not set # CONFIG_VIDEO_OV5640 is not set # CONFIG_VIDEO_OV5645 is not set # CONFIG_VIDEO_OV5647 is not set @@ -3369,6 +3389,7 @@ CONFIG_VIDEO_MT9V011=m # CONFIG_VIDEO_SR030PC30 is not set # CONFIG_VIDEO_NOON010PC30 is not set # CONFIG_VIDEO_M5MOLS is not set +# CONFIG_VIDEO_RDACM20 is not set # CONFIG_VIDEO_RJ54N1 is not set # CONFIG_VIDEO_S5K6AA is not set # CONFIG_VIDEO_S5K6A3 is not set @@ -3385,6 +3406,7 @@ CONFIG_VIDEO_MT9V011=m # CONFIG_VIDEO_AD5820 is not set # CONFIG_VIDEO_AK7375 is not set # CONFIG_VIDEO_DW9714 is not set +# CONFIG_VIDEO_DW9768 is not set # CONFIG_VIDEO_DW9807_VCM is not set # end of Lens drivers @@ -3729,7 +3751,7 @@ CONFIG_FB_MODE_HELPERS=y # # Frame buffer hardware drivers # -CONFIG_FB_ARMCLCD=y +# CONFIG_FB_ARMCLCD is not set # CONFIG_FB_OPENCORES is not set # CONFIG_FB_S1D13XXX is not set # CONFIG_FB_SMSCUFX is not set @@ -3758,7 +3780,6 @@ CONFIG_LCD_CLASS_DEVICE=m # CONFIG_LCD_HX8357 is not set # CONFIG_LCD_OTM3225A is not set CONFIG_BACKLIGHT_CLASS_DEVICE=y -CONFIG_BACKLIGHT_GENERIC=m CONFIG_BACKLIGHT_PWM=m # CONFIG_BACKLIGHT_QCOM_WLED is not set # CONFIG_BACKLIGHT_ADP8860 is not set @@ -3864,6 +3885,7 @@ CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y # CONFIG_SND_I2S_HI6210_I2S is not set # CONFIG_SND_SOC_IMG is not set +# CONFIG_SND_SOC_INTEL_KEEMBAY is not set # CONFIG_SND_SOC_MTK_BTCVSD is not set # CONFIG_SND_SOC_SOF_TOPLEVEL is not set @@ -3947,7 +3969,7 @@ CONFIG_SND_SOC_HDMI_CODEC=y # CONFIG_SND_SOC_MAX98504 is not set # CONFIG_SND_SOC_MAX9867 is not set # CONFIG_SND_SOC_MAX98927 is not set -# CONFIG_SND_SOC_MAX98373 is not set +# CONFIG_SND_SOC_MAX98373_I2C is not set # CONFIG_SND_SOC_MAX98390 is not set # CONFIG_SND_SOC_MAX9860 is not set # CONFIG_SND_SOC_MSM8916_WCD_DIGITAL is not set @@ -4181,8 +4203,8 @@ CONFIG_USB=y CONFIG_USB_DEFAULT_PERSIST=y # CONFIG_USB_DYNAMIC_MINORS is not set CONFIG_USB_OTG=y -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_OTG_PRODUCTLIST is not set +# CONFIG_USB_OTG_DISABLE_EXTERNAL_HUB is not set # CONFIG_USB_OTG_FSM is not set # CONFIG_USB_LEDS_TRIGGER_USBPORT is not set CONFIG_USB_AUTOSUSPEND_DELAY=2 @@ -4445,6 +4467,7 @@ CONFIG_MMC_SDHCI_XENON=y CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y # CONFIG_LEDS_CLASS_FLASH is not set +# CONFIG_LEDS_CLASS_MULTICOLOR is not set # CONFIG_LEDS_BRIGHTNESS_HW_CHANGED is not set # @@ -4464,10 +4487,7 @@ CONFIG_LEDS_CLASS=y CONFIG_LEDS_GPIO=y # CONFIG_LEDS_LP3944 is not set # CONFIG_LEDS_LP3952 is not set -# CONFIG_LEDS_LP5521 is not set -# CONFIG_LEDS_LP5523 is not set -# CONFIG_LEDS_LP5562 is not set -# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_LP55XX_COMMON is not set # CONFIG_LEDS_LP8860 is not set # CONFIG_LEDS_PCA955X is not set # CONFIG_LEDS_PCA963X is not set @@ -4656,6 +4676,7 @@ CONFIG_MV_XOR_V2=y CONFIG_PL330_DMA=y # CONFIG_XILINX_DMA is not set # CONFIG_XILINX_ZYNQMP_DMA is not set +# CONFIG_XILINX_ZYNQMP_DPDMA is not set CONFIG_QCOM_HIDMA_MGMT=y CONFIG_QCOM_HIDMA=y # CONFIG_DW_DMAC is not set @@ -4761,19 +4782,9 @@ CONFIG_RTL8723BS=m # end of Resolver to digital converters # end of IIO staging drivers -# -# Speakup console speech -# -# CONFIG_SPEAKUP is not set -# end of Speakup console speech - CONFIG_STAGING_MEDIA=y CONFIG_VIDEO_SUNXI=y CONFIG_VIDEO_SUNXI_CEDRUS=y - -# -# soc_camera sensor drivers -# CONFIG_VIDEO_USBVISION=m # @@ -4785,10 +4796,7 @@ CONFIG_VIDEO_USBVISION=m # CONFIG_LTE_GDM724X is not set # CONFIG_GS_FPGABOOT is not set # CONFIG_UNISYSSPAR is not set -# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set # CONFIG_FB_TFT is not set -# CONFIG_WILC1000_SDIO is not set -# CONFIG_WILC1000_SPI is not set # CONFIG_KS7010 is not set # CONFIG_PI433 is not set @@ -4808,6 +4816,7 @@ CONFIG_HAVE_CLK=y CONFIG_CLKDEV_LOOKUP=y CONFIG_HAVE_CLK_PREPARE=y CONFIG_COMMON_CLK=y +# CONFIG_CLK_HSDK is not set # CONFIG_COMMON_CLK_MAX77686 is not set # CONFIG_COMMON_CLK_MAX9485 is not set # CONFIG_COMMON_CLK_RK808 is not set @@ -5106,6 +5115,7 @@ CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 # CONFIG_CCS811 is not set # CONFIG_IAQCORE is not set # CONFIG_PMS7003 is not set +# CONFIG_SCD30_CORE is not set # CONFIG_SENSIRION_SGP30 is not set # CONFIG_SPS30 is not set # CONFIG_VZ89X is not set @@ -5237,6 +5247,8 @@ CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 # CONFIG_FXOS8700_I2C is not set # CONFIG_FXOS8700_SPI is not set # CONFIG_KMX61 is not set +# CONFIG_INV_ICM42600_I2C is not set +# CONFIG_INV_ICM42600_SPI is not set # CONFIG_INV_MPU6050_I2C is not set # CONFIG_INV_MPU6050_SPI is not set # CONFIG_IIO_ST_LSM6DSX is not set @@ -5637,6 +5649,7 @@ CONFIG_SYSFS=y CONFIG_TMPFS=y # CONFIG_TMPFS_POSIX_ACL is not set # CONFIG_TMPFS_XATTR is not set +# CONFIG_TMPFS_INODE64 is not set CONFIG_HUGETLBFS=y CONFIG_HUGETLB_PAGE=y CONFIG_MEMFD_CREATE=y @@ -5724,7 +5737,15 @@ CONFIG_SUNRPC_GSS=y CONFIG_SUNRPC_BACKCHANNEL=y # CONFIG_SUNRPC_DEBUG is not set # CONFIG_CEPH_FS is not set -# CONFIG_CIFS is not set +CONFIG_CIFS=y +CONFIG_CIFS_STATS2=y +CONFIG_CIFS_ALLOW_INSECURE_LEGACY=y +# CONFIG_CIFS_WEAK_PW_HASH is not set +# CONFIG_CIFS_UPCALL is not set +# CONFIG_CIFS_XATTR is not set +# CONFIG_CIFS_DEBUG is not set +# CONFIG_CIFS_DFS_UPCALL is not set +# CONFIG_CIFS_ROOT is not set # CONFIG_CODA_FS is not set # CONFIG_AFS_FS is not set CONFIG_9P_FS=y @@ -5885,7 +5906,7 @@ CONFIG_CRYPTO_ECDH=m # # Authenticated Encryption with Associated Data # -CONFIG_CRYPTO_CCM=m +CONFIG_CRYPTO_CCM=y CONFIG_CRYPTO_GCM=y # CONFIG_CRYPTO_CHACHA20POLY1305 is not set # CONFIG_CRYPTO_AEGIS128 is not set @@ -5936,7 +5957,7 @@ CONFIG_CRYPTO_MD5=y # CONFIG_CRYPTO_RMD320 is not set CONFIG_CRYPTO_SHA1=y CONFIG_CRYPTO_SHA256=y -CONFIG_CRYPTO_SHA512=m +CONFIG_CRYPTO_SHA512=y CONFIG_CRYPTO_SHA3=m CONFIG_CRYPTO_SM3=m # CONFIG_CRYPTO_STREEBOG is not set @@ -5996,7 +6017,7 @@ CONFIG_CRYPTO_HASH_INFO=y # Crypto library routines # CONFIG_CRYPTO_LIB_AES=y -CONFIG_CRYPTO_LIB_ARC4=m +CONFIG_CRYPTO_LIB_ARC4=y CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y CONFIG_CRYPTO_LIB_BLAKE2S=y CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=y @@ -6100,11 +6121,13 @@ CONFIG_XZ_DEC_SPARC=y CONFIG_XZ_DEC_BCJ=y # CONFIG_XZ_DEC_TEST is not set CONFIG_DECOMPRESS_LZ4=y +CONFIG_DECOMPRESS_ZSTD=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_XARRAY_MULTI=y CONFIG_ASSOCIATIVE_ARRAY=y CONFIG_HAS_IOMEM=y CONFIG_HAS_DMA=y +CONFIG_DMA_OPS=y CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y @@ -6144,6 +6167,7 @@ CONFIG_LIBFDT=y CONFIG_OID_REGISTRY=y CONFIG_HAVE_GENERIC_VDSO=y CONFIG_GENERIC_GETTIMEOFDAY=y +CONFIG_GENERIC_VDSO_TIME_NS=y CONFIG_FONT_SUPPORT=y # CONFIG_FONTS is not set CONFIG_FONT_8x8=y @@ -6202,6 +6226,9 @@ CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 CONFIG_MAGIC_SYSRQ_SERIAL=y CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE="" CONFIG_DEBUG_FS=y +CONFIG_DEBUG_FS_ALLOW_ALL=y +# CONFIG_DEBUG_FS_DISALLOW_MOUNT is not set +# CONFIG_DEBUG_FS_ALLOW_NONE is not set CONFIG_HAVE_ARCH_KGDB=y # CONFIG_KGDB is not set CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y @@ -6242,7 +6269,6 @@ CONFIG_HAVE_ARCH_KASAN_SW_TAGS=y CONFIG_CC_HAS_KASAN_GENERIC=y CONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y # CONFIG_KASAN is not set -CONFIG_KASAN_STACK=1 # end of Memory Debugging # CONFIG_DEBUG_SHIRQ is not set @@ -6310,6 +6336,7 @@ CONFIG_HAVE_DEBUG_BUGVERBOSE=y # # CONFIG_RCU_PERF_TEST is not set # CONFIG_RCU_TORTURE_TEST is not set +# CONFIG_RCU_REF_SCALE_TEST is not set CONFIG_RCU_CPU_STALL_TIMEOUT=21 # CONFIG_RCU_TRACE is not set # CONFIG_RCU_EQS_DEBUG is not set diff --git a/projects/Allwinner/linux/linux.arm.conf b/projects/Allwinner/linux/linux.arm.conf index 710b267496..dc8d6ac259 100644 --- a/projects/Allwinner/linux/linux.arm.conf +++ b/projects/Allwinner/linux/linux.arm.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 5.8.0 Kernel Configuration +# Linux/arm 5.9.0 Kernel Configuration # CONFIG_CC_VERSION_TEXT="armv7ve-libreelec-linux-gnueabihf-gcc-10.2.0 (GCC) 10.2.0" CONFIG_CC_IS_GCC=y @@ -91,7 +91,7 @@ CONFIG_PREEMPT_NONE=y CONFIG_TICK_CPU_ACCOUNTING=y # CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set # CONFIG_IRQ_TIME_ACCOUNTING is not set -# CONFIG_SCHED_THERMAL_PRESSURE is not set +CONFIG_SCHED_THERMAL_PRESSURE=y # CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_TASKSTATS is not set # CONFIG_PSI is not set @@ -167,7 +167,9 @@ CONFIG_RD_GZIP=y # CONFIG_RD_XZ is not set # CONFIG_RD_LZO is not set # CONFIG_RD_LZ4 is not set +CONFIG_RD_ZSTD=y # CONFIG_INITRAMFS_COMPRESSION_GZIP is not set +# CONFIG_INITRAMFS_COMPRESSION_ZSTD is not set CONFIG_INITRAMFS_COMPRESSION_NONE=y # CONFIG_BOOT_CONFIG is not set CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y @@ -298,6 +300,7 @@ CONFIG_ARCH_MULTI_V6_V7=y # CONFIG_ARCH_MESON is not set # CONFIG_ARCH_MILBEAUT is not set # CONFIG_ARCH_MMP is not set +# CONFIG_ARCH_MSTARV7 is not set # CONFIG_ARCH_MVEBU is not set # CONFIG_ARCH_NPCM is not set @@ -582,6 +585,7 @@ CONFIG_ARM_PSCI_FW=y # CONFIG_ARM_PSCI_CHECKER is not set CONFIG_HAVE_ARM_SMCCC=y CONFIG_HAVE_ARM_SMCCC_DISCOVERY=y +CONFIG_ARM_SMCCC_SOC_ID=y # # Tegra firmware driver @@ -596,6 +600,7 @@ CONFIG_CRYPTO_SHA512_ARM=y CONFIG_CRYPTO_AES_ARM=y # CONFIG_CRYPTO_CHACHA20_NEON is not set CONFIG_CRYPTO_POLY1305_ARM=y +CONFIG_AS_VFP_VMRS_FPINST=y # # General architecture-dependent options @@ -628,7 +633,6 @@ CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_HAVE_ARCH_SECCOMP_FILTER=y CONFIG_SECCOMP_FILTER=y CONFIG_HAVE_STACKPROTECTOR=y -CONFIG_CC_HAS_STACKPROTECTOR_NONE=y # CONFIG_STACKPROTECTOR is not set CONFIG_HAVE_CONTEXT_TRACKING=y CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y @@ -640,7 +644,6 @@ CONFIG_HAVE_ARCH_MMAP_RND_BITS=y CONFIG_HAVE_EXIT_THREAD=y CONFIG_ARCH_MMAP_RND_BITS=8 CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y -CONFIG_HAVE_COPY_THREAD_TLS=y CONFIG_CLONE_BACKWARDS=y CONFIG_OLD_SIGSUSPEND3=y CONFIG_OLD_SIGACTION=y @@ -1380,6 +1383,7 @@ CONFIG_DEV_COREDUMP=y # CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set # CONFIG_TEST_ASYNC_DRIVER_PROBE is not set CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_SOC_BUS=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y CONFIG_REGMAP_SPI=y @@ -1709,6 +1713,7 @@ CONFIG_NET_VENDOR_SYNOPSYS=y # CONFIG_NET_VENDOR_XILINX is not set CONFIG_MDIO_DEVICE=y CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVRES=y # CONFIG_MDIO_BCM_UNIMAC is not set # CONFIG_MDIO_BITBANG is not set CONFIG_MDIO_BUS_MUX=y @@ -1910,7 +1915,12 @@ CONFIG_MT76x0U=m CONFIG_MT76x2_COMMON=m CONFIG_MT76x2U=m CONFIG_MT7615_COMMON=m +CONFIG_MT7663_USB_SDIO_COMMON=m CONFIG_MT7663U=m +# CONFIG_MT7663S is not set +CONFIG_WLAN_VENDOR_MICROCHIP=y +# CONFIG_WILC1000_SDIO is not set +# CONFIG_WILC1000_SPI is not set CONFIG_WLAN_VENDOR_RALINK=y CONFIG_RT2X00=m CONFIG_RT2500USB=m @@ -2260,6 +2270,7 @@ CONFIG_SPI_MASTER=y # CONFIG_SPI_AXI_SPI_ENGINE is not set # CONFIG_SPI_BITBANG is not set # CONFIG_SPI_CADENCE is not set +# CONFIG_SPI_CADENCE_QUADSPI is not set # CONFIG_SPI_DESIGNWARE is not set # CONFIG_SPI_NXP_FLEXSPI is not set # CONFIG_SPI_GPIO is not set @@ -2288,6 +2299,7 @@ CONFIG_SPI_SUN6I=y # CONFIG_SPI_LOOPBACK_TEST is not set # CONFIG_SPI_TLE62X0 is not set # CONFIG_SPI_SLAVE is not set +CONFIG_SPI_DYNAMIC=y # CONFIG_SPMI is not set # CONFIG_HSI is not set CONFIG_PPS=y @@ -2385,6 +2397,7 @@ CONFIG_GPIO_SYSFS=y # CONFIG_GPIO_MAX7300 is not set # CONFIG_GPIO_MAX732X is not set # CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCA9570 is not set # CONFIG_GPIO_PCF857X is not set # CONFIG_GPIO_TPIC2810 is not set # end of I2C GPIO expanders @@ -2449,6 +2462,7 @@ CONFIG_AXP20X_POWER=y # CONFIG_CHARGER_BQ24190 is not set # CONFIG_CHARGER_BQ24257 is not set # CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_BQ2515X is not set # CONFIG_CHARGER_BQ25890 is not set # CONFIG_CHARGER_SMB347 is not set # CONFIG_BATTERY_GAUGE_LTC2941 is not set @@ -2482,6 +2496,7 @@ CONFIG_HWMON=y # CONFIG_SENSORS_AXI_FAN_CONTROL is not set # CONFIG_SENSORS_ASPEED is not set # CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_CORSAIR_CPRO is not set # CONFIG_SENSORS_DRIVETEMP is not set # CONFIG_SENSORS_DS620 is not set # CONFIG_SENSORS_DS1621 is not set @@ -2596,6 +2611,7 @@ CONFIG_HWMON=y # CONFIG_SENSORS_W83627HF is not set # CONFIG_SENSORS_W83627EHF is not set CONFIG_THERMAL=y +# CONFIG_THERMAL_NETLINK is not set # CONFIG_THERMAL_STATISTICS is not set CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 CONFIG_THERMAL_HWMON=y @@ -2610,7 +2626,6 @@ CONFIG_THERMAL_GOV_STEP_WISE=y # CONFIG_THERMAL_GOV_USER_SPACE is not set CONFIG_CPU_THERMAL=y CONFIG_CPU_FREQ_THERMAL=y -CONFIG_CLOCK_THERMAL=y CONFIG_DEVFREQ_THERMAL=y # CONFIG_THERMAL_EMULATION is not set # CONFIG_THERMAL_MMIO is not set @@ -2729,7 +2744,6 @@ CONFIG_MFD_AXP20X_RSB=y # CONFIG_MFD_SI476X_CORE is not set # CONFIG_MFD_SM501 is not set # CONFIG_MFD_SKY81452 is not set -# CONFIG_MFD_SMSC is not set # CONFIG_ABX500_CORE is not set # CONFIG_MFD_STMPE is not set CONFIG_MFD_SUN6I_PRCM=y @@ -2790,6 +2804,7 @@ CONFIG_REGULATOR_AXP20X=y # CONFIG_REGULATOR_DA9210 is not set # CONFIG_REGULATOR_DA9211 is not set # CONFIG_REGULATOR_FAN53555 is not set +# CONFIG_REGULATOR_FAN53880 is not set CONFIG_REGULATOR_GPIO=y # CONFIG_REGULATOR_ISL9305 is not set # CONFIG_REGULATOR_ISL6271A is not set @@ -2811,6 +2826,7 @@ CONFIG_REGULATOR_GPIO=y # CONFIG_REGULATOR_MP886X is not set # CONFIG_REGULATOR_MPQ7920 is not set # CONFIG_REGULATOR_MT6311 is not set +# CONFIG_REGULATOR_PCA9450 is not set # CONFIG_REGULATOR_PFUZE100 is not set # CONFIG_REGULATOR_PV88060 is not set # CONFIG_REGULATOR_PV88080 is not set @@ -2819,6 +2835,7 @@ CONFIG_REGULATOR_GPIO=y # CONFIG_REGULATOR_SLG51000 is not set CONFIG_REGULATOR_SY8106A=y # CONFIG_REGULATOR_SY8824X is not set +# CONFIG_REGULATOR_SY8827N is not set # CONFIG_REGULATOR_TPS51632 is not set # CONFIG_REGULATOR_TPS62360 is not set # CONFIG_REGULATOR_TPS65023 is not set @@ -2862,12 +2879,14 @@ CONFIG_IR_SUNXI=y # CONFIG_IR_SERIAL is not set # CONFIG_IR_SIR is not set CONFIG_RC_XBOX_DVD=y +# CONFIG_IR_TOY is not set CONFIG_CEC_CORE=y CONFIG_CEC_NOTIFIER=y CONFIG_CEC_PIN=y # CONFIG_MEDIA_CEC_RC is not set # CONFIG_CEC_PIN_ERROR_INJ is not set CONFIG_MEDIA_CEC_SUPPORT=y +# CONFIG_CEC_CH7322 is not set CONFIG_USB_PULSE8_CEC=m CONFIG_USB_RAINSHADOW_CEC=m CONFIG_MEDIA_SUPPORT=y @@ -3152,6 +3171,7 @@ CONFIG_VIDEO_TW9903=m CONFIG_VIDEO_TW9906=m CONFIG_VIDEO_TW9910=m CONFIG_VIDEO_VPX3220=m +# CONFIG_VIDEO_MAX9286 is not set # # Video and audio decoders @@ -3219,7 +3239,6 @@ CONFIG_VIDEO_ST_MIPID02=m # CONFIG_VIDEO_OV2659 is not set # CONFIG_VIDEO_OV2680 is not set # CONFIG_VIDEO_OV2685 is not set -# CONFIG_VIDEO_OV2740 is not set # CONFIG_VIDEO_OV5640 is not set # CONFIG_VIDEO_OV5645 is not set # CONFIG_VIDEO_OV5647 is not set @@ -3249,6 +3268,7 @@ CONFIG_VIDEO_OV7640=m # CONFIG_VIDEO_SR030PC30 is not set # CONFIG_VIDEO_NOON010PC30 is not set # CONFIG_VIDEO_M5MOLS is not set +# CONFIG_VIDEO_RDACM20 is not set # CONFIG_VIDEO_RJ54N1 is not set # CONFIG_VIDEO_S5K6AA is not set # CONFIG_VIDEO_S5K6A3 is not set @@ -3265,6 +3285,7 @@ CONFIG_VIDEO_OV7640=m # CONFIG_VIDEO_AD5820 is not set # CONFIG_VIDEO_AK7375 is not set # CONFIG_VIDEO_DW9714 is not set +# CONFIG_VIDEO_DW9768 is not set # CONFIG_VIDEO_DW9807_VCM is not set # end of Lens drivers @@ -3852,7 +3873,7 @@ CONFIG_SND_SOC_HDMI_CODEC=y # CONFIG_SND_SOC_MAX98504 is not set # CONFIG_SND_SOC_MAX9867 is not set # CONFIG_SND_SOC_MAX98927 is not set -# CONFIG_SND_SOC_MAX98373 is not set +# CONFIG_SND_SOC_MAX98373_I2C is not set # CONFIG_SND_SOC_MAX98390 is not set # CONFIG_SND_SOC_MAX9860 is not set # CONFIG_SND_SOC_MSM8916_WCD_DIGITAL is not set @@ -4085,8 +4106,8 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_DEFAULT_PERSIST=y # CONFIG_USB_DYNAMIC_MINORS is not set # CONFIG_USB_OTG is not set -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_OTG_PRODUCTLIST is not set +# CONFIG_USB_OTG_DISABLE_EXTERNAL_HUB is not set # CONFIG_USB_LEDS_TRIGGER_USBPORT is not set CONFIG_USB_AUTOSUSPEND_DELAY=2 CONFIG_USB_MON=m @@ -4347,6 +4368,7 @@ CONFIG_MMC_SUNXI=y CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y # CONFIG_LEDS_CLASS_FLASH is not set +# CONFIG_LEDS_CLASS_MULTICOLOR is not set # CONFIG_LEDS_BRIGHTNESS_HW_CHANGED is not set # @@ -4366,10 +4388,7 @@ CONFIG_LEDS_CLASS=y CONFIG_LEDS_GPIO=y # CONFIG_LEDS_LP3944 is not set # CONFIG_LEDS_LP3952 is not set -# CONFIG_LEDS_LP5521 is not set -# CONFIG_LEDS_LP5523 is not set -# CONFIG_LEDS_LP5562 is not set -# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_LP55XX_COMMON is not set # CONFIG_LEDS_LP8860 is not set # CONFIG_LEDS_PCA955X is not set # CONFIG_LEDS_PCA963X is not set @@ -4548,6 +4567,7 @@ CONFIG_DMA_SUN6I=y # CONFIG_FSL_QDMA is not set # CONFIG_INTEL_IDMA64 is not set # CONFIG_NBPFAXI_DMA is not set +# CONFIG_XILINX_ZYNQMP_DPDMA is not set # CONFIG_QCOM_HIDMA_MGMT is not set # CONFIG_QCOM_HIDMA is not set # CONFIG_DW_DMAC is not set @@ -4651,19 +4671,9 @@ CONFIG_STAGING=y # end of Resolver to digital converters # end of IIO staging drivers -# -# Speakup console speech -# -# CONFIG_SPEAKUP is not set -# end of Speakup console speech - CONFIG_STAGING_MEDIA=y CONFIG_VIDEO_SUNXI=y CONFIG_VIDEO_SUNXI_CEDRUS=y - -# -# soc_camera sensor drivers -# CONFIG_VIDEO_USBVISION=m # @@ -4675,10 +4685,7 @@ CONFIG_VIDEO_USBVISION=m # CONFIG_LTE_GDM724X is not set # CONFIG_GS_FPGABOOT is not set # CONFIG_UNISYSSPAR is not set -# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set # CONFIG_FB_TFT is not set -# CONFIG_WILC1000_SDIO is not set -# CONFIG_WILC1000_SPI is not set # CONFIG_KS7010 is not set # CONFIG_PI433 is not set @@ -4698,6 +4705,7 @@ CONFIG_HAVE_CLK=y CONFIG_CLKDEV_LOOKUP=y CONFIG_HAVE_CLK_PREPARE=y CONFIG_COMMON_CLK=y +# CONFIG_CLK_HSDK is not set # CONFIG_COMMON_CLK_MAX9485 is not set # CONFIG_COMMON_CLK_SI5341 is not set # CONFIG_COMMON_CLK_SI5351 is not set @@ -4965,6 +4973,7 @@ CONFIG_SUN4I_GPADC=y # CONFIG_CCS811 is not set # CONFIG_IAQCORE is not set # CONFIG_PMS7003 is not set +# CONFIG_SCD30_CORE is not set # CONFIG_SENSIRION_SGP30 is not set # CONFIG_SPS30 is not set # CONFIG_VZ89X is not set @@ -5096,6 +5105,8 @@ CONFIG_SUN4I_GPADC=y # CONFIG_FXOS8700_I2C is not set # CONFIG_FXOS8700_SPI is not set # CONFIG_KMX61 is not set +# CONFIG_INV_ICM42600_I2C is not set +# CONFIG_INV_ICM42600_SPI is not set # CONFIG_INV_MPU6050_I2C is not set # CONFIG_INV_MPU6050_SPI is not set # CONFIG_IIO_ST_LSM6DSX is not set @@ -5545,7 +5556,15 @@ CONFIG_SUNRPC_BACKCHANNEL=y CONFIG_SUNRPC_SWAP=y # CONFIG_SUNRPC_DEBUG is not set # CONFIG_CEPH_FS is not set -# CONFIG_CIFS is not set +CONFIG_CIFS=y +CONFIG_CIFS_STATS2=y +CONFIG_CIFS_ALLOW_INSECURE_LEGACY=y +# CONFIG_CIFS_WEAK_PW_HASH is not set +# CONFIG_CIFS_UPCALL is not set +# CONFIG_CIFS_XATTR is not set +# CONFIG_CIFS_DEBUG is not set +# CONFIG_CIFS_DFS_UPCALL is not set +# CONFIG_CIFS_ROOT is not set # CONFIG_CODA_FS is not set # CONFIG_AFS_FS is not set CONFIG_NLS=y @@ -5663,7 +5682,7 @@ CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_MANAGER2=y # CONFIG_CRYPTO_USER is not set CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y -CONFIG_CRYPTO_GF128MUL=m +CONFIG_CRYPTO_GF128MUL=y CONFIG_CRYPTO_NULL=y CONFIG_CRYPTO_NULL2=y # CONFIG_CRYPTO_PCRYPT is not set @@ -5685,8 +5704,8 @@ CONFIG_CRYPTO_ECDH=m # # Authenticated Encryption with Associated Data # -CONFIG_CRYPTO_CCM=m -CONFIG_CRYPTO_GCM=m +CONFIG_CRYPTO_CCM=y +CONFIG_CRYPTO_GCM=y # CONFIG_CRYPTO_CHACHA20POLY1305 is not set # CONFIG_CRYPTO_AEGIS128 is not set CONFIG_CRYPTO_SEQIV=m @@ -5697,7 +5716,7 @@ CONFIG_CRYPTO_ECHAINIV=m # CONFIG_CRYPTO_CBC=m # CONFIG_CRYPTO_CFB is not set -CONFIG_CRYPTO_CTR=m +CONFIG_CRYPTO_CTR=y # CONFIG_CRYPTO_CTS is not set CONFIG_CRYPTO_ECB=y # CONFIG_CRYPTO_LRW is not set @@ -5712,7 +5731,7 @@ CONFIG_CRYPTO_ECB=y # Hash modes # CONFIG_CRYPTO_CMAC=y -CONFIG_CRYPTO_HMAC=m +CONFIG_CRYPTO_HMAC=y # CONFIG_CRYPTO_XCBC is not set # CONFIG_CRYPTO_VMAC is not set @@ -5725,7 +5744,7 @@ CONFIG_CRYPTO_XXHASH=m CONFIG_CRYPTO_BLAKE2B=m # CONFIG_CRYPTO_BLAKE2S is not set # CONFIG_CRYPTO_CRCT10DIF is not set -CONFIG_CRYPTO_GHASH=m +CONFIG_CRYPTO_GHASH=y # CONFIG_CRYPTO_POLY1305 is not set CONFIG_CRYPTO_MD4=y CONFIG_CRYPTO_MD5=y @@ -5735,8 +5754,8 @@ CONFIG_CRYPTO_MD5=y # CONFIG_CRYPTO_RMD256 is not set # CONFIG_CRYPTO_RMD320 is not set CONFIG_CRYPTO_SHA1=y -CONFIG_CRYPTO_SHA256=m -# CONFIG_CRYPTO_SHA512 is not set +CONFIG_CRYPTO_SHA256=y +CONFIG_CRYPTO_SHA512=y # CONFIG_CRYPTO_SHA3 is not set # CONFIG_CRYPTO_SM3 is not set # CONFIG_CRYPTO_STREEBOG is not set @@ -5796,7 +5815,7 @@ CONFIG_CRYPTO_HASH_INFO=y # Crypto library routines # CONFIG_CRYPTO_LIB_AES=y -CONFIG_CRYPTO_LIB_ARC4=m +CONFIG_CRYPTO_LIB_ARC4=y CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y CONFIG_CRYPTO_LIB_BLAKE2S=y CONFIG_CRYPTO_LIB_CHACHA_GENERIC=y @@ -5808,7 +5827,7 @@ CONFIG_CRYPTO_LIB_POLY1305_RSIZE=9 CONFIG_CRYPTO_ARCH_HAVE_LIB_POLY1305=y CONFIG_CRYPTO_LIB_POLY1305=y CONFIG_CRYPTO_LIB_CHACHA20POLY1305=y -CONFIG_CRYPTO_LIB_SHA256=m +CONFIG_CRYPTO_LIB_SHA256=y CONFIG_CRYPTO_HW=y CONFIG_CRYPTO_DEV_ALLWINNER=y CONFIG_CRYPTO_DEV_SUN4I_SS=m @@ -5892,11 +5911,13 @@ CONFIG_XZ_DEC_SPARC=y CONFIG_XZ_DEC_BCJ=y # CONFIG_XZ_DEC_TEST is not set CONFIG_DECOMPRESS_GZIP=y +CONFIG_DECOMPRESS_ZSTD=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_ASSOCIATIVE_ARRAY=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y CONFIG_HAS_DMA=y +CONFIG_DMA_OPS=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_DMA_DECLARE_COHERENT=y CONFIG_ARCH_HAS_SETUP_DMA_OPS=y @@ -5968,6 +5989,7 @@ CONFIG_FRAME_WARN=1024 # CONFIG_HEADERS_INSTALL is not set # CONFIG_DEBUG_SECTION_MISMATCH is not set CONFIG_SECTION_MISMATCH_WARN_ONLY=y +# CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_32B is not set # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set # end of Compile-time checks and compiler options @@ -5979,6 +6001,9 @@ CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 CONFIG_MAGIC_SYSRQ_SERIAL=y CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE="" CONFIG_DEBUG_FS=y +CONFIG_DEBUG_FS_ALLOW_ALL=y +# CONFIG_DEBUG_FS_DISALLOW_MOUNT is not set +# CONFIG_DEBUG_FS_ALLOW_NONE is not set CONFIG_HAVE_ARCH_KGDB=y # CONFIG_KGDB is not set # CONFIG_UBSAN is not set @@ -6011,7 +6036,6 @@ CONFIG_DEBUG_MEMORY_INIT=y # CONFIG_DEBUG_HIGHMEM is not set CONFIG_CC_HAS_KASAN_GENERIC=y CONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y -CONFIG_KASAN_STACK=1 # end of Memory Debugging # CONFIG_DEBUG_SHIRQ is not set @@ -6076,6 +6100,7 @@ CONFIG_LOCK_DEBUGGING_SUPPORT=y # # CONFIG_RCU_PERF_TEST is not set # CONFIG_RCU_TORTURE_TEST is not set +# CONFIG_RCU_REF_SCALE_TEST is not set CONFIG_RCU_CPU_STALL_TIMEOUT=21 # CONFIG_RCU_TRACE is not set # CONFIG_RCU_EQS_DEBUG is not set diff --git a/projects/Allwinner/patches/linux/0003-hdmi-improvements.patch b/projects/Allwinner/patches/linux/0003-hdmi-improvements.patch index ebc1d39664..a1fd260c66 100644 --- a/projects/Allwinner/patches/linux/0003-hdmi-improvements.patch +++ b/projects/Allwinner/patches/linux/0003-hdmi-improvements.patch @@ -145,413 +145,3 @@ index bfb1519..47632a3 100644 -- 2.14.1 -From 759c992d38d1a02560687247dec7ac05f4e8b3ce Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Sun, 8 Dec 2019 13:13:46 +0000 -Subject: [PATCH] drm: dw-hdmi: rename last_connector_result - -Signed-off-by: Jonas Karlman ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 20 ++++++++++---------- - 1 file changed, 10 insertions(+), 10 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 0e716c40c42c..2dad989e7b4f 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -197,7 +197,7 @@ struct dw_hdmi { - - hdmi_codec_plugged_cb plugged_cb; - struct device *codec_dev; -- enum drm_connector_status last_connector_result; -+ enum drm_connector_status last_connector_status; - }; - - #define HDMI_IH_PHY_STAT0_RX_SENSE \ -@@ -236,7 +236,7 @@ int dw_hdmi_set_plugged_cb(struct dw_hdmi *hdmi, hdmi_codec_plugged_cb fn, - mutex_lock(&hdmi->mutex); - hdmi->plugged_cb = fn; - hdmi->codec_dev = codec_dev; -- plugged = hdmi->last_connector_result == connector_status_connected; -+ plugged = hdmi->last_connector_status == connector_status_connected; - handle_plugged_change(hdmi, plugged); - mutex_unlock(&hdmi->mutex); - -@@ -2271,7 +2271,7 @@ dw_hdmi_connector_detect(struct drm_connector *connector, bool force) - { - struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, - connector); -- enum drm_connector_status result; -+ enum drm_connector_status status; - - mutex_lock(&hdmi->mutex); - hdmi->force = DRM_FORCE_UNSPECIFIED; -@@ -2279,18 +2279,18 @@ dw_hdmi_connector_detect(struct drm_connector *connector, bool force) - dw_hdmi_update_phy_mask(hdmi); - mutex_unlock(&hdmi->mutex); - -- result = hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data); -+ status = hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data); - - mutex_lock(&hdmi->mutex); -- if (result != hdmi->last_connector_result) { -- dev_dbg(hdmi->dev, "read_hpd result: %d", result); -+ if (status != hdmi->last_connector_status) { -+ dev_dbg(hdmi->dev, "connector status: %d", status); - handle_plugged_change(hdmi, -- result == connector_status_connected); -- hdmi->last_connector_result = result; -+ status == connector_status_connected); -+ hdmi->last_connector_status = status; - } - mutex_unlock(&hdmi->mutex); - -- return result; -+ return status; - } - - static int dw_hdmi_connector_get_modes(struct drm_connector *connector) -@@ -3053,7 +3053,7 @@ __dw_hdmi_probe(struct platform_device *pdev, - hdmi->rxsense = true; - hdmi->phy_mask = (u8)~(HDMI_PHY_HPD | HDMI_PHY_RX_SENSE); - hdmi->mc_clkdis = 0x7f; -- hdmi->last_connector_result = connector_status_disconnected; -+ hdmi->last_connector_status = connector_status_disconnected; - - mutex_init(&hdmi->mutex); - mutex_init(&hdmi->audio_mutex); - -From 753bd0f066fd26f253f45ca652bb8a532c6dad90 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Sun, 1 Dec 2019 20:51:22 +0000 -Subject: [PATCH] drm: dw-hdmi: extract handle_plugged_change call - -Signed-off-by: Jonas Karlman ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 22 ++++++++++++++-------- - 1 file changed, 14 insertions(+), 8 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 2dad989e7b4f..ac198fcaba8b 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -228,6 +228,19 @@ static void handle_plugged_change(struct dw_hdmi *hdmi, bool plugged) - hdmi->plugged_cb(hdmi->codec_dev, plugged); - } - -+static void dw_hdmi_update_connector_status(struct dw_hdmi *hdmi, -+ enum drm_connector_status status) -+{ -+ mutex_lock(&hdmi->mutex); -+ if (status != hdmi->last_connector_status) { -+ dev_dbg(hdmi->dev, "connector status: %d", status); -+ handle_plugged_change(hdmi, -+ status == connector_status_connected); -+ hdmi->last_connector_status = status; -+ } -+ mutex_unlock(&hdmi->mutex); -+} -+ - int dw_hdmi_set_plugged_cb(struct dw_hdmi *hdmi, hdmi_codec_plugged_cb fn, - struct device *codec_dev) - { -@@ -2281,14 +2294,7 @@ dw_hdmi_connector_detect(struct drm_connector *connector, bool force) - - status = hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data); - -- mutex_lock(&hdmi->mutex); -- if (status != hdmi->last_connector_status) { -- dev_dbg(hdmi->dev, "connector status: %d", status); -- handle_plugged_change(hdmi, -- status == connector_status_connected); -- hdmi->last_connector_status = status; -- } -- mutex_unlock(&hdmi->mutex); -+ dw_hdmi_update_connector_status(hdmi, status); - - return status; - } - -From fdd68a4db03fba2017a4aa65830adf3b8d5a585c Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Sat, 28 Sep 2019 13:34:46 +0000 -Subject: [PATCH] drm: dw-hdmi: remove unused struct member - -Signed-off-by: Jonas Karlman ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index ac198fcaba8b..7a0eb443cec6 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -41,8 +41,6 @@ - #define DDC_CI_ADDR 0x37 - #define DDC_SEGMENT_ADDR 0x30 - --#define HDMI_EDID_LEN 512 -- - /* DW-HDMI Controller >= 0x200a are at least compliant with SCDC version 1 */ - #define SCDC_MIN_SOURCE_VERSION 0x1 - -@@ -152,8 +150,6 @@ struct dw_hdmi { - - int vic; - -- u8 edid[HDMI_EDID_LEN]; -- - struct { - const struct dw_hdmi_phy_ops *ops; - const char *name; - -From 1b52bf5366035687e7e028f1320c9e2d37dd01a3 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Sat, 28 Sep 2019 13:34:46 +0000 -Subject: [PATCH] drm: dw-hdmi: read edid in detect callback - -Signed-off-by: Jonas Karlman ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 79 +++++++++++++++++++++++-------- - 1 file changed, 58 insertions(+), 21 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 7a0eb443cec6..363f7c5a8016 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -150,6 +150,8 @@ struct dw_hdmi { - - int vic; - -+ struct edid *cached_edid; -+ - struct { - const struct dw_hdmi_phy_ops *ops; - const char *name; -@@ -2217,9 +2219,55 @@ static void initialize_hdmi_ih_mutes(struct dw_hdmi *hdmi) - hdmi_writeb(hdmi, ih_mute, HDMI_IH_MUTE); - } - -+static void dw_hdmi_clear_edid(struct drm_connector *connector) -+{ -+ struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, -+ connector); -+ -+ if (!hdmi->cached_edid) -+ return; -+ -+ hdmi->sink_is_hdmi = false; -+ hdmi->sink_has_audio = false; -+ -+ kfree(hdmi->cached_edid); -+ hdmi->cached_edid = NULL; -+} -+ -+static void dw_hdmi_get_edid(struct drm_connector *connector) -+{ -+ struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, -+ connector); -+ struct edid *edid; -+ -+ if (!hdmi->ddc || hdmi->cached_edid) -+ return; -+ -+ edid = drm_get_edid(connector, hdmi->ddc); -+ -+ if (edid && edid->input & DRM_EDID_INPUT_DIGITAL) { -+ dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n", -+ edid->width_cm, edid->height_cm); -+ -+ hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid); -+ hdmi->sink_has_audio = drm_detect_monitor_audio(edid); -+ -+ hdmi->cached_edid = edid; -+ } else { -+ dev_dbg(hdmi->dev, "failed to get edid\n"); -+ -+ kfree(edid); -+ edid = NULL; -+ } -+ -+ drm_connector_update_edid_property(connector, edid); -+ cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid); -+} -+ - static void dw_hdmi_poweron(struct dw_hdmi *hdmi) - { - hdmi->bridge_is_on = true; -+ dw_hdmi_get_edid(&hdmi->connector); - dw_hdmi_setup(hdmi, &hdmi->previous_mode); - } - -@@ -2290,6 +2338,11 @@ dw_hdmi_connector_detect(struct drm_connector *connector, bool force) - - status = hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data); - -+ if (status == connector_status_disconnected) -+ dw_hdmi_clear_edid(connector); -+ else -+ dw_hdmi_get_edid(connector); -+ - dw_hdmi_update_connector_status(hdmi, status); - - return status; -@@ -2299,28 +2352,8 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector) - { - struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, - connector); -- struct edid *edid; -- int ret = 0; -- -- if (!hdmi->ddc) -- return 0; - -- edid = drm_get_edid(connector, hdmi->ddc); -- if (edid) { -- dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n", -- edid->width_cm, edid->height_cm); -- -- hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid); -- hdmi->sink_has_audio = drm_detect_monitor_audio(edid); -- drm_connector_update_edid_property(connector, edid); -- cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid); -- ret = drm_add_edid_modes(connector, edid); -- kfree(edid); -- } else { -- dev_dbg(hdmi->dev, "failed to get edid\n"); -- } -- -- return ret; -+ return drm_add_edid_modes(connector, hdmi->cached_edid); - } - - static bool hdr_metadata_equal(const struct drm_connector_state *old_state, -@@ -2699,6 +2732,9 @@ static void dw_hdmi_bridge_detach(struct drm_bridge *bridge) - cec_notifier_conn_unregister(hdmi->cec_notifier); - hdmi->cec_notifier = NULL; - mutex_unlock(&hdmi->cec_notifier_mutex); -+ -+ kfree(hdmi->cached_edid); -+ hdmi->cached_edid = NULL; - } - - static enum drm_mode_status -@@ -3388,6 +3424,7 @@ EXPORT_SYMBOL_GPL(dw_hdmi_unbind); - - void dw_hdmi_resume(struct dw_hdmi *hdmi) - { -+ dw_hdmi_clear_edid(&hdmi->connector); - dw_hdmi_init_hw(hdmi); - } - EXPORT_SYMBOL_GPL(dw_hdmi_resume); - -From 94b8204bf9165575ee51d9e18c4a2df16e2199ed Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Sat, 28 Sep 2019 13:34:47 +0000 -Subject: [PATCH] drm: dw-hdmi: read edid in force callback - -Signed-off-by: Jonas Karlman ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 363f7c5a8016..dff27934287c 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -2405,6 +2405,13 @@ static void dw_hdmi_connector_force(struct drm_connector *connector) - dw_hdmi_update_power(hdmi); - dw_hdmi_update_phy_mask(hdmi); - mutex_unlock(&hdmi->mutex); -+ -+ dw_hdmi_clear_edid(connector); -+ -+ if (connector->status != connector_status_connected) -+ return; -+ -+ dw_hdmi_get_edid(connector); - } - - static const struct drm_connector_funcs dw_hdmi_connector_funcs = { - -From d2ba7dbdb7d87a1240aac2652bddb49ce147b790 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Sat, 28 Sep 2019 13:34:47 +0000 -Subject: [PATCH] drm: dw-hdmi: invalidate cec phys addr in detect callback - -Signed-off-by: Jonas Karlman ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 17 +++-------------- - 1 file changed, 3 insertions(+), 14 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index dff27934287c..c922639e25eb 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -190,7 +190,6 @@ struct dw_hdmi { - void (*enable_audio)(struct dw_hdmi *hdmi); - void (*disable_audio)(struct dw_hdmi *hdmi); - -- struct mutex cec_notifier_mutex; - struct cec_notifier *cec_notifier; - - hdmi_codec_plugged_cb plugged_cb; -@@ -2232,6 +2231,8 @@ static void dw_hdmi_clear_edid(struct drm_connector *connector) - - kfree(hdmi->cached_edid); - hdmi->cached_edid = NULL; -+ -+ cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); - } - - static void dw_hdmi_get_edid(struct drm_connector *connector) -@@ -2724,9 +2725,7 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *bridge) - if (!notifier) - return -ENOMEM; - -- mutex_lock(&hdmi->cec_notifier_mutex); - hdmi->cec_notifier = notifier; -- mutex_unlock(&hdmi->cec_notifier_mutex); - - return 0; - } -@@ -2735,10 +2734,8 @@ static void dw_hdmi_bridge_detach(struct drm_bridge *bridge) - { - struct dw_hdmi *hdmi = bridge->driver_private; - -- mutex_lock(&hdmi->cec_notifier_mutex); - cec_notifier_conn_unregister(hdmi->cec_notifier); - hdmi->cec_notifier = NULL; -- mutex_unlock(&hdmi->cec_notifier_mutex); - - kfree(hdmi->cached_edid); - hdmi->cached_edid = NULL; -@@ -2906,18 +2903,11 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) - * ask the source to re-read the EDID. - */ - if (intr_stat & -- (HDMI_IH_PHY_STAT0_RX_SENSE | HDMI_IH_PHY_STAT0_HPD)) { -+ (HDMI_IH_PHY_STAT0_RX_SENSE | HDMI_IH_PHY_STAT0_HPD)) - dw_hdmi_setup_rx_sense(hdmi, - phy_stat & HDMI_PHY_HPD, - phy_stat & HDMI_PHY_RX_SENSE); - -- if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) == 0) { -- mutex_lock(&hdmi->cec_notifier_mutex); -- cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); -- mutex_unlock(&hdmi->cec_notifier_mutex); -- } -- } -- - if (intr_stat & HDMI_IH_PHY_STAT0_HPD) { - dev_dbg(hdmi->dev, "EVENT=%s\n", - phy_int_pol & HDMI_PHY_HPD ? "plugin" : "plugout"); -@@ -3102,7 +3092,6 @@ __dw_hdmi_probe(struct platform_device *pdev, - - mutex_init(&hdmi->mutex); - mutex_init(&hdmi->audio_mutex); -- mutex_init(&hdmi->cec_notifier_mutex); - spin_lock_init(&hdmi->audio_lock); - - ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0); - diff --git a/projects/Allwinner/patches/linux/0007-drm-fixes.patch b/projects/Allwinner/patches/linux/0007-drm-fixes.patch index 4610d8ef40..2341bafafb 100644 --- a/projects/Allwinner/patches/linux/0007-drm-fixes.patch +++ b/projects/Allwinner/patches/linux/0007-drm-fixes.patch @@ -379,7 +379,7 @@ index 8825518e06c8..006b746b0e95 100644 .reg_bits = 32, .val_bits = 32, .reg_stride = 4, - .max_register = 0xbfffc, /* guessed */ + .max_register = 0xffffc, /* guessed */ + .volatile_reg = sun8i_mixer_volatile_reg, }; From f0aaf71cfe9a518458112456f8949c13010b8954 Mon Sep 17 00:00:00 2001 From: Jonas Karlman Date: Tue, 13 Oct 2020 06:05:09 +0000 Subject: [PATCH 4/6] Rockchip: linux: update patches to 5.9 --- .../RK3288/linux/default/linux.arm.conf | 109 +- .../RK3328/linux/default/linux.aarch64.conf | 133 +- .../RK3399/linux/default/linux.aarch64.conf | 133 +- .../linux-0001-rockchip-from-5.10.patch | 2967 ++++++++++++ .../linux-0001-rockchip-from-5.9.patch | 4098 ----------------- .../linux-0002-rockchip-from-next.patch | 434 -- .../default/linux-0011-v4l2-from-5.10.patch | 2712 +++++++++++ .../default/linux-0011-v4l2-from-5.9.patch | 1190 ----- .../default/linux-0021-drm-from-5.10.patch | 2953 ++++++++++++ .../default/linux-0021-drm-from-5.9.patch | 3613 --------------- .../default/linux-0022-drm-from-next.patch | 1599 ++----- 11 files changed, 9244 insertions(+), 10697 deletions(-) create mode 100644 projects/Rockchip/patches/linux/default/linux-0001-rockchip-from-5.10.patch delete mode 100644 projects/Rockchip/patches/linux/default/linux-0001-rockchip-from-5.9.patch delete mode 100644 projects/Rockchip/patches/linux/default/linux-0002-rockchip-from-next.patch create mode 100644 projects/Rockchip/patches/linux/default/linux-0011-v4l2-from-5.10.patch delete mode 100644 projects/Rockchip/patches/linux/default/linux-0011-v4l2-from-5.9.patch create mode 100644 projects/Rockchip/patches/linux/default/linux-0021-drm-from-5.10.patch delete mode 100644 projects/Rockchip/patches/linux/default/linux-0021-drm-from-5.9.patch diff --git a/projects/Rockchip/devices/RK3288/linux/default/linux.arm.conf b/projects/Rockchip/devices/RK3288/linux/default/linux.arm.conf index 4e9ea279bd..1907ff255a 100644 --- a/projects/Rockchip/devices/RK3288/linux/default/linux.arm.conf +++ b/projects/Rockchip/devices/RK3288/linux/default/linux.arm.conf @@ -1,8 +1,8 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 5.8.0 Kernel Configuration +# Linux/arm 5.9.0 Kernel Configuration # -CONFIG_CC_VERSION_TEXT="arm-none-linux-gnueabihf-gcc.real (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 20191025" +CONFIG_CC_VERSION_TEXT="arm-none-linux-gnueabihf-gcc-9.2.1 (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 20191025" CONFIG_CC_IS_GCC=y CONFIG_GCC_VERSION=90201 CONFIG_LD_VERSION=233010000 @@ -92,7 +92,7 @@ CONFIG_TICK_CPU_ACCOUNTING=y # CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set CONFIG_IRQ_TIME_ACCOUNTING=y CONFIG_HAVE_SCHED_AVG_IRQ=y -# CONFIG_SCHED_THERMAL_PRESSURE is not set +CONFIG_SCHED_THERMAL_PRESSURE=y CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT_V3=y CONFIG_TASKSTATS=y @@ -171,6 +171,8 @@ CONFIG_INITRAMFS_ROOT_GID=0 # CONFIG_RD_XZ is not set # CONFIG_RD_LZO is not set # CONFIG_RD_LZ4 is not set +CONFIG_RD_ZSTD=y +# CONFIG_INITRAMFS_COMPRESSION_ZSTD is not set CONFIG_INITRAMFS_COMPRESSION_NONE=y # CONFIG_BOOT_CONFIG is not set CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y @@ -299,6 +301,7 @@ CONFIG_ARCH_MULTI_V6_V7=y # CONFIG_ARCH_MESON is not set # CONFIG_ARCH_MILBEAUT is not set # CONFIG_ARCH_MMP is not set +# CONFIG_ARCH_MSTARV7 is not set # CONFIG_ARCH_MVEBU is not set # CONFIG_ARCH_NPCM is not set @@ -458,7 +461,6 @@ CONFIG_SECCOMP=y # CONFIG_PARAVIRT is not set # CONFIG_PARAVIRT_TIME_ACCOUNTING is not set # CONFIG_XEN is not set -CONFIG_STACKPROTECTOR_PER_TASK=y # end of Kernel Features # @@ -594,6 +596,7 @@ CONFIG_CRYPTO_SHA512_ARM=m CONFIG_CRYPTO_AES_ARM=m CONFIG_CRYPTO_CHACHA20_NEON=m CONFIG_CRYPTO_POLY1305_ARM=m +CONFIG_AS_VFP_VMRS_FPINST=y # # General architecture-dependent options @@ -627,7 +630,6 @@ CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_HAVE_ARCH_SECCOMP_FILTER=y CONFIG_SECCOMP_FILTER=y CONFIG_HAVE_STACKPROTECTOR=y -CONFIG_CC_HAS_STACKPROTECTOR_NONE=y CONFIG_STACKPROTECTOR=y CONFIG_STACKPROTECTOR_STRONG=y CONFIG_HAVE_CONTEXT_TRACKING=y @@ -640,7 +642,6 @@ CONFIG_HAVE_ARCH_MMAP_RND_BITS=y CONFIG_HAVE_EXIT_THREAD=y CONFIG_ARCH_MMAP_RND_BITS=8 CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y -CONFIG_HAVE_COPY_THREAD_TLS=y CONFIG_CLONE_BACKWARDS=y CONFIG_OLD_SIGSUSPEND3=y CONFIG_OLD_SIGACTION=y @@ -662,10 +663,7 @@ CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y # end of GCOV-based kernel profiling CONFIG_HAVE_GCC_PLUGINS=y -CONFIG_GCC_PLUGINS=y -# CONFIG_GCC_PLUGIN_LATENT_ENTROPY is not set -# CONFIG_GCC_PLUGIN_RANDSTRUCT is not set -CONFIG_GCC_PLUGIN_ARM_SSP_PER_TASK=y +# CONFIG_GCC_PLUGINS is not set # end of General architecture-dependent options CONFIG_RT_MUTEXES=y @@ -878,6 +876,7 @@ CONFIG_NET_DSA_TAG_BRCM_PREPEND=m # CONFIG_NET_DSA_TAG_EDSA is not set # CONFIG_NET_DSA_TAG_MTK is not set # CONFIG_NET_DSA_TAG_KSZ is not set +# CONFIG_NET_DSA_TAG_RTL4_A is not set # CONFIG_NET_DSA_TAG_OCELOT is not set # CONFIG_NET_DSA_TAG_QCA is not set # CONFIG_NET_DSA_TAG_LAN9303 is not set @@ -1146,9 +1145,13 @@ CONFIG_MTD_CFI_I2=y # CONFIG_MTD_DOCG3 is not set # end of Self-contained MTD device drivers +# +# NAND +# # CONFIG_MTD_ONENAND is not set # CONFIG_MTD_RAW_NAND is not set # CONFIG_MTD_SPI_NAND is not set +# end of NAND # # LPDDR & LPDDR2 PCM memory drivers @@ -1159,7 +1162,6 @@ CONFIG_MTD_CFI_I2=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y -# CONFIG_SPI_CADENCE_QUADSPI is not set CONFIG_MTD_UBI=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 CONFIG_MTD_UBI_BEB_LIMIT=20 @@ -1411,6 +1413,7 @@ CONFIG_DWMAC_ROCKCHIP=y # CONFIG_NET_VENDOR_XILINX is not set CONFIG_MDIO_DEVICE=y CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVRES=y CONFIG_MDIO_BCM_UNIMAC=m # CONFIG_MDIO_BITBANG is not set # CONFIG_MDIO_BUS_MUX_GPIO is not set @@ -1611,6 +1614,7 @@ CONFIG_MT7601U=m CONFIG_MT76_CORE=m CONFIG_MT76_LEDS=y CONFIG_MT76_USB=m +CONFIG_MT76_SDIO=m CONFIG_MT76x02_LIB=m CONFIG_MT76x02_USB=m CONFIG_MT76x0_COMMON=m @@ -1618,7 +1622,12 @@ CONFIG_MT76x0U=m CONFIG_MT76x2_COMMON=m CONFIG_MT76x2U=m CONFIG_MT7615_COMMON=m +CONFIG_MT7663_USB_SDIO_COMMON=m CONFIG_MT7663U=m +CONFIG_MT7663S=m +CONFIG_WLAN_VENDOR_MICROCHIP=y +# CONFIG_WILC1000_SDIO is not set +# CONFIG_WILC1000_SPI is not set CONFIG_WLAN_VENDOR_RALINK=y CONFIG_RT2X00=m CONFIG_RT2500USB=m @@ -1887,6 +1896,7 @@ CONFIG_VIRTIO_CONSOLE=y # CONFIG_IPMB_DEVICE_INTERFACE is not set CONFIG_HW_RANDOM=y # CONFIG_HW_RANDOM_TIMERIOMEM is not set +# CONFIG_HW_RANDOM_BA431 is not set # CONFIG_HW_RANDOM_VIRTIO is not set CONFIG_HW_RANDOM_OPTEE=m # CONFIG_HW_RANDOM_CCTRNG is not set @@ -1982,6 +1992,7 @@ CONFIG_SPI_MEM=y # CONFIG_SPI_AXI_SPI_ENGINE is not set CONFIG_SPI_BITBANG=y CONFIG_SPI_CADENCE=y +# CONFIG_SPI_CADENCE_QUADSPI is not set # CONFIG_SPI_DESIGNWARE is not set # CONFIG_SPI_NXP_FLEXSPI is not set CONFIG_SPI_GPIO=m @@ -2009,6 +2020,7 @@ CONFIG_SPI_SPIDEV=y # CONFIG_SPI_LOOPBACK_TEST is not set # CONFIG_SPI_TLE62X0 is not set # CONFIG_SPI_SLAVE is not set +CONFIG_SPI_DYNAMIC=y CONFIG_SPMI=y # CONFIG_HSI is not set CONFIG_PPS=y @@ -2094,6 +2106,7 @@ CONFIG_GPIO_XILINX=y # CONFIG_GPIO_MAX732X is not set CONFIG_GPIO_PCA953X=y CONFIG_GPIO_PCA953X_IRQ=y +# CONFIG_GPIO_PCA9570 is not set CONFIG_GPIO_PCF857X=y # CONFIG_GPIO_TPIC2810 is not set # end of I2C GPIO expanders @@ -2169,6 +2182,7 @@ CONFIG_BATTERY_CPCAP=y # CONFIG_CHARGER_BQ24190 is not set # CONFIG_CHARGER_BQ24257 is not set # CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_BQ2515X is not set # CONFIG_CHARGER_BQ25890 is not set # CONFIG_CHARGER_SMB347 is not set # CONFIG_CHARGER_TPS65090 is not set @@ -2207,6 +2221,7 @@ CONFIG_SENSORS_ARM_SCMI=m CONFIG_SENSORS_ARM_SCPI=m # CONFIG_SENSORS_ASPEED is not set # CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_CORSAIR_CPRO is not set # CONFIG_SENSORS_DS620 is not set # CONFIG_SENSORS_DS1621 is not set # CONFIG_SENSORS_F71805F is not set @@ -2320,6 +2335,7 @@ CONFIG_SENSORS_INA2XX=m # CONFIG_SENSORS_W83627HF is not set # CONFIG_SENSORS_W83627EHF is not set CONFIG_THERMAL=y +# CONFIG_THERMAL_NETLINK is not set # CONFIG_THERMAL_STATISTICS is not set CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 CONFIG_THERMAL_HWMON=y @@ -2334,7 +2350,6 @@ CONFIG_THERMAL_GOV_STEP_WISE=y # CONFIG_THERMAL_GOV_USER_SPACE is not set CONFIG_CPU_THERMAL=y CONFIG_CPU_FREQ_THERMAL=y -# CONFIG_CLOCK_THERMAL is not set CONFIG_DEVFREQ_THERMAL=y CONFIG_THERMAL_EMULATION=y # CONFIG_THERMAL_MMIO is not set @@ -2453,7 +2468,6 @@ CONFIG_MFD_SEC_CORE=y # CONFIG_MFD_SI476X_CORE is not set # CONFIG_MFD_SM501 is not set # CONFIG_MFD_SKY81452 is not set -# CONFIG_MFD_SMSC is not set # CONFIG_ABX500_CORE is not set CONFIG_MFD_STMPE=y @@ -2506,6 +2520,7 @@ CONFIG_MFD_TPS65910=y # CONFIG_MFD_ROHM_BD71828 is not set # CONFIG_MFD_STPMIC1 is not set # CONFIG_MFD_STMFX is not set +# CONFIG_MFD_KHADAS_MCU is not set # CONFIG_RAVE_SP_CORE is not set # end of Multifunction device drivers @@ -2523,10 +2538,12 @@ CONFIG_REGULATOR_AS3722=y CONFIG_REGULATOR_AXP20X=y CONFIG_REGULATOR_BCM590XX=y CONFIG_REGULATOR_CPCAP=y +# CONFIG_REGULATOR_CROS_EC is not set # CONFIG_REGULATOR_DA9063 is not set CONFIG_REGULATOR_DA9210=y # CONFIG_REGULATOR_DA9211 is not set CONFIG_REGULATOR_FAN53555=y +# CONFIG_REGULATOR_FAN53880 is not set CONFIG_REGULATOR_GPIO=y # CONFIG_REGULATOR_ISL9305 is not set # CONFIG_REGULATOR_ISL6271A is not set @@ -2556,12 +2573,14 @@ CONFIG_REGULATOR_MAX77802=m # CONFIG_REGULATOR_MPQ7920 is not set # CONFIG_REGULATOR_MT6311 is not set CONFIG_REGULATOR_PALMAS=y +# CONFIG_REGULATOR_PCA9450 is not set # CONFIG_REGULATOR_PFUZE100 is not set # CONFIG_REGULATOR_PV88060 is not set # CONFIG_REGULATOR_PV88080 is not set # CONFIG_REGULATOR_PV88090 is not set CONFIG_REGULATOR_PWM=y # CONFIG_REGULATOR_QCOM_SPMI is not set +# CONFIG_REGULATOR_QCOM_USB_VBUS is not set CONFIG_REGULATOR_RK808=y CONFIG_REGULATOR_RN5T618=y # CONFIG_REGULATOR_S2MPA01 is not set @@ -2570,6 +2589,7 @@ CONFIG_REGULATOR_S5M8767=y # CONFIG_REGULATOR_SLG51000 is not set # CONFIG_REGULATOR_SY8106A is not set # CONFIG_REGULATOR_SY8824X is not set +# CONFIG_REGULATOR_SY8827N is not set CONFIG_REGULATOR_TPS51632=y CONFIG_REGULATOR_TPS62360=y # CONFIG_REGULATOR_TPS65023 is not set @@ -2582,6 +2602,7 @@ CONFIG_REGULATOR_TPS65218=y CONFIG_REGULATOR_TPS6586X=y CONFIG_REGULATOR_TPS65910=y # CONFIG_REGULATOR_VCTRL is not set +# CONFIG_REGULATOR_QCOM_LABIBB is not set CONFIG_RC_CORE=y CONFIG_RC_MAP=m CONFIG_LIRC=y @@ -2618,10 +2639,12 @@ CONFIG_IR_SERIAL=m # CONFIG_IR_SERIAL_TRANSMITTER is not set CONFIG_IR_SIR=m CONFIG_RC_XBOX_DVD=m +CONFIG_IR_TOY=m CONFIG_CEC_CORE=y CONFIG_CEC_NOTIFIER=y # CONFIG_MEDIA_CEC_RC is not set CONFIG_MEDIA_CEC_SUPPORT=y +# CONFIG_CEC_CH7322 is not set # CONFIG_CEC_CROS_EC is not set CONFIG_USB_PULSE8_CEC=m CONFIG_USB_RAINSHADOW_CEC=m @@ -2805,6 +2828,7 @@ CONFIG_VIDEO_ML86V7667=m # CONFIG_VIDEO_TW9906 is not set # CONFIG_VIDEO_TW9910 is not set # CONFIG_VIDEO_VPX3220 is not set +# CONFIG_VIDEO_MAX9286 is not set # # Video and audio decoders @@ -2858,6 +2882,7 @@ CONFIG_VIDEO_ML86V7667=m # Camera sensor devices # # CONFIG_VIDEO_HI556 is not set +# CONFIG_VIDEO_IMX214 is not set # CONFIG_VIDEO_IMX219 is not set # CONFIG_VIDEO_IMX258 is not set # CONFIG_VIDEO_IMX274 is not set @@ -2868,7 +2893,6 @@ CONFIG_VIDEO_ML86V7667=m # CONFIG_VIDEO_OV2659 is not set # CONFIG_VIDEO_OV2680 is not set # CONFIG_VIDEO_OV2685 is not set -# CONFIG_VIDEO_OV2740 is not set # CONFIG_VIDEO_OV5640 is not set # CONFIG_VIDEO_OV5645 is not set # CONFIG_VIDEO_OV5647 is not set @@ -2898,6 +2922,7 @@ CONFIG_VIDEO_ML86V7667=m # CONFIG_VIDEO_SR030PC30 is not set # CONFIG_VIDEO_NOON010PC30 is not set # CONFIG_VIDEO_M5MOLS is not set +# CONFIG_VIDEO_RDACM20 is not set # CONFIG_VIDEO_RJ54N1 is not set # CONFIG_VIDEO_S5K6AA is not set # CONFIG_VIDEO_S5K6A3 is not set @@ -2914,6 +2939,7 @@ CONFIG_VIDEO_ML86V7667=m # CONFIG_VIDEO_AD5820 is not set # CONFIG_VIDEO_AK7375 is not set # CONFIG_VIDEO_DW9714 is not set +# CONFIG_VIDEO_DW9768 is not set # CONFIG_VIDEO_DW9807_VCM is not set # end of Lens drivers @@ -3031,7 +3057,6 @@ CONFIG_DRM_PANEL_ORISETECH_OTM8009A=m # CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN is not set # CONFIG_DRM_PANEL_RAYDIUM_RM67191 is not set CONFIG_DRM_PANEL_RAYDIUM_RM68200=m -# CONFIG_DRM_PANEL_ROCKTECH_JH057N00900 is not set # CONFIG_DRM_PANEL_RONBO_RB070D30 is not set # CONFIG_DRM_PANEL_SAMSUNG_S6D16D0 is not set # CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2 is not set @@ -3044,6 +3069,7 @@ CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03=m # CONFIG_DRM_PANEL_SHARP_LS037V7DW01 is not set # CONFIG_DRM_PANEL_SHARP_LS043T1LE01 is not set # CONFIG_DRM_PANEL_SITRONIX_ST7701 is not set +# CONFIG_DRM_PANEL_SITRONIX_ST7703 is not set # CONFIG_DRM_PANEL_SITRONIX_ST7789V is not set # CONFIG_DRM_PANEL_SONY_ACX424AKP is not set # CONFIG_DRM_PANEL_SONY_ACX565AKM is not set @@ -3156,7 +3182,6 @@ CONFIG_FB_MODE_HELPERS=y # # CONFIG_LCD_CLASS_DEVICE is not set CONFIG_BACKLIGHT_CLASS_DEVICE=y -CONFIG_BACKLIGHT_GENERIC=y CONFIG_BACKLIGHT_PWM=y # CONFIG_BACKLIGHT_QCOM_WLED is not set # CONFIG_BACKLIGHT_ADP8860 is not set @@ -3347,7 +3372,7 @@ CONFIG_SND_SOC_MAX98090=m # CONFIG_SND_SOC_MAX98504 is not set # CONFIG_SND_SOC_MAX9867 is not set # CONFIG_SND_SOC_MAX98927 is not set -# CONFIG_SND_SOC_MAX98373 is not set +# CONFIG_SND_SOC_MAX98373_I2C is not set # CONFIG_SND_SOC_MAX98390 is not set # CONFIG_SND_SOC_MAX9860 is not set # CONFIG_SND_SOC_MSM8916_WCD_ANALOG is not set @@ -3574,8 +3599,8 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_DEFAULT_PERSIST=y # CONFIG_USB_DYNAMIC_MINORS is not set CONFIG_USB_OTG=y -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_OTG_PRODUCTLIST is not set +# CONFIG_USB_OTG_DISABLE_EXTERNAL_HUB is not set # CONFIG_USB_OTG_FSM is not set # CONFIG_USB_LEDS_TRIGGER_USBPORT is not set CONFIG_USB_AUTOSUSPEND_DELAY=2 @@ -3880,6 +3905,7 @@ CONFIG_MMC_SDHCI_EXTERNAL_DMA=y CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y CONFIG_LEDS_CLASS_FLASH=m +# CONFIG_LEDS_CLASS_MULTICOLOR is not set # CONFIG_LEDS_BRIGHTNESS_HW_CHANGED is not set # @@ -3903,10 +3929,7 @@ CONFIG_LEDS_CPCAP=m CONFIG_LEDS_GPIO=y # CONFIG_LEDS_LP3944 is not set # CONFIG_LEDS_LP3952 is not set -# CONFIG_LEDS_LP5521 is not set -# CONFIG_LEDS_LP5523 is not set -# CONFIG_LEDS_LP5562 is not set -# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_LP55XX_COMMON is not set # CONFIG_LEDS_LP8860 is not set # CONFIG_LEDS_PCA955X is not set # CONFIG_LEDS_PCA963X is not set @@ -4106,6 +4129,7 @@ CONFIG_FSL_EDMA=y # CONFIG_INTEL_IDMA64 is not set # CONFIG_NBPFAXI_DMA is not set CONFIG_PL330_DMA=y +# CONFIG_XILINX_ZYNQMP_DPDMA is not set # CONFIG_QCOM_HIDMA_MGMT is not set # CONFIG_QCOM_HIDMA is not set CONFIG_DW_DMAC_CORE=y @@ -4220,20 +4244,10 @@ CONFIG_RTL8723BS=m # end of Resolver to digital converters # end of IIO staging drivers -# -# Speakup console speech -# -# CONFIG_SPEAKUP is not set -# end of Speakup console speech - CONFIG_STAGING_MEDIA=y CONFIG_VIDEO_HANTRO=m CONFIG_VIDEO_HANTRO_ROCKCHIP=y CONFIG_VIDEO_ROCKCHIP_VDEC=m - -# -# soc_camera sensor drivers -# # CONFIG_PHY_ROCKCHIP_DPHY_RX0 is not set # CONFIG_VIDEO_ROCKCHIP_ISP1 is not set @@ -4246,10 +4260,7 @@ CONFIG_VIDEO_ROCKCHIP_VDEC=m # CONFIG_LTE_GDM724X is not set # CONFIG_GS_FPGABOOT is not set # CONFIG_UNISYSSPAR is not set -# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set # CONFIG_FB_TFT is not set -# CONFIG_WILC1000_SDIO is not set -# CONFIG_WILC1000_SPI is not set # CONFIG_KS7010 is not set # CONFIG_PI433 is not set @@ -4281,6 +4292,7 @@ CONFIG_HAVE_CLK=y CONFIG_CLKDEV_LOOKUP=y CONFIG_HAVE_CLK_PREPARE=y CONFIG_COMMON_CLK=y +# CONFIG_CLK_HSDK is not set CONFIG_COMMON_CLK_MAX77686=y # CONFIG_COMMON_CLK_MAX9485 is not set CONFIG_COMMON_CLK_RK808=y @@ -4300,6 +4312,18 @@ CONFIG_CLK_QORIQ=y # CONFIG_COMMON_CLK_PWM is not set # CONFIG_COMMON_CLK_VC5 is not set # CONFIG_COMMON_CLK_FIXED_MMIO is not set +CONFIG_COMMON_CLK_ROCKCHIP=y +CONFIG_CLK_PX30=y +CONFIG_CLK_RV110X=y +CONFIG_CLK_RK3036=y +CONFIG_CLK_RK312X=y +CONFIG_CLK_RK3188=y +CONFIG_CLK_RK322X=y +CONFIG_CLK_RK3288=y +CONFIG_CLK_RK3308=y +CONFIG_CLK_RK3328=y +CONFIG_CLK_RK3368=y +CONFIG_CLK_RK3399=y # CONFIG_HWSPINLOCK is not set # @@ -4583,6 +4607,7 @@ CONFIG_VF610_ADC=m # CONFIG_CCS811 is not set # CONFIG_IAQCORE is not set # CONFIG_PMS7003 is not set +# CONFIG_SCD30_CORE is not set # CONFIG_SENSIRION_SGP30 is not set # CONFIG_SPS30 is not set # CONFIG_VZ89X is not set @@ -4717,6 +4742,8 @@ CONFIG_MPU3050_I2C=y # CONFIG_FXOS8700_I2C is not set # CONFIG_FXOS8700_SPI is not set # CONFIG_KMX61 is not set +# CONFIG_INV_ICM42600_I2C is not set +# CONFIG_INV_ICM42600_SPI is not set # CONFIG_INV_MPU6050_I2C is not set # CONFIG_INV_MPU6050_SPI is not set # CONFIG_IIO_ST_LSM6DSX is not set @@ -5281,9 +5308,6 @@ CONFIG_LSM="yama,loadpin,safesetid,integrity" # Memory initialization # CONFIG_INIT_STACK_NONE=y -# CONFIG_GCC_PLUGIN_STRUCTLEAK_USER is not set -# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF is not set -# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL is not set # CONFIG_INIT_ON_ALLOC_DEFAULT_ON is not set # CONFIG_INIT_ON_FREE_DEFAULT_ON is not set # end of Memory initialization @@ -5541,6 +5565,7 @@ CONFIG_XZ_DEC_ARMTHUMB=y CONFIG_XZ_DEC_SPARC=y CONFIG_XZ_DEC_BCJ=y # CONFIG_XZ_DEC_TEST is not set +CONFIG_DECOMPRESS_ZSTD=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_REED_SOLOMON=y CONFIG_REED_SOLOMON_ENC8=y @@ -5549,6 +5574,7 @@ CONFIG_ASSOCIATIVE_ARRAY=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y CONFIG_HAS_DMA=y +CONFIG_DMA_OPS=y CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_DMA_DECLARE_COHERENT=y @@ -5635,6 +5661,9 @@ CONFIG_SECTION_MISMATCH_WARN_ONLY=y # # CONFIG_MAGIC_SYSRQ is not set CONFIG_DEBUG_FS=y +CONFIG_DEBUG_FS_ALLOW_ALL=y +# CONFIG_DEBUG_FS_DISALLOW_MOUNT is not set +# CONFIG_DEBUG_FS_ALLOW_NONE is not set CONFIG_HAVE_ARCH_KGDB=y # CONFIG_KGDB is not set # CONFIG_UBSAN is not set @@ -5668,7 +5697,6 @@ CONFIG_DEBUG_MEMORY_INIT=y # CONFIG_DEBUG_HIGHMEM is not set CONFIG_CC_HAS_KASAN_GENERIC=y CONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y -CONFIG_KASAN_STACK=1 # end of Memory Debugging # CONFIG_DEBUG_SHIRQ is not set @@ -5734,6 +5762,7 @@ CONFIG_STACKTRACE=y # # CONFIG_RCU_PERF_TEST is not set # CONFIG_RCU_TORTURE_TEST is not set +# CONFIG_RCU_REF_SCALE_TEST is not set CONFIG_RCU_CPU_STALL_TIMEOUT=21 CONFIG_RCU_TRACE=y # CONFIG_RCU_EQS_DEBUG is not set diff --git a/projects/Rockchip/devices/RK3328/linux/default/linux.aarch64.conf b/projects/Rockchip/devices/RK3328/linux/default/linux.aarch64.conf index 18c15f6eba..a472fbf0a7 100644 --- a/projects/Rockchip/devices/RK3328/linux/default/linux.aarch64.conf +++ b/projects/Rockchip/devices/RK3328/linux/default/linux.aarch64.conf @@ -1,8 +1,8 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 5.8.0 Kernel Configuration +# Linux/arm64 5.9.0 Kernel Configuration # -CONFIG_CC_VERSION_TEXT="aarch64-none-linux-gnu-gcc.real (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 20191025" +CONFIG_CC_VERSION_TEXT="aarch64-none-linux-gnu-gcc-9.2.1 (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 20191025" CONFIG_CC_IS_GCC=y CONFIG_GCC_VERSION=90201 CONFIG_LD_VERSION=233010000 @@ -86,7 +86,7 @@ CONFIG_TICK_CPU_ACCOUNTING=y # CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set CONFIG_IRQ_TIME_ACCOUNTING=y CONFIG_HAVE_SCHED_AVG_IRQ=y -# CONFIG_SCHED_THERMAL_PRESSURE is not set +CONFIG_SCHED_THERMAL_PRESSURE=y CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT_V3=y CONFIG_TASKSTATS=y @@ -151,6 +151,7 @@ CONFIG_CGROUP_BPF=y CONFIG_SOCK_CGROUP_DATA=y CONFIG_NAMESPACES=y CONFIG_UTS_NS=y +CONFIG_TIME_NS=y CONFIG_IPC_NS=y CONFIG_USER_NS=y CONFIG_PID_NS=y @@ -169,7 +170,9 @@ CONFIG_INITRAMFS_ROOT_GID=0 # CONFIG_RD_XZ is not set # CONFIG_RD_LZO is not set CONFIG_RD_LZ4=y +CONFIG_RD_ZSTD=y CONFIG_INITRAMFS_COMPRESSION_LZ4=y +# CONFIG_INITRAMFS_COMPRESSION_ZSTD is not set # CONFIG_INITRAMFS_COMPRESSION_NONE is not set # CONFIG_BOOT_CONFIG is not set CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y @@ -278,10 +281,12 @@ CONFIG_ARCH_PROC_KCORE_TEXT=y # CONFIG_ARCH_BITMAIN is not set # CONFIG_ARCH_BRCMSTB is not set # CONFIG_ARCH_EXYNOS is not set +# CONFIG_ARCH_SPARX5 is not set # CONFIG_ARCH_K3 is not set # CONFIG_ARCH_LAYERSCAPE is not set # CONFIG_ARCH_LG1K is not set # CONFIG_ARCH_HISI is not set +# CONFIG_ARCH_KEEMBAY is not set # CONFIG_ARCH_MEDIATEK is not set # CONFIG_ARCH_MESON is not set # CONFIG_ARCH_MVEBU is not set @@ -387,7 +392,6 @@ CONFIG_SECCOMP=y CONFIG_FORCE_MAX_ZONEORDER=11 CONFIG_UNMAP_KERNEL_AT_EL0=y CONFIG_HARDEN_BRANCH_PREDICTOR=y -CONFIG_HARDEN_EL2_VECTORS=y CONFIG_ARM64_SSBD=y CONFIG_RODATA_FULL_DEFAULT_ENABLED=y # CONFIG_ARM64_SW_TTBR0_PAN is not set @@ -429,6 +433,8 @@ CONFIG_AS_HAS_CFI_NEGATE_RA_STATE=y # ARMv8.4 architectural features # CONFIG_ARM64_AMU_EXTN=y +CONFIG_AS_HAS_ARMV8_4=y +CONFIG_ARM64_TLB_RANGE=y # end of ARMv8.4 architectural features # @@ -501,6 +507,7 @@ CONFIG_DT_IDLE_STATES=y # CONFIG_ARM_CPUIDLE=y CONFIG_ARM_PSCI_CPUIDLE=y +CONFIG_ARM_PSCI_CPUIDLE_DOMAIN=y # end of ARM CPU Idle Drivers # end of CPU Idle @@ -546,6 +553,7 @@ CONFIG_ARM_PSCI_FW=y # CONFIG_ARM_PSCI_CHECKER is not set CONFIG_HAVE_ARM_SMCCC=y CONFIG_HAVE_ARM_SMCCC_DISCOVERY=y +CONFIG_ARM_SMCCC_SOC_ID=y # # Tegra firmware driver @@ -614,7 +622,6 @@ CONFIG_HAVE_ARCH_SECCOMP_FILTER=y CONFIG_SECCOMP_FILTER=y CONFIG_HAVE_ARCH_STACKLEAK=y CONFIG_HAVE_STACKPROTECTOR=y -CONFIG_CC_HAS_STACKPROTECTOR_NONE=y CONFIG_STACKPROTECTOR=y CONFIG_STACKPROTECTOR_STRONG=y CONFIG_HAVE_CONTEXT_TRACKING=y @@ -630,7 +637,6 @@ CONFIG_ARCH_MMAP_RND_BITS=18 CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11 CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y -CONFIG_HAVE_COPY_THREAD_TLS=y CONFIG_CLONE_BACKWARDS=y CONFIG_OLD_SIGSUSPEND3=y CONFIG_COMPAT_OLD_SIGACTION=y @@ -655,9 +661,7 @@ CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y # end of GCOV-based kernel profiling CONFIG_HAVE_GCC_PLUGINS=y -CONFIG_GCC_PLUGINS=y -# CONFIG_GCC_PLUGIN_LATENT_ENTROPY is not set -# CONFIG_GCC_PLUGIN_RANDSTRUCT is not set +# CONFIG_GCC_PLUGINS is not set # end of General architecture-dependent options CONFIG_RT_MUTEXES=y @@ -795,7 +799,6 @@ CONFIG_SELECT_MEMORY_MODEL=y # CONFIG_FLATMEM_MANUAL is not set CONFIG_SPARSEMEM_MANUAL=y CONFIG_SPARSEMEM=y -CONFIG_HAVE_MEMORY_PRESENT=y CONFIG_SPARSEMEM_EXTREME=y CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y CONFIG_SPARSEMEM_VMEMMAP=y @@ -1293,6 +1296,7 @@ CONFIG_DEV_COREDUMP=y # CONFIG_TEST_ASYNC_DRIVER_PROBE is not set CONFIG_GENERIC_CPU_AUTOPROBE=y CONFIG_GENERIC_CPU_VULNERABILITIES=y +CONFIG_SOC_BUS=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y CONFIG_REGMAP_SPI=y @@ -1382,9 +1386,13 @@ CONFIG_MTD_CFI_I2=y # CONFIG_MTD_DOCG3 is not set # end of Self-contained MTD device drivers +# +# NAND +# # CONFIG_MTD_ONENAND is not set # CONFIG_MTD_RAW_NAND is not set # CONFIG_MTD_SPI_NAND is not set +# end of NAND # # LPDDR & LPDDR2 PCM memory drivers @@ -1394,7 +1402,6 @@ CONFIG_MTD_CFI_I2=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y -# CONFIG_SPI_CADENCE_QUADSPI is not set # CONFIG_MTD_UBI is not set # CONFIG_MTD_HYPERBUS is not set CONFIG_DTC=y @@ -1612,6 +1619,7 @@ CONFIG_DWMAC_ROCKCHIP=y # CONFIG_NET_VENDOR_XILINX is not set CONFIG_MDIO_DEVICE=y CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVRES=y # CONFIG_MDIO_BCM_UNIMAC is not set CONFIG_MDIO_BITBANG=y CONFIG_MDIO_BUS_MUX=y @@ -1812,6 +1820,7 @@ CONFIG_MT7601U=m CONFIG_MT76_CORE=m CONFIG_MT76_LEDS=y CONFIG_MT76_USB=m +CONFIG_MT76_SDIO=m CONFIG_MT76x02_LIB=m CONFIG_MT76x02_USB=m CONFIG_MT76x0_COMMON=m @@ -1819,7 +1828,12 @@ CONFIG_MT76x0U=m CONFIG_MT76x2_COMMON=m CONFIG_MT76x2U=m CONFIG_MT7615_COMMON=m +CONFIG_MT7663_USB_SDIO_COMMON=m CONFIG_MT7663U=m +CONFIG_MT7663S=m +CONFIG_WLAN_VENDOR_MICROCHIP=y +# CONFIG_WILC1000_SDIO is not set +# CONFIG_WILC1000_SPI is not set CONFIG_WLAN_VENDOR_RALINK=y CONFIG_RT2X00=m CONFIG_RT2500USB=m @@ -2069,6 +2083,7 @@ CONFIG_VIRTIO_CONSOLE=y # CONFIG_IPMI_HANDLER is not set CONFIG_HW_RANDOM=m # CONFIG_HW_RANDOM_TIMERIOMEM is not set +# CONFIG_HW_RANDOM_BA431 is not set # CONFIG_HW_RANDOM_VIRTIO is not set CONFIG_HW_RANDOM_OPTEE=m # CONFIG_HW_RANDOM_CCTRNG is not set @@ -2163,6 +2178,7 @@ CONFIG_SPI_MEM=y # CONFIG_SPI_AXI_SPI_ENGINE is not set CONFIG_SPI_BITBANG=m # CONFIG_SPI_CADENCE is not set +# CONFIG_SPI_CADENCE_QUADSPI is not set # CONFIG_SPI_DESIGNWARE is not set # CONFIG_SPI_NXP_FLEXSPI is not set CONFIG_SPI_GPIO=m @@ -2190,6 +2206,7 @@ CONFIG_SPI_SPIDEV=m # CONFIG_SPI_LOOPBACK_TEST is not set # CONFIG_SPI_TLE62X0 is not set # CONFIG_SPI_SLAVE is not set +CONFIG_SPI_DYNAMIC=y CONFIG_SPMI=y # CONFIG_HSI is not set CONFIG_PPS=y @@ -2271,6 +2288,7 @@ CONFIG_GPIO_SYSCON=y # CONFIG_GPIO_MAX732X is not set CONFIG_GPIO_PCA953X=y CONFIG_GPIO_PCA953X_IRQ=y +# CONFIG_GPIO_PCA9570 is not set # CONFIG_GPIO_PCF857X is not set # CONFIG_GPIO_TPIC2810 is not set # end of I2C GPIO expanders @@ -2344,6 +2362,7 @@ CONFIG_POWER_SUPPLY_HWMON=y # CONFIG_CHARGER_BQ24190 is not set # CONFIG_CHARGER_BQ24257 is not set # CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_BQ2515X is not set # CONFIG_CHARGER_BQ25890 is not set # CONFIG_CHARGER_SMB347 is not set # CONFIG_BATTERY_GAUGE_LTC2941 is not set @@ -2378,6 +2397,7 @@ CONFIG_HWMON=y CONFIG_SENSORS_ARM_SCPI=y # CONFIG_SENSORS_ASPEED is not set # CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_CORSAIR_CPRO is not set # CONFIG_SENSORS_DS620 is not set # CONFIG_SENSORS_DS1621 is not set # CONFIG_SENSORS_F71805F is not set @@ -2491,6 +2511,7 @@ CONFIG_SENSORS_INA2XX=m # CONFIG_SENSORS_W83627HF is not set # CONFIG_SENSORS_W83627EHF is not set CONFIG_THERMAL=y +# CONFIG_THERMAL_NETLINK is not set # CONFIG_THERMAL_STATISTICS is not set CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 CONFIG_THERMAL_HWMON=y @@ -2505,7 +2526,6 @@ CONFIG_THERMAL_GOV_STEP_WISE=y # CONFIG_THERMAL_GOV_USER_SPACE is not set CONFIG_CPU_THERMAL=y CONFIG_CPU_FREQ_THERMAL=y -# CONFIG_CLOCK_THERMAL is not set CONFIG_DEVFREQ_THERMAL=y CONFIG_THERMAL_EMULATION=y # CONFIG_THERMAL_MMIO is not set @@ -2619,7 +2639,6 @@ CONFIG_MFD_SEC_CORE=y # CONFIG_MFD_SI476X_CORE is not set # CONFIG_MFD_SM501 is not set # CONFIG_MFD_SKY81452 is not set -# CONFIG_MFD_SMSC is not set # CONFIG_ABX500_CORE is not set # CONFIG_MFD_STMPE is not set CONFIG_MFD_SYSCON=y @@ -2661,6 +2680,7 @@ CONFIG_MFD_SYSCON=y # CONFIG_MFD_ROHM_BD71828 is not set # CONFIG_MFD_STPMIC1 is not set # CONFIG_MFD_STMFX is not set +# CONFIG_MFD_KHADAS_MCU is not set # CONFIG_RAVE_SP_CORE is not set # end of Multifunction device drivers @@ -2675,6 +2695,7 @@ CONFIG_REGULATOR_FIXED_VOLTAGE=y # CONFIG_REGULATOR_DA9210 is not set # CONFIG_REGULATOR_DA9211 is not set CONFIG_REGULATOR_FAN53555=y +# CONFIG_REGULATOR_FAN53880 is not set CONFIG_REGULATOR_GPIO=y # CONFIG_REGULATOR_ISL9305 is not set # CONFIG_REGULATOR_ISL6271A is not set @@ -2697,12 +2718,14 @@ CONFIG_REGULATOR_GPIO=y # CONFIG_REGULATOR_MP886X is not set # CONFIG_REGULATOR_MPQ7920 is not set # CONFIG_REGULATOR_MT6311 is not set +# CONFIG_REGULATOR_PCA9450 is not set # CONFIG_REGULATOR_PFUZE100 is not set # CONFIG_REGULATOR_PV88060 is not set # CONFIG_REGULATOR_PV88080 is not set # CONFIG_REGULATOR_PV88090 is not set CONFIG_REGULATOR_PWM=y # CONFIG_REGULATOR_QCOM_SPMI is not set +# CONFIG_REGULATOR_QCOM_USB_VBUS is not set CONFIG_REGULATOR_RK808=y # CONFIG_REGULATOR_S2MPA01 is not set # CONFIG_REGULATOR_S2MPS11 is not set @@ -2710,6 +2733,7 @@ CONFIG_REGULATOR_RK808=y # CONFIG_REGULATOR_SLG51000 is not set # CONFIG_REGULATOR_SY8106A is not set # CONFIG_REGULATOR_SY8824X is not set +# CONFIG_REGULATOR_SY8827N is not set # CONFIG_REGULATOR_TPS51632 is not set # CONFIG_REGULATOR_TPS62360 is not set # CONFIG_REGULATOR_TPS65023 is not set @@ -2717,6 +2741,7 @@ CONFIG_REGULATOR_RK808=y # CONFIG_REGULATOR_TPS65132 is not set # CONFIG_REGULATOR_TPS6524X is not set # CONFIG_REGULATOR_VCTRL is not set +# CONFIG_REGULATOR_QCOM_LABIBB is not set CONFIG_RC_CORE=y CONFIG_RC_MAP=m CONFIG_LIRC=y @@ -2753,10 +2778,12 @@ CONFIG_IR_SERIAL=m # CONFIG_IR_SERIAL_TRANSMITTER is not set CONFIG_IR_SIR=m CONFIG_RC_XBOX_DVD=m +CONFIG_IR_TOY=m CONFIG_CEC_CORE=y CONFIG_CEC_NOTIFIER=y # CONFIG_MEDIA_CEC_RC is not set CONFIG_MEDIA_CEC_SUPPORT=y +# CONFIG_CEC_CH7322 is not set CONFIG_USB_PULSE8_CEC=m CONFIG_USB_RAINSHADOW_CEC=m CONFIG_MEDIA_SUPPORT=m @@ -2894,6 +2921,7 @@ CONFIG_VIDEO_IR_I2C=m # Camera sensor devices # # CONFIG_VIDEO_HI556 is not set +# CONFIG_VIDEO_IMX214 is not set # CONFIG_VIDEO_IMX219 is not set # CONFIG_VIDEO_IMX258 is not set # CONFIG_VIDEO_IMX274 is not set @@ -2904,7 +2932,6 @@ CONFIG_VIDEO_IR_I2C=m # CONFIG_VIDEO_OV2659 is not set # CONFIG_VIDEO_OV2680 is not set # CONFIG_VIDEO_OV2685 is not set -# CONFIG_VIDEO_OV2740 is not set # CONFIG_VIDEO_OV5640 is not set # CONFIG_VIDEO_OV5645 is not set # CONFIG_VIDEO_OV5647 is not set @@ -2934,6 +2961,7 @@ CONFIG_VIDEO_IR_I2C=m # CONFIG_VIDEO_SR030PC30 is not set # CONFIG_VIDEO_NOON010PC30 is not set # CONFIG_VIDEO_M5MOLS is not set +# CONFIG_VIDEO_RDACM20 is not set # CONFIG_VIDEO_RJ54N1 is not set # CONFIG_VIDEO_S5K6AA is not set # CONFIG_VIDEO_S5K6A3 is not set @@ -2950,6 +2978,7 @@ CONFIG_VIDEO_IR_I2C=m # CONFIG_VIDEO_AD5820 is not set # CONFIG_VIDEO_AK7375 is not set # CONFIG_VIDEO_DW9714 is not set +# CONFIG_VIDEO_DW9768 is not set # CONFIG_VIDEO_DW9807_VCM is not set # end of Lens drivers @@ -3190,7 +3219,7 @@ CONFIG_FB_MODE_HELPERS=y # # Frame buffer hardware drivers # -CONFIG_FB_ARMCLCD=y +# CONFIG_FB_ARMCLCD is not set # CONFIG_FB_OPENCORES is not set # CONFIG_FB_S1D13XXX is not set # CONFIG_FB_SMSCUFX is not set @@ -3207,7 +3236,6 @@ CONFIG_FB_ARMCLCD=y # # CONFIG_LCD_CLASS_DEVICE is not set CONFIG_BACKLIGHT_CLASS_DEVICE=y -# CONFIG_BACKLIGHT_GENERIC is not set # CONFIG_BACKLIGHT_PWM is not set # CONFIG_BACKLIGHT_QCOM_WLED is not set # CONFIG_BACKLIGHT_ADP8860 is not set @@ -3313,6 +3341,7 @@ CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y # CONFIG_SND_I2S_HI6210_I2S is not set # CONFIG_SND_SOC_IMG is not set +# CONFIG_SND_SOC_INTEL_KEEMBAY is not set # CONFIG_SND_SOC_MTK_BTCVSD is not set CONFIG_SND_SOC_ROCKCHIP=y CONFIG_SND_SOC_ROCKCHIP_I2S=y @@ -3395,7 +3424,7 @@ CONFIG_SND_SOC_MAX98357A=m # CONFIG_SND_SOC_MAX98504 is not set # CONFIG_SND_SOC_MAX9867 is not set # CONFIG_SND_SOC_MAX98927 is not set -# CONFIG_SND_SOC_MAX98373 is not set +# CONFIG_SND_SOC_MAX98373_I2C is not set # CONFIG_SND_SOC_MAX98390 is not set # CONFIG_SND_SOC_MAX9860 is not set # CONFIG_SND_SOC_MSM8916_WCD_ANALOG is not set @@ -3623,8 +3652,8 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_DEFAULT_PERSIST=y # CONFIG_USB_DYNAMIC_MINORS is not set CONFIG_USB_OTG=y -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_OTG_PRODUCTLIST is not set +# CONFIG_USB_OTG_DISABLE_EXTERNAL_HUB is not set # CONFIG_USB_OTG_FSM is not set # CONFIG_USB_LEDS_TRIGGER_USBPORT is not set CONFIG_USB_AUTOSUSPEND_DELAY=2 @@ -3883,6 +3912,7 @@ CONFIG_MMC_CQHCI=y CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y CONFIG_LEDS_CLASS_FLASH=m +# CONFIG_LEDS_CLASS_MULTICOLOR is not set # CONFIG_LEDS_BRIGHTNESS_HW_CHANGED is not set # @@ -3905,10 +3935,7 @@ CONFIG_LEDS_CLASS_FLASH=m CONFIG_LEDS_GPIO=y # CONFIG_LEDS_LP3944 is not set # CONFIG_LEDS_LP3952 is not set -# CONFIG_LEDS_LP5521 is not set -# CONFIG_LEDS_LP5523 is not set -# CONFIG_LEDS_LP5562 is not set -# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_LP55XX_COMMON is not set # CONFIG_LEDS_LP8860 is not set # CONFIG_LEDS_PCA955X is not set # CONFIG_LEDS_PCA963X is not set @@ -4098,6 +4125,7 @@ CONFIG_DMA_OF=y CONFIG_PL330_DMA=y # CONFIG_XILINX_DMA is not set # CONFIG_XILINX_ZYNQMP_DMA is not set +# CONFIG_XILINX_ZYNQMP_DPDMA is not set # CONFIG_QCOM_HIDMA_MGMT is not set # CONFIG_QCOM_HIDMA is not set # CONFIG_DW_DMAC is not set @@ -4215,20 +4243,10 @@ CONFIG_RTL8723BS=m # end of Resolver to digital converters # end of IIO staging drivers -# -# Speakup console speech -# -# CONFIG_SPEAKUP is not set -# end of Speakup console speech - CONFIG_STAGING_MEDIA=y CONFIG_VIDEO_HANTRO=m CONFIG_VIDEO_HANTRO_ROCKCHIP=y CONFIG_VIDEO_ROCKCHIP_VDEC=m - -# -# soc_camera sensor drivers -# # CONFIG_PHY_ROCKCHIP_DPHY_RX0 is not set # CONFIG_VIDEO_ROCKCHIP_ISP1 is not set # CONFIG_VIDEO_USBVISION is not set @@ -4242,10 +4260,7 @@ CONFIG_VIDEO_ROCKCHIP_VDEC=m # CONFIG_LTE_GDM724X is not set # CONFIG_GS_FPGABOOT is not set # CONFIG_UNISYSSPAR is not set -# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set # CONFIG_FB_TFT is not set -# CONFIG_WILC1000_SDIO is not set -# CONFIG_WILC1000_SPI is not set # CONFIG_KS7010 is not set # CONFIG_PI433 is not set @@ -4266,6 +4281,7 @@ CONFIG_HAVE_CLK=y CONFIG_CLKDEV_LOOKUP=y CONFIG_HAVE_CLK_PREPARE=y CONFIG_COMMON_CLK=y +# CONFIG_CLK_HSDK is not set # CONFIG_COMMON_CLK_MAX77686 is not set # CONFIG_COMMON_CLK_MAX9485 is not set CONFIG_COMMON_CLK_RK808=y @@ -4284,6 +4300,17 @@ CONFIG_COMMON_CLK_XGENE=y CONFIG_COMMON_CLK_PWM=y # CONFIG_COMMON_CLK_VC5 is not set # CONFIG_COMMON_CLK_FIXED_MMIO is not set +CONFIG_COMMON_CLK_ROCKCHIP=y +CONFIG_CLK_PX30=y +CONFIG_CLK_RV110X=y +CONFIG_CLK_RK3036=y +CONFIG_CLK_RK312X=y +CONFIG_CLK_RK3188=y +CONFIG_CLK_RK322X=y +CONFIG_CLK_RK3308=y +CONFIG_CLK_RK3328=y +CONFIG_CLK_RK3368=y +CONFIG_CLK_RK3399=y CONFIG_HWSPINLOCK=y # @@ -4428,9 +4455,14 @@ CONFIG_EXTCON=y CONFIG_EXTCON_USB_GPIO=y # CONFIG_MEMORY is not set CONFIG_IIO=y -# CONFIG_IIO_BUFFER is not set +CONFIG_IIO_BUFFER=y +# CONFIG_IIO_BUFFER_CB is not set +# CONFIG_IIO_BUFFER_HW_CONSUMER is not set +CONFIG_IIO_KFIFO_BUF=y +CONFIG_IIO_TRIGGERED_BUFFER=y # CONFIG_IIO_CONFIGFS is not set -# CONFIG_IIO_TRIGGER is not set +CONFIG_IIO_TRIGGER=y +CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 # CONFIG_IIO_SW_DEVICE is not set # CONFIG_IIO_SW_TRIGGER is not set @@ -4556,6 +4588,7 @@ CONFIG_ROCKCHIP_SARADC=y # CONFIG_CCS811 is not set # CONFIG_IAQCORE is not set # CONFIG_PMS7003 is not set +# CONFIG_SCD30_CORE is not set # CONFIG_SENSIRION_SGP30 is not set # CONFIG_SPS30 is not set # CONFIG_VZ89X is not set @@ -4687,6 +4720,8 @@ CONFIG_ROCKCHIP_SARADC=y # CONFIG_FXOS8700_I2C is not set # CONFIG_FXOS8700_SPI is not set # CONFIG_KMX61 is not set +# CONFIG_INV_ICM42600_I2C is not set +# CONFIG_INV_ICM42600_SPI is not set # CONFIG_INV_MPU6050_I2C is not set # CONFIG_INV_MPU6050_SPI is not set # CONFIG_IIO_ST_LSM6DSX is not set @@ -4769,6 +4804,13 @@ CONFIG_ROCKCHIP_SARADC=y # # end of Inclinometer sensors +# +# Triggers - standalone +# +# CONFIG_IIO_INTERRUPT_TRIGGER is not set +# CONFIG_IIO_SYSFS_TRIGGER is not set +# end of Triggers - standalone + # # Linear and angular position sensors # @@ -5084,6 +5126,7 @@ CONFIG_SYSFS=y CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TMPFS_XATTR=y +# CONFIG_TMPFS_INODE64 is not set CONFIG_HUGETLBFS=y CONFIG_HUGETLB_PAGE=y CONFIG_MEMFD_CREATE=y @@ -5271,10 +5314,6 @@ CONFIG_LSM="yama,loadpin,safesetid,integrity" # Memory initialization # CONFIG_INIT_STACK_NONE=y -# CONFIG_GCC_PLUGIN_STRUCTLEAK_USER is not set -# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF is not set -# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL is not set -# CONFIG_GCC_PLUGIN_STACKLEAK is not set # CONFIG_INIT_ON_ALLOC_DEFAULT_ON is not set # CONFIG_INIT_ON_FREE_DEFAULT_ON is not set # end of Memory initialization @@ -5539,6 +5578,7 @@ CONFIG_XZ_DEC_SPARC=y CONFIG_XZ_DEC_BCJ=y # CONFIG_XZ_DEC_TEST is not set CONFIG_DECOMPRESS_LZ4=y +CONFIG_DECOMPRESS_ZSTD=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_REED_SOLOMON=y CONFIG_REED_SOLOMON_ENC8=y @@ -5547,6 +5587,7 @@ CONFIG_XARRAY_MULTI=y CONFIG_ASSOCIATIVE_ARRAY=y CONFIG_HAS_IOMEM=y CONFIG_HAS_DMA=y +CONFIG_DMA_OPS=y CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y @@ -5576,6 +5617,8 @@ CONFIG_CMA_ALIGNMENT=8 CONFIG_SGL_ALLOC=y CONFIG_CPU_RMAP=y CONFIG_DQL=y +CONFIG_GLOB=y +# CONFIG_GLOB_SELFTEST is not set CONFIG_NLATTR=y CONFIG_CLZ_TAB=y # CONFIG_IRQ_POLL is not set @@ -5584,6 +5627,7 @@ CONFIG_LIBFDT=y CONFIG_OID_REGISTRY=y CONFIG_HAVE_GENERIC_VDSO=y CONFIG_GENERIC_GETTIMEOFDAY=y +CONFIG_GENERIC_VDSO_TIME_NS=y CONFIG_FONT_SUPPORT=y # CONFIG_FONTS is not set CONFIG_FONT_8x8=y @@ -5642,6 +5686,9 @@ CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 CONFIG_MAGIC_SYSRQ_SERIAL=y CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE="" CONFIG_DEBUG_FS=y +CONFIG_DEBUG_FS_ALLOW_ALL=y +# CONFIG_DEBUG_FS_DISALLOW_MOUNT is not set +# CONFIG_DEBUG_FS_ALLOW_NONE is not set CONFIG_HAVE_ARCH_KGDB=y # CONFIG_KGDB is not set CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y @@ -5682,7 +5729,6 @@ CONFIG_HAVE_ARCH_KASAN_SW_TAGS=y CONFIG_CC_HAS_KASAN_GENERIC=y CONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y # CONFIG_KASAN is not set -CONFIG_KASAN_STACK=1 # end of Memory Debugging # CONFIG_DEBUG_SHIRQ is not set @@ -5749,6 +5795,7 @@ CONFIG_HAVE_DEBUG_BUGVERBOSE=y # # CONFIG_RCU_PERF_TEST is not set # CONFIG_RCU_TORTURE_TEST is not set +# CONFIG_RCU_REF_SCALE_TEST is not set CONFIG_RCU_CPU_STALL_TIMEOUT=21 # CONFIG_RCU_TRACE is not set # CONFIG_RCU_EQS_DEBUG is not set diff --git a/projects/Rockchip/devices/RK3399/linux/default/linux.aarch64.conf b/projects/Rockchip/devices/RK3399/linux/default/linux.aarch64.conf index 8da146b90e..a279c4745b 100644 --- a/projects/Rockchip/devices/RK3399/linux/default/linux.aarch64.conf +++ b/projects/Rockchip/devices/RK3399/linux/default/linux.aarch64.conf @@ -1,8 +1,8 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 5.8.0 Kernel Configuration +# Linux/arm64 5.9.0 Kernel Configuration # -CONFIG_CC_VERSION_TEXT="aarch64-none-linux-gnu-gcc.real (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 20191025" +CONFIG_CC_VERSION_TEXT="aarch64-none-linux-gnu-gcc-9.2.1 (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 20191025" CONFIG_CC_IS_GCC=y CONFIG_GCC_VERSION=90201 CONFIG_LD_VERSION=233010000 @@ -86,7 +86,7 @@ CONFIG_TICK_CPU_ACCOUNTING=y # CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set CONFIG_IRQ_TIME_ACCOUNTING=y CONFIG_HAVE_SCHED_AVG_IRQ=y -# CONFIG_SCHED_THERMAL_PRESSURE is not set +CONFIG_SCHED_THERMAL_PRESSURE=y CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT_V3=y CONFIG_TASKSTATS=y @@ -151,6 +151,7 @@ CONFIG_CGROUP_BPF=y CONFIG_SOCK_CGROUP_DATA=y CONFIG_NAMESPACES=y CONFIG_UTS_NS=y +CONFIG_TIME_NS=y CONFIG_IPC_NS=y CONFIG_USER_NS=y CONFIG_PID_NS=y @@ -169,7 +170,9 @@ CONFIG_INITRAMFS_ROOT_GID=0 # CONFIG_RD_XZ is not set # CONFIG_RD_LZO is not set CONFIG_RD_LZ4=y +CONFIG_RD_ZSTD=y CONFIG_INITRAMFS_COMPRESSION_LZ4=y +# CONFIG_INITRAMFS_COMPRESSION_ZSTD is not set # CONFIG_INITRAMFS_COMPRESSION_NONE is not set # CONFIG_BOOT_CONFIG is not set CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y @@ -278,10 +281,12 @@ CONFIG_ARCH_PROC_KCORE_TEXT=y # CONFIG_ARCH_BITMAIN is not set # CONFIG_ARCH_BRCMSTB is not set # CONFIG_ARCH_EXYNOS is not set +# CONFIG_ARCH_SPARX5 is not set # CONFIG_ARCH_K3 is not set # CONFIG_ARCH_LAYERSCAPE is not set # CONFIG_ARCH_LG1K is not set # CONFIG_ARCH_HISI is not set +# CONFIG_ARCH_KEEMBAY is not set # CONFIG_ARCH_MEDIATEK is not set # CONFIG_ARCH_MESON is not set # CONFIG_ARCH_MVEBU is not set @@ -387,7 +392,6 @@ CONFIG_SECCOMP=y CONFIG_FORCE_MAX_ZONEORDER=11 CONFIG_UNMAP_KERNEL_AT_EL0=y CONFIG_HARDEN_BRANCH_PREDICTOR=y -CONFIG_HARDEN_EL2_VECTORS=y CONFIG_ARM64_SSBD=y CONFIG_RODATA_FULL_DEFAULT_ENABLED=y # CONFIG_ARM64_SW_TTBR0_PAN is not set @@ -429,6 +433,8 @@ CONFIG_AS_HAS_CFI_NEGATE_RA_STATE=y # ARMv8.4 architectural features # CONFIG_ARM64_AMU_EXTN=y +CONFIG_AS_HAS_ARMV8_4=y +CONFIG_ARM64_TLB_RANGE=y # end of ARMv8.4 architectural features # @@ -501,6 +507,7 @@ CONFIG_DT_IDLE_STATES=y # CONFIG_ARM_CPUIDLE=y CONFIG_ARM_PSCI_CPUIDLE=y +CONFIG_ARM_PSCI_CPUIDLE_DOMAIN=y # end of ARM CPU Idle Drivers # end of CPU Idle @@ -546,6 +553,7 @@ CONFIG_ARM_PSCI_FW=y # CONFIG_ARM_PSCI_CHECKER is not set CONFIG_HAVE_ARM_SMCCC=y CONFIG_HAVE_ARM_SMCCC_DISCOVERY=y +CONFIG_ARM_SMCCC_SOC_ID=y # # Tegra firmware driver @@ -614,7 +622,6 @@ CONFIG_HAVE_ARCH_SECCOMP_FILTER=y CONFIG_SECCOMP_FILTER=y CONFIG_HAVE_ARCH_STACKLEAK=y CONFIG_HAVE_STACKPROTECTOR=y -CONFIG_CC_HAS_STACKPROTECTOR_NONE=y CONFIG_STACKPROTECTOR=y CONFIG_STACKPROTECTOR_STRONG=y CONFIG_HAVE_CONTEXT_TRACKING=y @@ -630,7 +637,6 @@ CONFIG_ARCH_MMAP_RND_BITS=18 CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11 CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y -CONFIG_HAVE_COPY_THREAD_TLS=y CONFIG_CLONE_BACKWARDS=y CONFIG_OLD_SIGSUSPEND3=y CONFIG_COMPAT_OLD_SIGACTION=y @@ -655,9 +661,7 @@ CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y # end of GCOV-based kernel profiling CONFIG_HAVE_GCC_PLUGINS=y -CONFIG_GCC_PLUGINS=y -# CONFIG_GCC_PLUGIN_LATENT_ENTROPY is not set -# CONFIG_GCC_PLUGIN_RANDSTRUCT is not set +# CONFIG_GCC_PLUGINS is not set # end of General architecture-dependent options CONFIG_RT_MUTEXES=y @@ -795,7 +799,6 @@ CONFIG_SELECT_MEMORY_MODEL=y # CONFIG_FLATMEM_MANUAL is not set CONFIG_SPARSEMEM_MANUAL=y CONFIG_SPARSEMEM=y -CONFIG_HAVE_MEMORY_PRESENT=y CONFIG_SPARSEMEM_EXTREME=y CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y CONFIG_SPARSEMEM_VMEMMAP=y @@ -1293,6 +1296,7 @@ CONFIG_DEV_COREDUMP=y # CONFIG_TEST_ASYNC_DRIVER_PROBE is not set CONFIG_GENERIC_CPU_AUTOPROBE=y CONFIG_GENERIC_CPU_VULNERABILITIES=y +CONFIG_SOC_BUS=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y CONFIG_REGMAP_SPI=y @@ -1382,9 +1386,13 @@ CONFIG_MTD_CFI_I2=y # CONFIG_MTD_DOCG3 is not set # end of Self-contained MTD device drivers +# +# NAND +# # CONFIG_MTD_ONENAND is not set # CONFIG_MTD_RAW_NAND is not set # CONFIG_MTD_SPI_NAND is not set +# end of NAND # # LPDDR & LPDDR2 PCM memory drivers @@ -1394,7 +1402,6 @@ CONFIG_MTD_CFI_I2=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y -# CONFIG_SPI_CADENCE_QUADSPI is not set # CONFIG_MTD_UBI is not set # CONFIG_MTD_HYPERBUS is not set CONFIG_DTC=y @@ -1612,6 +1619,7 @@ CONFIG_DWMAC_ROCKCHIP=y # CONFIG_NET_VENDOR_XILINX is not set CONFIG_MDIO_DEVICE=y CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVRES=y # CONFIG_MDIO_BCM_UNIMAC is not set CONFIG_MDIO_BITBANG=y CONFIG_MDIO_BUS_MUX=y @@ -1812,6 +1820,7 @@ CONFIG_MT7601U=m CONFIG_MT76_CORE=m CONFIG_MT76_LEDS=y CONFIG_MT76_USB=m +CONFIG_MT76_SDIO=m CONFIG_MT76x02_LIB=m CONFIG_MT76x02_USB=m CONFIG_MT76x0_COMMON=m @@ -1819,7 +1828,12 @@ CONFIG_MT76x0U=m CONFIG_MT76x2_COMMON=m CONFIG_MT76x2U=m CONFIG_MT7615_COMMON=m +CONFIG_MT7663_USB_SDIO_COMMON=m CONFIG_MT7663U=m +CONFIG_MT7663S=m +CONFIG_WLAN_VENDOR_MICROCHIP=y +# CONFIG_WILC1000_SDIO is not set +# CONFIG_WILC1000_SPI is not set CONFIG_WLAN_VENDOR_RALINK=y CONFIG_RT2X00=m CONFIG_RT2500USB=m @@ -2069,6 +2083,7 @@ CONFIG_VIRTIO_CONSOLE=y # CONFIG_IPMI_HANDLER is not set CONFIG_HW_RANDOM=m # CONFIG_HW_RANDOM_TIMERIOMEM is not set +# CONFIG_HW_RANDOM_BA431 is not set # CONFIG_HW_RANDOM_VIRTIO is not set CONFIG_HW_RANDOM_OPTEE=m # CONFIG_HW_RANDOM_CCTRNG is not set @@ -2163,6 +2178,7 @@ CONFIG_SPI_MEM=y # CONFIG_SPI_AXI_SPI_ENGINE is not set CONFIG_SPI_BITBANG=m # CONFIG_SPI_CADENCE is not set +# CONFIG_SPI_CADENCE_QUADSPI is not set # CONFIG_SPI_DESIGNWARE is not set # CONFIG_SPI_NXP_FLEXSPI is not set CONFIG_SPI_GPIO=m @@ -2190,6 +2206,7 @@ CONFIG_SPI_SPIDEV=m # CONFIG_SPI_LOOPBACK_TEST is not set # CONFIG_SPI_TLE62X0 is not set # CONFIG_SPI_SLAVE is not set +CONFIG_SPI_DYNAMIC=y CONFIG_SPMI=y # CONFIG_HSI is not set CONFIG_PPS=y @@ -2271,6 +2288,7 @@ CONFIG_GPIO_SYSCON=y # CONFIG_GPIO_MAX732X is not set CONFIG_GPIO_PCA953X=y CONFIG_GPIO_PCA953X_IRQ=y +# CONFIG_GPIO_PCA9570 is not set # CONFIG_GPIO_PCF857X is not set # CONFIG_GPIO_TPIC2810 is not set # end of I2C GPIO expanders @@ -2344,6 +2362,7 @@ CONFIG_POWER_SUPPLY_HWMON=y # CONFIG_CHARGER_BQ24190 is not set # CONFIG_CHARGER_BQ24257 is not set # CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_BQ2515X is not set # CONFIG_CHARGER_BQ25890 is not set # CONFIG_CHARGER_SMB347 is not set # CONFIG_BATTERY_GAUGE_LTC2941 is not set @@ -2378,6 +2397,7 @@ CONFIG_HWMON=y CONFIG_SENSORS_ARM_SCPI=y # CONFIG_SENSORS_ASPEED is not set # CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_CORSAIR_CPRO is not set # CONFIG_SENSORS_DS620 is not set # CONFIG_SENSORS_DS1621 is not set # CONFIG_SENSORS_F71805F is not set @@ -2491,6 +2511,7 @@ CONFIG_SENSORS_INA2XX=m # CONFIG_SENSORS_W83627HF is not set # CONFIG_SENSORS_W83627EHF is not set CONFIG_THERMAL=y +# CONFIG_THERMAL_NETLINK is not set # CONFIG_THERMAL_STATISTICS is not set CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 CONFIG_THERMAL_HWMON=y @@ -2505,7 +2526,6 @@ CONFIG_THERMAL_GOV_STEP_WISE=y # CONFIG_THERMAL_GOV_USER_SPACE is not set CONFIG_CPU_THERMAL=y CONFIG_CPU_FREQ_THERMAL=y -# CONFIG_CLOCK_THERMAL is not set CONFIG_DEVFREQ_THERMAL=y CONFIG_THERMAL_EMULATION=y # CONFIG_THERMAL_MMIO is not set @@ -2619,7 +2639,6 @@ CONFIG_MFD_SEC_CORE=y # CONFIG_MFD_SI476X_CORE is not set # CONFIG_MFD_SM501 is not set # CONFIG_MFD_SKY81452 is not set -# CONFIG_MFD_SMSC is not set # CONFIG_ABX500_CORE is not set # CONFIG_MFD_STMPE is not set CONFIG_MFD_SYSCON=y @@ -2661,6 +2680,7 @@ CONFIG_MFD_SYSCON=y # CONFIG_MFD_ROHM_BD71828 is not set # CONFIG_MFD_STPMIC1 is not set # CONFIG_MFD_STMFX is not set +# CONFIG_MFD_KHADAS_MCU is not set # CONFIG_RAVE_SP_CORE is not set # end of Multifunction device drivers @@ -2675,6 +2695,7 @@ CONFIG_REGULATOR_FIXED_VOLTAGE=y # CONFIG_REGULATOR_DA9210 is not set # CONFIG_REGULATOR_DA9211 is not set CONFIG_REGULATOR_FAN53555=y +# CONFIG_REGULATOR_FAN53880 is not set CONFIG_REGULATOR_GPIO=y # CONFIG_REGULATOR_ISL9305 is not set # CONFIG_REGULATOR_ISL6271A is not set @@ -2697,12 +2718,14 @@ CONFIG_REGULATOR_GPIO=y # CONFIG_REGULATOR_MP886X is not set # CONFIG_REGULATOR_MPQ7920 is not set # CONFIG_REGULATOR_MT6311 is not set +# CONFIG_REGULATOR_PCA9450 is not set # CONFIG_REGULATOR_PFUZE100 is not set # CONFIG_REGULATOR_PV88060 is not set # CONFIG_REGULATOR_PV88080 is not set # CONFIG_REGULATOR_PV88090 is not set CONFIG_REGULATOR_PWM=y # CONFIG_REGULATOR_QCOM_SPMI is not set +# CONFIG_REGULATOR_QCOM_USB_VBUS is not set CONFIG_REGULATOR_RK808=y # CONFIG_REGULATOR_S2MPA01 is not set # CONFIG_REGULATOR_S2MPS11 is not set @@ -2710,6 +2733,7 @@ CONFIG_REGULATOR_RK808=y # CONFIG_REGULATOR_SLG51000 is not set # CONFIG_REGULATOR_SY8106A is not set # CONFIG_REGULATOR_SY8824X is not set +# CONFIG_REGULATOR_SY8827N is not set # CONFIG_REGULATOR_TPS51632 is not set # CONFIG_REGULATOR_TPS62360 is not set # CONFIG_REGULATOR_TPS65023 is not set @@ -2717,6 +2741,7 @@ CONFIG_REGULATOR_RK808=y # CONFIG_REGULATOR_TPS65132 is not set # CONFIG_REGULATOR_TPS6524X is not set # CONFIG_REGULATOR_VCTRL is not set +# CONFIG_REGULATOR_QCOM_LABIBB is not set CONFIG_RC_CORE=y CONFIG_RC_MAP=m CONFIG_LIRC=y @@ -2753,10 +2778,12 @@ CONFIG_IR_SERIAL=m # CONFIG_IR_SERIAL_TRANSMITTER is not set CONFIG_IR_SIR=m CONFIG_RC_XBOX_DVD=m +CONFIG_IR_TOY=m CONFIG_CEC_CORE=y CONFIG_CEC_NOTIFIER=y # CONFIG_MEDIA_CEC_RC is not set CONFIG_MEDIA_CEC_SUPPORT=y +# CONFIG_CEC_CH7322 is not set CONFIG_USB_PULSE8_CEC=m CONFIG_USB_RAINSHADOW_CEC=m CONFIG_MEDIA_SUPPORT=m @@ -2894,6 +2921,7 @@ CONFIG_VIDEO_IR_I2C=m # Camera sensor devices # # CONFIG_VIDEO_HI556 is not set +# CONFIG_VIDEO_IMX214 is not set # CONFIG_VIDEO_IMX219 is not set # CONFIG_VIDEO_IMX258 is not set # CONFIG_VIDEO_IMX274 is not set @@ -2904,7 +2932,6 @@ CONFIG_VIDEO_IR_I2C=m # CONFIG_VIDEO_OV2659 is not set # CONFIG_VIDEO_OV2680 is not set # CONFIG_VIDEO_OV2685 is not set -# CONFIG_VIDEO_OV2740 is not set # CONFIG_VIDEO_OV5640 is not set # CONFIG_VIDEO_OV5645 is not set # CONFIG_VIDEO_OV5647 is not set @@ -2934,6 +2961,7 @@ CONFIG_VIDEO_IR_I2C=m # CONFIG_VIDEO_SR030PC30 is not set # CONFIG_VIDEO_NOON010PC30 is not set # CONFIG_VIDEO_M5MOLS is not set +# CONFIG_VIDEO_RDACM20 is not set # CONFIG_VIDEO_RJ54N1 is not set # CONFIG_VIDEO_S5K6AA is not set # CONFIG_VIDEO_S5K6A3 is not set @@ -2950,6 +2978,7 @@ CONFIG_VIDEO_IR_I2C=m # CONFIG_VIDEO_AD5820 is not set # CONFIG_VIDEO_AK7375 is not set # CONFIG_VIDEO_DW9714 is not set +# CONFIG_VIDEO_DW9768 is not set # CONFIG_VIDEO_DW9807_VCM is not set # end of Lens drivers @@ -3190,7 +3219,7 @@ CONFIG_FB_MODE_HELPERS=y # # Frame buffer hardware drivers # -CONFIG_FB_ARMCLCD=y +# CONFIG_FB_ARMCLCD is not set # CONFIG_FB_OPENCORES is not set # CONFIG_FB_S1D13XXX is not set # CONFIG_FB_SMSCUFX is not set @@ -3207,7 +3236,6 @@ CONFIG_FB_ARMCLCD=y # # CONFIG_LCD_CLASS_DEVICE is not set CONFIG_BACKLIGHT_CLASS_DEVICE=y -# CONFIG_BACKLIGHT_GENERIC is not set # CONFIG_BACKLIGHT_PWM is not set # CONFIG_BACKLIGHT_QCOM_WLED is not set # CONFIG_BACKLIGHT_ADP8860 is not set @@ -3313,6 +3341,7 @@ CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y # CONFIG_SND_I2S_HI6210_I2S is not set # CONFIG_SND_SOC_IMG is not set +# CONFIG_SND_SOC_INTEL_KEEMBAY is not set # CONFIG_SND_SOC_MTK_BTCVSD is not set CONFIG_SND_SOC_ROCKCHIP=y CONFIG_SND_SOC_ROCKCHIP_I2S=y @@ -3395,7 +3424,7 @@ CONFIG_SND_SOC_MAX98357A=m # CONFIG_SND_SOC_MAX98504 is not set # CONFIG_SND_SOC_MAX9867 is not set # CONFIG_SND_SOC_MAX98927 is not set -# CONFIG_SND_SOC_MAX98373 is not set +# CONFIG_SND_SOC_MAX98373_I2C is not set # CONFIG_SND_SOC_MAX98390 is not set # CONFIG_SND_SOC_MAX9860 is not set # CONFIG_SND_SOC_MSM8916_WCD_ANALOG is not set @@ -3623,8 +3652,8 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_DEFAULT_PERSIST=y # CONFIG_USB_DYNAMIC_MINORS is not set CONFIG_USB_OTG=y -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_OTG_PRODUCTLIST is not set +# CONFIG_USB_OTG_DISABLE_EXTERNAL_HUB is not set # CONFIG_USB_OTG_FSM is not set # CONFIG_USB_LEDS_TRIGGER_USBPORT is not set CONFIG_USB_AUTOSUSPEND_DELAY=2 @@ -3883,6 +3912,7 @@ CONFIG_MMC_CQHCI=y CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y CONFIG_LEDS_CLASS_FLASH=m +# CONFIG_LEDS_CLASS_MULTICOLOR is not set # CONFIG_LEDS_BRIGHTNESS_HW_CHANGED is not set # @@ -3905,10 +3935,7 @@ CONFIG_LEDS_CLASS_FLASH=m CONFIG_LEDS_GPIO=y # CONFIG_LEDS_LP3944 is not set # CONFIG_LEDS_LP3952 is not set -# CONFIG_LEDS_LP5521 is not set -# CONFIG_LEDS_LP5523 is not set -# CONFIG_LEDS_LP5562 is not set -# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_LP55XX_COMMON is not set # CONFIG_LEDS_LP8860 is not set # CONFIG_LEDS_PCA955X is not set # CONFIG_LEDS_PCA963X is not set @@ -4098,6 +4125,7 @@ CONFIG_DMA_OF=y CONFIG_PL330_DMA=y # CONFIG_XILINX_DMA is not set # CONFIG_XILINX_ZYNQMP_DMA is not set +# CONFIG_XILINX_ZYNQMP_DPDMA is not set # CONFIG_QCOM_HIDMA_MGMT is not set # CONFIG_QCOM_HIDMA is not set # CONFIG_DW_DMAC is not set @@ -4215,20 +4243,10 @@ CONFIG_RTL8723BS=m # end of Resolver to digital converters # end of IIO staging drivers -# -# Speakup console speech -# -# CONFIG_SPEAKUP is not set -# end of Speakup console speech - CONFIG_STAGING_MEDIA=y CONFIG_VIDEO_HANTRO=m CONFIG_VIDEO_HANTRO_ROCKCHIP=y CONFIG_VIDEO_ROCKCHIP_VDEC=m - -# -# soc_camera sensor drivers -# # CONFIG_PHY_ROCKCHIP_DPHY_RX0 is not set # CONFIG_VIDEO_ROCKCHIP_ISP1 is not set # CONFIG_VIDEO_USBVISION is not set @@ -4242,10 +4260,7 @@ CONFIG_VIDEO_ROCKCHIP_VDEC=m # CONFIG_LTE_GDM724X is not set # CONFIG_GS_FPGABOOT is not set # CONFIG_UNISYSSPAR is not set -# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set # CONFIG_FB_TFT is not set -# CONFIG_WILC1000_SDIO is not set -# CONFIG_WILC1000_SPI is not set # CONFIG_KS7010 is not set # CONFIG_PI433 is not set @@ -4266,6 +4281,7 @@ CONFIG_HAVE_CLK=y CONFIG_CLKDEV_LOOKUP=y CONFIG_HAVE_CLK_PREPARE=y CONFIG_COMMON_CLK=y +# CONFIG_CLK_HSDK is not set # CONFIG_COMMON_CLK_MAX77686 is not set # CONFIG_COMMON_CLK_MAX9485 is not set CONFIG_COMMON_CLK_RK808=y @@ -4284,6 +4300,17 @@ CONFIG_COMMON_CLK_XGENE=y CONFIG_COMMON_CLK_PWM=y # CONFIG_COMMON_CLK_VC5 is not set # CONFIG_COMMON_CLK_FIXED_MMIO is not set +CONFIG_COMMON_CLK_ROCKCHIP=y +CONFIG_CLK_PX30=y +CONFIG_CLK_RV110X=y +CONFIG_CLK_RK3036=y +CONFIG_CLK_RK312X=y +CONFIG_CLK_RK3188=y +CONFIG_CLK_RK322X=y +CONFIG_CLK_RK3308=y +CONFIG_CLK_RK3328=y +CONFIG_CLK_RK3368=y +CONFIG_CLK_RK3399=y CONFIG_HWSPINLOCK=y # @@ -4428,9 +4455,14 @@ CONFIG_EXTCON=y CONFIG_EXTCON_USB_GPIO=y # CONFIG_MEMORY is not set CONFIG_IIO=y -# CONFIG_IIO_BUFFER is not set +CONFIG_IIO_BUFFER=y +# CONFIG_IIO_BUFFER_CB is not set +# CONFIG_IIO_BUFFER_HW_CONSUMER is not set +CONFIG_IIO_KFIFO_BUF=y +CONFIG_IIO_TRIGGERED_BUFFER=y # CONFIG_IIO_CONFIGFS is not set -# CONFIG_IIO_TRIGGER is not set +CONFIG_IIO_TRIGGER=y +CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 # CONFIG_IIO_SW_DEVICE is not set # CONFIG_IIO_SW_TRIGGER is not set @@ -4556,6 +4588,7 @@ CONFIG_ROCKCHIP_SARADC=y # CONFIG_CCS811 is not set # CONFIG_IAQCORE is not set # CONFIG_PMS7003 is not set +# CONFIG_SCD30_CORE is not set # CONFIG_SENSIRION_SGP30 is not set # CONFIG_SPS30 is not set # CONFIG_VZ89X is not set @@ -4687,6 +4720,8 @@ CONFIG_ROCKCHIP_SARADC=y # CONFIG_FXOS8700_I2C is not set # CONFIG_FXOS8700_SPI is not set # CONFIG_KMX61 is not set +# CONFIG_INV_ICM42600_I2C is not set +# CONFIG_INV_ICM42600_SPI is not set # CONFIG_INV_MPU6050_I2C is not set # CONFIG_INV_MPU6050_SPI is not set # CONFIG_IIO_ST_LSM6DSX is not set @@ -4769,6 +4804,13 @@ CONFIG_ROCKCHIP_SARADC=y # # end of Inclinometer sensors +# +# Triggers - standalone +# +# CONFIG_IIO_INTERRUPT_TRIGGER is not set +# CONFIG_IIO_SYSFS_TRIGGER is not set +# end of Triggers - standalone + # # Linear and angular position sensors # @@ -5084,6 +5126,7 @@ CONFIG_SYSFS=y CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TMPFS_XATTR=y +# CONFIG_TMPFS_INODE64 is not set CONFIG_HUGETLBFS=y CONFIG_HUGETLB_PAGE=y CONFIG_MEMFD_CREATE=y @@ -5271,10 +5314,6 @@ CONFIG_LSM="yama,loadpin,safesetid,integrity" # Memory initialization # CONFIG_INIT_STACK_NONE=y -# CONFIG_GCC_PLUGIN_STRUCTLEAK_USER is not set -# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF is not set -# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL is not set -# CONFIG_GCC_PLUGIN_STACKLEAK is not set # CONFIG_INIT_ON_ALLOC_DEFAULT_ON is not set # CONFIG_INIT_ON_FREE_DEFAULT_ON is not set # end of Memory initialization @@ -5539,6 +5578,7 @@ CONFIG_XZ_DEC_SPARC=y CONFIG_XZ_DEC_BCJ=y # CONFIG_XZ_DEC_TEST is not set CONFIG_DECOMPRESS_LZ4=y +CONFIG_DECOMPRESS_ZSTD=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_REED_SOLOMON=y CONFIG_REED_SOLOMON_ENC8=y @@ -5547,6 +5587,7 @@ CONFIG_XARRAY_MULTI=y CONFIG_ASSOCIATIVE_ARRAY=y CONFIG_HAS_IOMEM=y CONFIG_HAS_DMA=y +CONFIG_DMA_OPS=y CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y @@ -5576,6 +5617,8 @@ CONFIG_CMA_ALIGNMENT=8 CONFIG_SGL_ALLOC=y CONFIG_CPU_RMAP=y CONFIG_DQL=y +CONFIG_GLOB=y +# CONFIG_GLOB_SELFTEST is not set CONFIG_NLATTR=y CONFIG_CLZ_TAB=y # CONFIG_IRQ_POLL is not set @@ -5584,6 +5627,7 @@ CONFIG_LIBFDT=y CONFIG_OID_REGISTRY=y CONFIG_HAVE_GENERIC_VDSO=y CONFIG_GENERIC_GETTIMEOFDAY=y +CONFIG_GENERIC_VDSO_TIME_NS=y CONFIG_FONT_SUPPORT=y # CONFIG_FONTS is not set CONFIG_FONT_8x8=y @@ -5642,6 +5686,9 @@ CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 CONFIG_MAGIC_SYSRQ_SERIAL=y CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE="" CONFIG_DEBUG_FS=y +CONFIG_DEBUG_FS_ALLOW_ALL=y +# CONFIG_DEBUG_FS_DISALLOW_MOUNT is not set +# CONFIG_DEBUG_FS_ALLOW_NONE is not set CONFIG_HAVE_ARCH_KGDB=y # CONFIG_KGDB is not set CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y @@ -5682,7 +5729,6 @@ CONFIG_HAVE_ARCH_KASAN_SW_TAGS=y CONFIG_CC_HAS_KASAN_GENERIC=y CONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y # CONFIG_KASAN is not set -CONFIG_KASAN_STACK=1 # end of Memory Debugging # CONFIG_DEBUG_SHIRQ is not set @@ -5749,6 +5795,7 @@ CONFIG_HAVE_DEBUG_BUGVERBOSE=y # # CONFIG_RCU_PERF_TEST is not set # CONFIG_RCU_TORTURE_TEST is not set +# CONFIG_RCU_REF_SCALE_TEST is not set CONFIG_RCU_CPU_STALL_TIMEOUT=21 # CONFIG_RCU_TRACE is not set # CONFIG_RCU_EQS_DEBUG is not set diff --git a/projects/Rockchip/patches/linux/default/linux-0001-rockchip-from-5.10.patch b/projects/Rockchip/patches/linux/default/linux-0001-rockchip-from-5.10.patch new file mode 100644 index 0000000000..60bac1412f --- /dev/null +++ b/projects/Rockchip/patches/linux/default/linux-0001-rockchip-from-5.10.patch @@ -0,0 +1,2967 @@ +From 2e3fedafa307db03549840de3f5e342f09fb5c45 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C5=81ukasz=20Stelmach?= +Date: Thu, 13 Aug 2020 22:41:23 +0200 +Subject: [PATCH] dmaengine: pl330: fix instruction dump formatting +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Instruction dump uses two printk() in a row to print one instruction. Use +KERN_CONT to prevent breaking the output in the middle. + +Signed-off-by: Łukasz Stelmach +Link: https://lore.kernel.org/r/20200813204123.19044-1-l.stelmach@samsung.com +Signed-off-by: Vinod Koul +(cherry picked from commit 112ec61b212200d378963cbafdd736a62e9ddaec) +--- + drivers/dma/pl330.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 5274a0704d96..106f47298f9e 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -255,7 +255,7 @@ enum pl330_byteswap { + static unsigned cmd_line; + #define PL330_DBGCMD_DUMP(off, x...) do { \ + printk("%x:", cmd_line); \ +- printk(x); \ ++ printk(KERN_CONT x); \ + cmd_line += off; \ + } while (0) + #define PL330_DBGMC_START(addr) (cmd_line = addr) + +From 3bb4e2c068270e9c910e3a3b7bec8b0225e2d442 Mon Sep 17 00:00:00 2001 +From: Jagan Teki +Date: Wed, 19 Aug 2020 00:15:05 +0530 +Subject: [PATCH] arm64: dts: rockchip: Fix power routing to support POE on + rk3399-roc-pc + +When POE used, the current power routing is failing to power-up +the PMIC regulators which cause Linux boot hangs. + +This patch is trying to update the power routing in order to +support Type C0 and POE powering methods. + +As per the schematics, sys_12v is a common output power regulator +when type c and POE power being used. sys_12v is supplied by dc_12v +which is supplied from MP8859 in type c0 power routing and sys_12v +is supplied by MP8009 PoE PD in POE power supply routing. + +Signed-off-by: Jagan Teki +Tested-by: Suniel Mahesh +Link: https://lore.kernel.org/r/20200818184505.30064-1-jagan@amarulasolutions.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit bd77d0ad7a698f5e04edf02328d11e808a71d87c) +--- + .../boot/dts/rockchip/rk3399-roc-pc-mezzanine.dts | 18 ++++++++++++++++-- + arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi | 12 ++++++++++-- + 2 files changed, 26 insertions(+), 4 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-mezzanine.dts b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-mezzanine.dts +index 2acb3d500fb9..754627d97144 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-mezzanine.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-mezzanine.dts +@@ -11,6 +11,16 @@ + model = "Firefly ROC-RK3399-PC Mezzanine Board"; + compatible = "firefly,roc-rk3399-pc-mezzanine", "rockchip,rk3399"; + ++ /* MP8009 PoE PD */ ++ poe_12v: poe-12v { ++ compatible = "regulator-fixed"; ++ regulator-name = "poe_12v"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <12000000>; ++ regulator-max-microvolt = <12000000>; ++ }; ++ + vcc3v3_ngff: vcc3v3-ngff { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_ngff"; +@@ -22,7 +32,7 @@ + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; +- vin-supply = <&dc_12v>; ++ vin-supply = <&sys_12v>; + }; + + vcc3v3_pcie: vcc3v3-pcie { +@@ -34,10 +44,14 @@ + pinctrl-0 = <&vcc3v3_pcie_en>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; +- vin-supply = <&dc_12v>; ++ vin-supply = <&sys_12v>; + }; + }; + ++&sys_12v { ++ vin-supply = <&poe_12v>; ++}; ++ + &pcie_phy { + status = "okay"; + }; +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi +index b85ec31cd283..e7a459fa4322 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi +@@ -110,6 +110,14 @@ + regulator-max-microvolt = <5000000>; + }; + ++ sys_12v: sys-12v { ++ compatible = "regulator-fixed"; ++ regulator-name = "sys_12v"; ++ regulator-always-on; ++ regulator-boot-on; ++ vin-supply = <&dc_12v>; ++ }; ++ + /* switched by pmic_sleep */ + vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 { + compatible = "regulator-fixed"; +@@ -141,7 +149,7 @@ + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; +- vin-supply = <&dc_12v>; ++ vin-supply = <&sys_12v>; + }; + + vcca_0v9: vcca-0v9 { +@@ -186,7 +194,7 @@ + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; +- vin-supply = <&dc_12v>; ++ vin-supply = <&sys_12v>; + }; + + vdd_log: vdd-log { + +From 9d3c764ef494a805ed623e81e7485d5fc3f57a97 Mon Sep 17 00:00:00 2001 +From: Johan Jonker +Date: Tue, 18 Aug 2020 16:37:27 +0200 +Subject: [PATCH] arm64: dts: rockchip: change spdif fallback compatible on + rk3308 + +A test with the command below shows that the compatible string + +"rockchip,rk3308-spdif", "rockchip,rk3328-spdif" + +is already in use, but is not added to a document. +The current fallback string "rockchip,rk3328-spdif" points to a data +set enum RK_SPDIF_RK3366 in rockchip_spdif.c that is not used both +in the mainline as in the manufacturer kernel. +(Of the enum only RK_SPDIF_RK3288 is used.) +So if the properties don't change we might as well use the first SoC +in line as fallback string and add the description for rk3308 as: + +"rockchip,rk3308-spdif", "rockchip,rk3066-spdif" + +make ARCH=arm64 dtbs_check +DT_SCHEMA_FILES=Documentation/devicetree/bindings/sound/rockchip-spdif.yaml + +Signed-off-by: Johan Jonker +Link: https://lore.kernel.org/r/20200818143727.5882-2-jbx6244@gmail.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit bc1f9bff0629a15e3de1ef106ac03cba930227dd) +--- + arch/arm64/boot/dts/rockchip/rk3308.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308.dtsi b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +index e8b754d415d8..2560b98771ca 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +@@ -574,7 +574,7 @@ + }; + + spdif_tx: spdif-tx@ff3a0000 { +- compatible = "rockchip,rk3308-spdif", "rockchip,rk3328-spdif"; ++ compatible = "rockchip,rk3308-spdif", "rockchip,rk3066-spdif"; + reg = <0x0 0xff3a0000 0x0 0x1000>; + interrupts = ; + clocks = <&cru SCLK_SPDIF_TX>, <&cru HCLK_SPDIFTX>; + +From a87e7be5beb9646557e70f0b42c558d418ba16ce Mon Sep 17 00:00:00 2001 +From: Jagan Teki +Date: Fri, 7 Aug 2020 15:18:23 +0530 +Subject: [PATCH] dt-bindings: arm: rockchip: Update ROCKPi 4 binding + +ROCKPi 4 has 3 variants of hardware platforms called +ROCKPi 4A, 4B, and 4C. + +- ROCKPi 4A has no Wif/BT. +- ROCKPi 4B has AP6256 Wifi/BT, PoE. +- ROCKPi 4C has AP6256 Wifi/BT, PoE, miniDP, USB Host enabled + GPIO pin change compared to 4B, 4C + +So, update the existing ROCKPi 4 binding to support +ROCKPi 4A/B/C hardware platforms. + +Signed-off-by: Jagan Teki +Acked-by: Rob Herring +Link: https://lore.kernel.org/r/20200807094826.12019-1-jagan@amarulasolutions.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit 75a0a65a301f557bf0306d7983f8cf31ac91de56) +--- + Documentation/devicetree/bindings/arm/rockchip.yaml | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/Documentation/devicetree/bindings/arm/rockchip.yaml b/Documentation/devicetree/bindings/arm/rockchip.yaml +index db2e35796795..7025d00c06cc 100644 +--- a/Documentation/devicetree/bindings/arm/rockchip.yaml ++++ b/Documentation/devicetree/bindings/arm/rockchip.yaml +@@ -430,8 +430,12 @@ properties: + - const: radxa,rock + - const: rockchip,rk3188 + +- - description: Radxa ROCK Pi 4 ++ - description: Radxa ROCK Pi 4A/B/C + items: ++ - enum: ++ - radxa,rockpi4a ++ - radxa,rockpi4b ++ - radxa,rockpi4c + - const: radxa,rockpi4 + - const: rockchip,rk3399 + + +From bb10faf3729a3982ba5a85b39b416116e315f642 Mon Sep 17 00:00:00 2001 +From: Jagan Teki +Date: Fri, 7 Aug 2020 15:18:24 +0530 +Subject: [PATCH] arm64: dts: rockchip: Mark rock-pi-4 as rock-pi-4a dts + +ROCKPi 4 has 3 variants of hardware platforms called +RockPI 4A, 4B, and 4C. + +- ROCKPi 4A has no Wif/BT. +- ROCKPi 4B has AP6256 Wifi/BT, PoE. +- ROCKPi 4C has AP6256 Wifi/BT, PoE, miniDP, USB Host enabled + GPIO pin change compared to 4B, 4C + +So move common nodes, properties into dtsi file and include +on respective variant dts files. + +Signed-off-by: Jagan Teki +Link: https://lore.kernel.org/r/20200807094826.12019-2-jagan@amarulasolutions.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit b5edb04673700125bfd1d13e6c14747b1ecba522) +--- + arch/arm64/boot/dts/rockchip/Makefile | 2 +- + .../{rk3399-rock-pi-4.dts => rk3399-rock-pi-4.dtsi} | 3 --- + arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4a.dts | 13 +++++++++++++ + 3 files changed, 14 insertions(+), 4 deletions(-) + rename arch/arm64/boot/dts/rockchip/{rk3399-rock-pi-4.dts => rk3399-rock-pi-4.dtsi} (99%) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4a.dts + +diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile +index b87b1f773083..42f9e1861461 100644 +--- a/arch/arm64/boot/dts/rockchip/Makefile ++++ b/arch/arm64/boot/dts/rockchip/Makefile +@@ -33,7 +33,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-pinebook-pro.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-puma-haikou.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc-mezzanine.dtb +-dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4.dtb ++dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4a.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock960.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpro64-v2.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpro64.dtb +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi +similarity index 99% +rename from arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts +rename to arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi +index 60f98a3e19d8..e163f438f836 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi +@@ -11,9 +11,6 @@ + #include "rk3399-opp.dtsi" + + / { +- model = "Radxa ROCK Pi 4"; +- compatible = "radxa,rockpi4", "rockchip,rk3399"; +- + chosen { + stdout-path = "serial2:1500000n8"; + }; +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4a.dts b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4a.dts +new file mode 100644 +index 000000000000..89f2af5e111d +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4a.dts +@@ -0,0 +1,13 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2019 Akash Gajjar ++ * Copyright (c) 2019 Pragnesh Patel ++ */ ++ ++/dts-v1/; ++#include "rk3399-rock-pi-4.dtsi" ++ ++/ { ++ model = "Radxa ROCK Pi 4A"; ++ compatible = "radxa,rockpi4a", "radxa,rockpi4", "rockchip,rk3399"; ++}; + +From 54123d61cf3af2ae6b27e264a40c058eba9716c2 Mon Sep 17 00:00:00 2001 +From: Jagan Teki +Date: Fri, 7 Aug 2020 15:18:25 +0530 +Subject: [PATCH] arm64: dts: rockchip: Add Radxa ROCK Pi 4B support + +RockPI 4B has AP6256 Wifi/BT, so enable them in 4B dts +instead of enable in common dtsi. + +Signed-off-by: Jagan Teki +Link: https://lore.kernel.org/r/20200807094826.12019-3-jagan@amarulasolutions.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit c1075b7fcca81f58ebc5d723f07b23f84ae93daa) +--- + arch/arm64/boot/dts/rockchip/Makefile | 1 + + arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi | 23 ------------ + arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b.dts | 42 ++++++++++++++++++++++ + 3 files changed, 43 insertions(+), 23 deletions(-) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b.dts + +diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile +index 42f9e1861461..8832d05c2571 100644 +--- a/arch/arm64/boot/dts/rockchip/Makefile ++++ b/arch/arm64/boot/dts/rockchip/Makefile +@@ -34,6 +34,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-puma-haikou.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc-mezzanine.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4a.dtb ++dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4b.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock960.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpro64-v2.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpro64.dtb +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi +index e163f438f836..678a336010bf 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi +@@ -584,17 +584,6 @@ + pinctrl-names = "default"; + pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; + sd-uhs-sdr104; +- status = "okay"; +- +- brcmf: wifi@1 { +- compatible = "brcm,bcm4329-fmac"; +- reg = <1>; +- interrupt-parent = <&gpio0>; +- interrupts = ; +- interrupt-names = "host-wake"; +- pinctrl-names = "default"; +- pinctrl-0 = <&wifi_host_wake_l>; +- }; + }; + + &sdmmc { +@@ -663,18 +652,6 @@ + &uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; +- status = "okay"; +- +- bluetooth { +- compatible = "brcm,bcm43438-bt"; +- clocks = <&rk808 1>; +- clock-names = "ext_clock"; +- device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; +- host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; +- shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; +- pinctrl-names = "default"; +- pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; +- }; + }; + + &uart2 { +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b.dts b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b.dts +new file mode 100644 +index 000000000000..f0055ce2fda0 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b.dts +@@ -0,0 +1,42 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2019 Akash Gajjar ++ * Copyright (c) 2019 Pragnesh Patel ++ */ ++ ++/dts-v1/; ++#include "rk3399-rock-pi-4.dtsi" ++ ++/ { ++ model = "Radxa ROCK Pi 4B"; ++ compatible = "radxa,rockpi4b", "radxa,rockpi4", "rockchip,rk3399"; ++}; ++ ++&sdio0 { ++ status = "okay"; ++ ++ brcmf: wifi@1 { ++ compatible = "brcm,bcm4329-fmac"; ++ reg = <1>; ++ interrupt-parent = <&gpio0>; ++ interrupts = ; ++ interrupt-names = "host-wake"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_host_wake_l>; ++ }; ++}; ++ ++&uart0 { ++ status = "okay"; ++ ++ bluetooth { ++ compatible = "brcm,bcm43438-bt"; ++ clocks = <&rk808 1>; ++ clock-names = "ext_clock"; ++ device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; ++ host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; ++ shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; ++ }; ++}; + +From a28e4816e96a5b6f565fbe71e8d333e541a54227 Mon Sep 17 00:00:00 2001 +From: Jagan Teki +Date: Fri, 7 Aug 2020 15:18:26 +0530 +Subject: [PATCH] arm64: dts: rockchip: Add Radxa ROCK Pi 4C support + +Rock PI 4C has AP6256 Wifi/BT, PoE, miniDP, USB Host enabled +GPIO pin change compared to 4B, 4C. + +So, add or enable difference nodes/properties in 4C dts +by including common dtsi. + +Signed-off-by: Jagan Teki +Link: https://lore.kernel.org/r/20200807094826.12019-4-jagan@amarulasolutions.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit 93e0e8ce5fdf549f1715dad00bfbb21b2f69ba8e) +--- + arch/arm64/boot/dts/rockchip/Makefile | 1 + + arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4c.dts | 51 ++++++++++++++++++++++ + 2 files changed, 52 insertions(+) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4c.dts + +diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile +index 8832d05c2571..02cdb3c4a6c1 100644 +--- a/arch/arm64/boot/dts/rockchip/Makefile ++++ b/arch/arm64/boot/dts/rockchip/Makefile +@@ -35,6 +35,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc-mezzanine.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4a.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4b.dtb ++dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4c.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock960.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpro64-v2.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpro64.dtb +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4c.dts b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4c.dts +new file mode 100644 +index 000000000000..4c7ebb1c5d2d +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4c.dts +@@ -0,0 +1,51 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd ++ * Copyright (c) 2019 Radxa Limited ++ * Copyright (c) 2019 Amarula Solutions(India) ++ */ ++ ++/dts-v1/; ++#include "rk3399-rock-pi-4.dtsi" ++ ++/ { ++ model = "Radxa ROCK Pi 4C"; ++ compatible = "radxa,rockpi4c", "radxa,rockpi4", "rockchip,rk3399"; ++}; ++ ++&sdio0 { ++ status = "okay"; ++ ++ brcmf: wifi@1 { ++ compatible = "brcm,bcm4329-fmac"; ++ reg = <1>; ++ interrupt-parent = <&gpio0>; ++ interrupts = ; ++ interrupt-names = "host-wake"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_host_wake_l>; ++ }; ++}; ++ ++&uart0 { ++ status = "okay"; ++ ++ bluetooth { ++ compatible = "brcm,bcm43438-bt"; ++ clocks = <&rk808 1>; ++ clock-names = "ext_clock"; ++ device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; ++ host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; ++ shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; ++ }; ++}; ++ ++&vcc5v0_host { ++ gpio = <&gpio3 RK_PD6 GPIO_ACTIVE_HIGH>; ++}; ++ ++&vcc5v0_host_en { ++ rockchip,pins = <3 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>; ++}; + +From c89d84dcef9b307af733aaaedbf1614b4b266341 Mon Sep 17 00:00:00 2001 +From: Johan Jonker +Date: Sat, 8 Aug 2020 18:06:17 +0200 +Subject: [PATCH] dt-bindings: arm: rockchip: add Zkmagic A95X Z2 description + +Add Zkmagic A95X Z2 description for a board with rk3318 processor. + +Signed-off-by: Johan Jonker +Acked-by: Rob Herring +Link: https://lore.kernel.org/r/20200808160618.15445-3-jbx6244@gmail.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit 0dc8c62c92d4df35a001b613ebe10f95e4ebf776) +--- + Documentation/devicetree/bindings/arm/rockchip.yaml | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Documentation/devicetree/bindings/arm/rockchip.yaml b/Documentation/devicetree/bindings/arm/rockchip.yaml +index 7025d00c06cc..251c3ca22e1b 100644 +--- a/Documentation/devicetree/bindings/arm/rockchip.yaml ++++ b/Documentation/devicetree/bindings/arm/rockchip.yaml +@@ -559,4 +559,9 @@ properties: + items: + - const: tronsmart,orion-r68-meta + - const: rockchip,rk3368 ++ ++ - description: Zkmagic A95X Z2 ++ items: ++ - const: zkmagic,a95x-z2 ++ - const: rockchip,rk3318 + ... + +From a4d955617bdc633aa291642c54134dd30d0c1187 Mon Sep 17 00:00:00 2001 +From: Johan Jonker +Date: Sat, 8 Aug 2020 18:06:18 +0200 +Subject: [PATCH] arm64: dts: rockchip: add rk3318 A95X Z2 board + +The rk3318 A95X Z2 boards are sold as TV box. +No further documentation is given, but from the dts files +extracted it seems that the rk3318 processor is simulair +to the rk3328. This dts file contains only the basic nodes +that have support in the mainline kernel. + +Features: + +CPU: RK3318 Quad-Core Cortex-A53 +GPU: Mali-450 +RAM: 2/4GB DDR3 +ROM: EMMC 16/32/64GB +HDMI: HDMI 2.0a for 4k@60Hz +Ethernet: 10/100M standard RJ-45 +WiFi: 2.4G+5G WIFI, 802.11 b/g/n +Bluetooth: 4.0 +1 x USB 3.0 +1 x USB 2.0 +1 x Micro SD card slot +1 x SPDIF +1 x AV +1 x DC IN + +Signed-off-by: Johan Jonker +Link: https://lore.kernel.org/r/20200808160618.15445-4-jbx6244@gmail.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit 964ed0807b5f7b42b8a6ad48531ae9312e19599d) +--- + arch/arm64/boot/dts/rockchip/Makefile | 1 + + arch/arm64/boot/dts/rockchip/rk3318-a95x-z2.dts | 374 ++++++++++++++++++++++++ + 2 files changed, 375 insertions(+) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3318-a95x-z2.dts + +diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile +index 02cdb3c4a6c1..d53efdf4cb5a 100644 +--- a/arch/arm64/boot/dts/rockchip/Makefile ++++ b/arch/arm64/boot/dts/rockchip/Makefile +@@ -2,6 +2,7 @@ + dtb-$(CONFIG_ARCH_ROCKCHIP) += px30-evb.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3308-evb.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3308-roc-cc.dtb ++dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3318-a95x-z2.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3326-odroid-go2.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-a1.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-evb.dtb +diff --git a/arch/arm64/boot/dts/rockchip/rk3318-a95x-z2.dts b/arch/arm64/boot/dts/rockchip/rk3318-a95x-z2.dts +new file mode 100644 +index 000000000000..30c73ef25370 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3318-a95x-z2.dts +@@ -0,0 +1,374 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++ ++/dts-v1/; ++#include ++#include "rk3328.dtsi" ++ ++/ { ++ model = "A95X Z2"; ++ compatible = "zkmagic,a95x-z2", "rockchip,rk3318"; ++ ++ chosen { ++ stdout-path = "serial2:1500000n8"; ++ }; ++ ++ adc-keys { ++ compatible = "adc-keys"; ++ io-channels = <&saradc 0>; ++ io-channel-names = "buttons"; ++ keyup-threshold-microvolt = <1800000>; ++ poll-interval = <100>; ++ ++ recovery { ++ label = "recovery"; ++ linux,code = ; ++ press-threshold-microvolt = <17000>; ++ }; ++ }; ++ ++ ir-receiver { ++ compatible = "gpio-ir-receiver"; ++ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; ++ pinctrl-0 = <&ir_int>; ++ pinctrl-names = "default"; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ pinctrl-0 = <&cyx_led_pin>; ++ pinctrl-names = "default"; ++ ++ cyx_led: led-0 { ++ default-state = "on"; ++ gpios = <&gpio2 RK_PC7 GPIO_ACTIVE_LOW>; ++ label = "CYX_LED"; ++ }; ++ }; ++ ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ pinctrl-0 = <&wifi_enable_h>; ++ pinctrl-names = "default"; ++ reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; ++ }; ++ ++ spdif-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,name = "SPDIF"; ++ ++ simple-audio-card,cpu { ++ sound-dai = <&spdif>; ++ }; ++ ++ simple-audio-card,codec { ++ sound-dai = <&spdif_out>; ++ }; ++ }; ++ ++ spdif_out: spdif-out { ++ compatible = "linux,spdif-dit"; ++ #sound-dai-cells = <0>; ++ }; ++ ++ /* Power tree */ ++ vccio_1v8: vccio-1v8-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vccio_1v8"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-always-on; ++ }; ++ ++ vccio_3v3: vccio-3v3-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vccio_3v3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ }; ++ ++ vcc_otg_vbus: otg-vbus-regulator { ++ compatible = "regulator-fixed"; ++ gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; ++ pinctrl-0 = <&otg_vbus_drv>; ++ pinctrl-names = "default"; ++ regulator-name = "vcc_otg_vbus"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ enable-active-high; ++ }; ++ ++ vcc_sd: sdmmc-regulator { ++ compatible = "regulator-fixed"; ++ gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>; ++ pinctrl-0 = <&sdmmc0m1_pin>; ++ pinctrl-names = "default"; ++ regulator-name = "vcc_sd"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vccio_3v3>; ++ }; ++ ++ vdd_arm: vdd-arm { ++ compatible = "pwm-regulator"; ++ pwms = <&pwm0 0 5000 1>; ++ regulator-name = "vdd_arm"; ++ regulator-min-microvolt = <950000>; ++ regulator-max-microvolt = <1400000>; ++ regulator-settling-time-up-us = <250>; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ vdd_log: vdd-log { ++ compatible = "pwm-regulator"; ++ pwms = <&pwm1 0 5000 1>; ++ regulator-name = "vdd_log"; ++ regulator-min-microvolt = <900000>; ++ regulator-max-microvolt = <1300000>; ++ regulator-settling-time-up-us = <250>; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++}; ++ ++&analog_sound { ++ status = "okay"; ++}; ++ ++&codec { ++ status = "okay"; ++}; ++ ++&cpu0 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu2 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu3 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu0_opp_table { ++ opp-1200000000 { ++ status = "disabled"; ++ }; ++ ++ opp-1296000000 { ++ status = "disabled"; ++ }; ++}; ++ ++&emmc { ++ bus-width = <8>; ++ cap-mmc-highspeed; ++ non-removable; ++ pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&gmac2phy { ++ assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>; ++ assigned-clock-rate = <50000000>; ++ assigned-clocks = <&cru SCLK_MAC2PHY>; ++ clock_in_out = "output"; ++ status = "okay"; ++}; ++ ++&gpu { ++ mali-supply = <&vdd_log>; ++}; ++ ++&hdmi { ++ ddc-i2c-scl-high-time-ns = <9625>; ++ ddc-i2c-scl-low-time-ns = <10000>; ++ status = "okay"; ++}; ++ ++&hdmiphy { ++ status = "okay"; ++}; ++ ++&hdmi_sound { ++ status = "okay"; ++}; ++ ++&i2s0 { ++ status = "okay"; ++}; ++ ++&i2s1 { ++ status = "okay"; ++}; ++ ++&io_domains { ++ pmuio-supply = <&vccio_3v3>; ++ vccio1-supply = <&vccio_3v3>; ++ vccio2-supply = <&vccio_1v8>; ++ vccio3-supply = <&vccio_3v3>; ++ vccio4-supply = <&vccio_1v8>; ++ vccio5-supply = <&vccio_3v3>; ++ vccio6-supply = <&vccio_3v3>; ++ status = "okay"; ++}; ++ ++&pinctrl { ++ ir { ++ ir_int: ir-int { ++ rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ leds { ++ cyx_led_pin: cyx-led-pin { ++ rockchip,pins = <2 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ pwm0 { ++ pwm0_pin_pull_up: pwm0-pin-pull-up { ++ rockchip,pins = <2 RK_PA4 1 &pcfg_pull_up>; ++ }; ++ }; ++ ++ pwm1 { ++ pwm1_pin_pull_up: pwm1-pin-pull-up { ++ rockchip,pins = <2 RK_PA5 1 &pcfg_pull_up>; ++ }; ++ }; ++ ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ sdmmc1 { ++ clk_32k_out: clk-32k-out { ++ rockchip,pins = <1 RK_PD4 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ usb { ++ host_vbus_drv: host-vbus-drv { ++ rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ otg_vbus_drv: otg-vbus-drv { ++ rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++}; ++ ++&pwm0 { ++ pinctrl-0 = <&pwm0_pin_pull_up>; ++ pinctrl-names = "active"; ++ status = "okay"; ++}; ++ ++&pwm1 { ++ pinctrl-0 = <&pwm1_pin_pull_up>; ++ pinctrl-names = "active"; ++ status = "okay"; ++}; ++ ++&saradc { ++ vref-supply = <&vccio_1v8>; ++ status = "okay"; ++}; ++ ++&sdio { ++ bus-width = <4>; ++ cap-sd-highspeed; ++ cap-sdio-irq; ++ keep-power-in-suspend; ++ max-frequency = <125000000>; ++ mmc-pwrseq = <&sdio_pwrseq>; ++ non-removable; ++ pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk &clk_32k_out>; ++ pinctrl-names = "default"; ++ sd-uhs-sdr104; ++ status = "okay"; ++}; ++ ++&sdmmc { ++ bus-width = <4>; ++ cap-sd-highspeed; ++ pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>; ++ pinctrl-names = "default"; ++ vmmc-supply = <&vcc_sd>; ++ status = "okay"; ++}; ++ ++&spdif { ++ pinctrl-0 = <&spdifm0_tx>; ++ status = "okay"; ++}; ++ ++&soc_crit { ++ temperature = <115000>; /* millicelsius */ ++}; ++ ++&target { ++ temperature = <105000>; /* millicelsius */ ++}; ++ ++&threshold { ++ temperature = <90000>; /* millicelsius */ ++}; ++ ++&tsadc { ++ rockchip,hw-tshut-temp = <120000>; ++ status = "okay"; ++}; ++ ++&u2phy { ++ status = "okay"; ++}; ++ ++&u2phy_host { ++ status = "okay"; ++}; ++ ++&u2phy_otg { ++ phy-supply = <&vcc_otg_vbus>; ++ status = "okay"; ++}; ++ ++&uart0 { ++ pinctrl-0 = <&uart0_xfer &uart0_cts>; ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&usb20_otg { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&vop { ++ status = "okay"; ++}; ++ ++&vop_mmu { ++ status = "okay"; ++}; + +From 739bf33933935649816771290e0f7e87ed9dcd44 Mon Sep 17 00:00:00 2001 +From: Johan Jonker +Date: Thu, 13 Aug 2020 20:17:11 +0200 +Subject: [PATCH] arm64: dts: rockchip: fix cpu-supply for rk3328-evb + +The property cpu-supply should be added to each cpu separately, +so fix that for rk3328-evb. + +Signed-off-by: Johan Jonker +Link: https://lore.kernel.org/r/20200813181711.15906-1-jbx6244@gmail.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit 4be8df7b3bcd46a75f7e297ef310234975a437d8) +--- + arch/arm64/boot/dts/rockchip/rk3328-evb.dts | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-evb.dts b/arch/arm64/boot/dts/rockchip/rk3328-evb.dts +index 1969dab84138..a48767931af6 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-evb.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-evb.dts +@@ -70,6 +70,18 @@ + cpu-supply = <&vdd_arm>; + }; + ++&cpu1 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu2 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu3 { ++ cpu-supply = <&vdd_arm>; ++}; ++ + &emmc { + bus-width = <8>; + cap-mmc-highspeed; + +From 4a30b39b5d073898b065e24af70688d0572bbacb Mon Sep 17 00:00:00 2001 +From: Johan Jonker +Date: Thu, 13 Aug 2020 20:02:41 +0200 +Subject: [PATCH] ARM: dts: rockchip: update cpu supplies on rk3288 + +The use of cpu0-supply for cpu0 alone is deprecated, +so add cpu-supply to each cpu separately and +update all existing rk3288 boards that use this property. + +Signed-off-by: Johan Jonker +Link: https://lore.kernel.org/r/20200813180241.14660-1-jbx6244@gmail.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit b282ae0511cdb6f17cb5052de20288245a8ecd00) +--- + arch/arm/boot/dts/rk3288-miqi.dts | 14 +++++++++++++- + arch/arm/boot/dts/rk3288-popmetal.dts | 14 +++++++++++++- + arch/arm/boot/dts/rk3288-r89.dts | 14 +++++++++++++- + arch/arm/boot/dts/rk3288-vyasa.dts | 14 +++++++++++++- + 4 files changed, 52 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/dts/rk3288-miqi.dts b/arch/arm/boot/dts/rk3288-miqi.dts +index 213c9eb84f76..8a3992105151 100644 +--- a/arch/arm/boot/dts/rk3288-miqi.dts ++++ b/arch/arm/boot/dts/rk3288-miqi.dts +@@ -81,7 +81,19 @@ + }; + + &cpu0 { +- cpu0-supply = <&vdd_cpu>; ++ cpu-supply = <&vdd_cpu>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vdd_cpu>; ++}; ++ ++&cpu2 { ++ cpu-supply = <&vdd_cpu>; ++}; ++ ++&cpu3 { ++ cpu-supply = <&vdd_cpu>; + }; + + &emmc { +diff --git a/arch/arm/boot/dts/rk3288-popmetal.dts b/arch/arm/boot/dts/rk3288-popmetal.dts +index 6a51940398b5..160ed8b932fb 100644 +--- a/arch/arm/boot/dts/rk3288-popmetal.dts ++++ b/arch/arm/boot/dts/rk3288-popmetal.dts +@@ -103,7 +103,19 @@ + }; + + &cpu0 { +- cpu0-supply = <&vdd_cpu>; ++ cpu-supply = <&vdd_cpu>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vdd_cpu>; ++}; ++ ++&cpu2 { ++ cpu-supply = <&vdd_cpu>; ++}; ++ ++&cpu3 { ++ cpu-supply = <&vdd_cpu>; + }; + + &emmc { +diff --git a/arch/arm/boot/dts/rk3288-r89.dts b/arch/arm/boot/dts/rk3288-r89.dts +index a258c7ae5329..e5ba901c7dcb 100644 +--- a/arch/arm/boot/dts/rk3288-r89.dts ++++ b/arch/arm/boot/dts/rk3288-r89.dts +@@ -91,7 +91,19 @@ + }; + + &cpu0 { +- cpu0-supply = <&vdd_cpu>; ++ cpu-supply = <&vdd_cpu>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vdd_cpu>; ++}; ++ ++&cpu2 { ++ cpu-supply = <&vdd_cpu>; ++}; ++ ++&cpu3 { ++ cpu-supply = <&vdd_cpu>; + }; + + &gmac { +diff --git a/arch/arm/boot/dts/rk3288-vyasa.dts b/arch/arm/boot/dts/rk3288-vyasa.dts +index 1a20854a1317..aa50f8ed4ca0 100644 +--- a/arch/arm/boot/dts/rk3288-vyasa.dts ++++ b/arch/arm/boot/dts/rk3288-vyasa.dts +@@ -125,7 +125,19 @@ + }; + + &cpu0 { +- cpu0-supply = <&vdd_cpu>; ++ cpu-supply = <&vdd_cpu>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vdd_cpu>; ++}; ++ ++&cpu2 { ++ cpu-supply = <&vdd_cpu>; ++}; ++ ++&cpu3 { ++ cpu-supply = <&vdd_cpu>; + }; + + &emmc { + +From 23f9077620fd1f450589387e5951d0db36d2f6d4 Mon Sep 17 00:00:00 2001 +From: Johan Jonker +Date: Thu, 13 Aug 2020 19:24:50 +0200 +Subject: [PATCH] ARM: dts: rockchip: rk3066a: add label to cpu@1 + +Add label to cpu@1 for later use. + +Signed-off-by: Johan Jonker +Link: https://lore.kernel.org/r/20200813172451.13754-1-jbx6244@gmail.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit 9ab4a7312bf31611f3a9c95470f15b3f2bcd83e3) +--- + arch/arm/boot/dts/rk3066a.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/rk3066a.dtsi b/arch/arm/boot/dts/rk3066a.dtsi +index b599394d149d..252750c97f97 100644 +--- a/arch/arm/boot/dts/rk3066a.dtsi ++++ b/arch/arm/boot/dts/rk3066a.dtsi +@@ -36,7 +36,7 @@ + clock-latency = <40000>; + clocks = <&cru ARMCLK>; + }; +- cpu@1 { ++ cpu1: cpu@1 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + next-level-cache = <&L2>; + +From c9ab5671bc0bceac1179f1566daf964c12c4be03 Mon Sep 17 00:00:00 2001 +From: Johan Jonker +Date: Thu, 13 Aug 2020 19:24:51 +0200 +Subject: [PATCH] ARM: dts: rockchip: update cpu supplies on rk3066a + +The use of cpu0-supply for cpu0 alone is deprecated, +so add cpu-supply to each cpu separately and +update all existing rk3066a boards. + +Signed-off-by: Johan Jonker +Link: https://lore.kernel.org/r/20200813172451.13754-2-jbx6244@gmail.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit 20e464c0f12a9b1930adb0365326037d5b060cee) +--- + arch/arm/boot/dts/rk3066a-bqcurie2.dts | 6 +++++- + arch/arm/boot/dts/rk3066a-marsboard.dts | 6 +++++- + arch/arm/boot/dts/rk3066a-rayeager.dts | 6 +++++- + 3 files changed, 15 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/rk3066a-bqcurie2.dts b/arch/arm/boot/dts/rk3066a-bqcurie2.dts +index 0a56a2f1bc4d..eba7a1344976 100644 +--- a/arch/arm/boot/dts/rk3066a-bqcurie2.dts ++++ b/arch/arm/boot/dts/rk3066a-bqcurie2.dts +@@ -63,7 +63,11 @@ + }; + + &cpu0 { +- cpu0-supply = <&vdd_arm>; ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vdd_arm>; + }; + + &i2c1 { +diff --git a/arch/arm/boot/dts/rk3066a-marsboard.dts b/arch/arm/boot/dts/rk3066a-marsboard.dts +index 7e01f6406a86..6b121658d93c 100644 +--- a/arch/arm/boot/dts/rk3066a-marsboard.dts ++++ b/arch/arm/boot/dts/rk3066a-marsboard.dts +@@ -47,7 +47,11 @@ + }; + + &cpu0 { +- cpu0-supply = <&vdd_arm>; ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vdd_arm>; + }; + + &i2c1 { +diff --git a/arch/arm/boot/dts/rk3066a-rayeager.dts b/arch/arm/boot/dts/rk3066a-rayeager.dts +index f9db6bb9fa11..309518403d86 100644 +--- a/arch/arm/boot/dts/rk3066a-rayeager.dts ++++ b/arch/arm/boot/dts/rk3066a-rayeager.dts +@@ -128,7 +128,11 @@ + }; + + &cpu0 { +- cpu0-supply = <&vdd_arm>; ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vdd_arm>; + }; + + &emac { + +From 4b163a2456edff104e7c9e8d6852afb5aec99b7c Mon Sep 17 00:00:00 2001 +From: Adrian Schmutzler +Date: Sun, 30 Aug 2020 21:08:20 +0200 +Subject: [PATCH] ARM: dts: rockchip: replace status value "ok" by "okay" + +While the DT parser recognizes "ok" as a valid value for the +"status" property, it is actually mentioned nowhere. Use the +proper value "okay" instead, as done in the majority of files +already. + +Signed-off-by: Adrian Schmutzler +Link: https://lore.kernel.org/r/20200830190820.20583-1-freifunk@adrianschmutzler.de +Signed-off-by: Heiko Stuebner +(cherry picked from commit 0cf10e6f94335495f90fc62fb75d9569f6a603fb) +--- + arch/arm/boot/dts/rk3288-evb.dtsi | 2 +- + arch/arm/boot/dts/rk3288-firefly-reload-core.dtsi | 2 +- + arch/arm/boot/dts/rk3288-firefly.dtsi | 2 +- + arch/arm/boot/dts/rk3288-miqi.dts | 2 +- + arch/arm/boot/dts/rk3288-popmetal.dts | 2 +- + arch/arm/boot/dts/rk3288-r89.dts | 2 +- + arch/arm/boot/dts/rk3288-rock2-square.dts | 2 +- + arch/arm/boot/dts/rk3288-tinker.dtsi | 2 +- + 8 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/arch/arm/boot/dts/rk3288-evb.dtsi b/arch/arm/boot/dts/rk3288-evb.dtsi +index 018802df4c0e..c4ca73b40d4a 100644 +--- a/arch/arm/boot/dts/rk3288-evb.dtsi ++++ b/arch/arm/boot/dts/rk3288-evb.dtsi +@@ -247,7 +247,7 @@ + pinctrl-0 = <&rgmii_pins>; + tx_delay = <0x30>; + rx_delay = <0x10>; +- status = "ok"; ++ status = "okay"; + }; + + &gpu { +diff --git a/arch/arm/boot/dts/rk3288-firefly-reload-core.dtsi b/arch/arm/boot/dts/rk3288-firefly-reload-core.dtsi +index 61435d8ee37b..36efa36b7190 100644 +--- a/arch/arm/boot/dts/rk3288-firefly-reload-core.dtsi ++++ b/arch/arm/boot/dts/rk3288-firefly-reload-core.dtsi +@@ -61,7 +61,7 @@ + snps,reset-gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_LOW>; + tx_delay = <0x30>; + rx_delay = <0x10>; +- status = "ok"; ++ status = "okay"; + }; + + &i2c0 { +diff --git a/arch/arm/boot/dts/rk3288-firefly.dtsi b/arch/arm/boot/dts/rk3288-firefly.dtsi +index e5c4fd4ea67e..7fb582302b32 100644 +--- a/arch/arm/boot/dts/rk3288-firefly.dtsi ++++ b/arch/arm/boot/dts/rk3288-firefly.dtsi +@@ -191,7 +191,7 @@ + snps,reset-gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_LOW>; + tx_delay = <0x30>; + rx_delay = <0x10>; +- status = "ok"; ++ status = "okay"; + }; + + &gpu { +diff --git a/arch/arm/boot/dts/rk3288-miqi.dts b/arch/arm/boot/dts/rk3288-miqi.dts +index 8a3992105151..cf54d5ffff2f 100644 +--- a/arch/arm/boot/dts/rk3288-miqi.dts ++++ b/arch/arm/boot/dts/rk3288-miqi.dts +@@ -120,7 +120,7 @@ + snps,reset-gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_LOW>; + tx_delay = <0x30>; + rx_delay = <0x10>; +- status = "ok"; ++ status = "okay"; + }; + + &hdmi { +diff --git a/arch/arm/boot/dts/rk3288-popmetal.dts b/arch/arm/boot/dts/rk3288-popmetal.dts +index 160ed8b932fb..8c7376d64bc4 100644 +--- a/arch/arm/boot/dts/rk3288-popmetal.dts ++++ b/arch/arm/boot/dts/rk3288-popmetal.dts +@@ -161,7 +161,7 @@ + pinctrl-0 = <&rgmii_pins>; + tx_delay = <0x30>; + rx_delay = <0x10>; +- status = "ok"; ++ status = "okay"; + }; + + &hdmi { +diff --git a/arch/arm/boot/dts/rk3288-r89.dts b/arch/arm/boot/dts/rk3288-r89.dts +index e5ba901c7dcb..55467bc30fa6 100644 +--- a/arch/arm/boot/dts/rk3288-r89.dts ++++ b/arch/arm/boot/dts/rk3288-r89.dts +@@ -119,7 +119,7 @@ + pinctrl-0 = <&rgmii_pins>; + tx_delay = <0x30>; + rx_delay = <0x10>; +- status = "ok"; ++ status = "okay"; + }; + + &hdmi { +diff --git a/arch/arm/boot/dts/rk3288-rock2-square.dts b/arch/arm/boot/dts/rk3288-rock2-square.dts +index 3cca4d0f9b09..c4d1d142d8c6 100644 +--- a/arch/arm/boot/dts/rk3288-rock2-square.dts ++++ b/arch/arm/boot/dts/rk3288-rock2-square.dts +@@ -156,7 +156,7 @@ + }; + + &gmac { +- status = "ok"; ++ status = "okay"; + }; + + &hdmi { +diff --git a/arch/arm/boot/dts/rk3288-tinker.dtsi b/arch/arm/boot/dts/rk3288-tinker.dtsi +index 90e9be443fe6..9c1e38c54eae 100644 +--- a/arch/arm/boot/dts/rk3288-tinker.dtsi ++++ b/arch/arm/boot/dts/rk3288-tinker.dtsi +@@ -137,7 +137,7 @@ + snps,reset-delays-us = <0 10000 1000000>; + tx_delay = <0x30>; + rx_delay = <0x10>; +- status = "ok"; ++ status = "okay"; + }; + + &gpu { + +From 26f3fea877d88bffe0cfbccafb3109a5b4700de9 Mon Sep 17 00:00:00 2001 +From: Adrian Schmutzler +Date: Sun, 30 Aug 2020 22:11:12 +0200 +Subject: [PATCH] arm64: dts: rockchip: replace status value "ok" by "okay" + +While the DT parser recognizes "ok" as a valid value for the +"status" property, it is actually mentioned nowhere. Use the +proper value "okay" instead, as done in the majority of files +already. + +Signed-off-by: Adrian Schmutzler +Link: https://lore.kernel.org/r/20200830201112.1934-1-freifunk@adrianschmutzler.de +Signed-off-by: Heiko Stuebner +(cherry picked from commit 9caff35d7eba8e15c996c694a282fd38b2ea345e) +--- + arch/arm64/boot/dts/rockchip/rk3368-evb.dtsi | 2 +- + arch/arm64/boot/dts/rockchip/rk3368-orion-r68-meta.dts | 2 +- + arch/arm64/boot/dts/rockchip/rk3368-r88.dts | 4 ++-- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3368-evb.dtsi b/arch/arm64/boot/dts/rockchip/rk3368-evb.dtsi +index 1c52f47c43a6..87fabc64cc39 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3368-evb.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3368-evb.dtsi +@@ -134,7 +134,7 @@ + pinctrl-0 = <&rmii_pins>; + tx_delay = <0x30>; + rx_delay = <0x10>; +- status = "ok"; ++ status = "okay"; + }; + + &i2c0 { +diff --git a/arch/arm64/boot/dts/rockchip/rk3368-orion-r68-meta.dts b/arch/arm64/boot/dts/rockchip/rk3368-orion-r68-meta.dts +index b058ce999e3b..ecce16ecc9c3 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3368-orion-r68-meta.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3368-orion-r68-meta.dts +@@ -183,7 +183,7 @@ + snps,reset-delays-us = <0 10000 1000000>; + tx_delay = <0x30>; + rx_delay = <0x10>; +- status = "ok"; ++ status = "okay"; + }; + + &i2c0 { +diff --git a/arch/arm64/boot/dts/rockchip/rk3368-r88.dts b/arch/arm64/boot/dts/rockchip/rk3368-r88.dts +index 236ab0f1b206..2582fa4b90e2 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3368-r88.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3368-r88.dts +@@ -167,7 +167,7 @@ + pinctrl-0 = <&rmii_pins>; + tx_delay = <0x30>; + rx_delay = <0x10>; +- status = "ok"; ++ status = "okay"; + }; + + &i2c0 { +@@ -198,7 +198,7 @@ + }; + + &io_domains { +- status = "ok"; ++ status = "okay"; + + audio-supply = <&vcc_io>; + gpio30-supply = <&vcc_io>; + +From 28e7a5de4a188cb33017f93a025b3888bf09a74c Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Fri, 28 Aug 2020 17:26:35 +0200 +Subject: [PATCH] dmaengine: pl330: Simplify with dev_err_probe() + +Common pattern of handling deferred probe can be simplified with +dev_err_probe(). Less code and the error value gets printed. + +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20200828152637.16903-1-krzk@kernel.org +Signed-off-by: Vinod Koul +(cherry picked from commit af53bef5636d92e81279f4a16f814f8dccf9bf89) +--- + drivers/dma/pl330.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 106f47298f9e..bb27338ec1ae 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -3034,9 +3034,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) + + pl330->rstc = devm_reset_control_get_optional(&adev->dev, "dma"); + if (IS_ERR(pl330->rstc)) { +- if (PTR_ERR(pl330->rstc) != -EPROBE_DEFER) +- dev_err(&adev->dev, "Failed to get reset!\n"); +- return PTR_ERR(pl330->rstc); ++ return dev_err_probe(&adev->dev, PTR_ERR(pl330->rstc), "Failed to get reset!\n"); + } else { + ret = reset_control_deassert(pl330->rstc); + if (ret) { +@@ -3047,9 +3045,8 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) + + pl330->rstc_ocp = devm_reset_control_get_optional(&adev->dev, "dma-ocp"); + if (IS_ERR(pl330->rstc_ocp)) { +- if (PTR_ERR(pl330->rstc_ocp) != -EPROBE_DEFER) +- dev_err(&adev->dev, "Failed to get OCP reset!\n"); +- return PTR_ERR(pl330->rstc_ocp); ++ return dev_err_probe(&adev->dev, PTR_ERR(pl330->rstc_ocp), ++ "Failed to get OCP reset!\n"); + } else { + ret = reset_control_deassert(pl330->rstc_ocp); + if (ret) { + +From da47d555261d41660af9d1071f22b044079d8aff Mon Sep 17 00:00:00 2001 +From: Robin Murphy +Date: Thu, 3 Sep 2020 21:25:53 +0100 +Subject: [PATCH] dmaengine: pl330: Drop local dma_parms + +Since commit f458488425f1 ("amba: Initialize dma_parms for amba +devices"), struct amba_device already provides a dma_parms structure, +so we can save allocating another one. + +Signed-off-by: Robin Murphy +Link: https://lore.kernel.org/r/c9e58882e33f22f9b0a6d65a5507e24004512148.1599164692.git.robin.murphy@arm.com +Signed-off-by: Vinod Koul +(cherry picked from commit 2fc3cad287c62c6477ab674e4430662b470c3a22) +--- + drivers/dma/pl330.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index bb27338ec1ae..000c3c4b4f7a 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -460,9 +460,6 @@ struct pl330_dmac { + /* DMA-Engine Device */ + struct dma_device ddma; + +- /* Holds info about sg limitations */ +- struct device_dma_parameters dma_parms; +- + /* Pool of descriptors available for the DMAC's channels */ + struct list_head desc_pool; + /* To protect desc_pool manipulation */ +@@ -3151,8 +3148,6 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) + } + } + +- adev->dev.dma_parms = &pl330->dma_parms; +- + /* + * This is the limit for transfers with a buswidth of 1, larger + * buswidths will have larger limits. + +From 86d82ef8547894e41cfded4a7521c7dcb6f3dc54 Mon Sep 17 00:00:00 2001 +From: Tuo Li +Date: Mon, 7 Sep 2020 21:09:37 +0800 +Subject: [PATCH] ALSA: rockchip_i2s: fix a possible divide-by-zero bug in + rockchip_i2s_hw_params() + +The variable bclk_rate is checked in: + if (bclk_rate && mclk_rate % bclk_rate) + +This indicates that bclk_rate can be zero. +If so, a divide-by-zero bug will occur: + div_bclk = mclk_rate / bclk_rate; + +To fix this possible bug, the function returns -EINVAL when bclk_rate is +zero. + +Signed-off-by: Tuo Li +Link: https://lore.kernel.org/r/TY2PR04MB4029799E60A5BCAAD5B7B5BBB8280@TY2PR04MB4029.apcprd04.prod.outlook.com +Signed-off-by: Mark Brown +(cherry picked from commit 375e2c352582442783178e6a33c279d6bc9354a2) +--- + sound/soc/rockchip/rockchip_i2s.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c +index d1438753edb4..593299675b8c 100644 +--- a/sound/soc/rockchip/rockchip_i2s.c ++++ b/sound/soc/rockchip/rockchip_i2s.c +@@ -279,7 +279,7 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream, + if (i2s->is_master_mode) { + mclk_rate = clk_get_rate(i2s->mclk); + bclk_rate = 2 * 32 * params_rate(params); +- if (bclk_rate && mclk_rate % bclk_rate) ++ if (bclk_rate == 0 || mclk_rate % bclk_rate) + return -EINVAL; + + div_bclk = mclk_rate / bclk_rate; + +From ddbd68d0a7bc4931238977a1a6b35741c77c550c Mon Sep 17 00:00:00 2001 +From: Allen Pais +Date: Mon, 31 Aug 2020 16:05:27 +0530 +Subject: [PATCH] dmaengine: pl330: convert tasklets to use new tasklet_setup() + API + +In preparation for unconditionally passing the +struct tasklet_struct pointer to all tasklet +callbacks, switch to using the new tasklet_setup() +and from_tasklet() to pass the tasklet pointer explicitly. + +Signed-off-by: Romain Perier +Signed-off-by: Allen Pais +Link: https://lore.kernel.org/r/20200831103542.305571-21-allen.lkml@gmail.com +Signed-off-by: Vinod Koul +(cherry picked from commit ab2a98ae4105d805383f840c54fabbb6560e2fc7) +--- + drivers/dma/pl330.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 000c3c4b4f7a..d98fb318dd2d 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -1573,9 +1573,9 @@ static void dma_pl330_rqcb(struct dma_pl330_desc *desc, enum pl330_op_err err) + tasklet_schedule(&pch->task); + } + +-static void pl330_dotask(unsigned long data) ++static void pl330_dotask(struct tasklet_struct *t) + { +- struct pl330_dmac *pl330 = (struct pl330_dmac *) data; ++ struct pl330_dmac *pl330 = from_tasklet(pl330, t, tasks); + unsigned long flags; + int i; + +@@ -1979,7 +1979,7 @@ static int pl330_add(struct pl330_dmac *pl330) + return ret; + } + +- tasklet_init(&pl330->tasks, pl330_dotask, (unsigned long) pl330); ++ tasklet_setup(&pl330->tasks, pl330_dotask); + + pl330->state = INIT; + +@@ -2062,9 +2062,9 @@ static inline void fill_queue(struct dma_pl330_chan *pch) + } + } + +-static void pl330_tasklet(unsigned long data) ++static void pl330_tasklet(struct tasklet_struct *t) + { +- struct dma_pl330_chan *pch = (struct dma_pl330_chan *)data; ++ struct dma_pl330_chan *pch = from_tasklet(pch, t, task); + struct dma_pl330_desc *desc, *_dt; + unsigned long flags; + bool power_down = false; +@@ -2172,7 +2172,7 @@ static int pl330_alloc_chan_resources(struct dma_chan *chan) + return -ENOMEM; + } + +- tasklet_init(&pch->task, pl330_tasklet, (unsigned long) pch); ++ tasklet_setup(&pch->task, pl330_tasklet); + + spin_unlock_irqrestore(&pl330->lock, flags); + + +From 1004f7a89c69a41e05bfb0e50b855192eb13def4 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Wed, 16 Sep 2020 18:17:40 +0200 +Subject: [PATCH] clk: rockchip: rk3308: drop unused mux_timer_src_p +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The parent names 'mux_timer_src_p' is not used: + + In file included from drivers/clk/rockchip/clk-rk3308.c:13:0: + drivers/clk/rockchip/clk-rk3308.c:136:7: warning: ‘mux_timer_src_p’ defined but not used [-Wunused-const-variable=] + +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20200916161740.14173-6-krzk@kernel.org +Signed-off-by: Heiko Stuebner +(cherry picked from commit 816e87253dec6686d2ef1bc2d84e82f033555046) +--- + drivers/clk/rockchip/clk-rk3308.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/clk/rockchip/clk-rk3308.c b/drivers/clk/rockchip/clk-rk3308.c +index b0baf87a283e..5bf15f2a44b7 100644 +--- a/drivers/clk/rockchip/clk-rk3308.c ++++ b/drivers/clk/rockchip/clk-rk3308.c +@@ -133,7 +133,6 @@ PNAME(mux_uart1_p) = { "clk_uart1_src", "dummy", "clk_uart1_frac" }; + PNAME(mux_uart2_p) = { "clk_uart2_src", "dummy", "clk_uart2_frac" }; + PNAME(mux_uart3_p) = { "clk_uart3_src", "dummy", "clk_uart3_frac" }; + PNAME(mux_uart4_p) = { "clk_uart4_src", "dummy", "clk_uart4_frac" }; +-PNAME(mux_timer_src_p) = { "xin24m", "clk_rtc32k" }; + PNAME(mux_dclk_vop_p) = { "dclk_vop_src", "dclk_vop_frac", "xin24m" }; + PNAME(mux_nandc_p) = { "clk_nandc_div", "clk_nandc_div50" }; + PNAME(mux_sdmmc_p) = { "clk_sdmmc_div", "clk_sdmmc_div50" }; + +From 61d1828ae692430d8b032376bae59602398fdb36 Mon Sep 17 00:00:00 2001 +From: Elaine Zhang +Date: Mon, 14 Sep 2020 10:22:20 +0800 +Subject: [PATCH] clk: rockchip: Use clk_hw_register_composite instead of + clk_register_composite calls + +clk_hw_register_composite it's already exported. +Preparation for compilation of rK common clock drivers into modules. + +Reported-by: kernel test robot +Signed-off-by: Elaine Zhang +Reviewed-by: Kever Yang +Reviewed-by: Heiko Stuebner +Reviewed-by: Stephen Boyd +Link: https://lore.kernel.org/r/20200914022225.23613-2-zhangqing@rock-chips.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit 63207c37eac4f15fdebac14685a315c259c0a780) +--- + drivers/clk/rockchip/clk-half-divider.c | 18 +++++----- + drivers/clk/rockchip/clk.c | 61 ++++++++++++++++----------------- + 2 files changed, 40 insertions(+), 39 deletions(-) + +diff --git a/drivers/clk/rockchip/clk-half-divider.c b/drivers/clk/rockchip/clk-half-divider.c +index b333fc28c94b..e97fd3dfbae7 100644 +--- a/drivers/clk/rockchip/clk-half-divider.c ++++ b/drivers/clk/rockchip/clk-half-divider.c +@@ -166,7 +166,7 @@ struct clk *rockchip_clk_register_halfdiv(const char *name, + unsigned long flags, + spinlock_t *lock) + { +- struct clk *clk; ++ struct clk_hw *hw; + struct clk_mux *mux = NULL; + struct clk_gate *gate = NULL; + struct clk_divider *div = NULL; +@@ -212,16 +212,18 @@ struct clk *rockchip_clk_register_halfdiv(const char *name, + div_ops = &clk_half_divider_ops; + } + +- clk = clk_register_composite(NULL, name, parent_names, num_parents, +- mux ? &mux->hw : NULL, mux_ops, +- div ? &div->hw : NULL, div_ops, +- gate ? &gate->hw : NULL, gate_ops, +- flags); ++ hw = clk_hw_register_composite(NULL, name, parent_names, num_parents, ++ mux ? &mux->hw : NULL, mux_ops, ++ div ? &div->hw : NULL, div_ops, ++ gate ? &gate->hw : NULL, gate_ops, ++ flags); ++ if (IS_ERR(hw)) ++ goto err_div; + +- return clk; ++ return hw->clk; + err_div: + kfree(gate); + err_gate: + kfree(mux); +- return ERR_PTR(-ENOMEM); ++ return ERR_CAST(hw); + } +diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c +index 546e810c3560..46409972983e 100644 +--- a/drivers/clk/rockchip/clk.c ++++ b/drivers/clk/rockchip/clk.c +@@ -43,7 +43,7 @@ static struct clk *rockchip_clk_register_branch(const char *name, + u8 gate_shift, u8 gate_flags, unsigned long flags, + spinlock_t *lock) + { +- struct clk *clk; ++ struct clk_hw *hw; + struct clk_mux *mux = NULL; + struct clk_gate *gate = NULL; + struct clk_divider *div = NULL; +@@ -100,20 +100,18 @@ static struct clk *rockchip_clk_register_branch(const char *name, + : &clk_divider_ops; + } + +- clk = clk_register_composite(NULL, name, parent_names, num_parents, +- mux ? &mux->hw : NULL, mux_ops, +- div ? &div->hw : NULL, div_ops, +- gate ? &gate->hw : NULL, gate_ops, +- flags); +- +- if (IS_ERR(clk)) { +- ret = PTR_ERR(clk); +- goto err_composite; ++ hw = clk_hw_register_composite(NULL, name, parent_names, num_parents, ++ mux ? &mux->hw : NULL, mux_ops, ++ div ? &div->hw : NULL, div_ops, ++ gate ? &gate->hw : NULL, gate_ops, ++ flags); ++ if (IS_ERR(hw)) { ++ kfree(div); ++ kfree(gate); ++ return ERR_CAST(hw); + } + +- return clk; +-err_composite: +- kfree(div); ++ return hw->clk; + err_div: + kfree(gate); + err_gate: +@@ -214,8 +212,8 @@ static struct clk *rockchip_clk_register_frac_branch( + unsigned long flags, struct rockchip_clk_branch *child, + spinlock_t *lock) + { ++ struct clk_hw *hw; + struct rockchip_clk_frac *frac; +- struct clk *clk; + struct clk_gate *gate = NULL; + struct clk_fractional_divider *div = NULL; + const struct clk_ops *div_ops = NULL, *gate_ops = NULL; +@@ -255,14 +253,14 @@ static struct clk *rockchip_clk_register_frac_branch( + div->approximation = rockchip_fractional_approximation; + div_ops = &clk_fractional_divider_ops; + +- clk = clk_register_composite(NULL, name, parent_names, num_parents, +- NULL, NULL, +- &div->hw, div_ops, +- gate ? &gate->hw : NULL, gate_ops, +- flags | CLK_SET_RATE_UNGATE); +- if (IS_ERR(clk)) { ++ hw = clk_hw_register_composite(NULL, name, parent_names, num_parents, ++ NULL, NULL, ++ &div->hw, div_ops, ++ gate ? &gate->hw : NULL, gate_ops, ++ flags | CLK_SET_RATE_UNGATE); ++ if (IS_ERR(hw)) { + kfree(frac); +- return clk; ++ return ERR_CAST(hw); + } + + if (child) { +@@ -292,7 +290,7 @@ static struct clk *rockchip_clk_register_frac_branch( + mux_clk = clk_register(NULL, &frac_mux->hw); + if (IS_ERR(mux_clk)) { + kfree(frac); +- return clk; ++ return mux_clk; + } + + rockchip_clk_add_lookup(ctx, mux_clk, child->id); +@@ -301,7 +299,7 @@ static struct clk *rockchip_clk_register_frac_branch( + if (frac->mux_frac_idx >= 0) { + pr_debug("%s: found fractional parent in mux at pos %d\n", + __func__, frac->mux_frac_idx); +- ret = clk_notifier_register(clk, &frac->clk_nb); ++ ret = clk_notifier_register(hw->clk, &frac->clk_nb); + if (ret) + pr_err("%s: failed to register clock notifier for %s\n", + __func__, name); +@@ -311,7 +309,7 @@ static struct clk *rockchip_clk_register_frac_branch( + } + } + +- return clk; ++ return hw->clk; + } + + static struct clk *rockchip_clk_register_factor_branch(const char *name, +@@ -320,7 +318,7 @@ static struct clk *rockchip_clk_register_factor_branch(const char *name, + int gate_offset, u8 gate_shift, u8 gate_flags, + unsigned long flags, spinlock_t *lock) + { +- struct clk *clk; ++ struct clk_hw *hw; + struct clk_gate *gate = NULL; + struct clk_fixed_factor *fix = NULL; + +@@ -349,16 +347,17 @@ static struct clk *rockchip_clk_register_factor_branch(const char *name, + fix->mult = mult; + fix->div = div; + +- clk = clk_register_composite(NULL, name, parent_names, num_parents, +- NULL, NULL, +- &fix->hw, &clk_fixed_factor_ops, +- &gate->hw, &clk_gate_ops, flags); +- if (IS_ERR(clk)) { ++ hw = clk_hw_register_composite(NULL, name, parent_names, num_parents, ++ NULL, NULL, ++ &fix->hw, &clk_fixed_factor_ops, ++ &gate->hw, &clk_gate_ops, flags); ++ if (IS_ERR(hw)) { + kfree(fix); + kfree(gate); ++ return ERR_CAST(hw); + } + +- return clk; ++ return hw->clk; + } + + struct rockchip_clk_provider * __init rockchip_clk_init(struct device_node *np, + +From ec0b48760e3c0efb4522dfedf3a5088e538991c5 Mon Sep 17 00:00:00 2001 +From: Elaine Zhang +Date: Mon, 14 Sep 2020 10:22:21 +0800 +Subject: [PATCH] clk: rockchip: Export rockchip_clk_register_ddrclk() + +This is used by the Rockchip clk driver, export it to allow that +driver to be compiled as a module.. + +Signed-off-by: Elaine Zhang +Reviewed-by: Kever Yang +Reviewed-by: Stephen Boyd +Link: https://lore.kernel.org/r/20200914022225.23613-3-zhangqing@rock-chips.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit f73907de3493b94d80af5122bcacc98f0e7b295b) +--- + drivers/clk/rockchip/clk-ddr.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/clk/rockchip/clk-ddr.c b/drivers/clk/rockchip/clk-ddr.c +index 9273bce4d7b6..86718c54e56b 100644 +--- a/drivers/clk/rockchip/clk-ddr.c ++++ b/drivers/clk/rockchip/clk-ddr.c +@@ -136,3 +136,4 @@ struct clk *rockchip_clk_register_ddrclk(const char *name, int flags, + + return clk; + } ++EXPORT_SYMBOL_GPL(rockchip_clk_register_ddrclk); + +From e2b0bd39722ef935b30bacf97a23446297169ac7 Mon Sep 17 00:00:00 2001 +From: Elaine Zhang +Date: Mon, 14 Sep 2020 10:22:22 +0800 +Subject: [PATCH] clk: rockchip: Export rockchip_register_softrst() + +This is used by the Rockchip clk driver, export it to allow that +driver to be compiled as a module.. + +Signed-off-by: Elaine Zhang +Reviewed-by: Kever Yang +Reviewed-by: Stephen Boyd +Link: https://lore.kernel.org/r/20200914022225.23613-4-zhangqing@rock-chips.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit 37353491d1a8c207685c138c3640bd43864b70d9) +--- + drivers/clk/rockchip/softrst.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/clk/rockchip/softrst.c b/drivers/clk/rockchip/softrst.c +index 5f1ff5e47c4f..5d07266745b8 100644 +--- a/drivers/clk/rockchip/softrst.c ++++ b/drivers/clk/rockchip/softrst.c +@@ -77,9 +77,9 @@ static const struct reset_control_ops rockchip_softrst_ops = { + .deassert = rockchip_softrst_deassert, + }; + +-void __init rockchip_register_softrst(struct device_node *np, +- unsigned int num_regs, +- void __iomem *base, u8 flags) ++void rockchip_register_softrst(struct device_node *np, ++ unsigned int num_regs, ++ void __iomem *base, u8 flags) + { + struct rockchip_softrst *softrst; + int ret; +@@ -107,3 +107,4 @@ void __init rockchip_register_softrst(struct device_node *np, + kfree(softrst); + } + }; ++EXPORT_SYMBOL_GPL(rockchip_register_softrst); + +From 8af53c34ecbf759fccf3769fa03d43db2ac554cb Mon Sep 17 00:00:00 2001 +From: Elaine Zhang +Date: Mon, 14 Sep 2020 10:22:23 +0800 +Subject: [PATCH] clk: rockchip: Export some clock common APIs for module + drivers + +This is used by the Rockchip clk driver, export it to allow that +driver to be compiled as a module. + +Signed-off-by: Elaine Zhang +Reviewed-by: Kever Yang +Reviewed-by: Stephen Boyd +Link: https://lore.kernel.org/r/20200914022225.23613-5-zhangqing@rock-chips.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit ea650c26611dd61adfcc8647d6144f2c9f453d90) +--- + drivers/clk/rockchip/clk.c | 52 ++++++++++++++++++++++++++-------------------- + 1 file changed, 30 insertions(+), 22 deletions(-) + +diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c +index 46409972983e..b443169dd408 100644 +--- a/drivers/clk/rockchip/clk.c ++++ b/drivers/clk/rockchip/clk.c +@@ -360,8 +360,9 @@ static struct clk *rockchip_clk_register_factor_branch(const char *name, + return hw->clk; + } + +-struct rockchip_clk_provider * __init rockchip_clk_init(struct device_node *np, +- void __iomem *base, unsigned long nr_clks) ++struct rockchip_clk_provider *rockchip_clk_init(struct device_node *np, ++ void __iomem *base, ++ unsigned long nr_clks) + { + struct rockchip_clk_provider *ctx; + struct clk **clk_table; +@@ -393,14 +394,16 @@ struct rockchip_clk_provider * __init rockchip_clk_init(struct device_node *np, + kfree(ctx); + return ERR_PTR(-ENOMEM); + } ++EXPORT_SYMBOL_GPL(rockchip_clk_init); + +-void __init rockchip_clk_of_add_provider(struct device_node *np, +- struct rockchip_clk_provider *ctx) ++void rockchip_clk_of_add_provider(struct device_node *np, ++ struct rockchip_clk_provider *ctx) + { + if (of_clk_add_provider(np, of_clk_src_onecell_get, + &ctx->clk_data)) + pr_err("%s: could not register clk provider\n", __func__); + } ++EXPORT_SYMBOL_GPL(rockchip_clk_of_add_provider); + + void rockchip_clk_add_lookup(struct rockchip_clk_provider *ctx, + struct clk *clk, unsigned int id) +@@ -408,8 +411,9 @@ void rockchip_clk_add_lookup(struct rockchip_clk_provider *ctx, + if (ctx->clk_data.clks && id) + ctx->clk_data.clks[id] = clk; + } ++EXPORT_SYMBOL_GPL(rockchip_clk_add_lookup); + +-void __init rockchip_clk_register_plls(struct rockchip_clk_provider *ctx, ++void rockchip_clk_register_plls(struct rockchip_clk_provider *ctx, + struct rockchip_pll_clock *list, + unsigned int nr_pll, int grf_lock_offset) + { +@@ -432,11 +436,11 @@ void __init rockchip_clk_register_plls(struct rockchip_clk_provider *ctx, + rockchip_clk_add_lookup(ctx, clk, list->id); + } + } ++EXPORT_SYMBOL_GPL(rockchip_clk_register_plls); + +-void __init rockchip_clk_register_branches( +- struct rockchip_clk_provider *ctx, +- struct rockchip_clk_branch *list, +- unsigned int nr_clk) ++void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx, ++ struct rockchip_clk_branch *list, ++ unsigned int nr_clk) + { + struct clk *clk = NULL; + unsigned int idx; +@@ -565,14 +569,15 @@ void __init rockchip_clk_register_branches( + rockchip_clk_add_lookup(ctx, clk, list->id); + } + } +- +-void __init rockchip_clk_register_armclk(struct rockchip_clk_provider *ctx, +- unsigned int lookup_id, +- const char *name, const char *const *parent_names, +- u8 num_parents, +- const struct rockchip_cpuclk_reg_data *reg_data, +- const struct rockchip_cpuclk_rate_table *rates, +- int nrates) ++EXPORT_SYMBOL_GPL(rockchip_clk_register_branches); ++ ++void rockchip_clk_register_armclk(struct rockchip_clk_provider *ctx, ++ unsigned int lookup_id, ++ const char *name, const char *const *parent_names, ++ u8 num_parents, ++ const struct rockchip_cpuclk_reg_data *reg_data, ++ const struct rockchip_cpuclk_rate_table *rates, ++ int nrates) + { + struct clk *clk; + +@@ -587,9 +592,10 @@ void __init rockchip_clk_register_armclk(struct rockchip_clk_provider *ctx, + + rockchip_clk_add_lookup(ctx, clk, lookup_id); + } ++EXPORT_SYMBOL_GPL(rockchip_clk_register_armclk); + +-void __init rockchip_clk_protect_critical(const char *const clocks[], +- int nclocks) ++void rockchip_clk_protect_critical(const char *const clocks[], ++ int nclocks) + { + int i; + +@@ -601,6 +607,7 @@ void __init rockchip_clk_protect_critical(const char *const clocks[], + clk_prepare_enable(clk); + } + } ++EXPORT_SYMBOL_GPL(rockchip_clk_protect_critical); + + static void __iomem *rst_base; + static unsigned int reg_restart; +@@ -620,10 +627,10 @@ static struct notifier_block rockchip_restart_handler = { + .priority = 128, + }; + +-void __init ++void + rockchip_register_restart_notifier(struct rockchip_clk_provider *ctx, +- unsigned int reg, +- void (*cb)(void)) ++ unsigned int reg, ++ void (*cb)(void)) + { + int ret; + +@@ -635,3 +642,4 @@ rockchip_register_restart_notifier(struct rockchip_clk_provider *ctx, + pr_err("%s: cannot register restart handler, %d\n", + __func__, ret); + } ++EXPORT_SYMBOL_GPL(rockchip_register_restart_notifier); + +From c71d3c0979104408630b2c540ae383b1ff0d4dd3 Mon Sep 17 00:00:00 2001 +From: Elaine Zhang +Date: Mon, 14 Sep 2020 10:23:04 +0800 +Subject: [PATCH] clk: rockchip: fix the clk config to support module build + +use CONFIG_COMMON_CLK_ROCKCHIP for Rk common clk drivers. +use CONFIG_CLK_RKXX for Rk soc clk driver. +Mark CONFIG_CLK_RK3399 to "tristate", +to support building Rk3399 SoC clock driver as module. + +Signed-off-by: Elaine Zhang +Reviewed-by: Kever Yang +Reviewed-by: Stephen Boyd +Link: https://lore.kernel.org/r/20200914022304.23908-1-zhangqing@rock-chips.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit 4d98ed1e126495016f2a3ef4db6379855c4aacf2) +--- + drivers/clk/Kconfig | 1 + + drivers/clk/rockchip/Kconfig | 78 +++++++++++++++++++++++++++++++++++++++++++ + drivers/clk/rockchip/Makefile | 42 ++++++++++++----------- + 3 files changed, 101 insertions(+), 20 deletions(-) + create mode 100644 drivers/clk/rockchip/Kconfig + +diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig +index 4026fac9fac3..b41aaed9bd51 100644 +--- a/drivers/clk/Kconfig ++++ b/drivers/clk/Kconfig +@@ -373,6 +373,7 @@ source "drivers/clk/meson/Kconfig" + source "drivers/clk/mvebu/Kconfig" + source "drivers/clk/qcom/Kconfig" + source "drivers/clk/renesas/Kconfig" ++source "drivers/clk/rockchip/Kconfig" + source "drivers/clk/samsung/Kconfig" + source "drivers/clk/sifive/Kconfig" + source "drivers/clk/sprd/Kconfig" +diff --git a/drivers/clk/rockchip/Kconfig b/drivers/clk/rockchip/Kconfig +new file mode 100644 +index 000000000000..524b0e0df0a7 +--- /dev/null ++++ b/drivers/clk/rockchip/Kconfig +@@ -0,0 +1,78 @@ ++# SPDX-License-Identifier: GPL-2.0 ++# common clock support for ROCKCHIP SoC family. ++ ++config COMMON_CLK_ROCKCHIP ++ bool "Rockchip clock controller common support" ++ depends on ARCH_ROCKCHIP ++ default ARCH_ROCKCHIP ++ help ++ Say y here to enable common clock controller for Rockchip platforms. ++ ++if COMMON_CLK_ROCKCHIP ++config CLK_PX30 ++ bool "Rockchip PX30 clock controller support" ++ default y ++ help ++ Build the driver for PX30 Clock Driver. ++ ++config CLK_RV110X ++ bool "Rockchip RV110x clock controller support" ++ default y ++ help ++ Build the driver for RV110x Clock Driver. ++ ++config CLK_RK3036 ++ bool "Rockchip RK3036 clock controller support" ++ default y ++ help ++ Build the driver for RK3036 Clock Driver. ++ ++config CLK_RK312X ++ bool "Rockchip RK312x clock controller support" ++ default y ++ help ++ Build the driver for RK312x Clock Driver. ++ ++config CLK_RK3188 ++ bool "Rockchip RK3188 clock controller support" ++ default y ++ help ++ Build the driver for RK3188 Clock Driver. ++ ++config CLK_RK322X ++ bool "Rockchip RK322x clock controller support" ++ default y ++ help ++ Build the driver for RK322x Clock Driver. ++ ++config CLK_RK3288 ++ bool "Rockchip RK3288 clock controller support" ++ depends on ARM ++ default y ++ help ++ Build the driver for RK3288 Clock Driver. ++ ++config CLK_RK3308 ++ bool "Rockchip RK3308 clock controller support" ++ default y ++ help ++ Build the driver for RK3308 Clock Driver. ++ ++config CLK_RK3328 ++ bool "Rockchip RK3328 clock controller support" ++ default y ++ help ++ Build the driver for RK3328 Clock Driver. ++ ++config CLK_RK3368 ++ bool "Rockchip RK3368 clock controller support" ++ default y ++ help ++ Build the driver for RK3368 Clock Driver. ++ ++config CLK_RK3399 ++ bool "Rockchip RK3399 clock controller support" ++ default y ++ help ++ Build the driver for RK3399 Clock Driver. ++endif +diff --git a/drivers/clk/rockchip/Makefile b/drivers/clk/rockchip/Makefile +index 7c5b5813a87c..a99e4d9bbae1 100644 +--- a/drivers/clk/rockchip/Makefile ++++ b/drivers/clk/rockchip/Makefile +@@ -3,24 +3,26 @@ + # Rockchip Clock specific Makefile + # + +-obj-y += clk.o +-obj-y += clk-pll.o +-obj-y += clk-cpu.o +-obj-y += clk-half-divider.o +-obj-y += clk-inverter.o +-obj-y += clk-mmc-phase.o +-obj-y += clk-muxgrf.o +-obj-y += clk-ddr.o +-obj-$(CONFIG_RESET_CONTROLLER) += softrst.o ++obj-$(CONFIG_COMMON_CLK_ROCKCHIP) += clk-rockchip.o + +-obj-y += clk-px30.o +-obj-y += clk-rv1108.o +-obj-y += clk-rk3036.o +-obj-y += clk-rk3128.o +-obj-y += clk-rk3188.o +-obj-y += clk-rk3228.o +-obj-y += clk-rk3288.o +-obj-y += clk-rk3308.o +-obj-y += clk-rk3328.o +-obj-y += clk-rk3368.o +-obj-y += clk-rk3399.o ++clk-rockchip-y += clk.o ++clk-rockchip-y += clk-pll.o ++clk-rockchip-y += clk-cpu.o ++clk-rockchip-y += clk-half-divider.o ++clk-rockchip-y += clk-inverter.o ++clk-rockchip-y += clk-mmc-phase.o ++clk-rockchip-y += clk-muxgrf.o ++clk-rockchip-y += clk-ddr.o ++clk-rockchip-$(CONFIG_RESET_CONTROLLER) += softrst.o ++ ++obj-$(CONFIG_CLK_PX30) += clk-px30.o ++obj-$(CONFIG_CLK_RV110X) += clk-rv1108.o ++obj-$(CONFIG_CLK_RK3036) += clk-rk3036.o ++obj-$(CONFIG_CLK_RK312X) += clk-rk3128.o ++obj-$(CONFIG_CLK_RK3188) += clk-rk3188.o ++obj-$(CONFIG_CLK_RK322X) += clk-rk3228.o ++obj-$(CONFIG_CLK_RK3288) += clk-rk3288.o ++obj-$(CONFIG_CLK_RK3308) += clk-rk3308.o ++obj-$(CONFIG_CLK_RK3328) += clk-rk3328.o ++obj-$(CONFIG_CLK_RK3368) += clk-rk3368.o ++obj-$(CONFIG_CLK_RK3399) += clk-rk3399.o + +From 640cf0e121d7879899d26bce21b5c7d954f67b09 Mon Sep 17 00:00:00 2001 +From: Elaine Zhang +Date: Mon, 14 Sep 2020 10:23:16 +0800 +Subject: [PATCH] clk: rockchip: rk3399: Support module build + +support CLK_OF_DECLARE and builtin_platform_driver_probe +double clk init method. +add module author, description and license to support building +Soc Rk3399 clock driver as module. + +Signed-off-by: Elaine Zhang +Reviewed-by: Kever Yang +Reviewed-by: Stephen Boyd +Link: https://lore.kernel.org/r/20200914022316.24045-1-zhangqing@rock-chips.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit 70d839e2761d22eba6facdb3b65faea4d57f355d) +--- + drivers/clk/rockchip/Kconfig | 2 +- + drivers/clk/rockchip/clk-rk3399.c | 56 +++++++++++++++++++++++++++++++++++++++ + 2 files changed, 57 insertions(+), 1 deletion(-) + +diff --git a/drivers/clk/rockchip/Kconfig b/drivers/clk/rockchip/Kconfig +index 524b0e0df0a7..47cd6c5de837 100644 +--- a/drivers/clk/rockchip/Kconfig ++++ b/drivers/clk/rockchip/Kconfig +@@ -71,7 +71,7 @@ config CLK_RK3368 + Build the driver for RK3368 Clock Driver. + + config CLK_RK3399 +- bool "Rockchip RK3399 clock controller support" ++ tristate "Rockchip RK3399 clock controller support" + default y + help + Build the driver for RK3399 Clock Driver. +diff --git a/drivers/clk/rockchip/clk-rk3399.c b/drivers/clk/rockchip/clk-rk3399.c +index ce1d2446f142..7df2f1e00347 100644 +--- a/drivers/clk/rockchip/clk-rk3399.c ++++ b/drivers/clk/rockchip/clk-rk3399.c +@@ -5,9 +5,11 @@ + */ + + #include ++#include + #include + #include + #include ++#include + #include + #include + #include +@@ -1600,3 +1602,57 @@ static void __init rk3399_pmu_clk_init(struct device_node *np) + rockchip_clk_of_add_provider(np, ctx); + } + CLK_OF_DECLARE(rk3399_cru_pmu, "rockchip,rk3399-pmucru", rk3399_pmu_clk_init); ++ ++struct clk_rk3399_inits { ++ void (*inits)(struct device_node *np); ++}; ++ ++static const struct clk_rk3399_inits clk_rk3399_pmucru_init = { ++ .inits = rk3399_pmu_clk_init, ++}; ++ ++static const struct clk_rk3399_inits clk_rk3399_cru_init = { ++ .inits = rk3399_clk_init, ++}; ++ ++static const struct of_device_id clk_rk3399_match_table[] = { ++ { ++ .compatible = "rockchip,rk3399-cru", ++ .data = &clk_rk3399_cru_init, ++ }, { ++ .compatible = "rockchip,rk3399-pmucru", ++ .data = &clk_rk3399_pmucru_init, ++ }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, clk_rk3399_match_table); ++ ++static int __init clk_rk3399_probe(struct platform_device *pdev) ++{ ++ struct device_node *np = pdev->dev.of_node; ++ const struct of_device_id *match; ++ const struct clk_rk3399_inits *init_data; ++ ++ match = of_match_device(clk_rk3399_match_table, &pdev->dev); ++ if (!match || !match->data) ++ return -EINVAL; ++ ++ init_data = match->data; ++ if (init_data->inits) ++ init_data->inits(np); ++ ++ return 0; ++} ++ ++static struct platform_driver clk_rk3399_driver = { ++ .driver = { ++ .name = "clk-rk3399", ++ .of_match_table = clk_rk3399_match_table, ++ .suppress_bind_attrs = true, ++ }, ++}; ++builtin_platform_driver_probe(clk_rk3399_driver, clk_rk3399_probe); ++ ++MODULE_DESCRIPTION("Rockchip RK3399 Clock Driver"); ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS("platform:clk-rk3399"); + +From 2862d98b5f5d3682afe09bab8fc29c982e3ac0fe Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Sun, 20 Sep 2020 17:45:27 +0200 +Subject: [PATCH] dt-bindings: Add doc for FriendlyARM NanoPi R2S + +Add devicetree binding documentation for the FriendlyARM NanoPi R2S. + +Signed-off-by: David Bauer +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20200920154528.88185-1-mail@david-bauer.net +Signed-off-by: Heiko Stuebner +(cherry picked from commit 8cfcf3279419acbf2d2c471262bfb18d9e175fc9) +--- + Documentation/devicetree/bindings/arm/rockchip.yaml | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Documentation/devicetree/bindings/arm/rockchip.yaml b/Documentation/devicetree/bindings/arm/rockchip.yaml +index 251c3ca22e1b..65b4cc2c63f7 100644 +--- a/Documentation/devicetree/bindings/arm/rockchip.yaml ++++ b/Documentation/devicetree/bindings/arm/rockchip.yaml +@@ -104,6 +104,11 @@ properties: + - firefly,roc-rk3399-pc-mezzanine + - const: rockchip,rk3399 + ++ - description: FriendlyElec NanoPi R2S ++ items: ++ - const: friendlyarm,nanopi-r2s ++ - const: rockchip,rk3328 ++ + - description: FriendlyElec NanoPi4 series boards + items: + - enum: + +From 6b865e0835b1517ed2e7d44feb819f83ce3bc138 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Sun, 20 Sep 2020 17:45:28 +0200 +Subject: [PATCH] arm64: dts: rockchip: Add support for FriendlyARM NanoPi R2S + +This adds support for the NanoPi R2S from FriendlyARM. + +Rockchip RK3328 SoC +1GB DDR4 RAM +Gigabit Ethernet (WAN) +Gigabit Ethernet (USB3) (LAN) +USB 2.0 Host Port +MicroSD slot +Reset button +WAN - LAN - SYS LED + +Signed-off-by: David Bauer +Link: https://lore.kernel.org/r/20200920154528.88185-2-mail@david-bauer.net +[adapted from sdmmc0m1_gpio to renamed sdmmc0m1_pin] +Reported-by: kernel test robot +Signed-off-by: Heiko Stuebner +(cherry picked from commit f1ec83f880dbeaceb10d33c40c47aa1769b787e8) +--- + arch/arm64/boot/dts/rockchip/Makefile | 1 + + arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts | 368 +++++++++++++++++++++ + 2 files changed, 369 insertions(+) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts + +diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile +index d53efdf4cb5a..26661c7b736b 100644 +--- a/arch/arm64/boot/dts/rockchip/Makefile ++++ b/arch/arm64/boot/dts/rockchip/Makefile +@@ -6,6 +6,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3318-a95x-z2.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3326-odroid-go2.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-a1.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-evb.dtb ++dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-nanopi-r2s.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-rock64.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-roc-cc.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-evb-act8846.dtb +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +new file mode 100644 +index 000000000000..be7a31d81632 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +@@ -0,0 +1,368 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2020 David Bauer ++ */ ++ ++/dts-v1/; ++ ++#include ++#include ++#include "rk3328.dtsi" ++ ++/ { ++ model = "FriendlyElec NanoPi R2S"; ++ compatible = "friendlyarm,nanopi-r2s", "rockchip,rk3328"; ++ ++ chosen { ++ stdout-path = "serial2:1500000n8"; ++ }; ++ ++ gmac_clk: gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "gmac_clk"; ++ #clock-cells = <0>; ++ }; ++ ++ keys { ++ compatible = "gpio-keys"; ++ pinctrl-0 = <&reset_button_pin>; ++ pinctrl-names = "default"; ++ ++ reset { ++ label = "reset"; ++ gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>; ++ linux,code = ; ++ debounce-interval = <50>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ pinctrl-0 = <&lan_led_pin>, <&sys_led_pin>, <&wan_led_pin>; ++ pinctrl-names = "default"; ++ ++ lan_led: led-0 { ++ gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; ++ label = "nanopi-r2s:green:lan"; ++ }; ++ ++ sys_led: led-1 { ++ gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; ++ label = "nanopi-r2s:red:sys"; ++ }; ++ ++ wan_led: led-2 { ++ gpios = <&gpio2 RK_PC2 GPIO_ACTIVE_HIGH>; ++ label = "nanopi-r2s:green:wan"; ++ }; ++ }; ++ ++ vcc_io_sdio: sdmmcio-regulator { ++ compatible = "regulator-gpio"; ++ enable-active-high; ++ gpios = <&gpio1 RK_PD4 GPIO_ACTIVE_HIGH>; ++ pinctrl-0 = <&sdio_vcc_pin>; ++ pinctrl-names = "default"; ++ regulator-name = "vcc_io_sdio"; ++ regulator-always-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-settling-time-us = <5000>; ++ regulator-type = "voltage"; ++ startup-delay-us = <2000>; ++ states = <1800000 0x1 ++ 3300000 0x0>; ++ vin-supply = <&vcc_io_33>; ++ }; ++ ++ vcc_sd: sdmmc-regulator { ++ compatible = "regulator-fixed"; ++ gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>; ++ pinctrl-0 = <&sdmmc0m1_pin>; ++ pinctrl-names = "default"; ++ regulator-name = "vcc_sd"; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vcc_io_33>; ++ }; ++ ++ vdd_5v: vdd-5v { ++ compatible = "regulator-fixed"; ++ regulator-name = "vdd_5v"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++}; ++ ++&cpu0 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu2 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu3 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&gmac2io { ++ assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>; ++ assigned-clock-parents = <&gmac_clk>, <&gmac_clk>; ++ clock_in_out = "input"; ++ phy-handle = <&rtl8211e>; ++ phy-mode = "rgmii"; ++ phy-supply = <&vcc_io_33>; ++ pinctrl-0 = <&rgmiim1_pins>; ++ pinctrl-names = "default"; ++ rx_delay = <0x18>; ++ snps,aal; ++ tx_delay = <0x24>; ++ status = "okay"; ++ ++ mdio { ++ compatible = "snps,dwmac-mdio"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ rtl8211e: ethernet-phy@1 { ++ reg = <1>; ++ pinctrl-0 = <ð_phy_reset_pin>; ++ pinctrl-names = "default"; ++ reset-assert-us = <10000>; ++ reset-deassert-us = <50000>; ++ reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&i2c1 { ++ status = "okay"; ++ ++ rk805: pmic@18 { ++ compatible = "rockchip,rk805"; ++ reg = <0x18>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <24 IRQ_TYPE_LEVEL_LOW>; ++ #clock-cells = <1>; ++ clock-output-names = "xin32k", "rk805-clkout2"; ++ gpio-controller; ++ #gpio-cells = <2>; ++ pinctrl-0 = <&pmic_int_l>; ++ pinctrl-names = "default"; ++ rockchip,system-power-controller; ++ wakeup-source; ++ ++ vcc1-supply = <&vdd_5v>; ++ vcc2-supply = <&vdd_5v>; ++ vcc3-supply = <&vdd_5v>; ++ vcc4-supply = <&vdd_5v>; ++ vcc5-supply = <&vcc_io_33>; ++ vcc6-supply = <&vdd_5v>; ++ ++ regulators { ++ vdd_log: DCDC_REG1 { ++ regulator-name = "vdd_log"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-ramp-delay = <12500>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1000000>; ++ }; ++ }; ++ ++ vdd_arm: DCDC_REG2 { ++ regulator-name = "vdd_arm"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-ramp-delay = <12500>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <950000>; ++ }; ++ }; ++ ++ vcc_ddr: DCDC_REG3 { ++ regulator-name = "vcc_ddr"; ++ regulator-always-on; ++ regulator-boot-on; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_io_33: DCDC_REG4 { ++ regulator-name = "vcc_io_33"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3300000>; ++ }; ++ }; ++ ++ vcc_18: LDO_REG1 { ++ regulator-name = "vcc_18"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc18_emmc: LDO_REG2 { ++ regulator-name = "vcc18_emmc"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vdd_10: LDO_REG3 { ++ regulator-name = "vdd_10"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1000000>; ++ regulator-max-microvolt = <1000000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1000000>; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&io_domains { ++ pmuio-supply = <&vcc_io_33>; ++ vccio1-supply = <&vcc_io_33>; ++ vccio2-supply = <&vcc18_emmc>; ++ vccio3-supply = <&vcc_io_sdio>; ++ vccio4-supply = <&vcc_18>; ++ vccio5-supply = <&vcc_io_33>; ++ vccio6-supply = <&vcc_io_33>; ++ status = "okay"; ++}; ++ ++&pinctrl { ++ button { ++ reset_button_pin: reset-button-pin { ++ rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ ethernet-phy { ++ eth_phy_reset_pin: eth-phy-reset-pin { ++ rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ leds { ++ lan_led_pin: lan-led-pin { ++ rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ sys_led_pin: sys-led-pin { ++ rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ wan_led_pin: wan-led-pin { ++ rockchip,pins = <2 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ sd { ++ sdio_vcc_pin: sdio-vcc-pin { ++ rockchip,pins = <1 RK_PD4 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++}; ++ ++&pwm2 { ++ status = "okay"; ++}; ++ ++&sdmmc { ++ bus-width = <4>; ++ cap-sd-highspeed; ++ disable-wp; ++ pinctrl-0 = <&sdmmc0_clk>, <&sdmmc0_cmd>, <&sdmmc0_dectn>, <&sdmmc0_bus4>; ++ pinctrl-names = "default"; ++ sd-uhs-sdr12; ++ sd-uhs-sdr25; ++ sd-uhs-sdr50; ++ sd-uhs-sdr104; ++ vmmc-supply = <&vcc_sd>; ++ vqmmc-supply = <&vcc_io_sdio>; ++ status = "okay"; ++}; ++ ++&tsadc { ++ rockchip,hw-tshut-mode = <0>; ++ rockchip,hw-tshut-polarity = <0>; ++ status = "okay"; ++}; ++ ++&u2phy { ++ status = "okay"; ++}; ++ ++&u2phy_host { ++ status = "okay"; ++}; ++ ++&u2phy_otg { ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&usb20_otg { ++ status = "okay"; ++ dr_mode = "host"; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; + +From f18092b21f3ea3ed7d134b274c64c8edde1fcb30 Mon Sep 17 00:00:00 2001 +From: Artem Lapkin +Date: Wed, 23 Sep 2020 21:08:22 +0800 +Subject: [PATCH] arm64: dts: rockchip: add spiflash node to rk3399-khadas-edge + +The Khadas Edge Boards uses winbond - w25q128 spi flash with 104Mhz + +Signed-off-by: Artem Lapkin +Link: https://lore.kernel.org/r/20200923130823.1612533-2-art@khadas.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit 5d71f44569941386b419398463166fdf1785f4e2) +--- + arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi +index e36837c04dc7..c67420578fac 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi +@@ -690,6 +690,16 @@ + status = "okay"; + }; + ++&spi1 { ++ status = "okay"; ++ ++ spiflash: flash@0 { ++ compatible = "winbond,w25q128fw", "jedec,spi-nor"; ++ reg = <0>; ++ spi-max-frequency = <104000000>; ++ }; ++}; ++ + &tcphy0 { + status = "okay"; + }; + +From e2cad982d40449e0839c6de164a34a1d2e23d694 Mon Sep 17 00:00:00 2001 +From: Artem Lapkin +Date: Wed, 23 Sep 2020 21:08:23 +0800 +Subject: [PATCH] arm64: dts: rockchip: add ir-receiver node to + rk3399-khadas-edge + +add missed ir-receiver and ir_rx pinctl nodes to rk3399-khadas-edge +Khadas Edge board uses gpio-ir-receiver on RK_PB6 gpio + +Signed-off-by: Artem Lapkin +Link: https://lore.kernel.org/r/20200923130823.1612533-3-art@khadas.com +Signed-off-by: Heiko Stuebner +(cherry picked from commit 30a9a8c16865d37bfc0f1859a398ba1b24eec569) +--- + arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi +index c67420578fac..635afdd99122 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi +@@ -138,6 +138,14 @@ + }; + }; + ++ ir-receiver { ++ compatible = "gpio-ir-receiver"; ++ gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; ++ linux,rc-map-name = "rc-khadas"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&ir_rx>; ++ }; ++ + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; +@@ -585,6 +593,12 @@ + }; + }; + ++ ir { ++ ir_rx: ir-rx { ++ rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ + leds { + sys_led_pin: sys-led-pin { + rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + +From d9ffbaa89722fee3ef963646ea2423ac84f78854 Mon Sep 17 00:00:00 2001 +From: Stephen Boyd +Date: Wed, 23 Sep 2020 17:41:44 -0700 +Subject: [PATCH] clk: rockchip: Initialize hw to error to avoid undefined + behavior + +We can get down to this return value from ERR_CAST() without +initializing hw. Set it to -ENOMEM so that we always return something +sane. + +Fixes the following smatch warning: + +drivers/clk/rockchip/clk-half-divider.c:228 rockchip_clk_register_halfdiv() error: uninitialized symbol 'hw'. +drivers/clk/rockchip/clk-half-divider.c:228 rockchip_clk_register_halfdiv() warn: passing zero to 'ERR_CAST' + +Cc: Elaine Zhang +Cc: Heiko Stuebner +Fixes: 956060a52795 ("clk: rockchip: add support for half divider") +Signed-off-by: Stephen Boyd +(cherry picked from commit f8ac4db0e23c15baa3f379d4f7e007589d7710ed) +--- + drivers/clk/rockchip/clk-half-divider.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/clk/rockchip/clk-half-divider.c b/drivers/clk/rockchip/clk-half-divider.c +index e97fd3dfbae7..ccd5c270c213 100644 +--- a/drivers/clk/rockchip/clk-half-divider.c ++++ b/drivers/clk/rockchip/clk-half-divider.c +@@ -166,7 +166,7 @@ struct clk *rockchip_clk_register_halfdiv(const char *name, + unsigned long flags, + spinlock_t *lock) + { +- struct clk_hw *hw; ++ struct clk_hw *hw = ERR_PTR(-ENOMEM); + struct clk_mux *mux = NULL; + struct clk_gate *gate = NULL; + struct clk_divider *div = NULL; + +From aadd7a83a8a1e799653d9df0cc99bb0633515fbf Mon Sep 17 00:00:00 2001 +From: Vinod Koul +Date: Wed, 30 Sep 2020 17:47:35 +0530 +Subject: [PATCH] dmaengine: pl330: fix argument for tasklet + +Commit 59cd818763e8 ("dmaengine: fsl: convert tasklets to use new +tasklet_setup() API") converted the pl330 driver to use new tasklet +functions but missed that driver calls the tasklet function directly as +well, so update it. + +Fixes: 59cd818763e8 ("dmaengine: fsl: convert tasklets to use new tasklet_setup() API") +Reported-by: kernel test robot +Link: https://lore.kernel.org/r/20200930121735.49699-1-vkoul@kernel.org +Signed-off-by: Vinod Koul +(cherry picked from commit 86ae924a91a4a4297ad9f47e131f74b1dab6cb7a) +--- + drivers/dma/pl330.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index d98fb318dd2d..e9f0101d92fa 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -2484,7 +2484,7 @@ static void pl330_issue_pending(struct dma_chan *chan) + list_splice_tail_init(&pch->submitted_list, &pch->work_list); + spin_unlock_irqrestore(&pch->lock, flags); + +- pl330_tasklet((unsigned long)pch); ++ pl330_tasklet(&pch->task); + } + + /* diff --git a/projects/Rockchip/patches/linux/default/linux-0001-rockchip-from-5.9.patch b/projects/Rockchip/patches/linux/default/linux-0001-rockchip-from-5.9.patch deleted file mode 100644 index 4825cab216..0000000000 --- a/projects/Rockchip/patches/linux/default/linux-0001-rockchip-from-5.9.patch +++ /dev/null @@ -1,4098 +0,0 @@ -From 55085f3c06672bd8d4ebbff1ced4b5fa6c1333a7 Mon Sep 17 00:00:00 2001 -From: Tobias Schramm -Date: Thu, 28 May 2020 19:25:50 +0200 -Subject: [PATCH] arm64: dts: rockchip: add fuel gauge to Pinebook Pro dts - -This commit adds cw2015 fuel gauge and battery to the Pinebook Pro dts. - -Signed-off-by: Tobias Schramm -Link: https://lore.kernel.org/r/20200528172550.2324722-2-t.schramm@manjaro.org -Signed-off-by: Heiko Stuebner -(cherry picked from commit c7c4d698cd2882c4d095aeed43bbad6fc990e998) ---- - .../boot/dts/rockchip/rk3399-pinebook-pro.dts | 25 ++++++++++++++++++++++ - 1 file changed, 25 insertions(+) - -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts -index cb0245d2226d..8f5b2df01560 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts -@@ -28,6 +28,13 @@ - pwms = <&pwm0 0 740740 0>; - }; - -+ bat: battery { -+ compatible = "simple-battery"; -+ charge-full-design-microamp-hours = <9800000>; -+ voltage-max-design-microvolt = <4350000>; -+ voltage-min-design-microvolt = <3000000>; -+ }; -+ - edp_panel: edp-panel { - compatible = "boe,nv140fhmn49"; - backlight = <&backlight>; -@@ -741,6 +748,24 @@ - }; - }; - }; -+ -+ cw2015@62 { -+ compatible = "cellwise,cw2015"; -+ reg = <0x62>; -+ cellwise,battery-profile = /bits/ 8 < -+ 0x17 0x67 0x80 0x73 0x6E 0x6C 0x6B 0x63 -+ 0x77 0x51 0x5C 0x58 0x50 0x4C 0x48 0x36 -+ 0x15 0x0C 0x0C 0x19 0x5B 0x7D 0x6F 0x69 -+ 0x69 0x5B 0x0C 0x29 0x20 0x40 0x52 0x59 -+ 0x57 0x56 0x54 0x4F 0x3B 0x1F 0x7F 0x17 -+ 0x06 0x1A 0x30 0x5A 0x85 0x93 0x96 0x2D -+ 0x48 0x77 0x9C 0xB3 0x80 0x52 0x94 0xCB -+ 0x2F 0x00 0x64 0xA5 0xB5 0x11 0xF0 0x11 -+ >; -+ cellwise,monitor-interval-ms = <5000>; -+ monitored-battery = <&bat>; -+ power-supplies = <&mains_charger>, <&fusb0>; -+ }; - }; - - &i2s1 { - -From b7bb225f855f25cdd503b84296774fc1a96f1b7f Mon Sep 17 00:00:00 2001 -From: Peter Geis -Date: Sun, 14 Jun 2020 14:29:51 +0000 -Subject: [PATCH] arm64: dts: rockchip: set rockpro64 usbc dr_mode as host - -The usb-c port on the rockpro64 does not detect devices reliably when in otg mode. -Setting the mode to "host" allows the port to work reliably. -This aligns with the pinebook-pro configuration. - -Signed-off-by: Peter Geis -Link: https://lore.kernel.org/r/20200614142950.1120694-1-pgwipeout@gmail.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit 75152d66315521a48c4997305f4e01c5f139e160) ---- - arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi -index 6788ab28f89a..3456ee97c288 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi -@@ -795,7 +795,7 @@ - - &usbdrd_dwc3_0 { - status = "okay"; -- dr_mode = "otg"; -+ dr_mode = "host"; - }; - - &usbdrd3_1 { - -From 8e445f12f1fcc91f96b79c88cae0d20399436b95 Mon Sep 17 00:00:00 2001 -From: Heiko Stuebner -Date: Sun, 7 Jun 2020 23:29:09 +0200 -Subject: [PATCH] arm64: dts: rockchip: fix rk3368-lion gmac reset gpio - -The lion gmac node currently uses opposite active-values for the -gmac phy reset pin. The gpio-declaration uses active-high while the -separate snps,reset-active-low property marks the pin as active low. - -While on the kernel side this works ok, other DT users may get -confused - as seen with uboot right now. - -So bring this in line and make both properties match, similar to the -other Rockchip board. - -Fixes: d99a02bcfa81 ("arm64: dts: rockchip: add RK3368-uQ7 (Lion) SoM") -Signed-off-by: Heiko Stuebner -Link: https://lore.kernel.org/r/20200607212909.920575-1-heiko@sntech.de -(cherry picked from commit 2300e6dab473e93181cf76e4fe6671aa3d24c57b) ---- - arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi b/arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi -index e17311e09082..216aafd90e7f 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi -@@ -156,7 +156,7 @@ - pinctrl-0 = <&rgmii_pins>; - snps,reset-active-low; - snps,reset-delays-us = <0 10000 50000>; -- snps,reset-gpio = <&gpio3 RK_PB3 GPIO_ACTIVE_HIGH>; -+ snps,reset-gpio = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; - tx_delay = <0x10>; - rx_delay = <0x10>; - status = "okay"; - -From f083f0c9daebefdfd97690ced05b1dbc994cb619 Mon Sep 17 00:00:00 2001 -From: Heiko Stuebner -Date: Thu, 4 Jun 2020 11:12:39 +0200 -Subject: [PATCH] arm64: dts: rockchip: fix rk3399-puma vcc5v0-host gpio - -The puma vcc5v0_host regulator node currently uses opposite active-values -for the enable pin. The gpio-declaration uses active-high while the -separate enable-active-low property marks the pin as active low. - -While on the kernel side this works ok, other DT users may get -confused - as seen with uboot right now. - -So bring this in line and make both properties match, similar to the -gmac fix. - -Fixes: 2c66fc34e945 ("arm64: dts: rockchip: add RK3399-Q7 (Puma) SoM") -Signed-off-by: Heiko Stuebner -Link: https://lore.kernel.org/r/20200604091239.424318-1-heiko@sntech.de -(cherry picked from commit 7a7184f6cfa9279f1a1c10a1845d247d7fad54ff) ---- - arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi -index 07694b196fdb..063f59a420b6 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi -@@ -101,7 +101,7 @@ - - vcc5v0_host: vcc5v0-host-regulator { - compatible = "regulator-fixed"; -- gpio = <&gpio4 RK_PA3 GPIO_ACTIVE_HIGH>; -+ gpio = <&gpio4 RK_PA3 GPIO_ACTIVE_LOW>; - enable-active-low; - pinctrl-names = "default"; - pinctrl-0 = <&vcc5v0_host_en>; - -From 7361aa23039cce5a8e113ea0de374deab933c264 Mon Sep 17 00:00:00 2001 -From: Heiko Stuebner -Date: Wed, 3 Jun 2020 15:28:36 +0200 -Subject: [PATCH] arm64: dts: rockchip: fix rk3399-puma gmac reset gpio - -The puma gmac node currently uses opposite active-values for the -gmac phy reset pin. The gpio-declaration uses active-high while the -separate snps,reset-active-low property marks the pin as active low. - -While on the kernel side this works ok, other DT users may get -confused - as seen with uboot right now. - -So bring this in line and make both properties match, similar to the -other Rockchip board. - -Fixes: 2c66fc34e945 ("arm64: dts: rockchip: add RK3399-Q7 (Puma) SoM") -Signed-off-by: Heiko Stuebner -Link: https://lore.kernel.org/r/20200603132836.362519-1-heiko@sntech.de -(cherry picked from commit 8a445086f8af0b7b9bd8d1901d6f306bb154f70d) ---- - arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi -index 063f59a420b6..72c06abd27ea 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi -@@ -157,7 +157,7 @@ - phy-mode = "rgmii"; - pinctrl-names = "default"; - pinctrl-0 = <&rgmii_pins>; -- snps,reset-gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_HIGH>; -+ snps,reset-gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; - snps,reset-active-low; - snps,reset-delays-us = <0 10000 50000>; - tx_delay = <0x10>; - -From 6ac9e5a0c010eaae64e413c1e4712757acd80933 Mon Sep 17 00:00:00 2001 -From: Johan Jonker -Date: Sun, 24 May 2020 18:06:36 +0200 -Subject: [PATCH] arm64: dts: rockchip: rename label and nodename pinctrl - subnodes that end with gpio - -A test with the command below gives for example this error: - -arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dt.yaml: -tsadc: tsadc-otp-gpio: -{'phandle': [[90]], 'rockchip,pins': [[0, 6, 0, 123]]} -is not of type 'array' - -'gpio' is a sort of reserved nodename and should not be used -for pinctrl in combination with 'rockchip,pins', so change -nodes that end with 'gpio' to end with 'pin' or 'pins'. - -make ARCH=arm64 dtbs_check -DT_SCHEMA_FILES=~/.local/lib/python3.5/site-packages/ -dtschema/schemas/gpio/gpio.yaml - -Signed-off-by: Johan Jonker -Link: https://lore.kernel.org/r/20200524160636.16547-2-jbx6244@gmail.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit 2bc65fef4fe424f5f8295175f1b42f8b94c6df01) ---- - arch/arm64/boot/dts/rockchip/px30.dtsi | 6 +- - arch/arm64/boot/dts/rockchip/rk3308.dtsi | 6 +- - arch/arm64/boot/dts/rockchip/rk3328-evb.dts | 2 +- - arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 2 +- - arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 2 +- - arch/arm64/boot/dts/rockchip/rk3328.dtsi | 24 +++---- - .../arm64/boot/dts/rockchip/rk3368-lion-haikou.dts | 2 +- - arch/arm64/boot/dts/rockchip/rk3368.dtsi | 6 +- - arch/arm64/boot/dts/rockchip/rk3399-firefly.dts | 4 +- - .../boot/dts/rockchip/rk3399-gru-scarlet.dtsi | 2 +- - arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 4 +- - arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts | 8 +-- - arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts | 8 +-- - .../boot/dts/rockchip/rk3399-pinebook-pro.dts | 74 +++++++++++----------- - arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi | 8 +-- - arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts | 8 +-- - arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi | 4 +- - arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 8 +-- - arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi | 4 +- - arch/arm64/boot/dts/rockchip/rk3399.dtsi | 6 +- - 20 files changed, 94 insertions(+), 94 deletions(-) - -diff --git a/arch/arm64/boot/dts/rockchip/px30.dtsi b/arch/arm64/boot/dts/rockchip/px30.dtsi -index a6b8427156d5..e9bb2b97ae55 100644 ---- a/arch/arm64/boot/dts/rockchip/px30.dtsi -+++ b/arch/arm64/boot/dts/rockchip/px30.dtsi -@@ -733,9 +733,9 @@ - rockchip,grf = <&grf>; - rockchip,hw-tshut-temp = <120000>; - pinctrl-names = "init", "default", "sleep"; -- pinctrl-0 = <&tsadc_otp_gpio>; -+ pinctrl-0 = <&tsadc_otp_pin>; - pinctrl-1 = <&tsadc_otp_out>; -- pinctrl-2 = <&tsadc_otp_gpio>; -+ pinctrl-2 = <&tsadc_otp_pin>; - #thermal-sensor-cells = <1>; - status = "disabled"; - }; -@@ -1373,7 +1373,7 @@ - }; - - tsadc { -- tsadc_otp_gpio: tsadc-otp-gpio { -+ tsadc_otp_pin: tsadc-otp-pin { - rockchip,pins = - <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3308.dtsi b/arch/arm64/boot/dts/rockchip/rk3308.dtsi -index ac7f694079d0..ba1c71568164 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi -@@ -1629,7 +1629,7 @@ - }; - - tsadc { -- tsadc_otp_gpio: tsadc-otp-gpio { -+ tsadc_otp_pin: tsadc-otp-pin { - rockchip,pins = - <0 RK_PB2 0 &pcfg_pull_none>; - }; -@@ -1657,7 +1657,7 @@ - <2 RK_PA3 1 &pcfg_pull_none>; - }; - -- uart0_rts_gpio: uart0-rts-gpio { -+ uart0_rts_pin: uart0-rts-pin { - rockchip,pins = - <2 RK_PA3 0 &pcfg_pull_none>; - }; -@@ -1730,7 +1730,7 @@ - <4 RK_PA7 1 &pcfg_pull_none>; - }; - -- uart4_rts_gpio: uart4-rts-gpio { -+ uart4_rts_pin: uart4-rts-pin { - rockchip,pins = - <4 RK_PA7 0 &pcfg_pull_none>; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3328-evb.dts b/arch/arm64/boot/dts/rockchip/rk3328-evb.dts -index ac29c2744d08..1969dab84138 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3328-evb.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3328-evb.dts -@@ -41,7 +41,7 @@ - compatible = "regulator-fixed"; - gpio = <&gpio0 30 GPIO_ACTIVE_LOW>; - pinctrl-names = "default"; -- pinctrl-0 = <&sdmmc0m1_gpio>; -+ pinctrl-0 = <&sdmmc0m1_pin>; - regulator-name = "vcc_sd"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; -diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts -index 34db48c274e5..b70ffb1c6a63 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts -@@ -34,7 +34,7 @@ - compatible = "regulator-fixed"; - gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>; - pinctrl-names = "default"; -- pinctrl-0 = <&sdmmc0m1_gpio>; -+ pinctrl-0 = <&sdmmc0m1_pin>; - regulator-boot-on; - regulator-name = "vcc_sd"; - regulator-min-microvolt = <3300000>; -diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts -index 6e09c223ed57..86cfb5c50a94 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts -@@ -25,7 +25,7 @@ - compatible = "regulator-fixed"; - gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>; - pinctrl-names = "default"; -- pinctrl-0 = <&sdmmc0m1_gpio>; -+ pinctrl-0 = <&sdmmc0m1_pin>; - regulator-name = "vcc_sd"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; -diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -index d399883d4b75..72e655020560 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -@@ -552,9 +552,9 @@ - clocks = <&cru SCLK_TSADC>, <&cru PCLK_TSADC>; - clock-names = "tsadc", "apb_pclk"; - pinctrl-names = "init", "default", "sleep"; -- pinctrl-0 = <&otp_gpio>; -+ pinctrl-0 = <&otp_pin>; - pinctrl-1 = <&otp_out>; -- pinctrl-2 = <&otp_gpio>; -+ pinctrl-2 = <&otp_pin>; - resets = <&cru SRST_TSADC>; - reset-names = "tsadc-apb"; - rockchip,grf = <&grf>; -@@ -1154,7 +1154,7 @@ - rockchip,pins = <0 RK_PA5 2 &pcfg_pull_none>, - <0 RK_PA6 2 &pcfg_pull_none>; - }; -- i2c3_gpio: i2c3-gpio { -+ i2c3_pins: i2c3-pins { - rockchip,pins = - <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>, - <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; -@@ -1225,7 +1225,7 @@ - }; - - tsadc { -- otp_gpio: otp-gpio { -+ otp_pin: otp-pin { - rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; - }; - -@@ -1248,7 +1248,7 @@ - rockchip,pins = <1 RK_PB2 1 &pcfg_pull_none>; - }; - -- uart0_rts_gpio: uart0-rts-gpio { -+ uart0_rts_pin: uart0-rts-pin { - rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; - }; - }; -@@ -1267,7 +1267,7 @@ - rockchip,pins = <3 RK_PA5 4 &pcfg_pull_none>; - }; - -- uart1_rts_gpio: uart1-rts-gpio { -+ uart1_rts_pin: uart1-rts-pin { - rockchip,pins = <3 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; - }; - }; -@@ -1493,7 +1493,7 @@ - rockchip,pins = <2 RK_PA7 1 &pcfg_pull_up_4ma>; - }; - -- sdmmc0m0_gpio: sdmmc0m0-gpio { -+ sdmmc0m0_pin: sdmmc0m0-pin { - rockchip,pins = <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up_4ma>; - }; - }; -@@ -1503,7 +1503,7 @@ - rockchip,pins = <0 RK_PD6 3 &pcfg_pull_up_4ma>; - }; - -- sdmmc0m1_gpio: sdmmc0m1-gpio { -+ sdmmc0m1_pin: sdmmc0m1-pin { - rockchip,pins = <0 RK_PD6 RK_FUNC_GPIO &pcfg_pull_up_4ma>; - }; - }; -@@ -1536,7 +1536,7 @@ - <1 RK_PA3 1 &pcfg_pull_up_8ma>; - }; - -- sdmmc0_gpio: sdmmc0-gpio { -+ sdmmc0_pins: sdmmc0-pins { - rockchip,pins = - <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up_4ma>, - <1 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up_4ma>, -@@ -1578,7 +1578,7 @@ - <3 RK_PA7 3 &pcfg_pull_up_4ma>; - }; - -- sdmmc0ext_gpio: sdmmc0ext-gpio { -+ sdmmc0ext_pins: sdmmc0ext-pins { - rockchip,pins = - <3 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up_4ma>, - <3 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up_4ma>, -@@ -1623,7 +1623,7 @@ - <1 RK_PC1 1 &pcfg_pull_up_8ma>; - }; - -- sdmmc1_gpio: sdmmc1-gpio { -+ sdmmc1_pins: sdmmc1-pins { - rockchip,pins = - <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up_4ma>, - <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up_4ma>, -@@ -1817,7 +1817,7 @@ - tsadc_int: tsadc-int { - rockchip,pins = <2 RK_PB5 2 &pcfg_pull_none>; - }; -- tsadc_gpio: tsadc-gpio { -+ tsadc_pin: tsadc-pin { - rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; - }; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3368-lion-haikou.dts b/arch/arm64/boot/dts/rockchip/rk3368-lion-haikou.dts -index cbde279ae81d..dbd2caba322f 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3368-lion-haikou.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3368-lion-haikou.dts -@@ -125,7 +125,7 @@ - }; - - sdmmc { -- sdmmc_cd_gpio: sdmmc-cd-gpio { -+ sdmmc_cd_pin: sdmmc-cd-pin { - rockchip,pins = - <2 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3368.dtsi b/arch/arm64/boot/dts/rockchip/rk3368.dtsi -index 1ebb0eef42da..5d25a9d04051 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3368.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3368.dtsi -@@ -483,9 +483,9 @@ - resets = <&cru SRST_TSADC>; - reset-names = "tsadc-apb"; - pinctrl-names = "init", "default", "sleep"; -- pinctrl-0 = <&otp_gpio>; -+ pinctrl-0 = <&otp_pin>; - pinctrl-1 = <&otp_out>; -- pinctrl-2 = <&otp_gpio>; -+ pinctrl-2 = <&otp_pin>; - #thermal-sensor-cells = <1>; - rockchip,hw-tshut-temp = <95000>; - status = "disabled"; -@@ -1145,7 +1145,7 @@ - }; - - tsadc { -- otp_gpio: otp-gpio { -+ otp_pin: otp-pin { - rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; - }; - -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts -index 20b5599f5e78..6db18808b9c5 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts -@@ -589,11 +589,11 @@ - }; - - pmic { -- vsel1_gpio: vsel1-gpio { -+ vsel1_pin: vsel1-pin { - rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>; - }; - -- vsel2_gpio: vsel2-gpio { -+ vsel2_pin: vsel2-pin { - rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; - }; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi -index 4373ed732af7..60cd1c18cd4e 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi -@@ -499,7 +499,7 @@ camera: &i2c7 { - }; - - /* there is no external pull up, so need to set this pin pull up */ --&sdmmc_cd_gpio { -+&sdmmc_cd_pin { - rockchip,pins = <1 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>; - }; - -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi -index 2f3997740068..32dcaf210085 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi -@@ -516,7 +516,7 @@ ap_i2c_audio: &i2c8 { - * configured as SDMMC and not JTAG. - */ - pinctrl-names = "default"; -- pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_cd_gpio -+ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_cd_pin - &sdmmc_bus4>; - - bus-width = <4>; -@@ -767,7 +767,7 @@ ap_i2c_audio: &i2c8 { - }; - - /* This is where we actually hook up CD; has external pull */ -- sdmmc_cd_gpio: sdmmc-cd-gpio { -+ sdmmc_cd_pin: sdmmc-cd-pin { - rockchip,pins = <4 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>; - }; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts b/arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts -index bf87fa32d3b1..341d074ed996 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts -@@ -205,7 +205,7 @@ - compatible = "silergy,syr827"; - reg = <0x40>; - regulator-compatible = "fan53555-reg"; -- pinctrl-0 = <&vsel1_gpio>; -+ pinctrl-0 = <&vsel1_pin>; - regulator-name = "vdd_cpu_b"; - regulator-min-microvolt = <712500>; - regulator-max-microvolt = <1500000>; -@@ -223,7 +223,7 @@ - compatible = "silergy,syr828"; - reg = <0x41>; - regulator-compatible = "fan53555-reg"; -- pinctrl-0 = <&vsel2_gpio>; -+ pinctrl-0 = <&vsel2_pin>; - regulator-name = "vdd_gpu"; - regulator-min-microvolt = <712500>; - regulator-max-microvolt = <1500000>; -@@ -521,12 +521,12 @@ - <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>; - }; - -- vsel1_gpio: vsel1-gpio { -+ vsel1_pin: vsel1-pin { - rockchip,pins = - <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; - }; - -- vsel2_gpio: vsel2-gpio { -+ vsel2_pin: vsel2-pin { - rockchip,pins = - <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts b/arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts -index 73be38a53796..1fa80ac15464 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts -@@ -341,7 +341,7 @@ - reg = <0x40>; - fcs,suspend-voltage-selector = <1>; - pinctrl-names = "default"; -- pinctrl-0 = <&vsel1_gpio>; -+ pinctrl-0 = <&vsel1_pin>; - regulator-name = "vdd_cpu_b"; - regulator-min-microvolt = <712500>; - regulator-max-microvolt = <1500000>; -@@ -360,7 +360,7 @@ - reg = <0x41>; - fcs,suspend-voltage-selector = <1>; - pinctrl-names = "default"; -- pinctrl-0 = <&vsel2_gpio>; -+ pinctrl-0 = <&vsel2_pin>; - regulator-name = "vdd_gpu"; - regulator-min-microvolt = <712500>; - regulator-max-microvolt = <1500000>; -@@ -447,11 +447,11 @@ - rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>; - }; - -- vsel1_gpio: vsel1-gpio { -+ vsel1_pin: vsel1-pin { - rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; - }; - -- vsel2_gpio: vsel2-gpio { -+ vsel2_pin: vsel2-pin { - rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; - }; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts -index 8f5b2df01560..06d48338c836 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts -@@ -40,7 +40,7 @@ - backlight = <&backlight>; - enable-gpios = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>; - pinctrl-names = "default"; -- pinctrl-0 = <&panel_en_gpio>; -+ pinctrl-0 = <&panel_en_pin>; - power-supply = <&vcc3v3_panel>; - - ports { -@@ -67,7 +67,7 @@ - gpio-key-lid { - compatible = "gpio-keys"; - pinctrl-names = "default"; -- pinctrl-0 = <&lidbtn_gpio>; -+ pinctrl-0 = <&lidbtn_pin>; - - lid { - debounce-interval = <20>; -@@ -83,7 +83,7 @@ - gpio-key-power { - compatible = "gpio-keys"; - pinctrl-names = "default"; -- pinctrl-0 = <&pwrbtn_gpio>; -+ pinctrl-0 = <&pwrbtn_pin>; - - power { - debounce-interval = <20>; -@@ -124,7 +124,7 @@ - clocks = <&rk808 1>; - clock-names = "ext_clock"; - pinctrl-names = "default"; -- pinctrl-0 = <&wifi_enable_h_gpio>; -+ pinctrl-0 = <&wifi_enable_h_pin>; - post-power-on-delay-ms = <100>; - power-off-delay-us = <500000>; - -@@ -136,7 +136,7 @@ - es8316-sound { - compatible = "simple-audio-card"; - pinctrl-names = "default"; -- pinctrl-0 = <&hp_det_gpio>; -+ pinctrl-0 = <&hp_det_pin>; - simple-audio-card,name = "rockchip,es8316-codec"; - simple-audio-card,format = "i2s"; - simple-audio-card,mclk-fs = <256>; -@@ -220,7 +220,7 @@ - enable-active-high; - gpio = <&gpio1 RK_PB5 GPIO_ACTIVE_HIGH>; - pinctrl-names = "default"; -- pinctrl-0 = <&pwr_5v_gpio>; -+ pinctrl-0 = <&pwr_5v_pin>; - regulator-name = "vcc5v0_usb"; - regulator-always-on; - regulator-min-microvolt = <5000000>; -@@ -277,7 +277,7 @@ - enable-active-high; - gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>; - pinctrl-names = "default"; -- pinctrl-0 = <&sdmmc0_pwr_h_gpio>; -+ pinctrl-0 = <&sdmmc0_pwr_h_pin>; - regulator-name = "vcc3v0_sd"; - regulator-always-on; - regulator-min-microvolt = <3000000>; -@@ -295,7 +295,7 @@ - enable-active-high; - gpio = <&gpio1 RK_PC6 GPIO_ACTIVE_HIGH>; - pinctrl-names = "default"; -- pinctrl-0 = <&lcdvcc_en_gpio>; -+ pinctrl-0 = <&lcdvcc_en_pin>; - regulator-name = "vcc3v3_panel"; - regulator-always-on; - regulator-min-microvolt = <3300000>; -@@ -324,7 +324,7 @@ - enable-active-high; - gpio = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>; - pinctrl-names = "default"; -- pinctrl-0 = <&vcc5v0_host_en_gpio>; -+ pinctrl-0 = <&vcc5v0_host_en_pin>; - regulator-name = "vcc5v0_otg"; - regulator-always-on; - regulator-min-microvolt = <5000000>; -@@ -343,7 +343,7 @@ - enable-active-high; - gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>; - pinctrl-names = "default"; -- pinctrl-0 = <&vcc5v0_typec0_en_gpio>; -+ pinctrl-0 = <&vcc5v0_typec0_en_pin>; - regulator-name = "vbus_5vout"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; -@@ -375,7 +375,7 @@ - - /* Also triggered by USB charger */ - pinctrl-names = "default"; -- pinctrl-0 = <&dc_det_gpio>; -+ pinctrl-0 = <&dc_det_pin>; - }; - }; - -@@ -454,7 +454,7 @@ - interrupt-parent = <&gpio3>; - interrupts = <10 IRQ_TYPE_LEVEL_LOW>; - pinctrl-names = "default"; -- pinctrl-0 = <&pmic_int_l_gpio>; -+ pinctrl-0 = <&pmic_int_l_pin>; - rockchip,system-power-controller; - wakeup-source; - -@@ -634,7 +634,7 @@ - reg = <0x40>; - fcs,suspend-voltage-selector = <1>; - pinctrl-names = "default"; -- pinctrl-0 = <&vsel1_gpio>; -+ pinctrl-0 = <&vsel1_pin>; - regulator-name = "vdd_cpu_b"; - regulator-always-on; - regulator-boot-on; -@@ -653,7 +653,7 @@ - reg = <0x41>; - fcs,suspend-voltage-selector = <1>; - pinctrl-names = "default"; -- pinctrl-0 = <&vsel2_gpio>; -+ pinctrl-0 = <&vsel2_pin>; - regulator-name = "vdd_gpu"; - regulator-always-on; - regulator-boot-on; -@@ -700,7 +700,7 @@ - interrupt-parent = <&gpio1>; - interrupts = ; - pinctrl-names = "default"; -- pinctrl-0 = <&fusb0_int_gpio>; -+ pinctrl-0 = <&fusb0_int_pin>; - vbus-supply = <&vbus_typec>; - - connector { -@@ -770,7 +770,7 @@ - - &i2s1 { - pinctrl-names = "default"; -- pinctrl-0 = <&i2s_8ch_mclk_gpio>, <&i2s1_2ch_bus>; -+ pinctrl-0 = <&i2s_8ch_mclk_pin>, <&i2s1_2ch_bus>; - rockchip,capture-channels = <8>; - rockchip,playback-channels = <8>; - status = "okay"; -@@ -802,49 +802,49 @@ - - &pinctrl { - buttons { -- pwrbtn_gpio: pwrbtn-gpio { -+ pwrbtn_pin: pwrbtn-pin { - rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; - }; - -- lidbtn_gpio: lidbtn-gpio { -+ lidbtn_pin: lidbtn-pin { - rockchip,pins = <1 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; - }; - }; - - dc-charger { -- dc_det_gpio: dc-det-gpio { -+ dc_det_pin: dc-det-pin { - rockchip,pins = <4 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; - }; - }; - - es8316 { -- hp_det_gpio: hp-det-gpio { -+ hp_det_pin: hp-det-pin { - rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>; - }; - }; - - fusb302x { -- fusb0_int_gpio: fusb0-int-gpio { -+ fusb0_int_pin: fusb0-int-pin { - rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; - }; - }; - - i2s1 { -- i2s_8ch_mclk_gpio: i2s-8ch-mclk-gpio { -+ i2s_8ch_mclk_pin: i2s-8ch-mclk-pin { - rockchip,pins = <4 RK_PA0 1 &pcfg_pull_none>; - }; - }; - - lcd-panel { -- lcdvcc_en_gpio: lcdvcc-en-gpio { -+ lcdvcc_en_pin: lcdvcc-en-pin { - rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; - }; - -- panel_en_gpio: panel-en-gpio { -+ panel_en_pin: panel-en-pin { - rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; - }; - -- lcd_panel_reset_gpio: lcd-panel-reset-gpio { -+ lcd_panel_reset_pin: lcd-panel-reset-pin { - rockchip,pins = <4 RK_PD6 RK_FUNC_GPIO &pcfg_pull_up>; - }; - }; -@@ -860,58 +860,58 @@ - }; - - pmic { -- pmic_int_l_gpio: pmic-int-l-gpio { -+ pmic_int_l_pin: pmic-int-l-pin { - rockchip,pins = <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; - }; - -- vsel1_gpio: vsel1-gpio { -+ vsel1_pin: vsel1-pin { - rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; - }; - -- vsel2_gpio: vsel2-gpio { -+ vsel2_pin: vsel2-pin { - rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; - }; - }; - - sdcard { -- sdmmc0_pwr_h_gpio: sdmmc0-pwr-h-gpio { -+ sdmmc0_pwr_h_pin: sdmmc0-pwr-h-pin { - rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>; - }; - - }; - - sdio-pwrseq { -- wifi_enable_h_gpio: wifi-enable-h-gpio { -+ wifi_enable_h_pin: wifi-enable-h-pin { - rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; - }; - }; - - usb-typec { -- vcc5v0_typec0_en_gpio: vcc5v0-typec0-en-gpio { -+ vcc5v0_typec0_en_pin: vcc5v0-typec0-en-pin { - rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; - }; - }; - - usb2 { -- pwr_5v_gpio: pwr-5v-gpio { -+ pwr_5v_pin: pwr-5v-pin { - rockchip,pins = <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; - }; - -- vcc5v0_host_en_gpio: vcc5v0-host-en-gpio { -+ vcc5v0_host_en_pin: vcc5v0-host-en-pin { - rockchip,pins = <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; - }; - }; - - wireless-bluetooth { -- bt_wake_gpio: bt-wake-gpio { -+ bt_wake_pin: bt-wake-pin { - rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; - }; - -- bt_host_wake_gpio: bt-host-wake-gpio { -+ bt_host_wake_pin: bt-host-wake-pin { - rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>; - }; - -- bt_reset_gpio: bt-reset-gpio { -+ bt_reset_pin: bt-reset-pin { - rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; - }; - }; -@@ -1059,7 +1059,7 @@ - host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; - max-speed = <1500000>; - pinctrl-names = "default"; -- pinctrl-0 = <&bt_host_wake_gpio &bt_wake_gpio &bt_reset_gpio>; -+ pinctrl-0 = <&bt_host_wake_pin &bt_wake_pin &bt_reset_pin>; - shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; - vbat-supply = <&wifi_bat>; - vddio-supply = <&vcc_wl>; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi -index 9f225e9c3d54..59b89d6ccdef 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi -@@ -456,7 +456,7 @@ - reg = <0x40>; - fcs,suspend-voltage-selector = <1>; - pinctrl-names = "default"; -- pinctrl-0 = <&vsel1_gpio>; -+ pinctrl-0 = <&vsel1_pin>; - regulator-name = "vdd_cpu_b"; - regulator-min-microvolt = <712500>; - regulator-max-microvolt = <1500000>; -@@ -475,7 +475,7 @@ - reg = <0x41>; - fcs,suspend-voltage-selector = <1>; - pinctrl-names = "default"; -- pinctrl-0 = <&vsel2_gpio>; -+ pinctrl-0 = <&vsel2_pin>; - regulator-name = "vdd_gpu"; - regulator-min-microvolt = <712500>; - regulator-max-microvolt = <1500000>; -@@ -609,11 +609,11 @@ - }; - - pmic { -- vsel1_gpio: vsel1-gpio { -+ vsel1_pin: vsel1-pin { - rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>; - }; - -- vsel2_gpio: vsel2-gpio { -+ vsel2_pin: vsel2-pin { - rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; - }; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts -index 3923ec01ef66..60f98a3e19d8 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts -@@ -390,7 +390,7 @@ - reg = <0x40>; - fcs,suspend-voltage-selector = <1>; - pinctrl-names = "default"; -- pinctrl-0 = <&vsel1_gpio>; -+ pinctrl-0 = <&vsel1_pin>; - regulator-name = "vdd_cpu_b"; - regulator-min-microvolt = <712500>; - regulator-max-microvolt = <1500000>; -@@ -409,7 +409,7 @@ - reg = <0x41>; - fcs,suspend-voltage-selector = <1>; - pinctrl-names = "default"; -- pinctrl-0 = <&vsel2_gpio>; -+ pinctrl-0 = <&vsel2_pin>; - regulator-name = "vdd_gpu"; - regulator-min-microvolt = <712500>; - regulator-max-microvolt = <1500000>; -@@ -532,11 +532,11 @@ - rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>; - }; - -- vsel1_gpio: vsel1-gpio { -+ vsel1_pin: vsel1-pin { - rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; - }; - -- vsel2_gpio: vsel2-gpio { -+ vsel2_pin: vsel2-pin { - rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; - }; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi -index ba7c75c9f2a1..5e3ac589bc54 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi -@@ -470,12 +470,12 @@ - <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>; - }; - -- vsel1_gpio: vsel1-gpio { -+ vsel1_pin: vsel1-pin { - rockchip,pins = - <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; - }; - -- vsel2_gpio: vsel2-gpio { -+ vsel2_pin: vsel2-pin { - rockchip,pins = - <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi -index 3456ee97c288..c84cad16118a 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi -@@ -445,7 +445,7 @@ - reg = <0x40>; - fcs,suspend-voltage-selector = <1>; - pinctrl-names = "default"; -- pinctrl-0 = <&vsel1_gpio>; -+ pinctrl-0 = <&vsel1_pin>; - regulator-name = "vdd_cpu_b"; - regulator-min-microvolt = <712500>; - regulator-max-microvolt = <1500000>; -@@ -464,7 +464,7 @@ - reg = <0x41>; - fcs,suspend-voltage-selector = <1>; - pinctrl-names = "default"; -- pinctrl-0 = <&vsel2_gpio>; -+ pinctrl-0 = <&vsel2_pin>; - regulator-name = "vdd_gpu"; - regulator-min-microvolt = <712500>; - regulator-max-microvolt = <1500000>; -@@ -612,11 +612,11 @@ - rockchip,pins = <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; - }; - -- vsel1_gpio: vsel1-gpio { -+ vsel1_pin: vsel1-pin { - rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; - }; - -- vsel2_gpio: vsel2-gpio { -+ vsel2_pin: vsel2-pin { - rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; - }; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi -index 1bc1579674e5..701a567d7638 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi -@@ -481,11 +481,11 @@ - <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>; - }; - -- vsel1_gpio: vsel1-gpio { -+ vsel1_pin: vsel1-pin { - rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; - }; - -- vsel2_gpio: vsel2-gpio { -+ vsel2_pin: vsel2-pin { - rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; - }; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -index 2581e9cc7a1d..781b5c2cdb4d 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -@@ -845,9 +845,9 @@ - rockchip,grf = <&grf>; - rockchip,hw-tshut-temp = <95000>; - pinctrl-names = "init", "default", "sleep"; -- pinctrl-0 = <&otp_gpio>; -+ pinctrl-0 = <&otp_pin>; - pinctrl-1 = <&otp_out>; -- pinctrl-2 = <&otp_gpio>; -+ pinctrl-2 = <&otp_pin>; - #thermal-sensor-cells = <1>; - status = "disabled"; - }; -@@ -2485,7 +2485,7 @@ - }; - - tsadc { -- otp_gpio: otp-gpio { -+ otp_pin: otp-pin { - rockchip,pins = <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; - }; - - -From 909929e1a7134ccbb43967882d8fcdaefc12a48e Mon Sep 17 00:00:00 2001 -From: Johan Jonker -Date: Fri, 22 May 2020 17:46:57 +0200 -Subject: [PATCH] arm64: dts: rockchip: rename and label gpio-led subnodes part - 2 - -Current dts files with 'gpio-led' nodes were manually verified. -In order to automate this process leds-gpio.txt -has been converted to yaml. With this conversion a check -for pattern properties was added. In part 2 rename and label -gpio-led subnodes that passed the regex, but still don't have -the preferred form. Any pin subnode that ends with '-gpio' -in the pinctrl node generates a warning. - -Fix with help of the following rules: - -1: Add nodename in the preferred form. - -2: Always add a label that ends with '_led' to prevent conflicts - with other labels such as 'power' and 'mmc' - -3: If leds need pinctrl add a label that ends with '_led_pin' - also to prevent conflicts with other labels. - -patternProperties: - # The first form is preferred, but fall back to just 'led' - # anywhere in the node name to at least catch some child nodes. - "(^led-[0-9a-f]$|led)": - -make ARCH=arm64 dtbs_check -DT_SCHEMA_FILES=Documentation/devicetree/bindings/leds/ -leds-gpio.yaml - -make ARCH=arm64 dtbs_check -DT_SCHEMA_FILES=~/.local/lib/python3.5/site-packages/dtschema/ -schemas/gpio/gpio.yaml - -Signed-off-by: Johan Jonker -Link: https://lore.kernel.org/r/20200522154657.9472-1-jbx6244@gmail.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit 6dd5e12c0b9bba40b3947ac1a9fd2f992585b5c6) ---- - arch/arm64/boot/dts/rockchip/rk3368-lion-haikou.dts | 6 +++--- - arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi | 8 ++++---- - arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi | 10 +++++----- - arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi | 6 +++--- - arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts | 6 +++--- - arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi | 6 +++--- - arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi | 14 +++++++------- - arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 10 +++++----- - 8 files changed, 33 insertions(+), 33 deletions(-) - -diff --git a/arch/arm64/boot/dts/rockchip/rk3368-lion-haikou.dts b/arch/arm64/boot/dts/rockchip/rk3368-lion-haikou.dts -index dbd2caba322f..7fcb1eacea8a 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3368-lion-haikou.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3368-lion-haikou.dts -@@ -25,9 +25,9 @@ - }; - - leds { -- pinctrl-0 = <&led_pins_module>, <&led_sd_haikou>; -+ pinctrl-0 = <&module_led_pins>, <&sd_card_led_pin>; - -- sd-card-led { -+ sd_card_led: led-3 { - label = "sd_card_led"; - gpios = <&gpio0 RK_PD2 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "mmc0"; -@@ -118,7 +118,7 @@ - }; - - leds { -- led_sd_haikou: led-sd-gpio { -+ sd_card_led_pin: sd-card-led-pin { - rockchip,pins = - <0 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi b/arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi -index 216aafd90e7f..24d28be4736c 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi -@@ -76,16 +76,16 @@ - leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; -- pinctrl-0 = <&led_pins_module>; -+ pinctrl-0 = <&module_led_pins>; - -- module_led1 { -+ module_led1: led-1 { - label = "module_led1"; - gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "heartbeat"; - panic-indicator; - }; - -- module_led2 { -+ module_led2: led-2 { - label = "module_led2"; - gpios = <&gpio3 RK_PA3 GPIO_ACTIVE_HIGH>; - default-state = "off"; -@@ -270,7 +270,7 @@ - - &pinctrl { - leds { -- led_pins_module: led-module-gpio { -+ module_led_pins: module-led-pins { - rockchip,pins = - <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>, - <3 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi -index e87a04477440..e36837c04dc7 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi -@@ -141,15 +141,15 @@ - leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; -- pinctrl-0 = <&sys_led_gpio>, <&user_led_gpio>; -+ pinctrl-0 = <&sys_led_pin>, <&user_led_pin>; - -- sys-led { -+ sys_led: led-0 { - label = "sys_led"; - linux,default-trigger = "heartbeat"; - gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; - }; - -- user-led { -+ user_led: led-1 { - label = "user_led"; - default-state = "off"; - gpios = <&gpio4 RK_PD0 GPIO_ACTIVE_HIGH>; -@@ -586,11 +586,11 @@ - }; - - leds { -- sys_led_gpio: sys_led-gpio { -+ sys_led_pin: sys-led-pin { - rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; - }; - -- user_led_gpio: user_led-gpio { -+ user_led_pin: user-led-pin { - rockchip,pins = <4 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>; - }; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi -index 1d246c2caa3c..76a8b40a93c6 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi -@@ -117,9 +117,9 @@ - leds: gpio-leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; -- pinctrl-0 = <&leds_gpio>; -+ pinctrl-0 = <&status_led_pin>; - -- status { -+ status_led: led-0 { - gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>; - label = "status_led"; - linux,default-trigger = "heartbeat"; -@@ -520,7 +520,7 @@ - }; - - gpio-leds { -- leds_gpio: leds-gpio { -+ status_led_pin: status-led-pin { - rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; - }; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts b/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts -index d80d6b726820..a8d363568fd6 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts -@@ -15,9 +15,9 @@ - }; - - leds { -- pinctrl-0 = <&led_pin_module>, <&led_sd_haikou>; -+ pinctrl-0 = <&module_led_pin>, <&sd_card_led_pin>; - -- sd-card-led { -+ sd_card_led: led-1 { - label = "sd_card_led"; - gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "mmc0"; -@@ -179,7 +179,7 @@ - }; - - leds { -- led_sd_haikou: led-sd-gpio { -+ sd_card_led_pin: sd-card-led-pin { - rockchip,pins = - <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi -index 72c06abd27ea..4660416c8f38 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi -@@ -11,9 +11,9 @@ - leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; -- pinctrl-0 = <&led_pin_module>; -+ pinctrl-0 = <&module_led_pin>; - -- module-led { -+ module_led: led-0 { - label = "module_led"; - gpios = <&gpio2 RK_PD1 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "heartbeat"; -@@ -450,7 +450,7 @@ - }; - - leds { -- led_pin_module: led-module-gpio { -+ module_led_pin: module-led-pin { - rockchip,pins = - <2 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi -index 59b89d6ccdef..b85ec31cd283 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi -@@ -61,23 +61,23 @@ - leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; -- pinctrl-0 = <&work_led_gpio>, <&diy_led_gpio>, <&yellow_led_gpio>; -+ pinctrl-0 = <&work_led_pin>, <&diy_led_pin>, <&yellow_led_pin>; - -- work-led { -+ work_led: led-0 { - label = "green:work"; - gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; - default-state = "on"; - linux,default-trigger = "heartbeat"; - }; - -- diy-led { -+ diy_led: led-1 { - label = "red:diy"; - gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>; - default-state = "off"; - linux,default-trigger = "mmc1"; - }; - -- yellow-led { -+ yellow_led: led-2 { - label = "yellow:yellow-led"; - gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; - default-state = "off"; -@@ -595,15 +595,15 @@ - }; - - leds { -- diy_led_gpio: diy_led-gpio { -+ diy_led_pin: diy-led-pin { - rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; - }; - -- work_led_gpio: work_led-gpio { -+ work_led_pin: work-led-pin { - rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; - }; - -- yellow_led_gpio: yellow_led-gpio { -+ yellow_led_pin: yellow-led-pin { - rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; - }; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi -index c84cad16118a..6e553ff47534 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi -@@ -39,15 +39,15 @@ - leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; -- pinctrl-0 = <&work_led_gpio>, <&diy_led_gpio>; -+ pinctrl-0 = <&work_led_pin>, <&diy_led_pin>; - -- work-led { -+ work_led: led-0 { - label = "work"; - default-state = "on"; - gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>; - }; - -- diy-led { -+ diy_led: led-1 { - label = "diy"; - default-state = "off"; - gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; -@@ -588,11 +588,11 @@ - }; - - leds { -- work_led_gpio: work_led-gpio { -+ work_led_pin: work-led-pin { - rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; - }; - -- diy_led_gpio: diy_led-gpio { -+ diy_led_pin: diy-led-pin { - rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; - }; - }; - -From 21cc12f4a0becd48996323c3cacf8f70433c3760 Mon Sep 17 00:00:00 2001 -From: Johan Jonker -Date: Sun, 24 May 2020 18:06:35 +0200 -Subject: [PATCH] ARM: dts: rockchip: rename label and nodename pinctrl - subnodes that end with gpio - -A test with the command below gives for example this error: - -arch/arm/boot/dts/rk3288-tinker.dt.yaml: tsadc: otp-gpio: -{'phandle': [[54]], 'rockchip,pins': [[0, 10, 0, 118]]} -is not of type 'array' - -'gpio' is a sort of reserved nodename and should not be used -for pinctrl in combination with 'rockchip,pins', so change -nodes that end with 'gpio' to end with 'pin' or 'pins'. - -make ARCH=arm dtbs_check -DT_SCHEMA_FILES=~/.local/lib/python3.5/site-packages/ -dtschema/schemas/gpio/gpio.yaml - -Signed-off-by: Johan Jonker -Link: https://lore.kernel.org/r/20200524160636.16547-1-jbx6244@gmail.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit fff987e7328951f7d6fb2d0545de8635ceafa89f) ---- - arch/arm/boot/dts/rk322x.dtsi | 6 +++--- - arch/arm/boot/dts/rk3288-veyron-jaq.dts | 2 +- - arch/arm/boot/dts/rk3288-veyron-jerry.dts | 2 +- - arch/arm/boot/dts/rk3288-veyron-mighty.dts | 6 +++--- - arch/arm/boot/dts/rk3288-veyron-minnie.dts | 2 +- - arch/arm/boot/dts/rk3288-veyron-pinky.dts | 6 +++--- - arch/arm/boot/dts/rk3288-veyron-sdmmc.dtsi | 2 +- - arch/arm/boot/dts/rk3288-veyron-speedy.dts | 2 +- - arch/arm/boot/dts/rk3288.dtsi | 6 +++--- - arch/arm/boot/dts/rv1108.dtsi | 12 ++++++------ - 10 files changed, 23 insertions(+), 23 deletions(-) - -diff --git a/arch/arm/boot/dts/rk322x.dtsi b/arch/arm/boot/dts/rk322x.dtsi -index b0fd92befdeb..3236abb0aba9 100644 ---- a/arch/arm/boot/dts/rk322x.dtsi -+++ b/arch/arm/boot/dts/rk322x.dtsi -@@ -520,9 +520,9 @@ - resets = <&cru SRST_TSADC>; - reset-names = "tsadc-apb"; - pinctrl-names = "init", "default", "sleep"; -- pinctrl-0 = <&otp_gpio>; -+ pinctrl-0 = <&otp_pin>; - pinctrl-1 = <&otp_out>; -- pinctrl-2 = <&otp_gpio>; -+ pinctrl-2 = <&otp_pin>; - #thermal-sensor-cells = <0>; - rockchip,hw-tshut-temp = <95000>; - status = "disabled"; -@@ -1111,7 +1111,7 @@ - }; - - tsadc { -- otp_gpio: otp-gpio { -+ otp_pin: otp-pin { - rockchip,pins = <0 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>; - }; - -diff --git a/arch/arm/boot/dts/rk3288-veyron-jaq.dts b/arch/arm/boot/dts/rk3288-veyron-jaq.dts -index 171ba6185b6d..8efba9deae3c 100644 ---- a/arch/arm/boot/dts/rk3288-veyron-jaq.dts -+++ b/arch/arm/boot/dts/rk3288-veyron-jaq.dts -@@ -47,7 +47,7 @@ - &sdmmc { - disable-wp; - pinctrl-names = "default"; -- pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd_disabled &sdmmc_cd_gpio -+ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd_disabled &sdmmc_cd_pin - &sdmmc_bus4>; - }; - -diff --git a/arch/arm/boot/dts/rk3288-veyron-jerry.dts b/arch/arm/boot/dts/rk3288-veyron-jerry.dts -index 66f00d28801a..2c916c50dda5 100644 ---- a/arch/arm/boot/dts/rk3288-veyron-jerry.dts -+++ b/arch/arm/boot/dts/rk3288-veyron-jerry.dts -@@ -192,7 +192,7 @@ - &sdmmc { - disable-wp; - pinctrl-names = "default"; -- pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd_disabled &sdmmc_cd_gpio -+ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd_disabled &sdmmc_cd_pin - &sdmmc_bus4>; - }; - -diff --git a/arch/arm/boot/dts/rk3288-veyron-mighty.dts b/arch/arm/boot/dts/rk3288-veyron-mighty.dts -index 27fbc07476d2..fa695a88f236 100644 ---- a/arch/arm/boot/dts/rk3288-veyron-mighty.dts -+++ b/arch/arm/boot/dts/rk3288-veyron-mighty.dts -@@ -18,8 +18,8 @@ - }; - - &sdmmc { -- pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd_disabled &sdmmc_cd_gpio -- &sdmmc_wp_gpio &sdmmc_bus4>; -+ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd_disabled &sdmmc_cd_pin -+ &sdmmc_wp_pin &sdmmc_bus4>; - wp-gpios = <&gpio7 10 GPIO_ACTIVE_HIGH>; - - /delete-property/ disable-wp; -@@ -27,7 +27,7 @@ - - &pinctrl { - sdmmc { -- sdmmc_wp_gpio: sdmmc-wp-gpio { -+ sdmmc_wp_pin: sdmmc-wp-pin { - rockchip,pins = <7 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; - }; - }; -diff --git a/arch/arm/boot/dts/rk3288-veyron-minnie.dts b/arch/arm/boot/dts/rk3288-veyron-minnie.dts -index 383fad1a88a1..f8b69e0a16a0 100644 ---- a/arch/arm/boot/dts/rk3288-veyron-minnie.dts -+++ b/arch/arm/boot/dts/rk3288-veyron-minnie.dts -@@ -114,7 +114,7 @@ - &sdmmc { - disable-wp; - pinctrl-names = "default"; -- pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd_disabled &sdmmc_cd_gpio -+ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd_disabled &sdmmc_cd_pin - &sdmmc_bus4>; - }; - -diff --git a/arch/arm/boot/dts/rk3288-veyron-pinky.dts b/arch/arm/boot/dts/rk3288-veyron-pinky.dts -index 71e6629cc208..4e9fdb0f722d 100644 ---- a/arch/arm/boot/dts/rk3288-veyron-pinky.dts -+++ b/arch/arm/boot/dts/rk3288-veyron-pinky.dts -@@ -105,7 +105,7 @@ - }; - - sdmmc { -- sdmmc_wp_gpio: sdmmc-wp-gpio { -+ sdmmc_wp_pin: sdmmc-wp-pin { - rockchip,pins = <7 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; - }; - }; -@@ -126,8 +126,8 @@ - - &sdmmc { - pinctrl-names = "default"; -- pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd_disabled &sdmmc_cd_gpio -- &sdmmc_wp_gpio &sdmmc_bus4>; -+ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd_disabled &sdmmc_cd_pin -+ &sdmmc_wp_pin &sdmmc_bus4>; - wp-gpios = <&gpio7 RK_PB2 GPIO_ACTIVE_HIGH>; - }; - -diff --git a/arch/arm/boot/dts/rk3288-veyron-sdmmc.dtsi b/arch/arm/boot/dts/rk3288-veyron-sdmmc.dtsi -index fe950f9863e8..27fb06ce907e 100644 ---- a/arch/arm/boot/dts/rk3288-veyron-sdmmc.dtsi -+++ b/arch/arm/boot/dts/rk3288-veyron-sdmmc.dtsi -@@ -41,7 +41,7 @@ - }; - - /* This is where we actually hook up CD */ -- sdmmc_cd_gpio: sdmmc-cd-gpio { -+ sdmmc_cd_pin: sdmmc-cd-pin { - rockchip,pins = <7 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; - }; - }; -diff --git a/arch/arm/boot/dts/rk3288-veyron-speedy.dts b/arch/arm/boot/dts/rk3288-veyron-speedy.dts -index e354c61a45e7..4a3ea934d03e 100644 ---- a/arch/arm/boot/dts/rk3288-veyron-speedy.dts -+++ b/arch/arm/boot/dts/rk3288-veyron-speedy.dts -@@ -54,7 +54,7 @@ - &sdmmc { - disable-wp; - pinctrl-names = "default"; -- pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd_disabled &sdmmc_cd_gpio -+ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd_disabled &sdmmc_cd_pin - &sdmmc_bus4>; - }; - -diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi -index 2e1edd85f04a..84d59469035e 100644 ---- a/arch/arm/boot/dts/rk3288.dtsi -+++ b/arch/arm/boot/dts/rk3288.dtsi -@@ -574,9 +574,9 @@ - resets = <&cru SRST_TSADC>; - reset-names = "tsadc-apb"; - pinctrl-names = "init", "default", "sleep"; -- pinctrl-0 = <&otp_gpio>; -+ pinctrl-0 = <&otp_pin>; - pinctrl-1 = <&otp_out>; -- pinctrl-2 = <&otp_gpio>; -+ pinctrl-2 = <&otp_pin>; - #thermal-sensor-cells = <1>; - rockchip,grf = <&grf>; - rockchip,hw-tshut-temp = <95000>; -@@ -1929,7 +1929,7 @@ - }; - - tsadc { -- otp_gpio: otp-gpio { -+ otp_pin: otp-pin { - rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; - }; - -diff --git a/arch/arm/boot/dts/rv1108.dtsi b/arch/arm/boot/dts/rv1108.dtsi -index f9cfe2c80791..a5d130bd0547 100644 ---- a/arch/arm/boot/dts/rv1108.dtsi -+++ b/arch/arm/boot/dts/rv1108.dtsi -@@ -351,9 +351,9 @@ - clocks = <&cru SCLK_TSADC>, <&cru PCLK_TSADC>; - clock-names = "tsadc", "apb_pclk"; - pinctrl-names = "init", "default", "sleep"; -- pinctrl-0 = <&otp_gpio>; -+ pinctrl-0 = <&otp_pin>; - pinctrl-1 = <&otp_out>; -- pinctrl-2 = <&otp_gpio>; -+ pinctrl-2 = <&otp_pin>; - resets = <&cru SRST_TSADC>; - reset-names = "tsadc-apb"; - rockchip,hw-tshut-temp = <120000>; -@@ -728,7 +728,7 @@ - <0 RK_PC6 3 &pcfg_pull_none>; - }; - -- i2c2m1_gpio: i2c2m1-gpio { -+ i2c2m1_pins: i2c2m1-pins { - rockchip,pins = <0 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>, - <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; - }; -@@ -740,7 +740,7 @@ - <1 RK_PD4 2 &pcfg_pull_none>; - }; - -- i2c2m05v_gpio: i2c2m05v-gpio { -+ i2c2m05v_pins: i2c2m05v-pins { - rockchip,pins = <1 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>, - <1 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>; - }; -@@ -867,7 +867,7 @@ - rockchip,pins = <0 RK_PB7 1 &pcfg_pull_none>; - }; - -- otp_gpio: otp-gpio { -+ otp_pin: otp-pin { - rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; - }; - }; -@@ -886,7 +886,7 @@ - rockchip,pins = <3 RK_PA3 1 &pcfg_pull_none>; - }; - -- uart0_rts_gpio: uart0-rts-gpio { -+ uart0_rts_pin: uart0-rts-pin { - rockchip,pins = <3 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; - }; - }; - -From 5501ee8504dd2cc8f55cf564572b4e7568fb58c2 Mon Sep 17 00:00:00 2001 -From: Abhishek Pandit-Subedi -Date: Fri, 12 Jun 2020 13:02:48 -0700 -Subject: [PATCH] ARM: dts: rockchip: Add marvell BT irq config - -Veyron Jaq and Mighty both use the Marvel 8897 WiFi+BT chip. Add wakeup -and pinctrl block to devicetree so the btmrvl driver can correctly -configure the wakeup interrupt. - -Signed-off-by: Abhishek Pandit-Subedi -Reviewed-by: Douglas Anderson -Link: https://lore.kernel.org/r/20200612130219.v2.1.I66864be898aa835ccb66b6cd5220d0b082338a81@changeid -Signed-off-by: Heiko Stuebner -(cherry picked from commit 6c2b99a2e7a073575b4ee91abf7d16470991c1f4) ---- - arch/arm/boot/dts/rk3288-veyron-jaq.dts | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/arch/arm/boot/dts/rk3288-veyron-jaq.dts b/arch/arm/boot/dts/rk3288-veyron-jaq.dts -index 8efba9deae3c..af77ab20586d 100644 ---- a/arch/arm/boot/dts/rk3288-veyron-jaq.dts -+++ b/arch/arm/boot/dts/rk3288-veyron-jaq.dts -@@ -44,6 +44,21 @@ - }; - }; - -+&sdio0 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ btmrvl: btmrvl@2 { -+ compatible = "marvell,sd8897-bt"; -+ reg = <2>; -+ interrupt-parent = <&gpio4>; -+ interrupts = ; -+ marvell,wakeup-pin = /bits/ 16 <13>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&bt_host_wake_l>; -+ }; -+}; -+ - &sdmmc { - disable-wp; - pinctrl-names = "default"; - -From b98b61fe61d412492bb63f1fb59e6bdca1fcb45d Mon Sep 17 00:00:00 2001 -From: Sugar Zhang -Date: Thu, 4 Jun 2020 09:36:38 +0800 -Subject: [PATCH] dmaengine: pl330: Make sure the debug is idle before doing - DMAGO - -According to the datasheet of pl330: - -Example 2-1 Using DMAGO with the debug instruction registers - -1. Create a program for the DMA channel -2. Store the program in a region of system memory -3. Poll the DBGSTATUS Register to ensure that the debug is idle -4. Write to the DBGINST0 Register -5. Write to the DBGINST1 Register -6. Write zero to the DBGCMD Register - -so, we should make sure the debug is idle before step 4/5/6, not -only step 6. if not, there maybe a risk that fail to write DBGINST0/1. - -Signed-off-by: Sugar Zhang -Link: https://lore.kernel.org/r/1591234598-78919-1-git-send-email-sugar.zhang@rock-chips.com -Signed-off-by: Vinod Koul -(cherry picked from commit d12ea5591eddf625b7707c018b72e46e8674c3c2) ---- - drivers/dma/pl330.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c -index 88b884cbb7c1..6a158eef6b8a 100644 ---- a/drivers/dma/pl330.c -+++ b/drivers/dma/pl330.c -@@ -885,6 +885,12 @@ static inline void _execute_DBGINSN(struct pl330_thread *thrd, - void __iomem *regs = thrd->dmac->base; - u32 val; - -+ /* If timed out due to halted state-machine */ -+ if (_until_dmac_idle(thrd)) { -+ dev_err(thrd->dmac->ddma.dev, "DMAC halted!\n"); -+ return; -+ } -+ - val = (insn[0] << 16) | (insn[1] << 24); - if (!as_manager) { - val |= (1 << 0); -@@ -895,12 +901,6 @@ static inline void _execute_DBGINSN(struct pl330_thread *thrd, - val = le32_to_cpu(*((__le32 *)&insn[2])); - writel(val, regs + DBGINST1); - -- /* If timed out due to halted state-machine */ -- if (_until_dmac_idle(thrd)) { -- dev_err(thrd->dmac->ddma.dev, "DMAC halted!\n"); -- return; -- } -- - /* Get going */ - writel(0, regs + DBGCMD); - } - -From 41e2127ef8f5e49a419d2f0c6bb04f529a7958bb Mon Sep 17 00:00:00 2001 -From: Shunqian Zheng -Date: Fri, 3 Apr 2020 13:15:37 -0300 -Subject: [PATCH] arm64: dts: rockchip: add rx0 mipi-phy for rk3399 - -Designware MIPI D-PHY, used for ISP0 in rk3399. - -Verified with: -make ARCH=arm64 dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy-rx0.yaml - -Signed-off-by: Shunqian Zheng -Signed-off-by: Jacob Chen -Signed-off-by: Helen Koike -Link: https://lore.kernel.org/r/20200403161538.1375908-9-helen.koike@collabora.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit e4bfde13e323f9ee5f2f38aa5cac0676dd656f8e) ---- - arch/arm64/boot/dts/rockchip/rk3399.dtsi | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -index 781b5c2cdb4d..f2ef0d8ba54b 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -@@ -1397,6 +1397,17 @@ - status = "disabled"; - }; - -+ mipi_dphy_rx0: mipi-dphy-rx0 { -+ compatible = "rockchip,rk3399-mipi-dphy-rx0"; -+ clocks = <&cru SCLK_MIPIDPHY_REF>, -+ <&cru SCLK_DPHY_RX0_CFG>, -+ <&cru PCLK_VIO_GRF>; -+ clock-names = "dphy-ref", "dphy-cfg", "grf"; -+ power-domains = <&power RK3399_PD_VIO>; -+ #phy-cells = <0>; -+ status = "disabled"; -+ }; -+ - u2phy0: usb2-phy@e450 { - compatible = "rockchip,rk3399-usb2phy"; - reg = <0xe450 0x10>; - -From 769c26773769a18c6657ffdbe3c27e3f18fb842f Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Tue, 7 Jul 2020 14:06:10 -0500 -Subject: [PATCH] ASoC: codecs: es8316: fix 'defined but not used' warning - -Fix W=1 warning - -sound/soc/codecs/es8316.c:842:36: warning: 'es8316_acpi_match' defined -but not used [-Wunused-const-variable=] - 842 | static const struct acpi_device_id es8316_acpi_match[] = { - | ^~~~~~~~~~~~~~~~~ - -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20200707190612.97799-12-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown -(cherry picked from commit 07ac670981fc5932ca3799ce7d96431d80afce0e) ---- - sound/soc/codecs/es8316.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c -index 36eef1fb3d18..70af35c5f727 100644 ---- a/sound/soc/codecs/es8316.c -+++ b/sound/soc/codecs/es8316.c -@@ -839,11 +839,13 @@ static const struct of_device_id es8316_of_match[] = { - }; - MODULE_DEVICE_TABLE(of, es8316_of_match); - -+#ifdef CONFIG_ACPI - static const struct acpi_device_id es8316_acpi_match[] = { - {"ESSX8316", 0}, - {}, - }; - MODULE_DEVICE_TABLE(acpi, es8316_acpi_match); -+#endif - - static struct i2c_driver es8316_i2c_driver = { - .driver = { - -From 168750c814b2aa91f3c31502c882cd946709c733 Mon Sep 17 00:00:00 2001 -From: Vinod Koul -Date: Wed, 8 Jul 2020 18:58:07 +0530 -Subject: [PATCH] phy: rockchip-typec: use correct format for structure - description - -We get warning with W=1 build: -drivers/phy/rockchip/phy-rockchip-typec.c:360: warning: cannot -understand function prototype: 'struct rockchip_usb3phy_port_cfg ' - -The 'struct rockchip_usb3phy_port_cfg ' is commented properly but uses -wrong format, so fix that up - -Link: https://lore.kernel.org/r/20200708132809.265967-4-vkoul@kernel.org -Signed-off-by: Vinod Koul -(cherry picked from commit 72fbf95f36218ec2a901e0eb7c3aa0bea6f1f396) ---- - drivers/phy/rockchip/phy-rockchip-typec.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c -index 24563160197f..70a31251b202 100644 ---- a/drivers/phy/rockchip/phy-rockchip-typec.c -+++ b/drivers/phy/rockchip/phy-rockchip-typec.c -@@ -347,7 +347,7 @@ struct usb3phy_reg { - }; - - /** -- * struct rockchip_usb3phy_port_cfg: usb3-phy port configuration. -+ * struct rockchip_usb3phy_port_cfg - usb3-phy port configuration. - * @reg: the base address for usb3-phy config. - * @typec_conn_dir: the register of type-c connector direction. - * @usb3tousb2_en: the register of type-c force usb2 to usb2 enable. - -From 2bf866df390e99598321d05a0254e4035b8d8f32 Mon Sep 17 00:00:00 2001 -From: Sugar Zhang -Date: Mon, 13 Jul 2020 18:26:00 +0800 -Subject: [PATCH] ASoC: rockchip: spdif: Handle clk by pm runtime - -This patch handle the clk by pm runtime mechanism to simplify -the clk management. - -Signed-off-by: Sugar Zhang -Link: https://lore.kernel.org/r/1594635960-67855-1-git-send-email-sugar.zhang@rock-chips.com -Signed-off-by: Mark Brown -(cherry picked from commit f50d67f9eff62f8078fe6e98ede3f4fb1defc361) ---- - sound/soc/rockchip/rockchip_spdif.c | 59 +++++++++++-------------------------- - 1 file changed, 17 insertions(+), 42 deletions(-) - -diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c -index 6635145a26c4..674810851fbc 100644 ---- a/sound/soc/rockchip/rockchip_spdif.c -+++ b/sound/soc/rockchip/rockchip_spdif.c -@@ -306,44 +306,22 @@ static int rk_spdif_probe(struct platform_device *pdev) - return -ENOMEM; - - spdif->hclk = devm_clk_get(&pdev->dev, "hclk"); -- if (IS_ERR(spdif->hclk)) { -- dev_err(&pdev->dev, "Can't retrieve rk_spdif bus clock\n"); -+ if (IS_ERR(spdif->hclk)) - return PTR_ERR(spdif->hclk); -- } -- ret = clk_prepare_enable(spdif->hclk); -- if (ret) { -- dev_err(spdif->dev, "hclock enable failed %d\n", ret); -- return ret; -- } - - spdif->mclk = devm_clk_get(&pdev->dev, "mclk"); -- if (IS_ERR(spdif->mclk)) { -- dev_err(&pdev->dev, "Can't retrieve rk_spdif master clock\n"); -- ret = PTR_ERR(spdif->mclk); -- goto err_disable_hclk; -- } -- -- ret = clk_prepare_enable(spdif->mclk); -- if (ret) { -- dev_err(spdif->dev, "clock enable failed %d\n", ret); -- goto err_disable_clocks; -- } -+ if (IS_ERR(spdif->mclk)) -+ return PTR_ERR(spdif->mclk); - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - regs = devm_ioremap_resource(&pdev->dev, res); -- if (IS_ERR(regs)) { -- ret = PTR_ERR(regs); -- goto err_disable_clocks; -- } -+ if (IS_ERR(regs)) -+ return PTR_ERR(regs); - - spdif->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "hclk", regs, - &rk_spdif_regmap_config); -- if (IS_ERR(spdif->regmap)) { -- dev_err(&pdev->dev, -- "Failed to initialise managed register map\n"); -- ret = PTR_ERR(spdif->regmap); -- goto err_disable_clocks; -- } -+ if (IS_ERR(spdif->regmap)) -+ return PTR_ERR(spdif->regmap); - - spdif->playback_dma_data.addr = res->start + SPDIF_SMPDR; - spdif->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; -@@ -352,47 +330,44 @@ static int rk_spdif_probe(struct platform_device *pdev) - spdif->dev = &pdev->dev; - dev_set_drvdata(&pdev->dev, spdif); - -- pm_runtime_set_active(&pdev->dev); - pm_runtime_enable(&pdev->dev); -- pm_request_idle(&pdev->dev); -+ if (!pm_runtime_enabled(&pdev->dev)) { -+ ret = rk_spdif_runtime_resume(&pdev->dev); -+ if (ret) -+ goto err_pm_runtime; -+ } - - ret = devm_snd_soc_register_component(&pdev->dev, - &rk_spdif_component, - &rk_spdif_dai, 1); - if (ret) { - dev_err(&pdev->dev, "Could not register DAI\n"); -- goto err_pm_runtime; -+ goto err_pm_suspend; - } - - ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0); - if (ret) { - dev_err(&pdev->dev, "Could not register PCM\n"); -- goto err_pm_runtime; -+ goto err_pm_suspend; - } - - return 0; - -+err_pm_suspend: -+ if (!pm_runtime_status_suspended(&pdev->dev)) -+ rk_spdif_runtime_suspend(&pdev->dev); - err_pm_runtime: - pm_runtime_disable(&pdev->dev); --err_disable_clocks: -- clk_disable_unprepare(spdif->mclk); --err_disable_hclk: -- clk_disable_unprepare(spdif->hclk); - - return ret; - } - - static int rk_spdif_remove(struct platform_device *pdev) - { -- struct rk_spdif_dev *spdif = dev_get_drvdata(&pdev->dev); -- - pm_runtime_disable(&pdev->dev); - if (!pm_runtime_status_suspended(&pdev->dev)) - rk_spdif_runtime_suspend(&pdev->dev); - -- clk_disable_unprepare(spdif->mclk); -- clk_disable_unprepare(spdif->hclk); -- - return 0; - } - - -From fb8424e2b2c666f57f82363939bbe9ae7c12b88b Mon Sep 17 00:00:00 2001 -From: Katsuhiro Suzuki -Date: Tue, 14 Jul 2020 16:32:47 +0900 -Subject: [PATCH] ASoC: convert rk3328 codec binding to yaml - -This patch converts Rockchip rk3328 audio codec binding to DT schema. -And adds description about "mclk" clock and fixes some errors in -original example. - -Signed-off-by: Katsuhiro Suzuki -Reviewed-by: Rob Herring -Link: https://lore.kernel.org/r/20200714073247.172859-1-katsuhiro@katsuster.net -Signed-off-by: Mark Brown -(cherry picked from commit 3f6597ad2f9ed8ed89dbd2a9ec0b0c892774f9d2) ---- - .../bindings/sound/rockchip,rk3328-codec.txt | 28 --------- - .../bindings/sound/rockchip,rk3328-codec.yaml | 69 ++++++++++++++++++++++ - 2 files changed, 69 insertions(+), 28 deletions(-) - delete mode 100644 Documentation/devicetree/bindings/sound/rockchip,rk3328-codec.txt - create mode 100644 Documentation/devicetree/bindings/sound/rockchip,rk3328-codec.yaml - -diff --git a/Documentation/devicetree/bindings/sound/rockchip,rk3328-codec.txt b/Documentation/devicetree/bindings/sound/rockchip,rk3328-codec.txt -deleted file mode 100644 -index 1ecd75d2032a..000000000000 ---- a/Documentation/devicetree/bindings/sound/rockchip,rk3328-codec.txt -+++ /dev/null -@@ -1,28 +0,0 @@ --* Rockchip Rk3328 internal codec -- --Required properties: -- --- compatible: "rockchip,rk3328-codec" --- reg: physical base address of the controller and length of memory mapped -- region. --- rockchip,grf: the phandle of the syscon node for GRF register. --- clocks: a list of phandle + clock-specifer pairs, one for each entry in clock-names. --- clock-names: should be "pclk". --- spk-depop-time-ms: speak depop time msec. -- --Optional properties: -- --- mute-gpios: GPIO specifier for external line driver control (typically the -- dedicated GPIO_MUTE pin) -- --Example for rk3328 internal codec: -- --codec: codec@ff410000 { -- compatible = "rockchip,rk3328-codec"; -- reg = <0x0 0xff410000 0x0 0x1000>; -- rockchip,grf = <&grf>; -- clocks = <&cru PCLK_ACODEC>; -- clock-names = "pclk"; -- mute-gpios = <&grf_gpio 0 GPIO_ACTIVE_LOW>; -- spk-depop-time-ms = 100; --}; -diff --git a/Documentation/devicetree/bindings/sound/rockchip,rk3328-codec.yaml b/Documentation/devicetree/bindings/sound/rockchip,rk3328-codec.yaml -new file mode 100644 -index 000000000000..5b85ad5e4834 ---- /dev/null -+++ b/Documentation/devicetree/bindings/sound/rockchip,rk3328-codec.yaml -@@ -0,0 +1,69 @@ -+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) -+%YAML 1.2 -+--- -+$id: http://devicetree.org/schemas/sound/rockchip,rk3328-codec.yaml# -+$schema: http://devicetree.org/meta-schemas/core.yaml# -+ -+title: Rockchip rk3328 internal codec -+ -+maintainers: -+ - Heiko Stuebner -+ -+properties: -+ compatible: -+ const: rockchip,rk3328-codec -+ -+ reg: -+ maxItems: 1 -+ -+ clocks: -+ items: -+ - description: clock for audio codec -+ - description: clock for I2S master clock -+ -+ clock-names: -+ items: -+ - const: pclk -+ - const: mclk -+ -+ rockchip,grf: -+ $ref: /schemas/types.yaml#/definitions/phandle -+ description: -+ The phandle of the syscon node for the GRF register. -+ -+ spk-depop-time-ms: -+ default: 200 -+ description: -+ Speaker depop time in msec. -+ -+ mute-gpios: -+ maxItems: 1 -+ description: -+ GPIO specifier for external line driver control (typically the -+ dedicated GPIO_MUTE pin) -+ -+ "#sound-dai-cells": -+ const: 0 -+ -+required: -+ - compatible -+ - reg -+ - clocks -+ - clock-names -+ - rockchip,grf -+ - "#sound-dai-cells" -+ -+examples: -+ - | -+ #include -+ #include -+ codec: codec@ff410000 { -+ compatible = "rockchip,rk3328-codec"; -+ reg = <0xff410000 0x1000>; -+ clocks = <&cru PCLK_ACODECPHY>, <&cru SCLK_I2S1>; -+ clock-names = "pclk", "mclk"; -+ rockchip,grf = <&grf>; -+ mute-gpios = <&grf_gpio 0 GPIO_ACTIVE_LOW>; -+ spk-depop-time-ms = <100>; -+ #sound-dai-cells = <0>; -+ }; - -From 0af70ee151c875caa591c2d5d3115f7c807ef228 Mon Sep 17 00:00:00 2001 -From: Sugar Zhang -Date: Mon, 29 Jun 2020 22:05:42 +0800 -Subject: [PATCH] dmaengine: pl330: Remove the burst limit for quirk - 'NO-FLUSHP' - -There is no reason to limit the performance on the 'NO-FLUSHP' SoCs, -because 'FLUSHP' instruction is broken on these platforms, so remove -the limit to improve the efficiency. - -Signed-off-by: Sugar Zhang -Link: https://lore.kernel.org/r/1593439555-68130-2-git-send-email-sugar.zhang@rock-chips.com -Signed-off-by: Vinod Koul -(cherry picked from commit 05611a93b8ffa3fe7d2eb43dd6c11e37ead5908a) ---- - drivers/dma/pl330.c | 10 ++-------- - 1 file changed, 2 insertions(+), 8 deletions(-) - -diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c -index 6a158eef6b8a..7686292bc1db 100644 ---- a/drivers/dma/pl330.c -+++ b/drivers/dma/pl330.c -@@ -1183,9 +1183,6 @@ static inline int _ldst_peripheral(struct pl330_dmac *pl330, - { - int off = 0; - -- if (pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP) -- cond = BURST; -- - /* - * do FLUSHP at beginning to clear any stale dma requests before the - * first WFP. -@@ -2221,9 +2218,7 @@ static bool pl330_prep_slave_fifo(struct dma_pl330_chan *pch, - - static int fixup_burst_len(int max_burst_len, int quirks) - { -- if (quirks & PL330_QUIRK_BROKEN_NO_FLUSHP) -- return 1; -- else if (max_burst_len > PL330_MAX_BURST) -+ if (max_burst_len > PL330_MAX_BURST) - return PL330_MAX_BURST; - else if (max_burst_len < 1) - return 1; -@@ -3128,8 +3123,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) - pd->dst_addr_widths = PL330_DMA_BUSWIDTHS; - pd->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); - pd->residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; -- pd->max_burst = ((pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP) ? -- 1 : PL330_MAX_BURST); -+ pd->max_burst = PL330_MAX_BURST; - - ret = dma_async_device_register(pd); - if (ret) { - -From eaedb49ad444ff15939418b10d758395b2c2885f Mon Sep 17 00:00:00 2001 -From: Sugar Zhang -Date: Mon, 29 Jun 2020 22:05:43 +0800 -Subject: [PATCH] dmaengine: pl330: Improve transfer efficiency for the dregs - -Only the unaligned burst transfers have the dregs. -so, still use BURST transfer with a reduced size -for better performance. - -Signed-off-by: Sugar Zhang -Link: https://lore.kernel.org/r/1593439555-68130-3-git-send-email-sugar.zhang@rock-chips.com -Signed-off-by: Vinod Koul -(cherry picked from commit 3e7f0bd872087bf4653eeee9a83050f91baae907) ---- - drivers/dma/pl330.c | 32 +++++++++++++++++++++----------- - 1 file changed, 21 insertions(+), 11 deletions(-) - -diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c -index 7686292bc1db..f1f0176c6c05 100644 ---- a/drivers/dma/pl330.c -+++ b/drivers/dma/pl330.c -@@ -1228,8 +1228,9 @@ static int _bursts(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[], - } - - /* -- * transfer dregs with single transfers to peripheral, or a reduced size burst -- * for mem-to-mem. -+ * only the unaligned burst transfers have the dregs. -+ * so, still transfer dregs with a reduced size burst -+ * for mem-to-mem, mem-to-dev or dev-to-mem. - */ - static int _dregs(struct pl330_dmac *pl330, unsigned int dry_run, u8 buf[], - const struct _xfer_spec *pxs, int transfer_length) -@@ -1240,22 +1241,31 @@ static int _dregs(struct pl330_dmac *pl330, unsigned int dry_run, u8 buf[], - if (transfer_length == 0) - return off; - -+ /* -+ * dregs_len = (total bytes - BURST_TO_BYTE(bursts, ccr)) / -+ * BRST_SIZE(ccr) -+ * the dregs len must be smaller than burst len, -+ * so, for higher efficiency, we can modify CCR -+ * to use a reduced size burst len for the dregs. -+ */ -+ dregs_ccr = pxs->ccr; -+ dregs_ccr &= ~((0xf << CC_SRCBRSTLEN_SHFT) | -+ (0xf << CC_DSTBRSTLEN_SHFT)); -+ dregs_ccr |= (((transfer_length - 1) & 0xf) << -+ CC_SRCBRSTLEN_SHFT); -+ dregs_ccr |= (((transfer_length - 1) & 0xf) << -+ CC_DSTBRSTLEN_SHFT); -+ - switch (pxs->desc->rqtype) { - case DMA_MEM_TO_DEV: - /* fall through */ - case DMA_DEV_TO_MEM: -- off += _ldst_peripheral(pl330, dry_run, &buf[off], pxs, -- transfer_length, SINGLE); -+ off += _emit_MOV(dry_run, &buf[off], CCR, dregs_ccr); -+ off += _ldst_peripheral(pl330, dry_run, &buf[off], pxs, 1, -+ BURST); - break; - - case DMA_MEM_TO_MEM: -- dregs_ccr = pxs->ccr; -- dregs_ccr &= ~((0xf << CC_SRCBRSTLEN_SHFT) | -- (0xf << CC_DSTBRSTLEN_SHFT)); -- dregs_ccr |= (((transfer_length - 1) & 0xf) << -- CC_SRCBRSTLEN_SHFT); -- dregs_ccr |= (((transfer_length - 1) & 0xf) << -- CC_DSTBRSTLEN_SHFT); - off += _emit_MOV(dry_run, &buf[off], CCR, dregs_ccr); - off += _ldst_memtomem(dry_run, &buf[off], pxs, 1); - break; - -From a2321c41b827bf897f39ab2e0049fb3c69cdcfd2 Mon Sep 17 00:00:00 2001 -From: Sugar Zhang -Date: Mon, 29 Jun 2020 22:05:45 +0800 -Subject: [PATCH] dmaengine: pl330: Add quirk 'arm,pl330-periph-burst' - -This patch adds the qurik to use burst transfers only -for pl330 controller, even for request with a length of 1. - -Although, the correct way should be: if the peripheral request -length is 1, the peripheral should use SINGLE request, and then -notify the dmac using SINGLE mode by src/dst_maxburst with 1. - -For example, on the Rockchip SoCs, all the peripherals can use -SINGLE or BURST request by setting GRF registers. it is possible -that if these peripheral drivers are used only for Rockchip SoCs. -Unfortunately, it's not, such as dw uart, which is used so widely, -and we can't set src/dst_maxburst according to the SoCs' specific -to compatible with all the other SoCs. - -So, for convenience, all the peripherals are set as BURST request -by default on the Rockchip SoCs. even for request with a length of 1. -the current pl330 driver will perform SINGLE transfer if the client's -maxburst is 1, which still should be working according to chapter 2.6.6 -of datasheet which describe how DMAC performs SINGLE transfers for -a BURST request. Unfortunately, it's broken on the Rockchip SoCs, -which support only matching transfers, such as BURST transfer for -BURST request, SINGLE transfer for SINGLE request. - -Finally, we add the quirk to specify pl330 to use burst transfers only. - -Signed-off-by: Sugar Zhang -Link: https://lore.kernel.org/r/1593439555-68130-5-git-send-email-sugar.zhang@rock-chips.com -Signed-off-by: Vinod Koul -(cherry picked from commit 5fb9e3a3423313fe6169d5069e471bfdab6e0b79) ---- - drivers/dma/pl330.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c -index f1f0176c6c05..3be8d462eab4 100644 ---- a/drivers/dma/pl330.c -+++ b/drivers/dma/pl330.c -@@ -33,7 +33,8 @@ - #define PL330_MAX_PERI 32 - #define PL330_MAX_BURST 16 - --#define PL330_QUIRK_BROKEN_NO_FLUSHP BIT(0) -+#define PL330_QUIRK_BROKEN_NO_FLUSHP BIT(0) -+#define PL330_QUIRK_PERIPH_BURST BIT(1) - - enum pl330_cachectrl { - CCTRL0, /* Noncacheable and nonbufferable */ -@@ -509,6 +510,10 @@ static struct pl330_of_quirks { - { - .quirk = "arm,pl330-broken-no-flushp", - .id = PL330_QUIRK_BROKEN_NO_FLUSHP, -+ }, -+ { -+ .quirk = "arm,pl330-periph-burst", -+ .id = PL330_QUIRK_PERIPH_BURST, - } - }; - -@@ -1206,6 +1211,9 @@ static int _bursts(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[], - int off = 0; - enum pl330_cond cond = BRST_LEN(pxs->ccr) > 1 ? BURST : SINGLE; - -+ if (pl330->quirks & PL330_QUIRK_PERIPH_BURST) -+ cond = BURST; -+ - switch (pxs->desc->rqtype) { - case DMA_MEM_TO_DEV: - /* fall through */ - -From c8c01a9881647f07fbd0a5a0b2dc316c89ec8198 Mon Sep 17 00:00:00 2001 -From: Lee Jones -Date: Tue, 14 Jul 2020 12:15:34 +0100 -Subject: [PATCH] dmaengine: pl330: Demote obvious misuse of kerneldoc to - standard comment block - -No 'struct' title is provided. Nor are any attribute descriptions. - -Fixes the following W=1 kernel build warning(s): - - drivers/dma/pl330.c:295: warning: cannot understand function prototype: 'struct pl330_reqcfg ' - -Signed-off-by: Lee Jones -Cc: Philipp Zabel -Cc: Jaswinder Singh -Link: https://lore.kernel.org/r/20200714111546.1755231-6-lee.jones@linaro.org -Signed-off-by: Vinod Koul -(cherry picked from commit f9e036df575d8efce6fd469acd9df3148c2adf6e) ---- - drivers/dma/pl330.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c -index 3be8d462eab4..2c508ee672b9 100644 ---- a/drivers/dma/pl330.c -+++ b/drivers/dma/pl330.c -@@ -285,7 +285,7 @@ struct pl330_config { - u32 irq_ns; - }; - --/** -+/* - * Request Configuration. - * The PL330 core does not modify this and uses the last - * working configuration if the request doesn't provide any. - -From 0d6ca0a2c723ee54eb279942db95274fdccb525c Mon Sep 17 00:00:00 2001 -From: Kuninori Morimoto -Date: Thu, 9 Jul 2020 10:55:36 +0900 -Subject: [PATCH] ASoC: hdmi-codec: return -ENOTSUPP for digital_mute - -snd_soc_dai_digital_mute() will return -ENOTSUPP if driver doesn't -support mute. -In hdmi-codec case, hdmi_codec_digital_mute() will be used for it, -and each driver has .digital_mute() callback. -hdmi_codec_digital_mute() want to return -ENOTSUPP to follow it. - -Signed-off-by: Kuninori Morimoto -Link: https://lore.kernel.org/r/87fta1xxjc.wl-kuninori.morimoto.gx@renesas.com -Signed-off-by: Mark Brown -(cherry picked from commit e07e49c0d1e3693facf588142c4cbde45904b3f8) ---- - sound/soc/codecs/hdmi-codec.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c -index f005751da2cc..926ab447a96b 100644 ---- a/sound/soc/codecs/hdmi-codec.c -+++ b/sound/soc/codecs/hdmi-codec.c -@@ -566,7 +566,7 @@ static int hdmi_codec_digital_mute(struct snd_soc_dai *dai, int mute) - return hcp->hcd.ops->digital_mute(dai->dev->parent, - hcp->hcd.data, mute); - -- return 0; -+ return -ENOTSUPP; - } - - static const struct snd_soc_dai_ops hdmi_codec_i2s_dai_ops = { - -From 302002cea0d7b39f8274d1466b8b6184d5687f86 Mon Sep 17 00:00:00 2001 -From: Johan Jonker -Date: Wed, 15 Jul 2020 09:09:54 +0200 -Subject: [PATCH] arm64: dts: rockchip: remove bus-width from mmc nodes in px30 - dts files - -'bus-width' has been added to px30.dtsi mmc nodes, so now it can be -removed from the dts files that include it. - -Signed-off-by: Johan Jonker -Link: https://lore.kernel.org/r/20200715070954.1992-1-jbx6244@gmail.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit e7e46a1f6b755248058db531b1cff3b0cc580650) ---- - arch/arm64/boot/dts/rockchip/px30-evb.dts | 3 --- - arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts | 1 - - 2 files changed, 4 deletions(-) - -diff --git a/arch/arm64/boot/dts/rockchip/px30-evb.dts b/arch/arm64/boot/dts/rockchip/px30-evb.dts -index 0a680257d9c2..5fe905fae9a8 100644 ---- a/arch/arm64/boot/dts/rockchip/px30-evb.dts -+++ b/arch/arm64/boot/dts/rockchip/px30-evb.dts -@@ -145,7 +145,6 @@ - }; - - &emmc { -- bus-width = <8>; - cap-mmc-highspeed; - mmc-hs200-1_8v; - non-removable; -@@ -499,7 +498,6 @@ - }; - - &sdmmc { -- bus-width = <4>; - cap-mmc-highspeed; - cap-sd-highspeed; - card-detect-delay = <800>; -@@ -513,7 +511,6 @@ - }; - - &sdio { -- bus-width = <4>; - cap-sd-highspeed; - keep-power-in-suspend; - non-removable; -diff --git a/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts b/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts -index b3a8f936578f..35bd6b904b9c 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts -@@ -445,7 +445,6 @@ - }; - - &sdmmc { -- bus-width = <4>; - cap-sd-highspeed; - card-detect-delay = <200>; - cd-gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_LOW>; /*[> CD GPIO <]*/ - -From 2998dd296342e93744c25268f5103cc628e0f004 Mon Sep 17 00:00:00 2001 -From: Sugar Zhang -Date: Mon, 29 Jun 2020 22:12:11 +0800 -Subject: [PATCH] arm64: dts: rockchip: Add 'arm,pl330-periph-burst' for dmac - -This patch Add the quirk to specify to use burst transfer -for better compatible and higher performance. - -Signed-off-by: Sugar Zhang - -Link: https://lore.kernel.org/r/1593439935-68540-1-git-send-email-sugar.zhang@rock-chips.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit 505af9184ec0a0222bb883486137fac32731e01d) ---- - arch/arm64/boot/dts/rockchip/px30.dtsi | 1 + - arch/arm64/boot/dts/rockchip/rk3308.dtsi | 2 ++ - arch/arm64/boot/dts/rockchip/rk3328.dtsi | 1 + - arch/arm64/boot/dts/rockchip/rk3368.dtsi | 2 ++ - arch/arm64/boot/dts/rockchip/rk3399.dtsi | 2 ++ - 5 files changed, 8 insertions(+) - -diff --git a/arch/arm64/boot/dts/rockchip/px30.dtsi b/arch/arm64/boot/dts/rockchip/px30.dtsi -index e9bb2b97ae55..2695ea8cda14 100644 ---- a/arch/arm64/boot/dts/rockchip/px30.dtsi -+++ b/arch/arm64/boot/dts/rockchip/px30.dtsi -@@ -714,6 +714,7 @@ - reg = <0x0 0xff240000 0x0 0x4000>; - interrupts = , - ; -+ arm,pl330-periph-burst; - clocks = <&cru ACLK_DMAC>; - clock-names = "apb_pclk"; - #dma-cells = <1>; -diff --git a/arch/arm64/boot/dts/rockchip/rk3308.dtsi b/arch/arm64/boot/dts/rockchip/rk3308.dtsi -index ba1c71568164..e8b754d415d8 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi -@@ -524,6 +524,7 @@ - reg = <0x0 0xff2c0000 0x0 0x4000>; - interrupts = , - ; -+ arm,pl330-periph-burst; - clocks = <&cru ACLK_DMAC0>; - clock-names = "apb_pclk"; - #dma-cells = <1>; -@@ -534,6 +535,7 @@ - reg = <0x0 0xff2d0000 0x0 0x4000>; - interrupts = , - ; -+ arm,pl330-periph-burst; - clocks = <&cru ACLK_DMAC1>; - clock-names = "apb_pclk"; - #dma-cells = <1>; -diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -index 72e655020560..bbdb19a3e85d 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -@@ -153,6 +153,7 @@ - reg = <0x0 0xff1f0000 0x0 0x4000>; - interrupts = , - ; -+ arm,pl330-periph-burst; - clocks = <&cru ACLK_DMAC>; - clock-names = "apb_pclk"; - #dma-cells = <1>; -diff --git a/arch/arm64/boot/dts/rockchip/rk3368.dtsi b/arch/arm64/boot/dts/rockchip/rk3368.dtsi -index 5d25a9d04051..3746f23dc3df 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3368.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3368.dtsi -@@ -149,6 +149,7 @@ - ; - #dma-cells = <1>; - arm,pl330-broken-no-flushp; -+ arm,pl330-periph-burst; - clocks = <&cru ACLK_DMAC_PERI>; - clock-names = "apb_pclk"; - }; -@@ -160,6 +161,7 @@ - ; - #dma-cells = <1>; - arm,pl330-broken-no-flushp; -+ arm,pl330-periph-burst; - clocks = <&cru ACLK_DMAC_BUS>; - clock-names = "apb_pclk"; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -index f2ef0d8ba54b..ada724b12f01 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -@@ -209,6 +209,7 @@ - interrupts = , - ; - #dma-cells = <1>; -+ arm,pl330-periph-burst; - clocks = <&cru ACLK_DMAC0_PERILP>; - clock-names = "apb_pclk"; - }; -@@ -219,6 +220,7 @@ - interrupts = , - ; - #dma-cells = <1>; -+ arm,pl330-periph-burst; - clocks = <&cru ACLK_DMAC1_PERILP>; - clock-names = "apb_pclk"; - }; - -From bdb45209dbe7864cf6d04c4ae32d207e580ffbd0 Mon Sep 17 00:00:00 2001 -From: Sugar Zhang -Date: Mon, 29 Jun 2020 22:10:57 +0800 -Subject: [PATCH] ARM: dts: rockchip: Add 'arm,pl330-periph-burst' for dmac - -This patch Add the quirk to specify to use burst transfer -for better compatible and higher performance. - -Signed-off-by: Sugar Zhang - -Link: https://lore.kernel.org/r/1593439866-68459-1-git-send-email-sugar.zhang@rock-chips.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit fb082df317823463eaf09ac88de19fb3319e4f58) ---- - arch/arm/boot/dts/rk3036.dtsi | 1 + - arch/arm/boot/dts/rk322x.dtsi | 1 + - arch/arm/boot/dts/rk3288.dtsi | 3 +++ - arch/arm/boot/dts/rk3xxx.dtsi | 3 +++ - arch/arm/boot/dts/rv1108.dtsi | 1 + - 5 files changed, 9 insertions(+) - -diff --git a/arch/arm/boot/dts/rk3036.dtsi b/arch/arm/boot/dts/rk3036.dtsi -index d9a0c9a29b68..093567022386 100644 ---- a/arch/arm/boot/dts/rk3036.dtsi -+++ b/arch/arm/boot/dts/rk3036.dtsi -@@ -67,6 +67,7 @@ - ; - #dma-cells = <1>; - arm,pl330-broken-no-flushp; -+ arm,pl330-periph-burst; - clocks = <&cru ACLK_DMAC2>; - clock-names = "apb_pclk"; - }; -diff --git a/arch/arm/boot/dts/rk322x.dtsi b/arch/arm/boot/dts/rk322x.dtsi -index 3236abb0aba9..48e6e8d44a1a 100644 ---- a/arch/arm/boot/dts/rk322x.dtsi -+++ b/arch/arm/boot/dts/rk322x.dtsi -@@ -107,6 +107,7 @@ - interrupts = , - ; - #dma-cells = <1>; -+ arm,pl330-periph-burst; - clocks = <&cru ACLK_DMAC>; - clock-names = "apb_pclk"; - }; -diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi -index 84d59469035e..9fa11b9f4522 100644 ---- a/arch/arm/boot/dts/rk3288.dtsi -+++ b/arch/arm/boot/dts/rk3288.dtsi -@@ -167,6 +167,7 @@ - ; - #dma-cells = <1>; - arm,pl330-broken-no-flushp; -+ arm,pl330-periph-burst; - clocks = <&cru ACLK_DMAC2>; - clock-names = "apb_pclk"; - }; -@@ -178,6 +179,7 @@ - ; - #dma-cells = <1>; - arm,pl330-broken-no-flushp; -+ arm,pl330-periph-burst; - clocks = <&cru ACLK_DMAC1>; - clock-names = "apb_pclk"; - status = "disabled"; -@@ -190,6 +192,7 @@ - ; - #dma-cells = <1>; - arm,pl330-broken-no-flushp; -+ arm,pl330-periph-burst; - clocks = <&cru ACLK_DMAC1>; - clock-names = "apb_pclk"; - }; -diff --git a/arch/arm/boot/dts/rk3xxx.dtsi b/arch/arm/boot/dts/rk3xxx.dtsi -index d929b60517ab..859a7477909f 100644 ---- a/arch/arm/boot/dts/rk3xxx.dtsi -+++ b/arch/arm/boot/dts/rk3xxx.dtsi -@@ -45,6 +45,7 @@ - ; - #dma-cells = <1>; - arm,pl330-broken-no-flushp; -+ arm,pl330-periph-burst; - clocks = <&cru ACLK_DMA1>; - clock-names = "apb_pclk"; - }; -@@ -56,6 +57,7 @@ - ; - #dma-cells = <1>; - arm,pl330-broken-no-flushp; -+ arm,pl330-periph-burst; - clocks = <&cru ACLK_DMA1>; - clock-names = "apb_pclk"; - status = "disabled"; -@@ -68,6 +70,7 @@ - ; - #dma-cells = <1>; - arm,pl330-broken-no-flushp; -+ arm,pl330-periph-burst; - clocks = <&cru ACLK_DMA2>; - clock-names = "apb_pclk"; - }; -diff --git a/arch/arm/boot/dts/rv1108.dtsi b/arch/arm/boot/dts/rv1108.dtsi -index a5d130bd0547..a1a08cb9364e 100644 ---- a/arch/arm/boot/dts/rv1108.dtsi -+++ b/arch/arm/boot/dts/rv1108.dtsi -@@ -97,6 +97,7 @@ - interrupts = ; - #dma-cells = <1>; - arm,pl330-broken-no-flushp; -+ arm,pl330-periph-burst; - clocks = <&cru ACLK_DMAC>; - clock-names = "apb_pclk"; - }; - -From c731874b9b0b7cb275d9cebd9ceb4a7dbc78d9cd Mon Sep 17 00:00:00 2001 -From: Jagan Teki -Date: Wed, 15 Jul 2020 14:04:12 +0530 -Subject: [PATCH] ARM: dts: rockchip: dalang-carrier: Move i2c nodes into SOM - -I2C nodes and associated slave devices defined in Carrier board -are specific to rk3399pro vmrac SOM. - -So, move them into SOM dtsi. - -Signed-off-by: Jagan Teki -Link: https://lore.kernel.org/r/20200715083418.112003-2-jagan@amarulasolutions.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit c2f343510d99ab53b46bdfeb184cb48f622e6943) ---- - .../boot/dts/rockchip-radxa-dalang-carrier.dtsi | 32 ---------------------- - .../boot/dts/rockchip/rk3399pro-vmarc-som.dtsi | 29 ++++++++++++++++++++ - 2 files changed, 29 insertions(+), 32 deletions(-) - -diff --git a/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi b/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi -index df3712aedf8a..176b53b8e41a 100644 ---- a/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi -+++ b/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi -@@ -17,29 +17,6 @@ - status = "okay"; - }; - --&i2c1 { -- status = "okay"; -- i2c-scl-rising-time-ns = <140>; -- i2c-scl-falling-time-ns = <30>; --}; -- --&i2c2 { -- status = "okay"; -- clock-frequency = <400000>; -- -- hym8563: hym8563@51 { -- compatible = "haoyu,hym8563"; -- reg = <0x51>; -- #clock-cells = <0>; -- clock-frequency = <32768>; -- clock-output-names = "hym8563"; -- pinctrl-names = "default"; -- pinctrl-0 = <&hym8563_int>; -- interrupt-parent = <&gpio4>; -- interrupts = <30 IRQ_TYPE_LEVEL_LOW>; -- }; --}; -- - &pwm0 { - status = "okay"; - }; -@@ -70,12 +47,3 @@ - &uart2 { - status = "okay"; - }; -- --&pinctrl { -- hym8563 { -- hym8563_int: hym8563-int { -- rockchip,pins = -- <4 RK_PD6 0 &pcfg_pull_up>; -- }; -- }; --}; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi b/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -index 0a516334f15f..e11538171e67 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -@@ -297,6 +297,29 @@ - }; - }; - -+&i2c1 { -+ i2c-scl-falling-time-ns = <30>; -+ i2c-scl-rising-time-ns = <140>; -+ status = "okay"; -+}; -+ -+&i2c2 { -+ clock-frequency = <400000>; -+ status = "okay"; -+ -+ hym8563: hym8563@51 { -+ compatible = "haoyu,hym8563"; -+ reg = <0x51>; -+ #clock-cells = <0>; -+ clock-frequency = <32768>; -+ clock-output-names = "hym8563"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hym8563_int>; -+ interrupt-parent = <&gpio4>; -+ interrupts = ; -+ }; -+}; -+ - &io_domains { - status = "okay"; - bt656-supply = <&vcca_1v8>; -@@ -324,6 +347,12 @@ - }; - - &pinctrl { -+ hym8563 { -+ hym8563_int: hym8563-int { -+ rockchip,pins = <4 RK_PD6 0 &pcfg_pull_up>; -+ }; -+ }; -+ - pmic { - pmic_int_l: pmic-int-l { - rockchip,pins = - -From 9f90d56d4ad373cf51dffb34e5288e7b8e83840c Mon Sep 17 00:00:00 2001 -From: Jagan Teki -Date: Wed, 15 Jul 2020 14:04:13 +0530 -Subject: [PATCH] arm64: dts: rk3399pro: vmarc-som: Fix sorting nodes, - properties - -Fix node, properties sorting on RockPI N10 board dts(i) files. - -Signed-off-by: Jagan Teki -Link: https://lore.kernel.org/r/20200715083418.112003-3-jagan@amarulasolutions.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit 3047b384a74090f09b994298eb5c40986275233a) ---- - .../boot/dts/rockchip/rk3399pro-rock-pi-n10.dts | 2 +- - .../boot/dts/rockchip/rk3399pro-vmarc-som.dtsi | 35 +++++++++++----------- - 2 files changed, 18 insertions(+), 19 deletions(-) - -diff --git a/arch/arm64/boot/dts/rockchip/rk3399pro-rock-pi-n10.dts b/arch/arm64/boot/dts/rockchip/rk3399pro-rock-pi-n10.dts -index a1783e7f769a..539f4005386d 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399pro-rock-pi-n10.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3399pro-rock-pi-n10.dts -@@ -8,8 +8,8 @@ - /dts-v1/; - #include "rk3399.dtsi" - #include "rk3399-opp.dtsi" --#include "rk3399pro-vmarc-som.dtsi" - #include -+#include "rk3399pro-vmarc-som.dtsi" - - / { - model = "Radxa ROCK Pi N10"; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi b/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -index e11538171e67..121a430d6a70 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -@@ -76,8 +76,8 @@ - - &i2c0 { - clock-frequency = <400000>; -- i2c-scl-rising-time-ns = <180>; - i2c-scl-falling-time-ns = <30>; -+ i2c-scl-rising-time-ns = <180>; - status = "okay"; - - rk809: pmic@20 { -@@ -323,8 +323,22 @@ - &io_domains { - status = "okay"; - bt656-supply = <&vcca_1v8>; -- sdmmc-supply = <&vccio_sd>; - gpio1830-supply = <&vccio_3v0>; -+ sdmmc-supply = <&vccio_sd>; -+}; -+ -+&pinctrl { -+ hym8563 { -+ hym8563_int: hym8563-int { -+ rockchip,pins = <4 RK_PD6 0 &pcfg_pull_up>; -+ }; -+ }; -+ -+ pmic { -+ pmic_int_l: pmic-int-l { -+ rockchip,pins = <1 RK_PC2 0 &pcfg_pull_up>; -+ }; -+ }; - }; - - &pmu_io_domains { -@@ -341,22 +355,7 @@ - }; - - &tsadc { -- status = "okay"; - rockchip,hw-tshut-mode = <1>; - rockchip,hw-tshut-polarity = <1>; --}; -- --&pinctrl { -- hym8563 { -- hym8563_int: hym8563-int { -- rockchip,pins = <4 RK_PD6 0 &pcfg_pull_up>; -- }; -- }; -- -- pmic { -- pmic_int_l: pmic-int-l { -- rockchip,pins = -- <1 RK_PC2 0 &pcfg_pull_up>; -- }; -- }; -+ status = "okay"; - }; - -From af119e1d768dcbebf778716c5318b896132d9b35 Mon Sep 17 00:00:00 2001 -From: Jagan Teki -Date: Wed, 15 Jul 2020 14:04:14 +0530 -Subject: [PATCH] arm64: dts: rk3399pro: vmarc-som: Move supply regulators into - Carrier - -Supply regulators are common across different variants of vmarc SOM's -since the Type C power controller IC is part of the carrier board. - -So, move the supply regulators into carrier board dtsi. - -Signed-off-by: Jagan Teki -Link: https://lore.kernel.org/r/20200715083418.112003-4-jagan@amarulasolutions.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit 4a3ca113c0f3a2ce33e51fc6a48a121b2d707d4f) ---- - arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi | 19 +++++++++++++++++++ - arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi | 19 ------------------- - 2 files changed, 19 insertions(+), 19 deletions(-) - -diff --git a/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi b/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi -index 176b53b8e41a..00b200a62263 100644 ---- a/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi -+++ b/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi -@@ -11,6 +11,25 @@ - chosen { - stdout-path = "serial2:1500000n8"; - }; -+ -+ vcc12v_dcin: vcc12v-dcin-regulator { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc12v_dcin"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <12000000>; -+ regulator-max-microvolt = <12000000>; -+ }; -+ -+ vcc5v0_sys: vcc5v0-sys-regulator { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc5v0_sys"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ vin-supply = <&vcc12v_dcin>; -+ }; - }; - - &gmac { -diff --git a/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi b/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -index 121a430d6a70..d8fa8127d9dc 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -@@ -18,25 +18,6 @@ - clock-output-names = "clkin_gmac"; - #clock-cells = <0>; - }; -- -- vcc12v_dcin: vcc12v-dcin-regulator { -- compatible = "regulator-fixed"; -- regulator-name = "vcc12v_dcin"; -- regulator-always-on; -- regulator-boot-on; -- regulator-min-microvolt = <12000000>; -- regulator-max-microvolt = <12000000>; -- }; -- -- vcc5v0_sys: vcc5v0-sys-regulator { -- compatible = "regulator-fixed"; -- regulator-name = "vcc5v0_sys"; -- regulator-always-on; -- regulator-boot-on; -- regulator-min-microvolt = <5000000>; -- regulator-max-microvolt = <5000000>; -- vin-supply = <&vcc12v_dcin>; -- }; - }; - - &cpu_l0 { - -From 5bd86db05f58c75af3819ed6d28db6d87e408c96 Mon Sep 17 00:00:00 2001 -From: Jagan Teki -Date: Wed, 15 Jul 2020 14:04:15 +0530 -Subject: [PATCH] arm64: dts: rk3399pro: vmarc-som: Move common properties into - Carrier - -Some of gmac, sdmmc node properties are common across rk3288 and -rk3399pro SOM's so move them into Carrier dtsi. - -Chosen node is specific to rk3399pro configure SBC, so move it into -RockPI N10 dts. - -Signed-off-by: Jagan Teki -Link: https://lore.kernel.org/r/20200715083418.112003-5-jagan@amarulasolutions.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit a66bd94d0eac017e4846658750acaca2937555bb) ---- - .../arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi | 18 ++++++++++++++---- - .../boot/dts/rockchip/rk3399pro-rock-pi-n10.dts | 4 ++++ - .../boot/dts/rockchip/rk3399pro-vmarc-som.dtsi | 21 +++++---------------- - 3 files changed, 23 insertions(+), 20 deletions(-) - -diff --git a/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi b/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi -index 00b200a62263..450e5bb5af0b 100644 ---- a/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi -+++ b/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi -@@ -8,8 +8,11 @@ - #include - - / { -- chosen { -- stdout-path = "serial2:1500000n8"; -+ clkin_gmac: external-gmac-clock { -+ compatible = "fixed-clock"; -+ clock-frequency = <125000000>; -+ clock-output-names = "clkin_gmac"; -+ #clock-cells = <0>; - }; - - vcc12v_dcin: vcc12v-dcin-regulator { -@@ -33,6 +36,15 @@ - }; - - &gmac { -+ assigned-clock-parents = <&clkin_gmac>; -+ clock_in_out = "input"; -+ phy-mode = "rgmii"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&rgmii_pins>; -+ snps,reset-active-low; -+ snps,reset-delays-us = <0 10000 50000>; -+ tx_delay = <0x28>; -+ rx_delay = <0x11>; - status = "okay"; - }; - -@@ -48,10 +60,8 @@ - bus-width = <4>; - cap-mmc-highspeed; - cap-sd-highspeed; -- cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; - disable-wp; - vqmmc-supply = <&vccio_sd>; -- max-frequency = <150000000>; - pinctrl-names = "default"; - pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; - status = "okay"; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399pro-rock-pi-n10.dts b/arch/arm64/boot/dts/rockchip/rk3399pro-rock-pi-n10.dts -index 539f4005386d..369de5dc0ebd 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399pro-rock-pi-n10.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3399pro-rock-pi-n10.dts -@@ -15,4 +15,8 @@ - model = "Radxa ROCK Pi N10"; - compatible = "radxa,rockpi-n10", "vamrs,rk3399pro-vmarc-som", - "rockchip,rk3399pro"; -+ -+ chosen { -+ stdout-path = "serial2:1500000n8"; -+ }; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi b/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -index d8fa8127d9dc..37ed95d5f7e9 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -@@ -11,13 +11,6 @@ - - / { - compatible = "vamrs,rk3399pro-vmarc-som", "rockchip,rk3399pro"; -- -- clkin_gmac: external-gmac-clock { -- compatible = "fixed-clock"; -- clock-frequency = <125000000>; -- clock-output-names = "clkin_gmac"; -- #clock-cells = <0>; -- }; - }; - - &cpu_l0 { -@@ -42,17 +35,8 @@ - - &gmac { - assigned-clocks = <&cru SCLK_RMII_SRC>; -- assigned-clock-parents = <&clkin_gmac>; -- clock_in_out = "input"; - phy-supply = <&vcc_lan>; -- phy-mode = "rgmii"; -- pinctrl-names = "default"; -- pinctrl-0 = <&rgmii_pins>; - snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; -- snps,reset-active-low; -- snps,reset-delays-us = <0 10000 50000>; -- tx_delay = <0x28>; -- rx_delay = <0x11>; - }; - - &i2c0 { -@@ -335,6 +319,11 @@ - status = "okay"; - }; - -+&sdmmc { -+ cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; -+ max-frequency = <150000000>; -+}; -+ - &tsadc { - rockchip,hw-tshut-mode = <1>; - rockchip,hw-tshut-polarity = <1>; - -From 1b73fa113236dfaa889027bb2c133e349568da14 Mon Sep 17 00:00:00 2001 -From: Jagan Teki -Date: Wed, 15 Jul 2020 14:04:16 +0530 -Subject: [PATCH] dt-bindings: arm: rockchip: Add Rock Pi N8 binding - -Rock Pi N8 is a Rockchip RK3288 based SBC, which has -- VMARC RK3288 SOM (as per SMARC standard) from Vamrs. -- Compatible carrier board from Radxa. - -VMARC RK3288 SOM need to mount on top of dalang carrier -board for making Rock PI N8 SBC. - -Add dt-bindings for it. - -Signed-off-by: Jagan Teki -Reviewed-by: Rob Herring -Link: https://lore.kernel.org/r/20200715083418.112003-6-jagan@amarulasolutions.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit 09ee4794270f0010c6397163f033f883f5bff1aa) ---- - Documentation/devicetree/bindings/arm/rockchip.yaml | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/Documentation/devicetree/bindings/arm/rockchip.yaml b/Documentation/devicetree/bindings/arm/rockchip.yaml -index d4a4045092df..db2e35796795 100644 ---- a/Documentation/devicetree/bindings/arm/rockchip.yaml -+++ b/Documentation/devicetree/bindings/arm/rockchip.yaml -@@ -435,6 +435,12 @@ properties: - - const: radxa,rockpi4 - - const: rockchip,rk3399 - -+ - description: Radxa ROCK Pi N8 -+ items: -+ - const: radxa,rockpi-n8 -+ - const: vamrs,rk3288-vmarc-som -+ - const: rockchip,rk3288 -+ - - description: Radxa ROCK Pi N10 - items: - - const: radxa,rockpi-n10 - -From e3b88d81f3f782d8a899bda98b167a628ab7178b Mon Sep 17 00:00:00 2001 -From: Jagan Teki -Date: Wed, 15 Jul 2020 14:04:17 +0530 -Subject: [PATCH] ARM: dts: rockchip: Add VMARC RK3288 SOM initial support - -VMARC RK3288 SOM is a standard SMARC SOM design with -Rockchip RK3288 SoC, which is designed by Vamrs. - -Specification: -- Rockchip RK3288 -- PMIC: RK808 -- eMMC: 16GB/32GB/64GB -- SD slot -- 2xUSB-2.0, 1xUSB3.0 -- USB-C for power supply -- Ethernet -- HDMI, MIPI-DSI/CSI, eDP - -Add initial support for VMARC RK3288 SOM, this would use -with associated carrier board. - -Signed-off-by: Jagan Teki -Link: https://lore.kernel.org/r/20200715083418.112003-7-jagan@amarulasolutions.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit b8c564d4fa76b1314a10585eea8e97b8c621a77a) ---- - arch/arm/boot/dts/rk3288-vmarc-som.dtsi | 270 ++++++++++++++++++++++++++++++++ - 1 file changed, 270 insertions(+) - create mode 100644 arch/arm/boot/dts/rk3288-vmarc-som.dtsi - -diff --git a/arch/arm/boot/dts/rk3288-vmarc-som.dtsi b/arch/arm/boot/dts/rk3288-vmarc-som.dtsi -new file mode 100644 -index 000000000000..cd61b6230f0d ---- /dev/null -+++ b/arch/arm/boot/dts/rk3288-vmarc-som.dtsi -@@ -0,0 +1,270 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd -+ * Copyright (c) 2019 Vamrs Limited -+ * Copyright (c) 2019 Amarula Solutions(India) -+ */ -+ -+#include -+#include -+ -+/ { -+ compatible = "vamrs,rk3288-vmarc-som", "rockchip,rk3288"; -+ -+ vccio_flash: vccio-flash-regulator { -+ compatible = "regulator-fixed"; -+ regulator-name = "vccio_flash"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ vin-supply = <&vcc_io>; -+ }; -+}; -+ -+&emmc { -+ bus-width = <8>; -+ cap-mmc-highspeed; -+ disable-wp; -+ non-removable; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_pwr &emmc_bus8>; -+ vmmc-supply = <&vcc_io>; -+ vqmmc-supply = <&vccio_flash>; -+ status = "okay"; -+}; -+ -+&gmac { -+ assigned-clocks = <&cru SCLK_MAC>; -+ phy-supply = <&vcc_io>; -+ snps,reset-gpio = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>; -+}; -+ -+&i2c0 { -+ clock-frequency = <400000>; -+ status = "okay"; -+ -+ rk808: pmic@1b { -+ compatible = "rockchip,rk808"; -+ reg = <0x1b>; -+ interrupt-parent = <&gpio0>; -+ interrupts = ; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pmic_int &global_pwroff>; -+ rockchip,system-power-controller; -+ wakeup-source; -+ #clock-cells = <1>; -+ clock-output-names = "rk808-clkout1", "rk808-clkout2"; -+ -+ vcc1-supply = <&vcc5v0_sys>; -+ vcc2-supply = <&vcc5v0_sys>; -+ vcc3-supply = <&vcc5v0_sys>; -+ vcc4-supply = <&vcc5v0_sys>; -+ vcc6-supply = <&vcc5v0_sys>; -+ vcc7-supply = <&vcc5v0_sys>; -+ vcc8-supply = <&vcc_io>; -+ vcc9-supply = <&vcc_io>; -+ vcc10-supply = <&vcc5v0_sys>; -+ vcc11-supply = <&vcc5v0_sys>; -+ vcc12-supply = <&vcc_io>; -+ vddio-supply = <&vcc_io>; -+ -+ regulators { -+ vdd_cpu: DCDC_REG1 { -+ regulator-name = "vdd_arm"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <750000>; -+ regulator-max-microvolt = <1400000>; -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdd_gpu: DCDC_REG2 { -+ regulator-name = "vdd_gpu"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <850000>; -+ regulator-max-microvolt = <1250000>; -+ regulator-ramp-delay = <6000>; -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc_ddr: DCDC_REG3 { -+ regulator-name = "vcc_ddr"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ }; -+ }; -+ -+ vcc_io: DCDC_REG4 { -+ regulator-name = "vcc_io"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <3300000>; -+ }; -+ }; -+ -+ vcc_tp: LDO_REG1 { -+ regulator-name = "vcc_tp"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcca_codec: LDO_REG2 { -+ regulator-name = "vcca_codec"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <3300000>; -+ }; -+ }; -+ -+ vdd_10: LDO_REG3 { -+ regulator-name = "vdd_10"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1000000>; -+ regulator-max-microvolt = <1000000>; -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <1000000>; -+ }; -+ }; -+ -+ vcc_wl: LDO_REG4 { -+ regulator-name = "vcc_wl"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ }; -+ }; -+ -+ vccio_sd: LDO_REG5 { -+ regulator-name = "vccio_sd"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <3300000>; -+ }; -+ }; -+ -+ vdd10_lcd: LDO_REG6 { -+ regulator-name = "vdd10_lcd"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1000000>; -+ regulator-max-microvolt = <1000000>; -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc_18: LDO_REG7 { -+ regulator-name = "vcc_18"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <1800000>; -+ }; -+ }; -+ -+ vcc18_lcd: LDO_REG8 { -+ regulator-name = "vcc18_lcd"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc_sd: SWITCH_REG1 { -+ regulator-name = "vcc_sd"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc_lcd: SWITCH_REG2 { -+ regulator-name = "vcc_lcd"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ }; -+ }; -+}; -+ -+&io_domains { -+ bb-supply = <&vcc_io>; -+ flash0-supply = <&vccio_flash>; -+ gpio1830-supply = <&vcc_18>; -+ gpio30-supply = <&vcc_io>; -+ sdcard-supply = <&vccio_sd>; -+ status = "okay"; -+}; -+ -+&pinctrl { -+ pcfg_pull_none_drv_8ma: pcfg-pull-none-drv-8ma { -+ drive-strength = <8>; -+ }; -+ -+ pcfg_pull_up_drv_8ma: pcfg-pull-up-drv-8ma { -+ bias-pull-up; -+ drive-strength = <8>; -+ }; -+ -+ pmic { -+ pmic_int: pmic-int { -+ rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+ -+ sdmmc { -+ sdmmc_bus4: sdmmc-bus4 { -+ rockchip,pins = -+ <6 RK_PC0 1 &pcfg_pull_up_drv_8ma>, -+ <6 RK_PC1 1 &pcfg_pull_up_drv_8ma>, -+ <6 RK_PC2 1 &pcfg_pull_up_drv_8ma>, -+ <6 RK_PC3 1 &pcfg_pull_up_drv_8ma>; -+ }; -+ -+ sdmmc_clk: sdmmc-clk { -+ rockchip,pins = <6 RK_PC4 1 &pcfg_pull_none_drv_8ma>; -+ }; -+ -+ sdmmc_cmd: sdmmc-cmd { -+ rockchip,pins = <6 RK_PC5 1 &pcfg_pull_up_drv_8ma>; -+ }; -+ }; -+}; - -From 0eab92051a5c64b595ebb266350b3ae537f76fcb Mon Sep 17 00:00:00 2001 -From: Michael Trimarchi -Date: Tue, 7 Jul 2020 12:12:14 +0200 -Subject: [PATCH] ARM: dts: rockchip: Fix VBUS on rk3288-vyasa - -Connect the voltage regulator of vbus to the otg connector. -Depending on the current mode this is enabled (in "host" mode") -or disabled (in "peripheral" mode). The regulator must be updated -if the controller is configured in "otg" mode and the status changes -between "host" and "peripheral". - -Signed-off-by: Michael Trimarchi -Link: https://lore.kernel.org/r/20200707101214.2301768-1-michael@amarulasolutions.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit 719646b76a41b8a482f8701825b635e9710ab329) ---- - arch/arm/boot/dts/rk3288-vyasa.dts | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/arch/arm/boot/dts/rk3288-vyasa.dts b/arch/arm/boot/dts/rk3288-vyasa.dts -index 385dd59393e1..1a20854a1317 100644 ---- a/arch/arm/boot/dts/rk3288-vyasa.dts -+++ b/arch/arm/boot/dts/rk3288-vyasa.dts -@@ -99,8 +99,6 @@ - pinctrl-0 = <&otg_vbus_drv>; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; -- regulator-always-on; -- regulator-boot-on; - vin-supply = <&vsus_5v>; - }; - -@@ -416,6 +414,7 @@ - }; - - &usb_otg { -+ vbus-supply = <&vusb1_5v>; - status = "okay"; - }; - - -From c9012318ac0f9eddc9ab0243c230f6932ba747d6 Mon Sep 17 00:00:00 2001 -From: Jagan Teki -Date: Mon, 20 Jul 2020 16:28:46 +0530 -Subject: [PATCH] ARM: dts: rockchip: Add usb host0 ohci node for rk3288 - -rk3288 and rk3288w have a usb host0 ohci controller. - -Although rk3288 ohci doesn't actually work on hardware, but -rk3288w ohci can work well. - -So add usb host0 ohci node in rk3288 dtsi and boards -can then enable it if supported. - -Signed-off-by: Jagan Teki -Cc: William Wu -Link: https://lore.kernel.org/r/20200720105846.367776-1-jagan@amarulasolutions.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit 82540defdd9cfc491f564ffb8d01911966636bc7) ---- - arch/arm/boot/dts/rk3288.dtsi | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi -index 9fa11b9f4522..68d5a58cfe88 100644 ---- a/arch/arm/boot/dts/rk3288.dtsi -+++ b/arch/arm/boot/dts/rk3288.dtsi -@@ -616,7 +616,16 @@ - status = "disabled"; - }; - -- /* NOTE: ohci@ff520000 doesn't actually work on hardware */ -+ /* NOTE: doesn't work on RK3288, but was fixed on RK3288W */ -+ usb_host0_ohci: usb@ff520000 { -+ compatible = "generic-ohci"; -+ reg = <0x0 0xff520000 0x0 0x100>; -+ interrupts = ; -+ clocks = <&cru HCLK_USBHOST0>; -+ phys = <&usbphy1>; -+ phy-names = "usb"; -+ status = "disabled"; -+ }; - - usb_host1: usb@ff540000 { - compatible = "rockchip,rk3288-usb", "rockchip,rk3066-usb", - -From cf9073499d98c73f36c6db78d215d6fc122cb0e0 Mon Sep 17 00:00:00 2001 -From: Jagan Teki -Date: Mon, 20 Jul 2020 16:32:28 +0530 -Subject: [PATCH] ARM: dts: rockchip: Add USB for RockPI N8/N10 - -Radxa dalang carrier board has 2x USB 2.0 and 1x USB 3.0 -ports. - -This patch adds support to enable all these USB ports for -N10 and N8 combinations SBCs. - -Note that the USB 3.0 port on RockPI N8 combination works -as USB 2.0 OTG since it is driven from RK3288. - -Signed-off-by: Jagan Teki -Link: https://lore.kernel.org/r/20200720110230.367985-1-jagan@amarulasolutions.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit 417b188a985d3557b0ecb5623b27bd9843f03aec) ---- - arch/arm/boot/dts/rk3288-vmarc-som.dtsi | 42 ++++++++++++ - .../boot/dts/rockchip-radxa-dalang-carrier.dtsi | 18 +++++ - .../boot/dts/rockchip/rk3399pro-vmarc-som.dtsi | 78 ++++++++++++++++++++++ - 3 files changed, 138 insertions(+) - -diff --git a/arch/arm/boot/dts/rk3288-vmarc-som.dtsi b/arch/arm/boot/dts/rk3288-vmarc-som.dtsi -index cd61b6230f0d..78164d117248 100644 ---- a/arch/arm/boot/dts/rk3288-vmarc-som.dtsi -+++ b/arch/arm/boot/dts/rk3288-vmarc-som.dtsi -@@ -267,4 +267,46 @@ - rockchip,pins = <6 RK_PC5 1 &pcfg_pull_up_drv_8ma>; - }; - }; -+ -+ vbus_host { -+ usb1_en_oc: usb1-en-oc { -+ rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+ -+ vbus_typec { -+ usb0_en_oc: usb0-en-oc { -+ rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+}; -+ -+&usbphy { -+ status = "okay"; -+}; -+ -+&usb_host0_ehci { -+ status = "okay"; -+}; -+ -+&usb_host0_ohci { -+ status = "okay"; -+}; -+ -+&usb_host1 { -+ status = "okay"; -+}; -+ -+&usb_otg { -+ status = "okay"; -+}; -+ -+&vbus_host { -+ enable-active-high; -+ gpio = <&gpio0 RK_PC1 GPIO_ACTIVE_HIGH>; /* USB1_EN_OC# */ -+}; -+ -+&vbus_typec { -+ enable-active-high; -+ gpio = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>; /* USB0_EN_OC# */ - }; -diff --git a/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi b/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi -index 450e5bb5af0b..d2b6ead148a2 100644 ---- a/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi -+++ b/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi -@@ -33,6 +33,24 @@ - regulator-max-microvolt = <5000000>; - vin-supply = <&vcc12v_dcin>; - }; -+ -+ vbus_host: vbus-host { -+ compatible = "regulator-fixed"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&usb1_en_oc>; -+ regulator-name = "vbus_host"; /* HOST-5V */ -+ regulator-always-on; -+ vin-supply = <&vcc5v0_sys>; -+ }; -+ -+ vbus_typec: vbus-typec { -+ compatible = "regulator-fixed"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&usb0_en_oc>; -+ regulator-name = "vbus_typec"; -+ regulator-always-on; -+ vin-supply = <&vcc5v0_sys>; -+ }; - }; - - &gmac { -diff --git a/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi b/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -index 37ed95d5f7e9..111d6cf9a4e6 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -@@ -304,6 +304,18 @@ - rockchip,pins = <1 RK_PC2 0 &pcfg_pull_up>; - }; - }; -+ -+ vbus_host { -+ usb1_en_oc: usb1-en-oc { -+ rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+ -+ vbus_typec { -+ usb0_en_oc: usb0-en-oc { -+ rockchip,pins = <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; - }; - - &pmu_io_domains { -@@ -324,8 +336,74 @@ - max-frequency = <150000000>; - }; - -+&tcphy0 { -+ status = "okay"; -+}; -+ - &tsadc { - rockchip,hw-tshut-mode = <1>; - rockchip,hw-tshut-polarity = <1>; - status = "okay"; - }; -+ -+&u2phy0 { -+ status = "okay"; -+ -+ u2phy0_otg: otg-port { -+ phy-supply = <&vbus_typec>; -+ status = "okay"; -+ }; -+ -+ u2phy0_host: host-port { -+ phy-supply = <&vbus_host>; -+ status = "okay"; -+ }; -+}; -+ -+ -+&u2phy1 { -+ status = "okay"; -+ -+ u2phy1_host: host-port { -+ phy-supply = <&vbus_host>; -+ status = "okay"; -+ }; -+}; -+ -+&usb_host0_ehci { -+ status = "okay"; -+}; -+ -+&usb_host0_ohci { -+ status = "okay"; -+}; -+ -+&usb_host1_ehci { -+ status = "okay"; -+}; -+ -+&usb_host1_ohci { -+ status = "okay"; -+}; -+ -+&usbdrd3_0 { -+ status = "okay"; -+}; -+ -+&usbdrd_dwc3_0 { -+ status = "okay"; -+}; -+ -+&vbus_host { -+ enable-active-high; -+ gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; /* USB1_EN_OC# */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&usb1_en_oc>; -+}; -+ -+&vbus_typec { -+ enable-active-high; -+ gpio = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>; /* USB0_EN_OC# */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&usb0_en_oc>; -+}; - -From 173aa8b05ebe857f08a24d3d1766b5f32ab9004e Mon Sep 17 00:00:00 2001 -From: Jagan Teki -Date: Mon, 20 Jul 2020 16:32:29 +0530 -Subject: [PATCH] ARM: dts: rockchip: Add HDMI out for RockPI N8/N10 - -This patch adds support to enable HDMI out for -N10 and N8 combinations SBCs. - -Signed-off-by: Jagan Teki -Signed-off-by: Suniel Mahesh -Link: https://lore.kernel.org/r/20200720110230.367985-2-jagan@amarulasolutions.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit d0cb2f30e7c033f0a8bbe98ec73dbc1db4788942) ---- - arch/arm/boot/dts/rk3288-vmarc-som.dtsi | 10 ++++++++++ - arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi | 20 ++++++++++++++++++++ - .../arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi | 12 ++++++++++++ - 3 files changed, 42 insertions(+) - -diff --git a/arch/arm/boot/dts/rk3288-vmarc-som.dtsi b/arch/arm/boot/dts/rk3288-vmarc-som.dtsi -index 78164d117248..4a373f5aa600 100644 ---- a/arch/arm/boot/dts/rk3288-vmarc-som.dtsi -+++ b/arch/arm/boot/dts/rk3288-vmarc-som.dtsi -@@ -38,6 +38,12 @@ - snps,reset-gpio = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>; - }; - -+&hdmi { -+ ddc-i2c-bus = <&i2c5>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hdmi_cec_c0>; -+}; -+ - &i2c0 { - clock-frequency = <400000>; - status = "okay"; -@@ -225,6 +231,10 @@ - }; - }; - -+&i2c5 { -+ status = "okay"; -+}; -+ - &io_domains { - bb-supply = <&vcc_io>; - flash0-supply = <&vccio_flash>; -diff --git a/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi b/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi -index d2b6ead148a2..26b53eac4706 100644 ---- a/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi -+++ b/arch/arm/boot/dts/rockchip-radxa-dalang-carrier.dtsi -@@ -66,6 +66,10 @@ - status = "okay"; - }; - -+&hdmi { -+ status = "okay"; -+}; -+ - &pwm0 { - status = "okay"; - }; -@@ -94,3 +98,19 @@ - &uart2 { - status = "okay"; - }; -+ -+&vopb { -+ status = "okay"; -+}; -+ -+&vopb_mmu { -+ status = "okay"; -+}; -+ -+&vopl { -+ status = "okay"; -+}; -+ -+&vopl_mmu { -+ status = "okay"; -+}; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi b/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -index 111d6cf9a4e6..ebccc4a153a2 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -@@ -39,6 +39,12 @@ - snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; - }; - -+&hdmi { -+ ddc-i2c-bus = <&i2c3>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hdmi_cec>; -+}; -+ - &i2c0 { - clock-frequency = <400000>; - i2c-scl-falling-time-ns = <30>; -@@ -285,6 +291,12 @@ - }; - }; - -+&i2c3 { -+ i2c-scl-rising-time-ns = <450>; -+ i2c-scl-falling-time-ns = <15>; -+ status = "okay"; -+}; -+ - &io_domains { - status = "okay"; - bt656-supply = <&vcca_1v8>; - -From 5cce5ce7244c4d34004176fc9887d9217e98b09c Mon Sep 17 00:00:00 2001 -From: Jagan Teki -Date: Mon, 20 Jul 2020 16:32:30 +0530 -Subject: [PATCH] arm64: dts: rockchip: Add PCIe for RockPI N10 - -This patch adds support to enable PCIe for RockPI N10. - -Signed-off-by: Jagan Teki -Link: https://lore.kernel.org/r/20200720110230.367985-3-jagan@amarulasolutions.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit 93ca8ac2e8fcea6feb02a40edd2334144b62fc6e) ---- - .../boot/dts/rockchip/rk3399pro-vmarc-som.dtsi | 40 ++++++++++++++++++++-- - 1 file changed, 38 insertions(+), 2 deletions(-) - -diff --git a/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi b/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -index ebccc4a153a2..5d087be04af8 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi -@@ -11,6 +11,18 @@ - - / { - compatible = "vamrs,rk3399pro-vmarc-som", "rockchip,rk3399pro"; -+ -+ vcc3v3_pcie: vcc-pcie-regulator { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpio = <&gpio4 RK_PD4 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pcie_pwr>; -+ regulator-name = "vcc3v3_pcie"; -+ regulator-always-on; -+ regulator-boot-on; -+ vin-supply = <&vcc5v0_sys>; -+ }; - }; - - &cpu_l0 { -@@ -142,7 +154,8 @@ - regulator-min-microvolt = <900000>; - regulator-max-microvolt = <900000>; - regulator-state-mem { -- regulator-off-in-suspend; -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <900000>; - }; - }; - -@@ -177,7 +190,8 @@ - regulator-min-microvolt = <1850000>; - regulator-max-microvolt = <1850000>; - regulator-state-mem { -- regulator-off-in-suspend; -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <1850000>; - }; - }; - -@@ -304,6 +318,22 @@ - sdmmc-supply = <&vccio_sd>; - }; - -+&pcie_phy { -+ status = "okay"; -+}; -+ -+&pcie0 { -+ ep-gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>; -+ max-link-speed = <2>; -+ num-lanes = <4>; -+ pinctrl-0 = <&pcie_clkreqnb_cpm>; -+ pinctrl-names = "default"; -+ vpcie0v9-supply = <&vcca_0v9>; /* VCC_0V9_S0 */ -+ vpcie1v8-supply = <&vcca_1v8>; /* VCC_1V8_S0 */ -+ vpcie3v3-supply = <&vcc3v3_pcie>; -+ status = "okay"; -+}; -+ - &pinctrl { - hym8563 { - hym8563_int: hym8563-int { -@@ -311,6 +341,12 @@ - }; - }; - -+ pcie { -+ pcie_pwr: pcie-pwr { -+ rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+ - pmic { - pmic_int_l: pmic-int-l { - rockchip,pins = <1 RK_PC2 0 &pcfg_pull_up>; - -From 09a6626e55ac70435dbad23fb461d930d1c34a30 Mon Sep 17 00:00:00 2001 -From: Katsuhiro Suzuki -Date: Sat, 25 Jul 2020 00:59:33 +0900 -Subject: [PATCH] ASoC: convert Everest ES8316 binding to yaml - -This patch converts Everest Semiconductor ES8316 low power audio -CODEC binding to DT schema. - -Signed-off-by: Katsuhiro Suzuki -Reviewed-by: Rob Herring -Link: https://lore.kernel.org/r/20200724155933.1040501-1-katsuhiro@katsuster.net -Signed-off-by: Mark Brown -(cherry picked from commit 92e67a9c4f206dc9c859c405e67448a8be59ac5d) ---- - .../devicetree/bindings/sound/everest,es8316.txt | 23 ---------- - .../devicetree/bindings/sound/everest,es8316.yaml | 50 ++++++++++++++++++++++ - 2 files changed, 50 insertions(+), 23 deletions(-) - delete mode 100644 Documentation/devicetree/bindings/sound/everest,es8316.txt - create mode 100644 Documentation/devicetree/bindings/sound/everest,es8316.yaml - -diff --git a/Documentation/devicetree/bindings/sound/everest,es8316.txt b/Documentation/devicetree/bindings/sound/everest,es8316.txt -deleted file mode 100644 -index 1bf03c5f2af4..000000000000 ---- a/Documentation/devicetree/bindings/sound/everest,es8316.txt -+++ /dev/null -@@ -1,23 +0,0 @@ --Everest ES8316 audio CODEC -- --This device supports both I2C and SPI. -- --Required properties: -- -- - compatible : should be "everest,es8316" -- - reg : the I2C address of the device for I2C -- --Optional properties: -- -- - clocks : a list of phandle, should contain entries for clock-names -- - clock-names : should include as follows: -- "mclk" : master clock (MCLK) of the device -- --Example: -- --es8316: codec@11 { -- compatible = "everest,es8316"; -- reg = <0x11>; -- clocks = <&clks 10>; -- clock-names = "mclk"; --}; -diff --git a/Documentation/devicetree/bindings/sound/everest,es8316.yaml b/Documentation/devicetree/bindings/sound/everest,es8316.yaml -new file mode 100644 -index 000000000000..3b752bba748b ---- /dev/null -+++ b/Documentation/devicetree/bindings/sound/everest,es8316.yaml -@@ -0,0 +1,50 @@ -+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) -+%YAML 1.2 -+--- -+$id: http://devicetree.org/schemas/sound/everest,es8316.yaml# -+$schema: http://devicetree.org/meta-schemas/core.yaml# -+ -+title: Everest ES8316 audio CODEC -+ -+maintainers: -+ - Daniel Drake -+ - Katsuhiro Suzuki -+ -+properties: -+ compatible: -+ const: everest,es8316 -+ -+ reg: -+ maxItems: 1 -+ -+ clocks: -+ items: -+ - description: clock for master clock (MCLK) -+ -+ clock-names: -+ items: -+ - const: mclk -+ -+ "#sound-dai-cells": -+ const: 0 -+ -+required: -+ - compatible -+ - reg -+ - "#sound-dai-cells" -+ -+additionalProperties: false -+ -+examples: -+ - | -+ i2c0 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ es8316: codec@11 { -+ compatible = "everest,es8316"; -+ reg = <0x11>; -+ clocks = <&clks 10>; -+ clock-names = "mclk"; -+ #sound-dai-cells = <0>; -+ }; -+ }; - -From caea25a96e707f4bd13e3dc35d3016c9842cebe4 Mon Sep 17 00:00:00 2001 -From: Alper Nebi Yasak -Date: Tue, 21 Jul 2020 21:27:10 +0300 -Subject: [PATCH] ASoC: rk3399_gru_sound: Add DAPM pins, kcontrols for jack - detection - -PulseAudio (and perhaps other userspace utilities) can not detect any -jack for rk3399_gru_sound as the driver doesn't expose related Jack -kcontrols. - -This patch adds two DAPM pins to the headset jack, where the -snd_soc_card_jack_new() call automatically creates "Headphones Jack" and -"Headset Mic Jack" kcontrols from them. - -With an appropriate ALSA UCM config specifying JackControl fields for -the "Headphones" and "Headset" (mic) devices, PulseAudio can detect -plug/unplug events for both of them after this patch. - -Signed-off-by: Alper Nebi Yasak -Link: https://lore.kernel.org/r/20200721182709.6895-1-alpernebiyasak@gmail.com -Signed-off-by: Mark Brown -(cherry picked from commit d0508b4f16049a658d68a7c276ba08296c5a76bc) ---- - sound/soc/rockchip/rk3399_gru_sound.c | 17 ++++++++++++++++- - 1 file changed, 16 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c -index 9539b0d024fe..3e45179638ca 100644 ---- a/sound/soc/rockchip/rk3399_gru_sound.c -+++ b/sound/soc/rockchip/rk3399_gru_sound.c -@@ -32,6 +32,19 @@ static unsigned int dmic_wakeup_delay; - - static struct snd_soc_jack rockchip_sound_jack; - -+/* Headset jack detection DAPM pins */ -+static struct snd_soc_jack_pin rockchip_sound_jack_pins[] = { -+ { -+ .pin = "Headphones", -+ .mask = SND_JACK_HEADPHONE, -+ }, -+ { -+ .pin = "Headset Mic", -+ .mask = SND_JACK_MICROPHONE, -+ }, -+ -+}; -+ - static const struct snd_soc_dapm_widget rockchip_dapm_widgets[] = { - SND_SOC_DAPM_HP("Headphones", NULL), - SND_SOC_DAPM_SPK("Speakers", NULL), -@@ -176,7 +189,9 @@ static int rockchip_sound_da7219_init(struct snd_soc_pcm_runtime *rtd) - SND_JACK_HEADSET | SND_JACK_LINEOUT | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3, -- &rockchip_sound_jack, NULL, 0); -+ &rockchip_sound_jack, -+ rockchip_sound_jack_pins, -+ ARRAY_SIZE(rockchip_sound_jack_pins)); - - if (ret) { - dev_err(rtd->card->dev, "New Headset Jack failed! (%d)\n", ret); diff --git a/projects/Rockchip/patches/linux/default/linux-0002-rockchip-from-next.patch b/projects/Rockchip/patches/linux/default/linux-0002-rockchip-from-next.patch deleted file mode 100644 index 17a5bb140a..0000000000 --- a/projects/Rockchip/patches/linux/default/linux-0002-rockchip-from-next.patch +++ /dev/null @@ -1,434 +0,0 @@ -From f916206d652ac8c3bf9757891b224739a71ebd08 Mon Sep 17 00:00:00 2001 -From: Heiko Stuebner -Date: Wed, 29 Jan 2020 17:38:19 +0100 -Subject: [PATCH] clk: rockchip: convert rk3399 pll type to use - readl_relaxed_poll_timeout - -Instead of open coding the polling of the lock status, use the handy -readl_relaxed_poll_timeout for this. As the pll locking is normally -blazingly fast and we don't want to incur additional delays, we're -not doing any sleeps similar to for example the imx clk-pllv4 -and define a very safe but still short timeout of 1ms. - -Suggested-by: Stephen Boyd -Signed-off-by: Heiko Stuebner -Reviewed-by: Stephen Boyd -Link: https://lore.kernel.org/r/20200129163821.1547295-1-heiko@sntech.de -(cherry picked from commit bf4237a188f872e535de8cbfc7903c1387b83b01) ---- - drivers/clk/rockchip/clk-pll.c | 23 ++++++++++++----------- - 1 file changed, 12 insertions(+), 11 deletions(-) - -diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c -index 10560d963baf..28b04aad31ad 100644 ---- a/drivers/clk/rockchip/clk-pll.c -+++ b/drivers/clk/rockchip/clk-pll.c -@@ -589,19 +589,20 @@ static const struct clk_ops rockchip_rk3066_pll_clk_ops = { - static int rockchip_rk3399_pll_wait_lock(struct rockchip_clk_pll *pll) - { - u32 pllcon; -- int delay = 24000000; -+ int ret; - -- /* poll check the lock status in rk3399 xPLLCON2 */ -- while (delay > 0) { -- pllcon = readl_relaxed(pll->reg_base + RK3399_PLLCON(2)); -- if (pllcon & RK3399_PLLCON2_LOCK_STATUS) -- return 0; -+ /* -+ * Lock time typical 250, max 500 input clock cycles @24MHz -+ * So define a very safe maximum of 1000us, meaning 24000 cycles. -+ */ -+ ret = readl_relaxed_poll_timeout(pll->reg_base + RK3399_PLLCON(2), -+ pllcon, -+ pllcon & RK3399_PLLCON2_LOCK_STATUS, -+ 0, 1000); -+ if (ret) -+ pr_err("%s: timeout waiting for pll to lock\n", __func__); - -- delay--; -- } -- -- pr_err("%s: timeout waiting for pll to lock\n", __func__); -- return -ETIMEDOUT; -+ return ret; - } - - static void rockchip_rk3399_pll_get_params(struct rockchip_clk_pll *pll, - -From 75fe2528cfc9d96d885cebca24d7d16f09e90697 Mon Sep 17 00:00:00 2001 -From: Heiko Stuebner -Date: Wed, 29 Jan 2020 17:38:20 +0100 -Subject: [PATCH] clk: rockchip: convert basic pll lock_wait to use - regmap_read_poll_timeout - -Instead of open coding the polling of the lock status, use the -handy regmap_read_poll_timeout for this. As the pll locking is -normally blazingly fast and we don't want to incur additional -delays, we're not doing any sleeps similar to for example the imx -clk-pllv4 and define a very safe but still short timeout of 1ms. - -Suggested-by: Stephen Boyd -Signed-off-by: Heiko Stuebner -Reviewed-by: Stephen Boyd -Link: https://lore.kernel.org/r/20200129163821.1547295-2-heiko@sntech.de -(cherry picked from commit 3507df1a4615113ae6509e0f14f6546f0d1c84b4) ---- - drivers/clk/rockchip/clk-pll.c | 21 ++++++--------------- - 1 file changed, 6 insertions(+), 15 deletions(-) - -diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c -index 28b04aad31ad..945f8b2cacc1 100644 ---- a/drivers/clk/rockchip/clk-pll.c -+++ b/drivers/clk/rockchip/clk-pll.c -@@ -86,23 +86,14 @@ static int rockchip_pll_wait_lock(struct rockchip_clk_pll *pll) - { - struct regmap *grf = pll->ctx->grf; - unsigned int val; -- int delay = 24000000, ret; -- -- while (delay > 0) { -- ret = regmap_read(grf, pll->lock_offset, &val); -- if (ret) { -- pr_err("%s: failed to read pll lock status: %d\n", -- __func__, ret); -- return ret; -- } -+ int ret; - -- if (val & BIT(pll->lock_shift)) -- return 0; -- delay--; -- } -+ ret = regmap_read_poll_timeout(grf, pll->lock_offset, val, -+ val & BIT(pll->lock_shift), 0, 1000); -+ if (ret) -+ pr_err("%s: timeout waiting for pll to lock\n", __func__); - -- pr_err("%s: timeout waiting for pll to lock\n", __func__); -- return -ETIMEDOUT; -+ return ret; - } - - /** - -From e3e19d6127b1e323cb6236d1c2bd10c9c405c2b6 Mon Sep 17 00:00:00 2001 -From: Heiko Stuebner -Date: Wed, 29 Jan 2020 17:38:21 +0100 -Subject: [PATCH] clk: rockchip: convert rk3036 pll type to use internal lock - status - -The rk3036 pll type exposes its lock status in both its pllcon registers -as well as the General Register Files. To remove one dependency convert -it to the "internal" lock status, similar to how rk3399 handles it. - -Signed-off-by: Heiko Stuebner -Reviewed-by: Stephen Boyd -Link: https://lore.kernel.org/r/20200129163821.1547295-3-heiko@sntech.de -(cherry picked from commit 7f6ffbb885d147557bdca471c37b7b1204005798) ---- - drivers/clk/rockchip/clk-pll.c | 26 +++++++++++++++++++++++--- - 1 file changed, 23 insertions(+), 3 deletions(-) - -diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c -index 945f8b2cacc1..4c6c9167ef50 100644 ---- a/drivers/clk/rockchip/clk-pll.c -+++ b/drivers/clk/rockchip/clk-pll.c -@@ -12,6 +12,7 @@ - #include - #include - #include -+#include - #include - #include - #include "clk.h" -@@ -109,12 +110,31 @@ static int rockchip_pll_wait_lock(struct rockchip_clk_pll *pll) - #define RK3036_PLLCON1_REFDIV_SHIFT 0 - #define RK3036_PLLCON1_POSTDIV2_MASK 0x7 - #define RK3036_PLLCON1_POSTDIV2_SHIFT 6 -+#define RK3036_PLLCON1_LOCK_STATUS BIT(10) - #define RK3036_PLLCON1_DSMPD_MASK 0x1 - #define RK3036_PLLCON1_DSMPD_SHIFT 12 -+#define RK3036_PLLCON1_PWRDOWN BIT(13) - #define RK3036_PLLCON2_FRAC_MASK 0xffffff - #define RK3036_PLLCON2_FRAC_SHIFT 0 - --#define RK3036_PLLCON1_PWRDOWN (1 << 13) -+static int rockchip_rk3036_pll_wait_lock(struct rockchip_clk_pll *pll) -+{ -+ u32 pllcon; -+ int ret; -+ -+ /* -+ * Lock time typical 250, max 500 input clock cycles @24MHz -+ * So define a very safe maximum of 1000us, meaning 24000 cycles. -+ */ -+ ret = readl_relaxed_poll_timeout(pll->reg_base + RK3036_PLLCON(1), -+ pllcon, -+ pllcon & RK3036_PLLCON1_LOCK_STATUS, -+ 0, 1000); -+ if (ret) -+ pr_err("%s: timeout waiting for pll to lock\n", __func__); -+ -+ return ret; -+} - - static void rockchip_rk3036_pll_get_params(struct rockchip_clk_pll *pll, - struct rockchip_pll_rate_table *rate) -@@ -212,7 +232,7 @@ static int rockchip_rk3036_pll_set_params(struct rockchip_clk_pll *pll, - writel_relaxed(pllcon, pll->reg_base + RK3036_PLLCON(2)); - - /* wait for the pll to lock */ -- ret = rockchip_pll_wait_lock(pll); -+ ret = rockchip_rk3036_pll_wait_lock(pll); - if (ret) { - pr_warn("%s: pll update unsuccessful, trying to restore old params\n", - __func__); -@@ -251,7 +271,7 @@ static int rockchip_rk3036_pll_enable(struct clk_hw *hw) - - writel(HIWORD_UPDATE(0, RK3036_PLLCON1_PWRDOWN, 0), - pll->reg_base + RK3036_PLLCON(1)); -- rockchip_pll_wait_lock(pll); -+ rockchip_rk3036_pll_wait_lock(pll); - - return 0; - } - -From 49b2aa801327bfab69916ef87eb942c56b2ada88 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Myl=C3=A8ne=20Josserand?= -Date: Tue, 2 Jun 2020 10:06:43 +0200 -Subject: [PATCH] clk: rockchip: Handle clock tree for rk3288w variant -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The revision rk3288w has a different clock tree about "hclk_vio" -clock, according to the BSP kernel code. - -This patch handles this difference by detecting which device-tree -we are using. If it is a "rockchip,rk3288-cru", let's register -the clock tree as it was before. If the device-tree node is -"rockchip,rk3288w-cru", we will apply the difference with this -version of this SoC. - -Noticed that this new device-tree compatible must be handled in -bootloader such as u-boot. - -Signed-off-by: Mylène Josserand -Link: https://lore.kernel.org/r/20200602080644.11333-2-mylene.josserand@collabora.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit 1627f683636df70fb25358b0a7b39a24e8fce5bf) ---- - drivers/clk/rockchip/clk-rk3288.c | 20 ++++++++++++++++++-- - 1 file changed, 18 insertions(+), 2 deletions(-) - -diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c -index cc2a177bbdbf..204976e2d0cb 100644 ---- a/drivers/clk/rockchip/clk-rk3288.c -+++ b/drivers/clk/rockchip/clk-rk3288.c -@@ -425,8 +425,6 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { - COMPOSITE(0, "aclk_vio0", mux_pll_src_cpll_gpll_usb480m_p, CLK_IGNORE_UNUSED, - RK3288_CLKSEL_CON(31), 6, 2, MFLAGS, 0, 5, DFLAGS, - RK3288_CLKGATE_CON(3), 0, GFLAGS), -- DIV(0, "hclk_vio", "aclk_vio0", 0, -- RK3288_CLKSEL_CON(28), 8, 5, DFLAGS), - COMPOSITE(0, "aclk_vio1", mux_pll_src_cpll_gpll_usb480m_p, CLK_IGNORE_UNUSED, - RK3288_CLKSEL_CON(31), 14, 2, MFLAGS, 8, 5, DFLAGS, - RK3288_CLKGATE_CON(3), 2, GFLAGS), -@@ -819,6 +817,16 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { - INVERTER(0, "pclk_isp", "pclk_isp_in", RK3288_CLKSEL_CON(29), 3, IFLAGS), - }; - -+static struct rockchip_clk_branch rk3288w_hclkvio_branch[] __initdata = { -+ DIV(0, "hclk_vio", "aclk_vio1", 0, -+ RK3288_CLKSEL_CON(28), 8, 5, DFLAGS), -+}; -+ -+static struct rockchip_clk_branch rk3288_hclkvio_branch[] __initdata = { -+ DIV(0, "hclk_vio", "aclk_vio0", 0, -+ RK3288_CLKSEL_CON(28), 8, 5, DFLAGS), -+}; -+ - static const char *const rk3288_critical_clocks[] __initconst = { - "aclk_cpu", - "aclk_peri", -@@ -936,6 +944,14 @@ static void __init rk3288_clk_init(struct device_node *np) - RK3288_GRF_SOC_STATUS1); - rockchip_clk_register_branches(ctx, rk3288_clk_branches, - ARRAY_SIZE(rk3288_clk_branches)); -+ -+ if (of_device_is_compatible(np, "rockchip,rk3288w-cru")) -+ rockchip_clk_register_branches(ctx, rk3288w_hclkvio_branch, -+ ARRAY_SIZE(rk3288w_hclkvio_branch)); -+ else -+ rockchip_clk_register_branches(ctx, rk3288_hclkvio_branch, -+ ARRAY_SIZE(rk3288_hclkvio_branch)); -+ - rockchip_clk_protect_critical(rk3288_critical_clocks, - ARRAY_SIZE(rk3288_critical_clocks)); - - -From 3559f1d09de0bc44790de8a71ae7978bb79e73d6 Mon Sep 17 00:00:00 2001 -From: Heiko Stuebner -Date: Fri, 3 Jul 2020 17:49:48 +0200 -Subject: [PATCH] clk: rockchip: use separate compatibles for rk3288w-cru - -Commit 1627f683636d ("clk: rockchip: Handle clock tree for rk3288w variant") -added the check for rk3288w-specific clock-tree changes but in turn would -require a double-compatible due to re-using the main rockchip,rk3288-cru -compatible as entry point. - -The binding change actually describes the compatibles as one or the other -so adapt the code accordingly and add a real second entry-point for the -clock controller. - -Signed-off-by: Heiko Stuebner -Reviewed-by: Ezequiel Garcia -Reviewed-by: Jagan Teki -Tested-by: Jagan Teki # rock-pi-n8 -Link: https://lore.kernel.org/r/20200703154948.260369-1-heiko@sntech.de -(cherry picked from commit 0a7f99aad259d223ce69c03e792c7e2bfcf8c2c6) ---- - drivers/clk/rockchip/clk-rk3288.c | 21 +++++++++++++++++++-- - 1 file changed, 19 insertions(+), 2 deletions(-) - -diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c -index 204976e2d0cb..93c794695c46 100644 ---- a/drivers/clk/rockchip/clk-rk3288.c -+++ b/drivers/clk/rockchip/clk-rk3288.c -@@ -15,6 +15,11 @@ - #define RK3288_GRF_SOC_CON(x) (0x244 + x * 4) - #define RK3288_GRF_SOC_STATUS1 0x284 - -+enum rk3288_variant { -+ RK3288_CRU, -+ RK3288W_CRU, -+}; -+ - enum rk3288_plls { - apll, dpll, cpll, gpll, npll, - }; -@@ -922,7 +927,8 @@ static struct syscore_ops rk3288_clk_syscore_ops = { - .resume = rk3288_clk_resume, - }; - --static void __init rk3288_clk_init(struct device_node *np) -+static void __init rk3288_common_init(struct device_node *np, -+ enum rk3288_variant soc) - { - struct rockchip_clk_provider *ctx; - -@@ -945,7 +951,7 @@ static void __init rk3288_clk_init(struct device_node *np) - rockchip_clk_register_branches(ctx, rk3288_clk_branches, - ARRAY_SIZE(rk3288_clk_branches)); - -- if (of_device_is_compatible(np, "rockchip,rk3288w-cru")) -+ if (soc == RK3288W_CRU) - rockchip_clk_register_branches(ctx, rk3288w_hclkvio_branch, - ARRAY_SIZE(rk3288w_hclkvio_branch)); - else -@@ -970,4 +976,15 @@ static void __init rk3288_clk_init(struct device_node *np) - - rockchip_clk_of_add_provider(np, ctx); - } -+ -+static void __init rk3288_clk_init(struct device_node *np) -+{ -+ rk3288_common_init(np, RK3288_CRU); -+} - CLK_OF_DECLARE(rk3288_cru, "rockchip,rk3288-cru", rk3288_clk_init); -+ -+static void __init rk3288w_clk_init(struct device_node *np) -+{ -+ rk3288_common_init(np, RK3288W_CRU); -+} -+CLK_OF_DECLARE(rk3288w_cru, "rockchip,rk3288w-cru", rk3288w_clk_init); - -From 785f0d7bf291f2939c9f5c0c2248d89849ff8fb8 Mon Sep 17 00:00:00 2001 -From: Robin Murphy -Date: Thu, 18 Jun 2020 18:56:29 +0100 -Subject: [PATCH] clk: rockchip: Revert "fix wrong mmc sample phase shift for - rk3328" - -This reverts commit 82f4b67f018c88a7cc9337f0067ed3d6ec352648. - -According to a subsequent revert in the vendor kernel, the original -change was based on unclear documentation and was in fact incorrect. - -Emprically, my board's HS200 eMMC at 200MHZ apparently gets lucky with a -phase where this had no impact, but limiting max-frequency to 150MHz to -match the nominal capability of the I/O pins made it virtually unusable, -constantly throwing errors and retuning. With this revert, it starts -behaving perfectly at 150MHz too. - -Fixes: 82f4b67f018c ("clk: rockchip: fix wrong mmc sample phase shift for rk3328") -Signed-off-by: Robin Murphy -Reviewed-by: Shawn Lin -Link: https://lore.kernel.org/r/c80eb52e34c03f817586b6b7912fbd4e31be9079.1589475794.git.robin.murphy@arm.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit 465931e70881476a210d44705102ef8b6ee6cdb0) ---- - drivers/clk/rockchip/clk-rk3328.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/drivers/clk/rockchip/clk-rk3328.c b/drivers/clk/rockchip/clk-rk3328.c -index c186a1985bf4..2429b7c2a8b3 100644 ---- a/drivers/clk/rockchip/clk-rk3328.c -+++ b/drivers/clk/rockchip/clk-rk3328.c -@@ -808,22 +808,22 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = { - MMC(SCLK_SDMMC_DRV, "sdmmc_drv", "clk_sdmmc", - RK3328_SDMMC_CON0, 1), - MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "clk_sdmmc", -- RK3328_SDMMC_CON1, 0), -+ RK3328_SDMMC_CON1, 1), - - MMC(SCLK_SDIO_DRV, "sdio_drv", "clk_sdio", - RK3328_SDIO_CON0, 1), - MMC(SCLK_SDIO_SAMPLE, "sdio_sample", "clk_sdio", -- RK3328_SDIO_CON1, 0), -+ RK3328_SDIO_CON1, 1), - - MMC(SCLK_EMMC_DRV, "emmc_drv", "clk_emmc", - RK3328_EMMC_CON0, 1), - MMC(SCLK_EMMC_SAMPLE, "emmc_sample", "clk_emmc", -- RK3328_EMMC_CON1, 0), -+ RK3328_EMMC_CON1, 1), - - MMC(SCLK_SDMMC_EXT_DRV, "sdmmc_ext_drv", "clk_sdmmc_ext", - RK3328_SDMMC_EXT_CON0, 1), - MMC(SCLK_SDMMC_EXT_SAMPLE, "sdmmc_ext_sample", "clk_sdmmc_ext", -- RK3328_SDMMC_EXT_CON1, 0), -+ RK3328_SDMMC_EXT_CON1, 1), - }; - - static const char *const rk3328_critical_clocks[] __initconst = { - -From e1e87d6b234a855b1a7adcec8d32ad8b87047c2e Mon Sep 17 00:00:00 2001 -From: Alex Bee -Date: Wed, 22 Jul 2020 18:18:20 +0200 -Subject: [PATCH] clk: rockchip: add sclk_mac_lbtest to rk3188_critical_clocks - -Since the loopbacktest clock is not exported and is not touched in the -driver, it has to be added to rk3188_critical_clocks to be protected from -being disabled and in order to get the emac working. - -Signed-off-by: Alex Bee -Link: https://lore.kernel.org/r/20200722161820.5316-1-knaerzche@gmail.com -Signed-off-by: Heiko Stuebner -(cherry picked from commit ef990bcad58cf1d13c5a49191a2c2342eb8d6709) ---- - drivers/clk/rockchip/clk-rk3188.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/clk/rockchip/clk-rk3188.c b/drivers/clk/rockchip/clk-rk3188.c -index 77aebfb1d6d5..730020fcc7fe 100644 ---- a/drivers/clk/rockchip/clk-rk3188.c -+++ b/drivers/clk/rockchip/clk-rk3188.c -@@ -751,6 +751,7 @@ static const char *const rk3188_critical_clocks[] __initconst = { - "pclk_peri", - "hclk_cpubus", - "hclk_vio_bus", -+ "sclk_mac_lbtest", - }; - - static struct rockchip_clk_provider *__init rk3188_common_clk_init(struct device_node *np) diff --git a/projects/Rockchip/patches/linux/default/linux-0011-v4l2-from-5.10.patch b/projects/Rockchip/patches/linux/default/linux-0011-v4l2-from-5.10.patch new file mode 100644 index 0000000000..09f59e4bd8 --- /dev/null +++ b/projects/Rockchip/patches/linux/default/linux-0011-v4l2-from-5.10.patch @@ -0,0 +1,2712 @@ +From aac4c6e6f64b7bc56f8265cba1374a01322e3262 Mon Sep 17 00:00:00 2001 +From: Pi-Hsun Shih +Date: Fri, 14 Aug 2020 09:11:40 +0200 +Subject: [PATCH] media: v4l2-mem2mem: add v4l2_m2m_suspend, v4l2_m2m_resume + +Add two functions that can be used to stop new jobs from being queued / +continue running queued job. This can be used while a driver using m2m +helper is going to suspend / wake up from resume, and can ensure that +there's no job running in suspend process. + +Signed-off-by: Pi-Hsun Shih +Signed-off-by: Jerry-ch Chen +Reviewed-by: Tomasz Figa +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit 911ea8ec42dea0e28083a6e92b1b4a5a0ad5acca) +--- + drivers/media/v4l2-core/v4l2-mem2mem.c | 41 ++++++++++++++++++++++++++++++++++ + include/media/v4l2-mem2mem.h | 22 ++++++++++++++++++ + 2 files changed, 63 insertions(+) + +diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c +index 95a8f2dc5341..6a80240e9228 100644 +--- a/drivers/media/v4l2-core/v4l2-mem2mem.c ++++ b/drivers/media/v4l2-core/v4l2-mem2mem.c +@@ -43,6 +43,10 @@ module_param(debug, bool, 0644); + #define TRANS_ABORT (1 << 2) + + ++/* The job queue is not running new jobs */ ++#define QUEUE_PAUSED (1 << 0) ++ ++ + /* Offset base for buffers on the destination queue - used to distinguish + * between source and destination buffers when mmapping - they receive the same + * offsets but for different queues */ +@@ -84,6 +88,7 @@ static const char * const m2m_entity_name[] = { + * @job_queue: instances queued to run + * @job_spinlock: protects job_queue + * @job_work: worker to run queued jobs. ++ * @job_queue_flags: flags of the queue status, %QUEUE_PAUSED. + * @m2m_ops: driver callbacks + */ + struct v4l2_m2m_dev { +@@ -101,6 +106,7 @@ struct v4l2_m2m_dev { + struct list_head job_queue; + spinlock_t job_spinlock; + struct work_struct job_work; ++ unsigned long job_queue_flags; + + const struct v4l2_m2m_ops *m2m_ops; + }; +@@ -263,6 +269,12 @@ static void v4l2_m2m_try_run(struct v4l2_m2m_dev *m2m_dev) + return; + } + ++ if (m2m_dev->job_queue_flags & QUEUE_PAUSED) { ++ spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags); ++ dprintk("Running new jobs is paused\n"); ++ return; ++ } ++ + m2m_dev->curr_ctx = list_first_entry(&m2m_dev->job_queue, + struct v4l2_m2m_ctx, queue); + m2m_dev->curr_ctx->job_flags |= TRANS_RUNNING; +@@ -504,6 +516,7 @@ void v4l2_m2m_buf_done_and_job_finish(struct v4l2_m2m_dev *m2m_dev, + + if (WARN_ON(!src_buf || !dst_buf)) + goto unlock; ++ v4l2_m2m_buf_done(src_buf, state); + dst_buf->is_held = src_buf->flags & V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF; + if (!dst_buf->is_held) { + v4l2_m2m_dst_buf_remove(m2m_ctx); +@@ -528,6 +541,34 @@ void v4l2_m2m_buf_done_and_job_finish(struct v4l2_m2m_dev *m2m_dev, + } + EXPORT_SYMBOL(v4l2_m2m_buf_done_and_job_finish); + ++void v4l2_m2m_suspend(struct v4l2_m2m_dev *m2m_dev) ++{ ++ unsigned long flags; ++ struct v4l2_m2m_ctx *curr_ctx; ++ ++ spin_lock_irqsave(&m2m_dev->job_spinlock, flags); ++ m2m_dev->job_queue_flags |= QUEUE_PAUSED; ++ curr_ctx = m2m_dev->curr_ctx; ++ spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags); ++ ++ if (curr_ctx) ++ wait_event(curr_ctx->finished, ++ !(curr_ctx->job_flags & TRANS_RUNNING)); ++} ++EXPORT_SYMBOL(v4l2_m2m_suspend); ++ ++void v4l2_m2m_resume(struct v4l2_m2m_dev *m2m_dev) ++{ ++ unsigned long flags; ++ ++ spin_lock_irqsave(&m2m_dev->job_spinlock, flags); ++ m2m_dev->job_queue_flags &= ~QUEUE_PAUSED; ++ spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags); ++ ++ v4l2_m2m_try_run(m2m_dev); ++} ++EXPORT_SYMBOL(v4l2_m2m_resume); ++ + int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, + struct v4l2_requestbuffers *reqbufs) + { +diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h +index 98753f00df7e..5a91b548ecc0 100644 +--- a/include/media/v4l2-mem2mem.h ++++ b/include/media/v4l2-mem2mem.h +@@ -304,6 +304,28 @@ v4l2_m2m_is_last_draining_src_buf(struct v4l2_m2m_ctx *m2m_ctx, + void v4l2_m2m_last_buffer_done(struct v4l2_m2m_ctx *m2m_ctx, + struct vb2_v4l2_buffer *vbuf); + ++/** ++ * v4l2_m2m_suspend() - stop new jobs from being run and wait for current job ++ * to finish ++ * ++ * @m2m_dev: opaque pointer to the internal data to handle M2M context ++ * ++ * Called by a driver in the suspend hook. Stop new jobs from being run, and ++ * wait for current running job to finish. ++ */ ++void v4l2_m2m_suspend(struct v4l2_m2m_dev *m2m_dev); ++ ++/** ++ * v4l2_m2m_resume() - resume job running and try to run a queued job ++ * ++ * @m2m_dev: opaque pointer to the internal data to handle M2M context ++ * ++ * Called by a driver in the resume hook. This reverts the operation of ++ * v4l2_m2m_suspend() and allows job to be run. Also try to run a queued job if ++ * there is any. ++ */ ++void v4l2_m2m_resume(struct v4l2_m2m_dev *m2m_dev); ++ + /** + * v4l2_m2m_reqbufs() - multi-queue-aware REQBUFS multiplexer + * + +From 3aa91cc1cdd3ca25c6c224cb5ccd601f44943d5f Mon Sep 17 00:00:00 2001 +From: Ezequiel Garcia +Date: Mon, 27 Jul 2020 19:05:37 +0200 +Subject: [PATCH] media: hantro: h264: Get the correct fallback reference + buffer + +If the bitstream and the application are incorrectly configuring +the reference pictures, the hardware will need to fallback +to using some other reference picture. + +When the post-processor is enabled, the fallback buffer +should be a shadow buffer (postproc.dec_q), and not a +CAPTURE queue buffer, since the latter is post-processed +and not really the output of the decoder core. + +Fixes: 8c2d66b036c77 ("media: hantro: Support color conversion via post-processing") +Signed-off-by: Ezequiel Garcia +Reviewed-by: Philipp Zabel +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit 6d9e8cd0553bb03e8ab9d4d2d7d17f3fb639bd86) +--- + drivers/staging/media/hantro/hantro_h264.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/staging/media/hantro/hantro_h264.c b/drivers/staging/media/hantro/hantro_h264.c +index 194d05848077..6dcd47bd9ed3 100644 +--- a/drivers/staging/media/hantro/hantro_h264.c ++++ b/drivers/staging/media/hantro/hantro_h264.c +@@ -325,7 +325,7 @@ dma_addr_t hantro_h264_get_ref_buf(struct hantro_ctx *ctx, + */ + dst_buf = hantro_get_dst_buf(ctx); + buf = &dst_buf->vb2_buf; +- dma_addr = vb2_dma_contig_plane_dma_addr(buf, 0); ++ dma_addr = hantro_get_dec_buf_addr(ctx, buf); + } + + return dma_addr; + +From 53c9bdb74ce56398ee6b17fea317a784757c642b Mon Sep 17 00:00:00 2001 +From: Ezequiel Garcia +Date: Mon, 27 Jul 2020 19:05:38 +0200 +Subject: [PATCH] media: hantro: postproc: Fix motion vector space allocation + +When the post-processor is enabled, the driver allocates +"shadow buffers" which are used for the decoder core, +and exposes the post-processed buffers to userspace. + +For this reason, extra motion vector space has to +be allocated on the shadow buffers, which the driver +wasn't doing. Fix it. + +This fix should address artifacts on high profile bitstreams. + +Fixes: 8c2d66b036c77 ("media: hantro: Support color conversion via post-processing") +Signed-off-by: Ezequiel Garcia +Reviewed-by: Philipp Zabel +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit 669ccf19ed2059b9d517664a2dbbf6bde87e1414) +--- + drivers/staging/media/hantro/hantro_postproc.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c +index 44062ffceaea..6d2a8f2a8f0b 100644 +--- a/drivers/staging/media/hantro/hantro_postproc.c ++++ b/drivers/staging/media/hantro/hantro_postproc.c +@@ -118,7 +118,9 @@ int hantro_postproc_alloc(struct hantro_ctx *ctx) + unsigned int num_buffers = cap_queue->num_buffers; + unsigned int i, buf_size; + +- buf_size = ctx->dst_fmt.plane_fmt[0].sizeimage; ++ buf_size = ctx->dst_fmt.plane_fmt[0].sizeimage + ++ hantro_h264_mv_size(ctx->dst_fmt.width, ++ ctx->dst_fmt.height); + + for (i = 0; i < num_buffers; ++i) { + struct hantro_aux_buf *priv = &ctx->postproc.dec_q[i]; + +From ea3a9782bc2717375bf236f11738c02d5148b8a8 Mon Sep 17 00:00:00 2001 +From: Jernej Skrabec +Date: Tue, 25 Aug 2020 05:52:27 +0200 +Subject: [PATCH] media: uapi: h264: Update reference lists + +When dealing with interlaced frames, reference lists must tell if +each particular reference is meant for top or bottom field. This info +is currently not provided at all in the H264 related controls. + +Change reference lists to hold a structure, which specifies +an index into the DPB array and the field/frame specification +for the picture. + +Currently the only user of these lists is Cedrus which is just compile +fixed here. Actual usage of will come in a following commit. + +Signed-off-by: Jernej Skrabec +Signed-off-by: Ezequiel Garcia +Tested-by: Jonas Karlman +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit e000e1fa4bdbd783149e7f97cf3be61e1c0bab8c) +--- + .../userspace-api/media/v4l/ext-ctrls-codec.rst | 44 +++++++++++++++++++++- + drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 6 +-- + include/media/h264-ctrls.h | 21 ++++++++--- + 3 files changed, 60 insertions(+), 11 deletions(-) + +diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +index d0d506a444b1..df1c4fc5cb48 100644 +--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst ++++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +@@ -1843,10 +1843,10 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + * - __u32 + - ``slice_group_change_cycle`` + - +- * - __u8 ++ * - struct :c:type:`v4l2_h264_reference` + - ``ref_pic_list0[32]`` + - Reference picture list after applying the per-slice modifications +- * - __u8 ++ * - struct :c:type:`v4l2_h264_reference` + - ``ref_pic_list1[32]`` + - Reference picture list after applying the per-slice modifications + * - __u32 +@@ -1926,6 +1926,46 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + - ``chroma_offset[32][2]`` + - + ++``Picture Reference`` ++ ++.. c:type:: v4l2_h264_reference ++ ++.. cssclass:: longtable ++ ++.. flat-table:: struct v4l2_h264_reference ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 1 1 2 ++ ++ * - __u8 ++ - ``fields`` ++ - Specifies how the picture is referenced. See :ref:`Reference Fields ` ++ * - __u8 ++ - ``index`` ++ - Index into the :c:type:`v4l2_ctrl_h264_decode_params`.dpb array. ++ ++.. _h264_ref_fields: ++ ++``Reference Fields`` ++ ++.. cssclass:: longtable ++ ++.. flat-table:: ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 1 1 2 ++ ++ * - ``V4L2_H264_TOP_FIELD_REF`` ++ - 0x1 ++ - The top field in field pair is used for short-term reference. ++ * - ``V4L2_H264_BOTTOM_FIELD_REF`` ++ - 0x2 ++ - The bottom field in field pair is used for short-term reference. ++ * - ``V4L2_H264_FRAME_REF`` ++ - 0x3 ++ - The frame (or the top/bottom fields, if it's a field pair) ++ is used for short-term reference. ++ + ``V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS (struct)`` + Specifies the decode parameters (as extracted from the bitstream) + for the associated H264 slice data. This includes the necessary +diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +index 54ee2aa423e2..cce527bbdf86 100644 +--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c ++++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +@@ -166,8 +166,8 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx, + + static void _cedrus_write_ref_list(struct cedrus_ctx *ctx, + struct cedrus_run *run, +- const u8 *ref_list, u8 num_ref, +- enum cedrus_h264_sram_off sram) ++ const struct v4l2_h264_reference *ref_list, ++ u8 num_ref, enum cedrus_h264_sram_off sram) + { + const struct v4l2_ctrl_h264_decode_params *decode = run->h264.decode_params; + struct vb2_queue *cap_q; +@@ -188,7 +188,7 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx, + int buf_idx; + u8 dpb_idx; + +- dpb_idx = ref_list[i]; ++ dpb_idx = ref_list[i].index; + dpb = &decode->dpb[dpb_idx]; + + if (!(dpb->flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE)) +diff --git a/include/media/h264-ctrls.h b/include/media/h264-ctrls.h +index 080fd1293c42..3c613b84e5ae 100644 +--- a/include/media/h264-ctrls.h ++++ b/include/media/h264-ctrls.h +@@ -19,6 +19,8 @@ + */ + #define V4L2_H264_NUM_DPB_ENTRIES 16 + ++#define V4L2_H264_REF_LIST_LEN (2 * V4L2_H264_NUM_DPB_ENTRIES) ++ + /* Our pixel format isn't stable at the moment */ + #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4') /* H264 parsed slices */ + +@@ -140,6 +142,17 @@ struct v4l2_h264_pred_weight_table { + #define V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED 0x04 + #define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH 0x08 + ++#define V4L2_H264_TOP_FIELD_REF 0x1 ++#define V4L2_H264_BOTTOM_FIELD_REF 0x2 ++#define V4L2_H264_FRAME_REF 0x3 ++ ++struct v4l2_h264_reference { ++ __u8 fields; ++ ++ /* Index into v4l2_ctrl_h264_decode_params.dpb[] */ ++ __u8 index; ++}; ++ + struct v4l2_ctrl_h264_slice_params { + /* Size in bytes, including header */ + __u32 size; +@@ -178,12 +191,8 @@ struct v4l2_ctrl_h264_slice_params { + __u8 num_ref_idx_l1_active_minus1; + __u32 slice_group_change_cycle; + +- /* +- * Entries on each list are indices into +- * v4l2_ctrl_h264_decode_params.dpb[]. +- */ +- __u8 ref_pic_list0[32]; +- __u8 ref_pic_list1[32]; ++ struct v4l2_h264_reference ref_pic_list0[V4L2_H264_REF_LIST_LEN]; ++ struct v4l2_h264_reference ref_pic_list1[V4L2_H264_REF_LIST_LEN]; + + __u32 flags; + }; + +From 2abf5d0e3f8c932002c0aa44f486f53e8225e1d3 Mon Sep 17 00:00:00 2001 +From: Ezequiel Garcia +Date: Tue, 25 Aug 2020 05:52:28 +0200 +Subject: [PATCH] media: uapi: h264: Further clarify scaling lists order + +Commit 0b0393d59eb4a ("media: uapi: h264: clarify +expected scaling_list_4x4/8x8 order") improved the +documentation on H264 scaling lists order. + +This commit improves the documentation by clarifying +that the lists themselves are expected in raster scan order. + +Signed-off-by: Ezequiel Garcia +Tested-by: Jonas Karlman +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit cefdf805844b551e08858971e1f64e3af378d697) +--- + Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +index df1c4fc5cb48..2cce412f5be1 100644 +--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst ++++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +@@ -1725,12 +1725,14 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + - ``scaling_list_4x4[6][16]`` + - Scaling matrix after applying the inverse scanning process. + Expected list order is Intra Y, Intra Cb, Intra Cr, Inter Y, +- Inter Cb, Inter Cr. ++ Inter Cb, Inter Cr. The values on each scaling list are ++ expected in raster scan order. + * - __u8 + - ``scaling_list_8x8[6][64]`` + - Scaling matrix after applying the inverse scanning process. + Expected list order is Intra Y, Inter Y, Intra Cb, Inter Cb, +- Intra Cr, Inter Cr. ++ Intra Cr, Inter Cr. The values on each scaling list are ++ expected in raster scan order. + + ``V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS (struct)`` + Specifies the slice parameters (as extracted from the bitstream) + +From 10ca864bd5385e820849556513562b879974bd95 Mon Sep 17 00:00:00 2001 +From: Ezequiel Garcia +Date: Tue, 25 Aug 2020 05:52:29 +0200 +Subject: [PATCH] media: uapi: h264: Split prediction weight parameters + +The prediction weight parameters are only required under +certain conditions, which depend on slice header parameters. + +As specified in section 7.3.3 Slice header syntax, the prediction +weight table is present if: + +((weighted_pred_flag && (slice_type == P || slice_type == SP)) || \ +(weighted_bipred_idc == 1 && slice_type == B)) + +Given its size, it makes sense to move this table to its control, +so applications can avoid passing it if the slice doesn't specify it. + +Before this change struct v4l2_ctrl_h264_slice_params was 960 bytes. +With this change, it's 188 bytes and struct v4l2_ctrl_h264_pred_weight +is 772 bytes. + +Signed-off-by: Ezequiel Garcia +Tested-by: Jonas Karlman +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit eb44c6c9c236b1568985816254faf520fde21776) +--- + .../userspace-api/media/v4l/ext-ctrls-codec.rst | 19 ++++++++++++------- + drivers/media/v4l2-core/v4l2-ctrls.c | 8 ++++++++ + drivers/staging/media/sunxi/cedrus/cedrus.c | 7 +++++++ + drivers/staging/media/sunxi/cedrus/cedrus.h | 1 + + drivers/staging/media/sunxi/cedrus/cedrus_dec.c | 2 ++ + drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 12 +++--------- + include/media/h264-ctrls.h | 12 ++++++++++-- + include/media/v4l2-ctrls.h | 2 ++ + 8 files changed, 45 insertions(+), 18 deletions(-) + +diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +index 2cce412f5be1..9e4421a7c6a6 100644 +--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst ++++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +@@ -1879,18 +1879,23 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + - 0x00000008 + - + +-``Prediction Weight Table`` ++``V4L2_CID_MPEG_VIDEO_H264_PRED_WEIGHTS (struct)`` ++ Prediction weight table defined according to :ref:`h264`, ++ section 7.4.3.2 "Prediction Weight Table Semantics". ++ The prediction weight table must be passed by applications ++ under the conditions explained in section 7.3.3 "Slice header ++ syntax". + +- The bitstream parameters are defined according to :ref:`h264`, +- section 7.4.3.2 "Prediction Weight Table Semantics". For further +- documentation, refer to the above specification, unless there is +- an explicit comment stating otherwise. ++ .. note:: ++ ++ This compound control is not yet part of the public kernel API and ++ it is expected to change. + +-.. c:type:: v4l2_h264_pred_weight_table ++.. c:type:: v4l2_ctrl_h264_pred_weights + + .. cssclass:: longtable + +-.. flat-table:: struct v4l2_h264_pred_weight_table ++.. flat-table:: struct v4l2_ctrl_h264_pred_weights + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 +diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c +index 45a2403aa039..ae0bf3f36c4a 100644 +--- a/drivers/media/v4l2-core/v4l2-ctrls.c ++++ b/drivers/media/v4l2-core/v4l2-ctrls.c +@@ -897,6 +897,7 @@ const char *v4l2_ctrl_get_name(u32 id) + case V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS: return "H264 Decode Parameters"; + case V4L2_CID_MPEG_VIDEO_H264_DECODE_MODE: return "H264 Decode Mode"; + case V4L2_CID_MPEG_VIDEO_H264_START_CODE: return "H264 Start Code"; ++ case V4L2_CID_MPEG_VIDEO_H264_PRED_WEIGHTS: return "H264 Prediction Weight Table"; + case V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL: return "MPEG2 Level"; + case V4L2_CID_MPEG_VIDEO_MPEG2_PROFILE: return "MPEG2 Profile"; + case V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP: return "MPEG4 I-Frame QP Value"; +@@ -1412,6 +1413,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, + case V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS: + *type = V4L2_CTRL_TYPE_H264_DECODE_PARAMS; + break; ++ case V4L2_CID_MPEG_VIDEO_H264_PRED_WEIGHTS: ++ *type = V4L2_CTRL_TYPE_H264_PRED_WEIGHTS; ++ break; + case V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER: + *type = V4L2_CTRL_TYPE_VP8_FRAME_HEADER; + break; +@@ -1790,6 +1794,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, + case V4L2_CTRL_TYPE_H264_SPS: + case V4L2_CTRL_TYPE_H264_PPS: + case V4L2_CTRL_TYPE_H264_SCALING_MATRIX: ++ case V4L2_CTRL_TYPE_H264_PRED_WEIGHTS: + case V4L2_CTRL_TYPE_H264_SLICE_PARAMS: + case V4L2_CTRL_TYPE_H264_DECODE_PARAMS: + break; +@@ -2553,6 +2558,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, + case V4L2_CTRL_TYPE_H264_DECODE_PARAMS: + elem_size = sizeof(struct v4l2_ctrl_h264_decode_params); + break; ++ case V4L2_CTRL_TYPE_H264_PRED_WEIGHTS: ++ elem_size = sizeof(struct v4l2_ctrl_h264_pred_weights); ++ break; + case V4L2_CTRL_TYPE_VP8_FRAME_HEADER: + elem_size = sizeof(struct v4l2_ctrl_vp8_frame_header); + break; +diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c +index 7c6b91f0e780..5d41d3357663 100644 +--- a/drivers/staging/media/sunxi/cedrus/cedrus.c ++++ b/drivers/staging/media/sunxi/cedrus/cedrus.c +@@ -78,6 +78,13 @@ static const struct cedrus_control cedrus_controls[] = { + .codec = CEDRUS_CODEC_H264, + .required = true, + }, ++ { ++ .cfg = { ++ .id = V4L2_CID_MPEG_VIDEO_H264_PRED_WEIGHTS, ++ }, ++ .codec = CEDRUS_CODEC_H264, ++ .required = false, ++ }, + { + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_H264_DECODE_MODE, +diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h b/drivers/staging/media/sunxi/cedrus/cedrus.h +index 96765555ab8a..93c843ae14bb 100644 +--- a/drivers/staging/media/sunxi/cedrus/cedrus.h ++++ b/drivers/staging/media/sunxi/cedrus/cedrus.h +@@ -62,6 +62,7 @@ struct cedrus_h264_run { + const struct v4l2_ctrl_h264_scaling_matrix *scaling_matrix; + const struct v4l2_ctrl_h264_slice_params *slice_params; + const struct v4l2_ctrl_h264_sps *sps; ++ const struct v4l2_ctrl_h264_pred_weights *pred_weights; + }; + + struct cedrus_mpeg2_run { +diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c +index 58c48e4fdfe9..6385026d1b6b 100644 +--- a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c ++++ b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c +@@ -57,6 +57,8 @@ void cedrus_device_run(void *priv) + V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS); + run.h264.sps = cedrus_find_control_data(ctx, + V4L2_CID_MPEG_VIDEO_H264_SPS); ++ run.h264.pred_weights = cedrus_find_control_data(ctx, ++ V4L2_CID_MPEG_VIDEO_H264_PRED_WEIGHTS); + break; + + case V4L2_PIX_FMT_HEVC_SLICE: +diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +index cce527bbdf86..d5636dbbb622 100644 +--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c ++++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +@@ -256,10 +256,8 @@ static void cedrus_write_scaling_lists(struct cedrus_ctx *ctx, + static void cedrus_write_pred_weight_table(struct cedrus_ctx *ctx, + struct cedrus_run *run) + { +- const struct v4l2_ctrl_h264_slice_params *slice = +- run->h264.slice_params; +- const struct v4l2_h264_pred_weight_table *pred_weight = +- &slice->pred_weight_table; ++ const struct v4l2_ctrl_h264_pred_weights *pred_weight = ++ run->h264.pred_weights; + struct cedrus_dev *dev = ctx->dev; + int i, j, k; + +@@ -367,11 +365,7 @@ static void cedrus_set_params(struct cedrus_ctx *ctx, + + cedrus_skip_bits(dev, slice->header_bit_size); + +- if (((pps->flags & V4L2_H264_PPS_FLAG_WEIGHTED_PRED) && +- (slice->slice_type == V4L2_H264_SLICE_TYPE_P || +- slice->slice_type == V4L2_H264_SLICE_TYPE_SP)) || +- (pps->weighted_bipred_idc == 1 && +- slice->slice_type == V4L2_H264_SLICE_TYPE_B)) ++ if (V4L2_H264_CTRL_PRED_WEIGHTS_REQUIRED(pps, slice)) + cedrus_write_pred_weight_table(ctx, run); + + if ((slice->slice_type == V4L2_H264_SLICE_TYPE_P) || +diff --git a/include/media/h264-ctrls.h b/include/media/h264-ctrls.h +index 3c613b84e5ae..31c6f4c5963b 100644 +--- a/include/media/h264-ctrls.h ++++ b/include/media/h264-ctrls.h +@@ -36,6 +36,7 @@ + #define V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS (V4L2_CID_MPEG_BASE+1004) + #define V4L2_CID_MPEG_VIDEO_H264_DECODE_MODE (V4L2_CID_MPEG_BASE+1005) + #define V4L2_CID_MPEG_VIDEO_H264_START_CODE (V4L2_CID_MPEG_BASE+1006) ++#define V4L2_CID_MPEG_VIDEO_H264_PRED_WEIGHTS (V4L2_CID_MPEG_BASE+1007) + + /* enum v4l2_ctrl_type type values */ + #define V4L2_CTRL_TYPE_H264_SPS 0x0110 +@@ -43,6 +44,7 @@ + #define V4L2_CTRL_TYPE_H264_SCALING_MATRIX 0x0112 + #define V4L2_CTRL_TYPE_H264_SLICE_PARAMS 0x0113 + #define V4L2_CTRL_TYPE_H264_DECODE_PARAMS 0x0114 ++#define V4L2_CTRL_TYPE_H264_PRED_WEIGHTS 0x0115 + + enum v4l2_mpeg_video_h264_decode_mode { + V4L2_MPEG_VIDEO_H264_DECODE_MODE_SLICE_BASED, +@@ -125,7 +127,14 @@ struct v4l2_h264_weight_factors { + __s16 chroma_offset[32][2]; + }; + +-struct v4l2_h264_pred_weight_table { ++#define V4L2_H264_CTRL_PRED_WEIGHTS_REQUIRED(pps, slice) \ ++ ((((pps)->flags & V4L2_H264_PPS_FLAG_WEIGHTED_PRED) && \ ++ ((slice)->slice_type == V4L2_H264_SLICE_TYPE_P || \ ++ (slice)->slice_type == V4L2_H264_SLICE_TYPE_SP)) || \ ++ ((pps)->weighted_bipred_idc == 1 && \ ++ (slice)->slice_type == V4L2_H264_SLICE_TYPE_B)) ++ ++struct v4l2_ctrl_h264_pred_weights { + __u16 luma_log2_weight_denom; + __u16 chroma_log2_weight_denom; + struct v4l2_h264_weight_factors weight_factors[2]; +@@ -175,7 +184,6 @@ struct v4l2_ctrl_h264_slice_params { + __s32 delta_pic_order_cnt0; + __s32 delta_pic_order_cnt1; + +- struct v4l2_h264_pred_weight_table pred_weight_table; + /* Size in bits of dec_ref_pic_marking() syntax element. */ + __u32 dec_ref_pic_marking_bit_size; + /* Size in bits of pic order count syntax. */ +diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h +index f40e2cbb21d3..cb25f345e9ad 100644 +--- a/include/media/v4l2-ctrls.h ++++ b/include/media/v4l2-ctrls.h +@@ -51,6 +51,7 @@ struct video_device; + * @p_h264_scaling_matrix: Pointer to a struct v4l2_ctrl_h264_scaling_matrix. + * @p_h264_slice_params: Pointer to a struct v4l2_ctrl_h264_slice_params. + * @p_h264_decode_params: Pointer to a struct v4l2_ctrl_h264_decode_params. ++ * @p_h264_pred_weights: Pointer to a struct v4l2_ctrl_h264_pred_weights. + * @p_vp8_frame_header: Pointer to a VP8 frame header structure. + * @p_hevc_sps: Pointer to an HEVC sequence parameter set structure. + * @p_hevc_pps: Pointer to an HEVC picture parameter set structure. +@@ -74,6 +75,7 @@ union v4l2_ctrl_ptr { + struct v4l2_ctrl_h264_scaling_matrix *p_h264_scaling_matrix; + struct v4l2_ctrl_h264_slice_params *p_h264_slice_params; + struct v4l2_ctrl_h264_decode_params *p_h264_decode_params; ++ struct v4l2_ctrl_h264_pred_weights *p_h264_pred_weights; + struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header; + struct v4l2_ctrl_hevc_sps *p_hevc_sps; + struct v4l2_ctrl_hevc_pps *p_hevc_pps; + +From b9ab1fbb981ac04f89e2a2a8c22a3e79d9089718 Mon Sep 17 00:00:00 2001 +From: Philipp Zabel +Date: Tue, 25 Aug 2020 05:52:30 +0200 +Subject: [PATCH] media: uapi: h264: Clarify pic_order_cnt_bit_size field + +Since pic_order_cnt_bit_size is not a syntax element itself, explicitly +state that it is the total size in bits of the pic_order_cnt_lsb, +delta_pic_order_cnt_bottom, delta_pic_order_cnt[0], and +delta_pic_order_cnt[1] syntax elements contained in the slice. + +[Ezequiel: rebase] + +Signed-off-by: Philipp Zabel +Signed-off-by: Ezequiel Garcia +Reviewed-by: Nicolas Dufresne +Tested-by: Jonas Karlman +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit fb92c56312d4e3a5c30de963e459a040a4761665) +--- + Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +index 9e4421a7c6a6..591d3d35c429 100644 +--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst ++++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +@@ -1815,7 +1815,9 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + - Size in bits of the dec_ref_pic_marking() syntax element. + * - __u32 + - ``pic_order_cnt_bit_size`` +- - ++ - Combined size in bits of the picture order count related syntax ++ elements: pic_order_cnt_lsb, delta_pic_order_cnt_bottom, ++ delta_pic_order_cnt0, and delta_pic_order_cnt1. + * - __u8 + - ``cabac_init_idc`` + - + +From 49086ddc8b141ed75f1023e3ebcb87a7d0c224c0 Mon Sep 17 00:00:00 2001 +From: Ezequiel Garcia +Date: Tue, 25 Aug 2020 05:52:31 +0200 +Subject: [PATCH] media: uapi: h264: Increase size of 'first_mb_in_slice' field + +Slice header syntax element 'first_mb_in_slice' can point +to the last macroblock, currently the field can only reference +65536 macroblocks which is insufficient for 8K videos. + +Although unlikely, a 8192x4320 video (where macroblocks are 16x16), +would contain 138240 macroblocks on a frame. + +As per the H264 specification, 'first_mb_in_slice' can be up to +PicSizeInMbs - 1, so increase the size of the field to 32-bits. + +Note that v4l2_ctrl_h264_slice_params struct will be modified +in a follow-up commit, and so we defer its 64-bit padding. + +Signed-off-by: Ezequiel Garcia +Tested-by: Jonas Karlman +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit 4245232fa6ca58f79710732bd16cefe78b8b8bc4) +--- + Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 2 +- + include/media/h264-ctrls.h | 3 ++- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +index 591d3d35c429..a417a1ae50d5 100644 +--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst ++++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +@@ -1774,7 +1774,7 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + * - __u32 + - ``header_bit_size`` + - +- * - __u16 ++ * - __u32 + - ``first_mb_in_slice`` + - + * - __u8 +diff --git a/include/media/h264-ctrls.h b/include/media/h264-ctrls.h +index 31c6f4c5963b..9a6722edf004 100644 +--- a/include/media/h264-ctrls.h ++++ b/include/media/h264-ctrls.h +@@ -172,7 +172,8 @@ struct v4l2_ctrl_h264_slice_params { + /* Offset in bits to slice_data() from the beginning of this slice. */ + __u32 header_bit_size; + +- __u16 first_mb_in_slice; ++ __u32 first_mb_in_slice; ++ + __u8 slice_type; + __u8 pic_parameter_set_id; + __u8 colour_plane_id; + +From d1bcf7e7272530af2327ee7c6bcbf9de3bddf697 Mon Sep 17 00:00:00 2001 +From: Ezequiel Garcia +Date: Tue, 25 Aug 2020 05:52:32 +0200 +Subject: [PATCH] media: uapi: h264: Clean DPB entry interface + +As discussed recently, the current interface for the +Decoded Picture Buffer is not enough to properly +support field coding. + +This commit introduces enough semantics to support +frame and field coding, and to signal how DPB entries +are "used for reference". + +Reserved fields will be added by a follow-up commit. + +Signed-off-by: Ezequiel Garcia +Tested-by: Jonas Karlman +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit c02ff21952a6a19ca375b9dc4f9a5609616a82b8) +--- + .../userspace-api/media/v4l/ext-ctrls-codec.rst | 24 +++++++--------------- + drivers/media/v4l2-core/v4l2-h264.c | 4 ++-- + drivers/staging/media/rkvdec/rkvdec-h264.c | 17 +++++++-------- + include/media/h264-ctrls.h | 2 +- + 4 files changed, 19 insertions(+), 28 deletions(-) + +diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +index a417a1ae50d5..49febae8fd0f 100644 +--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst ++++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +@@ -2057,6 +2057,9 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + * - __u16 + - ``pic_num`` + - ++ * - __u8 ++ - ``fields`` ++ - Specifies how the DPB entry is referenced. See :ref:`Reference Fields ` + * - __s32 + - ``top_field_order_cnt`` + - +@@ -2080,29 +2083,16 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + + * - ``V4L2_H264_DPB_ENTRY_FLAG_VALID`` + - 0x00000001 +- - The DPB entry is valid and should be considered ++ - The DPB entry is valid (non-empty) and should be considered. + * - ``V4L2_H264_DPB_ENTRY_FLAG_ACTIVE`` + - 0x00000002 +- - The DPB entry is currently being used as a reference frame ++ - The DPB entry is used for reference. + * - ``V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM`` + - 0x00000004 +- - The DPB entry is a long term reference frame ++ - The DPB entry is used for long-term reference. + * - ``V4L2_H264_DPB_ENTRY_FLAG_FIELD`` + - 0x00000008 +- - The DPB entry is a field reference, which means only one of the field +- will be used when decoding the new frame/field. When not set the DPB +- entry is a frame reference (both fields will be used). Note that this +- flag does not say anything about the number of fields contained in the +- reference frame, it just describes the one used to decode the new +- field/frame +- * - ``V4L2_H264_DPB_ENTRY_FLAG_BOTTOM_FIELD`` +- - 0x00000010 +- - The DPB entry is a bottom field reference (only the bottom field of the +- reference frame is needed to decode the new frame/field). Only valid if +- V4L2_H264_DPB_ENTRY_FLAG_FIELD is set. When +- V4L2_H264_DPB_ENTRY_FLAG_FIELD is set but +- V4L2_H264_DPB_ENTRY_FLAG_BOTTOM_FIELD is not, that means the +- DPB entry is a top field reference ++ - The DPB entry is a single field or a complementary field pair. + + ``V4L2_CID_MPEG_VIDEO_H264_DECODE_MODE (enum)`` + Specifies the decoding mode to use. Currently exposes slice-based and +diff --git a/drivers/media/v4l2-core/v4l2-h264.c b/drivers/media/v4l2-core/v4l2-h264.c +index edf6225f0522..f4742408436b 100644 +--- a/drivers/media/v4l2-core/v4l2-h264.c ++++ b/drivers/media/v4l2-core/v4l2-h264.c +@@ -66,10 +66,10 @@ v4l2_h264_init_reflist_builder(struct v4l2_h264_reflist_builder *b, + else + b->refs[i].frame_num = dpb[i].frame_num; + +- if (!(dpb[i].flags & V4L2_H264_DPB_ENTRY_FLAG_FIELD)) ++ if (dpb[i].fields == V4L2_H264_FRAME_REF) + pic_order_count = min(dpb[i].top_field_order_cnt, + dpb[i].bottom_field_order_cnt); +- else if (dpb[i].flags & V4L2_H264_DPB_ENTRY_FLAG_BOTTOM_FIELD) ++ else if (dpb[i].fields & V4L2_H264_BOTTOM_FIELD_REF) + pic_order_count = dpb[i].bottom_field_order_cnt; + else + pic_order_count = dpb[i].top_field_order_cnt; +diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c +index 7b66e2743a4f..d1f2715f30ae 100644 +--- a/drivers/staging/media/rkvdec/rkvdec-h264.c ++++ b/drivers/staging/media/rkvdec/rkvdec-h264.c +@@ -949,16 +949,17 @@ static void config_registers(struct rkvdec_ctx *ctx, + for (i = 0; i < ARRAY_SIZE(dec_params->dpb); i++) { + struct vb2_buffer *vb_buf = get_ref_buf(ctx, run, i); + +- refer_addr = vb2_dma_contig_plane_dma_addr(vb_buf, 0) | +- RKVDEC_COLMV_USED_FLAG_REF; ++ refer_addr = vb2_dma_contig_plane_dma_addr(vb_buf, 0); + +- if (!(dpb[i].flags & V4L2_H264_DPB_ENTRY_FLAG_FIELD)) +- refer_addr |= RKVDEC_TOPFIELD_USED_REF | +- RKVDEC_BOTFIELD_USED_REF; +- else if (dpb[i].flags & V4L2_H264_DPB_ENTRY_FLAG_BOTTOM_FIELD) +- refer_addr |= RKVDEC_BOTFIELD_USED_REF; +- else ++ if (dpb[i].flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE) ++ refer_addr |= RKVDEC_COLMV_USED_FLAG_REF; ++ if (dpb[i].flags & V4L2_H264_DPB_ENTRY_FLAG_FIELD) ++ refer_addr |= RKVDEC_FIELD_REF; ++ ++ if (dpb[i].fields & V4L2_H264_TOP_FIELD_REF) + refer_addr |= RKVDEC_TOPFIELD_USED_REF; ++ if (dpb[i].fields & V4L2_H264_BOTTOM_FIELD_REF) ++ refer_addr |= RKVDEC_BOTFIELD_USED_REF; + + writel_relaxed(dpb[i].top_field_order_cnt, + rkvdec->regs + poc_reg_tbl_top_field[i]); +diff --git a/include/media/h264-ctrls.h b/include/media/h264-ctrls.h +index 9a6722edf004..0529e75cce5f 100644 +--- a/include/media/h264-ctrls.h ++++ b/include/media/h264-ctrls.h +@@ -210,12 +210,12 @@ struct v4l2_ctrl_h264_slice_params { + #define V4L2_H264_DPB_ENTRY_FLAG_ACTIVE 0x02 + #define V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM 0x04 + #define V4L2_H264_DPB_ENTRY_FLAG_FIELD 0x08 +-#define V4L2_H264_DPB_ENTRY_FLAG_BOTTOM_FIELD 0x10 + + struct v4l2_h264_dpb_entry { + __u64 reference_ts; + __u16 frame_num; + __u16 pic_num; ++ __u8 fields; + /* Note that field is indicated by v4l2_buffer.field */ + __s32 top_field_order_cnt; + __s32 bottom_field_order_cnt; + +From 44d417cc4d3f820149995948f9cb0d2ef02c7562 Mon Sep 17 00:00:00 2001 +From: Ezequiel Garcia +Date: Tue, 25 Aug 2020 05:52:33 +0200 +Subject: [PATCH] media: uapi: h264: Increase size of DPB entry pic_num + +DPB entry PicNum maximum value is 2*MaxFrameNum for interlaced +content (field_pic_flag=1). + +As specified, MaxFrameNum is 2^(log2_max_frame_num_minus4 + 4) +and log2_max_frame_num_minus4 is in the range of 0 to 12, +which means pic_num should be a 32-bit field. + +The v4l2_h264_dpb_entry struct needs to be padded to avoid a hole, +which might be also useful to allow future uAPI extensions. + +Signed-off-by: Ezequiel Garcia +Tested-by: Jonas Karlman +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit f9879eb378295e8a912d2d10c872c45f3e19421b) +--- + Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 9 ++++++--- + drivers/media/v4l2-core/v4l2-ctrls.c | 13 +++++++++++++ + include/media/h264-ctrls.h | 3 ++- + include/media/v4l2-h264.h | 2 +- + 4 files changed, 22 insertions(+), 5 deletions(-) + +diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +index 49febae8fd0f..3808c46718ad 100644 +--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst ++++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +@@ -2051,15 +2051,18 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + ``timestamp`` field in struct :c:type:`v4l2_buffer`. Use the + :c:func:`v4l2_timeval_to_ns()` function to convert the struct + :c:type:`timeval` in struct :c:type:`v4l2_buffer` to a __u64. +- * - __u16 +- - ``frame_num`` ++ * - __u32 ++ - ``pic_num`` + - + * - __u16 +- - ``pic_num`` ++ - ``frame_num`` + - + * - __u8 + - ``fields`` + - Specifies how the DPB entry is referenced. See :ref:`Reference Fields ` ++ * - __u8 ++ - ``reserved[5]`` ++ - Applications and drivers must set this to zero. + * - __s32 + - ``top_field_order_cnt`` + - +diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c +index ae0bf3f36c4a..31dbe4222091 100644 +--- a/drivers/media/v4l2-core/v4l2-ctrls.c ++++ b/drivers/media/v4l2-core/v4l2-ctrls.c +@@ -1725,6 +1725,8 @@ static void std_log(const struct v4l2_ctrl *ctrl) + + #define zero_padding(s) \ + memset(&(s).padding, 0, sizeof((s).padding)) ++#define zero_reserved(s) \ ++ memset(&(s).reserved, 0, sizeof((s).reserved)) + + /* + * Compound controls validation requires setting unused fields/flags to zero +@@ -1735,6 +1737,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, + { + struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params; + struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header; ++ struct v4l2_ctrl_h264_decode_params *p_h264_dec_params; + struct v4l2_ctrl_hevc_sps *p_hevc_sps; + struct v4l2_ctrl_hevc_pps *p_hevc_pps; + struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params; +@@ -1796,7 +1799,17 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, + case V4L2_CTRL_TYPE_H264_SCALING_MATRIX: + case V4L2_CTRL_TYPE_H264_PRED_WEIGHTS: + case V4L2_CTRL_TYPE_H264_SLICE_PARAMS: ++ break; ++ + case V4L2_CTRL_TYPE_H264_DECODE_PARAMS: ++ p_h264_dec_params = p; ++ ++ for (i = 0; i < V4L2_H264_NUM_DPB_ENTRIES; i++) { ++ struct v4l2_h264_dpb_entry *dpb_entry = ++ &p_h264_dec_params->dpb[i]; ++ ++ zero_reserved(*dpb_entry); ++ } + break; + + case V4L2_CTRL_TYPE_VP8_FRAME_HEADER: +diff --git a/include/media/h264-ctrls.h b/include/media/h264-ctrls.h +index 0529e75cce5f..91f6f0d43e11 100644 +--- a/include/media/h264-ctrls.h ++++ b/include/media/h264-ctrls.h +@@ -213,9 +213,10 @@ struct v4l2_ctrl_h264_slice_params { + + struct v4l2_h264_dpb_entry { + __u64 reference_ts; ++ __u32 pic_num; + __u16 frame_num; +- __u16 pic_num; + __u8 fields; ++ __u8 reserved[5]; + /* Note that field is indicated by v4l2_buffer.field */ + __s32 top_field_order_cnt; + __s32 bottom_field_order_cnt; +diff --git a/include/media/v4l2-h264.h b/include/media/v4l2-h264.h +index bc9ebb560ccf..1a5f26fc2a9a 100644 +--- a/include/media/v4l2-h264.h ++++ b/include/media/v4l2-h264.h +@@ -33,7 +33,7 @@ struct v4l2_h264_reflist_builder { + struct { + s32 pic_order_count; + int frame_num; +- u16 pic_num; ++ u32 pic_num; + u16 longterm : 1; + } refs[V4L2_H264_NUM_DPB_ENTRIES]; + s32 cur_pic_order_count; + +From cc7011362e4d3327874deb6d585c610558a10bc4 Mon Sep 17 00:00:00 2001 +From: Ezequiel Garcia +Date: Tue, 25 Aug 2020 05:52:34 +0200 +Subject: [PATCH] media: uapi: h264: Drop SLICE_PARAMS 'size' field + +The SLICE_PARAMS control is intended for slice-based +devices. In this mode, the OUTPUT buffer contains +a single slice, and so the buffer's plane payload size +can be used to query the slice size. + +To reduce the API surface drop the size from the +SLICE_PARAMS control. + +A follow-up change will remove other members in SLICE_PARAMS +so we don't need to add padding fields here. + +Signed-off-by: Ezequiel Garcia +Tested-by: Jonas Karlman +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit f6f0d58edfa77d18c41777740958f467de615728) +--- + Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 3 --- + drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 7 +++---- + include/media/h264-ctrls.h | 3 --- + 3 files changed, 3 insertions(+), 10 deletions(-) + +diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +index 3808c46718ad..e74a2531ab67 100644 +--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst ++++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +@@ -1760,9 +1760,6 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + :stub-columns: 0 + :widths: 1 1 2 + +- * - __u32 +- - ``size`` +- - + * - __u32 + - ``start_byte_offset`` + Offset (in bytes) from the beginning of the OUTPUT buffer to the start +diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +index d5636dbbb622..7d9bd5860a1b 100644 +--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c ++++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +@@ -324,17 +324,16 @@ static void cedrus_set_params(struct cedrus_ctx *ctx, + struct vb2_buffer *src_buf = &run->src->vb2_buf; + struct cedrus_dev *dev = ctx->dev; + dma_addr_t src_buf_addr; +- u32 len = slice->size * 8; ++ size_t slice_bytes = vb2_get_plane_payload(src_buf, 0); + unsigned int pic_width_in_mbs; + bool mbaff_pic; + u32 reg; + +- cedrus_write(dev, VE_H264_VLD_LEN, len); ++ cedrus_write(dev, VE_H264_VLD_LEN, slice_bytes * 8); + cedrus_write(dev, VE_H264_VLD_OFFSET, 0); + + src_buf_addr = vb2_dma_contig_plane_dma_addr(src_buf, 0); +- cedrus_write(dev, VE_H264_VLD_END, +- src_buf_addr + vb2_get_plane_payload(src_buf, 0)); ++ cedrus_write(dev, VE_H264_VLD_END, src_buf_addr + slice_bytes); + cedrus_write(dev, VE_H264_VLD_ADDR, + VE_H264_VLD_ADDR_VAL(src_buf_addr) | + VE_H264_VLD_ADDR_FIRST | VE_H264_VLD_ADDR_VALID | +diff --git a/include/media/h264-ctrls.h b/include/media/h264-ctrls.h +index 91f6f0d43e11..77d0ec51ae43 100644 +--- a/include/media/h264-ctrls.h ++++ b/include/media/h264-ctrls.h +@@ -163,9 +163,6 @@ struct v4l2_h264_reference { + }; + + struct v4l2_ctrl_h264_slice_params { +- /* Size in bytes, including header */ +- __u32 size; +- + /* Offset in bytes to the start of slice in the OUTPUT buffer. */ + __u32 start_byte_offset; + + +From 8a51555783ee2d5cd3471c4fc88f666399bd52e3 Mon Sep 17 00:00:00 2001 +From: Ezequiel Garcia +Date: Tue, 25 Aug 2020 05:52:35 +0200 +Subject: [PATCH] media: uapi: h264: Clarify SLICE_BASED mode + +Currently, the SLICE_BASED and FRAME_BASED modes documentation +is misleading and not matching the intended use-cases. + +Drop non-required fields SLICE_PARAMS 'start_byte_offset' and +DECODE_PARAMS 'num_slices' and clarify the decoding modes in the +documentation. + +On SLICE_BASED mode, a single slice is expected per OUTPUT buffer, +and therefore 'start_byte_offset' is not needed (since the offset +to the slice is the start of the buffer). + +This mode requires the use of CAPTURE buffer holding, and so +the number of slices shall not be required. + +On FRAME_BASED mode, the devices are expected to take care of slice +parsing. Neither SLICE_PARAMS are required (and shouldn't be +exposed by frame-based drivers), nor the number of slices. + +Signed-off-by: Ezequiel Garcia +Tested-by: Jonas Karlman +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit 2287c5e65cbcc99633c412dbfe1d39bd9f7bf1ce) +--- + .../userspace-api/media/v4l/ext-ctrls-codec.rst | 39 ++++++---------------- + include/media/h264-ctrls.h | 4 --- + 2 files changed, 10 insertions(+), 33 deletions(-) + +diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +index e74a2531ab67..304b6012b358 100644 +--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst ++++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +@@ -1748,9 +1748,6 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + This compound control is not yet part of the public kernel API + and it is expected to change. + +- This structure is expected to be passed as an array, with one +- entry for each slice included in the bitstream buffer. +- + .. c:type:: v4l2_ctrl_h264_slice_params + + .. cssclass:: longtable +@@ -1760,17 +1757,9 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + :stub-columns: 0 + :widths: 1 1 2 + +- * - __u32 +- - ``start_byte_offset`` +- Offset (in bytes) from the beginning of the OUTPUT buffer to the start +- of the slice. If the slice starts with a start code, then this is the +- offset to such start code. When operating in slice-based decoding mode +- (see :c:type:`v4l2_mpeg_video_h264_decode_mode`), this field should +- be set to 0. When operating in frame-based decoding mode, this field +- should be 0 for the first slice. + * - __u32 + - ``header_bit_size`` +- - ++ - Offset in bits to slice_data() from the beginning of this slice. + * - __u32 + - ``first_mb_in_slice`` + - +@@ -1998,12 +1987,6 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + * - struct :c:type:`v4l2_h264_dpb_entry` + - ``dpb[16]`` + - +- * - __u16 +- - ``num_slices`` +- - Number of slices needed to decode the current frame/field. When +- operating in slice-based decoding mode (see +- :c:type:`v4l2_mpeg_video_h264_decode_mode`), this field +- should always be set to one. + * - __u16 + - ``nal_ref_idc`` + - NAL reference ID value coming from the NAL Unit header +@@ -2121,22 +2104,20 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + * - ``V4L2_MPEG_VIDEO_H264_DECODE_MODE_SLICE_BASED`` + - 0 + - Decoding is done at the slice granularity. +- In this mode, ``num_slices`` field in struct +- :c:type:`v4l2_ctrl_h264_decode_params` should be set to 1, +- and ``start_byte_offset`` in struct +- :c:type:`v4l2_ctrl_h264_slice_params` should be set to 0. + The OUTPUT buffer must contain a single slice. ++ When this mode is selected, the ``V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS`` ++ control shall be set. When multiple slices compose a frame, ++ use of ``V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF`` flag ++ is required. + * - ``V4L2_MPEG_VIDEO_H264_DECODE_MODE_FRAME_BASED`` + - 1 +- - Decoding is done at the frame granularity. +- In this mode, ``num_slices`` field in struct +- :c:type:`v4l2_ctrl_h264_decode_params` should be set to the number +- of slices in the frame, and ``start_byte_offset`` in struct +- :c:type:`v4l2_ctrl_h264_slice_params` should be set accordingly +- for each slice. For the first slice, ``start_byte_offset`` should +- be zero. ++ - Decoding is done at the frame granularity, + The OUTPUT buffer must contain all slices needed to decode the + frame. The OUTPUT buffer must also contain both fields. ++ This mode will be supported by devices that ++ parse the slice(s) header(s) in hardware. When this mode is ++ selected, the ``V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS`` ++ control shall not be set. + + ``V4L2_CID_MPEG_VIDEO_H264_START_CODE (enum)`` + Specifies the H264 slice start code expected for each slice. +diff --git a/include/media/h264-ctrls.h b/include/media/h264-ctrls.h +index 77d0ec51ae43..e4cae02a765f 100644 +--- a/include/media/h264-ctrls.h ++++ b/include/media/h264-ctrls.h +@@ -163,9 +163,6 @@ struct v4l2_h264_reference { + }; + + struct v4l2_ctrl_h264_slice_params { +- /* Offset in bytes to the start of slice in the OUTPUT buffer. */ +- __u32 start_byte_offset; +- + /* Offset in bits to slice_data() from the beginning of this slice. */ + __u32 header_bit_size; + +@@ -224,7 +221,6 @@ struct v4l2_h264_dpb_entry { + + struct v4l2_ctrl_h264_decode_params { + struct v4l2_h264_dpb_entry dpb[V4L2_H264_NUM_DPB_ENTRIES]; +- __u16 num_slices; + __u16 nal_ref_idc; + __s32 top_field_order_cnt; + __s32 bottom_field_order_cnt; + +From 0ed1639eb2c39ddca4a54bf6132657d3e4e6c184 Mon Sep 17 00:00:00 2001 +From: Ezequiel Garcia +Date: Tue, 25 Aug 2020 05:52:36 +0200 +Subject: [PATCH] media: uapi: h264: Clean slice invariants syntax elements + +The H.264 specification requires in section 7.4.3 "Slice header semantics", +that the following values shall be the same in all slice headers: + + pic_parameter_set_id + frame_num + field_pic_flag + bottom_field_flag + idr_pic_id + pic_order_cnt_lsb + delta_pic_order_cnt_bottom + delta_pic_order_cnt[ 0 ] + delta_pic_order_cnt[ 1 ] + sp_for_switch_flag + slice_group_change_cycle + +These bitstream fields are part of the slice header, and therefore +passed redundantly on each slice. The purpose of the redundancy +is to make the codec fault-tolerant in network scenarios. + +This is of course not needed to be reflected in the V4L2 controls, +given the bitstream has already been parsed by applications. +Therefore, move the redundant fields to the per-frame decode +parameters control (DECODE_PARAMS). + +Field 'pic_parameter_set_id' is simply removed in this case, +because the PPS control must currently contain the active PPS. + +Syntax elements dec_ref_pic_marking() and those related +to pic order count, remain invariant as well, and therefore, +the fields dec_ref_pic_marking_bit_size and pic_order_cnt_bit_size +are also common to all slices. + +Signed-off-by: Ezequiel Garcia +Reviewed-by: Nicolas Dufresne +Tested-by: Jonas Karlman +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit d9358563179a7f01f9020ebbe201c7e54ba3af48) +--- + .../userspace-api/media/v4l/ext-ctrls-codec.rst | 86 +++++++++++----------- + drivers/media/v4l2-core/v4l2-ctrls.c | 7 ++ + drivers/media/v4l2-core/v4l2-h264.c | 8 +- + drivers/staging/media/hantro/hantro_g1_h264_dec.c | 21 +++--- + drivers/staging/media/hantro/hantro_h264.c | 3 +- + drivers/staging/media/rkvdec/rkvdec-h264.c | 6 +- + drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 9 +-- + include/media/h264-ctrls.h | 39 +++++----- + include/media/v4l2-h264.h | 1 - + 9 files changed, 90 insertions(+), 90 deletions(-) + +diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +index 304b6012b358..4cd9fd9c5a89 100644 +--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst ++++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +@@ -1766,44 +1766,12 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + * - __u8 + - ``slice_type`` + - +- * - __u8 +- - ``pic_parameter_set_id`` +- - + * - __u8 + - ``colour_plane_id`` + - + * - __u8 + - ``redundant_pic_cnt`` + - +- * - __u16 +- - ``frame_num`` +- - +- * - __u16 +- - ``idr_pic_id`` +- - +- * - __u16 +- - ``pic_order_cnt_lsb`` +- - +- * - __s32 +- - ``delta_pic_order_cnt_bottom`` +- - +- * - __s32 +- - ``delta_pic_order_cnt0`` +- - +- * - __s32 +- - ``delta_pic_order_cnt1`` +- - +- * - struct :c:type:`v4l2_h264_pred_weight_table` +- - ``pred_weight_table`` +- - +- * - __u32 +- - ``dec_ref_pic_marking_bit_size`` +- - Size in bits of the dec_ref_pic_marking() syntax element. +- * - __u32 +- - ``pic_order_cnt_bit_size`` +- - Combined size in bits of the picture order count related syntax +- elements: pic_order_cnt_lsb, delta_pic_order_cnt_bottom, +- delta_pic_order_cnt0, and delta_pic_order_cnt1. + * - __u8 + - ``cabac_init_idc`` + - +@@ -1830,9 +1798,9 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + - ``num_ref_idx_l1_active_minus1`` + - If num_ref_idx_active_override_flag is not set, this field must be + set to the value of num_ref_idx_l1_default_active_minus1. +- * - __u32 +- - ``slice_group_change_cycle`` +- - ++ * - __u8 ++ - ``reserved`` ++ - Applications and drivers must set this to zero. + * - struct :c:type:`v4l2_h264_reference` + - ``ref_pic_list0[32]`` + - Reference picture list after applying the per-slice modifications +@@ -1854,17 +1822,11 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + :stub-columns: 0 + :widths: 1 1 2 + +- * - ``V4L2_H264_SLICE_FLAG_FIELD_PIC`` +- - 0x00000001 +- - +- * - ``V4L2_H264_SLICE_FLAG_BOTTOM_FIELD`` +- - 0x00000002 +- - + * - ``V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED`` +- - 0x00000004 ++ - 0x00000001 + - + * - ``V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH`` +- - 0x00000008 ++ - 0x00000002 + - + + ``V4L2_CID_MPEG_VIDEO_H264_PRED_WEIGHTS (struct)`` +@@ -1990,12 +1952,44 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + * - __u16 + - ``nal_ref_idc`` + - NAL reference ID value coming from the NAL Unit header ++ * - __u16 ++ - ``frame_num`` ++ - + * - __s32 + - ``top_field_order_cnt`` + - Picture Order Count for the coded top field + * - __s32 + - ``bottom_field_order_cnt`` + - Picture Order Count for the coded bottom field ++ * - __u16 ++ - ``idr_pic_id`` ++ - ++ * - __u16 ++ - ``pic_order_cnt_lsb`` ++ - ++ * - __s32 ++ - ``delta_pic_order_cnt_bottom`` ++ - ++ * - __s32 ++ - ``delta_pic_order_cnt0`` ++ - ++ * - __s32 ++ - ``delta_pic_order_cnt1`` ++ - ++ * - __u32 ++ - ``dec_ref_pic_marking_bit_size`` ++ - Size in bits of the dec_ref_pic_marking() syntax element. ++ * - __u32 ++ - ``pic_order_cnt_bit_size`` ++ - Combined size in bits of the picture order count related syntax ++ elements: pic_order_cnt_lsb, delta_pic_order_cnt_bottom, ++ delta_pic_order_cnt0, and delta_pic_order_cnt1. ++ * - __u32 ++ - ``slice_group_change_cycle`` ++ - ++ * - __u32 ++ - ``reserved`` ++ - Applications and drivers must set this to zero. + * - __u32 + - ``flags`` + - See :ref:`Decode Parameters Flags ` +@@ -2014,6 +2008,12 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + * - ``V4L2_H264_DECODE_PARAM_FLAG_IDR_PIC`` + - 0x00000001 + - That picture is an IDR picture ++ * - ``V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC`` ++ - 0x00000002 ++ - ++ * - ``V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD`` ++ - 0x00000004 ++ - + + .. c:type:: v4l2_h264_dpb_entry + +diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c +index 31dbe4222091..d4a6c0346c2a 100644 +--- a/drivers/media/v4l2-core/v4l2-ctrls.c ++++ b/drivers/media/v4l2-core/v4l2-ctrls.c +@@ -1737,6 +1737,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, + { + struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params; + struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header; ++ struct v4l2_ctrl_h264_slice_params *p_h264_slice_params; + struct v4l2_ctrl_h264_decode_params *p_h264_dec_params; + struct v4l2_ctrl_hevc_sps *p_hevc_sps; + struct v4l2_ctrl_hevc_pps *p_hevc_pps; +@@ -1798,7 +1799,12 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, + case V4L2_CTRL_TYPE_H264_PPS: + case V4L2_CTRL_TYPE_H264_SCALING_MATRIX: + case V4L2_CTRL_TYPE_H264_PRED_WEIGHTS: ++ break; ++ + case V4L2_CTRL_TYPE_H264_SLICE_PARAMS: ++ p_h264_slice_params = p; ++ ++ zero_reserved(*p_h264_slice_params); + break; + + case V4L2_CTRL_TYPE_H264_DECODE_PARAMS: +@@ -1810,6 +1816,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, + + zero_reserved(*dpb_entry); + } ++ zero_reserved(*p_h264_dec_params); + break; + + case V4L2_CTRL_TYPE_VP8_FRAME_HEADER: +diff --git a/drivers/media/v4l2-core/v4l2-h264.c b/drivers/media/v4l2-core/v4l2-h264.c +index f4742408436b..5633a242520a 100644 +--- a/drivers/media/v4l2-core/v4l2-h264.c ++++ b/drivers/media/v4l2-core/v4l2-h264.c +@@ -18,14 +18,12 @@ + * + * @b: the builder context to initialize + * @dec_params: decode parameters control +- * @slice_params: first slice parameters control + * @sps: SPS control + * @dpb: DPB to use when creating the reference list + */ + void + v4l2_h264_init_reflist_builder(struct v4l2_h264_reflist_builder *b, + const struct v4l2_ctrl_h264_decode_params *dec_params, +- const struct v4l2_ctrl_h264_slice_params *slice_params, + const struct v4l2_ctrl_h264_sps *sps, + const struct v4l2_h264_dpb_entry dpb[V4L2_H264_NUM_DPB_ENTRIES]) + { +@@ -33,13 +31,13 @@ v4l2_h264_init_reflist_builder(struct v4l2_h264_reflist_builder *b, + unsigned int i; + + max_frame_num = 1 << (sps->log2_max_frame_num_minus4 + 4); +- cur_frame_num = slice_params->frame_num; ++ cur_frame_num = dec_params->frame_num; + + memset(b, 0, sizeof(*b)); +- if (!(slice_params->flags & V4L2_H264_SLICE_FLAG_FIELD_PIC)) ++ if (!(dec_params->flags & V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC)) + b->cur_pic_order_count = min(dec_params->bottom_field_order_cnt, + dec_params->top_field_order_cnt); +- else if (slice_params->flags & V4L2_H264_SLICE_FLAG_BOTTOM_FIELD) ++ else if (dec_params->flags & V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD) + b->cur_pic_order_count = dec_params->bottom_field_order_cnt; + else + b->cur_pic_order_count = dec_params->top_field_order_cnt; +diff --git a/drivers/staging/media/hantro/hantro_g1_h264_dec.c b/drivers/staging/media/hantro/hantro_g1_h264_dec.c +index 424c648ce9fc..f9839e9c6da5 100644 +--- a/drivers/staging/media/hantro/hantro_g1_h264_dec.c ++++ b/drivers/staging/media/hantro/hantro_g1_h264_dec.c +@@ -23,7 +23,6 @@ static void set_params(struct hantro_ctx *ctx) + { + const struct hantro_h264_dec_ctrls *ctrls = &ctx->h264_dec.ctrls; + const struct v4l2_ctrl_h264_decode_params *dec_param = ctrls->decode; +- const struct v4l2_ctrl_h264_slice_params *slices = ctrls->slices; + const struct v4l2_ctrl_h264_sps *sps = ctrls->sps; + const struct v4l2_ctrl_h264_pps *pps = ctrls->pps; + struct vb2_v4l2_buffer *src_buf = hantro_get_src_buf(ctx); +@@ -42,11 +41,11 @@ static void set_params(struct hantro_ctx *ctx) + + if (!(sps->flags & V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY) && + (sps->flags & V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD || +- slices[0].flags & V4L2_H264_SLICE_FLAG_FIELD_PIC)) ++ dec_param->flags & V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC)) + reg |= G1_REG_DEC_CTRL0_PIC_INTERLACE_E; +- if (slices[0].flags & V4L2_H264_SLICE_FLAG_FIELD_PIC) ++ if (dec_param->flags & V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC) + reg |= G1_REG_DEC_CTRL0_PIC_FIELDMODE_E; +- if (!(slices[0].flags & V4L2_H264_SLICE_FLAG_BOTTOM_FIELD)) ++ if (!(dec_param->flags & V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD)) + reg |= G1_REG_DEC_CTRL0_PIC_TOPFIELD_E; + vdpu_write_relaxed(vpu, reg, G1_REG_DEC_CTRL0); + +@@ -75,7 +74,7 @@ static void set_params(struct hantro_ctx *ctx) + + /* Decoder control register 4. */ + reg = G1_REG_DEC_CTRL4_FRAMENUM_LEN(sps->log2_max_frame_num_minus4 + 4) | +- G1_REG_DEC_CTRL4_FRAMENUM(slices[0].frame_num) | ++ G1_REG_DEC_CTRL4_FRAMENUM(dec_param->frame_num) | + G1_REG_DEC_CTRL4_WEIGHT_BIPR_IDC(pps->weighted_bipred_idc); + if (pps->flags & V4L2_H264_PPS_FLAG_ENTROPY_CODING_MODE) + reg |= G1_REG_DEC_CTRL4_CABAC_E; +@@ -88,8 +87,8 @@ static void set_params(struct hantro_ctx *ctx) + vdpu_write_relaxed(vpu, reg, G1_REG_DEC_CTRL4); + + /* Decoder control register 5. */ +- reg = G1_REG_DEC_CTRL5_REFPIC_MK_LEN(slices[0].dec_ref_pic_marking_bit_size) | +- G1_REG_DEC_CTRL5_IDR_PIC_ID(slices[0].idr_pic_id); ++ reg = G1_REG_DEC_CTRL5_REFPIC_MK_LEN(dec_param->dec_ref_pic_marking_bit_size) | ++ G1_REG_DEC_CTRL5_IDR_PIC_ID(dec_param->idr_pic_id); + if (pps->flags & V4L2_H264_PPS_FLAG_CONSTRAINED_INTRA_PRED) + reg |= G1_REG_DEC_CTRL5_CONST_INTRA_E; + if (pps->flags & V4L2_H264_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT) +@@ -103,10 +102,10 @@ static void set_params(struct hantro_ctx *ctx) + vdpu_write_relaxed(vpu, reg, G1_REG_DEC_CTRL5); + + /* Decoder control register 6. */ +- reg = G1_REG_DEC_CTRL6_PPS_ID(slices[0].pic_parameter_set_id) | ++ reg = G1_REG_DEC_CTRL6_PPS_ID(pps->pic_parameter_set_id) | + G1_REG_DEC_CTRL6_REFIDX0_ACTIVE(pps->num_ref_idx_l0_default_active_minus1 + 1) | + G1_REG_DEC_CTRL6_REFIDX1_ACTIVE(pps->num_ref_idx_l1_default_active_minus1 + 1) | +- G1_REG_DEC_CTRL6_POC_LENGTH(slices[0].pic_order_cnt_bit_size); ++ G1_REG_DEC_CTRL6_POC_LENGTH(dec_param->pic_order_cnt_bit_size); + vdpu_write_relaxed(vpu, reg, G1_REG_DEC_CTRL6); + + /* Error concealment register. */ +@@ -246,7 +245,7 @@ static void set_buffers(struct hantro_ctx *ctx) + /* Destination (decoded frame) buffer. */ + dst_dma = hantro_get_dec_buf_addr(ctx, &dst_buf->vb2_buf); + /* Adjust dma addr to start at second line for bottom field */ +- if (ctrls->slices[0].flags & V4L2_H264_SLICE_FLAG_BOTTOM_FIELD) ++ if (ctrls->decode->flags & V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD) + offset = ALIGN(ctx->src_fmt.width, MB_DIM); + vdpu_write_relaxed(vpu, dst_dma + offset, G1_REG_ADDR_DST); + +@@ -265,7 +264,7 @@ static void set_buffers(struct hantro_ctx *ctx) + * DMV buffer is split in two for field encoded frames, + * adjust offset for bottom field + */ +- if (ctrls->slices[0].flags & V4L2_H264_SLICE_FLAG_BOTTOM_FIELD) ++ if (ctrls->decode->flags & V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD) + offset += 32 * MB_WIDTH(ctx->src_fmt.width) * + MB_HEIGHT(ctx->src_fmt.height); + vdpu_write_relaxed(vpu, dst_dma + offset, G1_REG_ADDR_DIR_MV); +diff --git a/drivers/staging/media/hantro/hantro_h264.c b/drivers/staging/media/hantro/hantro_h264.c +index 6dcd47bd9ed3..7578a4fc1b16 100644 +--- a/drivers/staging/media/hantro/hantro_h264.c ++++ b/drivers/staging/media/hantro/hantro_h264.c +@@ -372,8 +372,7 @@ int hantro_h264_dec_prepare_run(struct hantro_ctx *ctx) + + /* Build the P/B{0,1} ref lists. */ + v4l2_h264_init_reflist_builder(&reflist_builder, ctrls->decode, +- &ctrls->slices[0], ctrls->sps, +- ctx->h264_dec.dpb); ++ ctrls->sps, ctx->h264_dec.dpb); + v4l2_h264_build_p_ref_list(&reflist_builder, h264_ctx->reflists.p); + v4l2_h264_build_b_ref_lists(&reflist_builder, h264_ctx->reflists.b0, + h264_ctx->reflists.b1); +diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c +index d1f2715f30ae..90f211839be2 100644 +--- a/drivers/staging/media/rkvdec/rkvdec-h264.c ++++ b/drivers/staging/media/rkvdec/rkvdec-h264.c +@@ -730,7 +730,6 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, + struct rkvdec_h264_run *run) + { + const struct v4l2_ctrl_h264_decode_params *dec_params = run->decode_params; +- const struct v4l2_ctrl_h264_slice_params *sl_params = &run->slices_params[0]; + const struct v4l2_h264_dpb_entry *dpb = dec_params->dpb; + struct rkvdec_h264_ctx *h264_ctx = ctx->priv; + const struct v4l2_ctrl_h264_sps *sps = run->sps; +@@ -754,7 +753,7 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, + continue; + + if (dpb[i].flags & V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM || +- dpb[i].frame_num < sl_params->frame_num) { ++ dpb[i].frame_num < dec_params->frame_num) { + p[i] = dpb[i].frame_num; + continue; + } +@@ -1094,8 +1093,7 @@ static int rkvdec_h264_run(struct rkvdec_ctx *ctx) + + /* Build the P/B{0,1} ref lists. */ + v4l2_h264_init_reflist_builder(&reflist_builder, run.decode_params, +- &run.slices_params[0], run.sps, +- run.decode_params->dpb); ++ run.sps, run.decode_params->dpb); + h264_ctx->reflists.num_valid = reflist_builder.num_valid; + v4l2_h264_build_p_ref_list(&reflist_builder, h264_ctx->reflists.p); + v4l2_h264_build_b_ref_lists(&reflist_builder, h264_ctx->reflists.b0, +diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +index 7d9bd5860a1b..c8f626fdd3dd 100644 +--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c ++++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +@@ -95,7 +95,6 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx, + { + struct cedrus_h264_sram_ref_pic pic_list[CEDRUS_H264_FRAME_NUM]; + const struct v4l2_ctrl_h264_decode_params *decode = run->h264.decode_params; +- const struct v4l2_ctrl_h264_slice_params *slice = run->h264.slice_params; + const struct v4l2_ctrl_h264_sps *sps = run->h264.sps; + struct vb2_queue *cap_q; + struct cedrus_buffer *output_buf; +@@ -144,7 +143,7 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx, + output_buf = vb2_to_cedrus_buffer(&run->dst->vb2_buf); + output_buf->codec.h264.position = position; + +- if (slice->flags & V4L2_H264_SLICE_FLAG_FIELD_PIC) ++ if (decode->flags & V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC) + output_buf->codec.h264.pic_type = CEDRUS_H264_PIC_TYPE_FIELD; + else if (sps->flags & V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD) + output_buf->codec.h264.pic_type = CEDRUS_H264_PIC_TYPE_MBAFF; +@@ -407,7 +406,7 @@ static void cedrus_set_params(struct cedrus_ctx *ctx, + reg |= VE_H264_SPS_DIRECT_8X8_INFERENCE; + cedrus_write(dev, VE_H264_SPS, reg); + +- mbaff_pic = !(slice->flags & V4L2_H264_SLICE_FLAG_FIELD_PIC) && ++ mbaff_pic = !(decode->flags & V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC) && + (sps->flags & V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD); + pic_width_in_mbs = sps->pic_width_in_mbs_minus1 + 1; + +@@ -421,9 +420,9 @@ static void cedrus_set_params(struct cedrus_ctx *ctx, + reg |= slice->cabac_init_idc & 0x3; + if (ctx->fh.m2m_ctx->new_frame) + reg |= VE_H264_SHS_FIRST_SLICE_IN_PIC; +- if (slice->flags & V4L2_H264_SLICE_FLAG_FIELD_PIC) ++ if (decode->flags & V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC) + reg |= VE_H264_SHS_FIELD_PIC; +- if (slice->flags & V4L2_H264_SLICE_FLAG_BOTTOM_FIELD) ++ if (decode->flags & V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD) + reg |= VE_H264_SHS_BOTTOM_FIELD; + if (slice->flags & V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED) + reg |= VE_H264_SHS_DIRECT_SPATIAL_MV_PRED; +diff --git a/include/media/h264-ctrls.h b/include/media/h264-ctrls.h +index e4cae02a765f..0c15ff938873 100644 +--- a/include/media/h264-ctrls.h ++++ b/include/media/h264-ctrls.h +@@ -146,10 +146,8 @@ struct v4l2_ctrl_h264_pred_weights { + #define V4L2_H264_SLICE_TYPE_SP 3 + #define V4L2_H264_SLICE_TYPE_SI 4 + +-#define V4L2_H264_SLICE_FLAG_FIELD_PIC 0x01 +-#define V4L2_H264_SLICE_FLAG_BOTTOM_FIELD 0x02 +-#define V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED 0x04 +-#define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH 0x08 ++#define V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED 0x01 ++#define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH 0x02 + + #define V4L2_H264_TOP_FIELD_REF 0x1 + #define V4L2_H264_BOTTOM_FIELD_REF 0x2 +@@ -169,21 +167,8 @@ struct v4l2_ctrl_h264_slice_params { + __u32 first_mb_in_slice; + + __u8 slice_type; +- __u8 pic_parameter_set_id; + __u8 colour_plane_id; + __u8 redundant_pic_cnt; +- __u16 frame_num; +- __u16 idr_pic_id; +- __u16 pic_order_cnt_lsb; +- __s32 delta_pic_order_cnt_bottom; +- __s32 delta_pic_order_cnt0; +- __s32 delta_pic_order_cnt1; +- +- /* Size in bits of dec_ref_pic_marking() syntax element. */ +- __u32 dec_ref_pic_marking_bit_size; +- /* Size in bits of pic order count syntax. */ +- __u32 pic_order_cnt_bit_size; +- + __u8 cabac_init_idc; + __s8 slice_qp_delta; + __s8 slice_qs_delta; +@@ -192,7 +177,8 @@ struct v4l2_ctrl_h264_slice_params { + __s8 slice_beta_offset_div2; + __u8 num_ref_idx_l0_active_minus1; + __u8 num_ref_idx_l1_active_minus1; +- __u32 slice_group_change_cycle; ++ ++ __u8 reserved; + + struct v4l2_h264_reference ref_pic_list0[V4L2_H264_REF_LIST_LEN]; + struct v4l2_h264_reference ref_pic_list1[V4L2_H264_REF_LIST_LEN]; +@@ -217,13 +203,28 @@ struct v4l2_h264_dpb_entry { + __u32 flags; /* V4L2_H264_DPB_ENTRY_FLAG_* */ + }; + +-#define V4L2_H264_DECODE_PARAM_FLAG_IDR_PIC 0x01 ++#define V4L2_H264_DECODE_PARAM_FLAG_IDR_PIC 0x01 ++#define V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC 0x02 ++#define V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD 0x04 + + struct v4l2_ctrl_h264_decode_params { + struct v4l2_h264_dpb_entry dpb[V4L2_H264_NUM_DPB_ENTRIES]; + __u16 nal_ref_idc; ++ __u16 frame_num; + __s32 top_field_order_cnt; + __s32 bottom_field_order_cnt; ++ __u16 idr_pic_id; ++ __u16 pic_order_cnt_lsb; ++ __s32 delta_pic_order_cnt_bottom; ++ __s32 delta_pic_order_cnt0; ++ __s32 delta_pic_order_cnt1; ++ /* Size in bits of dec_ref_pic_marking() syntax element. */ ++ __u32 dec_ref_pic_marking_bit_size; ++ /* Size in bits of pic order count syntax. */ ++ __u32 pic_order_cnt_bit_size; ++ __u32 slice_group_change_cycle; ++ ++ __u32 reserved; + __u32 flags; /* V4L2_H264_DECODE_PARAM_FLAG_* */ + }; + +diff --git a/include/media/v4l2-h264.h b/include/media/v4l2-h264.h +index 1a5f26fc2a9a..f08ba181263d 100644 +--- a/include/media/v4l2-h264.h ++++ b/include/media/v4l2-h264.h +@@ -44,7 +44,6 @@ struct v4l2_h264_reflist_builder { + void + v4l2_h264_init_reflist_builder(struct v4l2_h264_reflist_builder *b, + const struct v4l2_ctrl_h264_decode_params *dec_params, +- const struct v4l2_ctrl_h264_slice_params *slice_params, + const struct v4l2_ctrl_h264_sps *sps, + const struct v4l2_h264_dpb_entry dpb[V4L2_H264_NUM_DPB_ENTRIES]); + + +From ca371b762ca1278521c8032a478a3ad3f9e03a18 Mon Sep 17 00:00:00 2001 +From: Ezequiel Garcia +Date: Tue, 25 Aug 2020 05:52:37 +0200 +Subject: [PATCH] media: uapi: h264: Rename and clarify + PPS_FLAG_SCALING_MATRIX_PRESENT + +Applications are expected to fill V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX +if a non-flat scaling matrix applies to the picture. This is the case if +SPS scaling_matrix_present_flag or PPS pic_scaling_matrix_present_flag +are set, and should be handled by applications. + +On one hand, the PPS bitstream syntax element signals the presence of a +Picture scaling matrix modifying the Sequence (SPS) scaling matrix. +On the other hand, our flag should indicate if the scaling matrix +V4L2 control is applicable to this request. + +Rename the flag from PPS_FLAG_PIC_SCALING_MATRIX_PRESENT to +PPS_FLAG_SCALING_MATRIX_PRESENT, to avoid mixing this flag with +bitstream syntax element pic_scaling_matrix_present_flag, +and clarify the meaning of our flag. + +Signed-off-by: Ezequiel Garcia +Tested-by: Jonas Karlman +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit 54889c51b833d236228f983be16212fbe806bb89) +--- + Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 5 +++-- + include/media/h264-ctrls.h | 2 +- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +index 4cd9fd9c5a89..e2b94b1d0ab0 100644 +--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst ++++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +@@ -1695,9 +1695,10 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - + * - ``V4L2_H264_PPS_FLAG_TRANSFORM_8X8_MODE`` + - 0x00000040 + - +- * - ``V4L2_H264_PPS_FLAG_PIC_SCALING_MATRIX_PRESENT`` ++ * - ``V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT`` + - 0x00000080 +- - ++ - Indicates that ``V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX`` ++ must be used for this picture. + + ``V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX (struct)`` + Specifies the scaling matrix (as extracted from the bitstream) for +diff --git a/include/media/h264-ctrls.h b/include/media/h264-ctrls.h +index 0c15ff938873..ec4799154438 100644 +--- a/include/media/h264-ctrls.h ++++ b/include/media/h264-ctrls.h +@@ -99,7 +99,7 @@ struct v4l2_ctrl_h264_sps { + #define V4L2_H264_PPS_FLAG_CONSTRAINED_INTRA_PRED 0x0010 + #define V4L2_H264_PPS_FLAG_REDUNDANT_PIC_CNT_PRESENT 0x0020 + #define V4L2_H264_PPS_FLAG_TRANSFORM_8X8_MODE 0x0040 +-#define V4L2_H264_PPS_FLAG_PIC_SCALING_MATRIX_PRESENT 0x0080 ++#define V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT 0x0080 + + struct v4l2_ctrl_h264_pps { + __u8 pic_parameter_set_id; + +From d8858326adbebde9fa273528c6d03970b6b50168 Mon Sep 17 00:00:00 2001 +From: Ezequiel Garcia +Date: Tue, 25 Aug 2020 05:52:38 +0200 +Subject: [PATCH] media: hantro: Don't require unneeded H264_SLICE_PARAMS + +Now that slice invariant parameters have been moved, +the driver no longer needs this control, so drop it. + +Signed-off-by: Ezequiel Garcia +Tested-by: Jonas Karlman +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit 057c4452894a38e4cc256858425b2c756003a92f) +--- + drivers/staging/media/hantro/hantro_drv.c | 5 ----- + drivers/staging/media/hantro/hantro_h264.c | 5 ----- + drivers/staging/media/hantro/hantro_hw.h | 2 -- + 3 files changed, 12 deletions(-) + +diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c +index 34797507f214..3cd00cc0a364 100644 +--- a/drivers/staging/media/hantro/hantro_drv.c ++++ b/drivers/staging/media/hantro/hantro_drv.c +@@ -306,11 +306,6 @@ static const struct hantro_ctrl controls[] = { + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS, + }, +- }, { +- .codec = HANTRO_H264_DECODER, +- .cfg = { +- .id = V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS, +- }, + }, { + .codec = HANTRO_H264_DECODER, + .cfg = { +diff --git a/drivers/staging/media/hantro/hantro_h264.c b/drivers/staging/media/hantro/hantro_h264.c +index 7578a4fc1b16..089bfa9c625b 100644 +--- a/drivers/staging/media/hantro/hantro_h264.c ++++ b/drivers/staging/media/hantro/hantro_h264.c +@@ -349,11 +349,6 @@ int hantro_h264_dec_prepare_run(struct hantro_ctx *ctx) + if (WARN_ON(!ctrls->decode)) + return -EINVAL; + +- ctrls->slices = +- hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS); +- if (WARN_ON(!ctrls->slices)) +- return -EINVAL; +- + ctrls->sps = + hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_H264_SPS); + if (WARN_ON(!ctrls->sps)) +diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h +index f066de6b592d..219283a06f52 100644 +--- a/drivers/staging/media/hantro/hantro_hw.h ++++ b/drivers/staging/media/hantro/hantro_hw.h +@@ -56,14 +56,12 @@ struct hantro_jpeg_enc_hw_ctx { + * struct hantro_h264_dec_ctrls + * @decode: Decode params + * @scaling: Scaling info +- * @slice: Slice params + * @sps: SPS info + * @pps: PPS info + */ + struct hantro_h264_dec_ctrls { + const struct v4l2_ctrl_h264_decode_params *decode; + const struct v4l2_ctrl_h264_scaling_matrix *scaling; +- const struct v4l2_ctrl_h264_slice_params *slices; + const struct v4l2_ctrl_h264_sps *sps; + const struct v4l2_ctrl_h264_pps *pps; + }; + +From a41936be0e44cd4317a6cce088eb6625aef96ac5 Mon Sep 17 00:00:00 2001 +From: Ezequiel Garcia +Date: Tue, 25 Aug 2020 05:52:39 +0200 +Subject: [PATCH] media: rkvdec: Don't require unneeded H264_SLICE_PARAMS + +Now that slice invariant parameters have been moved, +the driver no longer needs this control, so drop it. + +Signed-off-by: Ezequiel Garcia +Reviewed-by: Jonas Karlman +Tested-by: Jonas Karlman +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit a52b29e8d21d6c6463ff40e862107da0717a0840) +--- + drivers/staging/media/rkvdec/rkvdec-h264.c | 4 ---- + drivers/staging/media/rkvdec/rkvdec.c | 5 ----- + 2 files changed, 9 deletions(-) + +diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c +index 90f211839be2..c45cd1617b3b 100644 +--- a/drivers/staging/media/rkvdec/rkvdec-h264.c ++++ b/drivers/staging/media/rkvdec/rkvdec-h264.c +@@ -109,7 +109,6 @@ struct rkvdec_h264_reflists { + struct rkvdec_h264_run { + struct rkvdec_run base; + const struct v4l2_ctrl_h264_decode_params *decode_params; +- const struct v4l2_ctrl_h264_slice_params *slices_params; + const struct v4l2_ctrl_h264_sps *sps; + const struct v4l2_ctrl_h264_pps *pps; + const struct v4l2_ctrl_h264_scaling_matrix *scaling_matrix; +@@ -1066,9 +1065,6 @@ static void rkvdec_h264_run_preamble(struct rkvdec_ctx *ctx, + ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl, + V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS); + run->decode_params = ctrl ? ctrl->p_cur.p : NULL; +- ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl, +- V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS); +- run->slices_params = ctrl ? ctrl->p_cur.p : NULL; + ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl, + V4L2_CID_MPEG_VIDEO_H264_SPS); + run->sps = ctrl ? ctrl->p_cur.p : NULL; +diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c +index c8151328fb70..7c5129593921 100644 +--- a/drivers/staging/media/rkvdec/rkvdec.c ++++ b/drivers/staging/media/rkvdec/rkvdec.c +@@ -59,11 +59,6 @@ static const struct rkvdec_ctrl_desc rkvdec_h264_ctrl_descs[] = { + .mandatory = true, + .cfg.id = V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS, + }, +- { +- .per_request = true, +- .mandatory = true, +- .cfg.id = V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS, +- }, + { + .per_request = true, + .mandatory = true, + +From 46d93c497a135bbebf8a46e457cbb1ccbc65187e Mon Sep 17 00:00:00 2001 +From: Jernej Skrabec +Date: Tue, 25 Aug 2020 05:52:40 +0200 +Subject: [PATCH] media: cedrus: h264: Properly configure reference field + +When interlaced H264 content is being decoded, references must indicate +which field is being referenced. Currently this was done by checking +capture buffer flags. However, that is not correct because capture +buffer may hold both fields. + +Fix this by checking newly introduced flags in reference lists. + +Signed-off-by: Jernej Skrabec +Reviewed-by: Nicolas Dufresne +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit cfc8c3ed533e650270152f293a3536f3ca0e7053) +--- + drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +index c8f626fdd3dd..1e89a8438f36 100644 +--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c ++++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +@@ -182,7 +182,6 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx, + for (i = 0; i < num_ref; i++) { + const struct v4l2_h264_dpb_entry *dpb; + const struct cedrus_buffer *cedrus_buf; +- const struct vb2_v4l2_buffer *ref_buf; + unsigned int position; + int buf_idx; + u8 dpb_idx; +@@ -197,12 +196,11 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx, + if (buf_idx < 0) + continue; + +- ref_buf = to_vb2_v4l2_buffer(cap_q->bufs[buf_idx]); +- cedrus_buf = vb2_v4l2_to_cedrus_buffer(ref_buf); ++ cedrus_buf = vb2_to_cedrus_buffer(cap_q->bufs[buf_idx]); + position = cedrus_buf->codec.h264.position; + + sram_array[i] |= position << 1; +- if (ref_buf->field == V4L2_FIELD_BOTTOM) ++ if (ref_list[i].fields & V4L2_H264_BOTTOM_FIELD_REF) + sram_array[i] |= BIT(0); + } + + +From 639f50ba7ef39ae5c7e3d954c4eb45e798d807e1 Mon Sep 17 00:00:00 2001 +From: Jernej Skrabec +Date: Tue, 25 Aug 2020 05:52:41 +0200 +Subject: [PATCH] media: cedrus: h264: Fix frame list construction + +Current frame list construction algorithm assumes that decoded image +will be output into its own buffer. That is true for progressive content +but not for interlaced where each field is decoded separately into same +buffer. + +Fix that by checking if capture buffer is listed in DPB. If it is, reuse +it. + +Signed-off-by: Jernej Skrabec +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit 46e8893e72b43d10f5cad92355b36a7babe83724) +--- + drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +index 1e89a8438f36..fe041b444385 100644 +--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c ++++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +@@ -101,7 +101,7 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx, + struct cedrus_dev *dev = ctx->dev; + unsigned long used_dpbs = 0; + unsigned int position; +- unsigned int output = 0; ++ int output = -1; + unsigned int i; + + cap_q = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); +@@ -124,6 +124,11 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx, + position = cedrus_buf->codec.h264.position; + used_dpbs |= BIT(position); + ++ if (run->dst->vb2_buf.timestamp == dpb->reference_ts) { ++ output = position; ++ continue; ++ } ++ + if (!(dpb->flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE)) + continue; + +@@ -131,13 +136,11 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx, + dpb->top_field_order_cnt, + dpb->bottom_field_order_cnt, + &pic_list[position]); +- +- output = max(position, output); + } + +- position = find_next_zero_bit(&used_dpbs, CEDRUS_H264_FRAME_NUM, +- output); +- if (position >= CEDRUS_H264_FRAME_NUM) ++ if (output >= 0) ++ position = output; ++ else + position = find_first_zero_bit(&used_dpbs, CEDRUS_H264_FRAME_NUM); + + output_buf = vb2_to_cedrus_buffer(&run->dst->vb2_buf); + +From 8fcba25193bcdb227cd399ef8f4fff04bd296aa6 Mon Sep 17 00:00:00 2001 +From: Ezequiel Garcia +Date: Tue, 25 Aug 2020 05:52:42 +0200 +Subject: [PATCH] media: rkvdec: Drop unneeded per_request driver-specific + control flag + +Currently, the drivers makes no distinction between per_request +and mandatory, as both are used in the same request validate check. + +The driver only cares to know if a given control is +required to be part of a request, so only one flag is needed. + +Signed-off-by: Ezequiel Garcia +Tested-by: Jonas Karlman +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit d3951cfc9bee5b1d4282c2f6b9458b4a94929eee) +--- + drivers/staging/media/rkvdec/rkvdec.c | 8 +------- + drivers/staging/media/rkvdec/rkvdec.h | 1 - + 2 files changed, 1 insertion(+), 8 deletions(-) + +diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c +index 7c5129593921..9f59dfb62d3f 100644 +--- a/drivers/staging/media/rkvdec/rkvdec.c ++++ b/drivers/staging/media/rkvdec/rkvdec.c +@@ -55,35 +55,29 @@ static const struct v4l2_ctrl_ops rkvdec_ctrl_ops = { + + static const struct rkvdec_ctrl_desc rkvdec_h264_ctrl_descs[] = { + { +- .per_request = true, + .mandatory = true, + .cfg.id = V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS, + }, + { +- .per_request = true, + .mandatory = true, + .cfg.id = V4L2_CID_MPEG_VIDEO_H264_SPS, + .cfg.ops = &rkvdec_ctrl_ops, + }, + { +- .per_request = true, + .mandatory = true, + .cfg.id = V4L2_CID_MPEG_VIDEO_H264_PPS, + }, + { +- .per_request = true, + .mandatory = true, + .cfg.id = V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX, + }, + { +- .mandatory = true, + .cfg.id = V4L2_CID_MPEG_VIDEO_H264_DECODE_MODE, + .cfg.min = V4L2_MPEG_VIDEO_H264_DECODE_MODE_FRAME_BASED, + .cfg.max = V4L2_MPEG_VIDEO_H264_DECODE_MODE_FRAME_BASED, + .cfg.def = V4L2_MPEG_VIDEO_H264_DECODE_MODE_FRAME_BASED, + }, + { +- .mandatory = true, + .cfg.id = V4L2_CID_MPEG_VIDEO_H264_START_CODE, + .cfg.min = V4L2_MPEG_VIDEO_H264_START_CODE_ANNEX_B, + .cfg.def = V4L2_MPEG_VIDEO_H264_START_CODE_ANNEX_B, +@@ -615,7 +609,7 @@ static int rkvdec_request_validate(struct media_request *req) + u32 id = ctrls->ctrls[i].cfg.id; + struct v4l2_ctrl *ctrl; + +- if (!ctrls->ctrls[i].per_request || !ctrls->ctrls[i].mandatory) ++ if (!ctrls->ctrls[i].mandatory) + continue; + + ctrl = v4l2_ctrl_request_hdl_ctrl_find(hdl, id); +diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h +index 2fc9f46b6910..77a137cca88e 100644 +--- a/drivers/staging/media/rkvdec/rkvdec.h ++++ b/drivers/staging/media/rkvdec/rkvdec.h +@@ -25,7 +25,6 @@ + struct rkvdec_ctx; + + struct rkvdec_ctrl_desc { +- u32 per_request : 1; + u32 mandatory : 1; + struct v4l2_ctrl_config cfg; + }; + +From 6b4ad3335d579f5a867a7a320dad4e47f0a82e53 Mon Sep 17 00:00:00 2001 +From: Ezequiel Garcia +Date: Tue, 25 Aug 2020 05:52:43 +0200 +Subject: [PATCH] media: rkvdec: Use H264_SCALING_MATRIX only when required + +Baseline, Main and Extended profiles are specified to +not support a scaling matrix. Also, High profiles +can optionally specify a scaling matrix, using +SPS and PPS NAL units. + +To meet this expectation, applications are required to +set the V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX control +and set the V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT +flag only when a scaling matrix is specified for a picture. + +Implement this on rkvdec, which has hardware support for this +case. + +Signed-off-by: Ezequiel Garcia +Tested-by: Jonas Karlman +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit fd902918e3e6c70e771e14e611950f361a78cfc5) +--- + drivers/staging/media/rkvdec/rkvdec-h264.c | 10 +++++++--- + drivers/staging/media/rkvdec/rkvdec.c | 1 - + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c +index c45cd1617b3b..7cc3b478a5f4 100644 +--- a/drivers/staging/media/rkvdec/rkvdec-h264.c ++++ b/drivers/staging/media/rkvdec/rkvdec-h264.c +@@ -708,9 +708,9 @@ static void assemble_hw_pps(struct rkvdec_ctx *ctx, + WRITE_PPS(pps->second_chroma_qp_index_offset, + SECOND_CHROMA_QP_INDEX_OFFSET); + +- /* always use the matrix sent from userspace */ +- WRITE_PPS(1, SCALING_LIST_ENABLE_FLAG); +- ++ WRITE_PPS(!!(pps->flags & V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT), ++ SCALING_LIST_ENABLE_FLAG); ++ /* To be on the safe side, program the scaling matrix address */ + scaling_distance = offsetof(struct rkvdec_h264_priv_tbl, scaling_list); + scaling_list_address = h264_ctx->priv_tbl.dma + scaling_distance; + WRITE_PPS(scaling_list_address, SCALING_LIST_ADDRESS); +@@ -792,9 +792,13 @@ static void assemble_hw_scaling_list(struct rkvdec_ctx *ctx, + struct rkvdec_h264_run *run) + { + const struct v4l2_ctrl_h264_scaling_matrix *scaling = run->scaling_matrix; ++ const struct v4l2_ctrl_h264_pps *pps = run->pps; + struct rkvdec_h264_ctx *h264_ctx = ctx->priv; + struct rkvdec_h264_priv_tbl *tbl = h264_ctx->priv_tbl.cpu; + ++ if (!(pps->flags & V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT)) ++ return; ++ + BUILD_BUG_ON(sizeof(tbl->scaling_list.scaling_list_4x4) != + sizeof(scaling->scaling_list_4x4)); + BUILD_BUG_ON(sizeof(tbl->scaling_list.scaling_list_8x8) != +diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c +index 9f59dfb62d3f..d25c4a37e2af 100644 +--- a/drivers/staging/media/rkvdec/rkvdec.c ++++ b/drivers/staging/media/rkvdec/rkvdec.c +@@ -68,7 +68,6 @@ static const struct rkvdec_ctrl_desc rkvdec_h264_ctrl_descs[] = { + .cfg.id = V4L2_CID_MPEG_VIDEO_H264_PPS, + }, + { +- .mandatory = true, + .cfg.id = V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX, + }, + { + +From 2d1e9d1ee8c70cc956e5d4356fa4b0db16475639 Mon Sep 17 00:00:00 2001 +From: Ezequiel Garcia +Date: Tue, 25 Aug 2020 05:52:44 +0200 +Subject: [PATCH] media: hantro: Use H264_SCALING_MATRIX only when required + +Baseline, Main and Extended profiles are specified to +not support a scaling matrix. Also, High profiles +can optionally specify a scaling matrix, using +SPS and PPS NAL units. + +To meet this expectation, applications are required to +set the V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX control +and set the V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT +flag only when a scaling matrix is specified for a picture. + +Implement this on hantro, which has hardware support for this +case. + +Signed-off-by: Ezequiel Garcia +Tested-by: Jonas Karlman +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit e6de6b3fac5f70cbf37eaa671d1bfeb2478469d9) +--- + drivers/staging/media/hantro/hantro_g1_h264_dec.c | 5 ++--- + drivers/staging/media/hantro/hantro_h264.c | 4 ++++ + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/drivers/staging/media/hantro/hantro_g1_h264_dec.c b/drivers/staging/media/hantro/hantro_g1_h264_dec.c +index f9839e9c6da5..845bef73d218 100644 +--- a/drivers/staging/media/hantro/hantro_g1_h264_dec.c ++++ b/drivers/staging/media/hantro/hantro_g1_h264_dec.c +@@ -59,9 +59,8 @@ static void set_params(struct hantro_ctx *ctx) + reg = G1_REG_DEC_CTRL2_CH_QP_OFFSET(pps->chroma_qp_index_offset) | + G1_REG_DEC_CTRL2_CH_QP_OFFSET2(pps->second_chroma_qp_index_offset); + +- /* always use the matrix sent from userspace */ +- reg |= G1_REG_DEC_CTRL2_TYPE1_QUANT_E; +- ++ if (pps->flags & V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT) ++ reg |= G1_REG_DEC_CTRL2_TYPE1_QUANT_E; + if (!(sps->flags & V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY)) + reg |= G1_REG_DEC_CTRL2_FIELDPIC_FLAG_E; + vdpu_write_relaxed(vpu, reg, G1_REG_DEC_CTRL2); +diff --git a/drivers/staging/media/hantro/hantro_h264.c b/drivers/staging/media/hantro/hantro_h264.c +index 089bfa9c625b..b1bdc00ac262 100644 +--- a/drivers/staging/media/hantro/hantro_h264.c ++++ b/drivers/staging/media/hantro/hantro_h264.c +@@ -197,6 +197,7 @@ assemble_scaling_list(struct hantro_ctx *ctx) + { + const struct hantro_h264_dec_ctrls *ctrls = &ctx->h264_dec.ctrls; + const struct v4l2_ctrl_h264_scaling_matrix *scaling = ctrls->scaling; ++ const struct v4l2_ctrl_h264_pps *pps = ctrls->pps; + const size_t num_list_4x4 = ARRAY_SIZE(scaling->scaling_list_4x4); + const size_t list_len_4x4 = ARRAY_SIZE(scaling->scaling_list_4x4[0]); + const size_t list_len_8x8 = ARRAY_SIZE(scaling->scaling_list_8x8[0]); +@@ -205,6 +206,9 @@ assemble_scaling_list(struct hantro_ctx *ctx) + const u32 *src; + int i, j; + ++ if (!(pps->flags & V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT)) ++ return; ++ + for (i = 0; i < num_list_4x4; i++) { + src = (u32 *)&scaling->scaling_list_4x4[i]; + for (j = 0; j < list_len_4x4 / 4; j++) + +From 4c2a7a45d1223e8b736fd2badd8e665cf06e3298 Mon Sep 17 00:00:00 2001 +From: Ezequiel Garcia +Date: Tue, 25 Aug 2020 05:52:45 +0200 +Subject: [PATCH] media: cedrus: Use H264_SCALING_MATRIX only when required + +Baseline, Main and Extended profiles are specified to +not support a scaling matrix. Also, High profiles +can optionally specify a scaling matrix, using +SPS and PPS NAL units. + +To meet this expectation, applications are required to +set the V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX control +and set the V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT +flag only when a scaling matrix is specified for a picture. + +Implement this on cedrus, which has hardware support for this +case. + +Signed-off-by: Ezequiel Garcia +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit b3a23db0e2f89b309c40e32421c423875b5c1e65) +--- + drivers/staging/media/sunxi/cedrus/cedrus.c | 2 +- + drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 6 ++++++ + 2 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c +index 5d41d3357663..e0e35502e34a 100644 +--- a/drivers/staging/media/sunxi/cedrus/cedrus.c ++++ b/drivers/staging/media/sunxi/cedrus/cedrus.c +@@ -76,7 +76,7 @@ static const struct cedrus_control cedrus_controls[] = { + .id = V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX, + }, + .codec = CEDRUS_CODEC_H264, +- .required = true, ++ .required = false, + }, + { + .cfg = { +diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +index fe041b444385..28319351e909 100644 +--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c ++++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +@@ -238,8 +238,12 @@ static void cedrus_write_scaling_lists(struct cedrus_ctx *ctx, + { + const struct v4l2_ctrl_h264_scaling_matrix *scaling = + run->h264.scaling_matrix; ++ const struct v4l2_ctrl_h264_pps *pps = run->h264.pps; + struct cedrus_dev *dev = ctx->dev; + ++ if (!(pps->flags & V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT)) ++ return; ++ + cedrus_h264_write_sram(dev, CEDRUS_SRAM_H264_SCALING_LIST_8x8_0, + scaling->scaling_list_8x8[0], + sizeof(scaling->scaling_list_8x8[0])); +@@ -442,6 +446,8 @@ static void cedrus_set_params(struct cedrus_ctx *ctx, + reg |= (pps->second_chroma_qp_index_offset & 0x3f) << 16; + reg |= (pps->chroma_qp_index_offset & 0x3f) << 8; + reg |= (pps->pic_init_qp_minus26 + 26 + slice->slice_qp_delta) & 0x3f; ++ if (pps->flags & V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT) ++ reg |= VE_H264_SHS_QP_SCALING_MATRIX_DEFAULT; + cedrus_write(dev, VE_H264_SHS_QP, reg); + + // clear status flags + +From f63d65cb5f9554f96a9dfd785f775da98bf7cb69 Mon Sep 17 00:00:00 2001 +From: Mauro Carvalho Chehab +Date: Tue, 1 Sep 2020 11:09:26 +0200 +Subject: [PATCH] media: videobuf-dma-sg: number of pages should be unsigned + long + +As reported by smatch: + + drivers/media/v4l2-core/videobuf-dma-sg.c:245 videobuf_dma_init_kernel() warn: should 'nr_pages << 12' be a 64 bit type? + +The printk should not be using %d for the number of pages. + +After looking better, the real problem here is that the +number of pages should be long int. + +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit 1faa39e0f3bcfe47dc7a61a72c234b24005c3a1a) +--- + drivers/media/v4l2-core/videobuf-dma-sg.c | 22 ++++++++++++---------- + include/media/videobuf-dma-sg.h | 2 +- + 2 files changed, 13 insertions(+), 11 deletions(-) + +diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c b/drivers/media/v4l2-core/videobuf-dma-sg.c +index 46ff19df9f53..8dd0562de287 100644 +--- a/drivers/media/v4l2-core/videobuf-dma-sg.c ++++ b/drivers/media/v4l2-core/videobuf-dma-sg.c +@@ -180,7 +180,7 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma, + if (rw == READ) + flags |= FOLL_WRITE; + +- dprintk(1, "init user [0x%lx+0x%lx => %d pages]\n", ++ dprintk(1, "init user [0x%lx+0x%lx => %lu pages]\n", + data, size, dma->nr_pages); + + err = pin_user_pages(data & PAGE_MASK, dma->nr_pages, +@@ -188,7 +188,7 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma, + + if (err != dma->nr_pages) { + dma->nr_pages = (err >= 0) ? err : 0; +- dprintk(1, "pin_user_pages: err=%d [%d]\n", err, ++ dprintk(1, "pin_user_pages: err=%d [%lu]\n", err, + dma->nr_pages); + return err < 0 ? err : -EINVAL; + } +@@ -208,11 +208,11 @@ static int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction, + } + + static int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction, +- int nr_pages) ++ unsigned long nr_pages) + { + int i; + +- dprintk(1, "init kernel [%d pages]\n", nr_pages); ++ dprintk(1, "init kernel [%lu pages]\n", nr_pages); + + dma->direction = direction; + dma->vaddr_pages = kcalloc(nr_pages, sizeof(*dma->vaddr_pages), +@@ -238,11 +238,11 @@ static int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction, + dma->vaddr = vmap(dma->vaddr_pages, nr_pages, VM_MAP | VM_IOREMAP, + PAGE_KERNEL); + if (NULL == dma->vaddr) { +- dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages); ++ dprintk(1, "vmalloc_32(%lu pages) failed\n", nr_pages); + goto out_free_pages; + } + +- dprintk(1, "vmalloc is at addr %p, size=%d\n", ++ dprintk(1, "vmalloc is at addr %p, size=%lu\n", + dma->vaddr, nr_pages << PAGE_SHIFT); + + memset(dma->vaddr, 0, nr_pages << PAGE_SHIFT); +@@ -267,9 +267,9 @@ static int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction, + } + + static int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, +- dma_addr_t addr, int nr_pages) ++ dma_addr_t addr, unsigned long nr_pages) + { +- dprintk(1, "init overlay [%d pages @ bus 0x%lx]\n", ++ dprintk(1, "init overlay [%lu pages @ bus 0x%lx]\n", + nr_pages, (unsigned long)addr); + dma->direction = direction; + +@@ -500,9 +500,11 @@ static int __videobuf_iolock(struct videobuf_queue *q, + struct videobuf_buffer *vb, + struct v4l2_framebuffer *fbuf) + { +- int err, pages; +- dma_addr_t bus; + struct videobuf_dma_sg_memory *mem = vb->priv; ++ unsigned long pages; ++ dma_addr_t bus; ++ int err; ++ + BUG_ON(!mem); + + MAGIC_CHECK(mem->magic, MAGIC_SG_MEM); +diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h +index 34450f7ad510..930ff8d454fc 100644 +--- a/include/media/videobuf-dma-sg.h ++++ b/include/media/videobuf-dma-sg.h +@@ -60,7 +60,7 @@ struct videobuf_dmabuf { + /* common */ + struct scatterlist *sglist; + int sglen; +- int nr_pages; ++ unsigned long nr_pages; + int direction; + }; + + +From 613f4cb124631154bfa17e944e6809031e32fc74 Mon Sep 17 00:00:00 2001 +From: Alexandre Courbot +Date: Thu, 27 Aug 2020 14:49:45 +0200 +Subject: [PATCH] media: v4l2-mem2mem: always consider OUTPUT queue during poll + +If poll() is called on a m2m device with the EPOLLOUT event after the +last buffer of the CAPTURE queue is dequeued, any buffer available on +OUTPUT queue will never be signaled because v4l2_m2m_poll_for_data() +starts by checking whether dst_q->last_buffer_dequeued is set and +returns EPOLLIN in this case, without looking at the state of the OUTPUT +queue. + +Fix this by not early returning so we keep checking the state of the +OUTPUT queue afterwards. + +Signed-off-by: Alexandre Courbot +Reviewed-by: Ezequiel Garcia +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit 566463afdbc43c7744c5a1b89250fc808df03833) +--- + drivers/media/v4l2-core/v4l2-mem2mem.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c +index 6a80240e9228..121243e5bece 100644 +--- a/drivers/media/v4l2-core/v4l2-mem2mem.c ++++ b/drivers/media/v4l2-core/v4l2-mem2mem.c +@@ -909,10 +909,8 @@ static __poll_t v4l2_m2m_poll_for_data(struct file *file, + * If the last buffer was dequeued from the capture queue, + * return immediately. DQBUF will return -EPIPE. + */ +- if (dst_q->last_buffer_dequeued) { +- spin_unlock_irqrestore(&dst_q->done_lock, flags); +- return EPOLLIN | EPOLLRDNORM; +- } ++ if (dst_q->last_buffer_dequeued) ++ rc |= EPOLLIN | EPOLLRDNORM; + } + spin_unlock_irqrestore(&dst_q->done_lock, flags); + + +From 72d1b85060473b809d9450b54100a3e65331dea3 Mon Sep 17 00:00:00 2001 +From: Alexandre Courbot +Date: Thu, 27 Aug 2020 14:49:46 +0200 +Subject: [PATCH] media: v4l2-mem2mem: simplify poll logic + +Factorize redundant checks into a single code block, remove unneeded +checks (a buffer in done_list is necessarily in the DONE or ERROR +state), and we end up with a much simpler version of this function. + +Signed-off-by: Alexandre Courbot +Reviewed-by: Ezequiel Garcia +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit 1698a7f1511267a0d07a783dd467eab19bf498f3) +--- + drivers/media/v4l2-core/v4l2-mem2mem.c | 26 +++++--------------------- + 1 file changed, 5 insertions(+), 21 deletions(-) + +diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c +index 121243e5bece..f626ba5ee3d9 100644 +--- a/drivers/media/v4l2-core/v4l2-mem2mem.c ++++ b/drivers/media/v4l2-core/v4l2-mem2mem.c +@@ -882,7 +882,6 @@ static __poll_t v4l2_m2m_poll_for_data(struct file *file, + struct poll_table_struct *wait) + { + struct vb2_queue *src_q, *dst_q; +- struct vb2_buffer *src_vb = NULL, *dst_vb = NULL; + __poll_t rc = 0; + unsigned long flags; + +@@ -903,32 +902,17 @@ static __poll_t v4l2_m2m_poll_for_data(struct file *file, + list_empty(&dst_q->queued_list))) + return EPOLLERR; + +- spin_lock_irqsave(&dst_q->done_lock, flags); +- if (list_empty(&dst_q->done_list)) { +- /* +- * If the last buffer was dequeued from the capture queue, +- * return immediately. DQBUF will return -EPIPE. +- */ +- if (dst_q->last_buffer_dequeued) +- rc |= EPOLLIN | EPOLLRDNORM; +- } +- spin_unlock_irqrestore(&dst_q->done_lock, flags); +- + spin_lock_irqsave(&src_q->done_lock, flags); + if (!list_empty(&src_q->done_list)) +- src_vb = list_first_entry(&src_q->done_list, struct vb2_buffer, +- done_entry); +- if (src_vb && (src_vb->state == VB2_BUF_STATE_DONE +- || src_vb->state == VB2_BUF_STATE_ERROR)) + rc |= EPOLLOUT | EPOLLWRNORM; + spin_unlock_irqrestore(&src_q->done_lock, flags); + + spin_lock_irqsave(&dst_q->done_lock, flags); +- if (!list_empty(&dst_q->done_list)) +- dst_vb = list_first_entry(&dst_q->done_list, struct vb2_buffer, +- done_entry); +- if (dst_vb && (dst_vb->state == VB2_BUF_STATE_DONE +- || dst_vb->state == VB2_BUF_STATE_ERROR)) ++ /* ++ * If the last buffer was dequeued from the capture queue, signal ++ * userspace. DQBUF(CAPTURE) will return -EPIPE. ++ */ ++ if (!list_empty(&dst_q->done_list) || dst_q->last_buffer_dequeued) + rc |= EPOLLIN | EPOLLRDNORM; + spin_unlock_irqrestore(&dst_q->done_lock, flags); + + +From e12ddb183c1503d7f94320fd20e4e7f2828a0976 Mon Sep 17 00:00:00 2001 +From: Nicolas Dufresne +Date: Fri, 18 Sep 2020 02:27:51 +0200 +Subject: [PATCH] media: cedrus: Propagate OUTPUT resolution to CAPTURE + +As per spec, the CAPTURE resolution should be automatically set based on +the OUTPUT resolution. This patch properly propagate width/height to the +capture when the OUTPUT format is set and override the user provided +width/height with configured OUTPUT resolution when the CAPTURE fmt is +updated. + +This also prevents userspace from selecting a CAPTURE resolution that is +too small, avoiding kernel oops. + +Signed-off-by: Nicolas Dufresne +Reviewed-by: Ezequiel Garcia +Acked-by: Paul Kocialkowski +Tested-by: Ondrej Jirman +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit 8c608272ec3e6926ae2e258e74e84777d932ddd6) +--- + drivers/staging/media/sunxi/cedrus/cedrus_video.c | 29 +++++++++++++++++++++-- + 1 file changed, 27 insertions(+), 2 deletions(-) + +diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c +index 16d82309e7b6..667b86dde1ee 100644 +--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c ++++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c +@@ -247,6 +247,8 @@ static int cedrus_try_fmt_vid_cap(struct file *file, void *priv, + return -EINVAL; + + pix_fmt->pixelformat = fmt->pixelformat; ++ pix_fmt->width = ctx->src_fmt.width; ++ pix_fmt->height = ctx->src_fmt.height; + cedrus_prepare_format(pix_fmt); + + return 0; +@@ -296,10 +298,30 @@ static int cedrus_s_fmt_vid_out(struct file *file, void *priv, + { + struct cedrus_ctx *ctx = cedrus_file2ctx(file); + struct vb2_queue *vq; ++ struct vb2_queue *peer_vq; + int ret; + ++ ret = cedrus_try_fmt_vid_out(file, priv, f); ++ if (ret) ++ return ret; ++ + vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type); +- if (vb2_is_busy(vq)) ++ /* ++ * In order to support dynamic resolution change, ++ * the decoder admits a resolution change, as long ++ * as the pixelformat remains. Can't be done if streaming. ++ */ ++ if (vb2_is_streaming(vq) || (vb2_is_busy(vq) && ++ f->fmt.pix.pixelformat != ctx->src_fmt.pixelformat)) ++ return -EBUSY; ++ /* ++ * Since format change on the OUTPUT queue will reset ++ * the CAPTURE queue, we can't allow doing so ++ * when the CAPTURE queue has buffers allocated. ++ */ ++ peer_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, ++ V4L2_BUF_TYPE_VIDEO_CAPTURE); ++ if (vb2_is_busy(peer_vq)) + return -EBUSY; + + ret = cedrus_try_fmt_vid_out(file, priv, f); +@@ -319,11 +341,14 @@ static int cedrus_s_fmt_vid_out(struct file *file, void *priv, + break; + } + +- /* Propagate colorspace information to capture. */ ++ /* Propagate format information to capture. */ + ctx->dst_fmt.colorspace = f->fmt.pix.colorspace; + ctx->dst_fmt.xfer_func = f->fmt.pix.xfer_func; + ctx->dst_fmt.ycbcr_enc = f->fmt.pix.ycbcr_enc; + ctx->dst_fmt.quantization = f->fmt.pix.quantization; ++ ctx->dst_fmt.width = ctx->src_fmt.width; ++ ctx->dst_fmt.height = ctx->src_fmt.height; ++ cedrus_prepare_format(&ctx->dst_fmt); + + return 0; + } + +From 58605ff417174bf3310b01bcc7372a29425d1bdf Mon Sep 17 00:00:00 2001 +From: Ezequiel Garcia +Date: Mon, 28 Sep 2020 16:03:34 +0200 +Subject: [PATCH] media: v4l2-mem2mem: Fix spurious v4l2_m2m_buf_done + +A seemingly bad rebase introduced a spurious v4l2_m2m_buf_done, +which releases a buffer twice and therefore triggers a +noisy warning on each job: + +WARNING: CPU: 0 PID: 0 at drivers/media/common/videobuf2/videobuf2-core.c:986 vb2_buffer_done+0x208/0x2a0 + +Fix it by removing the spurious v4l2_m2m_buf_done. + +Reported-by: Adrian Ratiu +Fixes: 911ea8ec42dea ("media: v4l2-mem2mem: add v4l2_m2m_suspend, v4l2_m2m_resume") +Signed-off-by: Ezequiel Garcia +Tested-by: Adrian Ratiu +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit 1efe3c28eba1306b007f4cb9303a5646b47cb11b) +--- + drivers/media/v4l2-core/v4l2-mem2mem.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c +index f626ba5ee3d9..b221b4e438a1 100644 +--- a/drivers/media/v4l2-core/v4l2-mem2mem.c ++++ b/drivers/media/v4l2-core/v4l2-mem2mem.c +@@ -516,7 +516,6 @@ void v4l2_m2m_buf_done_and_job_finish(struct v4l2_m2m_dev *m2m_dev, + + if (WARN_ON(!src_buf || !dst_buf)) + goto unlock; +- v4l2_m2m_buf_done(src_buf, state); + dst_buf->is_held = src_buf->flags & V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF; + if (!dst_buf->is_held) { + v4l2_m2m_dst_buf_remove(m2m_ctx); diff --git a/projects/Rockchip/patches/linux/default/linux-0011-v4l2-from-5.9.patch b/projects/Rockchip/patches/linux/default/linux-0011-v4l2-from-5.9.patch deleted file mode 100644 index 25df0565fe..0000000000 --- a/projects/Rockchip/patches/linux/default/linux-0011-v4l2-from-5.9.patch +++ /dev/null @@ -1,1190 +0,0 @@ -From 36844f391c6e38eb536c4feae921f170963c7134 Mon Sep 17 00:00:00 2001 -From: Ezequiel Garcia -Date: Wed, 1 Jul 2020 15:17:30 +0200 -Subject: [PATCH] v4l2-core: Print control name in VIDIOC_S/G_(EXT)_CTRL(S) - -While debugging, it's currently really hard to identify controls -by their ID. Print the control name making the print more helpful. - -With this change, the print changes from: - -video1: VIDIOC_S_EXT_CTRLS: which=0xf010000, count=5, error_idx=4, request_fd=45, id/size=0x990ce8/1048, id/size=0x990ce9/12, id/size=0x990cea/480, id/size=0x990ceb/896, id/size=0x990cec/400 - -video1: VIDIOC_S_EXT_CTRLS: which=0xf010000, count=5, error_idx=4, request_fd=42, name=H264 Sequence Parameter Set, id/size=0x990ce8/1048, name=H264 Picture Parameter Set, id/size=0x990ce9/12, name=H264 Scaling Matrix, id/size=0x990cea/480, name=H264 Slice Parameters, id/size=0x990ceb/896, name=H264 Decode Parameters, id/size=0x990cec/400 - -For instance, this is specially helpful when the ioctl fails. Consider -the following example: - -v4l2-ctrls: prepare_ext_ctrls: video1: pointer control id 0x990cec size too small, 400 bytes but 784 bytes needed -v4l2-ctrls: try_set_ext_ctrls: video1: video1: try_set_ext_ctrls_common failed (-14) -video1: VIDIOC_S_EXT_CTRLS: error -14: which=0xf010000, count=5, error_idx=5, request_fd=39, name=H264 Sequence Parameter Set, id/size=0x990ce8/1048, name=H264 Picture Parameter Set, id/size=0x990ce9/12, name=H264 Scaling Matrix, id/size=0x990cea/480, name=H264 Slice Parameters, id/size=0x990ceb/896, name=H264 Decode Parameters, id/size=0x990cec/400 - -Signed-off-by: Ezequiel Garcia -Signed-off-by: Hans Verkuil -Signed-off-by: Mauro Carvalho Chehab -(cherry picked from commit a69a7a33268308ddcc9abf0f7d7cd61ec4300cbe) ---- - drivers/media/v4l2-core/v4l2-ioctl.c | 14 ++++++++++---- - 1 file changed, 10 insertions(+), 4 deletions(-) - -diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c -index 2322f08a98be..38eaee7eeff6 100644 ---- a/drivers/media/v4l2-core/v4l2-ioctl.c -+++ b/drivers/media/v4l2-core/v4l2-ioctl.c -@@ -582,7 +582,10 @@ static void v4l_print_querymenu(const void *arg, bool write_only) - static void v4l_print_control(const void *arg, bool write_only) - { - const struct v4l2_control *p = arg; -+ const char *name = v4l2_ctrl_get_name(p->id); - -+ if (name) -+ pr_cont("name=%s, ", name); - pr_cont("id=0x%x, value=%d\n", p->id, p->value); - } - -@@ -594,12 +597,15 @@ static void v4l_print_ext_controls(const void *arg, bool write_only) - pr_cont("which=0x%x, count=%d, error_idx=%d, request_fd=%d", - p->which, p->count, p->error_idx, p->request_fd); - for (i = 0; i < p->count; i++) { -+ unsigned int id = p->controls[i].id; -+ const char *name = v4l2_ctrl_get_name(id); -+ -+ if (name) -+ pr_cont(", name=%s", name); - if (!p->controls[i].size) -- pr_cont(", id/val=0x%x/0x%x", -- p->controls[i].id, p->controls[i].value); -+ pr_cont(", id/val=0x%x/0x%x", id, p->controls[i].value); - else -- pr_cont(", id/size=0x%x/%u", -- p->controls[i].id, p->controls[i].size); -+ pr_cont(", id/size=0x%x/%u", id, p->controls[i].size); - } - pr_cont("\n"); - } - -From 9d69da65b06b3f79acf76d2f7f1a4d3cf4205447 Mon Sep 17 00:00:00 2001 -From: Ezequiel Garcia -Date: Wed, 24 Jun 2020 21:28:00 +0200 -Subject: [PATCH] media: Add V4L2_TYPE_IS_CAPTURE helper - -It's all too easy to get confused by the V4L2_TYPE_IS_OUTPUT -macro, when it's used as !V4L2_TYPE_IS_OUTPUT. - -Reduce the risk of confusion with macro to explicitly -check for the CAPTURE queue type case. - -This change does not affect functionality, and it's -only intended to make the code more readable. - -Suggested-by: Nicolas Dufresne -Signed-off-by: Ezequiel Garcia -Signed-off-by: Hans Verkuil -[hverkuil-cisco@xs4all.nl: checkpatch: align with parenthesis] -Signed-off-by: Mauro Carvalho Chehab -(cherry picked from commit b3ab1c6058fad8cd5726f24e9ed9053e43bb2af4) ---- - drivers/media/common/videobuf2/videobuf2-v4l2.c | 4 ++-- - drivers/media/platform/exynos-gsc/gsc-core.c | 2 +- - drivers/media/platform/exynos-gsc/gsc-m2m.c | 2 +- - drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 2 +- - drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c | 7 +++---- - drivers/media/platform/rcar_jpu.c | 2 +- - drivers/media/platform/sti/hva/hva-v4l2.c | 2 +- - drivers/media/platform/ti-vpe/vpe.c | 2 +- - drivers/media/test-drivers/vicodec/vicodec-core.c | 6 +++--- - drivers/media/v4l2-core/v4l2-mem2mem.c | 6 +++--- - drivers/staging/media/hantro/hantro_v4l2.c | 2 +- - drivers/staging/media/rkvdec/rkvdec.c | 2 +- - include/uapi/linux/videodev2.h | 2 ++ - 13 files changed, 21 insertions(+), 20 deletions(-) - -diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c -index eb5d5db96552..fd32c2e64809 100644 ---- a/drivers/media/common/videobuf2/videobuf2-v4l2.c -+++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c -@@ -94,7 +94,7 @@ static int __verify_length(struct vb2_buffer *vb, const struct v4l2_buffer *b) - unsigned int bytesused; - unsigned int plane; - -- if (!V4L2_TYPE_IS_OUTPUT(b->type)) -+ if (V4L2_TYPE_IS_CAPTURE(b->type)) - return 0; - - if (V4L2_TYPE_IS_MULTIPLANAR(b->type)) { -@@ -307,7 +307,7 @@ static int vb2_fill_vb2_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b - - /* Zero flags that we handle */ - vbuf->flags = b->flags & ~V4L2_BUFFER_MASK_FLAGS; -- if (!vb->vb2_queue->copy_timestamp || !V4L2_TYPE_IS_OUTPUT(b->type)) { -+ if (!vb->vb2_queue->copy_timestamp || V4L2_TYPE_IS_CAPTURE(b->type)) { - /* - * Non-COPY timestamps and non-OUTPUT queues will get - * their timestamp and timestamp source flags from the -diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c -index f6650b45bc3d..9f41c2e7097a 100644 ---- a/drivers/media/platform/exynos-gsc/gsc-core.c -+++ b/drivers/media/platform/exynos-gsc/gsc-core.c -@@ -577,7 +577,7 @@ int gsc_try_selection(struct gsc_ctx *ctx, struct v4l2_selection *s) - v4l_bound_align_image(&tmp_w, min_w, max_w, mod_x, - &tmp_h, min_h, max_h, mod_y, 0); - -- if (!V4L2_TYPE_IS_OUTPUT(s->type) && -+ if (V4L2_TYPE_IS_CAPTURE(s->type) && - (ctx->gsc_ctrls.rotate->val == 90 || - ctx->gsc_ctrls.rotate->val == 270)) - gsc_check_crop_change(tmp_h, tmp_w, -diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c -index e2c162635f72..27a3c92c73bc 100644 ---- a/drivers/media/platform/exynos-gsc/gsc-m2m.c -+++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c -@@ -255,7 +255,7 @@ static int gsc_m2m_buf_prepare(struct vb2_buffer *vb) - if (IS_ERR(frame)) - return PTR_ERR(frame); - -- if (!V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type)) { -+ if (V4L2_TYPE_IS_CAPTURE(vb->vb2_queue->type)) { - for (i = 0; i < frame->fmt->num_planes; i++) - vb2_set_plane_payload(vb, i, frame->payload[i]); - } -diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c -index f82a81a3bdee..61fed1e35a00 100644 ---- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c -+++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c -@@ -731,7 +731,7 @@ static void mtk_jpeg_stop_streaming(struct vb2_queue *q) - * subsampling. Update capture queue when the stream is off. - */ - if (ctx->state == MTK_JPEG_SOURCE_CHANGE && -- !V4L2_TYPE_IS_OUTPUT(q->type)) { -+ V4L2_TYPE_IS_CAPTURE(q->type)) { - struct mtk_jpeg_src_buf *src_buf; - - vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); -diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c -index 821f2cf325f0..a6ea22b57416 100644 ---- a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c -+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c -@@ -193,7 +193,7 @@ static const struct mtk_mdp_fmt *mtk_mdp_try_fmt_mplane(struct mtk_mdp_ctx *ctx, - - pix_mp->field = V4L2_FIELD_NONE; - pix_mp->pixelformat = fmt->pixelformat; -- if (!V4L2_TYPE_IS_OUTPUT(f->type)) { -+ if (V4L2_TYPE_IS_CAPTURE(f->type)) { - pix_mp->colorspace = ctx->colorspace; - pix_mp->xfer_func = ctx->xfer_func; - pix_mp->ycbcr_enc = ctx->ycbcr_enc; -@@ -327,9 +327,8 @@ static int mtk_mdp_try_crop(struct mtk_mdp_ctx *ctx, u32 type, - mtk_mdp_bound_align_image(&new_w, min_w, max_w, align_w, - &new_h, min_h, max_h, align_h); - -- if (!V4L2_TYPE_IS_OUTPUT(type) && -- (ctx->ctrls.rotate->val == 90 || -- ctx->ctrls.rotate->val == 270)) -+ if (V4L2_TYPE_IS_CAPTURE(type) && -+ (ctx->ctrls.rotate->val == 90 || ctx->ctrls.rotate->val == 270)) - mtk_mdp_check_crop_change(new_h, new_w, - &r->width, &r->height); - else -diff --git a/drivers/media/platform/rcar_jpu.c b/drivers/media/platform/rcar_jpu.c -index 5250a14324e9..9b99ff368698 100644 ---- a/drivers/media/platform/rcar_jpu.c -+++ b/drivers/media/platform/rcar_jpu.c -@@ -1066,7 +1066,7 @@ static int jpu_buf_prepare(struct vb2_buffer *vb) - } - - /* decoder capture queue */ -- if (!ctx->encoder && !V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type)) -+ if (!ctx->encoder && V4L2_TYPE_IS_CAPTURE(vb->vb2_queue->type)) - vb2_set_plane_payload(vb, i, size); - } - -diff --git a/drivers/media/platform/sti/hva/hva-v4l2.c b/drivers/media/platform/sti/hva/hva-v4l2.c -index 197b99d8fd9c..bb34d6997d99 100644 ---- a/drivers/media/platform/sti/hva/hva-v4l2.c -+++ b/drivers/media/platform/sti/hva/hva-v4l2.c -@@ -1087,7 +1087,7 @@ static void hva_stop_streaming(struct vb2_queue *vq) - - if ((V4L2_TYPE_IS_OUTPUT(vq->type) && - vb2_is_streaming(&ctx->fh.m2m_ctx->cap_q_ctx.q)) || -- (!V4L2_TYPE_IS_OUTPUT(vq->type) && -+ (V4L2_TYPE_IS_CAPTURE(vq->type) && - vb2_is_streaming(&ctx->fh.m2m_ctx->out_q_ctx.q))) { - dev_dbg(dev, "%s %s out=%d cap=%d\n", - ctx->name, to_type_str(vq->type), -diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c -index cff2fcd6d812..346f8212791c 100644 ---- a/drivers/media/platform/ti-vpe/vpe.c -+++ b/drivers/media/platform/ti-vpe/vpe.c -@@ -1576,7 +1576,7 @@ static int vpe_g_fmt(struct file *file, void *priv, struct v4l2_format *f) - - *f = q_data->format; - -- if (!V4L2_TYPE_IS_OUTPUT(f->type)) { -+ if (V4L2_TYPE_IS_CAPTURE(f->type)) { - struct vpe_q_data *s_q_data; - struct v4l2_pix_format_mplane *spix; - -diff --git a/drivers/media/test-drivers/vicodec/vicodec-core.c b/drivers/media/test-drivers/vicodec/vicodec-core.c -index e879290727ef..8941d73f6611 100644 ---- a/drivers/media/test-drivers/vicodec/vicodec-core.c -+++ b/drivers/media/test-drivers/vicodec/vicodec-core.c -@@ -1442,7 +1442,7 @@ static void vicodec_buf_queue(struct vb2_buffer *vb) - .u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION, - }; - -- if (!V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type) && -+ if (V4L2_TYPE_IS_CAPTURE(vb->vb2_queue->type) && - vb2_is_streaming(vb->vb2_queue) && - v4l2_m2m_dst_buf_is_last(ctx->fh.m2m_ctx)) { - unsigned int i; -@@ -1479,7 +1479,7 @@ static void vicodec_buf_queue(struct vb2_buffer *vb) - * in the compressed stream - */ - if (ctx->is_stateless || ctx->is_enc || -- !V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type)) { -+ V4L2_TYPE_IS_CAPTURE(vb->vb2_queue->type)) { - v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf); - return; - } -@@ -1574,7 +1574,7 @@ static int vicodec_start_streaming(struct vb2_queue *q, - state->gop_cnt = 0; - - if ((V4L2_TYPE_IS_OUTPUT(q->type) && !ctx->is_enc) || -- (!V4L2_TYPE_IS_OUTPUT(q->type) && ctx->is_enc)) -+ (V4L2_TYPE_IS_CAPTURE(q->type) && ctx->is_enc)) - return 0; - - if (info->id == V4L2_PIX_FMT_FWHT || -diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c -index 62ac9424c92a..95a8f2dc5341 100644 ---- a/drivers/media/v4l2-core/v4l2-mem2mem.c -+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c -@@ -556,7 +556,7 @@ int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, - ret = vb2_querybuf(vq, buf); - - /* Adjust MMAP memory offsets for the CAPTURE queue */ -- if (buf->memory == V4L2_MEMORY_MMAP && !V4L2_TYPE_IS_OUTPUT(vq->type)) { -+ if (buf->memory == V4L2_MEMORY_MMAP && V4L2_TYPE_IS_CAPTURE(vq->type)) { - if (V4L2_TYPE_IS_MULTIPLANAR(vq->type)) { - for (i = 0; i < buf->length; ++i) - buf->m.planes[i].m.mem_offset -@@ -712,7 +712,7 @@ int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, - int ret; - - vq = v4l2_m2m_get_vq(m2m_ctx, buf->type); -- if (!V4L2_TYPE_IS_OUTPUT(vq->type) && -+ if (V4L2_TYPE_IS_CAPTURE(vq->type) && - (buf->flags & V4L2_BUF_FLAG_REQUEST_FD)) { - dprintk("%s: requests cannot be used with capture buffers\n", - __func__); -@@ -729,7 +729,7 @@ int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, - * buffer as DONE with LAST flag since it won't be queued on the - * device. - */ -- if (!V4L2_TYPE_IS_OUTPUT(vq->type) && -+ if (V4L2_TYPE_IS_CAPTURE(vq->type) && - vb2_is_streaming(vq) && !vb2_start_streaming_called(vq) && - (v4l2_m2m_has_stopped(m2m_ctx) || v4l2_m2m_dst_buf_is_last(m2m_ctx))) - v4l2_m2m_force_last_buf_done(m2m_ctx, vq); -diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c -index f28a94e2fa93..63859e8a0923 100644 ---- a/drivers/staging/media/hantro/hantro_v4l2.c -+++ b/drivers/staging/media/hantro/hantro_v4l2.c -@@ -237,7 +237,7 @@ static int hantro_try_fmt(const struct hantro_ctx *ctx, - enum v4l2_buf_type type) - { - const struct hantro_fmt *fmt, *vpu_fmt; -- bool capture = !V4L2_TYPE_IS_OUTPUT(type); -+ bool capture = V4L2_TYPE_IS_CAPTURE(type); - bool coded; - - coded = capture == hantro_is_encoder_ctx(ctx); -diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c -index 225eeca73356..fd68671f0286 100644 ---- a/drivers/staging/media/rkvdec/rkvdec.c -+++ b/drivers/staging/media/rkvdec/rkvdec.c -@@ -489,7 +489,7 @@ static int rkvdec_start_streaming(struct vb2_queue *q, unsigned int count) - const struct rkvdec_coded_fmt_desc *desc; - int ret; - -- if (!V4L2_TYPE_IS_OUTPUT(q->type)) -+ if (V4L2_TYPE_IS_CAPTURE(q->type)) - return 0; - - desc = ctx->coded_fmt_desc; -diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h -index c3a1cf1c507f..6fe8822d2cb4 100644 ---- a/include/uapi/linux/videodev2.h -+++ b/include/uapi/linux/videodev2.h -@@ -171,6 +171,8 @@ enum v4l2_buf_type { - || (type) == V4L2_BUF_TYPE_SDR_OUTPUT \ - || (type) == V4L2_BUF_TYPE_META_OUTPUT) - -+#define V4L2_TYPE_IS_CAPTURE(type) (!V4L2_TYPE_IS_OUTPUT(type)) -+ - enum v4l2_tuner_type { - V4L2_TUNER_RADIO = 1, - V4L2_TUNER_ANALOG_TV = 2, - -From d749cf811605c51dac943327a59f7bdcb3ed7235 Mon Sep 17 00:00:00 2001 -From: Ezequiel Garcia -Date: Wed, 1 Jul 2020 15:16:02 +0200 -Subject: [PATCH] hantro: h264: Remove unused macro definition - -The generic H264 reference list builder moved all -the users of this macro, but left the macro. - -Remove it. - -Signed-off-by: Ezequiel Garcia -Reviewed-by: Philipp Zabel -Signed-off-by: Hans Verkuil -Signed-off-by: Mauro Carvalho Chehab -(cherry picked from commit 3ebf271b1dee6df816bd8f2135218640c478dedd) ---- - drivers/staging/media/hantro/hantro_h264.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/drivers/staging/media/hantro/hantro_h264.c b/drivers/staging/media/hantro/hantro_h264.c -index d561f125085a..dd935d7009bf 100644 ---- a/drivers/staging/media/hantro/hantro_h264.c -+++ b/drivers/staging/media/hantro/hantro_h264.c -@@ -22,8 +22,6 @@ - #define POC_BUFFER_SIZE 34 - #define SCALING_LIST_SIZE (6 * 16 + 2 * 64) - --#define HANTRO_CMP(a, b) ((a) < (b) ? -1 : 1) -- - /* Data structure describing auxiliary buffer format. */ - struct hantro_h264_dec_priv_tbl { - u32 cabac_table[CABAC_INIT_BUFFER_SIZE]; - -From 9eabbf39cb2216e740d66176c4a5b8f284de04f2 Mon Sep 17 00:00:00 2001 -From: Ezequiel Garcia -Date: Wed, 1 Jul 2020 15:16:03 +0200 -Subject: [PATCH] hantro: h264: Rename scaling list handling function - -Commit e17f08e31666 ("media: hantro: Do not reorder -H264 scaling list") removed the scaling list reordering, -which was wrong and not needed. - -However, the name of the function stayed, which is -confusing for anyone reading the code. Rename -from "reorder" to "assemble" which is cleaner. - -This is just a cosmetic cleanup. - -Signed-off-by: Ezequiel Garcia -Reviewed-by: Philipp Zabel -Signed-off-by: Hans Verkuil -Signed-off-by: Mauro Carvalho Chehab -(cherry picked from commit 4df3a47e3422a9de1f3ce1a4ba8a0447a73e7567) ---- - drivers/staging/media/hantro/hantro_h264.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/staging/media/hantro/hantro_h264.c b/drivers/staging/media/hantro/hantro_h264.c -index dd935d7009bf..194d05848077 100644 ---- a/drivers/staging/media/hantro/hantro_h264.c -+++ b/drivers/staging/media/hantro/hantro_h264.c -@@ -193,7 +193,7 @@ static const u32 h264_cabac_table[] = { - }; - - static void --reorder_scaling_list(struct hantro_ctx *ctx) -+assemble_scaling_list(struct hantro_ctx *ctx) - { - const struct hantro_h264_dec_ctrls *ctrls = &ctx->h264_dec.ctrls; - const struct v4l2_ctrl_h264_scaling_matrix *scaling = ctrls->scaling; -@@ -235,7 +235,7 @@ static void prepare_table(struct hantro_ctx *ctx) - tbl->poc[32] = dec_param->top_field_order_cnt; - tbl->poc[33] = dec_param->bottom_field_order_cnt; - -- reorder_scaling_list(ctx); -+ assemble_scaling_list(ctx); - } - - static bool dpb_entry_match(const struct v4l2_h264_dpb_entry *a, - -From 46dce14fc3b553b0d6008b8880e53629aa842002 Mon Sep 17 00:00:00 2001 -From: Ezequiel Garcia -Date: Wed, 1 Jul 2020 15:16:04 +0200 -Subject: [PATCH] hantro: Rework how encoder and decoder are identified - -So far we've been using the .buf_finish hook to distinguish -decoder from encoder. This is unnecessarily obfuscated. - -Moreover, we want to move the buf_finish, so use a cleaner -scheme to distinguish the driver decoder/encoder type. - -Signed-off-by: Ezequiel Garcia -Reviewed-by: Philipp Zabel -Signed-off-by: Hans Verkuil -Signed-off-by: Mauro Carvalho Chehab -(cherry picked from commit 21f0315b7b3ee6ca909d81a963744671fb27bf71) ---- - drivers/staging/media/hantro/hantro.h | 6 +++--- - drivers/staging/media/hantro/hantro_drv.c | 9 +++------ - drivers/staging/media/hantro/hantro_v4l2.c | 28 ++++++++++++++-------------- - 3 files changed, 20 insertions(+), 23 deletions(-) - -diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h -index 3005207fc6fb..2284e23d8500 100644 ---- a/drivers/staging/media/hantro/hantro.h -+++ b/drivers/staging/media/hantro/hantro.h -@@ -199,6 +199,7 @@ struct hantro_dev { - * - * @dev: VPU driver data to which the context belongs. - * @fh: V4L2 file handler. -+ * @is_encoder: Decoder or encoder context? - * - * @sequence_cap: Sequence counter for capture queue - * @sequence_out: Sequence counter for output queue -@@ -223,6 +224,7 @@ struct hantro_dev { - struct hantro_ctx { - struct hantro_dev *dev; - struct v4l2_fh fh; -+ bool is_encoder; - - u32 sequence_cap; - u32 sequence_out; -@@ -399,8 +401,6 @@ static inline void hantro_reg_write_s(struct hantro_dev *vpu, - vdpu_write(vpu, vdpu_read_mask(vpu, reg, val), reg->base); - } - --bool hantro_is_encoder_ctx(const struct hantro_ctx *ctx); -- - void *hantro_get_ctrl(struct hantro_ctx *ctx, u32 id); - dma_addr_t hantro_get_ref(struct hantro_ctx *ctx, u64 ts); - -@@ -420,7 +420,7 @@ static inline bool - hantro_needs_postproc(const struct hantro_ctx *ctx, - const struct hantro_fmt *fmt) - { -- return !hantro_is_encoder_ctx(ctx) && fmt->fourcc != V4L2_PIX_FMT_NV12; -+ return !ctx->is_encoder && fmt->fourcc != V4L2_PIX_FMT_NV12; - } - - static inline dma_addr_t -diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c -index 0db8ad455160..9145d02e5d3c 100644 ---- a/drivers/staging/media/hantro/hantro_drv.c -+++ b/drivers/staging/media/hantro/hantro_drv.c -@@ -195,11 +195,6 @@ static void device_run(void *priv) - hantro_job_finish(ctx->dev, ctx, 0, VB2_BUF_STATE_ERROR); - } - --bool hantro_is_encoder_ctx(const struct hantro_ctx *ctx) --{ -- return ctx->buf_finish == hantro_enc_buf_finish; --} -- - static struct v4l2_m2m_ops vpu_m2m_ops = { - .device_run = device_run, - }; -@@ -240,7 +235,7 @@ queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq) - * - * For the DMA destination buffer, we use a bounce buffer. - */ -- if (hantro_is_encoder_ctx(ctx)) { -+ if (ctx->is_encoder) { - dst_vq->mem_ops = &vb2_vmalloc_memops; - } else { - dst_vq->bidirectional = true; -@@ -420,8 +415,10 @@ static int hantro_open(struct file *filp) - if (func->id == MEDIA_ENT_F_PROC_VIDEO_ENCODER) { - allowed_codecs = vpu->variant->codec & HANTRO_ENCODERS; - ctx->buf_finish = hantro_enc_buf_finish; -+ ctx->is_encoder = true; - } else if (func->id == MEDIA_ENT_F_PROC_VIDEO_DECODER) { - allowed_codecs = vpu->variant->codec & HANTRO_DECODERS; -+ ctx->is_encoder = false; - } else { - ret = -ENODEV; - goto err_ctx_free; -diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c -index 63859e8a0923..b668a82d40ad 100644 ---- a/drivers/staging/media/hantro/hantro_v4l2.c -+++ b/drivers/staging/media/hantro/hantro_v4l2.c -@@ -40,7 +40,7 @@ hantro_get_formats(const struct hantro_ctx *ctx, unsigned int *num_fmts) - { - const struct hantro_fmt *formats; - -- if (hantro_is_encoder_ctx(ctx)) { -+ if (ctx->is_encoder) { - formats = ctx->dev->variant->enc_fmts; - *num_fmts = ctx->dev->variant->num_enc_fmts; - } else { -@@ -55,7 +55,7 @@ static const struct hantro_fmt * - hantro_get_postproc_formats(const struct hantro_ctx *ctx, - unsigned int *num_fmts) - { -- if (hantro_is_encoder_ctx(ctx)) { -+ if (ctx->is_encoder) { - *num_fmts = 0; - return NULL; - } -@@ -158,7 +158,7 @@ static int vidioc_enum_fmt(struct file *file, void *priv, - * not MODE_NONE. - * - on the output side we want to filter out all MODE_NONE formats. - */ -- skip_mode_none = capture == hantro_is_encoder_ctx(ctx); -+ skip_mode_none = capture == ctx->is_encoder; - - formats = hantro_get_formats(ctx, &num_fmts); - for (i = 0; i < num_fmts; i++) { -@@ -240,7 +240,7 @@ static int hantro_try_fmt(const struct hantro_ctx *ctx, - bool capture = V4L2_TYPE_IS_CAPTURE(type); - bool coded; - -- coded = capture == hantro_is_encoder_ctx(ctx); -+ coded = capture == ctx->is_encoder; - - vpu_debug(4, "trying format %c%c%c%c\n", - (pix_mp->pixelformat & 0x7f), -@@ -257,7 +257,7 @@ static int hantro_try_fmt(const struct hantro_ctx *ctx, - if (coded) { - pix_mp->num_planes = 1; - vpu_fmt = fmt; -- } else if (hantro_is_encoder_ctx(ctx)) { -+ } else if (ctx->is_encoder) { - vpu_fmt = ctx->vpu_dst_fmt; - } else { - vpu_fmt = ctx->vpu_src_fmt; -@@ -330,7 +330,7 @@ hantro_reset_encoded_fmt(struct hantro_ctx *ctx) - - vpu_fmt = hantro_get_default_fmt(ctx, true); - -- if (hantro_is_encoder_ctx(ctx)) { -+ if (ctx->is_encoder) { - ctx->vpu_dst_fmt = vpu_fmt; - fmt = &ctx->dst_fmt; - } else { -@@ -341,7 +341,7 @@ hantro_reset_encoded_fmt(struct hantro_ctx *ctx) - hantro_reset_fmt(fmt, vpu_fmt); - fmt->width = vpu_fmt->frmsize.min_width; - fmt->height = vpu_fmt->frmsize.min_height; -- if (hantro_is_encoder_ctx(ctx)) -+ if (ctx->is_encoder) - hantro_set_fmt_cap(ctx, fmt); - else - hantro_set_fmt_out(ctx, fmt); -@@ -355,7 +355,7 @@ hantro_reset_raw_fmt(struct hantro_ctx *ctx) - - raw_vpu_fmt = hantro_get_default_fmt(ctx, false); - -- if (hantro_is_encoder_ctx(ctx)) { -+ if (ctx->is_encoder) { - ctx->vpu_src_fmt = raw_vpu_fmt; - raw_fmt = &ctx->src_fmt; - encoded_fmt = &ctx->dst_fmt; -@@ -368,7 +368,7 @@ hantro_reset_raw_fmt(struct hantro_ctx *ctx) - hantro_reset_fmt(raw_fmt, raw_vpu_fmt); - raw_fmt->width = encoded_fmt->width; - raw_fmt->width = encoded_fmt->width; -- if (hantro_is_encoder_ctx(ctx)) -+ if (ctx->is_encoder) - hantro_set_fmt_out(ctx, raw_fmt); - else - hantro_set_fmt_cap(ctx, raw_fmt); -@@ -409,7 +409,7 @@ static int hantro_set_fmt_out(struct hantro_ctx *ctx, - if (ret) - return ret; - -- if (!hantro_is_encoder_ctx(ctx)) { -+ if (!ctx->is_encoder) { - struct vb2_queue *peer_vq; - - /* -@@ -450,7 +450,7 @@ static int hantro_set_fmt_out(struct hantro_ctx *ctx, - * Note that hantro_reset_raw_fmt() also propagates size - * changes to the raw format. - */ -- if (!hantro_is_encoder_ctx(ctx)) -+ if (!ctx->is_encoder) - hantro_reset_raw_fmt(ctx); - - /* Colorimetry information are always propagated. */ -@@ -479,7 +479,7 @@ static int hantro_set_fmt_cap(struct hantro_ctx *ctx, - if (vb2_is_busy(vq)) - return -EBUSY; - -- if (hantro_is_encoder_ctx(ctx)) { -+ if (ctx->is_encoder) { - struct vb2_queue *peer_vq; - - /* -@@ -512,7 +512,7 @@ static int hantro_set_fmt_cap(struct hantro_ctx *ctx, - * Note that hantro_reset_raw_fmt() also propagates size - * changes to the raw format. - */ -- if (hantro_is_encoder_ctx(ctx)) -+ if (ctx->is_encoder) - hantro_reset_raw_fmt(ctx); - - /* Colorimetry information are always propagated. */ -@@ -655,7 +655,7 @@ static bool hantro_vq_is_coded(struct vb2_queue *q) - { - struct hantro_ctx *ctx = vb2_get_drv_priv(q); - -- return hantro_is_encoder_ctx(ctx) != V4L2_TYPE_IS_OUTPUT(q->type); -+ return ctx->is_encoder != V4L2_TYPE_IS_OUTPUT(q->type); - } - - static int hantro_start_streaming(struct vb2_queue *q, unsigned int count) - -From 25e06243f2b6d58dafa7ed480797e20dbc73f44b Mon Sep 17 00:00:00 2001 -From: Ezequiel Garcia -Date: Wed, 1 Jul 2020 15:16:05 +0200 -Subject: [PATCH] hantro: Move hantro_enc_buf_finish to JPEG codec_ops.done - -hantro_enc_buf_finish is used only for JPEG, and so should -be moved to JPEG codec_ops.done. - -This cleanup is also taking care of addressing -a subtle issue: checking the non-NULL bounce buffer -using ctx->jpeg_enc, which is a member of a union is -confusing and error-prone. - -Note that the issue is currently innocuous because an -encoder context only supports JPEG. - -The codec_ops.done has an argument that codec-specific code -shouldn't need, so drop that as well. - -Signed-off-by: Ezequiel Garcia -Reviewed-by: Philipp Zabel -Signed-off-by: Hans Verkuil -Signed-off-by: Mauro Carvalho Chehab -(cherry picked from commit e765dba11ec26d7ea42974ec4d470b5ce00be3de) ---- - drivers/staging/media/hantro/hantro.h | 7 ----- - drivers/staging/media/hantro/hantro_drv.c | 37 +++-------------------- - drivers/staging/media/hantro/hantro_h1_jpeg_enc.c | 17 +++++++++++ - drivers/staging/media/hantro/hantro_hw.h | 3 +- - drivers/staging/media/hantro/rk3288_vpu_hw.c | 1 + - 5 files changed, 24 insertions(+), 41 deletions(-) - -diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h -index 2284e23d8500..65f9f7ea7dcf 100644 ---- a/drivers/staging/media/hantro/hantro.h -+++ b/drivers/staging/media/hantro/hantro.h -@@ -212,9 +212,6 @@ struct hantro_dev { - * @ctrl_handler: Control handler used to register controls. - * @jpeg_quality: User-specified JPEG compression quality. - * -- * @buf_finish: Buffer finish. This depends on encoder or decoder -- * context, and it's called right before -- * calling v4l2_m2m_job_finish. - * @codec_ops: Set of operations related to codec mode. - * @postproc: Post-processing context. - * @jpeg_enc: JPEG-encoding context. -@@ -237,10 +234,6 @@ struct hantro_ctx { - struct v4l2_ctrl_handler ctrl_handler; - int jpeg_quality; - -- int (*buf_finish)(struct hantro_ctx *ctx, -- struct vb2_buffer *buf, -- unsigned int bytesused); -- - const struct hantro_codec_ops *codec_ops; - struct hantro_postproc_ctx postproc; - -diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c -index 9145d02e5d3c..88b5c5989d83 100644 ---- a/drivers/staging/media/hantro/hantro_drv.c -+++ b/drivers/staging/media/hantro/hantro_drv.c -@@ -56,37 +56,12 @@ dma_addr_t hantro_get_ref(struct hantro_ctx *ctx, u64 ts) - return hantro_get_dec_buf_addr(ctx, buf); - } - --static int --hantro_enc_buf_finish(struct hantro_ctx *ctx, struct vb2_buffer *buf, -- unsigned int bytesused) --{ -- size_t avail_size; -- -- avail_size = vb2_plane_size(buf, 0) - ctx->vpu_dst_fmt->header_size; -- if (bytesused > avail_size) -- return -EINVAL; -- /* -- * The bounce buffer is only for the JPEG encoder. -- * TODO: Rework the JPEG encoder to eliminate the need -- * for a bounce buffer. -- */ -- if (ctx->jpeg_enc.bounce_buffer.cpu) { -- memcpy(vb2_plane_vaddr(buf, 0) + -- ctx->vpu_dst_fmt->header_size, -- ctx->jpeg_enc.bounce_buffer.cpu, bytesused); -- } -- buf->planes[0].bytesused = -- ctx->vpu_dst_fmt->header_size + bytesused; -- return 0; --} -- - static void hantro_job_finish(struct hantro_dev *vpu, - struct hantro_ctx *ctx, - unsigned int bytesused, - enum vb2_buffer_state result) - { - struct vb2_v4l2_buffer *src, *dst; -- int ret; - - pm_runtime_mark_last_busy(vpu->dev); - pm_runtime_put_autosuspend(vpu->dev); -@@ -103,12 +78,6 @@ static void hantro_job_finish(struct hantro_dev *vpu, - src->sequence = ctx->sequence_out++; - dst->sequence = ctx->sequence_cap++; - -- if (ctx->buf_finish) { -- ret = ctx->buf_finish(ctx, &dst->vb2_buf, bytesused); -- if (ret) -- result = VB2_BUF_STATE_ERROR; -- } -- - v4l2_m2m_buf_done_and_job_finish(ctx->dev->m2m_dev, ctx->fh.m2m_ctx, - result); - } -@@ -124,8 +93,11 @@ void hantro_irq_done(struct hantro_dev *vpu, unsigned int bytesused, - * the timeout expired. The watchdog is running, - * and will take care of finishing the job. - */ -- if (cancel_delayed_work(&vpu->watchdog_work)) -+ if (cancel_delayed_work(&vpu->watchdog_work)) { -+ if (result == VB2_BUF_STATE_DONE && ctx->codec_ops->done) -+ ctx->codec_ops->done(ctx); - hantro_job_finish(vpu, ctx, bytesused, result); -+ } - } - - void hantro_watchdog(struct work_struct *work) -@@ -414,7 +386,6 @@ static int hantro_open(struct file *filp) - ctx->dev = vpu; - if (func->id == MEDIA_ENT_F_PROC_VIDEO_ENCODER) { - allowed_codecs = vpu->variant->codec & HANTRO_ENCODERS; -- ctx->buf_finish = hantro_enc_buf_finish; - ctx->is_encoder = true; - } else if (func->id == MEDIA_ENT_F_PROC_VIDEO_DECODER) { - allowed_codecs = vpu->variant->codec & HANTRO_DECODERS; -diff --git a/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c b/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c -index b22418436823..b88dc4ed06db 100644 ---- a/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c -+++ b/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c -@@ -137,3 +137,20 @@ void hantro_h1_jpeg_enc_run(struct hantro_ctx *ctx) - - vepu_write(vpu, reg, H1_REG_ENC_CTRL); - } -+ -+void hantro_jpeg_enc_done(struct hantro_ctx *ctx) -+{ -+ struct hantro_dev *vpu = ctx->dev; -+ u32 bytesused = vepu_read(vpu, H1_REG_STR_BUF_LIMIT) / 8; -+ struct vb2_v4l2_buffer *dst_buf = hantro_get_dst_buf(ctx); -+ -+ /* -+ * TODO: Rework the JPEG encoder to eliminate the need -+ * for a bounce buffer. -+ */ -+ memcpy(vb2_plane_vaddr(&dst_buf->vb2_buf, 0) + -+ ctx->vpu_dst_fmt->header_size, -+ ctx->jpeg_enc.bounce_buffer.cpu, bytesused); -+ vb2_set_plane_payload(&dst_buf->vb2_buf, 0, -+ ctx->vpu_dst_fmt->header_size + bytesused); -+} -diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h -index 4053d8710e04..2d6323cd6732 100644 ---- a/drivers/staging/media/hantro/hantro_hw.h -+++ b/drivers/staging/media/hantro/hantro_hw.h -@@ -138,7 +138,7 @@ struct hantro_codec_ops { - int (*init)(struct hantro_ctx *ctx); - void (*exit)(struct hantro_ctx *ctx); - void (*run)(struct hantro_ctx *ctx); -- void (*done)(struct hantro_ctx *ctx, enum vb2_buffer_state); -+ void (*done)(struct hantro_ctx *ctx); - void (*reset)(struct hantro_ctx *ctx); - }; - -@@ -172,6 +172,7 @@ void hantro_h1_jpeg_enc_run(struct hantro_ctx *ctx); - void rk3399_vpu_jpeg_enc_run(struct hantro_ctx *ctx); - int hantro_jpeg_enc_init(struct hantro_ctx *ctx); - void hantro_jpeg_enc_exit(struct hantro_ctx *ctx); -+void hantro_jpeg_enc_done(struct hantro_ctx *ctx); - - dma_addr_t hantro_h264_get_ref_buf(struct hantro_ctx *ctx, - unsigned int dpb_idx); -diff --git a/drivers/staging/media/hantro/rk3288_vpu_hw.c b/drivers/staging/media/hantro/rk3288_vpu_hw.c -index 2f914b37b9e5..b1cf2abb972f 100644 ---- a/drivers/staging/media/hantro/rk3288_vpu_hw.c -+++ b/drivers/staging/media/hantro/rk3288_vpu_hw.c -@@ -180,6 +180,7 @@ static const struct hantro_codec_ops rk3288_vpu_codec_ops[] = { - .run = hantro_h1_jpeg_enc_run, - .reset = rk3288_vpu_enc_reset, - .init = hantro_jpeg_enc_init, -+ .done = hantro_jpeg_enc_done, - .exit = hantro_jpeg_enc_exit, - }, - [HANTRO_MODE_H264_DEC] = { - -From 7c9520827a7dc71dbfd0c43f95805c2c6e3ce0bb Mon Sep 17 00:00:00 2001 -From: Ezequiel Garcia -Date: Wed, 1 Jul 2020 15:16:06 +0200 -Subject: [PATCH] hantro: Remove unused bytesused argument - -The driver doesn't need the bytesused argument. - -For decoders, the plane bytesused is known and therefore, -buf_prepare is used to set it. For encoders, it's -handled by the codec_ops.done hook. - -Signed-off-by: Ezequiel Garcia -Reviewed-by: Philipp Zabel -Signed-off-by: Hans Verkuil -Signed-off-by: Mauro Carvalho Chehab -(cherry picked from commit b72a6342dd240ce8e15b7acf1c38c67a0c56092b) ---- - drivers/staging/media/hantro/hantro_drv.c | 9 ++++----- - drivers/staging/media/hantro/hantro_hw.h | 2 +- - drivers/staging/media/hantro/imx8m_vpu_hw.c | 2 +- - drivers/staging/media/hantro/rk3288_vpu_hw.c | 7 +++---- - drivers/staging/media/hantro/rk3399_vpu_hw.c | 7 +++---- - 5 files changed, 12 insertions(+), 15 deletions(-) - -diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c -index 88b5c5989d83..34367b169011 100644 ---- a/drivers/staging/media/hantro/hantro_drv.c -+++ b/drivers/staging/media/hantro/hantro_drv.c -@@ -58,7 +58,6 @@ dma_addr_t hantro_get_ref(struct hantro_ctx *ctx, u64 ts) - - static void hantro_job_finish(struct hantro_dev *vpu, - struct hantro_ctx *ctx, -- unsigned int bytesused, - enum vb2_buffer_state result) - { - struct vb2_v4l2_buffer *src, *dst; -@@ -82,7 +81,7 @@ static void hantro_job_finish(struct hantro_dev *vpu, - result); - } - --void hantro_irq_done(struct hantro_dev *vpu, unsigned int bytesused, -+void hantro_irq_done(struct hantro_dev *vpu, - enum vb2_buffer_state result) - { - struct hantro_ctx *ctx = -@@ -96,7 +95,7 @@ void hantro_irq_done(struct hantro_dev *vpu, unsigned int bytesused, - if (cancel_delayed_work(&vpu->watchdog_work)) { - if (result == VB2_BUF_STATE_DONE && ctx->codec_ops->done) - ctx->codec_ops->done(ctx); -- hantro_job_finish(vpu, ctx, bytesused, result); -+ hantro_job_finish(vpu, ctx, result); - } - } - -@@ -111,7 +110,7 @@ void hantro_watchdog(struct work_struct *work) - if (ctx) { - vpu_err("frame processing timed out!\n"); - ctx->codec_ops->reset(ctx); -- hantro_job_finish(vpu, ctx, 0, VB2_BUF_STATE_ERROR); -+ hantro_job_finish(vpu, ctx, VB2_BUF_STATE_ERROR); - } - } - -@@ -164,7 +163,7 @@ static void device_run(void *priv) - return; - - err_cancel_job: -- hantro_job_finish(ctx->dev, ctx, 0, VB2_BUF_STATE_ERROR); -+ hantro_job_finish(ctx->dev, ctx, VB2_BUF_STATE_ERROR); - } - - static struct v4l2_m2m_ops vpu_m2m_ops = { -diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h -index 2d6323cd6732..f066de6b592d 100644 ---- a/drivers/staging/media/hantro/hantro_hw.h -+++ b/drivers/staging/media/hantro/hantro_hw.h -@@ -163,7 +163,7 @@ extern const u32 hantro_vp8_dec_mc_filter[8][6]; - - void hantro_watchdog(struct work_struct *work); - void hantro_run(struct hantro_ctx *ctx); --void hantro_irq_done(struct hantro_dev *vpu, unsigned int bytesused, -+void hantro_irq_done(struct hantro_dev *vpu, - enum vb2_buffer_state result); - void hantro_start_prepare_run(struct hantro_ctx *ctx); - void hantro_end_prepare_run(struct hantro_ctx *ctx); -diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c -index cb2420c5526e..c222de075ef4 100644 ---- a/drivers/staging/media/hantro/imx8m_vpu_hw.c -+++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c -@@ -143,7 +143,7 @@ static irqreturn_t imx8m_vpu_g1_irq(int irq, void *dev_id) - vdpu_write(vpu, 0, G1_REG_INTERRUPT); - vdpu_write(vpu, G1_REG_CONFIG_DEC_CLK_GATE_E, G1_REG_CONFIG); - -- hantro_irq_done(vpu, 0, state); -+ hantro_irq_done(vpu, state); - - return IRQ_HANDLED; - } -diff --git a/drivers/staging/media/hantro/rk3288_vpu_hw.c b/drivers/staging/media/hantro/rk3288_vpu_hw.c -index b1cf2abb972f..7b299ee3e93d 100644 ---- a/drivers/staging/media/hantro/rk3288_vpu_hw.c -+++ b/drivers/staging/media/hantro/rk3288_vpu_hw.c -@@ -113,17 +113,16 @@ static irqreturn_t rk3288_vepu_irq(int irq, void *dev_id) - { - struct hantro_dev *vpu = dev_id; - enum vb2_buffer_state state; -- u32 status, bytesused; -+ u32 status; - - status = vepu_read(vpu, H1_REG_INTERRUPT); -- bytesused = vepu_read(vpu, H1_REG_STR_BUF_LIMIT) / 8; - state = (status & H1_REG_INTERRUPT_FRAME_RDY) ? - VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR; - - vepu_write(vpu, 0, H1_REG_INTERRUPT); - vepu_write(vpu, 0, H1_REG_AXI_CTRL); - -- hantro_irq_done(vpu, bytesused, state); -+ hantro_irq_done(vpu, state); - - return IRQ_HANDLED; - } -@@ -141,7 +140,7 @@ static irqreturn_t rk3288_vdpu_irq(int irq, void *dev_id) - vdpu_write(vpu, 0, G1_REG_INTERRUPT); - vdpu_write(vpu, G1_REG_CONFIG_DEC_CLK_GATE_E, G1_REG_CONFIG); - -- hantro_irq_done(vpu, 0, state); -+ hantro_irq_done(vpu, state); - - return IRQ_HANDLED; - } -diff --git a/drivers/staging/media/hantro/rk3399_vpu_hw.c b/drivers/staging/media/hantro/rk3399_vpu_hw.c -index 9ac1f2cb6a16..7a7962cf771e 100644 ---- a/drivers/staging/media/hantro/rk3399_vpu_hw.c -+++ b/drivers/staging/media/hantro/rk3399_vpu_hw.c -@@ -92,17 +92,16 @@ static irqreturn_t rk3399_vepu_irq(int irq, void *dev_id) - { - struct hantro_dev *vpu = dev_id; - enum vb2_buffer_state state; -- u32 status, bytesused; -+ u32 status; - - status = vepu_read(vpu, VEPU_REG_INTERRUPT); -- bytesused = vepu_read(vpu, VEPU_REG_STR_BUF_LIMIT) / 8; - state = (status & VEPU_REG_INTERRUPT_FRAME_READY) ? - VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR; - - vepu_write(vpu, 0, VEPU_REG_INTERRUPT); - vepu_write(vpu, 0, VEPU_REG_AXI_CTRL); - -- hantro_irq_done(vpu, bytesused, state); -+ hantro_irq_done(vpu, state); - - return IRQ_HANDLED; - } -@@ -120,7 +119,7 @@ static irqreturn_t rk3399_vdpu_irq(int irq, void *dev_id) - vdpu_write(vpu, 0, VDPU_REG_INTERRUPT); - vdpu_write(vpu, 0, VDPU_REG_AXI_CTRL); - -- hantro_irq_done(vpu, 0, state); -+ hantro_irq_done(vpu, state); - - return IRQ_HANDLED; - } - -From 6724a9b87cff7d869b51fe6c0a9dc65d2c7e839a Mon Sep 17 00:00:00 2001 -From: Ezequiel Garcia -Date: Wed, 1 Jul 2020 15:16:07 +0200 -Subject: [PATCH] hantro: Make sure we don't use post-processor on an encoder - -Commit 986eee3a5234 ("media: hantro: Prevent encoders from using -post-processing") fixed hantro_needs_postproc condition, -but missed one case. Encoders don't have any post-processor -hardware block, so also can't be disabled. - -Fix it. - -Fixes: 986eee3a5234 ("media: hantro: Prevent encoders from using post-processing") -Signed-off-by: Ezequiel Garcia -Reviewed-by: Philipp Zabel -Signed-off-by: Hans Verkuil -Signed-off-by: Mauro Carvalho Chehab -(cherry picked from commit 46d7aaebbe441d5381e35d8e16df784690e65ef3) ---- - drivers/staging/media/hantro/hantro_drv.c | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c -index 34367b169011..d32b6b1ab70b 100644 ---- a/drivers/staging/media/hantro/hantro_drv.c -+++ b/drivers/staging/media/hantro/hantro_drv.c -@@ -122,10 +122,12 @@ void hantro_start_prepare_run(struct hantro_ctx *ctx) - v4l2_ctrl_request_setup(src_buf->vb2_buf.req_obj.req, - &ctx->ctrl_handler); - -- if (hantro_needs_postproc(ctx, ctx->vpu_dst_fmt)) -- hantro_postproc_enable(ctx); -- else -- hantro_postproc_disable(ctx); -+ if (!ctx->is_encoder) { -+ if (hantro_needs_postproc(ctx, ctx->vpu_dst_fmt)) -+ hantro_postproc_enable(ctx); -+ else -+ hantro_postproc_disable(ctx); -+ } - } - - void hantro_end_prepare_run(struct hantro_ctx *ctx) - -From 6e0c6cfb81852324a6f77e306346ab894416b41f Mon Sep 17 00:00:00 2001 -From: Ezequiel Garcia -Date: Thu, 9 Jul 2020 18:36:34 +0200 -Subject: [PATCH] rkvdec: h264: Refuse to decode unsupported bitstream - -The hardware only supports 4:2:2, 4:2:0 or 4:0:0 (monochrome), -8-bit or 10-bit depth content. - -Verify that the SPS refers to a supported bitstream, and refuse -unsupported bitstreams by failing at TRY_EXT_CTRLS time. - -The driver is currently broken on 10-bit and 4:2:2 -so disallow those as well. - -Signed-off-by: Ezequiel Garcia -Reviewed-by: Jonas Karlman -Signed-off-by: Hans Verkuil -Signed-off-by: Mauro Carvalho Chehab -(cherry picked from commit 9363aa33f6a9acfd16f98c749f17f6c65d184670) ---- - drivers/staging/media/rkvdec/rkvdec.c | 27 +++++++++++++++++++++++++++ - 1 file changed, 27 insertions(+) - -diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c -index fd68671f0286..c8151328fb70 100644 ---- a/drivers/staging/media/rkvdec/rkvdec.c -+++ b/drivers/staging/media/rkvdec/rkvdec.c -@@ -27,6 +27,32 @@ - #include "rkvdec.h" - #include "rkvdec-regs.h" - -+static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl) -+{ -+ if (ctrl->id == V4L2_CID_MPEG_VIDEO_H264_SPS) { -+ const struct v4l2_ctrl_h264_sps *sps = ctrl->p_new.p_h264_sps; -+ /* -+ * TODO: The hardware supports 10-bit and 4:2:2 profiles, -+ * but it's currently broken in the driver. -+ * Reject them for now, until it's fixed. -+ */ -+ if (sps->chroma_format_idc > 1) -+ /* Only 4:0:0 and 4:2:0 are supported */ -+ return -EINVAL; -+ if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8) -+ /* Luma and chroma bit depth mismatch */ -+ return -EINVAL; -+ if (sps->bit_depth_luma_minus8 != 0) -+ /* Only 8-bit is supported */ -+ return -EINVAL; -+ } -+ return 0; -+} -+ -+static const struct v4l2_ctrl_ops rkvdec_ctrl_ops = { -+ .try_ctrl = rkvdec_try_ctrl, -+}; -+ - static const struct rkvdec_ctrl_desc rkvdec_h264_ctrl_descs[] = { - { - .per_request = true, -@@ -42,6 +68,7 @@ static const struct rkvdec_ctrl_desc rkvdec_h264_ctrl_descs[] = { - .per_request = true, - .mandatory = true, - .cfg.id = V4L2_CID_MPEG_VIDEO_H264_SPS, -+ .cfg.ops = &rkvdec_ctrl_ops, - }, - { - .per_request = true, - -From ce193e381cc2124e82c3e167996726953c0b8365 Mon Sep 17 00:00:00 2001 -From: Ezequiel Garcia -Date: Thu, 9 Jul 2020 18:36:35 +0200 -Subject: [PATCH] hantro: h264: Refuse to decode unsupported bitstream - -The hardware only supports 4:2:0 or 4:0:0 (monochrome), -8-bit depth content. - -Verify that the SPS refers to a supported bitstream, and refuse -unsupported bitstreams by failing at TRY_EXT_CTRLS time. - -Given the JPEG compression level control is the only one -that needs setting, a specific ops is provided. - -Signed-off-by: Ezequiel Garcia -Reviewed-by: Philipp Zabel -Reviewed-by: Jonas Karlman -Signed-off-by: Hans Verkuil -Signed-off-by: Mauro Carvalho Chehab -(cherry picked from commit d70cca7323442026e20c474314518c446cb4766f) ---- - drivers/staging/media/hantro/hantro_drv.c | 29 ++++++++++++++++++++++++++--- - 1 file changed, 26 insertions(+), 3 deletions(-) - -diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c -index d32b6b1ab70b..34797507f214 100644 ---- a/drivers/staging/media/hantro/hantro_drv.c -+++ b/drivers/staging/media/hantro/hantro_drv.c -@@ -229,7 +229,25 @@ queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq) - return vb2_queue_init(dst_vq); - } - --static int hantro_s_ctrl(struct v4l2_ctrl *ctrl) -+static int hantro_try_ctrl(struct v4l2_ctrl *ctrl) -+{ -+ if (ctrl->id == V4L2_CID_MPEG_VIDEO_H264_SPS) { -+ const struct v4l2_ctrl_h264_sps *sps = ctrl->p_new.p_h264_sps; -+ -+ if (sps->chroma_format_idc > 1) -+ /* Only 4:0:0 and 4:2:0 are supported */ -+ return -EINVAL; -+ if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8) -+ /* Luma and chroma bit depth mismatch */ -+ return -EINVAL; -+ if (sps->bit_depth_luma_minus8 != 0) -+ /* Only 8-bit is supported */ -+ return -EINVAL; -+ } -+ return 0; -+} -+ -+static int hantro_jpeg_s_ctrl(struct v4l2_ctrl *ctrl) - { - struct hantro_ctx *ctx; - -@@ -250,7 +268,11 @@ static int hantro_s_ctrl(struct v4l2_ctrl *ctrl) - } - - static const struct v4l2_ctrl_ops hantro_ctrl_ops = { -- .s_ctrl = hantro_s_ctrl, -+ .try_ctrl = hantro_try_ctrl, -+}; -+ -+static const struct v4l2_ctrl_ops hantro_jpeg_ctrl_ops = { -+ .s_ctrl = hantro_jpeg_s_ctrl, - }; - - static const struct hantro_ctrl controls[] = { -@@ -262,7 +284,7 @@ static const struct hantro_ctrl controls[] = { - .max = 100, - .step = 1, - .def = 50, -- .ops = &hantro_ctrl_ops, -+ .ops = &hantro_jpeg_ctrl_ops, - }, - }, { - .codec = HANTRO_MPEG2_DECODER, -@@ -293,6 +315,7 @@ static const struct hantro_ctrl controls[] = { - .codec = HANTRO_H264_DECODER, - .cfg = { - .id = V4L2_CID_MPEG_VIDEO_H264_SPS, -+ .ops = &hantro_ctrl_ops, - }, - }, { - .codec = HANTRO_H264_DECODER, diff --git a/projects/Rockchip/patches/linux/default/linux-0021-drm-from-5.10.patch b/projects/Rockchip/patches/linux/default/linux-0021-drm-from-5.10.patch new file mode 100644 index 0000000000..8d832159a9 --- /dev/null +++ b/projects/Rockchip/patches/linux/default/linux-0021-drm-from-5.10.patch @@ -0,0 +1,2953 @@ +From b162fb6ee80dd2a986dc4d0d4eaefd29f9152f9c Mon Sep 17 00:00:00 2001 +From: Tomeu Vizoso +Date: Thu, 11 Jun 2020 10:58:43 +0200 +Subject: [PATCH] drm/panfrost: Make sure GPU is powered on when reading + GPU_LATEST_FLUSH_ID + +Bifrost devices do support the flush reduction feature, so on first job +submit we were trying to read the register while still powered off. + +If the GPU is powered off, the feature doesn't bring any benefit, so +don't try to read. + +Tested-by: Heiko Stuebner +Reviewed-by: Steven Price +Signed-off-by: Tomeu Vizoso +Signed-off-by: Rob Herring +Link: https://patchwork.freedesktop.org/patch/msgid/20200611085900.49740-1-tomeu.vizoso@collabora.com +(cherry picked from commit 3a74265c54f883c847ed8554129baefb3e04f135) +--- + drivers/gpu/drm/panfrost/panfrost_gpu.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c +index f2c1ddc41a9b..e0f190e43813 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_gpu.c ++++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + + #include "panfrost_device.h" + #include "panfrost_features.h" +@@ -368,7 +369,16 @@ void panfrost_gpu_fini(struct panfrost_device *pfdev) + + u32 panfrost_gpu_get_latest_flush_id(struct panfrost_device *pfdev) + { +- if (panfrost_has_hw_feature(pfdev, HW_FEATURE_FLUSH_REDUCTION)) +- return gpu_read(pfdev, GPU_LATEST_FLUSH_ID); ++ u32 flush_id; ++ ++ if (panfrost_has_hw_feature(pfdev, HW_FEATURE_FLUSH_REDUCTION)) { ++ /* Flush reduction only makes sense when the GPU is kept powered on between jobs */ ++ if (pm_runtime_get_if_in_use(pfdev->dev)) { ++ flush_id = gpu_read(pfdev, GPU_LATEST_FLUSH_ID); ++ pm_runtime_put(pfdev->dev); ++ return flush_id; ++ } ++ } ++ + return 0; + } + +From 2aacfa5ced256a281c36ea2577fc5fb7a4974e9b Mon Sep 17 00:00:00 2001 +From: Tomeu Vizoso +Date: Thu, 11 Jun 2020 10:58:44 +0200 +Subject: [PATCH] drm/panfrost: Add compatible string for bifrost + +Mesa now supports some Bifrost devices, so enable it. + +Tested-by: Heiko Stuebner +Reviewed-by: Steven Price +Reviewed-by: Heiko Stuebner +Signed-off-by: Tomeu Vizoso +Signed-off-by: Rob Herring +Link: https://patchwork.freedesktop.org/patch/msgid/20200611085900.49740-2-tomeu.vizoso@collabora.com +(cherry picked from commit 72ef7fe96fd20d3d0e538e165b393819f99870ad) +--- + drivers/gpu/drm/panfrost/panfrost_drv.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c +index ada51df9a7a3..f79f98534ab6 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_drv.c ++++ b/drivers/gpu/drm/panfrost/panfrost_drv.c +@@ -677,6 +677,7 @@ static const struct of_device_id dt_match[] = { + { .compatible = "arm,mali-t830", .data = &default_data, }, + { .compatible = "arm,mali-t860", .data = &default_data, }, + { .compatible = "arm,mali-t880", .data = &default_data, }, ++ { .compatible = "arm,mali-bifrost", .data = &default_data, }, + {} + }; + MODULE_DEVICE_TABLE(of, dt_match); + +From ef833747ee892a26711ee7765ff81166cd5f1d52 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= +Date: Fri, 10 Jul 2020 11:53:56 +0200 +Subject: [PATCH] drm/panfrost: avoid static declaration +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This declaration can be avoided so change it. + +Reviewed-by: Steven Price +Reviewed-by: Alyssa Rosenzweig +Signed-off-by: Clément Péron +Signed-off-by: Rob Herring +Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-2-peron.clem@gmail.com +(cherry picked from commit 862cc626210e34501b4d7a7795c41a67785987e5) +--- + drivers/gpu/drm/panfrost/panfrost_devfreq.c | 38 ++++++++++++++--------------- + 1 file changed, 18 insertions(+), 20 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c +index 413987038fbf..1b560b903ea6 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c ++++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c +@@ -14,7 +14,24 @@ + #include "panfrost_gpu.h" + #include "panfrost_regs.h" + +-static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev); ++static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev) ++{ ++ ktime_t now; ++ ktime_t last; ++ ++ if (!pfdev->devfreq.devfreq) ++ return; ++ ++ now = ktime_get(); ++ last = pfdev->devfreq.time_last_update; ++ ++ if (atomic_read(&pfdev->devfreq.busy_count) > 0) ++ pfdev->devfreq.busy_time += ktime_sub(now, last); ++ else ++ pfdev->devfreq.idle_time += ktime_sub(now, last); ++ ++ pfdev->devfreq.time_last_update = now; ++} + + static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, + u32 flags) +@@ -139,25 +156,6 @@ void panfrost_devfreq_suspend(struct panfrost_device *pfdev) + devfreq_suspend_device(pfdev->devfreq.devfreq); + } + +-static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev) +-{ +- ktime_t now; +- ktime_t last; +- +- if (!pfdev->devfreq.devfreq) +- return; +- +- now = ktime_get(); +- last = pfdev->devfreq.time_last_update; +- +- if (atomic_read(&pfdev->devfreq.busy_count) > 0) +- pfdev->devfreq.busy_time += ktime_sub(now, last); +- else +- pfdev->devfreq.idle_time += ktime_sub(now, last); +- +- pfdev->devfreq.time_last_update = now; +-} +- + void panfrost_devfreq_record_busy(struct panfrost_device *pfdev) + { + panfrost_devfreq_update_utilization(pfdev); + +From e79051392b32df8ba3dcb9cd160f1dfe5631ca1a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= +Date: Fri, 10 Jul 2020 11:53:57 +0200 +Subject: [PATCH] drm/panfrost: clean headers in devfreq +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Don't include not required headers and sort them. + +Reviewed-by: Steven Price +Reviewed-by: Alyssa Rosenzweig +Signed-off-by: Clément Péron +Signed-off-by: Rob Herring +Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-3-peron.clem@gmail.com +(cherry picked from commit 9713e942a539c55b5e0bc64ba83b736bda1087fe) +--- + drivers/gpu/drm/panfrost/panfrost_devfreq.c | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c +index 1b560b903ea6..df7b71da9a84 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c ++++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c +@@ -1,18 +1,14 @@ + // SPDX-License-Identifier: GPL-2.0 + /* Copyright 2019 Collabora ltd. */ ++ ++#include + #include + #include + #include + #include +-#include +-#include + + #include "panfrost_device.h" + #include "panfrost_devfreq.h" +-#include "panfrost_features.h" +-#include "panfrost_issues.h" +-#include "panfrost_gpu.h" +-#include "panfrost_regs.h" + + static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev) + { + +From b644d4b83e0c6b86565dc6e7eda0e368e855c56d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= +Date: Fri, 10 Jul 2020 11:53:58 +0200 +Subject: [PATCH] drm/panfrost: don't use pfdevfreq.busy_count to know if hw is + idle +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This use devfreq variable that will be lock with spinlock in future +patches. We should either introduce a function to access this one +but as devfreq is optional let's just remove it. + +Reviewed-by: Steven Price +Reviewed-by: Alyssa Rosenzweig +Signed-off-by: Clément Péron +Signed-off-by: Rob Herring +Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-4-peron.clem@gmail.com +(cherry picked from commit eb9dd67249b55fd1fa3d7359be387ea2079247a6) +--- + drivers/gpu/drm/panfrost/panfrost_job.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c +index 360146f6f3d9..4c13dbae68fb 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_job.c ++++ b/drivers/gpu/drm/panfrost/panfrost_job.c +@@ -581,10 +581,6 @@ int panfrost_job_is_idle(struct panfrost_device *pfdev) + struct panfrost_job_slot *js = pfdev->js; + int i; + +- /* Check whether the hardware is idle */ +- if (atomic_read(&pfdev->devfreq.busy_count)) +- return false; +- + for (i = 0; i < NUM_JOB_SLOTS; i++) { + /* If there are any jobs in the HW queue, we're not idle */ + if (atomic_read(&js->queue[i].sched.hw_rq_count)) + +From 1a29b20297e3cfb87ccd6c2a05b385b1a3adf099 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= +Date: Fri, 10 Jul 2020 11:53:59 +0200 +Subject: [PATCH] drm/panfrost: introduce panfrost_devfreq struct +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Introduce a proper panfrost_devfreq to deal with devfreq variables. + +Reviewed-by: Steven Price +Reviewed-by: Alyssa Rosenzweig +Signed-off-by: Clément Péron +Signed-off-by: Rob Herring +Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-5-peron.clem@gmail.com +(cherry picked from commit 9bfacfc82f903b066b0b63460d5b7943705048a4) +--- + drivers/gpu/drm/panfrost/panfrost_devfreq.c | 76 ++++++++++++++++------------- + drivers/gpu/drm/panfrost/panfrost_devfreq.h | 20 +++++++- + drivers/gpu/drm/panfrost/panfrost_device.h | 11 ++--- + drivers/gpu/drm/panfrost/panfrost_job.c | 6 +-- + 4 files changed, 66 insertions(+), 47 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c +index df7b71da9a84..962550363391 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c ++++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c +@@ -10,23 +10,23 @@ + #include "panfrost_device.h" + #include "panfrost_devfreq.h" + +-static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev) ++static void panfrost_devfreq_update_utilization(struct panfrost_devfreq *pfdevfreq) + { + ktime_t now; + ktime_t last; + +- if (!pfdev->devfreq.devfreq) ++ if (!pfdevfreq->devfreq) + return; + + now = ktime_get(); +- last = pfdev->devfreq.time_last_update; ++ last = pfdevfreq->time_last_update; + +- if (atomic_read(&pfdev->devfreq.busy_count) > 0) +- pfdev->devfreq.busy_time += ktime_sub(now, last); ++ if (atomic_read(&pfdevfreq->busy_count) > 0) ++ pfdevfreq->busy_time += ktime_sub(now, last); + else +- pfdev->devfreq.idle_time += ktime_sub(now, last); ++ pfdevfreq->idle_time += ktime_sub(now, last); + +- pfdev->devfreq.time_last_update = now; ++ pfdevfreq->time_last_update = now; + } + + static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, +@@ -47,30 +47,31 @@ static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, + return 0; + } + +-static void panfrost_devfreq_reset(struct panfrost_device *pfdev) ++static void panfrost_devfreq_reset(struct panfrost_devfreq *pfdevfreq) + { +- pfdev->devfreq.busy_time = 0; +- pfdev->devfreq.idle_time = 0; +- pfdev->devfreq.time_last_update = ktime_get(); ++ pfdevfreq->busy_time = 0; ++ pfdevfreq->idle_time = 0; ++ pfdevfreq->time_last_update = ktime_get(); + } + + static int panfrost_devfreq_get_dev_status(struct device *dev, + struct devfreq_dev_status *status) + { + struct panfrost_device *pfdev = dev_get_drvdata(dev); ++ struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; + +- panfrost_devfreq_update_utilization(pfdev); ++ panfrost_devfreq_update_utilization(pfdevfreq); + + status->current_frequency = clk_get_rate(pfdev->clock); +- status->total_time = ktime_to_ns(ktime_add(pfdev->devfreq.busy_time, +- pfdev->devfreq.idle_time)); ++ status->total_time = ktime_to_ns(ktime_add(pfdevfreq->busy_time, ++ pfdevfreq->idle_time)); + +- status->busy_time = ktime_to_ns(pfdev->devfreq.busy_time); ++ status->busy_time = ktime_to_ns(pfdevfreq->busy_time); + +- panfrost_devfreq_reset(pfdev); ++ panfrost_devfreq_reset(pfdevfreq); + +- dev_dbg(pfdev->dev, "busy %lu total %lu %lu %% freq %lu MHz\n", status->busy_time, +- status->total_time, ++ dev_dbg(pfdev->dev, "busy %lu total %lu %lu %% freq %lu MHz\n", ++ status->busy_time, status->total_time, + status->busy_time / (status->total_time / 100), + status->current_frequency / 1000 / 1000); + +@@ -91,6 +92,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) + struct device *dev = &pfdev->pdev->dev; + struct devfreq *devfreq; + struct thermal_cooling_device *cooling; ++ struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; + + ret = dev_pm_opp_of_add_table(dev); + if (ret == -ENODEV) /* Optional, continue without devfreq */ +@@ -98,7 +100,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) + else if (ret) + return ret; + +- panfrost_devfreq_reset(pfdev); ++ panfrost_devfreq_reset(pfdevfreq); + + cur_freq = clk_get_rate(pfdev->clock); + +@@ -116,53 +118,59 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) + dev_pm_opp_of_remove_table(dev); + return PTR_ERR(devfreq); + } +- pfdev->devfreq.devfreq = devfreq; ++ pfdevfreq->devfreq = devfreq; + + cooling = of_devfreq_cooling_register(dev->of_node, devfreq); + if (IS_ERR(cooling)) + DRM_DEV_INFO(dev, "Failed to register cooling device\n"); + else +- pfdev->devfreq.cooling = cooling; ++ pfdevfreq->cooling = cooling; + + return 0; + } + + void panfrost_devfreq_fini(struct panfrost_device *pfdev) + { +- if (pfdev->devfreq.cooling) +- devfreq_cooling_unregister(pfdev->devfreq.cooling); ++ struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; ++ ++ if (pfdevfreq->cooling) ++ devfreq_cooling_unregister(pfdevfreq->cooling); + dev_pm_opp_of_remove_table(&pfdev->pdev->dev); + } + + void panfrost_devfreq_resume(struct panfrost_device *pfdev) + { +- if (!pfdev->devfreq.devfreq) ++ struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; ++ ++ if (!pfdevfreq->devfreq) + return; + +- panfrost_devfreq_reset(pfdev); ++ panfrost_devfreq_reset(pfdevfreq); + +- devfreq_resume_device(pfdev->devfreq.devfreq); ++ devfreq_resume_device(pfdevfreq->devfreq); + } + + void panfrost_devfreq_suspend(struct panfrost_device *pfdev) + { +- if (!pfdev->devfreq.devfreq) ++ struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; ++ ++ if (!pfdevfreq->devfreq) + return; + +- devfreq_suspend_device(pfdev->devfreq.devfreq); ++ devfreq_suspend_device(pfdevfreq->devfreq); + } + +-void panfrost_devfreq_record_busy(struct panfrost_device *pfdev) ++void panfrost_devfreq_record_busy(struct panfrost_devfreq *pfdevfreq) + { +- panfrost_devfreq_update_utilization(pfdev); +- atomic_inc(&pfdev->devfreq.busy_count); ++ panfrost_devfreq_update_utilization(pfdevfreq); ++ atomic_inc(&pfdevfreq->busy_count); + } + +-void panfrost_devfreq_record_idle(struct panfrost_device *pfdev) ++void panfrost_devfreq_record_idle(struct panfrost_devfreq *pfdevfreq) + { + int count; + +- panfrost_devfreq_update_utilization(pfdev); +- count = atomic_dec_if_positive(&pfdev->devfreq.busy_count); ++ panfrost_devfreq_update_utilization(pfdevfreq); ++ count = atomic_dec_if_positive(&pfdevfreq->busy_count); + WARN_ON(count < 0); + } +diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h +index 0611beffc8d0..0697f8d5aa34 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h ++++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h +@@ -4,13 +4,29 @@ + #ifndef __PANFROST_DEVFREQ_H__ + #define __PANFROST_DEVFREQ_H__ + ++#include ++ ++struct devfreq; ++struct thermal_cooling_device; ++ ++struct panfrost_device; ++ ++struct panfrost_devfreq { ++ struct devfreq *devfreq; ++ struct thermal_cooling_device *cooling; ++ ktime_t busy_time; ++ ktime_t idle_time; ++ ktime_t time_last_update; ++ atomic_t busy_count; ++}; ++ + int panfrost_devfreq_init(struct panfrost_device *pfdev); + void panfrost_devfreq_fini(struct panfrost_device *pfdev); + + void panfrost_devfreq_resume(struct panfrost_device *pfdev); + void panfrost_devfreq_suspend(struct panfrost_device *pfdev); + +-void panfrost_devfreq_record_busy(struct panfrost_device *pfdev); +-void panfrost_devfreq_record_idle(struct panfrost_device *pfdev); ++void panfrost_devfreq_record_busy(struct panfrost_devfreq *devfreq); ++void panfrost_devfreq_record_idle(struct panfrost_devfreq *devfreq); + + #endif /* __PANFROST_DEVFREQ_H__ */ +diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h +index c30c719a8059..2efa59c9d1c5 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_device.h ++++ b/drivers/gpu/drm/panfrost/panfrost_device.h +@@ -13,6 +13,8 @@ + #include + #include + ++#include "panfrost_devfreq.h" ++ + struct panfrost_device; + struct panfrost_mmu; + struct panfrost_job_slot; +@@ -107,14 +109,7 @@ struct panfrost_device { + struct list_head shrinker_list; + struct shrinker shrinker; + +- struct { +- struct devfreq *devfreq; +- struct thermal_cooling_device *cooling; +- ktime_t busy_time; +- ktime_t idle_time; +- ktime_t time_last_update; +- atomic_t busy_count; +- } devfreq; ++ struct panfrost_devfreq pfdevfreq; + }; + + struct panfrost_mmu { +diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c +index 4c13dbae68fb..30e7b7196dab 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_job.c ++++ b/drivers/gpu/drm/panfrost/panfrost_job.c +@@ -145,7 +145,7 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) + u64 jc_head = job->jc; + int ret; + +- panfrost_devfreq_record_busy(pfdev); ++ panfrost_devfreq_record_busy(&pfdev->pfdevfreq); + + ret = pm_runtime_get_sync(pfdev->dev); + if (ret < 0) +@@ -410,7 +410,7 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job) + for (i = 0; i < NUM_JOB_SLOTS; i++) { + if (pfdev->jobs[i]) { + pm_runtime_put_noidle(pfdev->dev); +- panfrost_devfreq_record_idle(pfdev); ++ panfrost_devfreq_record_idle(&pfdev->pfdevfreq); + pfdev->jobs[i] = NULL; + } + } +@@ -478,7 +478,7 @@ static irqreturn_t panfrost_job_irq_handler(int irq, void *data) + pfdev->jobs[j] = NULL; + + panfrost_mmu_as_put(pfdev, &job->file_priv->mmu); +- panfrost_devfreq_record_idle(pfdev); ++ panfrost_devfreq_record_idle(&pfdev->pfdevfreq); + + dma_fence_signal_locked(job->done_fence); + pm_runtime_put_autosuspend(pfdev->dev); + +From c0bae02328a32aabc9cd41f37ab93623ea2ea3e3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= +Date: Fri, 10 Jul 2020 11:54:00 +0200 +Subject: [PATCH] drm/panfrost: use spinlock instead of atomic +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Convert busy_count to a simple int protected by spinlock. + +Reviewed-by: Steven Price +Reviewed-by: Alyssa Rosenzweig +Signed-off-by: Clément Péron +Signed-off-by: Rob Herring +Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-6-peron.clem@gmail.com +(cherry picked from commit ed85df3f60740bb4be23fbc2db283d59b361a834) +--- + drivers/gpu/drm/panfrost/panfrost_devfreq.c | 43 +++++++++++++++++++++-------- + drivers/gpu/drm/panfrost/panfrost_devfreq.h | 9 +++++- + 2 files changed, 40 insertions(+), 12 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c +index 962550363391..78753cfb59fb 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c ++++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c +@@ -12,16 +12,12 @@ + + static void panfrost_devfreq_update_utilization(struct panfrost_devfreq *pfdevfreq) + { +- ktime_t now; +- ktime_t last; +- +- if (!pfdevfreq->devfreq) +- return; ++ ktime_t now, last; + + now = ktime_get(); + last = pfdevfreq->time_last_update; + +- if (atomic_read(&pfdevfreq->busy_count) > 0) ++ if (pfdevfreq->busy_count > 0) + pfdevfreq->busy_time += ktime_sub(now, last); + else + pfdevfreq->idle_time += ktime_sub(now, last); +@@ -59,10 +55,14 @@ static int panfrost_devfreq_get_dev_status(struct device *dev, + { + struct panfrost_device *pfdev = dev_get_drvdata(dev); + struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; ++ unsigned long irqflags; ++ ++ status->current_frequency = clk_get_rate(pfdev->clock); ++ ++ spin_lock_irqsave(&pfdevfreq->lock, irqflags); + + panfrost_devfreq_update_utilization(pfdevfreq); + +- status->current_frequency = clk_get_rate(pfdev->clock); + status->total_time = ktime_to_ns(ktime_add(pfdevfreq->busy_time, + pfdevfreq->idle_time)); + +@@ -70,6 +70,8 @@ static int panfrost_devfreq_get_dev_status(struct device *dev, + + panfrost_devfreq_reset(pfdevfreq); + ++ spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); ++ + dev_dbg(pfdev->dev, "busy %lu total %lu %lu %% freq %lu MHz\n", + status->busy_time, status->total_time, + status->busy_time / (status->total_time / 100), +@@ -100,6 +102,8 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) + else if (ret) + return ret; + ++ spin_lock_init(&pfdevfreq->lock); ++ + panfrost_devfreq_reset(pfdevfreq); + + cur_freq = clk_get_rate(pfdev->clock); +@@ -162,15 +166,32 @@ void panfrost_devfreq_suspend(struct panfrost_device *pfdev) + + void panfrost_devfreq_record_busy(struct panfrost_devfreq *pfdevfreq) + { ++ unsigned long irqflags; ++ ++ if (!pfdevfreq->devfreq) ++ return; ++ ++ spin_lock_irqsave(&pfdevfreq->lock, irqflags); ++ + panfrost_devfreq_update_utilization(pfdevfreq); +- atomic_inc(&pfdevfreq->busy_count); ++ ++ pfdevfreq->busy_count++; ++ ++ spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); + } + + void panfrost_devfreq_record_idle(struct panfrost_devfreq *pfdevfreq) + { +- int count; ++ unsigned long irqflags; ++ ++ if (!pfdevfreq->devfreq) ++ return; ++ ++ spin_lock_irqsave(&pfdevfreq->lock, irqflags); + + panfrost_devfreq_update_utilization(pfdevfreq); +- count = atomic_dec_if_positive(&pfdevfreq->busy_count); +- WARN_ON(count < 0); ++ ++ WARN_ON(--pfdevfreq->busy_count < 0); ++ ++ spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); + } +diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h +index 0697f8d5aa34..3392df1020be 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h ++++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h +@@ -4,6 +4,7 @@ + #ifndef __PANFROST_DEVFREQ_H__ + #define __PANFROST_DEVFREQ_H__ + ++#include + #include + + struct devfreq; +@@ -14,10 +15,16 @@ struct panfrost_device; + struct panfrost_devfreq { + struct devfreq *devfreq; + struct thermal_cooling_device *cooling; ++ + ktime_t busy_time; + ktime_t idle_time; + ktime_t time_last_update; +- atomic_t busy_count; ++ int busy_count; ++ /* ++ * Protect busy_time, idle_time, time_last_update and busy_count ++ * because these can be updated concurrently between multiple jobs. ++ */ ++ spinlock_t lock; + }; + + int panfrost_devfreq_init(struct panfrost_device *pfdev); + +From f2c14c5a166e0d30ef41f6b4e4b8e7904dc931da Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= +Date: Fri, 10 Jul 2020 11:54:01 +0200 +Subject: [PATCH] drm/panfrost: properly handle error in probe +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Introduce a boolean to know if opp table has been added. + +With this, we can call panfrost_devfreq_fini() in case of error +and release what has been initialised. + +Reviewed-by: Steven Price +Reviewed-by: Alyssa Rosenzweig +Signed-off-by: Clément Péron +Signed-off-by: Rob Herring +Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-7-peron.clem@gmail.com +(cherry picked from commit 81f2fbe62cb54b6cf3d91078c4d49451ba7b9877) +--- + drivers/gpu/drm/panfrost/panfrost_devfreq.c | 25 +++++++++++++++++++------ + drivers/gpu/drm/panfrost/panfrost_devfreq.h | 1 + + 2 files changed, 20 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c +index 78753cfb59fb..d9007f44b772 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c ++++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c +@@ -101,6 +101,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) + return 0; + else if (ret) + return ret; ++ pfdevfreq->opp_of_table_added = true; + + spin_lock_init(&pfdevfreq->lock); + +@@ -109,8 +110,10 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) + cur_freq = clk_get_rate(pfdev->clock); + + opp = devfreq_recommended_opp(dev, &cur_freq, 0); +- if (IS_ERR(opp)) +- return PTR_ERR(opp); ++ if (IS_ERR(opp)) { ++ ret = PTR_ERR(opp); ++ goto err_fini; ++ } + + panfrost_devfreq_profile.initial_freq = cur_freq; + dev_pm_opp_put(opp); +@@ -119,8 +122,8 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) + DEVFREQ_GOV_SIMPLE_ONDEMAND, NULL); + if (IS_ERR(devfreq)) { + DRM_DEV_ERROR(dev, "Couldn't initialize GPU devfreq\n"); +- dev_pm_opp_of_remove_table(dev); +- return PTR_ERR(devfreq); ++ ret = PTR_ERR(devfreq); ++ goto err_fini; + } + pfdevfreq->devfreq = devfreq; + +@@ -131,15 +134,25 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) + pfdevfreq->cooling = cooling; + + return 0; ++ ++err_fini: ++ panfrost_devfreq_fini(pfdev); ++ return ret; + } + + void panfrost_devfreq_fini(struct panfrost_device *pfdev) + { + struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; + +- if (pfdevfreq->cooling) ++ if (pfdevfreq->cooling) { + devfreq_cooling_unregister(pfdevfreq->cooling); +- dev_pm_opp_of_remove_table(&pfdev->pdev->dev); ++ pfdevfreq->cooling = NULL; ++ } ++ ++ if (pfdevfreq->opp_of_table_added) { ++ dev_pm_opp_of_remove_table(&pfdev->pdev->dev); ++ pfdevfreq->opp_of_table_added = false; ++ } + } + + void panfrost_devfreq_resume(struct panfrost_device *pfdev) +diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h +index 3392df1020be..210269944687 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h ++++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h +@@ -15,6 +15,7 @@ struct panfrost_device; + struct panfrost_devfreq { + struct devfreq *devfreq; + struct thermal_cooling_device *cooling; ++ bool opp_of_table_added; + + ktime_t busy_time; + ktime_t idle_time; + +From 3d97427897f27de62bf02518918cc79ac6f7239c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= +Date: Fri, 10 Jul 2020 11:54:02 +0200 +Subject: [PATCH] drm/panfrost: rename error labels in device_init +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Rename goto labels in device_init it will be easier to maintain. + +Reviewed-by: Alyssa Rosenzweig +Reviewed-by: Steven Price +Signed-off-by: Clément Péron +Signed-off-by: Rob Herring +Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-8-peron.clem@gmail.com +(cherry picked from commit d3c335da0200be9287cdf5755d19f62ce1670a8d) +--- + drivers/gpu/drm/panfrost/panfrost_device.c | 30 +++++++++++++++--------------- + 1 file changed, 15 insertions(+), 15 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c +index b172087eee6a..9f89984f652a 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_device.c ++++ b/drivers/gpu/drm/panfrost/panfrost_device.c +@@ -216,56 +216,56 @@ int panfrost_device_init(struct panfrost_device *pfdev) + + err = panfrost_regulator_init(pfdev); + if (err) +- goto err_out0; ++ goto out_clk; + + err = panfrost_reset_init(pfdev); + if (err) { + dev_err(pfdev->dev, "reset init failed %d\n", err); +- goto err_out1; ++ goto out_regulator; + } + + err = panfrost_pm_domain_init(pfdev); + if (err) +- goto err_out2; ++ goto out_reset; + + res = platform_get_resource(pfdev->pdev, IORESOURCE_MEM, 0); + pfdev->iomem = devm_ioremap_resource(pfdev->dev, res); + if (IS_ERR(pfdev->iomem)) { + dev_err(pfdev->dev, "failed to ioremap iomem\n"); + err = PTR_ERR(pfdev->iomem); +- goto err_out3; ++ goto out_pm_domain; + } + + err = panfrost_gpu_init(pfdev); + if (err) +- goto err_out3; ++ goto out_pm_domain; + + err = panfrost_mmu_init(pfdev); + if (err) +- goto err_out4; ++ goto out_gpu; + + err = panfrost_job_init(pfdev); + if (err) +- goto err_out5; ++ goto out_mmu; + + err = panfrost_perfcnt_init(pfdev); + if (err) +- goto err_out6; ++ goto out_job; + + return 0; +-err_out6: ++out_job: + panfrost_job_fini(pfdev); +-err_out5: ++out_mmu: + panfrost_mmu_fini(pfdev); +-err_out4: ++out_gpu: + panfrost_gpu_fini(pfdev); +-err_out3: ++out_pm_domain: + panfrost_pm_domain_fini(pfdev); +-err_out2: ++out_reset: + panfrost_reset_fini(pfdev); +-err_out1: ++out_regulator: + panfrost_regulator_fini(pfdev); +-err_out0: ++out_clk: + panfrost_clk_fini(pfdev); + return err; + } + +From 73bf666c4c5f23c8b0165c4ec8580b335771f3e8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= +Date: Fri, 10 Jul 2020 11:54:03 +0200 +Subject: [PATCH] drm/panfrost: move devfreq_init()/fini() in device +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Later we will introduce devfreq probing regulator if they +are present. As regulator should be probe only one time we +need to get this logic in the device_init(). + +panfrost_device is already taking care of devfreq_resume() +and devfreq_suspend(), so it's not totally illogic to move +the devfreq_init() and devfreq_fini() here. + +Reviewed-by: Alyssa Rosenzweig +Reviewed-by: Steven Price +Signed-off-by: Clément Péron +Signed-off-by: Rob Herring +Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-9-peron.clem@gmail.com +(cherry picked from commit 25e247bbf85af3ad721dfeb2e2caf405f43b7e66) +--- + drivers/gpu/drm/panfrost/panfrost_device.c | 12 +++++++++++- + drivers/gpu/drm/panfrost/panfrost_drv.c | 15 ++------------- + 2 files changed, 13 insertions(+), 14 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c +index 9f89984f652a..36b5c8fea3eb 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_device.c ++++ b/drivers/gpu/drm/panfrost/panfrost_device.c +@@ -214,9 +214,16 @@ int panfrost_device_init(struct panfrost_device *pfdev) + return err; + } + ++ err = panfrost_devfreq_init(pfdev); ++ if (err) { ++ if (err != -EPROBE_DEFER) ++ dev_err(pfdev->dev, "devfreq init failed %d\n", err); ++ goto out_clk; ++ } ++ + err = panfrost_regulator_init(pfdev); + if (err) +- goto out_clk; ++ goto out_devfreq; + + err = panfrost_reset_init(pfdev); + if (err) { +@@ -265,6 +272,8 @@ int panfrost_device_init(struct panfrost_device *pfdev) + panfrost_reset_fini(pfdev); + out_regulator: + panfrost_regulator_fini(pfdev); ++out_devfreq: ++ panfrost_devfreq_fini(pfdev); + out_clk: + panfrost_clk_fini(pfdev); + return err; +@@ -278,6 +287,7 @@ void panfrost_device_fini(struct panfrost_device *pfdev) + panfrost_gpu_fini(pfdev); + panfrost_pm_domain_fini(pfdev); + panfrost_reset_fini(pfdev); ++ panfrost_devfreq_fini(pfdev); + panfrost_regulator_fini(pfdev); + panfrost_clk_fini(pfdev); + } +diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c +index f79f98534ab6..36463c89e966 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_drv.c ++++ b/drivers/gpu/drm/panfrost/panfrost_drv.c +@@ -14,7 +14,6 @@ + #include + + #include "panfrost_device.h" +-#include "panfrost_devfreq.h" + #include "panfrost_gem.h" + #include "panfrost_mmu.h" + #include "panfrost_job.h" +@@ -606,13 +605,6 @@ static int panfrost_probe(struct platform_device *pdev) + goto err_out0; + } + +- err = panfrost_devfreq_init(pfdev); +- if (err) { +- if (err != -EPROBE_DEFER) +- dev_err(&pdev->dev, "Fatal error during devfreq init\n"); +- goto err_out1; +- } +- + pm_runtime_set_active(pfdev->dev); + pm_runtime_mark_last_busy(pfdev->dev); + pm_runtime_enable(pfdev->dev); +@@ -625,16 +617,14 @@ static int panfrost_probe(struct platform_device *pdev) + */ + err = drm_dev_register(ddev, 0); + if (err < 0) +- goto err_out2; ++ goto err_out1; + + panfrost_gem_shrinker_init(ddev); + + return 0; + +-err_out2: +- pm_runtime_disable(pfdev->dev); +- panfrost_devfreq_fini(pfdev); + err_out1: ++ pm_runtime_disable(pfdev->dev); + panfrost_device_fini(pfdev); + err_out0: + drm_dev_put(ddev); +@@ -650,7 +640,6 @@ static int panfrost_remove(struct platform_device *pdev) + panfrost_gem_shrinker_cleanup(ddev); + + pm_runtime_get_sync(pfdev->dev); +- panfrost_devfreq_fini(pfdev); + panfrost_device_fini(pfdev); + pm_runtime_put_sync_suspend(pfdev->dev); + pm_runtime_disable(pfdev->dev); + +From 6d5816fcaa6621b0f7bb9c07bdc4a74696b0d4f6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= +Date: Fri, 10 Jul 2020 11:54:04 +0200 +Subject: [PATCH] drm/panfrost: dynamically alloc regulators +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +We will later introduce regulators managed by OPP. + +Only alloc regulators when it's needed. This also help use +to release the regulators only when they are allocated. + +Reviewed-by: Steven Price +Reviewed-by: Alyssa Rosenzweig +Signed-off-by: Clément Péron +Signed-off-by: Rob Herring +Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-10-peron.clem@gmail.com +(cherry picked from commit 512f21227fd3d2dbe7aad57a995b9732229c9b56) +--- + drivers/gpu/drm/panfrost/panfrost_device.c | 14 +++++++++----- + drivers/gpu/drm/panfrost/panfrost_device.h | 3 +-- + 2 files changed, 10 insertions(+), 7 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c +index 36b5c8fea3eb..f1474b961def 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_device.c ++++ b/drivers/gpu/drm/panfrost/panfrost_device.c +@@ -90,9 +90,11 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev) + { + int ret, i; + +- if (WARN(pfdev->comp->num_supplies > ARRAY_SIZE(pfdev->regulators), +- "Too many supplies in compatible structure.\n")) +- return -EINVAL; ++ pfdev->regulators = devm_kcalloc(pfdev->dev, pfdev->comp->num_supplies, ++ sizeof(*pfdev->regulators), ++ GFP_KERNEL); ++ if (!pfdev->regulators) ++ return -ENOMEM; + + for (i = 0; i < pfdev->comp->num_supplies; i++) + pfdev->regulators[i].supply = pfdev->comp->supply_names[i]; +@@ -119,8 +121,10 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev) + + static void panfrost_regulator_fini(struct panfrost_device *pfdev) + { +- regulator_bulk_disable(pfdev->comp->num_supplies, +- pfdev->regulators); ++ if (!pfdev->regulators) ++ return; ++ ++ regulator_bulk_disable(pfdev->comp->num_supplies, pfdev->regulators); + } + + static void panfrost_pm_domain_fini(struct panfrost_device *pfdev) +diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h +index 2efa59c9d1c5..953f7536a773 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_device.h ++++ b/drivers/gpu/drm/panfrost/panfrost_device.h +@@ -22,7 +22,6 @@ struct panfrost_job; + struct panfrost_perfcnt; + + #define NUM_JOB_SLOTS 3 +-#define MAX_REGULATORS 2 + #define MAX_PM_DOMAINS 3 + + struct panfrost_features { +@@ -81,7 +80,7 @@ struct panfrost_device { + void __iomem *iomem; + struct clk *clock; + struct clk *bus_clock; +- struct regulator_bulk_data regulators[MAX_REGULATORS]; ++ struct regulator_bulk_data *regulators; + struct reset_control *rstc; + /* pm_domains for devices with more than one. */ + struct device *pm_domain_devs[MAX_PM_DOMAINS]; + +From 132fdf3d6a3bb089fa4e7aab7306d98dfeff3273 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= +Date: Fri, 10 Jul 2020 11:54:05 +0200 +Subject: [PATCH] drm/panfrost: add regulators to devfreq +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some OPP tables specify voltage for each frequency. Devfreq can +handle these regulators but they should be get only 1 time to avoid +issue and know who is in charge. + +If OPP table is probe don't init regulator. + +Reviewed-by: Steven Price +Reviewed-by: Alyssa Rosenzweig +Signed-off-by: Clément Péron +Signed-off-by: Rob Herring +Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-11-peron.clem@gmail.com +(cherry picked from commit fd587ff01d59554144e2fd20f4113638a45c7c4e) +--- + drivers/gpu/drm/panfrost/panfrost_devfreq.c | 29 +++++++++++++++++++++++++---- + drivers/gpu/drm/panfrost/panfrost_devfreq.h | 2 ++ + drivers/gpu/drm/panfrost/panfrost_device.c | 9 ++++++--- + 3 files changed, 33 insertions(+), 7 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c +index d9007f44b772..8ab025d0035f 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c ++++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c +@@ -93,14 +93,30 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) + unsigned long cur_freq; + struct device *dev = &pfdev->pdev->dev; + struct devfreq *devfreq; ++ struct opp_table *opp_table; + struct thermal_cooling_device *cooling; + struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; + ++ opp_table = dev_pm_opp_set_regulators(dev, pfdev->comp->supply_names, ++ pfdev->comp->num_supplies); ++ if (IS_ERR(opp_table)) { ++ ret = PTR_ERR(opp_table); ++ /* Continue if the optional regulator is missing */ ++ if (ret != -ENODEV) { ++ DRM_DEV_ERROR(dev, "Couldn't set OPP regulators\n"); ++ goto err_fini; ++ } ++ } else { ++ pfdevfreq->regulators_opp_table = opp_table; ++ } ++ + ret = dev_pm_opp_of_add_table(dev); +- if (ret == -ENODEV) /* Optional, continue without devfreq */ +- return 0; +- else if (ret) +- return ret; ++ if (ret) { ++ /* Optional, continue without devfreq */ ++ if (ret == -ENODEV) ++ ret = 0; ++ goto err_fini; ++ } + pfdevfreq->opp_of_table_added = true; + + spin_lock_init(&pfdevfreq->lock); +@@ -153,6 +169,11 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev) + dev_pm_opp_of_remove_table(&pfdev->pdev->dev); + pfdevfreq->opp_of_table_added = false; + } ++ ++ if (pfdevfreq->regulators_opp_table) { ++ dev_pm_opp_put_regulators(pfdevfreq->regulators_opp_table); ++ pfdevfreq->regulators_opp_table = NULL; ++ } + } + + void panfrost_devfreq_resume(struct panfrost_device *pfdev) +diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h +index 210269944687..db6ea48e21f9 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h ++++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h +@@ -8,12 +8,14 @@ + #include + + struct devfreq; ++struct opp_table; + struct thermal_cooling_device; + + struct panfrost_device; + + struct panfrost_devfreq { + struct devfreq *devfreq; ++ struct opp_table *regulators_opp_table; + struct thermal_cooling_device *cooling; + bool opp_of_table_added; + +diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c +index f1474b961def..e6896733838a 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_device.c ++++ b/drivers/gpu/drm/panfrost/panfrost_device.c +@@ -225,9 +225,12 @@ int panfrost_device_init(struct panfrost_device *pfdev) + goto out_clk; + } + +- err = panfrost_regulator_init(pfdev); +- if (err) +- goto out_devfreq; ++ /* OPP will handle regulators */ ++ if (!pfdev->pfdevfreq.opp_of_table_added) { ++ err = panfrost_regulator_init(pfdev); ++ if (err) ++ goto out_devfreq; ++ } + + err = panfrost_reset_init(pfdev); + if (err) { + +From f2725e6b47a6e544e44c9af34c07179d14ed37e0 Mon Sep 17 00:00:00 2001 +From: Navid Emamdoost +Date: Sun, 14 Jun 2020 01:36:19 -0500 +Subject: [PATCH] drm/panfrost: perfcnt: fix ref count leak in + panfrost_perfcnt_enable_locked + +in panfrost_perfcnt_enable_locked, pm_runtime_get_sync is called which +increments the counter even in case of failure, leading to incorrect +ref count. In case of failure, decrement the ref count before returning. + +Acked-by: Alyssa Rosenzweig +Signed-off-by: Navid Emamdoost +Signed-off-by: Rob Herring +Link: https://patchwork.freedesktop.org/patch/msgid/20200614063619.44944-1-navid.emamdoost@gmail.com +(cherry picked from commit 9df0e0c1889677175037445d5ad1654d54176369) +--- + drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c +index ec4695cf3caf..fdbc8d949135 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c ++++ b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c +@@ -83,11 +83,13 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev, + + ret = pm_runtime_get_sync(pfdev->dev); + if (ret < 0) +- return ret; ++ goto err_put_pm; + + bo = drm_gem_shmem_create(pfdev->ddev, perfcnt->bosize); +- if (IS_ERR(bo)) +- return PTR_ERR(bo); ++ if (IS_ERR(bo)) { ++ ret = PTR_ERR(bo); ++ goto err_put_pm; ++ } + + /* Map the perfcnt buf in the address space attached to file_priv. */ + ret = panfrost_gem_open(&bo->base, file_priv); +@@ -168,6 +170,8 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev, + panfrost_gem_close(&bo->base, file_priv); + err_put_bo: + drm_gem_object_put(&bo->base); ++err_put_pm: ++ pm_runtime_put(pfdev->dev); + return ret; + } + + +From d54c64a7033c7d9a55ec3a455a93ccfa09ba9549 Mon Sep 17 00:00:00 2001 +From: Antonio Borneo +Date: Wed, 8 Jul 2020 16:08:36 +0200 +Subject: [PATCH] drm/bridge/synopsys: dsi: allow LP commands in video mode + +Current code only sends LP commands in command mode. + +Allows sending LP commands also in video mode by setting the +proper flag in DSI_VID_MODE_CFG. + +Signed-off-by: Antonio Borneo +Tested-by: Philippe Cornu +Reviewed-by: Philippe Cornu +Acked-by: Neil Armstrong +Signed-off-by: Neil Armstrong +Link: https://patchwork.freedesktop.org/patch/msgid/20200708140836.32418-1-yannick.fertre@st.com +(cherry picked from commit 6188b06e0357b3bc3b91d0b67783681d34ff2b64) +--- + drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +index d580b2aa4ce9..d41ce1de1067 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +@@ -89,6 +89,7 @@ + #define VID_MODE_TYPE_NON_BURST_SYNC_EVENTS 0x1 + #define VID_MODE_TYPE_BURST 0x2 + #define VID_MODE_TYPE_MASK 0x3 ++#define ENABLE_LOW_POWER_CMD BIT(15) + #define VID_MODE_VPG_ENABLE BIT(16) + #define VID_MODE_VPG_HORIZONTAL BIT(24) + +@@ -367,6 +368,13 @@ static void dw_mipi_message_config(struct dw_mipi_dsi *dsi, + + dsi_write(dsi, DSI_LPCLK_CTRL, lpm ? 0 : PHY_TXREQUESTCLKHS); + dsi_write(dsi, DSI_CMD_MODE_CFG, val); ++ ++ val = dsi_read(dsi, DSI_VID_MODE_CFG); ++ if (lpm) ++ val |= ENABLE_LOW_POWER_CMD; ++ else ++ val &= ~ENABLE_LOW_POWER_CMD; ++ dsi_write(dsi, DSI_VID_MODE_CFG, val); + } + + static int dw_mipi_dsi_gen_pkt_hdr_write(struct dw_mipi_dsi *dsi, u32 hdr_val) + +From 071e4591b5ddac631fe65bd2e527d7ca28105c5b Mon Sep 17 00:00:00 2001 +From: Antonio Borneo +Date: Wed, 1 Jul 2020 16:31:31 +0200 +Subject: [PATCH] drm/bridge/synopsys: dsi: allow sending longer LP commands + +Current code does not properly computes the max length of LP +commands that can be send during H or V sync, and rely on static +values. +Limiting the max LP length to 4 byte during the V-sync is overly +conservative. + +Relax the limit and allows longer LP commands (16 bytes) to be +sent during V-sync. + +Signed-off-by: Antonio Borneo +Tested-by: Philippe Cornu +Reviewed-by: Philippe Cornu +Acked-by: Neil Armstrong +Signed-off-by: Neil Armstrong +Link: https://patchwork.freedesktop.org/patch/msgid/20200701143131.841-1-yannick.fertre@st.com +(cherry picked from commit 9e025e80660fe35432c81e67d401109d8e7b0ff4) +--- + drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 17 +++++++++-------- + 1 file changed, 9 insertions(+), 8 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +index d41ce1de1067..e9a0f42ff99f 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +@@ -361,6 +361,15 @@ static void dw_mipi_message_config(struct dw_mipi_dsi *dsi, + bool lpm = msg->flags & MIPI_DSI_MSG_USE_LPM; + u32 val = 0; + ++ /* ++ * TODO dw drv improvements ++ * largest packet sizes during hfp or during vsa/vpb/vfp ++ * should be computed according to byte lane, lane number and only ++ * if sending lp cmds in high speed is enable (PHY_TXREQUESTCLKHS) ++ */ ++ dsi_write(dsi, DSI_DPI_LP_CMD_TIM, OUTVACT_LPCMD_TIME(16) ++ | INVACT_LPCMD_TIME(4)); ++ + if (msg->flags & MIPI_DSI_MSG_REQ_ACK) + val |= ACK_RQST_EN; + if (lpm) +@@ -619,14 +628,6 @@ static void dw_mipi_dsi_dpi_config(struct dw_mipi_dsi *dsi, + dsi_write(dsi, DSI_DPI_VCID, DPI_VCID(dsi->channel)); + dsi_write(dsi, DSI_DPI_COLOR_CODING, color); + dsi_write(dsi, DSI_DPI_CFG_POL, val); +- /* +- * TODO dw drv improvements +- * largest packet sizes during hfp or during vsa/vpb/vfp +- * should be computed according to byte lane, lane number and only +- * if sending lp cmds in high speed is enable (PHY_TXREQUESTCLKHS) +- */ +- dsi_write(dsi, DSI_DPI_LP_CMD_TIM, OUTVACT_LPCMD_TIME(4) +- | INVACT_LPCMD_TIME(4)); + } + + static void dw_mipi_dsi_packet_handler_config(struct dw_mipi_dsi *dsi) + +From e1f858bdf1dbb595e520830e8b51eebc25dc2d9e Mon Sep 17 00:00:00 2001 +From: Antonio Borneo +Date: Wed, 1 Jul 2020 21:42:34 +0200 +Subject: [PATCH] drm/bridge/synopsys: dsi: add support for non-continuous HS + clock + +Current code enables the HS clock when video mode is started or to +send out a HS command, and disables the HS clock to send out a LP +command. This is not what DSI spec specify. + +Enable HS clock either in command and in video mode. +Set automatic HS clock management for panels and devices that +support non-continuous HS clock. + +Signed-off-by: Antonio Borneo +Tested-by: Philippe Cornu +Reviewed-by: Philippe Cornu +Acked-by: Neil Armstrong +Signed-off-by: Neil Armstrong +Link: https://patchwork.freedesktop.org/patch/msgid/20200701194234.18123-1-yannick.fertre@st.com +(cherry picked from commit c6d94e37bdbb6dfe7e581e937a915ab58399b8a5) +--- + drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +index e9a0f42ff99f..8510a84c4c63 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +@@ -375,7 +375,6 @@ static void dw_mipi_message_config(struct dw_mipi_dsi *dsi, + if (lpm) + val |= CMD_MODE_ALL_LP; + +- dsi_write(dsi, DSI_LPCLK_CTRL, lpm ? 0 : PHY_TXREQUESTCLKHS); + dsi_write(dsi, DSI_CMD_MODE_CFG, val); + + val = dsi_read(dsi, DSI_VID_MODE_CFG); +@@ -558,16 +557,22 @@ static void dw_mipi_dsi_video_mode_config(struct dw_mipi_dsi *dsi) + static void dw_mipi_dsi_set_mode(struct dw_mipi_dsi *dsi, + unsigned long mode_flags) + { ++ u32 val; ++ + dsi_write(dsi, DSI_PWR_UP, RESET); + + if (mode_flags & MIPI_DSI_MODE_VIDEO) { + dsi_write(dsi, DSI_MODE_CFG, ENABLE_VIDEO_MODE); + dw_mipi_dsi_video_mode_config(dsi); +- dsi_write(dsi, DSI_LPCLK_CTRL, PHY_TXREQUESTCLKHS); + } else { + dsi_write(dsi, DSI_MODE_CFG, ENABLE_CMD_MODE); + } + ++ val = PHY_TXREQUESTCLKHS; ++ if (dsi->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) ++ val |= AUTO_CLKLANE_CTRL; ++ dsi_write(dsi, DSI_LPCLK_CTRL, val); ++ + dsi_write(dsi, DSI_PWR_UP, POWERUP); + } + + +From b3ba2bd08c57aedc749e4f3e646b4b773147866b Mon Sep 17 00:00:00 2001 +From: Angelo Ribeiro +Date: Mon, 6 Apr 2020 15:49:03 +0200 +Subject: [PATCH] drm/bridge: dw-mipi-dsi.c: Add VPG runtime config through + debugfs + +Add support for the video pattern generator (VPG) BER pattern mode and +configuration in runtime. + +This enables using the debugfs interface to manipulate the VPG after +the pipeline is set. +Also, enables the usage of the VPG BER pattern. + +Changes in v2: + - Added VID_MODE_VPG_MODE + - Solved incompatible return type on __get and __set + +Reported-by: kbuild test robot +Reported-by: Adrian Pop +Signed-off-by: Angelo Ribeiro +Tested-by: Yannick Fertre +Tested-by: Adrian Pop +Acked-by: Neil Armstrong +Cc: Gustavo Pimentel +Cc: Joao Pinto +Cc: Jose Abreu +Signed-off-by: Neil Armstrong +Link: https://patchwork.freedesktop.org/patch/msgid/a809feb7d7153a92e323416f744f1565e995da01.1586180592.git.angelo.ribeiro@synopsys.com +(cherry picked from commit e2435d69204c1f041e5742cac9af301021afa46f) +--- + drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 98 ++++++++++++++++++++++++--- + 1 file changed, 90 insertions(+), 8 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +index 8510a84c4c63..0b3825a4fbdb 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +@@ -91,6 +91,7 @@ + #define VID_MODE_TYPE_MASK 0x3 + #define ENABLE_LOW_POWER_CMD BIT(15) + #define VID_MODE_VPG_ENABLE BIT(16) ++#define VID_MODE_VPG_MODE BIT(20) + #define VID_MODE_VPG_HORIZONTAL BIT(24) + + #define DSI_VID_PKT_SIZE 0x3c +@@ -221,6 +222,21 @@ + #define PHY_STATUS_TIMEOUT_US 10000 + #define CMD_PKT_STATUS_TIMEOUT_US 20000 + ++#ifdef CONFIG_DEBUG_FS ++#define VPG_DEFS(name, dsi) \ ++ ((void __force *)&((*dsi).vpg_defs.name)) ++ ++#define REGISTER(name, mask, dsi) \ ++ { #name, VPG_DEFS(name, dsi), mask, dsi } ++ ++struct debugfs_entries { ++ const char *name; ++ bool *reg; ++ u32 mask; ++ struct dw_mipi_dsi *dsi; ++}; ++#endif /* CONFIG_DEBUG_FS */ ++ + struct dw_mipi_dsi { + struct drm_bridge bridge; + struct mipi_dsi_host dsi_host; +@@ -238,9 +254,12 @@ struct dw_mipi_dsi { + + #ifdef CONFIG_DEBUG_FS + struct dentry *debugfs; +- +- bool vpg; +- bool vpg_horizontal; ++ struct debugfs_entries *debugfs_vpg; ++ struct { ++ bool vpg; ++ bool vpg_horizontal; ++ bool vpg_ber_pattern; ++ } vpg_defs; + #endif /* CONFIG_DEBUG_FS */ + + struct dw_mipi_dsi *master; /* dual-dsi master ptr */ +@@ -545,9 +564,11 @@ static void dw_mipi_dsi_video_mode_config(struct dw_mipi_dsi *dsi) + val |= VID_MODE_TYPE_NON_BURST_SYNC_EVENTS; + + #ifdef CONFIG_DEBUG_FS +- if (dsi->vpg) { ++ if (dsi->vpg_defs.vpg) { + val |= VID_MODE_VPG_ENABLE; +- val |= dsi->vpg_horizontal ? VID_MODE_VPG_HORIZONTAL : 0; ++ val |= dsi->vpg_defs.vpg_horizontal ? ++ VID_MODE_VPG_HORIZONTAL : 0; ++ val |= dsi->vpg_defs.vpg_ber_pattern ? VID_MODE_VPG_MODE : 0; + } + #endif /* CONFIG_DEBUG_FS */ + +@@ -978,6 +999,68 @@ static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = { + + #ifdef CONFIG_DEBUG_FS + ++int dw_mipi_dsi_debugfs_write(void *data, u64 val) ++{ ++ struct debugfs_entries *vpg = data; ++ struct dw_mipi_dsi *dsi; ++ u32 mode_cfg; ++ ++ if (!vpg) ++ return -ENODEV; ++ ++ dsi = vpg->dsi; ++ ++ *vpg->reg = (bool)val; ++ ++ mode_cfg = dsi_read(dsi, DSI_VID_MODE_CFG); ++ ++ if (*vpg->reg) ++ mode_cfg |= vpg->mask; ++ else ++ mode_cfg &= ~vpg->mask; ++ ++ dsi_write(dsi, DSI_VID_MODE_CFG, mode_cfg); ++ ++ return 0; ++} ++ ++int dw_mipi_dsi_debugfs_show(void *data, u64 *val) ++{ ++ struct debugfs_entries *vpg = data; ++ ++ if (!vpg) ++ return -ENODEV; ++ ++ *val = *vpg->reg; ++ ++ return 0; ++} ++ ++DEFINE_DEBUGFS_ATTRIBUTE(fops_x32, dw_mipi_dsi_debugfs_show, ++ dw_mipi_dsi_debugfs_write, "%llu\n"); ++ ++static void debugfs_create_files(void *data) ++{ ++ struct dw_mipi_dsi *dsi = data; ++ struct debugfs_entries debugfs[] = { ++ REGISTER(vpg, VID_MODE_VPG_ENABLE, dsi), ++ REGISTER(vpg_horizontal, VID_MODE_VPG_HORIZONTAL, dsi), ++ REGISTER(vpg_ber_pattern, VID_MODE_VPG_MODE, dsi), ++ }; ++ int i; ++ ++ dsi->debugfs_vpg = kmalloc(sizeof(debugfs), GFP_KERNEL); ++ if (!dsi->debugfs_vpg) ++ return; ++ ++ memcpy(dsi->debugfs_vpg, debugfs, sizeof(debugfs)); ++ ++ for (i = 0; i < ARRAY_SIZE(debugfs); i++) ++ debugfs_create_file(dsi->debugfs_vpg[i].name, 0644, ++ dsi->debugfs, &dsi->debugfs_vpg[i], ++ &fops_x32); ++} ++ + static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi) + { + dsi->debugfs = debugfs_create_dir(dev_name(dsi->dev), NULL); +@@ -986,14 +1069,13 @@ static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi) + return; + } + +- debugfs_create_bool("vpg", 0660, dsi->debugfs, &dsi->vpg); +- debugfs_create_bool("vpg_horizontal", 0660, dsi->debugfs, +- &dsi->vpg_horizontal); ++ debugfs_create_files(dsi); + } + + static void dw_mipi_dsi_debugfs_remove(struct dw_mipi_dsi *dsi) + { + debugfs_remove_recursive(dsi->debugfs); ++ kfree(dsi->debugfs_vpg); + } + + #else + +From b48c8b2c43459f3c3bf28ffdec42553844412a83 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Mon, 7 Sep 2020 12:27:11 +0200 +Subject: [PATCH] drm/bridge: dw-mipi-dsi: fix dw_mipi_dsi_debugfs_show/write + warnings + +This fixes the following warnings while building in W=1 : +dw-mipi-dsi.c:1002:5: warning: no previous prototype for 'dw_mipi_dsi_debugfs_write' [-Wmissing-prototypes] +dw-mipi-dsi.c:1027:5: warning: no previous prototype for 'dw_mipi_dsi_debugfs_show' [-Wmissing-prototypes] + +Fixes: e2435d69204c ("drm/bridge: dw-mipi-dsi.c: Add VPG runtime config through debugfs") +Reported-by: kernel test robot +Signed-off-by: Neil Armstrong +Reviewed-by: Daniel Vetter +Cc: Angelo Ribeiro +Cc: Maxime Ripard +Cc: Maarten Lankhorst +Cc: Thomas Zimmermann +Link: https://patchwork.freedesktop.org/patch/msgid/20200907102711.23748-1-narmstrong@baylibre.com +(cherry picked from commit 25c4bcf9858e3e8752985fa0cda64a212ea328b7) +--- + drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +index 0b3825a4fbdb..52f5c5a2ed64 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +@@ -999,7 +999,7 @@ static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = { + + #ifdef CONFIG_DEBUG_FS + +-int dw_mipi_dsi_debugfs_write(void *data, u64 val) ++static int dw_mipi_dsi_debugfs_write(void *data, u64 val) + { + struct debugfs_entries *vpg = data; + struct dw_mipi_dsi *dsi; +@@ -1024,7 +1024,7 @@ int dw_mipi_dsi_debugfs_write(void *data, u64 val) + return 0; + } + +-int dw_mipi_dsi_debugfs_show(void *data, u64 *val) ++static int dw_mipi_dsi_debugfs_show(void *data, u64 *val) + { + struct debugfs_entries *vpg = data; + + +From 0765583a5df3824d6347f89088656d52f70d9de0 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Mon, 7 Sep 2020 13:24:25 +0200 +Subject: [PATCH] drm: allow limiting the scatter list size. + +Add drm_device argument to drm_prime_pages_to_sg(), so we can +call dma_max_mapping_size() to figure the segment size limit +and call into __sg_alloc_table_from_pages() with the correct +limit. + +This fixes virtio-gpu with sev. Possibly it'll fix other bugs +too given that drm seems to totaly ignore segment size limits +so far ... + +v2: place max_segment in drm driver not gem object. +v3: move max_segment next to the other gem fields. +v4: just use dma_max_mapping_size(). + +Signed-off-by: Gerd Hoffmann +Reviewed-by: Daniel Vetter +Link: http://patchwork.freedesktop.org/patch/msgid/20200907112425.15610-2-kraxel@redhat.com +(cherry picked from commit 707d561f77b5e2a6f90c9786bee44ee7a8dedc7e) +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 3 ++- + drivers/gpu/drm/drm_gem_shmem_helper.c | 2 +- + drivers/gpu/drm/drm_prime.c | 13 ++++++++++--- + drivers/gpu/drm/etnaviv/etnaviv_gem.c | 3 ++- + drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 2 +- + drivers/gpu/drm/msm/msm_gem.c | 2 +- + drivers/gpu/drm/msm/msm_gem_prime.c | 2 +- + drivers/gpu/drm/nouveau/nouveau_prime.c | 2 +- + drivers/gpu/drm/radeon/radeon_prime.c | 2 +- + drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 5 +++-- + drivers/gpu/drm/tegra/gem.c | 2 +- + drivers/gpu/drm/vgem/vgem_drv.c | 2 +- + drivers/gpu/drm/xen/xen_drm_front_gem.c | 3 ++- + include/drm/drm_prime.h | 3 ++- + 14 files changed, 29 insertions(+), 17 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +index 519ce4427fce..d7050ab95946 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +@@ -302,7 +302,8 @@ static struct sg_table *amdgpu_dma_buf_map(struct dma_buf_attachment *attach, + + switch (bo->tbo.mem.mem_type) { + case TTM_PL_TT: +- sgt = drm_prime_pages_to_sg(bo->tbo.ttm->pages, ++ sgt = drm_prime_pages_to_sg(obj->dev, ++ bo->tbo.ttm->pages, + bo->tbo.num_pages); + if (IS_ERR(sgt)) + return sgt; +diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c +index 4b7cfbac4daa..0a952f27c184 100644 +--- a/drivers/gpu/drm/drm_gem_shmem_helper.c ++++ b/drivers/gpu/drm/drm_gem_shmem_helper.c +@@ -656,7 +656,7 @@ struct sg_table *drm_gem_shmem_get_sg_table(struct drm_gem_object *obj) + + WARN_ON(shmem->base.import_attach); + +- return drm_prime_pages_to_sg(shmem->pages, obj->size >> PAGE_SHIFT); ++ return drm_prime_pages_to_sg(obj->dev, shmem->pages, obj->size >> PAGE_SHIFT); + } + EXPORT_SYMBOL_GPL(drm_gem_shmem_get_sg_table); + +diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c +index 1693aa7c14b5..8a6a3c99b7d8 100644 +--- a/drivers/gpu/drm/drm_prime.c ++++ b/drivers/gpu/drm/drm_prime.c +@@ -802,9 +802,11 @@ static const struct dma_buf_ops drm_gem_prime_dmabuf_ops = { + * + * This is useful for implementing &drm_gem_object_funcs.get_sg_table. + */ +-struct sg_table *drm_prime_pages_to_sg(struct page **pages, unsigned int nr_pages) ++struct sg_table *drm_prime_pages_to_sg(struct drm_device *dev, ++ struct page **pages, unsigned int nr_pages) + { + struct sg_table *sg = NULL; ++ size_t max_segment = 0; + int ret; + + sg = kmalloc(sizeof(struct sg_table), GFP_KERNEL); +@@ -813,8 +815,13 @@ struct sg_table *drm_prime_pages_to_sg(struct page **pages, unsigned int nr_page + goto out; + } + +- ret = sg_alloc_table_from_pages(sg, pages, nr_pages, 0, +- nr_pages << PAGE_SHIFT, GFP_KERNEL); ++ if (dev) ++ max_segment = dma_max_mapping_size(dev->dev); ++ if (max_segment == 0 || max_segment > SCATTERLIST_MAX_SEGMENT) ++ max_segment = SCATTERLIST_MAX_SEGMENT; ++ ret = __sg_alloc_table_from_pages(sg, pages, nr_pages, 0, ++ nr_pages << PAGE_SHIFT, ++ max_segment, GFP_KERNEL); + if (ret) + goto out; + +diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c +index f06e19e7be04..ea19f1d27275 100644 +--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c +@@ -103,7 +103,8 @@ struct page **etnaviv_gem_get_pages(struct etnaviv_gem_object *etnaviv_obj) + int npages = etnaviv_obj->base.size >> PAGE_SHIFT; + struct sg_table *sgt; + +- sgt = drm_prime_pages_to_sg(etnaviv_obj->pages, npages); ++ sgt = drm_prime_pages_to_sg(etnaviv_obj->base.dev, ++ etnaviv_obj->pages, npages); + if (IS_ERR(sgt)) { + dev_err(dev->dev, "failed to allocate sgt: %ld\n", + PTR_ERR(sgt)); +diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c +index 6d9e5c3c4dd5..4aa3426a9ba4 100644 +--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c +@@ -19,7 +19,7 @@ struct sg_table *etnaviv_gem_prime_get_sg_table(struct drm_gem_object *obj) + if (WARN_ON(!etnaviv_obj->pages)) /* should have already pinned! */ + return ERR_PTR(-EINVAL); + +- return drm_prime_pages_to_sg(etnaviv_obj->pages, npages); ++ return drm_prime_pages_to_sg(obj->dev, etnaviv_obj->pages, npages); + } + + void *etnaviv_gem_prime_vmap(struct drm_gem_object *obj) +diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c +index b2f49152b4d4..b4553caaa196 100644 +--- a/drivers/gpu/drm/msm/msm_gem.c ++++ b/drivers/gpu/drm/msm/msm_gem.c +@@ -126,7 +126,7 @@ static struct page **get_pages(struct drm_gem_object *obj) + + msm_obj->pages = p; + +- msm_obj->sgt = drm_prime_pages_to_sg(p, npages); ++ msm_obj->sgt = drm_prime_pages_to_sg(obj->dev, p, npages); + if (IS_ERR(msm_obj->sgt)) { + void *ptr = ERR_CAST(msm_obj->sgt); + +diff --git a/drivers/gpu/drm/msm/msm_gem_prime.c b/drivers/gpu/drm/msm/msm_gem_prime.c +index d7c8948427fe..515ef80816a0 100644 +--- a/drivers/gpu/drm/msm/msm_gem_prime.c ++++ b/drivers/gpu/drm/msm/msm_gem_prime.c +@@ -19,7 +19,7 @@ struct sg_table *msm_gem_prime_get_sg_table(struct drm_gem_object *obj) + if (WARN_ON(!msm_obj->pages)) /* should have already pinned! */ + return NULL; + +- return drm_prime_pages_to_sg(msm_obj->pages, npages); ++ return drm_prime_pages_to_sg(obj->dev, msm_obj->pages, npages); + } + + void *msm_gem_prime_vmap(struct drm_gem_object *obj) +diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c +index bae6a3eccee0..7766b810653f 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_prime.c ++++ b/drivers/gpu/drm/nouveau/nouveau_prime.c +@@ -32,7 +32,7 @@ struct sg_table *nouveau_gem_prime_get_sg_table(struct drm_gem_object *obj) + struct nouveau_bo *nvbo = nouveau_gem_object(obj); + int npages = nvbo->bo.num_pages; + +- return drm_prime_pages_to_sg(nvbo->bo.ttm->pages, npages); ++ return drm_prime_pages_to_sg(obj->dev, nvbo->bo.ttm->pages, npages); + } + + void *nouveau_gem_prime_vmap(struct drm_gem_object *obj) +diff --git a/drivers/gpu/drm/radeon/radeon_prime.c b/drivers/gpu/drm/radeon/radeon_prime.c +index b906e8fbd5f3..ea4c900e7c41 100644 +--- a/drivers/gpu/drm/radeon/radeon_prime.c ++++ b/drivers/gpu/drm/radeon/radeon_prime.c +@@ -36,7 +36,7 @@ struct sg_table *radeon_gem_prime_get_sg_table(struct drm_gem_object *obj) + struct radeon_bo *bo = gem_to_radeon_bo(obj); + int npages = bo->tbo.num_pages; + +- return drm_prime_pages_to_sg(bo->tbo.ttm->pages, npages); ++ return drm_prime_pages_to_sg(obj->dev, bo->tbo.ttm->pages, npages); + } + + void *radeon_gem_prime_vmap(struct drm_gem_object *obj) +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +index b9275ba7c5a5..0055d86576f7 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +@@ -85,7 +85,8 @@ static int rockchip_gem_get_pages(struct rockchip_gem_object *rk_obj) + + rk_obj->num_pages = rk_obj->base.size >> PAGE_SHIFT; + +- rk_obj->sgt = drm_prime_pages_to_sg(rk_obj->pages, rk_obj->num_pages); ++ rk_obj->sgt = drm_prime_pages_to_sg(rk_obj->base.dev, ++ rk_obj->pages, rk_obj->num_pages); + if (IS_ERR(rk_obj->sgt)) { + ret = PTR_ERR(rk_obj->sgt); + goto err_put_pages; +@@ -442,7 +443,7 @@ struct sg_table *rockchip_gem_prime_get_sg_table(struct drm_gem_object *obj) + int ret; + + if (rk_obj->pages) +- return drm_prime_pages_to_sg(rk_obj->pages, rk_obj->num_pages); ++ return drm_prime_pages_to_sg(obj->dev, rk_obj->pages, rk_obj->num_pages); + + sgt = kzalloc(sizeof(*sgt), GFP_KERNEL); + if (!sgt) +diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c +index 723df142a981..47e2935b8c68 100644 +--- a/drivers/gpu/drm/tegra/gem.c ++++ b/drivers/gpu/drm/tegra/gem.c +@@ -284,7 +284,7 @@ static int tegra_bo_get_pages(struct drm_device *drm, struct tegra_bo *bo) + + bo->num_pages = bo->gem.size >> PAGE_SHIFT; + +- bo->sgt = drm_prime_pages_to_sg(bo->pages, bo->num_pages); ++ bo->sgt = drm_prime_pages_to_sg(bo->gem.dev, bo->pages, bo->num_pages); + if (IS_ERR(bo->sgt)) { + err = PTR_ERR(bo->sgt); + goto put_pages; +diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c +index a775feda1cc7..4f0fd71d2da1 100644 +--- a/drivers/gpu/drm/vgem/vgem_drv.c ++++ b/drivers/gpu/drm/vgem/vgem_drv.c +@@ -321,7 +321,7 @@ static struct sg_table *vgem_prime_get_sg_table(struct drm_gem_object *obj) + { + struct drm_vgem_gem_object *bo = to_vgem_bo(obj); + +- return drm_prime_pages_to_sg(bo->pages, bo->base.size >> PAGE_SHIFT); ++ return drm_prime_pages_to_sg(obj->dev, bo->pages, bo->base.size >> PAGE_SHIFT); + } + + static struct drm_gem_object* vgem_prime_import(struct drm_device *dev, +diff --git a/drivers/gpu/drm/xen/xen_drm_front_gem.c b/drivers/gpu/drm/xen/xen_drm_front_gem.c +index 534daf37c97e..a8aefaa38bd3 100644 +--- a/drivers/gpu/drm/xen/xen_drm_front_gem.c ++++ b/drivers/gpu/drm/xen/xen_drm_front_gem.c +@@ -180,7 +180,8 @@ struct sg_table *xen_drm_front_gem_get_sg_table(struct drm_gem_object *gem_obj) + if (!xen_obj->pages) + return ERR_PTR(-ENOMEM); + +- return drm_prime_pages_to_sg(xen_obj->pages, xen_obj->num_pages); ++ return drm_prime_pages_to_sg(gem_obj->dev, ++ xen_obj->pages, xen_obj->num_pages); + } + + struct drm_gem_object * +diff --git a/include/drm/drm_prime.h b/include/drm/drm_prime.h +index 9af7422b44cf..bf141e74a1c2 100644 +--- a/include/drm/drm_prime.h ++++ b/include/drm/drm_prime.h +@@ -88,7 +88,8 @@ void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr); + int drm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma); + int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma); + +-struct sg_table *drm_prime_pages_to_sg(struct page **pages, unsigned int nr_pages); ++struct sg_table *drm_prime_pages_to_sg(struct drm_device *dev, ++ struct page **pages, unsigned int nr_pages); + struct dma_buf *drm_gem_prime_export(struct drm_gem_object *obj, + int flags); + + +From 0839a46485ed6cca60e13a706b8501267bd23bfa Mon Sep 17 00:00:00 2001 +From: Marek Szyprowski +Date: Fri, 8 May 2020 16:04:44 +0200 +Subject: [PATCH] drm: prime: add common helper to check scatterlist contiguity + +It is a common operation done by DRM drivers to check the contiguity +of the DMA-mapped buffer described by a scatterlist in the +sg_table object. Let's add a common helper for this operation. + +Signed-off-by: Marek Szyprowski +Reviewed-by: Andrzej Hajda +Reviewed-by: Robin Murphy +(cherry picked from commit d46e7ae24b81533d21edfa90914d27efa0c5f85d) +--- + drivers/gpu/drm/drm_gem_cma_helper.c | 23 +++-------------------- + drivers/gpu/drm/drm_prime.c | 31 +++++++++++++++++++++++++++++++ + include/drm/drm_prime.h | 2 ++ + 3 files changed, 36 insertions(+), 20 deletions(-) + +diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c +index 822edeadbab3..59b9ca207b42 100644 +--- a/drivers/gpu/drm/drm_gem_cma_helper.c ++++ b/drivers/gpu/drm/drm_gem_cma_helper.c +@@ -471,26 +471,9 @@ drm_gem_cma_prime_import_sg_table(struct drm_device *dev, + { + struct drm_gem_cma_object *cma_obj; + +- if (sgt->nents != 1) { +- /* check if the entries in the sg_table are contiguous */ +- dma_addr_t next_addr = sg_dma_address(sgt->sgl); +- struct scatterlist *s; +- unsigned int i; +- +- for_each_sg(sgt->sgl, s, sgt->nents, i) { +- /* +- * sg_dma_address(s) is only valid for entries +- * that have sg_dma_len(s) != 0 +- */ +- if (!sg_dma_len(s)) +- continue; +- +- if (sg_dma_address(s) != next_addr) +- return ERR_PTR(-EINVAL); +- +- next_addr = sg_dma_address(s) + sg_dma_len(s); +- } +- } ++ /* check if the entries in the sg_table are contiguous */ ++ if (drm_prime_get_contiguous_size(sgt) < attach->dmabuf->size) ++ return ERR_PTR(-EINVAL); + + /* Create a CMA GEM buffer. */ + cma_obj = __drm_gem_cma_create(dev, attach->dmabuf->size); +diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c +index 8a6a3c99b7d8..5a134c63856f 100644 +--- a/drivers/gpu/drm/drm_prime.c ++++ b/drivers/gpu/drm/drm_prime.c +@@ -832,6 +832,37 @@ struct sg_table *drm_prime_pages_to_sg(struct drm_device *dev, + } + EXPORT_SYMBOL(drm_prime_pages_to_sg); + ++/** ++ * drm_prime_get_contiguous_size - returns the contiguous size of the buffer ++ * @sgt: sg_table describing the buffer to check ++ * ++ * This helper calculates the contiguous size in the DMA address space ++ * of the the buffer described by the provided sg_table. ++ * ++ * This is useful for implementing ++ * &drm_gem_object_funcs.gem_prime_import_sg_table. ++ */ ++unsigned long drm_prime_get_contiguous_size(struct sg_table *sgt) ++{ ++ dma_addr_t expected = sg_dma_address(sgt->sgl); ++ struct scatterlist *sg; ++ unsigned long size = 0; ++ int i; ++ ++ for_each_sgtable_dma_sg(sgt, sg, i) { ++ unsigned int len = sg_dma_len(sg); ++ ++ if (!len) ++ break; ++ if (sg_dma_address(sg) != expected) ++ break; ++ expected += len; ++ size += len; ++ } ++ return size; ++} ++EXPORT_SYMBOL(drm_prime_get_contiguous_size); ++ + /** + * drm_gem_prime_export - helper library implementation of the export callback + * @obj: GEM object to export +diff --git a/include/drm/drm_prime.h b/include/drm/drm_prime.h +index bf141e74a1c2..0f69f9fbf12c 100644 +--- a/include/drm/drm_prime.h ++++ b/include/drm/drm_prime.h +@@ -93,6 +93,8 @@ struct sg_table *drm_prime_pages_to_sg(struct drm_device *dev, + struct dma_buf *drm_gem_prime_export(struct drm_gem_object *obj, + int flags); + ++unsigned long drm_prime_get_contiguous_size(struct sg_table *sgt); ++ + /* helper functions for importing */ + struct drm_gem_object *drm_gem_prime_import_dev(struct drm_device *dev, + struct dma_buf *dma_buf, + +From 4e60d2c4b502537362bae39f3d15b56c41a20648 Mon Sep 17 00:00:00 2001 +From: Marek Szyprowski +Date: Fri, 8 May 2020 16:05:14 +0200 +Subject: [PATCH] drm: prime: use sgtable iterators in + drm_prime_sg_to_page_addr_arrays() + +Replace the current hand-crafted code for extracting pages and DMA +addresses from the given scatterlist by the much more robust +code based on the generic scatterlist iterators and recently +introduced sg_table-based wrappers. The resulting code is simple and +easy to understand, so the comment describing the old code is no +longer needed. + +Signed-off-by: Marek Szyprowski +Reviewed-by: Andrzej Hajda +Reviewed-by: Robin Murphy +(cherry picked from commit 0552daac2d18fc92c71c94492476b8eb521227e9) +--- + drivers/gpu/drm/drm_prime.c | 49 ++++++++++++++------------------------------- + 1 file changed, 15 insertions(+), 34 deletions(-) + +diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c +index 5a134c63856f..9d2643f2d9e7 100644 +--- a/drivers/gpu/drm/drm_prime.c ++++ b/drivers/gpu/drm/drm_prime.c +@@ -997,45 +997,26 @@ EXPORT_SYMBOL(drm_gem_prime_import); + int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages, + dma_addr_t *addrs, int max_entries) + { +- unsigned count; +- struct scatterlist *sg; +- struct page *page; +- u32 page_len, page_index; +- dma_addr_t addr; +- u32 dma_len, dma_index; +- +- /* +- * Scatterlist elements contains both pages and DMA addresses, but +- * one shoud not assume 1:1 relation between them. The sg->length is +- * the size of the physical memory chunk described by the sg->page, +- * while sg_dma_len(sg) is the size of the DMA (IO virtual) chunk +- * described by the sg_dma_address(sg). +- */ +- page_index = 0; +- dma_index = 0; +- for_each_sg(sgt->sgl, sg, sgt->nents, count) { +- page_len = sg->length; +- page = sg_page(sg); +- dma_len = sg_dma_len(sg); +- addr = sg_dma_address(sg); +- +- while (pages && page_len > 0) { +- if (WARN_ON(page_index >= max_entries)) ++ struct sg_dma_page_iter dma_iter; ++ struct sg_page_iter page_iter; ++ struct page **p = pages; ++ dma_addr_t *a = addrs; ++ ++ if (pages) { ++ for_each_sgtable_page(sgt, &page_iter, 0) { ++ if (WARN_ON(p - pages >= max_entries)) + return -1; +- pages[page_index] = page; +- page++; +- page_len -= PAGE_SIZE; +- page_index++; ++ *p++ = sg_page_iter_page(&page_iter); + } +- while (addrs && dma_len > 0) { +- if (WARN_ON(dma_index >= max_entries)) ++ } ++ if (addrs) { ++ for_each_sgtable_dma_page(sgt, &dma_iter, 0) { ++ if (WARN_ON(a - addrs >= max_entries)) + return -1; +- addrs[dma_index] = addr; +- addr += PAGE_SIZE; +- dma_len -= PAGE_SIZE; +- dma_index++; ++ *a++ = sg_page_iter_dma_address(&dma_iter); + } + } ++ + return 0; + } + EXPORT_SYMBOL(drm_prime_sg_to_page_addr_arrays); + +From ec3929e32f4ca8176edcb0d5ba72ea2051ccfd11 Mon Sep 17 00:00:00 2001 +From: Marek Szyprowski +Date: Mon, 11 May 2020 12:27:54 +0200 +Subject: [PATCH] drm: core: fix common struct sg_table related issues + +The Documentation/DMA-API-HOWTO.txt states that the dma_map_sg() function +returns the number of the created entries in the DMA address space. +However the subsequent calls to the dma_sync_sg_for_{device,cpu}() and +dma_unmap_sg must be called with the original number of the entries +passed to the dma_map_sg(). + +struct sg_table is a common structure used for describing a non-contiguous +memory buffer, used commonly in the DRM and graphics subsystems. It +consists of a scatterlist with memory pages and DMA addresses (sgl entry), +as well as the number of scatterlist entries: CPU pages (orig_nents entry) +and DMA mapped pages (nents entry). + +It turned out that it was a common mistake to misuse nents and orig_nents +entries, calling DMA-mapping functions with a wrong number of entries or +ignoring the number of mapped entries returned by the dma_map_sg() +function. + +To avoid such issues, lets use a common dma-mapping wrappers operating +directly on the struct sg_table objects and use scatterlist page +iterators where possible. This, almost always, hides references to the +nents and orig_nents entries, making the code robust, easier to follow +and copy/paste safe. + +Signed-off-by: Marek Szyprowski +Reviewed-by: Andrzej Hajda +Reviewed-by: Robin Murphy +(cherry picked from commit 6c6fa39ca958d5313ff90d3e6c3064e0043c1da3) +--- + drivers/gpu/drm/drm_cache.c | 2 +- + drivers/gpu/drm/drm_gem_shmem_helper.c | 14 +++++++++----- + drivers/gpu/drm/drm_prime.c | 11 ++++++----- + 3 files changed, 16 insertions(+), 11 deletions(-) + +diff --git a/drivers/gpu/drm/drm_cache.c b/drivers/gpu/drm/drm_cache.c +index 03e01b000f7a..0fe3c496002a 100644 +--- a/drivers/gpu/drm/drm_cache.c ++++ b/drivers/gpu/drm/drm_cache.c +@@ -127,7 +127,7 @@ drm_clflush_sg(struct sg_table *st) + struct sg_page_iter sg_iter; + + mb(); /*CLFLUSH is ordered only by using memory barriers*/ +- for_each_sg_page(st->sgl, &sg_iter, st->nents, 0) ++ for_each_sgtable_page(st, &sg_iter, 0) + drm_clflush_page(sg_page_iter_page(&sg_iter)); + mb(); /*Make sure that all cache line entry is flushed*/ + +diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c +index 0a952f27c184..d77c9f8ff26c 100644 +--- a/drivers/gpu/drm/drm_gem_shmem_helper.c ++++ b/drivers/gpu/drm/drm_gem_shmem_helper.c +@@ -126,8 +126,8 @@ void drm_gem_shmem_free_object(struct drm_gem_object *obj) + drm_prime_gem_destroy(obj, shmem->sgt); + } else { + if (shmem->sgt) { +- dma_unmap_sg(obj->dev->dev, shmem->sgt->sgl, +- shmem->sgt->nents, DMA_BIDIRECTIONAL); ++ dma_unmap_sgtable(obj->dev->dev, shmem->sgt, ++ DMA_BIDIRECTIONAL, 0); + sg_free_table(shmem->sgt); + kfree(shmem->sgt); + } +@@ -424,8 +424,7 @@ void drm_gem_shmem_purge_locked(struct drm_gem_object *obj) + + WARN_ON(!drm_gem_shmem_is_purgeable(shmem)); + +- dma_unmap_sg(obj->dev->dev, shmem->sgt->sgl, +- shmem->sgt->nents, DMA_BIDIRECTIONAL); ++ dma_unmap_sgtable(obj->dev->dev, shmem->sgt, DMA_BIDIRECTIONAL, 0); + sg_free_table(shmem->sgt); + kfree(shmem->sgt); + shmem->sgt = NULL; +@@ -697,12 +696,17 @@ struct sg_table *drm_gem_shmem_get_pages_sgt(struct drm_gem_object *obj) + goto err_put_pages; + } + /* Map the pages for use by the h/w. */ +- dma_map_sg(obj->dev->dev, sgt->sgl, sgt->nents, DMA_BIDIRECTIONAL); ++ ret = dma_map_sgtable(obj->dev->dev, sgt, DMA_BIDIRECTIONAL, 0); ++ if (ret) ++ goto err_free_sgt; + + shmem->sgt = sgt; + + return sgt; + ++err_free_sgt: ++ sg_free_table(sgt); ++ kfree(sgt); + err_put_pages: + drm_gem_shmem_put_pages(shmem); + return ERR_PTR(ret); +diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c +index 9d2643f2d9e7..11fe9ff76fd5 100644 +--- a/drivers/gpu/drm/drm_prime.c ++++ b/drivers/gpu/drm/drm_prime.c +@@ -617,6 +617,7 @@ struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach, + { + struct drm_gem_object *obj = attach->dmabuf->priv; + struct sg_table *sgt; ++ int ret; + + if (WARN_ON(dir == DMA_NONE)) + return ERR_PTR(-EINVAL); +@@ -626,11 +627,12 @@ struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach, + else + sgt = obj->dev->driver->gem_prime_get_sg_table(obj); + +- if (!dma_map_sg_attrs(attach->dev, sgt->sgl, sgt->nents, dir, +- DMA_ATTR_SKIP_CPU_SYNC)) { ++ ret = dma_map_sgtable(attach->dev, sgt, dir, ++ DMA_ATTR_SKIP_CPU_SYNC); ++ if (ret) { + sg_free_table(sgt); + kfree(sgt); +- sgt = ERR_PTR(-ENOMEM); ++ sgt = ERR_PTR(ret); + } + + return sgt; +@@ -652,8 +654,7 @@ void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach, + if (!sgt) + return; + +- dma_unmap_sg_attrs(attach->dev, sgt->sgl, sgt->nents, dir, +- DMA_ATTR_SKIP_CPU_SYNC); ++ dma_unmap_sgtable(attach->dev, sgt, dir, DMA_ATTR_SKIP_CPU_SYNC); + sg_free_table(sgt); + kfree(sgt); + } + +From 7fad7e58e92e242d6c9d4039882f315a21a2769b Mon Sep 17 00:00:00 2001 +From: Marek Szyprowski +Date: Tue, 28 Apr 2020 13:09:11 +0200 +Subject: [PATCH] drm: lima: fix common struct sg_table related issues + +The Documentation/DMA-API-HOWTO.txt states that the dma_map_sg() function +returns the number of the created entries in the DMA address space. +However the subsequent calls to the dma_sync_sg_for_{device,cpu}() and +dma_unmap_sg must be called with the original number of the entries +passed to the dma_map_sg(). + +struct sg_table is a common structure used for describing a non-contiguous +memory buffer, used commonly in the DRM and graphics subsystems. It +consists of a scatterlist with memory pages and DMA addresses (sgl entry), +as well as the number of scatterlist entries: CPU pages (orig_nents entry) +and DMA mapped pages (nents entry). + +It turned out that it was a common mistake to misuse nents and orig_nents +entries, calling DMA-mapping functions with a wrong number of entries or +ignoring the number of mapped entries returned by the dma_map_sg() +function. + +To avoid such issues, lets use a common dma-mapping wrappers operating +directly on the struct sg_table objects and use scatterlist page +iterators where possible. This, almost always, hides references to the +nents and orig_nents entries, making the code robust, easier to follow +and copy/paste safe. + +Signed-off-by: Marek Szyprowski +Reviewed-by: Qiang Yu +(cherry picked from commit c3d9c17f486d5c54940487dc31a54ebfdeeb371a) +--- + drivers/gpu/drm/lima/lima_gem.c | 11 ++++++++--- + drivers/gpu/drm/lima/lima_vm.c | 5 ++--- + 2 files changed, 10 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/lima/lima_gem.c b/drivers/gpu/drm/lima/lima_gem.c +index 155f2b4b4030..11223fe348df 100644 +--- a/drivers/gpu/drm/lima/lima_gem.c ++++ b/drivers/gpu/drm/lima/lima_gem.c +@@ -69,8 +69,7 @@ int lima_heap_alloc(struct lima_bo *bo, struct lima_vm *vm) + return ret; + + if (bo->base.sgt) { +- dma_unmap_sg(dev, bo->base.sgt->sgl, +- bo->base.sgt->nents, DMA_BIDIRECTIONAL); ++ dma_unmap_sgtable(dev, bo->base.sgt, DMA_BIDIRECTIONAL, 0); + sg_free_table(bo->base.sgt); + } else { + bo->base.sgt = kmalloc(sizeof(*bo->base.sgt), GFP_KERNEL); +@@ -80,7 +79,13 @@ int lima_heap_alloc(struct lima_bo *bo, struct lima_vm *vm) + } + } + +- dma_map_sg(dev, sgt.sgl, sgt.nents, DMA_BIDIRECTIONAL); ++ ret = dma_map_sgtable(dev, &sgt, DMA_BIDIRECTIONAL, 0); ++ if (ret) { ++ sg_free_table(&sgt); ++ kfree(bo->base.sgt); ++ bo->base.sgt = NULL; ++ return ret; ++ } + + *bo->base.sgt = sgt; + +diff --git a/drivers/gpu/drm/lima/lima_vm.c b/drivers/gpu/drm/lima/lima_vm.c +index 5b92fb82674a..2b2739adc7f5 100644 +--- a/drivers/gpu/drm/lima/lima_vm.c ++++ b/drivers/gpu/drm/lima/lima_vm.c +@@ -124,7 +124,7 @@ int lima_vm_bo_add(struct lima_vm *vm, struct lima_bo *bo, bool create) + if (err) + goto err_out1; + +- for_each_sg_dma_page(bo->base.sgt->sgl, &sg_iter, bo->base.sgt->nents, 0) { ++ for_each_sgtable_dma_page(bo->base.sgt, &sg_iter, 0) { + err = lima_vm_map_page(vm, sg_page_iter_dma_address(&sg_iter), + bo_va->node.start + offset); + if (err) +@@ -298,8 +298,7 @@ int lima_vm_map_bo(struct lima_vm *vm, struct lima_bo *bo, int pageoff) + mutex_lock(&vm->lock); + + base = bo_va->node.start + (pageoff << PAGE_SHIFT); +- for_each_sg_dma_page(bo->base.sgt->sgl, &sg_iter, +- bo->base.sgt->nents, pageoff) { ++ for_each_sgtable_dma_page(bo->base.sgt, &sg_iter, pageoff) { + err = lima_vm_map_page(vm, sg_page_iter_dma_address(&sg_iter), + base + offset); + if (err) + +From 995cbafa1bebfd7a85e32332fb2840213a51d2e0 Mon Sep 17 00:00:00 2001 +From: Marek Szyprowski +Date: Tue, 28 Apr 2020 13:09:35 +0200 +Subject: [PATCH] drm: panfrost: fix common struct sg_table related issues + +The Documentation/DMA-API-HOWTO.txt states that the dma_map_sg() function +returns the number of the created entries in the DMA address space. +However the subsequent calls to the dma_sync_sg_for_{device,cpu}() and +dma_unmap_sg must be called with the original number of the entries +passed to the dma_map_sg(). + +struct sg_table is a common structure used for describing a non-contiguous +memory buffer, used commonly in the DRM and graphics subsystems. It +consists of a scatterlist with memory pages and DMA addresses (sgl entry), +as well as the number of scatterlist entries: CPU pages (orig_nents entry) +and DMA mapped pages (nents entry). + +It turned out that it was a common mistake to misuse nents and orig_nents +entries, calling DMA-mapping functions with a wrong number of entries or +ignoring the number of mapped entries returned by the dma_map_sg() +function. + +To avoid such issues, lets use a common dma-mapping wrappers operating +directly on the struct sg_table objects and use scatterlist page +iterators where possible. This, almost always, hides references to the +nents and orig_nents entries, making the code robust, easier to follow +and copy/paste safe. + +Signed-off-by: Marek Szyprowski +Reviewed-by: Steven Price +Reviewed-by: Rob Herring +(cherry picked from commit 34a4e66faf8b22c8409cbd46839ba5e488b1e6a9) +--- + drivers/gpu/drm/panfrost/panfrost_gem.c | 4 ++-- + drivers/gpu/drm/panfrost/panfrost_mmu.c | 7 +++---- + 2 files changed, 5 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panfrost/panfrost_gem.c +index 33355dd302f1..1a6cea0e0bd7 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_gem.c ++++ b/drivers/gpu/drm/panfrost/panfrost_gem.c +@@ -41,8 +41,8 @@ static void panfrost_gem_free_object(struct drm_gem_object *obj) + + for (i = 0; i < n_sgt; i++) { + if (bo->sgts[i].sgl) { +- dma_unmap_sg(pfdev->dev, bo->sgts[i].sgl, +- bo->sgts[i].nents, DMA_BIDIRECTIONAL); ++ dma_unmap_sgtable(pfdev->dev, &bo->sgts[i], ++ DMA_BIDIRECTIONAL, 0); + sg_free_table(&bo->sgts[i]); + } + } +diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c +index e8f7b11352d2..776448c527ea 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c ++++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c +@@ -253,7 +253,7 @@ static int mmu_map_sg(struct panfrost_device *pfdev, struct panfrost_mmu *mmu, + struct io_pgtable_ops *ops = mmu->pgtbl_ops; + u64 start_iova = iova; + +- for_each_sg(sgt->sgl, sgl, sgt->nents, count) { ++ for_each_sgtable_dma_sg(sgt, sgl, count) { + unsigned long paddr = sg_dma_address(sgl); + size_t len = sg_dma_len(sgl); + +@@ -517,10 +517,9 @@ static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, + if (ret) + goto err_pages; + +- if (!dma_map_sg(pfdev->dev, sgt->sgl, sgt->nents, DMA_BIDIRECTIONAL)) { +- ret = -EINVAL; ++ ret = dma_map_sgtable(pfdev->dev, sgt, DMA_BIDIRECTIONAL, 0); ++ if (ret) + goto err_map; +- } + + mmu_map_sg(pfdev, bomapping->mmu, addr, + IOMMU_WRITE | IOMMU_READ | IOMMU_NOEXEC, sgt); + +From 03fcee5f1d9c78e00f2000cf87843020c5fb1634 Mon Sep 17 00:00:00 2001 +From: Marek Szyprowski +Date: Thu, 30 Apr 2020 14:02:47 +0200 +Subject: [PATCH] drm: rockchip: use common helper for a scatterlist contiguity + check + +Use common helper for checking the contiguity of the imported dma-buf. + +Signed-off-by: Marek Szyprowski +Reviewed-by: Robin Murphy +(cherry picked from commit 6a8f15c62cd9235a3a4eb1c96e79131061310d57) +--- + drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 19 +------------------ + 1 file changed, 1 insertion(+), 18 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +index 0055d86576f7..d1559146dcce 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +@@ -461,23 +461,6 @@ struct sg_table *rockchip_gem_prime_get_sg_table(struct drm_gem_object *obj) + return sgt; + } + +-static unsigned long rockchip_sg_get_contiguous_size(struct sg_table *sgt, +- int count) +-{ +- struct scatterlist *s; +- dma_addr_t expected = sg_dma_address(sgt->sgl); +- unsigned int i; +- unsigned long size = 0; +- +- for_each_sg(sgt->sgl, s, count, i) { +- if (sg_dma_address(s) != expected) +- break; +- expected = sg_dma_address(s) + sg_dma_len(s); +- size += sg_dma_len(s); +- } +- return size; +-} +- + static int + rockchip_gem_iommu_map_sg(struct drm_device *drm, + struct dma_buf_attachment *attach, +@@ -499,7 +482,7 @@ rockchip_gem_dma_map_sg(struct drm_device *drm, + if (!count) + return -EINVAL; + +- if (rockchip_sg_get_contiguous_size(sg, count) < attach->dmabuf->size) { ++ if (drm_prime_get_contiguous_size(sg) < attach->dmabuf->size) { + DRM_ERROR("failed to map sg_table to contiguous linear address.\n"); + dma_unmap_sg(drm->dev, sg->sgl, sg->nents, + DMA_BIDIRECTIONAL); + +From 11f9a73528dc2bd14e6d7e54cb8df803478eef68 Mon Sep 17 00:00:00 2001 +From: Marek Szyprowski +Date: Tue, 28 Apr 2020 13:10:01 +0200 +Subject: [PATCH] drm: rockchip: fix common struct sg_table related issues + +The Documentation/DMA-API-HOWTO.txt states that the dma_map_sg() function +returns the number of the created entries in the DMA address space. +However the subsequent calls to the dma_sync_sg_for_{device,cpu}() and +dma_unmap_sg must be called with the original number of the entries +passed to the dma_map_sg(). + +struct sg_table is a common structure used for describing a non-contiguous +memory buffer, used commonly in the DRM and graphics subsystems. It +consists of a scatterlist with memory pages and DMA addresses (sgl entry), +as well as the number of scatterlist entries: CPU pages (orig_nents entry) +and DMA mapped pages (nents entry). + +It turned out that it was a common mistake to misuse nents and orig_nents +entries, calling DMA-mapping functions with a wrong number of entries or +ignoring the number of mapped entries returned by the dma_map_sg() +function. + +To avoid such issues, lets use a common dma-mapping wrappers operating +directly on the struct sg_table objects and use scatterlist page +iterators where possible. This, almost always, hides references to the +nents and orig_nents entries, making the code robust, easier to follow +and copy/paste safe. + +Signed-off-by: Marek Szyprowski +Reviewed-by: Robin Murphy +(cherry picked from commit 82c245b592da791c63316e7a82d9b9d01552c0c5) +--- + drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 23 ++++++++++------------- + 1 file changed, 10 insertions(+), 13 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +index d1559146dcce..62e5d0970525 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +@@ -36,8 +36,8 @@ static int rockchip_gem_iommu_map(struct rockchip_gem_object *rk_obj) + + rk_obj->dma_addr = rk_obj->mm.start; + +- ret = iommu_map_sg(private->domain, rk_obj->dma_addr, rk_obj->sgt->sgl, +- rk_obj->sgt->nents, prot); ++ ret = iommu_map_sgtable(private->domain, rk_obj->dma_addr, rk_obj->sgt, ++ prot); + if (ret < rk_obj->base.size) { + DRM_ERROR("failed to map buffer: size=%zd request_size=%zd\n", + ret, rk_obj->base.size); +@@ -99,11 +99,10 @@ static int rockchip_gem_get_pages(struct rockchip_gem_object *rk_obj) + * TODO: Replace this by drm_clflush_sg() once it can be implemented + * without relying on symbols that are not exported. + */ +- for_each_sg(rk_obj->sgt->sgl, s, rk_obj->sgt->nents, i) ++ for_each_sgtable_sg(rk_obj->sgt, s, i) + sg_dma_address(s) = sg_phys(s); + +- dma_sync_sg_for_device(drm->dev, rk_obj->sgt->sgl, rk_obj->sgt->nents, +- DMA_TO_DEVICE); ++ dma_sync_sgtable_for_device(drm->dev, rk_obj->sgt, DMA_TO_DEVICE); + + return 0; + +@@ -351,8 +350,8 @@ void rockchip_gem_free_object(struct drm_gem_object *obj) + if (private->domain) { + rockchip_gem_iommu_unmap(rk_obj); + } else { +- dma_unmap_sg(drm->dev, rk_obj->sgt->sgl, +- rk_obj->sgt->nents, DMA_BIDIRECTIONAL); ++ dma_unmap_sgtable(drm->dev, rk_obj->sgt, ++ DMA_BIDIRECTIONAL, 0); + } + drm_prime_gem_destroy(obj, rk_obj->sgt); + } else { +@@ -477,15 +476,13 @@ rockchip_gem_dma_map_sg(struct drm_device *drm, + struct sg_table *sg, + struct rockchip_gem_object *rk_obj) + { +- int count = dma_map_sg(drm->dev, sg->sgl, sg->nents, +- DMA_BIDIRECTIONAL); +- if (!count) +- return -EINVAL; ++ int err = dma_map_sgtable(drm->dev, sg, DMA_BIDIRECTIONAL, 0); ++ if (err) ++ return err; + + if (drm_prime_get_contiguous_size(sg) < attach->dmabuf->size) { + DRM_ERROR("failed to map sg_table to contiguous linear address.\n"); +- dma_unmap_sg(drm->dev, sg->sgl, sg->nents, +- DMA_BIDIRECTIONAL); ++ dma_unmap_sgtable(drm->dev, sg, DMA_BIDIRECTIONAL, 0); + return -EINVAL; + } + + +From 314b770980da1e7d968e8178194de70cbb44fd6c Mon Sep 17 00:00:00 2001 +From: Robin Murphy +Date: Thu, 3 Sep 2020 14:59:23 +0100 +Subject: [PATCH] drm/panfrost: Set DMA max segment size + +Since all we do with scatterlists is map them in the MMU, we don't have +any hardware constraints on how they're laid out. Let the DMA layer know +so it won't warn when DMA API debugging is enabled. + +Signed-off-by: Robin Murphy +Reviewed-by: Steven Price +Signed-off-by: Steven Price +Link: https://patchwork.freedesktop.org/patch/msgid/04371bc36512076b7feee07f854e56b80675d953.1599141563.git.robin.murphy@arm.com +(cherry picked from commit ac5037afefd33fea9a9c1a4a5ac46ece396e7465) +--- + drivers/gpu/drm/panfrost/panfrost_gpu.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c +index e0f190e43813..eea049c640a6 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_gpu.c ++++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c +@@ -344,6 +344,7 @@ int panfrost_gpu_init(struct panfrost_device *pfdev) + + dma_set_mask_and_coherent(pfdev->dev, + DMA_BIT_MASK(FIELD_GET(0xff00, pfdev->features.mmu_features))); ++ dma_set_max_seg_size(pfdev->dev, UINT_MAX); + + irq = platform_get_irq_byname(to_platform_device(pfdev->dev), "gpu"); + if (irq <= 0) + +From cba1b5eaf367a82a44b3c2ef2e98c755a229d6cd Mon Sep 17 00:00:00 2001 +From: Steven Price +Date: Wed, 9 Sep 2020 13:29:57 +0100 +Subject: [PATCH] drm/panfrost: Ensure GPU quirks are always initialised + +The GPU 'CONFIG' registers used to work around hardware issues are +cleared on reset so need to be programmed every time the GPU is reset. +However panfrost_device_reset() failed to do this. + +To avoid this in future instead move the call to +panfrost_gpu_init_quirks() to panfrost_gpu_power_on() so that the +regsiters are always programmed just before the cores are powered. + +Fixes: f3ba91228e8e ("drm/panfrost: Add initial panfrost driver") +Signed-off-by: Steven Price +Reviewed-by: Alyssa Rosenzweig +Link: https://patchwork.freedesktop.org/patch/msgid/20200909122957.51667-1-steven.price@arm.com +(cherry picked from commit 8c3c818c23a5bbce6ff180dd2ee04415241df77c) +--- + drivers/gpu/drm/panfrost/panfrost_gpu.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c +index eea049c640a6..c7c5da5a31d4 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_gpu.c ++++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c +@@ -305,6 +305,8 @@ void panfrost_gpu_power_on(struct panfrost_device *pfdev) + int ret; + u32 val; + ++ panfrost_gpu_init_quirks(pfdev); ++ + /* Just turn on everything for now */ + gpu_write(pfdev, L2_PWRON_LO, pfdev->features.l2_present); + ret = readl_relaxed_poll_timeout(pfdev->iomem + L2_READY_LO, +@@ -357,7 +359,6 @@ int panfrost_gpu_init(struct panfrost_device *pfdev) + return err; + } + +- panfrost_gpu_init_quirks(pfdev); + panfrost_gpu_power_on(pfdev); + + return 0; + +From 99d273baa069a7838597fdd601e01248d12c2fd1 Mon Sep 17 00:00:00 2001 +From: Alex Dewar +Date: Wed, 9 Sep 2020 20:02:08 +0100 +Subject: [PATCH] drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy + +kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of +this pattern. + +Issue identified with Coccinelle. + +Signed-off-by: Alex Dewar +Acked-by: Neil Armstrong +Signed-off-by: Neil Armstrong +Link: https://patchwork.freedesktop.org/patch/msgid/20200909190213.156302-1-alex.dewar90@gmail.com +(cherry picked from commit 33f290811d4c1a09c4e92f5bf0458525835dbcba) +--- + drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +index 52f5c5a2ed64..7e9a62ad56e8 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +@@ -1049,12 +1049,10 @@ static void debugfs_create_files(void *data) + }; + int i; + +- dsi->debugfs_vpg = kmalloc(sizeof(debugfs), GFP_KERNEL); ++ dsi->debugfs_vpg = kmemdup(debugfs, sizeof(debugfs), GFP_KERNEL); + if (!dsi->debugfs_vpg) + return; + +- memcpy(dsi->debugfs_vpg, debugfs, sizeof(debugfs)); +- + for (i = 0; i < ARRAY_SIZE(debugfs); i++) + debugfs_create_file(dsi->debugfs_vpg[i].name, 0644, + dsi->debugfs, &dsi->debugfs_vpg[i], + +From 0d1797eb5960177619add1f2ad6f2e57341a628b Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Fri, 4 Sep 2020 14:55:31 +0200 +Subject: [PATCH] drm/bridge: dw-mipi-dsi: permit configuring the escape clock + rate + +The Amlogic D-PHY in the Amlogic AXG SoC Family does support a frequency +higher than 10MHz for the TX Escape Clock, thus make the target rate +configurable. + +Signed-off-by: Neil Armstrong +Reviewed-by: Philippe Cornu +Link: https://patchwork.freedesktop.org/patch/msgid/20200904125531.15248-1-narmstrong@baylibre.com +(cherry picked from commit a328ca7e4af347e47742f36933df0fdac1c24ea5) +--- + drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 25 ++++++++++++++++++++----- + include/drm/bridge/dw_mipi_dsi.h | 1 + + 2 files changed, 21 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +index 7e9a62ad56e8..6b268f9445b3 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +@@ -605,15 +605,30 @@ static void dw_mipi_dsi_disable(struct dw_mipi_dsi *dsi) + + static void dw_mipi_dsi_init(struct dw_mipi_dsi *dsi) + { ++ const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops; ++ unsigned int esc_rate; /* in MHz */ ++ u32 esc_clk_division; ++ int ret; ++ + /* + * The maximum permitted escape clock is 20MHz and it is derived from +- * lanebyteclk, which is running at "lane_mbps / 8". Thus we want: +- * +- * (lane_mbps >> 3) / esc_clk_division < 20 ++ * lanebyteclk, which is running at "lane_mbps / 8". ++ */ ++ if (phy_ops->get_esc_clk_rate) { ++ ret = phy_ops->get_esc_clk_rate(dsi->plat_data->priv_data, ++ &esc_rate); ++ if (ret) ++ DRM_DEBUG_DRIVER("Phy get_esc_clk_rate() failed\n"); ++ } else ++ esc_rate = 20; /* Default to 20MHz */ ++ ++ /* ++ * We want : ++ * (lane_mbps >> 3) / esc_clk_division < X + * which is: +- * (lane_mbps >> 3) / 20 > esc_clk_division ++ * (lane_mbps >> 3) / X > esc_clk_division + */ +- u32 esc_clk_division = (dsi->lane_mbps >> 3) / 20 + 1; ++ esc_clk_division = (dsi->lane_mbps >> 3) / esc_rate + 1; + + dsi_write(dsi, DSI_PWR_UP, RESET); + +diff --git a/include/drm/bridge/dw_mipi_dsi.h b/include/drm/bridge/dw_mipi_dsi.h +index b0e390b3288e..bda8aa7c2280 100644 +--- a/include/drm/bridge/dw_mipi_dsi.h ++++ b/include/drm/bridge/dw_mipi_dsi.h +@@ -36,6 +36,7 @@ struct dw_mipi_dsi_phy_ops { + unsigned int *lane_mbps); + int (*get_timing)(void *priv_data, unsigned int lane_mbps, + struct dw_mipi_dsi_dphy_timing *timing); ++ int (*get_esc_clk_rate)(void *priv_data, unsigned int *esc_clk_rate); + }; + + struct dw_mipi_dsi_host_ops { + +From c8e0416624b180c61a1f76bb5fa8dc41eb99bd51 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Wed, 16 Sep 2020 17:01:45 +0200 +Subject: [PATCH] drm/panfrost: add support for vendor quirk + +The T820, G31 & G52 GPUs integrated by Amlogic in the respective GXM, +G12A/SM1 & G12B SoCs needs a quirk in the PWR registers after each reset. + +This adds a callback in the device compatible struct of permit this. + +Signed-off-by: Neil Armstrong +[Steven: Fix typo in commit log] +Reviewed-by: Steven Price +Reviewed-by: Alyssa Rosenzweig +Signed-off-by: Steven Price +Link: https://patchwork.freedesktop.org/patch/msgid/20200916150147.25753-2-narmstrong@baylibre.com +(cherry picked from commit 91e89097b86f566636ea5a7329c79d5521be46d2) +--- + drivers/gpu/drm/panfrost/panfrost_device.h | 3 +++ + drivers/gpu/drm/panfrost/panfrost_gpu.c | 4 ++++ + 2 files changed, 7 insertions(+) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h +index 953f7536a773..2e9cbd1c4a58 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_device.h ++++ b/drivers/gpu/drm/panfrost/panfrost_device.h +@@ -70,6 +70,9 @@ struct panfrost_compatible { + int num_pm_domains; + /* Only required if num_pm_domains > 1. */ + const char * const *pm_domain_names; ++ ++ /* Vendor implementation quirks callback */ ++ void (*vendor_quirk)(struct panfrost_device *pfdev); + }; + + struct panfrost_device { +diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c +index c7c5da5a31d4..a6de78bc1fa8 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_gpu.c ++++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c +@@ -136,6 +136,10 @@ static void panfrost_gpu_init_quirks(struct panfrost_device *pfdev) + + if (quirks) + gpu_write(pfdev, GPU_JM_CONFIG, quirks); ++ ++ /* Here goes platform specific quirks */ ++ if (pfdev->comp->vendor_quirk) ++ pfdev->comp->vendor_quirk(pfdev); + } + + #define MAX_HW_REVS 6 + +From 97e90d721491430f0af4a40236365a3a583ff4e3 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Wed, 16 Sep 2020 17:01:46 +0200 +Subject: [PATCH] drm/panfrost: add amlogic reset quirk callback + +The T820, G31 & G52 GPUs integrated by Amlogic in the respective GXM, +G12A/SM1 & G12B SoCs needs a quirk in the PWR registers at the GPU reset +time. + +Since the Amlogic's integration of the GPU cores with the SoC is not +publicly documented we do not know what does these values, but they +permit having a fully functional GPU running with Panfrost. + +Signed-off-by: Neil Armstrong +[Steven: Fix typo in commit log] +Reviewed-by: Steven Price +Reviewed-by: Alyssa Rosenzweig +Signed-off-by: Steven Price +Link: https://patchwork.freedesktop.org/patch/msgid/20200916150147.25753-3-narmstrong@baylibre.com +(cherry picked from commit 110003002291525bb209f47e6dbf121a63249a97) +--- + drivers/gpu/drm/panfrost/panfrost_gpu.c | 11 +++++++++++ + drivers/gpu/drm/panfrost/panfrost_gpu.h | 2 ++ + drivers/gpu/drm/panfrost/panfrost_regs.h | 4 ++++ + 3 files changed, 17 insertions(+) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c +index a6de78bc1fa8..e1b2a3376624 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_gpu.c ++++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c +@@ -76,6 +76,17 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev) + return 0; + } + ++void panfrost_gpu_amlogic_quirk(struct panfrost_device *pfdev) ++{ ++ /* ++ * The Amlogic integrated Mali-T820, Mali-G31 & Mali-G52 needs ++ * these undocumented bits in GPU_PWR_OVERRIDE1 to be set in order ++ * to operate correctly. ++ */ ++ gpu_write(pfdev, GPU_PWR_KEY, GPU_PWR_KEY_UNLOCK); ++ gpu_write(pfdev, GPU_PWR_OVERRIDE1, 0xfff | (0x20 << 16)); ++} ++ + static void panfrost_gpu_init_quirks(struct panfrost_device *pfdev) + { + u32 quirks = 0; +diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.h b/drivers/gpu/drm/panfrost/panfrost_gpu.h +index 4112412087b2..468c51e7e46d 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_gpu.h ++++ b/drivers/gpu/drm/panfrost/panfrost_gpu.h +@@ -16,4 +16,6 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev); + void panfrost_gpu_power_on(struct panfrost_device *pfdev); + void panfrost_gpu_power_off(struct panfrost_device *pfdev); + ++void panfrost_gpu_amlogic_quirk(struct panfrost_device *pfdev); ++ + #endif +diff --git a/drivers/gpu/drm/panfrost/panfrost_regs.h b/drivers/gpu/drm/panfrost/panfrost_regs.h +index ea38ac60581c..eddaa62ad8b0 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_regs.h ++++ b/drivers/gpu/drm/panfrost/panfrost_regs.h +@@ -51,6 +51,10 @@ + #define GPU_STATUS 0x34 + #define GPU_STATUS_PRFCNT_ACTIVE BIT(2) + #define GPU_LATEST_FLUSH_ID 0x38 ++#define GPU_PWR_KEY 0x50 /* (WO) Power manager key register */ ++#define GPU_PWR_KEY_UNLOCK 0x2968A819 ++#define GPU_PWR_OVERRIDE0 0x54 /* (RW) Power manager override settings */ ++#define GPU_PWR_OVERRIDE1 0x58 /* (RW) Power manager override settings */ + #define GPU_FAULT_STATUS 0x3C + #define GPU_FAULT_ADDRESS_LO 0x40 + #define GPU_FAULT_ADDRESS_HI 0x44 + +From 30ea0948011c753827c9aad069a081b80892fbbb Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Wed, 16 Sep 2020 17:01:47 +0200 +Subject: [PATCH] drm/panfrost: add Amlogic GPU integration quirks + +This adds the required GPU quirks, including the quirk in the PWR +registers at the GPU reset time and the IOMMU quirk for shareability +issues observed on G52 in Amlogic G12B SoCs. + +Signed-off-by: Neil Armstrong +Reviewed-by: Steven Price +Reviewed-by: Alyssa Rosenzweig +Signed-off-by: Steven Price +Link: https://patchwork.freedesktop.org/patch/msgid/20200916150147.25753-4-narmstrong@baylibre.com +(cherry picked from commit afcd0c7d3d4c22afc8befcfc906db6ce3058d3ee) +--- + drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c +index 36463c89e966..37d4cb7a5491 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_drv.c ++++ b/drivers/gpu/drm/panfrost/panfrost_drv.c +@@ -656,7 +656,18 @@ static const struct panfrost_compatible default_data = { + .pm_domain_names = NULL, + }; + ++static const struct panfrost_compatible amlogic_data = { ++ .num_supplies = ARRAY_SIZE(default_supplies), ++ .supply_names = default_supplies, ++ .vendor_quirk = panfrost_gpu_amlogic_quirk, ++}; ++ + static const struct of_device_id dt_match[] = { ++ /* Set first to probe before the generic compatibles */ ++ { .compatible = "amlogic,meson-gxm-mali", ++ .data = &amlogic_data, }, ++ { .compatible = "amlogic,meson-g12a-mali", ++ .data = &amlogic_data, }, + { .compatible = "arm,mali-t604", .data = &default_data, }, + { .compatible = "arm,mali-t624", .data = &default_data, }, + { .compatible = "arm,mali-t628", .data = &default_data, }, + +From 769f4cb43c91ab3090c23986f9cb57b016887642 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Thu, 8 Oct 2020 14:17:38 +0000 +Subject: [PATCH] drm/panfrost: increase readl_relaxed_poll_timeout values + +Amlogic SoC devices report the following errors frequently causing excessive +dmesg log spam and early log rotataion, although the errors appear to be +harmless as everything works fine: + +[ 7.202702] panfrost ffe40000.gpu: error powering up gpu L2 +[ 7.203760] panfrost ffe40000.gpu: error powering up gpu shader + +ARM staff have advised increasing the timeout values to eliminate the errors +in most normal scenarios, and testing with several different G31/G52 devices +shows 20000 to be a reliable value. + +Fixes: f3ba91228e8e ("drm/panfrost: Add initial panfrost driver") +Suggested-by: Steven Price +Signed-off-by: Christian Hewitt +Reviewed-by: Steven Price +Signed-off-by: Steven Price +Link: https://patchwork.freedesktop.org/patch/msgid/20201008141738.13560-1-christianshewitt@gmail.com +(cherry picked from commit c2df75ad2a9f205820e4bc0db936d3d9af3da1ae) +--- + drivers/gpu/drm/panfrost/panfrost_gpu.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c +index e1b2a3376624..2aae636f1cf5 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_gpu.c ++++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c +@@ -325,13 +325,13 @@ void panfrost_gpu_power_on(struct panfrost_device *pfdev) + /* Just turn on everything for now */ + gpu_write(pfdev, L2_PWRON_LO, pfdev->features.l2_present); + ret = readl_relaxed_poll_timeout(pfdev->iomem + L2_READY_LO, +- val, val == pfdev->features.l2_present, 100, 1000); ++ val, val == pfdev->features.l2_present, 100, 20000); + if (ret) + dev_err(pfdev->dev, "error powering up gpu L2"); + + gpu_write(pfdev, SHADER_PWRON_LO, pfdev->features.shader_present); + ret = readl_relaxed_poll_timeout(pfdev->iomem + SHADER_READY_LO, +- val, val == pfdev->features.shader_present, 100, 1000); ++ val, val == pfdev->features.shader_present, 100, 20000); + if (ret) + dev_err(pfdev->dev, "error powering up gpu shader"); + diff --git a/projects/Rockchip/patches/linux/default/linux-0021-drm-from-5.9.patch b/projects/Rockchip/patches/linux/default/linux-0021-drm-from-5.9.patch deleted file mode 100644 index 2dcfafd3e8..0000000000 --- a/projects/Rockchip/patches/linux/default/linux-0021-drm-from-5.9.patch +++ /dev/null @@ -1,3613 +0,0 @@ -From a6752edf88b17c77c31e66922789ec10308b618e Mon Sep 17 00:00:00 2001 -From: Emil Velikov -Date: Tue, 5 May 2020 16:16:13 +0100 -Subject: [PATCH] drm/rockchip: vop: call vop_cfg_done() under reg_lock -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The function vop_cfg_done() is a simple VOP_REG_SET(). As such it should -be done under a reg_lock. A quick look through the driver shows that all -other instances (apart from driver init) have the lock. Do the same here - -Cc: Sandy Huang -Cc: Heiko Stübner -Signed-off-by: Emil Velikov -Reviewed-by: Sandy Huang -Link: https://patchwork.freedesktop.org/patch/msgid/20200505151613.2932456-1-emil.l.velikov@gmail.com -(cherry picked from commit 5fa63f0773323b1d028f2da5c94b8f3e38619b69) ---- - drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -index 33463b79a37b..1d76455ca933 100644 ---- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -@@ -645,10 +645,10 @@ static int vop_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) - s->enable_afbc = false; - } - -- spin_unlock(&vop->reg_lock); -- - vop_cfg_done(vop); - -+ spin_unlock(&vop->reg_lock); -+ - /* - * At here, vop clock & iommu is enable, R/W vop regs would be safe. - */ - -From 1fdb9715e312cdfbf594de65992ab36ae441d5b2 Mon Sep 17 00:00:00 2001 -From: Bernard Zhao -Date: Mon, 27 Apr 2020 01:05:23 -0700 -Subject: [PATCH] drivers: video: hdmi: cleanup coding style in video a bit - -Eliminate the magic numbers, add vendor infoframe size macro -like other hdmi modules. - -Signed-off-by: Bernard Zhao -Cc: Uma Shankar -Cc: Ville Syrjala -Cc: Shashank Sharma -Cc: Laurent Pinchart -Cc: Daniel Vetter -Cc: opensource.kernel@vivo.com -[b.zolnierkie: add "hdmi" to the patch summary] -[b.zolnierkie: fix "vender" -> vendor" typo in the patch description] -Signed-off-by: Bartlomiej Zolnierkiewicz -Link: https://patchwork.freedesktop.org/patch/msgid/20200427080530.3234-1-bernard@vivo.com -(cherry picked from commit d43be2554b58621a21cb5f54b32db2263b3008b6) ---- - drivers/video/hdmi.c | 2 +- - include/linux/hdmi.h | 1 + - 2 files changed, 2 insertions(+), 1 deletion(-) - -diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c -index e70792b3e367..b7a1d6fae90d 100644 ---- a/drivers/video/hdmi.c -+++ b/drivers/video/hdmi.c -@@ -495,7 +495,7 @@ int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame) - * value - */ - frame->s3d_struct = HDMI_3D_STRUCTURE_INVALID; -- frame->length = 4; -+ frame->length = HDMI_VENDOR_INFOFRAME_SIZE; - - return 0; - } -diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h -index 50c31f1a0a2d..9850d59d6f1c 100644 ---- a/include/linux/hdmi.h -+++ b/include/linux/hdmi.h -@@ -57,6 +57,7 @@ enum hdmi_infoframe_type { - #define HDMI_SPD_INFOFRAME_SIZE 25 - #define HDMI_AUDIO_INFOFRAME_SIZE 10 - #define HDMI_DRM_INFOFRAME_SIZE 26 -+#define HDMI_VENDOR_INFOFRAME_SIZE 4 - - #define HDMI_INFOFRAME_SIZE(type) \ - (HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE) - -From 326cfcb658e63140cb8f4677572d4180c0540d3d Mon Sep 17 00:00:00 2001 -From: Paul Kocialkowski -Date: Thu, 16 Apr 2020 16:05:26 +0200 -Subject: [PATCH] drm/rockchip: Add per-pixel alpha support for the PX30 VOP - -Compared to its predecessors, the PX30 VOP has a different register layout -for enabling per-pixel alpha. Instead of src_alpha_ctl and dst_alpha_ctl, -there is a single alpha control register. This register takes some fields -from src_alpha_ctl, but with a different layout. - -Add support for the required fields to the PX30 VOP window descriptions, -which makes per-pixel-alpha formats behave correctly. - -Signed-off-by: Paul Kocialkowski -Signed-off-by: Heiko Stuebner -Link: https://patchwork.freedesktop.org/patch/msgid/20200416140526.262533-1-paul.kocialkowski@bootlin.com -(cherry picked from commit 2aae8ed1f390a42ec752e4403ffca877fb3260e1) ---- - drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++++ - drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 3 +++ - drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 9 +++++++++ - 3 files changed, 16 insertions(+) - -diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -index 1d76455ca933..c80f7d9fd13f 100644 ---- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -@@ -1007,6 +1007,10 @@ static void vop_plane_atomic_update(struct drm_plane *plane, - SRC_ALPHA_CAL_M0(ALPHA_NO_SATURATION) | - SRC_FACTOR_M0(ALPHA_ONE); - VOP_WIN_SET(vop, win, src_alpha_ctl, val); -+ -+ VOP_WIN_SET(vop, win, alpha_pre_mul, ALPHA_SRC_PRE_MUL); -+ VOP_WIN_SET(vop, win, alpha_mode, ALPHA_PER_PIX); -+ VOP_WIN_SET(vop, win, alpha_en, 1); - } else { - VOP_WIN_SET(vop, win, src_alpha_ctl, SRC_ALPHA_EN(0)); - } -diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h -index d03bdb531ef2..4a2099cb582e 100644 ---- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h -+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h -@@ -167,6 +167,9 @@ struct vop_win_phy { - - struct vop_reg dst_alpha_ctl; - struct vop_reg src_alpha_ctl; -+ struct vop_reg alpha_pre_mul; -+ struct vop_reg alpha_mode; -+ struct vop_reg alpha_en; - struct vop_reg channel; - }; - -diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c -index 2413deded22c..80053d91a301 100644 ---- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c -+++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c -@@ -264,6 +264,9 @@ static const struct vop_win_phy px30_win0_data = { - .uv_mst = VOP_REG(PX30_WIN0_CBR_MST0, 0xffffffff, 0), - .yrgb_vir = VOP_REG(PX30_WIN0_VIR, 0x1fff, 0), - .uv_vir = VOP_REG(PX30_WIN0_VIR, 0x1fff, 16), -+ .alpha_pre_mul = VOP_REG(PX30_WIN0_ALPHA_CTRL, 0x1, 2), -+ .alpha_mode = VOP_REG(PX30_WIN0_ALPHA_CTRL, 0x1, 1), -+ .alpha_en = VOP_REG(PX30_WIN0_ALPHA_CTRL, 0x1, 0), - }; - - static const struct vop_win_phy px30_win1_data = { -@@ -277,6 +280,9 @@ static const struct vop_win_phy px30_win1_data = { - .dsp_st = VOP_REG(PX30_WIN1_DSP_ST, 0xffffffff, 0), - .yrgb_mst = VOP_REG(PX30_WIN1_MST, 0xffffffff, 0), - .yrgb_vir = VOP_REG(PX30_WIN1_VIR, 0x1fff, 0), -+ .alpha_pre_mul = VOP_REG(PX30_WIN1_ALPHA_CTRL, 0x1, 2), -+ .alpha_mode = VOP_REG(PX30_WIN1_ALPHA_CTRL, 0x1, 1), -+ .alpha_en = VOP_REG(PX30_WIN1_ALPHA_CTRL, 0x1, 0), - }; - - static const struct vop_win_phy px30_win2_data = { -@@ -291,6 +297,9 @@ static const struct vop_win_phy px30_win2_data = { - .dsp_st = VOP_REG(PX30_WIN2_DSP_ST0, 0x1fff1fff, 0), - .yrgb_mst = VOP_REG(PX30_WIN2_MST0, 0xffffffff, 0), - .yrgb_vir = VOP_REG(PX30_WIN2_VIR0_1, 0x1fff, 0), -+ .alpha_pre_mul = VOP_REG(PX30_WIN2_ALPHA_CTRL, 0x1, 2), -+ .alpha_mode = VOP_REG(PX30_WIN2_ALPHA_CTRL, 0x1, 1), -+ .alpha_en = VOP_REG(PX30_WIN2_ALPHA_CTRL, 0x1, 0), - }; - - static const struct vop_win_data px30_vop_big_win_data[] = { - -From b0766b1d203e666d01853328c94b154be2efd700 Mon Sep 17 00:00:00 2001 -From: Krzysztof Kozlowski -Date: Wed, 27 May 2020 22:05:44 +0200 -Subject: [PATCH] drm/panfrost: Reduce the amount of logs on deferred probe - -There is no point to print deferred probe (and its failures to get -resources) as an error. Also there is no need to print regulator errors -twice. - -In case of multiple probe tries this would pollute the dmesg. - -Signed-off-by: Krzysztof Kozlowski -Reviewed-by: Steven Price -Signed-off-by: Steven Price -Link: https://patchwork.freedesktop.org/patch/msgid/20200527200544.7849-1-krzk@kernel.org -(cherry picked from commit e63adeccc0bbba34a7b988b8898bebbd5bbb6461) ---- - drivers/gpu/drm/panfrost/panfrost_device.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c -index 8136babd3ba9..b172087eee6a 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_device.c -+++ b/drivers/gpu/drm/panfrost/panfrost_device.c -@@ -101,7 +101,9 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev) - pfdev->comp->num_supplies, - pfdev->regulators); - if (ret < 0) { -- dev_err(pfdev->dev, "failed to get regulators: %d\n", ret); -+ if (ret != -EPROBE_DEFER) -+ dev_err(pfdev->dev, "failed to get regulators: %d\n", -+ ret); - return ret; - } - -@@ -213,10 +215,8 @@ int panfrost_device_init(struct panfrost_device *pfdev) - } - - err = panfrost_regulator_init(pfdev); -- if (err) { -- dev_err(pfdev->dev, "regulator init failed %d\n", err); -+ if (err) - goto err_out0; -- } - - err = panfrost_reset_init(pfdev); - if (err) { - -From ae01e6ce2d9a1d413b0dc34f48924b7934cb8670 Mon Sep 17 00:00:00 2001 -From: Steven Price -Date: Fri, 22 May 2020 16:36:53 +0100 -Subject: [PATCH] drm/panfrost: Fix inbalance of devfreq record_busy/idle() - -The calls to panfrost_devfreq_record_busy() and -panfrost_devfreq_record_idle() must be balanced to ensure that the -devfreq utilisation is correctly reported. But there are two cases where -this doesn't work correctly. - -In panfrost_job_hw_submit() if pm_runtime_get_sync() fails or the -WARN_ON() fires then no call to panfrost_devfreq_record_busy() is made, -but when the job times out the corresponding _record_idle() call is -still made in panfrost_job_timedout(). Move the call up to ensure that -it always happens. - -Secondly panfrost_job_timedout() only makes a single call to -panfrost_devfreq_record_idle() even if it is cleaning up multiple jobs. -Move the call inside the loop to ensure that the number of -_record_idle() calls matches the number of _record_busy() calls. - -Fixes: 9e62b885f715 ("drm/panfrost: Simplify devfreq utilisation tracking") -Acked-by: Alyssa Rosenzweig -Signed-off-by: Steven Price -Link: https://patchwork.freedesktop.org/patch/msgid/20200522153653.40754-1-steven.price@arm.com -(cherry picked from commit b99773ef258e628bd53cab22d450a755b73b4d55) ---- - drivers/gpu/drm/panfrost/panfrost_job.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c -index 7914b1570841..f9519afca29d 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_job.c -+++ b/drivers/gpu/drm/panfrost/panfrost_job.c -@@ -145,6 +145,8 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) - u64 jc_head = job->jc; - int ret; - -+ panfrost_devfreq_record_busy(pfdev); -+ - ret = pm_runtime_get_sync(pfdev->dev); - if (ret < 0) - return; -@@ -155,7 +157,6 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) - } - - cfg = panfrost_mmu_as_get(pfdev, &job->file_priv->mmu); -- panfrost_devfreq_record_busy(pfdev); - - job_write(pfdev, JS_HEAD_NEXT_LO(js), jc_head & 0xFFFFFFFF); - job_write(pfdev, JS_HEAD_NEXT_HI(js), jc_head >> 32); -@@ -410,12 +411,12 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job) - for (i = 0; i < NUM_JOB_SLOTS; i++) { - if (pfdev->jobs[i]) { - pm_runtime_put_noidle(pfdev->dev); -+ panfrost_devfreq_record_idle(pfdev); - pfdev->jobs[i] = NULL; - } - } - spin_unlock_irqrestore(&pfdev->js->job_lock, flags); - -- panfrost_devfreq_record_idle(pfdev); - panfrost_device_reset(pfdev); - - for (i = 0; i < NUM_JOB_SLOTS; i++) - -From c786931a8c638a0e3caa97133cef1172664c51a4 Mon Sep 17 00:00:00 2001 -From: Dinghao Liu -Date: Fri, 22 May 2020 21:41:09 +0800 -Subject: [PATCH] drm/panfrost: Fix runtime PM imbalance on error - -The caller expects panfrost_job_hw_submit() to increase -runtime PM usage counter. The refcount decrement on the -error branch of WARN_ON() will break the counter balance -and needs to be removed. - -Signed-off-by: Dinghao Liu -Reviewed-by: Steven Price -Signed-off-by: Steven Price -Link: https://patchwork.freedesktop.org/patch/msgid/20200522134109.27204-1-dinghao.liu@zju.edu.cn -(cherry picked from commit 64092598c4566dc80a71ca57396dc36fdbf3da4b) ---- - drivers/gpu/drm/panfrost/panfrost_job.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c -index f9519afca29d..c6242fe34840 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_job.c -+++ b/drivers/gpu/drm/panfrost/panfrost_job.c -@@ -152,7 +152,6 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) - return; - - if (WARN_ON(job_read(pfdev, JS_COMMAND_NEXT(js)))) { -- pm_runtime_put_sync_autosuspend(pfdev->dev); - return; - } - - -From a74d3fcf73bcb33ec30edd6cfc6b5ef61c05fc9e Mon Sep 17 00:00:00 2001 -From: Denis Efremov -Date: Mon, 8 Jun 2020 18:17:28 +0300 -Subject: [PATCH] drm/panfrost: Use kvfree() to free bo->sgts - -Use kvfree() to free bo->sgts, because the memory is allocated with -kvmalloc_array() in panfrost_mmu_map_fault_addr(). - -Fixes: 187d2929206e ("drm/panfrost: Add support for GPU heap allocations") -Cc: stable@vger.kernel.org -Signed-off-by: Denis Efremov -Reviewed-by: Steven Price -Signed-off-by: Steven Price -Link: https://patchwork.freedesktop.org/patch/msgid/20200608151728.234026-1-efremov@linux.com -(cherry picked from commit 114427b8927a4def2942b2b886f7e4aeae289ccb) ---- - drivers/gpu/drm/panfrost/panfrost_gem.c | 2 +- - drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panfrost/panfrost_gem.c -index 17b654e1eb94..556181ea4a07 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_gem.c -+++ b/drivers/gpu/drm/panfrost/panfrost_gem.c -@@ -46,7 +46,7 @@ static void panfrost_gem_free_object(struct drm_gem_object *obj) - sg_free_table(&bo->sgts[i]); - } - } -- kfree(bo->sgts); -+ kvfree(bo->sgts); - } - - drm_gem_shmem_free_object(obj); -diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c -index ed28aeba6d59..3c8ae7411c80 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_mmu.c -+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c -@@ -486,7 +486,7 @@ static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, - pages = kvmalloc_array(bo->base.base.size >> PAGE_SHIFT, - sizeof(struct page *), GFP_KERNEL | __GFP_ZERO); - if (!pages) { -- kfree(bo->sgts); -+ kvfree(bo->sgts); - bo->sgts = NULL; - mutex_unlock(&bo->base.pages_lock); - ret = -ENOMEM; - -From ff20f5bb6ef5dc63914dbe8510a336b7586356d9 Mon Sep 17 00:00:00 2001 -From: Ben Davis -Date: Mon, 1 Jun 2020 17:28:17 +0100 -Subject: [PATCH] drm: drm_fourcc: add NV15, Q410, Q401 YUV formats - -DRM_FORMAT_NV15 is a 2 plane format suitable for linear and 16x16 -block-linear memory layouts (DRM_FORMAT_MOD_SAMSUNG_16_16_TILE). The -format is similar to P010 with 4:2:0 sub-sampling but has no padding -between components. Instead, luminance and chrominance samples are -grouped into 4s so that each group is packed into an integer number -of bytes: - -YYYY = UVUV = 4 * 10 bits = 40 bits = 5 bytes - -The '15' suffix refers to the optimum effective bits per pixel which is -achieved when the total number of luminance samples is a multiple of 8. - -Q410 and Q401 are both 3 plane non-subsampled formats with 16 bits per -component, but only 10 bits are used and 6 are padded. 'Q' is chosen -as the first letter to denote 3 plane YUV444, (and is the next letter -along from P which is usually 2 plane). - -V2: Updated block_w of NV15 to {4, 2, 0} -V3: Updated commit message to include specific modifier name - -NV15: -Tested-by: Jonas Karlman - -Reviewed-by: Brian Starkey -Signed-off-by: Ben Davis -Signed-off-by: Liviu Dudau -Link: https://patchwork.freedesktop.org/patch/msgid/20200601162817.18230-1-ben.davis@arm.com -(cherry picked from commit 94b292b277343190175d39172c903c0c5fb814f1) ---- - drivers/gpu/drm/drm_fourcc.c | 12 ++++++++++++ - include/uapi/drm/drm_fourcc.h | 22 ++++++++++++++++++++++ - 2 files changed, 34 insertions(+) - -diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c -index b234bfaeda06..722c7ebe4e88 100644 ---- a/drivers/gpu/drm/drm_fourcc.c -+++ b/drivers/gpu/drm/drm_fourcc.c -@@ -274,6 +274,18 @@ const struct drm_format_info *__drm_format_info(u32 format) - { .format = DRM_FORMAT_YUV420_10BIT, .depth = 0, - .num_planes = 1, .cpp = { 0, 0, 0 }, .hsub = 2, .vsub = 2, - .is_yuv = true }, -+ { .format = DRM_FORMAT_NV15, .depth = 0, -+ .num_planes = 2, .char_per_block = { 5, 5, 0 }, -+ .block_w = { 4, 2, 0 }, .block_h = { 1, 1, 0 }, .hsub = 2, -+ .vsub = 2, .is_yuv = true }, -+ { .format = DRM_FORMAT_Q410, .depth = 0, -+ .num_planes = 3, .char_per_block = { 2, 2, 2 }, -+ .block_w = { 1, 1, 1 }, .block_h = { 1, 1, 1 }, .hsub = 0, -+ .vsub = 0, .is_yuv = true }, -+ { .format = DRM_FORMAT_Q401, .depth = 0, -+ .num_planes = 3, .char_per_block = { 2, 2, 2 }, -+ .block_w = { 1, 1, 1 }, .block_h = { 1, 1, 1 }, .hsub = 0, -+ .vsub = 0, .is_yuv = true }, - }; - - unsigned int i; -diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h -index 490143500a50..8ba2d9153a94 100644 ---- a/include/uapi/drm/drm_fourcc.h -+++ b/include/uapi/drm/drm_fourcc.h -@@ -236,6 +236,12 @@ extern "C" { - #define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */ - #define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */ - #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */ -+/* -+ * 2 plane YCbCr -+ * index 0 = Y plane, [39:0] Y3:Y2:Y1:Y0 little endian -+ * index 1 = Cr:Cb plane, [39:0] Cr1:Cb1:Cr0:Cb0 little endian -+ */ -+#define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5') /* 2x2 subsampled Cr:Cb plane */ - - /* - * 2 plane YCbCr MSB aligned -@@ -265,6 +271,22 @@ extern "C" { - */ - #define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */ - -+/* 3 plane non-subsampled (444) YCbCr -+ * 16 bits per component, but only 10 bits are used and 6 bits are padded -+ * index 0: Y plane, [15:0] Y:x [10:6] little endian -+ * index 1: Cb plane, [15:0] Cb:x [10:6] little endian -+ * index 2: Cr plane, [15:0] Cr:x [10:6] little endian -+ */ -+#define DRM_FORMAT_Q410 fourcc_code('Q', '4', '1', '0') -+ -+/* 3 plane non-subsampled (444) YCrCb -+ * 16 bits per component, but only 10 bits are used and 6 bits are padded -+ * index 0: Y plane, [15:0] Y:x [10:6] little endian -+ * index 1: Cr plane, [15:0] Cr:x [10:6] little endian -+ * index 2: Cb plane, [15:0] Cb:x [10:6] little endian -+ */ -+#define DRM_FORMAT_Q401 fourcc_code('Q', '4', '0', '1') -+ - /* - * 3 plane YCbCr - * index 0: Y plane, [7:0] Y - -From 0a233934f5acb378db5706316b7a8ffd207c4421 Mon Sep 17 00:00:00 2001 -From: Ben Davis -Date: Thu, 30 Apr 2020 09:32:20 +0100 -Subject: [PATCH] drm: drm_fourcc: Add uncompressed AFBC modifier - -AFBC has a mode that guarantees use of AFBC with an uncompressed -payloads, we add a new modifier to support this mode. - -V2: updated modifier comment - -Signed-off-by: Ben Davis -Acked-by: Liviu Dudau -Signed-off-by: Liviu Dudau -Link: https://patchwork.freedesktop.org/patch/msgid/20200430083220.17347-1-ben.davis@arm.com -(cherry picked from commit 79ce058032c391b12af928b1e30abf92482a270f) ---- - include/uapi/drm/drm_fourcc.h | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h -index 8ba2d9153a94..993c1b342315 100644 ---- a/include/uapi/drm/drm_fourcc.h -+++ b/include/uapi/drm/drm_fourcc.h -@@ -914,6 +914,18 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier) - */ - #define AFBC_FORMAT_MOD_BCH (1ULL << 11) - -+/* AFBC uncompressed storage mode -+ * -+ * Indicates that the buffer is using AFBC uncompressed storage mode. -+ * In this mode all superblock payloads in the buffer use the uncompressed -+ * storage mode, which is usually only used for data which cannot be compressed. -+ * The buffer layout is the same as for AFBC buffers without USM set, this only -+ * affects the storage mode of the individual superblocks. Note that even a -+ * buffer without USM set may use uncompressed storage mode for some or all -+ * superblocks, USM just guarantees it for all. -+ */ -+#define AFBC_FORMAT_MOD_USM (1ULL << 12) -+ - /* - * Arm 16x16 Block U-Interleaved modifier - * - -From 57fd7e0d426c2565175f6956da0a31e19000d7e4 Mon Sep 17 00:00:00 2001 -From: Laurent Pinchart -Date: Tue, 26 May 2020 04:14:47 +0300 -Subject: [PATCH] drm: edid: Constify connector argument to infoframe functions - -The drm_hdmi_avi_infoframe_from_display_mode(), -drm_hdmi_vendor_infoframe_from_display_mode() and -drm_hdmi_avi_infoframe_quant_range() functions take a drm_connector that -they don't modify. Mark it as const. - -Signed-off-by: Laurent Pinchart -Acked-by: Sam Ravnborg -Signed-off-by: Sam Ravnborg -Link: https://patchwork.freedesktop.org/patch/msgid/20200526011505.31884-10-laurent.pinchart+renesas@ideasonboard.com -(cherry picked from commit 192a3aa0e4e20e1087baa29183c5d64d48716fa9) ---- - drivers/gpu/drm/drm_edid.c | 12 ++++++------ - include/drm/drm_edid.h | 6 +++--- - 2 files changed, 9 insertions(+), 9 deletions(-) - -diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c -index fed653f13c26..b3f659759adb 100644 ---- a/drivers/gpu/drm/drm_edid.c -+++ b/drivers/gpu/drm/drm_edid.c -@@ -5366,7 +5366,7 @@ void drm_set_preferred_mode(struct drm_connector *connector, - } - EXPORT_SYMBOL(drm_set_preferred_mode); - --static bool is_hdmi2_sink(struct drm_connector *connector) -+static bool is_hdmi2_sink(const struct drm_connector *connector) - { - /* - * FIXME: sil-sii8620 doesn't have a connector around when -@@ -5451,7 +5451,7 @@ drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame, - } - EXPORT_SYMBOL(drm_hdmi_infoframe_set_hdr_metadata); - --static u8 drm_mode_hdmi_vic(struct drm_connector *connector, -+static u8 drm_mode_hdmi_vic(const struct drm_connector *connector, - const struct drm_display_mode *mode) - { - bool has_hdmi_infoframe = connector ? -@@ -5467,7 +5467,7 @@ static u8 drm_mode_hdmi_vic(struct drm_connector *connector, - return drm_match_hdmi_mode(mode); - } - --static u8 drm_mode_cea_vic(struct drm_connector *connector, -+static u8 drm_mode_cea_vic(const struct drm_connector *connector, - const struct drm_display_mode *mode) - { - u8 vic; -@@ -5505,7 +5505,7 @@ static u8 drm_mode_cea_vic(struct drm_connector *connector, - */ - int - drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, -- struct drm_connector *connector, -+ const struct drm_connector *connector, - const struct drm_display_mode *mode) - { - enum hdmi_picture_aspect picture_aspect; -@@ -5652,7 +5652,7 @@ EXPORT_SYMBOL(drm_hdmi_avi_infoframe_colorspace); - */ - void - drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame, -- struct drm_connector *connector, -+ const struct drm_connector *connector, - const struct drm_display_mode *mode, - enum hdmi_quantization_range rgb_quant_range) - { -@@ -5756,7 +5756,7 @@ s3d_structure_from_display_mode(const struct drm_display_mode *mode) - */ - int - drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, -- struct drm_connector *connector, -+ const struct drm_connector *connector, - const struct drm_display_mode *mode) - { - /* -diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h -index 34b15e3d070c..43254319ab19 100644 ---- a/include/drm/drm_edid.h -+++ b/include/drm/drm_edid.h -@@ -361,11 +361,11 @@ drm_load_edid_firmware(struct drm_connector *connector) - - int - drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, -- struct drm_connector *connector, -+ const struct drm_connector *connector, - const struct drm_display_mode *mode); - int - drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, -- struct drm_connector *connector, -+ const struct drm_connector *connector, - const struct drm_display_mode *mode); - - void -@@ -378,7 +378,7 @@ drm_hdmi_avi_infoframe_bars(struct hdmi_avi_infoframe *frame, - - void - drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame, -- struct drm_connector *connector, -+ const struct drm_connector *connector, - const struct drm_display_mode *mode, - enum hdmi_quantization_range rgb_quant_range); - - -From 1c6fa4a67d81a2a5a74f43ab901b2c80a5f73b10 Mon Sep 17 00:00:00 2001 -From: Laurent Pinchart -Date: Tue, 26 May 2020 04:14:48 +0300 -Subject: [PATCH] drm: bridge: Pass drm_display_info to drm_bridge_funcs - .mode_valid() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When validating a mode, bridges may need to do so in the context of a -display, as specified by drm_display_info. An example is the meson -dw-hdmi bridge that needs to consider the YUV 4:2:0 output format to -perform clock calculations. - -Bridges that need the display info currently retrieve it from the -drm_connector created by the bridge. This gets in the way of moving -connector creation out of bridge drivers. To make this possible, pass -the drm_display_info to drm_bridge_funcs .mode_valid(). - -Changes to the bridge drivers have been performed with the following -coccinelle semantic patch and have been compile-tested. - -@ rule1 @ -identifier funcs; -identifier fn; -@@ - struct drm_bridge_funcs funcs = { - ..., - .mode_valid = fn - }; - -@ depends on rule1 @ -identifier rule1.fn; -identifier bridge; -identifier mode; -@@ - enum drm_mode_status fn( - struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode - ) - { - ... - } - -Signed-off-by: Laurent Pinchart -Reviewed-by: Neil Armstrong -Reviewed-by: Boris Brezillon -Reviewed-by: Guido Günther # for the nwl-dsi part: -Signed-off-by: Sam Ravnborg -Link: https://patchwork.freedesktop.org/patch/msgid/20200526011505.31884-11-laurent.pinchart+renesas@ideasonboard.com -(cherry picked from commit 12c683e12cd8e2dcf7b7143bebceae484d17727a) ---- - drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 1 + - drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 1 + - drivers/gpu/drm/bridge/cdns-dsi.c | 1 + - drivers/gpu/drm/bridge/chrontel-ch7033.c | 1 + - drivers/gpu/drm/bridge/nwl-dsi.c | 1 + - drivers/gpu/drm/bridge/sii9234.c | 1 + - drivers/gpu/drm/bridge/sil-sii8620.c | 1 + - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 1 + - drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 1 + - drivers/gpu/drm/bridge/tc358767.c | 1 + - drivers/gpu/drm/bridge/tc358768.c | 1 + - drivers/gpu/drm/bridge/thc63lvd1024.c | 1 + - drivers/gpu/drm/bridge/ti-tfp410.c | 1 + - drivers/gpu/drm/drm_atomic_helper.c | 3 ++- - drivers/gpu/drm/drm_bridge.c | 4 +++- - drivers/gpu/drm/drm_probe_helper.c | 4 +++- - drivers/gpu/drm/i2c/tda998x_drv.c | 1 + - drivers/gpu/drm/omapdrm/dss/dpi.c | 1 + - drivers/gpu/drm/omapdrm/dss/sdi.c | 1 + - drivers/gpu/drm/omapdrm/dss/venc.c | 1 + - include/drm/drm_bridge.h | 3 +++ - 21 files changed, 28 insertions(+), 3 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c -index 9af39ec958db..f082b4ed4878 100644 ---- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c -+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c -@@ -588,6 +588,7 @@ static int anx6345_bridge_attach(struct drm_bridge *bridge, - - static enum drm_mode_status - anx6345_bridge_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - if (mode->flags & DRM_MODE_FLAG_INTERLACE) -diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c -index 0d5a5ad0c9ee..81debd02c169 100644 ---- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c -+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c -@@ -944,6 +944,7 @@ static int anx78xx_bridge_attach(struct drm_bridge *bridge, - - static enum drm_mode_status - anx78xx_bridge_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - if (mode->flags & DRM_MODE_FLAG_INTERLACE) -diff --git a/drivers/gpu/drm/bridge/cdns-dsi.c b/drivers/gpu/drm/bridge/cdns-dsi.c -index 69c3892caee5..76373e31df92 100644 ---- a/drivers/gpu/drm/bridge/cdns-dsi.c -+++ b/drivers/gpu/drm/bridge/cdns-dsi.c -@@ -663,6 +663,7 @@ static int cdns_dsi_bridge_attach(struct drm_bridge *bridge, - - static enum drm_mode_status - cdns_dsi_bridge_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge); -diff --git a/drivers/gpu/drm/bridge/chrontel-ch7033.c b/drivers/gpu/drm/bridge/chrontel-ch7033.c -index f8675d82974b..486f405c2e16 100644 ---- a/drivers/gpu/drm/bridge/chrontel-ch7033.c -+++ b/drivers/gpu/drm/bridge/chrontel-ch7033.c -@@ -317,6 +317,7 @@ static void ch7033_bridge_detach(struct drm_bridge *bridge) - } - - static enum drm_mode_status ch7033_bridge_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - if (mode->clock > 165000) -diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c -index c7bc194bbce3..ce94f797d090 100644 ---- a/drivers/gpu/drm/bridge/nwl-dsi.c -+++ b/drivers/gpu/drm/bridge/nwl-dsi.c -@@ -818,6 +818,7 @@ static bool nwl_dsi_bridge_mode_fixup(struct drm_bridge *bridge, - - static enum drm_mode_status - nwl_dsi_bridge_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - struct nwl_dsi *dsi = bridge_to_dsi(bridge); -diff --git a/drivers/gpu/drm/bridge/sii9234.c b/drivers/gpu/drm/bridge/sii9234.c -index b1258f0ed205..15c98a7bd81c 100644 ---- a/drivers/gpu/drm/bridge/sii9234.c -+++ b/drivers/gpu/drm/bridge/sii9234.c -@@ -873,6 +873,7 @@ static inline struct sii9234 *bridge_to_sii9234(struct drm_bridge *bridge) - } - - static enum drm_mode_status sii9234_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - if (mode->clock > MHL1_MAX_CLK) -diff --git a/drivers/gpu/drm/bridge/sil-sii8620.c b/drivers/gpu/drm/bridge/sil-sii8620.c -index 92acd336aa89..7c0c93c7e61f 100644 ---- a/drivers/gpu/drm/bridge/sil-sii8620.c -+++ b/drivers/gpu/drm/bridge/sil-sii8620.c -@@ -2244,6 +2244,7 @@ static int sii8620_is_packing_required(struct sii8620 *ctx, - } - - static enum drm_mode_status sii8620_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - struct sii8620 *ctx = bridge_to_sii8620(bridge); -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 30681398cfb0..b535354150db 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -2767,6 +2767,7 @@ static void dw_hdmi_bridge_detach(struct drm_bridge *bridge) - - static enum drm_mode_status - dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - struct dw_hdmi *hdmi = bridge->driver_private; -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c -index 5ef0f154aa7b..c223fb9a04cb 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c -@@ -924,6 +924,7 @@ static void dw_mipi_dsi_bridge_enable(struct drm_bridge *bridge) - - static enum drm_mode_status - dw_mipi_dsi_bridge_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge); -diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c -index e4c0ea03ae3a..c2777b226c75 100644 ---- a/drivers/gpu/drm/bridge/tc358767.c -+++ b/drivers/gpu/drm/bridge/tc358767.c -@@ -1306,6 +1306,7 @@ static bool tc_bridge_mode_fixup(struct drm_bridge *bridge, - } - - static enum drm_mode_status tc_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - struct tc_data *tc = bridge_to_tc(bridge); -diff --git a/drivers/gpu/drm/bridge/tc358768.c b/drivers/gpu/drm/bridge/tc358768.c -index 6650fe4cfc20..4a463fadf743 100644 ---- a/drivers/gpu/drm/bridge/tc358768.c -+++ b/drivers/gpu/drm/bridge/tc358768.c -@@ -529,6 +529,7 @@ static int tc358768_bridge_attach(struct drm_bridge *bridge, - - static enum drm_mode_status - tc358768_bridge_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - struct tc358768_priv *priv = bridge_to_tc358768(bridge); -diff --git a/drivers/gpu/drm/bridge/thc63lvd1024.c b/drivers/gpu/drm/bridge/thc63lvd1024.c -index 97d8129760e9..86b06975bfdd 100644 ---- a/drivers/gpu/drm/bridge/thc63lvd1024.c -+++ b/drivers/gpu/drm/bridge/thc63lvd1024.c -@@ -51,6 +51,7 @@ static int thc63_attach(struct drm_bridge *bridge, - } - - static enum drm_mode_status thc63_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - struct thc63_dev *thc63 = to_thc63(bridge); -diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c -index e3eb6364c0f7..30230c552aeb 100644 ---- a/drivers/gpu/drm/bridge/ti-tfp410.c -+++ b/drivers/gpu/drm/bridge/ti-tfp410.c -@@ -188,6 +188,7 @@ static void tfp410_disable(struct drm_bridge *bridge) - } - - static enum drm_mode_status tfp410_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - if (mode->clock < 25000) -diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c -index 85d163f16801..c1178518dc7a 100644 ---- a/drivers/gpu/drm/drm_atomic_helper.c -+++ b/drivers/gpu/drm/drm_atomic_helper.c -@@ -506,7 +506,8 @@ static enum drm_mode_status mode_valid_path(struct drm_connector *connector, - } - - bridge = drm_bridge_chain_get_first_bridge(encoder); -- ret = drm_bridge_chain_mode_valid(bridge, mode); -+ ret = drm_bridge_chain_mode_valid(bridge, &connector->display_info, -+ mode); - if (ret != MODE_OK) { - DRM_DEBUG_ATOMIC("[BRIDGE] mode_valid() failed\n"); - return ret; -diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c -index afdec8e5fc68..8e31af64e8fe 100644 ---- a/drivers/gpu/drm/drm_bridge.c -+++ b/drivers/gpu/drm/drm_bridge.c -@@ -377,6 +377,7 @@ EXPORT_SYMBOL(drm_bridge_chain_mode_fixup); - * drm_bridge_chain_mode_valid - validate the mode against all bridges in the - * encoder chain. - * @bridge: bridge control structure -+ * @info: display info against which the mode shall be validated - * @mode: desired mode to be validated - * - * Calls &drm_bridge_funcs.mode_valid for all the bridges in the encoder -@@ -390,6 +391,7 @@ EXPORT_SYMBOL(drm_bridge_chain_mode_fixup); - */ - enum drm_mode_status - drm_bridge_chain_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - struct drm_encoder *encoder; -@@ -404,7 +406,7 @@ drm_bridge_chain_mode_valid(struct drm_bridge *bridge, - if (!bridge->funcs->mode_valid) - continue; - -- ret = bridge->funcs->mode_valid(bridge, mode); -+ ret = bridge->funcs->mode_valid(bridge, info, mode); - if (ret != MODE_OK) - return ret; - } -diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c -index 576b4b7dcd89..f5d141e0400f 100644 ---- a/drivers/gpu/drm/drm_probe_helper.c -+++ b/drivers/gpu/drm/drm_probe_helper.c -@@ -114,7 +114,9 @@ drm_mode_validate_pipeline(struct drm_display_mode *mode, - } - - bridge = drm_bridge_chain_get_first_bridge(encoder); -- ret = drm_bridge_chain_mode_valid(bridge, mode); -+ ret = drm_bridge_chain_mode_valid(bridge, -+ &connector->display_info, -+ mode); - if (ret != MODE_OK) { - /* There is also no point in continuing for crtc check - * here. */ -diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c -index 9517f522dcb9..50fd119a5276 100644 ---- a/drivers/gpu/drm/i2c/tda998x_drv.c -+++ b/drivers/gpu/drm/i2c/tda998x_drv.c -@@ -1379,6 +1379,7 @@ static void tda998x_bridge_detach(struct drm_bridge *bridge) - } - - static enum drm_mode_status tda998x_bridge_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - /* TDA19988 dotclock can go up to 165MHz */ -diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c b/drivers/gpu/drm/omapdrm/dss/dpi.c -index 5110acb0c6c1..1d2992daef40 100644 ---- a/drivers/gpu/drm/omapdrm/dss/dpi.c -+++ b/drivers/gpu/drm/omapdrm/dss/dpi.c -@@ -434,6 +434,7 @@ static int dpi_bridge_attach(struct drm_bridge *bridge, - - static enum drm_mode_status - dpi_bridge_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - struct dpi_data *dpi = drm_bridge_to_dpi(bridge); -diff --git a/drivers/gpu/drm/omapdrm/dss/sdi.c b/drivers/gpu/drm/omapdrm/dss/sdi.c -index 417a8740ad0a..033fd30074b0 100644 ---- a/drivers/gpu/drm/omapdrm/dss/sdi.c -+++ b/drivers/gpu/drm/omapdrm/dss/sdi.c -@@ -140,6 +140,7 @@ static int sdi_bridge_attach(struct drm_bridge *bridge, - - static enum drm_mode_status - sdi_bridge_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - struct sdi_device *sdi = drm_bridge_to_sdi(bridge); -diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c -index 9701843ccf09..4406ce2a08b4 100644 ---- a/drivers/gpu/drm/omapdrm/dss/venc.c -+++ b/drivers/gpu/drm/omapdrm/dss/venc.c -@@ -548,6 +548,7 @@ static int venc_bridge_attach(struct drm_bridge *bridge, - - static enum drm_mode_status - venc_bridge_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - switch (venc_get_videomode(mode)) { -diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h -index ea2aa5ebae34..e3d7f36d8c39 100644 ---- a/include/drm/drm_bridge.h -+++ b/include/drm/drm_bridge.h -@@ -35,6 +35,7 @@ - struct drm_bridge; - struct drm_bridge_timings; - struct drm_connector; -+struct drm_display_info; - struct drm_panel; - struct edid; - struct i2c_adapter; -@@ -112,6 +113,7 @@ struct drm_bridge_funcs { - * drm_mode_status Enum - */ - enum drm_mode_status (*mode_valid)(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode); - - /** -@@ -836,6 +838,7 @@ bool drm_bridge_chain_mode_fixup(struct drm_bridge *bridge, - struct drm_display_mode *adjusted_mode); - enum drm_mode_status - drm_bridge_chain_mode_valid(struct drm_bridge *bridge, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode); - void drm_bridge_chain_disable(struct drm_bridge *bridge); - void drm_bridge_chain_post_disable(struct drm_bridge *bridge); - -From 5a92a08e1cc2a6a273f6430581b1065d20dbacf5 Mon Sep 17 00:00:00 2001 -From: Laurent Pinchart -Date: Tue, 26 May 2020 04:14:49 +0300 -Subject: [PATCH] drm: bridge: dw-hdmi: Pass private data pointer to - .mode_valid() - -Platform glue drivers for dw_hdmi may need to access device-specific -data from their .mode_valid() implementation. They currently have no -clean way to do so, and one driver hacks around it by accessing the -dev_private data of the drm_device retrieved from the connector. - -Add a priv_data void pointer to the dw_hdmi_plat_data structure, and -pass it to the .mode_valid() function. - -Signed-off-by: Laurent Pinchart -Reviewed-by: Neil Armstrong -Signed-off-by: Sam Ravnborg -Link: https://patchwork.freedesktop.org/patch/msgid/20200526011505.31884-12-laurent.pinchart+renesas@ideasonboard.com -(cherry picked from commit 96591a4b93fb8b335941783dd6e7ded9d6d49f09) ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 6 ++++-- - drivers/gpu/drm/imx/dw_hdmi-imx.c | 6 ++++-- - drivers/gpu/drm/meson/meson_dw_hdmi.c | 3 ++- - drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c | 3 ++- - drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 3 ++- - drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 6 ++++-- - drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 3 ++- - include/drm/bridge/dw_hdmi.h | 14 ++++++++++++-- - 8 files changed, 32 insertions(+), 12 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index b535354150db..2b3f203cf467 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -2771,6 +2771,7 @@ dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge, - const struct drm_display_mode *mode) - { - struct dw_hdmi *hdmi = bridge->driver_private; -+ const struct dw_hdmi_plat_data *pdata = hdmi->plat_data; - struct drm_connector *connector = &hdmi->connector; - enum drm_mode_status mode_status = MODE_OK; - -@@ -2778,8 +2779,9 @@ dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge, - if (mode->flags & DRM_MODE_FLAG_DBLCLK) - return MODE_BAD; - -- if (hdmi->plat_data->mode_valid) -- mode_status = hdmi->plat_data->mode_valid(connector, mode); -+ if (pdata->mode_valid) -+ mode_status = pdata->mode_valid(hdmi, pdata->priv_data, -+ connector, mode); - - return mode_status; - } -diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c b/drivers/gpu/drm/imx/dw_hdmi-imx.c -index ba4ca17fd4d8..95aed4666c95 100644 ---- a/drivers/gpu/drm/imx/dw_hdmi-imx.c -+++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c -@@ -145,7 +145,8 @@ static const struct drm_encoder_helper_funcs dw_hdmi_imx_encoder_helper_funcs = - }; - - static enum drm_mode_status --imx6q_hdmi_mode_valid(struct drm_connector *con, -+imx6q_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, -+ struct drm_connector *con, - const struct drm_display_mode *mode) - { - if (mode->clock < 13500) -@@ -158,7 +159,8 @@ imx6q_hdmi_mode_valid(struct drm_connector *con, - } - - static enum drm_mode_status --imx6dl_hdmi_mode_valid(struct drm_connector *con, -+imx6dl_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, -+ struct drm_connector *con, - const struct drm_display_mode *mode) - { - if (mode->clock < 13500) -diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c -index 24a12c453095..fc594213c0e0 100644 ---- a/drivers/gpu/drm/meson/meson_dw_hdmi.c -+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c -@@ -630,7 +630,8 @@ static irqreturn_t dw_hdmi_top_thread_irq(int irq, void *dev_id) - } - - static enum drm_mode_status --dw_hdmi_mode_valid(struct drm_connector *connector, -+dw_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, -+ struct drm_connector *connector, - const struct drm_display_mode *mode) - { - struct meson_drm *priv = connector->dev->dev_private; -diff --git a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c -index 452461dc96f2..4d837a4d302d 100644 ---- a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c -+++ b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c -@@ -38,7 +38,8 @@ static const struct rcar_hdmi_phy_params rcar_hdmi_phy_params[] = { - }; - - static enum drm_mode_status --rcar_hdmi_mode_valid(struct drm_connector *connector, -+rcar_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, -+ struct drm_connector *connector, - const struct drm_display_mode *mode) - { - /* -diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 121aa8a63a76..d08f86783a28 100644 ---- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -220,7 +220,8 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi) - } - - static enum drm_mode_status --dw_hdmi_rockchip_mode_valid(struct drm_connector *connector, -+dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data, -+ struct drm_connector *connector, - const struct drm_display_mode *mode) - { - const struct dw_hdmi_mpll_config *mpll_cfg = rockchip_mpll_cfg; -diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c -index 972682bb8000..0a3637442ba6 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c -+++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c -@@ -31,7 +31,8 @@ sun8i_dw_hdmi_encoder_helper_funcs = { - }; - - static enum drm_mode_status --sun8i_dw_hdmi_mode_valid_a83t(struct drm_connector *connector, -+sun8i_dw_hdmi_mode_valid_a83t(struct dw_hdmi *hdmi, void *data, -+ struct drm_connector *connector, - const struct drm_display_mode *mode) - { - if (mode->clock > 297000) -@@ -41,7 +42,8 @@ sun8i_dw_hdmi_mode_valid_a83t(struct drm_connector *connector, - } - - static enum drm_mode_status --sun8i_dw_hdmi_mode_valid_h6(struct drm_connector *connector, -+sun8i_dw_hdmi_mode_valid_h6(struct dw_hdmi *hdmi, void *data, -+ struct drm_connector *connector, - const struct drm_display_mode *mode) - { - /* -diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h -index 8e64945167e9..8587b8d2590e 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h -+++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h -@@ -176,7 +176,8 @@ struct sun8i_hdmi_phy { - }; - - struct sun8i_dw_hdmi_quirks { -- enum drm_mode_status (*mode_valid)(struct drm_connector *connector, -+ enum drm_mode_status (*mode_valid)(struct dw_hdmi *hdmi, void *data, -+ struct drm_connector *connector, - const struct drm_display_mode *mode); - unsigned int set_rate : 1; - unsigned int use_drm_infoframe : 1; -diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h -index 0b34a12c4a1c..66a811f75b91 100644 ---- a/include/drm/bridge/dw_hdmi.h -+++ b/include/drm/bridge/dw_hdmi.h -@@ -124,13 +124,23 @@ struct dw_hdmi_phy_ops { - - struct dw_hdmi_plat_data { - struct regmap *regm; -- enum drm_mode_status (*mode_valid)(struct drm_connector *connector, -- const struct drm_display_mode *mode); -+ - unsigned long input_bus_format; - unsigned long input_bus_encoding; - bool use_drm_infoframe; - bool ycbcr_420_allowed; - -+ /* -+ * Private data passed to all the .mode_valid() and .configure_phy() -+ * callback functions. -+ */ -+ void *priv_data; -+ -+ /* Platform-specific mode validation (optional). */ -+ enum drm_mode_status (*mode_valid)(struct dw_hdmi *hdmi, void *data, -+ struct drm_connector *connector, -+ const struct drm_display_mode *mode); -+ - /* Vendor PHY support */ - const struct dw_hdmi_phy_ops *phy_ops; - const char *phy_name; - -From b524c7a4d04ca3c726d30ca5e07097198ecb4e61 Mon Sep 17 00:00:00 2001 -From: Laurent Pinchart -Date: Tue, 26 May 2020 04:14:50 +0300 -Subject: [PATCH] drm: bridge: dw-hdmi: Pass private data pointer to - .configure_phy() - -The .configure_phy() operation takes a dw_hdmi_plat_data pointer as a -context argument. This differs from .mode_valid() that takes a custom -private context pointer, causing possible confusion. Make the -dw_hdmi_plat_data operations more consistent by passing the private -context pointer to .configure_phy() as well. - -Signed-off-by: Laurent Pinchart -Reviewed-by: Neil Armstrong -Signed-off-by: Sam Ravnborg -Link: https://patchwork.freedesktop.org/patch/msgid/20200526011505.31884-13-laurent.pinchart+renesas@ideasonboard.com -(cherry picked from commit 49da7e5d84e3b520355c0b6148d6dc9e5415a13e) ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +- - drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c | 3 +-- - include/drm/bridge/dw_hdmi.h | 3 +-- - 3 files changed, 3 insertions(+), 5 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 2b3f203cf467..6edb60e6c784 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -1514,7 +1514,7 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi) - - /* Write to the PHY as configured by the platform */ - if (pdata->configure_phy) -- ret = pdata->configure_phy(hdmi, pdata, mpixelclock); -+ ret = pdata->configure_phy(hdmi, pdata->priv_data, mpixelclock); - else - ret = phy->configure(hdmi, pdata, mpixelclock); - if (ret) { -diff --git a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c -index 4d837a4d302d..d0dffe55a7cb 100644 ---- a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c -+++ b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c -@@ -52,8 +52,7 @@ rcar_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, - return MODE_OK; - } - --static int rcar_hdmi_phy_configure(struct dw_hdmi *hdmi, -- const struct dw_hdmi_plat_data *pdata, -+static int rcar_hdmi_phy_configure(struct dw_hdmi *hdmi, void *data, - unsigned long mpixelclock) - { - const struct rcar_hdmi_phy_params *params = rcar_hdmi_phy_params; -diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h -index 66a811f75b91..09348c9cbd11 100644 ---- a/include/drm/bridge/dw_hdmi.h -+++ b/include/drm/bridge/dw_hdmi.h -@@ -151,8 +151,7 @@ struct dw_hdmi_plat_data { - const struct dw_hdmi_mpll_config *mpll_cfg; - const struct dw_hdmi_curr_ctrl *cur_ctr; - const struct dw_hdmi_phy_config *phy_config; -- int (*configure_phy)(struct dw_hdmi *hdmi, -- const struct dw_hdmi_plat_data *pdata, -+ int (*configure_phy)(struct dw_hdmi *hdmi, void *data, - unsigned long mpixelclock); - }; - - -From 2753b63f782d0c6cb05859164c9f6acc899b5460 Mon Sep 17 00:00:00 2001 -From: Laurent Pinchart -Date: Tue, 26 May 2020 04:14:51 +0300 -Subject: [PATCH] drm: bridge: dw-hdmi: Remove unused field from - dw_hdmi_plat_data - -The input_bus_format field of struct dw_hdmi_plat_data is unused. Remove -it. - -Signed-off-by: Laurent Pinchart -Reviewed-by: Neil Armstrong -Signed-off-by: Sam Ravnborg -Link: https://patchwork.freedesktop.org/patch/msgid/20200526011505.31884-14-laurent.pinchart+renesas@ideasonboard.com -(cherry picked from commit 29fc89719d396e81176974ce37e0cc81e23869d8) ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 5 +---- - include/drm/bridge/dw_hdmi.h | 1 - - 2 files changed, 1 insertion(+), 5 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 6edb60e6c784..adc5a95a06e9 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -2137,10 +2137,7 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) - hdmi->hdmi_data.video_mode.mpixelrepetitionoutput = 0; - hdmi->hdmi_data.video_mode.mpixelrepetitioninput = 0; - -- if (hdmi->plat_data->input_bus_format) -- hdmi->hdmi_data.enc_in_bus_format = -- hdmi->plat_data->input_bus_format; -- else if (hdmi->hdmi_data.enc_in_bus_format == MEDIA_BUS_FMT_FIXED) -+ if (hdmi->hdmi_data.enc_in_bus_format == MEDIA_BUS_FMT_FIXED) - hdmi->hdmi_data.enc_in_bus_format = MEDIA_BUS_FMT_RGB888_1X24; - - /* TOFIX: Get input encoding from plat data or fallback to none */ -diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h -index 09348c9cbd11..5dfa9d83e2d3 100644 ---- a/include/drm/bridge/dw_hdmi.h -+++ b/include/drm/bridge/dw_hdmi.h -@@ -125,7 +125,6 @@ struct dw_hdmi_phy_ops { - struct dw_hdmi_plat_data { - struct regmap *regm; - -- unsigned long input_bus_format; - unsigned long input_bus_encoding; - bool use_drm_infoframe; - bool ycbcr_420_allowed; - -From 48a24bad613caf460cb8f3e003de57f864228dca Mon Sep 17 00:00:00 2001 -From: Laurent Pinchart -Date: Tue, 26 May 2020 04:14:52 +0300 -Subject: [PATCH] drm: meson: dw-hdmi: Use dw_hdmi context to replace hack - -The meson-dw-hdmi driver needs to access its own context from the -.mode_valid() operation. It currently gets it from the dev_private field -of the drm_device retrieved from the connector, which is a hack. Use the -private data passed to the .mode_valid() operation instead. - -Signed-off-by: Laurent Pinchart -Reviewed-by: Neil Armstrong -Signed-off-by: Sam Ravnborg -Link: https://patchwork.freedesktop.org/patch/msgid/20200526011505.31884-15-laurent.pinchart+renesas@ideasonboard.com -(cherry picked from commit 9bc78d6dc818701e47c5ebd0879877a512f039f0) ---- - drivers/gpu/drm/meson/meson_dw_hdmi.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c -index fc594213c0e0..607bd9f495b1 100644 ---- a/drivers/gpu/drm/meson/meson_dw_hdmi.c -+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c -@@ -634,7 +634,8 @@ dw_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, - struct drm_connector *connector, - const struct drm_display_mode *mode) - { -- struct meson_drm *priv = connector->dev->dev_private; -+ struct meson_dw_hdmi *dw_hdmi = data; -+ struct meson_drm *priv = dw_hdmi->priv; - bool is_hdmi2_sink = connector->display_info.hdmi.scdc.supported; - unsigned int phy_freq; - unsigned int vclk_freq; -@@ -693,7 +694,7 @@ dw_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, - if (mode->flags & DRM_MODE_FLAG_DBLCLK) - venc_freq /= 2; - -- dev_dbg(connector->dev->dev, "%s: vclk:%d phy=%d venc=%d hdmi=%d\n", -+ dev_dbg(dw_hdmi->dev, "%s: vclk:%d phy=%d venc=%d hdmi=%d\n", - __func__, phy_freq, vclk_freq, venc_freq, hdmi_freq); - - return meson_vclk_vic_supported_freq(priv, phy_freq, vclk_freq); -@@ -1066,6 +1067,7 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, - - /* Bridge / Connector */ - -+ dw_plat_data->priv_data = meson_dw_hdmi; - dw_plat_data->mode_valid = dw_hdmi_mode_valid; - dw_plat_data->phy_ops = &meson_dw_hdmi_phy_ops; - dw_plat_data->phy_name = "meson_dw_hdmi_phy"; - -From 53a5e36d164de29774055ae009cef6898350f624 Mon Sep 17 00:00:00 2001 -From: Laurent Pinchart -Date: Tue, 26 May 2020 04:14:53 +0300 -Subject: [PATCH] drm: bridge: dw-hdmi: Pass drm_display_info to .mode_valid() - -Replace the drm_connector pointer passed to the .mode_valid() function -with a const drm_display_info pointer, as that's all the function should -need. Use the display info passed to the bridge .mode_valid() operation -instead of retrieving it from the connector, to prepare for make -connector creation optional. - -Signed-off-by: Laurent Pinchart -Reviewed-by: Neil Armstrong -Signed-off-by: Sam Ravnborg -Link: https://patchwork.freedesktop.org/patch/msgid/20200526011505.31884-16-laurent.pinchart+renesas@ideasonboard.com -(cherry picked from commit af05bba0fbe2c07fe500f697080d78d050be2fbf) ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 5 ++--- - drivers/gpu/drm/imx/dw_hdmi-imx.c | 4 ++-- - drivers/gpu/drm/meson/meson_dw_hdmi.c | 20 ++++++++++---------- - drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c | 2 +- - drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 2 +- - drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 4 ++-- - drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 2 +- - include/drm/bridge/dw_hdmi.h | 4 ++-- - 8 files changed, 21 insertions(+), 22 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index adc5a95a06e9..23650e69604c 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -2769,7 +2769,6 @@ dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge, - { - struct dw_hdmi *hdmi = bridge->driver_private; - const struct dw_hdmi_plat_data *pdata = hdmi->plat_data; -- struct drm_connector *connector = &hdmi->connector; - enum drm_mode_status mode_status = MODE_OK; - - /* We don't support double-clocked modes */ -@@ -2777,8 +2776,8 @@ dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge, - return MODE_BAD; - - if (pdata->mode_valid) -- mode_status = pdata->mode_valid(hdmi, pdata->priv_data, -- connector, mode); -+ mode_status = pdata->mode_valid(hdmi, pdata->priv_data, info, -+ mode); - - return mode_status; - } -diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c b/drivers/gpu/drm/imx/dw_hdmi-imx.c -index 95aed4666c95..2dc93fa6ecb6 100644 ---- a/drivers/gpu/drm/imx/dw_hdmi-imx.c -+++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c -@@ -146,7 +146,7 @@ static const struct drm_encoder_helper_funcs dw_hdmi_imx_encoder_helper_funcs = - - static enum drm_mode_status - imx6q_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, -- struct drm_connector *con, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - if (mode->clock < 13500) -@@ -160,7 +160,7 @@ imx6q_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, - - static enum drm_mode_status - imx6dl_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, -- struct drm_connector *con, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - if (mode->clock < 13500) -diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c -index 607bd9f495b1..50b950f5ca3c 100644 ---- a/drivers/gpu/drm/meson/meson_dw_hdmi.c -+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c -@@ -631,12 +631,12 @@ static irqreturn_t dw_hdmi_top_thread_irq(int irq, void *dev_id) - - static enum drm_mode_status - dw_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, -- struct drm_connector *connector, -+ const struct drm_display_info *display_info, - const struct drm_display_mode *mode) - { - struct meson_dw_hdmi *dw_hdmi = data; - struct meson_drm *priv = dw_hdmi->priv; -- bool is_hdmi2_sink = connector->display_info.hdmi.scdc.supported; -+ bool is_hdmi2_sink = display_info->hdmi.scdc.supported; - unsigned int phy_freq; - unsigned int vclk_freq; - unsigned int venc_freq; -@@ -647,10 +647,10 @@ dw_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, - DRM_DEBUG_DRIVER("Modeline " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode)); - - /* If sink does not support 540MHz, reject the non-420 HDMI2 modes */ -- if (connector->display_info.max_tmds_clock && -- mode->clock > connector->display_info.max_tmds_clock && -- !drm_mode_is_420_only(&connector->display_info, mode) && -- !drm_mode_is_420_also(&connector->display_info, mode)) -+ if (display_info->max_tmds_clock && -+ mode->clock > display_info->max_tmds_clock && -+ !drm_mode_is_420_only(display_info, mode) && -+ !drm_mode_is_420_also(display_info, mode)) - return MODE_BAD; - - /* Check against non-VIC supported modes */ -@@ -667,9 +667,9 @@ dw_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, - vclk_freq = mode->clock; - - /* For 420, pixel clock is half unlike venc clock */ -- if (drm_mode_is_420_only(&connector->display_info, mode) || -+ if (drm_mode_is_420_only(display_info, mode) || - (!is_hdmi2_sink && -- drm_mode_is_420_also(&connector->display_info, mode))) -+ drm_mode_is_420_also(display_info, mode))) - vclk_freq /= 2; - - /* TMDS clock is pixel_clock * 10 */ -@@ -684,9 +684,9 @@ dw_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, - - /* VENC double pixels for 1080i, 720p and YUV420 modes */ - if (meson_venc_hdmi_venc_repeat(vic) || -- drm_mode_is_420_only(&connector->display_info, mode) || -+ drm_mode_is_420_only(display_info, mode) || - (!is_hdmi2_sink && -- drm_mode_is_420_also(&connector->display_info, mode))) -+ drm_mode_is_420_also(display_info, mode))) - venc_freq *= 2; - - vclk_freq = max(venc_freq, hdmi_freq); -diff --git a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c -index d0dffe55a7cb..7b8ec8310699 100644 ---- a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c -+++ b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c -@@ -39,7 +39,7 @@ static const struct rcar_hdmi_phy_params rcar_hdmi_phy_params[] = { - - static enum drm_mode_status - rcar_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, -- struct drm_connector *connector, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - /* -diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index d08f86783a28..d286751bb333 100644 ---- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -221,7 +221,7 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi) - - static enum drm_mode_status - dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data, -- struct drm_connector *connector, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - const struct dw_hdmi_mpll_config *mpll_cfg = rockchip_mpll_cfg; -diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c -index 0a3637442ba6..d4c08043dd81 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c -+++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c -@@ -32,7 +32,7 @@ sun8i_dw_hdmi_encoder_helper_funcs = { - - static enum drm_mode_status - sun8i_dw_hdmi_mode_valid_a83t(struct dw_hdmi *hdmi, void *data, -- struct drm_connector *connector, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - if (mode->clock > 297000) -@@ -43,7 +43,7 @@ sun8i_dw_hdmi_mode_valid_a83t(struct dw_hdmi *hdmi, void *data, - - static enum drm_mode_status - sun8i_dw_hdmi_mode_valid_h6(struct dw_hdmi *hdmi, void *data, -- struct drm_connector *connector, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode) - { - /* -diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h -index 8587b8d2590e..d983746fa194 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h -+++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h -@@ -177,7 +177,7 @@ struct sun8i_hdmi_phy { - - struct sun8i_dw_hdmi_quirks { - enum drm_mode_status (*mode_valid)(struct dw_hdmi *hdmi, void *data, -- struct drm_connector *connector, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode); - unsigned int set_rate : 1; - unsigned int use_drm_infoframe : 1; -diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h -index 5dfa9d83e2d3..fec293b21c2e 100644 ---- a/include/drm/bridge/dw_hdmi.h -+++ b/include/drm/bridge/dw_hdmi.h -@@ -8,7 +8,7 @@ - - #include - --struct drm_connector; -+struct drm_display_info; - struct drm_display_mode; - struct drm_encoder; - struct dw_hdmi; -@@ -137,7 +137,7 @@ struct dw_hdmi_plat_data { - - /* Platform-specific mode validation (optional). */ - enum drm_mode_status (*mode_valid)(struct dw_hdmi *hdmi, void *data, -- struct drm_connector *connector, -+ const struct drm_display_info *info, - const struct drm_display_mode *mode); - - /* Vendor PHY support */ - -From 99ac754367be84fb5c1507dbc09a970a07f17deb Mon Sep 17 00:00:00 2001 -From: Laurent Pinchart -Date: Tue, 26 May 2020 04:14:54 +0300 -Subject: [PATCH] drm: bridge: dw-hdmi: Constify mode argument to - dw_hdmi_phy_ops .init() - -The PHY .init() must not modify the mode it receives. Make the pointer -const to enfore that. - -Signed-off-by: Laurent Pinchart -Reviewed-by: Neil Armstrong -Signed-off-by: Sam Ravnborg -Link: https://patchwork.freedesktop.org/patch/msgid/20200526011505.31884-17-laurent.pinchart+renesas@ideasonboard.com -(cherry picked from commit 35a395f1134bbbd2984dcca28c04f09fbbb8b0a4) ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +- - drivers/gpu/drm/meson/meson_dw_hdmi.c | 4 ++-- - drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 2 +- - drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 2 +- - include/drm/bridge/dw_hdmi.h | 2 +- - 5 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 23650e69604c..6e6a3d95e68e 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -1531,7 +1531,7 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi) - } - - static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data, -- struct drm_display_mode *mode) -+ const struct drm_display_mode *mode) - { - int i, ret; - -diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c -index 50b950f5ca3c..a1217df5fe5a 100644 ---- a/drivers/gpu/drm/meson/meson_dw_hdmi.c -+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c -@@ -297,7 +297,7 @@ static inline void dw_hdmi_dwc_write_bits(struct meson_dw_hdmi *dw_hdmi, - - /* Setup PHY bandwidth modes */ - static void meson_hdmi_phy_setup_mode(struct meson_dw_hdmi *dw_hdmi, -- struct drm_display_mode *mode) -+ const struct drm_display_mode *mode) - { - struct meson_drm *priv = dw_hdmi->priv; - unsigned int pixel_clock = mode->clock; -@@ -427,7 +427,7 @@ static void dw_hdmi_set_vclk(struct meson_dw_hdmi *dw_hdmi, - } - - static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data, -- struct drm_display_mode *mode) -+ const struct drm_display_mode *mode) - { - struct meson_dw_hdmi *dw_hdmi = (struct meson_dw_hdmi *)data; - struct meson_drm *priv = dw_hdmi->priv; -diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index d286751bb333..10e210f6455d 100644 ---- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -312,7 +312,7 @@ static const struct drm_encoder_helper_funcs dw_hdmi_rockchip_encoder_helper_fun - }; - - static int dw_hdmi_rockchip_genphy_init(struct dw_hdmi *dw_hdmi, void *data, -- struct drm_display_mode *mode) -+ const struct drm_display_mode *mode) - { - struct rockchip_hdmi *hdmi = (struct rockchip_hdmi *)data; - -diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c -index 43643ad31730..8e078cacf063 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c -+++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c -@@ -341,7 +341,7 @@ static int sun8i_hdmi_phy_config_h3(struct dw_hdmi *hdmi, - } - - static int sun8i_hdmi_phy_config(struct dw_hdmi *hdmi, void *data, -- struct drm_display_mode *mode) -+ const struct drm_display_mode *mode) - { - struct sun8i_hdmi_phy *phy = (struct sun8i_hdmi_phy *)data; - u32 val = 0; -diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h -index fec293b21c2e..f930d218cc6b 100644 ---- a/include/drm/bridge/dw_hdmi.h -+++ b/include/drm/bridge/dw_hdmi.h -@@ -114,7 +114,7 @@ struct dw_hdmi_phy_config { - - struct dw_hdmi_phy_ops { - int (*init)(struct dw_hdmi *hdmi, void *data, -- struct drm_display_mode *mode); -+ const struct drm_display_mode *mode); - void (*disable)(struct dw_hdmi *hdmi, void *data); - enum drm_connector_status (*read_hpd)(struct dw_hdmi *hdmi, void *data); - void (*update_hpd)(struct dw_hdmi *hdmi, void *data, - -From 3f32c1651003657315d10e10ba3f82f814bf679c Mon Sep 17 00:00:00 2001 -From: Laurent Pinchart -Date: Tue, 26 May 2020 04:14:55 +0300 -Subject: [PATCH] drm: bridge: dw-hdmi: Constify mode argument to internal - functions - -Several internal functions take a drm_display_mode argument to configure -the HDMI encoder or the HDMI PHY. They must not modify the mode, make -the pointer const to enforce that. - -Signed-off-by: Laurent Pinchart -Reviewed-by: Neil Armstrong -Signed-off-by: Sam Ravnborg -Link: https://patchwork.freedesktop.org/patch/msgid/20200526011505.31884-18-laurent.pinchart+renesas@ideasonboard.com -(cherry picked from commit 9fbfa320b435e6f25499a63f7bb74b4fc5341b30) ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 6e6a3d95e68e..5b5f07a23400 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -1628,7 +1628,8 @@ static void hdmi_tx_hdcp_config(struct dw_hdmi *hdmi) - HDMI_A_HDCPCFG1_ENCRYPTIONDISABLE_MASK, HDMI_A_HDCPCFG1); - } - --static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode) -+static void hdmi_config_AVI(struct dw_hdmi *hdmi, -+ const struct drm_display_mode *mode) - { - struct hdmi_avi_infoframe frame; - u8 val; -@@ -1756,7 +1757,7 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode) - } - - static void hdmi_config_vendor_specific_infoframe(struct dw_hdmi *hdmi, -- struct drm_display_mode *mode) -+ const struct drm_display_mode *mode) - { - struct hdmi_vendor_infoframe frame; - u8 buffer[10]; -@@ -2112,7 +2113,8 @@ static void hdmi_disable_overflow_interrupts(struct dw_hdmi *hdmi) - HDMI_IH_MUTE_FC_STAT2); - } - --static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) -+static int dw_hdmi_setup(struct dw_hdmi *hdmi, -+ const struct drm_display_mode *mode) - { - int ret; - - -From 96db500c40d28a630906600cd98b1886298a68e3 Mon Sep 17 00:00:00 2001 -From: Laurent Pinchart -Date: Tue, 26 May 2020 04:14:56 +0300 -Subject: [PATCH] drm: bridge: dw-hdmi: Pass drm_display_info to - dw_hdmi_support_scdc() - -To prepare for making connector creation optional in the driver, pass -the drm_display_info explicitly to dw_hdmi_support_scdc(). The pointer -is passed to the callers where required, particularly to the -dw_hdmi_phy_ops .init() function. - -Signed-off-by: Laurent Pinchart -Reviewed-by: Neil Armstrong -Signed-off-by: Sam Ravnborg -Link: https://patchwork.freedesktop.org/patch/msgid/20200526011505.31884-19-laurent.pinchart+renesas@ideasonboard.com -(cherry picked from commit 7be390d4c0a125266c558c30a3687d931c3b6101) ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 32 +++++++++++++++++------------ - drivers/gpu/drm/meson/meson_dw_hdmi.c | 3 ++- - drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 1 + - drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 1 + - include/drm/bridge/dw_hdmi.h | 4 +++- - 5 files changed, 26 insertions(+), 15 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 5b5f07a23400..a18794cce0d8 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -1241,10 +1241,9 @@ void dw_hdmi_phy_i2c_write(struct dw_hdmi *hdmi, unsigned short data, - EXPORT_SYMBOL_GPL(dw_hdmi_phy_i2c_write); - - /* Filter out invalid setups to avoid configuring SCDC and scrambling */ --static bool dw_hdmi_support_scdc(struct dw_hdmi *hdmi) -+static bool dw_hdmi_support_scdc(struct dw_hdmi *hdmi, -+ const struct drm_display_info *display) - { -- struct drm_display_info *display = &hdmi->connector.display_info; -- - /* Completely disable SCDC support for older controllers */ - if (hdmi->version < 0x200a) - return false; -@@ -1282,12 +1281,13 @@ static bool dw_hdmi_support_scdc(struct dw_hdmi *hdmi) - * helper should called right before enabling the TMDS Clock and Data in - * the PHY configuration callback. - */ --void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi) -+void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi, -+ const struct drm_display_info *display) - { - unsigned long mtmdsclock = hdmi->hdmi_data.video_mode.mtmdsclock; - - /* Control for TMDS Bit Period/TMDS Clock-Period Ratio */ -- if (dw_hdmi_support_scdc(hdmi)) { -+ if (dw_hdmi_support_scdc(hdmi, display)) { - if (mtmdsclock > HDMI14_MAX_TMDSCLK) - drm_scdc_set_high_tmds_clock_ratio(hdmi->ddc, 1); - else -@@ -1490,7 +1490,8 @@ static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi, - return 0; - } - --static int hdmi_phy_configure(struct dw_hdmi *hdmi) -+static int hdmi_phy_configure(struct dw_hdmi *hdmi, -+ const struct drm_display_info *display) - { - const struct dw_hdmi_phy_data *phy = hdmi->phy.data; - const struct dw_hdmi_plat_data *pdata = hdmi->plat_data; -@@ -1500,7 +1501,7 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi) - - dw_hdmi_phy_power_off(hdmi); - -- dw_hdmi_set_high_tmds_clock_ratio(hdmi); -+ dw_hdmi_set_high_tmds_clock_ratio(hdmi, display); - - /* Leave low power consumption mode by asserting SVSRET. */ - if (phy->has_svsret) -@@ -1531,6 +1532,7 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi) - } - - static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data, -+ const struct drm_display_info *display, - const struct drm_display_mode *mode) - { - int i, ret; -@@ -1540,7 +1542,7 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data, - dw_hdmi_phy_sel_data_en_pol(hdmi, 1); - dw_hdmi_phy_sel_interface_control(hdmi, 0); - -- ret = hdmi_phy_configure(hdmi); -+ ret = hdmi_phy_configure(hdmi, display); - if (ret) - return ret; - } -@@ -1846,10 +1848,11 @@ static void hdmi_config_drm_infoframe(struct dw_hdmi *hdmi) - } - - static void hdmi_av_composer(struct dw_hdmi *hdmi, -+ const struct drm_display_info *display, - const struct drm_display_mode *mode) - { - u8 inv_val, bytes; -- struct drm_hdmi_info *hdmi_info = &hdmi->connector.display_info.hdmi; -+ const struct drm_hdmi_info *hdmi_info = &display->hdmi; - struct hdmi_vmode *vmode = &hdmi->hdmi_data.video_mode; - int hblank, vblank, h_de_hs, v_de_vs, hsync_len, vsync_len; - unsigned int vdisplay, hdisplay; -@@ -1882,7 +1885,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, - - /* Set up HDMI_FC_INVIDCONF */ - inv_val = (hdmi->hdmi_data.hdcp_enable || -- (dw_hdmi_support_scdc(hdmi) && -+ (dw_hdmi_support_scdc(hdmi, display) && - (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK || - hdmi_info->scdc.scrambling.low_rates)) ? - HDMI_FC_INVIDCONF_HDCP_KEEPOUT_ACTIVE : -@@ -1950,7 +1953,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, - } - - /* Scrambling Control */ -- if (dw_hdmi_support_scdc(hdmi)) { -+ if (dw_hdmi_support_scdc(hdmi, display)) { - if (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK || - hdmi_info->scdc.scrambling.low_rates) { - /* -@@ -2116,6 +2119,7 @@ static void hdmi_disable_overflow_interrupts(struct dw_hdmi *hdmi) - static int dw_hdmi_setup(struct dw_hdmi *hdmi, - const struct drm_display_mode *mode) - { -+ struct drm_connector *connector = &hdmi->connector; - int ret; - - hdmi_disable_overflow_interrupts(hdmi); -@@ -2161,10 +2165,12 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, - hdmi->hdmi_data.video_mode.mdataenablepolarity = true; - - /* HDMI Initialization Step B.1 */ -- hdmi_av_composer(hdmi, mode); -+ hdmi_av_composer(hdmi, &connector->display_info, mode); - - /* HDMI Initializateion Step B.2 */ -- ret = hdmi->phy.ops->init(hdmi, hdmi->phy.data, &hdmi->previous_mode); -+ ret = hdmi->phy.ops->init(hdmi, hdmi->phy.data, -+ &connector->display_info, -+ &hdmi->previous_mode); - if (ret) - return ret; - hdmi->phy.enabled = true; -diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c -index a1217df5fe5a..29a8ff41595d 100644 ---- a/drivers/gpu/drm/meson/meson_dw_hdmi.c -+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c -@@ -427,6 +427,7 @@ static void dw_hdmi_set_vclk(struct meson_dw_hdmi *dw_hdmi, - } - - static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data, -+ const struct drm_display_info *display, - const struct drm_display_mode *mode) - { - struct meson_dw_hdmi *dw_hdmi = (struct meson_dw_hdmi *)data; -@@ -496,7 +497,7 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data, - /* Disable clock, fifo, fifo_wr */ - regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, 0xf, 0); - -- dw_hdmi_set_high_tmds_clock_ratio(hdmi); -+ dw_hdmi_set_high_tmds_clock_ratio(hdmi, display); - - msleep(100); - -diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 10e210f6455d..23de359a1dec 100644 ---- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -312,6 +312,7 @@ static const struct drm_encoder_helper_funcs dw_hdmi_rockchip_encoder_helper_fun - }; - - static int dw_hdmi_rockchip_genphy_init(struct dw_hdmi *dw_hdmi, void *data, -+ const struct drm_display_info *display, - const struct drm_display_mode *mode) - { - struct rockchip_hdmi *hdmi = (struct rockchip_hdmi *)data; -diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c -index 8e078cacf063..156d00e5165b 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c -+++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c -@@ -341,6 +341,7 @@ static int sun8i_hdmi_phy_config_h3(struct dw_hdmi *hdmi, - } - - static int sun8i_hdmi_phy_config(struct dw_hdmi *hdmi, void *data, -+ const struct drm_display_info *display, - const struct drm_display_mode *mode) - { - struct sun8i_hdmi_phy *phy = (struct sun8i_hdmi_phy *)data; -diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h -index f930d218cc6b..ea34ca146b82 100644 ---- a/include/drm/bridge/dw_hdmi.h -+++ b/include/drm/bridge/dw_hdmi.h -@@ -114,6 +114,7 @@ struct dw_hdmi_phy_config { - - struct dw_hdmi_phy_ops { - int (*init)(struct dw_hdmi *hdmi, void *data, -+ const struct drm_display_info *display, - const struct drm_display_mode *mode); - void (*disable)(struct dw_hdmi *hdmi, void *data); - enum drm_connector_status (*read_hpd)(struct dw_hdmi *hdmi, void *data); -@@ -174,7 +175,8 @@ void dw_hdmi_set_channel_status(struct dw_hdmi *hdmi, u8 *channel_status); - void dw_hdmi_set_channel_allocation(struct dw_hdmi *hdmi, unsigned int ca); - void dw_hdmi_audio_enable(struct dw_hdmi *hdmi); - void dw_hdmi_audio_disable(struct dw_hdmi *hdmi); --void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi); -+void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi, -+ const struct drm_display_info *display); - - /* PHY configuration */ - void dw_hdmi_phy_i2c_set_addr(struct dw_hdmi *hdmi, u8 address); - -From 5d3cddd3c75ab9c4dbe6b9cc6e2fbb85ed2c3f80 Mon Sep 17 00:00:00 2001 -From: Laurent Pinchart -Date: Tue, 26 May 2020 04:14:57 +0300 -Subject: [PATCH] drm: bridge: dw-hdmi: Split connector creation to a separate - function - -Isolate all the code related to connector creation to a new -dw_hdmi_connector_create() function, to prepare for making connector -creation optional. - -Signed-off-by: Laurent Pinchart -Reviewed-by: Neil Armstrong -Signed-off-by: Sam Ravnborg -Link: https://patchwork.freedesktop.org/patch/msgid/20200526011505.31884-20-laurent.pinchart+renesas@ideasonboard.com -(cherry picked from commit 3f588fda4b80dbd7dafa08b0e16fd72a42676e3c) ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 107 +++++++++++++++++------------- - 1 file changed, 62 insertions(+), 45 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index a18794cce0d8..35d38b644912 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -2317,6 +2317,10 @@ static void dw_hdmi_update_phy_mask(struct dw_hdmi *hdmi) - hdmi->rxsense); - } - -+/* ----------------------------------------------------------------------------- -+ * DRM Connector Operations -+ */ -+ - static enum drm_connector_status - dw_hdmi_connector_detect(struct drm_connector *connector, bool force) - { -@@ -2438,6 +2442,59 @@ static const struct drm_connector_helper_funcs dw_hdmi_connector_helper_funcs = - .atomic_check = dw_hdmi_connector_atomic_check, - }; - -+static int dw_hdmi_connector_create(struct dw_hdmi *hdmi) -+{ -+ struct drm_connector *connector = &hdmi->connector; -+ struct cec_connector_info conn_info; -+ struct cec_notifier *notifier; -+ -+ if (hdmi->version >= 0x200a) -+ connector->ycbcr_420_allowed = -+ hdmi->plat_data->ycbcr_420_allowed; -+ else -+ connector->ycbcr_420_allowed = false; -+ -+ connector->interlace_allowed = 1; -+ connector->polled = DRM_CONNECTOR_POLL_HPD; -+ -+ drm_connector_helper_add(connector, &dw_hdmi_connector_helper_funcs); -+ -+ drm_connector_init_with_ddc(hdmi->bridge.dev, connector, -+ &dw_hdmi_connector_funcs, -+ DRM_MODE_CONNECTOR_HDMIA, -+ hdmi->ddc); -+ -+ /* -+ * drm_connector_attach_max_bpc_property() requires the -+ * connector to have a state. -+ */ -+ drm_atomic_helper_connector_reset(connector); -+ -+ drm_connector_attach_max_bpc_property(connector, 8, 16); -+ -+ if (hdmi->version >= 0x200a && hdmi->plat_data->use_drm_infoframe) -+ drm_object_attach_property(&connector->base, -+ connector->dev->mode_config.hdr_output_metadata_property, 0); -+ -+ drm_connector_attach_encoder(connector, hdmi->bridge.encoder); -+ -+ cec_fill_conn_info_from_drm(&conn_info, connector); -+ -+ notifier = cec_notifier_conn_register(hdmi->dev, NULL, &conn_info); -+ if (!notifier) -+ return -ENOMEM; -+ -+ mutex_lock(&hdmi->cec_notifier_mutex); -+ hdmi->cec_notifier = notifier; -+ mutex_unlock(&hdmi->cec_notifier_mutex); -+ -+ return 0; -+} -+ -+/* ----------------------------------------------------------------------------- -+ * DRM Bridge Operations -+ */ -+ - /* - * Possible output formats : - * - MEDIA_BUS_FMT_UYYVYY16_0_5X48, -@@ -2713,51 +2770,13 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *bridge, - enum drm_bridge_attach_flags flags) - { - struct dw_hdmi *hdmi = bridge->driver_private; -- struct drm_encoder *encoder = bridge->encoder; -- struct drm_connector *connector = &hdmi->connector; -- struct cec_connector_info conn_info; -- struct cec_notifier *notifier; - - if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) { - DRM_ERROR("Fix bridge driver to make connector optional!"); - return -EINVAL; - } - -- connector->interlace_allowed = 1; -- connector->polled = DRM_CONNECTOR_POLL_HPD; -- -- drm_connector_helper_add(connector, &dw_hdmi_connector_helper_funcs); -- -- drm_connector_init_with_ddc(bridge->dev, connector, -- &dw_hdmi_connector_funcs, -- DRM_MODE_CONNECTOR_HDMIA, -- hdmi->ddc); -- -- /* -- * drm_connector_attach_max_bpc_property() requires the -- * connector to have a state. -- */ -- drm_atomic_helper_connector_reset(connector); -- -- drm_connector_attach_max_bpc_property(connector, 8, 16); -- -- if (hdmi->version >= 0x200a && hdmi->plat_data->use_drm_infoframe) -- drm_object_attach_property(&connector->base, -- connector->dev->mode_config.hdr_output_metadata_property, 0); -- -- drm_connector_attach_encoder(connector, encoder); -- -- cec_fill_conn_info_from_drm(&conn_info, connector); -- -- notifier = cec_notifier_conn_register(hdmi->dev, NULL, &conn_info); -- if (!notifier) -- return -ENOMEM; -- -- mutex_lock(&hdmi->cec_notifier_mutex); -- hdmi->cec_notifier = notifier; -- mutex_unlock(&hdmi->cec_notifier_mutex); -- -- return 0; -+ return dw_hdmi_connector_create(hdmi); - } - - static void dw_hdmi_bridge_detach(struct drm_bridge *bridge) -@@ -2841,6 +2860,10 @@ static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = { - .mode_valid = dw_hdmi_bridge_mode_valid, - }; - -+/* ----------------------------------------------------------------------------- -+ * IRQ Handling -+ */ -+ - static irqreturn_t dw_hdmi_i2c_irq(struct dw_hdmi *hdmi) - { - struct dw_hdmi_i2c *i2c = hdmi->i2c; -@@ -3303,12 +3326,6 @@ __dw_hdmi_probe(struct platform_device *pdev, - hdmi->bridge.of_node = pdev->dev.of_node; - #endif - -- if (hdmi->version >= 0x200a) -- hdmi->connector.ycbcr_420_allowed = -- hdmi->plat_data->ycbcr_420_allowed; -- else -- hdmi->connector.ycbcr_420_allowed = false; -- - memset(&pdevinfo, 0, sizeof(pdevinfo)); - pdevinfo.parent = dev; - pdevinfo.id = PLATFORM_DEVID_AUTO; - -From 74b0a99dc5f17e451603a2a71ca1fd6f9a572975 Mon Sep 17 00:00:00 2001 -From: Laurent Pinchart -Date: Tue, 26 May 2020 04:14:58 +0300 -Subject: [PATCH] drm: bridge: dw-hdmi: Store current connector in struct - dw_hdmi - -Store the connector that the bridge is currently wired to in the dw_hdmi -structure. This is currently identical to the connector field, but will -differ once the driver supports disabling connector creation. - -Signed-off-by: Laurent Pinchart -Reviewed-by: Neil Armstrong -Signed-off-by: Sam Ravnborg -Link: https://patchwork.freedesktop.org/patch/msgid/20200526011505.31884-21-laurent.pinchart+renesas@ideasonboard.com -(cherry picked from commit ca7b6b7176ffea4d07afbd98ede7a94fb0f68fa1) ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 18 ++++++++++++++---- - 1 file changed, 14 insertions(+), 4 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 35d38b644912..16bffedb4715 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -181,6 +181,7 @@ struct dw_hdmi { - - struct mutex mutex; /* for state below and previous_mode */ - enum drm_connector_force force; /* mutex-protected force state */ -+ struct drm_connector *curr_conn;/* current connector (only valid when !disabled) */ - bool disabled; /* DRM has disabled our bridge */ - bool bridge_is_on; /* indicates the bridge is on */ - bool rxsense; /* rxsense state */ -@@ -2823,23 +2824,32 @@ static void dw_hdmi_bridge_mode_set(struct drm_bridge *bridge, - mutex_unlock(&hdmi->mutex); - } - --static void dw_hdmi_bridge_disable(struct drm_bridge *bridge) -+static void dw_hdmi_bridge_atomic_disable(struct drm_bridge *bridge, -+ struct drm_bridge_state *old_state) - { - struct dw_hdmi *hdmi = bridge->driver_private; - - mutex_lock(&hdmi->mutex); - hdmi->disabled = true; -+ hdmi->curr_conn = NULL; - dw_hdmi_update_power(hdmi); - dw_hdmi_update_phy_mask(hdmi); - mutex_unlock(&hdmi->mutex); - } - --static void dw_hdmi_bridge_enable(struct drm_bridge *bridge) -+static void dw_hdmi_bridge_atomic_enable(struct drm_bridge *bridge, -+ struct drm_bridge_state *old_state) - { - struct dw_hdmi *hdmi = bridge->driver_private; -+ struct drm_atomic_state *state = old_state->base.state; -+ struct drm_connector *connector; -+ -+ connector = drm_atomic_get_new_connector_for_encoder(state, -+ bridge->encoder); - - mutex_lock(&hdmi->mutex); - hdmi->disabled = false; -+ hdmi->curr_conn = connector; - dw_hdmi_update_power(hdmi); - dw_hdmi_update_phy_mask(hdmi); - mutex_unlock(&hdmi->mutex); -@@ -2854,8 +2864,8 @@ static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = { - .atomic_check = dw_hdmi_bridge_atomic_check, - .atomic_get_output_bus_fmts = dw_hdmi_bridge_atomic_get_output_bus_fmts, - .atomic_get_input_bus_fmts = dw_hdmi_bridge_atomic_get_input_bus_fmts, -- .enable = dw_hdmi_bridge_enable, -- .disable = dw_hdmi_bridge_disable, -+ .atomic_enable = dw_hdmi_bridge_atomic_enable, -+ .atomic_disable = dw_hdmi_bridge_atomic_disable, - .mode_set = dw_hdmi_bridge_mode_set, - .mode_valid = dw_hdmi_bridge_mode_valid, - }; - -From e70331acdac9e7cdc58b61bfc95461eba889d0d4 Mon Sep 17 00:00:00 2001 -From: Laurent Pinchart -Date: Tue, 26 May 2020 04:14:59 +0300 -Subject: [PATCH] drm: bridge: dw-hdmi: Pass drm_connector to internal - functions as needed - -To prepare for making connector creation optional in the driver, pass -the drm_connector explicitly to the internal functions that require it. -The functions that still access the connector from the dw_hdmi structure -are dw_hdmi_connector_create() and __dw_hdmi_probe(). The former access -is expected, as that's where the internal connector is created. The -latter will be addressed separately. - -Signed-off-by: Laurent Pinchart -Reviewed-by: Neil Armstrong -Signed-off-by: Sam Ravnborg -Link: https://patchwork.freedesktop.org/patch/msgid/20200526011505.31884-22-laurent.pinchart+renesas@ideasonboard.com -(cherry picked from commit 81980037fb275d9db1bbb0239682d707e8dd62a0) ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 31 ++++++++++++++++++------------- - 1 file changed, 18 insertions(+), 13 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 16bffedb4715..b69c14b9de62 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -1632,18 +1632,17 @@ static void hdmi_tx_hdcp_config(struct dw_hdmi *hdmi) - } - - static void hdmi_config_AVI(struct dw_hdmi *hdmi, -+ const struct drm_connector *connector, - const struct drm_display_mode *mode) - { - struct hdmi_avi_infoframe frame; - u8 val; - - /* Initialise info frame from DRM mode */ -- drm_hdmi_avi_infoframe_from_display_mode(&frame, -- &hdmi->connector, mode); -+ drm_hdmi_avi_infoframe_from_display_mode(&frame, connector, mode); - - if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format)) { -- drm_hdmi_avi_infoframe_quant_range(&frame, &hdmi->connector, -- mode, -+ drm_hdmi_avi_infoframe_quant_range(&frame, connector, mode, - hdmi->hdmi_data.rgb_limited_range ? - HDMI_QUANTIZATION_RANGE_LIMITED : - HDMI_QUANTIZATION_RANGE_FULL); -@@ -1760,14 +1759,14 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, - } - - static void hdmi_config_vendor_specific_infoframe(struct dw_hdmi *hdmi, -+ const struct drm_connector *connector, - const struct drm_display_mode *mode) - { - struct hdmi_vendor_infoframe frame; - u8 buffer[10]; - ssize_t err; - -- err = drm_hdmi_vendor_infoframe_from_display_mode(&frame, -- &hdmi->connector, -+ err = drm_hdmi_vendor_infoframe_from_display_mode(&frame, connector, - mode); - if (err < 0) - /* -@@ -1813,9 +1812,10 @@ static void hdmi_config_vendor_specific_infoframe(struct dw_hdmi *hdmi, - HDMI_FC_DATAUTO0_VSD_MASK); - } - --static void hdmi_config_drm_infoframe(struct dw_hdmi *hdmi) -+static void hdmi_config_drm_infoframe(struct dw_hdmi *hdmi, -+ const struct drm_connector *connector) - { -- const struct drm_connector_state *conn_state = hdmi->connector.state; -+ const struct drm_connector_state *conn_state = connector->state; - struct hdmi_drm_infoframe frame; - u8 buffer[30]; - ssize_t err; -@@ -2118,9 +2118,9 @@ static void hdmi_disable_overflow_interrupts(struct dw_hdmi *hdmi) - } - - static int dw_hdmi_setup(struct dw_hdmi *hdmi, -+ const struct drm_connector *connector, - const struct drm_display_mode *mode) - { -- struct drm_connector *connector = &hdmi->connector; - int ret; - - hdmi_disable_overflow_interrupts(hdmi); -@@ -2192,9 +2192,9 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, - dev_dbg(hdmi->dev, "%s HDMI mode\n", __func__); - - /* HDMI Initialization Step F - Configure AVI InfoFrame */ -- hdmi_config_AVI(hdmi, mode); -- hdmi_config_vendor_specific_infoframe(hdmi, mode); -- hdmi_config_drm_infoframe(hdmi); -+ hdmi_config_AVI(hdmi, connector, mode); -+ hdmi_config_vendor_specific_infoframe(hdmi, connector, mode); -+ hdmi_config_drm_infoframe(hdmi, connector); - } else { - dev_dbg(hdmi->dev, "%s DVI mode\n", __func__); - } -@@ -2263,7 +2263,12 @@ static void initialize_hdmi_ih_mutes(struct dw_hdmi *hdmi) - static void dw_hdmi_poweron(struct dw_hdmi *hdmi) - { - hdmi->bridge_is_on = true; -- dw_hdmi_setup(hdmi, &hdmi->previous_mode); -+ -+ /* -+ * The curr_conn field is guaranteed to be valid here, as this function -+ * is only be called when !hdmi->disabled. -+ */ -+ dw_hdmi_setup(hdmi, hdmi->curr_conn, &hdmi->previous_mode); - } - - static void dw_hdmi_poweroff(struct dw_hdmi *hdmi) - -From 9a877974d7d9247d44baf689d8ba1043b7888161 Mon Sep 17 00:00:00 2001 -From: Laurent Pinchart -Date: Tue, 26 May 2020 04:15:00 +0300 -Subject: [PATCH] drm: bridge: dw-hdmi: Make connector creation optional - -Implement the drm_bridge_funcs .detect() and .get_edid() operations, and -call drm_bridge_hpd_notify() notify to report HPD. This provides the -necessary API to support disabling connector creation, do so by -accepting DRM_BRIDGE_ATTACH_NO_CONNECTOR in dw_hdmi_bridge_attach(). - -Signed-off-by: Laurent Pinchart -Reviewed-by: Neil Armstrong -Signed-off-by: Sam Ravnborg -Link: https://patchwork.freedesktop.org/patch/msgid/20200526011505.31884-23-laurent.pinchart+renesas@ideasonboard.com -(cherry picked from commit ec971aaa6775cff555b4f58777ceab1d9a8370e0) ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 104 +++++++++++++++++++++--------- - 1 file changed, 74 insertions(+), 30 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index b69c14b9de62..6148a022569a 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -2323,15 +2323,8 @@ static void dw_hdmi_update_phy_mask(struct dw_hdmi *hdmi) - hdmi->rxsense); - } - --/* ----------------------------------------------------------------------------- -- * DRM Connector Operations -- */ -- --static enum drm_connector_status --dw_hdmi_connector_detect(struct drm_connector *connector, bool force) -+static enum drm_connector_status dw_hdmi_detect(struct dw_hdmi *hdmi) - { -- struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, -- connector); - enum drm_connector_status result; - - mutex_lock(&hdmi->mutex); -@@ -2354,31 +2347,57 @@ dw_hdmi_connector_detect(struct drm_connector *connector, bool force) - return result; - } - --static int dw_hdmi_connector_get_modes(struct drm_connector *connector) -+static struct edid *dw_hdmi_get_edid(struct dw_hdmi *hdmi, -+ struct drm_connector *connector) - { -- struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, -- connector); - struct edid *edid; -- int ret = 0; - - if (!hdmi->ddc) -- return 0; -+ return NULL; - - edid = drm_get_edid(connector, hdmi->ddc); -- if (edid) { -- dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n", -- edid->width_cm, edid->height_cm); -- -- hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid); -- hdmi->sink_has_audio = drm_detect_monitor_audio(edid); -- drm_connector_update_edid_property(connector, edid); -- cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid); -- ret = drm_add_edid_modes(connector, edid); -- kfree(edid); -- } else { -+ if (!edid) { - dev_dbg(hdmi->dev, "failed to get edid\n"); -+ return NULL; - } - -+ dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n", -+ edid->width_cm, edid->height_cm); -+ -+ hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid); -+ hdmi->sink_has_audio = drm_detect_monitor_audio(edid); -+ -+ return edid; -+} -+ -+/* ----------------------------------------------------------------------------- -+ * DRM Connector Operations -+ */ -+ -+static enum drm_connector_status -+dw_hdmi_connector_detect(struct drm_connector *connector, bool force) -+{ -+ struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, -+ connector); -+ return dw_hdmi_detect(hdmi); -+} -+ -+static int dw_hdmi_connector_get_modes(struct drm_connector *connector) -+{ -+ struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, -+ connector); -+ struct edid *edid; -+ int ret; -+ -+ edid = dw_hdmi_get_edid(hdmi, connector); -+ if (!edid) -+ return 0; -+ -+ drm_connector_update_edid_property(connector, edid); -+ cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid); -+ ret = drm_add_edid_modes(connector, edid); -+ kfree(edid); -+ - return ret; - } - -@@ -2777,10 +2796,8 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *bridge, - { - struct dw_hdmi *hdmi = bridge->driver_private; - -- if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) { -- DRM_ERROR("Fix bridge driver to make connector optional!"); -- return -EINVAL; -- } -+ if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) -+ return 0; - - return dw_hdmi_connector_create(hdmi); - } -@@ -2860,6 +2877,21 @@ static void dw_hdmi_bridge_atomic_enable(struct drm_bridge *bridge, - mutex_unlock(&hdmi->mutex); - } - -+static enum drm_connector_status dw_hdmi_bridge_detect(struct drm_bridge *bridge) -+{ -+ struct dw_hdmi *hdmi = bridge->driver_private; -+ -+ return dw_hdmi_detect(hdmi); -+} -+ -+static struct edid *dw_hdmi_bridge_get_edid(struct drm_bridge *bridge, -+ struct drm_connector *connector) -+{ -+ struct dw_hdmi *hdmi = bridge->driver_private; -+ -+ return dw_hdmi_get_edid(hdmi, connector); -+} -+ - static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = { - .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, -@@ -2873,6 +2905,8 @@ static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = { - .atomic_disable = dw_hdmi_bridge_atomic_disable, - .mode_set = dw_hdmi_bridge_mode_set, - .mode_valid = dw_hdmi_bridge_mode_valid, -+ .detect = dw_hdmi_bridge_detect, -+ .get_edid = dw_hdmi_bridge_get_edid, - }; - - /* ----------------------------------------------------------------------------- -@@ -2988,10 +3022,18 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) - } - - if (intr_stat & HDMI_IH_PHY_STAT0_HPD) { -+ enum drm_connector_status status = phy_int_pol & HDMI_PHY_HPD -+ ? connector_status_connected -+ : connector_status_disconnected; -+ - dev_dbg(hdmi->dev, "EVENT=%s\n", -- phy_int_pol & HDMI_PHY_HPD ? "plugin" : "plugout"); -- if (hdmi->bridge.dev) -+ status == connector_status_connected ? -+ "plugin" : "plugout"); -+ -+ if (hdmi->bridge.dev) { - drm_helper_hpd_irq_event(hdmi->bridge.dev); -+ drm_bridge_hpd_notify(&hdmi->bridge, status); -+ } - } - - hdmi_writeb(hdmi, intr_stat, HDMI_IH_PHY_STAT0); -@@ -3337,6 +3379,8 @@ __dw_hdmi_probe(struct platform_device *pdev, - - hdmi->bridge.driver_private = hdmi; - hdmi->bridge.funcs = &dw_hdmi_bridge_funcs; -+ hdmi->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID -+ | DRM_BRIDGE_OP_HPD; - #ifdef CONFIG_OF - hdmi->bridge.of_node = pdev->dev.of_node; - #endif - -From 7ba7f0aef832e3153014cb7148a0a4cc6a6beb12 Mon Sep 17 00:00:00 2001 -From: Stanislav Lisovskiy -Date: Tue, 30 Jun 2020 05:56:58 +0530 -Subject: [PATCH] drm: Add helper to compare edids. - -Many drivers would benefit from using -drm helper to compare edid, rather -than bothering with own implementation. - -v2: Added documentation for this function. - -Signed-off-by: Stanislav Lisovskiy -Signed-off-by: Maarten Lankhorst -Link: https://patchwork.freedesktop.org/patch/msgid/20200630002700.5451-2-kunal1.joshi@intel.com -(cherry picked from commit 536faa450e17f32fddb1a2124e3df71a966122cd) ---- - drivers/gpu/drm/drm_edid.c | 33 +++++++++++++++++++++++++++++++++ - include/drm/drm_edid.h | 9 +++++++++ - 2 files changed, 42 insertions(+) - -diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c -index b3f659759adb..aa0644d8272a 100644 ---- a/drivers/gpu/drm/drm_edid.c -+++ b/drivers/gpu/drm/drm_edid.c -@@ -1615,6 +1615,39 @@ static bool drm_edid_is_zero(const u8 *in_edid, int length) - return true; - } - -+/** -+ * drm_edid_are_equal - compare two edid blobs. -+ * @edid1: pointer to first blob -+ * @edid2: pointer to second blob -+ * This helper can be used during probing to determine if -+ * edid had changed. -+ */ -+bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2) -+{ -+ int edid1_len, edid2_len; -+ bool edid1_present = edid1 != NULL; -+ bool edid2_present = edid2 != NULL; -+ -+ if (edid1_present != edid2_present) -+ return false; -+ -+ if (edid1) { -+ -+ edid1_len = EDID_LENGTH * (1 + edid1->extensions); -+ edid2_len = EDID_LENGTH * (1 + edid2->extensions); -+ -+ if (edid1_len != edid2_len) -+ return false; -+ -+ if (memcmp(edid1, edid2, edid1_len)) -+ return false; -+ } -+ -+ return true; -+} -+EXPORT_SYMBOL(drm_edid_are_equal); -+ -+ - /** - * drm_edid_block_valid - Sanity check the EDID block (base or extension) - * @raw_edid: pointer to raw EDID block -diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h -index 43254319ab19..cfa4f5af49af 100644 ---- a/include/drm/drm_edid.h -+++ b/include/drm/drm_edid.h -@@ -359,6 +359,15 @@ drm_load_edid_firmware(struct drm_connector *connector) - } - #endif - -+/** -+ * drm_edid_are_equal - compare two edid blobs. -+ * @edid1: pointer to first blob -+ * @edid2: pointer to second blob -+ * This helper can be used during probing to determine if -+ * edid had changed. -+ */ -+bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2); -+ - int - drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, - const struct drm_connector *connector, - -From 8085a1cfd296f70e4d4c197023880fc51c6c14d9 Mon Sep 17 00:00:00 2001 -From: Stanislav Lisovskiy -Date: Tue, 30 Jun 2020 05:56:59 +0530 -Subject: [PATCH] drm: Introduce epoch counter to drm_connector - -This counter will be used by drm_helper_probe_detect caller to determine -if anything had changed(including edid, connection status and etc). -Hardware specific driver detect hooks are responsible for updating this -counter when some change is detected to notify the drm part, -which can trigger for example hotplug event. - -Also now call drm_connector_update_edid_property -right after we get edid always to make sure there is a -unified way to handle edid change, without having to -change tons of source code as currently -drm_connector_update_edid_property is called only in -certain cases like reprobing and not right after edid is -actually updated. - -v2: Added documentation for the new counter. Rename change_counter to - epoch_counter. - -Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105540 - -Signed-off-by: Stanislav Lisovskiy -Signed-off-by: Maarten Lankhorst -Link: https://patchwork.freedesktop.org/patch/msgid/20200630002700.5451-3-kunal1.joshi@intel.com -(cherry picked from commit 5186421cbfe250002308d4d759674214b385752f) ---- - drivers/gpu/drm/drm_connector.c | 16 ++++++++++++++++ - drivers/gpu/drm/drm_edid.c | 8 +++++--- - drivers/gpu/drm/drm_probe_helper.c | 38 +++++++++++++++++++++++++++++++++----- - include/drm/drm_connector.h | 2 ++ - 4 files changed, 56 insertions(+), 8 deletions(-) - -diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c -index d877ddc6dc57..c6d7fc45aeac 100644 ---- a/drivers/gpu/drm/drm_connector.c -+++ b/drivers/gpu/drm/drm_connector.c -@@ -269,6 +269,7 @@ int drm_connector_init(struct drm_device *dev, - INIT_LIST_HEAD(&connector->modes); - mutex_init(&connector->mutex); - connector->edid_blob_ptr = NULL; -+ connector->epoch_counter = 0; - connector->tile_blob_ptr = NULL; - connector->status = connector_status_unknown; - connector->display_info.panel_orientation = -@@ -1954,6 +1955,7 @@ int drm_connector_update_edid_property(struct drm_connector *connector, - struct drm_device *dev = connector->dev; - size_t size = 0; - int ret; -+ const struct edid *old_edid; - - /* ignore requests to set edid when overridden */ - if (connector->override_edid) -@@ -1977,6 +1979,20 @@ int drm_connector_update_edid_property(struct drm_connector *connector, - - drm_update_tile_info(connector, edid); - -+ if (connector->edid_blob_ptr) { -+ old_edid = (const struct edid *)connector->edid_blob_ptr->data; -+ if (old_edid) { -+ if (!drm_edid_are_equal(edid, old_edid)) { -+ DRM_DEBUG_KMS("[CONNECTOR:%d:%s] Edid was changed.\n", -+ connector->base.id, connector->name); -+ -+ connector->epoch_counter += 1; -+ DRM_DEBUG_KMS("Updating change counter to %llu\n", -+ connector->epoch_counter); -+ } -+ } -+ } -+ - drm_object_property_set_value(&connector->base, - dev->mode_config.non_desktop_property, - connector->display_info.non_desktop); -diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c -index aa0644d8272a..ddb9a093ad0d 100644 ---- a/drivers/gpu/drm/drm_edid.c -+++ b/drivers/gpu/drm/drm_edid.c -@@ -1632,7 +1632,6 @@ bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2) - return false; - - if (edid1) { -- - edid1_len = EDID_LENGTH * (1 + edid1->extensions); - edid2_len = EDID_LENGTH * (1 + edid2->extensions); - -@@ -1647,7 +1646,6 @@ bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2) - } - EXPORT_SYMBOL(drm_edid_are_equal); - -- - /** - * drm_edid_block_valid - Sanity check the EDID block (base or extension) - * @raw_edid: pointer to raw EDID block -@@ -2050,13 +2048,17 @@ EXPORT_SYMBOL(drm_probe_ddc); - struct edid *drm_get_edid(struct drm_connector *connector, - struct i2c_adapter *adapter) - { -+ struct edid *edid; -+ - if (connector->force == DRM_FORCE_OFF) - return NULL; - - if (connector->force == DRM_FORCE_UNSPECIFIED && !drm_probe_ddc(adapter)) - return NULL; - -- return drm_do_get_edid(connector, drm_do_probe_ddc_edid, adapter); -+ edid = drm_do_get_edid(connector, drm_do_probe_ddc_edid, adapter); -+ drm_connector_update_edid_property(connector, edid); -+ return edid; - } - EXPORT_SYMBOL(drm_get_edid); - -diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c -index f5d141e0400f..6d3a1dbfcba5 100644 ---- a/drivers/gpu/drm/drm_probe_helper.c -+++ b/drivers/gpu/drm/drm_probe_helper.c -@@ -290,6 +290,9 @@ drm_helper_probe_detect_ctx(struct drm_connector *connector, bool force) - if (WARN_ON(ret < 0)) - ret = connector_status_unknown; - -+ if (ret != connector->status) -+ connector->epoch_counter += 1; -+ - drm_modeset_drop_locks(&ctx); - drm_modeset_acquire_fini(&ctx); - -@@ -323,11 +326,16 @@ drm_helper_probe_detect(struct drm_connector *connector, - return ret; - - if (funcs->detect_ctx) -- return funcs->detect_ctx(connector, ctx, force); -+ ret = funcs->detect_ctx(connector, ctx, force); - else if (connector->funcs->detect) -- return connector->funcs->detect(connector, force); -+ ret = connector->funcs->detect(connector, force); - else -- return connector_status_connected; -+ ret = connector_status_connected; -+ -+ if (ret != connector->status) -+ connector->epoch_counter += 1; -+ -+ return ret; - } - EXPORT_SYMBOL(drm_helper_probe_detect); - -@@ -780,6 +788,7 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev) - struct drm_connector_list_iter conn_iter; - enum drm_connector_status old_status; - bool changed = false; -+ u64 old_epoch_counter; - - if (!dev->mode_config.poll_enabled) - return false; -@@ -793,20 +802,39 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev) - - old_status = connector->status; - -+ old_epoch_counter = connector->epoch_counter; -+ -+ DRM_DEBUG_KMS("[CONNECTOR:%d:%s] Old epoch counter %llu\n", connector->base.id, -+ connector->name, -+ old_epoch_counter); -+ - connector->status = drm_helper_probe_detect(connector, NULL, false); - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n", - connector->base.id, - connector->name, - drm_get_connector_status_name(old_status), - drm_get_connector_status_name(connector->status)); -- if (old_status != connector->status) -+ -+ DRM_DEBUG_KMS("[CONNECTOR:%d:%s] New epoch counter %llu\n", -+ connector->base.id, -+ connector->name, -+ connector->epoch_counter); -+ -+ /* -+ * Check if epoch counter had changed, meaning that we need -+ * to send a uevent. -+ */ -+ if (old_epoch_counter != connector->epoch_counter) - changed = true; -+ - } - drm_connector_list_iter_end(&conn_iter); - mutex_unlock(&dev->mode_config.mutex); - -- if (changed) -+ if (changed) { - drm_kms_helper_hotplug_event(dev); -+ DRM_DEBUG_KMS("Sent hotplug event\n"); -+ } - - return changed; - } -diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h -index fd543d1db9b2..6a451b86c454 100644 ---- a/include/drm/drm_connector.h -+++ b/include/drm/drm_connector.h -@@ -1329,6 +1329,8 @@ struct drm_connector { - enum drm_connector_force force; - /** @override_edid: has the EDID been overwritten through debugfs for testing? */ - bool override_edid; -+ /** @epoch_counter: used to detect any other changes in connector, besides status */ -+ u64 epoch_counter; - - /** - * @possible_encoders: Bit mask of encoders that can drive this - -From 046e4a5427e133a04a50a794e69030f1bf18b046 Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Fri, 3 Jul 2020 10:07:23 +0200 -Subject: [PATCH] drm/fourcc: Add modifier definitions for describing Amlogic - Video Framebuffer Compression - -Amlogic uses a proprietary lossless image compression protocol and format -for their hardware video codec accelerators, either video decoders or -video input encoders. - -It considerably reduces memory bandwidth while writing and reading -frames in memory. - -The underlying storage is considered to be 3 components, 8bit or 10-bit -per component, YCbCr 420, single plane : -- DRM_FORMAT_YUV420_8BIT -- DRM_FORMAT_YUV420_10BIT - -This modifier will be notably added to DMA-BUF frames imported from the V4L2 -Amlogic VDEC decoder. - -This introduces the basic layout composed of: -- a body content organized in 64x32 superblocks with 4096 bytes per - superblock in default mode. -- a 32 bytes per 128x64 header block - -This layout is tranferrable between Amlogic SoCs supporting this modifier. - -The Memory Saving option exist changing the layout superblock size to save memory when -using 8bit components pixels size. - -Finally is also adds the Scatter Memory layout, meaning the header contains IOMMU -references to the compressed frames content to optimize memory access -and layout. - -In this mode, only the header memory address is needed, thus the content -memory organization is tied to the current producer execution and cannot -be saved/dumped neither transferrable between Amlogic SoCs supporting this -modifier. - -Signed-off-by: Neil Armstrong -Tested-by: Kevin Hilman -Reviewed-by: Kevin Hilman -Acked-by: Daniel Vetter -Link: https://patchwork.freedesktop.org/patch/msgid/20200703080728.25207-2-narmstrong@baylibre.com -(cherry picked from commit d6528ec883096e7ccdb08257bcc45670bc878519) ---- - include/uapi/drm/drm_fourcc.h | 81 +++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 81 insertions(+) - -diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h -index 993c1b342315..cbf92fdf2712 100644 ---- a/include/uapi/drm/drm_fourcc.h -+++ b/include/uapi/drm/drm_fourcc.h -@@ -331,6 +331,7 @@ extern "C" { - #define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07 - #define DRM_FORMAT_MOD_VENDOR_ARM 0x08 - #define DRM_FORMAT_MOD_VENDOR_ALLWINNER 0x09 -+#define DRM_FORMAT_MOD_VENDOR_AMLOGIC 0x0a - - /* add more to the end as needed */ - -@@ -950,6 +951,86 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier) - */ - #define DRM_FORMAT_MOD_ALLWINNER_TILED fourcc_mod_code(ALLWINNER, 1) - -+/* -+ * Amlogic Video Framebuffer Compression modifiers -+ * -+ * Amlogic uses a proprietary lossless image compression protocol and format -+ * for their hardware video codec accelerators, either video decoders or -+ * video input encoders. -+ * -+ * It considerably reduces memory bandwidth while writing and reading -+ * frames in memory. -+ * -+ * The underlying storage is considered to be 3 components, 8bit or 10-bit -+ * per component YCbCr 420, single plane : -+ * - DRM_FORMAT_YUV420_8BIT -+ * - DRM_FORMAT_YUV420_10BIT -+ * -+ * The first 8 bits of the mode defines the layout, then the following 8 bits -+ * defines the options changing the layout. -+ * -+ * Not all combinations are valid, and different SoCs may support different -+ * combinations of layout and options. -+ */ -+#define __fourcc_mod_amlogic_layout_mask 0xf -+#define __fourcc_mod_amlogic_options_shift 8 -+#define __fourcc_mod_amlogic_options_mask 0xf -+ -+#define DRM_FORMAT_MOD_AMLOGIC_FBC(__layout, __options) \ -+ fourcc_mod_code(AMLOGIC, \ -+ ((__layout) & __fourcc_mod_amlogic_layout_mask) | \ -+ ((__options) & __fourcc_mod_amlogic_options_mask \ -+ << __fourcc_mod_amlogic_options_shift)) -+ -+/* Amlogic FBC Layouts */ -+ -+/* -+ * Amlogic FBC Basic Layout -+ * -+ * The basic layout is composed of: -+ * - a body content organized in 64x32 superblocks with 4096 bytes per -+ * superblock in default mode. -+ * - a 32 bytes per 128x64 header block -+ * -+ * This layout is transferrable between Amlogic SoCs supporting this modifier. -+ */ -+#define AMLOGIC_FBC_LAYOUT_BASIC (1ULL) -+ -+/* -+ * Amlogic FBC Scatter Memory layout -+ * -+ * Indicates the header contains IOMMU references to the compressed -+ * frames content to optimize memory access and layout. -+ * -+ * In this mode, only the header memory address is needed, thus the -+ * content memory organization is tied to the current producer -+ * execution and cannot be saved/dumped neither transferrable between -+ * Amlogic SoCs supporting this modifier. -+ * -+ * Due to the nature of the layout, these buffers are not expected to -+ * be accessible by the user-space clients, but only accessible by the -+ * hardware producers and consumers. -+ * -+ * The user-space clients should expect a failure while trying to mmap -+ * the DMA-BUF handle returned by the producer. -+ */ -+#define AMLOGIC_FBC_LAYOUT_SCATTER (2ULL) -+ -+/* Amlogic FBC Layout Options Bit Mask */ -+ -+/* -+ * Amlogic FBC Memory Saving mode -+ * -+ * Indicates the storage is packed when pixel size is multiple of word -+ * boudaries, i.e. 8bit should be stored in this mode to save allocation -+ * memory. -+ * -+ * This mode reduces body layout to 3072 bytes per 64x32 superblock with -+ * the basic layout and 3200 bytes per 64x32 superblock combined with -+ * the scatter layout. -+ */ -+#define AMLOGIC_FBC_OPTION_MEM_SAVING (1ULL << 0) -+ - #if defined(__cplusplus) - } - #endif - -From a6e5b6b5a07615cbe478e278554e47d1ddf0fa77 Mon Sep 17 00:00:00 2001 -From: Brian Starkey -Date: Fri, 26 Jun 2020 17:48:00 +0100 -Subject: [PATCH] drm: drm_fourcc: Add generic alias for 16_16_TILE modifier - -In cases such as DRM_FORMAT_MOD_SAMSUNG_16_16_TILE, the modifier -describes a generic pixel re-ordering which can be applicable to -multiple vendors. - -Define an alias: DRM_FORMAT_MOD_GENERIC_16_16_TILE, which can be -used to describe this layout in a vendor-neutral way, and add a -comment about the expected usage of such "generic" modifiers. - -Changes in v2: - - Move note about future cases to comment (Daniel) - -Signed-off-by: Brian Starkey -Reviewed-by: Daniel Vetter -Signed-off-by: Liviu Dudau -Link: https://patchwork.freedesktop.org/patch/msgid/20200626164800.11595-1-brian.starkey@arm.com -(cherry picked from commit 9ac2b63791ef63935c71e2a7f5444a1118c4d084) ---- - include/uapi/drm/drm_fourcc.h | 25 +++++++++++++++++++++++++ - 1 file changed, 25 insertions(+) - -diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h -index cbf92fdf2712..4bee7de5f306 100644 ---- a/include/uapi/drm/drm_fourcc.h -+++ b/include/uapi/drm/drm_fourcc.h -@@ -346,8 +346,33 @@ extern "C" { - * When adding a new token please document the layout with a code comment, - * similar to the fourcc codes above. drm_fourcc.h is considered the - * authoritative source for all of these. -+ * -+ * Generic modifier names: -+ * -+ * DRM_FORMAT_MOD_GENERIC_* definitions are used to provide vendor-neutral names -+ * for layouts which are common across multiple vendors. To preserve -+ * compatibility, in cases where a vendor-specific definition already exists and -+ * a generic name for it is desired, the common name is a purely symbolic alias -+ * and must use the same numerical value as the original definition. -+ * -+ * Note that generic names should only be used for modifiers which describe -+ * generic layouts (such as pixel re-ordering), which may have -+ * independently-developed support across multiple vendors. -+ * -+ * In future cases where a generic layout is identified before merging with a -+ * vendor-specific modifier, a new 'GENERIC' vendor or modifier using vendor -+ * 'NONE' could be considered. This should only be for obvious, exceptional -+ * cases to avoid polluting the 'GENERIC' namespace with modifiers which only -+ * apply to a single vendor. -+ * -+ * Generic names should not be used for cases where multiple hardware vendors -+ * have implementations of the same standardised compression scheme (such as -+ * AFBC). In those cases, all implementations should use the same format -+ * modifier(s), reflecting the vendor of the standard. - */ - -+#define DRM_FORMAT_MOD_GENERIC_16_16_TILE DRM_FORMAT_MOD_SAMSUNG_16_16_TILE -+ - /* - * Invalid Modifier - * - -From ffef9e6d93cea1613e62d2e73c9e9ebcf78d23ad Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= -Date: Wed, 27 May 2020 16:03:08 +0300 -Subject: [PATCH] drm/edid: Allow looking for ext blocks starting from a - specified index -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Apparently EDIDs with multiple DispID ext blocks is a thing, so prepare -for iterating through multiple ext blocks of the same type by -passing the starting ext block index to drm_find_edid_extension(). Well -also have drm_find_edid_extension() update the index to point to the -next ext block on success. Thus we should be able to call -drm_find_edid_extension() in loop. - -Signed-off-by: Ville Syrjälä -Link: https://patchwork.freedesktop.org/patch/msgid/20200527130310.27099-1-ville.syrjala@linux.intel.com -Reviewed-by: José Roberto de Souza -(cherry picked from commit 8873cfa384055d0348c03161420b1e9b6c1dc5d0) ---- - drivers/gpu/drm/drm_edid.c | 30 +++++++++++++++++++++--------- - 1 file changed, 21 insertions(+), 9 deletions(-) - -diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c -index ddb9a093ad0d..06cb75b9fc44 100644 ---- a/drivers/gpu/drm/drm_edid.c -+++ b/drivers/gpu/drm/drm_edid.c -@@ -3226,7 +3226,8 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid, - /* - * Search EDID for CEA extension block. - */ --static u8 *drm_find_edid_extension(const struct edid *edid, int ext_id) -+static u8 *drm_find_edid_extension(const struct edid *edid, -+ int ext_id, int *ext_index) - { - u8 *edid_ext = NULL; - int i; -@@ -3236,23 +3237,26 @@ static u8 *drm_find_edid_extension(const struct edid *edid, int ext_id) - return NULL; - - /* Find CEA extension */ -- for (i = 0; i < edid->extensions; i++) { -+ for (i = *ext_index; i < edid->extensions; i++) { - edid_ext = (u8 *)edid + EDID_LENGTH * (i + 1); - if (edid_ext[0] == ext_id) - break; - } - -- if (i == edid->extensions) -+ if (i >= edid->extensions) - return NULL; - -+ *ext_index = i + 1; -+ - return edid_ext; - } - - - static u8 *drm_find_displayid_extension(const struct edid *edid, -- int *length, int *idx) -+ int *length, int *idx, -+ int *ext_index) - { -- u8 *displayid = drm_find_edid_extension(edid, DISPLAYID_EXT); -+ u8 *displayid = drm_find_edid_extension(edid, DISPLAYID_EXT, ext_index); - struct displayid_hdr *base; - int ret; - -@@ -3279,14 +3283,18 @@ static u8 *drm_find_cea_extension(const struct edid *edid) - struct displayid_block *block; - u8 *cea; - u8 *displayid; -+ int ext_index; - - /* Look for a top level CEA extension block */ -- cea = drm_find_edid_extension(edid, CEA_EXT); -+ ext_index = 0; -+ cea = drm_find_edid_extension(edid, CEA_EXT, &ext_index); - if (cea) - return cea; - - /* CEA blocks can also be found embedded in a DisplayID block */ -- displayid = drm_find_displayid_extension(edid, &length, &idx); -+ ext_index = 0; -+ displayid = drm_find_displayid_extension(edid, &length, &idx, -+ &ext_index); - if (!displayid) - return NULL; - -@@ -5236,8 +5244,10 @@ static int add_displayid_detailed_modes(struct drm_connector *connector, - int length, idx; - struct displayid_block *block; - int num_modes = 0; -+ int ext_index = 0; - -- displayid = drm_find_displayid_extension(edid, &length, &idx); -+ displayid = drm_find_displayid_extension(edid, &length, &idx, -+ &ext_index); - if (!displayid) - return 0; - -@@ -5911,11 +5921,13 @@ void drm_update_tile_info(struct drm_connector *connector, - const struct edid *edid) - { - const void *displayid = NULL; -+ int ext_index = 0; - int length, idx; - int ret; - - connector->has_tile = false; -- displayid = drm_find_displayid_extension(edid, &length, &idx); -+ displayid = drm_find_displayid_extension(edid, &length, &idx, -+ &ext_index); - if (!displayid) { - /* drop reference to any tile group we had */ - goto out_drop_ref; - -From 7a987517ed8a51a6e4f27194e46ed67def79ce44 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= -Date: Wed, 27 May 2020 16:03:09 +0300 -Subject: [PATCH] drm/edid: Iterate through all DispID ext blocks -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Apparently there are EDIDs in the wild with multiple DispID extension -blocks. Iterate through them all. - -In one particular case the tile information is specicied in the -second DispID ext block, and since the current parser only looks -at the first DispID ext block we don't notice that we're dealing -with a tiled display. - -While at it change a few functions to return void since we have -no use for the errno. - -References: https://gitlab.freedesktop.org/drm/intel/-/issues/27 -Signed-off-by: Ville Syrjälä -Link: https://patchwork.freedesktop.org/patch/msgid/20200527130310.27099-2-ville.syrjala@linux.intel.com -Reviewed-by: José Roberto de Souza -(cherry picked from commit 7f261afdcfae363192e3eef52dd34855cc149c15) ---- - drivers/gpu/drm/drm_edid.c | 84 +++++++++++++++++++++------------------------- - 1 file changed, 38 insertions(+), 46 deletions(-) - -diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c -index 06cb75b9fc44..fcd739af570f 100644 ---- a/drivers/gpu/drm/drm_edid.c -+++ b/drivers/gpu/drm/drm_edid.c -@@ -3286,6 +3286,7 @@ static u8 *drm_find_cea_extension(const struct edid *edid) - int ext_index; - - /* Look for a top level CEA extension block */ -+ /* FIXME: make callers iterate through multiple CEA ext blocks? */ - ext_index = 0; - cea = drm_find_edid_extension(edid, CEA_EXT, &ext_index); - if (cea) -@@ -3293,20 +3294,20 @@ static u8 *drm_find_cea_extension(const struct edid *edid) - - /* CEA blocks can also be found embedded in a DisplayID block */ - ext_index = 0; -- displayid = drm_find_displayid_extension(edid, &length, &idx, -- &ext_index); -- if (!displayid) -- return NULL; -+ for (;;) { -+ displayid = drm_find_displayid_extension(edid, &length, &idx, -+ &ext_index); -+ if (!displayid) -+ return NULL; - -- idx += sizeof(struct displayid_hdr); -- for_each_displayid_db(displayid, block, idx, length) { -- if (block->tag == DATA_BLOCK_CTA) { -- cea = (u8 *)block; -- break; -+ idx += sizeof(struct displayid_hdr); -+ for_each_displayid_db(displayid, block, idx, length) { -+ if (block->tag == DATA_BLOCK_CTA) -+ return (u8 *)block; - } - } - -- return cea; -+ return NULL; - } - - static __always_inline const struct drm_display_mode *cea_mode_for_vic(u8 vic) -@@ -5246,19 +5247,22 @@ static int add_displayid_detailed_modes(struct drm_connector *connector, - int num_modes = 0; - int ext_index = 0; - -- displayid = drm_find_displayid_extension(edid, &length, &idx, -- &ext_index); -- if (!displayid) -- return 0; -- -- idx += sizeof(struct displayid_hdr); -- for_each_displayid_db(displayid, block, idx, length) { -- switch (block->tag) { -- case DATA_BLOCK_TYPE_1_DETAILED_TIMING: -- num_modes += add_displayid_detailed_1_modes(connector, block); -+ for (;;) { -+ displayid = drm_find_displayid_extension(edid, &length, &idx, -+ &ext_index); -+ if (!displayid) - break; -+ -+ idx += sizeof(struct displayid_hdr); -+ for_each_displayid_db(displayid, block, idx, length) { -+ switch (block->tag) { -+ case DATA_BLOCK_TYPE_1_DETAILED_TIMING: -+ num_modes += add_displayid_detailed_1_modes(connector, block); -+ break; -+ } - } - } -+ - return num_modes; - } - -@@ -5838,8 +5842,8 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, - } - EXPORT_SYMBOL(drm_hdmi_vendor_infoframe_from_display_mode); - --static int drm_parse_tiled_block(struct drm_connector *connector, -- const struct displayid_block *block) -+static void drm_parse_tiled_block(struct drm_connector *connector, -+ const struct displayid_block *block) - { - const struct displayid_tiled_block *tile = (struct displayid_tiled_block *)block; - u16 w, h; -@@ -5877,7 +5881,7 @@ static int drm_parse_tiled_block(struct drm_connector *connector, - tg = drm_mode_create_tile_group(connector->dev, tile->topology_id); - } - if (!tg) -- return -ENOMEM; -+ return; - - if (connector->tile_group != tg) { - /* if we haven't got a pointer, -@@ -5889,14 +5893,12 @@ static int drm_parse_tiled_block(struct drm_connector *connector, - } else - /* if same tile group, then release the ref we just took. */ - drm_mode_put_tile_group(connector->dev, tg); -- return 0; - } - --static int drm_displayid_parse_tiled(struct drm_connector *connector, -- const u8 *displayid, int length, int idx) -+static void drm_displayid_parse_tiled(struct drm_connector *connector, -+ const u8 *displayid, int length, int idx) - { - const struct displayid_block *block; -- int ret; - - idx += sizeof(struct displayid_hdr); - for_each_displayid_db(displayid, block, idx, length) { -@@ -5905,16 +5907,13 @@ static int drm_displayid_parse_tiled(struct drm_connector *connector, - - switch (block->tag) { - case DATA_BLOCK_TILED_DISPLAY: -- ret = drm_parse_tiled_block(connector, block); -- if (ret) -- return ret; -+ drm_parse_tiled_block(connector, block); - break; - default: - DRM_DEBUG_KMS("found DisplayID tag 0x%x, unhandled\n", block->tag); - break; - } - } -- return 0; - } - - void drm_update_tile_info(struct drm_connector *connector, -@@ -5923,26 +5922,19 @@ void drm_update_tile_info(struct drm_connector *connector, - const void *displayid = NULL; - int ext_index = 0; - int length, idx; -- int ret; - - connector->has_tile = false; -- displayid = drm_find_displayid_extension(edid, &length, &idx, -- &ext_index); -- if (!displayid) { -- /* drop reference to any tile group we had */ -- goto out_drop_ref; -+ for (;;) { -+ displayid = drm_find_displayid_extension(edid, &length, &idx, -+ &ext_index); -+ if (!displayid) -+ break; -+ -+ drm_displayid_parse_tiled(connector, displayid, length, idx); - } - -- ret = drm_displayid_parse_tiled(connector, displayid, length, idx); -- if (ret < 0) -- goto out_drop_ref; -- if (!connector->has_tile) -- goto out_drop_ref; -- return; --out_drop_ref: -- if (connector->tile_group) { -+ if (!connector->has_tile && connector->tile_group) { - drm_mode_put_tile_group(connector->dev, connector->tile_group); - connector->tile_group = NULL; - } -- return; - } - -From b08694ca37609d75f9d2fe8e4d8c22185cac626b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= -Date: Wed, 27 May 2020 16:03:10 +0300 -Subject: [PATCH] drm/edid: Clean up some curly braces -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Drop some pointless curly braces, and add some across the -else when the if has them too. - -Signed-off-by: Ville Syrjälä -Link: https://patchwork.freedesktop.org/patch/msgid/20200527130310.27099-3-ville.syrjala@linux.intel.com -Reviewed-by: José Roberto de Souza -(cherry picked from commit 392f9fcb159bf95ec3c7de340a880f4778167275) ---- - drivers/gpu/drm/drm_edid.c | 9 ++++----- - 1 file changed, 4 insertions(+), 5 deletions(-) - -diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c -index fcd739af570f..c28e7678014d 100644 ---- a/drivers/gpu/drm/drm_edid.c -+++ b/drivers/gpu/drm/drm_edid.c -@@ -5877,22 +5877,21 @@ static void drm_parse_tiled_block(struct drm_connector *connector, - DRM_DEBUG_KMS("vend %c%c%c\n", tile->topology_id[0], tile->topology_id[1], tile->topology_id[2]); - - tg = drm_mode_get_tile_group(connector->dev, tile->topology_id); -- if (!tg) { -+ if (!tg) - tg = drm_mode_create_tile_group(connector->dev, tile->topology_id); -- } - if (!tg) - return; - - if (connector->tile_group != tg) { - /* if we haven't got a pointer, - take the reference, drop ref to old tile group */ -- if (connector->tile_group) { -+ if (connector->tile_group) - drm_mode_put_tile_group(connector->dev, connector->tile_group); -- } - connector->tile_group = tg; -- } else -+ } else { - /* if same tile group, then release the ref we just took. */ - drm_mode_put_tile_group(connector->dev, tg); -+ } - } - - static void drm_displayid_parse_tiled(struct drm_connector *connector, - -From 7d9ebd53573f7632d64d61410fb905415de3e81d Mon Sep 17 00:00:00 2001 -From: Liu Ying -Date: Thu, 9 Jul 2020 10:02:35 +0800 -Subject: [PATCH] drm/bridge: dw-hdmi: Don't cleanup i2c adapter and ddc ptr in - __dw_hdmi_probe() bailout path - -It's unnecessary to cleanup the i2c adapter and the ddc pointer in -the bailout path of __dw_hdmi_probe(), since the adapter is not -added and the ddc pointer is not set. - -Fixes: a23d6265f033 ("drm: bridge: dw-hdmi: Extract PHY interrupt setup to a function") -Cc: Andrzej Hajda -Cc: Neil Armstrong -Cc: Laurent Pinchart -Cc: Jonas Karlman -Cc: Jernej Skrabec -Cc: David Airlie -Cc: Daniel Vetter -Cc: Boris Brezillon -Cc: Jerome Brunet -Cc: Cheng-Yi Chiang -Cc: Dariusz Marcinkiewicz -Cc: Archit Taneja -Cc: Jose Abreu -Cc: dri-devel@lists.freedesktop.org -Cc: NXP Linux Team -Signed-off-by: Liu Ying -Reviewed-by: Laurent Pinchart -Signed-off-by: Sam Ravnborg -Link: https://patchwork.freedesktop.org/patch/msgid/1594260156-8316-1-git-send-email-victor.liu@nxp.com -(cherry picked from commit 2ae53e79f2dec41949d7b089c0b6d7edce292d10) ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 6148a022569a..137b6ebfed19 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -3441,11 +3441,6 @@ __dw_hdmi_probe(struct platform_device *pdev, - return hdmi; - - err_iahb: -- if (hdmi->i2c) { -- i2c_del_adapter(&hdmi->i2c->adap); -- hdmi->ddc = NULL; -- } -- - clk_disable_unprepare(hdmi->iahb_clk); - if (hdmi->cec_clk) - clk_disable_unprepare(hdmi->cec_clk); - -From 62824ff0d032a45a21b21c95c4f6081c5e646edf Mon Sep 17 00:00:00 2001 -From: Liu Ying -Date: Thu, 9 Jul 2020 10:02:36 +0800 -Subject: [PATCH] drm/bridge: dw-hdmi: Always add the bridge in the global - bridge list - -It doesn't hurt to add the bridge in the global bridge list also for -platform specific dw-hdmi drivers which are based on the component -framework. This can be achieved by moving the drm_bridge_add() function -call from dw_hdmi_probe() to __dw_hdmi_probe(). A counterpart movement -for drm_bridge_remove() is also needed then. Moreover, since drm_bridge_add() -initializes &bridge->hpd_mutex, this may help those platform specific -dw-hdmi drivers(based on the component framework) avoid accessing the -uninitialized mutex in drm_bridge_hpd_notify() which is called in -dw_hdmi_irq(). Putting drm_bridge_add() in __dw_hdmi_probe() just before -it returns successfully should bring no logic change for platforms based -on the DRM bridge API, which is a good choice from safety point of view. -Also, __dw_hdmi_probe() is renamed to dw_hdmi_probe() since dw_hdmi_probe() -does nothing else but calling __dw_hdmi_probe(). Similar renaming applies -to the __dw_hdmi_remove()/dw_hdmi_remove() pair. - -Fixes: ec971aaa6775 ("drm: bridge: dw-hdmi: Make connector creation optional") -Cc: Andrzej Hajda -Cc: Neil Armstrong -Cc: Laurent Pinchart -Cc: Jonas Karlman -Cc: Jernej Skrabec -Cc: David Airlie -Cc: Daniel Vetter -Cc: Boris Brezillon -Cc: Jerome Brunet -Cc: Cheng-Yi Chiang -Cc: Dariusz Marcinkiewicz -Cc: Archit Taneja -Cc: Jose Abreu -Cc: Sam Ravnborg -Cc: dri-devel@lists.freedesktop.org -Cc: NXP Linux Team -Signed-off-by: Liu Ying -Signed-off-by: Sam Ravnborg -Link: https://patchwork.freedesktop.org/patch/msgid/1594260156-8316-2-git-send-email-victor.liu@nxp.com -(cherry picked from commit 0bf4f5b5d3972df7014df302b95b58b8de1a1e94) ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 44 +++++++++---------------------- - 1 file changed, 13 insertions(+), 31 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 137b6ebfed19..748df1cacd2b 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -3179,9 +3179,11 @@ static void dw_hdmi_init_hw(struct dw_hdmi *hdmi) - hdmi->phy.ops->setup_hpd(hdmi, hdmi->phy.data); - } - --static struct dw_hdmi * --__dw_hdmi_probe(struct platform_device *pdev, -- const struct dw_hdmi_plat_data *plat_data) -+/* ----------------------------------------------------------------------------- -+ * Probe/remove API, used from platforms based on the DRM bridge API. -+ */ -+struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, -+ const struct dw_hdmi_plat_data *plat_data) - { - struct device *dev = &pdev->dev; - struct device_node *np = dev->of_node; -@@ -3438,6 +3440,8 @@ __dw_hdmi_probe(struct platform_device *pdev, - hdmi->cec = platform_device_register_full(&pdevinfo); - } - -+ drm_bridge_add(&hdmi->bridge); -+ - return hdmi; - - err_iahb: -@@ -3451,9 +3455,12 @@ __dw_hdmi_probe(struct platform_device *pdev, - - return ERR_PTR(ret); - } -+EXPORT_SYMBOL_GPL(dw_hdmi_probe); - --static void __dw_hdmi_remove(struct dw_hdmi *hdmi) -+void dw_hdmi_remove(struct dw_hdmi *hdmi) - { -+ drm_bridge_remove(&hdmi->bridge); -+ - if (hdmi->audio && !IS_ERR(hdmi->audio)) - platform_device_unregister(hdmi->audio); - if (!IS_ERR(hdmi->cec)) -@@ -3472,31 +3479,6 @@ static void __dw_hdmi_remove(struct dw_hdmi *hdmi) - else - i2c_put_adapter(hdmi->ddc); - } -- --/* ----------------------------------------------------------------------------- -- * Probe/remove API, used from platforms based on the DRM bridge API. -- */ --struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, -- const struct dw_hdmi_plat_data *plat_data) --{ -- struct dw_hdmi *hdmi; -- -- hdmi = __dw_hdmi_probe(pdev, plat_data); -- if (IS_ERR(hdmi)) -- return hdmi; -- -- drm_bridge_add(&hdmi->bridge); -- -- return hdmi; --} --EXPORT_SYMBOL_GPL(dw_hdmi_probe); -- --void dw_hdmi_remove(struct dw_hdmi *hdmi) --{ -- drm_bridge_remove(&hdmi->bridge); -- -- __dw_hdmi_remove(hdmi); --} - EXPORT_SYMBOL_GPL(dw_hdmi_remove); - - /* ----------------------------------------------------------------------------- -@@ -3509,7 +3491,7 @@ struct dw_hdmi *dw_hdmi_bind(struct platform_device *pdev, - struct dw_hdmi *hdmi; - int ret; - -- hdmi = __dw_hdmi_probe(pdev, plat_data); -+ hdmi = dw_hdmi_probe(pdev, plat_data); - if (IS_ERR(hdmi)) - return hdmi; - -@@ -3526,7 +3508,7 @@ EXPORT_SYMBOL_GPL(dw_hdmi_bind); - - void dw_hdmi_unbind(struct dw_hdmi *hdmi) - { -- __dw_hdmi_remove(hdmi); -+ dw_hdmi_remove(hdmi); - } - EXPORT_SYMBOL_GPL(dw_hdmi_unbind); - - -From 7815bc21a8e65bde5ef846a49a0d3735ee942698 Mon Sep 17 00:00:00 2001 -From: Andrey Lebedev -Date: Fri, 19 Jun 2020 10:58:59 +0300 -Subject: [PATCH] drm/lima: Expose job_hang_limit module parameter - -Some pp or gp jobs can be successfully repeated even after they time outs. -Introduce lima module parameter to specify number of times a job can hang -before being dropped. - -Signed-off-by: Andrey Lebedev -Signed-off-by: Qiang Yu -Link: https://patchwork.freedesktop.org/patch/msgid/20200619075900.3030696-1-andrey.lebedev@gmail.com -(cherry picked from commit de48984486d942d4f23e2b29374639f21042bdaa) ---- - drivers/gpu/drm/lima/lima_drv.c | 4 ++++ - drivers/gpu/drm/lima/lima_drv.h | 1 + - drivers/gpu/drm/lima/lima_sched.c | 5 +++-- - 3 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpu/drm/lima/lima_drv.c b/drivers/gpu/drm/lima/lima_drv.c -index a831565af813..ab460121fd52 100644 ---- a/drivers/gpu/drm/lima/lima_drv.c -+++ b/drivers/gpu/drm/lima/lima_drv.c -@@ -19,6 +19,7 @@ - int lima_sched_timeout_ms; - uint lima_heap_init_nr_pages = 8; - uint lima_max_error_tasks; -+uint lima_job_hang_limit; - - MODULE_PARM_DESC(sched_timeout_ms, "task run timeout in ms"); - module_param_named(sched_timeout_ms, lima_sched_timeout_ms, int, 0444); -@@ -29,6 +30,9 @@ module_param_named(heap_init_nr_pages, lima_heap_init_nr_pages, uint, 0444); - MODULE_PARM_DESC(max_error_tasks, "max number of error tasks to save"); - module_param_named(max_error_tasks, lima_max_error_tasks, uint, 0644); - -+MODULE_PARM_DESC(job_hang_limit, "number of times to allow a job to hang before dropping it (default 0)"); -+module_param_named(job_hang_limit, lima_job_hang_limit, uint, 0444); -+ - static int lima_ioctl_get_param(struct drm_device *dev, void *data, struct drm_file *file) - { - struct drm_lima_get_param *args = data; -diff --git a/drivers/gpu/drm/lima/lima_drv.h b/drivers/gpu/drm/lima/lima_drv.h -index fdbd4077c768..c738d288547b 100644 ---- a/drivers/gpu/drm/lima/lima_drv.h -+++ b/drivers/gpu/drm/lima/lima_drv.h -@@ -11,6 +11,7 @@ - extern int lima_sched_timeout_ms; - extern uint lima_heap_init_nr_pages; - extern uint lima_max_error_tasks; -+extern uint lima_job_hang_limit; - - struct lima_vm; - struct lima_bo; -diff --git a/drivers/gpu/drm/lima/lima_sched.c b/drivers/gpu/drm/lima/lima_sched.c -index e6cefda00279..1602985dfa04 100644 ---- a/drivers/gpu/drm/lima/lima_sched.c -+++ b/drivers/gpu/drm/lima/lima_sched.c -@@ -503,8 +503,9 @@ int lima_sched_pipe_init(struct lima_sched_pipe *pipe, const char *name) - - INIT_WORK(&pipe->recover_work, lima_sched_recover_work); - -- return drm_sched_init(&pipe->base, &lima_sched_ops, 1, 0, -- msecs_to_jiffies(timeout), name); -+ return drm_sched_init(&pipe->base, &lima_sched_ops, 1, -+ lima_job_hang_limit, msecs_to_jiffies(timeout), -+ name); - } - - void lima_sched_pipe_fini(struct lima_sched_pipe *pipe) diff --git a/projects/Rockchip/patches/linux/default/linux-0022-drm-from-next.patch b/projects/Rockchip/patches/linux/default/linux-0022-drm-from-next.patch index 43c39f03d6..86615ef337 100644 --- a/projects/Rockchip/patches/linux/default/linux-0022-drm-from-next.patch +++ b/projects/Rockchip/patches/linux/default/linux-0022-drm-from-next.patch @@ -1,1276 +1,403 @@ -From 0265e50360c4bf2bc327f41e662180428652933e Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Thu, 23 Jul 2020 11:05:50 +0200 -Subject: [PATCH] drm/fourcc: fix Amlogic Video Framebuffer Compression macro - -Fix the Amlogic Video Framebuffer Compression modifier macro to -correctly add the layout options, a pair of parenthesis was missing. - -Fixes: d6528ec88309 ("drm/fourcc: Add modifier definitions for describing Amlogic Video Framebuffer Compression") -Signed-off-by: Neil Armstrong -Acked-by: Sam Ravnborg -Link: https://patchwork.freedesktop.org/patch/msgid/20200723090551.27529-1-narmstrong@baylibre.com -(cherry picked from commit da3a9e9a6aa96ef589c153078f66e0646bf06b55) ---- - include/uapi/drm/drm_fourcc.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h -index 4bee7de5f306..82f327801267 100644 ---- a/include/uapi/drm/drm_fourcc.h -+++ b/include/uapi/drm/drm_fourcc.h -@@ -1004,7 +1004,7 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier) - #define DRM_FORMAT_MOD_AMLOGIC_FBC(__layout, __options) \ - fourcc_mod_code(AMLOGIC, \ - ((__layout) & __fourcc_mod_amlogic_layout_mask) | \ -- ((__options) & __fourcc_mod_amlogic_options_mask \ -+ (((__options) & __fourcc_mod_amlogic_options_mask) \ - << __fourcc_mod_amlogic_options_shift)) - - /* Amlogic FBC Layouts */ - -From 97445c33a53e91080924607652c349470021f903 Mon Sep 17 00:00:00 2001 -From: Tomeu Vizoso -Date: Thu, 11 Jun 2020 10:58:43 +0200 -Subject: [PATCH] drm/panfrost: Make sure GPU is powered on when reading - GPU_LATEST_FLUSH_ID - -Bifrost devices do support the flush reduction feature, so on first job -submit we were trying to read the register while still powered off. - -If the GPU is powered off, the feature doesn't bring any benefit, so -don't try to read. - -Tested-by: Heiko Stuebner -Reviewed-by: Steven Price -Signed-off-by: Tomeu Vizoso -Signed-off-by: Rob Herring -Link: https://patchwork.freedesktop.org/patch/msgid/20200611085900.49740-1-tomeu.vizoso@collabora.com -(cherry picked from commit 3a74265c54f883c847ed8554129baefb3e04f135) ---- - drivers/gpu/drm/panfrost/panfrost_gpu.c | 14 ++++++++++++-- - 1 file changed, 12 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c -index f2c1ddc41a9b..e0f190e43813 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_gpu.c -+++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - - #include "panfrost_device.h" - #include "panfrost_features.h" -@@ -368,7 +369,16 @@ void panfrost_gpu_fini(struct panfrost_device *pfdev) - - u32 panfrost_gpu_get_latest_flush_id(struct panfrost_device *pfdev) - { -- if (panfrost_has_hw_feature(pfdev, HW_FEATURE_FLUSH_REDUCTION)) -- return gpu_read(pfdev, GPU_LATEST_FLUSH_ID); -+ u32 flush_id; -+ -+ if (panfrost_has_hw_feature(pfdev, HW_FEATURE_FLUSH_REDUCTION)) { -+ /* Flush reduction only makes sense when the GPU is kept powered on between jobs */ -+ if (pm_runtime_get_if_in_use(pfdev->dev)) { -+ flush_id = gpu_read(pfdev, GPU_LATEST_FLUSH_ID); -+ pm_runtime_put(pfdev->dev); -+ return flush_id; -+ } -+ } -+ - return 0; - } - -From 60dffdcdb8acfc408d983e1a57882346dcf15548 Mon Sep 17 00:00:00 2001 -From: Tomeu Vizoso -Date: Thu, 11 Jun 2020 10:58:44 +0200 -Subject: [PATCH] drm/panfrost: Add compatible string for bifrost - -Mesa now supports some Bifrost devices, so enable it. - -Tested-by: Heiko Stuebner -Reviewed-by: Steven Price -Reviewed-by: Heiko Stuebner -Signed-off-by: Tomeu Vizoso -Signed-off-by: Rob Herring -Link: https://patchwork.freedesktop.org/patch/msgid/20200611085900.49740-2-tomeu.vizoso@collabora.com -(cherry picked from commit 72ef7fe96fd20d3d0e538e165b393819f99870ad) ---- - drivers/gpu/drm/panfrost/panfrost_drv.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c -index 882fecc33fdb..8ff8e140f91e 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_drv.c -+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c -@@ -677,6 +677,7 @@ static const struct of_device_id dt_match[] = { - { .compatible = "arm,mali-t830", .data = &default_data, }, - { .compatible = "arm,mali-t860", .data = &default_data, }, - { .compatible = "arm,mali-t880", .data = &default_data, }, -+ { .compatible = "arm,mali-bifrost", .data = &default_data, }, - {} - }; - MODULE_DEVICE_TABLE(of, dt_match); - -From 6cb794d2c595862996db8e2b0f6749b06b7f8338 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= -Date: Fri, 10 Jul 2020 11:53:56 +0200 -Subject: [PATCH] drm/panfrost: avoid static declaration +From 0898302e2ab75165acf8ad43726e67f3f0f6ab32 Mon Sep 17 00:00:00 2001 +From: Thomas Zimmermann +Date: Wed, 23 Sep 2020 12:21:51 +0200 +Subject: [PATCH] drm/rockchip: Convert to drm_gem_object_funcs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This declaration can be avoided so change it. +GEM object functions deprecate several similar callback interfaces in +struct drm_driver. This patch replaces the per-driver callbacks with +per-instance callbacks in rockchip. The only exception is gem_prime_mmap, +which is non-trivial to convert. -Reviewed-by: Steven Price -Reviewed-by: Alyssa Rosenzweig -Signed-off-by: Clément Péron -Signed-off-by: Rob Herring -Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-2-peron.clem@gmail.com -(cherry picked from commit 862cc626210e34501b4d7a7795c41a67785987e5) +v3: + * update documentation + +Signed-off-by: Thomas Zimmermann +Reviewed-by: Daniel Vetter +Acked-by: Christian König +Link: https://patchwork.freedesktop.org/patch/msgid/20200923102159.24084-15-tzimmermann@suse.de +(cherry picked from commit 0d590af3140d0f84c537a9ad252aecc780ed7aa5) --- - drivers/gpu/drm/panfrost/panfrost_devfreq.c | 38 ++++++++++++++--------------- - 1 file changed, 18 insertions(+), 20 deletions(-) + drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 5 ----- + drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 12 +++++++++++- + 2 files changed, 11 insertions(+), 6 deletions(-) -diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c -index 413987038fbf..1b560b903ea6 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c -+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c -@@ -14,7 +14,24 @@ - #include "panfrost_gpu.h" - #include "panfrost_regs.h" - --static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev); -+static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev) -+{ -+ ktime_t now; -+ ktime_t last; -+ -+ if (!pfdev->devfreq.devfreq) -+ return; -+ -+ now = ktime_get(); -+ last = pfdev->devfreq.time_last_update; -+ -+ if (atomic_read(&pfdev->devfreq.busy_count) > 0) -+ pfdev->devfreq.busy_time += ktime_sub(now, last); -+ else -+ pfdev->devfreq.idle_time += ktime_sub(now, last); -+ -+ pfdev->devfreq.time_last_update = now; -+} - - static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, - u32 flags) -@@ -139,25 +156,6 @@ void panfrost_devfreq_suspend(struct panfrost_device *pfdev) - devfreq_suspend_device(pfdev->devfreq.devfreq); +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +index 0f3eb392fe39..b7654f5e4225 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +@@ -212,15 +212,10 @@ static const struct file_operations rockchip_drm_driver_fops = { + static struct drm_driver rockchip_drm_driver = { + .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC, + .lastclose = drm_fb_helper_lastclose, +- .gem_vm_ops = &drm_gem_cma_vm_ops, +- .gem_free_object_unlocked = rockchip_gem_free_object, + .dumb_create = rockchip_gem_dumb_create, + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, + .prime_fd_to_handle = drm_gem_prime_fd_to_handle, +- .gem_prime_get_sg_table = rockchip_gem_prime_get_sg_table, + .gem_prime_import_sg_table = rockchip_gem_prime_import_sg_table, +- .gem_prime_vmap = rockchip_gem_prime_vmap, +- .gem_prime_vunmap = rockchip_gem_prime_vunmap, + .gem_prime_mmap = rockchip_gem_mmap_buf, + .fops = &rockchip_drm_driver_fops, + .name = DRIVER_NAME, +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +index 62e5d0970525..1cf4631461c9 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +@@ -295,6 +295,14 @@ static void rockchip_gem_release_object(struct rockchip_gem_object *rk_obj) + kfree(rk_obj); } --static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev) --{ -- ktime_t now; -- ktime_t last; -- -- if (!pfdev->devfreq.devfreq) -- return; -- -- now = ktime_get(); -- last = pfdev->devfreq.time_last_update; -- -- if (atomic_read(&pfdev->devfreq.busy_count) > 0) -- pfdev->devfreq.busy_time += ktime_sub(now, last); -- else -- pfdev->devfreq.idle_time += ktime_sub(now, last); -- -- pfdev->devfreq.time_last_update = now; --} -- - void panfrost_devfreq_record_busy(struct panfrost_device *pfdev) - { - panfrost_devfreq_update_utilization(pfdev); - -From f8582b7b92b88a7a5721c93a43f64cce7996a3ba Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= -Date: Fri, 10 Jul 2020 11:53:57 +0200 -Subject: [PATCH] drm/panfrost: clean headers in devfreq -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Don't include not required headers and sort them. - -Reviewed-by: Steven Price -Reviewed-by: Alyssa Rosenzweig -Signed-off-by: Clément Péron -Signed-off-by: Rob Herring -Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-3-peron.clem@gmail.com -(cherry picked from commit 9713e942a539c55b5e0bc64ba83b736bda1087fe) ---- - drivers/gpu/drm/panfrost/panfrost_devfreq.c | 8 ++------ - 1 file changed, 2 insertions(+), 6 deletions(-) - -diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c -index 1b560b903ea6..df7b71da9a84 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c -+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c -@@ -1,18 +1,14 @@ - // SPDX-License-Identifier: GPL-2.0 - /* Copyright 2019 Collabora ltd. */ -+ -+#include - #include - #include - #include - #include --#include --#include - - #include "panfrost_device.h" - #include "panfrost_devfreq.h" --#include "panfrost_features.h" --#include "panfrost_issues.h" --#include "panfrost_gpu.h" --#include "panfrost_regs.h" - - static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev) - { - -From 4bf3b83ab197a9b567917998d8d7e5d069bff60f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= -Date: Fri, 10 Jul 2020 11:53:58 +0200 -Subject: [PATCH] drm/panfrost: don't use pfdevfreq.busy_count to know if hw is - idle -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This use devfreq variable that will be lock with spinlock in future -patches. We should either introduce a function to access this one -but as devfreq is optional let's just remove it. - -Reviewed-by: Steven Price -Reviewed-by: Alyssa Rosenzweig -Signed-off-by: Clément Péron -Signed-off-by: Rob Herring -Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-4-peron.clem@gmail.com -(cherry picked from commit eb9dd67249b55fd1fa3d7359be387ea2079247a6) ---- - drivers/gpu/drm/panfrost/panfrost_job.c | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c -index c6242fe34840..aec05be1ba7a 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_job.c -+++ b/drivers/gpu/drm/panfrost/panfrost_job.c -@@ -581,10 +581,6 @@ int panfrost_job_is_idle(struct panfrost_device *pfdev) - struct panfrost_job_slot *js = pfdev->js; - int i; - -- /* Check whether the hardware is idle */ -- if (atomic_read(&pfdev->devfreq.busy_count)) -- return false; -- - for (i = 0; i < NUM_JOB_SLOTS; i++) { - /* If there are any jobs in the HW queue, we're not idle */ - if (atomic_read(&js->queue[i].sched.hw_rq_count)) - -From 6127648dc07553d337a56d9f12857110e13aae9a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= -Date: Fri, 10 Jul 2020 11:53:59 +0200 -Subject: [PATCH] drm/panfrost: introduce panfrost_devfreq struct -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Introduce a proper panfrost_devfreq to deal with devfreq variables. - -Reviewed-by: Steven Price -Reviewed-by: Alyssa Rosenzweig -Signed-off-by: Clément Péron -Signed-off-by: Rob Herring -Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-5-peron.clem@gmail.com -(cherry picked from commit 9bfacfc82f903b066b0b63460d5b7943705048a4) ---- - drivers/gpu/drm/panfrost/panfrost_devfreq.c | 76 ++++++++++++++++------------- - drivers/gpu/drm/panfrost/panfrost_devfreq.h | 20 +++++++- - drivers/gpu/drm/panfrost/panfrost_device.h | 11 ++--- - drivers/gpu/drm/panfrost/panfrost_job.c | 6 +-- - 4 files changed, 66 insertions(+), 47 deletions(-) - -diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c -index df7b71da9a84..962550363391 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c -+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c -@@ -10,23 +10,23 @@ - #include "panfrost_device.h" - #include "panfrost_devfreq.h" - --static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev) -+static void panfrost_devfreq_update_utilization(struct panfrost_devfreq *pfdevfreq) - { - ktime_t now; - ktime_t last; - -- if (!pfdev->devfreq.devfreq) -+ if (!pfdevfreq->devfreq) - return; - - now = ktime_get(); -- last = pfdev->devfreq.time_last_update; -+ last = pfdevfreq->time_last_update; - -- if (atomic_read(&pfdev->devfreq.busy_count) > 0) -- pfdev->devfreq.busy_time += ktime_sub(now, last); -+ if (atomic_read(&pfdevfreq->busy_count) > 0) -+ pfdevfreq->busy_time += ktime_sub(now, last); - else -- pfdev->devfreq.idle_time += ktime_sub(now, last); -+ pfdevfreq->idle_time += ktime_sub(now, last); - -- pfdev->devfreq.time_last_update = now; -+ pfdevfreq->time_last_update = now; - } - - static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, -@@ -47,30 +47,31 @@ static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, - return 0; - } - --static void panfrost_devfreq_reset(struct panfrost_device *pfdev) -+static void panfrost_devfreq_reset(struct panfrost_devfreq *pfdevfreq) - { -- pfdev->devfreq.busy_time = 0; -- pfdev->devfreq.idle_time = 0; -- pfdev->devfreq.time_last_update = ktime_get(); -+ pfdevfreq->busy_time = 0; -+ pfdevfreq->idle_time = 0; -+ pfdevfreq->time_last_update = ktime_get(); - } - - static int panfrost_devfreq_get_dev_status(struct device *dev, - struct devfreq_dev_status *status) - { - struct panfrost_device *pfdev = dev_get_drvdata(dev); -+ struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; - -- panfrost_devfreq_update_utilization(pfdev); -+ panfrost_devfreq_update_utilization(pfdevfreq); - - status->current_frequency = clk_get_rate(pfdev->clock); -- status->total_time = ktime_to_ns(ktime_add(pfdev->devfreq.busy_time, -- pfdev->devfreq.idle_time)); -+ status->total_time = ktime_to_ns(ktime_add(pfdevfreq->busy_time, -+ pfdevfreq->idle_time)); - -- status->busy_time = ktime_to_ns(pfdev->devfreq.busy_time); -+ status->busy_time = ktime_to_ns(pfdevfreq->busy_time); - -- panfrost_devfreq_reset(pfdev); -+ panfrost_devfreq_reset(pfdevfreq); - -- dev_dbg(pfdev->dev, "busy %lu total %lu %lu %% freq %lu MHz\n", status->busy_time, -- status->total_time, -+ dev_dbg(pfdev->dev, "busy %lu total %lu %lu %% freq %lu MHz\n", -+ status->busy_time, status->total_time, - status->busy_time / (status->total_time / 100), - status->current_frequency / 1000 / 1000); - -@@ -91,6 +92,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) - struct device *dev = &pfdev->pdev->dev; - struct devfreq *devfreq; - struct thermal_cooling_device *cooling; -+ struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; - - ret = dev_pm_opp_of_add_table(dev); - if (ret == -ENODEV) /* Optional, continue without devfreq */ -@@ -98,7 +100,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) - else if (ret) - return ret; - -- panfrost_devfreq_reset(pfdev); -+ panfrost_devfreq_reset(pfdevfreq); - - cur_freq = clk_get_rate(pfdev->clock); - -@@ -116,53 +118,59 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) - dev_pm_opp_of_remove_table(dev); - return PTR_ERR(devfreq); - } -- pfdev->devfreq.devfreq = devfreq; -+ pfdevfreq->devfreq = devfreq; - - cooling = of_devfreq_cooling_register(dev->of_node, devfreq); - if (IS_ERR(cooling)) - DRM_DEV_INFO(dev, "Failed to register cooling device\n"); - else -- pfdev->devfreq.cooling = cooling; -+ pfdevfreq->cooling = cooling; - - return 0; - } - - void panfrost_devfreq_fini(struct panfrost_device *pfdev) - { -- if (pfdev->devfreq.cooling) -- devfreq_cooling_unregister(pfdev->devfreq.cooling); -+ struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; -+ -+ if (pfdevfreq->cooling) -+ devfreq_cooling_unregister(pfdevfreq->cooling); - dev_pm_opp_of_remove_table(&pfdev->pdev->dev); - } - - void panfrost_devfreq_resume(struct panfrost_device *pfdev) - { -- if (!pfdev->devfreq.devfreq) -+ struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; -+ -+ if (!pfdevfreq->devfreq) - return; - -- panfrost_devfreq_reset(pfdev); -+ panfrost_devfreq_reset(pfdevfreq); - -- devfreq_resume_device(pfdev->devfreq.devfreq); -+ devfreq_resume_device(pfdevfreq->devfreq); - } - - void panfrost_devfreq_suspend(struct panfrost_device *pfdev) - { -- if (!pfdev->devfreq.devfreq) -+ struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; -+ -+ if (!pfdevfreq->devfreq) - return; - -- devfreq_suspend_device(pfdev->devfreq.devfreq); -+ devfreq_suspend_device(pfdevfreq->devfreq); - } - --void panfrost_devfreq_record_busy(struct panfrost_device *pfdev) -+void panfrost_devfreq_record_busy(struct panfrost_devfreq *pfdevfreq) - { -- panfrost_devfreq_update_utilization(pfdev); -- atomic_inc(&pfdev->devfreq.busy_count); -+ panfrost_devfreq_update_utilization(pfdevfreq); -+ atomic_inc(&pfdevfreq->busy_count); - } - --void panfrost_devfreq_record_idle(struct panfrost_device *pfdev) -+void panfrost_devfreq_record_idle(struct panfrost_devfreq *pfdevfreq) - { - int count; - -- panfrost_devfreq_update_utilization(pfdev); -- count = atomic_dec_if_positive(&pfdev->devfreq.busy_count); -+ panfrost_devfreq_update_utilization(pfdevfreq); -+ count = atomic_dec_if_positive(&pfdevfreq->busy_count); - WARN_ON(count < 0); - } -diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h -index 0611beffc8d0..0697f8d5aa34 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h -+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h -@@ -4,13 +4,29 @@ - #ifndef __PANFROST_DEVFREQ_H__ - #define __PANFROST_DEVFREQ_H__ - -+#include -+ -+struct devfreq; -+struct thermal_cooling_device; -+ -+struct panfrost_device; -+ -+struct panfrost_devfreq { -+ struct devfreq *devfreq; -+ struct thermal_cooling_device *cooling; -+ ktime_t busy_time; -+ ktime_t idle_time; -+ ktime_t time_last_update; -+ atomic_t busy_count; ++static const struct drm_gem_object_funcs rockchip_gem_object_funcs = { ++ .free = rockchip_gem_free_object, ++ .get_sg_table = rockchip_gem_prime_get_sg_table, ++ .vmap = rockchip_gem_prime_vmap, ++ .vunmap = rockchip_gem_prime_vunmap, ++ .vm_ops = &drm_gem_cma_vm_ops, +}; + - int panfrost_devfreq_init(struct panfrost_device *pfdev); - void panfrost_devfreq_fini(struct panfrost_device *pfdev); + static struct rockchip_gem_object * + rockchip_gem_alloc_object(struct drm_device *drm, unsigned int size) + { +@@ -309,6 +317,8 @@ static struct rockchip_gem_object * - void panfrost_devfreq_resume(struct panfrost_device *pfdev); - void panfrost_devfreq_suspend(struct panfrost_device *pfdev); + obj = &rk_obj->base; --void panfrost_devfreq_record_busy(struct panfrost_device *pfdev); --void panfrost_devfreq_record_idle(struct panfrost_device *pfdev); -+void panfrost_devfreq_record_busy(struct panfrost_devfreq *devfreq); -+void panfrost_devfreq_record_idle(struct panfrost_devfreq *devfreq); - - #endif /* __PANFROST_DEVFREQ_H__ */ -diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h -index c30c719a8059..2efa59c9d1c5 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_device.h -+++ b/drivers/gpu/drm/panfrost/panfrost_device.h -@@ -13,6 +13,8 @@ - #include - #include - -+#include "panfrost_devfreq.h" ++ obj->funcs = &rockchip_gem_object_funcs; + - struct panfrost_device; - struct panfrost_mmu; - struct panfrost_job_slot; -@@ -107,14 +109,7 @@ struct panfrost_device { - struct list_head shrinker_list; - struct shrinker shrinker; + drm_gem_object_init(drm, obj, size); -- struct { -- struct devfreq *devfreq; -- struct thermal_cooling_device *cooling; -- ktime_t busy_time; -- ktime_t idle_time; -- ktime_t time_last_update; -- atomic_t busy_count; -- } devfreq; -+ struct panfrost_devfreq pfdevfreq; - }; + return rk_obj; +@@ -337,7 +347,7 @@ rockchip_gem_create_object(struct drm_device *drm, unsigned int size, + } - struct panfrost_mmu { + /* +- * rockchip_gem_free_object - (struct drm_driver)->gem_free_object_unlocked ++ * rockchip_gem_free_object - (struct drm_gem_object_funcs)->free + * callback function + */ + void rockchip_gem_free_object(struct drm_gem_object *obj) + +From 411c1e880514d8903890c1fe67c4b532d8f0c21c Mon Sep 17 00:00:00 2001 +From: Thomas Zimmermann +Date: Mon, 28 Sep 2020 10:16:43 +0200 +Subject: [PATCH] drm/rockchip: Include for + drm_gem_cm_vm_ops +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Include to get drm_gem_cma_vm_ops. Fallout +from the recent conversion to GEM object functions. + +Signed-off-by: Thomas Zimmermann +Reviewed-by: Sam Ravnborg +Reported-by: kernel test robot +Fixes: 0d590af3140d ("drm/rockchip: Convert to drm_gem_object_funcs") +Cc: Thomas Zimmermann +Cc: Daniel Vetter +Cc: Christian König +Cc: Sandy Huang +Cc: "Heiko Stübner" +Cc: dri-devel@lists.freedesktop.org +Cc: linux-arm-kernel@lists.infradead.org +Cc: linux-rockchip@lists.infradead.org +Link: https://patchwork.freedesktop.org/patch/msgid/20200928081643.8575-1-tzimmermann@suse.de +(cherry picked from commit 8f7db83e6abf863c6a2cfddbe7086f1e3251fdbf) +--- + drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +index 1cf4631461c9..7d5ebb10323b 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +@@ -10,6 +10,7 @@ + + #include + #include ++#include + #include + #include + + +From 4ddb01c2866cd57b134d739e9e88e00dc88453ae Mon Sep 17 00:00:00 2001 +From: Qinglang Miao +Date: Mon, 21 Sep 2020 21:10:19 +0800 +Subject: [PATCH] drm/panfrost: simplify the return expression of + cz_ih_hw_init() + +Simplify the return expression. + +Signed-off-by: Qinglang Miao +Reviewed-by: Philipp Zabel +Reviewed-by: Steven Price +Signed-off-by: Steven Price +Link: https://patchwork.freedesktop.org/patch/msgid/20200921131019.91558-1-miaoqinglang@huawei.com +(cherry picked from commit 3c4641d4e75618fa1b5501b9ae9c19f765d75725) +--- + drivers/gpu/drm/panfrost/panfrost_device.c | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c +index e6896733838a..ea8d31863c50 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_device.c ++++ b/drivers/gpu/drm/panfrost/panfrost_device.c +@@ -18,19 +18,13 @@ + + static int panfrost_reset_init(struct panfrost_device *pfdev) + { +- int err; +- + pfdev->rstc = devm_reset_control_array_get(pfdev->dev, false, true); + if (IS_ERR(pfdev->rstc)) { + dev_err(pfdev->dev, "get reset failed %ld\n", PTR_ERR(pfdev->rstc)); + return PTR_ERR(pfdev->rstc); + } + +- err = reset_control_deassert(pfdev->rstc); +- if (err) +- return err; +- +- return 0; ++ return reset_control_deassert(pfdev->rstc); + } + + static void panfrost_reset_fini(struct panfrost_device *pfdev) + +From b75473ce0e84aa528eef4f805c95fc5e2f6f766a Mon Sep 17 00:00:00 2001 +From: Qinglang Miao +Date: Mon, 21 Sep 2020 21:10:21 +0800 +Subject: [PATCH] drm/panfrost: simplify the return expression of + panfrost_devfreq_target() + +Simplify the return expression. + +Signed-off-by: Qinglang Miao +Reviewed-by: Steven Price +Signed-off-by: Steven Price +Link: https://patchwork.freedesktop.org/patch/msgid/20200921131021.91604-1-miaoqinglang@huawei.com +(cherry picked from commit 0c5036590bde1407a6250ea027e836815353820f) +--- + drivers/gpu/drm/panfrost/panfrost_devfreq.c | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c +index 8ab025d0035f..913eaa6d0bc6 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c ++++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c +@@ -29,18 +29,13 @@ static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, + u32 flags) + { + struct dev_pm_opp *opp; +- int err; + + opp = devfreq_recommended_opp(dev, freq, flags); + if (IS_ERR(opp)) + return PTR_ERR(opp); + dev_pm_opp_put(opp); + +- err = dev_pm_opp_set_rate(dev, *freq); +- if (err) +- return err; +- +- return 0; ++ return dev_pm_opp_set_rate(dev, *freq); + } + + static void panfrost_devfreq_reset(struct panfrost_devfreq *pfdevfreq) + +From f3f98ffb76cdbf06f0549ce904007a7725b76c6f Mon Sep 17 00:00:00 2001 +From: Rikard Falkeborn +Date: Sun, 4 Oct 2020 22:06:53 +0200 +Subject: [PATCH] drm: bridge: dw-hdmi: Constify dw_hdmi_i2s_ops + +The only usage of dw_hdmi_i2s_ops is to assign its address to the ops +field in the hdmi_codec_pdata struct, which is a const pointer. Make it +const to allow the compiler to put it in read-only memory. + +Signed-off-by: Rikard Falkeborn +Signed-off-by: Daniel Vetter +Link: https://patchwork.freedesktop.org/patch/msgid/20201004200653.14702-1-rikard.falkeborn@gmail.com +(cherry picked from commit f3d52908f6baffc21ba45058103d0226ca5cb073) +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +index 9fef6413741d..feb04f127b55 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +@@ -170,7 +170,7 @@ static int dw_hdmi_i2s_hook_plugged_cb(struct device *dev, void *data, + return dw_hdmi_set_plugged_cb(hdmi, fn, codec_dev); + } + +-static struct hdmi_codec_ops dw_hdmi_i2s_ops = { ++static const struct hdmi_codec_ops dw_hdmi_i2s_ops = { + .hw_params = dw_hdmi_i2s_hw_params, + .audio_startup = dw_hdmi_i2s_audio_startup, + .audio_shutdown = dw_hdmi_i2s_audio_shutdown, + +From 5855d31b6f0e36aea731afe3b8dff3c470efa46b Mon Sep 17 00:00:00 2001 +From: Boris Brezillon +Date: Fri, 2 Oct 2020 14:25:06 +0200 +Subject: [PATCH] drm/panfrost: Fix job timeout handling + +If more than two jobs end up timeout-ing concurrently, only one of them +(the one attached to the scheduler acquiring the lock) is fully handled. +The other one remains in a dangling state where it's no longer part of +the scheduling queue, but still blocks something in scheduler, leading +to repetitive timeouts when new jobs are queued. + +Let's make sure all bad jobs are properly handled by the thread +acquiring the lock. + +v3: +- Add Steven's R-b +- Don't take the sched_lock when stopping the schedulers + +v2: +- Fix the subject prefix +- Stop the scheduler before returning from panfrost_job_timedout() +- Call cancel_delayed_work_sync() after drm_sched_stop() to make sure + no timeout handlers are in flight when we reset the GPU (Steven Price) +- Make sure we release the reset lock before restarting the + schedulers (Steven Price) + +Fixes: f3ba91228e8e ("drm/panfrost: Add initial panfrost driver") +Cc: +Signed-off-by: Boris Brezillon +Reviewed-by: Steven Price +Signed-off-by: Steven Price +Link: https://patchwork.freedesktop.org/patch/msgid/20201002122506.1374183-1-boris.brezillon@collabora.com +(cherry picked from commit 1a11a88cfd9a97e13be8bc880c4795f9844fbbec) +--- + drivers/gpu/drm/panfrost/panfrost_job.c | 62 ++++++++++++++++++++++++++++----- + 1 file changed, 53 insertions(+), 9 deletions(-) + diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c -index aec05be1ba7a..2f297d962e64 100644 +index 30e7b7196dab..d0469e944143 100644 --- a/drivers/gpu/drm/panfrost/panfrost_job.c +++ b/drivers/gpu/drm/panfrost/panfrost_job.c -@@ -145,7 +145,7 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) - u64 jc_head = job->jc; - int ret; +@@ -25,7 +25,8 @@ -- panfrost_devfreq_record_busy(pfdev); -+ panfrost_devfreq_record_busy(&pfdev->pfdevfreq); - - ret = pm_runtime_get_sync(pfdev->dev); - if (ret < 0) -@@ -410,7 +410,7 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job) - for (i = 0; i < NUM_JOB_SLOTS; i++) { - if (pfdev->jobs[i]) { - pm_runtime_put_noidle(pfdev->dev); -- panfrost_devfreq_record_idle(pfdev); -+ panfrost_devfreq_record_idle(&pfdev->pfdevfreq); - pfdev->jobs[i] = NULL; - } - } -@@ -478,7 +478,7 @@ static irqreturn_t panfrost_job_irq_handler(int irq, void *data) - pfdev->jobs[j] = NULL; - - panfrost_mmu_as_put(pfdev, &job->file_priv->mmu); -- panfrost_devfreq_record_idle(pfdev); -+ panfrost_devfreq_record_idle(&pfdev->pfdevfreq); - - dma_fence_signal_locked(job->done_fence); - pm_runtime_put_autosuspend(pfdev->dev); - -From 6aa844533781eaf47bd219fafe46fd6647c101e3 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= -Date: Fri, 10 Jul 2020 11:54:00 +0200 -Subject: [PATCH] drm/panfrost: use spinlock instead of atomic -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Convert busy_count to a simple int protected by spinlock. - -Reviewed-by: Steven Price -Reviewed-by: Alyssa Rosenzweig -Signed-off-by: Clément Péron -Signed-off-by: Rob Herring -Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-6-peron.clem@gmail.com -(cherry picked from commit ed85df3f60740bb4be23fbc2db283d59b361a834) ---- - drivers/gpu/drm/panfrost/panfrost_devfreq.c | 43 +++++++++++++++++++++-------- - drivers/gpu/drm/panfrost/panfrost_devfreq.h | 9 +++++- - 2 files changed, 40 insertions(+), 12 deletions(-) - -diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c -index 962550363391..78753cfb59fb 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c -+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c -@@ -12,16 +12,12 @@ - - static void panfrost_devfreq_update_utilization(struct panfrost_devfreq *pfdevfreq) - { -- ktime_t now; -- ktime_t last; + struct panfrost_queue_state { + struct drm_gpu_scheduler sched; - -- if (!pfdevfreq->devfreq) -- return; -+ ktime_t now, last; - - now = ktime_get(); - last = pfdevfreq->time_last_update; - -- if (atomic_read(&pfdevfreq->busy_count) > 0) -+ if (pfdevfreq->busy_count > 0) - pfdevfreq->busy_time += ktime_sub(now, last); - else - pfdevfreq->idle_time += ktime_sub(now, last); -@@ -59,10 +55,14 @@ static int panfrost_devfreq_get_dev_status(struct device *dev, - { - struct panfrost_device *pfdev = dev_get_drvdata(dev); - struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; -+ unsigned long irqflags; -+ -+ status->current_frequency = clk_get_rate(pfdev->clock); -+ -+ spin_lock_irqsave(&pfdevfreq->lock, irqflags); - - panfrost_devfreq_update_utilization(pfdevfreq); - -- status->current_frequency = clk_get_rate(pfdev->clock); - status->total_time = ktime_to_ns(ktime_add(pfdevfreq->busy_time, - pfdevfreq->idle_time)); - -@@ -70,6 +70,8 @@ static int panfrost_devfreq_get_dev_status(struct device *dev, - - panfrost_devfreq_reset(pfdevfreq); - -+ spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); -+ - dev_dbg(pfdev->dev, "busy %lu total %lu %lu %% freq %lu MHz\n", - status->busy_time, status->total_time, - status->busy_time / (status->total_time / 100), -@@ -100,6 +102,8 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) - else if (ret) - return ret; - -+ spin_lock_init(&pfdevfreq->lock); -+ - panfrost_devfreq_reset(pfdevfreq); - - cur_freq = clk_get_rate(pfdev->clock); -@@ -162,15 +166,32 @@ void panfrost_devfreq_suspend(struct panfrost_device *pfdev) - - void panfrost_devfreq_record_busy(struct panfrost_devfreq *pfdevfreq) - { -+ unsigned long irqflags; -+ -+ if (!pfdevfreq->devfreq) -+ return; -+ -+ spin_lock_irqsave(&pfdevfreq->lock, irqflags); -+ - panfrost_devfreq_update_utilization(pfdevfreq); -- atomic_inc(&pfdevfreq->busy_count); -+ -+ pfdevfreq->busy_count++; -+ -+ spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); - } - - void panfrost_devfreq_record_idle(struct panfrost_devfreq *pfdevfreq) - { -- int count; -+ unsigned long irqflags; -+ -+ if (!pfdevfreq->devfreq) -+ return; -+ -+ spin_lock_irqsave(&pfdevfreq->lock, irqflags); - - panfrost_devfreq_update_utilization(pfdevfreq); -- count = atomic_dec_if_positive(&pfdevfreq->busy_count); -- WARN_ON(count < 0); -+ -+ WARN_ON(--pfdevfreq->busy_count < 0); -+ -+ spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); - } -diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h -index 0697f8d5aa34..3392df1020be 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h -+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h -@@ -4,6 +4,7 @@ - #ifndef __PANFROST_DEVFREQ_H__ - #define __PANFROST_DEVFREQ_H__ - -+#include - #include - - struct devfreq; -@@ -14,10 +15,16 @@ struct panfrost_device; - struct panfrost_devfreq { - struct devfreq *devfreq; - struct thermal_cooling_device *cooling; -+ - ktime_t busy_time; - ktime_t idle_time; - ktime_t time_last_update; -- atomic_t busy_count; -+ int busy_count; -+ /* -+ * Protect busy_time, idle_time, time_last_update and busy_count -+ * because these can be updated concurrently between multiple jobs. -+ */ -+ spinlock_t lock; ++ bool stopped; ++ struct mutex lock; + u64 fence_context; + u64 emit_seqno; }; - - int panfrost_devfreq_init(struct panfrost_device *pfdev); - -From ae30cb755ce33edff314df7ac0cc473a534da88d Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= -Date: Fri, 10 Jul 2020 11:54:01 +0200 -Subject: [PATCH] drm/panfrost: properly handle error in probe -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Introduce a boolean to know if opp table has been added. - -With this, we can call panfrost_devfreq_fini() in case of error -and release what has been initialised. - -Reviewed-by: Steven Price -Reviewed-by: Alyssa Rosenzweig -Signed-off-by: Clément Péron -Signed-off-by: Rob Herring -Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-7-peron.clem@gmail.com -(cherry picked from commit 81f2fbe62cb54b6cf3d91078c4d49451ba7b9877) ---- - drivers/gpu/drm/panfrost/panfrost_devfreq.c | 25 +++++++++++++++++++------ - drivers/gpu/drm/panfrost/panfrost_devfreq.h | 1 + - 2 files changed, 20 insertions(+), 6 deletions(-) - -diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c -index 78753cfb59fb..d9007f44b772 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c -+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c -@@ -101,6 +101,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) - return 0; - else if (ret) - return ret; -+ pfdevfreq->opp_of_table_added = true; - - spin_lock_init(&pfdevfreq->lock); - -@@ -109,8 +110,10 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) - cur_freq = clk_get_rate(pfdev->clock); - - opp = devfreq_recommended_opp(dev, &cur_freq, 0); -- if (IS_ERR(opp)) -- return PTR_ERR(opp); -+ if (IS_ERR(opp)) { -+ ret = PTR_ERR(opp); -+ goto err_fini; -+ } - - panfrost_devfreq_profile.initial_freq = cur_freq; - dev_pm_opp_put(opp); -@@ -119,8 +122,8 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) - DEVFREQ_GOV_SIMPLE_ONDEMAND, NULL); - if (IS_ERR(devfreq)) { - DRM_DEV_ERROR(dev, "Couldn't initialize GPU devfreq\n"); -- dev_pm_opp_of_remove_table(dev); -- return PTR_ERR(devfreq); -+ ret = PTR_ERR(devfreq); -+ goto err_fini; - } - pfdevfreq->devfreq = devfreq; - -@@ -131,15 +134,25 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) - pfdevfreq->cooling = cooling; - - return 0; -+ -+err_fini: -+ panfrost_devfreq_fini(pfdev); -+ return ret; +@@ -369,6 +370,24 @@ void panfrost_job_enable_interrupts(struct panfrost_device *pfdev) + job_write(pfdev, JOB_INT_MASK, irq_mask); } - void panfrost_devfreq_fini(struct panfrost_device *pfdev) ++static bool panfrost_scheduler_stop(struct panfrost_queue_state *queue, ++ struct drm_sched_job *bad) ++{ ++ bool stopped = false; ++ ++ mutex_lock(&queue->lock); ++ if (!queue->stopped) { ++ drm_sched_stop(&queue->sched, bad); ++ if (bad) ++ drm_sched_increase_karma(bad); ++ queue->stopped = true; ++ stopped = true; ++ } ++ mutex_unlock(&queue->lock); ++ ++ return stopped; ++} ++ + static void panfrost_job_timedout(struct drm_sched_job *sched_job) { - struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; + struct panfrost_job *job = to_panfrost_job(sched_job); +@@ -392,19 +411,39 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job) + job_read(pfdev, JS_TAIL_LO(js)), + sched_job); -- if (pfdevfreq->cooling) -+ if (pfdevfreq->cooling) { - devfreq_cooling_unregister(pfdevfreq->cooling); -- dev_pm_opp_of_remove_table(&pfdev->pdev->dev); -+ pfdevfreq->cooling = NULL; -+ } ++ /* Scheduler is already stopped, nothing to do. */ ++ if (!panfrost_scheduler_stop(&pfdev->js->queue[js], sched_job)) ++ return; + -+ if (pfdevfreq->opp_of_table_added) { -+ dev_pm_opp_of_remove_table(&pfdev->pdev->dev); -+ pfdevfreq->opp_of_table_added = false; -+ } - } + if (!mutex_trylock(&pfdev->reset_lock)) + return; - void panfrost_devfreq_resume(struct panfrost_device *pfdev) -diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h -index 3392df1020be..210269944687 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h -+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h -@@ -15,6 +15,7 @@ struct panfrost_device; - struct panfrost_devfreq { - struct devfreq *devfreq; - struct thermal_cooling_device *cooling; -+ bool opp_of_table_added; + for (i = 0; i < NUM_JOB_SLOTS; i++) { + struct drm_gpu_scheduler *sched = &pfdev->js->queue[i].sched; - ktime_t busy_time; - ktime_t idle_time; - -From 092280fbb01f23da5278e0a6c7cdae288fe3d277 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= -Date: Fri, 10 Jul 2020 11:54:02 +0200 -Subject: [PATCH] drm/panfrost: rename error labels in device_init -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Rename goto labels in device_init it will be easier to maintain. - -Reviewed-by: Alyssa Rosenzweig -Reviewed-by: Steven Price -Signed-off-by: Clément Péron -Signed-off-by: Rob Herring -Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-8-peron.clem@gmail.com -(cherry picked from commit d3c335da0200be9287cdf5755d19f62ce1670a8d) ---- - drivers/gpu/drm/panfrost/panfrost_device.c | 30 +++++++++++++++--------------- - 1 file changed, 15 insertions(+), 15 deletions(-) - -diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c -index b172087eee6a..9f89984f652a 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_device.c -+++ b/drivers/gpu/drm/panfrost/panfrost_device.c -@@ -216,56 +216,56 @@ int panfrost_device_init(struct panfrost_device *pfdev) - - err = panfrost_regulator_init(pfdev); - if (err) -- goto err_out0; -+ goto out_clk; - - err = panfrost_reset_init(pfdev); - if (err) { - dev_err(pfdev->dev, "reset init failed %d\n", err); -- goto err_out1; -+ goto out_regulator; - } - - err = panfrost_pm_domain_init(pfdev); - if (err) -- goto err_out2; -+ goto out_reset; - - res = platform_get_resource(pfdev->pdev, IORESOURCE_MEM, 0); - pfdev->iomem = devm_ioremap_resource(pfdev->dev, res); - if (IS_ERR(pfdev->iomem)) { - dev_err(pfdev->dev, "failed to ioremap iomem\n"); - err = PTR_ERR(pfdev->iomem); -- goto err_out3; -+ goto out_pm_domain; - } - - err = panfrost_gpu_init(pfdev); - if (err) -- goto err_out3; -+ goto out_pm_domain; - - err = panfrost_mmu_init(pfdev); - if (err) -- goto err_out4; -+ goto out_gpu; - - err = panfrost_job_init(pfdev); - if (err) -- goto err_out5; -+ goto out_mmu; - - err = panfrost_perfcnt_init(pfdev); - if (err) -- goto err_out6; -+ goto out_job; - - return 0; --err_out6: -+out_job: - panfrost_job_fini(pfdev); --err_out5: -+out_mmu: - panfrost_mmu_fini(pfdev); --err_out4: -+out_gpu: - panfrost_gpu_fini(pfdev); --err_out3: -+out_pm_domain: - panfrost_pm_domain_fini(pfdev); --err_out2: -+out_reset: - panfrost_reset_fini(pfdev); --err_out1: -+out_regulator: - panfrost_regulator_fini(pfdev); --err_out0: -+out_clk: - panfrost_clk_fini(pfdev); - return err; - } - -From ffe4f26e002f995ab9786293857a978ebd800921 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= -Date: Fri, 10 Jul 2020 11:54:03 +0200 -Subject: [PATCH] drm/panfrost: move devfreq_init()/fini() in device -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Later we will introduce devfreq probing regulator if they -are present. As regulator should be probe only one time we -need to get this logic in the device_init(). - -panfrost_device is already taking care of devfreq_resume() -and devfreq_suspend(), so it's not totally illogic to move -the devfreq_init() and devfreq_fini() here. - -Reviewed-by: Alyssa Rosenzweig -Reviewed-by: Steven Price -Signed-off-by: Clément Péron -Signed-off-by: Rob Herring -Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-9-peron.clem@gmail.com -(cherry picked from commit 25e247bbf85af3ad721dfeb2e2caf405f43b7e66) ---- - drivers/gpu/drm/panfrost/panfrost_device.c | 12 +++++++++++- - drivers/gpu/drm/panfrost/panfrost_drv.c | 15 ++------------- - 2 files changed, 13 insertions(+), 14 deletions(-) - -diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c -index 9f89984f652a..36b5c8fea3eb 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_device.c -+++ b/drivers/gpu/drm/panfrost/panfrost_device.c -@@ -214,9 +214,16 @@ int panfrost_device_init(struct panfrost_device *pfdev) - return err; - } - -+ err = panfrost_devfreq_init(pfdev); -+ if (err) { -+ if (err != -EPROBE_DEFER) -+ dev_err(pfdev->dev, "devfreq init failed %d\n", err); -+ goto out_clk; -+ } -+ - err = panfrost_regulator_init(pfdev); - if (err) -- goto out_clk; -+ goto out_devfreq; - - err = panfrost_reset_init(pfdev); - if (err) { -@@ -265,6 +272,8 @@ int panfrost_device_init(struct panfrost_device *pfdev) - panfrost_reset_fini(pfdev); - out_regulator: - panfrost_regulator_fini(pfdev); -+out_devfreq: -+ panfrost_devfreq_fini(pfdev); - out_clk: - panfrost_clk_fini(pfdev); - return err; -@@ -278,6 +287,7 @@ void panfrost_device_fini(struct panfrost_device *pfdev) - panfrost_gpu_fini(pfdev); - panfrost_pm_domain_fini(pfdev); - panfrost_reset_fini(pfdev); -+ panfrost_devfreq_fini(pfdev); - panfrost_regulator_fini(pfdev); - panfrost_clk_fini(pfdev); - } -diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c -index 8ff8e140f91e..ed8bcdd6b211 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_drv.c -+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c -@@ -14,7 +14,6 @@ - #include - - #include "panfrost_device.h" --#include "panfrost_devfreq.h" - #include "panfrost_gem.h" - #include "panfrost_mmu.h" - #include "panfrost_job.h" -@@ -606,13 +605,6 @@ static int panfrost_probe(struct platform_device *pdev) - goto err_out0; - } - -- err = panfrost_devfreq_init(pfdev); -- if (err) { -- if (err != -EPROBE_DEFER) -- dev_err(&pdev->dev, "Fatal error during devfreq init\n"); -- goto err_out1; +- drm_sched_stop(sched, sched_job); +- if (js != i) +- /* Ensure any timeouts on other slots have finished */ ++ /* ++ * If the queue is still active, make sure we wait for any ++ * pending timeouts. ++ */ ++ if (!pfdev->js->queue[i].stopped) + cancel_delayed_work_sync(&sched->work_tdr); - } + +- drm_sched_increase_karma(sched_job); ++ /* ++ * If the scheduler was not already stopped, there's a tiny ++ * chance a timeout has expired just before we stopped it, and ++ * drm_sched_stop() does not flush pending works. Let's flush ++ * them now so the timeout handler doesn't get called in the ++ * middle of a reset. ++ */ ++ if (panfrost_scheduler_stop(&pfdev->js->queue[i], NULL)) ++ cancel_delayed_work_sync(&sched->work_tdr); ++ ++ /* ++ * Now that we cancelled the pending timeouts, we can safely ++ * reset the stopped state. ++ */ ++ pfdev->js->queue[i].stopped = false; ++ } + + spin_lock_irqsave(&pfdev->js->job_lock, flags); + for (i = 0; i < NUM_JOB_SLOTS; i++) { +@@ -421,11 +460,11 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job) + for (i = 0; i < NUM_JOB_SLOTS; i++) + drm_sched_resubmit_jobs(&pfdev->js->queue[i].sched); + ++ mutex_unlock(&pfdev->reset_lock); ++ + /* restart scheduler after GPU is usable again */ + for (i = 0; i < NUM_JOB_SLOTS; i++) + drm_sched_start(&pfdev->js->queue[i].sched, true); - - pm_runtime_set_active(pfdev->dev); - pm_runtime_mark_last_busy(pfdev->dev); - pm_runtime_enable(pfdev->dev); -@@ -625,16 +617,14 @@ static int panfrost_probe(struct platform_device *pdev) - */ - err = drm_dev_register(ddev, 0); - if (err < 0) -- goto err_out2; -+ goto err_out1; +- mutex_unlock(&pfdev->reset_lock); + } - panfrost_gem_shrinker_init(ddev); - - return 0; - --err_out2: -- pm_runtime_disable(pfdev->dev); -- panfrost_devfreq_fini(pfdev); - err_out1: -+ pm_runtime_disable(pfdev->dev); - panfrost_device_fini(pfdev); - err_out0: - drm_dev_put(ddev); -@@ -650,7 +640,6 @@ static int panfrost_remove(struct platform_device *pdev) - panfrost_gem_shrinker_cleanup(ddev); - - pm_runtime_get_sync(pfdev->dev); -- panfrost_devfreq_fini(pfdev); - panfrost_device_fini(pfdev); - pm_runtime_put_sync_suspend(pfdev->dev); - pm_runtime_disable(pfdev->dev); - -From 7e7b8d6365eb64a4ff6211971523b4ac00d38e97 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= -Date: Fri, 10 Jul 2020 11:54:04 +0200 -Subject: [PATCH] drm/panfrost: dynamically alloc regulators -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -We will later introduce regulators managed by OPP. - -Only alloc regulators when it's needed. This also help use -to release the regulators only when they are allocated. - -Reviewed-by: Steven Price -Reviewed-by: Alyssa Rosenzweig -Signed-off-by: Clément Péron -Signed-off-by: Rob Herring -Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-10-peron.clem@gmail.com -(cherry picked from commit 512f21227fd3d2dbe7aad57a995b9732229c9b56) ---- - drivers/gpu/drm/panfrost/panfrost_device.c | 14 +++++++++----- - drivers/gpu/drm/panfrost/panfrost_device.h | 3 +-- - 2 files changed, 10 insertions(+), 7 deletions(-) - -diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c -index 36b5c8fea3eb..f1474b961def 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_device.c -+++ b/drivers/gpu/drm/panfrost/panfrost_device.c -@@ -90,9 +90,11 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev) - { + static const struct drm_sched_backend_ops panfrost_sched_ops = { +@@ -558,6 +597,7 @@ int panfrost_job_open(struct panfrost_file_priv *panfrost_priv) int ret, i; -- if (WARN(pfdev->comp->num_supplies > ARRAY_SIZE(pfdev->regulators), -- "Too many supplies in compatible structure.\n")) -- return -EINVAL; -+ pfdev->regulators = devm_kcalloc(pfdev->dev, pfdev->comp->num_supplies, -+ sizeof(*pfdev->regulators), -+ GFP_KERNEL); -+ if (!pfdev->regulators) -+ return -ENOMEM; + for (i = 0; i < NUM_JOB_SLOTS; i++) { ++ mutex_init(&js->queue[i].lock); + sched = &js->queue[i].sched; + ret = drm_sched_entity_init(&panfrost_priv->sched_entity[i], + DRM_SCHED_PRIORITY_NORMAL, &sched, +@@ -570,10 +610,14 @@ int panfrost_job_open(struct panfrost_file_priv *panfrost_priv) - for (i = 0; i < pfdev->comp->num_supplies; i++) - pfdev->regulators[i].supply = pfdev->comp->supply_names[i]; -@@ -119,8 +121,10 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev) - - static void panfrost_regulator_fini(struct panfrost_device *pfdev) + void panfrost_job_close(struct panfrost_file_priv *panfrost_priv) { -- regulator_bulk_disable(pfdev->comp->num_supplies, -- pfdev->regulators); -+ if (!pfdev->regulators) -+ return; -+ -+ regulator_bulk_disable(pfdev->comp->num_supplies, pfdev->regulators); - } ++ struct panfrost_device *pfdev = panfrost_priv->pfdev; ++ struct panfrost_job_slot *js = pfdev->js; + int i; - static void panfrost_pm_domain_fini(struct panfrost_device *pfdev) -diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h -index 2efa59c9d1c5..953f7536a773 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_device.h -+++ b/drivers/gpu/drm/panfrost/panfrost_device.h -@@ -22,7 +22,6 @@ struct panfrost_job; - struct panfrost_perfcnt; - - #define NUM_JOB_SLOTS 3 --#define MAX_REGULATORS 2 - #define MAX_PM_DOMAINS 3 - - struct panfrost_features { -@@ -81,7 +80,7 @@ struct panfrost_device { - void __iomem *iomem; - struct clk *clock; - struct clk *bus_clock; -- struct regulator_bulk_data regulators[MAX_REGULATORS]; -+ struct regulator_bulk_data *regulators; - struct reset_control *rstc; - /* pm_domains for devices with more than one. */ - struct device *pm_domain_devs[MAX_PM_DOMAINS]; - -From 6d63fc6e324b127bbeffaa515043012f30369338 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= -Date: Fri, 10 Jul 2020 11:54:05 +0200 -Subject: [PATCH] drm/panfrost: add regulators to devfreq -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Some OPP tables specify voltage for each frequency. Devfreq can -handle these regulators but they should be get only 1 time to avoid -issue and know who is in charge. - -If OPP table is probe don't init regulator. - -Reviewed-by: Steven Price -Reviewed-by: Alyssa Rosenzweig -Signed-off-by: Clément Péron -Signed-off-by: Rob Herring -Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-11-peron.clem@gmail.com -(cherry picked from commit fd587ff01d59554144e2fd20f4113638a45c7c4e) ---- - drivers/gpu/drm/panfrost/panfrost_devfreq.c | 29 +++++++++++++++++++++++++---- - drivers/gpu/drm/panfrost/panfrost_devfreq.h | 2 ++ - drivers/gpu/drm/panfrost/panfrost_device.c | 9 ++++++--- - 3 files changed, 33 insertions(+), 7 deletions(-) - -diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c -index d9007f44b772..8ab025d0035f 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c -+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c -@@ -93,14 +93,30 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) - unsigned long cur_freq; - struct device *dev = &pfdev->pdev->dev; - struct devfreq *devfreq; -+ struct opp_table *opp_table; - struct thermal_cooling_device *cooling; - struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; - -+ opp_table = dev_pm_opp_set_regulators(dev, pfdev->comp->supply_names, -+ pfdev->comp->num_supplies); -+ if (IS_ERR(opp_table)) { -+ ret = PTR_ERR(opp_table); -+ /* Continue if the optional regulator is missing */ -+ if (ret != -ENODEV) { -+ DRM_DEV_ERROR(dev, "Couldn't set OPP regulators\n"); -+ goto err_fini; -+ } -+ } else { -+ pfdevfreq->regulators_opp_table = opp_table; -+ } -+ - ret = dev_pm_opp_of_add_table(dev); -- if (ret == -ENODEV) /* Optional, continue without devfreq */ -- return 0; -- else if (ret) -- return ret; -+ if (ret) { -+ /* Optional, continue without devfreq */ -+ if (ret == -ENODEV) -+ ret = 0; -+ goto err_fini; -+ } - pfdevfreq->opp_of_table_added = true; - - spin_lock_init(&pfdevfreq->lock); -@@ -153,6 +169,11 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev) - dev_pm_opp_of_remove_table(&pfdev->pdev->dev); - pfdevfreq->opp_of_table_added = false; - } -+ -+ if (pfdevfreq->regulators_opp_table) { -+ dev_pm_opp_put_regulators(pfdevfreq->regulators_opp_table); -+ pfdevfreq->regulators_opp_table = NULL; +- for (i = 0; i < NUM_JOB_SLOTS; i++) ++ for (i = 0; i < NUM_JOB_SLOTS; i++) { + drm_sched_entity_destroy(&panfrost_priv->sched_entity[i]); ++ mutex_destroy(&js->queue[i].lock); + } } - void panfrost_devfreq_resume(struct panfrost_device *pfdev) -diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h -index 210269944687..db6ea48e21f9 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h -+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h -@@ -8,12 +8,14 @@ - #include - - struct devfreq; -+struct opp_table; - struct thermal_cooling_device; - - struct panfrost_device; - - struct panfrost_devfreq { - struct devfreq *devfreq; -+ struct opp_table *regulators_opp_table; - struct thermal_cooling_device *cooling; - bool opp_of_table_added; - -diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c -index f1474b961def..e6896733838a 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_device.c -+++ b/drivers/gpu/drm/panfrost/panfrost_device.c -@@ -225,9 +225,12 @@ int panfrost_device_init(struct panfrost_device *pfdev) - goto out_clk; - } - -- err = panfrost_regulator_init(pfdev); -- if (err) -- goto out_devfreq; -+ /* OPP will handle regulators */ -+ if (!pfdev->pfdevfreq.opp_of_table_added) { -+ err = panfrost_regulator_init(pfdev); -+ if (err) -+ goto out_devfreq; -+ } - - err = panfrost_reset_init(pfdev); - if (err) { - -From 9b6506ec66b7aac5f2e733028bec27da581977ed Mon Sep 17 00:00:00 2001 -From: Navid Emamdoost -Date: Sun, 14 Jun 2020 01:36:19 -0500 -Subject: [PATCH] drm/panfrost: perfcnt: fix ref count leak in - panfrost_perfcnt_enable_locked - -in panfrost_perfcnt_enable_locked, pm_runtime_get_sync is called which -increments the counter even in case of failure, leading to incorrect -ref count. In case of failure, decrement the ref count before returning. - -Acked-by: Alyssa Rosenzweig -Signed-off-by: Navid Emamdoost -Signed-off-by: Rob Herring -Link: https://patchwork.freedesktop.org/patch/msgid/20200614063619.44944-1-navid.emamdoost@gmail.com -(cherry picked from commit 9df0e0c1889677175037445d5ad1654d54176369) ---- - drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c -index 6913578d5aa7..6169644d4469 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c -+++ b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c -@@ -83,11 +83,13 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev, - - ret = pm_runtime_get_sync(pfdev->dev); - if (ret < 0) -- return ret; -+ goto err_put_pm; - - bo = drm_gem_shmem_create(pfdev->ddev, perfcnt->bosize); -- if (IS_ERR(bo)) -- return PTR_ERR(bo); -+ if (IS_ERR(bo)) { -+ ret = PTR_ERR(bo); -+ goto err_put_pm; -+ } - - /* Map the perfcnt buf in the address space attached to file_priv. */ - ret = panfrost_gem_open(&bo->base, file_priv); -@@ -168,6 +170,8 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev, - panfrost_gem_close(&bo->base, file_priv); - err_put_bo: - drm_gem_object_put_unlocked(&bo->base); -+err_put_pm: -+ pm_runtime_put(pfdev->dev); - return ret; - } - + int panfrost_job_is_idle(struct panfrost_device *pfdev) From 90f06fbe3d5c77f338f36433e5663d1e0d2d78c7 Mon Sep 17 00:00:00 2001 From: Jernej Skrabec Date: Wed, 14 Oct 2020 19:46:00 +0200 Subject: [PATCH 5/6] xf86-video-nvidia: Update to 450.80.02 --- packages/x11/driver/xf86-video-nvidia/package.mk | 4 ++-- packages/x11/driver/xf86-video-nvidia/udev.d/96-nvidia.rules | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/x11/driver/xf86-video-nvidia/package.mk b/packages/x11/driver/xf86-video-nvidia/package.mk index b5101cf7f3..fef739f92a 100644 --- a/packages/x11/driver/xf86-video-nvidia/package.mk +++ b/packages/x11/driver/xf86-video-nvidia/package.mk @@ -6,8 +6,8 @@ PKG_NAME="xf86-video-nvidia" # Remember to run "python packages/x11/driver/xf86-video-nvidia/scripts/make_nvidia_udev.py" and commit changes to # "packages/x11/driver/xf86-video-nvidia/udev.d/96-nvidia.rules" whenever bumping version. # Host may require installation of python-lxml and python-requests packages. -PKG_VERSION="450.57" -PKG_SHA256="8a65da18761a2e6547d681b0d87201a46d822e71a318c89a849767a95fbd1e07" +PKG_VERSION="450.80.02" +PKG_SHA256="ad4492e8905e915fe850ffb618347770ca2f0cb488ec3b2b09e96e427dc0d0c3" PKG_ARCH="x86_64" PKG_LICENSE="nonfree" PKG_SITE="http://www.nvidia.com/" diff --git a/packages/x11/driver/xf86-video-nvidia/udev.d/96-nvidia.rules b/packages/x11/driver/xf86-video-nvidia/udev.d/96-nvidia.rules index 0b9d13555f..b2ca922550 100644 --- a/packages/x11/driver/xf86-video-nvidia/udev.d/96-nvidia.rules +++ b/packages/x11/driver/xf86-video-nvidia/udev.d/96-nvidia.rules @@ -239,6 +239,7 @@ ATTRS{device}=="0x1e02", GOTO="configure_nvidia" ATTRS{device}=="0x1e04", GOTO="configure_nvidia" ATTRS{device}=="0x1e07", GOTO="configure_nvidia" ATTRS{device}=="0x1e30", GOTO="configure_nvidia" +ATTRS{device}=="0x1e36", GOTO="configure_nvidia" ATTRS{device}=="0x1e78", GOTO="configure_nvidia" ATTRS{device}=="0x1e81", GOTO="configure_nvidia" ATTRS{device}=="0x1e82", GOTO="configure_nvidia" @@ -282,7 +283,11 @@ ATTRS{device}=="0x1f82", GOTO="configure_nvidia" ATTRS{device}=="0x1f91", GOTO="configure_nvidia" ATTRS{device}=="0x1f95", GOTO="configure_nvidia" ATTRS{device}=="0x1f96", GOTO="configure_nvidia" +ATTRS{device}=="0x1f97", GOTO="configure_nvidia" +ATTRS{device}=="0x1f98", GOTO="configure_nvidia" ATTRS{device}=="0x1f99", GOTO="configure_nvidia" +ATTRS{device}=="0x1f9c", GOTO="configure_nvidia" +ATTRS{device}=="0x1fb0", GOTO="configure_nvidia" ATTRS{device}=="0x1fb8", GOTO="configure_nvidia" ATTRS{device}=="0x1fb9", GOTO="configure_nvidia" ATTRS{device}=="0x1ff9", GOTO="configure_nvidia" From 19f84243ee9e20e6bf9b8c7ada93faf80872d134 Mon Sep 17 00:00:00 2001 From: Jernej Skrabec Date: Wed, 14 Oct 2020 20:03:48 +0200 Subject: [PATCH 6/6] xf86-video-nvidia-legacy: Fix building on 5.9 --- ...f86-video-nvidia-legacy-0005-fix-5.9.patch | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 packages/x11/driver/xf86-video-nvidia-legacy/patches/xf86-video-nvidia-legacy-0005-fix-5.9.patch diff --git a/packages/x11/driver/xf86-video-nvidia-legacy/patches/xf86-video-nvidia-legacy-0005-fix-5.9.patch b/packages/x11/driver/xf86-video-nvidia-legacy/patches/xf86-video-nvidia-legacy-0005-fix-5.9.patch new file mode 100644 index 0000000000..0702651c26 --- /dev/null +++ b/packages/x11/driver/xf86-video-nvidia-legacy/patches/xf86-video-nvidia-legacy-0005-fix-5.9.patch @@ -0,0 +1,74 @@ +diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/nv.c NVIDIA-Linux-x86_64-340.108-new/kernel/nv.c +--- NVIDIA-Linux-x86_64-340.108-old/kernel/nv.c 2020-08-26 14:28:09.350000000 +0200 ++++ NVIDIA-Linux-x86_64-340.108-new/kernel/nv.c 2020-08-26 14:35:42.856666666 +0200 +@@ -2785,8 +2785,12 @@ + + #if defined(CONFIG_VGA_ARB) + #if defined(VGA_DEFAULT_DEVICE) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) ++ vga_get(VGA_DEFAULT_DEVICE, VGA_RSRC_LEGACY_MASK, 0); ++#else + vga_tryget(VGA_DEFAULT_DEVICE, VGA_RSRC_LEGACY_MASK); + #endif ++#endif + vga_set_legacy_decoding(dev, VGA_RSRC_NONE); + #endif + +diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/nv-drm.c NVIDIA-Linux-x86_64-340.108-new/kernel/nv-drm.c +--- NVIDIA-Linux-x86_64-340.108-old/kernel/nv-drm.c 2020-08-26 14:28:09.506666667 +0200 ++++ NVIDIA-Linux-x86_64-340.108-new/kernel/nv-drm.c 2020-08-26 14:48:58.443333335 +0200 +@@ -373,7 +373,11 @@ + .set_busid = drm_pci_set_busid, + #endif + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) ++ .gem_free_object_unlocked = nv_gem_free, ++#else + .gem_free_object = nv_gem_free, ++#endif + + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, + .gem_prime_export = drm_gem_prime_export, +@@ -470,8 +474,12 @@ + #if defined(NV_DRM_GEM_OBJECT_PUT_UNLOCKED_PRESENT) + drm_gem_object_put_unlocked(&nv_obj->base); + #else ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) ++ drm_gem_object_put_locked(&nv_obj->base); ++#else + drm_gem_object_unreference_unlocked(&nv_obj->base); + #endif ++#endif + + status = RM_OK; + +diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/nv-linux.h NVIDIA-Linux-x86_64-340.108-new/kernel/nv-linux.h +--- NVIDIA-Linux-x86_64-340.108-old/kernel/nv-linux.h 2020-08-26 14:28:09.583333333 +0200 ++++ NVIDIA-Linux-x86_64-340.108-new/kernel/nv-linux.h 2020-08-26 14:53:45.693333299 +0200 +@@ -136,8 +136,10 @@ + + #if defined(NVCPU_X86_64) && !defined(HAVE_COMPAT_IOCTL) + #include /* sys_ioctl() */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0) + #include /* register_ioctl32_conversion() */ + #endif ++#endif + + #if !defined(NV_FILE_OPERATIONS_HAS_IOCTL) && \ + !defined(NV_FILE_OPERATIONS_HAS_UNLOCKED_IOCTL) +@@ -2249,10 +2251,13 @@ + pages, vmas, NULL); + + #else +- ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) ++ return get_user_pages_remote(mm, start, nr_pages, flags, ++ pages, vmas, NULL); ++#else + return get_user_pages_remote(tsk, mm, start, nr_pages, flags, + pages, vmas); +- ++#endif + #endif + + }