rockchip,rk322x: bump edge kernel to 6.6 (#5875)
* rockchip,rk322x: bump edge kernel to 6.6 * rk322x: update patching_config.yaml
This commit is contained in:
parent
7d679d7018
commit
f08dcd4867
@ -1,6 +1,6 @@
|
||||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Linux/arm 6.5.7 Kernel Configuration
|
||||
# Linux/arm 6.6.0 Kernel Configuration
|
||||
#
|
||||
CONFIG_CC_VERSION_TEXT="arm-linux-gnueabihf-gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
|
||||
CONFIG_CC_IS_GCC=y
|
||||
@ -242,7 +242,6 @@ CONFIG_KCMP=y
|
||||
CONFIG_RSEQ=y
|
||||
CONFIG_CACHESTAT_SYSCALL=y
|
||||
# CONFIG_DEBUG_RSEQ is not set
|
||||
CONFIG_EMBEDDED=y
|
||||
CONFIG_HAVE_PERF_EVENTS=y
|
||||
CONFIG_PERF_USE_VMALLOC=y
|
||||
# CONFIG_PC104 is not set
|
||||
@ -257,6 +256,13 @@ CONFIG_PERF_EVENTS=y
|
||||
CONFIG_SYSTEM_DATA_VERIFICATION=y
|
||||
CONFIG_PROFILING=y
|
||||
CONFIG_TRACEPOINTS=y
|
||||
|
||||
#
|
||||
# Kexec and crash features
|
||||
#
|
||||
# CONFIG_KEXEC is not set
|
||||
# CONFIG_CRASH_DUMP is not set
|
||||
# end of Kexec and crash features
|
||||
# end of General setup
|
||||
|
||||
CONFIG_ARM=y
|
||||
@ -489,8 +495,8 @@ CONFIG_ZBOOT_ROM_TEXT=0x0
|
||||
CONFIG_ZBOOT_ROM_BSS=0x0
|
||||
# CONFIG_ARM_APPENDED_DTB is not set
|
||||
CONFIG_CMDLINE=""
|
||||
# CONFIG_KEXEC is not set
|
||||
# CONFIG_CRASH_DUMP is not set
|
||||
CONFIG_ARCH_SUPPORTS_KEXEC=y
|
||||
CONFIG_ARCH_SUPPORTS_CRASH_DUMP=y
|
||||
CONFIG_AUTO_ZRELADDR=y
|
||||
# CONFIG_EFI is not set
|
||||
# end of Boot options
|
||||
@ -820,6 +826,7 @@ CONFIG_SLAB_MERGE_DEFAULT=y
|
||||
# CONFIG_SLAB_FREELIST_HARDENED is not set
|
||||
# CONFIG_SLUB_STATS is not set
|
||||
CONFIG_SLUB_CPU_PARTIAL=y
|
||||
# CONFIG_RANDOM_KMALLOC_CACHES is not set
|
||||
# end of SLAB allocator options
|
||||
|
||||
# CONFIG_SHUFFLE_PAGE_ALLOCATOR is not set
|
||||
@ -841,7 +848,6 @@ CONFIG_BOUNCE=y
|
||||
CONFIG_KSM=y
|
||||
CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
|
||||
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
|
||||
CONFIG_FRONTSWAP=y
|
||||
CONFIG_CMA=y
|
||||
# CONFIG_CMA_DEBUG is not set
|
||||
# CONFIG_CMA_DEBUGFS is not set
|
||||
@ -857,6 +863,7 @@ CONFIG_VM_EVENT_COUNTERS=y
|
||||
# CONFIG_DMAPOOL_TEST is not set
|
||||
CONFIG_KMAP_LOCAL=y
|
||||
CONFIG_KMAP_LOCAL_NON_LINEAR_PTE_ARRAY=y
|
||||
CONFIG_MEMFD_CREATE=y
|
||||
# CONFIG_ANON_VMA_NAME is not set
|
||||
# CONFIG_USERFAULTFD is not set
|
||||
CONFIG_LRU_GEN=y
|
||||
@ -874,6 +881,7 @@ CONFIG_LOCK_MM_AND_FIND_VMA=y
|
||||
CONFIG_NET=y
|
||||
CONFIG_NET_INGRESS=y
|
||||
CONFIG_NET_EGRESS=y
|
||||
CONFIG_NET_XGRESS=y
|
||||
CONFIG_NET_REDIRECT=y
|
||||
CONFIG_SKB_EXTENSIONS=y
|
||||
|
||||
@ -1790,6 +1798,11 @@ CONFIG_ARM_CCI=y
|
||||
# CONFIG_MHI_BUS_EP is not set
|
||||
# end of Bus devices
|
||||
|
||||
#
|
||||
# Cache Drivers
|
||||
#
|
||||
# end of Cache Drivers
|
||||
|
||||
CONFIG_CONNECTOR=y
|
||||
CONFIG_PROC_EVENTS=y
|
||||
|
||||
@ -1981,6 +1994,7 @@ CONFIG_SCSI_VIRTIO=m
|
||||
CONFIG_MD=y
|
||||
CONFIG_BLK_DEV_MD=y
|
||||
CONFIG_MD_AUTODETECT=y
|
||||
CONFIG_MD_BITMAP_FILE=y
|
||||
# CONFIG_MD_LINEAR is not set
|
||||
CONFIG_MD_RAID0=y
|
||||
CONFIG_MD_RAID1=y
|
||||
@ -2204,9 +2218,11 @@ CONFIG_BCM_NET_PHYLIB=m
|
||||
# CONFIG_LSI_ET1011C_PHY is not set
|
||||
# CONFIG_MARVELL_PHY is not set
|
||||
# CONFIG_MARVELL_10G_PHY is not set
|
||||
# CONFIG_MARVELL_88Q2XXX_PHY is not set
|
||||
# CONFIG_MARVELL_88X2222_PHY is not set
|
||||
# CONFIG_MAXLINEAR_GPHY is not set
|
||||
CONFIG_MEDIATEK_GE_PHY=m
|
||||
# CONFIG_MEDIATEK_GE_SOC_PHY is not set
|
||||
# CONFIG_MICREL_PHY is not set
|
||||
# CONFIG_MICROCHIP_T1S_PHY is not set
|
||||
CONFIG_MICROCHIP_PHY=m
|
||||
@ -2460,6 +2476,8 @@ CONFIG_MT76_USB=m
|
||||
CONFIG_MT76x02_LIB=m
|
||||
CONFIG_MT76x02_USB=m
|
||||
CONFIG_MT76_CONNAC_LIB=m
|
||||
CONFIG_MT792x_LIB=m
|
||||
CONFIG_MT792x_USB=m
|
||||
CONFIG_MT76x0_COMMON=m
|
||||
CONFIG_MT76x0U=m
|
||||
CONFIG_MT76x2_COMMON=m
|
||||
@ -2752,6 +2770,7 @@ CONFIG_TOUCHSCREEN_ZET6223=m
|
||||
# CONFIG_TOUCHSCREEN_COLIBRI_VF50 is not set
|
||||
# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set
|
||||
CONFIG_TOUCHSCREEN_IQS5XX=m
|
||||
# CONFIG_TOUCHSCREEN_IQS7211 is not set
|
||||
# CONFIG_TOUCHSCREEN_ZINITIX is not set
|
||||
# CONFIG_TOUCHSCREEN_HIMAX_HX83112B is not set
|
||||
CONFIG_INPUT_MISC=y
|
||||
@ -3061,6 +3080,7 @@ CONFIG_DP83640_PHY=m
|
||||
CONFIG_PTP_1588_CLOCK_KVM=y
|
||||
# CONFIG_PTP_1588_CLOCK_IDT82P33 is not set
|
||||
# CONFIG_PTP_1588_CLOCK_IDTCM is not set
|
||||
# CONFIG_PTP_1588_CLOCK_MOCK is not set
|
||||
# end of PTP clock support
|
||||
|
||||
CONFIG_PINCTRL=y
|
||||
@ -3121,6 +3141,7 @@ CONFIG_GPIO_ROCKCHIP=y
|
||||
#
|
||||
# CONFIG_GPIO_ADNP is not set
|
||||
# CONFIG_GPIO_FXL6408 is not set
|
||||
# CONFIG_GPIO_DS4520 is not set
|
||||
# CONFIG_GPIO_GW_PLD is not set
|
||||
# CONFIG_GPIO_MAX7300 is not set
|
||||
# CONFIG_GPIO_MAX732X is not set
|
||||
@ -3306,6 +3327,7 @@ CONFIG_HWMON=y
|
||||
# CONFIG_SENSORS_G762 is not set
|
||||
CONFIG_SENSORS_GPIO_FAN=y
|
||||
# CONFIG_SENSORS_HIH6130 is not set
|
||||
# CONFIG_SENSORS_HS3001 is not set
|
||||
# CONFIG_SENSORS_IIO_HWMON is not set
|
||||
# CONFIG_SENSORS_IT87 is not set
|
||||
# CONFIG_SENSORS_JC42 is not set
|
||||
@ -3393,7 +3415,6 @@ CONFIG_SENSORS_PWM_FAN=y
|
||||
# CONFIG_SENSORS_SCH5627 is not set
|
||||
# CONFIG_SENSORS_SCH5636 is not set
|
||||
# CONFIG_SENSORS_STTS751 is not set
|
||||
# CONFIG_SENSORS_SMM665 is not set
|
||||
# CONFIG_SENSORS_ADC128D818 is not set
|
||||
# CONFIG_SENSORS_ADS7828 is not set
|
||||
# CONFIG_SENSORS_ADS7871 is not set
|
||||
@ -3496,6 +3517,7 @@ CONFIG_MFD_CORE=y
|
||||
# CONFIG_MFD_BCM590XX is not set
|
||||
# CONFIG_MFD_BD9571MWV is not set
|
||||
# CONFIG_MFD_AXP20X_I2C is not set
|
||||
# CONFIG_MFD_CS42L43_I2C is not set
|
||||
CONFIG_MFD_MADERA=m
|
||||
CONFIG_MFD_MADERA_I2C=m
|
||||
# CONFIG_MFD_MADERA_SPI is not set
|
||||
@ -3620,6 +3642,7 @@ CONFIG_REGULATOR_FIXED_VOLTAGE=y
|
||||
# CONFIG_REGULATOR_AD5398 is not set
|
||||
# CONFIG_REGULATOR_ARIZONA_LDO1 is not set
|
||||
# CONFIG_REGULATOR_ARIZONA_MICSUPP is not set
|
||||
# CONFIG_REGULATOR_AW37503 is not set
|
||||
# CONFIG_REGULATOR_BD718XX is not set
|
||||
# CONFIG_REGULATOR_CPCAP is not set
|
||||
# CONFIG_REGULATOR_DA9121 is not set
|
||||
@ -3638,6 +3661,7 @@ CONFIG_REGULATOR_GPIO=y
|
||||
# CONFIG_REGULATOR_LTC3676 is not set
|
||||
# CONFIG_REGULATOR_MAX1586 is not set
|
||||
# CONFIG_REGULATOR_MAX77650 is not set
|
||||
# CONFIG_REGULATOR_MAX77857 is not set
|
||||
# CONFIG_REGULATOR_MAX8649 is not set
|
||||
# CONFIG_REGULATOR_MAX8660 is not set
|
||||
# CONFIG_REGULATOR_MAX8893 is not set
|
||||
@ -3672,6 +3696,7 @@ CONFIG_REGULATOR_PWM=y
|
||||
# CONFIG_REGULATOR_RTQ2134 is not set
|
||||
# CONFIG_REGULATOR_RTMV20 is not set
|
||||
# CONFIG_REGULATOR_RTQ6752 is not set
|
||||
# CONFIG_REGULATOR_RTQ2208 is not set
|
||||
# CONFIG_REGULATOR_SLG51000 is not set
|
||||
# CONFIG_REGULATOR_STPMIC1 is not set
|
||||
# CONFIG_REGULATOR_SY8106A is not set
|
||||
@ -4163,6 +4188,7 @@ CONFIG_VIDEO_CAMERA_SENSOR=y
|
||||
# CONFIG_VIDEO_AD5820 is not set
|
||||
# CONFIG_VIDEO_AK7375 is not set
|
||||
# CONFIG_VIDEO_DW9714 is not set
|
||||
# CONFIG_VIDEO_DW9719 is not set
|
||||
# CONFIG_VIDEO_DW9768 is not set
|
||||
# CONFIG_VIDEO_DW9807_VCM is not set
|
||||
# end of Lens drivers
|
||||
@ -4279,6 +4305,14 @@ CONFIG_VIDEO_CX25840=m
|
||||
# CONFIG_VIDEO_THS7303 is not set
|
||||
# end of Miscellaneous helper chips
|
||||
|
||||
#
|
||||
# Video serializers and deserializers
|
||||
#
|
||||
# CONFIG_VIDEO_DS90UB913 is not set
|
||||
# CONFIG_VIDEO_DS90UB953 is not set
|
||||
# CONFIG_VIDEO_DS90UB960 is not set
|
||||
# end of Video serializers and deserializers
|
||||
|
||||
#
|
||||
# Media SPI Adapters
|
||||
#
|
||||
@ -4500,6 +4534,7 @@ CONFIG_DVB_AF9033=m
|
||||
#
|
||||
CONFIG_VIDEO_CMDLINE=y
|
||||
CONFIG_VIDEO_NOMODESET=y
|
||||
# CONFIG_AUXDISPLAY is not set
|
||||
CONFIG_DRM=y
|
||||
# CONFIG_DRM_DEBUG_MM is not set
|
||||
CONFIG_DRM_KMS_HELPER=y
|
||||
@ -4669,24 +4704,7 @@ CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y
|
||||
#
|
||||
# Frame buffer Devices
|
||||
#
|
||||
CONFIG_FB_NOTIFY=y
|
||||
CONFIG_FB=y
|
||||
# CONFIG_FIRMWARE_EDID is not set
|
||||
CONFIG_FB_SYS_FILLRECT=y
|
||||
CONFIG_FB_SYS_COPYAREA=y
|
||||
CONFIG_FB_SYS_IMAGEBLIT=y
|
||||
# CONFIG_FB_FOREIGN_ENDIAN is not set
|
||||
CONFIG_FB_SYS_FOPS=y
|
||||
CONFIG_FB_DEFERRED_IO=y
|
||||
CONFIG_FB_SYS_HELPERS=y
|
||||
CONFIG_FB_SYS_HELPERS_DEFERRED=y
|
||||
CONFIG_FB_BACKLIGHT=m
|
||||
CONFIG_FB_MODE_HELPERS=y
|
||||
CONFIG_FB_TILEBLITTING=y
|
||||
|
||||
#
|
||||
# Frame buffer hardware drivers
|
||||
#
|
||||
# CONFIG_FB_ARMCLCD is not set
|
||||
# CONFIG_FB_UVESA is not set
|
||||
# CONFIG_FB_OPENCORES is not set
|
||||
@ -4698,6 +4716,22 @@ CONFIG_FB_TILEBLITTING=y
|
||||
# CONFIG_FB_METRONOME is not set
|
||||
# CONFIG_FB_SIMPLE is not set
|
||||
# CONFIG_FB_SSD1307 is not set
|
||||
CONFIG_FB_CORE=y
|
||||
CONFIG_FB_NOTIFY=y
|
||||
# CONFIG_FIRMWARE_EDID is not set
|
||||
CONFIG_FB_DEVICE=y
|
||||
CONFIG_FB_SYS_FILLRECT=y
|
||||
CONFIG_FB_SYS_COPYAREA=y
|
||||
CONFIG_FB_SYS_IMAGEBLIT=y
|
||||
# CONFIG_FB_FOREIGN_ENDIAN is not set
|
||||
CONFIG_FB_SYS_FOPS=y
|
||||
CONFIG_FB_DEFERRED_IO=y
|
||||
CONFIG_FB_DMAMEM_HELPERS=y
|
||||
CONFIG_FB_SYSMEM_HELPERS=y
|
||||
CONFIG_FB_SYSMEM_HELPERS_DEFERRED=y
|
||||
CONFIG_FB_BACKLIGHT=m
|
||||
CONFIG_FB_MODE_HELPERS=y
|
||||
CONFIG_FB_TILEBLITTING=y
|
||||
# end of Frame buffer Devices
|
||||
|
||||
#
|
||||
@ -4878,8 +4912,10 @@ CONFIG_SND_SOC_AK4458=m
|
||||
# CONFIG_SND_SOC_AK5386 is not set
|
||||
CONFIG_SND_SOC_AK5558=m
|
||||
# CONFIG_SND_SOC_ALC5623 is not set
|
||||
# CONFIG_SND_SOC_AUDIO_IIO_AUX is not set
|
||||
# CONFIG_SND_SOC_AW8738 is not set
|
||||
# CONFIG_SND_SOC_AW88395 is not set
|
||||
# CONFIG_SND_SOC_AW88261 is not set
|
||||
CONFIG_SND_SOC_BD28623=m
|
||||
# CONFIG_SND_SOC_BT_SCO is not set
|
||||
# CONFIG_SND_SOC_CHV3_CODEC is not set
|
||||
@ -5102,6 +5138,7 @@ CONFIG_HID_GFRM=m
|
||||
# CONFIG_HID_GLORIOUS is not set
|
||||
CONFIG_HID_HOLTEK=m
|
||||
CONFIG_HOLTEK_FF=y
|
||||
# CONFIG_HID_GOOGLE_STADIA_FF is not set
|
||||
# CONFIG_HID_VIVALDI is not set
|
||||
CONFIG_HID_GT683R=m
|
||||
CONFIG_HID_KEYTOUCH=m
|
||||
@ -5483,6 +5520,7 @@ CONFIG_USB_CONFIGFS_F_UAC1=y
|
||||
CONFIG_USB_CONFIGFS_F_UAC1_LEGACY=y
|
||||
CONFIG_USB_CONFIGFS_F_UAC2=y
|
||||
CONFIG_USB_CONFIGFS_F_MIDI=y
|
||||
# CONFIG_USB_CONFIGFS_F_MIDI2 is not set
|
||||
CONFIG_USB_CONFIGFS_F_HID=y
|
||||
CONFIG_USB_CONFIGFS_F_UVC=y
|
||||
CONFIG_USB_CONFIGFS_F_PRINTER=y
|
||||
@ -5576,6 +5614,7 @@ CONFIG_LEDS_GPIO=y
|
||||
# CONFIG_LEDS_LP8860 is not set
|
||||
# CONFIG_LEDS_PCA955X is not set
|
||||
# CONFIG_LEDS_PCA963X is not set
|
||||
# CONFIG_LEDS_PCA995X is not set
|
||||
# CONFIG_LEDS_DAC124S085 is not set
|
||||
# CONFIG_LEDS_PWM is not set
|
||||
# CONFIG_LEDS_REGULATOR is not set
|
||||
@ -5738,7 +5777,6 @@ CONFIG_RTC_DRV_RX6110=m
|
||||
# CONFIG_RTC_DRV_M48T35 is not set
|
||||
# CONFIG_RTC_DRV_M48T59 is not set
|
||||
# CONFIG_RTC_DRV_MSM6242 is not set
|
||||
# CONFIG_RTC_DRV_BQ4802 is not set
|
||||
# CONFIG_RTC_DRV_RP5C01 is not set
|
||||
# CONFIG_RTC_DRV_OPTEE is not set
|
||||
# CONFIG_RTC_DRV_ZYNQMP is not set
|
||||
@ -5776,6 +5814,7 @@ CONFIG_FSL_QDMA=m
|
||||
# CONFIG_INTEL_IDMA64 is not set
|
||||
# CONFIG_NBPFAXI_DMA is not set
|
||||
CONFIG_PL330_DMA=y
|
||||
# CONFIG_XILINX_DMA is not set
|
||||
# CONFIG_XILINX_XDMA is not set
|
||||
# CONFIG_XILINX_ZYNQMP_DPDMA is not set
|
||||
# CONFIG_QCOM_HIDMA_MGMT is not set
|
||||
@ -5804,7 +5843,6 @@ CONFIG_DMABUF_SELFTESTS=m
|
||||
CONFIG_DMABUF_SYSFS_STATS=y
|
||||
# end of DMABUF options
|
||||
|
||||
# CONFIG_AUXDISPLAY is not set
|
||||
# CONFIG_UIO is not set
|
||||
# CONFIG_VFIO is not set
|
||||
# CONFIG_VIRT_DRIVERS is not set
|
||||
@ -5949,6 +5987,7 @@ CONFIG_COMMON_CLK_SI544=m
|
||||
# CONFIG_COMMON_CLK_PWM is not set
|
||||
# CONFIG_COMMON_CLK_RS9_PCIE is not set
|
||||
# CONFIG_COMMON_CLK_SI521XX is not set
|
||||
# CONFIG_COMMON_CLK_VC3 is not set
|
||||
CONFIG_COMMON_CLK_VC5=m
|
||||
# CONFIG_COMMON_CLK_VC7 is not set
|
||||
# CONFIG_COMMON_CLK_BD718XX is not set
|
||||
@ -6358,6 +6397,7 @@ CONFIG_AD5758=m
|
||||
# CONFIG_MAX5522 is not set
|
||||
# CONFIG_MAX5821 is not set
|
||||
# CONFIG_MCP4725 is not set
|
||||
# CONFIG_MCP4728 is not set
|
||||
# CONFIG_MCP4922 is not set
|
||||
# CONFIG_TI_DAC082S085 is not set
|
||||
CONFIG_TI_DAC5571=m
|
||||
@ -6627,6 +6667,7 @@ CONFIG_HID_SENSOR_PRESS=m
|
||||
#
|
||||
# Proximity and distance sensors
|
||||
#
|
||||
# CONFIG_IRSD200 is not set
|
||||
CONFIG_ISL29501=m
|
||||
# CONFIG_LIDAR_LITE_V2 is not set
|
||||
CONFIG_MB1232=m
|
||||
@ -6811,6 +6852,7 @@ CONFIG_MOST=m
|
||||
CONFIG_DCACHE_WORD_ACCESS=y
|
||||
CONFIG_VALIDATE_FS_PARSER=y
|
||||
CONFIG_FS_IOMAP=y
|
||||
CONFIG_BUFFER_HEAD=y
|
||||
CONFIG_LEGACY_DIRECT_IO=y
|
||||
CONFIG_EXT2_FS=y
|
||||
# CONFIG_EXT2_FS_XATTR is not set
|
||||
@ -6841,9 +6883,10 @@ CONFIG_XFS_POSIX_ACL=y
|
||||
CONFIG_XFS_RT=y
|
||||
CONFIG_XFS_DRAIN_INTENTS=y
|
||||
CONFIG_XFS_ONLINE_SCRUB=y
|
||||
CONFIG_XFS_ONLINE_SCRUB_STATS=y
|
||||
# CONFIG_XFS_ONLINE_REPAIR is not set
|
||||
# CONFIG_XFS_WARN is not set
|
||||
# CONFIG_XFS_DEBUG is not set
|
||||
CONFIG_XFS_DEBUG=y
|
||||
CONFIG_XFS_ASSERT_FATAL=y
|
||||
# CONFIG_GFS2_FS is not set
|
||||
# CONFIG_OCFS2_FS is not set
|
||||
CONFIG_BTRFS_FS=y
|
||||
@ -6896,6 +6939,7 @@ CONFIG_OVERLAY_FS=m
|
||||
CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y
|
||||
# CONFIG_OVERLAY_FS_INDEX is not set
|
||||
# CONFIG_OVERLAY_FS_METACOPY is not set
|
||||
# CONFIG_OVERLAY_FS_DEBUG is not set
|
||||
|
||||
#
|
||||
# Caches
|
||||
@ -6951,7 +6995,7 @@ CONFIG_SYSFS=y
|
||||
CONFIG_TMPFS=y
|
||||
CONFIG_TMPFS_POSIX_ACL=y
|
||||
CONFIG_TMPFS_XATTR=y
|
||||
CONFIG_MEMFD_CREATE=y
|
||||
# CONFIG_TMPFS_QUOTA is not set
|
||||
CONFIG_CONFIGFS_FS=y
|
||||
# end of Pseudo filesystems
|
||||
|
||||
@ -6993,16 +7037,7 @@ CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
|
||||
# CONFIG_ROMFS_FS is not set
|
||||
CONFIG_PSTORE=y
|
||||
CONFIG_PSTORE_DEFAULT_KMSG_BYTES=10240
|
||||
CONFIG_PSTORE_DEFLATE_COMPRESS=m
|
||||
# CONFIG_PSTORE_LZO_COMPRESS is not set
|
||||
# CONFIG_PSTORE_LZ4_COMPRESS is not set
|
||||
CONFIG_PSTORE_LZ4HC_COMPRESS=m
|
||||
# CONFIG_PSTORE_842_COMPRESS is not set
|
||||
# CONFIG_PSTORE_ZSTD_COMPRESS is not set
|
||||
CONFIG_PSTORE_COMPRESS=y
|
||||
CONFIG_PSTORE_DEFLATE_COMPRESS_DEFAULT=y
|
||||
# CONFIG_PSTORE_LZ4HC_COMPRESS_DEFAULT is not set
|
||||
CONFIG_PSTORE_COMPRESS_DEFAULT="deflate"
|
||||
CONFIG_PSTORE_CONSOLE=y
|
||||
# CONFIG_PSTORE_PMSG is not set
|
||||
# CONFIG_PSTORE_FTRACE is not set
|
||||
@ -7052,8 +7087,6 @@ CONFIG_SUNRPC_GSS=m
|
||||
CONFIG_SUNRPC_BACKCHANNEL=y
|
||||
CONFIG_SUNRPC_SWAP=y
|
||||
CONFIG_RPCSEC_GSS_KRB5=m
|
||||
CONFIG_RPCSEC_GSS_KRB5_CRYPTOSYSTEM=y
|
||||
# CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_DES is not set
|
||||
CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_AES_SHA1=y
|
||||
# CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_CAMELLIA is not set
|
||||
# CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_AES_SHA2 is not set
|
||||
@ -7129,6 +7162,7 @@ CONFIG_NLS_ISO8859_1=y
|
||||
# CONFIG_NLS_MAC_ROMANIAN is not set
|
||||
# CONFIG_NLS_MAC_TURKISH is not set
|
||||
CONFIG_NLS_UTF8=y
|
||||
CONFIG_NLS_UCS2_UTILS=m
|
||||
# CONFIG_DLM is not set
|
||||
# CONFIG_UNICODE is not set
|
||||
CONFIG_IO_WQ=y
|
||||
@ -7190,6 +7224,13 @@ CONFIG_CC_HAS_ZERO_CALL_USED_REGS=y
|
||||
# CONFIG_ZERO_CALL_USED_REGS is not set
|
||||
# end of Memory initialization
|
||||
|
||||
#
|
||||
# Hardening of kernel data structures
|
||||
#
|
||||
# CONFIG_LIST_HARDENED is not set
|
||||
# CONFIG_BUG_ON_DATA_CORRUPTION is not set
|
||||
# end of Hardening of kernel data structures
|
||||
|
||||
CONFIG_RANDSTRUCT_NONE=y
|
||||
# end of Kernel hardening options
|
||||
# end of Security options
|
||||
@ -7549,7 +7590,6 @@ CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE=y
|
||||
CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU=y
|
||||
CONFIG_DMA_NONCOHERENT_MMAP=y
|
||||
CONFIG_DMA_CMA=y
|
||||
# CONFIG_DMA_PERNUMA_CMA is not set
|
||||
|
||||
#
|
||||
# Default contiguous memory area size:
|
||||
@ -7752,7 +7792,6 @@ CONFIG_STACKTRACE=y
|
||||
# CONFIG_DEBUG_PLIST is not set
|
||||
# CONFIG_DEBUG_SG is not set
|
||||
# CONFIG_DEBUG_NOTIFIERS is not set
|
||||
# CONFIG_BUG_ON_DATA_CORRUPTION is not set
|
||||
# CONFIG_DEBUG_MAPLE_TREE is not set
|
||||
# end of Debug kernel data structures
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Linux/arm 6.5.5 Kernel Configuration
|
||||
# Linux/arm 6.6.0 Kernel Configuration
|
||||
#
|
||||
CONFIG_CC_VERSION_TEXT="arm-linux-gnueabihf-gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
|
||||
CONFIG_CC_IS_GCC=y
|
||||
@ -239,7 +239,6 @@ CONFIG_KCMP=y
|
||||
CONFIG_RSEQ=y
|
||||
CONFIG_CACHESTAT_SYSCALL=y
|
||||
# CONFIG_DEBUG_RSEQ is not set
|
||||
CONFIG_EMBEDDED=y
|
||||
CONFIG_HAVE_PERF_EVENTS=y
|
||||
CONFIG_PERF_USE_VMALLOC=y
|
||||
# CONFIG_PC104 is not set
|
||||
@ -254,6 +253,13 @@ CONFIG_PERF_EVENTS=y
|
||||
CONFIG_SYSTEM_DATA_VERIFICATION=y
|
||||
CONFIG_PROFILING=y
|
||||
CONFIG_TRACEPOINTS=y
|
||||
|
||||
#
|
||||
# Kexec and crash features
|
||||
#
|
||||
# CONFIG_KEXEC is not set
|
||||
# CONFIG_CRASH_DUMP is not set
|
||||
# end of Kexec and crash features
|
||||
# end of General setup
|
||||
|
||||
CONFIG_ARM=y
|
||||
@ -486,8 +492,8 @@ CONFIG_ZBOOT_ROM_TEXT=0x0
|
||||
CONFIG_ZBOOT_ROM_BSS=0x0
|
||||
# CONFIG_ARM_APPENDED_DTB is not set
|
||||
CONFIG_CMDLINE=""
|
||||
# CONFIG_KEXEC is not set
|
||||
# CONFIG_CRASH_DUMP is not set
|
||||
CONFIG_ARCH_SUPPORTS_KEXEC=y
|
||||
CONFIG_ARCH_SUPPORTS_CRASH_DUMP=y
|
||||
CONFIG_AUTO_ZRELADDR=y
|
||||
# CONFIG_EFI is not set
|
||||
# end of Boot options
|
||||
@ -814,6 +820,7 @@ CONFIG_SLAB_MERGE_DEFAULT=y
|
||||
# CONFIG_SLAB_FREELIST_HARDENED is not set
|
||||
# CONFIG_SLUB_STATS is not set
|
||||
CONFIG_SLUB_CPU_PARTIAL=y
|
||||
# CONFIG_RANDOM_KMALLOC_CACHES is not set
|
||||
# end of SLAB allocator options
|
||||
|
||||
# CONFIG_SHUFFLE_PAGE_ALLOCATOR is not set
|
||||
@ -835,7 +842,6 @@ CONFIG_BOUNCE=y
|
||||
CONFIG_KSM=y
|
||||
CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
|
||||
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
|
||||
CONFIG_FRONTSWAP=y
|
||||
CONFIG_CMA=y
|
||||
# CONFIG_CMA_DEBUG is not set
|
||||
# CONFIG_CMA_DEBUGFS is not set
|
||||
@ -851,6 +857,7 @@ CONFIG_VM_EVENT_COUNTERS=y
|
||||
# CONFIG_DMAPOOL_TEST is not set
|
||||
CONFIG_KMAP_LOCAL=y
|
||||
CONFIG_KMAP_LOCAL_NON_LINEAR_PTE_ARRAY=y
|
||||
CONFIG_MEMFD_CREATE=y
|
||||
# CONFIG_ANON_VMA_NAME is not set
|
||||
# CONFIG_USERFAULTFD is not set
|
||||
CONFIG_LRU_GEN=y
|
||||
@ -868,6 +875,7 @@ CONFIG_LOCK_MM_AND_FIND_VMA=y
|
||||
CONFIG_NET=y
|
||||
CONFIG_NET_INGRESS=y
|
||||
CONFIG_NET_EGRESS=y
|
||||
CONFIG_NET_XGRESS=y
|
||||
CONFIG_NET_REDIRECT=y
|
||||
CONFIG_SKB_EXTENSIONS=y
|
||||
|
||||
@ -1803,6 +1811,11 @@ CONFIG_ARM_CCI=y
|
||||
# CONFIG_MHI_BUS_EP is not set
|
||||
# end of Bus devices
|
||||
|
||||
#
|
||||
# Cache Drivers
|
||||
#
|
||||
# end of Cache Drivers
|
||||
|
||||
CONFIG_CONNECTOR=y
|
||||
CONFIG_PROC_EVENTS=y
|
||||
|
||||
@ -1991,6 +2004,7 @@ CONFIG_SCSI_VIRTIO=m
|
||||
# CONFIG_ATA is not set
|
||||
CONFIG_MD=y
|
||||
CONFIG_BLK_DEV_MD=m
|
||||
CONFIG_MD_BITMAP_FILE=y
|
||||
CONFIG_MD_LINEAR=m
|
||||
CONFIG_MD_RAID0=m
|
||||
CONFIG_MD_RAID1=m
|
||||
@ -2220,9 +2234,11 @@ CONFIG_BCM_NET_PHYLIB=m
|
||||
# CONFIG_LSI_ET1011C_PHY is not set
|
||||
# CONFIG_MARVELL_PHY is not set
|
||||
# CONFIG_MARVELL_10G_PHY is not set
|
||||
# CONFIG_MARVELL_88Q2XXX_PHY is not set
|
||||
CONFIG_MARVELL_88X2222_PHY=m
|
||||
CONFIG_MAXLINEAR_GPHY=m
|
||||
CONFIG_MEDIATEK_GE_PHY=m
|
||||
# CONFIG_MEDIATEK_GE_SOC_PHY is not set
|
||||
# CONFIG_MICREL_PHY is not set
|
||||
# CONFIG_MICROCHIP_T1S_PHY is not set
|
||||
CONFIG_MICROCHIP_PHY=m
|
||||
@ -2481,6 +2497,8 @@ CONFIG_MT76_SDIO=m
|
||||
CONFIG_MT76x02_LIB=m
|
||||
CONFIG_MT76x02_USB=m
|
||||
CONFIG_MT76_CONNAC_LIB=m
|
||||
CONFIG_MT792x_LIB=m
|
||||
CONFIG_MT792x_USB=m
|
||||
CONFIG_MT76x0_COMMON=m
|
||||
CONFIG_MT76x0U=m
|
||||
CONFIG_MT76x2_COMMON=m
|
||||
@ -2776,6 +2794,7 @@ CONFIG_TOUCHSCREEN_ZET6223=m
|
||||
# CONFIG_TOUCHSCREEN_COLIBRI_VF50 is not set
|
||||
# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set
|
||||
CONFIG_TOUCHSCREEN_IQS5XX=m
|
||||
# CONFIG_TOUCHSCREEN_IQS7211 is not set
|
||||
CONFIG_TOUCHSCREEN_ZINITIX=m
|
||||
# CONFIG_TOUCHSCREEN_HIMAX_HX83112B is not set
|
||||
CONFIG_INPUT_MISC=y
|
||||
@ -3083,6 +3102,7 @@ CONFIG_DP83640_PHY=m
|
||||
# CONFIG_PTP_1588_CLOCK_INES is not set
|
||||
# CONFIG_PTP_1588_CLOCK_IDT82P33 is not set
|
||||
CONFIG_PTP_1588_CLOCK_IDTCM=m
|
||||
# CONFIG_PTP_1588_CLOCK_MOCK is not set
|
||||
# end of PTP clock support
|
||||
|
||||
CONFIG_PINCTRL=y
|
||||
@ -3143,6 +3163,7 @@ CONFIG_GPIO_ROCKCHIP=m
|
||||
#
|
||||
# CONFIG_GPIO_ADNP is not set
|
||||
# CONFIG_GPIO_FXL6408 is not set
|
||||
# CONFIG_GPIO_DS4520 is not set
|
||||
# CONFIG_GPIO_GW_PLD is not set
|
||||
# CONFIG_GPIO_MAX7300 is not set
|
||||
# CONFIG_GPIO_MAX732X is not set
|
||||
@ -3333,6 +3354,7 @@ CONFIG_SENSORS_G760A=m
|
||||
CONFIG_SENSORS_G762=m
|
||||
CONFIG_SENSORS_GPIO_FAN=m
|
||||
CONFIG_SENSORS_HIH6130=m
|
||||
# CONFIG_SENSORS_HS3001 is not set
|
||||
# CONFIG_SENSORS_IIO_HWMON is not set
|
||||
CONFIG_SENSORS_IT87=m
|
||||
CONFIG_SENSORS_JC42=m
|
||||
@ -3421,7 +3443,6 @@ CONFIG_SENSORS_SCH56XX_COMMON=m
|
||||
CONFIG_SENSORS_SCH5627=m
|
||||
CONFIG_SENSORS_SCH5636=m
|
||||
CONFIG_SENSORS_STTS751=m
|
||||
CONFIG_SENSORS_SMM665=m
|
||||
CONFIG_SENSORS_ADC128D818=m
|
||||
CONFIG_SENSORS_ADS7828=m
|
||||
CONFIG_SENSORS_ADS7871=m
|
||||
@ -3528,6 +3549,7 @@ CONFIG_MFD_CORE=y
|
||||
# CONFIG_MFD_BD9571MWV is not set
|
||||
# CONFIG_MFD_AXP20X_I2C is not set
|
||||
CONFIG_MFD_CROS_EC_DEV=y
|
||||
# CONFIG_MFD_CS42L43_I2C is not set
|
||||
CONFIG_MFD_MADERA=m
|
||||
CONFIG_MFD_MADERA_I2C=m
|
||||
# CONFIG_MFD_MADERA_SPI is not set
|
||||
@ -3655,6 +3677,7 @@ CONFIG_REGULATOR_ACT8865=y
|
||||
# CONFIG_REGULATOR_ARIZONA_MICSUPP is not set
|
||||
CONFIG_REGULATOR_ARM_SCMI=m
|
||||
CONFIG_REGULATOR_ATC260X=m
|
||||
# CONFIG_REGULATOR_AW37503 is not set
|
||||
CONFIG_REGULATOR_BD718XX=m
|
||||
CONFIG_REGULATOR_BD957XMUF=m
|
||||
CONFIG_REGULATOR_CPCAP=m
|
||||
@ -3675,6 +3698,7 @@ CONFIG_REGULATOR_FAN53880=m
|
||||
# CONFIG_REGULATOR_LTC3676 is not set
|
||||
# CONFIG_REGULATOR_MAX1586 is not set
|
||||
CONFIG_REGULATOR_MAX77650=m
|
||||
# CONFIG_REGULATOR_MAX77857 is not set
|
||||
# CONFIG_REGULATOR_MAX8649 is not set
|
||||
# CONFIG_REGULATOR_MAX8660 is not set
|
||||
CONFIG_REGULATOR_MAX8893=m
|
||||
@ -3711,6 +3735,7 @@ CONFIG_REGULATOR_RT6245=m
|
||||
CONFIG_REGULATOR_RTQ2134=m
|
||||
CONFIG_REGULATOR_RTMV20=m
|
||||
CONFIG_REGULATOR_RTQ6752=m
|
||||
# CONFIG_REGULATOR_RTQ2208 is not set
|
||||
# CONFIG_REGULATOR_SLG51000 is not set
|
||||
# CONFIG_REGULATOR_STPMIC1 is not set
|
||||
# CONFIG_REGULATOR_SY8106A is not set
|
||||
@ -3804,6 +3829,8 @@ CONFIG_V4L2_VP9=m
|
||||
CONFIG_V4L2_MEM2MEM_DEV=m
|
||||
CONFIG_V4L2_FWNODE=y
|
||||
CONFIG_V4L2_ASYNC=y
|
||||
CONFIG_V4L2_CCI=m
|
||||
CONFIG_V4L2_CCI_I2C=m
|
||||
# end of Video4Linux options
|
||||
|
||||
#
|
||||
@ -4224,6 +4251,7 @@ CONFIG_VIDEO_ET8EK8=m
|
||||
# CONFIG_VIDEO_AD5820 is not set
|
||||
CONFIG_VIDEO_AK7375=m
|
||||
# CONFIG_VIDEO_DW9714 is not set
|
||||
# CONFIG_VIDEO_DW9719 is not set
|
||||
CONFIG_VIDEO_DW9768=m
|
||||
CONFIG_VIDEO_DW9807_VCM=m
|
||||
# end of Lens drivers
|
||||
@ -4344,6 +4372,14 @@ CONFIG_VIDEO_ST_MIPID02=m
|
||||
CONFIG_VIDEO_THS7303=m
|
||||
# end of Miscellaneous helper chips
|
||||
|
||||
#
|
||||
# Video serializers and deserializers
|
||||
#
|
||||
# CONFIG_VIDEO_DS90UB913 is not set
|
||||
# CONFIG_VIDEO_DS90UB953 is not set
|
||||
# CONFIG_VIDEO_DS90UB960 is not set
|
||||
# end of Video serializers and deserializers
|
||||
|
||||
#
|
||||
# Media SPI Adapters
|
||||
#
|
||||
@ -4567,6 +4603,7 @@ CONFIG_DVB_SP2=m
|
||||
CONFIG_APERTURE_HELPERS=y
|
||||
CONFIG_VIDEO_CMDLINE=y
|
||||
CONFIG_VIDEO_NOMODESET=y
|
||||
# CONFIG_AUXDISPLAY is not set
|
||||
CONFIG_DRM=y
|
||||
CONFIG_DRM_MIPI_DBI=m
|
||||
CONFIG_DRM_MIPI_DSI=y
|
||||
@ -4701,6 +4738,7 @@ CONFIG_DRM_PANEL_SITRONIX_ST7703=m
|
||||
CONFIG_DRM_PANEL_SONY_ACX565AKM=m
|
||||
# CONFIG_DRM_PANEL_SONY_TD4353_JDI is not set
|
||||
# CONFIG_DRM_PANEL_SONY_TULIP_TRULY_NT35521 is not set
|
||||
# CONFIG_DRM_PANEL_STARTEK_KD070FHFID015 is not set
|
||||
CONFIG_DRM_PANEL_TDO_TL070WSH30=m
|
||||
CONFIG_DRM_PANEL_TPO_TD028TTEC1=m
|
||||
CONFIG_DRM_PANEL_TPO_TD043MTEA1=m
|
||||
@ -4708,6 +4746,7 @@ CONFIG_DRM_PANEL_TPO_TPG110=m
|
||||
# CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA is not set
|
||||
# CONFIG_DRM_PANEL_VISIONOX_RM69299 is not set
|
||||
# CONFIG_DRM_PANEL_VISIONOX_VTDR6130 is not set
|
||||
# CONFIG_DRM_PANEL_VISIONOX_R66451 is not set
|
||||
CONFIG_DRM_PANEL_WIDECHIPS_WS2401=m
|
||||
# CONFIG_DRM_PANEL_XINPENG_XPP055C272 is not set
|
||||
# end of Display Panels
|
||||
@ -4794,24 +4833,7 @@ CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y
|
||||
#
|
||||
# Frame buffer Devices
|
||||
#
|
||||
CONFIG_FB_NOTIFY=y
|
||||
CONFIG_FB=y
|
||||
# CONFIG_FIRMWARE_EDID is not set
|
||||
CONFIG_FB_SYS_FILLRECT=y
|
||||
CONFIG_FB_SYS_COPYAREA=y
|
||||
CONFIG_FB_SYS_IMAGEBLIT=y
|
||||
# CONFIG_FB_FOREIGN_ENDIAN is not set
|
||||
CONFIG_FB_SYS_FOPS=y
|
||||
CONFIG_FB_DEFERRED_IO=y
|
||||
CONFIG_FB_SYS_HELPERS=y
|
||||
CONFIG_FB_SYS_HELPERS_DEFERRED=y
|
||||
CONFIG_FB_BACKLIGHT=m
|
||||
CONFIG_FB_MODE_HELPERS=y
|
||||
# CONFIG_FB_TILEBLITTING is not set
|
||||
|
||||
#
|
||||
# Frame buffer hardware drivers
|
||||
#
|
||||
# CONFIG_FB_ARMCLCD is not set
|
||||
# CONFIG_FB_UVESA is not set
|
||||
# CONFIG_FB_OPENCORES is not set
|
||||
@ -4823,6 +4845,22 @@ CONFIG_FB_MODE_HELPERS=y
|
||||
# CONFIG_FB_METRONOME is not set
|
||||
# CONFIG_FB_SIMPLE is not set
|
||||
# CONFIG_FB_SSD1307 is not set
|
||||
CONFIG_FB_CORE=y
|
||||
CONFIG_FB_NOTIFY=y
|
||||
# CONFIG_FIRMWARE_EDID is not set
|
||||
CONFIG_FB_DEVICE=y
|
||||
CONFIG_FB_SYS_FILLRECT=y
|
||||
CONFIG_FB_SYS_COPYAREA=y
|
||||
CONFIG_FB_SYS_IMAGEBLIT=y
|
||||
# CONFIG_FB_FOREIGN_ENDIAN is not set
|
||||
CONFIG_FB_SYS_FOPS=y
|
||||
CONFIG_FB_DEFERRED_IO=y
|
||||
CONFIG_FB_DMAMEM_HELPERS=y
|
||||
CONFIG_FB_SYSMEM_HELPERS=y
|
||||
CONFIG_FB_SYSMEM_HELPERS_DEFERRED=y
|
||||
CONFIG_FB_BACKLIGHT=m
|
||||
CONFIG_FB_MODE_HELPERS=y
|
||||
# CONFIG_FB_TILEBLITTING is not set
|
||||
# end of Frame buffer Devices
|
||||
|
||||
#
|
||||
@ -5009,8 +5047,10 @@ CONFIG_SND_SOC_AK4458=m
|
||||
# CONFIG_SND_SOC_AK5386 is not set
|
||||
CONFIG_SND_SOC_AK5558=m
|
||||
# CONFIG_SND_SOC_ALC5623 is not set
|
||||
# CONFIG_SND_SOC_AUDIO_IIO_AUX is not set
|
||||
# CONFIG_SND_SOC_AW8738 is not set
|
||||
# CONFIG_SND_SOC_AW88395 is not set
|
||||
# CONFIG_SND_SOC_AW88261 is not set
|
||||
CONFIG_SND_SOC_BD28623=m
|
||||
# CONFIG_SND_SOC_BT_SCO is not set
|
||||
# CONFIG_SND_SOC_CHV3_CODEC is not set
|
||||
@ -5237,6 +5277,7 @@ CONFIG_HID_HOLTEK=m
|
||||
CONFIG_HOLTEK_FF=y
|
||||
CONFIG_HID_VIVALDI_COMMON=m
|
||||
CONFIG_HID_GOOGLE_HAMMER=m
|
||||
# CONFIG_HID_GOOGLE_STADIA_FF is not set
|
||||
CONFIG_HID_VIVALDI=m
|
||||
CONFIG_HID_GT683R=m
|
||||
CONFIG_HID_KEYTOUCH=m
|
||||
@ -5604,6 +5645,7 @@ CONFIG_USB_CONFIGFS_F_FS=y
|
||||
# CONFIG_USB_CONFIGFS_F_UAC1_LEGACY is not set
|
||||
# CONFIG_USB_CONFIGFS_F_UAC2 is not set
|
||||
# CONFIG_USB_CONFIGFS_F_MIDI is not set
|
||||
# CONFIG_USB_CONFIGFS_F_MIDI2 is not set
|
||||
# CONFIG_USB_CONFIGFS_F_HID is not set
|
||||
# CONFIG_USB_CONFIGFS_F_UVC is not set
|
||||
# CONFIG_USB_CONFIGFS_F_PRINTER is not set
|
||||
@ -5712,6 +5754,7 @@ CONFIG_LEDS_LP55XX_COMMON=m
|
||||
# CONFIG_LEDS_LP8860 is not set
|
||||
# CONFIG_LEDS_PCA955X is not set
|
||||
# CONFIG_LEDS_PCA963X is not set
|
||||
# CONFIG_LEDS_PCA995X is not set
|
||||
# CONFIG_LEDS_DAC124S085 is not set
|
||||
# CONFIG_LEDS_PWM is not set
|
||||
# CONFIG_LEDS_REGULATOR is not set
|
||||
@ -5742,6 +5785,7 @@ CONFIG_LEDS_USER=m
|
||||
#
|
||||
# RGB LED drivers
|
||||
#
|
||||
# CONFIG_LEDS_GROUP_MULTICOLOR is not set
|
||||
# CONFIG_LEDS_PWM_MULTICOLOR is not set
|
||||
|
||||
#
|
||||
@ -5875,7 +5919,6 @@ CONFIG_RTC_DRV_RX6110=m
|
||||
# CONFIG_RTC_DRV_M48T35 is not set
|
||||
# CONFIG_RTC_DRV_M48T59 is not set
|
||||
# CONFIG_RTC_DRV_MSM6242 is not set
|
||||
# CONFIG_RTC_DRV_BQ4802 is not set
|
||||
# CONFIG_RTC_DRV_RP5C01 is not set
|
||||
# CONFIG_RTC_DRV_ZYNQMP is not set
|
||||
# CONFIG_RTC_DRV_CROS_EC is not set
|
||||
@ -5914,6 +5957,7 @@ CONFIG_FSL_QDMA=m
|
||||
# CONFIG_INTEL_IDMA64 is not set
|
||||
# CONFIG_NBPFAXI_DMA is not set
|
||||
CONFIG_PL330_DMA=y
|
||||
# CONFIG_XILINX_DMA is not set
|
||||
# CONFIG_XILINX_XDMA is not set
|
||||
CONFIG_XILINX_ZYNQMP_DPDMA=m
|
||||
# CONFIG_QCOM_HIDMA_MGMT is not set
|
||||
@ -5943,7 +5987,6 @@ CONFIG_DMABUF_HEAPS_SYSTEM=y
|
||||
CONFIG_DMABUF_HEAPS_CMA=y
|
||||
# end of DMABUF options
|
||||
|
||||
# CONFIG_AUXDISPLAY is not set
|
||||
# CONFIG_UIO is not set
|
||||
# CONFIG_VFIO is not set
|
||||
# CONFIG_VIRT_DRIVERS is not set
|
||||
@ -6106,6 +6149,7 @@ CONFIG_COMMON_CLK_AXI_CLKGEN=m
|
||||
# CONFIG_COMMON_CLK_PWM is not set
|
||||
# CONFIG_COMMON_CLK_RS9_PCIE is not set
|
||||
# CONFIG_COMMON_CLK_SI521XX is not set
|
||||
# CONFIG_COMMON_CLK_VC3 is not set
|
||||
CONFIG_COMMON_CLK_VC5=m
|
||||
# CONFIG_COMMON_CLK_VC7 is not set
|
||||
# CONFIG_COMMON_CLK_BD718XX is not set
|
||||
@ -6469,6 +6513,8 @@ CONFIG_HID_SENSOR_IIO_COMMON=m
|
||||
CONFIG_HID_SENSOR_IIO_TRIGGER=m
|
||||
# end of Hid Sensor IIO Common
|
||||
|
||||
CONFIG_IIO_INV_SENSORS_TIMESTAMP=m
|
||||
|
||||
#
|
||||
# IIO SCMI Sensors
|
||||
#
|
||||
@ -6522,6 +6568,7 @@ CONFIG_AD5766=m
|
||||
# CONFIG_MAX5522 is not set
|
||||
# CONFIG_MAX5821 is not set
|
||||
# CONFIG_MCP4725 is not set
|
||||
# CONFIG_MCP4728 is not set
|
||||
# CONFIG_MCP4922 is not set
|
||||
# CONFIG_TI_DAC082S085 is not set
|
||||
CONFIG_TI_DAC5571=m
|
||||
@ -6798,6 +6845,7 @@ CONFIG_HID_SENSOR_PRESS=m
|
||||
# Proximity and distance sensors
|
||||
#
|
||||
CONFIG_CROS_EC_MKBP_PROXIMITY=m
|
||||
# CONFIG_IRSD200 is not set
|
||||
CONFIG_ISL29501=m
|
||||
# CONFIG_LIDAR_LITE_V2 is not set
|
||||
CONFIG_MB1232=m
|
||||
@ -6985,6 +7033,7 @@ CONFIG_MOST_SND=m
|
||||
CONFIG_DCACHE_WORD_ACCESS=y
|
||||
CONFIG_VALIDATE_FS_PARSER=y
|
||||
CONFIG_FS_IOMAP=y
|
||||
CONFIG_BUFFER_HEAD=y
|
||||
CONFIG_LEGACY_DIRECT_IO=y
|
||||
CONFIG_EXT2_FS=y
|
||||
# CONFIG_EXT2_FS_XATTR is not set
|
||||
@ -7015,9 +7064,10 @@ CONFIG_XFS_POSIX_ACL=y
|
||||
CONFIG_XFS_RT=y
|
||||
CONFIG_XFS_DRAIN_INTENTS=y
|
||||
CONFIG_XFS_ONLINE_SCRUB=y
|
||||
CONFIG_XFS_ONLINE_SCRUB_STATS=y
|
||||
# CONFIG_XFS_ONLINE_REPAIR is not set
|
||||
# CONFIG_XFS_WARN is not set
|
||||
# CONFIG_XFS_DEBUG is not set
|
||||
CONFIG_XFS_DEBUG=y
|
||||
CONFIG_XFS_ASSERT_FATAL=y
|
||||
# CONFIG_GFS2_FS is not set
|
||||
# CONFIG_OCFS2_FS is not set
|
||||
CONFIG_BTRFS_FS=y
|
||||
@ -7070,6 +7120,7 @@ CONFIG_OVERLAY_FS=m
|
||||
CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y
|
||||
# CONFIG_OVERLAY_FS_INDEX is not set
|
||||
# CONFIG_OVERLAY_FS_METACOPY is not set
|
||||
# CONFIG_OVERLAY_FS_DEBUG is not set
|
||||
|
||||
#
|
||||
# Caches
|
||||
@ -7123,7 +7174,7 @@ CONFIG_SYSFS=y
|
||||
CONFIG_TMPFS=y
|
||||
CONFIG_TMPFS_POSIX_ACL=y
|
||||
CONFIG_TMPFS_XATTR=y
|
||||
CONFIG_MEMFD_CREATE=y
|
||||
# CONFIG_TMPFS_QUOTA is not set
|
||||
CONFIG_CONFIGFS_FS=y
|
||||
# end of Pseudo filesystems
|
||||
|
||||
@ -7165,16 +7216,7 @@ CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
|
||||
# CONFIG_ROMFS_FS is not set
|
||||
CONFIG_PSTORE=y
|
||||
CONFIG_PSTORE_DEFAULT_KMSG_BYTES=10240
|
||||
CONFIG_PSTORE_DEFLATE_COMPRESS=m
|
||||
# CONFIG_PSTORE_LZO_COMPRESS is not set
|
||||
# CONFIG_PSTORE_LZ4_COMPRESS is not set
|
||||
CONFIG_PSTORE_LZ4HC_COMPRESS=m
|
||||
# CONFIG_PSTORE_842_COMPRESS is not set
|
||||
# CONFIG_PSTORE_ZSTD_COMPRESS is not set
|
||||
CONFIG_PSTORE_COMPRESS=y
|
||||
CONFIG_PSTORE_DEFLATE_COMPRESS_DEFAULT=y
|
||||
# CONFIG_PSTORE_LZ4HC_COMPRESS_DEFAULT is not set
|
||||
CONFIG_PSTORE_COMPRESS_DEFAULT="deflate"
|
||||
CONFIG_PSTORE_CONSOLE=y
|
||||
# CONFIG_PSTORE_PMSG is not set
|
||||
# CONFIG_PSTORE_FTRACE is not set
|
||||
@ -7231,8 +7273,6 @@ CONFIG_SUNRPC_GSS=m
|
||||
CONFIG_SUNRPC_BACKCHANNEL=y
|
||||
CONFIG_SUNRPC_SWAP=y
|
||||
CONFIG_RPCSEC_GSS_KRB5=m
|
||||
CONFIG_RPCSEC_GSS_KRB5_CRYPTOSYSTEM=y
|
||||
# CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_DES is not set
|
||||
CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_AES_SHA1=y
|
||||
# CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_CAMELLIA is not set
|
||||
# CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_AES_SHA2 is not set
|
||||
@ -7308,6 +7348,7 @@ CONFIG_NLS_ISO8859_1=y
|
||||
# CONFIG_NLS_MAC_ROMANIAN is not set
|
||||
# CONFIG_NLS_MAC_TURKISH is not set
|
||||
CONFIG_NLS_UTF8=y
|
||||
CONFIG_NLS_UCS2_UTILS=m
|
||||
# CONFIG_DLM is not set
|
||||
# CONFIG_UNICODE is not set
|
||||
CONFIG_IO_WQ=y
|
||||
@ -7362,6 +7403,13 @@ CONFIG_CC_HAS_ZERO_CALL_USED_REGS=y
|
||||
# CONFIG_ZERO_CALL_USED_REGS is not set
|
||||
# end of Memory initialization
|
||||
|
||||
#
|
||||
# Hardening of kernel data structures
|
||||
#
|
||||
# CONFIG_LIST_HARDENED is not set
|
||||
# CONFIG_BUG_ON_DATA_CORRUPTION is not set
|
||||
# end of Hardening of kernel data structures
|
||||
|
||||
CONFIG_RANDSTRUCT_NONE=y
|
||||
# end of Kernel hardening options
|
||||
# end of Security options
|
||||
@ -7722,7 +7770,6 @@ CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE=y
|
||||
CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU=y
|
||||
CONFIG_DMA_NONCOHERENT_MMAP=y
|
||||
CONFIG_DMA_CMA=y
|
||||
# CONFIG_DMA_PERNUMA_CMA is not set
|
||||
|
||||
#
|
||||
# Default contiguous memory area size:
|
||||
@ -7928,7 +7975,6 @@ CONFIG_STACKTRACE=y
|
||||
# CONFIG_DEBUG_PLIST is not set
|
||||
# CONFIG_DEBUG_SG is not set
|
||||
# CONFIG_DEBUG_NOTIFIERS is not set
|
||||
# CONFIG_BUG_ON_DATA_CORRUPTION is not set
|
||||
# CONFIG_DEBUG_MAPLE_TREE is not set
|
||||
# end of Debug kernel data structures
|
||||
|
||||
|
||||
@ -36,8 +36,8 @@ case $BRANCH in
|
||||
|
||||
edge)
|
||||
|
||||
declare -g KERNEL_MAJOR_MINOR="6.5" # Major and minor versions of this kernel.
|
||||
KERNELBRANCH='branch:linux-6.5.y'
|
||||
declare -g KERNEL_MAJOR_MINOR="6.6" # Major and minor versions of this kernel.
|
||||
KERNELBRANCH='branch:linux-6.6.y'
|
||||
|
||||
;;
|
||||
|
||||
|
||||
@ -34,8 +34,8 @@ case $BRANCH in
|
||||
|
||||
edge)
|
||||
|
||||
declare -g KERNEL_MAJOR_MINOR="6.5" # Major and minor versions of this kernel.
|
||||
KERNELBRANCH='branch:linux-6.5.y'
|
||||
declare -g KERNEL_MAJOR_MINOR="6.6" # Major and minor versions of this kernel.
|
||||
KERNELBRANCH='branch:linux-6.6.y'
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
35
patch/kernel/archive/rk322x-6.6/0000.patching_config.yaml
Normal file
35
patch/kernel/archive/rk322x-6.6/0000.patching_config.yaml
Normal file
@ -0,0 +1,35 @@
|
||||
config:
|
||||
# Just some info stuff; not used by the patching scripts
|
||||
name: rk322x-6.6
|
||||
kind: kernel
|
||||
type: mainline # or: vendor
|
||||
branch: linux-6.6.y
|
||||
last-known-good-tag: v6.6.0
|
||||
maintainers:
|
||||
- { github: paolo.sabatino, name: Paolo Sabatino, email: paolo.sabatino@gmail.com, armbian-forum: jock }
|
||||
|
||||
# .dts files in these directories will be copied as-is to the build tree; later ones overwrite earlier ones.
|
||||
# This is meant to provide a way to "add a board DTS" without having to null-patch them in.
|
||||
dts-directories:
|
||||
- { source: "dt", target: "arch/arm/boot/dts/rockchip" }
|
||||
|
||||
# every file in these directories will be copied as-is to the build tree; later ones overwrite earlier ones
|
||||
# This is meant as a way to have overlays, bare, in a directory, without having to null-patch them in.
|
||||
# @TODO need a solution to auto-Makefile the overlays as well
|
||||
overlay-directories:
|
||||
- { source: "overlay", target: "arch/arm/boot/dts/rockchip/overlay" }
|
||||
|
||||
# the Makefile in each of these directories will be magically patched to include the dts files copied
|
||||
# or patched-in; overlay subdir will be included "-y" if it exists.
|
||||
# No more Makefile patching needed, yay!
|
||||
auto-patch-dt-makefile:
|
||||
- { directory: "arch/arm/boot/dts/rockchip", config-var: "CONFIG_ARCH_ROCKCHIP" }
|
||||
|
||||
# configuration for when applying patches to git / auto-rewriting patches (development cycle helpers)
|
||||
patches-to-git:
|
||||
do-not-commit-files:
|
||||
- "MAINTAINERS" # constant churn, drop them. sorry.
|
||||
- "Documentation/devicetree/bindings/arm/rockchip.yaml" # constant churn, conflicts on every bump, drop it. sorry.
|
||||
do-not-commit-regexes: # Python-style regexes
|
||||
- "^arch/([a-zA-Z0-9]+)/boot/dts/([a-zA-Z0-9]+)/Makefile$" # ignore DT Makefile patches, we've an auto-patcher now
|
||||
|
||||
@ -0,0 +1,131 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Sun, 17 Feb 2019 22:14:38 +0000
|
||||
Subject: [PATCH] mmc: core: set initial signal voltage on power off
|
||||
|
||||
Some boards have SD card connectors where the power rail cannot be switched
|
||||
off by the driver. If the card has not been power cycled, it may still be
|
||||
using 1.8V signaling after a warm re-boot. Bootroms expecting 3.3V signaling
|
||||
will fail to boot from a UHS card that continue to use 1.8V signaling.
|
||||
|
||||
Set initial signal voltage in mmc_power_off() to allow re-boot to function.
|
||||
|
||||
This fixes re-boot with UHS cards on Asus Tinker Board (Rockchip RK3288),
|
||||
same issue have been seen on some Rockchip RK3399 boards.
|
||||
|
||||
I am sending this as a RFC because I have no insights into SD/MMC subsystem,
|
||||
this change fix a re-boot issue on my boards and does not break emmc/sdio.
|
||||
Is this an acceptable workaround? Any advice is appreciated.
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
drivers/mmc/core/core.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
|
||||
index ef53a2578824..d4c53074154a 100644
|
||||
--- a/drivers/mmc/core/core.c
|
||||
+++ b/drivers/mmc/core/core.c
|
||||
@@ -1358,6 +1358,14 @@ void mmc_power_off(struct mmc_host *host)
|
||||
if (host->ios.power_mode == MMC_POWER_OFF)
|
||||
return;
|
||||
|
||||
+ mmc_set_initial_signal_voltage(host);
|
||||
+
|
||||
+ /*
|
||||
+ * This delay should be sufficient to allow the power supply
|
||||
+ * to reach the minimum voltage.
|
||||
+ */
|
||||
+ mmc_delay(host->ios.power_delay_ms);
|
||||
+
|
||||
mmc_pwrseq_power_off(host);
|
||||
|
||||
host->ios.clock = 0;
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Wed, 23 Jun 2021 16:59:18 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: Add sdmmc_ext for RK3328
|
||||
|
||||
RK3328 SoC has a fourth mmc controller called SDMMC_EXT. Some
|
||||
boards have sdio wifi connected to it. In order to use it
|
||||
one would have to add the pinctrls from sdmmc0ext group which
|
||||
is done on board level.
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328.dtsi | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
index 49ae15708a0b..60348d517efb 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
@@ -993,6 +993,20 @@ usb_host0_ohci: usb@ff5d0000 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ sdmmc_ext: mmc@ff5f0000 {
|
||||
+ compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc";
|
||||
+ reg = <0x0 0xff5f0000 0x0 0x4000>;
|
||||
+ interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru HCLK_SDMMC_EXT>, <&cru SCLK_SDMMC_EXT>,
|
||||
+ <&cru SCLK_SDMMC_EXT_DRV>, <&cru SCLK_SDMMC_EXT_SAMPLE>;
|
||||
+ clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
|
||||
+ fifo-depth = <0x100>;
|
||||
+ max-frequency = <150000000>;
|
||||
+ resets = <&cru SRST_SDMMCEXT>;
|
||||
+ reset-names = "reset";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
usbdrd3: usb@ff600000 {
|
||||
compatible = "rockchip,rk3328-dwc3", "snps,dwc3";
|
||||
reg = <0x0 0xff600000 0x0 0x100000>;
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Wed, 23 Jun 2021 17:02:08 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: Add sdmmc/sdio/emmc reset controls for
|
||||
RK3328
|
||||
|
||||
The DW MCI controller driver will use them to reset the IP block before
|
||||
initialisation.
|
||||
|
||||
Fixes: d717f7352ec6 ("arm64: dts: rockchip: add sdmmc/sdio/emmc nodes for RK3328 SoCs")
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328.dtsi | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
index 60348d517efb..d7e44d174d7b 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
@@ -871,6 +871,8 @@ sdmmc: mmc@ff500000 {
|
||||
clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
|
||||
fifo-depth = <0x100>;
|
||||
max-frequency = <150000000>;
|
||||
+ resets = <&cru SRST_MMC0>;
|
||||
+ reset-names = "reset";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -883,6 +885,8 @@ sdio: mmc@ff510000 {
|
||||
clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
|
||||
fifo-depth = <0x100>;
|
||||
max-frequency = <150000000>;
|
||||
+ resets = <&cru SRST_SDIO>;
|
||||
+ reset-names = "reset";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -895,6 +899,8 @@ emmc: mmc@ff520000 {
|
||||
clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
|
||||
fifo-depth = <0x100>;
|
||||
max-frequency = <150000000>;
|
||||
+ resets = <&cru SRST_EMMC>;
|
||||
+ reset-names = "reset";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -0,0 +1,659 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Mon, 6 Jul 2020 21:54:35 +0000
|
||||
Subject: [PATCH] media: v4l2-common: Add helpers to calculate bytesperline and
|
||||
sizeimage
|
||||
|
||||
Add helper functions to calculate plane bytesperline and sizeimage, these
|
||||
new helpers consider block width and height when calculating plane
|
||||
bytesperline and sizeimage.
|
||||
|
||||
This prepare support for new pixel formats added in next patch that make
|
||||
use of block width and height.
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
drivers/media/v4l2-core/v4l2-common.c | 77 +++++++++++++--------------
|
||||
1 file changed, 38 insertions(+), 39 deletions(-)
|
||||
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
|
||||
index e0fbe6ba4b6c..cb2f1acab7cf 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-common.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-common.c
|
||||
@@ -338,6 +338,33 @@ static inline unsigned int v4l2_format_block_height(const struct v4l2_format_inf
|
||||
return info->block_h[plane];
|
||||
}
|
||||
|
||||
+static inline unsigned int v4l2_format_plane_width(const struct v4l2_format_info *info, int plane,
|
||||
+ unsigned int width)
|
||||
+{
|
||||
+ unsigned int hdiv = plane ? info->hdiv : 1;
|
||||
+ unsigned int bytes = DIV_ROUND_UP(width * info->bpp[plane],
|
||||
+ v4l2_format_block_width(info, plane) *
|
||||
+ v4l2_format_block_height(info, plane));
|
||||
+
|
||||
+ return DIV_ROUND_UP(bytes, hdiv);
|
||||
+}
|
||||
+
|
||||
+static inline unsigned int v4l2_format_plane_height(const struct v4l2_format_info *info, int plane,
|
||||
+ unsigned int height)
|
||||
+{
|
||||
+ unsigned int vdiv = plane ? info->vdiv : 1;
|
||||
+ unsigned int lines = ALIGN(height, v4l2_format_block_height(info, plane));
|
||||
+
|
||||
+ return DIV_ROUND_UP(lines, vdiv);
|
||||
+}
|
||||
+
|
||||
+static inline unsigned int v4l2_format_plane_size(const struct v4l2_format_info *info, int plane,
|
||||
+ unsigned int width, unsigned int height)
|
||||
+{
|
||||
+ return v4l2_format_plane_width(info, plane, width) *
|
||||
+ v4l2_format_plane_height(info, plane, height);
|
||||
+}
|
||||
+
|
||||
void v4l2_apply_frmsize_constraints(u32 *width, u32 *height,
|
||||
const struct v4l2_frmsize_stepwise *frmsize)
|
||||
{
|
||||
@@ -373,37 +400,19 @@ int v4l2_fill_pixfmt_mp(struct v4l2_pix_format_mplane *pixfmt,
|
||||
|
||||
if (info->mem_planes == 1) {
|
||||
plane = &pixfmt->plane_fmt[0];
|
||||
- plane->bytesperline = ALIGN(width, v4l2_format_block_width(info, 0)) * info->bpp[0] / info->bpp_div[0];
|
||||
+ plane->bytesperline = v4l2_format_plane_width(info, 0, width);
|
||||
plane->sizeimage = 0;
|
||||
|
||||
- for (i = 0; i < info->comp_planes; i++) {
|
||||
- unsigned int hdiv = (i == 0) ? 1 : info->hdiv;
|
||||
- unsigned int vdiv = (i == 0) ? 1 : info->vdiv;
|
||||
- unsigned int aligned_width;
|
||||
- unsigned int aligned_height;
|
||||
-
|
||||
- aligned_width = ALIGN(width, v4l2_format_block_width(info, i));
|
||||
- aligned_height = ALIGN(height, v4l2_format_block_height(info, i));
|
||||
-
|
||||
- plane->sizeimage += info->bpp[i] *
|
||||
- DIV_ROUND_UP(aligned_width, hdiv) *
|
||||
- DIV_ROUND_UP(aligned_height, vdiv) / info->bpp_div[i];
|
||||
- }
|
||||
+ for (i = 0; i < info->comp_planes; i++)
|
||||
+ plane->sizeimage +=
|
||||
+ v4l2_format_plane_size(info, i, width, height);
|
||||
} else {
|
||||
for (i = 0; i < info->comp_planes; i++) {
|
||||
- unsigned int hdiv = (i == 0) ? 1 : info->hdiv;
|
||||
- unsigned int vdiv = (i == 0) ? 1 : info->vdiv;
|
||||
- unsigned int aligned_width;
|
||||
- unsigned int aligned_height;
|
||||
-
|
||||
- aligned_width = ALIGN(width, v4l2_format_block_width(info, i));
|
||||
- aligned_height = ALIGN(height, v4l2_format_block_height(info, i));
|
||||
-
|
||||
plane = &pixfmt->plane_fmt[i];
|
||||
plane->bytesperline =
|
||||
- info->bpp[i] * DIV_ROUND_UP(aligned_width, hdiv) / info->bpp_div[i];
|
||||
- plane->sizeimage =
|
||||
- plane->bytesperline * DIV_ROUND_UP(aligned_height, vdiv);
|
||||
+ v4l2_format_plane_width(info, i, width);
|
||||
+ plane->sizeimage = plane->bytesperline *
|
||||
+ v4l2_format_plane_height(info, i, height);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -427,22 +436,12 @@ int v4l2_fill_pixfmt(struct v4l2_pix_format *pixfmt, u32 pixelformat,
|
||||
pixfmt->width = width;
|
||||
pixfmt->height = height;
|
||||
pixfmt->pixelformat = pixelformat;
|
||||
- pixfmt->bytesperline = ALIGN(width, v4l2_format_block_width(info, 0)) * info->bpp[0] / info->bpp_div[0];
|
||||
+ pixfmt->bytesperline = v4l2_format_plane_width(info, 0, width);
|
||||
pixfmt->sizeimage = 0;
|
||||
|
||||
- for (i = 0; i < info->comp_planes; i++) {
|
||||
- unsigned int hdiv = (i == 0) ? 1 : info->hdiv;
|
||||
- unsigned int vdiv = (i == 0) ? 1 : info->vdiv;
|
||||
- unsigned int aligned_width;
|
||||
- unsigned int aligned_height;
|
||||
-
|
||||
- aligned_width = ALIGN(width, v4l2_format_block_width(info, i));
|
||||
- aligned_height = ALIGN(height, v4l2_format_block_height(info, i));
|
||||
-
|
||||
- pixfmt->sizeimage += info->bpp[i] *
|
||||
- DIV_ROUND_UP(aligned_width, hdiv) *
|
||||
- DIV_ROUND_UP(aligned_height, vdiv) / info->bpp_div[i];
|
||||
- }
|
||||
+ for (i = 0; i < info->comp_planes; i++)
|
||||
+ pixfmt->sizeimage +=
|
||||
+ v4l2_format_plane_size(info, i, width, height);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(v4l2_fill_pixfmt);
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Mon, 6 Jul 2020 21:54:36 +0000
|
||||
Subject: [PATCH] media: v4l2: Add NV15 and NV20 pixel formats
|
||||
|
||||
Add NV15 and NV20 pixel formats used by the Rockchip Video Decoder for
|
||||
10-bit buffers.
|
||||
|
||||
NV15 and NV20 is a packed 10-bit 4:2:0/4:2:2 semi-planar Y/UV format
|
||||
similar to P010 and P210 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' and '20' suffix refers to the optimum effective bits per pixel
|
||||
which is achieved when the total number of luminance samples is a multiple
|
||||
of 8 for NV15 and 4 for NV20.
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
drivers/media/v4l2-core/v4l2-common.c | 3 +++
|
||||
drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++
|
||||
include/uapi/linux/videodev2.h | 3 +++
|
||||
3 files changed, 8 insertions(+)
|
||||
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
|
||||
index cb2f1acab7cf..8446a1deffd8 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-common.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-common.c
|
||||
@@ -268,6 +268,9 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
|
||||
{ .format = V4L2_PIX_FMT_NV42, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
|
||||
{ .format = V4L2_PIX_FMT_P010, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 2, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 2, .vdiv = 1 },
|
||||
|
||||
+ { .format = V4L2_PIX_FMT_NV15, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 5, 5, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 2, .vdiv = 2, .block_w = { 4, 2, 0, 0 }, .block_h = { 1, 1, 0, 0 } },
|
||||
+ { .format = V4L2_PIX_FMT_NV20, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 5, 5, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 2, .vdiv = 1, .block_w = { 4, 2, 0, 0 }, .block_h = { 1, 1, 0, 0 } },
|
||||
+
|
||||
{ .format = V4L2_PIX_FMT_YUV410, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 4, .vdiv = 4 },
|
||||
{ .format = V4L2_PIX_FMT_YVU410, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 4, .vdiv = 4 },
|
||||
{ .format = V4L2_PIX_FMT_YUV411P, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 4, .vdiv = 1 },
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
|
||||
index e6fd355a2e92..24771edaa4f2 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
|
||||
@@ -1354,6 +1354,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
|
||||
case V4L2_PIX_FMT_NV42: descr = "Y/VU 4:4:4"; break;
|
||||
case V4L2_PIX_FMT_P010: descr = "10-bit Y/UV 4:2:0"; break;
|
||||
case V4L2_PIX_FMT_P012: descr = "12-bit Y/UV 4:2:0"; break;
|
||||
+ case V4L2_PIX_FMT_NV15: descr = "10-bit Y/UV 4:2:0 (Packed)"; break;
|
||||
+ case V4L2_PIX_FMT_NV20: descr = "10-bit Y/UV 4:2:2 (Packed)"; break;
|
||||
case V4L2_PIX_FMT_NV12_4L4: descr = "Y/UV 4:2:0 (4x4 Linear)"; break;
|
||||
case V4L2_PIX_FMT_NV12_16L16: descr = "Y/UV 4:2:0 (16x16 Linear)"; break;
|
||||
case V4L2_PIX_FMT_NV12_32L32: descr = "Y/UV 4:2:0 (32x32 Linear)"; break;
|
||||
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
|
||||
index 01e630f2ec78..cea44992aea3 100644
|
||||
--- a/include/uapi/linux/videodev2.h
|
||||
+++ b/include/uapi/linux/videodev2.h
|
||||
@@ -628,6 +628,9 @@ struct v4l2_pix_format {
|
||||
#define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/VU 4:4:4 */
|
||||
#define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 24 Y/UV 4:2:0 10-bit per component */
|
||||
|
||||
+#define V4L2_PIX_FMT_NV15 v4l2_fourcc('N', 'V', '1', '5') /* 15 Y/UV 4:2:0 10-bit packed */
|
||||
+#define V4L2_PIX_FMT_NV20 v4l2_fourcc('N', 'V', '2', '0') /* 20 Y/UV 4:2:2 10-bit packed */
|
||||
+
|
||||
/* two non contiguous planes - one Y, one Cr + Cb interleaved */
|
||||
#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/UV 4:2:0 */
|
||||
#define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1') /* 21 Y/VU 4:2:0 */
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Mon, 6 Jul 2020 21:54:36 +0000
|
||||
Subject: [PATCH] media: rkvdec: h264: Use bytesperline and buffer height to
|
||||
calculate stride
|
||||
|
||||
Use bytesperline and buffer height to calculate the strides configured.
|
||||
|
||||
This does not really change anything other than ensuring the bytesperline
|
||||
that is signaled to userspace matches what is configured in HW.
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
drivers/staging/media/rkvdec/rkvdec-h264.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c
|
||||
index 4fc167b42cf0..a8635105e387 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec-h264.c
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec-h264.c
|
||||
@@ -896,9 +896,9 @@ static void config_registers(struct rkvdec_ctx *ctx,
|
||||
dma_addr_t rlc_addr;
|
||||
dma_addr_t refer_addr;
|
||||
u32 rlc_len;
|
||||
- u32 hor_virstride = 0;
|
||||
- u32 ver_virstride = 0;
|
||||
- u32 y_virstride = 0;
|
||||
+ u32 hor_virstride;
|
||||
+ u32 ver_virstride;
|
||||
+ u32 y_virstride;
|
||||
u32 yuv_virstride = 0;
|
||||
u32 offset;
|
||||
dma_addr_t dst_addr;
|
||||
@@ -909,8 +909,8 @@ static void config_registers(struct rkvdec_ctx *ctx,
|
||||
|
||||
f = &ctx->decoded_fmt;
|
||||
dst_fmt = &f->fmt.pix_mp;
|
||||
- hor_virstride = (sps->bit_depth_luma_minus8 + 8) * dst_fmt->width / 8;
|
||||
- ver_virstride = round_up(dst_fmt->height, 16);
|
||||
+ hor_virstride = dst_fmt->plane_fmt[0].bytesperline;
|
||||
+ ver_virstride = dst_fmt->height;
|
||||
y_virstride = hor_virstride * ver_virstride;
|
||||
|
||||
if (sps->chroma_format_idc == 0)
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Mon, 6 Jul 2020 21:54:37 +0000
|
||||
Subject: [PATCH] media: rkvdec: Extract rkvdec_fill_decoded_pixfmt helper
|
||||
method
|
||||
|
||||
This extract setting decoded pixfmt into a helper method, current code is
|
||||
replaced with a call to the new helper method.
|
||||
|
||||
The helper method is also called from a new function in next patch.
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
drivers/staging/media/rkvdec/rkvdec.c | 29 ++++++++++++++-------------
|
||||
1 file changed, 15 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
index 7bab7586918c..40cc791aef26 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec.c
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
@@ -27,6 +27,17 @@
|
||||
#include "rkvdec.h"
|
||||
#include "rkvdec-regs.h"
|
||||
|
||||
+static void rkvdec_fill_decoded_pixfmt(struct rkvdec_ctx *ctx,
|
||||
+ struct v4l2_pix_format_mplane *pix_mp)
|
||||
+{
|
||||
+ v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat,
|
||||
+ pix_mp->width, pix_mp->height);
|
||||
+ pix_mp->plane_fmt[0].sizeimage += 128 *
|
||||
+ DIV_ROUND_UP(pix_mp->width, 16) *
|
||||
+ DIV_ROUND_UP(pix_mp->height, 16);
|
||||
+ pix_mp->field = V4L2_FIELD_NONE;
|
||||
+}
|
||||
+
|
||||
static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl)
|
||||
{
|
||||
struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl);
|
||||
@@ -192,13 +203,9 @@ static void rkvdec_reset_decoded_fmt(struct rkvdec_ctx *ctx)
|
||||
|
||||
rkvdec_reset_fmt(ctx, f, ctx->coded_fmt_desc->decoded_fmts[0]);
|
||||
f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||
- v4l2_fill_pixfmt_mp(&f->fmt.pix_mp,
|
||||
- ctx->coded_fmt_desc->decoded_fmts[0],
|
||||
- ctx->coded_fmt.fmt.pix_mp.width,
|
||||
- ctx->coded_fmt.fmt.pix_mp.height);
|
||||
- f->fmt.pix_mp.plane_fmt[0].sizeimage += 128 *
|
||||
- DIV_ROUND_UP(f->fmt.pix_mp.width, 16) *
|
||||
- DIV_ROUND_UP(f->fmt.pix_mp.height, 16);
|
||||
+ f->fmt.pix_mp.width = ctx->coded_fmt.fmt.pix_mp.width;
|
||||
+ f->fmt.pix_mp.height = ctx->coded_fmt.fmt.pix_mp.height;
|
||||
+ rkvdec_fill_decoded_pixfmt(ctx, &f->fmt.pix_mp);
|
||||
}
|
||||
|
||||
static int rkvdec_enum_framesizes(struct file *file, void *priv,
|
||||
@@ -264,13 +271,7 @@ static int rkvdec_try_capture_fmt(struct file *file, void *priv,
|
||||
&pix_mp->height,
|
||||
&coded_desc->frmsize);
|
||||
|
||||
- v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat,
|
||||
- pix_mp->width, pix_mp->height);
|
||||
- pix_mp->plane_fmt[0].sizeimage +=
|
||||
- 128 *
|
||||
- DIV_ROUND_UP(pix_mp->width, 16) *
|
||||
- DIV_ROUND_UP(pix_mp->height, 16);
|
||||
- pix_mp->field = V4L2_FIELD_NONE;
|
||||
+ rkvdec_fill_decoded_pixfmt(ctx, pix_mp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Mon, 6 Jul 2020 21:54:37 +0000
|
||||
Subject: [PATCH] media: rkvdec: Lock capture pixel format in s_ctrl and s_fmt
|
||||
|
||||
Add an optional valid_fmt operation that should return the valid
|
||||
pixelformat of CAPTURE buffers.
|
||||
|
||||
This is used in next patch to ensure correct pixelformat is used for 10-bit
|
||||
and 4:2:2 content.
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
drivers/staging/media/rkvdec/rkvdec.c | 67 +++++++++++++++++++++++----
|
||||
drivers/staging/media/rkvdec/rkvdec.h | 2 +
|
||||
2 files changed, 61 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
index 40cc791aef26..e93e1cb0f829 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec.c
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
@@ -38,19 +38,56 @@ static void rkvdec_fill_decoded_pixfmt(struct rkvdec_ctx *ctx,
|
||||
pix_mp->field = V4L2_FIELD_NONE;
|
||||
}
|
||||
|
||||
+static u32 rkvdec_valid_fmt(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl)
|
||||
+{
|
||||
+ const struct rkvdec_coded_fmt_desc *coded_desc = ctx->coded_fmt_desc;
|
||||
+
|
||||
+ if (coded_desc->ops->valid_fmt)
|
||||
+ return coded_desc->ops->valid_fmt(ctx, ctrl);
|
||||
+
|
||||
+ return ctx->valid_fmt;
|
||||
+}
|
||||
+
|
||||
static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl)
|
||||
{
|
||||
struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl);
|
||||
const struct rkvdec_coded_fmt_desc *desc = ctx->coded_fmt_desc;
|
||||
|
||||
- if (desc->ops->try_ctrl)
|
||||
- return desc->ops->try_ctrl(ctx, ctrl);
|
||||
+ if (desc->ops->try_ctrl) {
|
||||
+ int ret;
|
||||
+ ret = desc->ops->try_ctrl(ctx, ctrl);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ if (ctx->valid_fmt && ctx->valid_fmt != rkvdec_valid_fmt(ctx, ctrl))
|
||||
+ /* Only current valid format */
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rkvdec_s_ctrl(struct v4l2_ctrl *ctrl)
|
||||
+{
|
||||
+ struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl);
|
||||
+
|
||||
+ if (ctrl->id == V4L2_CID_STATELESS_H264_SPS && !ctx->valid_fmt) {
|
||||
+ ctx->valid_fmt = rkvdec_valid_fmt(ctx, ctrl);
|
||||
+ if (ctx->valid_fmt) {
|
||||
+ struct v4l2_pix_format_mplane *pix_mp;
|
||||
+
|
||||
+ pix_mp = &ctx->decoded_fmt.fmt.pix_mp;
|
||||
+ pix_mp->pixelformat = ctx->valid_fmt;
|
||||
+ rkvdec_fill_decoded_pixfmt(ctx, pix_mp);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct v4l2_ctrl_ops rkvdec_ctrl_ops = {
|
||||
.try_ctrl = rkvdec_try_ctrl,
|
||||
+ .s_ctrl = rkvdec_s_ctrl,
|
||||
};
|
||||
|
||||
static const struct rkvdec_ctrl_desc rkvdec_h264_ctrl_descs[] = {
|
||||
@@ -201,6 +238,7 @@ static void rkvdec_reset_decoded_fmt(struct rkvdec_ctx *ctx)
|
||||
{
|
||||
struct v4l2_format *f = &ctx->decoded_fmt;
|
||||
|
||||
+ ctx->valid_fmt = 0;
|
||||
rkvdec_reset_fmt(ctx, f, ctx->coded_fmt_desc->decoded_fmts[0]);
|
||||
f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||
f->fmt.pix_mp.width = ctx->coded_fmt.fmt.pix_mp.width;
|
||||
@@ -256,13 +294,17 @@ static int rkvdec_try_capture_fmt(struct file *file, void *priv,
|
||||
if (WARN_ON(!coded_desc))
|
||||
return -EINVAL;
|
||||
|
||||
- for (i = 0; i < coded_desc->num_decoded_fmts; i++) {
|
||||
- if (coded_desc->decoded_fmts[i] == pix_mp->pixelformat)
|
||||
- break;
|
||||
- }
|
||||
+ if (ctx->valid_fmt) {
|
||||
+ pix_mp->pixelformat = ctx->valid_fmt;
|
||||
+ } else {
|
||||
+ for (i = 0; i < coded_desc->num_decoded_fmts; i++) {
|
||||
+ if (coded_desc->decoded_fmts[i] == pix_mp->pixelformat)
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
- if (i == coded_desc->num_decoded_fmts)
|
||||
- pix_mp->pixelformat = coded_desc->decoded_fmts[0];
|
||||
+ if (i == coded_desc->num_decoded_fmts)
|
||||
+ pix_mp->pixelformat = coded_desc->decoded_fmts[0];
|
||||
+ }
|
||||
|
||||
/* Always apply the frmsize constraint of the coded end. */
|
||||
pix_mp->width = max(pix_mp->width, ctx->coded_fmt.fmt.pix_mp.width);
|
||||
@@ -326,6 +368,7 @@ static int rkvdec_s_capture_fmt(struct file *file, void *priv,
|
||||
return ret;
|
||||
|
||||
ctx->decoded_fmt = *f;
|
||||
+ ctx->valid_fmt = f->fmt.pix_mp.pixelformat;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -429,6 +472,14 @@ static int rkvdec_enum_capture_fmt(struct file *file, void *priv,
|
||||
if (WARN_ON(!ctx->coded_fmt_desc))
|
||||
return -EINVAL;
|
||||
|
||||
+ if (ctx->valid_fmt) {
|
||||
+ if (f->index)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ f->pixelformat = ctx->valid_fmt;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
if (f->index >= ctx->coded_fmt_desc->num_decoded_fmts)
|
||||
return -EINVAL;
|
||||
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h
|
||||
index 633335ebb9c4..b9e219438bc9 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec.h
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec.h
|
||||
@@ -66,6 +66,7 @@ vb2_to_rkvdec_decoded_buf(struct vb2_buffer *buf)
|
||||
struct rkvdec_coded_fmt_ops {
|
||||
int (*adjust_fmt)(struct rkvdec_ctx *ctx,
|
||||
struct v4l2_format *f);
|
||||
+ u32 (*valid_fmt)(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl);
|
||||
int (*start)(struct rkvdec_ctx *ctx);
|
||||
void (*stop)(struct rkvdec_ctx *ctx);
|
||||
int (*run)(struct rkvdec_ctx *ctx);
|
||||
@@ -101,6 +102,7 @@ struct rkvdec_ctx {
|
||||
struct v4l2_fh fh;
|
||||
struct v4l2_format coded_fmt;
|
||||
struct v4l2_format decoded_fmt;
|
||||
+ u32 valid_fmt;
|
||||
const struct rkvdec_coded_fmt_desc *coded_fmt_desc;
|
||||
struct v4l2_ctrl_handler ctrl_hdl;
|
||||
struct rkvdec_dev *dev;
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Mon, 6 Jul 2020 21:54:37 +0000
|
||||
Subject: [PATCH] media: rkvdec: h264: Support High 10 and 4:2:2 profiles
|
||||
|
||||
Add support and enable decoding of H264 High 10 and 4:2:2 profiles.
|
||||
|
||||
Decoded CAPTURE buffer width is aligned to 64 pixels to accommodate HW
|
||||
requirement on 10-bit format buffers.
|
||||
|
||||
The new valid_fmt operation is implemented and return a valid pixelformat
|
||||
for the provided SPS control.
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
drivers/staging/media/rkvdec/rkvdec-h264.c | 33 ++++++++++++++++------
|
||||
drivers/staging/media/rkvdec/rkvdec.c | 19 +++++++++----
|
||||
2 files changed, 37 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c
|
||||
index a8635105e387..0069d3d198db 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec-h264.c
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec-h264.c
|
||||
@@ -1031,19 +1031,14 @@ static int rkvdec_h264_validate_sps(struct rkvdec_ctx *ctx,
|
||||
{
|
||||
unsigned int width, height;
|
||||
|
||||
- /*
|
||||
- * 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 */
|
||||
+ if (sps->chroma_format_idc > 2)
|
||||
+ /* Only 4:0:0, 4:2:0 and 4:2:2 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 */
|
||||
+ if (sps->bit_depth_luma_minus8 != 0 && sps->bit_depth_luma_minus8 != 2)
|
||||
+ /* Only 8-bit and 10-bit is supported */
|
||||
return -EINVAL;
|
||||
|
||||
width = (sps->pic_width_in_mbs_minus1 + 1) * 16;
|
||||
@@ -1064,6 +1059,25 @@ static int rkvdec_h264_validate_sps(struct rkvdec_ctx *ctx,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static u32 rkvdec_h264_valid_fmt(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl)
|
||||
+{
|
||||
+ const struct v4l2_ctrl_h264_sps *sps = ctrl->p_new.p_h264_sps;
|
||||
+
|
||||
+ if (sps->bit_depth_luma_minus8 == 0) {
|
||||
+ if (sps->chroma_format_idc == 2)
|
||||
+ return V4L2_PIX_FMT_NV16;
|
||||
+ else
|
||||
+ return V4L2_PIX_FMT_NV12;
|
||||
+ } else if (sps->bit_depth_luma_minus8 == 2) {
|
||||
+ if (sps->chroma_format_idc == 2)
|
||||
+ return V4L2_PIX_FMT_NV20;
|
||||
+ else
|
||||
+ return V4L2_PIX_FMT_NV15;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int rkvdec_h264_start(struct rkvdec_ctx *ctx)
|
||||
{
|
||||
struct rkvdec_dev *rkvdec = ctx->dev;
|
||||
@@ -1185,6 +1199,7 @@ static int rkvdec_h264_try_ctrl(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl)
|
||||
|
||||
const struct rkvdec_coded_fmt_ops rkvdec_h264_fmt_ops = {
|
||||
.adjust_fmt = rkvdec_h264_adjust_fmt,
|
||||
+ .valid_fmt = rkvdec_h264_valid_fmt,
|
||||
.start = rkvdec_h264_start,
|
||||
.stop = rkvdec_h264_stop,
|
||||
.run = rkvdec_h264_run,
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
index e93e1cb0f829..4f5436c89e08 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec.c
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
@@ -31,7 +31,7 @@ static void rkvdec_fill_decoded_pixfmt(struct rkvdec_ctx *ctx,
|
||||
struct v4l2_pix_format_mplane *pix_mp)
|
||||
{
|
||||
v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat,
|
||||
- pix_mp->width, pix_mp->height);
|
||||
+ ALIGN(pix_mp->width, 64), pix_mp->height);
|
||||
pix_mp->plane_fmt[0].sizeimage += 128 *
|
||||
DIV_ROUND_UP(pix_mp->width, 16) *
|
||||
DIV_ROUND_UP(pix_mp->height, 16);
|
||||
@@ -136,8 +136,11 @@ static const struct rkvdec_ctrls rkvdec_h264_ctrls = {
|
||||
.num_ctrls = ARRAY_SIZE(rkvdec_h264_ctrl_descs),
|
||||
};
|
||||
|
||||
-static const u32 rkvdec_h264_vp9_decoded_fmts[] = {
|
||||
+static const u32 rkvdec_h264_decoded_fmts[] = {
|
||||
V4L2_PIX_FMT_NV12,
|
||||
+ V4L2_PIX_FMT_NV15,
|
||||
+ V4L2_PIX_FMT_NV16,
|
||||
+ V4L2_PIX_FMT_NV20,
|
||||
};
|
||||
|
||||
static const struct rkvdec_ctrl_desc rkvdec_vp9_ctrl_descs[] = {
|
||||
@@ -160,6 +163,10 @@ static const struct rkvdec_ctrls rkvdec_vp9_ctrls = {
|
||||
.num_ctrls = ARRAY_SIZE(rkvdec_vp9_ctrl_descs),
|
||||
};
|
||||
|
||||
+static const u32 rkvdec_vp9_decoded_fmts[] = {
|
||||
+ V4L2_PIX_FMT_NV12,
|
||||
+};
|
||||
+
|
||||
static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = {
|
||||
{
|
||||
.fourcc = V4L2_PIX_FMT_H264_SLICE,
|
||||
@@ -173,8 +180,8 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = {
|
||||
},
|
||||
.ctrls = &rkvdec_h264_ctrls,
|
||||
.ops = &rkvdec_h264_fmt_ops,
|
||||
- .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_vp9_decoded_fmts),
|
||||
- .decoded_fmts = rkvdec_h264_vp9_decoded_fmts,
|
||||
+ .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_decoded_fmts),
|
||||
+ .decoded_fmts = rkvdec_h264_decoded_fmts,
|
||||
.subsystem_flags = VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF,
|
||||
},
|
||||
{
|
||||
@@ -189,8 +196,8 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = {
|
||||
},
|
||||
.ctrls = &rkvdec_vp9_ctrls,
|
||||
.ops = &rkvdec_vp9_fmt_ops,
|
||||
- .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_vp9_decoded_fmts),
|
||||
- .decoded_fmts = rkvdec_h264_vp9_decoded_fmts,
|
||||
+ .num_decoded_fmts = ARRAY_SIZE(rkvdec_vp9_decoded_fmts),
|
||||
+ .decoded_fmts = rkvdec_vp9_decoded_fmts,
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Sun, 27 Mar 2022 14:18:07 +0200
|
||||
Subject: [PATCH] media: rkvdec-h264: Don't hardcode SPS/PPS parameters
|
||||
|
||||
Some SPS/PPS parameters are currently hardcoded in the driver
|
||||
even though so do exist in the uapi which is stable by now.
|
||||
|
||||
Use them instead of hardcoding them.
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
drivers/staging/media/rkvdec/rkvdec-h264.c | 13 +++++++------
|
||||
1 file changed, 7 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c
|
||||
index 0069d3d198db..2c27acaba85e 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec-h264.c
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec-h264.c
|
||||
@@ -655,13 +655,14 @@ static void assemble_hw_pps(struct rkvdec_ctx *ctx,
|
||||
|
||||
#define WRITE_PPS(value, field) set_ps_field(hw_ps->info, field, value)
|
||||
/* write sps */
|
||||
- WRITE_PPS(0xf, SEQ_PARAMETER_SET_ID);
|
||||
- WRITE_PPS(0xff, PROFILE_IDC);
|
||||
- WRITE_PPS(1, CONSTRAINT_SET3_FLAG);
|
||||
+ WRITE_PPS(sps->seq_parameter_set_id, SEQ_PARAMETER_SET_ID);
|
||||
+ WRITE_PPS(sps->profile_idc, PROFILE_IDC);
|
||||
+ WRITE_PPS((sps->constraint_set_flags & 1 << 3) ? 1 : 0, CONSTRAINT_SET3_FLAG);
|
||||
WRITE_PPS(sps->chroma_format_idc, CHROMA_FORMAT_IDC);
|
||||
WRITE_PPS(sps->bit_depth_luma_minus8, BIT_DEPTH_LUMA);
|
||||
WRITE_PPS(sps->bit_depth_chroma_minus8, BIT_DEPTH_CHROMA);
|
||||
- WRITE_PPS(0, QPPRIME_Y_ZERO_TRANSFORM_BYPASS_FLAG);
|
||||
+ WRITE_PPS(!!(sps->flags & V4L2_H264_SPS_FLAG_QPPRIME_Y_ZERO_TRANSFORM_BYPASS),
|
||||
+ QPPRIME_Y_ZERO_TRANSFORM_BYPASS_FLAG);
|
||||
WRITE_PPS(sps->log2_max_frame_num_minus4, LOG2_MAX_FRAME_NUM_MINUS4);
|
||||
WRITE_PPS(sps->max_num_ref_frames, MAX_NUM_REF_FRAMES);
|
||||
WRITE_PPS(sps->pic_order_cnt_type, PIC_ORDER_CNT_TYPE);
|
||||
@@ -688,8 +689,8 @@ static void assemble_hw_pps(struct rkvdec_ctx *ctx,
|
||||
DIRECT_8X8_INFERENCE_FLAG);
|
||||
|
||||
/* write pps */
|
||||
- WRITE_PPS(0xff, PIC_PARAMETER_SET_ID);
|
||||
- WRITE_PPS(0x1f, PPS_SEQ_PARAMETER_SET_ID);
|
||||
+ WRITE_PPS(pps->pic_parameter_set_id, PIC_PARAMETER_SET_ID);
|
||||
+ WRITE_PPS(pps->seq_parameter_set_id, PPS_SEQ_PARAMETER_SET_ID);
|
||||
WRITE_PPS(!!(pps->flags & V4L2_H264_PPS_FLAG_ENTROPY_CODING_MODE),
|
||||
ENTROPY_CODING_MODE_FLAG);
|
||||
WRITE_PPS(!!(pps->flags & V4L2_H264_PPS_FLAG_BOTTOM_FIELD_PIC_ORDER_IN_FRAME_PRESENT),
|
||||
@ -0,0 +1,236 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Mon, 6 Jul 2020 22:30:13 +0000
|
||||
Subject: [PATCH] drm: drm_fourcc: add NV20 and NV30 YUV formats
|
||||
|
||||
DRM_FORMAT_NV20 and DRM_FORMAT_NV30 formats is the 2x1 and non-subsampled
|
||||
variant of NV15, a 10-bit 2-plane YUV format that 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 '20' and '30' suffix refers to the optimum effective bits per pixel
|
||||
which is achieved when the total number of luminance samples is a multiple
|
||||
of 4.
|
||||
|
||||
V2: Added NV30 format
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
Reviewed-by: Sandy Huang <hjc@rock-chips.com>
|
||||
---
|
||||
drivers/gpu/drm/drm_fourcc.c | 8 ++++++++
|
||||
include/uapi/drm/drm_fourcc.h | 2 ++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
|
||||
index 07741b678798..5ec38456dc5d 100644
|
||||
--- a/drivers/gpu/drm/drm_fourcc.c
|
||||
+++ b/drivers/gpu/drm/drm_fourcc.c
|
||||
@@ -261,6 +261,14 @@ const struct drm_format_info *__drm_format_info(u32 format)
|
||||
.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_NV20, .depth = 0,
|
||||
+ .num_planes = 2, .char_per_block = { 5, 5, 0 },
|
||||
+ .block_w = { 4, 2, 0 }, .block_h = { 1, 1, 0 }, .hsub = 2,
|
||||
+ .vsub = 1, .is_yuv = true },
|
||||
+ { .format = DRM_FORMAT_NV30, .depth = 0,
|
||||
+ .num_planes = 2, .char_per_block = { 5, 5, 0 },
|
||||
+ .block_w = { 4, 2, 0 }, .block_h = { 1, 1, 0 }, .hsub = 1,
|
||||
+ .vsub = 1, .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,
|
||||
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
|
||||
index 0206f812c569..fa49ee98f275 100644
|
||||
--- a/include/uapi/drm/drm_fourcc.h
|
||||
+++ b/include/uapi/drm/drm_fourcc.h
|
||||
@@ -285,6 +285,8 @@ extern "C" {
|
||||
* 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 */
|
||||
+#define DRM_FORMAT_NV20 fourcc_code('N', 'V', '2', '0') /* 2x1 subsampled Cr:Cb plane */
|
||||
+#define DRM_FORMAT_NV30 fourcc_code('N', 'V', '3', '0') /* non-subsampled Cr:Cb plane */
|
||||
|
||||
/*
|
||||
* 2 plane YCbCr MSB aligned
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Mon, 6 Jul 2020 22:30:13 +0000
|
||||
Subject: [PATCH] drm: rockchip: add NV15, NV20 and NV30 support
|
||||
|
||||
Add support for displaying 10-bit 4:2:0 and 4:2:2 formats produced by the
|
||||
Rockchip Video Decoder on RK322X, RK3288, RK3328, RK3368 and RK3399.
|
||||
Also add support for 10-bit 4:4:4 format while at it.
|
||||
|
||||
V2: Added NV30 support
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
Reviewed-by: Sandy Huang <hjc@rock-chips.com>
|
||||
---
|
||||
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 29 +++++++++++++++++--
|
||||
drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 1 +
|
||||
drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 32 +++++++++++++++++----
|
||||
3 files changed, 54 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
|
||||
index d32117633efe..9e71263ac770 100644
|
||||
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
|
||||
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
|
||||
@@ -280,6 +280,18 @@ static bool has_uv_swapped(uint32_t format)
|
||||
}
|
||||
}
|
||||
|
||||
+static bool is_fmt_10(uint32_t format)
|
||||
+{
|
||||
+ switch (format) {
|
||||
+ case DRM_FORMAT_NV15:
|
||||
+ case DRM_FORMAT_NV20:
|
||||
+ case DRM_FORMAT_NV30:
|
||||
+ return true;
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static enum vop_data_format vop_convert_format(uint32_t format)
|
||||
{
|
||||
switch (format) {
|
||||
@@ -295,12 +307,15 @@ static enum vop_data_format vop_convert_format(uint32_t format)
|
||||
case DRM_FORMAT_BGR565:
|
||||
return VOP_FMT_RGB565;
|
||||
case DRM_FORMAT_NV12:
|
||||
+ case DRM_FORMAT_NV15:
|
||||
case DRM_FORMAT_NV21:
|
||||
return VOP_FMT_YUV420SP;
|
||||
case DRM_FORMAT_NV16:
|
||||
+ case DRM_FORMAT_NV20:
|
||||
case DRM_FORMAT_NV61:
|
||||
return VOP_FMT_YUV422SP;
|
||||
case DRM_FORMAT_NV24:
|
||||
+ case DRM_FORMAT_NV30:
|
||||
case DRM_FORMAT_NV42:
|
||||
return VOP_FMT_YUV444SP;
|
||||
default:
|
||||
@@ -954,7 +969,12 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
|
||||
dsp_sty = dest->y1 + crtc->mode.vtotal - crtc->mode.vsync_start;
|
||||
dsp_st = dsp_sty << 16 | (dsp_stx & 0xffff);
|
||||
|
||||
- offset = (src->x1 >> 16) * fb->format->cpp[0];
|
||||
+ if (fb->format->block_w[0])
|
||||
+ offset = (src->x1 >> 16) * fb->format->char_per_block[0] /
|
||||
+ fb->format->block_w[0];
|
||||
+ else
|
||||
+ offset = (src->x1 >> 16) * fb->format->cpp[0];
|
||||
+
|
||||
offset += (src->y1 >> 16) * fb->pitches[0];
|
||||
dma_addr = rk_obj->dma_addr + offset + fb->offsets[0];
|
||||
|
||||
@@ -980,6 +1000,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
|
||||
}
|
||||
|
||||
VOP_WIN_SET(vop, win, format, format);
|
||||
+ VOP_WIN_SET(vop, win, fmt_10, is_fmt_10(fb->format->format));
|
||||
VOP_WIN_SET(vop, win, yrgb_vir, DIV_ROUND_UP(fb->pitches[0], 4));
|
||||
VOP_WIN_SET(vop, win, yrgb_mst, dma_addr);
|
||||
VOP_WIN_YUV2YUV_SET(vop, win_yuv2yuv, y2r_en, is_yuv);
|
||||
@@ -996,7 +1017,11 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
|
||||
uv_obj = fb->obj[1];
|
||||
rk_uv_obj = to_rockchip_obj(uv_obj);
|
||||
|
||||
- offset = (src->x1 >> 16) * bpp / hsub;
|
||||
+ if (fb->format->block_w[1])
|
||||
+ offset = (src->x1 >> 16) * bpp /
|
||||
+ fb->format->block_w[1] / hsub;
|
||||
+ else
|
||||
+ offset = (src->x1 >> 16) * bpp / hsub;
|
||||
offset += (src->y1 >> 16) * fb->pitches[1] / vsub;
|
||||
|
||||
dma_addr = rk_uv_obj->dma_addr + offset + fb->offsets[1];
|
||||
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
|
||||
index 8502849833d9..b6eea31109d5 100644
|
||||
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
|
||||
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
|
||||
@@ -181,6 +181,7 @@ struct vop_win_phy {
|
||||
struct vop_reg enable;
|
||||
struct vop_reg gate;
|
||||
struct vop_reg format;
|
||||
+ struct vop_reg fmt_10;
|
||||
struct vop_reg rb_swap;
|
||||
struct vop_reg uv_swap;
|
||||
struct vop_reg act_info;
|
||||
diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
|
||||
index 014f99e8928e..16e6aa01e400 100644
|
||||
--- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
|
||||
+++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
|
||||
@@ -53,6 +53,23 @@ static const uint32_t formats_win_full[] = {
|
||||
DRM_FORMAT_NV42,
|
||||
};
|
||||
|
||||
+static const uint32_t formats_win_full_10[] = {
|
||||
+ DRM_FORMAT_XRGB8888,
|
||||
+ DRM_FORMAT_ARGB8888,
|
||||
+ DRM_FORMAT_XBGR8888,
|
||||
+ DRM_FORMAT_ABGR8888,
|
||||
+ DRM_FORMAT_RGB888,
|
||||
+ DRM_FORMAT_BGR888,
|
||||
+ DRM_FORMAT_RGB565,
|
||||
+ DRM_FORMAT_BGR565,
|
||||
+ DRM_FORMAT_NV12,
|
||||
+ DRM_FORMAT_NV16,
|
||||
+ DRM_FORMAT_NV24,
|
||||
+ DRM_FORMAT_NV15,
|
||||
+ DRM_FORMAT_NV20,
|
||||
+ DRM_FORMAT_NV30,
|
||||
+};
|
||||
+
|
||||
static const uint64_t format_modifiers_win_full[] = {
|
||||
DRM_FORMAT_MOD_LINEAR,
|
||||
DRM_FORMAT_MOD_INVALID,
|
||||
@@ -621,11 +638,12 @@ static const struct vop_scl_regs rk3288_win_full_scl = {
|
||||
|
||||
static const struct vop_win_phy rk3288_win01_data = {
|
||||
.scl = &rk3288_win_full_scl,
|
||||
- .data_formats = formats_win_full,
|
||||
- .nformats = ARRAY_SIZE(formats_win_full),
|
||||
+ .data_formats = formats_win_full_10,
|
||||
+ .nformats = ARRAY_SIZE(formats_win_full_10),
|
||||
.format_modifiers = format_modifiers_win_full,
|
||||
.enable = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 0),
|
||||
.format = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1),
|
||||
+ .fmt_10 = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 4),
|
||||
.rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12),
|
||||
.uv_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 15),
|
||||
.act_info = VOP_REG(RK3288_WIN0_ACT_INFO, 0x1fff1fff, 0),
|
||||
@@ -756,11 +774,12 @@ static const struct vop_intr rk3368_vop_intr = {
|
||||
|
||||
static const struct vop_win_phy rk3368_win01_data = {
|
||||
.scl = &rk3288_win_full_scl,
|
||||
- .data_formats = formats_win_full,
|
||||
- .nformats = ARRAY_SIZE(formats_win_full),
|
||||
+ .data_formats = formats_win_full_10,
|
||||
+ .nformats = ARRAY_SIZE(formats_win_full_10),
|
||||
.format_modifiers = format_modifiers_win_full,
|
||||
.enable = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 0),
|
||||
.format = VOP_REG(RK3368_WIN0_CTRL0, 0x7, 1),
|
||||
+ .fmt_10 = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 4),
|
||||
.rb_swap = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 12),
|
||||
.uv_swap = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 15),
|
||||
.x_mir_en = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 21),
|
||||
@@ -924,11 +943,12 @@ static const struct vop_win_yuv2yuv_data rk3399_vop_big_win_yuv2yuv_data[] = {
|
||||
|
||||
static const struct vop_win_phy rk3399_win01_data = {
|
||||
.scl = &rk3288_win_full_scl,
|
||||
- .data_formats = formats_win_full,
|
||||
- .nformats = ARRAY_SIZE(formats_win_full),
|
||||
+ .data_formats = formats_win_full_10,
|
||||
+ .nformats = ARRAY_SIZE(formats_win_full_10),
|
||||
.format_modifiers = format_modifiers_win_full_afbc,
|
||||
.enable = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 0),
|
||||
.format = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1),
|
||||
+ .fmt_10 = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 4),
|
||||
.rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12),
|
||||
.uv_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 15),
|
||||
.x_mir_en = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 21),
|
||||
3041
patch/kernel/archive/rk322x-6.6/01-linux-1000-drm-rockchip.patch
Normal file
3041
patch/kernel/archive/rk322x-6.6/01-linux-1000-drm-rockchip.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,542 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Sat, 23 May 2020 10:16:01 +0000
|
||||
Subject: [PATCH] WIP: media: rkvdec: pm runtime dont use autosuspend before
|
||||
disable and cleanup
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
drivers/staging/media/rkvdec/rkvdec.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
index 4f5436c89e08..eaf2f133a264 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec.c
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
@@ -1125,9 +1125,9 @@ static int rkvdec_remove(struct platform_device *pdev)
|
||||
|
||||
cancel_delayed_work_sync(&rkvdec->watchdog_work);
|
||||
|
||||
- rkvdec_v4l2_cleanup(rkvdec);
|
||||
- pm_runtime_disable(&pdev->dev);
|
||||
pm_runtime_dont_use_autosuspend(&pdev->dev);
|
||||
+ pm_runtime_disable(&pdev->dev);
|
||||
+ rkvdec_v4l2_cleanup(rkvdec);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Randy Li <ayaka@soulik.info>
|
||||
Date: Sun, 6 Jan 2019 01:48:37 +0800
|
||||
Subject: [PATCH] soc: rockchip: power-domain: export idle request
|
||||
|
||||
We need to put the power status of HEVC IP into IDLE unless
|
||||
we can't reset that IP or the SoC would crash down.
|
||||
rockchip_pmu_idle_request(dev, true)---> enter idle
|
||||
rockchip_pmu_idle_request(dev, false)---> exit idle
|
||||
|
||||
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
|
||||
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
|
||||
Signed-off-by: Randy Li <ayaka@soulik.info>
|
||||
---
|
||||
drivers/pmdomain/rockchip/pm-domains.c | 23 +++++++++++++++++++++++
|
||||
include/linux/rockchip_pmu.h | 15 +++++++++++++++
|
||||
include/soc/rockchip/pm_domains.h | 6 ++++++
|
||||
3 files changed, 44 insertions(+)
|
||||
create mode 100644 include/linux/rockchip_pmu.h
|
||||
|
||||
diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
|
||||
index 89795abac951..ffb5d62c9d52 100644
|
||||
--- a/drivers/pmdomain/rockchip/pm-domains.c
|
||||
+++ b/drivers/pmdomain/rockchip/pm-domains.c
|
||||
@@ -309,6 +309,29 @@ static int rockchip_pmu_set_idle_request(struct rockchip_pm_domain *pd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+int rockchip_pmu_idle_request(struct device *dev, bool idle)
|
||||
+{
|
||||
+ struct generic_pm_domain *genpd;
|
||||
+ struct rockchip_pm_domain *pd;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (IS_ERR_OR_NULL(dev))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (IS_ERR_OR_NULL(dev->pm_domain))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ genpd = pd_to_genpd(dev->pm_domain);
|
||||
+ pd = to_rockchip_pd(genpd);
|
||||
+
|
||||
+ mutex_lock(&pd->pmu->mutex);
|
||||
+ ret = rockchip_pmu_set_idle_request(pd, idle);
|
||||
+ mutex_unlock(&pd->pmu->mutex);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+EXPORT_SYMBOL(rockchip_pmu_idle_request);
|
||||
+
|
||||
static int rockchip_pmu_save_qos(struct rockchip_pm_domain *pd)
|
||||
{
|
||||
int i;
|
||||
diff --git a/include/linux/rockchip_pmu.h b/include/linux/rockchip_pmu.h
|
||||
new file mode 100644
|
||||
index 000000000000..720b3314e71a
|
||||
--- /dev/null
|
||||
+++ b/include/linux/rockchip_pmu.h
|
||||
@@ -0,0 +1,15 @@
|
||||
+/*
|
||||
+ * pm_domain.h - Definitions and headers related to device power domains.
|
||||
+ *
|
||||
+ * Copyright (C) 2017 Randy Li <ayaka@soulik.info>.
|
||||
+ *
|
||||
+ * This file is released under the GPLv2.
|
||||
+ */
|
||||
+
|
||||
+#ifndef _LINUX_ROCKCHIP_PM_H
|
||||
+#define _LINUX_ROCKCHIP_PM_H
|
||||
+#include <linux/device.h>
|
||||
+
|
||||
+int rockchip_pmu_idle_request(struct device *dev, bool idle);
|
||||
+
|
||||
+#endif /* _LINUX_ROCKCHIP_PM_H */
|
||||
diff --git a/include/soc/rockchip/pm_domains.h b/include/soc/rockchip/pm_domains.h
|
||||
index 7dbd941fc937..c5a59dd71754 100644
|
||||
--- a/include/soc/rockchip/pm_domains.h
|
||||
+++ b/include/soc/rockchip/pm_domains.h
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
int rockchip_pmu_block(void);
|
||||
void rockchip_pmu_unblock(void);
|
||||
+int rockchip_pmu_idle_request(struct device *dev, bool idle);
|
||||
|
||||
#else /* CONFIG_ROCKCHIP_PM_DOMAINS */
|
||||
|
||||
@@ -20,6 +21,11 @@ static inline int rockchip_pmu_block(void)
|
||||
|
||||
static inline void rockchip_pmu_unblock(void) { }
|
||||
|
||||
+static inline int rockchip_pmu_idle_request(struct device *dev, bool idle)
|
||||
+{
|
||||
+ return -ENOTSUPP;
|
||||
+}
|
||||
+
|
||||
#endif /* CONFIG_ROCKCHIP_PM_DOMAINS */
|
||||
|
||||
#endif /* __SOC_ROCKCHIP_PM_DOMAINS_H__ */
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Wed, 20 May 2020 17:04:47 +0200
|
||||
Subject: [PATCH] WIP: media: rkvdec: implement reset controls
|
||||
|
||||
---
|
||||
.../bindings/media/rockchip,vdec.yaml | 19 +++++++
|
||||
drivers/staging/media/rkvdec/rkvdec-regs.h | 5 ++
|
||||
drivers/staging/media/rkvdec/rkvdec.c | 53 +++++++++++++++++++
|
||||
drivers/staging/media/rkvdec/rkvdec.h | 11 +++-
|
||||
4 files changed, 87 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/media/rockchip,vdec.yaml b/Documentation/devicetree/bindings/media/rockchip,vdec.yaml
|
||||
index 3bcfb8e12333..dd6958df1de8 100644
|
||||
--- a/Documentation/devicetree/bindings/media/rockchip,vdec.yaml
|
||||
+++ b/Documentation/devicetree/bindings/media/rockchip,vdec.yaml
|
||||
@@ -53,6 +53,18 @@ properties:
|
||||
iommus:
|
||||
maxItems: 1
|
||||
|
||||
+ resets:
|
||||
+ maxItems: 6
|
||||
+
|
||||
+ reset-names:
|
||||
+ items:
|
||||
+ - const: video_h
|
||||
+ - const: video_a
|
||||
+ - const: video_core
|
||||
+ - const: video_cabac
|
||||
+ - const: niu_a
|
||||
+ - const: niu_h
|
||||
+
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
@@ -60,6 +72,8 @@ required:
|
||||
- clocks
|
||||
- clock-names
|
||||
- power-domains
|
||||
+ - resets
|
||||
+ - reset-names
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
@@ -78,6 +92,11 @@ examples:
|
||||
clock-names = "axi", "ahb", "cabac", "core";
|
||||
power-domains = <&power RK3399_PD_VDU>;
|
||||
iommus = <&vdec_mmu>;
|
||||
+ resets = <&cru SRST_H_VDU>, <&cru SRST_A_VDU>,
|
||||
+ <&cru SRST_VDU_CORE>, <&cru SRST_VDU_CA>,
|
||||
+ <&cru SRST_A_VDU_NOC>, <&cru SRST_H_VDU_NOC>;
|
||||
+ reset-names = "video_h", "video_a", "video_core", "video_cabac",
|
||||
+ "niu_a", "niu_h";
|
||||
};
|
||||
|
||||
...
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec-regs.h b/drivers/staging/media/rkvdec/rkvdec-regs.h
|
||||
index 15b9bee92016..3acc914888f6 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec-regs.h
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec-regs.h
|
||||
@@ -28,6 +28,11 @@
|
||||
#define RKVDEC_SOFTRST_EN_P BIT(20)
|
||||
#define RKVDEC_FORCE_SOFTRESET_VALID BIT(21)
|
||||
#define RKVDEC_SOFTRESET_RDY BIT(22)
|
||||
+#define RKVDEC_ERR_MASK (RKVDEC_BUS_STA \
|
||||
+ | RKVDEC_ERR_STA \
|
||||
+ | RKVDEC_TIMEOUT_STA \
|
||||
+ | RKVDEC_BUF_EMPTY_STA \
|
||||
+ | RKVDEC_COLMV_REF_ERR_STA )
|
||||
|
||||
#define RKVDEC_REG_SYSCTRL 0x008
|
||||
#define RKVDEC_IN_ENDIAN BIT(0)
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
index eaf2f133a264..f55abb7c377f 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec.c
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
@@ -10,12 +10,15 @@
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
+#include <linux/delay.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
+#include <linux/reset.h>
|
||||
+#include <linux/rockchip_pmu.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/videodev2.h>
|
||||
#include <linux/workqueue.h>
|
||||
@@ -717,6 +720,11 @@ static void rkvdec_job_finish(struct rkvdec_ctx *ctx,
|
||||
|
||||
pm_runtime_mark_last_busy(rkvdec->dev);
|
||||
pm_runtime_put_autosuspend(rkvdec->dev);
|
||||
+
|
||||
+ if (result == VB2_BUF_STATE_ERROR &&
|
||||
+ rkvdec->reset_mask == RESET_NONE)
|
||||
+ rkvdec->reset_mask |= RESET_SOFT;
|
||||
+
|
||||
rkvdec_job_finish_no_pm(ctx, result);
|
||||
}
|
||||
|
||||
@@ -754,6 +762,33 @@ static void rkvdec_device_run(void *priv)
|
||||
|
||||
if (WARN_ON(!desc))
|
||||
return;
|
||||
+ if (rkvdec->reset_mask != RESET_NONE) {
|
||||
+
|
||||
+ if (rkvdec->reset_mask & RESET_SOFT) {
|
||||
+ writel(RKVDEC_SOFTRST_EN_P,
|
||||
+ rkvdec->regs + RKVDEC_REG_INTERRUPT);
|
||||
+ udelay(RKVDEC_RESET_DELAY);
|
||||
+ if (readl(rkvdec->regs + RKVDEC_REG_INTERRUPT)
|
||||
+ & RKVDEC_SOFTRESET_RDY)
|
||||
+ dev_info_ratelimited(rkvdec->dev,
|
||||
+ "softreset failed\n");
|
||||
+ }
|
||||
+
|
||||
+ if (rkvdec->reset_mask & RESET_HARD) {
|
||||
+ rockchip_pmu_idle_request(rkvdec->dev, true);
|
||||
+ ret = reset_control_assert(rkvdec->rstc);
|
||||
+ if (!ret) {
|
||||
+ udelay(RKVDEC_RESET_DELAY);
|
||||
+ ret = reset_control_deassert(rkvdec->rstc);
|
||||
+ }
|
||||
+ rockchip_pmu_idle_request(rkvdec->dev, false);
|
||||
+ if (ret)
|
||||
+ dev_notice_ratelimited(rkvdec->dev,
|
||||
+ "hardreset failed\n");
|
||||
+ }
|
||||
+ rkvdec->reset_mask = RESET_NONE;
|
||||
+ pm_runtime_suspend(rkvdec->dev);
|
||||
+ }
|
||||
|
||||
ret = pm_runtime_resume_and_get(rkvdec->dev);
|
||||
if (ret < 0) {
|
||||
@@ -1020,6 +1055,11 @@ static irqreturn_t rkvdec_irq_handler(int irq, void *priv)
|
||||
if (cancel_delayed_work(&rkvdec->watchdog_work)) {
|
||||
struct rkvdec_ctx *ctx;
|
||||
|
||||
+ if (state == VB2_BUF_STATE_ERROR) {
|
||||
+ rkvdec->reset_mask |= (status & RKVDEC_ERR_MASK) ?
|
||||
+ RESET_HARD : RESET_SOFT;
|
||||
+ }
|
||||
+
|
||||
ctx = v4l2_m2m_get_curr_priv(rkvdec->m2m_dev);
|
||||
rkvdec_job_finish(ctx, state);
|
||||
}
|
||||
@@ -1037,6 +1077,7 @@ static void rkvdec_watchdog_func(struct work_struct *work)
|
||||
ctx = v4l2_m2m_get_curr_priv(rkvdec->m2m_dev);
|
||||
if (ctx) {
|
||||
dev_err(rkvdec->dev, "Frame processing timed out!\n");
|
||||
+ rkvdec->reset_mask |= RESET_HARD;
|
||||
writel(RKVDEC_IRQ_DIS, rkvdec->regs + RKVDEC_REG_INTERRUPT);
|
||||
writel(0, rkvdec->regs + RKVDEC_REG_SYSCTRL);
|
||||
rkvdec_job_finish(ctx, VB2_BUF_STATE_ERROR);
|
||||
@@ -1105,6 +1146,18 @@ static int rkvdec_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+
|
||||
+ rkvdec->rstc = devm_reset_control_array_get(&pdev->dev, false, true);
|
||||
+ if (IS_ERR(rkvdec->rstc)) {
|
||||
+ dev_err(&pdev->dev,
|
||||
+ "get resets failed %ld\n", PTR_ERR(rkvdec->rstc));
|
||||
+ return PTR_ERR(rkvdec->rstc);
|
||||
+ } else {
|
||||
+ dev_dbg(&pdev->dev,
|
||||
+ "requested %d resets\n",
|
||||
+ reset_control_get_count(&pdev->dev));
|
||||
+ }
|
||||
+
|
||||
pm_runtime_set_autosuspend_delay(&pdev->dev, 100);
|
||||
pm_runtime_use_autosuspend(&pdev->dev);
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h
|
||||
index b9e219438bc9..f02f79c405f0 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec.h
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec.h
|
||||
@@ -11,10 +11,11 @@
|
||||
#ifndef RKVDEC_H_
|
||||
#define RKVDEC_H_
|
||||
|
||||
+#include <linux/clk.h>
|
||||
#include <linux/platform_device.h>
|
||||
+#include <linux/reset.h>
|
||||
#include <linux/videodev2.h>
|
||||
#include <linux/wait.h>
|
||||
-#include <linux/clk.h>
|
||||
|
||||
#include <media/v4l2-ctrls.h>
|
||||
#include <media/v4l2-device.h>
|
||||
@@ -22,6 +23,12 @@
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-dma-contig.h>
|
||||
|
||||
+#define RESET_NONE 0
|
||||
+#define RESET_SOFT BIT(0)
|
||||
+#define RESET_HARD BIT(1)
|
||||
+
|
||||
+#define RKVDEC_RESET_DELAY 5
|
||||
+
|
||||
struct rkvdec_ctx;
|
||||
|
||||
struct rkvdec_ctrl_desc {
|
||||
@@ -96,6 +103,8 @@ struct rkvdec_dev {
|
||||
void __iomem *regs;
|
||||
struct mutex vdev_lock; /* serializes ioctls */
|
||||
struct delayed_work watchdog_work;
|
||||
+ struct reset_control *rstc;
|
||||
+ u8 reset_mask;
|
||||
};
|
||||
|
||||
struct rkvdec_ctx {
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Tue, 18 Aug 2020 11:38:04 +0200
|
||||
Subject: [PATCH] WIP: arm64: dts: add resets to vdec for RK3399
|
||||
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 10 +++++++++-
|
||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
index 980b12cb0a49..6e3149e587c5 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
@@ -1062,7 +1062,10 @@ power-domain@RK3399_PD_VCODEC {
|
||||
power-domain@RK3399_PD_VDU {
|
||||
reg = <RK3399_PD_VDU>;
|
||||
clocks = <&cru ACLK_VDU>,
|
||||
- <&cru HCLK_VDU>;
|
||||
+ <&cru HCLK_VDU>,
|
||||
+ <&cru SCLK_VDU_CA>,
|
||||
+ <&cru SCLK_VDU_CORE>;
|
||||
+
|
||||
pm_qos = <&qos_video_m1_r>,
|
||||
<&qos_video_m1_w>;
|
||||
#power-domain-cells = <0>;
|
||||
@@ -1345,6 +1348,11 @@ vdec: video-codec@ff660000 {
|
||||
clock-names = "axi", "ahb", "cabac", "core";
|
||||
iommus = <&vdec_mmu>;
|
||||
power-domains = <&power RK3399_PD_VDU>;
|
||||
+ resets = <&cru SRST_H_VDU>, <&cru SRST_A_VDU>,
|
||||
+ <&cru SRST_VDU_CORE>, <&cru SRST_VDU_CA>,
|
||||
+ <&cru SRST_A_VDU_NOC>, <&cru SRST_H_VDU_NOC>;
|
||||
+ reset-names = "video_h", "video_a", "video_core", "video_cabac",
|
||||
+ "niu_a", "niu_h";
|
||||
};
|
||||
|
||||
vdec_mmu: iommu@ff660480 {
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Fri, 1 Jan 2021 12:11:12 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: fix RK3399 vdec register witdh
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
index 6e3149e587c5..093ebe070775 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
@@ -1341,7 +1341,7 @@ vpu_mmu: iommu@ff650800 {
|
||||
|
||||
vdec: video-codec@ff660000 {
|
||||
compatible = "rockchip,rk3399-vdec";
|
||||
- reg = <0x0 0xff660000 0x0 0x400>;
|
||||
+ reg = <0x0 0xff660000 0x0 0x480>;
|
||||
interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH 0>;
|
||||
clocks = <&cru ACLK_VDU>, <&cru HCLK_VDU>,
|
||||
<&cru SCLK_VDU_CA>, <&cru SCLK_VDU_CORE>;
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Sat, 21 Aug 2021 16:12:36 +0200
|
||||
Subject: [PATCH] media: hantro: rockchip: Increase RK3288's max ACLK
|
||||
|
||||
Required to proper decode H.264@4K
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
drivers/media/platform/verisilicon/rockchip_vpu_hw.c | 14 +++++++++++---
|
||||
1 file changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
|
||||
index 8de6fd2e8eef..002b1a600f93 100644
|
||||
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
|
||||
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
|
||||
@@ -15,7 +15,8 @@
|
||||
#include "rockchip_vpu2_regs.h"
|
||||
|
||||
#define RK3066_ACLK_MAX_FREQ (300 * 1000 * 1000)
|
||||
-#define RK3288_ACLK_MAX_FREQ (400 * 1000 * 1000)
|
||||
+#define RK3288_ACLK_MAX_FREQ (600 * 1000 * 1000)
|
||||
+#define RK3399_ACLK_MAX_FREQ (400 * 1000 * 1000)
|
||||
#define RK3588_ACLK_MAX_FREQ (300 * 1000 * 1000)
|
||||
|
||||
#define ROCKCHIP_VPU981_MIN_SIZE 64
|
||||
@@ -346,13 +347,20 @@ static int rk3066_vpu_hw_init(struct hantro_dev *vpu)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int rockchip_vpu_hw_init(struct hantro_dev *vpu)
|
||||
+static int rk3288_vpu_hw_init(struct hantro_dev *vpu)
|
||||
{
|
||||
/* Bump ACLK to max. possible freq. to improve performance. */
|
||||
clk_set_rate(vpu->clocks[0].clk, RK3288_ACLK_MAX_FREQ);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int rockchip_vpu_hw_init(struct hantro_dev *vpu)
|
||||
+{
|
||||
+ /* Bump ACLK to max. possible freq. to improve performance. */
|
||||
+ clk_set_rate(vpu->clocks[0].clk, RK3399_ACLK_MAX_FREQ);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static void rk3066_vpu_dec_reset(struct hantro_ctx *ctx)
|
||||
{
|
||||
struct hantro_dev *vpu = ctx->dev;
|
||||
@@ -592,7 +600,7 @@ const struct hantro_variant rk3288_vpu_variant = {
|
||||
.codec_ops = rk3288_vpu_codec_ops,
|
||||
.irqs = rockchip_vpu1_irqs,
|
||||
.num_irqs = ARRAY_SIZE(rockchip_vpu1_irqs),
|
||||
- .init = rockchip_vpu_hw_init,
|
||||
+ .init = rk3288_vpu_hw_init,
|
||||
.clk_names = rockchip_vpu_clk_names,
|
||||
.num_clocks = ARRAY_SIZE(rockchip_vpu_clk_names)
|
||||
};
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Sun, 4 Jul 2021 15:19:44 +0200
|
||||
Subject: [PATCH] media: rkvdec: disable QoS for VP9 (corruptions on RK3328
|
||||
otherwise)
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
drivers/staging/media/rkvdec/rkvdec-regs.h | 2 ++
|
||||
drivers/staging/media/rkvdec/rkvdec-vp9.c | 8 ++++++++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec-regs.h b/drivers/staging/media/rkvdec/rkvdec-regs.h
|
||||
index 3acc914888f6..265f5234f4eb 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec-regs.h
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec-regs.h
|
||||
@@ -222,6 +222,8 @@
|
||||
#define RKVDEC_REG_H264_ERR_E 0x134
|
||||
#define RKVDEC_H264_ERR_EN_HIGHBITS(x) ((x) & 0x3fffffff)
|
||||
|
||||
+#define RKVDEC_QOS_CTRL 0x18C
|
||||
+
|
||||
#define RKVDEC_REG_PREF_LUMA_CACHE_COMMAND 0x410
|
||||
#define RKVDEC_REG_PREF_CHR_CACHE_COMMAND 0x450
|
||||
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec-vp9.c b/drivers/staging/media/rkvdec/rkvdec-vp9.c
|
||||
index d8c1c0db15c7..a289bc968e91 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec-vp9.c
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec-vp9.c
|
||||
@@ -802,6 +802,7 @@ static int rkvdec_vp9_run(struct rkvdec_ctx *ctx)
|
||||
struct rkvdec_dev *rkvdec = ctx->dev;
|
||||
struct rkvdec_vp9_run run = { };
|
||||
int ret;
|
||||
+ u32 reg;
|
||||
|
||||
ret = rkvdec_vp9_run_preamble(ctx, &run);
|
||||
if (ret) {
|
||||
@@ -823,6 +824,13 @@ static int rkvdec_vp9_run(struct rkvdec_ctx *ctx)
|
||||
writel(1, rkvdec->regs + RKVDEC_REG_PREF_CHR_CACHE_COMMAND);
|
||||
|
||||
writel(0xe, rkvdec->regs + RKVDEC_REG_STRMD_ERR_EN);
|
||||
+
|
||||
+ /* disable QOS for RK3328 - no effect on other SoCs */
|
||||
+ reg = readl(rkvdec->regs + RKVDEC_QOS_CTRL);
|
||||
+ reg |= 0xFFFF;
|
||||
+ reg &= (~BIT(12));
|
||||
+ writel(reg, rkvdec->regs + RKVDEC_QOS_CTRL);
|
||||
+
|
||||
/* Start decoding! */
|
||||
writel(RKVDEC_INTERRUPT_DEC_E | RKVDEC_CONFIG_DEC_CLK_GATE_E |
|
||||
RKVDEC_TIMEOUT_E | RKVDEC_BUF_EMPTY_E,
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Thu, 16 Jun 2022 13:18:22 +0200
|
||||
Subject: [PATCH] WIP: arm64: dts: add resets to vdec for RK3328
|
||||
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328.dtsi | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
index 5519347232f6..431c4ec198be 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
@@ -674,6 +674,11 @@ vdec: video-codec@ff360000 {
|
||||
assigned-clocks = <&cru ACLK_RKVDEC>, <&cru SCLK_VDEC_CABAC>,
|
||||
<&cru SCLK_VDEC_CORE>;
|
||||
assigned-clock-rates = <400000000>, <400000000>, <300000000>;
|
||||
+ resets = <&cru SRST_VDEC_H>, <&cru SRST_VDEC_A>,
|
||||
+ <&cru SRST_VDEC_CORE>, <&cru SRST_VDEC_CABAC>,
|
||||
+ <&cru SRST_VDEC_NIU_A>, <&cru SRST_VDEC_NIU_H>;
|
||||
+ reset-names = "video_h", "video_a", "video_core", "video_cabac",
|
||||
+ "niu_a", "niu_h";
|
||||
iommus = <&vdec_mmu>;
|
||||
power-domains = <&power RK3328_PD_VIDEO>;
|
||||
};
|
||||
@ -0,0 +1,688 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Wed, 2 Sep 2020 19:52:02 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: add gpu powerdomain, gpu opp-table and
|
||||
cooling cell for RK3328
|
||||
|
||||
Note: since the regulator that supplies the GPU usually also supplies
|
||||
other SoC components, we have to make sure voltage is never lower then
|
||||
1075 mV - also disable 500 MHz for now, since it will crash if rkvdec
|
||||
is running at the same time (voltage to high)
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
.../arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 4 +++
|
||||
.../arm64/boot/dts/rockchip/rk3328-rock64.dts | 4 +++
|
||||
arch/arm64/boot/dts/rockchip/rk3328.dtsi | 35 +++++++++++++++++++
|
||||
3 files changed, 43 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts
|
||||
index aa22a0c22265..51c7723d6762 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts
|
||||
@@ -166,6 +166,10 @@ &gmac2io {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&gpu {
|
||||
+ mali-supply = <&vdd_logic>;
|
||||
+};
|
||||
+
|
||||
&hdmi {
|
||||
status = "okay";
|
||||
};
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
|
||||
index f69a38f42d2d..c198a8a7f95a 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
|
||||
@@ -162,6 +162,10 @@ &gmac2io {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&gpu {
|
||||
+ mali-supply = <&vdd_logic>;
|
||||
+};
|
||||
+
|
||||
&hdmi {
|
||||
status = "okay";
|
||||
};
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
index 431c4ec198be..eec03adf0902 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
@@ -300,6 +300,11 @@ power: power-controller {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
+ power-domain@RK3328_PD_GPU {
|
||||
+ reg = <RK3328_PD_GPU>;
|
||||
+ clocks = <&cru ACLK_GPU>;
|
||||
+ #power-domain-cells = <0>;
|
||||
+ };
|
||||
power-domain@RK3328_PD_HEVC {
|
||||
reg = <RK3328_PD_HEVC>;
|
||||
#power-domain-cells = <0>;
|
||||
@@ -539,6 +544,11 @@ map0 {
|
||||
<&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||
contribution = <4096>;
|
||||
};
|
||||
+ map1 {
|
||||
+ trip = <&target>;
|
||||
+ cooling-device = <&gpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||
+ contribution = <4096>;
|
||||
+ };
|
||||
};
|
||||
};
|
||||
|
||||
@@ -620,7 +630,32 @@ gpu: gpu@ff300000 {
|
||||
"ppmmu1";
|
||||
clocks = <&cru ACLK_GPU>, <&cru ACLK_GPU>;
|
||||
clock-names = "bus", "core";
|
||||
+ operating-points-v2 = <&gpu_opp_table>;
|
||||
+ power-domains = <&power RK3328_PD_GPU>;
|
||||
resets = <&cru SRST_GPU_A>;
|
||||
+ #cooling-cells = <2>;
|
||||
+ };
|
||||
+
|
||||
+ gpu_opp_table: gpu-opp-table {
|
||||
+ compatible = "operating-points-v2";
|
||||
+
|
||||
+ opp-200000000 {
|
||||
+ opp-hz = /bits/ 64 <200000000>;
|
||||
+ opp-microvolt = <1075000>;
|
||||
+ };
|
||||
+ opp-300000000 {
|
||||
+ opp-hz = /bits/ 64 <300000000>;
|
||||
+ opp-microvolt = <1075000>;
|
||||
+ };
|
||||
+ opp-400000000 {
|
||||
+ opp-hz = /bits/ 64 <400000000>;
|
||||
+ opp-microvolt = <1075000>;
|
||||
+ };
|
||||
+ opp-500000000 {
|
||||
+ opp-hz = /bits/ 64 <500000000>;
|
||||
+ opp-microvolt = <1150000>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
};
|
||||
|
||||
h265e_mmu: iommu@ff330200 {
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Tue, 2 Feb 2021 17:22:21 +0200
|
||||
Subject: [PATCH] ARM: dts: RK3288 miqi add hdmi sound nodes
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288-miqi.dts | 20 ++++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
index 713f55e143c6..8d30c49f406e 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
@@ -78,6 +78,21 @@ vcc_sys: vsys-regulator {
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
};
|
||||
+
|
||||
+ sound {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,format = "i2s";
|
||||
+ simple-audio-card,name = "HDMI";
|
||||
+ simple-audio-card,mclk-fs = <512>;
|
||||
+
|
||||
+ simple-audio-card,codec {
|
||||
+ sound-dai = <&hdmi>;
|
||||
+ };
|
||||
+
|
||||
+ simple-audio-card,cpu {
|
||||
+ sound-dai = <&i2s>;
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
&cpu0 {
|
||||
@@ -284,6 +299,11 @@ &i2c5 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&i2s {
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&io_domains {
|
||||
status = "okay";
|
||||
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Fri, 2 Apr 2021 17:54:22 +0200
|
||||
Subject: [PATCH] ARM/arm64: dts: rockchip: align sound card names
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi | 2 +-
|
||||
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi
|
||||
index 09618bb7d872..db9106a3dd22 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi
|
||||
@@ -73,7 +73,7 @@ sdio_pwrseq: sdio-pwrseq {
|
||||
sound {
|
||||
compatible = "simple-audio-card";
|
||||
simple-audio-card,format = "i2s";
|
||||
- simple-audio-card,name = "rockchip,tinker-codec";
|
||||
+ simple-audio-card,name = "HDMI";
|
||||
simple-audio-card,mclk-fs = <512>;
|
||||
|
||||
simple-audio-card,codec {
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
index 093ebe070775..a10fe60b7680 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
@@ -1893,7 +1893,7 @@ hdmi_sound: hdmi-sound {
|
||||
compatible = "simple-audio-card";
|
||||
simple-audio-card,format = "i2s";
|
||||
simple-audio-card,mclk-fs = <256>;
|
||||
- simple-audio-card,name = "hdmi-sound";
|
||||
+ simple-audio-card,name = "HDMI";
|
||||
status = "disabled";
|
||||
|
||||
simple-audio-card,cpu {
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Sun, 25 Mar 2018 22:17:06 +0200
|
||||
Subject: [PATCH] ASoC: hdmi-codec: fix channel allocation
|
||||
|
||||
---
|
||||
sound/soc/codecs/hdmi-codec.c | 113 ++++++++++++++++------------------
|
||||
1 file changed, 52 insertions(+), 61 deletions(-)
|
||||
|
||||
diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
|
||||
index 5679102de91f..f0cd183f7873 100644
|
||||
--- a/sound/soc/codecs/hdmi-codec.c
|
||||
+++ b/sound/soc/codecs/hdmi-codec.c
|
||||
@@ -194,78 +194,69 @@ static const struct snd_pcm_chmap_elem hdmi_codec_8ch_chmaps[] = {
|
||||
*/
|
||||
static const struct hdmi_codec_cea_spk_alloc hdmi_codec_channel_alloc[] = {
|
||||
{ .ca_id = 0x00, .n_ch = 2,
|
||||
- .mask = FL | FR},
|
||||
- /* 2.1 */
|
||||
- { .ca_id = 0x01, .n_ch = 4,
|
||||
- .mask = FL | FR | LFE},
|
||||
- /* Dolby Surround */
|
||||
+ .mask = FL | FR },
|
||||
+ { .ca_id = 0x03, .n_ch = 4,
|
||||
+ .mask = FL | FR | LFE | FC },
|
||||
{ .ca_id = 0x02, .n_ch = 4,
|
||||
.mask = FL | FR | FC },
|
||||
- /* surround51 */
|
||||
+ { .ca_id = 0x01, .n_ch = 4,
|
||||
+ .mask = FL | FR | LFE },
|
||||
{ .ca_id = 0x0b, .n_ch = 6,
|
||||
- .mask = FL | FR | LFE | FC | RL | RR},
|
||||
- /* surround40 */
|
||||
- { .ca_id = 0x08, .n_ch = 6,
|
||||
- .mask = FL | FR | RL | RR },
|
||||
- /* surround41 */
|
||||
- { .ca_id = 0x09, .n_ch = 6,
|
||||
- .mask = FL | FR | LFE | RL | RR },
|
||||
- /* surround50 */
|
||||
+ .mask = FL | FR | LFE | FC | RL | RR },
|
||||
{ .ca_id = 0x0a, .n_ch = 6,
|
||||
.mask = FL | FR | FC | RL | RR },
|
||||
- /* 6.1 */
|
||||
- { .ca_id = 0x0f, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | FC | RL | RR | RC },
|
||||
- /* surround71 */
|
||||
+ { .ca_id = 0x09, .n_ch = 6,
|
||||
+ .mask = FL | FR | LFE | RL | RR },
|
||||
+ { .ca_id = 0x08, .n_ch = 6,
|
||||
+ .mask = FL | FR | RL | RR },
|
||||
+ { .ca_id = 0x07, .n_ch = 6,
|
||||
+ .mask = FL | FR | LFE | FC | RC },
|
||||
+ { .ca_id = 0x06, .n_ch = 6,
|
||||
+ .mask = FL | FR | FC | RC },
|
||||
+ { .ca_id = 0x05, .n_ch = 6,
|
||||
+ .mask = FL | FR | LFE | RC },
|
||||
+ { .ca_id = 0x04, .n_ch = 6,
|
||||
+ .mask = FL | FR | RC },
|
||||
{ .ca_id = 0x13, .n_ch = 8,
|
||||
.mask = FL | FR | LFE | FC | RL | RR | RLC | RRC },
|
||||
- /* others */
|
||||
- { .ca_id = 0x03, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | FC },
|
||||
- { .ca_id = 0x04, .n_ch = 8,
|
||||
- .mask = FL | FR | RC},
|
||||
- { .ca_id = 0x05, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | RC },
|
||||
- { .ca_id = 0x06, .n_ch = 8,
|
||||
- .mask = FL | FR | FC | RC },
|
||||
- { .ca_id = 0x07, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | FC | RC },
|
||||
- { .ca_id = 0x0c, .n_ch = 8,
|
||||
- .mask = FL | FR | RC | RL | RR },
|
||||
- { .ca_id = 0x0d, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | RL | RR | RC },
|
||||
- { .ca_id = 0x0e, .n_ch = 8,
|
||||
- .mask = FL | FR | FC | RL | RR | RC },
|
||||
- { .ca_id = 0x10, .n_ch = 8,
|
||||
- .mask = FL | FR | RL | RR | RLC | RRC },
|
||||
- { .ca_id = 0x11, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | RL | RR | RLC | RRC },
|
||||
+ { .ca_id = 0x1f, .n_ch = 8,
|
||||
+ .mask = FL | FR | LFE | FC | RL | RR | FLC | FRC },
|
||||
{ .ca_id = 0x12, .n_ch = 8,
|
||||
.mask = FL | FR | FC | RL | RR | RLC | RRC },
|
||||
- { .ca_id = 0x14, .n_ch = 8,
|
||||
- .mask = FL | FR | FLC | FRC },
|
||||
- { .ca_id = 0x15, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | FLC | FRC },
|
||||
- { .ca_id = 0x16, .n_ch = 8,
|
||||
- .mask = FL | FR | FC | FLC | FRC },
|
||||
- { .ca_id = 0x17, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | FC | FLC | FRC },
|
||||
- { .ca_id = 0x18, .n_ch = 8,
|
||||
- .mask = FL | FR | RC | FLC | FRC },
|
||||
- { .ca_id = 0x19, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | RC | FLC | FRC },
|
||||
- { .ca_id = 0x1a, .n_ch = 8,
|
||||
- .mask = FL | FR | RC | FC | FLC | FRC },
|
||||
- { .ca_id = 0x1b, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | RC | FC | FLC | FRC },
|
||||
- { .ca_id = 0x1c, .n_ch = 8,
|
||||
- .mask = FL | FR | RL | RR | FLC | FRC },
|
||||
- { .ca_id = 0x1d, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | RL | RR | FLC | FRC },
|
||||
{ .ca_id = 0x1e, .n_ch = 8,
|
||||
.mask = FL | FR | FC | RL | RR | FLC | FRC },
|
||||
- { .ca_id = 0x1f, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | FC | RL | RR | FLC | FRC },
|
||||
+ { .ca_id = 0x11, .n_ch = 8,
|
||||
+ .mask = FL | FR | LFE | RL | RR | RLC | RRC },
|
||||
+ { .ca_id = 0x1d, .n_ch = 8,
|
||||
+ .mask = FL | FR | LFE | RL | RR | FLC | FRC },
|
||||
+ { .ca_id = 0x10, .n_ch = 8,
|
||||
+ .mask = FL | FR | RL | RR | RLC | RRC },
|
||||
+ { .ca_id = 0x1c, .n_ch = 8,
|
||||
+ .mask = FL | FR | RL | RR | FLC | FRC },
|
||||
+ { .ca_id = 0x0f, .n_ch = 8,
|
||||
+ .mask = FL | FR | LFE | FC | RL | RR | RC },
|
||||
+ { .ca_id = 0x1b, .n_ch = 8,
|
||||
+ .mask = FL | FR | LFE | RC | FC | FLC | FRC },
|
||||
+ { .ca_id = 0x0e, .n_ch = 8,
|
||||
+ .mask = FL | FR | FC | RL | RR | RC },
|
||||
+ { .ca_id = 0x1a, .n_ch = 8,
|
||||
+ .mask = FL | FR | RC | FC | FLC | FRC },
|
||||
+ { .ca_id = 0x0d, .n_ch = 8,
|
||||
+ .mask = FL | FR | LFE | RL | RR | RC },
|
||||
+ { .ca_id = 0x19, .n_ch = 8,
|
||||
+ .mask = FL | FR | LFE | RC | FLC | FRC },
|
||||
+ { .ca_id = 0x0c, .n_ch = 8,
|
||||
+ .mask = FL | FR | RC | RL | RR },
|
||||
+ { .ca_id = 0x18, .n_ch = 8,
|
||||
+ .mask = FL | FR | RC | FLC | FRC },
|
||||
+ { .ca_id = 0x17, .n_ch = 8,
|
||||
+ .mask = FL | FR | LFE | FC | FLC | FRC },
|
||||
+ { .ca_id = 0x16, .n_ch = 8,
|
||||
+ .mask = FL | FR | FC | FLC | FRC },
|
||||
+ { .ca_id = 0x15, .n_ch = 8,
|
||||
+ .mask = FL | FR | LFE | FLC | FRC },
|
||||
+ { .ca_id = 0x14, .n_ch = 8,
|
||||
+ .mask = FL | FR | FLC | FRC },
|
||||
};
|
||||
|
||||
struct hdmi_codec_priv {
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Sat, 27 Feb 2021 17:52:02 +0100
|
||||
Subject: [PATCH] arm64: dts: rockchip: add SPDIF nodes for RK3328 A1 board
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328-a1.dts | 23 ++++++++++++++++++++++
|
||||
1 file changed, 23 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts
|
||||
index 40bf808642b9..27a1799027c2 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts
|
||||
@@ -57,6 +57,24 @@ ir-receiver {
|
||||
gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>;
|
||||
linux,rc-map-name = "rc-beelink-gs1";
|
||||
};
|
||||
+
|
||||
+ spdif_sound: 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_dit>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ spdif_dit: spdif-dit {
|
||||
+ compatible = "linux,spdif-dit";
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ };
|
||||
};
|
||||
|
||||
&analog_sound {
|
||||
@@ -325,6 +343,11 @@ &sdmmc {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&spdif {
|
||||
+ pinctrl-0 = <&spdifm0_tx>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&tsadc {
|
||||
rockchip,hw-tshut-mode = <0>;
|
||||
rockchip,hw-tshut-polarity = <0>;
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Sat, 27 Feb 2021 18:01:13 +0100
|
||||
Subject: [PATCH] arm64: dts: rockchip: Add ir-receiver node for RK3328 ROC CC
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts
|
||||
index 51c7723d6762..cf321302daec 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts
|
||||
@@ -88,6 +88,13 @@ vcc_phy: vcc-phy-regulator {
|
||||
regulator-boot-on;
|
||||
};
|
||||
|
||||
+ ir-receiver {
|
||||
+ compatible = "gpio-ir-receiver";
|
||||
+ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>;
|
||||
+ pinctrl-0 = <&ir_int>;
|
||||
+ pinctrl-names = "default";
|
||||
+ };
|
||||
+
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
@@ -312,6 +319,13 @@ &io_domains {
|
||||
};
|
||||
|
||||
&pinctrl {
|
||||
+
|
||||
+ ir {
|
||||
+ ir_int: ir-int {
|
||||
+ rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
pmic {
|
||||
pmic_int_l: pmic-int-l {
|
||||
rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Mon, 1 Mar 2021 21:24:15 +0100
|
||||
Subject: [PATCH] ARM: dts: add cec pinctrl for RK3288 miqi board
|
||||
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288-miqi.dts | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
index 8d30c49f406e..6d90db5a3b75 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
@@ -145,6 +145,8 @@ &gpu {
|
||||
|
||||
&hdmi {
|
||||
ddc-i2c-bus = <&i2c5>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&hdmi_cec_c0>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Mon, 1 Mar 2021 19:22:15 +0100
|
||||
Subject: [PATCH] HACK: arm64: dts: enable FE phy for Beelink A1 also
|
||||
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328-a1.dts | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts
|
||||
index 27a1799027c2..7de9dfa71d89 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts
|
||||
@@ -147,6 +147,14 @@ rtl8211f: ethernet-phy@0 {
|
||||
};
|
||||
};
|
||||
|
||||
+&gmac2phy {
|
||||
+ clock_in_out = "output";
|
||||
+ assigned-clock-rate = <50000000>;
|
||||
+ assigned-clocks = <&cru SCLK_MAC2PHY>;
|
||||
+ assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&gpu {
|
||||
mali-supply = <&vdd_logic>;
|
||||
};
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Tue, 26 Feb 2019 20:45:14 +0000
|
||||
Subject: [PATCH] WIP: dw-hdmi-cec: sleep 100ms on error
|
||||
|
||||
---
|
||||
drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c | 18 ++++++++++++++++--
|
||||
1 file changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c
|
||||
index c8f44bcb298a..d4280ce4542c 100644
|
||||
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c
|
||||
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c
|
||||
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* Copyright (C) 2015-2017 Russell King.
|
||||
*/
|
||||
+#include <linux/delay.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/module.h>
|
||||
@@ -129,8 +130,15 @@ static irqreturn_t dw_hdmi_cec_hardirq(int irq, void *data)
|
||||
|
||||
dw_hdmi_write(cec, stat, HDMI_IH_CEC_STAT0);
|
||||
|
||||
- if (stat & CEC_STAT_ERROR_INIT) {
|
||||
- cec->tx_status = CEC_TX_STATUS_ERROR;
|
||||
+ /* Status with both done and error_initiator bits have been seen
|
||||
+ * on Rockchip RK3328 devices, transmit attempt seems to have failed
|
||||
+ * when this happens, report as low drive and block cec-framework
|
||||
+ * 100ms before core retransmits the failed message, this seems to
|
||||
+ * mitigate the issue with failed transmit attempts.
|
||||
+ */
|
||||
+ if ((stat & (CEC_STAT_DONE|CEC_STAT_ERROR_INIT)) == (CEC_STAT_DONE|CEC_STAT_ERROR_INIT)) {
|
||||
+ pr_debug("dw_hdmi_cec_hardirq: stat=%02x LOW_DRIVE\n", stat);
|
||||
+ cec->tx_status = CEC_TX_STATUS_LOW_DRIVE;
|
||||
cec->tx_done = true;
|
||||
ret = IRQ_WAKE_THREAD;
|
||||
} else if (stat & CEC_STAT_DONE) {
|
||||
@@ -141,6 +149,10 @@ static irqreturn_t dw_hdmi_cec_hardirq(int irq, void *data)
|
||||
cec->tx_status = CEC_TX_STATUS_NACK;
|
||||
cec->tx_done = true;
|
||||
ret = IRQ_WAKE_THREAD;
|
||||
+ } else if (stat & CEC_STAT_ERROR_INIT) {
|
||||
+ cec->tx_status = CEC_TX_STATUS_ERROR;
|
||||
+ cec->tx_done = true;
|
||||
+ ret = IRQ_WAKE_THREAD;
|
||||
}
|
||||
|
||||
if (stat & CEC_STAT_EOM) {
|
||||
@@ -173,6 +185,8 @@ static irqreturn_t dw_hdmi_cec_thread(int irq, void *data)
|
||||
|
||||
if (cec->tx_done) {
|
||||
cec->tx_done = false;
|
||||
+ if (cec->tx_status == CEC_TX_STATUS_LOW_DRIVE)
|
||||
+ msleep(100);
|
||||
cec_transmit_attempt_done(adap, cec->tx_status);
|
||||
}
|
||||
if (cec->rx_done) {
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Wed, 5 May 2021 19:11:12 +0200
|
||||
Subject: [PATCH] arm64: boot: dts: Increase ACLK_PERILP0 clock rate for RK3399
|
||||
|
||||
As per vendor kernel. Leaving this clock at the lower rate will
|
||||
result in poor DMA controller performance
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
index a10fe60b7680..dbe6a9cb98a5 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
@@ -1477,7 +1477,7 @@ cru: clock-controller@ff760000 {
|
||||
<1000000000>,
|
||||
<150000000>, <75000000>,
|
||||
<37500000>,
|
||||
- <100000000>, <100000000>,
|
||||
+ <300000000>, <100000000>,
|
||||
<50000000>, <600000000>,
|
||||
<100000000>, <50000000>,
|
||||
<400000000>, <400000000>,
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Sat, 21 Aug 2021 17:04:46 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: Enable USB3 for rk3328 Beelink A1
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328-a1.dts | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts
|
||||
index 7de9dfa71d89..e857e5a727f4 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts
|
||||
@@ -389,6 +389,11 @@ &usb_host0_ehci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&usbdrd3 {
|
||||
+ dr_mode = "host";
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&vop {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Sat, 30 Oct 2021 12:19:19 +0200
|
||||
Subject: [PATCH] WIP: drm: bridge: dw-hdmi: switch from .hw_parmas to .prepare
|
||||
for i2s
|
||||
|
||||
Seems to be the only way to get AES bits correctly as set by
|
||||
userspace.
|
||||
TODO: check other consequences.
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
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 a2f0860b20bb..8961f9c7885d 100644
|
||||
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
|
||||
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
|
||||
@@ -34,9 +34,9 @@ static inline u8 hdmi_read(struct dw_hdmi_i2s_audio_data *audio, int offset)
|
||||
return audio->read(hdmi, offset);
|
||||
}
|
||||
|
||||
-static int dw_hdmi_i2s_hw_params(struct device *dev, void *data,
|
||||
- struct hdmi_codec_daifmt *fmt,
|
||||
- struct hdmi_codec_params *hparms)
|
||||
+static int dw_hdmi_i2s_prepare(struct device *dev, void *data,
|
||||
+ struct hdmi_codec_daifmt *fmt,
|
||||
+ struct hdmi_codec_params *hparms)
|
||||
{
|
||||
struct dw_hdmi_i2s_audio_data *audio = data;
|
||||
struct dw_hdmi *hdmi = audio->hdmi;
|
||||
@@ -178,7 +178,7 @@ static int dw_hdmi_i2s_hook_plugged_cb(struct device *dev, void *data,
|
||||
}
|
||||
|
||||
static const struct hdmi_codec_ops dw_hdmi_i2s_ops = {
|
||||
- .hw_params = dw_hdmi_i2s_hw_params,
|
||||
+ .prepare = dw_hdmi_i2s_prepare,
|
||||
.audio_startup = dw_hdmi_i2s_audio_startup,
|
||||
.audio_shutdown = dw_hdmi_i2s_audio_shutdown,
|
||||
.get_eld = dw_hdmi_i2s_get_eld,
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Sun, 18 Sep 2022 10:35:52 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: Disbake fusb for rk3399-roc-pc
|
||||
|
||||
As it will lead to an unbootable device in case one if those ports
|
||||
is used to power up the device.
|
||||
See https://lkml.org/lkml/2022/6/20/413
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi
|
||||
index 2f4b1b2e3ac7..7217ead94d39 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi
|
||||
@@ -215,7 +215,7 @@ vdd_log: vdd-log {
|
||||
regulator-name = "vdd_log";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
- regulator-min-microvolt = <450000>;
|
||||
+ regulator-min-microvolt = <430000>;
|
||||
regulator-max-microvolt = <1400000>;
|
||||
pwm-supply = <&vcc3v3_sys>;
|
||||
};
|
||||
@@ -536,7 +536,7 @@ fusb1: usb-typec@22 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&fusb1_int>;
|
||||
vbus-supply = <&vcc_vbus_typec1>;
|
||||
- status = "okay";
|
||||
+ status = "disabled";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -553,7 +553,7 @@ fusb0: usb-typec@22 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&fusb0_int>;
|
||||
vbus-supply = <&vcc_vbus_typec0>;
|
||||
- status = "okay";
|
||||
+ status = "disabled";
|
||||
};
|
||||
|
||||
mp8859: regulator@66 {
|
||||
@ -0,0 +1,63 @@
|
||||
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
|
||||
index 0370bb247fcb..55c0b8dddad5 100644
|
||||
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 2023-06-25 03:23:55.724209412 +0000
|
||||
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 2023-06-25 04:16:27.469899470 +0000
|
||||
@@ -254,35 +245,31 @@
|
||||
const struct drm_display_info *info,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
- struct rockchip_hdmi *hdmi = data;
|
||||
- const struct dw_hdmi_mpll_config *mpll_cfg = rockchip_mpll_cfg;
|
||||
- int pclk = mode->clock * 1000;
|
||||
- bool exact_match = hdmi->plat_data->phy_force_vendor;
|
||||
- int i;
|
||||
-
|
||||
- if (hdmi->ref_clk) {
|
||||
- int rpclk = clk_round_rate(hdmi->ref_clk, pclk);
|
||||
-
|
||||
- if (abs(rpclk - pclk) > pclk / 1000)
|
||||
- return MODE_NOCLOCK;
|
||||
- }
|
||||
-
|
||||
- for (i = 0; mpll_cfg[i].mpixelclock != (~0UL); i++) {
|
||||
- /*
|
||||
- * For vendor specific phys force an exact match of the pixelclock
|
||||
- * to preserve the original behaviour of the driver.
|
||||
- */
|
||||
- if (exact_match && pclk == mpll_cfg[i].mpixelclock)
|
||||
- return MODE_OK;
|
||||
- /*
|
||||
- * The Synopsys phy can work with pixelclocks up to the value given
|
||||
- * in the corresponding mpll_cfg entry.
|
||||
- */
|
||||
- if (!exact_match && pclk <= mpll_cfg[i].mpixelclock)
|
||||
- return MODE_OK;
|
||||
+ struct dw_hdmi_plat_data *pdata = (struct dw_hdmi_plat_data *)data;
|
||||
+ const struct dw_hdmi_mpll_config *mpll_cfg = pdata->mpll_cfg;
|
||||
+ int clock = mode->clock;
|
||||
+ unsigned int i = 0;
|
||||
+
|
||||
+ if (pdata->ycbcr_420_allowed && drm_mode_is_420(info, mode) &&
|
||||
+ (info->color_formats & DRM_COLOR_FORMAT_YCBCR420)) {
|
||||
+ clock /= 2;
|
||||
+ mpll_cfg = pdata->mpll_cfg_420;
|
||||
+ }
|
||||
+
|
||||
+ if ((!mpll_cfg && clock > 340000) ||
|
||||
+ (info->max_tmds_clock && clock > info->max_tmds_clock))
|
||||
+ return MODE_CLOCK_HIGH;
|
||||
+
|
||||
+ if (mpll_cfg) {
|
||||
+ while ((clock * 1000) < mpll_cfg[i].mpixelclock &&
|
||||
+ mpll_cfg[i].mpixelclock != (~0UL))
|
||||
+ i++;
|
||||
+
|
||||
+ if (mpll_cfg[i].mpixelclock == (~0UL))
|
||||
+ return MODE_CLOCK_HIGH;
|
||||
}
|
||||
|
||||
- return MODE_BAD;
|
||||
+ return MODE_OK;
|
||||
}
|
||||
|
||||
static void dw_hdmi_rockchip_encoder_disable(struct drm_encoder *encoder)
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,558 @@
|
||||
From d2d4783003509c554653cfceeb5ff946fe223bc2 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Thu, 9 Sep 2021 16:35:34 +0000
|
||||
Subject: [PATCH 1/4] 01-linux-0002-rockchip-from-list
|
||||
|
||||
---
|
||||
drivers/clk/rockchip/clk-pll.c | 236 ++++++++++++++++++++++++++++--
|
||||
drivers/clk/rockchip/clk-rk3228.c | 18 ++-
|
||||
drivers/clk/rockchip/clk.c | 39 ++++-
|
||||
drivers/clk/rockchip/clk.h | 27 +++-
|
||||
include/linux/clk-provider.h | 2 +
|
||||
5 files changed, 292 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c
|
||||
index f7827b3b7..8409e9eed 100644
|
||||
--- a/drivers/clk/rockchip/clk-pll.c
|
||||
+++ b/drivers/clk/rockchip/clk-pll.c
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <linux/iopoll.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/clk.h>
|
||||
+#include <linux/gcd.h>
|
||||
#include "clk.h"
|
||||
|
||||
#define PLL_MODE_MASK 0x3
|
||||
@@ -47,6 +48,198 @@ struct rockchip_clk_pll {
|
||||
#define to_rockchip_clk_pll_nb(nb) \
|
||||
container_of(nb, struct rockchip_clk_pll, clk_nb)
|
||||
|
||||
+#define MHZ (1000UL * 1000UL)
|
||||
+#define KHZ (1000UL)
|
||||
+
|
||||
+/* CLK_PLL_TYPE_RK3066_AUTO type ops */
|
||||
+#define PLL_FREF_MIN (269 * KHZ)
|
||||
+#define PLL_FREF_MAX (2200 * MHZ)
|
||||
+
|
||||
+#define PLL_FVCO_MIN (440 * MHZ)
|
||||
+#define PLL_FVCO_MAX (2200 * MHZ)
|
||||
+
|
||||
+#define PLL_FOUT_MIN (27500 * KHZ)
|
||||
+#define PLL_FOUT_MAX (2200 * MHZ)
|
||||
+
|
||||
+#define PLL_NF_MAX (4096)
|
||||
+#define PLL_NR_MAX (64)
|
||||
+#define PLL_NO_MAX (16)
|
||||
+
|
||||
+/* CLK_PLL_TYPE_RK3036/3366/3399_AUTO type ops */
|
||||
+#define MIN_FOUTVCO_FREQ (800 * MHZ)
|
||||
+#define MAX_FOUTVCO_FREQ (2000 * MHZ)
|
||||
+
|
||||
+static struct rockchip_pll_rate_table auto_table;
|
||||
+
|
||||
+static struct rockchip_pll_rate_table *rk_pll_rate_table_get(void)
|
||||
+{
|
||||
+ return &auto_table;
|
||||
+}
|
||||
+
|
||||
+static int rockchip_pll_clk_set_postdiv(unsigned long fout_hz,
|
||||
+ u32 *postdiv1,
|
||||
+ u32 *postdiv2,
|
||||
+ u32 *foutvco)
|
||||
+{
|
||||
+ unsigned long freq;
|
||||
+
|
||||
+ if (fout_hz < MIN_FOUTVCO_FREQ) {
|
||||
+ for (*postdiv1 = 1; *postdiv1 <= 7; (*postdiv1)++) {
|
||||
+ for (*postdiv2 = 1; *postdiv2 <= 7; (*postdiv2)++) {
|
||||
+ freq = fout_hz * (*postdiv1) * (*postdiv2);
|
||||
+ if (freq >= MIN_FOUTVCO_FREQ &&
|
||||
+ freq <= MAX_FOUTVCO_FREQ) {
|
||||
+ *foutvco = freq;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ pr_err("CANNOT FIND postdiv1/2 to make fout in range from 800M to 2000M,fout = %lu\n",
|
||||
+ fout_hz);
|
||||
+ } else {
|
||||
+ *postdiv1 = 1;
|
||||
+ *postdiv2 = 1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct rockchip_pll_rate_table *
|
||||
+rockchip_pll_clk_set_by_auto(struct rockchip_clk_pll *pll,
|
||||
+ unsigned long fin_hz,
|
||||
+ unsigned long fout_hz)
|
||||
+{
|
||||
+ struct rockchip_pll_rate_table *rate_table = rk_pll_rate_table_get();
|
||||
+ /* FIXME set postdiv1/2 always 1*/
|
||||
+ u32 foutvco = fout_hz;
|
||||
+ u64 fin_64, frac_64;
|
||||
+ u32 f_frac, postdiv1, postdiv2;
|
||||
+ unsigned long clk_gcd = 0;
|
||||
+
|
||||
+ if (fin_hz == 0 || fout_hz == 0 || fout_hz == fin_hz)
|
||||
+ return NULL;
|
||||
+
|
||||
+ rockchip_pll_clk_set_postdiv(fout_hz, &postdiv1, &postdiv2, &foutvco);
|
||||
+ rate_table->postdiv1 = postdiv1;
|
||||
+ rate_table->postdiv2 = postdiv2;
|
||||
+ rate_table->dsmpd = 1;
|
||||
+
|
||||
+ if (fin_hz / MHZ * MHZ == fin_hz && fout_hz / MHZ * MHZ == fout_hz) {
|
||||
+ fin_hz /= MHZ;
|
||||
+ foutvco /= MHZ;
|
||||
+ clk_gcd = gcd(fin_hz, foutvco);
|
||||
+ rate_table->refdiv = fin_hz / clk_gcd;
|
||||
+ rate_table->fbdiv = foutvco / clk_gcd;
|
||||
+
|
||||
+ rate_table->frac = 0;
|
||||
+
|
||||
+ pr_debug("fin = %lu, fout = %lu, clk_gcd = %lu, refdiv = %u, fbdiv = %u, postdiv1 = %u, postdiv2 = %u, frac = %u\n",
|
||||
+ fin_hz, fout_hz, clk_gcd, rate_table->refdiv,
|
||||
+ rate_table->fbdiv, rate_table->postdiv1,
|
||||
+ rate_table->postdiv2, rate_table->frac);
|
||||
+ } else {
|
||||
+ pr_debug("frac div running, fin_hz = %lu, fout_hz = %lu, fin_INT_mhz = %lu, fout_INT_mhz = %lu\n",
|
||||
+ fin_hz, fout_hz,
|
||||
+ fin_hz / MHZ * MHZ,
|
||||
+ fout_hz / MHZ * MHZ);
|
||||
+ pr_debug("frac get postdiv1 = %u, postdiv2 = %u, foutvco = %u\n",
|
||||
+ rate_table->postdiv1, rate_table->postdiv2, foutvco);
|
||||
+ clk_gcd = gcd(fin_hz / MHZ, foutvco / MHZ);
|
||||
+ rate_table->refdiv = fin_hz / MHZ / clk_gcd;
|
||||
+ rate_table->fbdiv = foutvco / MHZ / clk_gcd;
|
||||
+ pr_debug("frac get refdiv = %u, fbdiv = %u\n",
|
||||
+ rate_table->refdiv, rate_table->fbdiv);
|
||||
+
|
||||
+ rate_table->frac = 0;
|
||||
+
|
||||
+ f_frac = (foutvco % MHZ);
|
||||
+ fin_64 = fin_hz;
|
||||
+ do_div(fin_64, (u64)rate_table->refdiv);
|
||||
+ frac_64 = (u64)f_frac << 24;
|
||||
+ do_div(frac_64, fin_64);
|
||||
+ rate_table->frac = (u32)frac_64;
|
||||
+ if (rate_table->frac > 0)
|
||||
+ rate_table->dsmpd = 0;
|
||||
+ pr_debug("frac = %x\n", rate_table->frac);
|
||||
+ }
|
||||
+ return rate_table;
|
||||
+}
|
||||
+
|
||||
+static struct rockchip_pll_rate_table *
|
||||
+rockchip_rk3066_pll_clk_set_by_auto(struct rockchip_clk_pll *pll,
|
||||
+ unsigned long fin_hz,
|
||||
+ unsigned long fout_hz)
|
||||
+{
|
||||
+ struct rockchip_pll_rate_table *rate_table = rk_pll_rate_table_get();
|
||||
+ u32 nr, nf, no, nonr;
|
||||
+ u32 nr_out, nf_out, no_out;
|
||||
+ u32 n;
|
||||
+ u32 numerator, denominator;
|
||||
+ u64 fref, fvco, fout;
|
||||
+ unsigned long clk_gcd = 0;
|
||||
+
|
||||
+ nr_out = PLL_NR_MAX + 1;
|
||||
+ no_out = 0;
|
||||
+ nf_out = 0;
|
||||
+
|
||||
+ if (fin_hz == 0 || fout_hz == 0 || fout_hz == fin_hz)
|
||||
+ return NULL;
|
||||
+
|
||||
+ clk_gcd = gcd(fin_hz, fout_hz);
|
||||
+
|
||||
+ numerator = fout_hz / clk_gcd;
|
||||
+ denominator = fin_hz / clk_gcd;
|
||||
+
|
||||
+ for (n = 1;; n++) {
|
||||
+ nf = numerator * n;
|
||||
+ nonr = denominator * n;
|
||||
+ if (nf > PLL_NF_MAX || nonr > (PLL_NO_MAX * PLL_NR_MAX))
|
||||
+ break;
|
||||
+
|
||||
+ for (no = 1; no <= PLL_NO_MAX; no++) {
|
||||
+ if (!(no == 1 || !(no % 2)))
|
||||
+ continue;
|
||||
+
|
||||
+ if (nonr % no)
|
||||
+ continue;
|
||||
+ nr = nonr / no;
|
||||
+
|
||||
+ if (nr > PLL_NR_MAX)
|
||||
+ continue;
|
||||
+
|
||||
+ fref = fin_hz / nr;
|
||||
+ if (fref < PLL_FREF_MIN || fref > PLL_FREF_MAX)
|
||||
+ continue;
|
||||
+
|
||||
+ fvco = fref * nf;
|
||||
+ if (fvco < PLL_FVCO_MIN || fvco > PLL_FVCO_MAX)
|
||||
+ continue;
|
||||
+
|
||||
+ fout = fvco / no;
|
||||
+ if (fout < PLL_FOUT_MIN || fout > PLL_FOUT_MAX)
|
||||
+ continue;
|
||||
+
|
||||
+ /* select the best from all available PLL settings */
|
||||
+ if ((no > no_out) ||
|
||||
+ ((no == no_out) && (nr < nr_out))) {
|
||||
+ nr_out = nr;
|
||||
+ nf_out = nf;
|
||||
+ no_out = no;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* output the best PLL setting */
|
||||
+ if ((nr_out <= PLL_NR_MAX) && (no_out > 0)) {
|
||||
+ rate_table->nr = nr_out;
|
||||
+ rate_table->nf = nf_out;
|
||||
+ rate_table->no = no_out;
|
||||
+ } else {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ return rate_table;
|
||||
+}
|
||||
+
|
||||
static const struct rockchip_pll_rate_table *rockchip_get_pll_settings(
|
||||
struct rockchip_clk_pll *pll, unsigned long rate)
|
||||
{
|
||||
@@ -58,24 +251,16 @@ static const struct rockchip_pll_rate_table *rockchip_get_pll_settings(
|
||||
return &rate_table[i];
|
||||
}
|
||||
|
||||
- return NULL;
|
||||
+ if (pll->type == pll_rk3066)
|
||||
+ return rockchip_rk3066_pll_clk_set_by_auto(pll, 24 * MHZ, rate);
|
||||
+ else
|
||||
+ return rockchip_pll_clk_set_by_auto(pll, 24 * MHZ, rate);
|
||||
}
|
||||
|
||||
static long rockchip_pll_round_rate(struct clk_hw *hw,
|
||||
unsigned long drate, unsigned long *prate)
|
||||
{
|
||||
- struct rockchip_clk_pll *pll = to_rockchip_clk_pll(hw);
|
||||
- const struct rockchip_pll_rate_table *rate_table = pll->rate_table;
|
||||
- int i;
|
||||
-
|
||||
- /* Assumming rate_table is in descending order */
|
||||
- for (i = 0; i < pll->rate_count; i++) {
|
||||
- if (drate >= rate_table[i].rate)
|
||||
- return rate_table[i].rate;
|
||||
- }
|
||||
-
|
||||
- /* return minimum supported value */
|
||||
- return rate_table[i - 1].rate;
|
||||
+ return drate;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -165,7 +350,7 @@ static unsigned long rockchip_rk3036_pll_recalc_rate(struct clk_hw *hw,
|
||||
{
|
||||
struct rockchip_clk_pll *pll = to_rockchip_clk_pll(hw);
|
||||
struct rockchip_pll_rate_table cur;
|
||||
- u64 rate64 = prate;
|
||||
+ u64 rate64 = prate, frac_rate64 = prate;
|
||||
|
||||
rockchip_rk3036_pll_get_params(pll, &cur);
|
||||
|
||||
@@ -174,7 +359,7 @@ static unsigned long rockchip_rk3036_pll_recalc_rate(struct clk_hw *hw,
|
||||
|
||||
if (cur.dsmpd == 0) {
|
||||
/* fractional mode */
|
||||
- u64 frac_rate64 = prate * cur.frac;
|
||||
+ frac_rate64 *= cur.frac;
|
||||
|
||||
do_div(frac_rate64, cur.refdiv);
|
||||
rate64 += frac_rate64 >> 24;
|
||||
@@ -210,6 +395,11 @@ static int rockchip_rk3036_pll_set_params(struct rockchip_clk_pll *pll,
|
||||
rate_change_remuxed = 1;
|
||||
}
|
||||
|
||||
+ /* set pll power down */
|
||||
+ writel(HIWORD_UPDATE(RK3036_PLLCON1_PWRDOWN,
|
||||
+ RK3036_PLLCON1_PWRDOWN, 0),
|
||||
+ pll->reg_base + RK3036_PLLCON(1));
|
||||
+
|
||||
/* update pll values */
|
||||
writel_relaxed(HIWORD_UPDATE(rate->fbdiv, RK3036_PLLCON0_FBDIV_MASK,
|
||||
RK3036_PLLCON0_FBDIV_SHIFT) |
|
||||
@@ -231,6 +421,11 @@ static int rockchip_rk3036_pll_set_params(struct rockchip_clk_pll *pll,
|
||||
pllcon |= rate->frac << RK3036_PLLCON2_FRAC_SHIFT;
|
||||
writel_relaxed(pllcon, pll->reg_base + RK3036_PLLCON(2));
|
||||
|
||||
+ /* set pll power up */
|
||||
+ writel(HIWORD_UPDATE(0, RK3036_PLLCON1_PWRDOWN, 0),
|
||||
+ pll->reg_base + RK3036_PLLCON(1));
|
||||
+ udelay(1);
|
||||
+
|
||||
/* wait for the pll to lock */
|
||||
ret = rockchip_rk3036_pll_wait_lock(pll);
|
||||
if (ret) {
|
||||
@@ -692,6 +887,11 @@ static int rockchip_rk3399_pll_set_params(struct rockchip_clk_pll *pll,
|
||||
rate_change_remuxed = 1;
|
||||
}
|
||||
|
||||
+ /* set pll power down */
|
||||
+ writel(HIWORD_UPDATE(RK3399_PLLCON3_PWRDOWN,
|
||||
+ RK3399_PLLCON3_PWRDOWN, 0),
|
||||
+ pll->reg_base + RK3399_PLLCON(3));
|
||||
+
|
||||
/* update pll values */
|
||||
writel_relaxed(HIWORD_UPDATE(rate->fbdiv, RK3399_PLLCON0_FBDIV_MASK,
|
||||
RK3399_PLLCON0_FBDIV_SHIFT),
|
||||
@@ -715,6 +915,12 @@ static int rockchip_rk3399_pll_set_params(struct rockchip_clk_pll *pll,
|
||||
RK3399_PLLCON3_DSMPD_SHIFT),
|
||||
pll->reg_base + RK3399_PLLCON(3));
|
||||
|
||||
+ /* set pll power up */
|
||||
+ writel(HIWORD_UPDATE(0,
|
||||
+ RK3399_PLLCON3_PWRDOWN, 0),
|
||||
+ pll->reg_base + RK3399_PLLCON(3));
|
||||
+ udelay(1);
|
||||
+
|
||||
/* wait for the pll to lock */
|
||||
ret = rockchip_rk3399_pll_wait_lock(pll);
|
||||
if (ret) {
|
||||
diff --git a/drivers/clk/rockchip/clk-rk3228.c b/drivers/clk/rockchip/clk-rk3228.c
|
||||
index 7343d2d76..aca1a483a 100644
|
||||
--- a/drivers/clk/rockchip/clk-rk3228.c
|
||||
+++ b/drivers/clk/rockchip/clk-rk3228.c
|
||||
@@ -15,6 +15,10 @@
|
||||
|
||||
#define RK3228_GRF_SOC_STATUS0 0x480
|
||||
|
||||
+#define RK3228_UART_FRAC_MAX_PRATE 600000000
|
||||
+#define RK3228_SPDIF_FRAC_MAX_PRATE 600000000
|
||||
+#define RK3228_I2S_FRAC_MAX_PRATE 600000000
|
||||
+
|
||||
enum rk3228_plls {
|
||||
apll, dpll, cpll, gpll,
|
||||
};
|
||||
@@ -420,7 +424,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
|
||||
COMPOSITE_FRACMUX(0, "i2s0_frac", "i2s0_src", CLK_SET_RATE_PARENT,
|
||||
RK2928_CLKSEL_CON(8), 0,
|
||||
RK2928_CLKGATE_CON(0), 4, GFLAGS,
|
||||
- &rk3228_i2s0_fracmux),
|
||||
+ &rk3228_i2s0_fracmux, RK3228_I2S_FRAC_MAX_PRATE),
|
||||
GATE(SCLK_I2S0, "sclk_i2s0", "i2s0_pre", CLK_SET_RATE_PARENT,
|
||||
RK2928_CLKGATE_CON(0), 5, GFLAGS),
|
||||
|
||||
@@ -430,7 +434,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
|
||||
COMPOSITE_FRACMUX(0, "i2s1_frac", "i2s1_src", CLK_SET_RATE_PARENT,
|
||||
RK2928_CLKSEL_CON(7), 0,
|
||||
RK2928_CLKGATE_CON(0), 11, GFLAGS,
|
||||
- &rk3228_i2s1_fracmux),
|
||||
+ &rk3228_i2s1_fracmux, RK3228_I2S_FRAC_MAX_PRATE),
|
||||
GATE(SCLK_I2S1, "sclk_i2s1", "i2s1_pre", CLK_SET_RATE_PARENT,
|
||||
RK2928_CLKGATE_CON(0), 14, GFLAGS),
|
||||
COMPOSITE_NODIV(SCLK_I2S_OUT, "i2s_out", mux_i2s_out_p, 0,
|
||||
@@ -443,7 +447,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
|
||||
COMPOSITE_FRACMUX(0, "i2s2_frac", "i2s2_src", CLK_SET_RATE_PARENT,
|
||||
RK2928_CLKSEL_CON(30), 0,
|
||||
RK2928_CLKGATE_CON(0), 8, GFLAGS,
|
||||
- &rk3228_i2s2_fracmux),
|
||||
+ &rk3228_i2s2_fracmux, RK3228_I2S_FRAC_MAX_PRATE),
|
||||
GATE(SCLK_I2S2, "sclk_i2s2", "i2s2_pre", CLK_SET_RATE_PARENT,
|
||||
RK2928_CLKGATE_CON(0), 9, GFLAGS),
|
||||
|
||||
@@ -453,7 +457,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
|
||||
COMPOSITE_FRACMUX(0, "spdif_frac", "sclk_spdif_src", CLK_SET_RATE_PARENT,
|
||||
RK2928_CLKSEL_CON(20), 0,
|
||||
RK2928_CLKGATE_CON(2), 12, GFLAGS,
|
||||
- &rk3228_spdif_fracmux),
|
||||
+ &rk3228_spdif_fracmux, RK3228_SPDIF_FRAC_MAX_PRATE),
|
||||
|
||||
GATE(0, "jtag", "ext_jtag", CLK_IGNORE_UNUSED,
|
||||
RK2928_CLKGATE_CON(1), 3, GFLAGS),
|
||||
@@ -488,15 +492,15 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
|
||||
COMPOSITE_FRACMUX(0, "uart0_frac", "uart0_src", CLK_SET_RATE_PARENT,
|
||||
RK2928_CLKSEL_CON(17), 0,
|
||||
RK2928_CLKGATE_CON(1), 9, GFLAGS,
|
||||
- &rk3228_uart0_fracmux),
|
||||
+ &rk3228_uart0_fracmux, RK3228_UART_FRAC_MAX_PRATE),
|
||||
COMPOSITE_FRACMUX(0, "uart1_frac", "uart1_src", CLK_SET_RATE_PARENT,
|
||||
RK2928_CLKSEL_CON(18), 0,
|
||||
RK2928_CLKGATE_CON(1), 11, GFLAGS,
|
||||
- &rk3228_uart1_fracmux),
|
||||
+ &rk3228_uart1_fracmux, RK3228_UART_FRAC_MAX_PRATE),
|
||||
COMPOSITE_FRACMUX(0, "uart2_frac", "uart2_src", CLK_SET_RATE_PARENT,
|
||||
RK2928_CLKSEL_CON(19), 0,
|
||||
RK2928_CLKGATE_CON(1), 13, GFLAGS,
|
||||
- &rk3228_uart2_fracmux),
|
||||
+ &rk3228_uart2_fracmux, RK3228_UART_FRAC_MAX_PRATE),
|
||||
|
||||
COMPOSITE(SCLK_NANDC, "sclk_nandc", mux_pll_src_2plls_p, 0,
|
||||
RK2928_CLKSEL_CON(2), 14, 1, MFLAGS, 8, 5, DFLAGS,
|
||||
diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
|
||||
index 049e5e0b6..d8e744c22 100644
|
||||
--- a/drivers/clk/rockchip/clk.c
|
||||
+++ b/drivers/clk/rockchip/clk.c
|
||||
@@ -210,7 +229,7 @@ static struct clk *rockchip_clk_register_frac_branch(
|
||||
void __iomem *base, int muxdiv_offset, u8 div_flags,
|
||||
int gate_offset, u8 gate_shift, u8 gate_flags,
|
||||
unsigned long flags, struct rockchip_clk_branch *child,
|
||||
- spinlock_t *lock)
|
||||
+ unsigned long max_prate, spinlock_t *lock)
|
||||
{
|
||||
struct clk_hw *hw;
|
||||
struct rockchip_clk_frac *frac;
|
||||
@@ -251,6 +270,7 @@ static struct clk *rockchip_clk_register_frac_branch(
|
||||
div->nmask = GENMASK(div->nwidth - 1, 0) << div->nshift;
|
||||
div->lock = lock;
|
||||
div->approximation = rockchip_fractional_approximation;
|
||||
+ div->max_prate = max_prate;
|
||||
div_ops = &clk_fractional_divider_ops;
|
||||
|
||||
hw = clk_hw_register_composite(NULL, name, parent_names, num_parents,
|
||||
@@ -387,6 +407,8 @@ struct rockchip_clk_provider *rockchip_clk_init(struct device_node *np,
|
||||
|
||||
ctx->grf = syscon_regmap_lookup_by_phandle(ctx->cru_node,
|
||||
"rockchip,grf");
|
||||
+ ctx->pmugrf = syscon_regmap_lookup_by_phandle(ctx->cru_node,
|
||||
+ "rockchip,pmugrf");
|
||||
|
||||
return ctx;
|
||||
|
||||
@@ -465,6 +487,13 @@ void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx,
|
||||
list->mux_shift, list->mux_width,
|
||||
list->mux_flags);
|
||||
break;
|
||||
+ case branch_muxpmugrf:
|
||||
+ clk = rockchip_clk_register_muxgrf(list->name,
|
||||
+ list->parent_names, list->num_parents,
|
||||
+ flags, ctx->pmugrf, list->muxdiv_offset,
|
||||
+ list->mux_shift, list->mux_width,
|
||||
+ list->mux_flags);
|
||||
+ break;
|
||||
case branch_divider:
|
||||
if (list->div_table)
|
||||
clk = clk_register_divider_table(NULL,
|
||||
@@ -488,7 +517,7 @@ void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx,
|
||||
list->div_flags,
|
||||
list->gate_offset, list->gate_shift,
|
||||
list->gate_flags, flags, list->child,
|
||||
- &ctx->lock);
|
||||
+ list->max_prate, &ctx->lock);
|
||||
break;
|
||||
case branch_half_divider:
|
||||
clk = rockchip_clk_register_halfdiv(list->name,
|
||||
diff --git a/drivers/clk/rockchip/clk.h b/drivers/clk/rockchip/clk.h
|
||||
index 7aa45cc70..6becf40a8 100644
|
||||
--- a/drivers/clk/rockchip/clk.h
|
||||
+++ b/drivers/clk/rockchip/clk.h
|
||||
@@ -266,6 +266,7 @@ struct rockchip_clk_provider {
|
||||
struct clk_onecell_data clk_data;
|
||||
struct device_node *cru_node;
|
||||
struct regmap *grf;
|
||||
+ struct regmap *pmugrf;
|
||||
spinlock_t lock;
|
||||
};
|
||||
|
||||
@@ -427,6 +428,7 @@ enum rockchip_clk_branch_type {
|
||||
branch_composite,
|
||||
branch_mux,
|
||||
branch_muxgrf,
|
||||
+ branch_muxpmugrf,
|
||||
branch_divider,
|
||||
branch_fraction_divider,
|
||||
branch_gate,
|
||||
@@ -457,6 +459,7 @@ struct rockchip_clk_branch {
|
||||
u8 gate_shift;
|
||||
u8 gate_flags;
|
||||
struct rockchip_clk_branch *child;
|
||||
+ unsigned long max_prate;
|
||||
};
|
||||
|
||||
#define COMPOSITE(_id, cname, pnames, f, mo, ms, mw, mf, ds, dw,\
|
||||
@@ -596,7 +599,7 @@ struct rockchip_clk_branch {
|
||||
.gate_offset = -1, \
|
||||
}
|
||||
|
||||
-#define COMPOSITE_FRAC(_id, cname, pname, f, mo, df, go, gs, gf)\
|
||||
+#define COMPOSITE_FRAC(_id, cname, pname, f, mo, df, go, gs, gf, prate)\
|
||||
{ \
|
||||
.id = _id, \
|
||||
.branch_type = branch_fraction_divider, \
|
||||
@@ -611,9 +614,10 @@ struct rockchip_clk_branch {
|
||||
.gate_offset = go, \
|
||||
.gate_shift = gs, \
|
||||
.gate_flags = gf, \
|
||||
+ .max_prate = prate, \
|
||||
}
|
||||
|
||||
-#define COMPOSITE_FRACMUX(_id, cname, pname, f, mo, df, go, gs, gf, ch) \
|
||||
+#define COMPOSITE_FRACMUX(_id, cname, pname, f, mo, df, go, gs, gf, ch, prate) \
|
||||
{ \
|
||||
.id = _id, \
|
||||
.branch_type = branch_fraction_divider, \
|
||||
@@ -629,9 +633,10 @@ struct rockchip_clk_branch {
|
||||
.gate_shift = gs, \
|
||||
.gate_flags = gf, \
|
||||
.child = ch, \
|
||||
+ .max_prate = prate, \
|
||||
}
|
||||
|
||||
-#define COMPOSITE_FRACMUX_NOGATE(_id, cname, pname, f, mo, df, ch) \
|
||||
+#define COMPOSITE_FRACMUX_NOGATE(_id, cname, pname, f, mo, df, ch, prate) \
|
||||
{ \
|
||||
.id = _id, \
|
||||
.branch_type = branch_fraction_divider, \
|
||||
@@ -645,6 +650,7 @@ struct rockchip_clk_branch {
|
||||
.div_flags = df, \
|
||||
.gate_offset = -1, \
|
||||
.child = ch, \
|
||||
+ .max_prate = prate, \
|
||||
}
|
||||
|
||||
#define COMPOSITE_DDRCLK(_id, cname, pnames, f, mo, ms, mw, \
|
||||
@@ -695,6 +701,21 @@ struct rockchip_clk_branch {
|
||||
.gate_offset = -1, \
|
||||
}
|
||||
|
||||
+#define MUXPMUGRF(_id, cname, pnames, f, o, s, w, mf) \
|
||||
+ { \
|
||||
+ .id = _id, \
|
||||
+ .branch_type = branch_muxpmugrf, \
|
||||
+ .name = cname, \
|
||||
+ .parent_names = pnames, \
|
||||
+ .num_parents = ARRAY_SIZE(pnames), \
|
||||
+ .flags = f, \
|
||||
+ .muxdiv_offset = o, \
|
||||
+ .mux_shift = s, \
|
||||
+ .mux_width = w, \
|
||||
+ .mux_flags = mf, \
|
||||
+ .gate_offset = -1, \
|
||||
+ }
|
||||
+
|
||||
#define DIV(_id, cname, pname, f, o, s, w, df) \
|
||||
{ \
|
||||
.id = _id, \
|
||||
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
|
||||
index d83b82930..d54624046 100644
|
||||
--- a/include/linux/clk-provider.h
|
||||
+++ b/include/linux/clk-provider.h
|
||||
@@ -989,6 +989,7 @@ struct clk_hw *devm_clk_hw_register_fixed_factor(struct device *dev,
|
||||
* @mwidth: width of the numerator bit field
|
||||
* @nshift: shift to the denominator bit field
|
||||
* @nwidth: width of the denominator bit field
|
||||
+ * @max_parent: the maximum frequency of fractional divider parent clock
|
||||
* @lock: register lock
|
||||
*
|
||||
* Clock with adjustable fractional divider affecting its output frequency.
|
||||
@@ -1012,6 +1013,7 @@ struct clk_fractional_divider {
|
||||
u8 nwidth;
|
||||
u32 nmask;
|
||||
u8 flags;
|
||||
+ unsigned long max_prate;
|
||||
void (*approximation)(struct clk_hw *hw,
|
||||
unsigned long rate, unsigned long *parent_rate,
|
||||
unsigned long *m, unsigned long *n);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
From 6408e6688b18e5c712c711110d196a4e95f3f870 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Thu, 9 Sep 2021 16:37:28 +0000
|
||||
Subject: [PATCH 2/4] 01-linux-1000-export-mm_trace_rss_stat
|
||||
|
||||
---
|
||||
mm/memory.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/mm/memory.c b/mm/memory.c
|
||||
index 25fc46e87..7ef0adaa5 100644
|
||||
--- a/mm/memory.c
|
||||
+++ b/mm/memory.c
|
||||
@@ -171,6 +171,7 @@ void mm_trace_rss_stat(struct mm_struct *mm, int member, long count)
|
||||
{
|
||||
trace_rss_stat(mm, member, count);
|
||||
}
|
||||
+EXPORT_SYMBOL(mm_trace_rss_stat);
|
||||
|
||||
#if defined(SPLIT_RSS_COUNTING)
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,782 @@
|
||||
From 92a42b2df843c0f6c2937dc6bdbfe72332c9e557 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Thu, 9 Sep 2021 16:46:33 +0000
|
||||
Subject: [PATCH 3/4] 01-linux-1000-rockchip-wip
|
||||
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk322x.dtsi | 101 +++++++++++++++++-
|
||||
arch/arm/boot/dts/rockchip/rk3xxx.dtsi | 2 +
|
||||
drivers/clk/rockchip/clk-rk3228.c | 61 ++++-------
|
||||
drivers/net/ethernet/arc/emac.h | 14 +++
|
||||
drivers/net/ethernet/arc/emac_main.c | 81 ++++++++++++--
|
||||
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 38 ++++++-
|
||||
drivers/pmdomain/rockchip/pm-domains.c | 23 ++++
|
||||
drivers/usb/dwc2/core.c | 2 +-
|
||||
8 files changed, 266 insertions(+), 56 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk322x.dtsi b/arch/arm/boot/dts/rockchip/rk322x.dtsi
|
||||
index 75af99c76..c50b2ccd7 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk322x.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk322x.dtsi
|
||||
@@ -15,6 +15,7 @@ / {
|
||||
interrupt-parent = <&gic>;
|
||||
|
||||
aliases {
|
||||
+ ethernet0 = &gmac;
|
||||
serial0 = &uart0;
|
||||
serial1 = &uart1;
|
||||
serial2 = &uart2;
|
||||
@@ -105,6 +106,22 @@ arm-pmu {
|
||||
interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>;
|
||||
};
|
||||
|
||||
+ hdmi_sound: hdmi-sound {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,name = "hdmi-sound";
|
||||
+ simple-audio-card,format = "i2s";
|
||||
+ simple-audio-card,mclk-fs = <256>;
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ simple-audio-card,cpu {
|
||||
+ sound-dai = <&i2s0>;
|
||||
+ };
|
||||
+
|
||||
+ simple-audio-card,codec {
|
||||
+ sound-dai = <&hdmi>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
psci {
|
||||
compatible = "arm,psci-1.0", "arm,psci-0.2";
|
||||
method = "smc";
|
||||
@@ -132,6 +149,17 @@ display_subsystem: display-subsystem {
|
||||
ports = <&vop_out>;
|
||||
};
|
||||
|
||||
+ crypto: cypto-controller@100a0000 {
|
||||
+ compatible = "rockchip,rk3288-crypto";
|
||||
+ reg = <0x100a0000 0x4000>;
|
||||
+ interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru HCLK_M_CRYPTO>, <&cru HCLK_S_CRYPTO>,
|
||||
+ <&cru SCLK_CRYPTO>, <&cru ACLK_DMAC>;
|
||||
+ clock-names = "aclk", "hclk", "sclk", "apb_pclk";
|
||||
+ resets = <&cru SRST_CRYPTO>;
|
||||
+ reset-names = "crypto-rst";
|
||||
+ };
|
||||
+
|
||||
i2s1: i2s1@100b0000 {
|
||||
compatible = "rockchip,rk3228-i2s", "rockchip,rk3066-i2s";
|
||||
reg = <0x100b0000 0x4000>;
|
||||
@@ -142,6 +170,7 @@ i2s1: i2s1@100b0000 {
|
||||
dma-names = "tx", "rx";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&i2s1_bus>;
|
||||
+ #sound-dai-cells = <0>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -153,6 +182,7 @@ i2s0: i2s0@100c0000 {
|
||||
clocks = <&cru SCLK_I2S0>, <&cru HCLK_I2S0_8CH>;
|
||||
dmas = <&pdma 11>, <&pdma 12>;
|
||||
dma-names = "tx", "rx";
|
||||
+ #sound-dai-cells = <0>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -166,6 +196,7 @@ spdif: spdif@100d0000 {
|
||||
dma-names = "tx";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&spdif_tx>;
|
||||
+ #sound-dai-cells = <0>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -337,7 +368,7 @@ uart2: serial@11030000 {
|
||||
clocks = <&cru SCLK_UART2>, <&cru PCLK_UART2>;
|
||||
clock-names = "baudclk", "apb_pclk";
|
||||
pinctrl-names = "default";
|
||||
- pinctrl-0 = <&uart2_xfer>;
|
||||
+ pinctrl-0 = <&uart21_xfer>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <4>;
|
||||
status = "disabled";
|
||||
@@ -358,6 +389,10 @@ efuse_id: id@7 {
|
||||
cpu_leakage: cpu_leakage@17 {
|
||||
reg = <0x17 0x1>;
|
||||
};
|
||||
+ hdmi_phy_flag: hdmi-phy-flag@1d {
|
||||
+ reg = <0x1d 0x1>;
|
||||
+ bits = <1 1>;
|
||||
+ };
|
||||
};
|
||||
|
||||
i2c0: i2c@11050000 {
|
||||
@@ -554,6 +589,11 @@ map1 {
|
||||
<&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
<&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||
};
|
||||
+ map2 {
|
||||
+ trip = <&cpu_alert1>;
|
||||
+ cooling-device =
|
||||
+ <&gpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||
+ };
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -584,6 +624,8 @@ hdmi_phy: hdmi-phy@12030000 {
|
||||
clock-names = "sysclk", "refoclk", "refpclk";
|
||||
#clock-cells = <0>;
|
||||
clock-output-names = "hdmiphy_phy";
|
||||
+ nvmem-cells = <&hdmi_phy_flag>;
|
||||
+ nvmem-cell-names = "hdmi-phy-flag";
|
||||
#phy-cells = <0>;
|
||||
status = "disabled";
|
||||
};
|
||||
@@ -607,7 +649,27 @@ gpu: gpu@20000000 {
|
||||
clock-names = "bus", "core";
|
||||
power-domains = <&power RK3228_PD_GPU>;
|
||||
resets = <&cru SRST_GPU_A>;
|
||||
- status = "disabled";
|
||||
+ operating-points-v2 = <&gpu_opp_table>;
|
||||
+ #cooling-cells = <2>; /* min followed by max */
|
||||
+ };
|
||||
+
|
||||
+ gpu_opp_table: opp-table2 {
|
||||
+ compatible = "operating-points-v2";
|
||||
+
|
||||
+ opp-200000000 {
|
||||
+ opp-hz = /bits/ 64 <200000000>;
|
||||
+ opp-microvolt = <1050000>;
|
||||
+ };
|
||||
+
|
||||
+ opp-300000000 {
|
||||
+ opp-hz = /bits/ 64 <300000000>;
|
||||
+ opp-microvolt = <1050000>;
|
||||
+ };
|
||||
+
|
||||
+ opp-500000000 {
|
||||
+ opp-hz = /bits/ 64 <500000000>;
|
||||
+ opp-microvolt = <1150000>;
|
||||
+ };
|
||||
};
|
||||
|
||||
vpu: video-codec@20020000 {
|
||||
@@ -727,6 +789,7 @@ hdmi: hdmi@200a0000 {
|
||||
phys = <&hdmi_phy>;
|
||||
phy-names = "hdmi";
|
||||
rockchip,grf = <&grf>;
|
||||
+ #sound-dai-cells = <0>;
|
||||
status = "disabled";
|
||||
|
||||
ports {
|
||||
@@ -748,9 +811,13 @@ sdmmc: mmc@30000000 {
|
||||
clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>,
|
||||
<&cru SCLK_SDMMC_DRV>, <&cru SCLK_SDMMC_SAMPLE>;
|
||||
clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
|
||||
+ bus-width = <4>;
|
||||
fifo-depth = <0x100>;
|
||||
+ max-frequency = <150000000>;
|
||||
pinctrl-names = "default";
|
||||
- pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_bus4>;
|
||||
+ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_bus4 &sdmmc_pwr>;
|
||||
+ resets = <&cru SRST_SDMMC>;
|
||||
+ reset-names = "reset";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -760,10 +827,14 @@ sdio: mmc@30010000 {
|
||||
interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&cru HCLK_SDIO>, <&cru SCLK_SDIO>,
|
||||
<&cru SCLK_SDIO_DRV>, <&cru SCLK_SDIO_SAMPLE>;
|
||||
+ bus-width = <4>;
|
||||
clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
|
||||
fifo-depth = <0x100>;
|
||||
+ max-frequency = <150000000>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&sdio_clk &sdio_cmd &sdio_bus4>;
|
||||
+ resets = <&cru SRST_SDIO>;
|
||||
+ reset-names = "reset";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -771,14 +842,13 @@ emmc: mmc@30020000 {
|
||||
compatible = "rockchip,rk3228-dw-mshc", "rockchip,rk3288-dw-mshc";
|
||||
reg = <0x30020000 0x4000>;
|
||||
interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
|
||||
- clock-frequency = <37500000>;
|
||||
- max-frequency = <37500000>;
|
||||
clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>,
|
||||
<&cru SCLK_EMMC_DRV>, <&cru SCLK_EMMC_SAMPLE>;
|
||||
clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
|
||||
bus-width = <8>;
|
||||
rockchip,default-sample-phase = <158>;
|
||||
fifo-depth = <0x100>;
|
||||
+ max-frequency = <150000000>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>;
|
||||
resets = <&cru SRST_EMMC>;
|
||||
@@ -1029,6 +1099,10 @@ sdmmc_bus4: sdmmc-bus4 {
|
||||
<1 RK_PC4 1 &pcfg_pull_none_drv_12ma>,
|
||||
<1 RK_PC5 1 &pcfg_pull_none_drv_12ma>;
|
||||
};
|
||||
+
|
||||
+ sdmmc_pwr: sdmmc-pwr {
|
||||
+ rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
};
|
||||
|
||||
sdio {
|
||||
@@ -1261,13 +1335,30 @@ uart1_xfer: uart1-xfer {
|
||||
<1 RK_PB2 1 &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
+ uart11_xfer: uart11-xfer {
|
||||
+ rockchip,pins = <3 RK_PB6 1 &pcfg_pull_up>,
|
||||
+ <3 RK_PB5 1 &pcfg_pull_none>;
|
||||
+ };
|
||||
+
|
||||
uart1_cts: uart1-cts {
|
||||
rockchip,pins = <1 RK_PB0 1 &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
+ uart11_cts: uart11-cts {
|
||||
+ rockchip,pins = <3 RK_PA7 1 &pcfg_pull_none>;
|
||||
+ };
|
||||
+
|
||||
uart1_rts: uart1-rts {
|
||||
rockchip,pins = <1 RK_PB3 1 &pcfg_pull_none>;
|
||||
};
|
||||
+
|
||||
+ uart11_rts: uart11-rts {
|
||||
+ rockchip,pins = <3 RK_PA6 1 &pcfg_pull_none>;
|
||||
+ };
|
||||
+
|
||||
+ uart11_rts_gpio: uart11-rts-gpio {
|
||||
+ rockchip,pins = <3 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
};
|
||||
|
||||
uart2 {
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3xxx.dtsi b/arch/arm/boot/dts/rockchip/rk3xxx.dtsi
|
||||
index 616a828e0..f233b7a77 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3xxx.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3xxx.dtsi
|
||||
@@ -64,6 +64,8 @@ L2: cache-controller@10138000 {
|
||||
reg = <0x10138000 0x1000>;
|
||||
cache-unified;
|
||||
cache-level = <2>;
|
||||
+ prefetch-data = <1>;
|
||||
+ prefetch-instr = <1>;
|
||||
};
|
||||
|
||||
scu@1013c000 {
|
||||
diff --git a/drivers/clk/rockchip/clk-rk3228.c b/drivers/clk/rockchip/clk-rk3228.c
|
||||
index aca1a483a..7250adc64 100644
|
||||
--- a/drivers/clk/rockchip/clk-rk3228.c
|
||||
+++ b/drivers/clk/rockchip/clk-rk3228.c
|
||||
@@ -135,24 +135,22 @@ static const struct rockchip_cpuclk_reg_data rk3228_cpuclk_data = {
|
||||
|
||||
PNAME(mux_pll_p) = { "clk_24m", "xin24m" };
|
||||
|
||||
-PNAME(mux_ddrphy_p) = { "dpll_ddr", "gpll_ddr", "apll_ddr" };
|
||||
+PNAME(mux_ddrphy_p) = { "dpll", "gpll", "apll" };
|
||||
PNAME(mux_armclk_p) = { "apll_core", "gpll_core", "dpll_core" };
|
||||
PNAME(mux_usb480m_phy_p) = { "usb480m_phy0", "usb480m_phy1" };
|
||||
PNAME(mux_usb480m_p) = { "usb480m_phy", "xin24m" };
|
||||
PNAME(mux_hdmiphy_p) = { "hdmiphy_phy", "xin24m" };
|
||||
-PNAME(mux_aclk_cpu_src_p) = { "cpll_aclk_cpu", "gpll_aclk_cpu", "hdmiphy_aclk_cpu" };
|
||||
|
||||
PNAME(mux_pll_src_4plls_p) = { "cpll", "gpll", "hdmiphy", "usb480m" };
|
||||
PNAME(mux_pll_src_3plls_p) = { "cpll", "gpll", "hdmiphy" };
|
||||
PNAME(mux_pll_src_2plls_p) = { "cpll", "gpll" };
|
||||
PNAME(mux_sclk_hdmi_cec_p) = { "cpll", "gpll", "xin24m" };
|
||||
-PNAME(mux_aclk_peri_src_p) = { "cpll_peri", "gpll_peri", "hdmiphy_peri" };
|
||||
PNAME(mux_mmc_src_p) = { "cpll", "gpll", "xin24m", "usb480m" };
|
||||
PNAME(mux_pll_src_cpll_gpll_usb480m_p) = { "cpll", "gpll", "usb480m" };
|
||||
|
||||
PNAME(mux_sclk_rga_p) = { "gpll", "cpll", "sclk_rga_src" };
|
||||
|
||||
-PNAME(mux_sclk_vop_src_p) = { "gpll_vop", "cpll_vop" };
|
||||
+PNAME(mux_sclk_vop_src_p) = { "gpll", "cpll" };
|
||||
PNAME(mux_dclk_vop_p) = { "hdmiphy", "sclk_vop_pre" };
|
||||
|
||||
PNAME(mux_i2s0_p) = { "i2s0_src", "i2s0_frac", "ext_i2s", "xin12m" };
|
||||
@@ -221,27 +219,23 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
|
||||
RK2928_CLKSEL_CON(4), 8, 5, DFLAGS),
|
||||
|
||||
/* PD_DDR */
|
||||
- GATE(0, "apll_ddr", "apll", CLK_IGNORE_UNUSED,
|
||||
+ COMPOSITE(0, "clk_ddrphy_src", mux_ddrphy_p, CLK_IGNORE_UNUSED,
|
||||
+ RK2928_CLKSEL_CON(26), 8, 2, MFLAGS, 0, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO,
|
||||
RK2928_CLKGATE_CON(0), 2, GFLAGS),
|
||||
- GATE(0, "dpll_ddr", "dpll", CLK_IGNORE_UNUSED,
|
||||
- RK2928_CLKGATE_CON(0), 2, GFLAGS),
|
||||
- GATE(0, "gpll_ddr", "gpll", CLK_IGNORE_UNUSED,
|
||||
- RK2928_CLKGATE_CON(0), 2, GFLAGS),
|
||||
- COMPOSITE(0, "ddrphy4x", mux_ddrphy_p, CLK_IGNORE_UNUSED,
|
||||
- RK2928_CLKSEL_CON(26), 8, 2, MFLAGS, 0, 3, DFLAGS | CLK_DIVIDER_POWER_OF_TWO,
|
||||
+ GATE(0, "ddrphy4x", "clk_ddrphy_src", CLK_IGNORE_UNUSED,
|
||||
RK2928_CLKGATE_CON(7), 1, GFLAGS),
|
||||
- GATE(0, "ddrc", "ddrphy_pre", CLK_IGNORE_UNUSED,
|
||||
+ FACTOR_GATE(0, "ddrc", "clk_ddrphy_src", CLK_IGNORE_UNUSED, 1, 4,
|
||||
RK2928_CLKGATE_CON(8), 5, GFLAGS),
|
||||
- FACTOR_GATE(0, "ddrphy", "ddrphy4x", CLK_IGNORE_UNUSED, 1, 4,
|
||||
+ FACTOR_GATE(0, "ddrphy", "clk_ddrphy_src", CLK_IGNORE_UNUSED, 1, 4,
|
||||
RK2928_CLKGATE_CON(7), 0, GFLAGS),
|
||||
|
||||
/* PD_CORE */
|
||||
- GATE(0, "dpll_core", "dpll", CLK_IGNORE_UNUSED,
|
||||
- RK2928_CLKGATE_CON(0), 6, GFLAGS),
|
||||
GATE(0, "apll_core", "apll", CLK_IGNORE_UNUSED,
|
||||
RK2928_CLKGATE_CON(0), 6, GFLAGS),
|
||||
GATE(0, "gpll_core", "gpll", CLK_IGNORE_UNUSED,
|
||||
RK2928_CLKGATE_CON(0), 6, GFLAGS),
|
||||
+ GATE(0, "dpll_core", "dpll", CLK_IGNORE_UNUSED,
|
||||
+ RK2928_CLKGATE_CON(0), 6, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "pclk_dbg", "armclk", CLK_IGNORE_UNUSED,
|
||||
RK2928_CLKSEL_CON(1), 0, 4, DFLAGS | CLK_DIVIDER_READ_ONLY,
|
||||
RK2928_CLKGATE_CON(4), 1, GFLAGS),
|
||||
@@ -258,14 +252,9 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
|
||||
RK2928_MISC_CON, 15, 1, MFLAGS),
|
||||
|
||||
/* PD_BUS */
|
||||
- GATE(0, "hdmiphy_aclk_cpu", "hdmiphy", CLK_IGNORE_UNUSED,
|
||||
+ COMPOSITE(0, "aclk_cpu_src", mux_pll_src_3plls_p, 0,
|
||||
+ RK2928_CLKSEL_CON(0), 13, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK2928_CLKGATE_CON(0), 1, GFLAGS),
|
||||
- GATE(0, "gpll_aclk_cpu", "gpll", CLK_IGNORE_UNUSED,
|
||||
- RK2928_CLKGATE_CON(0), 1, GFLAGS),
|
||||
- GATE(0, "cpll_aclk_cpu", "cpll", CLK_IGNORE_UNUSED,
|
||||
- RK2928_CLKGATE_CON(0), 1, GFLAGS),
|
||||
- COMPOSITE_NOGATE(0, "aclk_cpu_src", mux_aclk_cpu_src_p, 0,
|
||||
- RK2928_CLKSEL_CON(0), 13, 2, MFLAGS, 8, 5, DFLAGS),
|
||||
GATE(ACLK_CPU, "aclk_cpu", "aclk_cpu_src", 0,
|
||||
RK2928_CLKGATE_CON(6), 0, GFLAGS),
|
||||
COMPOSITE_NOMUX(HCLK_CPU, "hclk_cpu", "aclk_cpu_src", 0,
|
||||
@@ -338,14 +327,9 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
|
||||
RK2928_CLKGATE_CON(3), 8, GFLAGS),
|
||||
|
||||
/* PD_PERI */
|
||||
- GATE(0, "cpll_peri", "cpll", CLK_IGNORE_UNUSED,
|
||||
- RK2928_CLKGATE_CON(2), 0, GFLAGS),
|
||||
- GATE(0, "gpll_peri", "gpll", CLK_IGNORE_UNUSED,
|
||||
+ COMPOSITE(0, "aclk_peri_src", mux_pll_src_3plls_p, 0,
|
||||
+ RK2928_CLKSEL_CON(10), 10, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK2928_CLKGATE_CON(2), 0, GFLAGS),
|
||||
- GATE(0, "hdmiphy_peri", "hdmiphy", CLK_IGNORE_UNUSED,
|
||||
- RK2928_CLKGATE_CON(2), 0, GFLAGS),
|
||||
- COMPOSITE_NOGATE(0, "aclk_peri_src", mux_aclk_peri_src_p, 0,
|
||||
- RK2928_CLKSEL_CON(10), 10, 2, MFLAGS, 0, 5, DFLAGS),
|
||||
COMPOSITE_NOMUX(PCLK_PERI, "pclk_peri", "aclk_peri_src", 0,
|
||||
RK2928_CLKSEL_CON(10), 12, 3, DFLAGS,
|
||||
RK2928_CLKGATE_CON(5), 2, GFLAGS),
|
||||
@@ -380,7 +364,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
|
||||
RK2928_CLKGATE_CON(10), 12, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_WIFI, "sclk_wifi", mux_pll_src_cpll_gpll_usb480m_p, 0,
|
||||
- RK2928_CLKSEL_CON(23), 5, 2, MFLAGS, 0, 6, DFLAGS,
|
||||
+ RK2928_CLKSEL_CON(23), 5, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK2928_CLKGATE_CON(2), 15, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_SDMMC, "sclk_sdmmc", mux_mmc_src_p, 0,
|
||||
@@ -403,12 +387,9 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
|
||||
* Clock-Architecture Diagram 2
|
||||
*/
|
||||
|
||||
- GATE(0, "gpll_vop", "gpll", 0,
|
||||
- RK2928_CLKGATE_CON(3), 1, GFLAGS),
|
||||
- GATE(0, "cpll_vop", "cpll", 0,
|
||||
+ COMPOSITE_NODIV(0, "sclk_vop_src", mux_sclk_vop_src_p, 0,
|
||||
+ RK2928_CLKSEL_CON(27), 0, 1, MFLAGS,
|
||||
RK2928_CLKGATE_CON(3), 1, GFLAGS),
|
||||
- MUX(0, "sclk_vop_src", mux_sclk_vop_src_p, 0,
|
||||
- RK2928_CLKSEL_CON(27), 0, 1, MFLAGS),
|
||||
DIV(DCLK_HDMI_PHY, "dclk_hdmiphy", "sclk_vop_src", 0,
|
||||
RK2928_CLKSEL_CON(29), 0, 3, DFLAGS),
|
||||
DIV(0, "sclk_vop_pre", "sclk_vop_src", 0,
|
||||
@@ -640,13 +621,13 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
|
||||
|
||||
/* PD_MMC */
|
||||
MMC(SCLK_SDMMC_DRV, "sdmmc_drv", "sclk_sdmmc", RK3228_SDMMC_CON0, 1),
|
||||
- MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "sclk_sdmmc", RK3228_SDMMC_CON1, 0),
|
||||
+ MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "sclk_sdmmc", RK3228_SDMMC_CON1, 1),
|
||||
|
||||
MMC(SCLK_SDIO_DRV, "sdio_drv", "sclk_sdio", RK3228_SDIO_CON0, 1),
|
||||
- MMC(SCLK_SDIO_SAMPLE, "sdio_sample", "sclk_sdio", RK3228_SDIO_CON1, 0),
|
||||
+ MMC(SCLK_SDIO_SAMPLE, "sdio_sample", "sclk_sdio", RK3228_SDIO_CON1, 1),
|
||||
|
||||
MMC(SCLK_EMMC_DRV, "emmc_drv", "sclk_emmc", RK3228_EMMC_CON0, 1),
|
||||
- MMC(SCLK_EMMC_SAMPLE, "emmc_sample", "sclk_emmc", RK3228_EMMC_CON1, 0),
|
||||
+ MMC(SCLK_EMMC_SAMPLE, "emmc_sample", "sclk_emmc", RK3228_EMMC_CON1, 1),
|
||||
};
|
||||
|
||||
static const char *const rk3228_critical_clocks[] __initconst = {
|
||||
@@ -661,6 +642,7 @@ static const char *const rk3228_critical_clocks[] __initconst = {
|
||||
"aclk_vop_noc",
|
||||
"aclk_hdcp_noc",
|
||||
"hclk_vio_ahb_arbi",
|
||||
+ "hclk_vio_h2p",
|
||||
"hclk_vio_noc",
|
||||
"hclk_vop_noc",
|
||||
"hclk_host0_arb",
|
||||
@@ -678,10 +660,13 @@ static const char *const rk3228_critical_clocks[] __initconst = {
|
||||
"pclk_ddrphy",
|
||||
"pclk_acodecphy",
|
||||
"pclk_phy_noc",
|
||||
+ "pclk_vio_h2p",
|
||||
"aclk_vpu_noc",
|
||||
"aclk_rkvdec_noc",
|
||||
+ "aclk_rkvdec",
|
||||
"hclk_vpu_noc",
|
||||
"hclk_rkvdec_noc",
|
||||
+ "hclk_rkvdec",
|
||||
};
|
||||
|
||||
static void __init rk3228_clk_init(struct device_node *np)
|
||||
diff --git a/drivers/net/ethernet/arc/emac.h b/drivers/net/ethernet/arc/emac.h
|
||||
index d820ae03a..0ac87288b 100644
|
||||
--- a/drivers/net/ethernet/arc/emac.h
|
||||
+++ b/drivers/net/ethernet/arc/emac.h
|
||||
@@ -91,6 +91,20 @@ struct arc_emac_bd {
|
||||
#define RX_RING_SZ (RX_BD_NUM * sizeof(struct arc_emac_bd))
|
||||
#define TX_RING_SZ (TX_BD_NUM * sizeof(struct arc_emac_bd))
|
||||
|
||||
+/* PHY fixups */
|
||||
+#define RTL_8201F_PHY_ID 0x001cc816
|
||||
+
|
||||
+#define RTL_8201F_PG_SELECT_REG 0x1f
|
||||
+#define RTL_8201F_PG4_EEE_REG 0x10
|
||||
+#define RTL_8201F_PG4_EEE_RX_QUIET_EN BIT(8)
|
||||
+#define RTL_8201F_PG4_EEE_TX_QUIET_EN BIT(9)
|
||||
+#define RTL_8201F_PG4_EEE_NWAY_EN BIT(12)
|
||||
+#define RTL_8201F_PG4_EEE_10M_CAP BIT(13)
|
||||
+#define RTL_8201F_PG7_RMSR_REG 0x10
|
||||
+#define RTL_8201F_PG7_RMSR_CLK_DIR_IN BIT(12)
|
||||
+#define RTL_8201F_PG0_PSMR_REG 0x18
|
||||
+#define RTL_8201F_PG0_PSMR_PWRSVE_EN BIT(15)
|
||||
+
|
||||
/**
|
||||
* struct buffer_state - Stores Rx/Tx buffer state.
|
||||
* @sk_buff: Pointer to socket buffer.
|
||||
diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
|
||||
index 67b8113a2..40332a976 100644
|
||||
--- a/drivers/net/ethernet/arc/emac_main.c
|
||||
+++ b/drivers/net/ethernet/arc/emac_main.c
|
||||
@@ -140,7 +140,7 @@ static void arc_emac_tx_clean(struct net_device *ndev)
|
||||
stats->tx_bytes += skb->len;
|
||||
}
|
||||
|
||||
- dma_unmap_single(&ndev->dev, dma_unmap_addr(tx_buff, addr),
|
||||
+ dma_unmap_single(ndev->dev.parent, dma_unmap_addr(tx_buff, addr),
|
||||
dma_unmap_len(tx_buff, len), DMA_TO_DEVICE);
|
||||
|
||||
/* return the sk_buff to system */
|
||||
@@ -223,9 +223,9 @@ static int arc_emac_rx(struct net_device *ndev, int budget)
|
||||
continue;
|
||||
}
|
||||
|
||||
- addr = dma_map_single(&ndev->dev, (void *)skb->data,
|
||||
+ addr = dma_map_single(ndev->dev.parent, (void *)skb->data,
|
||||
EMAC_BUFFER_SIZE, DMA_FROM_DEVICE);
|
||||
- if (dma_mapping_error(&ndev->dev, addr)) {
|
||||
+ if (dma_mapping_error(ndev->dev.parent, addr)) {
|
||||
if (net_ratelimit())
|
||||
netdev_err(ndev, "cannot map dma buffer\n");
|
||||
dev_kfree_skb(skb);
|
||||
@@ -237,7 +237,7 @@ static int arc_emac_rx(struct net_device *ndev, int budget)
|
||||
}
|
||||
|
||||
/* unmap previosly mapped skb */
|
||||
- dma_unmap_single(&ndev->dev, dma_unmap_addr(rx_buff, addr),
|
||||
+ dma_unmap_single(ndev->dev.parent, dma_unmap_addr(rx_buff, addr),
|
||||
dma_unmap_len(rx_buff, len), DMA_FROM_DEVICE);
|
||||
|
||||
pktlen = info & LEN_MASK;
|
||||
@@ -445,9 +445,9 @@ static int arc_emac_open(struct net_device *ndev)
|
||||
if (unlikely(!rx_buff->skb))
|
||||
return -ENOMEM;
|
||||
|
||||
- addr = dma_map_single(&ndev->dev, (void *)rx_buff->skb->data,
|
||||
+ addr = dma_map_single(ndev->dev.parent, (void *)rx_buff->skb->data,
|
||||
EMAC_BUFFER_SIZE, DMA_FROM_DEVICE);
|
||||
- if (dma_mapping_error(&ndev->dev, addr)) {
|
||||
+ if (dma_mapping_error(ndev->dev.parent, addr)) {
|
||||
netdev_err(ndev, "cannot dma map\n");
|
||||
dev_kfree_skb(rx_buff->skb);
|
||||
return -ENOMEM;
|
||||
@@ -555,7 +555,7 @@ static void arc_free_tx_queue(struct net_device *ndev)
|
||||
struct buffer_state *tx_buff = &priv->tx_buff[i];
|
||||
|
||||
if (tx_buff->skb) {
|
||||
- dma_unmap_single(&ndev->dev,
|
||||
+ dma_unmap_single(ndev->dev.parent,
|
||||
dma_unmap_addr(tx_buff, addr),
|
||||
dma_unmap_len(tx_buff, len),
|
||||
DMA_TO_DEVICE);
|
||||
@@ -586,7 +586,7 @@ static void arc_free_rx_queue(struct net_device *ndev)
|
||||
struct buffer_state *rx_buff = &priv->rx_buff[i];
|
||||
|
||||
if (rx_buff->skb) {
|
||||
- dma_unmap_single(&ndev->dev,
|
||||
+ dma_unmap_single(ndev->dev.parent,
|
||||
dma_unmap_addr(rx_buff, addr),
|
||||
dma_unmap_len(rx_buff, len),
|
||||
DMA_FROM_DEVICE);
|
||||
@@ -692,10 +692,10 @@ static netdev_tx_t arc_emac_tx(struct sk_buff *skb, struct net_device *ndev)
|
||||
return NETDEV_TX_BUSY;
|
||||
}
|
||||
|
||||
- addr = dma_map_single(&ndev->dev, (void *)skb->data, len,
|
||||
+ addr = dma_map_single(ndev->dev.parent, (void *)skb->data, len,
|
||||
DMA_TO_DEVICE);
|
||||
|
||||
- if (unlikely(dma_mapping_error(&ndev->dev, addr))) {
|
||||
+ if (unlikely(dma_mapping_error(ndev->dev.parent, addr))) {
|
||||
stats->tx_dropped++;
|
||||
stats->tx_errors++;
|
||||
dev_kfree_skb_any(skb);
|
||||
@@ -850,6 +850,62 @@ static const struct net_device_ops arc_emac_netdev_ops = {
|
||||
#endif
|
||||
};
|
||||
|
||||
+/**
|
||||
+ * arc_emac_rtl8201f_phy_fixup
|
||||
+ * @phydev: Pointer to phy_device structure.
|
||||
+ *
|
||||
+ * This function registers a fixup in case RTL8201F's phy
|
||||
+ * clockout is used as reference for the mac interface
|
||||
+ * and disable EEE, since emac can't handle it
|
||||
+ */
|
||||
+static int arc_emac_rtl8201f_phy_fixup(struct phy_device *phydev)
|
||||
+{
|
||||
+ unsigned int reg, curr_pg;
|
||||
+ int err = 0;
|
||||
+
|
||||
+ curr_pg = phy_read(phydev, RTL_8201F_PG_SELECT_REG);
|
||||
+ err = phy_write(phydev, RTL_8201F_PG_SELECT_REG, 4);
|
||||
+ if (err)
|
||||
+ goto out_err;
|
||||
+ mdelay(10);
|
||||
+
|
||||
+ /* disable EEE */
|
||||
+ reg = phy_read(phydev, RTL_8201F_PG4_EEE_REG);
|
||||
+ reg &= ~RTL_8201F_PG4_EEE_RX_QUIET_EN &
|
||||
+ ~RTL_8201F_PG4_EEE_TX_QUIET_EN &
|
||||
+ ~RTL_8201F_PG4_EEE_NWAY_EN &
|
||||
+ ~RTL_8201F_PG4_EEE_10M_CAP;
|
||||
+ err = phy_write(phydev, RTL_8201F_PG4_EEE_REG, reg);
|
||||
+ if (err)
|
||||
+ goto out_err;
|
||||
+
|
||||
+ if (phydev->interface == PHY_INTERFACE_MODE_RMII) {
|
||||
+ err = phy_write(phydev, RTL_8201F_PG_SELECT_REG, 7);
|
||||
+ if (err)
|
||||
+ goto out_err;
|
||||
+ mdelay(10);
|
||||
+
|
||||
+ reg = phy_read(phydev, RTL_8201F_PG7_RMSR_REG);
|
||||
+ err = phy_write(phydev, RTL_8201F_PG_SELECT_REG, 0);
|
||||
+ if (err)
|
||||
+ goto out_err;
|
||||
+ mdelay(10);
|
||||
+
|
||||
+ if (!(reg & RTL_8201F_PG7_RMSR_CLK_DIR_IN)) {
|
||||
+ /* disable powersave if phy's clock output is used */
|
||||
+ reg = phy_read(phydev, RTL_8201F_PG0_PSMR_REG);
|
||||
+ reg &= ~RTL_8201F_PG0_PSMR_PWRSVE_EN & 0xffff;
|
||||
+ err = phy_write(phydev, RTL_8201F_PG0_PSMR_REG, reg);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+out_err:
|
||||
+ phy_write(phydev, RTL_8201F_PG_SELECT_REG, curr_pg);
|
||||
+ mdelay(10);
|
||||
+
|
||||
+ return err;
|
||||
+};
|
||||
+
|
||||
int arc_emac_probe(struct net_device *ndev, int interface)
|
||||
{
|
||||
struct device *dev = ndev->dev.parent;
|
||||
@@ -970,6 +1026,11 @@ int arc_emac_probe(struct net_device *ndev, int interface)
|
||||
goto out_clken;
|
||||
}
|
||||
|
||||
+ err = phy_register_fixup_for_uid(RTL_8201F_PHY_ID, 0xfffff0,
|
||||
+ arc_emac_rtl8201f_phy_fixup);
|
||||
+ if (err)
|
||||
+ dev_warn(dev, "Cannot register PHY board fixup.\n");
|
||||
+
|
||||
phydev = of_phy_connect(ndev, phy_node, arc_emac_adjust_link, 0,
|
||||
interface);
|
||||
if (!phydev) {
|
||||
diff --git a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
|
||||
index 1889e78e1..6209f51b3 100644
|
||||
--- a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
|
||||
+++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
|
||||
@@ -237,6 +237,9 @@ struct inno_hdmi_phy {
|
||||
struct clk *refoclk;
|
||||
struct clk *refpclk;
|
||||
|
||||
+ /* phy_flag flag */
|
||||
+ bool phy_flag;
|
||||
+
|
||||
/* platform data */
|
||||
const struct inno_hdmi_phy_drv_data *plat_data;
|
||||
int chip_version;
|
||||
@@ -471,6 +474,7 @@ static const struct pre_pll_config pre_pll_cfg_table[] = {
|
||||
static const struct post_pll_config post_pll_cfg_table[] = {
|
||||
{33750000, 1, 40, 8, 1},
|
||||
{33750000, 1, 80, 8, 2},
|
||||
+ {33750000, 1, 10, 2, 4},
|
||||
{74250000, 1, 40, 8, 1},
|
||||
{74250000, 18, 80, 8, 2},
|
||||
{148500000, 2, 40, 4, 3},
|
||||
@@ -621,8 +625,11 @@ static int inno_hdmi_phy_power_on(struct phy *phy)
|
||||
return -EINVAL;
|
||||
|
||||
for (; cfg->tmdsclock != 0; cfg++)
|
||||
- if (tmdsclock <= cfg->tmdsclock &&
|
||||
- cfg->version & inno->chip_version)
|
||||
+ if (((!inno->phy_flag || tmdsclock > 33750000)
|
||||
+ && tmdsclock <= cfg->tmdsclock
|
||||
+ && cfg->version & inno->chip_version) ||
|
||||
+ (inno->phy_flag && tmdsclock <= 33750000
|
||||
+ && cfg->version & 4))
|
||||
break;
|
||||
|
||||
for (; phy_cfg->tmdsclock != 0; phy_cfg++)
|
||||
@@ -1033,6 +1040,10 @@ static int inno_hdmi_phy_clk_register(struct inno_hdmi_phy *inno)
|
||||
|
||||
static int inno_hdmi_phy_rk3228_init(struct inno_hdmi_phy *inno)
|
||||
{
|
||||
+ struct nvmem_cell *cell;
|
||||
+ unsigned char *efuse_buf;
|
||||
+ size_t len;
|
||||
+
|
||||
/*
|
||||
* Use phy internal register control
|
||||
* rxsense/poweron/pllpd/pdataen signal.
|
||||
@@ -1047,7 +1058,28 @@ static int inno_hdmi_phy_rk3228_init(struct inno_hdmi_phy *inno)
|
||||
inno_update_bits(inno, 0xaa, RK3228_POST_PLL_CTRL_MANUAL,
|
||||
RK3228_POST_PLL_CTRL_MANUAL);
|
||||
|
||||
+
|
||||
inno->chip_version = 1;
|
||||
+ inno->phy_flag = false;
|
||||
+
|
||||
+ cell = nvmem_cell_get(inno->dev, "hdmi-phy-flag");
|
||||
+ if (IS_ERR(cell)) {
|
||||
+ if (PTR_ERR(cell) == -EPROBE_DEFER)
|
||||
+ return -EPROBE_DEFER;
|
||||
+
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ efuse_buf = nvmem_cell_read(cell, &len);
|
||||
+ nvmem_cell_put(cell);
|
||||
+
|
||||
+ if (IS_ERR(efuse_buf))
|
||||
+ return 0;
|
||||
+ if (len == 1)
|
||||
+ inno->phy_flag = (efuse_buf[0] & BIT(1)) ? true : false;
|
||||
+ kfree(efuse_buf);
|
||||
+
|
||||
+ dev_info(inno->dev, "phy_flag is: %d\n", inno->phy_flag);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1147,6 +1179,8 @@ static int inno_hdmi_phy_rk3328_init(struct inno_hdmi_phy *inno)
|
||||
|
||||
/* try to read the chip-version */
|
||||
inno->chip_version = 1;
|
||||
+ inno->phy_flag = false;
|
||||
+
|
||||
cell = nvmem_cell_get(inno->dev, "cpu-version");
|
||||
if (IS_ERR(cell)) {
|
||||
if (PTR_ERR(cell) == -EPROBE_DEFER)
|
||||
diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
|
||||
index fddb4022c..9583c76b4 100644
|
||||
--- a/drivers/pmdomain/rockchip/pm-domains.c
|
||||
+++ b/drivers/pmdomain/rockchip/pm-domains.c
|
||||
@@ -73,6 +73,7 @@ struct rockchip_pm_domain {
|
||||
struct regmap **qos_regmap;
|
||||
u32 *qos_save_regs[MAX_QOS_REGS_NUM];
|
||||
int num_clks;
|
||||
+ bool is_ignore_pwr;
|
||||
struct clk_bulk_data *clks;
|
||||
};
|
||||
|
||||
@@ -361,6 +362,9 @@ static int rockchip_pd_power_on(struct generic_pm_domain *domain)
|
||||
{
|
||||
struct rockchip_pm_domain *pd = to_rockchip_pd(domain);
|
||||
|
||||
+ if (pd->is_ignore_pwr)
|
||||
+ return 0;
|
||||
+
|
||||
return rockchip_pd_power(pd, true);
|
||||
}
|
||||
|
||||
@@ -368,6 +372,9 @@ static int rockchip_pd_power_off(struct generic_pm_domain *domain)
|
||||
{
|
||||
struct rockchip_pm_domain *pd = to_rockchip_pd(domain);
|
||||
|
||||
+ if (pd->is_ignore_pwr)
|
||||
+ return 0;
|
||||
+
|
||||
return rockchip_pd_power(pd, false);
|
||||
}
|
||||
|
||||
@@ -447,6 +454,9 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
|
||||
pd->info = pd_info;
|
||||
pd->pmu = pmu;
|
||||
|
||||
+ if (!pd_info->pwr_mask)
|
||||
+ pd->is_ignore_pwr = true;
|
||||
+
|
||||
pd->num_clks = of_clk_get_parent_count(node);
|
||||
if (pd->num_clks > 0) {
|
||||
pd->clks = devm_kcalloc(pmu->dev, pd->num_clks,
|
||||
@@ -600,6 +610,7 @@ static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu,
|
||||
{
|
||||
struct device_node *np;
|
||||
struct generic_pm_domain *child_domain, *parent_domain;
|
||||
+ struct rockchip_pm_domain *child_pd, *parent_pd;
|
||||
int error;
|
||||
|
||||
for_each_child_of_node(parent, np) {
|
||||
@@ -640,6 +651,18 @@ static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu,
|
||||
parent_domain->name, child_domain->name);
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * If child_pd doesn't do idle request or power on/off,
|
||||
+ * parent_pd may fail to do power on/off, so if parent_pd
|
||||
+ * need to power on/off, child_pd can't ignore to do idle
|
||||
+ * request and power on/off.
|
||||
+ */
|
||||
+ child_pd = to_rockchip_pd(child_domain);
|
||||
+ parent_pd = to_rockchip_pd(parent_domain);
|
||||
+ if (!parent_pd->is_ignore_pwr)
|
||||
+ child_pd->is_ignore_pwr = false;
|
||||
+
|
||||
+
|
||||
rockchip_pm_add_subdomain(pmu, np);
|
||||
}
|
||||
|
||||
diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
|
||||
index 272ae5722..cec178404 100644
|
||||
--- a/drivers/usb/dwc2/core.c
|
||||
+++ b/drivers/usb/dwc2/core.c
|
||||
@@ -607,7 +607,7 @@ void dwc2_force_dr_mode(struct dwc2_hsotg *hsotg)
|
||||
* platforms on their host-only dwc2.
|
||||
*/
|
||||
if (!dwc2_hw_is_otg(hsotg))
|
||||
- msleep(50);
|
||||
+ msleep(200);
|
||||
|
||||
break;
|
||||
case USB_DR_MODE_PERIPHERAL:
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,93 @@
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk322x.dtsi b/arch/arm/boot/dts/rockchip/rk322x.dtsi
|
||||
index 48e6e8d44..1dfd27f9f 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk322x.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk322x.dtsi
|
||||
@@ -712,6 +712,22 @@ emmc: mmc@30020000 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ nfc: nand-controller@30030000 {
|
||||
+ compatible = "rockchip,rk3228-nfc", "rockchip,rk2928-nfc";
|
||||
+ reg = <0x30030000 0x4000>;
|
||||
+ interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru SCLK_NANDC>, <&cru HCLK_NANDC>;
|
||||
+ clock-names = "nfc", "ahb";
|
||||
+ assigned-clocks = <&cru SCLK_NANDC>;
|
||||
+ assigned-clock-rates = <150000000>;
|
||||
+
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&flash_cs0 &flash_rdy &flash_ale &flash_cle
|
||||
+ &flash_wrn &flash_rdn &flash_bus8>;
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ };
|
||||
+
|
||||
usb_otg: usb@30040000 {
|
||||
compatible = "rockchip,rk3228-usb", "rockchip,rk3066-usb",
|
||||
"snps,dwc2";
|
||||
@@ -950,6 +966,65 @@ emmc_bus8: emmc-bus8 {
|
||||
};
|
||||
};
|
||||
|
||||
+ flash {
|
||||
+
|
||||
+ flash_cs0: flash-cs0 {
|
||||
+ rockchip,pins = <2 RK_PA6 1 &pcfg_pull_up>;
|
||||
+ };
|
||||
+
|
||||
+ flash_cs1: flash-cs1 {
|
||||
+ rockchip,pins = <0 RK_PC7 1 &pcfg_pull_up>;
|
||||
+ };
|
||||
+
|
||||
+ flash_cs2: flash-cs2 {
|
||||
+ rockchip,pins = <1 RK_PC6 1 &pcfg_pull_up>;
|
||||
+ };
|
||||
+
|
||||
+ flash_cs3: flash-cs3 {
|
||||
+ rockchip,pins = <1 RK_PC7 1 &pcfg_pull_up>;
|
||||
+ };
|
||||
+
|
||||
+ flash_rdy: flash-rdy {
|
||||
+ rockchip,pins = <2 RK_PA4 1 &pcfg_pull_up>;
|
||||
+ };
|
||||
+
|
||||
+ flash_ale: flash-ale {
|
||||
+ rockchip,pins = <2 RK_PA0 1 &pcfg_pull_down>;
|
||||
+ };
|
||||
+
|
||||
+ flash_cle: flash-cle {
|
||||
+ rockchip,pins = <2 RK_PA1 1 &pcfg_pull_down>;
|
||||
+ };
|
||||
+
|
||||
+ flash_wrn: flash-wrn {
|
||||
+ rockchip,pins = <2 RK_PA2 1 &pcfg_pull_up>;
|
||||
+ };
|
||||
+
|
||||
+ flash_rdn: flash-rdn {
|
||||
+ rockchip,pins = <2 RK_PA3 1 &pcfg_pull_up>;
|
||||
+ };
|
||||
+
|
||||
+ flash_bus8: flash-bus8 {
|
||||
+ rockchip,pins = <1 RK_PD0 1 &pcfg_pull_up>,
|
||||
+ <1 RK_PD1 1 &pcfg_pull_up>,
|
||||
+ <1 RK_PD2 1 &pcfg_pull_up>,
|
||||
+ <1 RK_PD3 1 &pcfg_pull_up>,
|
||||
+ <1 RK_PD4 1 &pcfg_pull_up>,
|
||||
+ <1 RK_PD5 1 &pcfg_pull_up>,
|
||||
+ <1 RK_PD6 1 &pcfg_pull_up>,
|
||||
+ <1 RK_PD7 1 &pcfg_pull_up>;
|
||||
+ };
|
||||
+
|
||||
+ flash_dqs: flash-dqs {
|
||||
+ rockchip,pins = <2 RK_PA7 1 &pcfg_pull_up>;
|
||||
+ };
|
||||
+
|
||||
+ flash_wp: flash-wp {
|
||||
+ rockchip,pins = <2 RK_PA5 1 &pcfg_pull_down>;
|
||||
+ };
|
||||
+
|
||||
+ };
|
||||
+
|
||||
gmac {
|
||||
rgmii_pins: rgmii-pins {
|
||||
rockchip,pins = <2 RK_PB6 1 &pcfg_pull_none>,
|
||||
@ -0,0 +1,66 @@
|
||||
diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
|
||||
index 73d24c6bbf05..d4ac6e161ef2 100644
|
||||
--- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
|
||||
+++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
|
||||
@@ -614,6 +614,44 @@ static const struct vop_common rk3288_common = {
|
||||
.dsp_background = VOP_REG(RK3288_DSP_BG, 0xffffffff, 0),
|
||||
};
|
||||
|
||||
+static const struct vop_win_phy rk3228_win0_data = {
|
||||
+ .scl = &rk3288_win_full_scl,
|
||||
+ .data_formats = formats_win_full,
|
||||
+ .nformats = ARRAY_SIZE(formats_win_full),
|
||||
+ .enable = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 0),
|
||||
+ .format = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1),
|
||||
+ .rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12),
|
||||
+ .act_info = VOP_REG(RK3288_WIN0_ACT_INFO, 0x1fff1fff, 0),
|
||||
+ .dsp_info = VOP_REG(RK3288_WIN0_DSP_INFO, 0x0fff0fff, 0),
|
||||
+ .dsp_st = VOP_REG(RK3288_WIN0_DSP_ST, 0x1fff1fff, 0),
|
||||
+ .yrgb_mst = VOP_REG(RK3288_WIN0_YRGB_MST, 0xffffffff, 0),
|
||||
+ .uv_mst = VOP_REG(RK3288_WIN0_CBR_MST, 0xffffffff, 0),
|
||||
+ .yrgb_vir = VOP_REG(RK3288_WIN0_VIR, 0x3fff, 0),
|
||||
+ .uv_vir = VOP_REG(RK3288_WIN0_VIR, 0x3fff, 16),
|
||||
+ .src_alpha_ctl = VOP_REG(RK3288_WIN0_SRC_ALPHA_CTRL, 0xff, 0),
|
||||
+ .dst_alpha_ctl = VOP_REG(RK3288_WIN0_DST_ALPHA_CTRL, 0xff, 0),
|
||||
+ .channel = VOP_REG(RK3288_WIN0_CTRL2, 0xff, 0),
|
||||
+};
|
||||
+
|
||||
+static const struct vop_win_phy rk3228_win1_data = {
|
||||
+ .scl = &rk3288_win_full_scl,
|
||||
+ .data_formats = formats_win_lite,
|
||||
+ .nformats = ARRAY_SIZE(formats_win_lite),
|
||||
+ .enable = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 0),
|
||||
+ .format = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1),
|
||||
+ .rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12),
|
||||
+ .act_info = VOP_REG(RK3288_WIN0_ACT_INFO, 0x1fff1fff, 0),
|
||||
+ .dsp_info = VOP_REG(RK3288_WIN0_DSP_INFO, 0x0fff0fff, 0),
|
||||
+ .dsp_st = VOP_REG(RK3288_WIN0_DSP_ST, 0x1fff1fff, 0),
|
||||
+ .yrgb_mst = VOP_REG(RK3288_WIN0_YRGB_MST, 0xffffffff, 0),
|
||||
+ .uv_mst = VOP_REG(RK3288_WIN0_CBR_MST, 0xffffffff, 0),
|
||||
+ .yrgb_vir = VOP_REG(RK3288_WIN0_VIR, 0x3fff, 0),
|
||||
+ .uv_vir = VOP_REG(RK3288_WIN0_VIR, 0x3fff, 16),
|
||||
+ .src_alpha_ctl = VOP_REG(RK3288_WIN0_SRC_ALPHA_CTRL, 0xff, 0),
|
||||
+ .dst_alpha_ctl = VOP_REG(RK3288_WIN0_DST_ALPHA_CTRL, 0xff, 0),
|
||||
+ .channel = VOP_REG(RK3288_WIN0_CTRL2, 0xff, 0),
|
||||
+};
|
||||
+
|
||||
/*
|
||||
* Note: rk3288 has a dedicated 'cursor' window, however, that window requires
|
||||
* special support to get alpha blending working. For now, just use overlay
|
||||
@@ -864,10 +902,10 @@ static const struct vop_data rk3399_vop_lit = {
|
||||
};
|
||||
|
||||
static const struct vop_win_data rk3228_vop_win_data[] = {
|
||||
- { .base = 0x00, .phy = &rk3288_win01_data,
|
||||
+ { .base = 0x00, .phy = &rk3228_win0_data,
|
||||
.type = DRM_PLANE_TYPE_PRIMARY },
|
||||
- { .base = 0x40, .phy = &rk3288_win01_data,
|
||||
- .type = DRM_PLANE_TYPE_CURSOR },
|
||||
+ { .base = 0x40, .phy = &rk3228_win1_data,
|
||||
+ .type = DRM_PLANE_TYPE_OVERLAY },
|
||||
};
|
||||
|
||||
static const struct vop_data rk3228_vop = {
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
From adecdd57a0155e0d96af2c84cc4fa52309fbb535 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Thu, 9 Sep 2021 19:14:08 +0000
|
||||
Subject: [PATCH] add iep node for rk322x
|
||||
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk322x.dtsi | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk322x.dtsi b/arch/arm/boot/dts/rockchip/rk322x.dtsi
|
||||
index 0ae753c1d..271e7835f 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk322x.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk322x.dtsi
|
||||
@@ -834,6 +834,17 @@ rga: rga@20060000 {
|
||||
reset-names = "core", "axi", "ahb";
|
||||
};
|
||||
|
||||
+ iep: iep@20070000 {
|
||||
+ compatible = "rockchip,rk3228-iep";
|
||||
+ reg = <0x20070000 0x800>;
|
||||
+ interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru ACLK_IEP>, <&cru HCLK_IEP>;
|
||||
+ clock-names = "axi", "ahb";
|
||||
+ iommus = <&iep_mmu>;
|
||||
+ power-domains = <&power RK3228_PD_VIO>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
iep_mmu: iommu@20070800 {
|
||||
compatible = "rockchip,iommu";
|
||||
reg = <0x20070800 0x100>;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
From 2d42546642fa4299d88fa4ae414fa1ab205dad70 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Sat, 11 Sep 2021 17:38:48 +0000
|
||||
Subject: [PATCH] rk322x: enable YUV modes for win1, 10-bit for win0/win1
|
||||
|
||||
---
|
||||
drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
|
||||
index 70930b410..3fd00b323 100644
|
||||
--- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
|
||||
+++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
|
||||
@@ -719,10 +719,11 @@ static const struct vop_common rk3288_common = {
|
||||
|
||||
static const struct vop_win_phy rk3228_win0_data = {
|
||||
.scl = &rk3288_win_full_scl,
|
||||
- .data_formats = formats_win_full,
|
||||
- .nformats = ARRAY_SIZE(formats_win_full),
|
||||
+ .data_formats = formats_win_full_10,
|
||||
+ .nformats = ARRAY_SIZE(formats_win_full_10),
|
||||
.enable = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 0),
|
||||
.format = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1),
|
||||
+ .fmt_10 = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 4),
|
||||
.rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12),
|
||||
.act_info = VOP_REG(RK3288_WIN0_ACT_INFO, 0x1fff1fff, 0),
|
||||
.dsp_info = VOP_REG(RK3288_WIN0_DSP_INFO, 0x0fff0fff, 0),
|
||||
@@ -738,10 +739,11 @@ static const struct vop_win_phy rk3228_win0_data = {
|
||||
|
||||
static const struct vop_win_phy rk3228_win1_data = {
|
||||
.scl = &rk3288_win_full_scl,
|
||||
- .data_formats = formats_win_lite,
|
||||
- .nformats = ARRAY_SIZE(formats_win_lite),
|
||||
+ .data_formats = formats_win_full_10,
|
||||
+ .nformats = ARRAY_SIZE(formats_win_full_10),
|
||||
.enable = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 0),
|
||||
.format = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1),
|
||||
+ .fmt_10 = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 4),
|
||||
.rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12),
|
||||
.act_info = VOP_REG(RK3288_WIN0_ACT_INFO, 0x1fff1fff, 0),
|
||||
.dsp_info = VOP_REG(RK3288_WIN0_DSP_INFO, 0x0fff0fff, 0),
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,914 @@
|
||||
From b4f40590a4f946d8ee704faf8579930e53ef4650 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Sun, 12 Sep 2021 10:15:56 +0000
|
||||
Subject: [PATCH] rk322x: analog audio codec
|
||||
|
||||
---
|
||||
.../bindings/sound/rockchip,rk3228-codec.txt | 22 +
|
||||
arch/arm/boot/dts/rockchip/rk322x.dtsi | 9 +
|
||||
drivers/clk/rockchip/clk-rk3228.c | 2 +-
|
||||
include/dt-bindings/clock/rk3228-cru.h | 1 +
|
||||
sound/soc/codecs/Kconfig | 5 +
|
||||
sound/soc/codecs/Makefile | 2 +
|
||||
sound/soc/codecs/rk3228_codec.c | 545 ++++++++++++++++++
|
||||
sound/soc/codecs/rk3228_codec.h | 218 +++++++
|
||||
8 files changed, 803 insertions(+), 1 deletion(-)
|
||||
create mode 100644 Documentation/devicetree/bindings/sound/rockchip,rk3228-codec.txt
|
||||
create mode 100644 sound/soc/codecs/rk3228_codec.c
|
||||
create mode 100644 sound/soc/codecs/rk3228_codec.h
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/sound/rockchip,rk3228-codec.txt b/Documentation/devicetree/bindings/sound/rockchip,rk3228-codec.txt
|
||||
new file mode 100644
|
||||
index 000000000..9191a8593
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/sound/rockchip,rk3228-codec.txt
|
||||
@@ -0,0 +1,22 @@
|
||||
+* Rockchip Rk3228 internal codec
|
||||
+
|
||||
+Required properties:
|
||||
+
|
||||
+- compatible: "rockchip,rk3228-codec"
|
||||
+- reg: physical base address of the controller and length of memory mapped
|
||||
+ region.
|
||||
+- clocks: a list of phandle + clock-specifer pairs, one for each entry in clock-names.
|
||||
+- clock-names: a list of clock names, one for each entry in clocks.
|
||||
+- spk-en-gpio: speaker enable gpio.
|
||||
+- spk-depop-time-ms: speaker depop time msec.
|
||||
+
|
||||
+Example for rk3228 internal codec:
|
||||
+
|
||||
+codec: codec@12010000 {
|
||||
+ compatible = "rockchip,rk3228-codec";
|
||||
+ reg = <0x12010000 0x1000>;
|
||||
+ clocks = <&cru SCLK_I2S_OUT>, <&cru PCLK_ACODECPHY>, <&cru SCLK_I2S1>;
|
||||
+ clock-names = "mclk", "pclk", "sclk";
|
||||
+ spk-en-gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk322x.dtsi b/arch/arm/boot/dts/rockchip/rk322x.dtsi
|
||||
index 75af99c76..c2670d498 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk322x.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk322x.dtsi
|
||||
@@ -145,6 +145,15 @@ i2s1: i2s1@100b0000 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ codec: codec@12010000 {
|
||||
+ compatible = "rockchip,rk3228-codec";
|
||||
+ reg = <0x12010000 0x1000>;
|
||||
+ clocks = <&cru SCLK_I2S_OUT>, <&cru PCLK_ACODECPHY>, <&cru SCLK_I2S1>;
|
||||
+ clock-names = "mclk", "pclk", "sclk";
|
||||
+ spk-en-gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
i2s0: i2s0@100c0000 {
|
||||
compatible = "rockchip,rk3228-i2s", "rockchip,rk3066-i2s";
|
||||
reg = <0x100c0000 0x4000>;
|
||||
diff --git a/drivers/clk/rockchip/clk-rk3228.c b/drivers/clk/rockchip/clk-rk3228.c
|
||||
index a24a35553..69f8c792f 100644
|
||||
--- a/drivers/clk/rockchip/clk-rk3228.c
|
||||
+++ b/drivers/clk/rockchip/clk-rk3228.c
|
||||
@@ -620,7 +620,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
|
||||
GATE(0, "pclk_sim", "pclk_cpu", 0, RK2928_CLKGATE_CON(10), 3, GFLAGS),
|
||||
|
||||
GATE(0, "pclk_ddrphy", "pclk_phy_pre", 0, RK2928_CLKGATE_CON(10), 3, GFLAGS),
|
||||
- GATE(0, "pclk_acodecphy", "pclk_phy_pre", 0, RK2928_CLKGATE_CON(10), 5, GFLAGS),
|
||||
+ GATE(PCLK_ACODECPHY, "pclk_acodecphy", "pclk_phy_pre", 0, RK2928_CLKGATE_CON(10), 5, GFLAGS),
|
||||
GATE(PCLK_HDMI_PHY, "pclk_hdmiphy", "pclk_phy_pre", 0, RK2928_CLKGATE_CON(10), 7, GFLAGS),
|
||||
GATE(0, "pclk_vdacphy", "pclk_phy_pre", 0, RK2928_CLKGATE_CON(10), 8, GFLAGS),
|
||||
GATE(0, "pclk_phy_noc", "pclk_phy_pre", 0, RK2928_CLKGATE_CON(10), 9, GFLAGS),
|
||||
diff --git a/include/dt-bindings/clock/rk3228-cru.h b/include/dt-bindings/clock/rk3228-cru.h
|
||||
index de550ea56..30d44ce90 100644
|
||||
--- a/include/dt-bindings/clock/rk3228-cru.h
|
||||
+++ b/include/dt-bindings/clock/rk3228-cru.h
|
||||
@@ -115,6 +115,7 @@
|
||||
#define PCLK_HDMI_CTRL 364
|
||||
#define PCLK_HDMI_PHY 365
|
||||
#define PCLK_GMAC 367
|
||||
+#define PCLK_ACODECPHY 368
|
||||
|
||||
/* hclk gates */
|
||||
#define HCLK_I2S0_8CH 442
|
||||
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
|
||||
index 07747565c3b5..0a05315786bc 100644
|
||||
--- a/sound/soc/codecs/Kconfig
|
||||
+++ b/sound/soc/codecs/Kconfig
|
||||
@@ -168,6 +168,7 @@ config SND_SOC_ALL_CODECS
|
||||
imply SND_SOC_PCM512x_I2C
|
||||
imply SND_SOC_PCM512x_SPI
|
||||
imply SND_SOC_PEB2466
|
||||
+ imply SND_SOC_RK3228
|
||||
imply SND_SOC_RK3328
|
||||
imply SND_SOC_RK817
|
||||
imply SND_SOC_RT274
|
||||
@@ -1251,6 +1252,10 @@ config SND_SOC_PEB2466
|
||||
To compile this driver as a module, choose M here: the module
|
||||
will be called snd-soc-peb2466.
|
||||
|
||||
+config SND_SOC_RK3228
|
||||
+ select REGMAP_MMIO
|
||||
+ tristate "Rockchip RK3228 CODEC"
|
||||
+
|
||||
config SND_SOC_RK3328
|
||||
tristate "Rockchip RK3328 audio CODEC"
|
||||
select REGMAP_MMIO
|
||||
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
|
||||
index f1ca18f7946c..73d3f6ffd7be 100644
|
||||
--- a/sound/soc/codecs/Makefile
|
||||
+++ b/sound/soc/codecs/Makefile
|
||||
@@ -188,6 +188,7 @@ snd-soc-pcm512x-objs := pcm512x.o
|
||||
snd-soc-pcm512x-i2c-objs := pcm512x-i2c.o
|
||||
snd-soc-pcm512x-spi-objs := pcm512x-spi.o
|
||||
snd-soc-peb2466-objs := peb2466.o
|
||||
+snd-soc-rk3228-objs := rk3228_codec.o
|
||||
snd-soc-rk3328-objs := rk3328_codec.o
|
||||
snd-soc-rk817-objs := rk817_codec.o
|
||||
snd-soc-rl6231-objs := rl6231.o
|
||||
@@ -550,6 +551,7 @@ obj-$(CONFIG_SND_SOC_PCM512x) += snd-soc-pcm512x.o
|
||||
obj-$(CONFIG_SND_SOC_PCM512x_I2C) += snd-soc-pcm512x-i2c.o
|
||||
obj-$(CONFIG_SND_SOC_PCM512x_SPI) += snd-soc-pcm512x-spi.o
|
||||
obj-$(CONFIG_SND_SOC_PEB2466) += snd-soc-peb2466.o
|
||||
+obj-$(CONFIG_SND_SOC_RK3228) += snd-soc-rk3228.o
|
||||
obj-$(CONFIG_SND_SOC_RK3328) += snd-soc-rk3328.o
|
||||
obj-$(CONFIG_SND_SOC_RK817) += snd-soc-rk817.o
|
||||
obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o
|
||||
diff --git a/sound/soc/codecs/rk3228_codec.c b/sound/soc/codecs/rk3228_codec.c
|
||||
new file mode 100644
|
||||
index 000000000..b65307435
|
||||
--- /dev/null
|
||||
+++ b/sound/soc/codecs/rk3228_codec.c
|
||||
@@ -0,0 +1,545 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+//
|
||||
+// rk3228_codec.c -- rk3228 ALSA Soc Audio driver
|
||||
+//
|
||||
+// Copyright (c) 2018, Fuzhou Rockchip Electronics Co., Ltd All rights reserved.
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/device.h>
|
||||
+#include <linux/delay.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/of_gpio.h>
|
||||
+#include <linux/clk.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/pm_runtime.h>
|
||||
+#include <linux/regmap.h>
|
||||
+#include <sound/pcm_params.h>
|
||||
+#include <sound/dmaengine_pcm.h>
|
||||
+#include "rk3228_codec.h"
|
||||
+
|
||||
+/*
|
||||
+ * volume setting
|
||||
+ * 0: -39dB
|
||||
+ * 26: 0dB
|
||||
+ * 31: 6dB
|
||||
+ * Step: 1.5dB
|
||||
+ */
|
||||
+#define OUT_VOLUME (0x18)
|
||||
+#define INITIAL_FREQ (11289600)
|
||||
+
|
||||
+struct rk3228_codec_priv {
|
||||
+ struct regmap *regmap;
|
||||
+ struct clk *mclk;
|
||||
+ struct clk *pclk;
|
||||
+ struct clk *sclk;
|
||||
+ struct gpio_desc *spk_en_gpio;
|
||||
+ int spk_depop_time; /* msec */
|
||||
+};
|
||||
+
|
||||
+static const struct reg_default rk3228_codec_reg_defaults[] = {
|
||||
+ { CODEC_RESET, 0x03 },
|
||||
+ { DAC_INIT_CTRL1, 0x00 },
|
||||
+ { DAC_INIT_CTRL2, 0x50 },
|
||||
+ { DAC_INIT_CTRL3, 0x0e },
|
||||
+ { DAC_PRECHARGE_CTRL, 0x01 },
|
||||
+ { DAC_PWR_CTRL, 0x00 },
|
||||
+ { DAC_CLK_CTRL, 0x00 },
|
||||
+ { HPMIX_CTRL, 0x00 },
|
||||
+ { HPOUT_CTRL, 0x00 },
|
||||
+ { HPOUTL_GAIN_CTRL, 0x00 },
|
||||
+ { HPOUTR_GAIN_CTRL, 0x00 },
|
||||
+ { HPOUT_POP_CTRL, 0x11 },
|
||||
+};
|
||||
+
|
||||
+static int rk3228_codec_reset(struct snd_soc_component *component)
|
||||
+{
|
||||
+ struct rk3228_codec_priv *rk3228 = snd_soc_component_get_drvdata(component);
|
||||
+
|
||||
+ regmap_write(rk3228->regmap, CODEC_RESET, 0);
|
||||
+ mdelay(10);
|
||||
+ regmap_write(rk3228->regmap, CODEC_RESET, 0x03);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3228_set_dai_fmt(struct snd_soc_dai *dai,
|
||||
+ unsigned int fmt)
|
||||
+{
|
||||
+ struct snd_soc_component *component = dai->component;
|
||||
+ struct rk3228_codec_priv *rk3228 = snd_soc_component_get_drvdata(component);
|
||||
+ unsigned int val = 0;
|
||||
+
|
||||
+ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
||||
+ case SND_SOC_DAIFMT_CBS_CFS:
|
||||
+ val |= PIN_DIRECTION_IN | DAC_I2S_MODE_SLAVE;
|
||||
+ break;
|
||||
+ case SND_SOC_DAIFMT_CBM_CFM:
|
||||
+ val |= PIN_DIRECTION_OUT | DAC_I2S_MODE_MASTER;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ regmap_update_bits(rk3228->regmap, DAC_INIT_CTRL1,
|
||||
+ PIN_DIRECTION_MASK | DAC_I2S_MODE_MASK, val);
|
||||
+
|
||||
+ val = 0;
|
||||
+ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
|
||||
+ case SND_SOC_DAIFMT_DSP_A:
|
||||
+ case SND_SOC_DAIFMT_DSP_B:
|
||||
+ val |= DAC_MODE_PCM;
|
||||
+ break;
|
||||
+ case SND_SOC_DAIFMT_I2S:
|
||||
+ val |= DAC_MODE_I2S;
|
||||
+ break;
|
||||
+ case SND_SOC_DAIFMT_RIGHT_J:
|
||||
+ val |= DAC_MODE_RJM;
|
||||
+ break;
|
||||
+ case SND_SOC_DAIFMT_LEFT_J:
|
||||
+ val |= DAC_MODE_LJM;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ regmap_update_bits(rk3228->regmap, DAC_INIT_CTRL2,
|
||||
+ DAC_MODE_MASK, val);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void rk3228_analog_output(struct rk3228_codec_priv *rk3228, int mute)
|
||||
+{
|
||||
+ if (rk3228->spk_en_gpio)
|
||||
+ gpiod_set_value(rk3228->spk_en_gpio, mute);
|
||||
+}
|
||||
+
|
||||
+static int rk3228_mute_stream(struct snd_soc_dai *dai, int mute, int direction)
|
||||
+{
|
||||
+ struct snd_soc_component *component = dai->component;
|
||||
+ struct rk3228_codec_priv *rk3228 = snd_soc_component_get_drvdata(component);
|
||||
+ unsigned int val = 0;
|
||||
+
|
||||
+ if (direction != SNDRV_PCM_STREAM_PLAYBACK)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (mute)
|
||||
+ val = HPOUTL_MUTE | HPOUTR_MUTE;
|
||||
+ else
|
||||
+ val = HPOUTL_UNMUTE | HPOUTR_UNMUTE;
|
||||
+
|
||||
+ regmap_update_bits(rk3228->regmap, HPOUT_CTRL,
|
||||
+ HPOUTL_MUTE_MASK | HPOUTR_MUTE_MASK, val);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3228_codec_power_on(struct snd_soc_component *component, int wait_ms)
|
||||
+{
|
||||
+ struct rk3228_codec_priv *rk3228 = snd_soc_component_get_drvdata(component);
|
||||
+
|
||||
+ regmap_update_bits(rk3228->regmap, DAC_PRECHARGE_CTRL,
|
||||
+ DAC_CHARGE_XCHARGE_MASK, DAC_CHARGE_PRECHARGE);
|
||||
+ mdelay(10);
|
||||
+ regmap_update_bits(rk3228->regmap, DAC_PRECHARGE_CTRL,
|
||||
+ DAC_CHARGE_CURRENT_ALL_MASK,
|
||||
+ DAC_CHARGE_CURRENT_ALL_ON);
|
||||
+
|
||||
+ mdelay(wait_ms);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3228_codec_power_off(struct snd_soc_component *component, int wait_ms)
|
||||
+{
|
||||
+ struct rk3228_codec_priv *rk3228 = snd_soc_component_get_drvdata(component);
|
||||
+
|
||||
+ regmap_update_bits(rk3228->regmap, DAC_PRECHARGE_CTRL,
|
||||
+ DAC_CHARGE_XCHARGE_MASK, DAC_CHARGE_DISCHARGE);
|
||||
+ mdelay(10);
|
||||
+ regmap_update_bits(rk3228->regmap, DAC_PRECHARGE_CTRL,
|
||||
+ DAC_CHARGE_CURRENT_ALL_MASK,
|
||||
+ DAC_CHARGE_CURRENT_ALL_ON);
|
||||
+
|
||||
+ mdelay(wait_ms);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct rk3228_reg_msk_val playback_open_list[] = {
|
||||
+ { DAC_PWR_CTRL, DAC_PWR_MASK, DAC_PWR_ON },
|
||||
+ { DAC_PWR_CTRL, DACL_PATH_REFV_MASK | DACR_PATH_REFV_MASK,
|
||||
+ DACL_PATH_REFV_ON | DACR_PATH_REFV_ON },
|
||||
+ { DAC_PWR_CTRL, HPOUTL_ZERO_CROSSING_ON | HPOUTR_ZERO_CROSSING_ON,
|
||||
+ HPOUTL_ZERO_CROSSING_ON | HPOUTR_ZERO_CROSSING_ON },
|
||||
+ { HPOUT_POP_CTRL, HPOUTR_POP_MASK | HPOUTL_POP_MASK,
|
||||
+ HPOUTR_POP_WORK | HPOUTL_POP_WORK },
|
||||
+ { HPMIX_CTRL, HPMIXL_MASK | HPMIXR_MASK, HPMIXL_EN | HPMIXR_EN },
|
||||
+ { HPMIX_CTRL, HPMIXL_INIT_MASK | HPMIXR_INIT_MASK,
|
||||
+ HPMIXL_INIT_EN | HPMIXR_INIT_EN },
|
||||
+ { HPOUT_CTRL, HPOUTL_MASK | HPOUTR_MASK, HPOUTL_EN | HPOUTR_EN },
|
||||
+ { HPOUT_CTRL, HPOUTL_INIT_MASK | HPOUTR_INIT_MASK,
|
||||
+ HPOUTL_INIT_EN | HPOUTR_INIT_EN },
|
||||
+ { DAC_CLK_CTRL, DACL_REFV_MASK | DACR_REFV_MASK,
|
||||
+ DACL_REFV_ON | DACR_REFV_ON },
|
||||
+ { DAC_CLK_CTRL, DACL_CLK_MASK | DACR_CLK_MASK,
|
||||
+ DACL_CLK_ON | DACR_CLK_ON },
|
||||
+ { DAC_CLK_CTRL, DACL_MASK | DACR_MASK, DACL_ON | DACR_ON },
|
||||
+ { DAC_CLK_CTRL, DACL_INIT_MASK | DACR_INIT_MASK,
|
||||
+ DACL_INIT_ON | DACR_INIT_ON },
|
||||
+ { DAC_SELECT, DACL_SELECT_MASK | DACR_SELECT_MASK,
|
||||
+ DACL_SELECT | DACR_SELECT },
|
||||
+ { HPMIX_CTRL, HPMIXL_INIT2_MASK | HPMIXR_INIT2_MASK,
|
||||
+ HPMIXL_INIT2_EN | HPMIXR_INIT2_EN },
|
||||
+ { HPOUT_CTRL, HPOUTL_MUTE_MASK | HPOUTR_MUTE_MASK,
|
||||
+ HPOUTL_UNMUTE | HPOUTR_UNMUTE },
|
||||
+};
|
||||
+
|
||||
+#define PLAYBACK_OPEN_LIST_LEN ARRAY_SIZE(playback_open_list)
|
||||
+
|
||||
+static int rk3228_codec_open_playback(struct snd_soc_component *component)
|
||||
+{
|
||||
+ struct rk3228_codec_priv *rk3228 = snd_soc_component_get_drvdata(component);
|
||||
+ int i = 0;
|
||||
+
|
||||
+ regmap_update_bits(rk3228->regmap, DAC_PRECHARGE_CTRL,
|
||||
+ DAC_CHARGE_CURRENT_ALL_MASK,
|
||||
+ DAC_CHARGE_CURRENT_I);
|
||||
+
|
||||
+ for (i = 0; i < PLAYBACK_OPEN_LIST_LEN; i++) {
|
||||
+ regmap_update_bits(rk3228->regmap,
|
||||
+ playback_open_list[i].reg,
|
||||
+ playback_open_list[i].msk,
|
||||
+ playback_open_list[i].val);
|
||||
+ mdelay(1);
|
||||
+ }
|
||||
+
|
||||
+ msleep(rk3228->spk_depop_time);
|
||||
+ rk3228_analog_output(rk3228, 1);
|
||||
+
|
||||
+ regmap_update_bits(rk3228->regmap, HPOUTL_GAIN_CTRL,
|
||||
+ HPOUTL_GAIN_MASK, OUT_VOLUME);
|
||||
+ regmap_update_bits(rk3228->regmap, HPOUTR_GAIN_CTRL,
|
||||
+ HPOUTR_GAIN_MASK, OUT_VOLUME);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct rk3228_reg_msk_val playback_close_list[] = {
|
||||
+ { HPMIX_CTRL, HPMIXL_INIT2_MASK | HPMIXR_INIT2_MASK,
|
||||
+ HPMIXL_INIT2_DIS | HPMIXR_INIT2_DIS },
|
||||
+ { DAC_SELECT, DACL_SELECT_MASK | DACR_SELECT_MASK,
|
||||
+ DACL_DESELECT | DACR_DESELECT },
|
||||
+ { HPOUT_CTRL, HPOUTL_MUTE_MASK | HPOUTR_MUTE_MASK,
|
||||
+ HPOUTL_MUTE | HPOUTR_MUTE },
|
||||
+ { HPOUT_CTRL, HPOUTL_INIT_MASK | HPOUTR_INIT_MASK,
|
||||
+ HPOUTL_INIT_DIS | HPOUTR_INIT_DIS },
|
||||
+ { HPOUT_CTRL, HPOUTL_MASK | HPOUTR_MASK, HPOUTL_DIS | HPOUTR_DIS },
|
||||
+ { HPMIX_CTRL, HPMIXL_MASK | HPMIXR_MASK, HPMIXL_DIS | HPMIXR_DIS },
|
||||
+ { DAC_CLK_CTRL, DACL_MASK | DACR_MASK, DACL_OFF | DACR_OFF },
|
||||
+ { DAC_CLK_CTRL, DACL_CLK_MASK | DACR_CLK_MASK,
|
||||
+ DACL_CLK_OFF | DACR_CLK_OFF },
|
||||
+ { DAC_CLK_CTRL, DACL_REFV_MASK | DACR_REFV_MASK,
|
||||
+ DACL_REFV_OFF | DACR_REFV_OFF },
|
||||
+ { HPOUT_POP_CTRL, HPOUTR_POP_MASK | HPOUTL_POP_MASK,
|
||||
+ HPOUTR_POP_XCHARGE | HPOUTL_POP_XCHARGE },
|
||||
+ { DAC_PWR_CTRL, DACL_PATH_REFV_MASK | DACR_PATH_REFV_MASK,
|
||||
+ DACL_PATH_REFV_OFF | DACR_PATH_REFV_OFF },
|
||||
+ { DAC_PWR_CTRL, DAC_PWR_MASK, DAC_PWR_OFF },
|
||||
+ { HPMIX_CTRL, HPMIXL_INIT_MASK | HPMIXR_INIT_MASK,
|
||||
+ HPMIXL_INIT_DIS | HPMIXR_INIT_DIS },
|
||||
+ { DAC_CLK_CTRL, DACL_INIT_MASK | DACR_INIT_MASK,
|
||||
+ DACL_INIT_OFF | DACR_INIT_OFF },
|
||||
+};
|
||||
+
|
||||
+#define PLAYBACK_CLOSE_LIST_LEN ARRAY_SIZE(playback_close_list)
|
||||
+
|
||||
+static int rk3228_codec_close_playback(struct snd_soc_component *component)
|
||||
+{
|
||||
+ struct rk3228_codec_priv *rk3228 = snd_soc_component_get_drvdata(component);
|
||||
+ int i = 0;
|
||||
+
|
||||
+ rk3228_analog_output(rk3228, 0);
|
||||
+
|
||||
+ regmap_update_bits(rk3228->regmap, HPOUTL_GAIN_CTRL,
|
||||
+ HPOUTL_GAIN_MASK, 0);
|
||||
+ regmap_update_bits(rk3228->regmap, HPOUTR_GAIN_CTRL,
|
||||
+ HPOUTR_GAIN_MASK, 0);
|
||||
+
|
||||
+ for (i = 0; i < PLAYBACK_CLOSE_LIST_LEN; i++) {
|
||||
+ regmap_update_bits(rk3228->regmap,
|
||||
+ playback_close_list[i].reg,
|
||||
+ playback_close_list[i].msk,
|
||||
+ playback_close_list[i].val);
|
||||
+ mdelay(1);
|
||||
+ }
|
||||
+
|
||||
+ regmap_update_bits(rk3228->regmap, DAC_PRECHARGE_CTRL,
|
||||
+ DAC_CHARGE_CURRENT_ALL_MASK,
|
||||
+ DAC_CHARGE_CURRENT_I);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3228_hw_params(struct snd_pcm_substream *substream,
|
||||
+ struct snd_pcm_hw_params *params,
|
||||
+ struct snd_soc_dai *dai)
|
||||
+{
|
||||
+ struct snd_soc_component *component = dai->component;
|
||||
+ struct rk3228_codec_priv *rk3228 = snd_soc_component_get_drvdata(component);
|
||||
+ unsigned int val = 0;
|
||||
+
|
||||
+ switch (params_format(params)) {
|
||||
+ case SNDRV_PCM_FORMAT_S16_LE:
|
||||
+ val |= DAC_VDL_16BITS;
|
||||
+ break;
|
||||
+ case SNDRV_PCM_FORMAT_S20_3LE:
|
||||
+ val |= DAC_VDL_20BITS;
|
||||
+ break;
|
||||
+ case SNDRV_PCM_FORMAT_S24_LE:
|
||||
+ val |= DAC_VDL_24BITS;
|
||||
+ break;
|
||||
+ case SNDRV_PCM_FORMAT_S32_LE:
|
||||
+ val |= DAC_VDL_32BITS;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ regmap_update_bits(rk3228->regmap, DAC_INIT_CTRL2, DAC_VDL_MASK, val);
|
||||
+ val = DAC_WL_32BITS | DAC_RST_DIS;
|
||||
+ regmap_update_bits(rk3228->regmap, DAC_INIT_CTRL3,
|
||||
+ DAC_WL_MASK | DAC_RST_MASK, val);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3228_pcm_startup(struct snd_pcm_substream *substream,
|
||||
+ struct snd_soc_dai *dai)
|
||||
+{
|
||||
+ struct snd_soc_component *component = dai->component;
|
||||
+
|
||||
+ return rk3228_codec_open_playback(component);
|
||||
+}
|
||||
+
|
||||
+static void rk3228_pcm_shutdown(struct snd_pcm_substream *substream,
|
||||
+ struct snd_soc_dai *dai)
|
||||
+{
|
||||
+ struct snd_soc_component *component = dai->component;
|
||||
+
|
||||
+ rk3228_codec_close_playback(component);
|
||||
+}
|
||||
+
|
||||
+static struct snd_soc_dai_ops rk3228_dai_ops = {
|
||||
+ .hw_params = rk3228_hw_params,
|
||||
+ .set_fmt = rk3228_set_dai_fmt,
|
||||
+ .mute_stream = rk3228_mute_stream,
|
||||
+ .startup = rk3228_pcm_startup,
|
||||
+ .shutdown = rk3228_pcm_shutdown,
|
||||
+};
|
||||
+
|
||||
+static struct snd_soc_dai_driver rk3228_dai[] = {
|
||||
+ {
|
||||
+ .name = "rk3228-hifi",
|
||||
+ .id = RK3228_HIFI,
|
||||
+ .playback = {
|
||||
+ .stream_name = "HIFI Playback",
|
||||
+ .channels_min = 1,
|
||||
+ .channels_max = 2,
|
||||
+ .rates = SNDRV_PCM_RATE_8000_96000,
|
||||
+ .formats = (SNDRV_PCM_FMTBIT_S16_LE |
|
||||
+ SNDRV_PCM_FMTBIT_S20_3LE |
|
||||
+ SNDRV_PCM_FMTBIT_S24_LE |
|
||||
+ SNDRV_PCM_FMTBIT_S32_LE),
|
||||
+ },
|
||||
+ /*.capture = {
|
||||
+ .stream_name = "HIFI Capture",
|
||||
+ .channels_min = 2,
|
||||
+ .channels_max = 8,
|
||||
+ .rates = SNDRV_PCM_RATE_8000_96000,
|
||||
+ .formats = (SNDRV_PCM_FMTBIT_S16_LE |
|
||||
+ SNDRV_PCM_FMTBIT_S20_3LE |
|
||||
+ SNDRV_PCM_FMTBIT_S24_LE |
|
||||
+ SNDRV_PCM_FMTBIT_S32_LE),
|
||||
+ },*/
|
||||
+ .ops = &rk3228_dai_ops,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static int rk3228_codec_probe(struct snd_soc_component *component)
|
||||
+{
|
||||
+ rk3228_codec_reset(component);
|
||||
+ rk3228_codec_power_on(component, 0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void rk3228_codec_remove(struct snd_soc_component *component)
|
||||
+{
|
||||
+ rk3228_codec_close_playback(component);
|
||||
+ rk3228_codec_power_off(component, 0);
|
||||
+}
|
||||
+
|
||||
+static struct snd_soc_component_driver soc_codec_dev_rk3228 = {
|
||||
+ .probe = rk3228_codec_probe,
|
||||
+ .remove = rk3228_codec_remove,
|
||||
+};
|
||||
+
|
||||
+static bool rk3228_codec_write_read_reg(struct device *dev, unsigned int reg)
|
||||
+{
|
||||
+ switch (reg) {
|
||||
+ case CODEC_RESET:
|
||||
+ case DAC_INIT_CTRL1:
|
||||
+ case DAC_INIT_CTRL2:
|
||||
+ case DAC_INIT_CTRL3:
|
||||
+ case DAC_PRECHARGE_CTRL:
|
||||
+ case DAC_PWR_CTRL:
|
||||
+ case DAC_CLK_CTRL:
|
||||
+ case HPMIX_CTRL:
|
||||
+ case DAC_SELECT:
|
||||
+ case HPOUT_CTRL:
|
||||
+ case HPOUTL_GAIN_CTRL:
|
||||
+ case HPOUTR_GAIN_CTRL:
|
||||
+ case HPOUT_POP_CTRL:
|
||||
+ return true;
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static bool rk3228_codec_volatile_reg(struct device *dev, unsigned int reg)
|
||||
+{
|
||||
+ switch (reg) {
|
||||
+ case CODEC_RESET:
|
||||
+ return true;
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static const struct regmap_config rk3228_codec_regmap_config = {
|
||||
+ .reg_bits = 32,
|
||||
+ .reg_stride = 4,
|
||||
+ .val_bits = 32,
|
||||
+ .max_register = HPOUT_POP_CTRL,
|
||||
+ .writeable_reg = rk3228_codec_write_read_reg,
|
||||
+ .readable_reg = rk3228_codec_write_read_reg,
|
||||
+ .volatile_reg = rk3228_codec_volatile_reg,
|
||||
+ .reg_defaults = rk3228_codec_reg_defaults,
|
||||
+ .num_reg_defaults = ARRAY_SIZE(rk3228_codec_reg_defaults),
|
||||
+ .cache_type = REGCACHE_FLAT,
|
||||
+};
|
||||
+
|
||||
+#ifdef CONFIG_OF
|
||||
+static const struct of_device_id rk3228codec_of_match[] = {
|
||||
+ { .compatible = "rockchip,rk3228-codec", },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, rk3228codec_of_match);
|
||||
+#endif
|
||||
+
|
||||
+static int rk3228_platform_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device_node *rk3228_np = pdev->dev.of_node;
|
||||
+ struct rk3228_codec_priv *rk3228;
|
||||
+ struct resource *res;
|
||||
+ void __iomem *base;
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ rk3228 = devm_kzalloc(&pdev->dev, sizeof(*rk3228), GFP_KERNEL);
|
||||
+ if (!rk3228)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ rk3228->mclk = devm_clk_get(&pdev->dev, "mclk");
|
||||
+ if (PTR_ERR(rk3228->mclk) == -EPROBE_DEFER)
|
||||
+ return -EPROBE_DEFER;
|
||||
+
|
||||
+ rk3228->pclk = devm_clk_get(&pdev->dev, "pclk");
|
||||
+ if (IS_ERR(rk3228->pclk))
|
||||
+ return PTR_ERR(rk3228->pclk);
|
||||
+
|
||||
+ rk3228->sclk = devm_clk_get(&pdev->dev, "sclk");
|
||||
+ if (IS_ERR(rk3228->sclk))
|
||||
+ return PTR_ERR(rk3228->sclk);
|
||||
+
|
||||
+ rk3228->spk_en_gpio = devm_gpiod_get_optional(&pdev->dev,
|
||||
+ "spk-en",
|
||||
+ GPIOD_OUT_LOW);
|
||||
+ if (IS_ERR(rk3228->spk_en_gpio))
|
||||
+ return PTR_ERR(rk3228->spk_en_gpio);
|
||||
+
|
||||
+ ret = of_property_read_u32(rk3228_np, "spk-depop-time-ms",
|
||||
+ &rk3228->spk_depop_time);
|
||||
+ if (ret < 0) {
|
||||
+ dev_info(&pdev->dev, "spk_depop_time use default value.\n");
|
||||
+ rk3228->spk_depop_time = 100;
|
||||
+ }
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ base = devm_ioremap_resource(&pdev->dev, res);
|
||||
+ if (IS_ERR(base))
|
||||
+ return PTR_ERR(base);
|
||||
+
|
||||
+ ret = clk_prepare_enable(rk3228->mclk);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = clk_prepare_enable(rk3228->pclk);
|
||||
+ if (ret < 0)
|
||||
+ goto err_pclk;
|
||||
+
|
||||
+ ret = clk_prepare_enable(rk3228->sclk);
|
||||
+ if (ret)
|
||||
+ goto err_sclk;
|
||||
+
|
||||
+ clk_set_rate(rk3228->sclk, INITIAL_FREQ);
|
||||
+
|
||||
+ rk3228->regmap = devm_regmap_init_mmio(&pdev->dev, base,
|
||||
+ &rk3228_codec_regmap_config);
|
||||
+ if (IS_ERR(rk3228->regmap)) {
|
||||
+ ret = PTR_ERR(rk3228->regmap);
|
||||
+ goto err_clk;
|
||||
+ }
|
||||
+
|
||||
+ platform_set_drvdata(pdev, rk3228);
|
||||
+
|
||||
+ ret = devm_snd_soc_register_component(&pdev->dev, &soc_codec_dev_rk3228,
|
||||
+ rk3228_dai, ARRAY_SIZE(rk3228_dai));
|
||||
+ if (!ret)
|
||||
+ return 0;
|
||||
+
|
||||
+err_clk:
|
||||
+ clk_disable_unprepare(rk3228->sclk);
|
||||
+err_sclk:
|
||||
+ clk_disable_unprepare(rk3228->pclk);
|
||||
+err_pclk:
|
||||
+ clk_disable_unprepare(rk3228->mclk);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int rk3228_platform_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct rk3228_codec_priv *rk3228 = platform_get_drvdata(pdev);
|
||||
+
|
||||
+ if (!IS_ERR(rk3228->mclk))
|
||||
+ clk_disable_unprepare(rk3228->mclk);
|
||||
+
|
||||
+ if (!IS_ERR(rk3228->pclk))
|
||||
+ clk_disable_unprepare(rk3228->pclk);
|
||||
+
|
||||
+ if (!IS_ERR(rk3228->sclk))
|
||||
+ clk_disable_unprepare(rk3228->sclk);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct platform_driver rk3228_codec_driver = {
|
||||
+ .driver = {
|
||||
+ .name = "rk3228-codec",
|
||||
+ .of_match_table = of_match_ptr(rk3228codec_of_match),
|
||||
+ },
|
||||
+ .probe = rk3228_platform_probe,
|
||||
+ .remove = rk3228_platform_remove,
|
||||
+};
|
||||
+module_platform_driver(rk3228_codec_driver);
|
||||
+
|
||||
+MODULE_AUTHOR("Sugar Zhang <sugar.zhang@rock-chips.com>");
|
||||
+MODULE_DESCRIPTION("ASoC rk3228 codec driver");
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
diff --git a/sound/soc/codecs/rk3228_codec.h b/sound/soc/codecs/rk3228_codec.h
|
||||
new file mode 100644
|
||||
index 000000000..7283d0ba8
|
||||
--- /dev/null
|
||||
+++ b/sound/soc/codecs/rk3228_codec.h
|
||||
@@ -0,0 +1,218 @@
|
||||
+/*
|
||||
+ * rk3228_codec.h -- rk3228 ALSA Soc Audio driver
|
||||
+ *
|
||||
+ * Copyright (c) 2018, Fuzhou Rockchip Electronics Co., Ltd All rights reserved.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms and conditions of the GNU General Public License,
|
||||
+ * version 2, as published by the Free Software Foundation.
|
||||
+ *
|
||||
+ * This program is distributed in the hope it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
+ * more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#ifndef _RK3228_CODEC_H
|
||||
+#define _RK3228_CODEC_H
|
||||
+
|
||||
+/* codec register */
|
||||
+#define CODEC_RESET (0x00 << 2)
|
||||
+#define DAC_INIT_CTRL1 (0x03 << 2)
|
||||
+#define DAC_INIT_CTRL2 (0x04 << 2)
|
||||
+#define DAC_INIT_CTRL3 (0x05 << 2)
|
||||
+#define DAC_PRECHARGE_CTRL (0x22 << 2)
|
||||
+#define DAC_PWR_CTRL (0x23 << 2)
|
||||
+#define DAC_CLK_CTRL (0x24 << 2)
|
||||
+#define HPMIX_CTRL (0x25 << 2)
|
||||
+#define DAC_SELECT (0x26 << 2)
|
||||
+#define HPOUT_CTRL (0x27 << 2)
|
||||
+#define HPOUTL_GAIN_CTRL (0x28 << 2)
|
||||
+#define HPOUTR_GAIN_CTRL (0x29 << 2)
|
||||
+#define HPOUT_POP_CTRL (0x2a << 2)
|
||||
+
|
||||
+/* REG00: CODEC_RESET */
|
||||
+#define PWR_RST_BYPASS_DIS BIT(6)
|
||||
+#define PWR_RST_BYPASS_EN BIT(6)
|
||||
+#define DIG_CORE_RST (0 << 1)
|
||||
+#define DIG_CORE_WORK BIT(1)
|
||||
+#define SYS_RST (0)
|
||||
+#define SYS_WORK BIT(0)
|
||||
+
|
||||
+/* REG03: DAC_INIT_CTRL1 */
|
||||
+#define PIN_DIRECTION_MASK BIT(5)
|
||||
+#define PIN_DIRECTION_IN (0 << 5)
|
||||
+#define PIN_DIRECTION_OUT BIT(5)
|
||||
+#define DAC_I2S_MODE_MASK BIT(4)
|
||||
+#define DAC_I2S_MODE_SLAVE (0 << 4)
|
||||
+#define DAC_I2S_MODE_MASTER BIT(4)
|
||||
+
|
||||
+/* REG04: DAC_INIT_CTRL2 */
|
||||
+#define DAC_I2S_LRP_MASK BIT(7)
|
||||
+#define DAC_I2S_LRP_NORMAL (0 << 7)
|
||||
+#define DAC_I2S_LRP_REVERSAL BIT(7)
|
||||
+#define DAC_VDL_MASK (3 << 5)
|
||||
+#define DAC_VDL_16BITS (0 << 5)
|
||||
+#define DAC_VDL_20BITS BIT(5)
|
||||
+#define DAC_VDL_24BITS (2 << 5)
|
||||
+#define DAC_VDL_32BITS (3 << 5)
|
||||
+#define DAC_MODE_MASK (3 << 3)
|
||||
+#define DAC_MODE_RJM (0 << 3)
|
||||
+#define DAC_MODE_LJM BIT(3)
|
||||
+#define DAC_MODE_I2S (2 << 3)
|
||||
+#define DAC_MODE_PCM (3 << 3)
|
||||
+#define DAC_LR_SWAP_MASK BIT(2)
|
||||
+#define DAC_LR_SWAP_DIS (0 << 2)
|
||||
+#define DAC_LR_SWAP_EN BIT(2)
|
||||
+
|
||||
+/* REG05: DAC_INIT_CTRL3 */
|
||||
+#define DAC_WL_MASK (3 << 2)
|
||||
+#define DAC_WL_16BITS (0 << 2)
|
||||
+#define DAC_WL_20BITS BIT(2)
|
||||
+#define DAC_WL_24BITS (2 << 2)
|
||||
+#define DAC_WL_32BITS (3 << 2)
|
||||
+#define DAC_RST_MASK BIT(1)
|
||||
+#define DAC_RST_EN (0 << 1)
|
||||
+#define DAC_RST_DIS BIT(1)
|
||||
+#define DAC_BCP_MASK BIT(0)
|
||||
+#define DAC_BCP_NORMAL (0 << 0)
|
||||
+#define DAC_BCP_REVERSAL BIT(0)
|
||||
+
|
||||
+/* REG22: DAC_PRECHARGE_CTRL */
|
||||
+#define DAC_CHARGE_PRECHARGE BIT(7)
|
||||
+#define DAC_CHARGE_DISCHARGE (0 << 7)
|
||||
+#define DAC_CHARGE_XCHARGE_MASK BIT(7)
|
||||
+#define DAC_CHARGE_CURRENT_64I BIT(6)
|
||||
+#define DAC_CHARGE_CURRENT_64I_MASK BIT(6)
|
||||
+#define DAC_CHARGE_CURRENT_32I BIT(5)
|
||||
+#define DAC_CHARGE_CURRENT_32I_MASK BIT(5)
|
||||
+#define DAC_CHARGE_CURRENT_16I BIT(4)
|
||||
+#define DAC_CHARGE_CURRENT_16I_MASK BIT(4)
|
||||
+#define DAC_CHARGE_CURRENT_08I BIT(3)
|
||||
+#define DAC_CHARGE_CURRENT_08I_MASK BIT(3)
|
||||
+#define DAC_CHARGE_CURRENT_04I BIT(2)
|
||||
+#define DAC_CHARGE_CURRENT_04I_MASK BIT(2)
|
||||
+#define DAC_CHARGE_CURRENT_02I BIT(1)
|
||||
+#define DAC_CHARGE_CURRENT_02I_MASK BIT(1)
|
||||
+#define DAC_CHARGE_CURRENT_I BIT(0)
|
||||
+#define DAC_CHARGE_CURRENT_I_MASK BIT(0)
|
||||
+#define DAC_CHARGE_CURRENT_ALL_MASK (0x7f)
|
||||
+#define DAC_CHARGE_CURRENT_ALL_OFF (0x0)
|
||||
+#define DAC_CHARGE_CURRENT_ALL_ON (0x7f)
|
||||
+
|
||||
+/* REG23: DAC_PWR_CTRL */
|
||||
+#define DAC_PWR_OFF (0 << 6)
|
||||
+#define DAC_PWR_ON BIT(6)
|
||||
+#define DAC_PWR_MASK BIT(6)
|
||||
+#define DACL_PATH_REFV_OFF (0 << 5)
|
||||
+#define DACL_PATH_REFV_ON BIT(5)
|
||||
+#define DACL_PATH_REFV_MASK BIT(5)
|
||||
+#define HPOUTL_ZERO_CROSSING_OFF (0 << 4)
|
||||
+#define HPOUTL_ZERO_CROSSING_ON BIT(4)
|
||||
+#define DACR_PATH_REFV_OFF (0 << 1)
|
||||
+#define DACR_PATH_REFV_ON BIT(1)
|
||||
+#define DACR_PATH_REFV_MASK BIT(1)
|
||||
+#define HPOUTR_ZERO_CROSSING_OFF (0 << 0)
|
||||
+#define HPOUTR_ZERO_CROSSING_ON BIT(0)
|
||||
+
|
||||
+/* REG24: DAC_CLK_CTRL */
|
||||
+#define DACL_REFV_OFF (0 << 7)
|
||||
+#define DACL_REFV_ON BIT(7)
|
||||
+#define DACL_REFV_MASK BIT(7)
|
||||
+#define DACL_CLK_OFF (0 << 6)
|
||||
+#define DACL_CLK_ON BIT(6)
|
||||
+#define DACL_CLK_MASK BIT(6)
|
||||
+#define DACL_OFF (0 << 5)
|
||||
+#define DACL_ON BIT(5)
|
||||
+#define DACL_MASK BIT(5)
|
||||
+#define DACL_INIT_OFF (0 << 4)
|
||||
+#define DACL_INIT_ON BIT(4)
|
||||
+#define DACL_INIT_MASK BIT(4)
|
||||
+#define DACR_REFV_OFF (0 << 3)
|
||||
+#define DACR_REFV_ON BIT(3)
|
||||
+#define DACR_REFV_MASK BIT(3)
|
||||
+#define DACR_CLK_OFF (0 << 2)
|
||||
+#define DACR_CLK_ON BIT(2)
|
||||
+#define DACR_CLK_MASK BIT(2)
|
||||
+#define DACR_OFF (0 << 1)
|
||||
+#define DACR_ON BIT(1)
|
||||
+#define DACR_MASK BIT(1)
|
||||
+#define DACR_INIT_OFF (0 << 0)
|
||||
+#define DACR_INIT_ON BIT(0)
|
||||
+#define DACR_INIT_MASK BIT(0)
|
||||
+
|
||||
+/* REG25: HPMIX_CTRL*/
|
||||
+#define HPMIXL_DIS (0 << 6)
|
||||
+#define HPMIXL_EN BIT(6)
|
||||
+#define HPMIXL_MASK BIT(6)
|
||||
+#define HPMIXL_INIT_DIS (0 << 5)
|
||||
+#define HPMIXL_INIT_EN BIT(5)
|
||||
+#define HPMIXL_INIT_MASK BIT(5)
|
||||
+#define HPMIXL_INIT2_DIS (0 << 4)
|
||||
+#define HPMIXL_INIT2_EN BIT(4)
|
||||
+#define HPMIXL_INIT2_MASK BIT(4)
|
||||
+#define HPMIXR_DIS (0 << 2)
|
||||
+#define HPMIXR_EN BIT(2)
|
||||
+#define HPMIXR_MASK BIT(2)
|
||||
+#define HPMIXR_INIT_DIS (0 << 1)
|
||||
+#define HPMIXR_INIT_EN BIT(1)
|
||||
+#define HPMIXR_INIT_MASK BIT(1)
|
||||
+#define HPMIXR_INIT2_DIS (0 << 0)
|
||||
+#define HPMIXR_INIT2_EN BIT(0)
|
||||
+#define HPMIXR_INIT2_MASK BIT(0)
|
||||
+
|
||||
+/* REG26: DAC_SELECT */
|
||||
+#define DACL_SELECT BIT(4)
|
||||
+#define DACL_SELECT_MASK BIT(4)
|
||||
+#define DACL_DESELECT (0 << 4)
|
||||
+#define DACR_SELECT BIT(0)
|
||||
+#define DACR_SELECT_MASK BIT(0)
|
||||
+#define DACR_DESELECT (0 << 0)
|
||||
+
|
||||
+/* REG27: HPOUT_CTRL */
|
||||
+#define HPOUTL_DIS (0 << 7)
|
||||
+#define HPOUTL_EN BIT(7)
|
||||
+#define HPOUTL_MASK BIT(7)
|
||||
+#define HPOUTL_INIT_DIS (0 << 6)
|
||||
+#define HPOUTL_INIT_EN BIT(6)
|
||||
+#define HPOUTL_INIT_MASK BIT(6)
|
||||
+#define HPOUTL_MUTE (0 << 5)
|
||||
+#define HPOUTL_UNMUTE BIT(5)
|
||||
+#define HPOUTL_MUTE_MASK BIT(5)
|
||||
+#define HPOUTR_DIS (0 << 4)
|
||||
+#define HPOUTR_EN BIT(4)
|
||||
+#define HPOUTR_MASK BIT(4)
|
||||
+#define HPOUTR_INIT_DIS (0 << 3)
|
||||
+#define HPOUTR_INIT_EN BIT(3)
|
||||
+#define HPOUTR_INIT_MASK BIT(3)
|
||||
+#define HPOUTR_MUTE (0 << 2)
|
||||
+#define HPOUTR_UNMUTE BIT(2)
|
||||
+#define HPOUTR_MUTE_MASK BIT(2)
|
||||
+
|
||||
+/* REG28: HPOUTL_GAIN_CTRL */
|
||||
+#define HPOUTL_GAIN_MASK (0X1f << 0)
|
||||
+
|
||||
+/* REG29: HPOUTR_GAIN_CTRL */
|
||||
+#define HPOUTR_GAIN_MASK (0X1f << 0)
|
||||
+
|
||||
+/* REG2a: HPOUT_POP_CTRL */
|
||||
+#define HPOUTR_POP_XCHARGE BIT(4)
|
||||
+#define HPOUTR_POP_WORK (2 << 4)
|
||||
+#define HPOUTR_POP_MASK (3 << 4)
|
||||
+#define HPOUTL_POP_XCHARGE BIT(0)
|
||||
+#define HPOUTL_POP_WORK (2 << 0)
|
||||
+#define HPOUTL_POP_MASK (3 << 0)
|
||||
+
|
||||
+#define RK3228_HIFI (0)
|
||||
+
|
||||
+struct rk3228_reg_msk_val {
|
||||
+ unsigned int reg;
|
||||
+ unsigned int msk;
|
||||
+ unsigned int val;
|
||||
+};
|
||||
+
|
||||
+#endif
|
||||
--
|
||||
2.25.1
|
||||
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
From 9e105544fcb63f8f79b199d1b194a36a354519b3 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Sun, 2 Apr 2023 10:53:07 +0000
|
||||
Subject: [PATCH 2/2] rk322x: better handle mmc/sdio clocks
|
||||
|
||||
---
|
||||
drivers/clk/rockchip/clk-rk3228.c | 10 ++++------
|
||||
1 file changed, 4 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/drivers/clk/rockchip/clk-rk3228.c b/drivers/clk/rockchip/clk-rk3228.c
|
||||
index 996f8bfee..0f690dd84 100644
|
||||
--- a/drivers/clk/rockchip/clk-rk3228.c
|
||||
+++ b/drivers/clk/rockchip/clk-rk3228.c
|
||||
@@ -371,17 +371,15 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
|
||||
RK2928_CLKSEL_CON(11), 8, 2, MFLAGS, 0, 8, DFLAGS,
|
||||
RK2928_CLKGATE_CON(2), 11, GFLAGS),
|
||||
|
||||
- COMPOSITE_NODIV(SCLK_SDIO_SRC, "sclk_sdio_src", mux_mmc_src_p, 0,
|
||||
+ COMPOSITE_DIV_OFFSET(SCLK_SDIO, "sclk_sdio", mux_mmc_src_p, 0,
|
||||
RK2928_CLKSEL_CON(11), 10, 2, MFLAGS,
|
||||
+ RK2928_CLKSEL_CON(12), 0, 8, DFLAGS,
|
||||
RK2928_CLKGATE_CON(2), 13, GFLAGS),
|
||||
- DIV(SCLK_SDIO, "sclk_sdio", "sclk_sdio_src", 0,
|
||||
- RK2928_CLKSEL_CON(12), 0, 8, DFLAGS),
|
||||
|
||||
- COMPOSITE_NODIV(0, "sclk_emmc_src", mux_mmc_src_p, 0,
|
||||
+ COMPOSITE_DIV_OFFSET(SCLK_EMMC, "sclk_emmc", mux_mmc_src_p, 0,
|
||||
RK2928_CLKSEL_CON(11), 12, 2, MFLAGS,
|
||||
+ RK2928_CLKSEL_CON(12), 8, 8, DFLAGS,
|
||||
RK2928_CLKGATE_CON(2), 14, GFLAGS),
|
||||
- DIV(SCLK_EMMC, "sclk_emmc", "sclk_emmc_src", 0,
|
||||
- RK2928_CLKSEL_CON(12), 8, 8, DFLAGS),
|
||||
|
||||
/*
|
||||
* Clock-Architecture Diagram 2
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@ -0,0 +1,234 @@
|
||||
From e039790fb29227f646e91e6d7ec7c3e89c584243 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Tue, 6 Jul 2021 14:21:52 +0000
|
||||
Subject: [PATCH 1/5] rk3228/rk3328: fix ddr clock gate, add SIP v2 calls
|
||||
|
||||
---
|
||||
drivers/clk/rockchip/clk-ddr.c | 130 ++++++++++++++++++++++++++++++
|
||||
drivers/clk/rockchip/clk-rk3228.c | 14 ++--
|
||||
drivers/clk/rockchip/clk-rk3328.c | 7 +-
|
||||
drivers/clk/rockchip/clk.h | 3 +-
|
||||
4 files changed, 143 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/drivers/clk/rockchip/clk-ddr.c b/drivers/clk/rockchip/clk-ddr.c
|
||||
index 86718c54e..b16b3795f 100644
|
||||
--- a/drivers/clk/rockchip/clk-ddr.c
|
||||
+++ b/drivers/clk/rockchip/clk-ddr.c
|
||||
@@ -87,6 +87,133 @@ static const struct clk_ops rockchip_ddrclk_sip_ops = {
|
||||
.get_parent = rockchip_ddrclk_get_parent,
|
||||
};
|
||||
|
||||
+/* See v4.4/include/dt-bindings/display/rk_fb.h */
|
||||
+#define SCREEN_NULL 0
|
||||
+#define SCREEN_HDMI 6
|
||||
+
|
||||
+static inline int rk_drm_get_lcdc_type(void)
|
||||
+{
|
||||
+ return SCREEN_NULL;
|
||||
+}
|
||||
+
|
||||
+struct share_params {
|
||||
+ u32 hz;
|
||||
+ u32 lcdc_type;
|
||||
+ u32 vop;
|
||||
+ u32 vop_dclk_mode;
|
||||
+ u32 sr_idle_en;
|
||||
+ u32 addr_mcu_el3;
|
||||
+ /*
|
||||
+ * 1: need to wait flag1
|
||||
+ * 0: never wait flag1
|
||||
+ */
|
||||
+ u32 wait_flag1;
|
||||
+ /*
|
||||
+ * 1: need to wait flag1
|
||||
+ * 0: never wait flag1
|
||||
+ */
|
||||
+ u32 wait_flag0;
|
||||
+ u32 complt_hwirq;
|
||||
+ /* if need, add parameter after */
|
||||
+};
|
||||
+
|
||||
+struct rockchip_ddrclk_data {
|
||||
+ u32 inited_flag;
|
||||
+ void __iomem *share_memory;
|
||||
+};
|
||||
+
|
||||
+static struct rockchip_ddrclk_data ddr_data;
|
||||
+
|
||||
+static void rockchip_ddrclk_data_init(void)
|
||||
+{
|
||||
+ struct arm_smccc_res res;
|
||||
+
|
||||
+ arm_smccc_smc(ROCKCHIP_SIP_SHARE_MEM,
|
||||
+ 1, SHARE_PAGE_TYPE_DDR, 0,
|
||||
+ 0, 0, 0, 0, &res);
|
||||
+
|
||||
+ if (!res.a0) {
|
||||
+ ddr_data.share_memory = (void __iomem *)ioremap(res.a1, 1<<12);
|
||||
+ ddr_data.inited_flag = 1;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int rockchip_ddrclk_sip_set_rate_v2(struct clk_hw *hw,
|
||||
+ unsigned long drate,
|
||||
+ unsigned long prate)
|
||||
+{
|
||||
+ struct share_params *p;
|
||||
+ struct arm_smccc_res res;
|
||||
+
|
||||
+ if (!ddr_data.inited_flag)
|
||||
+ rockchip_ddrclk_data_init();
|
||||
+
|
||||
+ p = (struct share_params *)ddr_data.share_memory;
|
||||
+
|
||||
+ p->hz = drate;
|
||||
+ p->lcdc_type = rk_drm_get_lcdc_type();
|
||||
+ p->wait_flag1 = 1;
|
||||
+ p->wait_flag0 = 1;
|
||||
+
|
||||
+ arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ,
|
||||
+ SHARE_PAGE_TYPE_DDR, 0,
|
||||
+ ROCKCHIP_SIP_CONFIG_DRAM_SET_RATE,
|
||||
+ 0, 0, 0, 0, &res);
|
||||
+
|
||||
+ if ((int)res.a1 == -6) {
|
||||
+ pr_err("%s: timeout, drate = %lumhz\n", __func__, drate/1000000);
|
||||
+ /* TODO: rockchip_dmcfreq_wait_complete(); */
|
||||
+ }
|
||||
+
|
||||
+ return res.a0;
|
||||
+}
|
||||
+
|
||||
+static unsigned long rockchip_ddrclk_sip_recalc_rate_v2
|
||||
+ (struct clk_hw *hw, unsigned long parent_rate)
|
||||
+{
|
||||
+ struct arm_smccc_res res;
|
||||
+
|
||||
+ arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ,
|
||||
+ SHARE_PAGE_TYPE_DDR, 0,
|
||||
+ ROCKCHIP_SIP_CONFIG_DRAM_GET_RATE,
|
||||
+ 0, 0, 0, 0, &res);
|
||||
+ if (!res.a0)
|
||||
+ return res.a1;
|
||||
+ else
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static long rockchip_ddrclk_sip_round_rate_v2(struct clk_hw *hw,
|
||||
+ unsigned long rate,
|
||||
+ unsigned long *prate)
|
||||
+{
|
||||
+ struct share_params *p;
|
||||
+ struct arm_smccc_res res;
|
||||
+
|
||||
+ if (!ddr_data.inited_flag)
|
||||
+ rockchip_ddrclk_data_init();
|
||||
+
|
||||
+ p = (struct share_params *)ddr_data.share_memory;
|
||||
+
|
||||
+ p->hz = rate;
|
||||
+
|
||||
+ arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ,
|
||||
+ SHARE_PAGE_TYPE_DDR, 0,
|
||||
+ ROCKCHIP_SIP_CONFIG_DRAM_ROUND_RATE,
|
||||
+ 0, 0, 0, 0, &res);
|
||||
+ if (!res.a0)
|
||||
+ return res.a1;
|
||||
+ else
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct clk_ops rockchip_ddrclk_sip_ops_v2 = {
|
||||
+ .recalc_rate = rockchip_ddrclk_sip_recalc_rate_v2,
|
||||
+ .set_rate = rockchip_ddrclk_sip_set_rate_v2,
|
||||
+ .round_rate = rockchip_ddrclk_sip_round_rate_v2,
|
||||
+ .get_parent = rockchip_ddrclk_get_parent,
|
||||
+};
|
||||
+
|
||||
struct clk *rockchip_clk_register_ddrclk(const char *name, int flags,
|
||||
const char *const *parent_names,
|
||||
u8 num_parents, int mux_offset,
|
||||
@@ -114,6 +241,9 @@ struct clk *rockchip_clk_register_ddrclk(const char *name, int flags,
|
||||
case ROCKCHIP_DDRCLK_SIP:
|
||||
init.ops = &rockchip_ddrclk_sip_ops;
|
||||
break;
|
||||
+ case ROCKCHIP_DDRCLK_SIP_V2:
|
||||
+ init.ops = &rockchip_ddrclk_sip_ops_v2;
|
||||
+ break;
|
||||
default:
|
||||
pr_err("%s: unsupported ddrclk type %d\n", __func__, ddr_flag);
|
||||
kfree(ddrclk);
|
||||
diff --git a/drivers/clk/rockchip/clk-rk3228.c b/drivers/clk/rockchip/clk-rk3228.c
|
||||
index 1f9176a5c..96393aa16 100644
|
||||
--- a/drivers/clk/rockchip/clk-rk3228.c
|
||||
+++ b/drivers/clk/rockchip/clk-rk3228.c
|
||||
@@ -218,9 +218,9 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
|
||||
RK2928_CLKSEL_CON(4), 8, 5, DFLAGS),
|
||||
|
||||
/* PD_DDR */
|
||||
- COMPOSITE(0, "clk_ddrphy_src", mux_ddrphy_p, CLK_IGNORE_UNUSED,
|
||||
- RK2928_CLKSEL_CON(26), 8, 2, MFLAGS, 0, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO,
|
||||
- RK2928_CLKGATE_CON(0), 2, GFLAGS),
|
||||
+ COMPOSITE_DDRCLK(SCLK_DDRCLK, "sclk_ddrc", mux_ddrphy_p, 0,
|
||||
+ RK2928_CLKSEL_CON(26), 8, 2, 0, 2,
|
||||
+ ROCKCHIP_DDRCLK_SIP_V2),
|
||||
GATE(0, "ddrphy4x", "clk_ddrphy_src", CLK_IGNORE_UNUSED,
|
||||
RK2928_CLKGATE_CON(7), 1, GFLAGS),
|
||||
FACTOR_GATE(0, "ddrc", "clk_ddrphy_src", CLK_IGNORE_UNUSED, 1, 4,
|
||||
@@ -576,8 +576,8 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
|
||||
GATE(HCLK_M_CRYPTO, "hclk_crypto_mst", "hclk_cpu", 0, RK2928_CLKGATE_CON(8), 11, GFLAGS),
|
||||
GATE(HCLK_S_CRYPTO, "hclk_crypto_slv", "hclk_cpu", 0, RK2928_CLKGATE_CON(8), 12, GFLAGS),
|
||||
|
||||
- GATE(0, "pclk_ddrupctl", "pclk_ddr_pre", 0, RK2928_CLKGATE_CON(8), 4, GFLAGS),
|
||||
- GATE(0, "pclk_ddrmon", "pclk_ddr_pre", 0, RK2928_CLKGATE_CON(8), 6, GFLAGS),
|
||||
+ GATE(0, "pclk_ddr_upctl", "pclk_ddr_pre", 0, RK2928_CLKGATE_CON(8), 4, GFLAGS),
|
||||
+ GATE(0, "pclk_ddr_mon", "pclk_ddr_pre", 0, RK2928_CLKGATE_CON(8), 6, GFLAGS),
|
||||
GATE(0, "pclk_msch_noc", "pclk_ddr_pre", 0, RK2928_CLKGATE_CON(10), 2, GFLAGS),
|
||||
|
||||
GATE(PCLK_EFUSE_1024, "pclk_efuse_1024", "pclk_cpu", 0, RK2928_CLKGATE_CON(8), 13, GFLAGS),
|
||||
@@ -652,8 +652,8 @@ static const char *const rk3228_critical_clocks[] __initconst = {
|
||||
"sclk_initmem_mbist",
|
||||
"aclk_initmem",
|
||||
"hclk_rom",
|
||||
- "pclk_ddrupctl",
|
||||
- "pclk_ddrmon",
|
||||
+ "pclk_ddr_upctl",
|
||||
+ "pclk_ddr_mon",
|
||||
"pclk_msch_noc",
|
||||
"pclk_stimer",
|
||||
"pclk_ddrphy",
|
||||
diff --git a/drivers/clk/rockchip/clk-rk3328.c b/drivers/clk/rockchip/clk-rk3328.c
|
||||
index cc18dbc18..5fdd611bb 100644
|
||||
--- a/drivers/clk/rockchip/clk-rk3328.c
|
||||
+++ b/drivers/clk/rockchip/clk-rk3328.c
|
||||
@@ -317,9 +317,10 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = {
|
||||
RK3328_CLKGATE_CON(14), 1, GFLAGS),
|
||||
|
||||
/* PD_DDR */
|
||||
- COMPOSITE(0, "clk_ddr", mux_ddrphy_p, CLK_IGNORE_UNUSED,
|
||||
- RK3328_CLKSEL_CON(3), 8, 2, MFLAGS, 0, 3, DFLAGS | CLK_DIVIDER_POWER_OF_TWO,
|
||||
- RK3328_CLKGATE_CON(0), 4, GFLAGS),
|
||||
+ COMPOSITE_DDRCLK(SCLK_DDRCLK, "sclk_ddrc", mux_ddrphy_p, 0,
|
||||
+ RK3328_CLKSEL_CON(3), 8, 2, 0, 3,
|
||||
+ ROCKCHIP_DDRCLK_SIP_V2),
|
||||
+
|
||||
GATE(0, "clk_ddrmsch", "clk_ddr", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(18), 6, GFLAGS),
|
||||
GATE(0, "clk_ddrupctl", "clk_ddr", CLK_IGNORE_UNUSED,
|
||||
diff --git a/drivers/clk/rockchip/clk.h b/drivers/clk/rockchip/clk.h
|
||||
index ae059b774..fdaa81ebb 100644
|
||||
--- a/drivers/clk/rockchip/clk.h
|
||||
+++ b/drivers/clk/rockchip/clk.h
|
||||
@@ -363,7 +363,8 @@ struct clk *rockchip_clk_register_mmc(const char *name,
|
||||
* DDRCLK flags, including method of setting the rate
|
||||
* ROCKCHIP_DDRCLK_SIP: use SIP call to bl31 to change ddrclk rate.
|
||||
*/
|
||||
-#define ROCKCHIP_DDRCLK_SIP BIT(0)
|
||||
+#define ROCKCHIP_DDRCLK_SIP 0x01
|
||||
+#define ROCKCHIP_DDRCLK_SIP_V2 0x03
|
||||
|
||||
struct clk *rockchip_clk_register_ddrclk(const char *name, int flags,
|
||||
const char *const *parent_names,
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
From 95358ea4a4434ad4af5545b3f762508e4f015fc3 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Tue, 6 Jul 2021 14:23:36 +0000
|
||||
Subject: [PATCH 2/5] rk3228/rk3328: add ddr clock and SIP related constants
|
||||
and defines
|
||||
|
||||
---
|
||||
include/dt-bindings/clock/rk3228-cru.h | 1 +
|
||||
include/soc/rockchip/rockchip_sip.h | 24 ++++++++++++++++++++++++
|
||||
2 files changed, 25 insertions(+)
|
||||
|
||||
diff --git a/include/dt-bindings/clock/rk3228-cru.h b/include/dt-bindings/clock/rk3228-cru.h
|
||||
index de550ea56..911824731 100644
|
||||
--- a/include/dt-bindings/clock/rk3228-cru.h
|
||||
+++ b/include/dt-bindings/clock/rk3228-cru.h
|
||||
@@ -15,6 +15,7 @@
|
||||
#define ARMCLK 5
|
||||
|
||||
/* sclk gates (special clocks) */
|
||||
+#define SCLK_DDRCLK 64
|
||||
#define SCLK_SPI0 65
|
||||
#define SCLK_NANDC 67
|
||||
#define SCLK_SDMMC 68
|
||||
diff --git a/include/soc/rockchip/rockchip_sip.h b/include/soc/rockchip/rockchip_sip.h
|
||||
index c46a9ae2a..34e653751 100644
|
||||
--- a/include/soc/rockchip/rockchip_sip.h
|
||||
+++ b/include/soc/rockchip/rockchip_sip.h
|
||||
@@ -6,6 +6,7 @@
|
||||
#ifndef __SOC_ROCKCHIP_SIP_H
|
||||
#define __SOC_ROCKCHIP_SIP_H
|
||||
|
||||
+#define ROCKCHIP_SIP_ATF_VERSION 0x82000001
|
||||
#define ROCKCHIP_SIP_DRAM_FREQ 0x82000008
|
||||
#define ROCKCHIP_SIP_CONFIG_DRAM_INIT 0x00
|
||||
#define ROCKCHIP_SIP_CONFIG_DRAM_SET_RATE 0x01
|
||||
@@ -16,5 +17,28 @@
|
||||
#define ROCKCHIP_SIP_CONFIG_DRAM_CLR_IRQ 0x06
|
||||
#define ROCKCHIP_SIP_CONFIG_DRAM_SET_PARAM 0x07
|
||||
#define ROCKCHIP_SIP_CONFIG_DRAM_SET_ODT_PD 0x08
|
||||
+#define ROCKCHIP_SIP_CONFIG_DRAM_GET_VERSION 0x08
|
||||
+#define ROCKCHIP_SIP_CONFIG_DRAM_POST_SET_RATE 0x09
|
||||
+#define ROCKCHIP_SIP_CONFIG_DRAM_SET_MSCH_RL 0x0a
|
||||
+#define ROCKCHIP_SIP_CONFIG_DRAM_DEBUG 0x0b
|
||||
+
|
||||
+#define ROCKCHIP_SIP_SHARE_MEM 0x82000009
|
||||
+#define ROCKCHIP_SIP_SIP_VERSION 0x8200000a
|
||||
+
|
||||
+/* Rockchip Sip version */
|
||||
+#define ROCKCHIP_SIP_IMPLEMENT_V1 (1)
|
||||
+#define ROCKCHIP_SIP_IMPLEMENT_V2 (2)
|
||||
+
|
||||
+/* SIP_ACCESS_REG: read or write */
|
||||
+#define SECURE_REG_RD 0x0
|
||||
+#define SECURE_REG_WR 0x1
|
||||
+
|
||||
+/* Share mem page types */
|
||||
+typedef enum {
|
||||
+ SHARE_PAGE_TYPE_INVALID = 0,
|
||||
+ SHARE_PAGE_TYPE_UARTDBG,
|
||||
+ SHARE_PAGE_TYPE_DDR,
|
||||
+ SHARE_PAGE_TYPE_MAX,
|
||||
+} share_page_type_t;
|
||||
|
||||
#endif
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,745 @@
|
||||
From 415ed43c9b64ca38bc433bd5dc0359292dd80380 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Tue, 6 Jul 2021 14:25:41 +0000
|
||||
Subject: [PATCH 3/5] rk3228/rk3328: extend rockchip dfi driver
|
||||
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk322x.dtsi | 7 +
|
||||
drivers/devfreq/event/rockchip-dfi.c | 598 ++++++++++++++++++++++++---
|
||||
2 files changed, 557 insertions(+), 48 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk322x.dtsi b/arch/arm/boot/dts/rockchip/rk322x.dtsi
|
||||
index ad98fcf37..7e06acc31 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk322x.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk322x.dtsi
|
||||
@@ -97,6 +97,13 @@ opp-1200000000 {
|
||||
};
|
||||
};
|
||||
|
||||
+ dfi: dfi@11210000 {
|
||||
+ reg = <0x11210000 0x400>;
|
||||
+ compatible = "rockchip,rk3228-dfi";
|
||||
+ rockchip,grf = <&grf>;
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
arm-pmu {
|
||||
compatible = "arm,cortex-a7-pmu";
|
||||
interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>,
|
||||
diff --git a/drivers/devfreq/event/rockchip-dfi.c b/drivers/devfreq/event/rockchip-dfi.c
|
||||
index 9a88faaf8..01fb84b99 100644
|
||||
--- a/drivers/devfreq/event/rockchip-dfi.c
|
||||
+++ b/drivers/devfreq/event/rockchip-dfi.c
|
||||
@@ -18,25 +18,68 @@
|
||||
#include <linux/list.h>
|
||||
#include <linux/of.h>
|
||||
|
||||
-#include <soc/rockchip/rk3399_grf.h>
|
||||
-
|
||||
-#define RK3399_DMC_NUM_CH 2
|
||||
-
|
||||
+#define PX30_PMUGRF_OS_REG2 0x208
|
||||
+
|
||||
+#define RK3128_GRF_SOC_CON0 0x140
|
||||
+#define RK3128_GRF_OS_REG1 0x1cc
|
||||
+#define RK3128_GRF_DFI_WRNUM 0x220
|
||||
+#define RK3128_GRF_DFI_RDNUM 0x224
|
||||
+#define RK3128_GRF_DFI_TIMERVAL 0x22c
|
||||
+#define RK3128_DDR_MONITOR_EN ((1 << (16 + 6)) + (1 << 6))
|
||||
+#define RK3128_DDR_MONITOR_DISB ((1 << (16 + 6)) + (0 << 6))
|
||||
+
|
||||
+#define RK3228_GRF_OS_REG2 0x5d0
|
||||
+
|
||||
+#define RK3288_PMU_SYS_REG2 0x9c
|
||||
+#define RK3288_GRF_SOC_CON4 0x254
|
||||
+#define RK3288_GRF_SOC_STATUS(n) (0x280 + (n) * 4)
|
||||
+#define RK3288_DFI_EN (0x30003 << 14)
|
||||
+#define RK3288_DFI_DIS (0x30000 << 14)
|
||||
+#define RK3288_LPDDR_SEL (0x10001 << 13)
|
||||
+#define RK3288_DDR3_SEL (0x10000 << 13)
|
||||
+
|
||||
+#define RK3328_GRF_OS_REG2 0x5d0
|
||||
+
|
||||
+#define RK3368_GRF_DDRC0_CON0 0x600
|
||||
+#define RK3368_GRF_SOC_STATUS5 0x494
|
||||
+#define RK3368_GRF_SOC_STATUS6 0x498
|
||||
+#define RK3368_GRF_SOC_STATUS8 0x4a0
|
||||
+#define RK3368_GRF_SOC_STATUS9 0x4a4
|
||||
+#define RK3368_GRF_SOC_STATUS10 0x4a8
|
||||
+#define RK3368_DFI_EN (0x30003 << 5)
|
||||
+#define RK3368_DFI_DIS (0x30000 << 5)
|
||||
+
|
||||
+#define MAX_DMC_NUM_CH 2
|
||||
+#define READ_DRAMTYPE_INFO(n) (((n) >> 13) & 0x7)
|
||||
+#define READ_CH_INFO(n) (((n) >> 28) & 0x3)
|
||||
/* DDRMON_CTRL */
|
||||
-#define DDRMON_CTRL 0x04
|
||||
-#define CLR_DDRMON_CTRL (0x1f0000 << 0)
|
||||
-#define LPDDR4_EN (0x10001 << 4)
|
||||
-#define HARDWARE_EN (0x10001 << 3)
|
||||
-#define LPDDR3_EN (0x10001 << 2)
|
||||
-#define SOFTWARE_EN (0x10001 << 1)
|
||||
-#define SOFTWARE_DIS (0x10000 << 1)
|
||||
-#define TIME_CNT_EN (0x10001 << 0)
|
||||
+#define DDRMON_CTRL 0x04
|
||||
+#define CLR_DDRMON_CTRL (0x3f0000 << 0)
|
||||
+#define DDR4_EN (0x10001 << 5)
|
||||
+#define LPDDR4_EN (0x10001 << 4)
|
||||
+#define HARDWARE_EN (0x10001 << 3)
|
||||
+#define LPDDR2_3_EN (0x10001 << 2)
|
||||
+#define SOFTWARE_EN (0x10001 << 1)
|
||||
+#define SOFTWARE_DIS (0x10000 << 1)
|
||||
+#define TIME_CNT_EN (0x10001 << 0)
|
||||
|
||||
#define DDRMON_CH0_COUNT_NUM 0x28
|
||||
#define DDRMON_CH0_DFI_ACCESS_NUM 0x2c
|
||||
#define DDRMON_CH1_COUNT_NUM 0x3c
|
||||
#define DDRMON_CH1_DFI_ACCESS_NUM 0x40
|
||||
|
||||
+/* pmu grf */
|
||||
+#define PMUGRF_OS_REG2 0x308
|
||||
+
|
||||
+enum {
|
||||
+ DDR4 = 0,
|
||||
+ DDR3 = 3,
|
||||
+ LPDDR2 = 5,
|
||||
+ LPDDR3 = 6,
|
||||
+ LPDDR4 = 7,
|
||||
+ UNUSED = 0xFF
|
||||
+};
|
||||
+
|
||||
struct dmc_usage {
|
||||
u32 access;
|
||||
u32 total;
|
||||
@@ -50,33 +93,261 @@ struct dmc_usage {
|
||||
struct rockchip_dfi {
|
||||
struct devfreq_event_dev *edev;
|
||||
struct devfreq_event_desc *desc;
|
||||
- struct dmc_usage ch_usage[RK3399_DMC_NUM_CH];
|
||||
+ struct dmc_usage ch_usage[MAX_DMC_NUM_CH];
|
||||
struct device *dev;
|
||||
void __iomem *regs;
|
||||
struct regmap *regmap_pmu;
|
||||
+ struct regmap *regmap_grf;
|
||||
+ struct regmap *regmap_pmugrf;
|
||||
struct clk *clk;
|
||||
+ u32 dram_type;
|
||||
+ /*
|
||||
+ * available mask, 1: available, 0: not available
|
||||
+ * each bit represent a channel
|
||||
+ */
|
||||
+ u32 ch_msk;
|
||||
+};
|
||||
+
|
||||
+static void rk3128_dfi_start_hardware_counter(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+
|
||||
+ regmap_write(info->regmap_grf,
|
||||
+ RK3128_GRF_SOC_CON0,
|
||||
+ RK3128_DDR_MONITOR_EN);
|
||||
+}
|
||||
+
|
||||
+static void rk3128_dfi_stop_hardware_counter(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+
|
||||
+ regmap_write(info->regmap_grf,
|
||||
+ RK3128_GRF_SOC_CON0,
|
||||
+ RK3128_DDR_MONITOR_DISB);
|
||||
+}
|
||||
+
|
||||
+static int rk3128_dfi_disable(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ rk3128_dfi_stop_hardware_counter(edev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3128_dfi_enable(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ rk3128_dfi_start_hardware_counter(edev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3128_dfi_set_event(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3128_dfi_get_event(struct devfreq_event_dev *edev,
|
||||
+ struct devfreq_event_data *edata)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+ unsigned long flags;
|
||||
+ u32 dfi_wr, dfi_rd, dfi_timer;
|
||||
+
|
||||
+ local_irq_save(flags);
|
||||
+
|
||||
+ rk3128_dfi_stop_hardware_counter(edev);
|
||||
+
|
||||
+ regmap_read(info->regmap_grf, RK3128_GRF_DFI_WRNUM, &dfi_wr);
|
||||
+ regmap_read(info->regmap_grf, RK3128_GRF_DFI_RDNUM, &dfi_rd);
|
||||
+ regmap_read(info->regmap_grf, RK3128_GRF_DFI_TIMERVAL, &dfi_timer);
|
||||
+
|
||||
+ edata->load_count = (dfi_wr + dfi_rd) * 4;
|
||||
+ edata->total_count = dfi_timer;
|
||||
+
|
||||
+ rk3128_dfi_start_hardware_counter(edev);
|
||||
+
|
||||
+ local_irq_restore(flags);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct devfreq_event_ops rk3128_dfi_ops = {
|
||||
+ .disable = rk3128_dfi_disable,
|
||||
+ .enable = rk3128_dfi_enable,
|
||||
+ .get_event = rk3128_dfi_get_event,
|
||||
+ .set_event = rk3128_dfi_set_event,
|
||||
+};
|
||||
+
|
||||
+static void rk3288_dfi_start_hardware_counter(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+
|
||||
+ regmap_write(info->regmap_grf, RK3288_GRF_SOC_CON4, RK3288_DFI_EN);
|
||||
+}
|
||||
+
|
||||
+static void rk3288_dfi_stop_hardware_counter(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+
|
||||
+ regmap_write(info->regmap_grf, RK3288_GRF_SOC_CON4, RK3288_DFI_DIS);
|
||||
+}
|
||||
+
|
||||
+static int rk3288_dfi_disable(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ rk3288_dfi_stop_hardware_counter(edev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3288_dfi_enable(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ rk3288_dfi_start_hardware_counter(edev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3288_dfi_set_event(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3288_dfi_get_busier_ch(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+ u32 tmp, max = 0;
|
||||
+ u32 i, busier_ch = 0;
|
||||
+ u32 rd_count, wr_count, total_count;
|
||||
+
|
||||
+ rk3288_dfi_stop_hardware_counter(edev);
|
||||
+
|
||||
+ /* Find out which channel is busier */
|
||||
+ for (i = 0; i < MAX_DMC_NUM_CH; i++) {
|
||||
+ if (!(info->ch_msk & BIT(i)))
|
||||
+ continue;
|
||||
+ regmap_read(info->regmap_grf,
|
||||
+ RK3288_GRF_SOC_STATUS(11 + i * 4), &wr_count);
|
||||
+ regmap_read(info->regmap_grf,
|
||||
+ RK3288_GRF_SOC_STATUS(12 + i * 4), &rd_count);
|
||||
+ regmap_read(info->regmap_grf,
|
||||
+ RK3288_GRF_SOC_STATUS(14 + i * 4), &total_count);
|
||||
+ info->ch_usage[i].access = (wr_count + rd_count) * 4;
|
||||
+ info->ch_usage[i].total = total_count;
|
||||
+ tmp = info->ch_usage[i].access;
|
||||
+ if (tmp > max) {
|
||||
+ busier_ch = i;
|
||||
+ max = tmp;
|
||||
+ }
|
||||
+ }
|
||||
+ rk3288_dfi_start_hardware_counter(edev);
|
||||
+
|
||||
+ return busier_ch;
|
||||
+}
|
||||
+
|
||||
+static int rk3288_dfi_get_event(struct devfreq_event_dev *edev,
|
||||
+ struct devfreq_event_data *edata)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+ int busier_ch;
|
||||
+ unsigned long flags;
|
||||
+
|
||||
+ local_irq_save(flags);
|
||||
+ busier_ch = rk3288_dfi_get_busier_ch(edev);
|
||||
+ local_irq_restore(flags);
|
||||
+
|
||||
+ edata->load_count = info->ch_usage[busier_ch].access;
|
||||
+ edata->total_count = info->ch_usage[busier_ch].total;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct devfreq_event_ops rk3288_dfi_ops = {
|
||||
+ .disable = rk3288_dfi_disable,
|
||||
+ .enable = rk3288_dfi_enable,
|
||||
+ .get_event = rk3288_dfi_get_event,
|
||||
+ .set_event = rk3288_dfi_set_event,
|
||||
+};
|
||||
+
|
||||
+static void rk3368_dfi_start_hardware_counter(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+
|
||||
+ regmap_write(info->regmap_grf, RK3368_GRF_DDRC0_CON0, RK3368_DFI_EN);
|
||||
+}
|
||||
+
|
||||
+static void rk3368_dfi_stop_hardware_counter(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+
|
||||
+ regmap_write(info->regmap_grf, RK3368_GRF_DDRC0_CON0, RK3368_DFI_DIS);
|
||||
+}
|
||||
+
|
||||
+static int rk3368_dfi_disable(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ rk3368_dfi_stop_hardware_counter(edev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3368_dfi_enable(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ rk3368_dfi_start_hardware_counter(edev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3368_dfi_set_event(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3368_dfi_get_event(struct devfreq_event_dev *edev,
|
||||
+ struct devfreq_event_data *edata)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+ unsigned long flags;
|
||||
+ u32 dfi0_wr, dfi0_rd, dfi1_wr, dfi1_rd, dfi_timer;
|
||||
+
|
||||
+ local_irq_save(flags);
|
||||
+
|
||||
+ rk3368_dfi_stop_hardware_counter(edev);
|
||||
+
|
||||
+ regmap_read(info->regmap_grf, RK3368_GRF_SOC_STATUS5, &dfi0_wr);
|
||||
+ regmap_read(info->regmap_grf, RK3368_GRF_SOC_STATUS6, &dfi0_rd);
|
||||
+ regmap_read(info->regmap_grf, RK3368_GRF_SOC_STATUS9, &dfi1_wr);
|
||||
+ regmap_read(info->regmap_grf, RK3368_GRF_SOC_STATUS10, &dfi1_rd);
|
||||
+ regmap_read(info->regmap_grf, RK3368_GRF_SOC_STATUS8, &dfi_timer);
|
||||
+
|
||||
+ edata->load_count = (dfi0_wr + dfi0_rd + dfi1_wr + dfi1_rd) * 2;
|
||||
+ edata->total_count = dfi_timer;
|
||||
+
|
||||
+ rk3368_dfi_start_hardware_counter(edev);
|
||||
+
|
||||
+ local_irq_restore(flags);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct devfreq_event_ops rk3368_dfi_ops = {
|
||||
+ .disable = rk3368_dfi_disable,
|
||||
+ .enable = rk3368_dfi_enable,
|
||||
+ .get_event = rk3368_dfi_get_event,
|
||||
+ .set_event = rk3368_dfi_set_event,
|
||||
};
|
||||
|
||||
static void rockchip_dfi_start_hardware_counter(struct devfreq_event_dev *edev)
|
||||
{
|
||||
struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
void __iomem *dfi_regs = info->regs;
|
||||
- u32 val;
|
||||
- u32 ddr_type;
|
||||
-
|
||||
- /* get ddr type */
|
||||
- regmap_read(info->regmap_pmu, RK3399_PMUGRF_OS_REG2, &val);
|
||||
- ddr_type = (val >> RK3399_PMUGRF_DDRTYPE_SHIFT) &
|
||||
- RK3399_PMUGRF_DDRTYPE_MASK;
|
||||
|
||||
/* clear DDRMON_CTRL setting */
|
||||
writel_relaxed(CLR_DDRMON_CTRL, dfi_regs + DDRMON_CTRL);
|
||||
|
||||
/* set ddr type to dfi */
|
||||
- if (ddr_type == RK3399_PMUGRF_DDRTYPE_LPDDR3)
|
||||
- writel_relaxed(LPDDR3_EN, dfi_regs + DDRMON_CTRL);
|
||||
- else if (ddr_type == RK3399_PMUGRF_DDRTYPE_LPDDR4)
|
||||
+ if (info->dram_type == LPDDR3 || info->dram_type == LPDDR2)
|
||||
+ writel_relaxed(LPDDR2_3_EN, dfi_regs + DDRMON_CTRL);
|
||||
+ else if (info->dram_type == LPDDR4)
|
||||
writel_relaxed(LPDDR4_EN, dfi_regs + DDRMON_CTRL);
|
||||
+ else if (info->dram_type == DDR4)
|
||||
+ writel_relaxed(DDR4_EN, dfi_regs + DDRMON_CTRL);
|
||||
|
||||
/* enable count, use software mode */
|
||||
writel_relaxed(SOFTWARE_EN, dfi_regs + DDRMON_CTRL);
|
||||
@@ -100,12 +371,22 @@ static int rockchip_dfi_get_busier_ch(struct devfreq_event_dev *edev)
|
||||
rockchip_dfi_stop_hardware_counter(edev);
|
||||
|
||||
/* Find out which channel is busier */
|
||||
- for (i = 0; i < RK3399_DMC_NUM_CH; i++) {
|
||||
- info->ch_usage[i].access = readl_relaxed(dfi_regs +
|
||||
- DDRMON_CH0_DFI_ACCESS_NUM + i * 20) * 4;
|
||||
+ for (i = 0; i < MAX_DMC_NUM_CH; i++) {
|
||||
+ if (!(info->ch_msk & BIT(i)))
|
||||
+ continue;
|
||||
+
|
||||
info->ch_usage[i].total = readl_relaxed(dfi_regs +
|
||||
DDRMON_CH0_COUNT_NUM + i * 20);
|
||||
- tmp = info->ch_usage[i].access;
|
||||
+
|
||||
+ /* LPDDR4 BL = 16,other DDR type BL = 8 */
|
||||
+ tmp = readl_relaxed(dfi_regs +
|
||||
+ DDRMON_CH0_DFI_ACCESS_NUM + i * 20);
|
||||
+ if (info->dram_type == LPDDR4)
|
||||
+ tmp *= 8;
|
||||
+ else
|
||||
+ tmp *= 4;
|
||||
+ info->ch_usage[i].access = tmp;
|
||||
+
|
||||
if (tmp > max) {
|
||||
busier_ch = i;
|
||||
max = tmp;
|
||||
@@ -118,10 +399,14 @@ static int rockchip_dfi_get_busier_ch(struct devfreq_event_dev *edev)
|
||||
|
||||
static int rockchip_dfi_disable(struct devfreq_event_dev *edev)
|
||||
{
|
||||
+ struct device *dev = &edev->dev;
|
||||
struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
|
||||
rockchip_dfi_stop_hardware_counter(edev);
|
||||
- clk_disable_unprepare(info->clk);
|
||||
+ if (info->clk)
|
||||
+ clk_disable_unprepare(info->clk);
|
||||
+
|
||||
+ dev_notice(dev,"Rockchip DFI interface disabled\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -129,20 +414,28 @@ static int rockchip_dfi_disable(struct devfreq_event_dev *edev)
|
||||
static int rockchip_dfi_enable(struct devfreq_event_dev *edev)
|
||||
{
|
||||
struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+ struct device *dev = &edev->dev;
|
||||
int ret;
|
||||
|
||||
- ret = clk_prepare_enable(info->clk);
|
||||
- if (ret) {
|
||||
- dev_err(&edev->dev, "failed to enable dfi clk: %d\n", ret);
|
||||
- return ret;
|
||||
+ if (info->clk) {
|
||||
+ ret = clk_prepare_enable(info->clk);
|
||||
+ if (ret) {
|
||||
+ dev_err(&edev->dev, "failed to enable dfi clk: %d\n",
|
||||
+ ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
}
|
||||
|
||||
rockchip_dfi_start_hardware_counter(edev);
|
||||
+
|
||||
+ dev_notice(dev,"Rockchip DFI interface enabled\n");
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rockchip_dfi_set_event(struct devfreq_event_dev *edev)
|
||||
{
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -151,8 +444,11 @@ static int rockchip_dfi_get_event(struct devfreq_event_dev *edev,
|
||||
{
|
||||
struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
int busier_ch;
|
||||
+ unsigned long flags;
|
||||
|
||||
+ local_irq_save(flags);
|
||||
busier_ch = rockchip_dfi_get_busier_ch(edev);
|
||||
+ local_irq_restore(flags);
|
||||
|
||||
edata->load_count = info->ch_usage[busier_ch].access;
|
||||
edata->total_count = info->ch_usage[busier_ch].total;
|
||||
@@ -167,22 +463,151 @@ static const struct devfreq_event_ops rockchip_dfi_ops = {
|
||||
.set_event = rockchip_dfi_set_event,
|
||||
};
|
||||
|
||||
-static const struct of_device_id rockchip_dfi_id_match[] = {
|
||||
- { .compatible = "rockchip,rk3399-dfi" },
|
||||
- { },
|
||||
-};
|
||||
-MODULE_DEVICE_TABLE(of, rockchip_dfi_id_match);
|
||||
+static __init int px30_dfi_init(struct platform_device *pdev,
|
||||
+ struct rockchip_dfi *data,
|
||||
+ struct devfreq_event_desc *desc)
|
||||
+{
|
||||
+ struct device_node *np = pdev->dev.of_node, *node;
|
||||
+ struct resource *res;
|
||||
+ u32 val;
|
||||
|
||||
-static int rockchip_dfi_probe(struct platform_device *pdev)
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ data->regs = devm_ioremap_resource(&pdev->dev, res);
|
||||
+ if (IS_ERR(data->regs))
|
||||
+ return PTR_ERR(data->regs);
|
||||
+
|
||||
+ node = of_parse_phandle(np, "rockchip,pmugrf", 0);
|
||||
+ if (node) {
|
||||
+ data->regmap_pmugrf = syscon_node_to_regmap(node);
|
||||
+ if (IS_ERR(data->regmap_pmugrf))
|
||||
+ return PTR_ERR(data->regmap_pmugrf);
|
||||
+ }
|
||||
+
|
||||
+ regmap_read(data->regmap_pmugrf, PX30_PMUGRF_OS_REG2, &val);
|
||||
+ data->dram_type = READ_DRAMTYPE_INFO(val);
|
||||
+ data->ch_msk = 1;
|
||||
+ data->clk = NULL;
|
||||
+
|
||||
+ desc->ops = &rockchip_dfi_ops;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static __init int rk3128_dfi_init(struct platform_device *pdev,
|
||||
+ struct rockchip_dfi *data,
|
||||
+ struct devfreq_event_desc *desc)
|
||||
+{
|
||||
+ struct device_node *np = pdev->dev.of_node, *node;
|
||||
+
|
||||
+ node = of_parse_phandle(np, "rockchip,grf", 0);
|
||||
+ if (node) {
|
||||
+ data->regmap_grf = syscon_node_to_regmap(node);
|
||||
+ if (IS_ERR(data->regmap_grf))
|
||||
+ return PTR_ERR(data->regmap_grf);
|
||||
+ }
|
||||
+
|
||||
+ desc->ops = &rk3128_dfi_ops;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static __init int rk3228_dfi_init(struct platform_device *pdev,
|
||||
+ struct rockchip_dfi *data,
|
||||
+ struct devfreq_event_desc *desc)
|
||||
{
|
||||
+ struct device_node *np = pdev->dev.of_node, *node;
|
||||
+ struct resource *res;
|
||||
struct device *dev = &pdev->dev;
|
||||
- struct rockchip_dfi *data;
|
||||
- struct devfreq_event_desc *desc;
|
||||
+ u32 val;
|
||||
+
|
||||
+ dev_notice(dev,"rk3228_dfi_init enter\n");
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ data->regs = devm_ioremap_resource(&pdev->dev, res);
|
||||
+ if (IS_ERR(data->regs))
|
||||
+ return PTR_ERR(data->regs);
|
||||
+
|
||||
+ node = of_parse_phandle(np, "rockchip,grf", 0);
|
||||
+ if (node) {
|
||||
+ data->regmap_grf = syscon_node_to_regmap(node);
|
||||
+ if (IS_ERR(data->regmap_grf))
|
||||
+ return PTR_ERR(data->regmap_grf);
|
||||
+ }
|
||||
+
|
||||
+ regmap_read(data->regmap_grf, RK3228_GRF_OS_REG2, &val);
|
||||
+ data->dram_type = READ_DRAMTYPE_INFO(val);
|
||||
+ data->ch_msk = 1;
|
||||
+ data->clk = NULL;
|
||||
+
|
||||
+ desc->ops = &rockchip_dfi_ops;
|
||||
+
|
||||
+ dev_notice(dev,"rk3228-dfi initialized, dram type: 0x%x, channels: %d\n", data->dram_type, data->ch_msk);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static __init int rk3288_dfi_init(struct platform_device *pdev,
|
||||
+ struct rockchip_dfi *data,
|
||||
+ struct devfreq_event_desc *desc)
|
||||
+{
|
||||
struct device_node *np = pdev->dev.of_node, *node;
|
||||
+ u32 val;
|
||||
|
||||
- data = devm_kzalloc(dev, sizeof(struct rockchip_dfi), GFP_KERNEL);
|
||||
- if (!data)
|
||||
- return -ENOMEM;
|
||||
+ node = of_parse_phandle(np, "rockchip,pmu", 0);
|
||||
+ if (node) {
|
||||
+ data->regmap_pmu = syscon_node_to_regmap(node);
|
||||
+ if (IS_ERR(data->regmap_pmu))
|
||||
+ return PTR_ERR(data->regmap_pmu);
|
||||
+ }
|
||||
+
|
||||
+ node = of_parse_phandle(np, "rockchip,grf", 0);
|
||||
+ if (node) {
|
||||
+ data->regmap_grf = syscon_node_to_regmap(node);
|
||||
+ if (IS_ERR(data->regmap_grf))
|
||||
+ return PTR_ERR(data->regmap_grf);
|
||||
+ }
|
||||
+
|
||||
+ regmap_read(data->regmap_pmu, RK3288_PMU_SYS_REG2, &val);
|
||||
+ data->dram_type = READ_DRAMTYPE_INFO(val);
|
||||
+ data->ch_msk = READ_CH_INFO(val);
|
||||
+
|
||||
+ if (data->dram_type == DDR3)
|
||||
+ regmap_write(data->regmap_grf, RK3288_GRF_SOC_CON4,
|
||||
+ RK3288_DDR3_SEL);
|
||||
+ else
|
||||
+ regmap_write(data->regmap_grf, RK3288_GRF_SOC_CON4,
|
||||
+ RK3288_LPDDR_SEL);
|
||||
+
|
||||
+ desc->ops = &rk3288_dfi_ops;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static __init int rk3368_dfi_init(struct platform_device *pdev,
|
||||
+ struct rockchip_dfi *data,
|
||||
+ struct devfreq_event_desc *desc)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+
|
||||
+ if (!dev->parent || !dev->parent->of_node)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ data->regmap_grf = syscon_node_to_regmap(dev->parent->of_node);
|
||||
+ if (IS_ERR(data->regmap_grf))
|
||||
+ return PTR_ERR(data->regmap_grf);
|
||||
+
|
||||
+ desc->ops = &rk3368_dfi_ops;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static __init int rockchip_dfi_init(struct platform_device *pdev,
|
||||
+ struct rockchip_dfi *data,
|
||||
+ struct devfreq_event_desc *desc)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct device_node *np = pdev->dev.of_node, *node;
|
||||
+ u32 val;
|
||||
|
||||
data->regs = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(data->regs))
|
||||
@@ -202,21 +627,98 @@ static int rockchip_dfi_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(data->regmap_pmu))
|
||||
return PTR_ERR(data->regmap_pmu);
|
||||
}
|
||||
- data->dev = dev;
|
||||
+
|
||||
+ regmap_read(data->regmap_pmu, PMUGRF_OS_REG2, &val);
|
||||
+ data->dram_type = READ_DRAMTYPE_INFO(val);
|
||||
+ data->ch_msk = READ_CH_INFO(val);
|
||||
+
|
||||
+ desc->ops = &rockchip_dfi_ops;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static __init int rk3328_dfi_init(struct platform_device *pdev,
|
||||
+ struct rockchip_dfi *data,
|
||||
+ struct devfreq_event_desc *desc)
|
||||
+{
|
||||
+ struct device_node *np = pdev->dev.of_node, *node;
|
||||
+ struct resource *res;
|
||||
+ u32 val;
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ data->regs = devm_ioremap_resource(&pdev->dev, res);
|
||||
+ if (IS_ERR(data->regs))
|
||||
+ return PTR_ERR(data->regs);
|
||||
+
|
||||
+ node = of_parse_phandle(np, "rockchip,grf", 0);
|
||||
+ if (node) {
|
||||
+ data->regmap_grf = syscon_node_to_regmap(node);
|
||||
+ if (IS_ERR(data->regmap_grf))
|
||||
+ return PTR_ERR(data->regmap_grf);
|
||||
+ }
|
||||
+
|
||||
+ regmap_read(data->regmap_grf, RK3328_GRF_OS_REG2, &val);
|
||||
+ data->dram_type = READ_DRAMTYPE_INFO(val);
|
||||
+ data->ch_msk = 1;
|
||||
+ data->clk = NULL;
|
||||
+
|
||||
+ desc->ops = &rockchip_dfi_ops;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id rockchip_dfi_id_match[] = {
|
||||
+ { .compatible = "rockchip,px30-dfi", .data = px30_dfi_init },
|
||||
+ { .compatible = "rockchip,rk1808-dfi", .data = px30_dfi_init },
|
||||
+ { .compatible = "rockchip,rk3128-dfi", .data = rk3128_dfi_init },
|
||||
+ { .compatible = "rockchip,rk3228-dfi", .data = rk3228_dfi_init },
|
||||
+ { .compatible = "rockchip,rk3288-dfi", .data = rk3288_dfi_init },
|
||||
+ { .compatible = "rockchip,rk3328-dfi", .data = rk3328_dfi_init },
|
||||
+ { .compatible = "rockchip,rk3368-dfi", .data = rk3368_dfi_init },
|
||||
+ { .compatible = "rockchip,rk3399-dfi", .data = rockchip_dfi_init },
|
||||
+ { },
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, rockchip_dfi_id_match);
|
||||
+
|
||||
+static int rockchip_dfi_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct rockchip_dfi *data;
|
||||
+ struct devfreq_event_desc *desc;
|
||||
+ struct device_node *np = pdev->dev.of_node;
|
||||
+ const struct of_device_id *match;
|
||||
+ int (*init)(struct platform_device *pdev, struct rockchip_dfi *data,
|
||||
+ struct devfreq_event_desc *desc);
|
||||
+
|
||||
+ data = devm_kzalloc(dev, sizeof(struct rockchip_dfi), GFP_KERNEL);
|
||||
+ if (!data)
|
||||
+ return -ENOMEM;
|
||||
|
||||
desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
|
||||
if (!desc)
|
||||
return -ENOMEM;
|
||||
|
||||
- desc->ops = &rockchip_dfi_ops;
|
||||
+ match = of_match_node(rockchip_dfi_id_match, pdev->dev.of_node);
|
||||
+ if (match) {
|
||||
+ init = match->data;
|
||||
+ if (init) {
|
||||
+ if (init(pdev, data, desc))
|
||||
+ return -EINVAL;
|
||||
+ } else {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ } else {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
desc->driver_data = data;
|
||||
desc->name = np->name;
|
||||
data->desc = desc;
|
||||
+ data->dev = dev;
|
||||
|
||||
- data->edev = devm_devfreq_event_add_edev(&pdev->dev, desc);
|
||||
+ data->edev = devm_devfreq_event_add_edev(dev, desc);
|
||||
if (IS_ERR(data->edev)) {
|
||||
- dev_err(&pdev->dev,
|
||||
- "failed to add devfreq-event device\n");
|
||||
+ dev_err(dev, "failed to add devfreq-event device\n");
|
||||
return PTR_ERR(data->edev);
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
|
||||
1040
patch/kernel/archive/rk322x-6.6/03-0004-add-dmc-driver.patch
Normal file
1040
patch/kernel/archive/rk322x-6.6/03-0004-add-dmc-driver.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,333 @@
|
||||
From ff9a0ab9d920d4a855b4be9912a57ac65e8906e2 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Fri, 10 Sep 2021 14:10:18 +0000
|
||||
Subject: [PATCH] drm rockchip hardware cursor
|
||||
|
||||
---
|
||||
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 218 +++++++++++++++++++-
|
||||
drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 3 +
|
||||
drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 19 +-
|
||||
3 files changed, 238 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
|
||||
index 83a926c0a..b0832320e 100644
|
||||
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
|
||||
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
|
||||
@@ -1160,6 +1160,207 @@ static void vop_plane_atomic_async_update(struct drm_plane *plane,
|
||||
}
|
||||
}
|
||||
|
||||
+static void vop_cursor_atomic_update(struct drm_plane *plane,
|
||||
+ struct drm_atomic_state *state)
|
||||
+{
|
||||
+
|
||||
+ struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state,
|
||||
+ plane);
|
||||
+ struct drm_crtc *crtc = new_state->crtc;
|
||||
+ struct vop_win *vop_win = to_vop_win(plane);
|
||||
+ const struct vop_win_data *win = vop_win->data;
|
||||
+ struct vop *vop = to_vop(new_state->crtc);
|
||||
+ struct drm_framebuffer *fb = new_state->fb;
|
||||
+ unsigned int actual_w, actual_h;
|
||||
+ unsigned int dsp_stx, dsp_sty;
|
||||
+ uint32_t dsp_st;
|
||||
+ struct drm_rect *src = &new_state->src;
|
||||
+ struct drm_rect *dest = &new_state->dst;
|
||||
+ struct drm_gem_object *obj;
|
||||
+ struct rockchip_gem_object *rk_obj;
|
||||
+ dma_addr_t dma_addr;
|
||||
+ uint32_t val;
|
||||
+ bool rb_swap;
|
||||
+ int win_index = VOP_WIN_TO_INDEX(vop_win);
|
||||
+ int format;
|
||||
+
|
||||
+ /*
|
||||
+ * can't update plane when vop is disabled.
|
||||
+ */
|
||||
+ if (WARN_ON(!crtc))
|
||||
+ return;
|
||||
+
|
||||
+ if (WARN_ON(!vop->is_enabled))
|
||||
+ return;
|
||||
+
|
||||
+ if (!new_state->visible) {
|
||||
+ vop_plane_atomic_disable(plane, state);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ obj = fb->obj[0];
|
||||
+ rk_obj = to_rockchip_obj(obj);
|
||||
+
|
||||
+// actual_w = drm_rect_width(src) >> 16;
|
||||
+// actual_h = drm_rect_height(src) >> 16;
|
||||
+
|
||||
+ dsp_stx = dest->x1 + crtc->mode.htotal - crtc->mode.hsync_start;
|
||||
+ dsp_sty = dest->y1 + crtc->mode.vtotal - crtc->mode.vsync_start;
|
||||
+ dsp_st = dsp_sty << 16 | (dsp_stx & 0xffff);
|
||||
+
|
||||
+ dma_addr = rk_obj->dma_addr;
|
||||
+
|
||||
+ /*
|
||||
+ * For y-mirroring we need to move address
|
||||
+ * to the beginning of the last line.
|
||||
+ */
|
||||
+// if (new_state->rotation & DRM_MODE_REFLECT_Y)
|
||||
+// dma_addr += (actual_h - 1) * fb->pitches[0];
|
||||
+
|
||||
+ spin_lock(&vop->reg_lock);
|
||||
+
|
||||
+ if (!(vop->win_enabled & BIT(win_index))) {
|
||||
+
|
||||
+ format = vop_convert_format(fb->format->format);
|
||||
+
|
||||
+ VOP_WIN_SET(vop, win, format, format);
|
||||
+
|
||||
+// if (win->phy->scl)
|
||||
+// scl_vop_cal_scl_fac(vop, win, actual_w, actual_h,
|
||||
+// drm_rect_width(dest), drm_rect_height(dest),
|
||||
+// fb->format);
|
||||
+
|
||||
+ rb_swap = has_rb_swapped(fb->format->format);
|
||||
+ VOP_WIN_SET(vop, win, rb_swap, rb_swap);
|
||||
+
|
||||
+ /*
|
||||
+ * Blending win0 with the background color doesn't seem to work
|
||||
+ * correctly. We only get the background color, no matter the contents
|
||||
+ * of the win0 framebuffer. However, blending pre-multiplied color
|
||||
+ * with the default opaque black default background color is a no-op,
|
||||
+ * so we can just disable blending to get the correct result.
|
||||
+ */
|
||||
+ if (fb->format->has_alpha && win_index > 0) {
|
||||
+ VOP_WIN_SET(vop, win, dst_alpha_ctl,
|
||||
+ DST_FACTOR_M0(ALPHA_SRC_INVERSE));
|
||||
+ val = SRC_ALPHA_EN(1) | SRC_COLOR_M0(ALPHA_SRC_PRE_MUL) |
|
||||
+ SRC_ALPHA_M0(ALPHA_STRAIGHT) |
|
||||
+ SRC_BLEND_M0(ALPHA_PER_PIX) |
|
||||
+ 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));
|
||||
+ VOP_WIN_SET(vop, win, alpha_en, 0);
|
||||
+ }
|
||||
+
|
||||
+ // 32x32 = 0, 64x64 = 1, 96x96 = 2, 128x128 = 3
|
||||
+ VOP_WIN_SET(vop, win, hwc_size, (new_state->crtc_w >> 5) - 1);
|
||||
+
|
||||
+ VOP_WIN_SET(vop, win, enable, 1);
|
||||
+ vop->win_enabled |= BIT(win_index);
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ VOP_WIN_SET(vop, win, yrgb_mst, dma_addr);
|
||||
+ VOP_WIN_SET(vop, win, dsp_st, dsp_st);
|
||||
+
|
||||
+ spin_unlock(&vop->reg_lock);
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static void vop_cursor_atomic_async_update(struct drm_plane *plane,
|
||||
+ struct drm_atomic_state *state)
|
||||
+{
|
||||
+
|
||||
+ struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state,
|
||||
+ plane);
|
||||
+ struct vop *vop = to_vop(plane->state->crtc);
|
||||
+ struct drm_framebuffer *old_fb = plane->state->fb;
|
||||
+
|
||||
+ plane->state->crtc_x = new_state->crtc_x;
|
||||
+ plane->state->crtc_y = new_state->crtc_y;
|
||||
+ plane->state->crtc_h = new_state->crtc_h;
|
||||
+ plane->state->crtc_w = new_state->crtc_w;
|
||||
+ plane->state->src_x = new_state->src_x;
|
||||
+ plane->state->src_y = new_state->src_y;
|
||||
+ plane->state->src_h = new_state->src_h;
|
||||
+ plane->state->src_w = new_state->src_w;
|
||||
+ swap(plane->state->fb, new_state->fb);
|
||||
+
|
||||
+ if (vop->is_enabled) {
|
||||
+ vop_cursor_atomic_update(plane, state);
|
||||
+ spin_lock(&vop->reg_lock);
|
||||
+ vop_cfg_done(vop);
|
||||
+ spin_unlock(&vop->reg_lock);
|
||||
+
|
||||
+ /*
|
||||
+ * A scanout can still be occurring, so we can't drop the
|
||||
+ * reference to the old framebuffer. To solve this we get a
|
||||
+ * reference to old_fb and set a worker to release it later.
|
||||
+ * FIXME: if we perform 500 async_update calls before the
|
||||
+ * vblank, then we can have 500 different framebuffers waiting
|
||||
+ * to be released.
|
||||
+ */
|
||||
+ if (old_fb && plane->state->fb != old_fb) {
|
||||
+ drm_framebuffer_get(old_fb);
|
||||
+ WARN_ON(drm_crtc_vblank_get(plane->state->crtc) != 0);
|
||||
+ drm_flip_work_queue(&vop->fb_unref_work, old_fb);
|
||||
+ set_bit(VOP_PENDING_FB_UNREF, &vop->pending);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static int vop_cursor_atomic_check(struct drm_plane *plane,
|
||||
+ struct drm_atomic_state *state)
|
||||
+{
|
||||
+ struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
|
||||
+ plane);
|
||||
+ struct drm_crtc *crtc = new_plane_state->crtc;
|
||||
+ struct drm_crtc_state *crtc_state;
|
||||
+ struct drm_framebuffer *fb = new_plane_state->fb;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!crtc || WARN_ON(!fb))
|
||||
+ return 0;
|
||||
+
|
||||
+ crtc_state = drm_atomic_get_existing_crtc_state(state, crtc);
|
||||
+ if (WARN_ON(!crtc_state))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
|
||||
+ DRM_PLANE_NO_SCALING, DRM_PLANE_NO_SCALING,
|
||||
+ true, true);
|
||||
+
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ if (!new_plane_state->visible)
|
||||
+ return 0;
|
||||
+
|
||||
+ ret = vop_convert_format(fb->format->format);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+
|
||||
+ if (new_plane_state->crtc_w != new_plane_state->crtc_h)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (new_plane_state->crtc_w != 0 &&
|
||||
+ new_plane_state->crtc_w != 32 &&
|
||||
+ new_plane_state->crtc_w != 64 &&
|
||||
+ new_plane_state->crtc_w != 96 &&
|
||||
+ new_plane_state->crtc_w != 128)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+}
|
||||
+
|
||||
static const struct drm_plane_helper_funcs plane_helper_funcs = {
|
||||
.atomic_check = vop_plane_atomic_check,
|
||||
.atomic_update = vop_plane_atomic_update,
|
||||
@@ -1169,6 +1370,15 @@ static const struct drm_plane_helper_funcs plane_helper_funcs = {
|
||||
.prepare_fb = drm_gem_plane_helper_prepare_fb,
|
||||
};
|
||||
|
||||
+static const struct drm_plane_helper_funcs cursor_plane_helper_funcs = {
|
||||
+ .atomic_check = vop_cursor_atomic_check,
|
||||
+ .atomic_update = vop_cursor_atomic_update,
|
||||
+ .atomic_disable = vop_plane_atomic_disable,
|
||||
+ .atomic_async_check = vop_plane_atomic_async_check,
|
||||
+ .atomic_async_update = vop_cursor_atomic_async_update,
|
||||
+ .prepare_fb = drm_gem_plane_helper_prepare_fb,
|
||||
+};
|
||||
+
|
||||
static const struct drm_plane_funcs vop_plane_funcs = {
|
||||
.update_plane = drm_atomic_helper_update_plane,
|
||||
.disable_plane = drm_atomic_helper_disable_plane,
|
||||
@@ -1956,6 +2166,7 @@ static int vop_create_crtc(struct vop *vop)
|
||||
struct drm_plane *primary = NULL, *cursor = NULL, *plane, *tmp;
|
||||
struct drm_crtc *crtc = &vop->crtc;
|
||||
struct device_node *port;
|
||||
+ const struct drm_plane_helper_funcs *helper_funcs;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
@@ -1976,7 +2187,12 @@ static int vop_create_crtc(struct vop *vop)
|
||||
}
|
||||
|
||||
plane = &vop_win->base;
|
||||
- drm_plane_helper_add(plane, &plane_helper_funcs);
|
||||
+ helper_funcs = &plane_helper_funcs;
|
||||
+
|
||||
+ if ((plane->type == DRM_PLANE_TYPE_CURSOR) && (vop_data->feature & VOP_FEATURE_SPECIAL_CURSOR_PLANE))
|
||||
+ helper_funcs = &cursor_plane_helper_funcs;
|
||||
+
|
||||
+ drm_plane_helper_add(plane, helper_funcs);
|
||||
vop_plane_add_properties(plane, i, win_data, vop_data);
|
||||
if (plane->type == DRM_PLANE_TYPE_PRIMARY)
|
||||
primary = plane;
|
||||
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
|
||||
index a997578e1..42dc299d9 100644
|
||||
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
|
||||
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
|
||||
@@ -190,6 +190,8 @@ struct vop_win_phy {
|
||||
struct vop_reg alpha_mode;
|
||||
struct vop_reg alpha_en;
|
||||
struct vop_reg channel;
|
||||
+
|
||||
+ struct vop_reg hwc_size;
|
||||
};
|
||||
|
||||
struct vop_win_yuv2yuv_data {
|
||||
@@ -225,6 +227,7 @@ struct vop_data {
|
||||
|
||||
#define VOP_FEATURE_OUTPUT_RGB10 BIT(0)
|
||||
#define VOP_FEATURE_INTERNAL_RGB BIT(1)
|
||||
+#define VOP_FEATURE_SPECIAL_CURSOR_PLANE BIT(2)
|
||||
u64 feature;
|
||||
};
|
||||
|
||||
diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
|
||||
index ab0a78097..70930b410 100644
|
||||
--- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
|
||||
+++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
|
||||
@@ -665,6 +665,19 @@ static const struct vop_win_phy rk3288_win23_data = {
|
||||
.dst_alpha_ctl = VOP_REG(RK3288_WIN2_DST_ALPHA_CTRL, 0xff, 0),
|
||||
};
|
||||
|
||||
+static const struct vop_win_phy rk3288_cursor_data = {
|
||||
+ .data_formats = formats_win_lite,
|
||||
+ .nformats = ARRAY_SIZE(formats_win_lite),
|
||||
+ .enable = VOP_REG(RK3288_HWC_CTRL0, 0x1, 0),
|
||||
+ .format = VOP_REG(RK3288_HWC_CTRL0, 0x7, 1),
|
||||
+ .rb_swap = VOP_REG(RK3288_HWC_CTRL0, 0x1, 12),
|
||||
+ .dsp_st = VOP_REG(RK3288_HWC_DSP_ST, 0x1fff1fff, 0),
|
||||
+ .yrgb_mst = VOP_REG(RK3288_HWC_MST, 0xffffffff, 0),
|
||||
+ .src_alpha_ctl = VOP_REG(RK3288_HWC_SRC_ALPHA_CTRL, 0xff, 0),
|
||||
+ .dst_alpha_ctl = VOP_REG(RK3288_HWC_DST_ALPHA_CTRL, 0xff, 0),
|
||||
+ .hwc_size = VOP_REG(RK3288_HWC_CTRL0, 0x3, 5),
|
||||
+};
|
||||
+
|
||||
static const struct vop_modeset rk3288_modeset = {
|
||||
.htotal_pw = VOP_REG(RK3288_DSP_HTOTAL_HS_END, 0x1fff1fff, 0),
|
||||
.hact_st_end = VOP_REG(RK3288_DSP_HACT_ST_END, 0x1fff1fff, 0),
|
||||
@@ -756,6 +769,8 @@ static const struct vop_win_data rk3288_vop_win_data[] = {
|
||||
{ .base = 0x00, .phy = &rk3288_win23_data,
|
||||
.type = DRM_PLANE_TYPE_OVERLAY },
|
||||
{ .base = 0x50, .phy = &rk3288_win23_data,
|
||||
+ .type = DRM_PLANE_TYPE_OVERLAY },
|
||||
+ { .base = 0x00, .phy = &rk3288_cursor_data,
|
||||
.type = DRM_PLANE_TYPE_CURSOR },
|
||||
};
|
||||
|
||||
@@ -1132,11 +1132,13 @@ static const struct vop_win_data rk3228_vop_win_data[] = {
|
||||
.type = DRM_PLANE_TYPE_PRIMARY },
|
||||
{ .base = 0x40, .phy = &rk3228_win1_data,
|
||||
.type = DRM_PLANE_TYPE_OVERLAY },
|
||||
+ { .base = 0x00, .phy = &rk3288_cursor_data,
|
||||
+ .type = DRM_PLANE_TYPE_CURSOR },
|
||||
};
|
||||
|
||||
static const struct vop_data rk3228_vop = {
|
||||
.version = VOP_VERSION(3, 7),
|
||||
- .feature = VOP_FEATURE_OUTPUT_RGB10,
|
||||
+ .feature = VOP_FEATURE_OUTPUT_RGB10 | VOP_FEATURE_SPECIAL_CURSOR_PLANE,
|
||||
.intr = &rk3366_vop_intr,
|
||||
.common = &rk3288_common,
|
||||
.modeset = &rk3288_modeset,
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,177 @@
|
||||
From 5d68f46388c9813efb1a722e52f6ec9c4be8c0ce Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Fri, 10 Sep 2021 14:18:08 +0000
|
||||
Subject: [PATCH] experimental drm patch
|
||||
|
||||
---
|
||||
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 134 +++++++++++---------
|
||||
1 file changed, 72 insertions(+), 62 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
|
||||
index b0832320e..a0fca8a20 100644
|
||||
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
|
||||
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
|
||||
@@ -997,25 +997,78 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
|
||||
|
||||
spin_lock(&vop->reg_lock);
|
||||
|
||||
- if (rockchip_afbc(fb->modifier)) {
|
||||
- int afbc_format = vop_convert_afbc_format(fb->format->format);
|
||||
+ if (!(vop->win_enabled & BIT(win_index))) {
|
||||
|
||||
- VOP_AFBC_SET(vop, format, afbc_format | AFBC_TILE_16x16);
|
||||
- VOP_AFBC_SET(vop, hreg_block_split, 0);
|
||||
- VOP_AFBC_SET(vop, win_sel, VOP_WIN_TO_INDEX(vop_win));
|
||||
- VOP_AFBC_SET(vop, hdr_ptr, dma_addr);
|
||||
- VOP_AFBC_SET(vop, pic_size, act_info);
|
||||
- }
|
||||
+ if (rockchip_afbc(fb->modifier)) {
|
||||
+ int afbc_format = vop_convert_afbc_format(fb->format->format);
|
||||
|
||||
- VOP_WIN_SET(vop, win, format, format);
|
||||
- VOP_WIN_SET(vop, win, fmt_10, is_fmt_10(fb->format->format));
|
||||
- VOP_WIN_SET(vop, win, yrgb_vir, DIV_ROUND_UP(fb->pitches[0], 4 >> skiplines));
|
||||
- VOP_WIN_SET(vop, win, yrgb_mst, dma_addr);
|
||||
- VOP_WIN_YUV2YUV_SET(vop, win_yuv2yuv, y2r_en, is_yuv);
|
||||
- VOP_WIN_SET(vop, win, y_mir_en,
|
||||
- (new_state->rotation & DRM_MODE_REFLECT_Y) ? 1 : 0);
|
||||
- VOP_WIN_SET(vop, win, x_mir_en,
|
||||
- (new_state->rotation & DRM_MODE_REFLECT_X) ? 1 : 0);
|
||||
+ VOP_AFBC_SET(vop, format, afbc_format | AFBC_TILE_16x16);
|
||||
+ VOP_AFBC_SET(vop, hreg_block_split, 0);
|
||||
+ VOP_AFBC_SET(vop, win_sel, VOP_WIN_TO_INDEX(vop_win));
|
||||
+ VOP_AFBC_SET(vop, hdr_ptr, dma_addr);
|
||||
+ VOP_AFBC_SET(vop, pic_size, act_info);
|
||||
+ }
|
||||
+
|
||||
+ VOP_WIN_SET(vop, win, format, format);
|
||||
+ VOP_WIN_SET(vop, win, fmt_10, is_fmt_10(fb->format->format));
|
||||
+ VOP_WIN_SET(vop, win, yrgb_vir, DIV_ROUND_UP(fb->pitches[0], 4 >> skiplines));
|
||||
+
|
||||
+ VOP_WIN_YUV2YUV_SET(vop, win_yuv2yuv, y2r_en, is_yuv);
|
||||
+ VOP_WIN_SET(vop, win, y_mir_en,
|
||||
+ (new_state->rotation & DRM_MODE_REFLECT_Y) ? 1 : 0);
|
||||
+ VOP_WIN_SET(vop, win, x_mir_en,
|
||||
+ (new_state->rotation & DRM_MODE_REFLECT_X) ? 1 : 0);
|
||||
+
|
||||
+ if (is_yuv) {
|
||||
+
|
||||
+ for (i = 0; i < NUM_YUV2YUV_COEFFICIENTS; i++) {
|
||||
+ VOP_WIN_YUV2YUV_COEFFICIENT_SET(vop,
|
||||
+ win_yuv2yuv,
|
||||
+ y2r_coefficients[i],
|
||||
+ bt601_yuv2rgb[i]);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (win->phy->scl)
|
||||
+ scl_vop_cal_scl_fac(vop, win, actual_w, actual_h,
|
||||
+ drm_rect_width(dest), drm_rect_height(dest),
|
||||
+ fb->format);
|
||||
+
|
||||
+ VOP_WIN_SET(vop, win, act_info, act_info);
|
||||
+ VOP_WIN_SET(vop, win, dsp_info, dsp_info);
|
||||
+
|
||||
+ rb_swap = has_rb_swapped(fb->format->format);
|
||||
+ VOP_WIN_SET(vop, win, rb_swap, rb_swap);
|
||||
+
|
||||
+ /*
|
||||
+ * Blending win0 with the background color doesn't seem to work
|
||||
+ * correctly. We only get the background color, no matter the contents
|
||||
+ * of the win0 framebuffer. However, blending pre-multiplied color
|
||||
+ * with the default opaque black default background color is a no-op,
|
||||
+ * so we can just disable blending to get the correct result.
|
||||
+ */
|
||||
+ if (fb->format->has_alpha && win_index > 0) {
|
||||
+ VOP_WIN_SET(vop, win, dst_alpha_ctl,
|
||||
+ DST_FACTOR_M0(ALPHA_SRC_INVERSE));
|
||||
+ val = SRC_ALPHA_EN(1) | SRC_COLOR_M0(ALPHA_SRC_PRE_MUL) |
|
||||
+ SRC_ALPHA_M0(ALPHA_STRAIGHT) |
|
||||
+ SRC_BLEND_M0(ALPHA_PER_PIX) |
|
||||
+ 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));
|
||||
+ VOP_WIN_SET(vop, win, alpha_en, 0);
|
||||
+ }
|
||||
+
|
||||
+ VOP_WIN_SET(vop, win, enable, 1);
|
||||
+ vop->win_enabled |= BIT(win_index);
|
||||
+
|
||||
+ }
|
||||
|
||||
if (is_yuv) {
|
||||
int hsub = fb->format->hsub;
|
||||
@@ -1027,7 +1080,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
|
||||
|
||||
if (fb->format->block_w[1])
|
||||
offset = (src->x1 >> 16) * bpp /
|
||||
- fb->format->block_w[1] / hsub;
|
||||
+ fb->format->block_w[1] / hsub;
|
||||
else
|
||||
offset = (src->x1 >> 16) * bpp / hsub;
|
||||
offset += (src->y1 >> 16) * fb->pitches[1] / vsub;
|
||||
@@ -1035,54 +1088,11 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
|
||||
dma_addr = rk_uv_obj->dma_addr + offset + fb->offsets[1];
|
||||
VOP_WIN_SET(vop, win, uv_vir, DIV_ROUND_UP(fb->pitches[1], 4 >> skiplines));
|
||||
VOP_WIN_SET(vop, win, uv_mst, dma_addr);
|
||||
-
|
||||
- for (i = 0; i < NUM_YUV2YUV_COEFFICIENTS; i++) {
|
||||
- VOP_WIN_YUV2YUV_COEFFICIENT_SET(vop,
|
||||
- win_yuv2yuv,
|
||||
- y2r_coefficients[i],
|
||||
- bt601_yuv2rgb[i]);
|
||||
- }
|
||||
}
|
||||
|
||||
- if (win->phy->scl)
|
||||
- scl_vop_cal_scl_fac(vop, win, actual_w, actual_h,
|
||||
- drm_rect_width(dest), drm_rect_height(dest),
|
||||
- fb->format);
|
||||
-
|
||||
- VOP_WIN_SET(vop, win, act_info, act_info);
|
||||
- VOP_WIN_SET(vop, win, dsp_info, dsp_info);
|
||||
+ VOP_WIN_SET(vop, win, yrgb_mst, dma_addr);
|
||||
VOP_WIN_SET(vop, win, dsp_st, dsp_st);
|
||||
|
||||
- rb_swap = has_rb_swapped(fb->format->format);
|
||||
- VOP_WIN_SET(vop, win, rb_swap, rb_swap);
|
||||
-
|
||||
- /*
|
||||
- * Blending win0 with the background color doesn't seem to work
|
||||
- * correctly. We only get the background color, no matter the contents
|
||||
- * of the win0 framebuffer. However, blending pre-multiplied color
|
||||
- * with the default opaque black default background color is a no-op,
|
||||
- * so we can just disable blending to get the correct result.
|
||||
- */
|
||||
- if (fb->format->has_alpha && win_index > 0) {
|
||||
- VOP_WIN_SET(vop, win, dst_alpha_ctl,
|
||||
- DST_FACTOR_M0(ALPHA_SRC_INVERSE));
|
||||
- val = SRC_ALPHA_EN(1) | SRC_COLOR_M0(ALPHA_SRC_PRE_MUL) |
|
||||
- SRC_ALPHA_M0(ALPHA_STRAIGHT) |
|
||||
- SRC_BLEND_M0(ALPHA_PER_PIX) |
|
||||
- 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));
|
||||
- VOP_WIN_SET(vop, win, alpha_en, 0);
|
||||
- }
|
||||
-
|
||||
- VOP_WIN_SET(vop, win, enable, 1);
|
||||
- vop->win_enabled |= BIT(win_index);
|
||||
spin_unlock(&vop->reg_lock);
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
From b50d1c7f698c88b790aa3d13a40fd67292b15c16 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Sun, 29 May 2022 10:57:59 +0000
|
||||
Subject: [PATCH] prefer 8-bit RGB over YCbCr
|
||||
|
||||
---
|
||||
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
|
||||
index 115d610c5c3..975e4ef6ef4 100644
|
||||
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
|
||||
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
|
||||
@@ -2658,6 +2658,10 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
|
||||
output_fmts[i++] = MEDIA_BUS_FMT_RGB101010_1X30;
|
||||
}
|
||||
|
||||
+ /* Prefer 8-bit RGB over YCbCr formats */
|
||||
+ if (is_tmds_allowed(info, mode, MEDIA_BUS_FMT_RGB888_1X24))
|
||||
+ output_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24;
|
||||
+
|
||||
if ((info->color_formats & DRM_COLOR_FORMAT_YCBCR422) &&
|
||||
is_tmds_allowed(info, mode, MEDIA_BUS_FMT_UYVY8_1X16))
|
||||
output_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16;
|
||||
@@ -2666,10 +2670,6 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
|
||||
is_tmds_allowed(info, mode, MEDIA_BUS_FMT_YUV8_1X24))
|
||||
output_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24;
|
||||
|
||||
- /* Default 8bit RGB fallback */
|
||||
- if (is_tmds_allowed(info, mode, MEDIA_BUS_FMT_RGB888_1X24))
|
||||
- output_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24;
|
||||
-
|
||||
*num_output_fmts = i;
|
||||
|
||||
return output_fmts;
|
||||
--
|
||||
2.30.2
|
||||
|
||||
782
patch/kernel/archive/rk322x-6.6/dt/rk322x-box.dts
Normal file
782
patch/kernel/archive/rk322x-6.6/dt/rk322x-box.dts
Normal file
@ -0,0 +1,782 @@
|
||||
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/pinctrl/rockchip.h>
|
||||
#include <dt-bindings/pwm/pwm.h>
|
||||
#include "rk322x.dtsi"
|
||||
|
||||
/ {
|
||||
|
||||
model = "Generic RK322x Tv Box board";
|
||||
compatible = "rockchip,rk3229";
|
||||
|
||||
/*
|
||||
* No need to reserve memory manually as long as u-boot v2020.10 and
|
||||
* OPTEE autoconfigure the reserved zones
|
||||
*/
|
||||
/delete-node/ reserved-memory;
|
||||
|
||||
/*
|
||||
* We rebuild the cpu-opp-table by ourselves
|
||||
*/
|
||||
/delete-node/ opp-table-0;
|
||||
|
||||
/*
|
||||
* Rebuild the thermal zones and cooling maps ourselved
|
||||
*/
|
||||
/delete-node/ thermal-zones;
|
||||
|
||||
/*
|
||||
* Include the mmc devices into aliases table
|
||||
*/
|
||||
aliases {
|
||||
mmc0 = &sdmmc;
|
||||
mmc1 = &sdio;
|
||||
mmc2 = &emmc;
|
||||
};
|
||||
|
||||
analog-sound {
|
||||
compatible = "simple-audio-card";
|
||||
simple-audio-card,format = "i2s";
|
||||
simple-audio-card,mclk-fs = <256>;
|
||||
simple-audio-card,name = "analog";
|
||||
simple-audio-card,cpu {
|
||||
sound-dai = <&i2s1>;
|
||||
};
|
||||
|
||||
simple-audio-card,codec {
|
||||
sound-dai = <&codec>;
|
||||
};
|
||||
};
|
||||
|
||||
chosen {
|
||||
bootargs = "earlyprintk=uart8250,mmio32,0x11030000";
|
||||
};
|
||||
|
||||
cpu0_opp_table: opp-table-0 {
|
||||
compatible = "operating-points-v2";
|
||||
opp-shared;
|
||||
|
||||
opp-600000000 {
|
||||
opp-hz = /bits/ 64 <600000000>;
|
||||
opp-microvolt = <975000>;
|
||||
clock-latency-ns = <40000>;
|
||||
opp-suspend;
|
||||
};
|
||||
|
||||
opp-816000000 {
|
||||
opp-hz = /bits/ 64 <816000000>;
|
||||
opp-microvolt = <1000000>;
|
||||
};
|
||||
|
||||
opp-1008000000 {
|
||||
opp-hz = /bits/ 64 <1008000000>;
|
||||
opp-microvolt = <1175000>;
|
||||
};
|
||||
|
||||
opp-1200000000 {
|
||||
opp-hz = /bits/ 64 <1200000000>;
|
||||
opp-microvolt = <1275000>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
gpio_leds: gpio-leds {
|
||||
|
||||
compatible = "gpio-leds";
|
||||
|
||||
/*
|
||||
* Working led, available on all boards
|
||||
*/
|
||||
working {
|
||||
gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>;
|
||||
label = "working";
|
||||
default-state = "on";
|
||||
linux,default-trigger = "timer";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&gpio_led_working>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
gpio_keys: gpio-keys {
|
||||
|
||||
compatible = "gpio-keys";
|
||||
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
};
|
||||
|
||||
ir_receiver: ir-receiver {
|
||||
compatible = "gpio-ir-receiver";
|
||||
gpios = <&gpio1 RK_PB3 GPIO_ACTIVE_LOW>;
|
||||
pinctrl-0 = <&ir_int>;
|
||||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
linux,rc-map-name = "rc-rk322x-tvbox";
|
||||
};
|
||||
|
||||
rockchip_ir_receiver: rockchip-ir-receiver {
|
||||
compatible = "rockchip-ir-receiver";
|
||||
reg = <0x110b0030 0x10>;
|
||||
gpios = <&gpio1 RK_PB3 GPIO_ACTIVE_LOW>;
|
||||
clocks = <&cru PCLK_PWM>;
|
||||
interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
|
||||
linux,rc-map-name = "rc-rk322x-tvbox";
|
||||
pinctrl-names = "default", "suspend";
|
||||
pinctrl-0 = <&ir_int>;
|
||||
pinctrl-1 = <&pwm3_pin>;
|
||||
pwm-id = <3>;
|
||||
shutdown-is-virtual-poweroff;
|
||||
wakeup-source;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
sdio_pwrseq: sdio-pwrseq {
|
||||
compatible = "mmc-pwrseq-simple";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&wifi_enable_h>;
|
||||
reset-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
|
||||
spdif_out: spdif-out {
|
||||
status = "okay";
|
||||
compatible = "linux,spdif-dit";
|
||||
#sound-dai-cells = <0>;
|
||||
};
|
||||
|
||||
spdif-sound {
|
||||
status = "okay";
|
||||
compatible = "simple-audio-card";
|
||||
simple-audio-card,name = "SPDIF";
|
||||
simple-audio-card,cpu {
|
||||
sound-dai = <&spdif>;
|
||||
};
|
||||
simple-audio-card,codec {
|
||||
sound-dai = <&spdif_out>;
|
||||
};
|
||||
};
|
||||
|
||||
vcc_sys: vcc-sys-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vcc_sys";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
};
|
||||
|
||||
vcc_host: vcc-host-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
enable-active-high;
|
||||
gpio = <&gpio3 RK_PC4 GPIO_ACTIVE_HIGH>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&host_vbus_drv>;
|
||||
regulator-name = "vcc_host";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
vin-supply = <&vcc_sys>;
|
||||
};
|
||||
|
||||
vccio_1v8: vccio-1v8-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vccio_1v8";
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
regulator-always-on;
|
||||
vin-supply = <&vcc_sys>;
|
||||
};
|
||||
|
||||
vccio_3v3: vccio-3v3-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vccio_3v3";
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-always-on;
|
||||
vin-supply = <&vcc_sys>;
|
||||
};
|
||||
|
||||
vcc_otg: vcc-otg-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
enable-active-high;
|
||||
gpio = <&gpio3 RK_PC6 GPIO_ACTIVE_HIGH>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&otg_vbus_drv>;
|
||||
regulator-name = "vcc_otg_vbus";
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
vin-supply = <&vcc_sys>;
|
||||
};
|
||||
|
||||
vcc_phy: vcc-phy-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
enable-active-high;
|
||||
regulator-name = "vcc_phy";
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
vin-supply = <&vccio_1v8>;
|
||||
};
|
||||
|
||||
vdd_arm: vdd-arm-regulator {
|
||||
compatible = "pwm-regulator";
|
||||
pwms = <&pwm1 0 5000 PWM_POLARITY_INVERTED>;
|
||||
pwm-supply = <&vcc_sys>;
|
||||
regulator-name = "vdd_arm";
|
||||
regulator-min-microvolt = <950000>;
|
||||
regulator-max-microvolt = <1400000>;
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
};
|
||||
|
||||
vdd_log: vdd-log-regulator {
|
||||
compatible = "pwm-regulator";
|
||||
pwms = <&pwm2 0 5000 PWM_POLARITY_INVERTED>;
|
||||
pwm-supply = <&vcc_sys>;
|
||||
regulator-name = "vdd_log";
|
||||
regulator-min-microvolt = <1000000>;
|
||||
regulator-max-microvolt = <1300000>;
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
};
|
||||
|
||||
thermal-zones {
|
||||
cpu_thermal: cpu-thermal {
|
||||
polling-delay-passive = <1000>; /* milliseconds */
|
||||
polling-delay = <5000>; /* milliseconds */
|
||||
|
||||
thermal-sensors = <&tsadc 0>;
|
||||
|
||||
trips {
|
||||
cpu_alert0: cpu_alert0 {
|
||||
temperature = <90000>; /* millicelsius */
|
||||
hysteresis = <2000>; /* millicelsius */
|
||||
type = "passive";
|
||||
};
|
||||
cpu_alert1: cpu_alert1 {
|
||||
temperature = <95000>; /* millicelsius */
|
||||
hysteresis = <2000>; /* millicelsius */
|
||||
type = "passive";
|
||||
};
|
||||
cpu_crit: cpu_crit {
|
||||
temperature = <105000>; /* millicelsius */
|
||||
hysteresis = <2000>; /* millicelsius */
|
||||
type = "critical";
|
||||
};
|
||||
};
|
||||
|
||||
cooling-maps {
|
||||
|
||||
cpu_throttle_low: map-cpu-throttle-low {
|
||||
trip = <&cpu_alert0>;
|
||||
cooling-device =
|
||||
<&cpu0 THERMAL_NO_LIMIT 1>,
|
||||
<&cpu1 THERMAL_NO_LIMIT 1>,
|
||||
<&cpu2 THERMAL_NO_LIMIT 1>,
|
||||
<&cpu3 THERMAL_NO_LIMIT 1>;
|
||||
};
|
||||
|
||||
cpu_throttle_high: map-cpu-throttle-high {
|
||||
trip = <&cpu_alert1>;
|
||||
cooling-device =
|
||||
<&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
<&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
<&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
<&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||
};
|
||||
|
||||
gpu_throttle_low: map-gpu-throttle-low {
|
||||
trip = <&cpu_alert0>;
|
||||
cooling-device =
|
||||
<&gpu THERMAL_NO_LIMIT 1>;
|
||||
};
|
||||
|
||||
gpu_throttle_high: map-gpu-throttle-high {
|
||||
trip = <&cpu_alert1>;
|
||||
cooling-device =
|
||||
<&gpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||
};
|
||||
|
||||
dmc_throttle_low: map-dmc-throttle-low {
|
||||
trip = <&cpu_alert0>;
|
||||
cooling-device = <&dmc THERMAL_NO_LIMIT 1>;
|
||||
};
|
||||
|
||||
dmc_throttle_high: map-dmc-throttle-high {
|
||||
trip = <&cpu_alert1>;
|
||||
cooling-device = <&dmc THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
&codec {
|
||||
#sound-dai-cells = <0>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&cpu0 {
|
||||
cpu-supply = <&vdd_arm>;
|
||||
};
|
||||
|
||||
&cpu1 {
|
||||
cpu-supply = <&vdd_arm>;
|
||||
};
|
||||
|
||||
&cpu2 {
|
||||
cpu-supply = <&vdd_arm>;
|
||||
};
|
||||
|
||||
&cpu3 {
|
||||
cpu-supply = <&vdd_arm>;
|
||||
};
|
||||
|
||||
&cru {
|
||||
assigned-clocks = <&cru PLL_GPLL>, <&cru ARMCLK>,
|
||||
<&cru PLL_CPLL>, <&cru ACLK_PERI>,
|
||||
<&cru HCLK_PERI>, <&cru PCLK_PERI>,
|
||||
<&cru ACLK_CPU>, <&cru HCLK_CPU>,
|
||||
<&cru PCLK_CPU>, <&cru ACLK_VOP>;
|
||||
|
||||
assigned-clock-rates = <1200000000>, <816000000>,
|
||||
<500000000>, <150000000>,
|
||||
<150000000>, <75000000>,
|
||||
<150000000>, <150000000>,
|
||||
<75000000>, <400000000>;
|
||||
};
|
||||
|
||||
&dmc {
|
||||
logic-supply = <&vdd_log>;
|
||||
};
|
||||
|
||||
&emmc {
|
||||
cap-mmc-highspeed;
|
||||
keep-power-in-suspend;
|
||||
non-removable;
|
||||
status = "okay";
|
||||
/delete-property/ mmc-ddr-1_8v;
|
||||
/delete-property/ pinctrl-names;
|
||||
/delete-property/ pinctrl-0;
|
||||
/delete-property/ rockchip,default-sample-phase;
|
||||
rockchip,default-sample-phase = <90>;
|
||||
};
|
||||
|
||||
&gmac {
|
||||
assigned-clocks = <&cru SCLK_MAC_SRC>;
|
||||
assigned-clock-rates = <50000000>;
|
||||
clock_in_out = "output";
|
||||
phy-handle = <&phy>;
|
||||
phy-mode = "rmii";
|
||||
phy-supply = <&vcc_phy>;
|
||||
tx_delay = <0x26>;
|
||||
rx_delay = <0x11>;
|
||||
status = "okay";
|
||||
|
||||
mdio {
|
||||
compatible = "snps,dwmac-mdio";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
phy: phy@0 {
|
||||
compatible = "ethernet-phy-id1234.d400",
|
||||
"ethernet-phy-ieee802.3-c22";
|
||||
reg = <0>;
|
||||
clocks = <&cru SCLK_MAC_PHY>;
|
||||
phy-is-integrated;
|
||||
resets = <&cru SRST_MACPHY>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&gpu {
|
||||
assigned-clocks = <&cru ACLK_GPU>;
|
||||
assigned-clock-rates = <300000000>;
|
||||
mali-supply = <&vdd_log>;
|
||||
};
|
||||
|
||||
&gpu_opp_table {
|
||||
opp-400000000 {
|
||||
opp-hz = /bits/ 64 <400000000>;
|
||||
opp-microvolt = <1100000 1000000 1200000>;
|
||||
};
|
||||
};
|
||||
|
||||
&io_domains {
|
||||
vccio1-supply = <&vccio_3v3>;
|
||||
vccio2-supply = <&vccio_1v8>;
|
||||
vccio4-supply = <&vccio_3v3>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&nfc {
|
||||
|
||||
status = "disabled";
|
||||
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
/delete-property/ pinctrl-names;
|
||||
/delete-property/ pinctrl-0;
|
||||
|
||||
nand@0 {
|
||||
reg = <0>;
|
||||
label = "rk-nand";
|
||||
nand-bus-width = <8>;
|
||||
nand-ecc-mode = "hw";
|
||||
nand-ecc-step-size = <1024>;
|
||||
nand-ecc-strength = <60>;
|
||||
nand-is-boot-medium;
|
||||
rockchip,boot-blks = <8>;
|
||||
rockchip,boot-ecc-strength = <60>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
&iep {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&iep_mmu {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pwm1 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pwm2 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&hdmi {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&hdmi_sound {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&hdmi_phy {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&i2s0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&i2s1 {
|
||||
#sound-dai-cells = <0>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
/** Integration to pin controller */
|
||||
&pinctrl {
|
||||
|
||||
pcfg_pull_up_12ma: pcfg-pull-up-12ma {
|
||||
drive-strength = <12>;
|
||||
bias-pull-up;
|
||||
};
|
||||
|
||||
pcfg_pull_down_12ma: pcfg-pull-down-12ma {
|
||||
drive-strength = <12>;
|
||||
bias-pull-down;
|
||||
};
|
||||
|
||||
pcfg_pull_none_12ma: pcfg-pull-none-12ma {
|
||||
drive-strength = <12>;
|
||||
bias-disable;
|
||||
};
|
||||
|
||||
pcfg_pull_up_8ma: pcfg-pull-up-8ma {
|
||||
drive-strength = <8>;
|
||||
bias-pull-up;
|
||||
};
|
||||
|
||||
pcfg_pull_down_8ma: pcfg-pull-down-8ma {
|
||||
drive-strength = <8>;
|
||||
bias-pull-down;
|
||||
};
|
||||
|
||||
pcfg_pull_none_8ma: pcfg-pull-none-8ma {
|
||||
drive-strength = <8>;
|
||||
bias-disable;
|
||||
};
|
||||
|
||||
pcfg_pull_up_2ma: pcfg-pull-up-2ma {
|
||||
drive-strength = <2>;
|
||||
bias-pull-up;
|
||||
};
|
||||
|
||||
pcfg_pull_down_2ma: pcfg-pull-down-2ma {
|
||||
drive-strength = <2>;
|
||||
bias-pull-down;
|
||||
};
|
||||
|
||||
pcfg_pull_none_2ma: pcfg-pull-none-2ma {
|
||||
drive-strength = <2>;
|
||||
bias-disable;
|
||||
};
|
||||
|
||||
/*
|
||||
* Some rk322x electrical schemes report this kind of pull-up/down
|
||||
* pin configurations. We set them here, but we don't use it in this
|
||||
* device tree. These instead are useful for overlays, because they seem
|
||||
* to increase stability on at least one board I got here
|
||||
*/
|
||||
sdmmc {
|
||||
sdmmc_clk: sdmmc-clk {
|
||||
rockchip,pins = <1 16 1 &pcfg_pull_down>;
|
||||
};
|
||||
|
||||
sdmmc_cmd: sdmmc-cmd {
|
||||
rockchip,pins = <1 15 1 &pcfg_pull_up>;
|
||||
};
|
||||
|
||||
sdmmc_bus4: sdmmc-bus4 {
|
||||
rockchip,pins = <1 18 1 &pcfg_pull_up>,
|
||||
<1 19 1 &pcfg_pull_up>,
|
||||
<1 20 1 &pcfg_pull_up>,
|
||||
<1 21 1 &pcfg_pull_up>;
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* Same as above, decreasing strength of SDIO pins seems to be benefical
|
||||
* to stability
|
||||
*/
|
||||
sdio {
|
||||
sdio_clk: sdio-clk {
|
||||
rockchip,pins = <3 0 1 &pcfg_pull_down_2ma>;
|
||||
};
|
||||
|
||||
sdio_cmd: sdio-cmd {
|
||||
rockchip,pins = <3 1 1 &pcfg_pull_up_2ma>;
|
||||
};
|
||||
|
||||
sdio_bus4: sdio-bus4 {
|
||||
rockchip,pins = <3 2 1 &pcfg_pull_up_2ma>,
|
||||
<3 3 1 &pcfg_pull_up_2ma>,
|
||||
<3 4 1 &pcfg_pull_up_2ma>,
|
||||
<3 5 1 &pcfg_pull_up_2ma>;
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* Same drill as above, electrical schemes also report this pull-up/down
|
||||
* configurations.
|
||||
*/
|
||||
emmc {
|
||||
emmc_clk: emmc-clk {
|
||||
rockchip,pins = <2 7 2 &pcfg_pull_up>;
|
||||
};
|
||||
|
||||
emmc_cmd: emmc-cmd {
|
||||
rockchip,pins = <1 22 2 &pcfg_pull_up>;
|
||||
};
|
||||
|
||||
emmc_bus8: emmc-bus8 {
|
||||
rockchip,pins = <1 24 2 &pcfg_pull_up>,
|
||||
<1 25 2 &pcfg_pull_up>,
|
||||
<1 26 2 &pcfg_pull_up>,
|
||||
<1 27 2 &pcfg_pull_up>,
|
||||
<1 28 2 &pcfg_pull_up>,
|
||||
<1 29 2 &pcfg_pull_up>,
|
||||
<1 30 2 &pcfg_pull_up>,
|
||||
<1 31 2 &pcfg_pull_up>;
|
||||
};
|
||||
|
||||
emmc_pwr: emmc-pwr {
|
||||
rockchip,pins = <2 RK_PA5 2 &pcfg_pull_down>;
|
||||
};
|
||||
|
||||
emmc_rst: emmc-rst {
|
||||
rockchip,pins = <1 RK_PC7 2 &pcfg_pull_up>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
gpio-items {
|
||||
gpio_led_working: gpio-led-working {
|
||||
rockchip,pins = <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
|
||||
ir {
|
||||
ir_int: ir-int {
|
||||
rockchip,pins = <1 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
|
||||
pwm1 {
|
||||
pwm1_pin_pull_down: pwm1-pin-pull-down {
|
||||
rockchip,pins = <0 RK_PD6 2 &pcfg_pull_down>;
|
||||
};
|
||||
};
|
||||
|
||||
pwm2 {
|
||||
pwm2_pin_pull_up: pwm2-pin-pull-up {
|
||||
rockchip,pins = <1 RK_PB4 2 &pcfg_pull_up>;
|
||||
};
|
||||
};
|
||||
|
||||
usb {
|
||||
host_vbus_drv: host-vbus-drv {
|
||||
rockchip,pins = <3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
otg_vbus_drv: otg-vbus-drv {
|
||||
rockchip,pins = <3 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
|
||||
sdio-pwrseq {
|
||||
wifi_enable_h: wifi-enable-h {
|
||||
rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
&uart1 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart11_xfer &uart11_rts &uart11_cts>;
|
||||
};
|
||||
|
||||
&uart2 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&u2phy0 {
|
||||
status = "okay";
|
||||
u2phy0_host: host-port {
|
||||
phy-supply = <&vcc_host>;
|
||||
};
|
||||
|
||||
u2phy0_otg: otg-port {
|
||||
phy-supply = <&vcc_otg>;
|
||||
};
|
||||
};
|
||||
|
||||
&u2phy0_otg {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&u2phy0_host {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&u2phy1 {
|
||||
status = "okay";
|
||||
u2phy1_host: host-port {
|
||||
phy-supply = <&vcc_host>;
|
||||
};
|
||||
|
||||
u2phy1_otg: otg-port {
|
||||
phy-supply = <&vcc_otg>;
|
||||
};
|
||||
};
|
||||
|
||||
&u2phy1_otg {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&u2phy1_host {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_host0_ehci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_host0_ohci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_host1_ehci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_host1_ohci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_host2_ehci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_host2_ohci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_otg {
|
||||
dr_mode = "host";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&sdio {
|
||||
mmc-pwrseq = <&sdio_pwrseq>;
|
||||
cap-sd-highspeed;
|
||||
cap-sdio-irq;
|
||||
keep-power-in-suspend;
|
||||
non-removable;
|
||||
no-sd;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&sdmmc {
|
||||
cd-gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_LOW>;
|
||||
cd-debounce-delay-ms = <500>;
|
||||
cap-sd-highspeed;
|
||||
keep-power-in-suspend;
|
||||
no-sdio;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&spdif {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&tsadc {
|
||||
rockchip,grf = <&grf>;
|
||||
rockchip,hw-tshut-mode = <0>;
|
||||
rockchip,hw-tshut-polarity = <1>;
|
||||
rockchip,hw-tshut-temp = <110000>;
|
||||
|
||||
/* delete the pinctrl-* properties because, on mainline kernel, they (in particular "default")
|
||||
change the GPIO configuration of the associated PIN. On most boards that pin is not connected
|
||||
so it does not do anything, but some other boards (X96-Mini) have that pin connected to
|
||||
a reset pin of the soc or whatever, thus changing the configuration of the pin at boot
|
||||
causes them to bootloop.
|
||||
We don't really need these ones though, because since hw-tshut-mode is set to 0, the CRU
|
||||
unit of the SoC does the reboot*/
|
||||
/delete-property/ pinctrl-names;
|
||||
/delete-property/ pinctrl-0;
|
||||
/delete-property/ pinctrl-1;
|
||||
/delete-property/ pinctrl-2;
|
||||
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&vop {
|
||||
assigned-clocks = <&cru DCLK_VOP>;
|
||||
assigned-clock-parents = <&cru SCLK_HDMI_PHY>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&vop_mmu {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&wdt {
|
||||
status = "okay";
|
||||
};
|
||||
@ -0,0 +1,96 @@
|
||||
diff --git a/arch/arm/boot/.gitignore b/arch/arm/boot/.gitignore
|
||||
index 3c79f859..4e5c1d59 100644
|
||||
--- a/arch/arm/boot/.gitignore
|
||||
+++ b/arch/arm/boot/.gitignore
|
||||
@@ -3,3 +3,5 @@ zImage
|
||||
xipImage
|
||||
bootpImage
|
||||
uImage
|
||||
+*.dtb*
|
||||
+*.scr
|
||||
diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst
|
||||
index 50d580d77..94bd15617 100644
|
||||
--- a/scripts/Makefile.dtbinst
|
||||
+++ b/scripts/Makefile.dtbinst
|
||||
@@ -18,9 +18,12 @@ include scripts/Kbuild.include
|
||||
include $(src)/Makefile
|
||||
|
||||
dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-)))
|
||||
+dtbos := $(addprefix $(dst)/overlay/, $(dtbo-y))
|
||||
+scrs := $(addprefix $(dst)/overlay/, $(scr-y))
|
||||
+readmes := $(addprefix $(dst)/overlay/, $(dtbotxt-y))
|
||||
subdirs := $(addprefix $(obj)/, $(subdir-y) $(subdir-m))
|
||||
|
||||
-__dtbs_install: $(dtbs) $(subdirs)
|
||||
+__dtbs_install: $(dtbs) $(dtbos) $(scrs) $(readmes) $(subdirs)
|
||||
@:
|
||||
|
||||
quiet_cmd_dtb_install = INSTALL $@
|
||||
@@ -29,6 +32,15 @@ quiet_cmd_dtb_install = INSTALL $@
|
||||
$(dst)/%.dtb: $(obj)/%.dtb
|
||||
$(call cmd,dtb_install)
|
||||
|
||||
+$(dst)/overlay/%.dtbo: $(obj)/%.dtbo
|
||||
+ $(call cmd,dtb_install)
|
||||
+
|
||||
+$(dst)/overlay/%.scr: $(obj)/%.scr
|
||||
+ $(call cmd,dtb_install)
|
||||
+
|
||||
+$(dst)/overlay/README.rk322x-overlays: $(src)/README.rk322x-overlays
|
||||
+ $(call cmd,dtb_install)
|
||||
+
|
||||
PHONY += $(subdirs)
|
||||
$(subdirs):
|
||||
$(Q)$(MAKE) $(dtbinst)=$@ dst=$(patsubst $(obj)/%,$(dst)/%,$@)
|
||||
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
|
||||
index 58c05e5d..2b95dda9 100644
|
||||
--- a/scripts/Makefile.lib
|
||||
+++ b/scripts/Makefile.lib
|
||||
@@ -278,6 +278,9 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \
|
||||
# ---------------------------------------------------------------------------
|
||||
DTC ?= $(objtree)/scripts/dtc/dtc
|
||||
|
||||
+# Overlay support
|
||||
+DTC_FLAGS += -@ -Wno-unit_address_format -Wno-simple_bus_reg
|
||||
+
|
||||
# Disable noisy checks by default
|
||||
ifeq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),)
|
||||
DTC_FLAGS += -Wno-unit_address_vs_reg \
|
||||
@@ -324,6 +327,23 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
|
||||
$(obj)/%.dtb: $(src)/%.dts FORCE
|
||||
$(call if_changed_dep,dtc)
|
||||
|
||||
+quiet_cmd_dtco = DTCO $@
|
||||
+cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \
|
||||
+ $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
|
||||
+ $(DTC) -O dtb -o $@ -b 0 \
|
||||
+ -i $(dir $<) $(DTC_FLAGS) \
|
||||
+ -d $(depfile).dtc.tmp $(dtc-tmp) ; \
|
||||
+ cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
|
||||
+
|
||||
+$(obj)/%.dtbo: $(src)/%.dts FORCE
|
||||
+ $(call if_changed_dep,dtco)
|
||||
+
|
||||
+quiet_cmd_scr = MKIMAGE $@
|
||||
+cmd_scr = mkimage -C none -A $(ARCH) -T script -d $< $@
|
||||
+
|
||||
+$(obj)/%.scr: $(src)/%.scr-cmd FORCE
|
||||
+ $(call if_changed,scr)
|
||||
+
|
||||
dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
|
||||
|
||||
# Bzip2
|
||||
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
|
||||
index 41c50f9461e5..387659d5b252 100644
|
||||
--- a/scripts/Makefile.lib
|
||||
+++ b/scripts/Makefile.lib
|
||||
@@ -79,6 +79,9 @@ header-test-y += $(filter-out $(header-test-), \
|
||||
|
||||
extra-$(CONFIG_HEADER_TEST) += $(addsuffix .s, $(header-test-y) $(header-test-m))
|
||||
|
||||
+# Overlay targets
|
||||
+extra-y += $(dtbo-y) $(scr-y) $(dtbotxt-y)
|
||||
+
|
||||
# Add subdir path
|
||||
|
||||
extra-y := $(addprefix $(obj)/,$(extra-y))
|
||||
@ -0,0 +1,358 @@
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/configfs-overlays.txt
|
||||
@@ -0,0 +1,31 @@
|
||||
+Howto use the configfs overlay interface.
|
||||
+
|
||||
+A device-tree configfs entry is created in /config/device-tree/overlays
|
||||
+and and it is manipulated using standard file system I/O.
|
||||
+Note that this is a debug level interface, for use by developers and
|
||||
+not necessarily something accessed by normal users due to the
|
||||
+security implications of having direct access to the kernel's device tree.
|
||||
+
|
||||
+* To create an overlay you mkdir the directory:
|
||||
+
|
||||
+ # mkdir /config/device-tree/overlays/foo
|
||||
+
|
||||
+* Either you echo the overlay firmware file to the path property file.
|
||||
+
|
||||
+ # echo foo.dtbo >/config/device-tree/overlays/foo/path
|
||||
+
|
||||
+* Or you cat the contents of the overlay to the dtbo file
|
||||
+
|
||||
+ # cat foo.dtbo >/config/device-tree/overlays/foo/dtbo
|
||||
+
|
||||
+The overlay file will be applied, and devices will be created/destroyed
|
||||
+as required.
|
||||
+
|
||||
+To remove it simply rmdir the directory.
|
||||
+
|
||||
+ # rmdir /config/device-tree/overlays/foo
|
||||
+
|
||||
+The rationalle of the dual interface (firmware & direct copy) is that each is
|
||||
+better suited to different use patterns. The firmware interface is what's
|
||||
+intended to be used by hardware managers in the kernel, while the copy interface
|
||||
+make sense for developers (since it avoids problems with namespaces).
|
||||
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
|
||||
index 37c2ccbefecdc..d3fc81a40c0e7 100644
|
||||
--- a/drivers/of/Kconfig
|
||||
+++ b/drivers/of/Kconfig
|
||||
@@ -103,4 +103,11 @@ config OF_OVERLAY
|
||||
config OF_NUMA
|
||||
bool
|
||||
|
||||
+config OF_CONFIGFS
|
||||
+ bool "Device Tree Overlay ConfigFS interface"
|
||||
+ select CONFIGFS_FS
|
||||
+ select OF_OVERLAY
|
||||
+ help
|
||||
+ Enable a simple user-space driven DT overlay interface.
|
||||
+
|
||||
endif # OF
|
||||
diff --git a/drivers/of/Makefile b/drivers/of/Makefile
|
||||
index 663a4af0cccd5..b00a95adf5199 100644
|
||||
--- a/drivers/of/Makefile
|
||||
+++ b/drivers/of/Makefile
|
||||
@@ -1,6 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
obj-y = base.o device.o platform.o property.o
|
||||
obj-$(CONFIG_OF_KOBJ) += kobj.o
|
||||
+obj-$(CONFIG_OF_CONFIGFS) += configfs.o
|
||||
obj-$(CONFIG_OF_DYNAMIC) += dynamic.o
|
||||
obj-$(CONFIG_OF_FLATTREE) += fdt.o
|
||||
obj-$(CONFIG_OF_EARLY_FLATTREE) += fdt_address.o
|
||||
diff --git a/drivers/of/configfs.c b/drivers/of/configfs.c
|
||||
new file mode 100644
|
||||
index 000000000..5dd509e8f
|
||||
--- /dev/null
|
||||
+++ b/drivers/of/configfs.c
|
||||
@@ -0,0 +1,290 @@
|
||||
+/*
|
||||
+ * Configfs entries for device-tree
|
||||
+ *
|
||||
+ * Copyright (C) 2013 - Pantelis Antoniou <panto@antoniou-consulting.com>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License
|
||||
+ * as published by the Free Software Foundation; either version
|
||||
+ * 2 of the License, or (at your option) any later version.
|
||||
+ */
|
||||
+#include <linux/ctype.h>
|
||||
+#include <linux/cpu.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/of_fdt.h>
|
||||
+#include <linux/spinlock.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/proc_fs.h>
|
||||
+#include <linux/configfs.h>
|
||||
+#include <linux/types.h>
|
||||
+#include <linux/stat.h>
|
||||
+#include <linux/limits.h>
|
||||
+#include <linux/file.h>
|
||||
+#include <linux/vmalloc.h>
|
||||
+#include <linux/firmware.h>
|
||||
+#include <linux/sizes.h>
|
||||
+
|
||||
+#include "of_private.h"
|
||||
+
|
||||
+struct cfs_overlay_item {
|
||||
+ struct config_item item;
|
||||
+
|
||||
+ char path[PATH_MAX];
|
||||
+
|
||||
+ const struct firmware *fw;
|
||||
+ struct device_node *overlay;
|
||||
+ int ov_id;
|
||||
+
|
||||
+ void *dtbo;
|
||||
+ int dtbo_size;
|
||||
+};
|
||||
+
|
||||
+static int create_overlay(struct cfs_overlay_item *overlay, void *blob, u32 blob_size)
|
||||
+{
|
||||
+ int err;
|
||||
+
|
||||
+ err = of_overlay_fdt_apply(blob, blob_size, &overlay->ov_id, NULL);
|
||||
+ if (err < 0) {
|
||||
+ pr_err("%s: Failed to create overlay (err=%d)\n",
|
||||
+ __func__, err);
|
||||
+ goto out_err;
|
||||
+ }
|
||||
+
|
||||
+out_err:
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+static inline struct cfs_overlay_item *to_cfs_overlay_item(
|
||||
+ struct config_item *item)
|
||||
+{
|
||||
+ return item ? container_of(item, struct cfs_overlay_item, item) : NULL;
|
||||
+}
|
||||
+
|
||||
+static ssize_t cfs_overlay_item_path_show(struct config_item *item,
|
||||
+ char *page)
|
||||
+{
|
||||
+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item);
|
||||
+ return sprintf(page, "%s\n", overlay->path);
|
||||
+}
|
||||
+
|
||||
+static ssize_t cfs_overlay_item_path_store(struct config_item *item,
|
||||
+ const char *page, size_t count)
|
||||
+{
|
||||
+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item);
|
||||
+ const char *p = page;
|
||||
+ char *s;
|
||||
+ int err;
|
||||
+
|
||||
+ /* if it's set do not allow changes */
|
||||
+ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0)
|
||||
+ return -EPERM;
|
||||
+
|
||||
+ /* copy to path buffer (and make sure it's always zero terminated */
|
||||
+ count = snprintf(overlay->path, sizeof(overlay->path) - 1, "%s", p);
|
||||
+ overlay->path[sizeof(overlay->path) - 1] = '\0';
|
||||
+
|
||||
+ /* strip trailing newlines */
|
||||
+ s = overlay->path + strlen(overlay->path);
|
||||
+ while (s > overlay->path && *--s == '\n')
|
||||
+ *s = '\0';
|
||||
+
|
||||
+ pr_debug("%s: path is '%s'\n", __func__, overlay->path);
|
||||
+
|
||||
+ err = request_firmware(&overlay->fw, overlay->path, NULL);
|
||||
+ if (err != 0)
|
||||
+ goto out_err;
|
||||
+
|
||||
+ err = create_overlay(overlay, (void *)overlay->fw->data, overlay->fw->size);
|
||||
+ if (err != 0)
|
||||
+ goto out_err;
|
||||
+
|
||||
+ return count;
|
||||
+
|
||||
+out_err:
|
||||
+
|
||||
+ release_firmware(overlay->fw);
|
||||
+ overlay->fw = NULL;
|
||||
+
|
||||
+ overlay->path[0] = '\0';
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+static ssize_t cfs_overlay_item_status_show(struct config_item *item,
|
||||
+ char *page)
|
||||
+{
|
||||
+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item);
|
||||
+
|
||||
+ return sprintf(page, "%s\n",
|
||||
+ overlay->ov_id >= 0 ? "applied" : "unapplied");
|
||||
+}
|
||||
+
|
||||
+CONFIGFS_ATTR(cfs_overlay_item_, path);
|
||||
+CONFIGFS_ATTR_RO(cfs_overlay_item_, status);
|
||||
+
|
||||
+static struct configfs_attribute *cfs_overlay_attrs[] = {
|
||||
+ &cfs_overlay_item_attr_path,
|
||||
+ &cfs_overlay_item_attr_status,
|
||||
+ NULL,
|
||||
+};
|
||||
+
|
||||
+ssize_t cfs_overlay_item_dtbo_read(struct config_item *item,
|
||||
+ void *buf, size_t max_count)
|
||||
+{
|
||||
+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item);
|
||||
+
|
||||
+ pr_debug("%s: buf=%p max_count=%zu\n", __func__,
|
||||
+ buf, max_count);
|
||||
+
|
||||
+ if (overlay->dtbo == NULL)
|
||||
+ return 0;
|
||||
+
|
||||
+ /* copy if buffer provided */
|
||||
+ if (buf != NULL) {
|
||||
+ /* the buffer must be large enough */
|
||||
+ if (overlay->dtbo_size > max_count)
|
||||
+ return -ENOSPC;
|
||||
+
|
||||
+ memcpy(buf, overlay->dtbo, overlay->dtbo_size);
|
||||
+ }
|
||||
+
|
||||
+ return overlay->dtbo_size;
|
||||
+}
|
||||
+
|
||||
+ssize_t cfs_overlay_item_dtbo_write(struct config_item *item,
|
||||
+ const void *buf, size_t count)
|
||||
+{
|
||||
+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item);
|
||||
+ int err;
|
||||
+
|
||||
+ /* if it's set do not allow changes */
|
||||
+ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0)
|
||||
+ return -EPERM;
|
||||
+
|
||||
+ /* copy the contents */
|
||||
+ overlay->dtbo = kmemdup(buf, count, GFP_KERNEL);
|
||||
+ if (overlay->dtbo == NULL)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ overlay->dtbo_size = count;
|
||||
+
|
||||
+ err = create_overlay(overlay, overlay->dtbo, overlay->dtbo_size);
|
||||
+ if (err != 0)
|
||||
+ goto out_err;
|
||||
+
|
||||
+ return count;
|
||||
+
|
||||
+out_err:
|
||||
+ kfree(overlay->dtbo);
|
||||
+ overlay->dtbo = NULL;
|
||||
+ overlay->dtbo_size = 0;
|
||||
+
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+CONFIGFS_BIN_ATTR(cfs_overlay_item_, dtbo, NULL, SZ_1M);
|
||||
+
|
||||
+static struct configfs_bin_attribute *cfs_overlay_bin_attrs[] = {
|
||||
+ &cfs_overlay_item_attr_dtbo,
|
||||
+ NULL,
|
||||
+};
|
||||
+
|
||||
+static void cfs_overlay_release(struct config_item *item)
|
||||
+{
|
||||
+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item);
|
||||
+
|
||||
+ if (overlay->ov_id >= 0)
|
||||
+ of_overlay_remove(&overlay->ov_id);
|
||||
+ if (overlay->fw)
|
||||
+ release_firmware(overlay->fw);
|
||||
+ /* kfree with NULL is safe */
|
||||
+ kfree(overlay->dtbo);
|
||||
+ kfree(overlay);
|
||||
+}
|
||||
+
|
||||
+static struct configfs_item_operations cfs_overlay_item_ops = {
|
||||
+ .release = cfs_overlay_release,
|
||||
+};
|
||||
+
|
||||
+static struct config_item_type cfs_overlay_type = {
|
||||
+ .ct_item_ops = &cfs_overlay_item_ops,
|
||||
+ .ct_attrs = cfs_overlay_attrs,
|
||||
+ .ct_bin_attrs = cfs_overlay_bin_attrs,
|
||||
+ .ct_owner = THIS_MODULE,
|
||||
+};
|
||||
+
|
||||
+static struct config_item *cfs_overlay_group_make_item(
|
||||
+ struct config_group *group, const char *name)
|
||||
+{
|
||||
+ struct cfs_overlay_item *overlay;
|
||||
+
|
||||
+ overlay = kzalloc(sizeof(*overlay), GFP_KERNEL);
|
||||
+ if (!overlay)
|
||||
+ return ERR_PTR(-ENOMEM);
|
||||
+ overlay->ov_id = -1;
|
||||
+
|
||||
+ config_item_init_type_name(&overlay->item, name, &cfs_overlay_type);
|
||||
+ return &overlay->item;
|
||||
+}
|
||||
+
|
||||
+static void cfs_overlay_group_drop_item(struct config_group *group,
|
||||
+ struct config_item *item)
|
||||
+{
|
||||
+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item);
|
||||
+
|
||||
+ config_item_put(&overlay->item);
|
||||
+}
|
||||
+
|
||||
+static struct configfs_group_operations overlays_ops = {
|
||||
+ .make_item = cfs_overlay_group_make_item,
|
||||
+ .drop_item = cfs_overlay_group_drop_item,
|
||||
+};
|
||||
+
|
||||
+static struct config_item_type overlays_type = {
|
||||
+ .ct_group_ops = &overlays_ops,
|
||||
+ .ct_owner = THIS_MODULE,
|
||||
+};
|
||||
+
|
||||
+static struct configfs_group_operations of_cfs_ops = {
|
||||
+ /* empty - we don't allow anything to be created */
|
||||
+};
|
||||
+
|
||||
+static struct config_item_type of_cfs_type = {
|
||||
+ .ct_group_ops = &of_cfs_ops,
|
||||
+ .ct_owner = THIS_MODULE,
|
||||
+};
|
||||
+
|
||||
+struct config_group of_cfs_overlay_group;
|
||||
+
|
||||
+static struct configfs_subsystem of_cfs_subsys = {
|
||||
+ .su_group = {
|
||||
+ .cg_item = {
|
||||
+ .ci_namebuf = "device-tree",
|
||||
+ .ci_type = &of_cfs_type,
|
||||
+ },
|
||||
+ },
|
||||
+ .su_mutex = __MUTEX_INITIALIZER(of_cfs_subsys.su_mutex),
|
||||
+};
|
||||
+
|
||||
+static int __init of_cfs_init(void)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ pr_info("%s\n", __func__);
|
||||
+
|
||||
+ config_group_init(&of_cfs_subsys.su_group);
|
||||
+ config_group_init_type_name(&of_cfs_overlay_group, "overlays",
|
||||
+ &overlays_type);
|
||||
+ configfs_add_default_group(&of_cfs_overlay_group,
|
||||
+ &of_cfs_subsys.su_group);
|
||||
+
|
||||
+ ret = configfs_register_subsystem(&of_cfs_subsys);
|
||||
+ if (ret != 0) {
|
||||
+ pr_err("%s: failed to register subsys\n", __func__);
|
||||
+ goto out;
|
||||
+ }
|
||||
+ pr_info("%s: OK\n", __func__);
|
||||
+out:
|
||||
+ return ret;
|
||||
+}
|
||||
+late_initcall(of_cfs_init);
|
||||
@ -0,0 +1,785 @@
|
||||
From 13498feb91614d59ebece61d0c278e31529bb8c8 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Tue, 10 Oct 2023 21:54:51 +0200
|
||||
Subject: [PATCH] rockchip gpio IR driver
|
||||
|
||||
---
|
||||
drivers/media/rc/Kconfig | 11 +
|
||||
drivers/media/rc/Makefile | 1 +
|
||||
drivers/media/rc/rockchip-ir.c | 723 +++++++++++++++++++++++++++++++++
|
||||
3 files changed, 735 insertions(+)
|
||||
create mode 100644 drivers/media/rc/rockchip-ir.c
|
||||
|
||||
diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig
|
||||
index f560fc38895f..b77fa83e90e8 100644
|
||||
--- a/drivers/media/rc/Kconfig
|
||||
+++ b/drivers/media/rc/Kconfig
|
||||
@@ -333,6 +333,17 @@ config IR_REDRAT3
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called redrat3.
|
||||
|
||||
+config IR_ROCKCHIP_CIR
|
||||
+ tristate "Rockchip GPIO IR receiver"
|
||||
+ depends on (OF && GPIOLIB) || COMPILE_TEST
|
||||
+ help
|
||||
+ Say Y here if you want to use the Rockchip IR receiver with
|
||||
+ virtual poweroff features provided by rockchip Trust OS
|
||||
+
|
||||
+ To compile this driver as a module, choose M here: the
|
||||
+ module will be called rockchip-ir
|
||||
+
|
||||
+
|
||||
config IR_RX51
|
||||
tristate "Nokia N900 IR transmitter diode"
|
||||
depends on (OMAP_DM_TIMER && PWM_OMAP_DMTIMER && ARCH_OMAP2PLUS || COMPILE_TEST) && RC_CORE
|
||||
diff --git a/drivers/media/rc/Makefile b/drivers/media/rc/Makefile
|
||||
index a9285266e944..057d5b64c121 100644
|
||||
--- a/drivers/media/rc/Makefile
|
||||
+++ b/drivers/media/rc/Makefile
|
||||
@@ -43,6 +43,7 @@ obj-$(CONFIG_IR_MTK) += mtk-cir.o
|
||||
obj-$(CONFIG_IR_NUVOTON) += nuvoton-cir.o
|
||||
obj-$(CONFIG_IR_PWM_TX) += pwm-ir-tx.o
|
||||
obj-$(CONFIG_IR_REDRAT3) += redrat3.o
|
||||
+obj-$(CONFIG_IR_ROCKCHIP_CIR) += rockchip-ir.o
|
||||
obj-$(CONFIG_IR_RX51) += ir-rx51.o
|
||||
obj-$(CONFIG_IR_SERIAL) += serial_ir.o
|
||||
obj-$(CONFIG_IR_SPI) += ir-spi.o
|
||||
diff --git a/drivers/media/rc/rockchip-ir.c b/drivers/media/rc/rockchip-ir.c
|
||||
new file mode 100644
|
||||
index 000000000000..43ade8c4adce
|
||||
--- /dev/null
|
||||
+++ b/drivers/media/rc/rockchip-ir.c
|
||||
@@ -0,0 +1,733 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-only
|
||||
+/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
|
||||
+*/
|
||||
+
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/interrupt.h>
|
||||
+#include <linux/gpio/consumer.h>
|
||||
+#include <linux/pinctrl/consumer.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/of_gpio.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/pm_runtime.h>
|
||||
+#include <linux/pm_qos.h>
|
||||
+#include <linux/irq.h>
|
||||
+#include <linux/arm-smccc.h>
|
||||
+#include <linux/clk.h>
|
||||
+#include <linux/reboot.h>
|
||||
+#include <uapi/linux/psci.h>
|
||||
+#include <media/rc-core.h>
|
||||
+#include <soc/rockchip/rockchip_sip.h>
|
||||
+
|
||||
+#define ROCKCHIP_IR_DEVICE_NAME "rockchip_ir_recv"
|
||||
+
|
||||
+#ifdef CONFIG_64BIT
|
||||
+#define PSCI_FN_NATIVE(version, name) PSCI_##version##_FN64_##name
|
||||
+#else
|
||||
+#define PSCI_FN_NATIVE(version, name) PSCI_##version##_FN_##name
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+* SIP/TEE constants for remote calls
|
||||
+*/
|
||||
+#define SIP_REMOTECTL_CFG 0x8200000b
|
||||
+#define SIP_SUSPEND_MODE 0x82000003
|
||||
+#define SIP_REMOTECTL_CFG 0x8200000b
|
||||
+#define SUSPEND_MODE_CONFIG 0x01
|
||||
+#define WKUP_SOURCE_CONFIG 0x02
|
||||
+#define PWM_REGULATOR_CONFIG 0x03
|
||||
+#define GPIO_POWER_CONFIG 0x04
|
||||
+#define SUSPEND_DEBUG_ENABLE 0x05
|
||||
+#define APIOS_SUSPEND_CONFIG 0x06
|
||||
+#define VIRTUAL_POWEROFF 0x07
|
||||
+
|
||||
+#define REMOTECTL_SET_IRQ 0xf0
|
||||
+#define REMOTECTL_SET_PWM_CH 0xf1
|
||||
+#define REMOTECTL_SET_PWRKEY 0xf2
|
||||
+#define REMOTECTL_GET_WAKEUP_STATE 0xf3
|
||||
+#define REMOTECTL_ENABLE 0xf4
|
||||
+#define REMOTECTL_PWRKEY_WAKEUP 0xdeadbeaf /* wakeup state */
|
||||
+
|
||||
+/*
|
||||
+* PWM Registers
|
||||
+* Each PWM has its own control registers
|
||||
+*/
|
||||
+#define PWM_REG_CNTR 0x00 /* Counter Register */
|
||||
+#define PWM_REG_HPR 0x04 /* Period Register */
|
||||
+#define PWM_REG_LPR 0x08 /* Duty Cycle Register */
|
||||
+#define PWM_REG_CTRL 0x0c /* Control Register */
|
||||
+
|
||||
+/*
|
||||
+* PWM General registers
|
||||
+* Registers shared among PWMs
|
||||
+*/
|
||||
+#define PWM_REG_INT_EN 0x44
|
||||
+
|
||||
+/*REG_CTRL bits definitions*/
|
||||
+#define PWM_ENABLE (1 << 0)
|
||||
+#define PWM_DISABLE (0 << 0)
|
||||
+
|
||||
+/*operation mode*/
|
||||
+#define PWM_MODE_ONESHOT (0x00 << 1)
|
||||
+#define PWM_MODE_CONTINUMOUS (0x01 << 1)
|
||||
+#define PWM_MODE_CAPTURE (0x02 << 1)
|
||||
+
|
||||
+/* Channel interrupt enable bit */
|
||||
+#define PWM_CH_INT_ENABLE(n) BIT(n)
|
||||
+
|
||||
+enum pwm_div {
|
||||
+ PWM_DIV1 = (0x0 << 12),
|
||||
+ PWM_DIV2 = (0x1 << 12),
|
||||
+ PWM_DIV4 = (0x2 << 12),
|
||||
+ PWM_DIV8 = (0x3 << 12),
|
||||
+ PWM_DIV16 = (0x4 << 12),
|
||||
+ PWM_DIV32 = (0x5 << 12),
|
||||
+ PWM_DIV64 = (0x6 << 12),
|
||||
+ PWM_DIV128 = (0x7 << 12),
|
||||
+};
|
||||
+
|
||||
+#define PWM_INT_ENABLE 1
|
||||
+#define PWM_INT_DISABLE 0
|
||||
+
|
||||
+struct rockchip_rc_dev {
|
||||
+ struct rc_dev *rcdev;
|
||||
+ struct gpio_desc *gpiod;
|
||||
+ int irq;
|
||||
+ struct device *pmdev;
|
||||
+ struct pm_qos_request qos;
|
||||
+ void __iomem *pwm_base;
|
||||
+ int pwm_wake_irq;
|
||||
+ int pwm_id;
|
||||
+ bool use_shutdown_handler; // if true, installs a shutdown handler and triggers virtual poweroff
|
||||
+ bool use_suspend_handler; // if true, virtual poweroff is used as suspend mode otherwise use as regular suspend
|
||||
+ struct pinctrl *pinctrl;
|
||||
+ struct pinctrl_state *pinctrl_state_default;
|
||||
+ struct pinctrl_state *pinctrl_state_suspend;
|
||||
+};
|
||||
+
|
||||
+static struct arm_smccc_res __invoke_sip_fn_smc(unsigned long function_id,
|
||||
+ unsigned long arg0,
|
||||
+ unsigned long arg1,
|
||||
+ unsigned long arg2)
|
||||
+{
|
||||
+ struct arm_smccc_res res;
|
||||
+
|
||||
+ arm_smccc_smc(function_id, arg0, arg1, arg2, 0, 0, 0, 0, &res);
|
||||
+
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
+int sip_smc_remotectl_config(u32 func, u32 data)
|
||||
+{
|
||||
+ struct arm_smccc_res res;
|
||||
+
|
||||
+ res = __invoke_sip_fn_smc(SIP_REMOTECTL_CFG, func, data, 0);
|
||||
+
|
||||
+ return res.a0;
|
||||
+}
|
||||
+
|
||||
+int sip_smc_set_suspend_mode(u32 ctrl, u32 config1, u32 config2)
|
||||
+{
|
||||
+ struct arm_smccc_res res;
|
||||
+
|
||||
+ res = __invoke_sip_fn_smc(SIP_SUSPEND_MODE, ctrl, config1, config2);
|
||||
+ return res.a0;
|
||||
+}
|
||||
+
|
||||
+int sip_smc_virtual_poweroff(void)
|
||||
+{
|
||||
+ struct arm_smccc_res res;
|
||||
+
|
||||
+ res = __invoke_sip_fn_smc(PSCI_FN_NATIVE(1_0, SYSTEM_SUSPEND), 0, 0, 0);
|
||||
+ return res.a0;
|
||||
+}
|
||||
+
|
||||
+static irqreturn_t rockchip_ir_recv_irq(int irq, void *dev_id)
|
||||
+{
|
||||
+ int val;
|
||||
+ struct rockchip_rc_dev *gpio_dev = dev_id;
|
||||
+ struct device *pmdev = gpio_dev->pmdev;
|
||||
+
|
||||
+ /*
|
||||
+ * For some cpuidle systems, not all:
|
||||
+ * Respond to interrupt taking more latency when cpu in idle.
|
||||
+ * Invoke asynchronous pm runtime get from interrupt context,
|
||||
+ * this may introduce a millisecond delay to call resume callback,
|
||||
+ * where to disable cpuilde.
|
||||
+ *
|
||||
+ * Two issues lead to fail to decode first frame, one is latency to
|
||||
+ * respond to interrupt, another is delay introduced by async api.
|
||||
+ */
|
||||
+ if (pmdev)
|
||||
+ pm_runtime_get(pmdev);
|
||||
+
|
||||
+ val = gpiod_get_value(gpio_dev->gpiod);
|
||||
+ if (val >= 0)
|
||||
+ ir_raw_event_store_edge(gpio_dev->rcdev, val == 1);
|
||||
+
|
||||
+ if (pmdev) {
|
||||
+ pm_runtime_mark_last_busy(pmdev);
|
||||
+ pm_runtime_put_autosuspend(pmdev);
|
||||
+ }
|
||||
+
|
||||
+ return IRQ_HANDLED;
|
||||
+}
|
||||
+
|
||||
+static void rockchip_pwm_int_ctrl(struct rockchip_rc_dev *gpio_dev, bool enable)
|
||||
+{
|
||||
+
|
||||
+ void __iomem *pwm_base = gpio_dev->pwm_base;
|
||||
+ struct device *dev = &gpio_dev->rcdev->dev;
|
||||
+ int pwm_id = gpio_dev->pwm_id;
|
||||
+
|
||||
+ void __iomem *reg_int_ctrl;
|
||||
+ int val;
|
||||
+
|
||||
+ reg_int_ctrl= pwm_base - (0x10 * pwm_id) + PWM_REG_INT_EN;
|
||||
+
|
||||
+ val = readl_relaxed(reg_int_ctrl);
|
||||
+
|
||||
+ if (enable) {
|
||||
+ val |= PWM_CH_INT_ENABLE(pwm_id);
|
||||
+ dev_info(dev, "PWM interrupt enabled, register value %x\n", val);
|
||||
+ } else {
|
||||
+ val &= ~PWM_CH_INT_ENABLE(pwm_id);
|
||||
+ dev_info(dev, "PWM interrupt disabled, register value %x\n", val);
|
||||
+ }
|
||||
+
|
||||
+ writel_relaxed(val, reg_int_ctrl);
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static int rockchip_pwm_hw_init(struct rockchip_rc_dev *gpio_dev)
|
||||
+{
|
||||
+
|
||||
+ void __iomem *pwm_base = gpio_dev->pwm_base;
|
||||
+ int val;
|
||||
+
|
||||
+ //1. disabled pwm
|
||||
+ val = readl_relaxed(pwm_base + PWM_REG_CTRL);
|
||||
+ val = (val & 0xFFFFFFFE) | PWM_DISABLE;
|
||||
+ writel_relaxed(val, pwm_base + PWM_REG_CTRL);
|
||||
+
|
||||
+ //2. capture mode
|
||||
+ val = readl_relaxed(pwm_base + PWM_REG_CTRL);
|
||||
+ val = (val & 0xFFFFFFF9) | PWM_MODE_CAPTURE;
|
||||
+ writel_relaxed(val, pwm_base + PWM_REG_CTRL);
|
||||
+
|
||||
+ //set clk div, clk div to 64
|
||||
+ val = readl_relaxed(pwm_base + PWM_REG_CTRL);
|
||||
+ val = (val & 0xFF0001FF) | PWM_DIV64;
|
||||
+ writel_relaxed(val, pwm_base + PWM_REG_CTRL);
|
||||
+
|
||||
+ //4. enabled pwm int
|
||||
+ rockchip_pwm_int_ctrl(gpio_dev, true);
|
||||
+
|
||||
+ //5. enabled pwm
|
||||
+ val = readl_relaxed(pwm_base + PWM_REG_CTRL);
|
||||
+ val = (val & 0xFFFFFFFE) | PWM_ENABLE;
|
||||
+ writel_relaxed(val, pwm_base + PWM_REG_CTRL);
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static int rockchip_pwm_hw_stop(struct rockchip_rc_dev *gpio_dev)
|
||||
+{
|
||||
+
|
||||
+ void __iomem *pwm_base = gpio_dev->pwm_base;
|
||||
+ int val;
|
||||
+
|
||||
+ //disable pwm interrupt
|
||||
+ rockchip_pwm_int_ctrl(gpio_dev, false);
|
||||
+
|
||||
+ //disable pwm
|
||||
+ val = readl_relaxed(pwm_base + PWM_REG_CTRL);
|
||||
+ val = (val & 0xFFFFFFFE) | PWM_DISABLE;
|
||||
+ writel_relaxed(val, pwm_base + PWM_REG_CTRL);
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static int rockchip_pwm_sip_wakeup_init(struct rockchip_rc_dev *gpio_dev)
|
||||
+{
|
||||
+
|
||||
+ struct device *dev = &gpio_dev->rcdev->dev;
|
||||
+
|
||||
+ struct irq_data *irq_data;
|
||||
+ long hwirq;
|
||||
+ int ret;
|
||||
+
|
||||
+ irq_data = irq_get_irq_data(gpio_dev->pwm_wake_irq);
|
||||
+ if (!irq_data) {
|
||||
+ dev_err(dev, "could not get irq data\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ hwirq = irq_data->hwirq;
|
||||
+ dev_info(dev, "use hwirq %ld, pwm chip id %d for PWM SIP wakeup\n", hwirq, gpio_dev->pwm_id);
|
||||
+
|
||||
+ ret = 0;
|
||||
+
|
||||
+ ret |= sip_smc_remotectl_config(REMOTECTL_SET_IRQ, (int)hwirq);
|
||||
+ ret |= sip_smc_remotectl_config(REMOTECTL_SET_PWM_CH, gpio_dev->pwm_id);
|
||||
+ ret |= sip_smc_remotectl_config(REMOTECTL_ENABLE, 1);
|
||||
+
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "SIP remote controller mode, TEE does not support feature\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ sip_smc_set_suspend_mode(SUSPEND_MODE_CONFIG, 0x10042, 0);
|
||||
+ sip_smc_set_suspend_mode(WKUP_SOURCE_CONFIG, 0x0, 0);
|
||||
+ sip_smc_set_suspend_mode(PWM_REGULATOR_CONFIG, 0x0, 0);
|
||||
+ //sip_smc_set_suspend_mode(GPIO_POWER_CONFIG, i, gpio_temp[i]);
|
||||
+ sip_smc_set_suspend_mode(SUSPEND_DEBUG_ENABLE, 0x1, 0);
|
||||
+ sip_smc_set_suspend_mode(APIOS_SUSPEND_CONFIG, 0x0, 0);
|
||||
+ sip_smc_set_suspend_mode(VIRTUAL_POWEROFF, 0, 1);
|
||||
+
|
||||
+ dev_info(dev, "TEE remote controller wakeup installed\n");
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static int rockchip_ir_recv_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct rockchip_rc_dev *gpio_dev = platform_get_drvdata(pdev);
|
||||
+ struct device *pmdev = gpio_dev->pmdev;
|
||||
+
|
||||
+ if (pmdev) {
|
||||
+ pm_runtime_get_sync(pmdev);
|
||||
+ cpu_latency_qos_remove_request(&gpio_dev->qos);
|
||||
+
|
||||
+ pm_runtime_disable(pmdev);
|
||||
+ pm_runtime_put_noidle(pmdev);
|
||||
+ pm_runtime_set_suspended(pmdev);
|
||||
+ }
|
||||
+
|
||||
+ // Disable the remote controller handling of the Trust OS
|
||||
+ sip_smc_remotectl_config(REMOTECTL_ENABLE, 0);
|
||||
+
|
||||
+ // Disable the virtual poweroff of the Trust OS
|
||||
+ sip_smc_set_suspend_mode(VIRTUAL_POWEROFF, 0, 0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rockchip_ir_register_power_key(struct device *dev)
|
||||
+{
|
||||
+
|
||||
+ struct rockchip_rc_dev *gpio_dev = dev_get_drvdata(dev);
|
||||
+
|
||||
+ struct rc_map *key_map;
|
||||
+ struct rc_map_table *key;
|
||||
+ int idx, key_scancode, rev_scancode;
|
||||
+ int tee_scancode;
|
||||
+
|
||||
+ key_map = &gpio_dev->rcdev->rc_map;
|
||||
+
|
||||
+ dev_info(dev, "remote key table %s, key map of %d items\n", key_map->name, key_map->len);
|
||||
+
|
||||
+ for (idx = 0; idx < key_map->len; idx++) {
|
||||
+
|
||||
+ key = &key_map->scan[idx];
|
||||
+
|
||||
+ if (key->keycode != KEY_POWER)
|
||||
+ continue;
|
||||
+
|
||||
+ key_scancode = key->scancode;
|
||||
+ rev_scancode = ~key_scancode;
|
||||
+
|
||||
+ // If key_scancode has higher 16 bits set to 0, then the scancode is NEC protocol, otherwise it is NECX/NEC32
|
||||
+ if ((key_scancode & 0xffff) == key_scancode)
|
||||
+ tee_scancode = (key_scancode & 0xff00) | ((rev_scancode & 0xff00) << 8); // NEC protocol
|
||||
+ else
|
||||
+ tee_scancode = ((key_scancode & 0xff0000) >> 8) | ((key_scancode & 0xff00) << 8); // NECX/NEC32 protocol
|
||||
+
|
||||
+ tee_scancode |= rev_scancode & 0xff;
|
||||
+ tee_scancode <<= 8;
|
||||
+
|
||||
+ sip_smc_remotectl_config(REMOTECTL_SET_PWRKEY, tee_scancode);
|
||||
+
|
||||
+ dev_info(dev, "registered scancode %08x (SIP: %8x)\n", key_scancode, tee_scancode);
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static int rockchip_ir_recv_suspend_prepare(struct device *dev)
|
||||
+{
|
||||
+ struct rockchip_rc_dev *gpio_dev = dev_get_drvdata(dev);
|
||||
+ int ret;
|
||||
+
|
||||
+ dev_info(dev, "initialize rockchip SIP virtual poweroff\n");
|
||||
+ ret = rockchip_pwm_sip_wakeup_init(gpio_dev);
|
||||
+
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ rockchip_ir_register_power_key(dev);
|
||||
+
|
||||
+ disable_irq(gpio_dev->irq);
|
||||
+ dev_info(dev, "GPIO IRQ disabled\n");
|
||||
+
|
||||
+ ret = pinctrl_select_state(gpio_dev->pinctrl, gpio_dev->pinctrl_state_suspend);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "unable to set pin in PWM mode\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ dev_info(dev, "set pin configuration to PWM mode\n");
|
||||
+
|
||||
+ rockchip_pwm_hw_init(gpio_dev);
|
||||
+ dev_info(dev, "started pin PWM mode\n");
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+}
|
||||
+
|
||||
+#ifdef CONFIG_PM
|
||||
+static int rockchip_ir_recv_suspend(struct device *dev)
|
||||
+{
|
||||
+ struct rockchip_rc_dev *gpio_dev = dev_get_drvdata(dev);
|
||||
+
|
||||
+ /*
|
||||
+ * if property suspend-is-virtual-poweroff is set, we can disable
|
||||
+ * the regular gpio wakeup and enable the PWM mode for the Trust OS
|
||||
+ * to take control and react to remote control.
|
||||
+ * If the property is not set, we instead enable the wake up for the
|
||||
+ * regular gpio.
|
||||
+ */
|
||||
+ if (gpio_dev->use_suspend_handler) {
|
||||
+
|
||||
+ rockchip_ir_recv_suspend_prepare(dev);
|
||||
+
|
||||
+ } else {
|
||||
+
|
||||
+ if (device_may_wakeup(dev))
|
||||
+ enable_irq_wake(gpio_dev->irq);
|
||||
+ else
|
||||
+ disable_irq(gpio_dev->irq);
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rockchip_ir_recv_resume(struct device *dev)
|
||||
+{
|
||||
+ struct rockchip_rc_dev *gpio_dev = dev_get_drvdata(dev);
|
||||
+ int ret;
|
||||
+
|
||||
+ /*
|
||||
+ * In case suspend-is-virtual-poweroff property is set,
|
||||
+ * restore the pin from PWM mode to regular GPIO configuration
|
||||
+ * and stop the PWM function.
|
||||
+ * Otherwise, just enable the regular GPIO irq
|
||||
+ */
|
||||
+ if (gpio_dev->use_suspend_handler) {
|
||||
+
|
||||
+ rockchip_pwm_hw_stop(gpio_dev);
|
||||
+ dev_info(dev, "stopped pin PWM mode\n");
|
||||
+
|
||||
+ ret = pinctrl_select_state(gpio_dev->pinctrl, gpio_dev->pinctrl_state_default);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "unable to restore pin in GPIO mode\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+ dev_info(dev, "restored pin configuration di GPIO\n");
|
||||
+
|
||||
+ enable_irq(gpio_dev->irq);
|
||||
+ dev_info(dev, "restored GPIO IRQ\n");
|
||||
+
|
||||
+ } else {
|
||||
+
|
||||
+ if (device_may_wakeup(dev))
|
||||
+ disable_irq_wake(gpio_dev->irq);
|
||||
+ else
|
||||
+ enable_irq(gpio_dev->irq);
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void rockchip_ir_recv_shutdown(struct platform_device *pdev)
|
||||
+{
|
||||
+
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct rockchip_rc_dev *gpio_dev = dev_get_drvdata(dev);
|
||||
+
|
||||
+ if (gpio_dev->use_shutdown_handler)
|
||||
+ rockchip_ir_recv_suspend_prepare(dev);
|
||||
+
|
||||
+ return;
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static int rockchip_ir_recv_sys_off(struct sys_off_data *data)
|
||||
+{
|
||||
+
|
||||
+ sip_smc_virtual_poweroff();
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static int rockchip_ir_recv_init_sip(void)
|
||||
+{
|
||||
+ struct arm_smccc_res res;
|
||||
+
|
||||
+ arm_smccc_smc(ROCKCHIP_SIP_SIP_VERSION, ROCKCHIP_SIP_IMPLEMENT_V2, SECURE_REG_WR, 0, 0, 0, 0, 0, &res);
|
||||
+
|
||||
+ if (res.a0)
|
||||
+ return 0;
|
||||
+
|
||||
+ return res.a1;
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static int rockchip_ir_recv_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct device_node *np = dev->of_node;
|
||||
+ struct rockchip_rc_dev *gpio_dev;
|
||||
+ struct rc_dev *rcdev;
|
||||
+ struct clk *clk;
|
||||
+ struct clk *p_clk;
|
||||
+ struct resource *res;
|
||||
+ u32 period = 0;
|
||||
+ int rc;
|
||||
+ int ret;
|
||||
+ int pwm_wake_irq;
|
||||
+ int clocks;
|
||||
+
|
||||
+ if (!np)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ gpio_dev = devm_kzalloc(dev, sizeof(*gpio_dev), GFP_KERNEL);
|
||||
+ if (!gpio_dev)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ gpio_dev->gpiod = devm_gpiod_get(dev, NULL, GPIOD_IN);
|
||||
+ if (IS_ERR(gpio_dev->gpiod)) {
|
||||
+ rc = PTR_ERR(gpio_dev->gpiod);
|
||||
+ /* Just try again if this happens */
|
||||
+ if (rc != -EPROBE_DEFER)
|
||||
+ dev_err(dev, "error getting gpio (%d)\n", rc);
|
||||
+ return rc;
|
||||
+ }
|
||||
+ gpio_dev->irq = gpiod_to_irq(gpio_dev->gpiod);
|
||||
+ if (gpio_dev->irq < 0)
|
||||
+ return gpio_dev->irq;
|
||||
+
|
||||
+ rcdev = devm_rc_allocate_device(dev, RC_DRIVER_IR_RAW);
|
||||
+ if (!rcdev)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ rcdev->priv = gpio_dev;
|
||||
+ rcdev->device_name = ROCKCHIP_IR_DEVICE_NAME;
|
||||
+ rcdev->input_phys = ROCKCHIP_IR_DEVICE_NAME "/input0";
|
||||
+ rcdev->input_id.bustype = BUS_HOST;
|
||||
+ rcdev->input_id.vendor = 0x0001;
|
||||
+ rcdev->input_id.product = 0x0001;
|
||||
+ rcdev->input_id.version = 0x0100;
|
||||
+ rcdev->dev.parent = dev;
|
||||
+ rcdev->driver_name = KBUILD_MODNAME;
|
||||
+ rcdev->min_timeout = 1;
|
||||
+ rcdev->timeout = IR_DEFAULT_TIMEOUT;
|
||||
+ rcdev->max_timeout = 10 * IR_DEFAULT_TIMEOUT;
|
||||
+ rcdev->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER;
|
||||
+ rcdev->map_name = of_get_property(np, "linux,rc-map-name", NULL);
|
||||
+ if (!rcdev->map_name)
|
||||
+ rcdev->map_name = RC_MAP_EMPTY;
|
||||
+
|
||||
+ gpio_dev->rcdev = rcdev;
|
||||
+ if (of_property_read_bool(np, "wakeup-source")) {
|
||||
+
|
||||
+ ret = device_init_wakeup(dev, true);
|
||||
+
|
||||
+ if (ret)
|
||||
+ dev_err(dev, "could not init wakeup device\n");
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ rc = devm_rc_register_device(dev, rcdev);
|
||||
+ if (rc < 0) {
|
||||
+ dev_err(dev, "failed to register rc device (%d)\n", rc);
|
||||
+ return rc;
|
||||
+ }
|
||||
+
|
||||
+ of_property_read_u32(np, "linux,autosuspend-period", &period);
|
||||
+ if (period) {
|
||||
+ gpio_dev->pmdev = dev;
|
||||
+ pm_runtime_set_autosuspend_delay(dev, period);
|
||||
+ pm_runtime_use_autosuspend(dev);
|
||||
+ pm_runtime_set_suspended(dev);
|
||||
+ pm_runtime_enable(dev);
|
||||
+ }
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ if (!res) {
|
||||
+ dev_err(dev, "no memory resources defined\n");
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
+
|
||||
+ gpio_dev->pwm_base = devm_ioremap_resource(dev, res);
|
||||
+ if (IS_ERR(gpio_dev->pwm_base))
|
||||
+ return PTR_ERR(gpio_dev->pwm_base);
|
||||
+
|
||||
+ clocks = of_property_count_strings(np, "clock-names");
|
||||
+ if (clocks == 2) {
|
||||
+ clk = devm_clk_get(dev, "pwm");
|
||||
+ p_clk = devm_clk_get(dev, "pclk");
|
||||
+ } else {
|
||||
+ clk = devm_clk_get(dev, NULL);
|
||||
+ p_clk = clk;
|
||||
+ }
|
||||
+
|
||||
+ if (IS_ERR(clk)) {
|
||||
+ ret = PTR_ERR(clk);
|
||||
+ if (ret != -EPROBE_DEFER)
|
||||
+ dev_err(dev, "Can't get bus clock: %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ if (IS_ERR(p_clk)) {
|
||||
+ ret = PTR_ERR(p_clk);
|
||||
+ if (ret != -EPROBE_DEFER)
|
||||
+ dev_err(dev, "Can't get peripheral clock: %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = clk_prepare_enable(clk);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "Can't enable bus clk: %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = clk_prepare_enable(p_clk);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "Can't enable peripheral clk: %d\n", ret);
|
||||
+ goto error_clk;
|
||||
+ }
|
||||
+
|
||||
+ pwm_wake_irq = platform_get_irq(pdev, 0);
|
||||
+ if (pwm_wake_irq < 0) {
|
||||
+ dev_err(&pdev->dev, "cannot find PWM wake interrupt\n");
|
||||
+ goto error_pclk;
|
||||
+ }
|
||||
+
|
||||
+ gpio_dev->pwm_wake_irq = pwm_wake_irq;
|
||||
+ ret = enable_irq_wake(pwm_wake_irq);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "could not enable IRQ wakeup\n");
|
||||
+ }
|
||||
+
|
||||
+ ret = of_property_read_u32(np, "pwm-id", &gpio_dev->pwm_id);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "missing pwm-id property\n");
|
||||
+ goto error_pclk;
|
||||
+ }
|
||||
+
|
||||
+ if (gpio_dev->pwm_id > 3) {
|
||||
+ dev_err(dev, "invalid pwm-id property\n");
|
||||
+ goto error_pclk;
|
||||
+ }
|
||||
+
|
||||
+ gpio_dev->use_shutdown_handler = of_property_read_bool(np, "shutdown-is-virtual-poweroff");
|
||||
+ gpio_dev->use_suspend_handler = of_property_read_bool(np, "suspend-is-virtual-poweroff");
|
||||
+
|
||||
+ gpio_dev->pinctrl = devm_pinctrl_get(dev);
|
||||
+ if (IS_ERR(gpio_dev->pinctrl)) {
|
||||
+ dev_err(dev, "Unable to get pinctrl\n");
|
||||
+ goto error_pclk;
|
||||
+ }
|
||||
+
|
||||
+ gpio_dev->pinctrl_state_default = pinctrl_lookup_state(gpio_dev->pinctrl, "default");
|
||||
+ if (IS_ERR(gpio_dev->pinctrl_state_default)) {
|
||||
+ dev_err(dev, "Unable to get default pinctrl state\n");
|
||||
+ goto error_pclk;
|
||||
+ }
|
||||
+
|
||||
+ gpio_dev->pinctrl_state_suspend = pinctrl_lookup_state(gpio_dev->pinctrl, "suspend");
|
||||
+ if (IS_ERR(gpio_dev->pinctrl_state_suspend)) {
|
||||
+ dev_err(dev, "Unable to get suspend pinctrl state\n");
|
||||
+ goto error_pclk;
|
||||
+ }
|
||||
+
|
||||
+ platform_set_drvdata(pdev, gpio_dev);
|
||||
+
|
||||
+ ret = devm_request_irq(dev, gpio_dev->irq, rockchip_ir_recv_irq,
|
||||
+ IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
|
||||
+ "gpio-ir-recv-irq", gpio_dev);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "Can't request GPIO interrupt\n");
|
||||
+ goto error_pclk;
|
||||
+ }
|
||||
+
|
||||
+ if (gpio_dev->use_shutdown_handler) {
|
||||
+
|
||||
+ ret = devm_register_sys_off_handler(dev, SYS_OFF_MODE_POWER_OFF,
|
||||
+ SYS_OFF_PRIO_FIRMWARE, rockchip_ir_recv_sys_off, NULL);
|
||||
+
|
||||
+ if (ret)
|
||||
+ dev_err(dev, "could not register sys_off handler\n");
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ ret = rockchip_ir_recv_init_sip();
|
||||
+ if (!ret) {
|
||||
+ dev_err(dev, "Unable to initialize Rockchip SIP v2, virtual poweroff unavailable\n");
|
||||
+ gpio_dev->use_shutdown_handler = false;
|
||||
+ gpio_dev->use_suspend_handler = false;
|
||||
+ } else {
|
||||
+ dev_info(dev, "rockchip SIP initialized, version 0x%x\n", ret);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+error_pclk:
|
||||
+ clk_unprepare(p_clk);
|
||||
+error_clk:
|
||||
+ clk_unprepare(clk);
|
||||
+
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static const struct dev_pm_ops rockchip_ir_recv_pm_ops = {
|
||||
+ .suspend = rockchip_ir_recv_suspend,
|
||||
+ .resume = rockchip_ir_recv_resume,
|
||||
+};
|
||||
+#endif
|
||||
+
|
||||
+static const struct of_device_id rockchip_ir_recv_of_match[] = {
|
||||
+ { .compatible = "rockchip-ir-receiver", },
|
||||
+ { },
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, rockchip_ir_recv_of_match);
|
||||
+
|
||||
+static struct platform_driver rockchip_ir_recv_driver = {
|
||||
+ .probe = rockchip_ir_recv_probe,
|
||||
+ .remove = rockchip_ir_recv_remove,
|
||||
+ .shutdown = rockchip_ir_recv_shutdown,
|
||||
+ .driver = {
|
||||
+ .name = KBUILD_MODNAME,
|
||||
+ .of_match_table = of_match_ptr(rockchip_ir_recv_of_match),
|
||||
+#ifdef CONFIG_PM
|
||||
+ .pm = &rockchip_ir_recv_pm_ops,
|
||||
+#endif
|
||||
+ },
|
||||
+};
|
||||
+module_platform_driver(rockchip_ir_recv_driver);
|
||||
+
|
||||
+MODULE_DESCRIPTION("Rockchip IR Receiver driver");
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
@ -0,0 +1,119 @@
|
||||
From f14539f8d08328ae5aad165a4deea25c7d6b09bf Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Mon, 25 Apr 2022 13:25:09 +0000
|
||||
Subject: [PATCH] add generic rk322x tv box remote controller keymap
|
||||
|
||||
---
|
||||
drivers/media/rc/keymaps/Makefile | 1 +
|
||||
drivers/media/rc/keymaps/rc-rk322x-tvbox.c | 74 ++++++++++++++++++++++
|
||||
include/media/rc-map.h | 1 +
|
||||
3 files changed, 77 insertions(+)
|
||||
create mode 100644 drivers/media/rc/keymaps/rc-rk322x-tvbox.c
|
||||
|
||||
diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
|
||||
index 5fe5c9e1a46..1aa49b78a65 100644
|
||||
--- a/drivers/media/rc/keymaps/Makefile
|
||||
+++ b/drivers/media/rc/keymaps/Makefile
|
||||
@@ -99,6 +99,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
|
||||
rc-rc6-mce.o \
|
||||
rc-real-audio-220-32-keys.o \
|
||||
rc-reddo.o \
|
||||
+ rc-rk322x-tvbox.o \
|
||||
rc-snapstream-firefly.o \
|
||||
rc-streamzap.o \
|
||||
rc-tanix-tx3mini.o \
|
||||
diff --git a/drivers/media/rc/keymaps/rc-rk322x-tvbox.c b/drivers/media/rc/keymaps/rc-rk322x-tvbox.c
|
||||
new file mode 100644
|
||||
index 00000000000..91e24ee52ee
|
||||
--- /dev/null
|
||||
+++ b/drivers/media/rc/keymaps/rc-rk322x-tvbox.c
|
||||
@@ -0,0 +1,74 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+// rc-rk322x-tvbox.c - Keytable for rk322x generic tv box remote controller
|
||||
+//
|
||||
+// keymap imported from ir-keymaps.c
|
||||
+//
|
||||
+// Copyright (c) 2022 Paolo Sabatino
|
||||
+
|
||||
+#include <media/rc-map.h>
|
||||
+#include <linux/module.h>
|
||||
+
|
||||
+/*
|
||||
+
|
||||
+*/
|
||||
+
|
||||
+static struct rc_map_table rk322x_tvbox[] = {
|
||||
+
|
||||
+ { 0x40400d, KEY_ENTER },
|
||||
+ { 0x40404d, KEY_POWER },
|
||||
+ { 0x40401e, KEY_PREVIOUSSONG },
|
||||
+ { 0x40401f, KEY_NEXTSONG },
|
||||
+ { 0x404001, KEY_1 },
|
||||
+ { 0x404002, KEY_2 },
|
||||
+ { 0x404003, KEY_3 },
|
||||
+ { 0x404004, KEY_4 },
|
||||
+ { 0x404005, KEY_5 },
|
||||
+ { 0x404006, KEY_6 },
|
||||
+ { 0x404007, KEY_7 },
|
||||
+ { 0x404008, KEY_8 },
|
||||
+ { 0x404009, KEY_9 },
|
||||
+ { 0x404000, KEY_0 },
|
||||
+ { 0x40400c, KEY_BACKSPACE },
|
||||
+ { 0x404044, KEY_F6 },
|
||||
+ { 0x40401a, KEY_HOME },
|
||||
+ { 0x404042, KEY_BACK },
|
||||
+ { 0x404045, KEY_MENU },
|
||||
+ { 0x40400f, KEY_TEXT },
|
||||
+ { 0x404010, KEY_LEFT },
|
||||
+ { 0x404011, KEY_RIGHT },
|
||||
+ { 0x40400e, KEY_DOWN },
|
||||
+ { 0x40400b, KEY_UP },
|
||||
+ { 0x40401c, KEY_VOLUMEDOWN },
|
||||
+ { 0x404043, KEY_MUTE },
|
||||
+ { 0x404015, KEY_VOLUMEUP },
|
||||
+ { 0x404053, KEY_F1 },
|
||||
+ { 0x40405b, KEY_F2 },
|
||||
+ { 0x404057, KEY_F3 },
|
||||
+ { 0x404054, KEY_F4 },
|
||||
+
|
||||
+};
|
||||
+
|
||||
+static struct rc_map_list rk322x_tvbox_map = {
|
||||
+ .map = {
|
||||
+ .scan = rk322x_tvbox,
|
||||
+ .size = ARRAY_SIZE(rk322x_tvbox),
|
||||
+ .rc_proto = RC_PROTO_NEC, /* Legacy IR type */
|
||||
+ .name = RC_MAP_RK322X_TVBOX,
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+static int __init init_rc_map_rk322x_tvbox(void)
|
||||
+{
|
||||
+ return rc_map_register(&rk322x_tvbox_map);
|
||||
+}
|
||||
+
|
||||
+static void __exit exit_rc_map_rk322x_tvbox(void)
|
||||
+{
|
||||
+ rc_map_unregister(&rk322x_tvbox_map);
|
||||
+}
|
||||
+
|
||||
+module_init(init_rc_map_rk322x_tvbox)
|
||||
+module_exit(exit_rc_map_rk322x_tvbox)
|
||||
+
|
||||
+MODULE_LICENSE("GPL");
|
||||
+MODULE_AUTHOR("Paolo Sabatino");
|
||||
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
|
||||
index 793b54342df..35aba84be9f 100644
|
||||
--- a/include/media/rc-map.h
|
||||
+++ b/include/media/rc-map.h
|
||||
@@ -310,6 +310,7 @@ struct rc_map *rc_map_get(const char *name);
|
||||
#define RC_MAP_RC6_MCE "rc-rc6-mce"
|
||||
#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys"
|
||||
#define RC_MAP_REDDO "rc-reddo"
|
||||
+#define RC_MAP_RK322X_TVBOX "rc-rk322x-tvbox"
|
||||
#define RC_MAP_SNAPSTREAM_FIREFLY "rc-snapstream-firefly"
|
||||
#define RC_MAP_STREAMZAP "rc-streamzap"
|
||||
#define RC_MAP_SU3000 "rc-su3000"
|
||||
--
|
||||
2.30.2
|
||||
|
||||
41
patch/kernel/archive/rk322x-6.6/overlay/Makefile
Executable file
41
patch/kernel/archive/rk322x-6.6/overlay/Makefile
Executable file
@ -0,0 +1,41 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
dtbo-$(CONFIG_ARCH_ROCKCHIP) += \
|
||||
rk322x-emmc.dtbo \
|
||||
rk322x-emmc-pins.dtbo \
|
||||
rk322x-emmc-ddr-ph45.dtbo \
|
||||
rk322x-emmc-ddr-ph180.dtbo \
|
||||
rk322x-emmc-hs200.dtbo \
|
||||
rk322x-nand.dtbo \
|
||||
rk322x-led-conf-default.dtbo \
|
||||
rk322x-led-conf1.dtbo \
|
||||
rk322x-led-conf2.dtbo \
|
||||
rk322x-led-conf3.dtbo \
|
||||
rk322x-led-conf4.dtbo \
|
||||
rk322x-led-conf5.dtbo \
|
||||
rk322x-led-conf6.dtbo \
|
||||
rk322x-led-conf7.dtbo \
|
||||
rk322x-led-conf8.dtbo \
|
||||
rk322x-cpu-hs.dtbo \
|
||||
rk322x-cpu-hs-lv.dtbo \
|
||||
rk322x-wlan-alt-wiring.dtbo \
|
||||
rk322x-cpu-stability.dtbo \
|
||||
rk322x-ir-wakeup.dtbo \
|
||||
rk322x-ddr3-330.dtbo \
|
||||
rk322x-ddr3-528.dtbo \
|
||||
rk322x-ddr3-660.dtbo \
|
||||
rk322x-ddr3-800.dtbo \
|
||||
rk322x-bt-8723cs.dtbo \
|
||||
rk322x-usb-otg-peripheral.dtbo
|
||||
|
||||
|
||||
scr-$(CONFIG_ARCH_ROCKCHIP) += \
|
||||
rk322x-fixup.scr
|
||||
|
||||
dtbotxt-$(CONFIG_ARCH_ROCKCHIP) += \
|
||||
README.rk322x-overlays
|
||||
|
||||
targets += $(dtbo-y) $(scr-y) $(dtbotxt-y)
|
||||
|
||||
always := $(dtbo-y) $(scr-y) $(dtbotxt-y)
|
||||
clean-files := *.dtbo *.scr
|
||||
|
||||
98
patch/kernel/archive/rk322x-6.6/overlay/README.rk322x-overlays
Executable file
98
patch/kernel/archive/rk322x-6.6/overlay/README.rk322x-overlays
Executable file
@ -0,0 +1,98 @@
|
||||
This document describes overlays provided in the kernel packages
|
||||
For generic Armbian overlays documentation please see
|
||||
https://docs.armbian.com/User-Guide_Allwinner_overlays/
|
||||
|
||||
### Platform:
|
||||
|
||||
rk322x (Rockchip)
|
||||
|
||||
### Provided overlays:
|
||||
|
||||
- rk322x-cpu-hs
|
||||
- rk322x-cpu-stability
|
||||
- rk322x-emmc*
|
||||
- rk322x-nand
|
||||
- rk322x-emmc-nand
|
||||
- rk322x-led-conf*
|
||||
- rk322x-wlan-alt-wiring
|
||||
- rk322x-ddr3-*
|
||||
- rk322x-bt-*
|
||||
- rk322x-usb-otg-peripheral
|
||||
- rk322x-ir-wakeup
|
||||
|
||||
### Overlay details:
|
||||
|
||||
### rk322x-cpu-hs
|
||||
|
||||
Activates higher CPU speed (up to 1.4ghz) for rk3228b/rk3229 boxes
|
||||
|
||||
### rk322x-cpu-stability
|
||||
|
||||
Increases the voltage of the lowest operating point to increase stability
|
||||
on some boards which have power regulation issues. Also adds a settling
|
||||
time to allow power regulator stabilize voltage.
|
||||
|
||||
### emmc*
|
||||
|
||||
rk322x-emmc activates onboard emmc device node and deactivates the
|
||||
nand controller.
|
||||
rk322x-emmc-pins sets the pin controller default pull up/down
|
||||
configuration, not all boards are happy with this overlay, so your
|
||||
mileage may vary and may want to not use it.
|
||||
rk322x-emmc-ddr-ph45/ph180 sets the emmc ddr mode. First overlay
|
||||
sets the default phase clock shifting to 45 degrees, the second
|
||||
overlay to 180 degrees. They are alternative, choose the one that
|
||||
makes your emmc perform better.
|
||||
rk322x-emmc-hs200 enables the hs200 mode. It is preferable to
|
||||
ddr mode because it is more stable, but old emmc parts don't
|
||||
support it.
|
||||
|
||||
### nand
|
||||
|
||||
Activates onboard nand device node and deactivates the emmc controller.
|
||||
Also sets up the pin controller default pull up/down configuration
|
||||
|
||||
### rk322x-led-conf*
|
||||
|
||||
Each device tree of this kind provides a different known wiring configuration
|
||||
(ie: gpio and active low/high) of the onboard leds. Each board manufacturer
|
||||
usually choose a different GPIO for the auxiliary led, but the main "working"
|
||||
led is always wired to the same gpio (although it may be active high or low)
|
||||
led-conf1 is commonly found in boards made by Chiptrip manufacturer
|
||||
led-conf2 is found in other boards with R329Q and MXQ_RK3229 marking
|
||||
led-conf3 is found in boards with R28-MXQ marking
|
||||
led-conf4 is found on boards with T066 marking
|
||||
led-conf5 is found on boards with IPB900 marking from AEMS PVT
|
||||
led-conf6 is found on boards with MXQ_PRO_V72 and similar markings, possibly
|
||||
with eMCP module.
|
||||
led-conf7 is found on boards with R29_MXQ, R2B_MXQ and H20 markings
|
||||
led-conf8 is specific for H20_221_V1.71 boards, but may work on other variants
|
||||
|
||||
### rk322x-alt-wiring
|
||||
|
||||
Some boards have different SDIO wiring setup for wifi chips. This overlay
|
||||
enables the different pin controller wiring and power enable
|
||||
|
||||
### rk322x-ddr3-*
|
||||
|
||||
Enable DRAM memory controller and sets the speed to the given speed bin.
|
||||
The DRAM memory controller reclocking only works with DDR3/LPDDR3, if
|
||||
you enable one of these overlays on boards with DDR2 memory the system
|
||||
will not boot anymore
|
||||
|
||||
### rk322x-bt-*
|
||||
|
||||
Overlays that enable bluetooth devices. Most common bluetooth chips are
|
||||
realtek ones.
|
||||
rk322x-bt-8723cs: enable this overlay for 8723cs and 8703bs wifi/bluetooth
|
||||
|
||||
### rk322x-usb-otg-peripheral
|
||||
|
||||
Set the OTG USB port to peripheral mode to be used as USB slave instead
|
||||
of USB host
|
||||
|
||||
### rk322x-ir-wakeup
|
||||
|
||||
Enable the rockchip-ir-driver in place of the standard gpio-ir-receiver.
|
||||
The rockchip-specific driver exploits the Trust OS and Virtual Poweroff mode
|
||||
to allow power up via remote controller power button.
|
||||
19
patch/kernel/archive/rk322x-6.6/overlay/rk322x-bt-8723cs.dts
Normal file
19
patch/kernel/archive/rk322x-6.6/overlay/rk322x-bt-8723cs.dts
Normal file
@ -0,0 +1,19 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/pinctrl/rockchip.h>
|
||||
|
||||
&uart1 {
|
||||
pinctrl-0 = <&uart11_xfer>, <&uart11_rts>, <&uart11_cts>;
|
||||
pinctrl-names = "default";
|
||||
uart-has-rtscts;
|
||||
status = "okay";
|
||||
bluetooth {
|
||||
compatible = "realtek,rtl8723cs-bt";
|
||||
enable-gpios = <&gpio2 RK_PD5 GPIO_ACTIVE_HIGH>;
|
||||
device-wake-gpios = <&gpio3 RK_PD3 GPIO_ACTIVE_HIGH>;
|
||||
host-wake-gpios = <&gpio3 RK_PD2 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
};
|
||||
68
patch/kernel/archive/rk322x-6.6/overlay/rk322x-cpu-hs-lv.dts
Executable file
68
patch/kernel/archive/rk322x-6.6/overlay/rk322x-cpu-hs-lv.dts
Executable file
@ -0,0 +1,68 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target = <&cpu0_opp_table>;
|
||||
__overlay__ {
|
||||
opp-600000000 {
|
||||
opp-microvolt = <950000 950000 1275000>;
|
||||
};
|
||||
opp-816000000 {
|
||||
opp-microvolt = <950000 950000 1275000>;
|
||||
};
|
||||
opp-1008000000 {
|
||||
opp-microvolt = <1000000 1000000 1275000>;
|
||||
};
|
||||
opp-1200000000 {
|
||||
opp-microvolt = <1100000 1100000 1275000>;
|
||||
};
|
||||
opp-1296000000 {
|
||||
opp-hz = /bits/ 64 <1296000000>;
|
||||
opp-microvolt = <1150000 1150000 1275000>;
|
||||
};
|
||||
opp-1392000000 {
|
||||
opp-hz = /bits/ 64 <1392000000>;
|
||||
opp-microvolt = <1225000 1225000 1275000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target = <&gpu_opp_table>;
|
||||
__overlay__ {
|
||||
opp-200000000 {
|
||||
opp-microvolt = <1050000 1050000 1200000>;
|
||||
};
|
||||
opp-300000000 {
|
||||
opp-microvolt = <1050000 1050000 1200000>;
|
||||
};
|
||||
opp-400000000 {
|
||||
opp-microvolt = <1050000 1050000 1200000>;
|
||||
};
|
||||
opp-500000000 {
|
||||
opp-microvolt = <1050000 1050000 1200000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fragment@2 {
|
||||
target = <&dmc_opp_table>;
|
||||
__overlay__ {
|
||||
opp-330000000 {
|
||||
opp-microvolt = <1050000 1050000 1200000>;
|
||||
};
|
||||
opp-534000000 {
|
||||
opp-microvolt = <1050000 1050000 1200000>;
|
||||
};
|
||||
opp-660000000 {
|
||||
opp-microvolt = <1050000 1050000 1200000>;
|
||||
};
|
||||
opp-786000000 {
|
||||
opp-microvolt = <1100000 1050000 1200000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
28
patch/kernel/archive/rk322x-6.6/overlay/rk322x-cpu-hs.dts
Executable file
28
patch/kernel/archive/rk322x-6.6/overlay/rk322x-cpu-hs.dts
Executable file
@ -0,0 +1,28 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target = <&cpu0_opp_table>;
|
||||
__overlay__ {
|
||||
|
||||
opp-1296000000 {
|
||||
opp-hz = /bits/ 64 <1296000000>;
|
||||
opp-microvolt = <1325000 1325000 1400000>;
|
||||
};
|
||||
opp-1392000000 {
|
||||
opp-hz = /bits/ 64 <1392000000>;
|
||||
opp-microvolt = <1350000 1350000 1400000>;
|
||||
};
|
||||
/*
|
||||
opp-1464000000 {
|
||||
opp-hz = /bits/ 64 <1464000000>;
|
||||
opp-microvolt = <1400000 1400000 1400000>;
|
||||
};
|
||||
*/
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
@ -0,0 +1,52 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
|
||||
/*
|
||||
Device tree overlay that tries to overcome issues on power regulators (expecially ARM
|
||||
power regulator) increasing lowest voltage and adding settling time to allow voltage
|
||||
stabilization
|
||||
*/
|
||||
|
||||
fragment@0 {
|
||||
target = <&cpu0_opp_table>;
|
||||
__overlay__ {
|
||||
|
||||
/*
|
||||
Increase 600 and 800 Mhz operating points voltage to decrease the range
|
||||
between minimum and maximum voltages
|
||||
*/
|
||||
opp-600000000 {
|
||||
opp-hz = /bits/ 64 <600000000>;
|
||||
opp-microvolt = <1100000>;
|
||||
};
|
||||
|
||||
opp-816000000 {
|
||||
opp-hz = /bits/ 64 <816000000>;
|
||||
opp-microvolt = <1100000>;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target = <&vdd_arm>;
|
||||
__overlay__ {
|
||||
|
||||
regulator-ramp-delay = <300>; // 30 uV/us, so 0.3v transition settling time is 1ms
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
fragment@2 {
|
||||
target = <&vdd_log>;
|
||||
__overlay__ {
|
||||
|
||||
regulator-ramp-delay = <600>; // 600 uV/us, so 0,3v transition settling time is 0.5ms
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
28
patch/kernel/archive/rk322x-6.6/overlay/rk322x-ddr3-330.dts
Normal file
28
patch/kernel/archive/rk322x-6.6/overlay/rk322x-ddr3-330.dts
Normal file
@ -0,0 +1,28 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target = <&dmc>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target = <&dmc_opp_table>;
|
||||
__overlay__ {
|
||||
opp-534000000 {
|
||||
status = "disabled";
|
||||
};
|
||||
opp-660000000 {
|
||||
status = "disabled";
|
||||
};
|
||||
opp-786000000 {
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
28
patch/kernel/archive/rk322x-6.6/overlay/rk322x-ddr3-528.dts
Normal file
28
patch/kernel/archive/rk322x-6.6/overlay/rk322x-ddr3-528.dts
Normal file
@ -0,0 +1,28 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target = <&dmc>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target = <&dmc_opp_table>;
|
||||
__overlay__ {
|
||||
opp-534000000 {
|
||||
status = "okay";
|
||||
};
|
||||
opp-660000000 {
|
||||
status = "disabled";
|
||||
};
|
||||
opp-786000000 {
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
28
patch/kernel/archive/rk322x-6.6/overlay/rk322x-ddr3-660.dts
Normal file
28
patch/kernel/archive/rk322x-6.6/overlay/rk322x-ddr3-660.dts
Normal file
@ -0,0 +1,28 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target = <&dmc>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target = <&dmc_opp_table>;
|
||||
__overlay__ {
|
||||
opp-534000000 {
|
||||
status = "okay";
|
||||
};
|
||||
opp-660000000 {
|
||||
status = "okay";
|
||||
};
|
||||
opp-786000000 {
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
28
patch/kernel/archive/rk322x-6.6/overlay/rk322x-ddr3-800.dts
Normal file
28
patch/kernel/archive/rk322x-6.6/overlay/rk322x-ddr3-800.dts
Normal file
@ -0,0 +1,28 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target = <&dmc>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target = <&dmc_opp_table>;
|
||||
__overlay__ {
|
||||
opp-534000000 {
|
||||
status = "okay";
|
||||
};
|
||||
opp-660000000 {
|
||||
status = "okay";
|
||||
};
|
||||
opp-786000000 {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
@ -0,0 +1,14 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target = <&emmc>;
|
||||
__overlay__ {
|
||||
mmc-ddr-1_8v;
|
||||
rockchip,default-sample-phase = <180>;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
@ -0,0 +1,14 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target = <&emmc>;
|
||||
__overlay__ {
|
||||
mmc-ddr-1_8v;
|
||||
rockchip,default-sample-phase = <45>;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
@ -0,0 +1,13 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target = <&emmc>;
|
||||
__overlay__ {
|
||||
mmc-hs200-1_8v;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
34
patch/kernel/archive/rk322x-6.6/overlay/rk322x-emmc-pins.dts
Normal file
34
patch/kernel/archive/rk322x-6.6/overlay/rk322x-emmc-pins.dts
Normal file
@ -0,0 +1,34 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/pinctrl/rockchip.h>
|
||||
|
||||
&{/} {
|
||||
|
||||
emmc_pwrseq: emmc-pwrseq {
|
||||
compatible = "mmc-pwrseq-emmc";
|
||||
reset-gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
sdmmc_pwrseq: sdmmc-pwrseq {
|
||||
compatible = "mmc-pwrseq-emmc";
|
||||
reset-gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
&emmc {
|
||||
status = "okay";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8 &emmc_pwr &emmc_rst>;
|
||||
mmc-pwrseq = <&emmc_pwrseq>;
|
||||
};
|
||||
|
||||
&sdmmc {
|
||||
mmc-pwrseq = <&sdmmc_pwrseq>;
|
||||
};
|
||||
|
||||
&nfc {
|
||||
status = "disabled";
|
||||
};
|
||||
20
patch/kernel/archive/rk322x-6.6/overlay/rk322x-emmc.dts
Executable file
20
patch/kernel/archive/rk322x-6.6/overlay/rk322x-emmc.dts
Executable file
@ -0,0 +1,20 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target = <&emmc>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target = <&nfc>;
|
||||
__overlay__ {
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
4
patch/kernel/archive/rk322x-6.6/overlay/rk322x-fixup.scr-cmd
Executable file
4
patch/kernel/archive/rk322x-6.6/overlay/rk322x-fixup.scr-cmd
Executable file
@ -0,0 +1,4 @@
|
||||
# overlays fixup script
|
||||
# implements (or rather substitutes) overlay arguments functionality
|
||||
# using u-boot scripting, environment variables and "fdt" command
|
||||
|
||||
16
patch/kernel/archive/rk322x-6.6/overlay/rk322x-ir-wakeup.dts
Normal file
16
patch/kernel/archive/rk322x-6.6/overlay/rk322x-ir-wakeup.dts
Normal file
@ -0,0 +1,16 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/*
|
||||
* Disable regular gpio-ir-receiver and enable
|
||||
* rockchip-ir-receiver driver; also enables virtual
|
||||
* poweroff on shutdown to allow restart with power key
|
||||
* on remote controller
|
||||
*/
|
||||
&ir_receiver {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&rockchip_ir_receiver {
|
||||
status = "okay";
|
||||
};
|
||||
@ -0,0 +1,22 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/pinctrl/rockchip.h>
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target-path = "/gpio-leds";
|
||||
__overlay__ {
|
||||
|
||||
working {
|
||||
gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>;
|
||||
linux,default-trigger = "none";
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
64
patch/kernel/archive/rk322x-6.6/overlay/rk322x-led-conf1.dts
Executable file
64
patch/kernel/archive/rk322x-6.6/overlay/rk322x-led-conf1.dts
Executable file
@ -0,0 +1,64 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/pinctrl/rockchip.h>
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target-path = "/gpio-leds";
|
||||
__overlay__ {
|
||||
|
||||
working {
|
||||
gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>;
|
||||
linux,default-trigger = "none";
|
||||
};
|
||||
|
||||
auxiliary {
|
||||
gpios = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>;
|
||||
label = "auxiliary";
|
||||
linux,default-trigger = "mmc2";
|
||||
default-state = "off";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&gpio_led_aux>;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target-path = "/pinctrl/gpio-items";
|
||||
__overlay__ {
|
||||
|
||||
gpio_led_aux: gpio-led-aux {
|
||||
rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
reset_key: reset-key {
|
||||
rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
fragment@2 {
|
||||
target = <&gpio_keys>;
|
||||
__overlay__ {
|
||||
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&reset_key>;
|
||||
|
||||
reset {
|
||||
gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>;
|
||||
label = "reset";
|
||||
linux,code = <KEY_RESTART>;
|
||||
debounce-interval = <200>;
|
||||
wakeup-source;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
64
patch/kernel/archive/rk322x-6.6/overlay/rk322x-led-conf2.dts
Executable file
64
patch/kernel/archive/rk322x-6.6/overlay/rk322x-led-conf2.dts
Executable file
@ -0,0 +1,64 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/pinctrl/rockchip.h>
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target-path = "/gpio-leds";
|
||||
__overlay__ {
|
||||
|
||||
working {
|
||||
gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_LOW>;
|
||||
linux,default-trigger = "none";
|
||||
};
|
||||
|
||||
auxiliary {
|
||||
gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>;
|
||||
label = "auxiliary";
|
||||
linux,default-trigger = "mmc2";
|
||||
default-state = "off";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&gpio_led_aux>;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target-path = "/pinctrl/gpio-items";
|
||||
__overlay__ {
|
||||
|
||||
gpio_led_aux: gpio-led-aux {
|
||||
rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
reset_key: reset-key {
|
||||
rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
fragment@2 {
|
||||
target = <&gpio_keys>;
|
||||
__overlay__ {
|
||||
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&reset_key>;
|
||||
|
||||
reset {
|
||||
gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>;
|
||||
label = "reset";
|
||||
linux,code = <KEY_RESTART>;
|
||||
debounce-interval = <200>;
|
||||
wakeup-source;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
64
patch/kernel/archive/rk322x-6.6/overlay/rk322x-led-conf3.dts
Executable file
64
patch/kernel/archive/rk322x-6.6/overlay/rk322x-led-conf3.dts
Executable file
@ -0,0 +1,64 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/pinctrl/rockchip.h>
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target-path = "/gpio-leds";
|
||||
__overlay__ {
|
||||
|
||||
working {
|
||||
gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>;
|
||||
linux,default-trigger = "none";
|
||||
};
|
||||
|
||||
auxiliary {
|
||||
gpios = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>;
|
||||
label = "auxiliary";
|
||||
linux,default-trigger = "mmc2";
|
||||
default-state = "off";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&gpio_led_aux>;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target-path = "/pinctrl/gpio-items";
|
||||
__overlay__ {
|
||||
|
||||
gpio_led_aux: gpio-led-aux {
|
||||
rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
reset_key: reset-key {
|
||||
rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
fragment@2 {
|
||||
target = <&gpio_keys>;
|
||||
__overlay__ {
|
||||
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&reset_key>;
|
||||
|
||||
reset {
|
||||
gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>;
|
||||
label = "reset";
|
||||
linux,code = <KEY_RESTART>;
|
||||
debounce-interval = <200>;
|
||||
wakeup-source;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
96
patch/kernel/archive/rk322x-6.6/overlay/rk322x-led-conf4.dts
Normal file
96
patch/kernel/archive/rk322x-6.6/overlay/rk322x-led-conf4.dts
Normal file
@ -0,0 +1,96 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/pinctrl/rockchip.h>
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target-path = "/gpio-leds";
|
||||
__overlay__ {
|
||||
|
||||
working {
|
||||
gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>;
|
||||
linux,default-trigger = "none";
|
||||
};
|
||||
|
||||
auxiliary {
|
||||
gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_HIGH>;
|
||||
label = "auxiliary";
|
||||
linux,default-trigger = "mmc2";
|
||||
default-state = "off";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&gpio_led_aux>;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target-path = "/pinctrl/gpio-items";
|
||||
__overlay__ {
|
||||
|
||||
gpio_led_working: gpio-led-working {
|
||||
rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
gpio_led_aux: gpio-led-aux {
|
||||
rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
fragment@2 {
|
||||
target = <&gpio_keys>;
|
||||
__overlay__ {
|
||||
|
||||
reset {
|
||||
gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>;
|
||||
label = "reset";
|
||||
linux,code = <KEY_RESTART>;
|
||||
debounce-interval = <200>;
|
||||
wakeup-source;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
fragment@3 {
|
||||
target = <&sdio_pwrseq>;
|
||||
__overlay__ {
|
||||
|
||||
reset-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>; /* GPIO2_D3 */
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
fragment@4 {
|
||||
target = <&wifi_enable_h>;
|
||||
__overlay__ {
|
||||
|
||||
rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
fragment@5 {
|
||||
target = <&sdio>;
|
||||
__overlay__ {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
wifi@1 {
|
||||
compatible = "esp,esp8089";
|
||||
reg = <1>;
|
||||
esp,crystal-26M-en = <0>;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
97
patch/kernel/archive/rk322x-6.6/overlay/rk322x-led-conf5.dts
Executable file
97
patch/kernel/archive/rk322x-6.6/overlay/rk322x-led-conf5.dts
Executable file
@ -0,0 +1,97 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/pinctrl/rockchip.h>
|
||||
|
||||
/*
|
||||
* gpio configuration for AEMS IPB900 boards
|
||||
*
|
||||
* - enables working and auxiliary leds
|
||||
* - fixes low strength on sdio pins for wifi
|
||||
*/
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target-path = "/gpio-leds";
|
||||
__overlay__ {
|
||||
|
||||
working {
|
||||
gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>;
|
||||
linux,default-trigger = "none";
|
||||
};
|
||||
|
||||
auxiliary {
|
||||
gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_LOW>;
|
||||
label = "auxiliary";
|
||||
linux,default-trigger = "mmc2";
|
||||
default-state = "off";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&gpio_led_aux>;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target-path = "/pinctrl/gpio-items";
|
||||
__overlay__ {
|
||||
|
||||
gpio_led_aux: gpio-led-aux {
|
||||
rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
reset_key: reset-key {
|
||||
rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
fragment@2 {
|
||||
target = <&gpio_keys>;
|
||||
__overlay__ {
|
||||
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&reset_key>;
|
||||
|
||||
reset {
|
||||
gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>;
|
||||
label = "reset";
|
||||
linux,code = <KEY_RESTART>;
|
||||
debounce-interval = <200>;
|
||||
wakeup-source;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
fragment@3 {
|
||||
target = <&sdio_bus4>;
|
||||
__overlay__ {
|
||||
rockchip,pins = <3 2 1 &pcfg_pull_none_8ma>,
|
||||
<3 3 1 &pcfg_pull_none_8ma>,
|
||||
<3 4 1 &pcfg_pull_none_8ma>,
|
||||
<3 5 1 &pcfg_pull_none_8ma>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
fragment@4 {
|
||||
target = <&sdio_clk>;
|
||||
__overlay__ {
|
||||
rockchip,pins = <3 0 1 &pcfg_pull_none_8ma>;
|
||||
};
|
||||
};
|
||||
|
||||
fragment@5 {
|
||||
target = <&sdio_cmd>;
|
||||
__overlay__ {
|
||||
rockchip,pins = <3 1 1 &pcfg_pull_none_8ma>;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
96
patch/kernel/archive/rk322x-6.6/overlay/rk322x-led-conf6.dts
Normal file
96
patch/kernel/archive/rk322x-6.6/overlay/rk322x-led-conf6.dts
Normal file
@ -0,0 +1,96 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/pinctrl/rockchip.h>
|
||||
|
||||
/*
|
||||
* gpio configuration for MXQ_PRO eMCP boards
|
||||
*
|
||||
* - fixes low strength on sdio pins for wifi
|
||||
* - correct gpio pins for wifi
|
||||
* - set emmc pins and default phase shift
|
||||
*/
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target-path = "/pinctrl/gpio-items";
|
||||
__overlay__ {
|
||||
|
||||
reset_key: reset-key {
|
||||
rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target = <&gpio_keys>;
|
||||
__overlay__ {
|
||||
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&reset_key>;
|
||||
|
||||
reset {
|
||||
gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>;
|
||||
label = "reset";
|
||||
linux,code = <KEY_RESTART>;
|
||||
debounce-interval = <200>;
|
||||
wakeup-source;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
fragment@2 {
|
||||
target = <&sdio_bus4>;
|
||||
__overlay__ {
|
||||
rockchip,pins = <3 2 1 &pcfg_pull_up>,
|
||||
<3 3 1 &pcfg_pull_up>,
|
||||
<3 4 1 &pcfg_pull_up>,
|
||||
<3 5 1 &pcfg_pull_up>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
fragment@3 {
|
||||
target = <&sdio_clk>;
|
||||
__overlay__ {
|
||||
rockchip,pins = <3 0 1 &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
|
||||
fragment@4 {
|
||||
target = <&sdio_cmd>;
|
||||
__overlay__ {
|
||||
rockchip,pins = <3 1 1 &pcfg_pull_up>;
|
||||
};
|
||||
};
|
||||
|
||||
fragment@5 {
|
||||
target = <&sdio_pwrseq>;
|
||||
__overlay__ {
|
||||
post-power-on-delay-ms = <300>;
|
||||
power-off-delay-us = <200000>;
|
||||
reset-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
|
||||
fragment@6 {
|
||||
target = <&sdio>;
|
||||
__overlay__ {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
wifi@1 {
|
||||
compatible = "esp,esp8089";
|
||||
reg = <1>;
|
||||
esp,crystal-26M-en = <1>;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
180
patch/kernel/archive/rk322x-6.6/overlay/rk322x-led-conf7.dts
Normal file
180
patch/kernel/archive/rk322x-6.6/overlay/rk322x-led-conf7.dts
Normal file
@ -0,0 +1,180 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/pinctrl/rockchip.h>
|
||||
|
||||
/*
|
||||
* gpio configuration for R29_MXQ boards
|
||||
*
|
||||
*/
|
||||
|
||||
&{/gpio-leds} {
|
||||
|
||||
working {
|
||||
gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_HIGH>;
|
||||
linux,default-trigger = "none";
|
||||
pinctrl-0 = <&gpio_led_working>;
|
||||
};
|
||||
|
||||
auxiliary {
|
||||
gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>;
|
||||
label = "auxiliary";
|
||||
linux,default-trigger = "mmc2";
|
||||
default-state = "off";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&gpio_led_auxiliary>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
&{/pinctrl/gpio-items} {
|
||||
|
||||
gpio_led_working: gpio-led-working {
|
||||
rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
gpio_led_auxiliary: gpio-led-auxiliary {
|
||||
rockchip,pins = <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
gpio_led_ethlink: gpio-led-ethlink{
|
||||
rockchip,pins = <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
gpio_led_ethled: gpio-led-ethled{
|
||||
rockchip,pins = <2 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
reset_key: reset-key {
|
||||
rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
&gpio_keys {
|
||||
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&reset_key>;
|
||||
|
||||
reset {
|
||||
gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>;
|
||||
label = "reset";
|
||||
linux,code = <KEY_RESTART>;
|
||||
debounce-interval = <200>;
|
||||
wakeup-source;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
&emmc {
|
||||
|
||||
rockchip,default-sample-phase = <112>;
|
||||
bus-width = <8>;
|
||||
clock-frequency = <125000000>;
|
||||
max-frequency = <125000000>;
|
||||
|
||||
};
|
||||
|
||||
&vdd_arm {
|
||||
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vdd_arm";
|
||||
regulator-min-microvolt = <1200000>;
|
||||
regulator-max-microvolt = <1200000>;
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
vin-supply = <&vcc_sys>;
|
||||
|
||||
};
|
||||
|
||||
&vdd_log {
|
||||
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vdd_log";
|
||||
regulator-min-microvolt = <1200000>;
|
||||
regulator-max-microvolt = <1200000>;
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
vin-supply = <&vcc_sys>;
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* R29, R2B ad H20 boards require a GPIO to be turned low to enable HDMI output, we simulate it
|
||||
* here as a regulator that must be always on.
|
||||
* Also these boards don't have the necessary power regulators for CPU and Logic.
|
||||
* R29 and R2B have a single power regulator fixed to 1.2v, hence the CPU can't go over 1.0 ghz
|
||||
*/
|
||||
&{/} {
|
||||
|
||||
vdd_hdmi_phy: vdd-hdmi-phy-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
gpio = <&gpio2 RK_PB3 GPIO_ACTIVE_LOW>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&hdmi_phy_enable>;
|
||||
regulator-name = "vdd-hdmi-phy";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
vin-supply = <&vcc_sys>;
|
||||
};
|
||||
|
||||
cpu_opp_table_r29: cpu-opp-table-r29 {
|
||||
compatible = "operating-points-v2";
|
||||
opp-shared;
|
||||
|
||||
opp-600000000 {
|
||||
opp-hz = /bits/ 64 <600000000>;
|
||||
opp-microvolt = <1200000>;
|
||||
clock-latency-ns = <40000>;
|
||||
opp-suspend;
|
||||
};
|
||||
|
||||
opp-816000000 {
|
||||
opp-hz = /bits/ 64 <816000000>;
|
||||
opp-microvolt = <1200000>;
|
||||
};
|
||||
|
||||
opp-1008000000 {
|
||||
opp-hz = /bits/ 64 <1008000000>;
|
||||
opp-microvolt = <1200000>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
&pinctrl {
|
||||
|
||||
hdmi-phy {
|
||||
hdmi_phy_enable: hdmi-phy-enable {
|
||||
rockchip,pins = <2 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
&pwm1 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&pwm2 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&cpu0 {
|
||||
operating-points-v2 = <&cpu_opp_table_r29>;
|
||||
};
|
||||
|
||||
&cpu1 {
|
||||
operating-points-v2 = <&cpu_opp_table_r29>;
|
||||
};
|
||||
|
||||
&cpu2 {
|
||||
operating-points-v2 = <&cpu_opp_table_r29>;
|
||||
};
|
||||
|
||||
&cpu3 {
|
||||
operating-points-v2 = <&cpu_opp_table_r29>;
|
||||
};
|
||||
109
patch/kernel/archive/rk322x-6.6/overlay/rk322x-led-conf8.dts
Normal file
109
patch/kernel/archive/rk322x-6.6/overlay/rk322x-led-conf8.dts
Normal file
@ -0,0 +1,109 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/pinctrl/rockchip.h>
|
||||
|
||||
/*
|
||||
* gpio configuration for H20_221_V1.71 boards
|
||||
*
|
||||
*/
|
||||
|
||||
&{/gpio-leds} {
|
||||
|
||||
working {
|
||||
gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_HIGH>;
|
||||
linux,default-trigger = "none";
|
||||
pinctrl-0 = <&gpio_led_working>;
|
||||
};
|
||||
|
||||
auxiliary {
|
||||
gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>;
|
||||
label = "auxiliary";
|
||||
linux,default-trigger = "mmc2";
|
||||
default-state = "off";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&gpio_led_auxiliary>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
&{/pinctrl/gpio-items} {
|
||||
|
||||
gpio_led_working: gpio-led-working {
|
||||
rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
gpio_led_auxiliary: gpio-led-auxiliary {
|
||||
rockchip,pins = <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
gpio_led_ethlink: gpio-led-ethlink{
|
||||
rockchip,pins = <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
gpio_led_ethled: gpio-led-ethled{
|
||||
rockchip,pins = <2 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
reset_key: reset-key {
|
||||
rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
&gpio_keys {
|
||||
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&reset_key>;
|
||||
|
||||
reset {
|
||||
gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>;
|
||||
label = "reset";
|
||||
linux,code = <KEY_RESTART>;
|
||||
debounce-interval = <200>;
|
||||
wakeup-source;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
&emmc {
|
||||
|
||||
rockchip,default-sample-phase = <112>;
|
||||
bus-width = <8>;
|
||||
clock-frequency = <125000000>;
|
||||
max-frequency = <125000000>;
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* R29, R2B ad H20 boards require a GPIO to be turned low to enable HDMI output, we simulate it
|
||||
* here as a regulator that must be always on.
|
||||
* Also these boards don't have the necessary power regulators for CPU and Logic.
|
||||
* R29 and R2B have a single power regulator fixed to 1.2v, hence the CPU can't go over 1.0 ghz
|
||||
*/
|
||||
&{/} {
|
||||
|
||||
vdd_hdmi_phy: vdd-hdmi-phy-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
gpio = <&gpio2 RK_PB3 GPIO_ACTIVE_LOW>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&hdmi_phy_enable>;
|
||||
regulator-name = "vdd-hdmi-phy";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
vin-supply = <&vcc_sys>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
&pinctrl {
|
||||
|
||||
hdmi-phy {
|
||||
hdmi_phy_enable: hdmi-phy-enable {
|
||||
rockchip,pins = <2 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
22
patch/kernel/archive/rk322x-6.6/overlay/rk322x-nand.dts
Executable file
22
patch/kernel/archive/rk322x-6.6/overlay/rk322x-nand.dts
Executable file
@ -0,0 +1,22 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target = <&nfc>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&flash_cs0 &flash_cs1 &flash_cs2 &flash_cs3 &flash_rdy &flash_ale &flash_cle &flash_wrn &flash_bus8 &flash_dqs &flash_wp>;
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target = <&emmc>;
|
||||
__overlay__ {
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
@ -0,0 +1,11 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/*
|
||||
* change OTG USB port mode to "peripheral"
|
||||
*
|
||||
*/
|
||||
|
||||
&usb_otg {
|
||||
dr_mode = "peripheral";
|
||||
};
|
||||
67
patch/kernel/archive/rk322x-6.6/overlay/rk322x-wlan-alt-wiring.dts
Executable file
67
patch/kernel/archive/rk322x-6.6/overlay/rk322x-wlan-alt-wiring.dts
Executable file
@ -0,0 +1,67 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/pinctrl/rockchip.h>
|
||||
|
||||
/ {
|
||||
|
||||
fragment@0 {
|
||||
target = <&pinctrl>;
|
||||
__overlay__ {
|
||||
|
||||
pcfg_pull_none_drv_4ma: pcfg-pull-none-drv-4ma {
|
||||
bias-disable;
|
||||
drive-strength = <0x04>;
|
||||
};
|
||||
|
||||
pcfg_pull_up_drv_4ma: pcfg-pull-up-drv-4ma {
|
||||
bias-pull-up;
|
||||
drive-strength = <0x04>;
|
||||
};
|
||||
|
||||
sdio {
|
||||
sdio_clk: sdio-clk {
|
||||
rockchip,pins = <1 0 1 &pcfg_pull_none_drv_4ma>;
|
||||
};
|
||||
|
||||
sdio_cmd: sdio-cmd {
|
||||
rockchip,pins = <0 3 2 &pcfg_pull_up_drv_4ma>;
|
||||
};
|
||||
|
||||
sdio_bus4: sdio-bus4 {
|
||||
rockchip,pins = <1 1 1 &pcfg_pull_up_drv_4ma>,
|
||||
<1 2 1 &pcfg_pull_up_drv_4ma>,
|
||||
<1 4 1 &pcfg_pull_up_drv_4ma>,
|
||||
<1 5 1 &pcfg_pull_up_drv_4ma>;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target = <&sdio_pwrseq>;
|
||||
__overlay__ {
|
||||
reset-gpios = <&gpio2 RK_PD5 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
};
|
||||
|
||||
fragment@2 {
|
||||
target = <&wifi_enable_h>;
|
||||
__overlay__ {
|
||||
rockchip,pins = <2 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
|
||||
fragment@3 {
|
||||
target = <&sdio>;
|
||||
__overlay__ {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&sdio_clk &sdio_cmd &sdio_bus4>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
@ -0,0 +1,45 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Thu, 10 Feb 2022 21:30:54 +0000
|
||||
Subject: add broadcom bcm43342 chip id
|
||||
|
||||
---
|
||||
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 ++
|
||||
drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 1 +
|
||||
2 files changed, 3 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
|
||||
index 6b38d9de71af..6a603d045103 100644
|
||||
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
|
||||
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
|
||||
@@ -609,6 +609,7 @@ BRCMF_FW_DEF(4329, "brcmfmac4329-sdio");
|
||||
BRCMF_FW_DEF(4330, "brcmfmac4330-sdio");
|
||||
BRCMF_FW_DEF(4334, "brcmfmac4334-sdio");
|
||||
BRCMF_FW_DEF(43340, "brcmfmac43340-sdio");
|
||||
+BRCMF_FW_DEF(43342, "brcmfmac43342-sdio");
|
||||
BRCMF_FW_DEF(4335, "brcmfmac4335-sdio");
|
||||
BRCMF_FW_DEF(43362, "brcmfmac43362-sdio");
|
||||
BRCMF_FW_DEF(4339, "brcmfmac4339-sdio");
|
||||
@@ -642,6 +643,7 @@ static const struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = {
|
||||
BRCMF_FW_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334),
|
||||
BRCMF_FW_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340),
|
||||
BRCMF_FW_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43340),
|
||||
+ BRCMF_FW_ENTRY(BRCM_CC_43342_CHIP_ID, 0xFFFFFFFF, 43342),
|
||||
BRCMF_FW_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335),
|
||||
BRCMF_FW_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362),
|
||||
BRCMF_FW_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339),
|
||||
diff --git a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
|
||||
index 44684bf1b9ac..bcf48de78d53 100644
|
||||
--- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
|
||||
+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
|
||||
@@ -27,6 +27,7 @@
|
||||
#define BRCM_CC_4334_CHIP_ID 0x4334
|
||||
#define BRCM_CC_43340_CHIP_ID 43340
|
||||
#define BRCM_CC_43341_CHIP_ID 43341
|
||||
+#define BRCM_CC_43342_CHIP_ID 43342
|
||||
#define BRCM_CC_43362_CHIP_ID 43362
|
||||
#define BRCM_CC_4335_CHIP_ID 0x4335
|
||||
#define BRCM_CC_4339_CHIP_ID 0x4339
|
||||
--
|
||||
Armbian
|
||||
|
||||
49482
patch/kernel/archive/rk322x-6.6/wifi-4003-ssv-6051-driver.patch
Normal file
49482
patch/kernel/archive/rk322x-6.6/wifi-4003-ssv-6051-driver.patch
Normal file
File diff suppressed because it is too large
Load Diff
10931
patch/kernel/archive/rk322x-6.6/wifi-4004-esp8089-kernel-driver.patch
Normal file
10931
patch/kernel/archive/rk322x-6.6/wifi-4004-esp8089-kernel-driver.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,131 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Sun, 17 Feb 2019 22:14:38 +0000
|
||||
Subject: [PATCH] mmc: core: set initial signal voltage on power off
|
||||
|
||||
Some boards have SD card connectors where the power rail cannot be switched
|
||||
off by the driver. If the card has not been power cycled, it may still be
|
||||
using 1.8V signaling after a warm re-boot. Bootroms expecting 3.3V signaling
|
||||
will fail to boot from a UHS card that continue to use 1.8V signaling.
|
||||
|
||||
Set initial signal voltage in mmc_power_off() to allow re-boot to function.
|
||||
|
||||
This fixes re-boot with UHS cards on Asus Tinker Board (Rockchip RK3288),
|
||||
same issue have been seen on some Rockchip RK3399 boards.
|
||||
|
||||
I am sending this as a RFC because I have no insights into SD/MMC subsystem,
|
||||
this change fix a re-boot issue on my boards and does not break emmc/sdio.
|
||||
Is this an acceptable workaround? Any advice is appreciated.
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
drivers/mmc/core/core.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
|
||||
index ef53a2578824..d4c53074154a 100644
|
||||
--- a/drivers/mmc/core/core.c
|
||||
+++ b/drivers/mmc/core/core.c
|
||||
@@ -1358,6 +1358,14 @@ void mmc_power_off(struct mmc_host *host)
|
||||
if (host->ios.power_mode == MMC_POWER_OFF)
|
||||
return;
|
||||
|
||||
+ mmc_set_initial_signal_voltage(host);
|
||||
+
|
||||
+ /*
|
||||
+ * This delay should be sufficient to allow the power supply
|
||||
+ * to reach the minimum voltage.
|
||||
+ */
|
||||
+ mmc_delay(host->ios.power_delay_ms);
|
||||
+
|
||||
mmc_pwrseq_power_off(host);
|
||||
|
||||
host->ios.clock = 0;
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Wed, 23 Jun 2021 16:59:18 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: Add sdmmc_ext for RK3328
|
||||
|
||||
RK3328 SoC has a fourth mmc controller called SDMMC_EXT. Some
|
||||
boards have sdio wifi connected to it. In order to use it
|
||||
one would have to add the pinctrls from sdmmc0ext group which
|
||||
is done on board level.
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328.dtsi | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
index 49ae15708a0b..60348d517efb 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
@@ -993,6 +993,20 @@ usb_host0_ohci: usb@ff5d0000 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ sdmmc_ext: mmc@ff5f0000 {
|
||||
+ compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc";
|
||||
+ reg = <0x0 0xff5f0000 0x0 0x4000>;
|
||||
+ interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru HCLK_SDMMC_EXT>, <&cru SCLK_SDMMC_EXT>,
|
||||
+ <&cru SCLK_SDMMC_EXT_DRV>, <&cru SCLK_SDMMC_EXT_SAMPLE>;
|
||||
+ clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
|
||||
+ fifo-depth = <0x100>;
|
||||
+ max-frequency = <150000000>;
|
||||
+ resets = <&cru SRST_SDMMCEXT>;
|
||||
+ reset-names = "reset";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
usbdrd3: usb@ff600000 {
|
||||
compatible = "rockchip,rk3328-dwc3", "snps,dwc3";
|
||||
reg = <0x0 0xff600000 0x0 0x100000>;
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Wed, 23 Jun 2021 17:02:08 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: Add sdmmc/sdio/emmc reset controls for
|
||||
RK3328
|
||||
|
||||
The DW MCI controller driver will use them to reset the IP block before
|
||||
initialisation.
|
||||
|
||||
Fixes: d717f7352ec6 ("arm64: dts: rockchip: add sdmmc/sdio/emmc nodes for RK3328 SoCs")
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328.dtsi | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
index 60348d517efb..d7e44d174d7b 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
@@ -871,6 +871,8 @@ sdmmc: mmc@ff500000 {
|
||||
clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
|
||||
fifo-depth = <0x100>;
|
||||
max-frequency = <150000000>;
|
||||
+ resets = <&cru SRST_MMC0>;
|
||||
+ reset-names = "reset";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -883,6 +885,8 @@ sdio: mmc@ff510000 {
|
||||
clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
|
||||
fifo-depth = <0x100>;
|
||||
max-frequency = <150000000>;
|
||||
+ resets = <&cru SRST_SDIO>;
|
||||
+ reset-names = "reset";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -895,6 +899,8 @@ emmc: mmc@ff520000 {
|
||||
clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
|
||||
fifo-depth = <0x100>;
|
||||
max-frequency = <150000000>;
|
||||
+ resets = <&cru SRST_EMMC>;
|
||||
+ reset-names = "reset";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -0,0 +1,659 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Mon, 6 Jul 2020 21:54:35 +0000
|
||||
Subject: [PATCH] media: v4l2-common: Add helpers to calculate bytesperline and
|
||||
sizeimage
|
||||
|
||||
Add helper functions to calculate plane bytesperline and sizeimage, these
|
||||
new helpers consider block width and height when calculating plane
|
||||
bytesperline and sizeimage.
|
||||
|
||||
This prepare support for new pixel formats added in next patch that make
|
||||
use of block width and height.
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
drivers/media/v4l2-core/v4l2-common.c | 77 +++++++++++++--------------
|
||||
1 file changed, 38 insertions(+), 39 deletions(-)
|
||||
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
|
||||
index e0fbe6ba4b6c..cb2f1acab7cf 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-common.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-common.c
|
||||
@@ -338,6 +338,33 @@ static inline unsigned int v4l2_format_block_height(const struct v4l2_format_inf
|
||||
return info->block_h[plane];
|
||||
}
|
||||
|
||||
+static inline unsigned int v4l2_format_plane_width(const struct v4l2_format_info *info, int plane,
|
||||
+ unsigned int width)
|
||||
+{
|
||||
+ unsigned int hdiv = plane ? info->hdiv : 1;
|
||||
+ unsigned int bytes = DIV_ROUND_UP(width * info->bpp[plane],
|
||||
+ v4l2_format_block_width(info, plane) *
|
||||
+ v4l2_format_block_height(info, plane));
|
||||
+
|
||||
+ return DIV_ROUND_UP(bytes, hdiv);
|
||||
+}
|
||||
+
|
||||
+static inline unsigned int v4l2_format_plane_height(const struct v4l2_format_info *info, int plane,
|
||||
+ unsigned int height)
|
||||
+{
|
||||
+ unsigned int vdiv = plane ? info->vdiv : 1;
|
||||
+ unsigned int lines = ALIGN(height, v4l2_format_block_height(info, plane));
|
||||
+
|
||||
+ return DIV_ROUND_UP(lines, vdiv);
|
||||
+}
|
||||
+
|
||||
+static inline unsigned int v4l2_format_plane_size(const struct v4l2_format_info *info, int plane,
|
||||
+ unsigned int width, unsigned int height)
|
||||
+{
|
||||
+ return v4l2_format_plane_width(info, plane, width) *
|
||||
+ v4l2_format_plane_height(info, plane, height);
|
||||
+}
|
||||
+
|
||||
void v4l2_apply_frmsize_constraints(u32 *width, u32 *height,
|
||||
const struct v4l2_frmsize_stepwise *frmsize)
|
||||
{
|
||||
@@ -373,37 +400,19 @@ int v4l2_fill_pixfmt_mp(struct v4l2_pix_format_mplane *pixfmt,
|
||||
|
||||
if (info->mem_planes == 1) {
|
||||
plane = &pixfmt->plane_fmt[0];
|
||||
- plane->bytesperline = ALIGN(width, v4l2_format_block_width(info, 0)) * info->bpp[0] / info->bpp_div[0];
|
||||
+ plane->bytesperline = v4l2_format_plane_width(info, 0, width);
|
||||
plane->sizeimage = 0;
|
||||
|
||||
- for (i = 0; i < info->comp_planes; i++) {
|
||||
- unsigned int hdiv = (i == 0) ? 1 : info->hdiv;
|
||||
- unsigned int vdiv = (i == 0) ? 1 : info->vdiv;
|
||||
- unsigned int aligned_width;
|
||||
- unsigned int aligned_height;
|
||||
-
|
||||
- aligned_width = ALIGN(width, v4l2_format_block_width(info, i));
|
||||
- aligned_height = ALIGN(height, v4l2_format_block_height(info, i));
|
||||
-
|
||||
- plane->sizeimage += info->bpp[i] *
|
||||
- DIV_ROUND_UP(aligned_width, hdiv) *
|
||||
- DIV_ROUND_UP(aligned_height, vdiv) / info->bpp_div[i];
|
||||
- }
|
||||
+ for (i = 0; i < info->comp_planes; i++)
|
||||
+ plane->sizeimage +=
|
||||
+ v4l2_format_plane_size(info, i, width, height);
|
||||
} else {
|
||||
for (i = 0; i < info->comp_planes; i++) {
|
||||
- unsigned int hdiv = (i == 0) ? 1 : info->hdiv;
|
||||
- unsigned int vdiv = (i == 0) ? 1 : info->vdiv;
|
||||
- unsigned int aligned_width;
|
||||
- unsigned int aligned_height;
|
||||
-
|
||||
- aligned_width = ALIGN(width, v4l2_format_block_width(info, i));
|
||||
- aligned_height = ALIGN(height, v4l2_format_block_height(info, i));
|
||||
-
|
||||
plane = &pixfmt->plane_fmt[i];
|
||||
plane->bytesperline =
|
||||
- info->bpp[i] * DIV_ROUND_UP(aligned_width, hdiv) / info->bpp_div[i];
|
||||
- plane->sizeimage =
|
||||
- plane->bytesperline * DIV_ROUND_UP(aligned_height, vdiv);
|
||||
+ v4l2_format_plane_width(info, i, width);
|
||||
+ plane->sizeimage = plane->bytesperline *
|
||||
+ v4l2_format_plane_height(info, i, height);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -427,22 +436,12 @@ int v4l2_fill_pixfmt(struct v4l2_pix_format *pixfmt, u32 pixelformat,
|
||||
pixfmt->width = width;
|
||||
pixfmt->height = height;
|
||||
pixfmt->pixelformat = pixelformat;
|
||||
- pixfmt->bytesperline = ALIGN(width, v4l2_format_block_width(info, 0)) * info->bpp[0] / info->bpp_div[0];
|
||||
+ pixfmt->bytesperline = v4l2_format_plane_width(info, 0, width);
|
||||
pixfmt->sizeimage = 0;
|
||||
|
||||
- for (i = 0; i < info->comp_planes; i++) {
|
||||
- unsigned int hdiv = (i == 0) ? 1 : info->hdiv;
|
||||
- unsigned int vdiv = (i == 0) ? 1 : info->vdiv;
|
||||
- unsigned int aligned_width;
|
||||
- unsigned int aligned_height;
|
||||
-
|
||||
- aligned_width = ALIGN(width, v4l2_format_block_width(info, i));
|
||||
- aligned_height = ALIGN(height, v4l2_format_block_height(info, i));
|
||||
-
|
||||
- pixfmt->sizeimage += info->bpp[i] *
|
||||
- DIV_ROUND_UP(aligned_width, hdiv) *
|
||||
- DIV_ROUND_UP(aligned_height, vdiv) / info->bpp_div[i];
|
||||
- }
|
||||
+ for (i = 0; i < info->comp_planes; i++)
|
||||
+ pixfmt->sizeimage +=
|
||||
+ v4l2_format_plane_size(info, i, width, height);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(v4l2_fill_pixfmt);
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Mon, 6 Jul 2020 21:54:36 +0000
|
||||
Subject: [PATCH] media: v4l2: Add NV15 and NV20 pixel formats
|
||||
|
||||
Add NV15 and NV20 pixel formats used by the Rockchip Video Decoder for
|
||||
10-bit buffers.
|
||||
|
||||
NV15 and NV20 is a packed 10-bit 4:2:0/4:2:2 semi-planar Y/UV format
|
||||
similar to P010 and P210 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' and '20' suffix refers to the optimum effective bits per pixel
|
||||
which is achieved when the total number of luminance samples is a multiple
|
||||
of 8 for NV15 and 4 for NV20.
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
drivers/media/v4l2-core/v4l2-common.c | 3 +++
|
||||
drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++
|
||||
include/uapi/linux/videodev2.h | 3 +++
|
||||
3 files changed, 8 insertions(+)
|
||||
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
|
||||
index cb2f1acab7cf..8446a1deffd8 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-common.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-common.c
|
||||
@@ -268,6 +268,9 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
|
||||
{ .format = V4L2_PIX_FMT_NV42, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
|
||||
{ .format = V4L2_PIX_FMT_P010, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 2, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 2, .vdiv = 1 },
|
||||
|
||||
+ { .format = V4L2_PIX_FMT_NV15, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 5, 5, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 2, .vdiv = 2, .block_w = { 4, 2, 0, 0 }, .block_h = { 1, 1, 0, 0 } },
|
||||
+ { .format = V4L2_PIX_FMT_NV20, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 5, 5, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 2, .vdiv = 1, .block_w = { 4, 2, 0, 0 }, .block_h = { 1, 1, 0, 0 } },
|
||||
+
|
||||
{ .format = V4L2_PIX_FMT_YUV410, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 4, .vdiv = 4 },
|
||||
{ .format = V4L2_PIX_FMT_YVU410, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 4, .vdiv = 4 },
|
||||
{ .format = V4L2_PIX_FMT_YUV411P, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 4, .vdiv = 1 },
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
|
||||
index e6fd355a2e92..24771edaa4f2 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
|
||||
@@ -1354,6 +1354,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
|
||||
case V4L2_PIX_FMT_NV42: descr = "Y/VU 4:4:4"; break;
|
||||
case V4L2_PIX_FMT_P010: descr = "10-bit Y/UV 4:2:0"; break;
|
||||
case V4L2_PIX_FMT_P012: descr = "12-bit Y/UV 4:2:0"; break;
|
||||
+ case V4L2_PIX_FMT_NV15: descr = "10-bit Y/UV 4:2:0 (Packed)"; break;
|
||||
+ case V4L2_PIX_FMT_NV20: descr = "10-bit Y/UV 4:2:2 (Packed)"; break;
|
||||
case V4L2_PIX_FMT_NV12_4L4: descr = "Y/UV 4:2:0 (4x4 Linear)"; break;
|
||||
case V4L2_PIX_FMT_NV12_16L16: descr = "Y/UV 4:2:0 (16x16 Linear)"; break;
|
||||
case V4L2_PIX_FMT_NV12_32L32: descr = "Y/UV 4:2:0 (32x32 Linear)"; break;
|
||||
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
|
||||
index 01e630f2ec78..cea44992aea3 100644
|
||||
--- a/include/uapi/linux/videodev2.h
|
||||
+++ b/include/uapi/linux/videodev2.h
|
||||
@@ -628,6 +628,9 @@ struct v4l2_pix_format {
|
||||
#define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/VU 4:4:4 */
|
||||
#define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 24 Y/UV 4:2:0 10-bit per component */
|
||||
|
||||
+#define V4L2_PIX_FMT_NV15 v4l2_fourcc('N', 'V', '1', '5') /* 15 Y/UV 4:2:0 10-bit packed */
|
||||
+#define V4L2_PIX_FMT_NV20 v4l2_fourcc('N', 'V', '2', '0') /* 20 Y/UV 4:2:2 10-bit packed */
|
||||
+
|
||||
/* two non contiguous planes - one Y, one Cr + Cb interleaved */
|
||||
#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/UV 4:2:0 */
|
||||
#define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1') /* 21 Y/VU 4:2:0 */
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Mon, 6 Jul 2020 21:54:36 +0000
|
||||
Subject: [PATCH] media: rkvdec: h264: Use bytesperline and buffer height to
|
||||
calculate stride
|
||||
|
||||
Use bytesperline and buffer height to calculate the strides configured.
|
||||
|
||||
This does not really change anything other than ensuring the bytesperline
|
||||
that is signaled to userspace matches what is configured in HW.
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
drivers/staging/media/rkvdec/rkvdec-h264.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c
|
||||
index 4fc167b42cf0..a8635105e387 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec-h264.c
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec-h264.c
|
||||
@@ -896,9 +896,9 @@ static void config_registers(struct rkvdec_ctx *ctx,
|
||||
dma_addr_t rlc_addr;
|
||||
dma_addr_t refer_addr;
|
||||
u32 rlc_len;
|
||||
- u32 hor_virstride = 0;
|
||||
- u32 ver_virstride = 0;
|
||||
- u32 y_virstride = 0;
|
||||
+ u32 hor_virstride;
|
||||
+ u32 ver_virstride;
|
||||
+ u32 y_virstride;
|
||||
u32 yuv_virstride = 0;
|
||||
u32 offset;
|
||||
dma_addr_t dst_addr;
|
||||
@@ -909,8 +909,8 @@ static void config_registers(struct rkvdec_ctx *ctx,
|
||||
|
||||
f = &ctx->decoded_fmt;
|
||||
dst_fmt = &f->fmt.pix_mp;
|
||||
- hor_virstride = (sps->bit_depth_luma_minus8 + 8) * dst_fmt->width / 8;
|
||||
- ver_virstride = round_up(dst_fmt->height, 16);
|
||||
+ hor_virstride = dst_fmt->plane_fmt[0].bytesperline;
|
||||
+ ver_virstride = dst_fmt->height;
|
||||
y_virstride = hor_virstride * ver_virstride;
|
||||
|
||||
if (sps->chroma_format_idc == 0)
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Mon, 6 Jul 2020 21:54:37 +0000
|
||||
Subject: [PATCH] media: rkvdec: Extract rkvdec_fill_decoded_pixfmt helper
|
||||
method
|
||||
|
||||
This extract setting decoded pixfmt into a helper method, current code is
|
||||
replaced with a call to the new helper method.
|
||||
|
||||
The helper method is also called from a new function in next patch.
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
drivers/staging/media/rkvdec/rkvdec.c | 29 ++++++++++++++-------------
|
||||
1 file changed, 15 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
index 7bab7586918c..40cc791aef26 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec.c
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
@@ -27,6 +27,17 @@
|
||||
#include "rkvdec.h"
|
||||
#include "rkvdec-regs.h"
|
||||
|
||||
+static void rkvdec_fill_decoded_pixfmt(struct rkvdec_ctx *ctx,
|
||||
+ struct v4l2_pix_format_mplane *pix_mp)
|
||||
+{
|
||||
+ v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat,
|
||||
+ pix_mp->width, pix_mp->height);
|
||||
+ pix_mp->plane_fmt[0].sizeimage += 128 *
|
||||
+ DIV_ROUND_UP(pix_mp->width, 16) *
|
||||
+ DIV_ROUND_UP(pix_mp->height, 16);
|
||||
+ pix_mp->field = V4L2_FIELD_NONE;
|
||||
+}
|
||||
+
|
||||
static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl)
|
||||
{
|
||||
struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl);
|
||||
@@ -192,13 +203,9 @@ static void rkvdec_reset_decoded_fmt(struct rkvdec_ctx *ctx)
|
||||
|
||||
rkvdec_reset_fmt(ctx, f, ctx->coded_fmt_desc->decoded_fmts[0]);
|
||||
f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||
- v4l2_fill_pixfmt_mp(&f->fmt.pix_mp,
|
||||
- ctx->coded_fmt_desc->decoded_fmts[0],
|
||||
- ctx->coded_fmt.fmt.pix_mp.width,
|
||||
- ctx->coded_fmt.fmt.pix_mp.height);
|
||||
- f->fmt.pix_mp.plane_fmt[0].sizeimage += 128 *
|
||||
- DIV_ROUND_UP(f->fmt.pix_mp.width, 16) *
|
||||
- DIV_ROUND_UP(f->fmt.pix_mp.height, 16);
|
||||
+ f->fmt.pix_mp.width = ctx->coded_fmt.fmt.pix_mp.width;
|
||||
+ f->fmt.pix_mp.height = ctx->coded_fmt.fmt.pix_mp.height;
|
||||
+ rkvdec_fill_decoded_pixfmt(ctx, &f->fmt.pix_mp);
|
||||
}
|
||||
|
||||
static int rkvdec_enum_framesizes(struct file *file, void *priv,
|
||||
@@ -264,13 +271,7 @@ static int rkvdec_try_capture_fmt(struct file *file, void *priv,
|
||||
&pix_mp->height,
|
||||
&coded_desc->frmsize);
|
||||
|
||||
- v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat,
|
||||
- pix_mp->width, pix_mp->height);
|
||||
- pix_mp->plane_fmt[0].sizeimage +=
|
||||
- 128 *
|
||||
- DIV_ROUND_UP(pix_mp->width, 16) *
|
||||
- DIV_ROUND_UP(pix_mp->height, 16);
|
||||
- pix_mp->field = V4L2_FIELD_NONE;
|
||||
+ rkvdec_fill_decoded_pixfmt(ctx, pix_mp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Mon, 6 Jul 2020 21:54:37 +0000
|
||||
Subject: [PATCH] media: rkvdec: Lock capture pixel format in s_ctrl and s_fmt
|
||||
|
||||
Add an optional valid_fmt operation that should return the valid
|
||||
pixelformat of CAPTURE buffers.
|
||||
|
||||
This is used in next patch to ensure correct pixelformat is used for 10-bit
|
||||
and 4:2:2 content.
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
drivers/staging/media/rkvdec/rkvdec.c | 67 +++++++++++++++++++++++----
|
||||
drivers/staging/media/rkvdec/rkvdec.h | 2 +
|
||||
2 files changed, 61 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
index 40cc791aef26..e93e1cb0f829 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec.c
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
@@ -38,19 +38,56 @@ static void rkvdec_fill_decoded_pixfmt(struct rkvdec_ctx *ctx,
|
||||
pix_mp->field = V4L2_FIELD_NONE;
|
||||
}
|
||||
|
||||
+static u32 rkvdec_valid_fmt(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl)
|
||||
+{
|
||||
+ const struct rkvdec_coded_fmt_desc *coded_desc = ctx->coded_fmt_desc;
|
||||
+
|
||||
+ if (coded_desc->ops->valid_fmt)
|
||||
+ return coded_desc->ops->valid_fmt(ctx, ctrl);
|
||||
+
|
||||
+ return ctx->valid_fmt;
|
||||
+}
|
||||
+
|
||||
static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl)
|
||||
{
|
||||
struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl);
|
||||
const struct rkvdec_coded_fmt_desc *desc = ctx->coded_fmt_desc;
|
||||
|
||||
- if (desc->ops->try_ctrl)
|
||||
- return desc->ops->try_ctrl(ctx, ctrl);
|
||||
+ if (desc->ops->try_ctrl) {
|
||||
+ int ret;
|
||||
+ ret = desc->ops->try_ctrl(ctx, ctrl);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ if (ctx->valid_fmt && ctx->valid_fmt != rkvdec_valid_fmt(ctx, ctrl))
|
||||
+ /* Only current valid format */
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rkvdec_s_ctrl(struct v4l2_ctrl *ctrl)
|
||||
+{
|
||||
+ struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl);
|
||||
+
|
||||
+ if (ctrl->id == V4L2_CID_STATELESS_H264_SPS && !ctx->valid_fmt) {
|
||||
+ ctx->valid_fmt = rkvdec_valid_fmt(ctx, ctrl);
|
||||
+ if (ctx->valid_fmt) {
|
||||
+ struct v4l2_pix_format_mplane *pix_mp;
|
||||
+
|
||||
+ pix_mp = &ctx->decoded_fmt.fmt.pix_mp;
|
||||
+ pix_mp->pixelformat = ctx->valid_fmt;
|
||||
+ rkvdec_fill_decoded_pixfmt(ctx, pix_mp);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct v4l2_ctrl_ops rkvdec_ctrl_ops = {
|
||||
.try_ctrl = rkvdec_try_ctrl,
|
||||
+ .s_ctrl = rkvdec_s_ctrl,
|
||||
};
|
||||
|
||||
static const struct rkvdec_ctrl_desc rkvdec_h264_ctrl_descs[] = {
|
||||
@@ -201,6 +238,7 @@ static void rkvdec_reset_decoded_fmt(struct rkvdec_ctx *ctx)
|
||||
{
|
||||
struct v4l2_format *f = &ctx->decoded_fmt;
|
||||
|
||||
+ ctx->valid_fmt = 0;
|
||||
rkvdec_reset_fmt(ctx, f, ctx->coded_fmt_desc->decoded_fmts[0]);
|
||||
f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||
f->fmt.pix_mp.width = ctx->coded_fmt.fmt.pix_mp.width;
|
||||
@@ -256,13 +294,17 @@ static int rkvdec_try_capture_fmt(struct file *file, void *priv,
|
||||
if (WARN_ON(!coded_desc))
|
||||
return -EINVAL;
|
||||
|
||||
- for (i = 0; i < coded_desc->num_decoded_fmts; i++) {
|
||||
- if (coded_desc->decoded_fmts[i] == pix_mp->pixelformat)
|
||||
- break;
|
||||
- }
|
||||
+ if (ctx->valid_fmt) {
|
||||
+ pix_mp->pixelformat = ctx->valid_fmt;
|
||||
+ } else {
|
||||
+ for (i = 0; i < coded_desc->num_decoded_fmts; i++) {
|
||||
+ if (coded_desc->decoded_fmts[i] == pix_mp->pixelformat)
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
- if (i == coded_desc->num_decoded_fmts)
|
||||
- pix_mp->pixelformat = coded_desc->decoded_fmts[0];
|
||||
+ if (i == coded_desc->num_decoded_fmts)
|
||||
+ pix_mp->pixelformat = coded_desc->decoded_fmts[0];
|
||||
+ }
|
||||
|
||||
/* Always apply the frmsize constraint of the coded end. */
|
||||
pix_mp->width = max(pix_mp->width, ctx->coded_fmt.fmt.pix_mp.width);
|
||||
@@ -326,6 +368,7 @@ static int rkvdec_s_capture_fmt(struct file *file, void *priv,
|
||||
return ret;
|
||||
|
||||
ctx->decoded_fmt = *f;
|
||||
+ ctx->valid_fmt = f->fmt.pix_mp.pixelformat;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -429,6 +472,14 @@ static int rkvdec_enum_capture_fmt(struct file *file, void *priv,
|
||||
if (WARN_ON(!ctx->coded_fmt_desc))
|
||||
return -EINVAL;
|
||||
|
||||
+ if (ctx->valid_fmt) {
|
||||
+ if (f->index)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ f->pixelformat = ctx->valid_fmt;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
if (f->index >= ctx->coded_fmt_desc->num_decoded_fmts)
|
||||
return -EINVAL;
|
||||
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h
|
||||
index 633335ebb9c4..b9e219438bc9 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec.h
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec.h
|
||||
@@ -66,6 +66,7 @@ vb2_to_rkvdec_decoded_buf(struct vb2_buffer *buf)
|
||||
struct rkvdec_coded_fmt_ops {
|
||||
int (*adjust_fmt)(struct rkvdec_ctx *ctx,
|
||||
struct v4l2_format *f);
|
||||
+ u32 (*valid_fmt)(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl);
|
||||
int (*start)(struct rkvdec_ctx *ctx);
|
||||
void (*stop)(struct rkvdec_ctx *ctx);
|
||||
int (*run)(struct rkvdec_ctx *ctx);
|
||||
@@ -101,6 +102,7 @@ struct rkvdec_ctx {
|
||||
struct v4l2_fh fh;
|
||||
struct v4l2_format coded_fmt;
|
||||
struct v4l2_format decoded_fmt;
|
||||
+ u32 valid_fmt;
|
||||
const struct rkvdec_coded_fmt_desc *coded_fmt_desc;
|
||||
struct v4l2_ctrl_handler ctrl_hdl;
|
||||
struct rkvdec_dev *dev;
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Mon, 6 Jul 2020 21:54:37 +0000
|
||||
Subject: [PATCH] media: rkvdec: h264: Support High 10 and 4:2:2 profiles
|
||||
|
||||
Add support and enable decoding of H264 High 10 and 4:2:2 profiles.
|
||||
|
||||
Decoded CAPTURE buffer width is aligned to 64 pixels to accommodate HW
|
||||
requirement on 10-bit format buffers.
|
||||
|
||||
The new valid_fmt operation is implemented and return a valid pixelformat
|
||||
for the provided SPS control.
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
drivers/staging/media/rkvdec/rkvdec-h264.c | 33 ++++++++++++++++------
|
||||
drivers/staging/media/rkvdec/rkvdec.c | 19 +++++++++----
|
||||
2 files changed, 37 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c
|
||||
index a8635105e387..0069d3d198db 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec-h264.c
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec-h264.c
|
||||
@@ -1031,19 +1031,14 @@ static int rkvdec_h264_validate_sps(struct rkvdec_ctx *ctx,
|
||||
{
|
||||
unsigned int width, height;
|
||||
|
||||
- /*
|
||||
- * 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 */
|
||||
+ if (sps->chroma_format_idc > 2)
|
||||
+ /* Only 4:0:0, 4:2:0 and 4:2:2 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 */
|
||||
+ if (sps->bit_depth_luma_minus8 != 0 && sps->bit_depth_luma_minus8 != 2)
|
||||
+ /* Only 8-bit and 10-bit is supported */
|
||||
return -EINVAL;
|
||||
|
||||
width = (sps->pic_width_in_mbs_minus1 + 1) * 16;
|
||||
@@ -1064,6 +1059,25 @@ static int rkvdec_h264_validate_sps(struct rkvdec_ctx *ctx,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static u32 rkvdec_h264_valid_fmt(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl)
|
||||
+{
|
||||
+ const struct v4l2_ctrl_h264_sps *sps = ctrl->p_new.p_h264_sps;
|
||||
+
|
||||
+ if (sps->bit_depth_luma_minus8 == 0) {
|
||||
+ if (sps->chroma_format_idc == 2)
|
||||
+ return V4L2_PIX_FMT_NV16;
|
||||
+ else
|
||||
+ return V4L2_PIX_FMT_NV12;
|
||||
+ } else if (sps->bit_depth_luma_minus8 == 2) {
|
||||
+ if (sps->chroma_format_idc == 2)
|
||||
+ return V4L2_PIX_FMT_NV20;
|
||||
+ else
|
||||
+ return V4L2_PIX_FMT_NV15;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int rkvdec_h264_start(struct rkvdec_ctx *ctx)
|
||||
{
|
||||
struct rkvdec_dev *rkvdec = ctx->dev;
|
||||
@@ -1185,6 +1199,7 @@ static int rkvdec_h264_try_ctrl(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl)
|
||||
|
||||
const struct rkvdec_coded_fmt_ops rkvdec_h264_fmt_ops = {
|
||||
.adjust_fmt = rkvdec_h264_adjust_fmt,
|
||||
+ .valid_fmt = rkvdec_h264_valid_fmt,
|
||||
.start = rkvdec_h264_start,
|
||||
.stop = rkvdec_h264_stop,
|
||||
.run = rkvdec_h264_run,
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
index e93e1cb0f829..4f5436c89e08 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec.c
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
@@ -31,7 +31,7 @@ static void rkvdec_fill_decoded_pixfmt(struct rkvdec_ctx *ctx,
|
||||
struct v4l2_pix_format_mplane *pix_mp)
|
||||
{
|
||||
v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat,
|
||||
- pix_mp->width, pix_mp->height);
|
||||
+ ALIGN(pix_mp->width, 64), pix_mp->height);
|
||||
pix_mp->plane_fmt[0].sizeimage += 128 *
|
||||
DIV_ROUND_UP(pix_mp->width, 16) *
|
||||
DIV_ROUND_UP(pix_mp->height, 16);
|
||||
@@ -136,8 +136,11 @@ static const struct rkvdec_ctrls rkvdec_h264_ctrls = {
|
||||
.num_ctrls = ARRAY_SIZE(rkvdec_h264_ctrl_descs),
|
||||
};
|
||||
|
||||
-static const u32 rkvdec_h264_vp9_decoded_fmts[] = {
|
||||
+static const u32 rkvdec_h264_decoded_fmts[] = {
|
||||
V4L2_PIX_FMT_NV12,
|
||||
+ V4L2_PIX_FMT_NV15,
|
||||
+ V4L2_PIX_FMT_NV16,
|
||||
+ V4L2_PIX_FMT_NV20,
|
||||
};
|
||||
|
||||
static const struct rkvdec_ctrl_desc rkvdec_vp9_ctrl_descs[] = {
|
||||
@@ -160,6 +163,10 @@ static const struct rkvdec_ctrls rkvdec_vp9_ctrls = {
|
||||
.num_ctrls = ARRAY_SIZE(rkvdec_vp9_ctrl_descs),
|
||||
};
|
||||
|
||||
+static const u32 rkvdec_vp9_decoded_fmts[] = {
|
||||
+ V4L2_PIX_FMT_NV12,
|
||||
+};
|
||||
+
|
||||
static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = {
|
||||
{
|
||||
.fourcc = V4L2_PIX_FMT_H264_SLICE,
|
||||
@@ -173,8 +180,8 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = {
|
||||
},
|
||||
.ctrls = &rkvdec_h264_ctrls,
|
||||
.ops = &rkvdec_h264_fmt_ops,
|
||||
- .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_vp9_decoded_fmts),
|
||||
- .decoded_fmts = rkvdec_h264_vp9_decoded_fmts,
|
||||
+ .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_decoded_fmts),
|
||||
+ .decoded_fmts = rkvdec_h264_decoded_fmts,
|
||||
.subsystem_flags = VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF,
|
||||
},
|
||||
{
|
||||
@@ -189,8 +196,8 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = {
|
||||
},
|
||||
.ctrls = &rkvdec_vp9_ctrls,
|
||||
.ops = &rkvdec_vp9_fmt_ops,
|
||||
- .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_vp9_decoded_fmts),
|
||||
- .decoded_fmts = rkvdec_h264_vp9_decoded_fmts,
|
||||
+ .num_decoded_fmts = ARRAY_SIZE(rkvdec_vp9_decoded_fmts),
|
||||
+ .decoded_fmts = rkvdec_vp9_decoded_fmts,
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Sun, 27 Mar 2022 14:18:07 +0200
|
||||
Subject: [PATCH] media: rkvdec-h264: Don't hardcode SPS/PPS parameters
|
||||
|
||||
Some SPS/PPS parameters are currently hardcoded in the driver
|
||||
even though so do exist in the uapi which is stable by now.
|
||||
|
||||
Use them instead of hardcoding them.
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
drivers/staging/media/rkvdec/rkvdec-h264.c | 13 +++++++------
|
||||
1 file changed, 7 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c
|
||||
index 0069d3d198db..2c27acaba85e 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec-h264.c
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec-h264.c
|
||||
@@ -655,13 +655,14 @@ static void assemble_hw_pps(struct rkvdec_ctx *ctx,
|
||||
|
||||
#define WRITE_PPS(value, field) set_ps_field(hw_ps->info, field, value)
|
||||
/* write sps */
|
||||
- WRITE_PPS(0xf, SEQ_PARAMETER_SET_ID);
|
||||
- WRITE_PPS(0xff, PROFILE_IDC);
|
||||
- WRITE_PPS(1, CONSTRAINT_SET3_FLAG);
|
||||
+ WRITE_PPS(sps->seq_parameter_set_id, SEQ_PARAMETER_SET_ID);
|
||||
+ WRITE_PPS(sps->profile_idc, PROFILE_IDC);
|
||||
+ WRITE_PPS((sps->constraint_set_flags & 1 << 3) ? 1 : 0, CONSTRAINT_SET3_FLAG);
|
||||
WRITE_PPS(sps->chroma_format_idc, CHROMA_FORMAT_IDC);
|
||||
WRITE_PPS(sps->bit_depth_luma_minus8, BIT_DEPTH_LUMA);
|
||||
WRITE_PPS(sps->bit_depth_chroma_minus8, BIT_DEPTH_CHROMA);
|
||||
- WRITE_PPS(0, QPPRIME_Y_ZERO_TRANSFORM_BYPASS_FLAG);
|
||||
+ WRITE_PPS(!!(sps->flags & V4L2_H264_SPS_FLAG_QPPRIME_Y_ZERO_TRANSFORM_BYPASS),
|
||||
+ QPPRIME_Y_ZERO_TRANSFORM_BYPASS_FLAG);
|
||||
WRITE_PPS(sps->log2_max_frame_num_minus4, LOG2_MAX_FRAME_NUM_MINUS4);
|
||||
WRITE_PPS(sps->max_num_ref_frames, MAX_NUM_REF_FRAMES);
|
||||
WRITE_PPS(sps->pic_order_cnt_type, PIC_ORDER_CNT_TYPE);
|
||||
@@ -688,8 +689,8 @@ static void assemble_hw_pps(struct rkvdec_ctx *ctx,
|
||||
DIRECT_8X8_INFERENCE_FLAG);
|
||||
|
||||
/* write pps */
|
||||
- WRITE_PPS(0xff, PIC_PARAMETER_SET_ID);
|
||||
- WRITE_PPS(0x1f, PPS_SEQ_PARAMETER_SET_ID);
|
||||
+ WRITE_PPS(pps->pic_parameter_set_id, PIC_PARAMETER_SET_ID);
|
||||
+ WRITE_PPS(pps->seq_parameter_set_id, PPS_SEQ_PARAMETER_SET_ID);
|
||||
WRITE_PPS(!!(pps->flags & V4L2_H264_PPS_FLAG_ENTROPY_CODING_MODE),
|
||||
ENTROPY_CODING_MODE_FLAG);
|
||||
WRITE_PPS(!!(pps->flags & V4L2_H264_PPS_FLAG_BOTTOM_FIELD_PIC_ORDER_IN_FRAME_PRESENT),
|
||||
@ -0,0 +1,236 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Mon, 6 Jul 2020 22:30:13 +0000
|
||||
Subject: [PATCH] drm: drm_fourcc: add NV20 and NV30 YUV formats
|
||||
|
||||
DRM_FORMAT_NV20 and DRM_FORMAT_NV30 formats is the 2x1 and non-subsampled
|
||||
variant of NV15, a 10-bit 2-plane YUV format that 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 '20' and '30' suffix refers to the optimum effective bits per pixel
|
||||
which is achieved when the total number of luminance samples is a multiple
|
||||
of 4.
|
||||
|
||||
V2: Added NV30 format
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
Reviewed-by: Sandy Huang <hjc@rock-chips.com>
|
||||
---
|
||||
drivers/gpu/drm/drm_fourcc.c | 8 ++++++++
|
||||
include/uapi/drm/drm_fourcc.h | 2 ++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
|
||||
index 07741b678798..5ec38456dc5d 100644
|
||||
--- a/drivers/gpu/drm/drm_fourcc.c
|
||||
+++ b/drivers/gpu/drm/drm_fourcc.c
|
||||
@@ -261,6 +261,14 @@ const struct drm_format_info *__drm_format_info(u32 format)
|
||||
.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_NV20, .depth = 0,
|
||||
+ .num_planes = 2, .char_per_block = { 5, 5, 0 },
|
||||
+ .block_w = { 4, 2, 0 }, .block_h = { 1, 1, 0 }, .hsub = 2,
|
||||
+ .vsub = 1, .is_yuv = true },
|
||||
+ { .format = DRM_FORMAT_NV30, .depth = 0,
|
||||
+ .num_planes = 2, .char_per_block = { 5, 5, 0 },
|
||||
+ .block_w = { 4, 2, 0 }, .block_h = { 1, 1, 0 }, .hsub = 1,
|
||||
+ .vsub = 1, .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,
|
||||
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
|
||||
index 0206f812c569..fa49ee98f275 100644
|
||||
--- a/include/uapi/drm/drm_fourcc.h
|
||||
+++ b/include/uapi/drm/drm_fourcc.h
|
||||
@@ -285,6 +285,8 @@ extern "C" {
|
||||
* 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 */
|
||||
+#define DRM_FORMAT_NV20 fourcc_code('N', 'V', '2', '0') /* 2x1 subsampled Cr:Cb plane */
|
||||
+#define DRM_FORMAT_NV30 fourcc_code('N', 'V', '3', '0') /* non-subsampled Cr:Cb plane */
|
||||
|
||||
/*
|
||||
* 2 plane YCbCr MSB aligned
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Mon, 6 Jul 2020 22:30:13 +0000
|
||||
Subject: [PATCH] drm: rockchip: add NV15, NV20 and NV30 support
|
||||
|
||||
Add support for displaying 10-bit 4:2:0 and 4:2:2 formats produced by the
|
||||
Rockchip Video Decoder on RK322X, RK3288, RK3328, RK3368 and RK3399.
|
||||
Also add support for 10-bit 4:4:4 format while at it.
|
||||
|
||||
V2: Added NV30 support
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
Reviewed-by: Sandy Huang <hjc@rock-chips.com>
|
||||
---
|
||||
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 29 +++++++++++++++++--
|
||||
drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 1 +
|
||||
drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 32 +++++++++++++++++----
|
||||
3 files changed, 54 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
|
||||
index d32117633efe..9e71263ac770 100644
|
||||
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
|
||||
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
|
||||
@@ -280,6 +280,18 @@ static bool has_uv_swapped(uint32_t format)
|
||||
}
|
||||
}
|
||||
|
||||
+static bool is_fmt_10(uint32_t format)
|
||||
+{
|
||||
+ switch (format) {
|
||||
+ case DRM_FORMAT_NV15:
|
||||
+ case DRM_FORMAT_NV20:
|
||||
+ case DRM_FORMAT_NV30:
|
||||
+ return true;
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static enum vop_data_format vop_convert_format(uint32_t format)
|
||||
{
|
||||
switch (format) {
|
||||
@@ -295,12 +307,15 @@ static enum vop_data_format vop_convert_format(uint32_t format)
|
||||
case DRM_FORMAT_BGR565:
|
||||
return VOP_FMT_RGB565;
|
||||
case DRM_FORMAT_NV12:
|
||||
+ case DRM_FORMAT_NV15:
|
||||
case DRM_FORMAT_NV21:
|
||||
return VOP_FMT_YUV420SP;
|
||||
case DRM_FORMAT_NV16:
|
||||
+ case DRM_FORMAT_NV20:
|
||||
case DRM_FORMAT_NV61:
|
||||
return VOP_FMT_YUV422SP;
|
||||
case DRM_FORMAT_NV24:
|
||||
+ case DRM_FORMAT_NV30:
|
||||
case DRM_FORMAT_NV42:
|
||||
return VOP_FMT_YUV444SP;
|
||||
default:
|
||||
@@ -954,7 +969,12 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
|
||||
dsp_sty = dest->y1 + crtc->mode.vtotal - crtc->mode.vsync_start;
|
||||
dsp_st = dsp_sty << 16 | (dsp_stx & 0xffff);
|
||||
|
||||
- offset = (src->x1 >> 16) * fb->format->cpp[0];
|
||||
+ if (fb->format->block_w[0])
|
||||
+ offset = (src->x1 >> 16) * fb->format->char_per_block[0] /
|
||||
+ fb->format->block_w[0];
|
||||
+ else
|
||||
+ offset = (src->x1 >> 16) * fb->format->cpp[0];
|
||||
+
|
||||
offset += (src->y1 >> 16) * fb->pitches[0];
|
||||
dma_addr = rk_obj->dma_addr + offset + fb->offsets[0];
|
||||
|
||||
@@ -980,6 +1000,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
|
||||
}
|
||||
|
||||
VOP_WIN_SET(vop, win, format, format);
|
||||
+ VOP_WIN_SET(vop, win, fmt_10, is_fmt_10(fb->format->format));
|
||||
VOP_WIN_SET(vop, win, yrgb_vir, DIV_ROUND_UP(fb->pitches[0], 4));
|
||||
VOP_WIN_SET(vop, win, yrgb_mst, dma_addr);
|
||||
VOP_WIN_YUV2YUV_SET(vop, win_yuv2yuv, y2r_en, is_yuv);
|
||||
@@ -996,7 +1017,11 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
|
||||
uv_obj = fb->obj[1];
|
||||
rk_uv_obj = to_rockchip_obj(uv_obj);
|
||||
|
||||
- offset = (src->x1 >> 16) * bpp / hsub;
|
||||
+ if (fb->format->block_w[1])
|
||||
+ offset = (src->x1 >> 16) * bpp /
|
||||
+ fb->format->block_w[1] / hsub;
|
||||
+ else
|
||||
+ offset = (src->x1 >> 16) * bpp / hsub;
|
||||
offset += (src->y1 >> 16) * fb->pitches[1] / vsub;
|
||||
|
||||
dma_addr = rk_uv_obj->dma_addr + offset + fb->offsets[1];
|
||||
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
|
||||
index 8502849833d9..b6eea31109d5 100644
|
||||
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
|
||||
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
|
||||
@@ -181,6 +181,7 @@ struct vop_win_phy {
|
||||
struct vop_reg enable;
|
||||
struct vop_reg gate;
|
||||
struct vop_reg format;
|
||||
+ struct vop_reg fmt_10;
|
||||
struct vop_reg rb_swap;
|
||||
struct vop_reg uv_swap;
|
||||
struct vop_reg act_info;
|
||||
diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
|
||||
index 014f99e8928e..16e6aa01e400 100644
|
||||
--- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
|
||||
+++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
|
||||
@@ -53,6 +53,23 @@ static const uint32_t formats_win_full[] = {
|
||||
DRM_FORMAT_NV42,
|
||||
};
|
||||
|
||||
+static const uint32_t formats_win_full_10[] = {
|
||||
+ DRM_FORMAT_XRGB8888,
|
||||
+ DRM_FORMAT_ARGB8888,
|
||||
+ DRM_FORMAT_XBGR8888,
|
||||
+ DRM_FORMAT_ABGR8888,
|
||||
+ DRM_FORMAT_RGB888,
|
||||
+ DRM_FORMAT_BGR888,
|
||||
+ DRM_FORMAT_RGB565,
|
||||
+ DRM_FORMAT_BGR565,
|
||||
+ DRM_FORMAT_NV12,
|
||||
+ DRM_FORMAT_NV16,
|
||||
+ DRM_FORMAT_NV24,
|
||||
+ DRM_FORMAT_NV15,
|
||||
+ DRM_FORMAT_NV20,
|
||||
+ DRM_FORMAT_NV30,
|
||||
+};
|
||||
+
|
||||
static const uint64_t format_modifiers_win_full[] = {
|
||||
DRM_FORMAT_MOD_LINEAR,
|
||||
DRM_FORMAT_MOD_INVALID,
|
||||
@@ -621,11 +638,12 @@ static const struct vop_scl_regs rk3288_win_full_scl = {
|
||||
|
||||
static const struct vop_win_phy rk3288_win01_data = {
|
||||
.scl = &rk3288_win_full_scl,
|
||||
- .data_formats = formats_win_full,
|
||||
- .nformats = ARRAY_SIZE(formats_win_full),
|
||||
+ .data_formats = formats_win_full_10,
|
||||
+ .nformats = ARRAY_SIZE(formats_win_full_10),
|
||||
.format_modifiers = format_modifiers_win_full,
|
||||
.enable = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 0),
|
||||
.format = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1),
|
||||
+ .fmt_10 = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 4),
|
||||
.rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12),
|
||||
.uv_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 15),
|
||||
.act_info = VOP_REG(RK3288_WIN0_ACT_INFO, 0x1fff1fff, 0),
|
||||
@@ -756,11 +774,12 @@ static const struct vop_intr rk3368_vop_intr = {
|
||||
|
||||
static const struct vop_win_phy rk3368_win01_data = {
|
||||
.scl = &rk3288_win_full_scl,
|
||||
- .data_formats = formats_win_full,
|
||||
- .nformats = ARRAY_SIZE(formats_win_full),
|
||||
+ .data_formats = formats_win_full_10,
|
||||
+ .nformats = ARRAY_SIZE(formats_win_full_10),
|
||||
.format_modifiers = format_modifiers_win_full,
|
||||
.enable = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 0),
|
||||
.format = VOP_REG(RK3368_WIN0_CTRL0, 0x7, 1),
|
||||
+ .fmt_10 = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 4),
|
||||
.rb_swap = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 12),
|
||||
.uv_swap = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 15),
|
||||
.x_mir_en = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 21),
|
||||
@@ -924,11 +943,12 @@ static const struct vop_win_yuv2yuv_data rk3399_vop_big_win_yuv2yuv_data[] = {
|
||||
|
||||
static const struct vop_win_phy rk3399_win01_data = {
|
||||
.scl = &rk3288_win_full_scl,
|
||||
- .data_formats = formats_win_full,
|
||||
- .nformats = ARRAY_SIZE(formats_win_full),
|
||||
+ .data_formats = formats_win_full_10,
|
||||
+ .nformats = ARRAY_SIZE(formats_win_full_10),
|
||||
.format_modifiers = format_modifiers_win_full_afbc,
|
||||
.enable = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 0),
|
||||
.format = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1),
|
||||
+ .fmt_10 = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 4),
|
||||
.rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12),
|
||||
.uv_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 15),
|
||||
.x_mir_en = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 21),
|
||||
3041
patch/kernel/archive/rockchip-6.6/01-linux-1000-drm-rockchip.patch
Normal file
3041
patch/kernel/archive/rockchip-6.6/01-linux-1000-drm-rockchip.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,542 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Sat, 23 May 2020 10:16:01 +0000
|
||||
Subject: [PATCH] WIP: media: rkvdec: pm runtime dont use autosuspend before
|
||||
disable and cleanup
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
drivers/staging/media/rkvdec/rkvdec.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
index 4f5436c89e08..eaf2f133a264 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec.c
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
@@ -1125,9 +1125,9 @@ static int rkvdec_remove(struct platform_device *pdev)
|
||||
|
||||
cancel_delayed_work_sync(&rkvdec->watchdog_work);
|
||||
|
||||
- rkvdec_v4l2_cleanup(rkvdec);
|
||||
- pm_runtime_disable(&pdev->dev);
|
||||
pm_runtime_dont_use_autosuspend(&pdev->dev);
|
||||
+ pm_runtime_disable(&pdev->dev);
|
||||
+ rkvdec_v4l2_cleanup(rkvdec);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Randy Li <ayaka@soulik.info>
|
||||
Date: Sun, 6 Jan 2019 01:48:37 +0800
|
||||
Subject: [PATCH] soc: rockchip: power-domain: export idle request
|
||||
|
||||
We need to put the power status of HEVC IP into IDLE unless
|
||||
we can't reset that IP or the SoC would crash down.
|
||||
rockchip_pmu_idle_request(dev, true)---> enter idle
|
||||
rockchip_pmu_idle_request(dev, false)---> exit idle
|
||||
|
||||
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
|
||||
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
|
||||
Signed-off-by: Randy Li <ayaka@soulik.info>
|
||||
---
|
||||
drivers/pmdomain/rockchip/pm-domains.c | 23 +++++++++++++++++++++++
|
||||
include/linux/rockchip_pmu.h | 15 +++++++++++++++
|
||||
include/soc/rockchip/pm_domains.h | 6 ++++++
|
||||
3 files changed, 44 insertions(+)
|
||||
create mode 100644 include/linux/rockchip_pmu.h
|
||||
|
||||
diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
|
||||
index 89795abac951..ffb5d62c9d52 100644
|
||||
--- a/drivers/pmdomain/rockchip/pm-domains.c
|
||||
+++ b/drivers/pmdomain/rockchip/pm-domains.c
|
||||
@@ -309,6 +309,29 @@ static int rockchip_pmu_set_idle_request(struct rockchip_pm_domain *pd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+int rockchip_pmu_idle_request(struct device *dev, bool idle)
|
||||
+{
|
||||
+ struct generic_pm_domain *genpd;
|
||||
+ struct rockchip_pm_domain *pd;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (IS_ERR_OR_NULL(dev))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (IS_ERR_OR_NULL(dev->pm_domain))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ genpd = pd_to_genpd(dev->pm_domain);
|
||||
+ pd = to_rockchip_pd(genpd);
|
||||
+
|
||||
+ mutex_lock(&pd->pmu->mutex);
|
||||
+ ret = rockchip_pmu_set_idle_request(pd, idle);
|
||||
+ mutex_unlock(&pd->pmu->mutex);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+EXPORT_SYMBOL(rockchip_pmu_idle_request);
|
||||
+
|
||||
static int rockchip_pmu_save_qos(struct rockchip_pm_domain *pd)
|
||||
{
|
||||
int i;
|
||||
diff --git a/include/linux/rockchip_pmu.h b/include/linux/rockchip_pmu.h
|
||||
new file mode 100644
|
||||
index 000000000000..720b3314e71a
|
||||
--- /dev/null
|
||||
+++ b/include/linux/rockchip_pmu.h
|
||||
@@ -0,0 +1,15 @@
|
||||
+/*
|
||||
+ * pm_domain.h - Definitions and headers related to device power domains.
|
||||
+ *
|
||||
+ * Copyright (C) 2017 Randy Li <ayaka@soulik.info>.
|
||||
+ *
|
||||
+ * This file is released under the GPLv2.
|
||||
+ */
|
||||
+
|
||||
+#ifndef _LINUX_ROCKCHIP_PM_H
|
||||
+#define _LINUX_ROCKCHIP_PM_H
|
||||
+#include <linux/device.h>
|
||||
+
|
||||
+int rockchip_pmu_idle_request(struct device *dev, bool idle);
|
||||
+
|
||||
+#endif /* _LINUX_ROCKCHIP_PM_H */
|
||||
diff --git a/include/soc/rockchip/pm_domains.h b/include/soc/rockchip/pm_domains.h
|
||||
index 7dbd941fc937..c5a59dd71754 100644
|
||||
--- a/include/soc/rockchip/pm_domains.h
|
||||
+++ b/include/soc/rockchip/pm_domains.h
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
int rockchip_pmu_block(void);
|
||||
void rockchip_pmu_unblock(void);
|
||||
+int rockchip_pmu_idle_request(struct device *dev, bool idle);
|
||||
|
||||
#else /* CONFIG_ROCKCHIP_PM_DOMAINS */
|
||||
|
||||
@@ -20,6 +21,11 @@ static inline int rockchip_pmu_block(void)
|
||||
|
||||
static inline void rockchip_pmu_unblock(void) { }
|
||||
|
||||
+static inline int rockchip_pmu_idle_request(struct device *dev, bool idle)
|
||||
+{
|
||||
+ return -ENOTSUPP;
|
||||
+}
|
||||
+
|
||||
#endif /* CONFIG_ROCKCHIP_PM_DOMAINS */
|
||||
|
||||
#endif /* __SOC_ROCKCHIP_PM_DOMAINS_H__ */
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Wed, 20 May 2020 17:04:47 +0200
|
||||
Subject: [PATCH] WIP: media: rkvdec: implement reset controls
|
||||
|
||||
---
|
||||
.../bindings/media/rockchip,vdec.yaml | 19 +++++++
|
||||
drivers/staging/media/rkvdec/rkvdec-regs.h | 5 ++
|
||||
drivers/staging/media/rkvdec/rkvdec.c | 53 +++++++++++++++++++
|
||||
drivers/staging/media/rkvdec/rkvdec.h | 11 +++-
|
||||
4 files changed, 87 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/media/rockchip,vdec.yaml b/Documentation/devicetree/bindings/media/rockchip,vdec.yaml
|
||||
index 3bcfb8e12333..dd6958df1de8 100644
|
||||
--- a/Documentation/devicetree/bindings/media/rockchip,vdec.yaml
|
||||
+++ b/Documentation/devicetree/bindings/media/rockchip,vdec.yaml
|
||||
@@ -53,6 +53,18 @@ properties:
|
||||
iommus:
|
||||
maxItems: 1
|
||||
|
||||
+ resets:
|
||||
+ maxItems: 6
|
||||
+
|
||||
+ reset-names:
|
||||
+ items:
|
||||
+ - const: video_h
|
||||
+ - const: video_a
|
||||
+ - const: video_core
|
||||
+ - const: video_cabac
|
||||
+ - const: niu_a
|
||||
+ - const: niu_h
|
||||
+
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
@@ -60,6 +72,8 @@ required:
|
||||
- clocks
|
||||
- clock-names
|
||||
- power-domains
|
||||
+ - resets
|
||||
+ - reset-names
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
@@ -78,6 +92,11 @@ examples:
|
||||
clock-names = "axi", "ahb", "cabac", "core";
|
||||
power-domains = <&power RK3399_PD_VDU>;
|
||||
iommus = <&vdec_mmu>;
|
||||
+ resets = <&cru SRST_H_VDU>, <&cru SRST_A_VDU>,
|
||||
+ <&cru SRST_VDU_CORE>, <&cru SRST_VDU_CA>,
|
||||
+ <&cru SRST_A_VDU_NOC>, <&cru SRST_H_VDU_NOC>;
|
||||
+ reset-names = "video_h", "video_a", "video_core", "video_cabac",
|
||||
+ "niu_a", "niu_h";
|
||||
};
|
||||
|
||||
...
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec-regs.h b/drivers/staging/media/rkvdec/rkvdec-regs.h
|
||||
index 15b9bee92016..3acc914888f6 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec-regs.h
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec-regs.h
|
||||
@@ -28,6 +28,11 @@
|
||||
#define RKVDEC_SOFTRST_EN_P BIT(20)
|
||||
#define RKVDEC_FORCE_SOFTRESET_VALID BIT(21)
|
||||
#define RKVDEC_SOFTRESET_RDY BIT(22)
|
||||
+#define RKVDEC_ERR_MASK (RKVDEC_BUS_STA \
|
||||
+ | RKVDEC_ERR_STA \
|
||||
+ | RKVDEC_TIMEOUT_STA \
|
||||
+ | RKVDEC_BUF_EMPTY_STA \
|
||||
+ | RKVDEC_COLMV_REF_ERR_STA )
|
||||
|
||||
#define RKVDEC_REG_SYSCTRL 0x008
|
||||
#define RKVDEC_IN_ENDIAN BIT(0)
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
index eaf2f133a264..f55abb7c377f 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec.c
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec.c
|
||||
@@ -10,12 +10,15 @@
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
+#include <linux/delay.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
+#include <linux/reset.h>
|
||||
+#include <linux/rockchip_pmu.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/videodev2.h>
|
||||
#include <linux/workqueue.h>
|
||||
@@ -717,6 +720,11 @@ static void rkvdec_job_finish(struct rkvdec_ctx *ctx,
|
||||
|
||||
pm_runtime_mark_last_busy(rkvdec->dev);
|
||||
pm_runtime_put_autosuspend(rkvdec->dev);
|
||||
+
|
||||
+ if (result == VB2_BUF_STATE_ERROR &&
|
||||
+ rkvdec->reset_mask == RESET_NONE)
|
||||
+ rkvdec->reset_mask |= RESET_SOFT;
|
||||
+
|
||||
rkvdec_job_finish_no_pm(ctx, result);
|
||||
}
|
||||
|
||||
@@ -754,6 +762,33 @@ static void rkvdec_device_run(void *priv)
|
||||
|
||||
if (WARN_ON(!desc))
|
||||
return;
|
||||
+ if (rkvdec->reset_mask != RESET_NONE) {
|
||||
+
|
||||
+ if (rkvdec->reset_mask & RESET_SOFT) {
|
||||
+ writel(RKVDEC_SOFTRST_EN_P,
|
||||
+ rkvdec->regs + RKVDEC_REG_INTERRUPT);
|
||||
+ udelay(RKVDEC_RESET_DELAY);
|
||||
+ if (readl(rkvdec->regs + RKVDEC_REG_INTERRUPT)
|
||||
+ & RKVDEC_SOFTRESET_RDY)
|
||||
+ dev_info_ratelimited(rkvdec->dev,
|
||||
+ "softreset failed\n");
|
||||
+ }
|
||||
+
|
||||
+ if (rkvdec->reset_mask & RESET_HARD) {
|
||||
+ rockchip_pmu_idle_request(rkvdec->dev, true);
|
||||
+ ret = reset_control_assert(rkvdec->rstc);
|
||||
+ if (!ret) {
|
||||
+ udelay(RKVDEC_RESET_DELAY);
|
||||
+ ret = reset_control_deassert(rkvdec->rstc);
|
||||
+ }
|
||||
+ rockchip_pmu_idle_request(rkvdec->dev, false);
|
||||
+ if (ret)
|
||||
+ dev_notice_ratelimited(rkvdec->dev,
|
||||
+ "hardreset failed\n");
|
||||
+ }
|
||||
+ rkvdec->reset_mask = RESET_NONE;
|
||||
+ pm_runtime_suspend(rkvdec->dev);
|
||||
+ }
|
||||
|
||||
ret = pm_runtime_resume_and_get(rkvdec->dev);
|
||||
if (ret < 0) {
|
||||
@@ -1020,6 +1055,11 @@ static irqreturn_t rkvdec_irq_handler(int irq, void *priv)
|
||||
if (cancel_delayed_work(&rkvdec->watchdog_work)) {
|
||||
struct rkvdec_ctx *ctx;
|
||||
|
||||
+ if (state == VB2_BUF_STATE_ERROR) {
|
||||
+ rkvdec->reset_mask |= (status & RKVDEC_ERR_MASK) ?
|
||||
+ RESET_HARD : RESET_SOFT;
|
||||
+ }
|
||||
+
|
||||
ctx = v4l2_m2m_get_curr_priv(rkvdec->m2m_dev);
|
||||
rkvdec_job_finish(ctx, state);
|
||||
}
|
||||
@@ -1037,6 +1077,7 @@ static void rkvdec_watchdog_func(struct work_struct *work)
|
||||
ctx = v4l2_m2m_get_curr_priv(rkvdec->m2m_dev);
|
||||
if (ctx) {
|
||||
dev_err(rkvdec->dev, "Frame processing timed out!\n");
|
||||
+ rkvdec->reset_mask |= RESET_HARD;
|
||||
writel(RKVDEC_IRQ_DIS, rkvdec->regs + RKVDEC_REG_INTERRUPT);
|
||||
writel(0, rkvdec->regs + RKVDEC_REG_SYSCTRL);
|
||||
rkvdec_job_finish(ctx, VB2_BUF_STATE_ERROR);
|
||||
@@ -1105,6 +1146,18 @@ static int rkvdec_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+
|
||||
+ rkvdec->rstc = devm_reset_control_array_get(&pdev->dev, false, true);
|
||||
+ if (IS_ERR(rkvdec->rstc)) {
|
||||
+ dev_err(&pdev->dev,
|
||||
+ "get resets failed %ld\n", PTR_ERR(rkvdec->rstc));
|
||||
+ return PTR_ERR(rkvdec->rstc);
|
||||
+ } else {
|
||||
+ dev_dbg(&pdev->dev,
|
||||
+ "requested %d resets\n",
|
||||
+ reset_control_get_count(&pdev->dev));
|
||||
+ }
|
||||
+
|
||||
pm_runtime_set_autosuspend_delay(&pdev->dev, 100);
|
||||
pm_runtime_use_autosuspend(&pdev->dev);
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h
|
||||
index b9e219438bc9..f02f79c405f0 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec.h
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec.h
|
||||
@@ -11,10 +11,11 @@
|
||||
#ifndef RKVDEC_H_
|
||||
#define RKVDEC_H_
|
||||
|
||||
+#include <linux/clk.h>
|
||||
#include <linux/platform_device.h>
|
||||
+#include <linux/reset.h>
|
||||
#include <linux/videodev2.h>
|
||||
#include <linux/wait.h>
|
||||
-#include <linux/clk.h>
|
||||
|
||||
#include <media/v4l2-ctrls.h>
|
||||
#include <media/v4l2-device.h>
|
||||
@@ -22,6 +23,12 @@
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <media/videobuf2-dma-contig.h>
|
||||
|
||||
+#define RESET_NONE 0
|
||||
+#define RESET_SOFT BIT(0)
|
||||
+#define RESET_HARD BIT(1)
|
||||
+
|
||||
+#define RKVDEC_RESET_DELAY 5
|
||||
+
|
||||
struct rkvdec_ctx;
|
||||
|
||||
struct rkvdec_ctrl_desc {
|
||||
@@ -96,6 +103,8 @@ struct rkvdec_dev {
|
||||
void __iomem *regs;
|
||||
struct mutex vdev_lock; /* serializes ioctls */
|
||||
struct delayed_work watchdog_work;
|
||||
+ struct reset_control *rstc;
|
||||
+ u8 reset_mask;
|
||||
};
|
||||
|
||||
struct rkvdec_ctx {
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Tue, 18 Aug 2020 11:38:04 +0200
|
||||
Subject: [PATCH] WIP: arm64: dts: add resets to vdec for RK3399
|
||||
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 10 +++++++++-
|
||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
index 980b12cb0a49..6e3149e587c5 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
@@ -1062,7 +1062,10 @@ power-domain@RK3399_PD_VCODEC {
|
||||
power-domain@RK3399_PD_VDU {
|
||||
reg = <RK3399_PD_VDU>;
|
||||
clocks = <&cru ACLK_VDU>,
|
||||
- <&cru HCLK_VDU>;
|
||||
+ <&cru HCLK_VDU>,
|
||||
+ <&cru SCLK_VDU_CA>,
|
||||
+ <&cru SCLK_VDU_CORE>;
|
||||
+
|
||||
pm_qos = <&qos_video_m1_r>,
|
||||
<&qos_video_m1_w>;
|
||||
#power-domain-cells = <0>;
|
||||
@@ -1345,6 +1348,11 @@ vdec: video-codec@ff660000 {
|
||||
clock-names = "axi", "ahb", "cabac", "core";
|
||||
iommus = <&vdec_mmu>;
|
||||
power-domains = <&power RK3399_PD_VDU>;
|
||||
+ resets = <&cru SRST_H_VDU>, <&cru SRST_A_VDU>,
|
||||
+ <&cru SRST_VDU_CORE>, <&cru SRST_VDU_CA>,
|
||||
+ <&cru SRST_A_VDU_NOC>, <&cru SRST_H_VDU_NOC>;
|
||||
+ reset-names = "video_h", "video_a", "video_core", "video_cabac",
|
||||
+ "niu_a", "niu_h";
|
||||
};
|
||||
|
||||
vdec_mmu: iommu@ff660480 {
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Fri, 1 Jan 2021 12:11:12 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: fix RK3399 vdec register witdh
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
index 6e3149e587c5..093ebe070775 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
@@ -1341,7 +1341,7 @@ vpu_mmu: iommu@ff650800 {
|
||||
|
||||
vdec: video-codec@ff660000 {
|
||||
compatible = "rockchip,rk3399-vdec";
|
||||
- reg = <0x0 0xff660000 0x0 0x400>;
|
||||
+ reg = <0x0 0xff660000 0x0 0x480>;
|
||||
interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH 0>;
|
||||
clocks = <&cru ACLK_VDU>, <&cru HCLK_VDU>,
|
||||
<&cru SCLK_VDU_CA>, <&cru SCLK_VDU_CORE>;
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Sat, 21 Aug 2021 16:12:36 +0200
|
||||
Subject: [PATCH] media: hantro: rockchip: Increase RK3288's max ACLK
|
||||
|
||||
Required to proper decode H.264@4K
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
drivers/media/platform/verisilicon/rockchip_vpu_hw.c | 14 +++++++++++---
|
||||
1 file changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
|
||||
index 8de6fd2e8eef..002b1a600f93 100644
|
||||
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
|
||||
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
|
||||
@@ -15,7 +15,8 @@
|
||||
#include "rockchip_vpu2_regs.h"
|
||||
|
||||
#define RK3066_ACLK_MAX_FREQ (300 * 1000 * 1000)
|
||||
-#define RK3288_ACLK_MAX_FREQ (400 * 1000 * 1000)
|
||||
+#define RK3288_ACLK_MAX_FREQ (600 * 1000 * 1000)
|
||||
+#define RK3399_ACLK_MAX_FREQ (400 * 1000 * 1000)
|
||||
#define RK3588_ACLK_MAX_FREQ (300 * 1000 * 1000)
|
||||
|
||||
#define ROCKCHIP_VPU981_MIN_SIZE 64
|
||||
@@ -346,13 +347,20 @@ static int rk3066_vpu_hw_init(struct hantro_dev *vpu)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int rockchip_vpu_hw_init(struct hantro_dev *vpu)
|
||||
+static int rk3288_vpu_hw_init(struct hantro_dev *vpu)
|
||||
{
|
||||
/* Bump ACLK to max. possible freq. to improve performance. */
|
||||
clk_set_rate(vpu->clocks[0].clk, RK3288_ACLK_MAX_FREQ);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int rockchip_vpu_hw_init(struct hantro_dev *vpu)
|
||||
+{
|
||||
+ /* Bump ACLK to max. possible freq. to improve performance. */
|
||||
+ clk_set_rate(vpu->clocks[0].clk, RK3399_ACLK_MAX_FREQ);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static void rk3066_vpu_dec_reset(struct hantro_ctx *ctx)
|
||||
{
|
||||
struct hantro_dev *vpu = ctx->dev;
|
||||
@@ -592,7 +600,7 @@ const struct hantro_variant rk3288_vpu_variant = {
|
||||
.codec_ops = rk3288_vpu_codec_ops,
|
||||
.irqs = rockchip_vpu1_irqs,
|
||||
.num_irqs = ARRAY_SIZE(rockchip_vpu1_irqs),
|
||||
- .init = rockchip_vpu_hw_init,
|
||||
+ .init = rk3288_vpu_hw_init,
|
||||
.clk_names = rockchip_vpu_clk_names,
|
||||
.num_clocks = ARRAY_SIZE(rockchip_vpu_clk_names)
|
||||
};
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Sun, 4 Jul 2021 15:19:44 +0200
|
||||
Subject: [PATCH] media: rkvdec: disable QoS for VP9 (corruptions on RK3328
|
||||
otherwise)
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
drivers/staging/media/rkvdec/rkvdec-regs.h | 2 ++
|
||||
drivers/staging/media/rkvdec/rkvdec-vp9.c | 8 ++++++++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec-regs.h b/drivers/staging/media/rkvdec/rkvdec-regs.h
|
||||
index 3acc914888f6..265f5234f4eb 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec-regs.h
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec-regs.h
|
||||
@@ -222,6 +222,8 @@
|
||||
#define RKVDEC_REG_H264_ERR_E 0x134
|
||||
#define RKVDEC_H264_ERR_EN_HIGHBITS(x) ((x) & 0x3fffffff)
|
||||
|
||||
+#define RKVDEC_QOS_CTRL 0x18C
|
||||
+
|
||||
#define RKVDEC_REG_PREF_LUMA_CACHE_COMMAND 0x410
|
||||
#define RKVDEC_REG_PREF_CHR_CACHE_COMMAND 0x450
|
||||
|
||||
diff --git a/drivers/staging/media/rkvdec/rkvdec-vp9.c b/drivers/staging/media/rkvdec/rkvdec-vp9.c
|
||||
index d8c1c0db15c7..a289bc968e91 100644
|
||||
--- a/drivers/staging/media/rkvdec/rkvdec-vp9.c
|
||||
+++ b/drivers/staging/media/rkvdec/rkvdec-vp9.c
|
||||
@@ -802,6 +802,7 @@ static int rkvdec_vp9_run(struct rkvdec_ctx *ctx)
|
||||
struct rkvdec_dev *rkvdec = ctx->dev;
|
||||
struct rkvdec_vp9_run run = { };
|
||||
int ret;
|
||||
+ u32 reg;
|
||||
|
||||
ret = rkvdec_vp9_run_preamble(ctx, &run);
|
||||
if (ret) {
|
||||
@@ -823,6 +824,13 @@ static int rkvdec_vp9_run(struct rkvdec_ctx *ctx)
|
||||
writel(1, rkvdec->regs + RKVDEC_REG_PREF_CHR_CACHE_COMMAND);
|
||||
|
||||
writel(0xe, rkvdec->regs + RKVDEC_REG_STRMD_ERR_EN);
|
||||
+
|
||||
+ /* disable QOS for RK3328 - no effect on other SoCs */
|
||||
+ reg = readl(rkvdec->regs + RKVDEC_QOS_CTRL);
|
||||
+ reg |= 0xFFFF;
|
||||
+ reg &= (~BIT(12));
|
||||
+ writel(reg, rkvdec->regs + RKVDEC_QOS_CTRL);
|
||||
+
|
||||
/* Start decoding! */
|
||||
writel(RKVDEC_INTERRUPT_DEC_E | RKVDEC_CONFIG_DEC_CLK_GATE_E |
|
||||
RKVDEC_TIMEOUT_E | RKVDEC_BUF_EMPTY_E,
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Thu, 16 Jun 2022 13:18:22 +0200
|
||||
Subject: [PATCH] WIP: arm64: dts: add resets to vdec for RK3328
|
||||
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328.dtsi | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
index 5519347232f6..431c4ec198be 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
@@ -674,6 +674,11 @@ vdec: video-codec@ff360000 {
|
||||
assigned-clocks = <&cru ACLK_RKVDEC>, <&cru SCLK_VDEC_CABAC>,
|
||||
<&cru SCLK_VDEC_CORE>;
|
||||
assigned-clock-rates = <400000000>, <400000000>, <300000000>;
|
||||
+ resets = <&cru SRST_VDEC_H>, <&cru SRST_VDEC_A>,
|
||||
+ <&cru SRST_VDEC_CORE>, <&cru SRST_VDEC_CABAC>,
|
||||
+ <&cru SRST_VDEC_NIU_A>, <&cru SRST_VDEC_NIU_H>;
|
||||
+ reset-names = "video_h", "video_a", "video_core", "video_cabac",
|
||||
+ "niu_a", "niu_h";
|
||||
iommus = <&vdec_mmu>;
|
||||
power-domains = <&power RK3328_PD_VIDEO>;
|
||||
};
|
||||
@ -0,0 +1,688 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Wed, 2 Sep 2020 19:52:02 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: add gpu powerdomain, gpu opp-table and
|
||||
cooling cell for RK3328
|
||||
|
||||
Note: since the regulator that supplies the GPU usually also supplies
|
||||
other SoC components, we have to make sure voltage is never lower then
|
||||
1075 mV - also disable 500 MHz for now, since it will crash if rkvdec
|
||||
is running at the same time (voltage to high)
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
.../arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 4 +++
|
||||
.../arm64/boot/dts/rockchip/rk3328-rock64.dts | 4 +++
|
||||
arch/arm64/boot/dts/rockchip/rk3328.dtsi | 35 +++++++++++++++++++
|
||||
3 files changed, 43 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts
|
||||
index aa22a0c22265..51c7723d6762 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts
|
||||
@@ -166,6 +166,10 @@ &gmac2io {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&gpu {
|
||||
+ mali-supply = <&vdd_logic>;
|
||||
+};
|
||||
+
|
||||
&hdmi {
|
||||
status = "okay";
|
||||
};
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
|
||||
index f69a38f42d2d..c198a8a7f95a 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
|
||||
@@ -162,6 +162,10 @@ &gmac2io {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&gpu {
|
||||
+ mali-supply = <&vdd_logic>;
|
||||
+};
|
||||
+
|
||||
&hdmi {
|
||||
status = "okay";
|
||||
};
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
index 431c4ec198be..eec03adf0902 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
@@ -300,6 +300,11 @@ power: power-controller {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
+ power-domain@RK3328_PD_GPU {
|
||||
+ reg = <RK3328_PD_GPU>;
|
||||
+ clocks = <&cru ACLK_GPU>;
|
||||
+ #power-domain-cells = <0>;
|
||||
+ };
|
||||
power-domain@RK3328_PD_HEVC {
|
||||
reg = <RK3328_PD_HEVC>;
|
||||
#power-domain-cells = <0>;
|
||||
@@ -539,6 +544,11 @@ map0 {
|
||||
<&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||
contribution = <4096>;
|
||||
};
|
||||
+ map1 {
|
||||
+ trip = <&target>;
|
||||
+ cooling-device = <&gpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||
+ contribution = <4096>;
|
||||
+ };
|
||||
};
|
||||
};
|
||||
|
||||
@@ -620,7 +630,32 @@ gpu: gpu@ff300000 {
|
||||
"ppmmu1";
|
||||
clocks = <&cru ACLK_GPU>, <&cru ACLK_GPU>;
|
||||
clock-names = "bus", "core";
|
||||
+ operating-points-v2 = <&gpu_opp_table>;
|
||||
+ power-domains = <&power RK3328_PD_GPU>;
|
||||
resets = <&cru SRST_GPU_A>;
|
||||
+ #cooling-cells = <2>;
|
||||
+ };
|
||||
+
|
||||
+ gpu_opp_table: gpu-opp-table {
|
||||
+ compatible = "operating-points-v2";
|
||||
+
|
||||
+ opp-200000000 {
|
||||
+ opp-hz = /bits/ 64 <200000000>;
|
||||
+ opp-microvolt = <1075000>;
|
||||
+ };
|
||||
+ opp-300000000 {
|
||||
+ opp-hz = /bits/ 64 <300000000>;
|
||||
+ opp-microvolt = <1075000>;
|
||||
+ };
|
||||
+ opp-400000000 {
|
||||
+ opp-hz = /bits/ 64 <400000000>;
|
||||
+ opp-microvolt = <1075000>;
|
||||
+ };
|
||||
+ opp-500000000 {
|
||||
+ opp-hz = /bits/ 64 <500000000>;
|
||||
+ opp-microvolt = <1150000>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
};
|
||||
|
||||
h265e_mmu: iommu@ff330200 {
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Tue, 2 Feb 2021 17:22:21 +0200
|
||||
Subject: [PATCH] ARM: dts: RK3288 miqi add hdmi sound nodes
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288-miqi.dts | 20 ++++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
index 713f55e143c6..8d30c49f406e 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
@@ -78,6 +78,21 @@ vcc_sys: vsys-regulator {
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
};
|
||||
+
|
||||
+ sound {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,format = "i2s";
|
||||
+ simple-audio-card,name = "HDMI";
|
||||
+ simple-audio-card,mclk-fs = <512>;
|
||||
+
|
||||
+ simple-audio-card,codec {
|
||||
+ sound-dai = <&hdmi>;
|
||||
+ };
|
||||
+
|
||||
+ simple-audio-card,cpu {
|
||||
+ sound-dai = <&i2s>;
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
&cpu0 {
|
||||
@@ -284,6 +299,11 @@ &i2c5 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&i2s {
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&io_domains {
|
||||
status = "okay";
|
||||
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Fri, 2 Apr 2021 17:54:22 +0200
|
||||
Subject: [PATCH] ARM/arm64: dts: rockchip: align sound card names
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi | 2 +-
|
||||
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi
|
||||
index 09618bb7d872..db9106a3dd22 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi
|
||||
@@ -73,7 +73,7 @@ sdio_pwrseq: sdio-pwrseq {
|
||||
sound {
|
||||
compatible = "simple-audio-card";
|
||||
simple-audio-card,format = "i2s";
|
||||
- simple-audio-card,name = "rockchip,tinker-codec";
|
||||
+ simple-audio-card,name = "HDMI";
|
||||
simple-audio-card,mclk-fs = <512>;
|
||||
|
||||
simple-audio-card,codec {
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
index 093ebe070775..a10fe60b7680 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
@@ -1893,7 +1893,7 @@ hdmi_sound: hdmi-sound {
|
||||
compatible = "simple-audio-card";
|
||||
simple-audio-card,format = "i2s";
|
||||
simple-audio-card,mclk-fs = <256>;
|
||||
- simple-audio-card,name = "hdmi-sound";
|
||||
+ simple-audio-card,name = "HDMI";
|
||||
status = "disabled";
|
||||
|
||||
simple-audio-card,cpu {
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Sun, 25 Mar 2018 22:17:06 +0200
|
||||
Subject: [PATCH] ASoC: hdmi-codec: fix channel allocation
|
||||
|
||||
---
|
||||
sound/soc/codecs/hdmi-codec.c | 113 ++++++++++++++++------------------
|
||||
1 file changed, 52 insertions(+), 61 deletions(-)
|
||||
|
||||
diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
|
||||
index 5679102de91f..f0cd183f7873 100644
|
||||
--- a/sound/soc/codecs/hdmi-codec.c
|
||||
+++ b/sound/soc/codecs/hdmi-codec.c
|
||||
@@ -194,78 +194,69 @@ static const struct snd_pcm_chmap_elem hdmi_codec_8ch_chmaps[] = {
|
||||
*/
|
||||
static const struct hdmi_codec_cea_spk_alloc hdmi_codec_channel_alloc[] = {
|
||||
{ .ca_id = 0x00, .n_ch = 2,
|
||||
- .mask = FL | FR},
|
||||
- /* 2.1 */
|
||||
- { .ca_id = 0x01, .n_ch = 4,
|
||||
- .mask = FL | FR | LFE},
|
||||
- /* Dolby Surround */
|
||||
+ .mask = FL | FR },
|
||||
+ { .ca_id = 0x03, .n_ch = 4,
|
||||
+ .mask = FL | FR | LFE | FC },
|
||||
{ .ca_id = 0x02, .n_ch = 4,
|
||||
.mask = FL | FR | FC },
|
||||
- /* surround51 */
|
||||
+ { .ca_id = 0x01, .n_ch = 4,
|
||||
+ .mask = FL | FR | LFE },
|
||||
{ .ca_id = 0x0b, .n_ch = 6,
|
||||
- .mask = FL | FR | LFE | FC | RL | RR},
|
||||
- /* surround40 */
|
||||
- { .ca_id = 0x08, .n_ch = 6,
|
||||
- .mask = FL | FR | RL | RR },
|
||||
- /* surround41 */
|
||||
- { .ca_id = 0x09, .n_ch = 6,
|
||||
- .mask = FL | FR | LFE | RL | RR },
|
||||
- /* surround50 */
|
||||
+ .mask = FL | FR | LFE | FC | RL | RR },
|
||||
{ .ca_id = 0x0a, .n_ch = 6,
|
||||
.mask = FL | FR | FC | RL | RR },
|
||||
- /* 6.1 */
|
||||
- { .ca_id = 0x0f, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | FC | RL | RR | RC },
|
||||
- /* surround71 */
|
||||
+ { .ca_id = 0x09, .n_ch = 6,
|
||||
+ .mask = FL | FR | LFE | RL | RR },
|
||||
+ { .ca_id = 0x08, .n_ch = 6,
|
||||
+ .mask = FL | FR | RL | RR },
|
||||
+ { .ca_id = 0x07, .n_ch = 6,
|
||||
+ .mask = FL | FR | LFE | FC | RC },
|
||||
+ { .ca_id = 0x06, .n_ch = 6,
|
||||
+ .mask = FL | FR | FC | RC },
|
||||
+ { .ca_id = 0x05, .n_ch = 6,
|
||||
+ .mask = FL | FR | LFE | RC },
|
||||
+ { .ca_id = 0x04, .n_ch = 6,
|
||||
+ .mask = FL | FR | RC },
|
||||
{ .ca_id = 0x13, .n_ch = 8,
|
||||
.mask = FL | FR | LFE | FC | RL | RR | RLC | RRC },
|
||||
- /* others */
|
||||
- { .ca_id = 0x03, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | FC },
|
||||
- { .ca_id = 0x04, .n_ch = 8,
|
||||
- .mask = FL | FR | RC},
|
||||
- { .ca_id = 0x05, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | RC },
|
||||
- { .ca_id = 0x06, .n_ch = 8,
|
||||
- .mask = FL | FR | FC | RC },
|
||||
- { .ca_id = 0x07, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | FC | RC },
|
||||
- { .ca_id = 0x0c, .n_ch = 8,
|
||||
- .mask = FL | FR | RC | RL | RR },
|
||||
- { .ca_id = 0x0d, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | RL | RR | RC },
|
||||
- { .ca_id = 0x0e, .n_ch = 8,
|
||||
- .mask = FL | FR | FC | RL | RR | RC },
|
||||
- { .ca_id = 0x10, .n_ch = 8,
|
||||
- .mask = FL | FR | RL | RR | RLC | RRC },
|
||||
- { .ca_id = 0x11, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | RL | RR | RLC | RRC },
|
||||
+ { .ca_id = 0x1f, .n_ch = 8,
|
||||
+ .mask = FL | FR | LFE | FC | RL | RR | FLC | FRC },
|
||||
{ .ca_id = 0x12, .n_ch = 8,
|
||||
.mask = FL | FR | FC | RL | RR | RLC | RRC },
|
||||
- { .ca_id = 0x14, .n_ch = 8,
|
||||
- .mask = FL | FR | FLC | FRC },
|
||||
- { .ca_id = 0x15, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | FLC | FRC },
|
||||
- { .ca_id = 0x16, .n_ch = 8,
|
||||
- .mask = FL | FR | FC | FLC | FRC },
|
||||
- { .ca_id = 0x17, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | FC | FLC | FRC },
|
||||
- { .ca_id = 0x18, .n_ch = 8,
|
||||
- .mask = FL | FR | RC | FLC | FRC },
|
||||
- { .ca_id = 0x19, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | RC | FLC | FRC },
|
||||
- { .ca_id = 0x1a, .n_ch = 8,
|
||||
- .mask = FL | FR | RC | FC | FLC | FRC },
|
||||
- { .ca_id = 0x1b, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | RC | FC | FLC | FRC },
|
||||
- { .ca_id = 0x1c, .n_ch = 8,
|
||||
- .mask = FL | FR | RL | RR | FLC | FRC },
|
||||
- { .ca_id = 0x1d, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | RL | RR | FLC | FRC },
|
||||
{ .ca_id = 0x1e, .n_ch = 8,
|
||||
.mask = FL | FR | FC | RL | RR | FLC | FRC },
|
||||
- { .ca_id = 0x1f, .n_ch = 8,
|
||||
- .mask = FL | FR | LFE | FC | RL | RR | FLC | FRC },
|
||||
+ { .ca_id = 0x11, .n_ch = 8,
|
||||
+ .mask = FL | FR | LFE | RL | RR | RLC | RRC },
|
||||
+ { .ca_id = 0x1d, .n_ch = 8,
|
||||
+ .mask = FL | FR | LFE | RL | RR | FLC | FRC },
|
||||
+ { .ca_id = 0x10, .n_ch = 8,
|
||||
+ .mask = FL | FR | RL | RR | RLC | RRC },
|
||||
+ { .ca_id = 0x1c, .n_ch = 8,
|
||||
+ .mask = FL | FR | RL | RR | FLC | FRC },
|
||||
+ { .ca_id = 0x0f, .n_ch = 8,
|
||||
+ .mask = FL | FR | LFE | FC | RL | RR | RC },
|
||||
+ { .ca_id = 0x1b, .n_ch = 8,
|
||||
+ .mask = FL | FR | LFE | RC | FC | FLC | FRC },
|
||||
+ { .ca_id = 0x0e, .n_ch = 8,
|
||||
+ .mask = FL | FR | FC | RL | RR | RC },
|
||||
+ { .ca_id = 0x1a, .n_ch = 8,
|
||||
+ .mask = FL | FR | RC | FC | FLC | FRC },
|
||||
+ { .ca_id = 0x0d, .n_ch = 8,
|
||||
+ .mask = FL | FR | LFE | RL | RR | RC },
|
||||
+ { .ca_id = 0x19, .n_ch = 8,
|
||||
+ .mask = FL | FR | LFE | RC | FLC | FRC },
|
||||
+ { .ca_id = 0x0c, .n_ch = 8,
|
||||
+ .mask = FL | FR | RC | RL | RR },
|
||||
+ { .ca_id = 0x18, .n_ch = 8,
|
||||
+ .mask = FL | FR | RC | FLC | FRC },
|
||||
+ { .ca_id = 0x17, .n_ch = 8,
|
||||
+ .mask = FL | FR | LFE | FC | FLC | FRC },
|
||||
+ { .ca_id = 0x16, .n_ch = 8,
|
||||
+ .mask = FL | FR | FC | FLC | FRC },
|
||||
+ { .ca_id = 0x15, .n_ch = 8,
|
||||
+ .mask = FL | FR | LFE | FLC | FRC },
|
||||
+ { .ca_id = 0x14, .n_ch = 8,
|
||||
+ .mask = FL | FR | FLC | FRC },
|
||||
};
|
||||
|
||||
struct hdmi_codec_priv {
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Sat, 27 Feb 2021 17:52:02 +0100
|
||||
Subject: [PATCH] arm64: dts: rockchip: add SPDIF nodes for RK3328 A1 board
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328-a1.dts | 23 ++++++++++++++++++++++
|
||||
1 file changed, 23 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts
|
||||
index 40bf808642b9..27a1799027c2 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts
|
||||
@@ -57,6 +57,24 @@ ir-receiver {
|
||||
gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>;
|
||||
linux,rc-map-name = "rc-beelink-gs1";
|
||||
};
|
||||
+
|
||||
+ spdif_sound: 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_dit>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ spdif_dit: spdif-dit {
|
||||
+ compatible = "linux,spdif-dit";
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ };
|
||||
};
|
||||
|
||||
&analog_sound {
|
||||
@@ -325,6 +343,11 @@ &sdmmc {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&spdif {
|
||||
+ pinctrl-0 = <&spdifm0_tx>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&tsadc {
|
||||
rockchip,hw-tshut-mode = <0>;
|
||||
rockchip,hw-tshut-polarity = <0>;
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Sat, 27 Feb 2021 18:01:13 +0100
|
||||
Subject: [PATCH] arm64: dts: rockchip: Add ir-receiver node for RK3328 ROC CC
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts
|
||||
index 51c7723d6762..cf321302daec 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts
|
||||
@@ -88,6 +88,13 @@ vcc_phy: vcc-phy-regulator {
|
||||
regulator-boot-on;
|
||||
};
|
||||
|
||||
+ ir-receiver {
|
||||
+ compatible = "gpio-ir-receiver";
|
||||
+ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>;
|
||||
+ pinctrl-0 = <&ir_int>;
|
||||
+ pinctrl-names = "default";
|
||||
+ };
|
||||
+
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
@@ -312,6 +319,13 @@ &io_domains {
|
||||
};
|
||||
|
||||
&pinctrl {
|
||||
+
|
||||
+ ir {
|
||||
+ ir_int: ir-int {
|
||||
+ rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
pmic {
|
||||
pmic_int_l: pmic-int-l {
|
||||
rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Mon, 1 Mar 2021 21:24:15 +0100
|
||||
Subject: [PATCH] ARM: dts: add cec pinctrl for RK3288 miqi board
|
||||
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288-miqi.dts | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
index 8d30c49f406e..6d90db5a3b75 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
@@ -145,6 +145,8 @@ &gpu {
|
||||
|
||||
&hdmi {
|
||||
ddc-i2c-bus = <&i2c5>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&hdmi_cec_c0>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Mon, 1 Mar 2021 19:22:15 +0100
|
||||
Subject: [PATCH] HACK: arm64: dts: enable FE phy for Beelink A1 also
|
||||
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328-a1.dts | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts
|
||||
index 27a1799027c2..7de9dfa71d89 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts
|
||||
@@ -147,6 +147,14 @@ rtl8211f: ethernet-phy@0 {
|
||||
};
|
||||
};
|
||||
|
||||
+&gmac2phy {
|
||||
+ clock_in_out = "output";
|
||||
+ assigned-clock-rate = <50000000>;
|
||||
+ assigned-clocks = <&cru SCLK_MAC2PHY>;
|
||||
+ assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&gpu {
|
||||
mali-supply = <&vdd_logic>;
|
||||
};
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Tue, 26 Feb 2019 20:45:14 +0000
|
||||
Subject: [PATCH] WIP: dw-hdmi-cec: sleep 100ms on error
|
||||
|
||||
---
|
||||
drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c | 18 ++++++++++++++++--
|
||||
1 file changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c
|
||||
index c8f44bcb298a..d4280ce4542c 100644
|
||||
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c
|
||||
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c
|
||||
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* Copyright (C) 2015-2017 Russell King.
|
||||
*/
|
||||
+#include <linux/delay.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/module.h>
|
||||
@@ -129,8 +130,15 @@ static irqreturn_t dw_hdmi_cec_hardirq(int irq, void *data)
|
||||
|
||||
dw_hdmi_write(cec, stat, HDMI_IH_CEC_STAT0);
|
||||
|
||||
- if (stat & CEC_STAT_ERROR_INIT) {
|
||||
- cec->tx_status = CEC_TX_STATUS_ERROR;
|
||||
+ /* Status with both done and error_initiator bits have been seen
|
||||
+ * on Rockchip RK3328 devices, transmit attempt seems to have failed
|
||||
+ * when this happens, report as low drive and block cec-framework
|
||||
+ * 100ms before core retransmits the failed message, this seems to
|
||||
+ * mitigate the issue with failed transmit attempts.
|
||||
+ */
|
||||
+ if ((stat & (CEC_STAT_DONE|CEC_STAT_ERROR_INIT)) == (CEC_STAT_DONE|CEC_STAT_ERROR_INIT)) {
|
||||
+ pr_debug("dw_hdmi_cec_hardirq: stat=%02x LOW_DRIVE\n", stat);
|
||||
+ cec->tx_status = CEC_TX_STATUS_LOW_DRIVE;
|
||||
cec->tx_done = true;
|
||||
ret = IRQ_WAKE_THREAD;
|
||||
} else if (stat & CEC_STAT_DONE) {
|
||||
@@ -141,6 +149,10 @@ static irqreturn_t dw_hdmi_cec_hardirq(int irq, void *data)
|
||||
cec->tx_status = CEC_TX_STATUS_NACK;
|
||||
cec->tx_done = true;
|
||||
ret = IRQ_WAKE_THREAD;
|
||||
+ } else if (stat & CEC_STAT_ERROR_INIT) {
|
||||
+ cec->tx_status = CEC_TX_STATUS_ERROR;
|
||||
+ cec->tx_done = true;
|
||||
+ ret = IRQ_WAKE_THREAD;
|
||||
}
|
||||
|
||||
if (stat & CEC_STAT_EOM) {
|
||||
@@ -173,6 +185,8 @@ static irqreturn_t dw_hdmi_cec_thread(int irq, void *data)
|
||||
|
||||
if (cec->tx_done) {
|
||||
cec->tx_done = false;
|
||||
+ if (cec->tx_status == CEC_TX_STATUS_LOW_DRIVE)
|
||||
+ msleep(100);
|
||||
cec_transmit_attempt_done(adap, cec->tx_status);
|
||||
}
|
||||
if (cec->rx_done) {
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Wed, 5 May 2021 19:11:12 +0200
|
||||
Subject: [PATCH] arm64: boot: dts: Increase ACLK_PERILP0 clock rate for RK3399
|
||||
|
||||
As per vendor kernel. Leaving this clock at the lower rate will
|
||||
result in poor DMA controller performance
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
index a10fe60b7680..dbe6a9cb98a5 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
@@ -1477,7 +1477,7 @@ cru: clock-controller@ff760000 {
|
||||
<1000000000>,
|
||||
<150000000>, <75000000>,
|
||||
<37500000>,
|
||||
- <100000000>, <100000000>,
|
||||
+ <300000000>, <100000000>,
|
||||
<50000000>, <600000000>,
|
||||
<100000000>, <50000000>,
|
||||
<400000000>, <400000000>,
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Sat, 21 Aug 2021 17:04:46 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: Enable USB3 for rk3328 Beelink A1
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328-a1.dts | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts
|
||||
index 7de9dfa71d89..e857e5a727f4 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts
|
||||
@@ -389,6 +389,11 @@ &usb_host0_ehci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&usbdrd3 {
|
||||
+ dr_mode = "host";
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&vop {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Sat, 30 Oct 2021 12:19:19 +0200
|
||||
Subject: [PATCH] WIP: drm: bridge: dw-hdmi: switch from .hw_parmas to .prepare
|
||||
for i2s
|
||||
|
||||
Seems to be the only way to get AES bits correctly as set by
|
||||
userspace.
|
||||
TODO: check other consequences.
|
||||
|
||||
Signed-off-by: Alex Bee <knaerzche@gmail.com>
|
||||
---
|
||||
drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
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 a2f0860b20bb..8961f9c7885d 100644
|
||||
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
|
||||
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
|
||||
@@ -34,9 +34,9 @@ static inline u8 hdmi_read(struct dw_hdmi_i2s_audio_data *audio, int offset)
|
||||
return audio->read(hdmi, offset);
|
||||
}
|
||||
|
||||
-static int dw_hdmi_i2s_hw_params(struct device *dev, void *data,
|
||||
- struct hdmi_codec_daifmt *fmt,
|
||||
- struct hdmi_codec_params *hparms)
|
||||
+static int dw_hdmi_i2s_prepare(struct device *dev, void *data,
|
||||
+ struct hdmi_codec_daifmt *fmt,
|
||||
+ struct hdmi_codec_params *hparms)
|
||||
{
|
||||
struct dw_hdmi_i2s_audio_data *audio = data;
|
||||
struct dw_hdmi *hdmi = audio->hdmi;
|
||||
@@ -178,7 +178,7 @@ static int dw_hdmi_i2s_hook_plugged_cb(struct device *dev, void *data,
|
||||
}
|
||||
|
||||
static const struct hdmi_codec_ops dw_hdmi_i2s_ops = {
|
||||
- .hw_params = dw_hdmi_i2s_hw_params,
|
||||
+ .prepare = dw_hdmi_i2s_prepare,
|
||||
.audio_startup = dw_hdmi_i2s_audio_startup,
|
||||
.audio_shutdown = dw_hdmi_i2s_audio_shutdown,
|
||||
.get_eld = dw_hdmi_i2s_get_eld,
|
||||
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Bee <knaerzche@gmail.com>
|
||||
Date: Sun, 18 Sep 2022 10:35:52 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: Disbake fusb for rk3399-roc-pc
|
||||
|
||||
As it will lead to an unbootable device in case one if those ports
|
||||
is used to power up the device.
|
||||
See https://lkml.org/lkml/2022/6/20/413
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi
|
||||
index 2f4b1b2e3ac7..7217ead94d39 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi
|
||||
@@ -215,7 +215,7 @@ vdd_log: vdd-log {
|
||||
regulator-name = "vdd_log";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
- regulator-min-microvolt = <450000>;
|
||||
+ regulator-min-microvolt = <430000>;
|
||||
regulator-max-microvolt = <1400000>;
|
||||
pwm-supply = <&vcc3v3_sys>;
|
||||
};
|
||||
@@ -536,7 +536,7 @@ fusb1: usb-typec@22 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&fusb1_int>;
|
||||
vbus-supply = <&vcc_vbus_typec1>;
|
||||
- status = "okay";
|
||||
+ status = "disabled";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -553,7 +553,7 @@ fusb0: usb-typec@22 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&fusb0_int>;
|
||||
vbus-supply = <&vcc_vbus_typec0>;
|
||||
- status = "okay";
|
||||
+ status = "disabled";
|
||||
};
|
||||
|
||||
mp8859: regulator@66 {
|
||||
@ -0,0 +1,63 @@
|
||||
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
|
||||
index 0370bb247fcb..55c0b8dddad5 100644
|
||||
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 2023-06-25 03:23:55.724209412 +0000
|
||||
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 2023-06-25 04:16:27.469899470 +0000
|
||||
@@ -254,35 +245,31 @@
|
||||
const struct drm_display_info *info,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
- struct rockchip_hdmi *hdmi = data;
|
||||
- const struct dw_hdmi_mpll_config *mpll_cfg = rockchip_mpll_cfg;
|
||||
- int pclk = mode->clock * 1000;
|
||||
- bool exact_match = hdmi->plat_data->phy_force_vendor;
|
||||
- int i;
|
||||
-
|
||||
- if (hdmi->ref_clk) {
|
||||
- int rpclk = clk_round_rate(hdmi->ref_clk, pclk);
|
||||
-
|
||||
- if (abs(rpclk - pclk) > pclk / 1000)
|
||||
- return MODE_NOCLOCK;
|
||||
- }
|
||||
-
|
||||
- for (i = 0; mpll_cfg[i].mpixelclock != (~0UL); i++) {
|
||||
- /*
|
||||
- * For vendor specific phys force an exact match of the pixelclock
|
||||
- * to preserve the original behaviour of the driver.
|
||||
- */
|
||||
- if (exact_match && pclk == mpll_cfg[i].mpixelclock)
|
||||
- return MODE_OK;
|
||||
- /*
|
||||
- * The Synopsys phy can work with pixelclocks up to the value given
|
||||
- * in the corresponding mpll_cfg entry.
|
||||
- */
|
||||
- if (!exact_match && pclk <= mpll_cfg[i].mpixelclock)
|
||||
- return MODE_OK;
|
||||
+ struct dw_hdmi_plat_data *pdata = (struct dw_hdmi_plat_data *)data;
|
||||
+ const struct dw_hdmi_mpll_config *mpll_cfg = pdata->mpll_cfg;
|
||||
+ int clock = mode->clock;
|
||||
+ unsigned int i = 0;
|
||||
+
|
||||
+ if (pdata->ycbcr_420_allowed && drm_mode_is_420(info, mode) &&
|
||||
+ (info->color_formats & DRM_COLOR_FORMAT_YCBCR420)) {
|
||||
+ clock /= 2;
|
||||
+ mpll_cfg = pdata->mpll_cfg_420;
|
||||
+ }
|
||||
+
|
||||
+ if ((!mpll_cfg && clock > 340000) ||
|
||||
+ (info->max_tmds_clock && clock > info->max_tmds_clock))
|
||||
+ return MODE_CLOCK_HIGH;
|
||||
+
|
||||
+ if (mpll_cfg) {
|
||||
+ while ((clock * 1000) < mpll_cfg[i].mpixelclock &&
|
||||
+ mpll_cfg[i].mpixelclock != (~0UL))
|
||||
+ i++;
|
||||
+
|
||||
+ if (mpll_cfg[i].mpixelclock == (~0UL))
|
||||
+ return MODE_CLOCK_HIGH;
|
||||
}
|
||||
|
||||
- return MODE_BAD;
|
||||
+ return MODE_OK;
|
||||
}
|
||||
|
||||
static void dw_hdmi_rockchip_encoder_disable(struct drm_encoder *encoder)
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,71 @@
|
||||
From 7f2d6a02498ce3fa7771893072e81b31f9bd64b2 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Fri, 24 Mar 2023 17:15:16 +0000
|
||||
Subject: [PATCH] register act8846 restart handler for SIPC function
|
||||
|
||||
---
|
||||
drivers/regulator/act8865-regulator.c | 27 +++++++++++++++++++++++++++
|
||||
1 file changed, 27 insertions(+)
|
||||
|
||||
diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c
|
||||
index 53f2c75cd..e45ad8430 100644
|
||||
--- a/drivers/regulator/act8865-regulator.c
|
||||
+++ b/drivers/regulator/act8865-regulator.c
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <linux/regulator/of_regulator.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <dt-bindings/regulator/active-semi,8865-regulator.h>
|
||||
+#include <linux/reboot.h>
|
||||
|
||||
/*
|
||||
* ACT8600 Global Register Map.
|
||||
@@ -141,6 +142,8 @@
|
||||
#define ACT8865_VOLTAGE_NUM 64
|
||||
#define ACT8600_SUDCDC_VOLTAGE_NUM 256
|
||||
|
||||
+#define ACT8846_SIPC_MASK 0x01
|
||||
+
|
||||
struct act8865 {
|
||||
struct regmap *regmap;
|
||||
int off_reg;
|
||||
@@ -582,6 +585,22 @@ static void act8865_power_off(void)
|
||||
while (1);
|
||||
}
|
||||
|
||||
+static int act8846_power_cycle(struct notifier_block *this,
|
||||
+ unsigned long code, void *unused)
|
||||
+{
|
||||
+ struct act8865 *act8846;
|
||||
+
|
||||
+ act8846 = i2c_get_clientdata(act8865_i2c_client);
|
||||
+ regmap_write(act8846->regmap, ACT8846_GLB_OFF_CTRL, ACT8846_SIPC_MASK);
|
||||
+
|
||||
+ return NOTIFY_DONE;
|
||||
+}
|
||||
+
|
||||
+static struct notifier_block act8846_restart_handler = {
|
||||
+ .notifier_call = act8846_power_cycle,
|
||||
+ .priority = 129,
|
||||
+};
|
||||
+
|
||||
static int act8600_charger_get_status(struct regmap *map)
|
||||
{
|
||||
unsigned int val;
|
||||
@@ -733,6 +752,14 @@ static int act8865_pmic_probe(struct i2c_client *client)
|
||||
} else {
|
||||
dev_err(dev, "Failed to set poweroff capability, already defined\n");
|
||||
}
|
||||
+
|
||||
+ if (type == ACT8846) {
|
||||
+ act8865_i2c_client = client;
|
||||
+ ret = register_restart_handler(&act8846_restart_handler);
|
||||
+ if (ret)
|
||||
+ pr_err("%s: cannot register restart handler, %d\n",
|
||||
+ __func__, ret);
|
||||
+ }
|
||||
}
|
||||
|
||||
/* Finally register devices */
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
From 604ea7fc311af2b3a41e7fe3b4fbde0ee03dfb9c Mon Sep 17 00:00:00 2001
|
||||
From: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
Date: Thu, 19 Oct 2017 21:09:50 +0200
|
||||
Subject: [PATCH 04/28] dts: rk3288: miqi: Enabling the Mali GPU node
|
||||
|
||||
Why is the MiQi the only one left without a working mali GPU node ?
|
||||
|
||||
Seriously, is there a rk3288 chipset WITHOUT a mali GPU ? Couldn't
|
||||
they enable it once in the DTSI, instead of defining it as "disabled"
|
||||
and enabling it in every DTS file ?
|
||||
|
||||
Signed-off-by: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288-miqi.dts | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
index 4d923aa6..3cd60674 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
@@ -149,6 +149,11 @@
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
+&gpu {
|
||||
+ mali-supply = <&vdd_gpu>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&hdmi {
|
||||
ddc-i2c-bus = <&i2c5>;
|
||||
status = "okay";
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
From 89e5763110ca77d68a4be00cd97a638adc2401d5 Mon Sep 17 00:00:00 2001
|
||||
From: Willy Tarreau <w@1wt.eu>
|
||||
Date: Tue, 2 Aug 2016 08:31:00 +0200
|
||||
Subject: [PATCH 05/28] ARM: dts: rockchip: fix the regulator's voltage range
|
||||
on MiQi board
|
||||
|
||||
The board declared too narrow a voltage range for the CPU and GPU
|
||||
regulators, preventing it from using the full CPU frequency range.
|
||||
The regulators support 712500 to 1500000 microvolts.
|
||||
|
||||
Signed-off-by: Willy Tarreau <w@1wt.eu>
|
||||
(cherry picked from commit 95330e63a9295a2632cee8cce5db80677f01857a)
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288-miqi.dts | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
index 3cd60674..a1c3cdaa 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
@@ -168,8 +168,8 @@
|
||||
fcs,suspend-voltage-selector = <1>;
|
||||
reg = <0x40>;
|
||||
regulator-name = "vdd_cpu";
|
||||
- regulator-min-microvolt = <850000>;
|
||||
- regulator-max-microvolt = <1350000>;
|
||||
+ regulator-min-microvolt = <712500>;
|
||||
+ regulator-max-microvolt = <1500000>;
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-enable-ramp-delay = <300>;
|
||||
@@ -182,8 +182,8 @@
|
||||
fcs,suspend-voltage-selector = <1>;
|
||||
reg = <0x41>;
|
||||
regulator-name = "vdd_gpu";
|
||||
- regulator-min-microvolt = <850000>;
|
||||
- regulator-max-microvolt = <1350000>;
|
||||
+ regulator-min-microvolt = <712500>;
|
||||
+ regulator-max-microvolt = <1500000>;
|
||||
regulator-always-on;
|
||||
vin-supply = <&vcc_sys>;
|
||||
};
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
From c27e445527e949f3ef46d5326066196969c17d23 Mon Sep 17 00:00:00 2001
|
||||
From: Myy <myy@miouyouyou.fr>
|
||||
Date: Sun, 12 Mar 2017 19:43:15 +0000
|
||||
Subject: [PATCH 06/28] ARM: dts: rockchip: add the MiQi board's fan definition
|
||||
|
||||
The MiQi board is sold with an enclosure in which a fan is connected
|
||||
to the second LED output, and configured by default in "heartbeat"
|
||||
mode so that it rotates slowly and increases when the CPU load
|
||||
increases, ensuring appropriate cooling by default. This LED output
|
||||
is called "Fan" in the original kernel and connected to GPIO18
|
||||
(gpiochip 0, pin 18). Here we called it "miqi:green:fan" to stay
|
||||
consistent with the kernel's naming conventions.
|
||||
|
||||
It's worth noting that without this patch the fan doesn't work at
|
||||
all, risking to make the board overheat.
|
||||
|
||||
Fixes: 162718c (v4.7)
|
||||
Cc: Heiko Stuebner <heiko@sntech.de>
|
||||
Signed-off-by: Willy Tarreau <w@1wt.eu>
|
||||
|
||||
Signed-off-by: Myy <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288-miqi.dts | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
index a1c3cdaa..0e383595 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
@@ -67,6 +67,13 @@
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
+ fan {
|
||||
+ gpios = <&gpio0 RK_PC2 GPIO_ACTIVE_HIGH>;
|
||||
+ label = "miqi:green:fan";
|
||||
+ linux,default-trigger = "heartbeat";
|
||||
+ };
|
||||
+
|
||||
+
|
||||
work_led: led-0 {
|
||||
gpios = <&gpio7 RK_PA2 GPIO_ACTIVE_HIGH>;
|
||||
label = "miqi:green:user";
|
||||
--
|
||||
2.11.0
|
||||
@ -0,0 +1,31 @@
|
||||
From 062488e4b8fd552c01e1104b3bc91a6f7ffe6c41 Mon Sep 17 00:00:00 2001
|
||||
From: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
Date: Thu, 19 Oct 2017 21:24:47 +0200
|
||||
Subject: [PATCH 10/28] RK3288: DTSI: rk3288.dtsi: Add missing SPI2 pinctrl
|
||||
|
||||
The spi2_cs1 pin reference is missing in the spi2 first pin control
|
||||
definition.
|
||||
|
||||
This patch is taken from the patches provided by the ARMbian team.
|
||||
|
||||
Signed-off-by: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288.dtsi | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288.dtsi b/arch/arm/boot/dts/rockchip/rk3288.dtsi
|
||||
index 5b789528..9ed532cc 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288.dtsi
|
||||
@@ -334,7 +334,7 @@
|
||||
dma-names = "tx", "rx";
|
||||
interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
|
||||
pinctrl-names = "default";
|
||||
- pinctrl-0 = <&spi2_clk &spi2_tx &spi2_rx &spi2_cs0>;
|
||||
+ pinctrl-0 = <&spi2_clk &spi2_tx &spi2_rx &spi2_cs0 &spi2_cs1>;
|
||||
reg = <0x0 0xff130000 0x0 0x1000>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@ -0,0 +1,98 @@
|
||||
From d5d5c53173c484a13cda62a537cbf75a5df4b0e4 Mon Sep 17 00:00:00 2001
|
||||
From: "Miouyouyou (Myy)" <myy@miouyouyou.fr>
|
||||
Date: Mon, 5 Nov 2018 21:58:56 +0100
|
||||
Subject: [PATCH] ARM: DTS: rk3288-tinker: Enabling SDIO and Wifi
|
||||
|
||||
Adding the appropriate nodes in order to exploit the WiFi capabilities
|
||||
of the board.
|
||||
Since these capabilities are provided through SDIO, and the SDIO
|
||||
nodes were not defined, these were added too.
|
||||
|
||||
These seems to depend on each other so they are added in one big
|
||||
patch.
|
||||
|
||||
Split if necessary.
|
||||
|
||||
Signed-off-by: Miouyouyou (Myy) <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288-tinker.dts | 62 +++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 62 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-tinker.dts b/arch/arm/boot/dts/rockchip/rk3288-tinker.dts
|
||||
index 1e43527aa..d4df13bed 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-tinker.dts
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-tinker.dts
|
||||
@@ -6,8 +6,70 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include "rk3288-tinker.dtsi"
|
||||
+#include <dt-bindings/clock/rockchip,rk808.h>
|
||||
|
||||
/ {
|
||||
model = "Rockchip RK3288 Asus Tinker Board";
|
||||
compatible = "asus,rk3288-tinker", "rockchip,rk3288";
|
||||
+
|
||||
+ /* This is essential to get SDIO devices working.
|
||||
+ The Wifi depends on SDIO ! */
|
||||
+ sdio_pwrseq: sdio-pwrseq {
|
||||
+ compatible = "mmc-pwrseq-simple";
|
||||
+ clocks = <&rk808 RK808_CLKOUT1>;
|
||||
+ clock-names = "ext_clock";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&chip_enable_h>, <&wifi_enable_h>;
|
||||
+
|
||||
+ /*
|
||||
+ * On the module itself this is one of these (depending
|
||||
+ * on the actual card populated):
|
||||
+ * - SDIO_RESET_L_WL_REG_ON
|
||||
+ * - PDN (power down when low)
|
||||
+ */
|
||||
+ reset-gpios = <&gpio4 28 GPIO_ACTIVE_LOW>, <&gpio4 27 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ wireless-wlan {
|
||||
+ compatible = "wlan-platdata";
|
||||
+ rockchip,grf = <&grf>;
|
||||
+ sdio_vref = <1800>;
|
||||
+ status = "okay";
|
||||
+ wifi_chip_type = "8723bs";
|
||||
+ WIFI,host_wake_irq = <&gpio4 30 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&io_domains {
|
||||
+ wifi-supply = <&vcc_18>;
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ sdio-pwrseq {
|
||||
+ wifi_enable_h: wifienable-h {
|
||||
+ rockchip,pins = <4 28 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+
|
||||
+ chip_enable_h: chip-enable-h {
|
||||
+ rockchip,pins = <4 27 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&sdio0 {
|
||||
+ bus-width = <4>;
|
||||
+ cap-sd-highspeed;
|
||||
+ cap-sdio-irq;
|
||||
+ clock-frequency = <50000000>;
|
||||
+ clock-freq-min-max = <200000 50000000>;
|
||||
+ disable-wp;
|
||||
+ keep-power-in-suspend;
|
||||
+ mmc-pwrseq = <&sdio_pwrseq>;
|
||||
+ non-removable;
|
||||
+ num-slots = <1>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
|
||||
+ sd-uhs-sdr104;
|
||||
+ status = "okay";
|
||||
+ supports-sdio;
|
||||
};
|
||||
--
|
||||
2.16.4
|
||||
|
||||
@ -0,0 +1,62 @@
|
||||
From 2c2e60256f2cbb2fce50a6317f85b1500efd1a6c Mon Sep 17 00:00:00 2001
|
||||
From: "Miouyouyou (Myy)" <myy@miouyouyou.fr>
|
||||
Date: Mon, 5 Nov 2018 22:03:26 +0100
|
||||
Subject: [PATCH] ARM: DTS: rk3288-tinker: Setup the Bluetooth UART pins
|
||||
|
||||
The most essential being the RTS pin, which is clearly needed to
|
||||
upload the initial configuration into the Realtek Bluetooth
|
||||
chip, and make the Bluetooth chip work.
|
||||
|
||||
Now, the Bluetooth chip also needs 3 other GPIOS to be enabled.
|
||||
I'll see how I do that through the DTS file in a near future.
|
||||
|
||||
The 3 GPIOS being :
|
||||
Bluetooth Reset : <&gpio4 29 GPIO_ACTIVE_HIGH>
|
||||
Bluetooth Wake : <&gpio4 26 GPIO_ACTIVE_HIGH>
|
||||
Bluetooth Wake_Host_IRQ : <&gpio4 31 GPIO_ACTIVE_HIGH>
|
||||
|
||||
These are currently setup manually, through scripts. But it seems that
|
||||
GPIO handling through /sys entries might not be possible in the long
|
||||
term, the replacement being libgpio.
|
||||
Anyway, if you're interesting in enabling the Bluetooth GPIO by hand,
|
||||
here are the commands :
|
||||
|
||||
cd /sys/class/gpio &&
|
||||
echo 146 > export &&
|
||||
echo 149 > export &&
|
||||
echo 151 > export &&
|
||||
echo high > gpio146/direction &&
|
||||
echo high > gpio149/direction &&
|
||||
echo high > gpio151/direction
|
||||
|
||||
Resetting the chip is done like this :
|
||||
|
||||
echo "Resetting the Bluetooth chip"
|
||||
cd /sys/class/gpio/gpio149 &&
|
||||
echo 0 > value &&
|
||||
sleep 1 &&
|
||||
echo 1 > value &&
|
||||
sleep 1
|
||||
|
||||
Signed-off-by: Miouyouyou (Myy) <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288-tinker.dts | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-tinker.dts b/arch/arm/boot/dts/rockchip/rk3288-tinker.dts
|
||||
index d4df13bed..b92e59c1e 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-tinker.dts
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-tinker.dts
|
||||
@@ -73,3 +73,9 @@
|
||||
status = "okay";
|
||||
supports-sdio;
|
||||
};
|
||||
+
|
||||
+&uart0 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart0_xfer>, <&uart0_cts>, <&uart0_rts>;
|
||||
+};
|
||||
+
|
||||
--
|
||||
2.16.4
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
From ebc29962ac27264772a4227f5abd6900cb72fa79 Mon Sep 17 00:00:00 2001
|
||||
From: "Miouyouyou (Myy)" <myy@miouyouyou.fr>
|
||||
Date: Mon, 5 Nov 2018 20:16:05 +0100
|
||||
Subject: [PATCH] ARM: DTSI: rk3288-tinker: Improving the CPU max voltage
|
||||
|
||||
Taken from the various patches provided by @TonyMac32 .
|
||||
|
||||
Signed-off-by: Miouyouyou (Myy) <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi
|
||||
index aa107ee41..3da1c830f 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi
|
||||
@@ -164,7 +164,7 @@
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <750000>;
|
||||
- regulator-max-microvolt = <1400000>;
|
||||
+ regulator-max-microvolt = <1450000>;
|
||||
regulator-name = "vdd_arm";
|
||||
regulator-ramp-delay = <6000>;
|
||||
regulator-state-mem {
|
||||
--
|
||||
2.16.4
|
||||
|
||||
@ -0,0 +1,53 @@
|
||||
From a72e0749acad92df7b854e38e97e1dc7b4799abe Mon Sep 17 00:00:00 2001
|
||||
From: "Miouyouyou (Myy)" <myy@miouyouyou.fr>
|
||||
Date: Mon, 5 Nov 2018 22:11:24 +0100
|
||||
Subject: [PATCH] ARM: DTS: rk3288-tinker: Defined the I2C interfaces
|
||||
|
||||
And all the hardware behind.
|
||||
|
||||
Taken from @TonyMac32, Butchered by @Miouyouyou .
|
||||
|
||||
Signed-off-by: Miouyouyou (Myy) <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288-tinker.dts | 25 +++++++++++++++++++++++++
|
||||
1 file changed, 25 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-tinker.dts b/arch/arm/boot/dts/rockchip/rk3288-tinker.dts
|
||||
index b92e59c1e..96d05fc6b 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-tinker.dts
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-tinker.dts
|
||||
@@ -40,6 +40,31 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&i2c1 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2c2 {
|
||||
+ afc0:af-controller@0 {
|
||||
+ status = "okay";
|
||||
+ compatible = "silicon touch,vm149C-v4l2-i2c-subdev";
|
||||
+ reg = <0x0 0x0c>;
|
||||
+ };
|
||||
+
|
||||
+ eeprom:m24c08@50 {
|
||||
+ compatible = "at,24c08";
|
||||
+ reg = <0x50>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&i2c3 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2c4 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&io_domains {
|
||||
wifi-supply = <&vcc_18>;
|
||||
};
|
||||
--
|
||||
2.16.4
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
From b24b8f83e150811ad54ee2a4843e44cd1421fafa Mon Sep 17 00:00:00 2001
|
||||
From: "Miouyouyou (Myy)" <myy@miouyouyou.fr>
|
||||
Date: Mon, 5 Nov 2018 22:15:14 +0100
|
||||
Subject: [PATCH] ARM: DTS: rk3288-tinker: Defining the SPI interface
|
||||
|
||||
Taken from, and tested by @TonyMac32 .
|
||||
|
||||
Well, the original one was tested by him but I had to adapt the
|
||||
registers definitions to the new 64-bits LPAE-compliant syntax.
|
||||
|
||||
Therefore that *might* break, along with a few other patches.
|
||||
|
||||
Signed-off-by: Miouyouyou (Myy) <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288-tinker.dts | 19 +++++++++++++++++++
|
||||
1 file changed, 19 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-tinker.dts b/arch/arm/boot/dts/rockchip/rk3288-tinker.dts
|
||||
index 96d05fc6b..17bfea298 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-tinker.dts
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-tinker.dts
|
||||
@@ -99,6 +99,25 @@
|
||||
supports-sdio;
|
||||
};
|
||||
|
||||
+&spi2 {
|
||||
+ max-freq = <50000000>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ spidev@0 {
|
||||
+ compatible = "rockchip,spi_tinker";
|
||||
+ reg = <0x0 0>;
|
||||
+ spi-max-frequency = <50000000>;
|
||||
+ spi-cpha = <1>;
|
||||
+ };
|
||||
+
|
||||
+ spidev@1 {
|
||||
+ compatible = "rockchip,spi_tinker";
|
||||
+ reg = <0x1>;
|
||||
+ spi-max-frequency = <50000000>;
|
||||
+ spi-cpha = <1>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&uart0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart0_xfer>, <&uart0_cts>, <&uart0_rts>;
|
||||
--
|
||||
2.16.4
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
From 487db7cefc9861fdaf30579c378a98f0360690ae Mon Sep 17 00:00:00 2001
|
||||
From: "Miouyouyou (Myy)" <myy@miouyouyou.fr>
|
||||
Date: Mon, 5 Nov 2018 20:27:14 +0100
|
||||
Subject: [PATCH] ARM: DTSI: rk3288-tinker: Defining SDMMC properties
|
||||
|
||||
I never knew if these properties were required to fix the dreaded
|
||||
reboot issue...
|
||||
|
||||
Signed-off-by: Miouyouyou (Myy) <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi
|
||||
index dd1090728..8edd6f681 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi
|
||||
@@ -436,7 +436,12 @@
|
||||
disable-wp; /* wp not hooked up */
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
|
||||
+ sd-uhs-sdr12;
|
||||
+ sd-uhs-sdr25;
|
||||
+ sd-uhs-sdr50;
|
||||
+ sd-uhs-sdr104;
|
||||
status = "okay";
|
||||
+ supports-sd;
|
||||
vmmc-supply = <&vcc33_sd>;
|
||||
vqmmc-supply = <&vccio_sd>;
|
||||
};
|
||||
--
|
||||
2.16.4
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
From 4ab4f88649468dada5d609e1a6f8a71a7d5610c9 Mon Sep 17 00:00:00 2001
|
||||
From: "Miouyouyou (Myy)" <myy@miouyouyou.fr>
|
||||
Date: Sat, 29 Sep 2018 02:48:59 +0200
|
||||
Subject: [PATCH 4/6] dts: rk3288: support for dedicating npll to a vop
|
||||
|
||||
This patch is taken from Urja Rannikko ( @urjaman ) patchset here :
|
||||
https://github.com/urjaman/arch-c201/blob/master/linux-c201/0020-RK3288-HDMI-clock-hacks-combined.patch
|
||||
https://www.spinics.net/lists/arm-kernel/msg673156.html
|
||||
|
||||
The original description was :
|
||||
|
||||
Add the VOP DCLKs to the assigned clocks list so their
|
||||
parents can be set in the dts include files for
|
||||
devices that do dedicate npll to a vop.
|
||||
|
||||
https://www.spinics.net/lists/arm-kernel/msg673162.html
|
||||
|
||||
Signed-off-by: Miouyouyou (Myy) <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288.dtsi | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288.dtsi b/arch/arm/boot/dts/rockchip/rk3288.dtsi
|
||||
index d23c7fa55..ff04aab5e 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288.dtsi
|
||||
@@ -867,12 +867,14 @@
|
||||
rockchip,grf = <&grf>;
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
- assigned-clocks = <&cru PLL_GPLL>, <&cru PLL_CPLL>,
|
||||
+ assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>,
|
||||
+ <&cru PLL_GPLL>, <&cru PLL_CPLL>,
|
||||
<&cru PLL_NPLL>, <&cru ACLK_CPU>,
|
||||
<&cru HCLK_CPU>, <&cru PCLK_CPU>,
|
||||
<&cru ACLK_PERI>, <&cru HCLK_PERI>,
|
||||
<&cru PCLK_PERI>;
|
||||
- assigned-clock-rates = <594000000>, <400000000>,
|
||||
+ assigned-clock-rates = <0>, <0>,
|
||||
+ <594000000>, <400000000>,
|
||||
<500000000>, <300000000>,
|
||||
<150000000>, <75000000>,
|
||||
<300000000>, <150000000>,
|
||||
--
|
||||
2.16.4
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
From 9177b30ab083dbda2bede3b3d61ef71ad4b1ffe0 Mon Sep 17 00:00:00 2001
|
||||
From: "Miouyouyou (Myy)" <myy@miouyouyou.fr>
|
||||
Date: Thu, 1 Nov 2018 21:31:26 +0100
|
||||
Subject: [PATCH 2/2] arm: dts: veyron: Added a flag to disable cache flush
|
||||
during reset
|
||||
|
||||
Flushing the MMC cache of ASUS Chromebooks during initialization or
|
||||
"recovery" generates 10 minutes hangup, according to @SolidHal.
|
||||
|
||||
This is an adaptation of @SolidHal, in order to pinpoint the fix to
|
||||
Veyron Chromebooks, and avoiding issues other RK3288 boards.
|
||||
|
||||
Signed-off-by: Miouyouyou (Myy) <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288-veyron.dtsi | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-veyron.dtsi b/arch/arm/boot/dts/rockchip/rk3288-veyron.dtsi
|
||||
index 2075120cf..fa4951fd7 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-veyron.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-veyron.dtsi
|
||||
@@ -123,6 +123,7 @@
|
||||
mmc-hs200-1_8v;
|
||||
mmc-pwrseq = <&emmc_pwrseq>;
|
||||
non-removable;
|
||||
+ no-recovery-cache-flush;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>;
|
||||
};
|
||||
--
|
||||
2.16.4
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288.dtsi b/arch/arm/boot/dts/rockchip/rk3288.dtsi
|
||||
index 0cd88774d..07681f1f0 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288.dtsi
|
||||
@@ -420,8 +420,6 @@
|
||||
reg-io-width = <4>;
|
||||
clocks = <&cru SCLK_UART0>, <&cru PCLK_UART0>;
|
||||
clock-names = "baudclk", "apb_pclk";
|
||||
- dmas = <&dmac_peri 1>, <&dmac_peri 2>;
|
||||
- dma-names = "tx", "rx";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart0_xfer>;
|
||||
status = "disabled";
|
||||
@@ -435,8 +433,6 @@
|
||||
reg-io-width = <4>;
|
||||
clocks = <&cru SCLK_UART1>, <&cru PCLK_UART1>;
|
||||
clock-names = "baudclk", "apb_pclk";
|
||||
- dmas = <&dmac_peri 3>, <&dmac_peri 4>;
|
||||
- dma-names = "tx", "rx";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart1_xfer>;
|
||||
status = "disabled";
|
||||
@@ -463,8 +459,6 @@
|
||||
reg-io-width = <4>;
|
||||
clocks = <&cru SCLK_UART3>, <&cru PCLK_UART3>;
|
||||
clock-names = "baudclk", "apb_pclk";
|
||||
- dmas = <&dmac_peri 7>, <&dmac_peri 8>;
|
||||
- dma-names = "tx", "rx";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart3_xfer>;
|
||||
status = "disabled";
|
||||
@@ -478,8 +472,6 @@
|
||||
reg-io-width = <4>;
|
||||
clocks = <&cru SCLK_UART4>, <&cru PCLK_UART4>;
|
||||
clock-names = "baudclk", "apb_pclk";
|
||||
- dmas = <&dmac_peri 9>, <&dmac_peri 10>;
|
||||
- dma-names = "tx", "rx";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart4_xfer>;
|
||||
status = "disabled";
|
||||
@ -0,0 +1,42 @@
|
||||
From 73258d32daf3a661281bb5c77c5e2e06c7ff714e Mon Sep 17 00:00:00 2001
|
||||
From: "Miouyouyou (Myy)" <myy@miouyouyou.fr>
|
||||
Date: Fri, 3 Jul 2020 02:02:18 +0200
|
||||
Subject: [PATCH] arm: dtsi: rk3288: add GPU 500 Mhz OPP again
|
||||
|
||||
Undoing the very bizarre mainline kernel patch,
|
||||
75481833c6dbab4c29d15452f6b4337c16f5407b
|
||||
which main purpose is to sync some 3.14 kernels hacks to
|
||||
mainline kernels, for reasons that only matter for a few Chromebooks,
|
||||
and shove it down the throat of every RK3288 user.
|
||||
|
||||
If you need to avoid the GPU going to 500 Mhz on Chromebooks,
|
||||
remove the OPP entry inside the DTS that actually matters to RK3288
|
||||
Chromebooks.
|
||||
|
||||
Meanwhile, the 600 Mhz operating point can prove to be unstable on
|
||||
some RK3288 boards, while 500 Mhz works fine.
|
||||
https://forum.armbian.com/topic/13515-panfrost-on-rk3288-and-gpu-on-600mhz-problems/
|
||||
|
||||
Signed-off-by: Miouyouyou (Myy) <myy@miouyouyou.fr>
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288.dtsi | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288.dtsi b/arch/arm/boot/dts/rockchip/rk3288.dtsi
|
||||
index a66412547..ef7457f79 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288.dtsi
|
||||
@@ -1312,6 +1312,10 @@ opp-400000000 {
|
||||
opp-hz = /bits/ 64 <400000000>;
|
||||
opp-microvolt = <1100000>;
|
||||
};
|
||||
+ opp-500000000 {
|
||||
+ opp-hz = /bits/ 64 <500000000>;
|
||||
+ opp-microvolt = <1200000>;
|
||||
+ };
|
||||
opp-600000000 {
|
||||
opp-hz = /bits/ 64 <600000000>;
|
||||
opp-microvolt = <1250000>;
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
From 0bcc81848ec1fb34fee9d3c7eb1550495cc8efc9 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Sat, 18 Sep 2021 12:31:19 +0000
|
||||
Subject: [PATCH 1/2] rockchip: enable hevc, hevc_mmu and rga nodes for
|
||||
tinkerboard (both)
|
||||
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi
|
||||
index aa36aedf9..ff2c6de32 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi
|
||||
@@ -150,6 +150,14 @@ &hdmi {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&hevc {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&hevc_mmu {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&i2c0 {
|
||||
clock-frequency = <400000>;
|
||||
status = "okay";
|
||||
@@ -449,6 +457,10 @@ &pwm0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&rga {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&saradc {
|
||||
vref-supply = <&vcc18_ldo1>;
|
||||
status = "okay";
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
From 2fdd826a704ef70df42d92b38ad88ef869c3729b Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
||||
Date: Sat, 18 Sep 2021 12:32:05 +0000
|
||||
Subject: [PATCH 2/2] rockchip: enable hevc, hevc_mmu and rga nodes for miqi
|
||||
|
||||
---
|
||||
arch/arm/boot/dts/rockchip/rk3288-miqi.dts | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
index 94bc76099..68eb766f0 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts
|
||||
@@ -162,6 +162,14 @@ &hdmi {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&hevc {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&hevc_mmu {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&i2c0 {
|
||||
clock-frequency = <400000>;
|
||||
status = "okay";
|
||||
@@ -405,6 +413,10 @@ host_vbus_drv: host-vbus-drv {
|
||||
};
|
||||
};
|
||||
|
||||
+&rga {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&saradc {
|
||||
vref-supply = <&vcc_18>;
|
||||
status = "okay";
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
From e0c5a419cf5464cd02996431afa98e3b22dc6801 Mon Sep 17 00:00:00 2001
|
||||
From: Myy <myy@miouyouyou.fr>
|
||||
Date: Mon, 17 Jul 2017 23:14:48 +0000
|
||||
Subject: [PATCH] clk: rockchip: add all known operating points to the allowed
|
||||
CPU freqs
|
||||
|
||||
Patch from Willy Tarreau
|
||||
|
||||
Original commit message :
|
||||
At least 1920 MHz runs stable on the MiQi even on openssl speed -multi 4,
|
||||
which is by far the most intensive workload, and 1992/2016 work fine on
|
||||
the CS-008 until it starts to heat too much. So add all of them so that
|
||||
the device tree can simply manipulate them.
|
||||
|
||||
Signed-off-by: Myy <myy@miouyouyou.fr>
|
||||
---
|
||||
drivers/clk/rockchip/clk-rk3288.c | 17 +++++++++++++++++
|
||||
1 file changed, 17 insertions(+)
|
||||
|
||||
diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c
|
||||
index 753c649..fd2058f 100644
|
||||
--- a/drivers/clk/rockchip/clk-rk3288.c
|
||||
+++ b/drivers/clk/rockchip/clk-rk3288.c
|
||||
@@ -145,6 +145,23 @@ static struct rockchip_pll_rate_table rk3288_pll_rates[] = {
|
||||
}
|
||||
|
||||
static struct rockchip_cpuclk_rate_table rk3288_cpuclk_rates[] __initdata = {
|
||||
+ RK3288_CPUCLK_RATE(2208000000U, 1, 3, 1, 3, 3),
|
||||
+ RK3288_CPUCLK_RATE(2184000000U, 1, 3, 1, 3, 3),
|
||||
+ RK3288_CPUCLK_RATE(2160000000U, 1, 3, 1, 3, 3),
|
||||
+ RK3288_CPUCLK_RATE(2136000000, 1, 3, 1, 3, 3),
|
||||
+ RK3288_CPUCLK_RATE(2112000000, 1, 3, 1, 3, 3),
|
||||
+ RK3288_CPUCLK_RATE(2088000000, 1, 3, 1, 3, 3),
|
||||
+ RK3288_CPUCLK_RATE(2064000000, 1, 3, 1, 3, 3),
|
||||
+ RK3288_CPUCLK_RATE(2040000000, 1, 3, 1, 3, 3),
|
||||
+ RK3288_CPUCLK_RATE(2016000000, 1, 3, 1, 3, 3),
|
||||
+ RK3288_CPUCLK_RATE(1992000000, 1, 3, 1, 3, 3),
|
||||
+ RK3288_CPUCLK_RATE(1968000000, 1, 3, 1, 3, 3),
|
||||
+ RK3288_CPUCLK_RATE(1944000000, 1, 3, 1, 3, 3),
|
||||
+ RK3288_CPUCLK_RATE(1920000000, 1, 3, 1, 3, 3),
|
||||
+ RK3288_CPUCLK_RATE(1896000000, 1, 3, 1, 3, 3),
|
||||
+ RK3288_CPUCLK_RATE(1872000000, 1, 3, 1, 3, 3),
|
||||
+ RK3288_CPUCLK_RATE(1848000000, 1, 3, 1, 3, 3),
|
||||
+ RK3288_CPUCLK_RATE(1824000000, 1, 3, 1, 3, 3),
|
||||
RK3288_CPUCLK_RATE(1800000000, 1, 3, 1, 3, 3),
|
||||
RK3288_CPUCLK_RATE(1704000000, 1, 3, 1, 3, 3),
|
||||
RK3288_CPUCLK_RATE(1608000000, 1, 3, 1, 3, 3),
|
||||
--
|
||||
2.10.2
|
||||
|
||||
@ -0,0 +1,116 @@
|
||||
From 302cd9b8a9f1f8a7735fabea3b9a7645dc40f9cc Mon Sep 17 00:00:00 2001
|
||||
From: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
Date: Sun, 7 Jan 2018 01:52:44 +0100
|
||||
Subject: [PATCH] drivers: mmc: dw-mci-rockchip: Handle ASUS Tinkerboard reboot
|
||||
|
||||
On ASUS Tinkerboard systems, if the SDMMC hardware is shutdown before
|
||||
rebooting, the system will be dead, as the SDMMC is the only way to
|
||||
boot anything, and the hardware doesn't power up the SDMMC hardware
|
||||
automatically when rebooting.
|
||||
|
||||
So, when using an ASUS Tinkerboard system, a new reboot handler is
|
||||
installed. This reboot handler takes care of powering the SDMMC
|
||||
hardware again before restarting the system, resolving the issue.
|
||||
|
||||
The code was inspired by the pwrseq_emmc.c, which seems to overcome
|
||||
similar effects with eMMC hardware.
|
||||
|
||||
Signed-off-by: Myy Miouyouyou <myy@miouyouyou.fr>
|
||||
---
|
||||
drivers/mmc/host/dw_mmc-rockchip.c | 66 ++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 66 insertions(+)
|
||||
|
||||
diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
|
||||
index a3f1c2b30..7eac1f221 100644
|
||||
--- a/drivers/mmc/host/dw_mmc-rockchip.c
|
||||
+++ b/drivers/mmc/host/dw_mmc-rockchip.c
|
||||
@@ -16,6 +16,11 @@
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
+#include <linux/regulator/consumer.h>
|
||||
+#include <linux/reboot.h>
|
||||
+#include <linux/delay.h>
|
||||
+#include "../core/core.h"
|
||||
+
|
||||
#include "dw_mmc.h"
|
||||
#include "dw_mmc-pltfm.h"
|
||||
|
||||
@@ -334,6 +339,66 @@ static const struct of_device_id dw_mci_rockchip_match[] = {
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, dw_mci_rockchip_match);
|
||||
|
||||
+struct dw_mci_rockchip_broken_boards_data {
|
||||
+ struct notifier_block reset_nb;
|
||||
+ struct platform_device *pdev;
|
||||
+};
|
||||
+
|
||||
+/* This reboot handler handles cases where disabling the SDMMC on
|
||||
+ * reboot will cause the hardware to be unable to start correctly
|
||||
+ * after rebooting.
|
||||
+ *
|
||||
+ * This happens with Tinkerboard systems...
|
||||
+ */
|
||||
+static int dw_mci_rockchip_broken_boards_reset_nb(
|
||||
+ struct notifier_block *this,
|
||||
+ unsigned long mode, void *cmd)
|
||||
+{
|
||||
+ struct dw_mci_rockchip_broken_boards_data const *data =
|
||||
+ container_of(this,
|
||||
+ struct dw_mci_rockchip_broken_boards_data,
|
||||
+ reset_nb);
|
||||
+ struct dw_mci *host = platform_get_drvdata(data->pdev);
|
||||
+ struct mmc_host *mmc = host->slot->mmc;
|
||||
+
|
||||
+ printk(KERN_ERR "Meow.\n");
|
||||
+
|
||||
+ mmc_power_off(mmc);
|
||||
+
|
||||
+ mdelay(20);
|
||||
+
|
||||
+ if (!IS_ERR(mmc->supply.vmmc))
|
||||
+ regulator_enable(mmc->supply.vmmc);
|
||||
+
|
||||
+ if (!IS_ERR(mmc->supply.vqmmc))
|
||||
+ regulator_set_voltage(mmc->supply.vqmmc, 3000000, 3300000);
|
||||
+
|
||||
+ printk(KERN_ERR "woeM.\n");
|
||||
+
|
||||
+ return NOTIFY_DONE;
|
||||
+}
|
||||
+
|
||||
+static void dw_mci_rockchip_register_broken_boards_reboot_handler(
|
||||
+ struct platform_device *pdev)
|
||||
+{
|
||||
+ struct dw_mci_rockchip_broken_boards_data *data;
|
||||
+
|
||||
+ if (!of_machine_is_compatible("asus,rk3288-tinker"))
|
||||
+ return;
|
||||
+
|
||||
+ data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
|
||||
+
|
||||
+ if (!data)
|
||||
+ return;
|
||||
+
|
||||
+ data->reset_nb.notifier_call =
|
||||
+ dw_mci_rockchip_broken_boards_reset_nb;
|
||||
+ data->reset_nb.priority = 255;
|
||||
+ register_restart_handler(&data->reset_nb);
|
||||
+
|
||||
+ data->pdev = pdev;
|
||||
+}
|
||||
+
|
||||
static int dw_mci_rockchip_probe(struct platform_device *pdev)
|
||||
{
|
||||
const struct dw_mci_drv_data *drv_data;
|
||||
@@ -361,6 +426,7 @@ static int dw_mci_rockchip_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
pm_runtime_put_autosuspend(&pdev->dev);
|
||||
+ dw_mci_rockchip_register_broken_boards_reboot_handler(pdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.14.1
|
||||
|
||||
@ -0,0 +1,102 @@
|
||||
FROM: Solidhal <hal@halemmerich.com>
|
||||
|
||||
This patch reverses commit 2b721118b7821107757eb1d37af4b60e877b27e7, as can bee seen here:
|
||||
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2b721118b7821107757eb1d37af4b60e877b27e7
|
||||
|
||||
This commit caused issues on veyron speedy with ath9k and dwc2 drivers. Any ath9k device (ar9271)
|
||||
would intermittently work, most of the time ending in errors as can bee seen here:
|
||||
https://github.com/SolidHal/PrawnOS/issues/38
|
||||
This commit fixes that issue.
|
||||
This is only a temporary work around while a permenant fix is found, as this commit seems to only cause issues
|
||||
with dwc2
|
||||
|
||||
|
||||
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
|
||||
index 3f563e02d..903851481 100644
|
||||
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
|
||||
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
|
||||
@@ -118,10 +118,10 @@ static int hif_usb_send_regout(struct hif_device_usb *hif_dev,
|
||||
cmd->skb = skb;
|
||||
cmd->hif_dev = hif_dev;
|
||||
|
||||
- usb_fill_int_urb(urb, hif_dev->udev,
|
||||
- usb_sndintpipe(hif_dev->udev, USB_REG_OUT_PIPE),
|
||||
+ usb_fill_bulk_urb(urb, hif_dev->udev,
|
||||
+ usb_sndbulkpipe(hif_dev->udev, USB_REG_OUT_PIPE),
|
||||
skb->data, skb->len,
|
||||
- hif_usb_regout_cb, cmd, 1);
|
||||
+ hif_usb_regout_cb, cmd);
|
||||
|
||||
usb_anchor_urb(urb, &hif_dev->regout_submitted);
|
||||
ret = usb_submit_urb(urb, GFP_KERNEL);
|
||||
@@ -735,11 +735,11 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
|
||||
|
||||
rx_buf->skb = skb;
|
||||
|
||||
- usb_fill_int_urb(urb, hif_dev->udev,
|
||||
- usb_rcvintpipe(hif_dev->udev,
|
||||
+ usb_fill_bulk_urb(urb, hif_dev->udev,
|
||||
+ usb_rcvbulkpipe(hif_dev->udev,
|
||||
USB_REG_IN_PIPE),
|
||||
skb->data, MAX_REG_IN_BUF_SIZE,
|
||||
- ath9k_hif_usb_reg_in_cb, rx_buf, 1);
|
||||
+ ath9k_hif_usb_reg_in_cb, rx_buf);
|
||||
}
|
||||
|
||||
resubmit:
|
||||
@@ -944,11 +944,11 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev)
|
||||
rx_buf->hif_dev = hif_dev;
|
||||
rx_buf->skb = skb;
|
||||
|
||||
- usb_fill_int_urb(urb, hif_dev->udev,
|
||||
- usb_rcvintpipe(hif_dev->udev,
|
||||
+ usb_fill_bulk_urb(urb, hif_dev->udev,
|
||||
+ usb_rcvbulkpipe(hif_dev->udev,
|
||||
USB_REG_IN_PIPE),
|
||||
skb->data, MAX_REG_IN_BUF_SIZE,
|
||||
- ath9k_hif_usb_reg_in_cb, rx_buf, 1);
|
||||
+ ath9k_hif_usb_reg_in_cb, skb);
|
||||
|
||||
/* Anchor URB */
|
||||
usb_anchor_urb(urb, &hif_dev->reg_in_submitted);
|
||||
@@ -1069,7 +1069,9 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev)
|
||||
|
||||
static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev)
|
||||
{
|
||||
- int ret;
|
||||
+ struct usb_host_interface *alt = &hif_dev->interface->altsetting[0];
|
||||
+ struct usb_endpoint_descriptor *endp;
|
||||
+ int ret, idx;
|
||||
|
||||
ret = ath9k_hif_usb_download_fw(hif_dev);
|
||||
if (ret) {
|
||||
@@ -1079,6 +1081,20 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+ /* On downloading the firmware to the target, the USB descriptor of EP4
|
||||
+ * is 'patched' to change the type of the endpoint to Bulk. This will
|
||||
+ * bring down CPU usage during the scan period.
|
||||
+ */
|
||||
+ for (idx = 0; idx < alt->desc.bNumEndpoints; idx++) {
|
||||
+ endp = &alt->endpoint[idx].desc;
|
||||
+ if ((endp->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
|
||||
+ == USB_ENDPOINT_XFER_INT) {
|
||||
+ endp->bmAttributes &= ~USB_ENDPOINT_XFERTYPE_MASK;
|
||||
+ endp->bmAttributes |= USB_ENDPOINT_XFER_BULK;
|
||||
+ endp->bInterval = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* Alloc URBs */
|
||||
ret = ath9k_hif_usb_alloc_urbs(hif_dev);
|
||||
if (ret) {
|
||||
@@ -1353,7 +1369,7 @@ static void ath9k_hif_usb_reboot(struct usb_device *udev)
|
||||
if (!buf)
|
||||
return;
|
||||
|
||||
- ret = usb_interrupt_msg(udev, usb_sndintpipe(udev, USB_REG_OUT_PIPE),
|
||||
+ ret = usb_bulk_msg(udev, usb_sndbulkpipe(udev, USB_REG_OUT_PIPE),
|
||||
buf, 4, NULL, USB_MSG_TIMEOUT);
|
||||
if (ret)
|
||||
dev_err(&udev->dev, "ath9k_htc: USB reboot failed\n");
|
||||
@ -0,0 +1,20 @@
|
||||
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
|
||||
index 5a038c667401..5dd1acf7f12a 100644
|
||||
--- a/drivers/spi/spidev.c
|
||||
+++ b/drivers/spi/spidev.c
|
||||
@@ -713,6 +713,7 @@ static const struct spi_device_id spidev_spi_ids[] = {
|
||||
{ .name = "spi-authenta" },
|
||||
{ .name = "em3581" },
|
||||
{ .name = "si3210" },
|
||||
+ { .name = "spi_tinker" },
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(spi, spidev_spi_ids);
|
||||
@@ -741,6 +742,7 @@ static const struct of_device_id spidev_dt_ids[] = {
|
||||
{ .compatible = "semtech,sx1301", .data = &spidev_of_check },
|
||||
{ .compatible = "silabs,em3581", .data = &spidev_of_check },
|
||||
{ .compatible = "silabs,si3210", .data = &spidev_of_check },
|
||||
+ { .compatible = "rockchip,spi_tinker", .data = &spidev_of_check },
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, spidev_dt_ids);
|
||||
395
patch/kernel/archive/rockchip-6.6/261_gpiomem_driver.patch
Normal file
395
patch/kernel/archive/rockchip-6.6/261_gpiomem_driver.patch
Normal file
@ -0,0 +1,395 @@
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi
|
||||
index e5b7ef1a5..f88c913ff 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi
|
||||
@@ -544,3 +544,6 @@
|
||||
&wdt {
|
||||
status = "okay";
|
||||
};
|
||||
+&gpiomem {
|
||||
+ status = "okay";
|
||||
+};
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288.dtsi b/arch/arm/boot/dts/rockchip/rk3288.dtsi
|
||||
index f3ca55496..14bbcb192 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288.dtsi
|
||||
@@ -1418,6 +1418,12 @@
|
||||
interrupts = <GIC_PPI 9 0xf04>;
|
||||
};
|
||||
|
||||
+ gpiomem: rk3288-gpiomem@ff750000 {
|
||||
+ compatible = "rockchip,rk3288-gpiomem";
|
||||
+ reg = <0x0 0xff750000 0x0 0x1000>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
pinctrl: pinctrl {
|
||||
compatible = "rockchip,rk3288-pinctrl";
|
||||
rockchip,grf = <&grf>;
|
||||
|
||||
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
|
||||
index 3143db5..9c18b74 100644
|
||||
--- a/drivers/char/Kconfig
|
||||
+++ b/drivers/char/Kconfig
|
||||
@@ -5,6 +5,7 @@
|
||||
menu "Character devices"
|
||||
|
||||
source "drivers/tty/Kconfig"
|
||||
+source "drivers/char/rockchip/Kconfig"
|
||||
|
||||
config DEVMEM
|
||||
bool "/dev/mem virtual device support"
|
||||
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
|
||||
index 264eb398f..9fd5f240b 100644
|
||||
--- a/drivers/char/Makefile
|
||||
+++ b/drivers/char/Makefile
|
||||
@@ -43,6 +43,8 @@ obj-$(CONFIG_TCG_TPM) += tpm/
|
||||
|
||||
obj-$(CONFIG_PS3_FLASH) += ps3flash.o
|
||||
|
||||
+obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/
|
||||
+
|
||||
obj-$(CONFIG_XILLYBUS_CLASS) += xillybus/
|
||||
obj-$(CONFIG_POWERNV_OP_PANEL) += powernv-op-panel.o
|
||||
obj-$(CONFIG_ADI) += adi.o
|
||||
diff --git a/drivers/char/rockchip/Kconfig b/drivers/char/rockchip/Kconfig
|
||||
new file mode 100644
|
||||
index 0000000..6e97486
|
||||
--- /dev/null
|
||||
+++ b/drivers/char/rockchip/Kconfig
|
||||
@@ -0,0 +1,16 @@
|
||||
+#
|
||||
+# Broadcom char driver config
|
||||
+#
|
||||
+
|
||||
+menuconfig RK_CHAR_DRIVERS
|
||||
+ bool "Rockchip Char Drivers"
|
||||
+ help
|
||||
+ Rockchip's char drivers
|
||||
+
|
||||
+config RK3288_DEVGPIOMEM
|
||||
+ tristate "/dev/gpiomem rootless GPIO access via mmap() on the RK3288"
|
||||
+ default y
|
||||
+ help
|
||||
+ Provides users with root-free access to the GPIO registers
|
||||
+ on the 3288. Calling mmap(/dev/gpiomem) will map the GPIO
|
||||
+ register page to the user's pointer.
|
||||
\ No newline at end of file
|
||||
diff --git a/drivers/char/rockchip/Makefile b/drivers/char/rockchip/Makefile
|
||||
new file mode 100644
|
||||
index 0000000..2287ec2
|
||||
--- /dev/null
|
||||
+++ b/drivers/char/rockchip/Makefile
|
||||
@@ -0,0 +1 @@
|
||||
+obj-$(CONFIG_RK3288_DEVGPIOMEM)+= rk3288-gpiomem.o
|
||||
\ No newline at end of file
|
||||
diff --git a/drivers/char/rockchip/rk3288-gpiomem.c b/drivers/char/rockchip/rk3288-gpiomem.c
|
||||
new file mode 100644
|
||||
index 0000000..984471c
|
||||
--- /dev/null
|
||||
+++ b/drivers/char/rockchip/rk3288-gpiomem.c
|
||||
@@ -0,0 +1,303 @@
|
||||
+/**
|
||||
+ * GPIO memory device driver
|
||||
+ *
|
||||
+ * Creates a chardev /dev/gpiomem which will provide user access to
|
||||
+ * the rk3288's GPIO registers when it is mmap()'d.
|
||||
+ * No longer need root for user GPIO access, but without relaxing permissions
|
||||
+ * on /dev/mem.
|
||||
+ *
|
||||
+ * Written by Luke Wren <luke@raspberrypi.org>
|
||||
+ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions
|
||||
+ * are met:
|
||||
+ * 1. Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions, and the following disclaimer,
|
||||
+ * without modification.
|
||||
+ * 2. Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in the
|
||||
+ * documentation and/or other materials provided with the distribution.
|
||||
+ * 3. The names of the above-listed copyright holders may not be used
|
||||
+ * to endorse or promote products derived from this software without
|
||||
+ * specific prior written permission.
|
||||
+ *
|
||||
+ * ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
+ * GNU General Public License ("GPL") version 2, as published by the Free
|
||||
+ * Software Foundation.
|
||||
+ *
|
||||
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/mm.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/cdev.h>
|
||||
+#include <linux/pagemap.h>
|
||||
+#include <linux/io.h>
|
||||
+
|
||||
+#define DEVICE_NAME "rk3288-gpiomem"
|
||||
+#define DRIVER_NAME "gpiomem-rk3288"
|
||||
+#define DEVICE_MINOR 0
|
||||
+
|
||||
+struct rk3288_gpiomem_instance {
|
||||
+ unsigned long gpio_regs_phys;
|
||||
+ struct device *dev;
|
||||
+};
|
||||
+
|
||||
+static struct cdev rk3288_gpiomem_cdev;
|
||||
+static dev_t rk3288_gpiomem_devid;
|
||||
+static struct class *rk3288_gpiomem_class;
|
||||
+static struct device *rk3288_gpiomem_dev;
|
||||
+static struct rk3288_gpiomem_instance *inst;
|
||||
+
|
||||
+
|
||||
+/****************************************************************************
|
||||
+*
|
||||
+* GPIO mem chardev file ops
|
||||
+*
|
||||
+***************************************************************************/
|
||||
+
|
||||
+static int rk3288_gpiomem_open(struct inode *inode, struct file *file)
|
||||
+{
|
||||
+ int dev = iminor(inode);
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ if (dev != DEVICE_MINOR) {
|
||||
+ dev_err(inst->dev, "Unknown minor device: %d", dev);
|
||||
+ ret = -ENXIO;
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int rk3288_gpiomem_release(struct inode *inode, struct file *file)
|
||||
+{
|
||||
+ int dev = iminor(inode);
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ if (dev != DEVICE_MINOR) {
|
||||
+ dev_err(inst->dev, "Unknown minor device %d", dev);
|
||||
+ ret = -ENXIO;
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static const struct vm_operations_struct rk3288_gpiomem_vm_ops = {
|
||||
+#ifdef CONFIG_HAVE_IOREMAP_PROT
|
||||
+ .access = generic_access_phys
|
||||
+#endif
|
||||
+};
|
||||
+static int address_is_allowed(unsigned long pfn, unsigned long size)
|
||||
+{
|
||||
+ unsigned long address = pfn << PAGE_SHIFT;
|
||||
+
|
||||
+ dev_info(inst->dev, "address_is_allowed.pfn: 0x%08lx", address);
|
||||
+
|
||||
+ switch(address) {
|
||||
+
|
||||
+ case 0xff750000:
|
||||
+ case 0xff760000:
|
||||
+ case 0xff780000:
|
||||
+ case 0xff790000:
|
||||
+ case 0xff7a0000:
|
||||
+ case 0xff7b0000:
|
||||
+ case 0xff7c0000:
|
||||
+ case 0xff7d0000:
|
||||
+ case 0xff7e0000:
|
||||
+ case 0xff7f0000:
|
||||
+ case 0xff7f2000:
|
||||
+ case 0xff770000:
|
||||
+ case 0xff730000:
|
||||
+ case 0xff680000:
|
||||
+ dev_info(inst->dev, "address_is_allowed.return 1");
|
||||
+ return 1;
|
||||
+ break;
|
||||
+ default :
|
||||
+ dev_info(inst->dev, "address_is_allowed.return 0");
|
||||
+ return 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int rk3288_gpiomem_mmap(struct file *file, struct vm_area_struct *vma)
|
||||
+{
|
||||
+
|
||||
+ size_t size;
|
||||
+
|
||||
+ size = vma->vm_end - vma->vm_start;
|
||||
+
|
||||
+
|
||||
+ if (!address_is_allowed(vma->vm_pgoff, size))
|
||||
+ return -EPERM;
|
||||
+
|
||||
+ vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_pgoff,
|
||||
+ size,
|
||||
+ vma->vm_page_prot);
|
||||
+
|
||||
+ vma->vm_ops = &rk3288_gpiomem_vm_ops;
|
||||
+
|
||||
+ /* Remap-pfn-range will mark the range VM_IO */
|
||||
+ if (remap_pfn_range(vma,
|
||||
+ vma->vm_start,
|
||||
+ vma->vm_pgoff,
|
||||
+ size,
|
||||
+ vma->vm_page_prot)) {
|
||||
+ return -EAGAIN;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct file_operations
|
||||
+rk3288_gpiomem_fops = {
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .open = rk3288_gpiomem_open,
|
||||
+ .release = rk3288_gpiomem_release,
|
||||
+ .mmap = rk3288_gpiomem_mmap,
|
||||
+};
|
||||
+
|
||||
+static int rk3288_gpiomem_dev_uevent(const struct device *dev, struct kobj_uevent_env *env)
|
||||
+{
|
||||
+ add_uevent_var(env, "DEVMODE=%#o", 0666);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+ /****************************************************************************
|
||||
+*
|
||||
+* Probe and remove functions
|
||||
+*
|
||||
+***************************************************************************/
|
||||
+
|
||||
+
|
||||
+static int rk3288_gpiomem_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ int err;
|
||||
+ void *ptr_err;
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct resource *ioresource;
|
||||
+
|
||||
+ /* Allocate buffers and instance data */
|
||||
+
|
||||
+ inst = kzalloc(sizeof(struct rk3288_gpiomem_instance), GFP_KERNEL);
|
||||
+
|
||||
+ if (!inst) {
|
||||
+ err = -ENOMEM;
|
||||
+ goto failed_inst_alloc;
|
||||
+ }
|
||||
+
|
||||
+ inst->dev = dev;
|
||||
+
|
||||
+ ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ if (ioresource) {
|
||||
+ inst->gpio_regs_phys = ioresource->start;
|
||||
+ } else {
|
||||
+ dev_err(inst->dev, "failed to get IO resource");
|
||||
+ err = -ENOENT;
|
||||
+ goto failed_get_resource;
|
||||
+ }
|
||||
+
|
||||
+ /* Create character device entries */
|
||||
+
|
||||
+ err = alloc_chrdev_region(&rk3288_gpiomem_devid,
|
||||
+ DEVICE_MINOR, 1, DEVICE_NAME);
|
||||
+ if (err != 0) {
|
||||
+ dev_err(inst->dev, "unable to allocate device number");
|
||||
+ goto failed_alloc_chrdev;
|
||||
+ }
|
||||
+ cdev_init(&rk3288_gpiomem_cdev, &rk3288_gpiomem_fops);
|
||||
+ rk3288_gpiomem_cdev.owner = THIS_MODULE;
|
||||
+ err = cdev_add(&rk3288_gpiomem_cdev, rk3288_gpiomem_devid, 1);
|
||||
+ if (err != 0) {
|
||||
+ dev_err(inst->dev, "unable to register device");
|
||||
+ goto failed_cdev_add;
|
||||
+ }
|
||||
+
|
||||
+ /* Create sysfs entries */
|
||||
+
|
||||
+ rk3288_gpiomem_class = class_create(DEVICE_NAME);
|
||||
+ ptr_err = rk3288_gpiomem_class;
|
||||
+ if (IS_ERR(ptr_err))
|
||||
+ goto failed_class_create;
|
||||
+ rk3288_gpiomem_class->dev_uevent = rk3288_gpiomem_dev_uevent;
|
||||
+ rk3288_gpiomem_dev = device_create(rk3288_gpiomem_class, NULL,
|
||||
+ rk3288_gpiomem_devid, NULL,
|
||||
+ "gpiomem");
|
||||
+ ptr_err = rk3288_gpiomem_dev;
|
||||
+ if (IS_ERR(ptr_err))
|
||||
+ goto failed_device_create;
|
||||
+
|
||||
+ dev_info(inst->dev, "Initialised: Registers at 0x%08lx",
|
||||
+ inst->gpio_regs_phys);
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+failed_device_create:
|
||||
+ class_destroy(rk3288_gpiomem_class);
|
||||
+failed_class_create:
|
||||
+ cdev_del(&rk3288_gpiomem_cdev);
|
||||
+ err = PTR_ERR(ptr_err);
|
||||
+failed_cdev_add:
|
||||
+ unregister_chrdev_region(rk3288_gpiomem_devid, 1);
|
||||
+failed_alloc_chrdev:
|
||||
+failed_get_resource:
|
||||
+ kfree(inst);
|
||||
+failed_inst_alloc:
|
||||
+ dev_err(inst->dev, "could not load rk3288_gpiomem");
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+static int rk3288_gpiomem_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device *dev = inst->dev;
|
||||
+
|
||||
+ kfree(inst);
|
||||
+ device_destroy(rk3288_gpiomem_class, rk3288_gpiomem_devid);
|
||||
+ class_destroy(rk3288_gpiomem_class);
|
||||
+ cdev_del(&rk3288_gpiomem_cdev);
|
||||
+ unregister_chrdev_region(rk3288_gpiomem_devid, 1);
|
||||
+
|
||||
+ dev_info(dev, "GPIO mem driver removed - OK");
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+ /****************************************************************************
|
||||
+*
|
||||
+* Register the driver with device tree
|
||||
+*
|
||||
+***************************************************************************/
|
||||
+
|
||||
+static const struct of_device_id rk3288_gpiomem_of_match[] = {
|
||||
+ {.compatible = "rockchip,rk3288-gpiomem",},
|
||||
+ { /* sentinel */ },
|
||||
+};
|
||||
+
|
||||
+MODULE_DEVICE_TABLE(of, rk3288_gpiomem_of_match);
|
||||
+
|
||||
+static struct platform_driver rk3288_gpiomem_driver = {
|
||||
+ .probe = rk3288_gpiomem_probe,
|
||||
+ .remove = rk3288_gpiomem_remove,
|
||||
+ .driver = {
|
||||
+ .name = DRIVER_NAME,
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = rk3288_gpiomem_of_match,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+module_platform_driver(rk3288_gpiomem_driver);
|
||||
+
|
||||
+MODULE_ALIAS("platform:gpiomem-rk3288");
|
||||
+MODULE_LICENSE("GPL");
|
||||
+MODULE_DESCRIPTION("gpiomem driver for accessing GPIO from userspace");
|
||||
+MODULE_AUTHOR("Luke Wren <luke@raspberrypi.org>");
|
||||
\ No newline at end of file
|
||||
@ -0,0 +1,32 @@
|
||||
diff --git a/arch/arm/boot/dts/rockchip/rk3288.dtsi b/arch/arm/boot/dts/rockchip/rk3288.dtsi
|
||||
index bc3601a..37ae378 100644
|
||||
--- a/arch/arm/boot/dts/rockchip/rk3288.dtsi
|
||||
+++ b/arch/arm/boot/dts/rockchip/rk3288.dtsi
|
||||
@@ -467,13 +467,6 @@
|
||||
};
|
||||
|
||||
thermal-zones {
|
||||
- reserve_thermal: reserve-thermal {
|
||||
- polling-delay-passive = <1000>; /* milliseconds */
|
||||
- polling-delay = <5000>; /* milliseconds */
|
||||
-
|
||||
- thermal-sensors = <&tsadc 0>;
|
||||
- };
|
||||
-
|
||||
cpu_thermal: cpu-thermal {
|
||||
polling-delay-passive = <100>; /* milliseconds */
|
||||
polling-delay = <5000>; /* milliseconds */
|
||||
@@ -539,6 +532,13 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
+
|
||||
+ reserve_thermal: reserve-thermal {
|
||||
+ polling-delay-passive = <1000>; /* milliseconds */
|
||||
+ polling-delay = <5000>; /* milliseconds */
|
||||
+
|
||||
+ thermal-sensors = <&tsadc 0>;
|
||||
+ };
|
||||
};
|
||||
|
||||
tsadc: tsadc@ff280000 {
|
||||
@ -0,0 +1,19 @@
|
||||
diff --git a/sound/usb/card.c b/sound/usb/card.c
|
||||
index 2bfe4e80a..cea93aaf5 100644
|
||||
--- a/sound/usb/card.c
|
||||
+++ b/sound/usb/card.c
|
||||
@@ -382,6 +382,14 @@ static void usb_audio_make_shortname(struct usb_device *dev,
|
||||
}
|
||||
|
||||
strim(card->shortname);
|
||||
+
|
||||
+ /* Tinker Board ALC4040 CODEC */
|
||||
+
|
||||
+ if(USB_ID_VENDOR(chip->usb_id) == 0x0bda &&
|
||||
+ USB_ID_PRODUCT(chip->usb_id) == 0x481a) {
|
||||
+ strlcat(card->shortname, " OnBoard", sizeof(card->shortname));
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
static void usb_audio_make_longname(struct usb_device *dev,
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user