diff --git a/AndroidKernel.mk b/AndroidKernel.mk index 73a2232be4a2..dc3190a16c3e 100644 --- a/AndroidKernel.mk +++ b/AndroidKernel.mk @@ -248,9 +248,9 @@ $(RTIC_DTB): $(INSTALLED_KERNEL_TARGET) # Creating a dtb.img once the kernel is compiled if TARGET_KERNEL_APPEND_DTB is set to be false $(INSTALLED_DTBIMAGE_TARGET): $(TARGET_PREBUILT_INT_KERNEL) $(INSTALLED_KERNEL_TARGET) $(RTIC_DTB) $(hide) if [ -d "$(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/vendor/" ]; then \ - cat $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/vendor/qcom/*.dtb $(RTIC_DTB) > $@; \ + cat $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/vendor/*/*.dtb $(RTIC_DTB) > $@; \ else \ - cat $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/qcom/*.dtb $(RTIC_DTB) > $@; \ + cat $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/*/*.dtb $(RTIC_DTB) > $@; \ fi .PHONY: kerneltags diff --git a/Kconfig b/Kconfig index 8c4c1cb0f9cd..c5caad904859 100644 --- a/Kconfig +++ b/Kconfig @@ -5,6 +5,24 @@ # mainmenu "Linux/$ARCH $KERNELVERSION Kernel Configuration" +#ifdef CONFIG_OPLUS_SYSTEM_KERNEL +#Wen.Luo@Bsp.Kernel.Stability,2020/4/20,OPLUS_SYSTEM_KERNEL_QCOM/OPLUS_SYSTEM_KERNEL_MTK add for qcom/mtk platform +config OPLUS_SYSTEM_KERNEL_QCOM + bool "config oplus system feature " + default y + help + define this config to Distinguish between qcom and mtk platform + +config OPLUS_FEATURE_PANIC_FLUSH + bool "fsync optimization " + default y + help + define this config to fsync optimization + +#endif /*CONFIG_OPLUS_SYSTEM_KERNEL*/ + + + config SRCARCH string option env="SRCARCH" diff --git a/Makefile b/Makefile index 93c2baeb83bc..05ddc8805660 100644 --- a/Makefile +++ b/Makefile @@ -445,8 +445,30 @@ KBUILD_AFLAGS_MODULE := -DMODULE KBUILD_CFLAGS_MODULE := -DMODULE KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds GCC_PLUGINS_CFLAGS := -CLANG_FLAGS := +CLANG_FLAGS := + +#ifdef OPLUS_FEATURE_BUILD +#Sunliang@TECH.SysTech.Build.BaseConfig, 2020/03/18, oplus customzation for flags or other variabls +-include OplusKernelEnvConfig.mk +#endif // OPLUS_FEATURE_BUILD + +#ifdef OPLUS_BUG_STABILITY +ifeq ($(TARGET_BUILD_VARIANT), user) +KBUILD_CFLAGS += -DCONFIG_OPPO_USER_BUILD +else +KBUILD_CFLAGS += -DCONFIG_OPPO_DEBUG_BUILD +endif +#endif OPLUS_BUG_STABILITY + + +# ifdef OPLUS_FEATURE_CHG_BASIC +# Gang.Yan@PSW.BSP.CHG.Basic, 2020/03/12, sjc Add for 806 high/low temp aging test +ifeq ($(OPPO_HIGH_TEMP_VERSION),true) +KBUILD_CFLAGS += -DCONFIG_HIGH_TEMP_VERSION +KBUILD_CPPFLAGS += -DCONFIG_HIGH_TEMP_VERSION +endif +#endif OPLUS_FEATURE_CHG_BASIC export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC export CPP AR NM STRIP OBJCOPY OBJDUMP HOSTLDFLAGS HOST_LOADLIBES export MAKE AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile index db5a70876487..538e16444129 100644 --- a/arch/arm64/boot/dts/Makefile +++ b/arch/arm64/boot/dts/Makefile @@ -1,29 +1,37 @@ # SPDX-License-Identifier: GPL-2.0 -dts-dirs += actions -dts-dirs += al -dts-dirs += allwinner -dts-dirs += altera -dts-dirs += amd -dts-dirs += amlogic -dts-dirs += apm -dts-dirs += arm -dts-dirs += broadcom -dts-dirs += cavium -dts-dirs += exynos -dts-dirs += freescale -dts-dirs += hisilicon -dts-dirs += marvell -dts-dirs += mediatek -dts-dirs += nvidia -dts-dirs += qcom -dts-dirs += realtek -dts-dirs += renesas -dts-dirs += rockchip -dts-dirs += socionext -dts-dirs += sprd -dts-dirs += xilinx -dts-dirs += lg -dts-dirs += zte +#ifdef VENDOR_EDIT +#/*ye.zhang@BSP.Bootloader.Bootflow, 2020-6-18, Add for oppo project*/ +#dts-dirs += actions +#dts-dirs += al +#dts-dirs += allwinner +#dts-dirs += altera +#dts-dirs += amd +#dts-dirs += amlogic +#dts-dirs += apm +#dts-dirs += arm +#dts-dirs += broadcom +#dts-dirs += cavium +#dts-dirs += exynos +#dts-dirs += freescale +#dts-dirs += hisilicon +#dts-dirs += marvell +#dts-dirs += mediatek +#dts-dirs += nvidia +#dts-dirs += qcom +#dts-dirs += realtek +#dts-dirs += renesas +#dts-dirs += rockchip +#dts-dirs += socionext +#dts-dirs += sprd +#dts-dirs += xilinx +#dts-dirs += lg +#dts-dirs += zte +#else +#dts-dirs += 19771 +#dts-dirs += 19721 +#dts-dirs += 206B1 +#dts-dirs += 20711 +#endif subdir-y := $(dts-dirs) diff --git a/arch/arm64/boot/dts/qcom/atoll.dtsi b/arch/arm64/boot/dts/qcom/atoll.dtsi index 4f2f8b1c7b09..52d9ef8ad855 100644 --- a/arch/arm64/boot/dts/qcom/atoll.dtsi +++ b/arch/arm64/boot/dts/qcom/atoll.dtsi @@ -1463,6 +1463,20 @@ qcom,guard-memory; }; + //#ifdef VENDOR_EDIT + //Zhengpeng.Tan@NW.AP.NV.892767, 2016/11/30 + //#ifdef FEATURE_OPPO_NV_BACKUP + //add for creating a shared memory with uio for nv backup and restore + qcom,oembackup_sharedmem@0 { + compatible = "qcom,sharedmem-uio"; + reg = <0x0 0x00100000>; + reg-names = "oembackup"; + qcom,client-id = <0x00000004>; + qcom,guard-memory; + }; + //#endif /* FEATURE_OPPO_NV_BACKUP */ + //#endif /* VENDOR_EDIT */ + pil_modem: qcom,mss@4080000 { compatible = "qcom,pil-tz-generic"; reg = <0x4080000 0x100>; diff --git a/arch/arm64/boot/dts/qcom/sdmmagpie-gpu.dtsi b/arch/arm64/boot/dts/qcom/sdmmagpie-gpu.dtsi index f07018b9d798..279493476246 100644 --- a/arch/arm64/boot/dts/qcom/sdmmagpie-gpu.dtsi +++ b/arch/arm64/boot/dts/qcom/sdmmagpie-gpu.dtsi @@ -594,6 +594,16 @@ }; }; }; + + qcom,cpu-to-ahb-path { + qcom,msm-bus,name = "ahbpath"; + qcom,msm-bus,num-cases = <3>; + qcom,msm-bus,num-paths = <1>; + qcom,msm-bus,vectors-KBps = + <1 598 0 0>, // off + <1 598 0 100>, // min freq + <1 598 0 9999999>; // max freq + }; }; kgsl_msm_iommu: qcom,kgsl-iommu@5040000 { diff --git a/arch/arm64/boot/dts/qcom/sdmmagpie.dtsi b/arch/arm64/boot/dts/qcom/sdmmagpie.dtsi index acef8e2685cf..d0b6afaead73 100644 --- a/arch/arm64/boot/dts/qcom/sdmmagpie.dtsi +++ b/arch/arm64/boot/dts/qcom/sdmmagpie.dtsi @@ -2478,6 +2478,19 @@ qcom,guard-memory; }; + //#ifdef VENDOR_EDIT + //Zhengpeng.Tan@NW.AP.NV.892767, 2016/11/30 + //#ifdef FEATURE_OPPO_NV_BACKUP + //add for creating a shared memory with uio for nv backup and restore + qcom,oembackup_sharedmem@0 { + compatible = "qcom,sharedmem-uio"; + reg = <0x0 0x00100000>; + reg-names = "oembackup"; + qcom,client-id = <0x00000004>; + qcom,guard-memory; + }; + //#endif /* FEATURE_OPPO_NV_BACKUP */ + //#endif /* VENDOR_EDIT */ qcom_cedev: qcedev@1de0000 { compatible = "qcom,qcedev"; reg = <0x1de0000 0x20000>, diff --git a/arch/arm64/boot/dts/qcom/sm6150.dtsi b/arch/arm64/boot/dts/qcom/sm6150.dtsi index 6822b9dc4ce0..7af08cfbc32b 100644 --- a/arch/arm64/boot/dts/qcom/sm6150.dtsi +++ b/arch/arm64/boot/dts/qcom/sm6150.dtsi @@ -2680,6 +2680,19 @@ qcom,guard-memory; }; + //#ifdef VENDOR_EDIT + //Zhengpeng.Tan@NW.AP.NV.892767, 2016/11/30 + //#ifdef FEATURE_OPPO_NV_BACKUP + //add for creating a shared memory with uio for nv backup and restore + qcom,oembackup_sharedmem@0 { + compatible = "qcom,sharedmem-uio"; + reg = <0x0 0x00100000>; + reg-names = "oembackup"; + qcom,client-id = <0x00000004>; + qcom,guard-memory; + }; + //#endif /* FEATURE_OPPO_NV_BACKUP */ + //#endif /* VENDOR_EDIT */ llcc_pmu: llcc-pmu@90cc000 { compatible = "qcom,qcom-llcc-pmu"; reg = <0x090cc000 0x300>; diff --git a/arch/arm64/configs/atoll_defconfig b/arch/arm64/configs/atoll_defconfig index a57ce7d9060c..e71d165a1be5 100644 --- a/arch/arm64/configs/atoll_defconfig +++ b/arch/arm64/configs/atoll_defconfig @@ -1,975 +1,179 @@ -# -# Automatically generated file; DO NOT EDIT. -# Linux/arm64 4.14.180 Kernel Configuration -# -CONFIG_OPLUS_SYSTEM_KERNEL_QCOM=y -CONFIG_OPLUS_FEATURE_PANIC_FLUSH=y -CONFIG_ARM64=y -CONFIG_64BIT=y -CONFIG_ARCH_PHYS_ADDR_T_64BIT=y -CONFIG_MMU=y -CONFIG_ARM64_PAGE_SHIFT=12 -CONFIG_ARM64_CONT_SHIFT=4 -CONFIG_ARCH_MMAP_RND_BITS_MIN=18 -CONFIG_ARCH_MMAP_RND_BITS_MAX=24 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 -CONFIG_STACKTRACE_SUPPORT=y -CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 -CONFIG_LOCKDEP_SUPPORT=y -CONFIG_TRACE_IRQFLAGS_SUPPORT=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y -CONFIG_GENERIC_HWEIGHT=y -CONFIG_GENERIC_CSUM=y -CONFIG_GENERIC_CALIBRATE_DELAY=y -CONFIG_ZONE_DMA=y -CONFIG_HAVE_GENERIC_GUP=y -CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_SG_DMA_LENGTH=y -CONFIG_SMP=y CONFIG_HOTPLUG_SIZE_BITS=29 -CONFIG_SWIOTLB=y -CONFIG_IOMMU_HELPER=y -CONFIG_KERNEL_MODE_NEON=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_PGTABLE_LEVELS=3 -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_ARCH_PROC_KCORE_TEXT=y -# CONFIG_QTI_GVM is not set -CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" -# CONFIG_TOOLS_SUPPORT_RELR is not set -CONFIG_IRQ_WORK=y -CONFIG_BUILDTIME_EXTABLE_SORT=y -CONFIG_THREAD_INFO_IN_TASK=y - -# -# General setup -# -CONFIG_INIT_ENV_ARG_LIMIT=32 -CONFIG_CROSS_COMPILE="" -# CONFIG_COMPILE_TEST is not set CONFIG_LOCALVERSION="-perf" # CONFIG_LOCALVERSION_AUTO is not set -CONFIG_DEFAULT_HOSTNAME="(none)" -CONFIG_SWAP=y -# CONFIG_SYSVIPC is not set -# CONFIG_POSIX_MQUEUE is not set -CONFIG_CROSS_MEMORY_ATTACH=y # CONFIG_FHANDLE is not set -# CONFIG_USELIB is not set CONFIG_AUDIT=y -CONFIG_HAVE_ARCH_AUDITSYSCALL=y # CONFIG_AUDITSYSCALL is not set - -# -# IRQ subsystem -# -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y -CONFIG_GENERIC_IRQ_MIGRATION=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_DOMAIN_HIERARCHY=y -CONFIG_GENERIC_MSI_IRQ=y -CONFIG_GENERIC_MSI_IRQ_DOMAIN=y -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_SPARSE_IRQ=y -CONFIG_ARCH_CLOCKSOURCE_DATA=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_ARCH_HAS_TICK_BROADCAST=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y - -# -# Timers subsystem -# -CONFIG_TICK_ONESHOT=y -CONFIG_NO_HZ_COMMON=y -# CONFIG_HZ_PERIODIC is not set -CONFIG_NO_HZ_IDLE=y -# CONFIG_NO_HZ_FULL is not set CONFIG_NO_HZ=y CONFIG_HIGH_RES_TIMERS=y - -# -# CPU/Task time and stats accounting -# -CONFIG_TICK_CPU_ACCOUNTING=y -# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set CONFIG_IRQ_TIME_ACCOUNTING=y CONFIG_SCHED_WALT=y -# CONFIG_BSD_PROCESS_ACCT is not set CONFIG_TASKSTATS=y -# CONFIG_TASK_DELAY_ACCT is not set CONFIG_TASK_XACCT=y CONFIG_TASK_IO_ACCOUNTING=y CONFIG_PSI=y -# CONFIG_PSI_DEFAULT_DISABLED is not set - -# -# RCU Subsystem -# -CONFIG_PREEMPT_RCU=y CONFIG_RCU_EXPERT=y -CONFIG_SRCU=y -CONFIG_TREE_SRCU=y -CONFIG_TASKS_RCU=y -CONFIG_RCU_STALL_COMMON=y -CONFIG_RCU_NEED_SEGCBLIST=y -CONFIG_RCU_FANOUT=64 -CONFIG_RCU_FANOUT_LEAF=16 CONFIG_RCU_FAST_NO_HZ=y -# CONFIG_RCU_BOOST is not set CONFIG_RCU_NOCB_CPU=y -CONFIG_BUILD_BIN2C=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y CONFIG_IKHEADERS=y -CONFIG_LOG_BUF_SHIFT=17 -# CONFIG_CONSOLE_FLUSH_ON_HOTPLUG is not set CONFIG_LOG_CPU_MAX_BUF_SHIFT=17 -CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=13 -CONFIG_GENERIC_SCHED_CLOCK=y - -# -# FAIR Scheuler tunables -# -CONFIG_PELT_UTIL_HALFLIFE_32=y -# CONFIG_PELT_UTIL_HALFLIFE_16 is not set -# CONFIG_PELT_UTIL_HALFLIFE_8 is not set -CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y -CONFIG_CGROUPS=y -CONFIG_PAGE_COUNTER=y CONFIG_MEMCG=y CONFIG_MEMCG_SWAP=y -CONFIG_MEMCG_SWAP_ENABLED=y CONFIG_BLK_CGROUP=y -# CONFIG_DEBUG_BLK_CGROUP is not set -CONFIG_CGROUP_WRITEBACK=y -CONFIG_CGROUP_SCHED=y -CONFIG_FAIR_GROUP_SCHED=y -# CONFIG_RT_GROUP_SCHED is not set -# CONFIG_CGROUP_PIDS is not set -# CONFIG_CGROUP_RDMA is not set CONFIG_CGROUP_FREEZER=y CONFIG_CPUSETS=y -CONFIG_PROC_PID_CPUSET=y -# CONFIG_CGROUP_DEVICE is not set CONFIG_CGROUP_CPUACCT=y -# CONFIG_CGROUP_PERF is not set CONFIG_CGROUP_BPF=y -# CONFIG_CGROUP_DEBUG is not set -CONFIG_SOCK_CGROUP_DATA=y CONFIG_SCHED_CORE_CTL=y -# CONFIG_CHECKPOINT_RESTORE is not set CONFIG_NAMESPACES=y -CONFIG_UTS_NS=y -# CONFIG_USER_NS is not set # CONFIG_PID_NS is not set -CONFIG_NET_NS=y CONFIG_SCHED_AUTOGROUP=y CONFIG_SCHED_TUNE=y CONFIG_DEFAULT_USE_ENERGY_AWARE=y -# CONFIG_SYSFS_DEPRECATED is not set -# CONFIG_RELAY is not set CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_RD_GZIP=y -CONFIG_RD_BZIP2=y -CONFIG_RD_LZMA=y # CONFIG_RD_XZ is not set # CONFIG_RD_LZO is not set # CONFIG_RD_LZ4 is not set -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_SYSCTL=y -CONFIG_HAVE_UID16=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_BPF=y -CONFIG_EXPERT=y -CONFIG_UID16=y -CONFIG_MULTIUSER=y -# CONFIG_SGETMASK_SYSCALL is not set -CONFIG_SYSFS_SYSCALL=y -# CONFIG_SYSCTL_SYSCALL is not set -CONFIG_POSIX_TIMERS=y -CONFIG_KALLSYMS=y CONFIG_KALLSYMS_ALL=y -# CONFIG_KALLSYMS_ABSOLUTE_PERCPU is not set -CONFIG_KALLSYMS_BASE_RELATIVE=y -CONFIG_PRINTK=y -CONFIG_BUG=y -CONFIG_ELF_CORE=y -CONFIG_BASE_FULL=y -CONFIG_FUTEX=y -CONFIG_FUTEX_PI=y -CONFIG_EPOLL=y -CONFIG_SIGNALFD=y -CONFIG_TIMERFD=y -CONFIG_EVENTFD=y CONFIG_BPF_SYSCALL=y CONFIG_BPF_JIT_ALWAYS_ON=y -CONFIG_SHMEM=y -CONFIG_AIO=y -CONFIG_ADVISE_SYSCALLS=y -# CONFIG_USERFAULTFD is not set -CONFIG_PCI_QUIRKS=y -CONFIG_MEMBARRIER=y CONFIG_EMBEDDED=y -CONFIG_HAVE_PERF_EVENTS=y -# CONFIG_PC104 is not set - -# -# Kernel Performance Events And Counters -# -CONFIG_PERF_EVENTS=y -# CONFIG_PERF_USER_SHARE is not set -# CONFIG_DEBUG_PERF_USE_VMALLOC is not set -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_SLUB_DEBUG=y -# CONFIG_SLUB_MEMCG_SYSFS_ON is not set +# CONFIG_SLUB_DEBUG is not set # CONFIG_COMPAT_BRK is not set -# CONFIG_SLAB is not set -CONFIG_SLUB=y -# CONFIG_SLOB is not set -CONFIG_SLAB_MERGE_DEFAULT=y CONFIG_SLAB_FREELIST_RANDOM=y CONFIG_SLAB_FREELIST_HARDENED=y -CONFIG_SLUB_CPU_PARTIAL=y -CONFIG_SYSTEM_DATA_VERIFICATION=y CONFIG_PROFILING=y -CONFIG_TRACEPOINTS=y -# CONFIG_KPROBES is not set -# CONFIG_JUMP_LABEL is not set -CONFIG_UPROBES=y -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_ARCH_HAS_FORTIFY_SOURCE=y -CONFIG_ARCH_HAS_SET_MEMORY=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_HW_BREAKPOINT=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_RCU_TABLE_FREE=y -CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y -CONFIG_HAVE_CMPXCHG_LOCAL=y -CONFIG_HAVE_CMPXCHG_DOUBLE=y -CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_SECCOMP_FILTER=y -CONFIG_HAVE_GCC_PLUGINS=y -# CONFIG_GCC_PLUGINS is not set -CONFIG_HAVE_CC_STACKPROTECTOR=y -CONFIG_CC_STACKPROTECTOR=y -# CONFIG_CC_STACKPROTECTOR_NONE is not set -# CONFIG_CC_STACKPROTECTOR_REGULAR is not set CONFIG_CC_STACKPROTECTOR_STRONG=y -CONFIG_THIN_ARCHIVES=y -# CONFIG_LTO is not set -CONFIG_ARCH_SUPPORTS_LTO_CLANG=y -CONFIG_ARCH_SUPPORTS_THINLTO=y -CONFIG_LTO_NONE=y -# CONFIG_LTO_CLANG is not set -CONFIG_ARCH_SUPPORTS_SHADOW_CALL_STACK=y -CONFIG_ROP_PROTECTION_NONE=y -# CONFIG_SHADOW_CALL_STACK is not set -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y -CONFIG_HAVE_ARCH_HUGE_VMAP=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_MODULES_USE_ELF_RELA=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_HAVE_ARCH_MMAP_RND_BITS=y -CONFIG_ARCH_MMAP_RND_BITS=18 -CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y -CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11 -# CONFIG_HAVE_ARCH_HASH is not set -# CONFIG_ISA_BUS_API is not set -CONFIG_CLONE_BACKWARDS=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_COMPAT_OLD_SIGACTION=y -# CONFIG_CPU_NO_EFFICIENT_FFS is not set -CONFIG_HAVE_ARCH_VMAP_STACK=y -CONFIG_VMAP_STACK=y -# CONFIG_ARCH_OPTIONAL_KERNEL_RWX is not set -# CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT is not set -CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y -CONFIG_STRICT_KERNEL_RWX=y -CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y -CONFIG_STRICT_MODULE_RWX=y -# CONFIG_REFCOUNT_FULL is not set -CONFIG_ARCH_HAS_RELR=y - -# -# GCOV-based kernel profiling -# -CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_SLABINFO=y -CONFIG_RT_MUTEXES=y -CONFIG_BASE_SMALL=0 CONFIG_MODULES=y -# CONFIG_MODULE_FORCE_LOAD is not set CONFIG_MODULE_UNLOAD=y -# CONFIG_MODULE_FORCE_UNLOAD is not set CONFIG_MODVERSIONS=y -# CONFIG_MODULE_SRCVERSION_ALL is not set CONFIG_MODULE_SIG=y -#CONFIG_MODULE_SIG_FORCE=y -CONFIG_MODULE_SIG_ALL=y -# CONFIG_MODULE_SIG_SHA1 is not set -# CONFIG_MODULE_SIG_SHA224 is not set -# CONFIG_MODULE_SIG_SHA256 is not set -# CONFIG_MODULE_SIG_SHA384 is not set +CONFIG_MODULE_SIG_FORCE=y CONFIG_MODULE_SIG_SHA512=y -CONFIG_MODULE_SIG_HASH="sha512" -# CONFIG_MODULE_COMPRESS is not set -# CONFIG_TRIM_UNUSED_KSYMS is not set -CONFIG_MODULES_TREE_LOOKUP=y -CONFIG_BLOCK=y -CONFIG_BLK_SCSI_REQUEST=y -CONFIG_BLK_DEV_BSG=y -# CONFIG_BLK_DEV_BSGLIB is not set -# CONFIG_BLK_DEV_INTEGRITY is not set -# CONFIG_BLK_DEV_ZONED is not set -# CONFIG_BLK_DEV_THROTTLING is not set -# CONFIG_BLK_CMDLINE_PARSER is not set -# CONFIG_BLK_WBT is not set -# CONFIG_BLK_SED_OPAL is not set CONFIG_BLK_INLINE_ENCRYPTION=y CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK=y - -# -# Partition Types -# CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -# CONFIG_AIX_PARTITION is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -# CONFIG_MAC_PARTITION is not set -CONFIG_MSDOS_PARTITION=y -# CONFIG_BSD_DISKLABEL is not set -# CONFIG_MINIX_SUBPARTITION is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_UNIXWARE_DISKLABEL is not set -# CONFIG_LDM_PARTITION is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_KARMA_PARTITION is not set -CONFIG_EFI_PARTITION=y -# CONFIG_SYSV68_PARTITION is not set -# CONFIG_CMDLINE_PARTITION is not set -CONFIG_BLOCK_COMPAT=y -CONFIG_BLK_MQ_PCI=y - -# -# IO Schedulers -# -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_CFQ=y CONFIG_CFQ_GROUP_IOSCHED=y -# CONFIG_DEFAULT_DEADLINE is not set -CONFIG_DEFAULT_CFQ=y -# CONFIG_DEFAULT_NOOP is not set -CONFIG_DEFAULT_IOSCHED="cfq" -CONFIG_MQ_IOSCHED_DEADLINE=y -CONFIG_MQ_IOSCHED_KYBER=y -# CONFIG_IOSCHED_BFQ is not set -CONFIG_OPPO_FG_IO_OPT=y -CONFIG_ASN1=y -CONFIG_UNINLINE_SPIN_UNLOCK=y -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_RWSEM_SPIN_ON_OWNER=y -CONFIG_LOCK_SPIN_ON_OWNER=y -CONFIG_ARCH_USE_QUEUED_RWLOCKS=y -CONFIG_QUEUED_RWLOCKS=y -CONFIG_RWSEM_PRIO_AWARE=y -CONFIG_FREEZER=y - -# -# Platform selection -# -# CONFIG_ARCH_ACTIONS is not set -# CONFIG_ARCH_SUNXI is not set -# CONFIG_ARCH_ALPINE is not set -# CONFIG_ARCH_SDM660 is not set -# CONFIG_ARCH_BCM2835 is not set -# CONFIG_ARCH_BCM_IPROC is not set -# CONFIG_ARCH_BERLIN is not set -# CONFIG_ARCH_BRCMSTB is not set -# CONFIG_ARCH_EXYNOS is not set -# CONFIG_ARCH_LAYERSCAPE is not set -# CONFIG_ARCH_LG1K is not set -# CONFIG_ARCH_HISI is not set -# CONFIG_ARCH_MEDIATEK is not set -# CONFIG_ARCH_MESON is not set -# CONFIG_ARCH_MVEBU is not set CONFIG_ARCH_QCOM=y -# CONFIG_ARCH_SM8150 is not set -# CONFIG_ARCH_SDMSHRIKE is not set -# CONFIG_ARCH_SM6150 is not set CONFIG_ARCH_ATOLL=y -# CONFIG_ARCH_QCS405 is not set -# CONFIG_ARCH_QCS403 is not set CONFIG_ARCH_SDMMAGPIE=y -# CONFIG_ARCH_TRINKET is not set -# CONFIG_ARCH_SDM429W is not set -# CONFIG_ARCH_REALTEK is not set -# CONFIG_ARCH_ROCKCHIP is not set -# CONFIG_ARCH_SEATTLE is not set -# CONFIG_ARCH_RENESAS is not set -# CONFIG_ARCH_STRATIX10 is not set -# CONFIG_ARCH_TEGRA is not set -# CONFIG_ARCH_SPRD is not set -# CONFIG_ARCH_THUNDER is not set -# CONFIG_ARCH_THUNDER2 is not set -# CONFIG_ARCH_UNIPHIER is not set -# CONFIG_ARCH_VEXPRESS is not set -# CONFIG_ARCH_VULCAN is not set -# CONFIG_ARCH_XGENE is not set -# CONFIG_ARCH_ZX is not set -# CONFIG_ARCH_ZYNQMP is not set - -# -# Bus support -# CONFIG_PCI=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_DOMAINS_GENERIC=y -CONFIG_PCI_SYSCALL=y -# CONFIG_PCIEPORTBUS is not set -CONFIG_PCI_BUS_ADDR_T_64BIT=y -CONFIG_PCI_MSI=y -CONFIG_PCI_MSI_IRQ_DOMAIN=y -# CONFIG_PCI_DEBUG is not set -# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set -# CONFIG_PCI_STUB is not set -# CONFIG_PCI_IOV is not set -# CONFIG_PCI_PRI is not set -# CONFIG_PCI_PASID is not set -# CONFIG_HOTPLUG_PCI is not set - -# -# DesignWare PCI Core Support -# -# CONFIG_PCIE_DW_PLAT is not set -# CONFIG_PCI_HISI is not set -# CONFIG_PCIE_QCOM is not set -# CONFIG_PCIE_KIRIN is not set - -# -# PCI host controller drivers -# CONFIG_PCI_MSM=y -# CONFIG_PCI_MSM_MSI is not set -# CONFIG_PCI_HOST_GENERIC is not set -# CONFIG_PCI_XGENE is not set -# CONFIG_PCI_HOST_THUNDER_PEM is not set -# CONFIG_PCI_HOST_THUNDER_ECAM is not set - -# -# PCI Endpoint -# -# CONFIG_PCI_ENDPOINT is not set - -# -# PCI switch controller drivers -# -# CONFIG_PCI_SW_SWITCHTEC is not set -# CONFIG_PCI_SW_QCOM_SWITCH is not set - -# -# Kernel Features -# - -# -# ARM errata workarounds via the alternatives framework -# -CONFIG_ARM64_ERRATUM_826319=y -CONFIG_ARM64_ERRATUM_827319=y -CONFIG_ARM64_ERRATUM_824069=y -CONFIG_ARM64_ERRATUM_819472=y -CONFIG_ARM64_ERRATUM_832075=y -CONFIG_ARM64_ERRATUM_845719=y -# CONFIG_ARM64_ERRATUM_843419 is not set -CONFIG_ARM64_ERRATUM_1024718=y -# CONFIG_ARM64_ERRATUM_1286807 is not set -CONFIG_ARM64_ERRATUM_1188873=y -CONFIG_CAVIUM_ERRATUM_22375=y -CONFIG_CAVIUM_ERRATUM_23154=y -CONFIG_CAVIUM_ERRATUM_27456=y -CONFIG_CAVIUM_ERRATUM_30115=y -CONFIG_QCOM_FALKOR_ERRATUM_1003=y -CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y -CONFIG_QCOM_FALKOR_ERRATUM_1009=y -CONFIG_QCOM_QDF2400_ERRATUM_0065=y -CONFIG_QCOM_FALKOR_ERRATUM_E1041=y -CONFIG_ARM64_4K_PAGES=y -# CONFIG_ARM64_16K_PAGES is not set -# CONFIG_ARM64_64K_PAGES is not set -CONFIG_ARM64_VA_BITS_39=y -# CONFIG_ARM64_VA_BITS_48 is not set -CONFIG_ARM64_VA_BITS=39 -# CONFIG_CPU_BIG_ENDIAN is not set CONFIG_SCHED_MC=y -# CONFIG_SCHED_SMT is not set CONFIG_NR_CPUS=8 -CONFIG_HOTPLUG_CPU=y -CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y -CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y -CONFIG_ARCH_NR_GPIO=1280 -# CONFIG_NUMA is not set -CONFIG_HOLES_IN_ZONE=y -# CONFIG_PREEMPT_NONE is not set -# CONFIG_PREEMPT_VOLUNTARY is not set CONFIG_PREEMPT=y -CONFIG_PREEMPT_COUNT=y -# CONFIG_HZ_100 is not set +#ifdef OPLUS_FEATURE_HEALTHINFO +#wenbin.liu@PSW.BSP.MM, 2018/06/14 Delete for improve performance +#CONFIG_HZ_100=y CONFIG_HZ_250=y -# CONFIG_HZ_300 is not set -# CONFIG_HZ_1000 is not set -CONFIG_HZ=250 -CONFIG_SCHED_HRTICK=y -CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y -CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_SPARSEMEM_DEFAULT=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_HAVE_ARCH_PFN_VALID=y -CONFIG_HW_PERF_EVENTS=y -CONFIG_SYS_SUPPORTS_HUGETLBFS=y -CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y -CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y -CONFIG_SELECT_MEMORY_MODEL=y -CONFIG_SPARSEMEM_MANUAL=y -CONFIG_SPARSEMEM=y -CONFIG_HAVE_MEMORY_PRESENT=y -CONFIG_SPARSEMEM_EXTREME=y -CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y -CONFIG_SPARSEMEM_VMEMMAP=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_NO_BOOTMEM=y -CONFIG_MEMORY_ISOLATION=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +#endif /* OPLUS_FEATURE_HEALTHINFO */ CONFIG_MEMORY_HOTPLUG=y -CONFIG_MEMORY_HOTPLUG_SPARSE=y CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE=y CONFIG_MEMORY_HOTPLUG_MOVABLE_NODE=y CONFIG_MEMORY_HOTREMOVE=y -CONFIG_SPLIT_PTLOCK_CPUS=4 -CONFIG_COMPACTION=y -CONFIG_MIGRATION=y -CONFIG_PHYS_ADDR_T_64BIT=y -CONFIG_BOUNCE=y -# CONFIG_KSM is not set -CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 -CONFIG_ARCH_SUPPORTS_MEMORY_FAILURE=y -# CONFIG_MEMORY_FAILURE is not set -# CONFIG_TRANSPARENT_HUGEPAGE is not set -# CONFIG_ARCH_WANTS_THP_SWAP is not set -# CONFIG_CLEANCACHE is not set -# CONFIG_FRONTSWAP is not set CONFIG_CMA=y CONFIG_CMA_DEBUG=y -CONFIG_CMA_AREAS=7 -# CONFIG_ZPOOL is not set -# CONFIG_ZBUD is not set CONFIG_ZSMALLOC=y -CONFIG_PGTABLE_MAPPING=y -# CONFIG_ZSMALLOC_STAT is not set -CONFIG_GENERIC_EARLY_IOREMAP=y CONFIG_BALANCE_ANON_FILE_RECLAIM=y -# CONFIG_IDLE_PAGE_TRACKING is not set -CONFIG_FRAME_VECTOR=y -# CONFIG_PERCPU_STATS is not set -CONFIG_ARCH_SUPPORTS_SPECULATIVE_PAGE_FAULT=y -CONFIG_SPECULATIVE_PAGE_FAULT=y -CONFIG_HAVE_LOW_MEMORY_KILLER=y -CONFIG_PROCESS_RECLAIM=y -# CONFIG_FORCE_ALLOC_FROM_DMA_ZONE is not set -CONFIG_OPLUS_MULTI_KSWAPD=y -CONFIG_PROCESS_RECLAIM_ENHANCE=y -CONFIG_OPPO_MEM_MONITOR=y -CONFIG_PHYSICAL_ANTI_FRAGMENTATION=y -CONFIG_VIRTUAL_RESERVE_MEMORY=y -CONFIG_ARM64_DMA_USE_IOMMU=y -CONFIG_ARM64_DMA_IOMMU_ALIGNMENT=9 -CONFIG_ARCH_MEMORY_PROBE=y CONFIG_SECCOMP=y -# CONFIG_PARAVIRT is not set -# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set -# CONFIG_KEXEC is not set -# CONFIG_CRASH_DUMP is not set -# CONFIG_XEN is not set -# CONFIG_OKL4_GUEST is not set -CONFIG_FORCE_MAX_ZONEORDER=11 -CONFIG_UNMAP_KERNEL_AT_EL0=y -CONFIG_HARDEN_BRANCH_PREDICTOR=y -# CONFIG_PRINT_VMEMLAYOUT is not set CONFIG_ARM64_SSBD=y -CONFIG_ARM64_TAGGED_ADDR_ABI=y CONFIG_ARMV8_DEPRECATED=y CONFIG_SWP_EMULATION=y CONFIG_CP15_BARRIER_EMULATION=y CONFIG_SETEND_EMULATION=y CONFIG_ARM64_SW_TTBR0_PAN=y - -# -# ARMv8.1 architectural features -# -CONFIG_ARM64_HW_AFDBM=y -CONFIG_ARM64_PAN=y -# CONFIG_ARM64_LSE_ATOMICS is not set # CONFIG_ARM64_VHE is not set - -# -# ARMv8.2 architectural features -# -CONFIG_ARM64_UAO=y -# CONFIG_ARM64_PMEM is not set -CONFIG_ARM64_MODULE_CMODEL_LARGE=y -CONFIG_ARM64_MODULE_PLTS=y -CONFIG_RELOCATABLE=y CONFIG_RANDOMIZE_BASE=y -CONFIG_RANDOMIZE_MODULE_REGION_FULL=y - -# -# Boot options -# -CONFIG_CMDLINE="" # CONFIG_EFI is not set -CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE=y -CONFIG_IMG_GZ_DTB=y -# CONFIG_IMG_DTB is not set -CONFIG_BUILD_ARM64_APPENDED_KERNEL_IMAGE_NAME="Image.gz-dtb" -CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE_NAMES="" -CONFIG_BUILD_ARM64_KERNEL_COMPRESSION_GZIP=y -# CONFIG_BUILD_ARM64_UNCOMPRESSED_KERNEL is not set CONFIG_KRYO_PMU_WORKAROUND=y -#CONFIG_BUILD_ARM64_DT_OVERLAY=y - -# -# Userspace binary formats -# -CONFIG_BINFMT_ELF=y -CONFIG_COMPAT_BINFMT_ELF=y -CONFIG_ELFCORE=y # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set -CONFIG_BINFMT_SCRIPT=y -# CONFIG_HAVE_AOUT is not set -# CONFIG_BINFMT_MISC is not set -CONFIG_COREDUMP=y CONFIG_COMPAT=y - -# -# Power management options -# -CONFIG_SUSPEND=y -CONFIG_SUSPEND_FREEZER=y -# CONFIG_SUSPEND_SKIP_SYNC is not set -# CONFIG_HIBERNATION is not set -CONFIG_PM_SLEEP=y -CONFIG_PM_SLEEP_SMP=y -# CONFIG_PM_AUTOSLEEP is not set CONFIG_PM_WAKELOCKS=y CONFIG_PM_WAKELOCKS_LIMIT=0 # CONFIG_PM_WAKELOCKS_GC is not set -CONFIG_PM=y -# CONFIG_PM_DEBUG is not set -CONFIG_PM_OPP=y -CONFIG_PM_CLK=y -CONFIG_PM_GENERIC_DOMAINS=y -# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set -CONFIG_PM_GENERIC_DOMAINS_SLEEP=y -CONFIG_PM_GENERIC_DOMAINS_OF=y -CONFIG_CPU_PM=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y - -# -# CPU Power Management -# - -# -# CPU Idle -# CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y -# CONFIG_CPU_IDLE_GOV_LADDER is not set -CONFIG_CPU_IDLE_GOV_MENU=y -CONFIG_DT_IDLE_STATES=y - -# -# ARM CPU Idle Drivers -# CONFIG_ARM_CPUIDLE=y -# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set - -# -# CPU Frequency scaling -# CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_GOV_ATTR_SET=y -CONFIG_CPU_FREQ_GOV_COMMON=y CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_FREQ_TIMES=y -CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE is not set -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_POWERSAVE=y CONFIG_CPU_FREQ_GOV_USERSPACE=y CONFIG_CPU_FREQ_GOV_ONDEMAND=y CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y CONFIG_CPU_BOOST=y CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y -# CONFIG_CPU_FREQ_GOV_INTERACTIVE is not set - -# -# CPU frequency scaling drivers -# -# CONFIG_CPUFREQ_DT is not set -# CONFIG_CPUFREQ_DUMMY is not set -# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set -# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set -# CONFIG_CPU_FREQ_MSM is not set -# CONFIG_QORIQ_CPUFREQ is not set CONFIG_NET=y -CONFIG_COMPAT_NETLINK_MESSAGES=y -CONFIG_NET_INGRESS=y -CONFIG_NET_EGRESS=y - -# -# Networking options -# CONFIG_PACKET=y -# CONFIG_PACKET_DIAG is not set CONFIG_UNIX=y -# CONFIG_UNIX_DIAG is not set -# CONFIG_TLS is not set -CONFIG_XFRM=y -CONFIG_XFRM_ALGO=y CONFIG_XFRM_USER=y CONFIG_XFRM_INTERFACE=y -# CONFIG_XFRM_SUB_POLICY is not set -# CONFIG_XFRM_MIGRATE is not set CONFIG_XFRM_STATISTICS=y -CONFIG_XFRM_IPCOMP=y CONFIG_NET_KEY=y -# CONFIG_NET_KEY_MIGRATE is not set CONFIG_INET=y CONFIG_IP_MULTICAST=y CONFIG_IP_ADVANCED_ROUTER=y -# CONFIG_IP_FIB_TRIE_STATS is not set CONFIG_IP_MULTIPLE_TABLES=y -# CONFIG_IP_ROUTE_MULTIPATH is not set CONFIG_IP_ROUTE_VERBOSE=y CONFIG_IP_PNP=y CONFIG_IP_PNP_DHCP=y -# CONFIG_IP_PNP_BOOTP is not set -# CONFIG_IP_PNP_RARP is not set -# CONFIG_NET_IPIP is not set CONFIG_NET_IPGRE_DEMUX=y -CONFIG_NET_IP_TUNNEL=y -# CONFIG_NET_IPGRE is not set -# CONFIG_IP_MROUTE is not set CONFIG_SYN_COOKIES=y CONFIG_NET_IPVTI=y -CONFIG_NET_UDP_TUNNEL=y -# CONFIG_NET_FOU is not set -# CONFIG_NET_FOU_IP_TUNNELS is not set CONFIG_INET_AH=y CONFIG_INET_ESP=y -# CONFIG_INET_ESP_OFFLOAD is not set CONFIG_INET_IPCOMP=y -CONFIG_INET_XFRM_TUNNEL=y -CONFIG_INET_TUNNEL=y -CONFIG_INET_XFRM_MODE_TRANSPORT=y -CONFIG_INET_XFRM_MODE_TUNNEL=y -CONFIG_INET_XFRM_MODE_BEET=y -CONFIG_INET_DIAG=y -CONFIG_INET_TCP_DIAG=y CONFIG_INET_UDP_DIAG=y -# CONFIG_INET_RAW_DIAG is not set CONFIG_INET_DIAG_DESTROY=y -# CONFIG_TCP_CONG_ADVANCED is not set -CONFIG_TCP_CONG_CUBIC=y -CONFIG_DEFAULT_TCP_CONG="cubic" -# CONFIG_TCP_MD5SIG is not set -CONFIG_IPV6=y CONFIG_IPV6_ROUTER_PREF=y CONFIG_IPV6_ROUTE_INFO=y CONFIG_IPV6_OPTIMISTIC_DAD=y CONFIG_INET6_AH=y CONFIG_INET6_ESP=y -# CONFIG_INET6_ESP_OFFLOAD is not set CONFIG_INET6_IPCOMP=y CONFIG_IPV6_MIP6=y -# CONFIG_IPV6_ILA is not set -CONFIG_INET6_XFRM_TUNNEL=y -CONFIG_INET6_TUNNEL=y -CONFIG_INET6_XFRM_MODE_TRANSPORT=y -CONFIG_INET6_XFRM_MODE_TUNNEL=y -CONFIG_INET6_XFRM_MODE_BEET=y -# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set CONFIG_IPV6_VTI=y -CONFIG_IPV6_SIT=y -# CONFIG_IPV6_SIT_6RD is not set -CONFIG_IPV6_NDISC_NODETYPE=y -CONFIG_IPV6_TUNNEL=y -# CONFIG_IPV6_GRE is not set -# CONFIG_IPV6_FOU is not set -# CONFIG_IPV6_FOU_TUNNEL is not set CONFIG_IPV6_MULTIPLE_TABLES=y CONFIG_IPV6_SUBTREES=y -# CONFIG_IPV6_MROUTE is not set -# CONFIG_IPV6_SEG6_LWTUNNEL is not set -# CONFIG_IPV6_SEG6_HMAC is not set -CONFIG_NETLABEL=y -CONFIG_NETWORK_SECMARK=y -CONFIG_NET_PTP_CLASSIFY=y -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set CONFIG_NETFILTER=y -CONFIG_NETFILTER_ADVANCED=y -CONFIG_BRIDGE_NETFILTER=m - -# -# Core Netfilter Configuration -# -CONFIG_NETFILTER_INGRESS=y -CONFIG_NETFILTER_NETLINK=y -# CONFIG_NETFILTER_NETLINK_ACCT is not set -CONFIG_NETFILTER_NETLINK_QUEUE=y -CONFIG_NETFILTER_NETLINK_LOG=y CONFIG_NF_CONNTRACK=y -CONFIG_NF_LOG_COMMON=y -# CONFIG_NF_LOG_NETDEV is not set -CONFIG_NF_CONNTRACK_MARK=y CONFIG_NF_CONNTRACK_SECMARK=y -# CONFIG_NF_CONNTRACK_ZONES is not set -CONFIG_NF_CONNTRACK_PROCFS=y CONFIG_NF_CONNTRACK_EVENTS=y -# CONFIG_NF_CONNTRACK_TIMEOUT is not set -# CONFIG_NF_CONNTRACK_TIMESTAMP is not set -CONFIG_NF_CT_PROTO_DCCP=y -CONFIG_NF_CT_PROTO_GRE=y -CONFIG_NF_CT_PROTO_SCTP=y -CONFIG_NF_CT_PROTO_UDPLITE=y CONFIG_NF_CONNTRACK_AMANDA=y CONFIG_NF_CONNTRACK_FTP=y CONFIG_NF_CONNTRACK_H323=y CONFIG_NF_CONNTRACK_IRC=y -CONFIG_NF_CONNTRACK_BROADCAST=y CONFIG_NF_CONNTRACK_NETBIOS_NS=y -# CONFIG_NF_CONNTRACK_SNMP is not set CONFIG_NF_CONNTRACK_PPTP=y CONFIG_NF_CONNTRACK_SANE=y -# CONFIG_NF_CONNTRACK_SIP is not set CONFIG_NF_CONNTRACK_TFTP=y CONFIG_NF_CT_NETLINK=y -# CONFIG_NF_CT_NETLINK_TIMEOUT is not set -# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set -CONFIG_NF_NAT=y -CONFIG_NF_NAT_NEEDED=y -CONFIG_NF_NAT_PROTO_DCCP=y -CONFIG_NF_NAT_PROTO_UDPLITE=y -CONFIG_NF_NAT_PROTO_SCTP=y -CONFIG_NF_NAT_AMANDA=y -CONFIG_NF_NAT_FTP=y -CONFIG_NF_NAT_IRC=y -# CONFIG_NF_NAT_SIP is not set -CONFIG_NF_NAT_TFTP=y -CONFIG_NF_NAT_REDIRECT=y -# CONFIG_NF_TABLES is not set -CONFIG_NETFILTER_XTABLES=y - -# -# Xtables combined modules -# -CONFIG_NETFILTER_XT_MARK=y -CONFIG_NETFILTER_XT_CONNMARK=y - -# -# Xtables targets -# -# CONFIG_NETFILTER_XT_TARGET_AUDIT is not set -# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set CONFIG_NETFILTER_XT_TARGET_CLASSIFY=y CONFIG_NETFILTER_XT_TARGET_CONNMARK=y CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=y -CONFIG_NETFILTER_XT_TARGET_CT=y CONFIG_NETFILTER_XT_TARGET_DSCP=y -# CONFIG_NETFILTER_XT_TARGET_HL is not set -# CONFIG_NETFILTER_XT_TARGET_HMARK is not set CONFIG_NETFILTER_XT_TARGET_IDLETIMER=y CONFIG_NETFILTER_XT_TARGET_HARDIDLETIMER=y -# CONFIG_NETFILTER_XT_TARGET_LED is not set CONFIG_NETFILTER_XT_TARGET_LOG=y -CONFIG_NETFILTER_XT_TARGET_IMQ=y CONFIG_NETFILTER_XT_TARGET_MARK=y -CONFIG_NETFILTER_XT_NAT=y -CONFIG_NETFILTER_XT_TARGET_NETMAP=y CONFIG_NETFILTER_XT_TARGET_NFLOG=y CONFIG_NETFILTER_XT_TARGET_NFQUEUE=y CONFIG_NETFILTER_XT_TARGET_NOTRACK=y -# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set -CONFIG_NETFILTER_XT_TARGET_REDIRECT=y CONFIG_NETFILTER_XT_TARGET_TEE=y CONFIG_NETFILTER_XT_TARGET_TPROXY=y CONFIG_NETFILTER_XT_TARGET_TRACE=y CONFIG_NETFILTER_XT_TARGET_SECMARK=y CONFIG_NETFILTER_XT_TARGET_TCPMSS=y -# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set - -# -# Xtables matches -# -# CONFIG_NETFILTER_XT_MATCH_ADDRTYPE is not set CONFIG_NETFILTER_XT_MATCH_BPF=y -# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set CONFIG_NETFILTER_XT_MATCH_COMMENT=y -# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=y CONFIG_NETFILTER_XT_MATCH_CONNMARK=y CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y -# CONFIG_NETFILTER_XT_MATCH_CPU is not set -# CONFIG_NETFILTER_XT_MATCH_DCCP is not set -# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set CONFIG_NETFILTER_XT_MATCH_DSCP=y -CONFIG_NETFILTER_XT_MATCH_ECN=y CONFIG_NETFILTER_XT_MATCH_ESP=y CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=y CONFIG_NETFILTER_XT_MATCH_HELPER=y -CONFIG_NETFILTER_XT_MATCH_HL=y -# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set CONFIG_NETFILTER_XT_MATCH_IPRANGE=y # CONFIG_NETFILTER_XT_MATCH_L2TP is not set CONFIG_NETFILTER_XT_MATCH_LENGTH=y @@ -977,44 +181,21 @@ CONFIG_NETFILTER_XT_MATCH_LIMIT=y CONFIG_NETFILTER_XT_MATCH_MAC=y CONFIG_NETFILTER_XT_MATCH_MARK=y CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y -# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set -# CONFIG_NETFILTER_XT_MATCH_OSF is not set CONFIG_NETFILTER_XT_MATCH_OWNER=y CONFIG_NETFILTER_XT_MATCH_POLICY=y -# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y CONFIG_NETFILTER_XT_MATCH_QUOTA=y CONFIG_NETFILTER_XT_MATCH_QUOTA2=y CONFIG_NETFILTER_XT_MATCH_QUOTA2_LOG=y -# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set -# CONFIG_NETFILTER_XT_MATCH_REALM is not set -# CONFIG_NETFILTER_XT_MATCH_RECENT is not set # CONFIG_NETFILTER_XT_MATCH_SCTP is not set CONFIG_NETFILTER_XT_MATCH_SOCKET=y CONFIG_NETFILTER_XT_MATCH_STATE=y CONFIG_NETFILTER_XT_MATCH_STATISTIC=y CONFIG_NETFILTER_XT_MATCH_STRING=y -# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set CONFIG_NETFILTER_XT_MATCH_TIME=y CONFIG_NETFILTER_XT_MATCH_U32=y -# CONFIG_IP_SET is not set -# CONFIG_IP_VS is not set - -# -# IP: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV4=y CONFIG_NF_CONNTRACK_IPV4=y CONFIG_NF_SOCKET_IPV4=y -CONFIG_NF_DUP_IPV4=y -# CONFIG_NF_LOG_ARP is not set -CONFIG_NF_LOG_IPV4=y -CONFIG_NF_REJECT_IPV4=y -CONFIG_NF_NAT_IPV4=y -CONFIG_NF_NAT_MASQUERADE_IPV4=y -CONFIG_NF_NAT_PROTO_GRE=y -CONFIG_NF_NAT_PPTP=y -CONFIG_NF_NAT_H323=y CONFIG_IP_NF_IPTABLES=y CONFIG_IP_NF_MATCH_AH=y CONFIG_IP_NF_MATCH_ECN=y @@ -1022,915 +203,114 @@ CONFIG_IP_NF_MATCH_RPFILTER=y CONFIG_IP_NF_MATCH_TTL=y CONFIG_IP_NF_FILTER=y CONFIG_IP_NF_TARGET_REJECT=y -# CONFIG_IP_NF_TARGET_SYNPROXY is not set CONFIG_IP_NF_NAT=y CONFIG_IP_NF_TARGET_MASQUERADE=y -# CONFIG_IP_NF_TARGET_NATTYPE_MODULE is not set CONFIG_IP_NF_TARGET_NETMAP=y CONFIG_IP_NF_TARGET_REDIRECT=y CONFIG_IP_NF_MANGLE=y -# CONFIG_IP_NF_TARGET_CLUSTERIP is not set -# CONFIG_IP_NF_TARGET_ECN is not set -# CONFIG_IP_NF_TARGET_TTL is not set CONFIG_IP_NF_RAW=y CONFIG_IP_NF_SECURITY=y CONFIG_IP_NF_ARPTABLES=y CONFIG_IP_NF_ARPFILTER=y CONFIG_IP_NF_ARP_MANGLE=y - -# -# IPv6: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV6=y CONFIG_NF_CONNTRACK_IPV6=y CONFIG_NF_SOCKET_IPV6=y -CONFIG_NF_DUP_IPV6=y -CONFIG_NF_REJECT_IPV6=y -CONFIG_NF_LOG_IPV6=y -# CONFIG_NF_NAT_IPV6 is not set CONFIG_IP6_NF_IPTABLES=y -# CONFIG_IP6_NF_MATCH_AH is not set -# CONFIG_IP6_NF_MATCH_EUI64 is not set -# CONFIG_IP6_NF_MATCH_FRAG is not set -# CONFIG_IP6_NF_MATCH_OPTS is not set -# CONFIG_IP6_NF_MATCH_HL is not set -# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set -# CONFIG_IP6_NF_MATCH_MH is not set CONFIG_IP6_NF_MATCH_RPFILTER=y -# CONFIG_IP6_NF_MATCH_RT is not set -# CONFIG_IP6_NF_TARGET_HL is not set CONFIG_IP6_NF_FILTER=y CONFIG_IP6_NF_TARGET_REJECT=y -# CONFIG_IP6_NF_TARGET_SYNPROXY is not set CONFIG_IP6_NF_MANGLE=y CONFIG_IP6_NF_RAW=y -# CONFIG_IP6_NF_SECURITY is not set -# CONFIG_IP6_NF_NAT is not set CONFIG_BRIDGE_NF_EBTABLES=y CONFIG_BRIDGE_EBT_BROUTE=y -# CONFIG_BRIDGE_EBT_T_FILTER is not set -# CONFIG_BRIDGE_EBT_T_NAT is not set -# CONFIG_BRIDGE_EBT_802_3 is not set -# CONFIG_BRIDGE_EBT_AMONG is not set -# CONFIG_BRIDGE_EBT_ARP is not set -# CONFIG_BRIDGE_EBT_IP is not set -# CONFIG_BRIDGE_EBT_IP6 is not set -# CONFIG_BRIDGE_EBT_LIMIT is not set -# CONFIG_BRIDGE_EBT_MARK is not set -# CONFIG_BRIDGE_EBT_PKTTYPE is not set -# CONFIG_BRIDGE_EBT_STP is not set -# CONFIG_BRIDGE_EBT_VLAN is not set -# CONFIG_BRIDGE_EBT_ARPREPLY is not set -# CONFIG_BRIDGE_EBT_DNAT is not set -# CONFIG_BRIDGE_EBT_MARK_T is not set -# CONFIG_BRIDGE_EBT_REDIRECT is not set -# CONFIG_BRIDGE_EBT_SNAT is not set -# CONFIG_BRIDGE_EBT_LOG is not set -# CONFIG_BRIDGE_EBT_NFLOG is not set -# CONFIG_IP_DCCP is not set CONFIG_IP_SCTP=y -# CONFIG_SCTP_DBG_OBJCNT is not set -CONFIG_SCTP_DEFAULT_COOKIE_HMAC_MD5=y -# CONFIG_SCTP_DEFAULT_COOKIE_HMAC_SHA1 is not set -# CONFIG_SCTP_DEFAULT_COOKIE_HMAC_NONE is not set -CONFIG_SCTP_COOKIE_HMAC_MD5=y -# CONFIG_SCTP_COOKIE_HMAC_SHA1 is not set -CONFIG_INET_SCTP_DIAG=y -# CONFIG_RDS is not set -# CONFIG_TIPC is not set -# CONFIG_ATM is not set CONFIG_L2TP=y CONFIG_L2TP_V3=y CONFIG_L2TP_IP=y CONFIG_L2TP_ETH=y -CONFIG_STP=y CONFIG_BRIDGE=y -CONFIG_BRIDGE_IGMP_SNOOPING=y -CONFIG_HAVE_NET_DSA=y -# CONFIG_NET_DSA is not set -# CONFIG_VLAN_8021Q is not set -# CONFIG_DECNET is not set -CONFIG_LLC=y -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_PHONET is not set -# CONFIG_6LOWPAN is not set -# CONFIG_IEEE802154 is not set CONFIG_NET_SCHED=y - -# -# Queueing/Scheduling -# -# CONFIG_NET_SCH_CBQ is not set CONFIG_NET_SCH_HTB=y -# CONFIG_NET_SCH_HFSC is not set CONFIG_NET_SCH_PRIO=y CONFIG_NET_SCH_MULTIQ=y -# CONFIG_NET_SCH_RED is not set -# CONFIG_NET_SCH_SFB is not set -# CONFIG_NET_SCH_SFQ is not set -# CONFIG_NET_SCH_TEQL is not set -# CONFIG_NET_SCH_TBF is not set -# CONFIG_NET_SCH_GRED is not set -# CONFIG_NET_SCH_DSMARK is not set -# CONFIG_NET_SCH_NETEM is not set -# CONFIG_NET_SCH_DRR is not set -# CONFIG_NET_SCH_MQPRIO is not set -# CONFIG_NET_SCH_CHOKE is not set -# CONFIG_NET_SCH_QFQ is not set -# CONFIG_NET_SCH_CODEL is not set -# CONFIG_NET_SCH_FQ_CODEL is not set -# CONFIG_NET_SCH_FQ is not set -# CONFIG_NET_SCH_HHF is not set -# CONFIG_NET_SCH_PIE is not set CONFIG_NET_SCH_INGRESS=y -# CONFIG_NET_SCH_PLUG is not set -# CONFIG_NET_SCH_DEFAULT is not set - -# -# Classification -# -CONFIG_NET_CLS=y -# CONFIG_NET_CLS_BASIC is not set -# CONFIG_NET_CLS_TCINDEX is not set -# CONFIG_NET_CLS_ROUTE4 is not set CONFIG_NET_CLS_FW=y CONFIG_NET_CLS_U32=y -# CONFIG_CLS_U32_PERF is not set CONFIG_CLS_U32_MARK=y -# CONFIG_NET_CLS_RSVP is not set -# CONFIG_NET_CLS_RSVP6 is not set CONFIG_NET_CLS_FLOW=y -# CONFIG_NET_CLS_CGROUP is not set CONFIG_NET_CLS_BPF=y -# CONFIG_NET_CLS_FLOWER is not set -# CONFIG_NET_CLS_MATCHALL is not set CONFIG_NET_EMATCH=y -CONFIG_NET_EMATCH_STACK=32 CONFIG_NET_EMATCH_CMP=y CONFIG_NET_EMATCH_NBYTE=y CONFIG_NET_EMATCH_U32=y CONFIG_NET_EMATCH_META=y CONFIG_NET_EMATCH_TEXT=y CONFIG_NET_CLS_ACT=y -# CONFIG_NET_ACT_POLICE is not set CONFIG_NET_ACT_GACT=y -# CONFIG_GACT_PROB is not set CONFIG_NET_ACT_MIRRED=y -# CONFIG_NET_ACT_SAMPLE is not set -# CONFIG_NET_ACT_IPT is not set -# CONFIG_NET_ACT_NAT is not set -# CONFIG_NET_ACT_PEDIT is not set -# CONFIG_NET_ACT_SIMP is not set CONFIG_NET_ACT_SKBEDIT=y -# CONFIG_NET_ACT_CSUM is not set -# CONFIG_NET_ACT_VLAN is not set -# CONFIG_NET_ACT_BPF is not set -# CONFIG_NET_ACT_CONNMARK is not set -# CONFIG_NET_ACT_SKBMOD is not set -# CONFIG_NET_ACT_IFE is not set -# CONFIG_NET_ACT_TUNNEL_KEY is not set -# CONFIG_NET_CLS_IND is not set -CONFIG_NET_SCH_FIFO=y -# CONFIG_DCB is not set -# CONFIG_DNS_RESOLVER is not set -# CONFIG_BATMAN_ADV is not set -# CONFIG_OPENVSWITCH is not set -# CONFIG_VSOCKETS is not set -# CONFIG_NETLINK_DIAG is not set -# CONFIG_MPLS is not set -# CONFIG_NET_NSH is not set -# CONFIG_HSR is not set -# CONFIG_NET_SWITCHDEV is not set -# CONFIG_NET_L3_MASTER_DEV is not set CONFIG_QRTR=y -CONFIG_QRTR_NODE_ID=1 CONFIG_QRTR_SMD=y -# CONFIG_QRTR_USB is not set -# CONFIG_QRTR_FIFO is not set -# CONFIG_QRTR_ETHERNET is not set -# CONFIG_NET_NCSI is not set -# CONFIG_RMNET_DATA is not set -# CONFIG_RMNET_USB is not set -CONFIG_RPS=y -CONFIG_RFS_ACCEL=y -CONFIG_XPS=y -# CONFIG_CGROUP_NET_PRIO is not set -# CONFIG_CGROUP_NET_CLASSID is not set -CONFIG_NET_RX_BUSY_POLL=y -CONFIG_BQL=y CONFIG_BPF_JIT=y -# CONFIG_BPF_STREAM_PARSER is not set -CONFIG_NET_FLOW_LIMIT=y CONFIG_SOCKEV_NLMCAST=y - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -# CONFIG_NET_DROP_MONITOR is not set -# CONFIG_HAMRADIO is not set -# CONFIG_CAN is not set CONFIG_BT=y -CONFIG_BT_BREDR=y -# CONFIG_BT_RFCOMM is not set -# CONFIG_BT_BNEP is not set -# CONFIG_BT_HIDP is not set -CONFIG_BT_HS=y -CONFIG_BT_LE=y -# CONFIG_BT_LEDS is not set -# CONFIG_BT_SELFTEST is not set - -# -# Bluetooth device drivers -# -# CONFIG_BT_HCIBTUSB is not set -# CONFIG_BT_HCIBTSDIO is not set -# CONFIG_BT_HCIUART is not set -# CONFIG_BT_HCIBCM203X is not set -# CONFIG_BT_HCIBFUSB is not set -# CONFIG_BT_HCIVHCI is not set -# CONFIG_BT_MRVL is not set CONFIG_MSM_BT_POWER=y -CONFIG_BTFM_SLIM=y -CONFIG_BTFM_SLIM_WCN3990=y -# CONFIG_AF_RXRPC is not set -# CONFIG_AF_KCM is not set -# CONFIG_STREAM_PARSER is not set -CONFIG_FIB_RULES=y -CONFIG_WIRELESS=y -CONFIG_WIRELESS_EXT=y -CONFIG_WEXT_CORE=y -CONFIG_WEXT_PROC=y -CONFIG_WEXT_SPY=y -CONFIG_WEXT_PRIV=y CONFIG_CFG80211=y -CONFIG_NL80211_TESTMODE=y -# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set CONFIG_CFG80211_CERTIFICATION_ONUS=y CONFIG_CFG80211_REG_CELLULAR_HINTS=y -# CONFIG_CFG80211_REG_RELAX_NO_IR is not set -CONFIG_CFG80211_DEFAULT_PS=y CONFIG_CFG80211_INTERNAL_REGDB=y -CONFIG_CFG80211_CRDA_SUPPORT=y -# CONFIG_CFG80211_WEXT is not set -# CONFIG_LIB80211 is not set -# CONFIG_MAC80211 is not set -CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 -# CONFIG_WIMAX is not set CONFIG_RFKILL=y -CONFIG_RFKILL_PM=y -CONFIG_RFKILL_LEDS=y -# CONFIG_RFKILL_INPUT is not set -# CONFIG_RFKILL_GPIO is not set -# CONFIG_NET_9P is not set -# CONFIG_CAIF is not set -# CONFIG_CEPH_LIB is not set -# CONFIG_NFC is not set -CONFIG_OPPO_NFC=y CONFIG_NFC_NQ=y -# CONFIG_NTAG_NQ is not set -# CONFIG_PSAMPLE is not set -# CONFIG_NET_IFE is not set -# CONFIG_LWTUNNEL is not set -CONFIG_DST_CACHE=y -CONFIG_GRO_CELLS=y -# CONFIG_NET_DEVLINK is not set -CONFIG_MAY_USE_DEVLINK=y -CONFIG_HAVE_EBPF_JIT=y - -# -# Device Drivers -# -CONFIG_ARM_AMBA=y - -# -# Generic Driver Options -# -# CONFIG_PLATFORM_AUTO is not set -CONFIG_UEVENT_HELPER=y -CONFIG_UEVENT_HELPER_PATH="" -# CONFIG_DEVTMPFS is not set -CONFIG_STANDALONE=y -CONFIG_PREVENT_FIRMWARE_BUILD=y -CONFIG_FW_LOADER=y -CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_EXTRA_FIRMWARE="" -CONFIG_FW_LOADER_USER_HELPER=y +#ifdef OPLUS_NFC_BRINGUP +#DengWeiwei@CONNECTIVITY.NFC.HARDWARE.253154, 2020/08/09 +#Add for the kernel Macro for NXP PN557 NFC kernel +CONFIG_NFC_PN553_DEVICES=y +#endif /*OPLUS_NFC_BRINGUP*/ CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y -# CONFIG_FW_CACHE is not set -CONFIG_WANT_DEV_COREDUMP=y -CONFIG_ALLOW_DEV_COREDUMP=y -CONFIG_DEV_COREDUMP=y -# CONFIG_DEBUG_DRIVER is not set -# CONFIG_DEBUG_DEVRES is not set -# CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set -# CONFIG_TEST_ASYNC_DRIVER_PROBE is not set -# CONFIG_SYS_HYPERVISOR is not set -# CONFIG_GENERIC_CPU_DEVICES is not set -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_CPU_VULNERABILITIES=y -CONFIG_SOC_BUS=y -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_SPI=y -CONFIG_REGMAP_SPMI=y -CONFIG_REGMAP_MMIO=y -CONFIG_REGMAP_IRQ=y CONFIG_REGMAP_WCD_IRQ=y -CONFIG_DMA_SHARED_BUFFER=y -# CONFIG_DMA_FENCE_TRACE is not set +CONFIG_REGMAP_ALLOW_WRITE_DEBUGFS=y CONFIG_DMA_CMA=y - -# -# Default contiguous memory area size: -# -CONFIG_CMA_SIZE_MBYTES=16 -CONFIG_CMA_SIZE_SEL_MBYTES=y -# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set -# CONFIG_CMA_SIZE_SEL_MIN is not set -# CONFIG_CMA_SIZE_SEL_MAX is not set -CONFIG_CMA_ALIGNMENT=8 -CONFIG_GENERIC_ARCH_TOPOLOGY=y - -# -# Bus devices -# -# CONFIG_ARM_CCI400_PMU is not set -# CONFIG_ARM_CCI5xx_PMU is not set -# CONFIG_ARM_CCN is not set -# CONFIG_BRCMSTB_GISB_ARB is not set -CONFIG_QCOM_EBI2=y -# CONFIG_SIMPLE_PM_BUS is not set -# CONFIG_VEXPRESS_CONFIG is not set -# CONFIG_MHI_BUS is not set - -# -# MHI controllers -# - -# -# MHI device support -# -# CONFIG_CONNECTOR is not set -# CONFIG_GNSS is not set -# CONFIG_MTD is not set -CONFIG_DTC=y -CONFIG_OF=y -# CONFIG_OF_UNITTEST is not set -CONFIG_OF_FLATTREE=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_KOBJ=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_ADDRESS_PCI=y -CONFIG_OF_IRQ=y -CONFIG_OF_NET=y -CONFIG_OF_MDIO=y -CONFIG_OF_PCI=y -CONFIG_OF_PCI_IRQ=y -CONFIG_OF_RESERVED_MEM=y -CONFIG_OF_SLIMBUS=y -# CONFIG_OF_OVERLAY is not set -CONFIG_OF_BATTERYDATA=y -# CONFIG_PARPORT is not set -CONFIG_BLK_DEV=y -# CONFIG_BLK_DEV_NULL_BLK is not set -# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set CONFIG_ZRAM=y CONFIG_ZRAM_DEDUP=y -# CONFIG_ZRAM_WRITEBACK is not set -CONFIG_OPLUS_ZRAM_OPT=y -# CONFIG_BLK_DEV_DAC960 is not set -# CONFIG_BLK_DEV_UMEM is not set -# CONFIG_BLK_DEV_COW_COMMON is not set CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_LOOP_MIN_COUNT=16 -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_DRBD is not set -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_SKD is not set -# CONFIG_BLK_DEV_SX8 is not set CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=8192 -# CONFIG_CDROM_PKTCDVD is not set -# CONFIG_ATA_OVER_ETH is not set -# CONFIG_BLK_DEV_RBD is not set -# CONFIG_BLK_DEV_RSXX is not set -# CONFIG_BLK_DEV_NVME is not set -# CONFIG_NVME_FC is not set -# CONFIG_NVME_TARGET is not set - -# -# Misc devices -# -# CONFIG_SENSORS_LIS3LV02D is not set -# CONFIG_AD525X_DPOT is not set -# CONFIG_DUMMY_IRQ is not set -# CONFIG_PHANTOM is not set -# CONFIG_SGI_IOC4 is not set -# CONFIG_TIFM_CORE is not set -# CONFIG_ICS932S401 is not set -# CONFIG_ENCLOSURE_SERVICES is not set -# CONFIG_HP_ILO is not set -# CONFIG_QCOM_COINCELL is not set -# CONFIG_APDS9802ALS is not set -# CONFIG_ISL29003 is not set -# CONFIG_ISL29020 is not set -# CONFIG_SENSORS_TSL2550 is not set -# CONFIG_SENSORS_BH1770 is not set -# CONFIG_SENSORS_APDS990X is not set -# CONFIG_HMC6352 is not set -# CONFIG_DS1682 is not set -# CONFIG_TI_DAC7512 is not set -# CONFIG_USB_SWITCH_FSA9480 is not set -# CONFIG_LATTICE_ECP3_CONFIG is not set -# CONFIG_SRAM is not set CONFIG_HDCP_QSEECOM=y CONFIG_QSEECOM=y -# CONFIG_PROFILER is not set -# CONFIG_PCI_ENDPOINT_TEST is not set CONFIG_UID_SYS_STATS=y -# CONFIG_UID_SYS_STATS_DEBUG is not set CONFIG_MEMORY_STATE_TIME=y CONFIG_QPNP_MISC=y -# CONFIG_C2PORT is not set - -# -# EEPROM support -# -# CONFIG_EEPROM_AT24 is not set -# CONFIG_EEPROM_AT25 is not set -# CONFIG_EEPROM_LEGACY is not set -# CONFIG_EEPROM_MAX6875 is not set -# CONFIG_EEPROM_93CX6 is not set -# CONFIG_EEPROM_93XX46 is not set -# CONFIG_EEPROM_IDT_89HPESX is not set -# CONFIG_CB710_CORE is not set - -# -# Texas Instruments shared transport line discipline -# -# CONFIG_TI_ST is not set -# CONFIG_SENSORS_LIS3_SPI is not set -# CONFIG_SENSORS_LIS3_I2C is not set - -# -# Altera FPGA firmware download module -# -# CONFIG_ALTERA_STAPL is not set - -# -# Intel MIC Bus Driver -# - -# -# SCIF Bus Driver -# - -# -# VOP Bus Driver -# - -# -# Intel MIC Host Driver -# - -# -# Intel MIC Card Driver -# - -# -# SCIF Driver -# - -# -# Intel MIC Coprocessor State Management (COSM) Drivers -# - -# -# VOP Driver -# -# CONFIG_GENWQE is not set -# CONFIG_ECHO is not set -# CONFIG_CXL_BASE is not set -# CONFIG_CXL_AFU_DRIVER_OPS is not set -# CONFIG_CXL_LIB is not set -# CONFIG_AW8697_HAPTIC is not set - -# -# FingerprintCard fingerprint driver -# CONFIG_FPR_FPC=y -# CONFIG_OPPO_MOTOR is not set -CONFIG_OPLUS_RF_CABLE_MONITOR=y -CONFIG_SIM_DETECT=y - -# -# SCSI device support -# -CONFIG_SCSI_MOD=y -# CONFIG_RAID_ATTRS is not set CONFIG_SCSI=y -CONFIG_SCSI_DMA=y -# CONFIG_SCSI_NETLINK is not set -# CONFIG_SCSI_MQ_DEFAULT is not set -CONFIG_SCSI_PROC_FS=y - -# -# SCSI support type (disk, tape, CD-ROM) -# CONFIG_BLK_DEV_SD=y -# CONFIG_CHR_DEV_ST is not set -# CONFIG_CHR_DEV_OSST is not set -# CONFIG_BLK_DEV_SR is not set CONFIG_CHR_DEV_SG=y CONFIG_CHR_DEV_SCH=y CONFIG_SCSI_CONSTANTS=y -# CONFIG_SCSI_LOGGING is not set CONFIG_SCSI_SCAN_ASYNC=y - -# -# SCSI Transports -# -# CONFIG_SCSI_SPI_ATTRS is not set -# CONFIG_SCSI_FC_ATTRS is not set -# CONFIG_SCSI_ISCSI_ATTRS is not set -# CONFIG_SCSI_SAS_ATTRS is not set -# CONFIG_SCSI_SAS_LIBSAS is not set -# CONFIG_SCSI_SRP_ATTRS is not set -CONFIG_SCSI_LOWLEVEL=y -# CONFIG_ISCSI_TCP is not set -# CONFIG_ISCSI_BOOT_SYSFS is not set -# CONFIG_SCSI_CXGB3_ISCSI is not set -# CONFIG_SCSI_CXGB4_ISCSI is not set -# CONFIG_SCSI_BNX2_ISCSI is not set -# CONFIG_BE2ISCSI is not set -# CONFIG_BLK_DEV_3W_XXXX_RAID is not set -# CONFIG_SCSI_HPSA is not set -# CONFIG_SCSI_3W_9XXX is not set -# CONFIG_SCSI_3W_SAS is not set -# CONFIG_SCSI_ACARD is not set -# CONFIG_SCSI_AACRAID is not set -# CONFIG_SCSI_AIC7XXX is not set -# CONFIG_SCSI_AIC79XX is not set -# CONFIG_SCSI_AIC94XX is not set -# CONFIG_SCSI_MVSAS is not set -# CONFIG_SCSI_MVUMI is not set -# CONFIG_SCSI_ADVANSYS is not set -# CONFIG_SCSI_ARCMSR is not set -# CONFIG_SCSI_ESAS2R is not set -# CONFIG_MEGARAID_NEWGEN is not set -# CONFIG_MEGARAID_LEGACY is not set -# CONFIG_MEGARAID_SAS is not set -# CONFIG_SCSI_MPT3SAS is not set -# CONFIG_SCSI_MPT2SAS is not set -# CONFIG_SCSI_SMARTPQI is not set CONFIG_SCSI_UFSHCD=y -# CONFIG_SCSI_UFSHCD_PCI is not set CONFIG_SCSI_UFSHCD_PLATFORM=y -# CONFIG_SCSI_UFS_DWC_TC_PLATFORM is not set CONFIG_SCSI_UFS_QCOM=y -# CONFIG_SCSI_UFSHCD_CMD_LOGGING is not set -CONFIG_UFSFEATURE=y -CONFIG_UFSHPB=y -CONFIG_HPB_SUP_ONLY_4=y -CONFIG_HPB_SUP_8_TO_32=y -CONFIG_HPB_SUP_OVER_36=y -CONFIG_UFSTW=y -CONFIG_UFSTW_IGNORE_GUARANTEE_BIT=y CONFIG_SCSI_UFS_CRYPTO=y CONFIG_SCSI_UFS_CRYPTO_QTI=y -# CONFIG_SCSI_HPTIOP is not set -# CONFIG_SCSI_SNIC is not set -# CONFIG_SCSI_DMX3191D is not set -# CONFIG_SCSI_FUTURE_DOMAIN is not set -# CONFIG_SCSI_IPS is not set -# CONFIG_SCSI_INITIO is not set -# CONFIG_SCSI_INIA100 is not set -# CONFIG_SCSI_STEX is not set -# CONFIG_SCSI_SYM53C8XX_2 is not set -# CONFIG_SCSI_QLOGIC_1280 is not set -# CONFIG_SCSI_QLA_ISCSI is not set -# CONFIG_SCSI_DC395x is not set -# CONFIG_SCSI_AM53C974 is not set -# CONFIG_SCSI_WD719X is not set -# CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_PMCRAID is not set -# CONFIG_SCSI_PM8001 is not set -# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set -# CONFIG_SCSI_DH is not set -# CONFIG_SCSI_OSD_INITIATOR is not set -CONFIG_HAVE_PATA_PLATFORM=y -# CONFIG_ATA is not set CONFIG_MD=y -# CONFIG_BLK_DEV_MD is not set -# CONFIG_BCACHE is not set -CONFIG_BLK_DEV_DM_BUILTIN=y CONFIG_BLK_DEV_DM=y -# CONFIG_DM_MQ_DEFAULT is not set -# CONFIG_DM_DEBUG is not set -CONFIG_DM_BUFIO=y -# CONFIG_DM_DEBUG_BLOCK_MANAGER_LOCKING is not set CONFIG_DM_CRYPT=y CONFIG_DM_DEFAULT_KEY=y CONFIG_DM_SNAPSHOT=y -# CONFIG_DM_THIN_PROVISIONING is not set -# CONFIG_DM_CACHE is not set -# CONFIG_DM_ERA is not set -# CONFIG_DM_MIRROR is not set -# CONFIG_DM_RAID is not set -# CONFIG_DM_ZERO is not set -# CONFIG_DM_MULTIPATH is not set -# CONFIG_DM_DELAY is not set CONFIG_DM_UEVENT=y -# CONFIG_DM_FLAKEY is not set CONFIG_DM_VERITY=y CONFIG_DM_VERITY_FEC=y -# CONFIG_DM_SWITCH is not set -# CONFIG_DM_LOG_WRITES is not set -# CONFIG_DM_INTEGRITY is not set -# CONFIG_DM_VERITY_AVB is not set -# CONFIG_DM_ANDROID_VERITY_AT_MOST_ONCE_DEFAULT_ENABLED is not set -# CONFIG_DM_BOW is not set -# CONFIG_TARGET_CORE is not set -# CONFIG_FUSION is not set - -# -# IEEE 1394 (FireWire) support -# -# CONFIG_FIREWIRE is not set -# CONFIG_FIREWIRE_NOSY is not set CONFIG_NETDEVICES=y -CONFIG_MII=y -CONFIG_NET_CORE=y CONFIG_BONDING=y CONFIG_DUMMY=y -# CONFIG_EQUALIZER is not set -# CONFIG_NET_FC is not set -# CONFIG_IFB is not set -# CONFIG_NET_TEAM is not set -# CONFIG_MACVLAN is not set -# CONFIG_VXLAN is not set -# CONFIG_GENEVE is not set -# CONFIG_GTP is not set -# CONFIG_MACSEC is not set -# CONFIG_NETCONSOLE is not set -# CONFIG_NETPOLL is not set -# CONFIG_NET_POLL_CONTROLLER is not set -# CONFIG_RMNET_IPLO is not set -CONFIG_IMQ=y -CONFIG_IMQ_NUM_DEVS=2 CONFIG_TUN=y -# CONFIG_TUN_VNET_CROSS_LE is not set CONFIG_VETH=y -# CONFIG_NLMON is not set -# CONFIG_ARCNET is not set - -# -# CAIF transport drivers -# - -# -# Distributed Switch Architecture drivers -# -CONFIG_ETHERNET=y -CONFIG_NET_VENDOR_3COM=y -# CONFIG_VORTEX is not set -# CONFIG_TYPHOON is not set -CONFIG_NET_VENDOR_ADAPTEC=y -# CONFIG_ADAPTEC_STARFIRE is not set -CONFIG_NET_VENDOR_AGERE=y -# CONFIG_ET131X is not set -CONFIG_NET_VENDOR_ALACRITECH=y -# CONFIG_SLICOSS is not set -CONFIG_NET_VENDOR_ALTEON=y -# CONFIG_ACENIC is not set -# CONFIG_ALTERA_TSE is not set -CONFIG_NET_VENDOR_AMAZON=y -# CONFIG_ENA_ETHERNET is not set -CONFIG_NET_VENDOR_AMD=y -# CONFIG_AMD8111_ETH is not set -# CONFIG_PCNET32 is not set -# CONFIG_AMD_XGBE is not set -# CONFIG_AMD_XGBE_HAVE_ECC is not set -CONFIG_NET_VENDOR_AQUANTIA=y -# CONFIG_AQFWD is not set -CONFIG_NET_VENDOR_ARC=y -CONFIG_NET_VENDOR_ATHEROS=y -# CONFIG_ATL2 is not set -# CONFIG_ATL1 is not set -# CONFIG_ATL1E is not set -# CONFIG_ATL1C is not set -# CONFIG_ALX is not set -# CONFIG_NET_VENDOR_AURORA is not set -CONFIG_NET_CADENCE=y -# CONFIG_MACB is not set -CONFIG_NET_VENDOR_BROADCOM=y -# CONFIG_B44 is not set -# CONFIG_BCMGENET is not set -# CONFIG_BNX2 is not set -# CONFIG_CNIC is not set -# CONFIG_TIGON3 is not set -# CONFIG_BNX2X is not set -# CONFIG_SYSTEMPORT is not set -# CONFIG_BNXT is not set -CONFIG_NET_VENDOR_BROCADE=y -# CONFIG_BNA is not set -CONFIG_NET_VENDOR_CAVIUM=y -# CONFIG_THUNDER_NIC_PF is not set -# CONFIG_THUNDER_NIC_VF is not set -# CONFIG_THUNDER_NIC_BGX is not set -# CONFIG_THUNDER_NIC_RGX is not set -# CONFIG_LIQUIDIO is not set -# CONFIG_LIQUIDIO_VF is not set -CONFIG_NET_VENDOR_CHELSIO=y -# CONFIG_CHELSIO_T1 is not set -# CONFIG_CHELSIO_T3 is not set -# CONFIG_CHELSIO_T4 is not set -# CONFIG_CHELSIO_T4VF is not set -CONFIG_NET_VENDOR_CISCO=y -# CONFIG_ENIC is not set -# CONFIG_DNET is not set -CONFIG_NET_VENDOR_DEC=y -# CONFIG_NET_TULIP is not set -CONFIG_NET_VENDOR_DLINK=y -# CONFIG_DL2K is not set -# CONFIG_SUNDANCE is not set -CONFIG_NET_VENDOR_EMULEX=y -# CONFIG_BE2NET is not set -CONFIG_NET_VENDOR_EZCHIP=y -# CONFIG_EZCHIP_NPS_MANAGEMENT_ENET is not set -CONFIG_NET_VENDOR_EXAR=y -# CONFIG_S2IO is not set -# CONFIG_VXGE is not set -CONFIG_NET_VENDOR_HISILICON=y -# CONFIG_HIX5HD2_GMAC is not set -# CONFIG_HISI_FEMAC is not set -# CONFIG_HIP04_ETH is not set -# CONFIG_HNS is not set -# CONFIG_HNS_DSAF is not set -# CONFIG_HNS_ENET is not set -# CONFIG_HNS3 is not set -CONFIG_NET_VENDOR_HP=y -# CONFIG_HP100 is not set -CONFIG_NET_VENDOR_HUAWEI=y -CONFIG_NET_VENDOR_INTEL=y -# CONFIG_E100 is not set -# CONFIG_E1000 is not set -# CONFIG_E1000E is not set -# CONFIG_IGB is not set -# CONFIG_IGBVF is not set -# CONFIG_IXGB is not set -# CONFIG_IXGBE is not set -# CONFIG_IXGBEVF is not set -# CONFIG_I40E is not set -# CONFIG_I40EVF is not set -# CONFIG_FM10K is not set -CONFIG_NET_VENDOR_I825XX=y -# CONFIG_JME is not set -CONFIG_NET_VENDOR_MARVELL=y -# CONFIG_MVMDIO is not set -# CONFIG_SKGE is not set CONFIG_SKY2=y -CONFIG_NET_VENDOR_MELLANOX=y -# CONFIG_MLX4_EN is not set -# CONFIG_MLX4_CORE is not set -# CONFIG_MLX5_CORE is not set -# CONFIG_MLXSW_CORE is not set -# CONFIG_MLXFW is not set -CONFIG_NET_VENDOR_MICREL=y -# CONFIG_KS8842 is not set -# CONFIG_KS8851 is not set -# CONFIG_KS8851_MLL is not set -# CONFIG_KSZ884X_PCI is not set -CONFIG_NET_VENDOR_MICROCHIP=y -# CONFIG_ENC28J60 is not set -# CONFIG_ENCX24J600 is not set -CONFIG_NET_VENDOR_MYRI=y -# CONFIG_MYRI10GE is not set -# CONFIG_FEALNX is not set -CONFIG_NET_VENDOR_NATSEMI=y -# CONFIG_NATSEMI is not set -# CONFIG_NS83820 is not set -CONFIG_NET_VENDOR_NETRONOME=y -# CONFIG_NFP is not set -CONFIG_NET_VENDOR_8390=y -# CONFIG_NE2K_PCI is not set -CONFIG_NET_VENDOR_NVIDIA=y -# CONFIG_FORCEDETH is not set -CONFIG_NET_VENDOR_OKI=y -# CONFIG_ETHOC is not set -CONFIG_NET_PACKET_ENGINE=y -# CONFIG_HAMACHI is not set -# CONFIG_YELLOWFIN is not set -CONFIG_NET_VENDOR_QLOGIC=y -# CONFIG_QLA3XXX is not set -# CONFIG_QLCNIC is not set -# CONFIG_QLGE is not set -# CONFIG_NETXEN_NIC is not set -# CONFIG_QED is not set -CONFIG_NET_VENDOR_QUALCOMM=y -# CONFIG_QCA7000_SPI is not set -# CONFIG_QCOM_EMAC is not set CONFIG_RMNET=y -CONFIG_NET_VENDOR_REALTEK=y -# CONFIG_8139CP is not set -# CONFIG_8139TOO is not set -# CONFIG_R8169 is not set -CONFIG_NET_VENDOR_RENESAS=y -CONFIG_NET_VENDOR_RDC=y -# CONFIG_R6040 is not set -CONFIG_NET_VENDOR_ROCKER=y -CONFIG_NET_VENDOR_SAMSUNG=y -# CONFIG_SXGBE_ETH is not set -CONFIG_NET_VENDOR_SEEQ=y -CONFIG_NET_VENDOR_SILAN=y -# CONFIG_SC92031 is not set -CONFIG_NET_VENDOR_SIS=y -# CONFIG_SIS900 is not set -# CONFIG_SIS190 is not set -CONFIG_NET_VENDOR_SOLARFLARE=y -# CONFIG_SFC is not set -# CONFIG_SFC_FALCON is not set -CONFIG_NET_VENDOR_SMSC=y -# CONFIG_SMC91X is not set -# CONFIG_EPIC100 is not set CONFIG_SMSC911X=y -# CONFIG_SMSC911X_ARCH_HOOKS is not set -# CONFIG_SMSC9420 is not set -CONFIG_NET_VENDOR_STMICRO=y -# CONFIG_STMMAC_ETH is not set -CONFIG_NET_VENDOR_SUN=y -# CONFIG_HAPPYMEAL is not set -# CONFIG_SUNGEM is not set -# CONFIG_CASSINI is not set -# CONFIG_NIU is not set -CONFIG_NET_VENDOR_TEHUTI=y -# CONFIG_TEHUTI is not set -CONFIG_NET_VENDOR_TI=y -# CONFIG_TI_CPSW_ALE is not set -# CONFIG_TLAN is not set -CONFIG_NET_VENDOR_VIA=y -# CONFIG_VIA_RHINE is not set -# CONFIG_VIA_VELOCITY is not set -CONFIG_NET_VENDOR_WIZNET=y -# CONFIG_WIZNET_W5100 is not set -# CONFIG_WIZNET_W5300 is not set -CONFIG_NET_VENDOR_SYNOPSYS=y -# CONFIG_DWC_XLGMAC is not set -# CONFIG_FDDI is not set -# CONFIG_HIPPI is not set -CONFIG_MDIO_DEVICE=y -CONFIG_MDIO_BUS=y -# CONFIG_MDIO_BCM_UNIMAC is not set -# CONFIG_MDIO_BITBANG is not set -# CONFIG_MDIO_BUS_MUX_GPIO is not set -# CONFIG_MDIO_BUS_MUX_MMIOREG is not set -# CONFIG_MDIO_HISI_FEMAC is not set -# CONFIG_MDIO_OCTEON is not set -# CONFIG_MDIO_THUNDER is not set -CONFIG_PHYLIB=y -CONFIG_SWPHY=y -# CONFIG_LED_TRIGGER_PHY is not set - -# -# MII PHY device drivers -# -# CONFIG_AMD_PHY is not set -# CONFIG_AQUANTIA_PHY is not set CONFIG_AT803X_PHY=y -# CONFIG_BCM7XXX_PHY is not set -# CONFIG_BCM87XX_PHY is not set -# CONFIG_BROADCOM_PHY is not set -# CONFIG_CICADA_PHY is not set -# CONFIG_CORTINA_PHY is not set -# CONFIG_DAVICOM_PHY is not set -# CONFIG_DP83848_PHY is not set -# CONFIG_DP83867_PHY is not set -CONFIG_FIXED_PHY=y -# CONFIG_ICPLUS_PHY is not set -# CONFIG_INTEL_XWAY_PHY is not set -# CONFIG_LSI_ET1011C_PHY is not set -# CONFIG_LXT_PHY is not set -# CONFIG_MARVELL_PHY is not set -# CONFIG_MARVELL_10G_PHY is not set CONFIG_MICREL_PHY=y -# CONFIG_MICROCHIP_PHY is not set -# CONFIG_MICROSEMI_PHY is not set -# CONFIG_NATIONAL_PHY is not set -# CONFIG_QSEMI_PHY is not set -# CONFIG_REALTEK_PHY is not set -# CONFIG_ROCKCHIP_PHY is not set -# CONFIG_SMSC_PHY is not set -# CONFIG_STE10XP is not set -# CONFIG_TERANETICS_PHY is not set -# CONFIG_VITESSE_PHY is not set -# CONFIG_XILINX_GMII2RGMII is not set -# CONFIG_MICREL_KS8995MA is not set CONFIG_PPP=y CONFIG_PPP_BSDCOMP=y CONFIG_PPP_DEFLATE=y @@ -1944,953 +324,160 @@ CONFIG_PPPOLAC=y CONFIG_PPPOPNS=y CONFIG_PPP_ASYNC=y CONFIG_PPP_SYNC_TTY=y -# CONFIG_SLIP is not set -CONFIG_SLHC=y -CONFIG_USB_NET_DRIVERS=y -# CONFIG_USB_CATC is not set -# CONFIG_USB_KAWETH is not set -# CONFIG_USB_PEGASUS is not set -# CONFIG_USB_RTL8150 is not set CONFIG_USB_RTL8152=y -# CONFIG_USB_LAN78XX is not set CONFIG_USB_USBNET=y -CONFIG_USB_NET_AX8817X=y -CONFIG_USB_NET_AX88179_178A=y -CONFIG_USB_NET_CDCETHER=y -# CONFIG_USB_NET_CDC_EEM is not set -CONFIG_USB_NET_CDC_NCM=y -# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set -# CONFIG_USB_NET_CDC_MBIM is not set -# CONFIG_USB_NET_DM9601 is not set -# CONFIG_USB_NET_SR9700 is not set -# CONFIG_USB_NET_SR9800 is not set -# CONFIG_USB_NET_SMSC75XX is not set -# CONFIG_USB_NET_SMSC95XX is not set -# CONFIG_USB_NET_GL620A is not set -CONFIG_USB_NET_NET1080=y -# CONFIG_USB_NET_PLUSB is not set -# CONFIG_USB_NET_MCS7830 is not set -# CONFIG_USB_NET_RNDIS_HOST is not set -CONFIG_USB_NET_CDC_SUBSET_ENABLE=y -CONFIG_USB_NET_CDC_SUBSET=y -# CONFIG_USB_ALI_M5632 is not set -# CONFIG_USB_AN2720 is not set -CONFIG_USB_BELKIN=y -CONFIG_USB_ARMLINUX=y -# CONFIG_USB_EPSON2888 is not set -# CONFIG_USB_KC2190 is not set -CONFIG_USB_NET_ZAURUS=y -# CONFIG_USB_NET_CX82310_ETH is not set -# CONFIG_USB_NET_KALMIA is not set -# CONFIG_USB_NET_QMI_WWAN is not set -# CONFIG_USB_HSO is not set -# CONFIG_USB_NET_INT51X1 is not set -# CONFIG_USB_IPHETH is not set -# CONFIG_USB_SIERRA_NET is not set -# CONFIG_USB_VL600 is not set -# CONFIG_USB_NET_CH9200 is not set -CONFIG_WLAN=y -# CONFIG_WIRELESS_WDS is not set -CONFIG_WLAN_VENDOR_ADMTEK=y -CONFIG_WLAN_VENDOR_ATH=y -# CONFIG_ATH_DEBUG is not set -# CONFIG_ATH_REG_DYNAMIC_USER_REG_HINTS is not set -# CONFIG_ATH5K_PCI is not set -# CONFIG_ATH6KL is not set CONFIG_WIL6210=m -CONFIG_WIL6210_ISR_COR=y -CONFIG_WIL6210_TRACING=y -CONFIG_WIL6210_PLATFORM_MSM=y -CONFIG_WIL6210_WRITE_IOCTL=y -CONFIG_WLAN_VENDOR_ATMEL=y -# CONFIG_ATMEL is not set -CONFIG_WLAN_VENDOR_BROADCOM=y -# CONFIG_BRCMFMAC is not set -CONFIG_WLAN_VENDOR_CISCO=y -CONFIG_WLAN_VENDOR_INTEL=y -# CONFIG_IPW2100 is not set -# CONFIG_IPW2200 is not set -CONFIG_WLAN_VENDOR_INTERSIL=y -# CONFIG_HOSTAP is not set -# CONFIG_HERMES is not set -# CONFIG_PRISM54 is not set -CONFIG_WLAN_VENDOR_MARVELL=y -# CONFIG_LIBERTAS is not set -# CONFIG_MWIFIEX is not set -CONFIG_WLAN_VENDOR_MEDIATEK=y -CONFIG_WLAN_VENDOR_RALINK=y -CONFIG_WLAN_VENDOR_REALTEK=y -CONFIG_WLAN_VENDOR_RSI=y -CONFIG_WLAN_VENDOR_ST=y -CONFIG_WLAN_VENDOR_TI=y -CONFIG_WLAN_VENDOR_ZYDAS=y -# CONFIG_USB_ZD1201 is not set -CONFIG_WLAN_VENDOR_QUANTENNA=y -# CONFIG_QTNFMAC_PEARL_PCIE is not set -# CONFIG_USB_NET_RNDIS_WLAN is not set CONFIG_WCNSS_MEM_PRE_ALLOC=y -# CONFIG_CNSS_CRYPTO is not set CONFIG_CLD_LL_CORE=y -# CONFIG_CNSS2 is not set -# CONFIG_CNSS_QCA6290 is not set -# CONFIG_CNSS_QCA6390 is not set -# CONFIG_CNSS_EMULATION is not set -# CONFIG_CNSS is not set -# CONFIG_CLD_DEBUG is not set -# CONFIG_CLD_USB_CORE is not set -# CONFIG_CLD_HL_SDIO_CORE is not set -# CONFIG_CNSS_LOGGER is not set -# CONFIG_WLAN_FEATURE_RX_WAKELOCK is not set -CONFIG_CNSS_UTILS=y CONFIG_CNSS_GENL=y -# CONFIG_VIRT_WIFI is not set - -# -# Enable WiMAX (Networking options) to see the WiMAX drivers -# -# CONFIG_WAN is not set -# CONFIG_VMXNET3 is not set -# CONFIG_ISDN is not set -# CONFIG_NVM is not set - -# -# Input device support -# -CONFIG_INPUT=y -CONFIG_INPUT_LEDS=y -CONFIG_INPUT_FF_MEMLESS=y -# CONFIG_INPUT_POLLDEV is not set -# CONFIG_INPUT_SPARSEKMAP is not set -# CONFIG_INPUT_MATRIXKMAP is not set - -# -# Userland interfaces -# -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_JOYDEV is not set CONFIG_INPUT_EVDEV=y -# CONFIG_INPUT_EVBUG is not set -# CONFIG_INPUT_KEYRESET is not set -# CONFIG_INPUT_KEYCOMBO is not set - -# -# Input Device Drivers -# -CONFIG_INPUT_KEYBOARD=y -# CONFIG_KEYBOARD_ADC is not set -# CONFIG_KEYBOARD_ADP5588 is not set -# CONFIG_KEYBOARD_ADP5589 is not set -CONFIG_KEYBOARD_ATKBD=y -# CONFIG_KEYBOARD_QT1070 is not set -# CONFIG_KEYBOARD_QT2160 is not set -# CONFIG_KEYBOARD_DLINK_DIR685 is not set -# CONFIG_KEYBOARD_LKKBD is not set CONFIG_KEYBOARD_GPIO=y -# CONFIG_KEYBOARD_GPIO_POLLED is not set -# CONFIG_KEYBOARD_TCA6416 is not set -# CONFIG_KEYBOARD_TCA8418 is not set -# CONFIG_KEYBOARD_MATRIX is not set -# CONFIG_KEYBOARD_LM8323 is not set -# CONFIG_KEYBOARD_LM8333 is not set -# CONFIG_KEYBOARD_MAX7359 is not set -# CONFIG_KEYBOARD_MCS is not set -# CONFIG_KEYBOARD_MPR121 is not set -# CONFIG_KEYBOARD_NEWTON is not set -# CONFIG_KEYBOARD_OPENCORES is not set -# CONFIG_KEYBOARD_SAMSUNG is not set -# CONFIG_KEYBOARD_STOWAWAY is not set -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_OMAP4 is not set -# CONFIG_KEYBOARD_TM2_TOUCHKEY is not set -# CONFIG_KEYBOARD_XTKBD is not set -# CONFIG_KEYBOARD_CAP11XX is not set -# CONFIG_KEYBOARD_BCM is not set -# CONFIG_INPUT_MOUSE is not set +#ifdef VENDOR_EDIT +#/*lizhijie@BSP.CHG.Basic, 2020/02/25, Add for Joystick */ CONFIG_INPUT_JOYSTICK=y -# CONFIG_JOYSTICK_ANALOG is not set -# CONFIG_JOYSTICK_A3D is not set -# CONFIG_JOYSTICK_ADI is not set -# CONFIG_JOYSTICK_COBRA is not set -# CONFIG_JOYSTICK_GF2K is not set -# CONFIG_JOYSTICK_GRIP is not set -# CONFIG_JOYSTICK_GRIP_MP is not set -# CONFIG_JOYSTICK_GUILLEMOT is not set -# CONFIG_JOYSTICK_INTERACT is not set -# CONFIG_JOYSTICK_SIDEWINDER is not set -# CONFIG_JOYSTICK_TMDC is not set -# CONFIG_JOYSTICK_IFORCE is not set -# CONFIG_JOYSTICK_WARRIOR is not set -# CONFIG_JOYSTICK_MAGELLAN is not set -# CONFIG_JOYSTICK_SPACEORB is not set -# CONFIG_JOYSTICK_SPACEBALL is not set -# CONFIG_JOYSTICK_STINGER is not set -# CONFIG_JOYSTICK_TWIDJOY is not set -# CONFIG_JOYSTICK_ZHENHUA is not set -# CONFIG_JOYSTICK_AS5011 is not set -# CONFIG_JOYSTICK_JOYDUMP is not set CONFIG_JOYSTICK_XPAD=y CONFIG_JOYSTICK_XPAD_FF=y CONFIG_JOYSTICK_XPAD_LEDS=y -# CONFIG_JOYSTICK_PSXPAD_SPI is not set -# CONFIG_INPUT_TABLET is not set +#endif /* VENDOR_EDIT */ +# CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_JOYSTICK=y +CONFIG_JOYSTICK_XPAD=y CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_PROPERTIES=y -# CONFIG_TOUCHSCREEN_ADS7846 is not set -# CONFIG_TOUCHSCREEN_AD7877 is not set -# CONFIG_TOUCHSCREEN_AD7879 is not set -# CONFIG_TOUCHSCREEN_AR1021_I2C is not set -# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set -# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set -# CONFIG_TOUCHSCREEN_BU21013 is not set -# CONFIG_TOUCHSCREEN_CHIPONE_ICN8318 is not set -# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set -# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set -# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set -# CONFIG_TOUCHSCREEN_DYNAPRO is not set -# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set -# CONFIG_TOUCHSCREEN_EETI is not set -# CONFIG_TOUCHSCREEN_EGALAX is not set -# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set -# CONFIG_TOUCHSCREEN_FUJITSU is not set -# CONFIG_TOUCHSCREEN_GOODIX is not set -# CONFIG_TOUCHSCREEN_ILI210X is not set -# CONFIG_TOUCHSCREEN_GUNZE is not set -# CONFIG_TOUCHSCREEN_EKTF2127 is not set -# CONFIG_TOUCHSCREEN_ELAN is not set -# CONFIG_TOUCHSCREEN_ELO is not set -# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set -# CONFIG_TOUCHSCREEN_WACOM_I2C is not set -# CONFIG_TOUCHSCREEN_MAX11801 is not set -# CONFIG_TOUCHSCREEN_MCS5000 is not set -# CONFIG_TOUCHSCREEN_MMS114 is not set -# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set -# CONFIG_TOUCHSCREEN_MTOUCH is not set -# CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set -# CONFIG_TOUCHSCREEN_INEXIO is not set -# CONFIG_TOUCHSCREEN_MK712 is not set -# CONFIG_TOUCHSCREEN_PENMOUNT is not set -# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set -# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set -# CONFIG_TOUCHSCREEN_TOUCHWIN is not set -# CONFIG_TOUCHSCREEN_PIXCIR is not set -# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set -# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set -# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set -# CONFIG_TOUCHSCREEN_TSC_SERIO is not set -# CONFIG_TOUCHSCREEN_TSC2004 is not set -# CONFIG_TOUCHSCREEN_TSC2005 is not set -# CONFIG_TOUCHSCREEN_TSC2007 is not set -# CONFIG_TOUCHSCREEN_RM_TS is not set -# CONFIG_TOUCHSCREEN_SILEAD is not set -# CONFIG_TOUCHSCREEN_SIS_I2C is not set -# CONFIG_TOUCHSCREEN_ST1232 is not set -# CONFIG_TOUCHSCREEN_STMFTS is not set -# CONFIG_TOUCHSCREEN_SUR40 is not set -# CONFIG_TOUCHSCREEN_SURFACE3_SPI is not set -# CONFIG_TOUCHSCREEN_SX8654 is not set -# CONFIG_TOUCHSCREEN_TPS6507X is not set -# CONFIG_TOUCHSCREEN_ZET6223 is not set -# CONFIG_TOUCHSCREEN_ZFORCE is not set -# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set -# CONFIG_TOUCHSCREEN_ST is not set -# CONFIG_TOUCHSCREEN_HIMAX_CHIPSET is not set -# CONFIG_TOUCHSCREEN_SYNAPTICS_DSX is not set -# CONFIG_TOUCHSCREEN_SYNAPTICS_TCM is not set -# CONFIG_TOUCHPANEL_MTK_PLATFORM is not set -# CONFIG_TOUCHPANEL_LATE_INIT is not set -CONFIG_TOUCHIRQ_UPDATE_QOS=y -CONFIG_TOUCHPANEL_NEW_SET_IRQ_WAKE=y +#ifdef VENDOR_EDIT +#Qicai.gu@Bsp.Group.Tp, 2020/02/26, Add for oppo project +#CONFIG_TOUCHSCREEN_ATMEL_MXT=y +#CONFIG_TOUCHSCREEN_ST=y +#CONFIG_TOUCHSCREEN_HIMAX_CHIPSET=y +#CONFIG_TOUCHSCREEN_HIMAX_I2C=y +#CONFIG_TOUCHSCREEN_HIMAX_INCELL=y +#CONFIG_TOUCHSCREEN_HIMAX_IC_HX83112=y +#CONFIG_TOUCHSCREEN_HIMAX_DEBUG=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_CORE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_RMI_DEV=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE_EXTRA_SYSFS=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_TEST_REPORTING=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_CORE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TOUCH=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DEVICE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TESTING=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_REFLASH=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_RECOVERY=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_ZEROFLASH=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DIAGNOSTICS=y + CONFIG_TOUCHPANEL_OPPO=y -# CONFIG_OPPO_TP_APK is not set -# CONFIG_TOUCHPANEL_ALGORITHM is not set -# CONFIG_TOUCHPANEL_MULTI_NOFLASH is not set -# CONFIG_TOUCHPANEL_SYNAPTICS is not set -CONFIG_TOUCHPANEL_FOCAL=y CONFIG_TOUCHPANEL_GOODIX=y -CONFIG_TOUCHPANEL_NOVA=y -# CONFIG_TOUCHPANEL_HIMAX is not set -CONFIG_TOUCHPANEL_SAMSUNG=y -# CONFIG_TOUCHPANEL_ILITEK is not set -# CONFIG_TOUCHPANEL_GOODIX_GT5688 is not set -# CONFIG_TOUCHPANEL_GOODIX_GT9286 is not set CONFIG_TOUCHPANEL_GOODIX_GT9886=y -# CONFIG_TOUCHPANEL_FOCAL_FT8006 is not set +CONFIG_TOUCHIRQ_UPDATE_QOS=y + +#ifdef OPLUS_FEATURE_TP_BASIC +#Qicai.gu add for FT3518 BSP.TP 2020/8/9 +CONFIG_TOUCHPANEL_FOCAL=y CONFIG_TOUCHPANEL_FOCAL_FT3518=y -# CONFIG_TOUCHPANEL_FOCAL_FT3518_GPIO_DEBUG is not set -# CONFIG_TOUCHPANEL_NT_DIGITALNOISE_TEST is not set -# CONFIG_TOUCHPANEL_NOVA_NT36672 is not set -# CONFIG_TOUCHPANEL_NOVA_NT36525 is not set -# CONFIG_TOUCHPANEL_NOVA_NT36672_NOFLASH is not set -# CONFIG_TOUCHPANEL_NOVA_NT36525_NOFLASH is not set -# CONFIG_TOUCHPANEL_NOVA_NT36525B_NOFLASH is not set +#endif /*OPLUS_FEATURE_TP_BASIC*/ + +#zhaifeibiao@ODM_LQ@BSP.touch,2020/11/03,Add for oppo project CONFIG_TOUCHPANEL_NOVA_NT36672C_NOFLASH=y -# CONFIG_TOUCHPANEL_SAMSUNG_S6SY791 is not set -# CONFIG_TOUCHPANEL_SAMSUNG_S6SY792 is not set -# CONFIG_TOUCHPANEL_SAMSUNG_S6SY761 is not set -# CONFIG_TOUCHPANEL_SAMSUNG_S6D7AT0 is not set +CONFIG_TOUCHPANEL_NOVA=y +CONFIG_TOUCHPANEL_NEW_SET_IRQ_WAKE=y +#ifdef VENDOR_EDIT +#lujiang.yu add for 567 BSP.TP 2020/4/3 +CONFIG_TOUCHPANEL_SAMSUNG=y CONFIG_TOUCHPANEL_SAMSUNG_S6SY771=y +#endif + +#CONFIG_TOUCHPANEL_NEW_SET_IRQ_WAKE=y +#endif CONFIG_INPUT_MISC=y -# CONFIG_INPUT_AD714X is not set -# CONFIG_INPUT_ATMEL_CAPTOUCH is not set -# CONFIG_INPUT_BMA150 is not set -# CONFIG_INPUT_E3X0_BUTTON is not set -# CONFIG_INPUT_HBTP_INPUT is not set -# CONFIG_INPUT_PM8941_PWRKEY is not set -# CONFIG_INPUT_PM8XXX_VIBRATOR is not set CONFIG_INPUT_QPNP_POWER_ON=y -# CONFIG_INPUT_QTI_HAPTICS is not set -# CONFIG_INPUT_MMA8450 is not set -# CONFIG_INPUT_GP2A is not set -# CONFIG_INPUT_GPIO_BEEPER is not set -# CONFIG_INPUT_GPIO_TILT_POLLED is not set -# CONFIG_INPUT_GPIO_DECODER is not set -# CONFIG_INPUT_ATI_REMOTE2 is not set -# CONFIG_INPUT_KEYSPAN_REMOTE is not set -# CONFIG_INPUT_KXTJ9 is not set -# CONFIG_INPUT_POWERMATE is not set -# CONFIG_INPUT_YEALINK is not set -# CONFIG_INPUT_CM109 is not set -# CONFIG_INPUT_REGULATOR_HAPTIC is not set CONFIG_INPUT_UINPUT=y -# CONFIG_INPUT_GPIO is not set -# CONFIG_INPUT_PCF8574 is not set -# CONFIG_INPUT_PWM_BEEPER is not set -# CONFIG_INPUT_PWM_VIBRA is not set -# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set -# CONFIG_INPUT_ADXL34X is not set -# CONFIG_INPUT_IMS_PCU is not set -# CONFIG_INPUT_CMA3000 is not set -# CONFIG_INPUT_SOC_BUTTON_ARRAY is not set -# CONFIG_INPUT_DRV260X_HAPTICS is not set -# CONFIG_INPUT_DRV2665_HAPTICS is not set -# CONFIG_INPUT_DRV2667_HAPTICS is not set -CONFIG_STMVL53L1=y -# CONFIG_SMI130 is not set -# CONFIG_RMI4_CORE is not set - -# -# Hardware I/O ports -# -CONFIG_SERIO=y # CONFIG_SERIO_SERPORT is not set -# CONFIG_SERIO_AMBAKMI is not set -# CONFIG_SERIO_PCIPS2 is not set -CONFIG_SERIO_LIBPS2=y -# CONFIG_SERIO_RAW is not set -# CONFIG_SERIO_ALTERA_PS2 is not set -# CONFIG_SERIO_PS2MULT is not set -# CONFIG_SERIO_ARC_PS2 is not set -# CONFIG_SERIO_APBPS2 is not set -# CONFIG_SERIO_GPIO_PS2 is not set -# CONFIG_USERIO is not set -# CONFIG_GAMEPORT is not set -CONFIG_OPPO_FINGERPRINT=y -CONFIG_OPPO_FINGERPRINT_QCOM=y -# CONFIG_OPPO_FINGERPRINT_MTK is not set -# CONFIG_OPPO_FINGERPRINT_FPC is not set -# CONFIG_OPPO_FINGERPRINT_GOODIX is not set -CONFIG_OPPO_FINGERPRINT_GOODIX_OPTICAL=y -# CONFIG_OPPO_FINGERPRINT_SILEAD_OPTICAL is not set -# CONFIG_OPPO_FINGERPRINT_EGIS_OPTICAL is not set -# CONFIG_OPPO_FINGERPRINT_EGIS is not set -# CONFIG_OPPO_FINGERPRINT_SILEAD is not set -CONFIG_OPPO_FINGERPRINT_JIIOV_OPTICAL=y -# CONFIG_OPPO_FINGERPRINT_CHIPONE is not set -# CONFIG_OPPO_FINGERPRINT_NAVIGATION_ENABLE is not set - -# -# Character devices -# -CONFIG_TTY=y -CONFIG_VT=y -CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_VT_CONSOLE=y -CONFIG_VT_CONSOLE_SLEEP=y -CONFIG_HW_CONSOLE=y -# CONFIG_VT_HW_CONSOLE_BINDING is not set -CONFIG_UNIX98_PTYS=y # CONFIG_LEGACY_PTYS is not set -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_NOZOMI is not set -# CONFIG_N_GSM is not set -# CONFIG_TRACE_SINK is not set -CONFIG_LDISC_AUTOLOAD=y # CONFIG_DEVMEM is not set - -# -# Serial drivers -# -CONFIG_SERIAL_EARLYCON=y -# CONFIG_SERIAL_8250 is not set - -# -# Non-8250 serial port support -# -# CONFIG_SERIAL_AMBA_PL010 is not set -# CONFIG_SERIAL_AMBA_PL011 is not set -# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set -# CONFIG_SERIAL_MAX3100 is not set -# CONFIG_SERIAL_MAX310X is not set -# CONFIG_SERIAL_UARTLITE is not set -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -# CONFIG_SERIAL_JSM is not set -# CONFIG_SERIAL_MSM is not set +#ifdef VENDOR_EDIT //Nanwei.Deng@power 2020.8.26 for ftm console enable CONFIG_SERIAL_MSM_GENI=y CONFIG_SERIAL_MSM_GENI_CONSOLE=y -# CONFIG_SERIAL_MSM_HS is not set +#endif CONFIG_SERIAL_MSM_WITH_HALF_SAMPLING=y -# CONFIG_SERIAL_SCCNXP is not set -# CONFIG_SERIAL_SC16IS7XX is not set -# CONFIG_SERIAL_ALTERA_JTAGUART is not set -# CONFIG_SERIAL_ALTERA_UART is not set -# CONFIG_SERIAL_IFX6X60 is not set -# CONFIG_SERIAL_XILINX_PS_UART is not set -# CONFIG_SERIAL_ARC is not set -# CONFIG_SERIAL_RP2 is not set -# CONFIG_SERIAL_FSL_LPUART is not set -# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set -# CONFIG_SERIAL_DEV_BUS is not set -# CONFIG_TTY_PRINTK is not set -# CONFIG_HVC_DCC is not set -# CONFIG_IPMI_HANDLER is not set CONFIG_HW_RANDOM=y -# CONFIG_HW_RANDOM_TIMERIOMEM is not set -# CONFIG_HW_RANDOM_MSM is not set CONFIG_HW_RANDOM_MSM_LEGACY=y -CONFIG_HW_RANDOM_CAVIUM=y -# CONFIG_APPLICOM is not set - -# -# PCMCIA character devices -# -# CONFIG_RAW_DRIVER is not set -# CONFIG_TCG_TPM is not set # CONFIG_DEVPORT is not set -# CONFIG_XILLYBUS is not set - -# -# Diag Support -# CONFIG_DIAG_CHAR=y -CONFIG_DIAG_OVER_USB=y CONFIG_MSM_FASTCVPD=y CONFIG_MSM_ADSPRPC=y CONFIG_MSM_RDBG=m - -# -# I2C support -# -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_COMPAT=y CONFIG_I2C_CHARDEV=y -CONFIG_I2C_MUX=y - -# -# Multiplexer I2C Chip support -# -# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set -# CONFIG_I2C_MUX_GPIO is not set -# CONFIG_I2C_MUX_GPMUX is not set -# CONFIG_I2C_MUX_LTC4306 is not set -# CONFIG_I2C_MUX_PCA9541 is not set CONFIG_I2C_MUX_PCA954x=y -# CONFIG_I2C_MUX_PINCTRL is not set -# CONFIG_I2C_MUX_REG is not set -# CONFIG_I2C_DEMUX_PINCTRL is not set -# CONFIG_I2C_MUX_MLXCPLD is not set -CONFIG_I2C_HELPER_AUTO=y -CONFIG_I2C_ALGOBIT=y - -# -# I2C Hardware Bus support -# - -# -# PC SMBus host controller drivers -# -# CONFIG_I2C_ALI1535 is not set -# CONFIG_I2C_ALI1563 is not set -# CONFIG_I2C_ALI15X3 is not set -# CONFIG_I2C_AMD756 is not set -# CONFIG_I2C_AMD8111 is not set -# CONFIG_I2C_I801 is not set -# CONFIG_I2C_ISCH is not set -# CONFIG_I2C_PIIX4 is not set -# CONFIG_I2C_NFORCE2 is not set -# CONFIG_I2C_SIS5595 is not set -# CONFIG_I2C_SIS630 is not set -# CONFIG_I2C_SIS96X is not set -# CONFIG_I2C_VIA is not set -# CONFIG_I2C_VIAPRO is not set - -# -# I2C system bus drivers (mostly embedded / system-on-chip) -# -# CONFIG_I2C_CADENCE is not set -# CONFIG_I2C_CBUS_GPIO is not set -# CONFIG_I2C_DESIGNWARE_PLATFORM is not set -# CONFIG_I2C_DESIGNWARE_PCI is not set -# CONFIG_I2C_EMEV2 is not set -# CONFIG_I2C_GPIO is not set -# CONFIG_I2C_NOMADIK is not set -# CONFIG_I2C_OCORES is not set -# CONFIG_I2C_PCA_PLATFORM is not set -# CONFIG_I2C_PXA_PCI is not set -# CONFIG_I2C_QUP is not set CONFIG_I2C_QCOM_GENI=y -# CONFIG_I2C_RK3X is not set -# CONFIG_I2C_SIMTEC is not set -# CONFIG_I2C_THUNDERX is not set -# CONFIG_I2C_XILINX is not set - -# -# External I2C/SMBus adapter drivers -# -# CONFIG_I2C_DIOLAN_U2C is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_ROBOTFUZZ_OSIF is not set -# CONFIG_I2C_TAOS_EVM is not set -# CONFIG_I2C_TINY_USB is not set - -# -# Other I2C/SMBus bus drivers -# -# CONFIG_I2C_MSM_V2 is not set -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_SLAVE is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set CONFIG_SPI=y -# CONFIG_SPI_DEBUG is not set -CONFIG_SPI_MASTER=y - -# -# SPI Master Controller Drivers -# -# CONFIG_SPI_ALTERA is not set -# CONFIG_SPI_AXI_SPI_ENGINE is not set -# CONFIG_SPI_BITBANG is not set -# CONFIG_SPI_CADENCE is not set -# CONFIG_SPI_DESIGNWARE is not set -# CONFIG_SPI_GPIO is not set -# CONFIG_SPI_FSL_SPI is not set -# CONFIG_SPI_OC_TINY is not set -# CONFIG_SPI_PL022 is not set -# CONFIG_SPI_PXA2XX is not set -# CONFIG_SPI_PXA2XX_PCI is not set -# CONFIG_SPI_ROCKCHIP is not set -# CONFIG_SPI_QUP is not set CONFIG_SPI_QCOM_GENI=y -# CONFIG_SPI_SC18IS602 is not set -# CONFIG_SPI_THUNDERX is not set -# CONFIG_SPI_XCOMM is not set -# CONFIG_SPI_XILINX is not set -# CONFIG_SPI_ZYNQMP_GQSPI is not set - -# -# SPI Protocol Masters -# CONFIG_SPI_SPIDEV=y -# CONFIG_SPI_LOOPBACK_TEST is not set -# CONFIG_SPI_TLE62X0 is not set -# CONFIG_SPI_SLAVE is not set CONFIG_SPMI=y -CONFIG_SPMI_MSM_PMIC_ARB=y -# CONFIG_SPMI_MSM_PMIC_ARB_DEBUG is not set CONFIG_SPMI_SIMULATOR=y CONFIG_PM8150_PMIC_SIMULATOR=y CONFIG_PM8150B_PMIC_SIMULATOR=y CONFIG_PM8150L_PMIC_SIMULATOR=y -CONFIG_SLIMBUS=y -# CONFIG_SLIMBUS_MSM_CTRL is not set CONFIG_SLIMBUS_MSM_NGD=y -# CONFIG_HSI is not set -CONFIG_PPS=y -# CONFIG_PPS_DEBUG is not set - -# -# PPS clients support -# -# CONFIG_PPS_CLIENT_KTIMER is not set -# CONFIG_PPS_CLIENT_LDISC is not set -# CONFIG_PPS_CLIENT_GPIO is not set - -# -# PPS generators support -# - -# -# PTP clock support -# CONFIG_PTP_1588_CLOCK=y - -# -# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. -# -CONFIG_PINCTRL=y - -# -# Pin controllers -# -CONFIG_PINMUX=y -CONFIG_PINCONF=y -CONFIG_GENERIC_PINCONF=y -# CONFIG_DEBUG_PINCTRL is not set -# CONFIG_PINCTRL_AMD is not set -# CONFIG_PINCTRL_MCP23S08 is not set -# CONFIG_PINCTRL_SINGLE is not set CONFIG_PINCTRL_SX150X=y -CONFIG_PINCTRL_MSM=y -# CONFIG_PINCTRL_APQ8064 is not set -# CONFIG_PINCTRL_APQ8084 is not set -# CONFIG_PINCTRL_IPQ4019 is not set -# CONFIG_PINCTRL_IPQ8064 is not set -# CONFIG_FRAGMENTED_GPIO_ADDRESS_SPACE is not set -# CONFIG_PINCTRL_IPQ8074 is not set -# CONFIG_PINCTRL_MSM8660 is not set -# CONFIG_PINCTRL_MSM8960 is not set -# CONFIG_PINCTRL_MDM9615 is not set -# CONFIG_PINCTRL_MSM8X74 is not set -# CONFIG_PINCTRL_MSM8916 is not set -# CONFIG_PINCTRL_MSM8994 is not set -# CONFIG_PINCTRL_MSM8996 is not set CONFIG_PINCTRL_QCOM_SPMI_PMIC=y -# CONFIG_PINCTRL_QCOM_SSBI_PMIC is not set -# CONFIG_PINCTRL_SM8150 is not set -# CONFIG_PINCTRL_SDMMAGPIE is not set -# CONFIG_PINCTRL_SDMSHRIKE is not set -# CONFIG_PINCTRL_SM6150 is not set CONFIG_PINCTRL_ATOLL=y -# CONFIG_PINCTRL_TRINKET is not set -# CONFIG_PINCTRL_SDXPRAIRIE is not set CONFIG_PINCTRL_SLPI=y -# CONFIG_PINCTRL_MDM9607 is not set -# CONFIG_PINCTRL_SDM660 is not set -# CONFIG_PINCTRL_SDM429W is not set -CONFIG_GPIOLIB=y -CONFIG_OF_GPIO=y -CONFIG_GPIOLIB_IRQCHIP=y -# CONFIG_DEBUG_GPIO is not set CONFIG_GPIO_SYSFS=y - -# -# Memory mapped GPIO drivers -# -# CONFIG_GPIO_74XX_MMIO is not set -# CONFIG_GPIO_ALTERA is not set -# CONFIG_GPIO_DWAPB is not set -# CONFIG_GPIO_FTGPIO010 is not set -# CONFIG_GPIO_GENERIC_PLATFORM is not set -# CONFIG_GPIO_GRGPIO is not set -# CONFIG_GPIO_MOCKUP is not set -# CONFIG_GPIO_PL061 is not set -# CONFIG_GPIO_SYSCON is not set -# CONFIG_GPIO_XGENE is not set -# CONFIG_GPIO_XILINX is not set - -# -# I2C GPIO expanders -# -# CONFIG_GPIO_ADP5588 is not set -# CONFIG_GPIO_ADNP is not set -# CONFIG_GPIO_MAX7300 is not set -# CONFIG_GPIO_MAX732X is not set -# CONFIG_GPIO_PCA953X is not set -# CONFIG_GPIO_PCF857X is not set -# CONFIG_GPIO_SX150X is not set -# CONFIG_GPIO_TPIC2810 is not set - -# -# MFD GPIO expanders -# - -# -# PCI GPIO expanders -# -# CONFIG_GPIO_BT8XX is not set -# CONFIG_GPIO_PCI_IDIO_16 is not set -# CONFIG_GPIO_RDC321X is not set - -# -# SPI GPIO expanders -# -# CONFIG_GPIO_74X164 is not set -# CONFIG_GPIO_MAX7301 is not set -# CONFIG_GPIO_MC33880 is not set -# CONFIG_GPIO_PISOSR is not set -# CONFIG_GPIO_XRA1403 is not set - -# -# USB GPIO expanders -# - -# -# GNSS SIRF controls -# -# CONFIG_GNSS_SIRF is not set -# CONFIG_W1 is not set -# CONFIG_POWER_AVS is not set -CONFIG_POWER_RESET=y -# CONFIG_POWER_RESET_BRCMSTB is not set -# CONFIG_POWER_RESET_GPIO is not set -# CONFIG_POWER_RESET_GPIO_RESTART is not set -# CONFIG_POWER_RESET_LTC2952 is not set CONFIG_POWER_RESET_QCOM=y CONFIG_QCOM_DLOAD_MODE=y -# CONFIG_POWER_RESET_RESTART is not set CONFIG_POWER_RESET_XGENE=y CONFIG_POWER_RESET_SYSCON=y -# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set -# CONFIG_SYSCON_REBOOT_MODE is not set -CONFIG_POWER_SUPPLY=y -# CONFIG_POWER_SUPPLY_DEBUG is not set -# CONFIG_PDA_POWER is not set -# CONFIG_GENERIC_ADC_BATTERY is not set -# CONFIG_TEST_POWER is not set -# CONFIG_BATTERY_DS2780 is not set -# CONFIG_BATTERY_DS2781 is not set -# CONFIG_BATTERY_DS2782 is not set -# CONFIG_BATTERY_LEGO_EV3 is not set -# CONFIG_BATTERY_SBS is not set -# CONFIG_CHARGER_SBS is not set -# CONFIG_BATTERY_BQ27XXX is not set -# CONFIG_BATTERY_MAX17040 is not set -# CONFIG_BATTERY_MAX17042 is not set -# CONFIG_CHARGER_ISP1704 is not set -# CONFIG_CHARGER_MAX8903 is not set -# CONFIG_CHARGER_LP8727 is not set -# CONFIG_CHARGER_GPIO is not set -# CONFIG_CHARGER_MANAGER is not set -# CONFIG_CHARGER_LTC3651 is not set -# CONFIG_CHARGER_DETECTOR_MAX14656 is not set -# CONFIG_CHARGER_QCOM_SMBB is not set -# CONFIG_CHARGER_BQ2415X is not set -# CONFIG_CHARGER_BQ24190 is not set -# CONFIG_CHARGER_BQ24257 is not set -# CONFIG_CHARGER_BQ24735 is not set -# CONFIG_CHARGER_BQ25890 is not set -# CONFIG_CHARGER_SMB347 is not set -# CONFIG_BATTERY_GAUGE_LTC2941 is not set -# CONFIG_CHARGER_RT9455 is not set - -# -# Qualcomm Technologies, Inc. Charger and Fuel Gauge support -# -# CONFIG_QPNP_FG_GEN3 is not set -# CONFIG_QPNP_FG_GEN4 is not set CONFIG_QPNP_QG=y -# CONFIG_SMB1351_USB_CHARGER is not set -# CONFIG_SMB1355_SLAVE_CHARGER is not set -# CONFIG_QPNP_SMB2 is not set +#ifdef VENDOR_EDIT +#/* lizhijie@BSP.CHG.Basic, 2020/02/25, Modify for charging */ +#CONFIG_SMB1355_SLAVE_CHARGER=y +#endif CONFIG_QPNP_SMB5=y -# CONFIG_SMB138X_CHARGER is not set -# CONFIG_QPNP_QNOVO is not set -# CONFIG_QPNP_QNOVO5 is not set -# CONFIG_SMB1390_CHARGE_PUMP is not set +#ifdef VENDOR_EDIT +#/* lizhijie@BSP.CHG.Basic, 2020/02/25, Modify for charging */ +CONFIG_OPPO_SM7125R_CHARGER=y +CONFIG_OPPO_CHIP_SOC_NODE=y +CONFIG_OPPO_SHORT_HW_CHECK=y +CONFIG_OPPO_SHORT_USERSPACE=y +CONFIG_OPPO_SHIP_MODE_SUPPORT=y +CONFIG_OPPO_SMART_CHARGER_SUPPORT=y +CONFIG_OPPO_SHORT_C_BATT_CHECK=y +CONFIG_OPPO_CHECK_CHARGERID_VOLT=y +CONFIG_OPPO_SHORT_IC_CHECK=y +CONFIG_OPPO_CALL_MODE_SUPPORT=y +CONFIG_OPPO_SMOOTH_SOC=y +CONFIG_HID_SONY=y +CONFIG_SONY_FF=y +CONFIG_HID_BETOP_FF=y +CONFIG_OPLUS_CHARGER=y +CONFIG_OPLUS_SM7125R_CHARGER=y +CONFIG_OPLUS_CHIP_SOC_NODE=y +CONFIG_OPLUS_SHORT_HW_CHECK=y +CONFIG_OPLUS_SHORT_USERSPACE=y +CONFIG_OPLUS_SHIP_MODE_SUPPORT=y +CONFIG_OPLUS_SMART_CHARGER_SUPPORT=y +CONFIG_OPLUS_SHORT_C_BATT_CHECK=y +CONFIG_OPLUS_CHECK_CHARGERID_VOLT=y +CONFIG_OPLUS_SHORT_IC_CHECK=y +CONFIG_OPLUS_CALL_MODE_SUPPORT=y +CONFIG_OPLUS_SMOOTH_SOC=y +CONFIG_OPLUS_WPC_INTERFACE_ENABLE=y +CONFIG_OPLUS_CHARGER_OPTIGA=y +#endif CONFIG_SMB1390_CHARGE_PUMP_PSY=y CONFIG_SMB1398_CHARGER=y -# CONFIG_SMB358_CHARGER is not set -# CONFIG_OPPO_SM7150R_CHARGER is not set -CONFIG_OPPO_SM7125R_CHARGER=y -# CONFIG_OPPO_SM8150Q_CHARGER is not set -CONFIG_OPPO_SHORT_C_BATT_CHECK=y -CONFIG_OPPO_CALL_MODE_SUPPORT=y -CONFIG_OPLUS_WPC_INTERFACE_ENABLE=y -CONFIG_OPPO_SMART_CHARGER_SUPPORT=y -CONFIG_OPPO_SHORT_HW_CHECK=y -CONFIG_OPPO_CHIP_SOC_NODE=y -CONFIG_OPPO_SHORT_IC_CHECK=y -# CONFIG_OPPO_RTC_DET_SUPPORT is not set -CONFIG_OPPO_CHECK_CHARGERID_VOLT=y -CONFIG_OPPO_SHIP_MODE_SUPPORT=y -CONFIG_OPPO_SHORT_USERSPACE=y -CONFIG_OPPO_SMOOTH_SOC=y -# CONFIG_OPLUS_SM7150R_CHARGER is not set -CONFIG_OPLUS_SM7125R_CHARGER=y -# CONFIG_OPLUS_SM8150R_CHARGER is not set -CONFIG_OPLUS_SHORT_C_BATT_CHECK=y -CONFIG_OPLUS_CALL_MODE_SUPPORT=y -CONFIG_OPLUS_SMART_CHARGER_SUPPORT=y -CONFIG_OPLUS_SHORT_HW_CHECK=y -CONFIG_OPLUS_CHIP_SOC_NODE=y -CONFIG_OPLUS_SHORT_IC_CHECK=y -# CONFIG_OPLUS_RTC_DET_SUPPORT is not set -CONFIG_OPLUS_CHECK_CHARGERID_VOLT=y -CONFIG_OPLUS_SHIP_MODE_SUPPORT=y -CONFIG_OPLUS_SHORT_USERSPACE=y -CONFIG_OPLUS_SMOOTH_SOC=y -CONFIG_OPLUS_CHARGER=y -# CONFIG_OPLUS_CHARGER_MTK is not set -# CONFIG_OPLUS_STANDARD_BATTERY_CHECK_ADC is not set -CONFIG_OPLUS_CHARGER_OPTIGA=y -CONFIG_HWMON=y -# CONFIG_HWMON_VID is not set -# CONFIG_HWMON_DEBUG_CHIP is not set - -# -# Native drivers -# -# CONFIG_SENSORS_AD7314 is not set -# CONFIG_SENSORS_AD7414 is not set -# CONFIG_SENSORS_AD7418 is not set -# CONFIG_SENSORS_ADM1021 is not set -# CONFIG_SENSORS_ADM1025 is not set -# CONFIG_SENSORS_ADM1026 is not set -# CONFIG_SENSORS_ADM1029 is not set -# CONFIG_SENSORS_ADM1031 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ADT7310 is not set -# CONFIG_SENSORS_ADT7410 is not set -# CONFIG_SENSORS_ADT7411 is not set -# CONFIG_SENSORS_ADT7462 is not set -# CONFIG_SENSORS_ADT7470 is not set -# CONFIG_SENSORS_ADT7475 is not set -# CONFIG_SENSORS_ASC7621 is not set -# CONFIG_SENSORS_ASPEED is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_DS620 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_I5K_AMB is not set -# CONFIG_SENSORS_F71805F is not set -# CONFIG_SENSORS_F71882FG is not set -# CONFIG_SENSORS_F75375S is not set -# CONFIG_SENSORS_GL518SM is not set -# CONFIG_SENSORS_GL520SM is not set -# CONFIG_SENSORS_G760A is not set -# CONFIG_SENSORS_G762 is not set -# CONFIG_SENSORS_GPIO_FAN is not set -# CONFIG_SENSORS_HIH6130 is not set -# CONFIG_SENSORS_IIO_HWMON is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_JC42 is not set -# CONFIG_SENSORS_POWR1220 is not set -# CONFIG_SENSORS_LINEAGE is not set -# CONFIG_SENSORS_LTC2945 is not set -# CONFIG_SENSORS_LTC2990 is not set -# CONFIG_SENSORS_LTC4151 is not set -# CONFIG_SENSORS_LTC4215 is not set -# CONFIG_SENSORS_LTC4222 is not set -# CONFIG_SENSORS_LTC4245 is not set -# CONFIG_SENSORS_LTC4260 is not set -# CONFIG_SENSORS_LTC4261 is not set -# CONFIG_SENSORS_MAX1111 is not set -# CONFIG_SENSORS_MAX16065 is not set -# CONFIG_SENSORS_MAX1619 is not set -# CONFIG_SENSORS_MAX1668 is not set -# CONFIG_SENSORS_MAX197 is not set -# CONFIG_SENSORS_MAX31722 is not set -# CONFIG_SENSORS_MAX6639 is not set -# CONFIG_SENSORS_MAX6642 is not set -# CONFIG_SENSORS_MAX6650 is not set -# CONFIG_SENSORS_MAX6697 is not set -# CONFIG_SENSORS_MAX31790 is not set -# CONFIG_SENSORS_MCP3021 is not set -# CONFIG_SENSORS_TC654 is not set -# CONFIG_SENSORS_ADCXX is not set -# CONFIG_SENSORS_LM63 is not set -# CONFIG_SENSORS_LM70 is not set -# CONFIG_SENSORS_LM73 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM77 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM87 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set -# CONFIG_SENSORS_LM93 is not set -# CONFIG_SENSORS_LM95234 is not set -# CONFIG_SENSORS_LM95241 is not set -# CONFIG_SENSORS_LM95245 is not set -# CONFIG_SENSORS_PC87360 is not set -# CONFIG_SENSORS_PC87427 is not set -# CONFIG_SENSORS_NTC_THERMISTOR is not set -# CONFIG_SENSORS_NCT6683 is not set -# CONFIG_SENSORS_NCT6775 is not set -# CONFIG_SENSORS_NCT7802 is not set -# CONFIG_SENSORS_NCT7904 is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_PMBUS is not set -# CONFIG_SENSORS_PWM_FAN is not set -# CONFIG_SENSORS_SHT15 is not set -# CONFIG_SENSORS_SHT21 is not set -# CONFIG_SENSORS_SHT3x is not set -# CONFIG_SENSORS_SHTC1 is not set -# CONFIG_SENSORS_SIS5595 is not set -# CONFIG_SENSORS_DME1737 is not set -# CONFIG_SENSORS_EMC1403 is not set -# CONFIG_SENSORS_EMC2103 is not set -# CONFIG_SENSORS_EMC6W201 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47M192 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_SCH56XX_COMMON is not set -# CONFIG_SENSORS_STTS751 is not set -# CONFIG_SENSORS_SMM665 is not set -# CONFIG_SENSORS_ADC128D818 is not set -# CONFIG_SENSORS_ADS1015 is not set -# CONFIG_SENSORS_ADS7828 is not set -# CONFIG_SENSORS_ADS7871 is not set -# CONFIG_SENSORS_AMC6821 is not set -# CONFIG_SENSORS_INA209 is not set -# CONFIG_SENSORS_INA2XX is not set -# CONFIG_SENSORS_INA3221 is not set -# CONFIG_SENSORS_TC74 is not set -# CONFIG_SENSORS_THMC50 is not set -# CONFIG_SENSORS_TMP102 is not set -# CONFIG_SENSORS_TMP103 is not set -# CONFIG_SENSORS_TMP108 is not set -# CONFIG_SENSORS_TMP401 is not set -# CONFIG_SENSORS_TMP421 is not set -# CONFIG_SENSORS_VIA686A is not set -# CONFIG_SENSORS_VT1211 is not set -# CONFIG_SENSORS_VT8231 is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83791D is not set -# CONFIG_SENSORS_W83792D is not set -# CONFIG_SENSORS_W83793 is not set -# CONFIG_SENSORS_W83795 is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83L786NG is not set -# CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83627EHF is not set CONFIG_THERMAL=y -CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 -CONFIG_THERMAL_HWMON=y -CONFIG_THERMAL_OF=y CONFIG_THERMAL_WRITABLE_TRIPS=y -CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y -# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set -# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set -# CONFIG_THERMAL_GOV_FAIR_SHARE is not set -CONFIG_THERMAL_GOV_STEP_WISE=y -# CONFIG_THERMAL_GOV_BANG_BANG is not set CONFIG_THERMAL_GOV_USER_SPACE=y CONFIG_THERMAL_GOV_LOW_LIMITS=y -# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set CONFIG_CPU_THERMAL=y -# CONFIG_CLOCK_THERMAL is not set CONFIG_DEVFREQ_THERMAL=y -# CONFIG_THERMAL_EMULATION is not set -CONFIG_HORAE_THERMAL_SHELL=y -# CONFIG_QORIQ_THERMAL is not set - -# -# ACPI INT340X thermal drivers -# CONFIG_QCOM_SPMI_TEMP_ALARM=y -# CONFIG_GENERIC_ADC_THERMAL is not set CONFIG_THERMAL_TSENS=y - -# -# Qualcomm thermal drivers -# -# CONFIG_QCOM_TSENS is not set CONFIG_QTI_THERMAL_LIMITS_DCVS=y CONFIG_QTI_VIRTUAL_SENSOR=y CONFIG_QTI_AOP_REG_COOLING_DEVICE=y @@ -2898,1752 +485,159 @@ CONFIG_QTI_QMI_COOLING_DEVICE=y CONFIG_QTI_QMI_SENSOR=y CONFIG_REGULATOR_COOLING_DEVICE=y CONFIG_QTI_BCL_PMIC5=y -# CONFIG_MSM_BCL_PERIPHERAL_CTL is not set CONFIG_QTI_BCL_SOC_DRIVER=y CONFIG_QTI_ADC_TM=y -# CONFIG_QTI_CX_IPEAK_COOLING_DEVICE is not set -# CONFIG_WATCHDOG is not set -CONFIG_SSB_POSSIBLE=y - -# -# Sonics Silicon Backplane -# -# CONFIG_SSB is not set -CONFIG_BCMA_POSSIBLE=y -# CONFIG_BCMA is not set - -# -# Multifunction device drivers -# -CONFIG_MFD_CORE=y -# CONFIG_MFD_ACT8945A is not set -# CONFIG_MFD_AS3711 is not set -# CONFIG_MFD_AS3722 is not set -# CONFIG_PMIC_ADP5520 is not set -# CONFIG_MFD_AAT2870_CORE is not set -# CONFIG_MFD_ATMEL_FLEXCOM is not set -# CONFIG_MFD_ATMEL_HLCDC is not set -# CONFIG_MFD_BCM590XX is not set -# CONFIG_MFD_BD9571MWV is not set -# CONFIG_MFD_AXP20X_I2C is not set -# CONFIG_MFD_CROS_EC is not set -# CONFIG_PMIC_DA903X is not set -# CONFIG_MFD_DA9052_SPI is not set -# CONFIG_MFD_DA9052_I2C is not set -# CONFIG_MFD_DA9055 is not set -# CONFIG_MFD_DA9062 is not set -# CONFIG_MFD_DA9063 is not set -# CONFIG_MFD_DA9150 is not set -# CONFIG_MFD_DLN2 is not set -# CONFIG_MFD_MC13XXX_SPI is not set -# CONFIG_MFD_MC13XXX_I2C is not set -# CONFIG_MFD_HI6421_PMIC is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_HTC_I2CPLD is not set -# CONFIG_LPC_ICH is not set -# CONFIG_LPC_SCH is not set -# CONFIG_MFD_JANZ_CMODIO is not set -# CONFIG_MFD_KEMPLD is not set -# CONFIG_MFD_88PM800 is not set -# CONFIG_MFD_88PM805 is not set -# CONFIG_MFD_88PM860X is not set -# CONFIG_MFD_MAX14577 is not set -# CONFIG_MFD_MAX77620 is not set -# CONFIG_MFD_MAX77686 is not set -# CONFIG_MFD_MAX77693 is not set -# CONFIG_MFD_MAX77843 is not set -# CONFIG_MFD_MAX8907 is not set -# CONFIG_MFD_MAX8925 is not set -# CONFIG_MFD_MAX8997 is not set -# CONFIG_MFD_MAX8998 is not set -# CONFIG_MFD_MT6397 is not set -# CONFIG_MFD_MENF21BMC is not set -# CONFIG_EZX_PCAP is not set -# CONFIG_MFD_CPCAP is not set -# CONFIG_MFD_VIPERBOARD is not set -# CONFIG_MFD_RETU is not set -# CONFIG_MFD_PCF50633 is not set CONFIG_MFD_I2C_PMIC=y -# CONFIG_MFD_QCOM_RPM is not set CONFIG_MFD_SPMI_PMIC=y -# CONFIG_MFD_RDC321X is not set -# CONFIG_MFD_RTSX_PCI is not set -# CONFIG_MFD_RT5033 is not set -# CONFIG_MFD_RTSX_USB is not set -# CONFIG_MFD_RC5T583 is not set -# CONFIG_MFD_RK808 is not set -# CONFIG_MFD_RN5T618 is not set -# CONFIG_MFD_SEC_CORE is not set -# CONFIG_MFD_SI476X_CORE is not set -# CONFIG_MFD_SM501 is not set -# CONFIG_MFD_SKY81452 is not set -# CONFIG_MFD_SMSC is not set -# CONFIG_ABX500_CORE is not set -# CONFIG_MFD_STMPE is not set -CONFIG_MFD_SYSCON=y -# CONFIG_MFD_TI_AM335X_TSCADC is not set -# CONFIG_MFD_LP3943 is not set -# CONFIG_MFD_LP8788 is not set -# CONFIG_MFD_TI_LMU is not set -# CONFIG_MFD_PALMAS is not set -# CONFIG_TPS6105X is not set -# CONFIG_TPS65010 is not set -# CONFIG_TPS6507X is not set -# CONFIG_MFD_TPS65086 is not set -# CONFIG_MFD_TPS65090 is not set -# CONFIG_MFD_TPS65217 is not set -# CONFIG_MFD_TI_LP873X is not set -# CONFIG_MFD_TI_LP87565 is not set -# CONFIG_MFD_TPS65218 is not set -# CONFIG_MFD_TPS6586X is not set -# CONFIG_MFD_TPS65910 is not set -# CONFIG_MFD_TPS65912_I2C is not set -# CONFIG_MFD_TPS65912_SPI is not set -# CONFIG_MFD_TPS80031 is not set -# CONFIG_TWL4030_CORE is not set -# CONFIG_TWL6040_CORE is not set -# CONFIG_MFD_WL1273_CORE is not set -# CONFIG_MFD_LM3533 is not set -# CONFIG_MFD_TC3589X is not set -# CONFIG_MFD_TMIO is not set -# CONFIG_MFD_VX855 is not set -# CONFIG_MFD_ARIZONA_I2C is not set -# CONFIG_MFD_ARIZONA_SPI is not set -# CONFIG_MFD_WM8400 is not set -# CONFIG_MFD_WM831X_I2C is not set -# CONFIG_MFD_WM831X_SPI is not set -# CONFIG_MFD_WM8350_I2C is not set -# CONFIG_MFD_WM8994 is not set -CONFIG_REGULATOR=y -# CONFIG_REGULATOR_DEBUG is not set CONFIG_REGULATOR_FIXED_VOLTAGE=y -# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set -# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set CONFIG_REGULATOR_PROXY_CONSUMER=y -# CONFIG_REGULATOR_ACT8865 is not set -# CONFIG_REGULATOR_AD5398 is not set -# CONFIG_REGULATOR_ANATOP is not set -# CONFIG_REGULATOR_DA9210 is not set -# CONFIG_REGULATOR_DA9211 is not set -# CONFIG_REGULATOR_FAN53555 is not set -# CONFIG_REGULATOR_GPIO is not set -# CONFIG_REGULATOR_ISL9305 is not set -# CONFIG_REGULATOR_ISL6271A is not set CONFIG_REGULATOR_PM8008=y -# CONFIG_REGULATOR_LP3971 is not set -# CONFIG_REGULATOR_LP3972 is not set -# CONFIG_REGULATOR_LP872X is not set -# CONFIG_REGULATOR_LP8755 is not set -# CONFIG_REGULATOR_LTC3589 is not set -# CONFIG_REGULATOR_LTC3676 is not set -# CONFIG_REGULATOR_MAX1586 is not set -# CONFIG_REGULATOR_MAX8649 is not set -# CONFIG_REGULATOR_MAX8660 is not set -# CONFIG_REGULATOR_MAX8952 is not set -# CONFIG_REGULATOR_MAX8973 is not set -# CONFIG_REGULATOR_MT6311 is not set -# CONFIG_REGULATOR_PFUZE100 is not set -# CONFIG_REGULATOR_PV88060 is not set -# CONFIG_REGULATOR_PV88080 is not set -# CONFIG_REGULATOR_PV88090 is not set -# CONFIG_REGULATOR_PWM is not set -# CONFIG_REGULATOR_QCOM_SPMI is not set CONFIG_REGULATOR_QPNP_AMOLED=y -# CONFIG_REGULATOR_QPNP_LABIBB is not set CONFIG_REGULATOR_QPNP_LCDB=y -# CONFIG_REGULATOR_QPNP_OLEDB is not set -# CONFIG_REGULATOR_TPS51632 is not set -# CONFIG_REGULATOR_TPS62360 is not set -# CONFIG_REGULATOR_TPS65023 is not set -# CONFIG_REGULATOR_TPS6507X is not set -# CONFIG_REGULATOR_TPS65132 is not set -# CONFIG_REGULATOR_TPS6524X is not set -# CONFIG_REGULATOR_VCTRL is not set -# CONFIG_REGULATOR_CPR is not set -# CONFIG_REGULATOR_CPR3 is not set -# CONFIG_REGULATOR_CPR4_MMSS_LDO is not set -# CONFIG_REGULATOR_CPRH_KBSS is not set -# CONFIG_REGULATOR_MEM_ACC is not set CONFIG_REGULATOR_REFGEN=y -# CONFIG_REGULATOR_MSM_GFX_LDO is not set CONFIG_REGULATOR_RPMH=y -# CONFIG_REGULATOR_SPM is not set CONFIG_REGULATOR_STUB=y -# CONFIG_REGULATOR_KTD2151 is not set -CONFIG_RC_CORE=y -CONFIG_RC_MAP=y -CONFIG_RC_DECODERS=y -# CONFIG_LIRC is not set -CONFIG_IR_NEC_DECODER=y -CONFIG_IR_RC5_DECODER=y -CONFIG_IR_RC6_DECODER=y -CONFIG_IR_JVC_DECODER=y -CONFIG_IR_SONY_DECODER=y -CONFIG_IR_SANYO_DECODER=y -CONFIG_IR_SHARP_DECODER=y -CONFIG_IR_MCE_KBD_DECODER=y -CONFIG_IR_XMP_DECODER=y -# CONFIG_RC_DEVICES is not set -CONFIG_IR_MSM_GENI=m CONFIG_MEDIA_SUPPORT=y - -# -# Multimedia core support -# CONFIG_MEDIA_CAMERA_SUPPORT=y -# CONFIG_MEDIA_ANALOG_TV_SUPPORT is not set CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -# CONFIG_MEDIA_RADIO_SUPPORT is not set -# CONFIG_MEDIA_SDR_SUPPORT is not set -# CONFIG_MEDIA_CEC_SUPPORT is not set CONFIG_MEDIA_CONTROLLER=y -# CONFIG_MEDIA_CONTROLLER_DVB is not set -CONFIG_VIDEO_DEV=y CONFIG_VIDEO_V4L2_SUBDEV_API=y -CONFIG_VIDEO_V4L2=y CONFIG_VIDEO_ADV_DEBUG=y CONFIG_VIDEO_FIXED_MINOR_RANGES=y -CONFIG_V4L2_MEM2MEM_DEV=y -CONFIG_VIDEOBUF2_CORE=y -CONFIG_VIDEOBUF2_MEMOPS=y -CONFIG_VIDEOBUF2_VMALLOC=y -# CONFIG_V4L2_LOOPBACK is not set -CONFIG_DVB_CORE=y -CONFIG_DVB_NET=y -# CONFIG_TTPCI_EEPROM is not set -CONFIG_DVB_MAX_ADAPTERS=16 -# CONFIG_DVB_DYNAMIC_MINORS is not set -# CONFIG_DVB_DEMUX_SECTION_LOSS_LOG is not set - -# -# Media drivers -# CONFIG_MEDIA_USB_SUPPORT=y - -# -# Webcam devices -# CONFIG_USB_VIDEO_CLASS=y -CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y -CONFIG_USB_GSPCA=m -# CONFIG_USB_M5602 is not set -# CONFIG_USB_STV06XX is not set -# CONFIG_USB_GL860 is not set -# CONFIG_USB_GSPCA_BENQ is not set -# CONFIG_USB_GSPCA_CONEX is not set -# CONFIG_USB_GSPCA_CPIA1 is not set -# CONFIG_USB_GSPCA_DTCS033 is not set -# CONFIG_USB_GSPCA_ETOMS is not set -# CONFIG_USB_GSPCA_FINEPIX is not set -# CONFIG_USB_GSPCA_JEILINJ is not set -# CONFIG_USB_GSPCA_JL2005BCD is not set -# CONFIG_USB_GSPCA_KINECT is not set -# CONFIG_USB_GSPCA_KONICA is not set -# CONFIG_USB_GSPCA_MARS is not set -# CONFIG_USB_GSPCA_MR97310A is not set -# CONFIG_USB_GSPCA_NW80X is not set -# CONFIG_USB_GSPCA_OV519 is not set -# CONFIG_USB_GSPCA_OV534 is not set -# CONFIG_USB_GSPCA_OV534_9 is not set -# CONFIG_USB_GSPCA_PAC207 is not set -# CONFIG_USB_GSPCA_PAC7302 is not set -# CONFIG_USB_GSPCA_PAC7311 is not set -# CONFIG_USB_GSPCA_SE401 is not set -# CONFIG_USB_GSPCA_SN9C2028 is not set -# CONFIG_USB_GSPCA_SN9C20X is not set -# CONFIG_USB_GSPCA_SONIXB is not set -# CONFIG_USB_GSPCA_SONIXJ is not set -# CONFIG_USB_GSPCA_SPCA500 is not set -# CONFIG_USB_GSPCA_SPCA501 is not set -# CONFIG_USB_GSPCA_SPCA505 is not set -# CONFIG_USB_GSPCA_SPCA506 is not set -# CONFIG_USB_GSPCA_SPCA508 is not set -# CONFIG_USB_GSPCA_SPCA561 is not set -# CONFIG_USB_GSPCA_SPCA1528 is not set -# CONFIG_USB_GSPCA_SQ905 is not set -# CONFIG_USB_GSPCA_SQ905C is not set -# CONFIG_USB_GSPCA_SQ930X is not set -# CONFIG_USB_GSPCA_STK014 is not set -# CONFIG_USB_GSPCA_STK1135 is not set -# CONFIG_USB_GSPCA_STV0680 is not set -# CONFIG_USB_GSPCA_SUNPLUS is not set -# CONFIG_USB_GSPCA_T613 is not set -# CONFIG_USB_GSPCA_TOPRO is not set -# CONFIG_USB_GSPCA_TOUPTEK is not set -# CONFIG_USB_GSPCA_TV8532 is not set -# CONFIG_USB_GSPCA_VC032X is not set -# CONFIG_USB_GSPCA_VICAM is not set -# CONFIG_USB_GSPCA_XIRLINK_CIT is not set -# CONFIG_USB_GSPCA_ZC3XX is not set -# CONFIG_USB_PWC is not set -# CONFIG_VIDEO_CPIA2 is not set -# CONFIG_USB_ZR364XX is not set -# CONFIG_USB_STKWEBCAM is not set -# CONFIG_USB_S2255 is not set -# CONFIG_VIDEO_USBTV is not set - -# -# Analog/digital TV USB devices -# -# CONFIG_VIDEO_AU0828 is not set -# CONFIG_VIDEO_CX231XX is not set -# CONFIG_VIDEO_TM6000 is not set - -# -# Digital TV USB devices -# -# CONFIG_DVB_USB is not set -# CONFIG_DVB_USB_V2 is not set -# CONFIG_DVB_TTUSB_BUDGET is not set -# CONFIG_DVB_TTUSB_DEC is not set -# CONFIG_SMS_USB_DRV is not set -# CONFIG_DVB_B2C2_FLEXCOP_USB is not set -# CONFIG_DVB_AS102 is not set - -# -# Webcam, TV (analog/digital) USB devices -# -# CONFIG_VIDEO_EM28XX is not set -# CONFIG_MEDIA_PCI_SUPPORT is not set CONFIG_V4L_PLATFORM_DRIVERS=y -# CONFIG_VIDEO_CAFE_CCIC is not set -# CONFIG_VIDEO_MUX is not set -# CONFIG_VIDEO_QCOM_CAMSS is not set -# CONFIG_SOC_CAMERA is not set -# CONFIG_VIDEO_XILINX is not set - -# -# Qualcomm Technologies, Inc. MSM Camera And Video -# CONFIG_SPECTRA_CAMERA=y -# CONFIG_MSM_AIS is not set -# CONFIG_MSM_CAMERA is not set -# CONFIG_MSMB_CAMERA is not set -# CONFIG_MSM_VIDC_3X_V4L2 is not set CONFIG_MSM_VIDC_V4L2=y CONFIG_MSM_VIDC_GOVERNORS=y CONFIG_MSM_SDE_ROTATOR=y CONFIG_MSM_SDE_ROTATOR_EVTLOG_DEBUG=y -# CONFIG_MSM_NPU is not set CONFIG_MSM_NPU_V2=y CONFIG_DVB_MPQ=m - -# -# Qualcomm Technologies, Inc. Demux device config -# CONFIG_DVB_MPQ_DEMUX=m -CONFIG_DVB_MPQ_NUM_DMX_DEVICES=4 CONFIG_DVB_MPQ_SW=y -# CONFIG_TSPP is not set -# CONFIG_V4L_MEM2MEM_DRIVERS is not set -# CONFIG_V4L_TEST_DRIVERS is not set -# CONFIG_DVB_PLATFORM_DRIVERS is not set - -# -# Qualcomm Technologies, Inc. MSM Camera And Video -# - -# -# Qualcomm Technologies, Inc. Demux device config -# - -# -# Qualcomm Technologies, Inc. MSM Camera And Video -# - -# -# Qualcomm Technologies, Inc. Demux device config -# - -# -# Supported MMC/SDIO adapters -# -# CONFIG_SMS_SDIO_DRV is not set -# CONFIG_CYPRESS_FIRMWARE is not set - -# -# Media ancillary drivers (tuners, sensors, i2c, spi, frontends) -# -CONFIG_MEDIA_SUBDRV_AUTOSELECT=y -CONFIG_MEDIA_ATTACH=y -CONFIG_VIDEO_IR_I2C=y - -# -# Audio decoders, processors and mixers -# - -# -# RDS decoders -# - -# -# Video decoders -# - -# -# Video and audio decoders -# - -# -# Video encoders -# - -# -# Camera sensor devices -# - -# -# Flash devices -# - -# -# Video improvement chips -# - -# -# Audio/Video compression chips -# - -# -# SDR tuner chips -# - -# -# Miscellaneous helper chips -# - -# -# Sensors used on soc_camera driver -# -CONFIG_MEDIA_TUNER=y -CONFIG_MEDIA_TUNER_SIMPLE=y -CONFIG_MEDIA_TUNER_TDA8290=y -CONFIG_MEDIA_TUNER_TDA827X=y -CONFIG_MEDIA_TUNER_TDA18271=y -CONFIG_MEDIA_TUNER_TDA9887=y -CONFIG_MEDIA_TUNER_MT20XX=y -CONFIG_MEDIA_TUNER_XC2028=y -CONFIG_MEDIA_TUNER_XC5000=y -CONFIG_MEDIA_TUNER_XC4000=y -CONFIG_MEDIA_TUNER_MC44S803=y - -# -# Multistandard (satellite) frontends -# - -# -# Multistandard (cable + terrestrial) frontends -# - -# -# DVB-S (satellite) frontends -# - -# -# DVB-T (terrestrial) frontends -# -# CONFIG_DVB_AS102_FE is not set -# CONFIG_DVB_GP8PSK_FE is not set - -# -# DVB-C (cable) frontends -# - -# -# ATSC (North American/Korean Terrestrial/Cable DTV) frontends -# - -# -# ISDB-T (terrestrial) frontends -# - -# -# ISDB-S (satellite) & ISDB-T (terrestrial) frontends -# - -# -# Digital terrestrial only tuners/PLL -# - -# -# SEC control devices for DVB-S -# - -# -# Tools to develop new frontends -# -# CONFIG_DVB_DUMMY_FE is not set - -# -# Graphics support -# -CONFIG_VGA_ARB=y -CONFIG_VGA_ARB_MAX_GPUS=16 CONFIG_DRM=y -CONFIG_DRM_MIPI_DSI=y -# CONFIG_DRM_DP_AUX_CHARDEV is not set -# CONFIG_DRM_DEBUG_MM is not set -# CONFIG_DRM_DEBUG_MM_SELFTEST is not set -CONFIG_DRM_KMS_HELPER=y -# CONFIG_DRM_FBDEV_EMULATION is not set -# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set - -# -# I2C encoder or helper chips -# -# CONFIG_DRM_I2C_CH7006 is not set -# CONFIG_DRM_I2C_SIL164 is not set -# CONFIG_DRM_I2C_NXP_TDA998X is not set -# CONFIG_DRM_HDLCD is not set -# CONFIG_DRM_MALI_DISPLAY is not set -# CONFIG_DRM_RADEON is not set -# CONFIG_DRM_AMDGPU is not set - -# -# ACP (Audio CoProcessor) Configuration -# -# CONFIG_DRM_NOUVEAU is not set -# CONFIG_DRM_VGEM is not set -# CONFIG_DRM_UDL is not set -# CONFIG_DRM_AST is not set -# CONFIG_DRM_MGAG200 is not set -# CONFIG_DRM_CIRRUS_QEMU is not set -# CONFIG_DRM_RCAR_DW_HDMI is not set -# CONFIG_DRM_QXL is not set -# CONFIG_DRM_BOCHS is not set -CONFIG_DRM_MSM=y CONFIG_DRM_MSM_REGISTER_LOGGING=y -# CONFIG_DRM_MSM_HDMI_HDCP is not set -# CONFIG_DRM_MSM_HDMI is not set -# CONFIG_DRM_MSM_DSI is not set -CONFIG_DRM_MSM_DSI_STAGING=y -# CONFIG_DRM_MSM_MDP5 is not set -# CONFIG_DRM_MSM_MDP4 is not set -# CONFIG_DRM_MSM_HDCP is not set -CONFIG_DRM_SDE_WB=y -# CONFIG_DRM_SDE_SHD is not set -# CONFIG_DRM_SDE_SHP is not set CONFIG_DRM_SDE_EVTLOG_DEBUG=y CONFIG_DRM_SDE_RSC=y -# CONFIG_DRM_MSM_LEASE is not set -CONFIG_DRM_PANEL=y - -# -# Display Panels -# -# CONFIG_DRM_PANEL_LVDS is not set -# CONFIG_DRM_PANEL_SIMPLE is not set -# CONFIG_DRM_PANEL_INNOLUX_P079ZCA is not set -# CONFIG_DRM_PANEL_JDI_LT070ME05000 is not set -# CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set -# CONFIG_DRM_PANEL_LG_LG4573 is not set -# CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00 is not set -# CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2 is not set -# CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set -# CONFIG_DRM_PANEL_SHARP_LQ101R1SX01 is not set -# CONFIG_DRM_PANEL_SHARP_LS043T1LE01 is not set -# CONFIG_DRM_PANEL_SITRONIX_ST7789V is not set -CONFIG_DRM_BRIDGE=y -CONFIG_DRM_PANEL_BRIDGE=y - -# -# Display Interface Bridges -# -# CONFIG_DRM_ANALOGIX_ANX78XX is not set CONFIG_DRM_ANALOGIX_ANX7625=y -# CONFIG_DRM_DUMB_VGA_DAC is not set -# CONFIG_DRM_LVDS_ENCODER is not set -# CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW is not set -# CONFIG_DRM_NXP_PTN3460 is not set -# CONFIG_DRM_PARADE_PS8622 is not set -# CONFIG_DRM_SIL_SII8620 is not set -# CONFIG_DRM_SII902X is not set -# CONFIG_DRM_TOSHIBA_TC358767 is not set -# CONFIG_DRM_TI_TFP410 is not set -# CONFIG_DRM_LT_LT9611 is not set -# CONFIG_DRM_I2C_ADV7511 is not set -# CONFIG_DRM_ARCPGU is not set -# CONFIG_DRM_HISI_HIBMC is not set -# CONFIG_DRM_HISI_KIRIN is not set -# CONFIG_DRM_MXSFB is not set -# CONFIG_DRM_TINYDRM is not set -# CONFIG_DRM_PL111 is not set -# CONFIG_DRM_LEGACY is not set -# CONFIG_DRM_LIB_RANDOM is not set - -# -# Frame buffer Devices -# -CONFIG_FB=y -# CONFIG_FIRMWARE_EDID is not set -CONFIG_FB_CMDLINE=y -CONFIG_FB_NOTIFY=y -# CONFIG_FB_DDC is not set -# CONFIG_FB_BOOT_VESA_SUPPORT is not set -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_IMAGEBLIT=y -# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set -# CONFIG_FB_SYS_FILLRECT is not set -# CONFIG_FB_SYS_COPYAREA is not set -# CONFIG_FB_SYS_IMAGEBLIT is not set -# CONFIG_FB_PROVIDE_GET_FB_UNMAPPED_AREA is not set -# CONFIG_FB_FOREIGN_ENDIAN is not set -# CONFIG_FB_SYS_FOPS is not set -# CONFIG_FB_SVGALIB is not set -# CONFIG_FB_MACMODES is not set -# CONFIG_FB_BACKLIGHT is not set -CONFIG_FB_MODE_HELPERS=y -# CONFIG_FB_TILEBLITTING is not set - -# -# Frame buffer hardware drivers -# -# CONFIG_FB_CIRRUS is not set -# CONFIG_FB_PM2 is not set CONFIG_FB_ARMCLCD=y -# CONFIG_FB_CYBER2000 is not set -# CONFIG_FB_ASILIANT is not set -# CONFIG_FB_IMSTT is not set -# CONFIG_FB_OPENCORES is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_NVIDIA is not set -# CONFIG_FB_RIVA is not set -# CONFIG_FB_I740 is not set -# CONFIG_FB_MATROX is not set -# CONFIG_FB_RADEON is not set -# CONFIG_FB_ATY128 is not set -# CONFIG_FB_ATY is not set -# CONFIG_FB_S3 is not set -# CONFIG_FB_SAVAGE is not set -# CONFIG_FB_SIS is not set -# CONFIG_FB_NEOMAGIC is not set -# CONFIG_FB_KYRO is not set -# CONFIG_FB_3DFX is not set -# CONFIG_FB_VOODOO1 is not set -# CONFIG_FB_VT8623 is not set -# CONFIG_FB_TRIDENT is not set -# CONFIG_FB_ARK is not set -# CONFIG_FB_PM3 is not set -# CONFIG_FB_CARMINE is not set -# CONFIG_FB_SMSCUFX is not set -# CONFIG_FB_UDL is not set -# CONFIG_FB_IBM_GXT4500 is not set -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FB_METRONOME is not set -# CONFIG_FB_MB862XX is not set -# CONFIG_FB_MSM is not set -# CONFIG_FB_BROADSHEET is not set -# CONFIG_FB_AUO_K190X is not set -# CONFIG_FB_SIMPLE is not set -# CONFIG_MSM_DBA is not set -# CONFIG_FB_SSD1307 is not set -# CONFIG_FB_SM712 is not set -CONFIG_BACKLIGHT_LCD_SUPPORT=y -CONFIG_LCD_CLASS_DEVICE=m -# CONFIG_LCD_L4F00242T03 is not set -# CONFIG_LCD_LMS283GF05 is not set -# CONFIG_LCD_LTV350QV is not set -# CONFIG_LCD_ILI922X is not set -# CONFIG_LCD_ILI9320 is not set -# CONFIG_LCD_TDO24M is not set -# CONFIG_LCD_VGG2432A4 is not set -# CONFIG_LCD_PLATFORM is not set -# CONFIG_LCD_S6E63M0 is not set -# CONFIG_LCD_LD9040 is not set -# CONFIG_LCD_AMS369FG06 is not set -# CONFIG_LCD_LMS501KF03 is not set -# CONFIG_LCD_HX8357 is not set -CONFIG_BACKLIGHT_CLASS_DEVICE=y -CONFIG_BACKLIGHT_GENERIC=y -# CONFIG_BACKLIGHT_PWM is not set -# CONFIG_BACKLIGHT_PM8941_WLED is not set CONFIG_BACKLIGHT_QCOM_SPMI_WLED=y -# CONFIG_BACKLIGHT_ADP8860 is not set -# CONFIG_BACKLIGHT_ADP8870 is not set -# CONFIG_BACKLIGHT_LM3630A is not set -# CONFIG_BACKLIGHT_LM3639 is not set -# CONFIG_BACKLIGHT_LP855X is not set -# CONFIG_BACKLIGHT_GPIO is not set -# CONFIG_BACKLIGHT_LV5207LP is not set -# CONFIG_BACKLIGHT_BD6107 is not set -# CONFIG_BACKLIGHT_ARCXCNN is not set -# CONFIG_BACKLIGHT_LM3697 is not set -# CONFIG_VGASTATE is not set -CONFIG_VIDEOMODE_HELPERS=y -CONFIG_HDMI=y - -# -# Console display driver support -# -CONFIG_DUMMY_CONSOLE=y -CONFIG_DUMMY_CONSOLE_COLUMNS=80 -CONFIG_DUMMY_CONSOLE_ROWS=25 -# CONFIG_FRAMEBUFFER_CONSOLE is not set CONFIG_LOGO=y # CONFIG_LOGO_LINUX_MONO is not set # CONFIG_LOGO_LINUX_VGA16 is not set -CONFIG_LOGO_LINUX_CLUT224=y CONFIG_SOUND=y -# CONFIG_SOUND_OSS_CORE is not set CONFIG_SND=y -CONFIG_SND_TIMER=y -CONFIG_SND_PCM=y -CONFIG_SND_PCM_ELD=y -CONFIG_SND_PCM_IEC958=y -CONFIG_SND_HWDEP=y -CONFIG_SND_RAWMIDI=y -CONFIG_SND_COMPRESS_OFFLOAD=y -CONFIG_SND_JACK=y -CONFIG_SND_JACK_INPUT_DEV=y -# CONFIG_SND_OSSEMUL is not set -CONFIG_SND_PCM_TIMER=y -# CONFIG_SND_HRTIMER is not set CONFIG_SND_DYNAMIC_MINORS=y -CONFIG_SND_MAX_CARDS=32 -CONFIG_SND_SUPPORT_OLD_API=y -CONFIG_SND_PROC_FS=y -CONFIG_SND_VERBOSE_PROCFS=y -# CONFIG_SND_VERBOSE_PRINTK is not set -# CONFIG_SND_DEBUG is not set -# CONFIG_SND_SEQUENCER is not set -# CONFIG_SND_OPL3_LIB_SEQ is not set -# CONFIG_SND_OPL4_LIB_SEQ is not set -CONFIG_SND_DRIVERS=y -# CONFIG_SND_DUMMY is not set -# CONFIG_SND_ALOOP is not set -# CONFIG_SND_MTPAV is not set -# CONFIG_SND_SERIAL_U16550 is not set -# CONFIG_SND_MPU401 is not set -# CONFIG_SND_PCI is not set - -# -# HD-Audio -# -CONFIG_SND_HDA_PREALLOC_SIZE=64 -CONFIG_SND_SPI=y -CONFIG_SND_USB=y CONFIG_SND_USB_AUDIO=y -# CONFIG_SND_USB_UA101 is not set -# CONFIG_SND_USB_CAIAQ is not set -# CONFIG_SND_USB_6FIRE is not set -# CONFIG_SND_USB_HIFACE is not set -# CONFIG_SND_BCD2000 is not set -# CONFIG_SND_USB_POD is not set -# CONFIG_SND_USB_PODHD is not set -# CONFIG_SND_USB_TONEPORT is not set -# CONFIG_SND_USB_VARIAX is not set CONFIG_SND_USB_AUDIO_QMI=y CONFIG_SND_SOC=y -CONFIG_SND_SOC_COMPRESS=y -# CONFIG_SND_SOC_AMD_ACP is not set -# CONFIG_SND_ATMEL_SOC is not set -# CONFIG_SND_DESIGNWARE_I2S is not set - -# -# SoC Audio for Freescale CPUs -# - -# -# Common SoC Audio options for Freescale CPUs: -# -# CONFIG_SND_SOC_FSL_ASRC is not set -# CONFIG_SND_SOC_FSL_SAI is not set -# CONFIG_SND_SOC_FSL_SSI is not set -# CONFIG_SND_SOC_FSL_SPDIF is not set -# CONFIG_SND_SOC_FSL_ESAI is not set -# CONFIG_SND_SOC_IMX_AUDMUX is not set -# CONFIG_SND_I2S_HI6210_I2S is not set -# CONFIG_SND_SOC_IMG is not set -# CONFIG_SND_SOC_QCOM is not set - -# -# STMicroelectronics STM32 SOC audio support -# -# CONFIG_SND_SOC_XTFPGA_I2S is not set -# CONFIG_ZX_TDM is not set -CONFIG_SND_SOC_I2C_AND_SPI=y - -# -# CODEC drivers -# -# CONFIG_SND_SOC_AC97_CODEC is not set -# CONFIG_SND_SOC_ADAU1701 is not set -# CONFIG_SND_SOC_ADAU1761_I2C is not set -# CONFIG_SND_SOC_ADAU1761_SPI is not set -# CONFIG_SND_SOC_ADAU7002 is not set -# CONFIG_SND_SOC_AK4104 is not set -# CONFIG_SND_SOC_AK4554 is not set -# CONFIG_SND_SOC_AK4613 is not set -# CONFIG_SND_SOC_AK4642 is not set -# CONFIG_SND_SOC_AK5386 is not set -# CONFIG_SND_SOC_ALC5623 is not set -# CONFIG_SND_SOC_BT_SCO is not set -# CONFIG_SND_SOC_CS35L32 is not set -# CONFIG_SND_SOC_CS35L33 is not set -# CONFIG_SND_SOC_CS35L34 is not set -# CONFIG_SND_SOC_CS35L35 is not set -# CONFIG_SND_SOC_CS42L42 is not set -# CONFIG_SND_SOC_CS42L51_I2C is not set -# CONFIG_SND_SOC_CS42L52 is not set -# CONFIG_SND_SOC_CS42L56 is not set -# CONFIG_SND_SOC_CS42L73 is not set -# CONFIG_SND_SOC_CS4265 is not set -# CONFIG_SND_SOC_CS4270 is not set -# CONFIG_SND_SOC_CS4271_I2C is not set -# CONFIG_SND_SOC_CS4271_SPI is not set -# CONFIG_SND_SOC_CS42XX8_I2C is not set -# CONFIG_SND_SOC_CS43130 is not set -# CONFIG_SND_SOC_CS4349 is not set -# CONFIG_SND_SOC_CS53L30 is not set -# CONFIG_SND_SOC_DIO2125 is not set -CONFIG_SND_SOC_HDMI_CODEC=y -# CONFIG_SND_SOC_ES7134 is not set -# CONFIG_SND_SOC_ES8316 is not set -# CONFIG_SND_SOC_ES8328_I2C is not set -# CONFIG_SND_SOC_ES8328_SPI is not set -# CONFIG_SND_SOC_GTM601 is not set -# CONFIG_SND_SOC_INNO_RK3036 is not set -# CONFIG_SND_SOC_MAX98504 is not set -# CONFIG_SND_SOC_MAX98927 is not set -# CONFIG_SND_SOC_MAX9860 is not set -# CONFIG_SND_SOC_MSM8916_WCD_ANALOG is not set -# CONFIG_SND_SOC_MSM8916_WCD_DIGITAL is not set -# CONFIG_SND_SOC_PCM1681 is not set -# CONFIG_SND_SOC_PCM179X_I2C is not set -# CONFIG_SND_SOC_PCM179X_SPI is not set -# CONFIG_SND_SOC_PCM3168A_I2C is not set -# CONFIG_SND_SOC_PCM3168A_SPI is not set -# CONFIG_SND_SOC_PCM512x_I2C is not set -# CONFIG_SND_SOC_PCM512x_SPI is not set -# CONFIG_SND_SOC_RT5616 is not set -# CONFIG_SND_SOC_RT5631 is not set -# CONFIG_SND_SOC_RT5677_SPI is not set -# CONFIG_SND_SOC_SGTL5000 is not set -# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set -# CONFIG_SND_SOC_SPDIF is not set -# CONFIG_SND_SOC_SSM2602_SPI is not set -# CONFIG_SND_SOC_SSM2602_I2C is not set -# CONFIG_SND_SOC_SSM4567 is not set -# CONFIG_SND_SOC_STA32X is not set -# CONFIG_SND_SOC_STA350 is not set -# CONFIG_SND_SOC_STI_SAS is not set -# CONFIG_SND_SOC_TAS2552 is not set -# CONFIG_SND_SOC_TAS5086 is not set -# CONFIG_SND_SOC_TAS571X is not set -# CONFIG_SND_SOC_TAS5720 is not set -# CONFIG_SND_SOC_TFA9879 is not set -# CONFIG_SND_SOC_TLV320AIC23_I2C is not set -# CONFIG_SND_SOC_TLV320AIC23_SPI is not set -# CONFIG_SND_SOC_TLV320AIC31XX is not set -# CONFIG_SND_SOC_TLV320AIC3X is not set -# CONFIG_SND_SOC_TS3A227E is not set -# CONFIG_SND_SOC_WM8510 is not set -# CONFIG_SND_SOC_WM8523 is not set -# CONFIG_SND_SOC_WM8524 is not set -# CONFIG_SND_SOC_WM8580 is not set -# CONFIG_SND_SOC_WM8711 is not set -# CONFIG_SND_SOC_WM8728 is not set -# CONFIG_SND_SOC_WM8731 is not set -# CONFIG_SND_SOC_WM8737 is not set -# CONFIG_SND_SOC_WM8741 is not set -# CONFIG_SND_SOC_WM8750 is not set -# CONFIG_SND_SOC_WM8753 is not set -# CONFIG_SND_SOC_WM8770 is not set -# CONFIG_SND_SOC_WM8776 is not set -# CONFIG_SND_SOC_WM8804_I2C is not set -# CONFIG_SND_SOC_WM8804_SPI is not set -# CONFIG_SND_SOC_WM8903 is not set -# CONFIG_SND_SOC_WM8960 is not set -# CONFIG_SND_SOC_WM8962 is not set -# CONFIG_SND_SOC_WM8974 is not set -# CONFIG_SND_SOC_WM8978 is not set -# CONFIG_SND_SOC_WM8985 is not set -# CONFIG_SND_SOC_ZX_AUD96P22 is not set -# CONFIG_SND_SOC_NAU8540 is not set -# CONFIG_SND_SOC_NAU8810 is not set -# CONFIG_SND_SOC_NAU8824 is not set -# CONFIG_SND_SOC_TPA6130A2 is not set -# CONFIG_SND_SOC_TFA98XX is not set -# CONFIG_SND_SIMPLE_CARD is not set -# CONFIG_SND_SIMPLE_SCU_CARD is not set -# CONFIG_SND_AUDIO_GRAPH_CARD is not set -# CONFIG_SND_AUDIO_GRAPH_SCU_CARD is not set - -# -# HID support -# -CONFIG_HID=y -# CONFIG_HID_BATTERY_STRENGTH is not set -# CONFIG_HIDRAW is not set CONFIG_UHID=y -CONFIG_HID_GENERIC=y - -# -# Special HID drivers -# -# CONFIG_HID_A4TECH is not set -# CONFIG_HID_ACCUTOUCH is not set -# CONFIG_HID_ACRUX is not set CONFIG_HID_APPLE=y -# CONFIG_HID_APPLEIR is not set -# CONFIG_HID_ASUS is not set -# CONFIG_HID_AUREAL is not set -# CONFIG_HID_BELKIN is not set -CONFIG_HID_BETOP_FF=y -# CONFIG_HID_CHERRY is not set -# CONFIG_HID_CHICONY is not set -# CONFIG_HID_CORSAIR is not set -# CONFIG_HID_PRODIKEYS is not set -# CONFIG_HID_CMEDIA is not set -# CONFIG_HID_CYPRESS is not set -# CONFIG_HID_DRAGONRISE is not set -# CONFIG_HID_EMS_FF is not set CONFIG_HID_ELECOM=y -# CONFIG_HID_ELO is not set -# CONFIG_HID_EZKEY is not set -# CONFIG_HID_GEMBIRD is not set -# CONFIG_HID_GFRM is not set -# CONFIG_HID_HOLTEK is not set -# CONFIG_HID_GT683R is not set -# CONFIG_HID_KEYTOUCH is not set -# CONFIG_HID_KYE is not set -# CONFIG_HID_UCLOGIC is not set -# CONFIG_HID_WALTOP is not set -# CONFIG_HID_GYRATION is not set -# CONFIG_HID_ICADE is not set -# CONFIG_HID_ITE is not set -# CONFIG_HID_TWINHAN is not set -# CONFIG_HID_KENSINGTON is not set -# CONFIG_HID_LCPOWER is not set -# CONFIG_HID_LED is not set -# CONFIG_HID_LENOVO is not set -# CONFIG_HID_LOGITECH is not set CONFIG_HID_MAGICMOUSE=y -# CONFIG_HID_MAYFLASH is not set CONFIG_HID_MICROSOFT=y -# CONFIG_HID_MONTEREY is not set CONFIG_HID_MULTITOUCH=y CONFIG_HID_NINTENDO=y -# CONFIG_HID_NTI is not set -# CONFIG_HID_NTRIG is not set -# CONFIG_HID_ORTEK is not set -# CONFIG_HID_PANTHERLORD is not set -# CONFIG_HID_PENMOUNT is not set -# CONFIG_HID_PETALYNX is not set -# CONFIG_HID_PICOLCD is not set CONFIG_HID_PLANTRONICS=y -# CONFIG_HID_PRIMAX is not set -# CONFIG_HID_RETRODE is not set -# CONFIG_HID_ROCCAT is not set -# CONFIG_HID_SAITEK is not set -# CONFIG_HID_SAMSUNG is not set CONFIG_HID_SONY=y -CONFIG_SONY_FF=y -# CONFIG_HID_SPEEDLINK is not set -# CONFIG_HID_STEAM is not set -# CONFIG_HID_STEELSERIES is not set -# CONFIG_HID_SUNPLUS is not set -# CONFIG_HID_RMI is not set -# CONFIG_HID_GREENASIA is not set -# CONFIG_HID_SMARTJOYPLUS is not set -# CONFIG_HID_TIVO is not set -# CONFIG_HID_TOPSEED is not set -# CONFIG_HID_THINGM is not set -# CONFIG_HID_THRUSTMASTER is not set -# CONFIG_HID_UDRAW_PS3 is not set -# CONFIG_HID_WACOM is not set -# CONFIG_HID_WIIMOTE is not set -# CONFIG_HID_XINMO is not set -# CONFIG_HID_ZEROPLUS is not set -# CONFIG_HID_ZYDACRON is not set -# CONFIG_HID_SENSOR_HUB is not set -# CONFIG_HID_ALPS is not set CONFIG_HID_QVR=y - -# -# USB HID support -# -CONFIG_USB_HID=y -# CONFIG_HID_PID is not set -# CONFIG_USB_HIDDEV is not set - -# -# I2C HID support -# -# CONFIG_I2C_HID is not set -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_COMMON=y -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB=y -CONFIG_USB_PCI=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y - -# -# Miscellaneous USB options -# -CONFIG_USB_DEFAULT_PERSIST=y -# CONFIG_USB_DYNAMIC_MINORS is not set -# CONFIG_USB_OTG is not set -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -# CONFIG_USB_LEDS_TRIGGER_USBPORT is not set -# CONFIG_USB_MON is not set -# CONFIG_USB_WUSB_CBAF is not set - -# -# USB Host Controller Drivers -# -# CONFIG_USB_C67X00_HCD is not set CONFIG_USB_XHCI_HCD=y -CONFIG_USB_XHCI_PCI=y -CONFIG_USB_XHCI_PLATFORM=y CONFIG_USB_EHCI_HCD=y -# CONFIG_USB_EHCI_ROOT_HUB_TT is not set -CONFIG_USB_EHCI_TT_NEWSCHED=y -CONFIG_USB_EHCI_PCI=y -# CONFIG_USB_EHCI_MSM is not set -# CONFIG_USB_EHCI_MSM_HSIC is not set CONFIG_USB_EHCI_HCD_PLATFORM=y -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_ISP1362_HCD is not set -# CONFIG_USB_FOTG210_HCD is not set -# CONFIG_USB_MAX3421_HCD is not set CONFIG_USB_OHCI_HCD=y -CONFIG_USB_OHCI_HCD_PCI=y CONFIG_USB_OHCI_HCD_PLATFORM=y -# CONFIG_USB_UHCI_HCD is not set -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_R8A66597_HCD is not set -# CONFIG_USB_HCD_TEST_MODE is not set - -# -# USB Device Class drivers -# -# CONFIG_USB_ACM is not set -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_WDM is not set -# CONFIG_USB_TMC is not set - -# -# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may -# - -# -# also be needed; see USB_STORAGE Help for more info -# CONFIG_USB_STORAGE=y -# CONFIG_USB_STORAGE_DEBUG is not set -# CONFIG_USB_STORAGE_REALTEK is not set -# CONFIG_USB_STORAGE_DATAFAB is not set -# CONFIG_USB_STORAGE_FREECOM is not set -# CONFIG_USB_STORAGE_ISD200 is not set -# CONFIG_USB_STORAGE_USBAT is not set -# CONFIG_USB_STORAGE_SDDR09 is not set -# CONFIG_USB_STORAGE_SDDR55 is not set -# CONFIG_USB_STORAGE_JUMPSHOT is not set -# CONFIG_USB_STORAGE_ALAUDA is not set -# CONFIG_USB_STORAGE_ONETOUCH is not set -# CONFIG_USB_STORAGE_KARMA is not set -# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set -# CONFIG_USB_STORAGE_ENE_UB6250 is not set -# CONFIG_USB_UAS is not set - -# -# USB Imaging devices -# -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -# CONFIG_USBIP_CORE is not set -# CONFIG_USB_MUSB_HDRC is not set CONFIG_USB_DWC3=y -# CONFIG_USB_DWC3_HOST is not set -# CONFIG_USB_DWC3_GADGET is not set -CONFIG_USB_DWC3_DUAL_ROLE=y - -# -# Platform Glue Driver Support -# -CONFIG_USB_DWC3_OF_SIMPLE=y CONFIG_USB_DWC3_MSM=y -# CONFIG_USB_DWC2 is not set -# CONFIG_USB_CHIPIDEA is not set CONFIG_USB_ISP1760=y -CONFIG_USB_ISP1760_HCD=y CONFIG_USB_ISP1760_HOST_ROLE=y -# CONFIG_USB_ISP1760_GADGET_ROLE is not set -# CONFIG_USB_ISP1760_DUAL_ROLE is not set - -# -# USB port drivers -# -# CONFIG_USB_SERIAL is not set - -# -# USB Miscellaneous drivers -# -# CONFIG_USB_EMI62 is not set -# CONFIG_USB_EMI26 is not set -# CONFIG_USB_ADUTUX is not set -# CONFIG_USB_SEVSEG is not set -# CONFIG_USB_LEGOTOWER is not set -# CONFIG_USB_LCD is not set -# CONFIG_USB_CYPRESS_CY7C63 is not set -# CONFIG_USB_CYTHERM is not set -# CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_FTDI_ELAN is not set -# CONFIG_USB_APPLEDISPLAY is not set -# CONFIG_USB_SISUSBVGA is not set -# CONFIG_USB_LD is not set -# CONFIG_USB_TRANCEVIBRATOR is not set -# CONFIG_USB_IOWARRIOR is not set -# CONFIG_USB_TEST is not set CONFIG_USB_EHSET_TEST_FIXTURE=y -# CONFIG_USB_ISIGHTFW is not set -# CONFIG_USB_YUREX is not set -# CONFIG_USB_EZUSB_FX2 is not set -# CONFIG_USB_HUB_USB251XB is not set -# CONFIG_USB_HSIC_USB3503 is not set -# CONFIG_USB_HSIC_USB4604 is not set CONFIG_USB_LINK_LAYER_TEST=y -# CONFIG_USB_CHAOSKEY is not set -# CONFIG_USB_REDRIVER_NB7VPQ904M is not set -# CONFIG_USB_TYPEC_MUX_NXP5150A is not set -# CONFIG_USB_QTI_DIAG_BRIDGE is not set -# CONFIG_USB_QTI_MDM_DATA_BRIDGE is not set -# CONFIG_USB_QTI_KS_BRIDGE is not set - -# -# USB Physical Layer drivers -# -CONFIG_USB_PHY=y -# CONFIG_USB_OTG_WAKELOCK is not set CONFIG_NOP_USB_XCEIV=y -# CONFIG_USB_GPIO_VBUS is not set -# CONFIG_USB_ISP1301 is not set -# CONFIG_MSM_SNPS_FEMTO_PHY is not set -# CONFIG_USB_MSM_OTG is not set -# CONFIG_USB_MSM_SSPHY is not set -# CONFIG_USB_QCOM_8X16_PHY is not set CONFIG_USB_QCOM_EMU_PHY=y CONFIG_USB_MSM_SSPHY_QMP=y CONFIG_MSM_QUSB_PHY=y CONFIG_MSM_HSUSB_PHY=y -# CONFIG_USB_ULPI is not set CONFIG_DUAL_ROLE_USB_INTF=y CONFIG_USB_GADGET=y -# CONFIG_USB_GADGET_DEBUG is not set -# CONFIG_USB_GADGET_DEBUG_FILES is not set CONFIG_USB_GADGET_VBUS_DRAW=900 -CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 - -# -# USB Peripheral Controller -# -# CONFIG_USB_FOTG210_UDC is not set -# CONFIG_USB_GR_UDC is not set -# CONFIG_USB_R8A66597 is not set -# CONFIG_USB_PXA27X is not set -# CONFIG_USB_MV_UDC is not set -# CONFIG_USB_MV_U3D is not set -# CONFIG_USB_SNP_UDC_PLAT is not set -# CONFIG_USB_M66592 is not set -# CONFIG_USB_BDC_UDC is not set -# CONFIG_USB_AMD5536UDC is not set -# CONFIG_USB_NET2272 is not set -# CONFIG_USB_NET2280 is not set -# CONFIG_USB_GOKU is not set -# CONFIG_USB_EG20T is not set -# CONFIG_USB_GADGET_XILINX is not set -# CONFIG_USB_CI13XXX_MSM is not set -# CONFIG_USB_CI13XXX_MSM_HSIC is not set -# CONFIG_USB_DUMMY_HCD is not set -CONFIG_USB_LIBCOMPOSITE=y -CONFIG_USB_U_ETHER=y -CONFIG_USB_F_NCM=y -CONFIG_USB_RNDIS=y -CONFIG_USB_F_MASS_STORAGE=y -CONFIG_USB_F_FS=y -CONFIG_USB_F_MIDI=y -CONFIG_USB_F_HID=y -CONFIG_USB_F_MTP=y -CONFIG_USB_F_PTP=y -CONFIG_USB_F_AUDIO_SRC=y -CONFIG_USB_F_ACC=y -CONFIG_USB_F_DIAG=y -CONFIG_USB_F_CDEV=y -CONFIG_USB_F_CCID=y -CONFIG_USB_F_GSI=y -CONFIG_USB_F_QDSS=y CONFIG_USB_CONFIGFS=y -# CONFIG_USB_CONFIGFS_SERIAL is not set -# CONFIG_USB_CONFIGFS_ACM is not set -# CONFIG_USB_CONFIGFS_OBEX is not set CONFIG_USB_CONFIGFS_NCM=y -# CONFIG_USB_CONFIGFS_ECM is not set -# CONFIG_USB_CONFIGFS_ECM_SUBSET is not set -# CONFIG_USB_CONFIGFS_QCRNDIS is not set -# CONFIG_USB_CONFIGFS_RNDIS is not set -# CONFIG_USB_CONFIGFS_RMNET_BAM is not set -# CONFIG_USB_CONFIGFS_MBIM_BAM is not set -# CONFIG_USB_CONFIGFS_EEM is not set CONFIG_USB_CONFIGFS_MASS_STORAGE=y -# CONFIG_USB_CONFIGFS_F_LB_SS is not set CONFIG_USB_CONFIGFS_F_FS=y CONFIG_USB_CONFIGFS_F_MTP=y CONFIG_USB_CONFIGFS_F_PTP=y CONFIG_USB_CONFIGFS_F_ACC=y CONFIG_USB_CONFIGFS_F_AUDIO_SRC=y CONFIG_USB_CONFIGFS_UEVENT=y -# CONFIG_USB_CONFIGFS_F_UAC1 is not set -# CONFIG_USB_CONFIGFS_F_UAC1_LEGACY is not set -# CONFIG_USB_CONFIGFS_F_UAC2 is not set CONFIG_USB_CONFIGFS_F_MIDI=y CONFIG_USB_CONFIGFS_F_HID=y -# CONFIG_USB_CONFIGFS_F_UVC is not set -# CONFIG_USB_CONFIGFS_F_PRINTER is not set CONFIG_USB_CONFIGFS_F_DIAG=y CONFIG_USB_CONFIGFS_F_CDEV=y CONFIG_USB_CONFIGFS_F_CCID=y CONFIG_USB_CONFIGFS_F_GSI=y CONFIG_USB_CONFIGFS_F_QDSS=y -# CONFIG_USB_CONFIGFS_F_IPC is not set - -# -# USB Power Delivery and Type-C drivers -# -# CONFIG_TYPEC_UCSI is not set - -# -# USB Power Delivery -# -CONFIG_USB_PD=y CONFIG_USB_PD_POLICY=y CONFIG_QPNP_USB_PDPHY=y -# CONFIG_USB_LED_TRIG is not set -# CONFIG_USB_ULPI_BUS is not set -# CONFIG_UWB is not set CONFIG_MMC=y CONFIG_MMC_PERF_PROFILING=y -CONFIG_PWRSEQ_EMMC=y -CONFIG_PWRSEQ_SIMPLE=y -CONFIG_MMC_BLOCK=y CONFIG_MMC_BLOCK_MINORS=32 CONFIG_MMC_BLOCK_DEFERRED_RESUME=y -# CONFIG_SDIO_UART is not set CONFIG_MMC_TEST=m -# CONFIG_MMC_RING_BUFFER is not set -# CONFIG_MMC_EMBEDDED_SDIO is not set CONFIG_MMC_PARANOID_SD_INIT=y CONFIG_MMC_CLKGATE=y -# CONFIG_MMC_SIMULATE_MAX_SPEED is not set - -# -# MMC/SD/SDIO Host Controller Drivers -# -# CONFIG_MMC_DEBUG is not set -# CONFIG_MMC_ARMMMCI is not set CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_IO_ACCESSORS=y -# CONFIG_MMC_SDHCI_PCI is not set CONFIG_MMC_SDHCI_PLTFM=y -# CONFIG_MMC_SDHCI_OF_ARASAN is not set -# CONFIG_MMC_SDHCI_OF_AT91 is not set -# CONFIG_MMC_SDHCI_CADENCE is not set -# CONFIG_MMC_SDHCI_F_SDH30 is not set CONFIG_MMC_SDHCI_MSM=y -# CONFIG_MMC_TIFM_SD is not set -# CONFIG_MMC_SPI is not set -# CONFIG_MMC_CB710 is not set -# CONFIG_MMC_VIA_SDMMC is not set -# CONFIG_MMC_CAVIUM_THUNDERX is not set -# CONFIG_MMC_DW is not set -# CONFIG_MMC_VUB300 is not set -# CONFIG_MMC_USHC is not set -# CONFIG_MMC_USDHI6ROL0 is not set CONFIG_MMC_CQ_HCI=y -# CONFIG_MMC_TOSHIBA_PCI is not set -# CONFIG_MMC_MTK is not set -# CONFIG_MMC_SDHCI_XENON is not set CONFIG_MMC_CQ_HCI_CRYPTO=y CONFIG_MMC_CQ_HCI_CRYPTO_QTI=y -# CONFIG_MEMSTICK is not set CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y -# CONFIG_LEDS_CLASS_FLASH is not set -# CONFIG_LEDS_BRIGHTNESS_HW_CHANGED is not set - -# -# LED drivers -# -# CONFIG_LEDS_BCM6328 is not set -# CONFIG_LEDS_BCM6358 is not set -# CONFIG_LEDS_LM3530 is not set -# CONFIG_LEDS_LM3642 is not set -# CONFIG_LEDS_PCA9532 is not set -# CONFIG_LEDS_GPIO is not set -# CONFIG_LEDS_LP3944 is not set -# CONFIG_LEDS_LP3952 is not set -# CONFIG_LEDS_LP5521 is not set -# CONFIG_LEDS_LP5523 is not set -# CONFIG_LEDS_LP5562 is not set -# CONFIG_LEDS_LP8501 is not set -# CONFIG_LEDS_LP8860 is not set -# CONFIG_LEDS_PCA955X is not set -# CONFIG_LEDS_PCA963X is not set -# CONFIG_LEDS_PCA9956B is not set CONFIG_LEDS_QPNP_FLASH_V2=y CONFIG_LEDS_QPNP_HAPTICS=y -# CONFIG_LEDS_DAC124S085 is not set -# CONFIG_LEDS_PWM is not set -# CONFIG_LEDS_REGULATOR is not set -# CONFIG_LEDS_BD2802 is not set -# CONFIG_LEDS_LT3593 is not set -# CONFIG_LEDS_TCA6507 is not set -# CONFIG_LEDS_TLC591XX is not set -# CONFIG_LEDS_LM355x is not set -# CONFIG_LEDS_IS31FL319X is not set -# CONFIG_LEDS_IS31FL32XX is not set -# CONFIG_LEDS_QCOM_CLK is not set - -# -# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) -# -# CONFIG_LEDS_BLINKM is not set CONFIG_LEDS_QTI_TRI_LED=y -# CONFIG_LEDS_SYSCON is not set -# CONFIG_LEDS_USER is not set CONFIG_LEDS_QPNP_VIBRATOR_LDO=y - -# -# LED Triggers -# -CONFIG_LEDS_TRIGGERS=y CONFIG_LEDS_TRIGGER_TIMER=y -# CONFIG_LEDS_TRIGGER_ONESHOT is not set -# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set -# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set -# CONFIG_LEDS_TRIGGER_CPU is not set -# CONFIG_LEDS_TRIGGER_GPIO is not set -# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set - -# -# iptables trigger is under Netfilter config (LED target) -# -# CONFIG_LEDS_TRIGGER_TRANSIENT is not set -# CONFIG_LEDS_TRIGGER_CAMERA is not set -# CONFIG_LEDS_TRIGGER_PANIC is not set -# CONFIG_ACCESSIBILITY is not set -# CONFIG_INFINIBAND is not set -CONFIG_EDAC_SUPPORT=y CONFIG_EDAC=y -CONFIG_EDAC_LEGACY_SYSFS=y -# CONFIG_EDAC_DEBUG is not set -# CONFIG_EDAC_THUNDERX is not set CONFIG_EDAC_KRYO_ARM64=y -# CONFIG_EDAC_KRYO_ARM64_POLL is not set -# CONFIG_EDAC_KRYO_ARM64_PANIC_ON_CE is not set CONFIG_EDAC_KRYO_ARM64_PANIC_ON_UE=y -# CONFIG_EDAC_GIC is not set -# CONFIG_EDAC_XGENE is not set -# CONFIG_EDAC_CORTEX_ARM64 is not set -# CONFIG_EDAC_QCOM_LLCC is not set -CONFIG_RTC_LIB=y CONFIG_RTC_CLASS=y -CONFIG_RTC_HCTOSYS=y -CONFIG_RTC_HCTOSYS_DEVICE="rtc0" -CONFIG_RTC_SYSTOHC=y -CONFIG_RTC_SYSTOHC_DEVICE="rtc0" -# CONFIG_RTC_DEBUG is not set -CONFIG_RTC_NVMEM=y - -# -# RTC interfaces -# -CONFIG_RTC_INTF_SYSFS=y -CONFIG_RTC_INTF_PROC=y -CONFIG_RTC_INTF_DEV=y -# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set -# CONFIG_RTC_DRV_TEST is not set - -# -# I2C RTC drivers -# -# CONFIG_RTC_DRV_ABB5ZES3 is not set -# CONFIG_RTC_DRV_ABX80X is not set -# CONFIG_RTC_DRV_DS1307 is not set -# CONFIG_RTC_DRV_DS1374 is not set -# CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_HYM8563 is not set -# CONFIG_RTC_DRV_MAX6900 is not set -# CONFIG_RTC_DRV_RS5C372 is not set -# CONFIG_RTC_DRV_ISL1208 is not set -# CONFIG_RTC_DRV_ISL12022 is not set -# CONFIG_RTC_DRV_X1205 is not set -# CONFIG_RTC_DRV_PCF8523 is not set -# CONFIG_RTC_DRV_PCF85063 is not set -# CONFIG_RTC_DRV_PCF8563 is not set -# CONFIG_RTC_DRV_PCF8583 is not set -# CONFIG_RTC_DRV_M41T80 is not set -# CONFIG_RTC_DRV_BQ32K is not set -# CONFIG_RTC_DRV_S35390A is not set -# CONFIG_RTC_DRV_FM3130 is not set -# CONFIG_RTC_DRV_RX8010 is not set -# CONFIG_RTC_DRV_RX8581 is not set -# CONFIG_RTC_DRV_RX8025 is not set -# CONFIG_RTC_DRV_EM3027 is not set -# CONFIG_RTC_DRV_RV8803 is not set - -# -# SPI RTC drivers -# -# CONFIG_RTC_DRV_M41T93 is not set -# CONFIG_RTC_DRV_M41T94 is not set -# CONFIG_RTC_DRV_DS1302 is not set -# CONFIG_RTC_DRV_DS1305 is not set -# CONFIG_RTC_DRV_DS1343 is not set -# CONFIG_RTC_DRV_DS1347 is not set -# CONFIG_RTC_DRV_DS1390 is not set -# CONFIG_RTC_DRV_MAX6916 is not set -# CONFIG_RTC_DRV_R9701 is not set -# CONFIG_RTC_DRV_RX4581 is not set -# CONFIG_RTC_DRV_RX6110 is not set -# CONFIG_RTC_DRV_RS5C348 is not set -# CONFIG_RTC_DRV_MAX6902 is not set -# CONFIG_RTC_DRV_PCF2123 is not set -# CONFIG_RTC_DRV_MCP795 is not set -CONFIG_RTC_I2C_AND_SPI=y - -# -# SPI and I2C RTC drivers -# -# CONFIG_RTC_DRV_DS3232 is not set -# CONFIG_RTC_DRV_PCF2127 is not set -# CONFIG_RTC_DRV_RV3029C2 is not set - -# -# Platform RTC drivers -# -# CONFIG_RTC_DRV_DS1286 is not set -# CONFIG_RTC_DRV_DS1511 is not set -# CONFIG_RTC_DRV_DS1553 is not set -# CONFIG_RTC_DRV_DS1685_FAMILY is not set -# CONFIG_RTC_DRV_DS1742 is not set -# CONFIG_RTC_DRV_DS2404 is not set -# CONFIG_RTC_DRV_STK17TA8 is not set -# CONFIG_RTC_DRV_M48T86 is not set -# 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_V3020 is not set -# CONFIG_RTC_DRV_ZYNQMP is not set - -# -# on-CPU RTC drivers -# -# CONFIG_RTC_DRV_PL030 is not set -# CONFIG_RTC_DRV_PL031 is not set -# CONFIG_RTC_DRV_FTRTC010 is not set -# CONFIG_RTC_DRV_PM8XXX is not set CONFIG_RTC_DRV_QPNP=y -# CONFIG_RTC_DRV_SNVS is not set -# CONFIG_RTC_DRV_R7301 is not set - -# -# HID Sensor RTC drivers -# -# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set CONFIG_DMADEVICES=y -# CONFIG_DMADEVICES_DEBUG is not set - -# -# DMA Devices -# -CONFIG_DMA_ENGINE=y -CONFIG_DMA_VIRTUAL_CHANNELS=y -CONFIG_DMA_OF=y -# CONFIG_ALTERA_MSGDMA is not set -# CONFIG_AMBA_PL08X is not set -# CONFIG_FSL_EDMA is not set -# CONFIG_INTEL_IDMA64 is not set -# CONFIG_MV_XOR_V2 is not set -# CONFIG_PL330_DMA is not set -# CONFIG_QCOM_SPS_DMA is not set -# CONFIG_XILINX_DMA is not set -# CONFIG_XILINX_ZYNQMP_DMA is not set -# CONFIG_QCOM_BAM_DMA is not set -# CONFIG_QCOM_HIDMA_MGMT is not set -# CONFIG_QCOM_HIDMA is not set CONFIG_QCOM_GPI_DMA=y -# CONFIG_QCOM_GPI_DMA_DEBUG is not set -# CONFIG_QCOM_PCI_EDMA is not set -# CONFIG_DW_DMAC is not set -# CONFIG_DW_DMAC_PCI is not set - -# -# DMA Clients -# -# CONFIG_ASYNC_TX_DMA is not set -# CONFIG_DMATEST is not set - -# -# DMABUF options -# -CONFIG_SYNC_FILE=y -# CONFIG_AUXDISPLAY is not set CONFIG_UIO=y -# CONFIG_UIO_CIF is not set -# CONFIG_UIO_PDRV_GENIRQ is not set -# CONFIG_UIO_DMEM_GENIRQ is not set -# CONFIG_UIO_AEC is not set -# CONFIG_UIO_SERCOS3 is not set -# CONFIG_UIO_PCI_GENERIC is not set -# CONFIG_UIO_NETX is not set -# CONFIG_UIO_PRUSS is not set -# CONFIG_UIO_MF624 is not set CONFIG_UIO_MSM_SHAREDMEM=y -# CONFIG_VFIO is not set -# CONFIG_VIRT_DRIVERS is not set - -# -# Virtio drivers -# -# CONFIG_VIRTIO_PCI is not set -# CONFIG_VIRTIO_MMIO is not set - -# -# Microsoft Hyper-V guest support -# -# CONFIG_HYPERV_TSCPAGE is not set -# CONFIG_VSERVICES_SUPPORT is not set CONFIG_STAGING=y -# CONFIG_IRDA is not set -# CONFIG_PRISM2_USB is not set -# CONFIG_COMEDI is not set -# CONFIG_RTL8192U is not set -# CONFIG_RTLLIB is not set -# CONFIG_RTL8723BS is not set -# CONFIG_R8712U is not set -# CONFIG_R8188EU is not set -# CONFIG_RTS5208 is not set - -# -# IIO staging drivers -# - -# -# Accelerometers -# -# CONFIG_ADIS16201 is not set -# CONFIG_ADIS16203 is not set -# CONFIG_ADIS16209 is not set -# CONFIG_ADIS16240 is not set - -# -# Analog to digital converters -# -# CONFIG_AD7606 is not set -# CONFIG_AD7780 is not set -# CONFIG_AD7816 is not set -# CONFIG_AD7192 is not set -# CONFIG_AD7280 is not set - -# -# Analog digital bi-direction converters -# -# CONFIG_ADT7316 is not set - -# -# Capacitance to digital converters -# -# CONFIG_AD7150 is not set -# CONFIG_AD7152 is not set -# CONFIG_AD7746 is not set - -# -# Direct Digital Synthesis -# -# CONFIG_AD9832 is not set -# CONFIG_AD9834 is not set - -# -# Digital gyroscope sensors -# -# CONFIG_ADIS16060 is not set - -# -# Network Analyzer, Impedance Converters -# -# CONFIG_AD5933 is not set - -# -# Light sensors -# -# CONFIG_TSL2x7x is not set - -# -# Active energy metering IC -# -# CONFIG_ADE7753 is not set -# CONFIG_ADE7754 is not set -# CONFIG_ADE7758 is not set -# CONFIG_ADE7759 is not set -# CONFIG_ADE7854 is not set - -# -# Resolver to digital converters -# -# CONFIG_AD2S90 is not set -# CONFIG_AD2S1200 is not set -# CONFIG_AD2S1210 is not set - -# -# Triggers - standalone -# -# CONFIG_FB_SM750 is not set -# CONFIG_FB_XGI is not set - -# -# Speakup console speech -# -# CONFIG_SPEAKUP is not set -# CONFIG_STAGING_MEDIA is not set - -# -# Android -# CONFIG_ASHMEM=y -# CONFIG_ANDROID_VSOC is not set CONFIG_ANDROID_LOW_MEMORY_KILLER=y -CONFIG_ANDROID_LOW_MEMORY_KILLER_AUTODETECT_OOM_ADJ_VALUES=y CONFIG_ION=y -# CONFIG_ION_SYSTEM_HEAP is not set -# CONFIG_ION_CARVEOUT_HEAP is not set -# CONFIG_ION_CHUNK_HEAP is not set -# CONFIG_ION_CMA_HEAP is not set -# CONFIG_ION_FORCE_DMA_SYNC is not set CONFIG_ION_DEFER_FREE_NO_SCHED_IDLE=y -CONFIG_OPLUS_ION_BOOSTPOOL=y -CONFIG_OPPO_HANS=y -# CONFIG_STAGING_BOARD is not set -# CONFIG_LTE_GDM724X is not set -# CONFIG_LNET is not set -# CONFIG_DGNC is not set -# CONFIG_GS_FPGABOOT is not set -# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set -# CONFIG_FB_TFT is not set -# CONFIG_WILC1000_SDIO is not set -# CONFIG_WILC1000_SPI is not set -# CONFIG_MOST is not set -# CONFIG_KS7010 is not set -# CONFIG_GREYBUS is not set -# CONFIG_CRYPTO_DEV_CCREE is not set - -# -# USB Power Delivery and Type-C drivers -# -# CONFIG_TYPEC_TCPM is not set -# CONFIG_PI433 is not set -# CONFIG_GOLDFISH is not set -# CONFIG_CHROME_PLATFORMS is not set - -# -# Qualcomm technologies inc. MSM specific device drivers -# -CONFIG_MSM_EXT_DISPLAY=y CONFIG_QCOM_GENI_SE=y CONFIG_QPNP_REVID=y CONFIG_SPS=y -# CONFIG_SPS_SUPPORT_BAMDMA is not set CONFIG_SPS_SUPPORT_NDP_BAM=y -# CONFIG_EP_PCIE is not set CONFIG_USB_BAM=y -# CONFIG_VETH_IPA is not set -CONFIG_GSI=y -# CONFIG_GSI_REGISTER_VERSION_2 is not set CONFIG_IPA3=y -# CONFIG_IPA is not set -# CONFIG_IPA_DEBUG is not set CONFIG_IPA_WDI_UNIFIED_API=y -# CONFIG_IPA_ETH is not set CONFIG_RMNET_IPA3=y -# CONFIG_ECM_IPA is not set CONFIG_RNDIS_IPA=y -# CONFIG_IPA3_MHI_PROXY is not set -# CONFIG_IPA3_MHI_PRIME_MANAGER is not set +CONFIG_IPA_UT=y CONFIG_MSM_11AD=m -# CONFIG_SEEMP_CORE is not set -# CONFIG_IPA3_REGDUMP is not set -# CONFIG_QCOM_ETHERNET_UTIL is not set -CONFIG_CLKDEV_LOOKUP=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_COMMON_CLK=y - -# -# Common Clock Framework -# -# CONFIG_COMMON_CLK_VERSATILE is not set -# CONFIG_CLK_HSDK is not set -# CONFIG_COMMON_CLK_SI5351 is not set -# CONFIG_COMMON_CLK_SI514 is not set -# CONFIG_COMMON_CLK_SI570 is not set -# CONFIG_COMMON_CLK_CDCE706 is not set -# CONFIG_COMMON_CLK_CDCE925 is not set -# CONFIG_COMMON_CLK_CS2000_CP is not set -# CONFIG_CLK_QORIQ is not set -CONFIG_COMMON_CLK_XGENE=y -# CONFIG_COMMON_CLK_NXP is not set -# CONFIG_COMMON_CLK_PWM is not set -# CONFIG_COMMON_CLK_PXA is not set -# CONFIG_COMMON_CLK_PIC32 is not set -# CONFIG_COMMON_CLK_VC5 is not set CONFIG_QCOM_MDSS_PLL=y -CONFIG_QCOM_GDSC=y -CONFIG_COMMON_CLK_QCOM=y -# CONFIG_APQ_GCC_8084 is not set -# CONFIG_APQ_MMCC_8084 is not set -# CONFIG_IPQ_GCC_4019 is not set -# CONFIG_IPQ_GCC_806X is not set -# CONFIG_IPQ_LCC_806X is not set -# CONFIG_IPQ_GCC_8074 is not set -# CONFIG_MSM_GCC_8660 is not set -# CONFIG_MSM_GCC_8916 is not set -# CONFIG_MSM_GCC_8960 is not set -# CONFIG_MSM_LCC_8960 is not set -# CONFIG_MDM_GCC_9615 is not set -# CONFIG_MDM_LCC_9615 is not set -# CONFIG_MSM_MMCC_8960 is not set -# CONFIG_MSM_GCC_8974 is not set -# CONFIG_MSM_MMCC_8974 is not set -# CONFIG_MSM_GCC_8994 is not set -# CONFIG_MSM_GCC_8996 is not set -# CONFIG_MSM_MMCC_8996 is not set -# CONFIG_MSM_GCC_660 is not set -# CONFIG_MSM_GPUCC_660 is not set -# CONFIG_MSM_MMCC_660 is not set CONFIG_SPMI_PMIC_CLKDIV=y CONFIG_MSM_CLK_AOP_QMP=y CONFIG_MSM_GCC_SM8150=y CONFIG_MSM_NPUCC_SM8150=y -# CONFIG_MSM_SCC_SM8150 is not set CONFIG_MSM_VIDEOCC_SM8150=y CONFIG_MSM_CAMCC_SM8150=y CONFIG_CLOCK_CPU_OSM=y -# CONFIG_CLOCK_CPU_OSM_660 is not set CONFIG_MSM_DISPCC_SM8150=y CONFIG_MSM_DEBUGCC_SM8150=y CONFIG_MSM_CLK_RPMH=y CONFIG_MSM_GPUCC_SM8150=y -# CONFIG_MSM_GCC_SDMSHRIKE is not set -# CONFIG_MSM_CAMCC_SDMSHRIKE is not set -# CONFIG_MSM_DEBUGCC_SDMSHRIKE is not set -# CONFIG_MDM_GCC_QCS405 is not set -# CONFIG_MDM_DEBUGCC_QCS405 is not set -# CONFIG_CLOCK_CPU_QCS405 is not set CONFIG_MSM_GCC_SM6150=y CONFIG_MSM_GPUCC_SM6150=y CONFIG_MSM_VIDEOCC_SM6150=y @@ -4658,154 +652,41 @@ CONFIG_MSM_VIDEOCC_SDMMAGPIE=y CONFIG_MSM_NPUCC_SDMMAGPIE=y CONFIG_MSM_GPUCC_SDMMAGPIE=y CONFIG_MSM_DEBUGCC_SDMMAGPIE=y -# CONFIG_GCC_SDXPRAIRIE is not set -# CONFIG_DEBUGCC_SDXPRAIRIE is not set -# CONFIG_CLOCK_CPU_SDXPRAIRIE is not set -# CONFIG_SM_GCC_TRINKET is not set -# CONFIG_SM_GPUCC_TRINKET is not set -# CONFIG_SM_VIDEOCC_TRINKET is not set -# CONFIG_SM_DISPCC_TRINKET is not set -# CONFIG_SM_DEBUGCC_TRINKET is not set -# CONFIG_QCS_CMN_BLK_PLL is not set CONFIG_SM_GCC_ATOLL=y CONFIG_SM_CAMCC_ATOLL=y CONFIG_SM_VIDEOCC_ATOLL=y CONFIG_SM_DISPCC_ATOLL=y CONFIG_SM_NPUCC_ATOLL=y CONFIG_SM_DEBUGCC_ATOLL=y -# CONFIG_SDM_GCC_429W is not set -# CONFIG_CLOCK_CPU_SDM is not set -# CONFIG_COMMON_CLK_MSM is not set CONFIG_HWSPINLOCK=y CONFIG_HWSPINLOCK_QCOM=y - -# -# Clock Source drivers -# -CONFIG_TIMER_OF=y -CONFIG_TIMER_PROBE=y -CONFIG_ARM_ARCH_TIMER=y -CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y -CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND=y -CONFIG_FSL_ERRATUM_A008585=y -CONFIG_HISILICON_ERRATUM_161010101=y -CONFIG_ARM64_ERRATUM_858921=y -# CONFIG_ARM_ARCH_TIMER_VCT_ACCESS is not set -# CONFIG_ARM_TIMER_SP804 is not set -# CONFIG_ATMEL_PIT is not set -# CONFIG_SH_TIMER_CMT is not set -# CONFIG_SH_TIMER_MTU2 is not set -# CONFIG_SH_TIMER_TMU is not set -# CONFIG_EM_TIMER_STI is not set -CONFIG_MAILBOX=y -# CONFIG_ARM_MHU is not set -# CONFIG_PLATFORM_MHU is not set -# CONFIG_PL320_MBOX is not set -# CONFIG_ALTERA_MBOX is not set -# CONFIG_MAILBOX_TEST is not set CONFIG_QCOM_APCS_IPC=y -# CONFIG_QCOM_GVM_IPC is not set -# CONFIG_BCM_FLEXRM_MBOX is not set -CONFIG_QTI_RPMH_MBOX=y CONFIG_MSM_QMP=y -CONFIG_IOMMU_API=y -CONFIG_IOMMU_SUPPORT=y - -# -# Generic IOMMU Pagetable Support -# -CONFIG_IOMMU_IO_PGTABLE=y -CONFIG_IOMMU_IO_PGTABLE_LPAE=y -# CONFIG_IOMMU_IO_PGTABLE_LPAE_SELFTEST is not set -# CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set CONFIG_IOMMU_IO_PGTABLE_FAST=y -# CONFIG_IOMMU_IO_PGTABLE_FAST_SELFTEST is not set -# CONFIG_IOMMU_IO_PGTABLE_FAST_PROVE_TLB is not set -CONFIG_IOMMU_IOVA=y -CONFIG_OF_IOMMU=y -CONFIG_IOMMU_DMA=y CONFIG_ARM_SMMU=y -# CONFIG_ARM_SMMU_V3 is not set -# CONFIG_ARM_SMMU_SELFTEST is not set -# CONFIG_IOMMU_TLBSYNC_DEBUG is not set -# CONFIG_ARM_SMMU_TESTBUS_DUMP is not set CONFIG_QCOM_LAZY_MAPPING=y +# ifdef OPLUS_BUG_STABILITY +# rendong.shi@BSP.kernel.debug,2017/5/20,remove for some secure issue from qcom request # CONFIG_IOMMU_DEBUG is not set -# CONFIG_QCOM_IOMMU is not set - -# -# Remoteproc drivers -# -# CONFIG_REMOTEPROC is not set - -# -# Rpmsg drivers -# -CONFIG_RPMSG=y +# CONFIG_IOMMU_DEBUG_TRACKING is not set +# CONFIG_IOMMU_TESTS is not set +# endif CONFIG_RPMSG_CHAR=y -CONFIG_RPMSG_QCOM_GLINK_NATIVE=y -# CONFIG_RPMSG_QCOM_GLINK_RPM is not set CONFIG_RPMSG_QCOM_GLINK_SMEM=y -# CONFIG_RPMSG_QCOM_GLINK_SPSS is not set CONFIG_RPMSG_QCOM_GLINK_SPI=y -# CONFIG_RPMSG_QCOM_GLINK_BGCOM is not set -# CONFIG_RPMSG_QCOM_SMD is not set -# CONFIG_RPMSG_VIRTIO is not set -# CONFIG_MSM_RPM_SMD is not set - -# -# SOC (System On Chip) specific Drivers -# - -# -# Amlogic SoC drivers -# - -# -# Broadcom SoC drivers -# -# CONFIG_SOC_BRCMSTB is not set - -# -# i.MX SoC drivers -# - -# -# Qualcomm SoC drivers -# CONFIG_QCOM_MEM_OFFLINE=y CONFIG_OVERRIDE_MEMORY_LIMIT=y CONFIG_QCOM_CPUSS_DUMP=y CONFIG_QCOM_RUN_QUEUE_STATS=y -# CONFIG_QCOM_GSBI is not set -CONFIG_QCOM_MDT_LOADER=y CONFIG_QCOM_LLCC=y -# CONFIG_QCOM_SM8150_LLCC is not set -# CONFIG_QCOM_SDMSHRIKE_LLCC is not set -# CONFIG_QCOM_SM6150_LLCC is not set -# CONFIG_QCOM_SDMMAGPIE_LLCC is not set CONFIG_QCOM_ATOLL_LLCC=y -# CONFIG_QCOM_SDXPRAIRIE_LLCC is not set -# CONFIG_QCOM_LLCC_AMON is not set CONFIG_QCOM_LLCC_PERFMON=m CONFIG_QCOM_QMI_HELPERS=y -# CONFIG_QCOM_QMI_RMNET is not set CONFIG_QCOM_SMEM=y -# CONFIG_MSM_APM is not set -# CONFIG_QCOM_SMD_RPM is not set -# CONFIG_MSM_SPM is not set -# CONFIG_MSM_L2_SPM is not set -CONFIG_QCOM_SCM=y -# CONFIG_QCOM_SCM_QCPE is not set CONFIG_QCOM_MEMORY_DUMP_V2=y -# CONFIG_MSM_DEBUG_LAR_UNLOCK is not set CONFIG_QCOM_WATCHDOG_V2=y CONFIG_QCOM_FORCE_WDOG_BITE_ON_PANIC=y -# CONFIG_QCOM_WDOG_IPI_ENABLE is not set -CONFIG_QCOM_SMEM_STATE=y CONFIG_QCOM_SMP2P=y -# CONFIG_QCOM_SMSM is not set -# CONFIG_QCOM_WCNSS_CTRL is not set CONFIG_QPNP_PBS=y CONFIG_MSM_SERVICE_LOCATOR=y CONFIG_MSM_SERVICE_NOTIFIER=y @@ -4813,1394 +694,309 @@ CONFIG_MSM_SUBSYSTEM_RESTART=y CONFIG_MSM_PIL=y CONFIG_MSM_SYSMON_QMI_COMM=y CONFIG_MSM_PIL_SSR_GENERIC=y -# CONFIG_MSM_PIL_MSS_QDSP6V5 is not set CONFIG_SETUP_SSR_NOTIF_TIMEOUTS=y CONFIG_SSR_SYSMON_NOTIF_TIMEOUT=20000 CONFIG_SSR_SUBSYS_NOTIF_TIMEOUT=20000 CONFIG_PANIC_ON_SSR_NOTIF_TIMEOUT=y CONFIG_MSM_BOOT_STATS=y -# CONFIG_MSM_BOOT_TIME_MARKER is not set -# CONFIG_MSM_CORE_HANG_DETECT is not set -# CONFIG_QCOM_DCC is not set CONFIG_QCOM_DCC_V2=y -# CONFIG_MSM_GLADIATOR_HANG_DETECT is not set -# CONFIG_MSM_GLADIATOR_ERP is not set -# CONFIG_SDX_EXT_IPC is not set -# CONFIG_QTI_NOTIFY_SIDEBAND is not set CONFIG_QCOM_SECURE_BUFFER=y CONFIG_ICNSS=y -# CONFIG_ICNSS_DEBUG is not set CONFIG_ICNSS_QMI=y -# CONFIG_CNSS_TIMESYNC is not set CONFIG_QCOM_EUD=y CONFIG_QCOM_MINIDUMP=y -CONFIG_MINIDUMP_MAX_ENTRIES=200 CONFIG_QCOM_BUS_SCALING=y CONFIG_QCOM_BUS_CONFIG_RPMH=y CONFIG_QCOM_COMMAND_DB=y CONFIG_QCOM_EARLY_RANDOM=y -# CONFIG_MSM_SPSS_UTILS is not set -# CONFIG_MSM_SPCOM is not set CONFIG_QTI_RPMH_API=y -CONFIG_QTI_SYSTEM_PM=y CONFIG_QSEE_IPC_IRQ=y -# CONFIG_QSEE_IPC_IRQ_BRIDGE is not set CONFIG_QCOM_GLINK=y CONFIG_QCOM_GLINK_PKT=y -# CONFIG_MSM_JTAGV8 is not set +CONFIG_QTI_RPM_STATS_LOG=y CONFIG_MSM_CDSP_LOADER=y CONFIG_QCOM_SMCINVOKE=y CONFIG_MSM_EVENT_TIMER=y -# CONFIG_MSM_AVTIMER is not set CONFIG_MSM_PM=y -# CONFIG_MSM_PM_LEGACY is not set -# CONFIG_MSM_QBT1000 is not set -# CONFIG_APSS_CORE_EA is not set CONFIG_QCOM_FSA4480_I2C=y -# CONFIG_QCOM_MAX20328_I2C is not set -# CONFIG_MSM_IDLE_STATS is not set CONFIG_MEM_SHARE_QMI_SERVICE=y -# CONFIG_MSM_HAB is not set -# CONFIG_MSM_AGL is not set -# CONFIG_QCOM_HGSL_TCSR_SIGNAL is not set CONFIG_MSM_PERFORMANCE=y -CONFIG_QCOM_QHEE_ENABLE_MEM_PROTECTION=y +CONFIG_QMP_DEBUGFS_CLIENT=y CONFIG_QCOM_SMP2P_SLEEPSTATE=y CONFIG_QCOM_CDSP_RM=y CONFIG_QCOM_CX_IPEAK=y -# CONFIG_QCOM_AOP_DDR_MESSAGING is not set -# CONFIG_QCOM_AOP_DDRSS_COMMANDS is not set -# CONFIG_QCOM_ADSP_MANUAL_VOTE is not set -# CONFIG_MSM_BAM_DMUX is not set -# CONFIG_MSM_BGCOM is not set -# CONFIG_MSM_BGRSB is not set -# CONFIG_MSM_PIL_SSR_BG is not set -CONFIG_QCOM_SOC_INFO=y CONFIG_QTI_CRYPTO_COMMON=y CONFIG_QTI_CRYPTO_TZ=y -# CONFIG_RENAME_BLOCK_DEVICE is not set -# CONFIG_WCNSS_CORE is not set -# CONFIG_SUNXI_SRAM is not set -# CONFIG_SOC_TI is not set -CONFIG_OPLUS_SYSTEM_KERNEL=y -CONFIG_OPPO_ARCH_FILE=y -CONFIG_OPPO_COMMON_SOFT=y -CONFIG_OPPO_DEVICE_IFNO=y -# CONFIG_OPLUS_FEATURE_DETAILHEAD is not set -# CONFIG_OPLUS_FEATURE_FEEDBACK is not set -CONFIG_OPLUS_FEATURE_UBOOT_LOG=y -CONFIG_OPLUS_FEATURE_SHUTDOWN_DETECT=y -# CONFIG_OPLUS_FEATURE_SLABTRACE_DEBUG is not set -CONFIG_OPLUS_FEATURE_OPROJECT=y -CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE=y -CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE=y -CONFIG_OPLUS_FEATURE_DEATH_HEALER=y -CONFIG_OPLUS_FEATURE_PHOENIX=y -CONFIG_OPLUS_FEATURE_PMIC_MONITOR=y -# CONFIG_OPLUS_FEATURE_SAUPWK is not set -CONFIG_OPLUS_FEATURE_PROJECTINFO=y -# CONFIG_OPLUS_FEATURE_CMDLINE is not set -# CONFIG_OPLUS_FEATURE_ANDROIDBOOT is not set -# CONFIG_OPLUS_FEATURE_FTMMODE is not set -# CONFIG_OPLUS_FEATURE_CHARGERPRESENT is not set -# CONFIG_OPLUS_FEATURE_BUILDVARIANT is not set -# CONFIG_OPLUS_FEATURE_SIMCARDNUM is not set -# CONFIG_OPLUS_FEATURE_CDT is not set -CONFIG_OPLUS_FEATURE_DUMP_DEVICE_INFO=y -CONFIG_OPLUS_FEATURE_RECORD_MDMRST=y -# CONFIG_OPLUS_FEATURE_AGINGTEST is not set -# CONFIG_OPLUS_OPPO_GPIO is not set -CONFIG_OPLUS_FEATURE_QCOM_PMICWD=y -# CONFIG_OPLUS_FEATURE_MM_FEEDBACK is not set -# CONFIG_OPLUS_FEATURE_QCOM_WATCHDOG is not set -CONFIG_OPLUS_FEATURE_ACM=y -CONFIG_OPLUS_FEATURE_ACM_LOGGING=y -# CONFIG_OPLUS_FEATURE_THEIA is not set -CONFIG_OPLUS_FEATURE_SELINUX_CONTROL_LOG=y -# CONFIG_OPLUS_FEATURE_MISC is not set -# CONFIG_PARAM_READ_WRITE is not set -# CONFIG_BOOTLOADER_LOG is not set -# CONFIG_WB_KERNEL_LOG is not set -CONFIG_OPLUS_FEATURE_LOWMEM_DBG=y -CONFIG_IOMONITOR=y -CONFIG_IOMONITOR_WITH_F2FS=y -# CONFIG_OPPO_CRITICALLOG is not set -# CONFIG_OPPO_WAKELOCK_PROFILER is not set -# CONFIG_OPPO_POWER_QCOM is not set -# CONFIG_OPPO_POWER_MTK is not set -CONFIG_OPLUS_WAKELOCK_PROFILER=y -CONFIG_OPLUS_POWER_QCOM=y -# CONFIG_OPLUS_POWER_MTK is not set -# CONFIG_OPLUS_POWERINFO_STANDBY_DEBUG is not set -# CONFIG_OPLUS_POWERINFO_RPMH is not set -# CONFIG_OPLUS_POWERINFO_FTM is not set -CONFIG_OPPO_HEALTHINFO=y -CONFIG_CAMERA_OPT=y -CONFIG_OPLUS_FEATURE_SENSOR_CFG=y -# CONFIG_SSC_INTERACTIVE is not set -CONFIG_NANDSWAP=y -# CONFIG_NANDSWAP_DEBUG is not set -CONFIG_PM_DEVFREQ=y - -# -# DEVFREQ Governors -# -CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y -CONFIG_DEVFREQ_GOV_PERFORMANCE=y -CONFIG_DEVFREQ_GOV_POWERSAVE=y -CONFIG_DEVFREQ_GOV_USERSPACE=y CONFIG_DEVFREQ_GOV_PASSIVE=y -CONFIG_DEVFREQ_GOV_CPUFREQ=y CONFIG_QCOM_BIMC_BWMON=y CONFIG_ARM_MEMLAT_MON=y CONFIG_QCOMCCI_HWMON=y CONFIG_QCOM_M4M_HWMON=y CONFIG_DEVFREQ_GOV_QCOM_BW_HWMON=y CONFIG_DEVFREQ_GOV_QCOM_CACHE_HWMON=y -# CONFIG_DEVFREQ_GOV_SPDM_HYP is not set CONFIG_DEVFREQ_GOV_MEMLAT=y - -# -# DEVFREQ Drivers -# -CONFIG_DEVFREQ_GOV_QCOM_ADRENO_TZ=y -CONFIG_DEVFREQ_GOV_QCOM_GPUBW_MON=y CONFIG_DEVFREQ_SIMPLE_DEV=y CONFIG_QCOM_DEVFREQ_DEVBW=y -# CONFIG_DEVFREQ_SPDM is not set CONFIG_DEVFREQ_GOV_CDSPL3=y -# CONFIG_PM_DEVFREQ_EVENT is not set -CONFIG_EXTCON=y - -# -# Extcon Device Drivers -# -# CONFIG_EXTCON_ADC_JACK is not set -# CONFIG_EXTCON_GPIO is not set -# CONFIG_EXTCON_MAX3355 is not set -# CONFIG_EXTCON_QCOM_SPMI_MISC is not set -# CONFIG_EXTCON_RT8973A is not set -# CONFIG_EXTCON_SM5502 is not set CONFIG_EXTCON_USB_GPIO=y -# CONFIG_MEMORY is not set CONFIG_IIO=y -# CONFIG_IIO_BUFFER is not set -# CONFIG_IIO_CONFIGFS is not set -# CONFIG_IIO_TRIGGER is not set -# CONFIG_IIO_SW_DEVICE is not set -# CONFIG_IIO_SW_TRIGGER is not set - -# -# Accelerometers -# -# CONFIG_ADXL345_I2C is not set -# CONFIG_ADXL345_SPI is not set -# CONFIG_BMA180 is not set -# CONFIG_BMA220 is not set -# CONFIG_BMC150_ACCEL is not set -# CONFIG_DA280 is not set -# CONFIG_DA311 is not set -# CONFIG_DMARD06 is not set -# CONFIG_DMARD09 is not set -# CONFIG_DMARD10 is not set -# CONFIG_IIO_ST_ACCEL_3AXIS is not set -# CONFIG_KXSD9 is not set -# CONFIG_KXCJK1013 is not set -# CONFIG_MC3230 is not set -# CONFIG_MMA7455_I2C is not set -# CONFIG_MMA7455_SPI is not set -# CONFIG_MMA7660 is not set -# CONFIG_MMA8452 is not set -# CONFIG_MMA9551 is not set -# CONFIG_MMA9553 is not set -# CONFIG_MXC4005 is not set -# CONFIG_MXC6255 is not set -# CONFIG_SCA3000 is not set -# CONFIG_STK8312 is not set -# CONFIG_STK8BA50 is not set - -# -# Analog to digital converters -# -# CONFIG_AD7266 is not set -# CONFIG_AD7291 is not set -# CONFIG_AD7298 is not set -# CONFIG_AD7476 is not set -# CONFIG_AD7766 is not set -# CONFIG_AD7791 is not set -# CONFIG_AD7793 is not set -# CONFIG_AD7887 is not set -# CONFIG_AD7923 is not set -# CONFIG_AD799X is not set -# CONFIG_CC10001_ADC is not set -# CONFIG_ENVELOPE_DETECTOR is not set -# CONFIG_HI8435 is not set -# CONFIG_HX711 is not set -# CONFIG_INA2XX_ADC is not set -# CONFIG_LTC2471 is not set -# CONFIG_LTC2485 is not set -# CONFIG_LTC2497 is not set -# CONFIG_MAX1027 is not set -# CONFIG_MAX11100 is not set -# CONFIG_MAX1118 is not set -# CONFIG_MAX1363 is not set -# CONFIG_MAX9611 is not set -# CONFIG_MCP320X is not set -# CONFIG_MCP3422 is not set -# CONFIG_NAU7802 is not set -CONFIG_QCOM_VADC_COMMON=y -# CONFIG_QCOM_SPMI_IADC is not set -# CONFIG_QCOM_SPMI_VADC is not set CONFIG_QCOM_SPMI_ADC5=y -# CONFIG_QCOM_TADC is not set -# CONFIG_QCOM_RRADC is not set -# CONFIG_TI_ADC081C is not set -# CONFIG_TI_ADC0832 is not set -# CONFIG_TI_ADC084S021 is not set -# CONFIG_TI_ADC12138 is not set -# CONFIG_TI_ADC108S102 is not set -# CONFIG_TI_ADC128S052 is not set -# CONFIG_TI_ADC161S626 is not set -# CONFIG_TI_ADS1015 is not set -# CONFIG_TI_ADS7950 is not set -# CONFIG_TI_ADS8688 is not set -# CONFIG_TI_TLC4541 is not set -# CONFIG_VF610_ADC is not set - -# -# Amplifiers -# -# CONFIG_AD8366 is not set - -# -# Chemical Sensors -# -# CONFIG_ATLAS_PH_SENSOR is not set -# CONFIG_CCS811 is not set -# CONFIG_IAQCORE is not set -# CONFIG_VZ89X is not set - -# -# Hid Sensor IIO Common -# - -# -# SSP Sensor Common -# -# CONFIG_IIO_SSP_SENSORHUB is not set - -# -# Counters -# - -# -# Digital to analog converters -# -# CONFIG_AD5064 is not set -# CONFIG_AD5360 is not set -# CONFIG_AD5380 is not set -# CONFIG_AD5421 is not set -# CONFIG_AD5446 is not set -# CONFIG_AD5449 is not set -# CONFIG_AD5592R is not set -# CONFIG_AD5593R is not set -# CONFIG_AD5504 is not set -# CONFIG_AD5624R_SPI is not set -# CONFIG_LTC2632 is not set -# CONFIG_AD5686 is not set -# CONFIG_AD5755 is not set -# CONFIG_AD5761 is not set -# CONFIG_AD5764 is not set -# CONFIG_AD5791 is not set -# CONFIG_AD7303 is not set -# CONFIG_AD8801 is not set -# CONFIG_DPOT_DAC is not set -# CONFIG_M62332 is not set -# CONFIG_MAX517 is not set -# CONFIG_MAX5821 is not set -# CONFIG_MCP4725 is not set -# CONFIG_MCP4922 is not set -# CONFIG_VF610_DAC is not set - -# -# IIO dummy driver -# - -# -# Frequency Synthesizers DDS/PLL -# - -# -# Clock Generator/Distribution -# -# CONFIG_AD9523 is not set - -# -# Phase-Locked Loop (PLL) frequency synthesizers -# -# CONFIG_ADF4350 is not set - -# -# Digital gyroscope sensors -# -# CONFIG_ADIS16080 is not set -# CONFIG_ADIS16130 is not set -# CONFIG_ADIS16136 is not set -# CONFIG_ADIS16260 is not set -# CONFIG_ADXRS450 is not set -# CONFIG_BMG160 is not set -# CONFIG_MPU3050_I2C is not set -# CONFIG_IIO_ST_GYRO_3AXIS is not set -# CONFIG_ITG3200 is not set - -# -# Health Sensors -# - -# -# Heart Rate Monitors -# -# CONFIG_AFE4403 is not set -# CONFIG_AFE4404 is not set -# CONFIG_MAX30100 is not set -# CONFIG_MAX30102 is not set - -# -# Humidity sensors -# -# CONFIG_AM2315 is not set -# CONFIG_DHT11 is not set -# CONFIG_HDC100X is not set -# CONFIG_HTS221 is not set -# CONFIG_HTU21 is not set -# CONFIG_SI7005 is not set -# CONFIG_SI7020 is not set - -# -# Inertial measurement units -# -# CONFIG_ADIS16400 is not set -# CONFIG_ADIS16480 is not set -# CONFIG_BMI160_I2C is not set -# CONFIG_BMI160_SPI is not set -# CONFIG_KMX61 is not set -# CONFIG_INV_MPU6050_I2C is not set -# CONFIG_INV_MPU6050_SPI is not set -# CONFIG_INV_MPU_IIO_I2C is not set -# CONFIG_INV_MPU_IIO_SPI is not set -# CONFIG_IIO_ST_LSM6DSX is not set -# CONFIG_IIO_ST_ASM330LHH is not set - -# -# Light sensors -# -# CONFIG_ADJD_S311 is not set -# CONFIG_AL3320A is not set -# CONFIG_APDS9300 is not set -# CONFIG_APDS9960 is not set -# CONFIG_BH1750 is not set -# CONFIG_BH1780 is not set -# CONFIG_CM32181 is not set -# CONFIG_CM3232 is not set -# CONFIG_CM3323 is not set -# CONFIG_CM3605 is not set -# CONFIG_CM36651 is not set -# CONFIG_GP2AP020A00F is not set -# CONFIG_SENSORS_ISL29018 is not set -# CONFIG_SENSORS_ISL29028 is not set -# CONFIG_ISL29125 is not set -# CONFIG_JSA1212 is not set -# CONFIG_RPR0521 is not set -# CONFIG_LTR501 is not set -# CONFIG_MAX44000 is not set -# CONFIG_OPT3001 is not set -# CONFIG_PA12203001 is not set -# CONFIG_SI1145 is not set -# CONFIG_STK3310 is not set -# CONFIG_TCS3414 is not set -# CONFIG_TCS3472 is not set -# CONFIG_SENSORS_TSL2563 is not set -# CONFIG_TSL2583 is not set -# CONFIG_TSL4531 is not set -# CONFIG_US5182D is not set -# CONFIG_VCNL4000 is not set -# CONFIG_VEML6070 is not set -# CONFIG_VL6180 is not set - -# -# Magnetometer sensors -# -# CONFIG_AK8974 is not set -# CONFIG_AK8975 is not set -# CONFIG_AK09911 is not set -# CONFIG_BMC150_MAGN_I2C is not set -# CONFIG_BMC150_MAGN_SPI is not set -# CONFIG_MAG3110 is not set -# CONFIG_MMC35240 is not set -# CONFIG_IIO_ST_MAGN_3AXIS is not set -# CONFIG_SENSORS_HMC5843_I2C is not set -# CONFIG_SENSORS_HMC5843_SPI is not set - -# -# Multiplexers -# -# CONFIG_IIO_MUX is not set - -# -# Inclinometer sensors -# - -# -# Digital potentiometers -# -# CONFIG_DS1803 is not set -# CONFIG_MAX5481 is not set -# CONFIG_MAX5487 is not set -# CONFIG_MCP4131 is not set -# CONFIG_MCP4531 is not set -# CONFIG_TPL0102 is not set - -# -# Digital potentiostats -# -# CONFIG_LMP91000 is not set - -# -# Pressure sensors -# -# CONFIG_ABP060MG is not set -# CONFIG_BMP280 is not set -# CONFIG_HP03 is not set -# CONFIG_MPL115_I2C is not set -# CONFIG_MPL115_SPI is not set -# CONFIG_MPL3115 is not set -# CONFIG_MS5611 is not set -# CONFIG_MS5637 is not set -# CONFIG_IIO_ST_PRESS is not set -# CONFIG_T5403 is not set -# CONFIG_HP206C is not set -# CONFIG_ZPA2326 is not set - -# -# Lightning sensors -# -# CONFIG_AS3935 is not set - -# -# Proximity and distance sensors -# -# CONFIG_LIDAR_LITE_V2 is not set -# CONFIG_SRF04 is not set -# CONFIG_SX9500 is not set -# CONFIG_SRF08 is not set - -# -# Temperature sensors -# -# CONFIG_MAXIM_THERMOCOUPLE is not set -# CONFIG_MLX90614 is not set -# CONFIG_TMP006 is not set -# CONFIG_TMP007 is not set -# CONFIG_TSYS01 is not set -# CONFIG_TSYS02D is not set -# CONFIG_NTB is not set -# CONFIG_VME_BUS is not set CONFIG_PWM=y -CONFIG_PWM_SYSFS=y -# CONFIG_PWM_FSL_FTM is not set -# CONFIG_PWM_PCA9685 is not set -# CONFIG_PWM_QCOM is not set CONFIG_PWM_QTI_LPG=y CONFIG_QCOM_KGSL=y -CONFIG_QCOM_ADRENO_DEFAULT_GOVERNOR="msm-adreno-tz" -CONFIG_QCOM_KGSL_IOMMU=y -CONFIG_IRQCHIP=y -CONFIG_ARM_GIC=y -CONFIG_ARM_GIC_MAX_NR=1 -CONFIG_ARM_GIC_V2M=y -CONFIG_ARM_GIC_V3=y -CONFIG_ARM_GIC_V3_ITS=y CONFIG_ARM_GIC_V3_ACL=y -CONFIG_QCOM_SHOW_RESUME_IRQ=y -CONFIG_PARTITION_PERCPU=y -CONFIG_QTI_PDC=y -# CONFIG_QTI_PDC_SM8150 is not set -# CONFIG_QTI_PDC_SM6150 is not set -CONFIG_QTI_PDC_SDMMAGPIE=y -# CONFIG_QTI_PDC_SDXPRAIRIE is not set -CONFIG_QTI_PDC_ATOLL=y -# CONFIG_QTI_MPM is not set -# CONFIG_QTI_PDC_VIRT is not set -# CONFIG_QTI_PDC_SAVE_RESTORE is not set -# CONFIG_IPACK_BUS is not set -CONFIG_RESET_CONTROLLER=y -# CONFIG_RESET_ATH79 is not set -# CONFIG_RESET_BERLIN is not set -# CONFIG_RESET_IMX7 is not set -# CONFIG_RESET_LANTIQ is not set -# CONFIG_RESET_LPC18XX is not set -# CONFIG_RESET_MESON is not set -# CONFIG_RESET_PISTACHIO is not set -# CONFIG_RESET_SOCFPGA is not set -# CONFIG_RESET_STM32 is not set -# CONFIG_RESET_SUNXI is not set -# CONFIG_RESET_TI_SYSCON is not set -# CONFIG_RESET_ZYNQ is not set -# CONFIG_RESET_TEGRA_BPMP is not set -# CONFIG_FMC is not set - -# -# PHY Subsystem -# -CONFIG_GENERIC_PHY=y -# CONFIG_PHY_XGENE is not set -# CONFIG_BCM_KONA_USB2_PHY is not set -# CONFIG_PHY_PXA_28NM_HSIC is not set -# CONFIG_PHY_PXA_28NM_USB2 is not set -# CONFIG_PHY_CPCAP_USB is not set -# CONFIG_PHY_QCOM_APQ8064_SATA is not set -# CONFIG_PHY_QCOM_IPQ806X_SATA is not set -# CONFIG_PHY_QCOM_PCIE2 is not set -# CONFIG_PHY_QCOM_QMP is not set -# CONFIG_PHY_QCOM_QUSB2 is not set -CONFIG_PHY_QCOM_UFS=y -# CONFIG_POWERCAP is not set -# CONFIG_MCB is not set - -# -# Performance monitor support -# -CONFIG_ARM_PMU=y CONFIG_ARM_DSU_PMU=y CONFIG_QCOM_LLCC_PMU=y CONFIG_RAS=y - -# -# Android -# CONFIG_ANDROID=y CONFIG_ANDROID_BINDER_IPC=y CONFIG_ANDROID_BINDERFS=y -CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder" -# CONFIG_ANDROID_BINDER_IPC_SELFTEST is not set -# CONFIG_LIBNVDIMM is not set -CONFIG_DAX=y -CONFIG_NVMEM=y CONFIG_QCOM_QFPROM=y CONFIG_NVMEM_SPMI_SDAM=y -CONFIG_STM=y -# CONFIG_STM_DUMMY is not set -# CONFIG_STM_SOURCE_CONSOLE is not set -# CONFIG_STM_SOURCE_HEARTBEAT is not set -# CONFIG_INTEL_TH is not set -# CONFIG_FPGA is not set - -# -# FSI support -# -# CONFIG_FSI is not set -# CONFIG_TEE is not set CONFIG_SENSORS_SSC=y CONFIG_ESOC=y CONFIG_ESOC_DEV=y CONFIG_ESOC_CLIENT=y -# CONFIG_ESOC_DEBUG is not set CONFIG_ESOC_MDM_4x=y CONFIG_ESOC_MDM_DRV=y CONFIG_ESOC_MDM_DBG_ENG=y -# CONFIG_MDM_DBG_REQ_ENG is not set -CONFIG_NFC_PN553_DEVICES=y -CONFIG_NXP_P73_DEVICES=y - -# -# Firmware Drivers -# -CONFIG_ARM_PSCI_FW=y -# CONFIG_ARM_PSCI_CHECKER is not set -# CONFIG_ARM_SCPI_PROTOCOL is not set -# CONFIG_FIRMWARE_MEMMAP is not set -# CONFIG_FW_CFG_SYSFS is not set -CONFIG_QCOM_SCM_64=y -CONFIG_HAVE_ARM_SMCCC=y -# CONFIG_GOOGLE_FIRMWARE is not set -# CONFIG_MESON_SM is not set - -# -# Tegra firmware driver -# CONFIG_MSM_TZ_LOG=y -# CONFIG_ACPI is not set - -# -# File systems -# -CONFIG_DCACHE_WORD_ACCESS=y -# CONFIG_EXT2_FS is not set -# CONFIG_EXT3_FS is not set CONFIG_EXT4_FS=y -CONFIG_EXT4_USE_FOR_EXT2=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y CONFIG_EXT4_ENCRYPTION=y -# CONFIG_EXT4_FS_ENCRYPTION is not set -# CONFIG_EXT4_DEBUG is not set -# CONFIG_OPLUS_FEATURE_EXT4_ASYNC_DISCARD is not set -CONFIG_JBD2=y -# CONFIG_JBD2_DEBUG is not set -CONFIG_FS_MBCACHE=y -# CONFIG_REISERFS_FS is not set -# CONFIG_JFS_FS is not set -# CONFIG_XFS_FS is not set -# CONFIG_GFS2_FS is not set -# CONFIG_OCFS2_FS is not set -# CONFIG_BTRFS_FS is not set -# CONFIG_NILFS2_FS is not set +CONFIG_EXT4_FS_ENCRYPTION=y +CONFIG_EXT4_FS_ICE_ENCRYPTION=y +#ifdef OPLUS_FEATURE_EXFAT_SUPPORT//huyu@BSP.Storage,add 2020/5/8 for kernel 4.19 exfat +CONFIG_NLS_UTF8=y +CONFIG_EXFAT_FS=y +# endif CONFIG_F2FS_FS=y -CONFIG_F2FS_STAT_FS=y -CONFIG_F2FS_FS_XATTR=y -CONFIG_F2FS_FS_POSIX_ACL=y CONFIG_F2FS_FS_SECURITY=y -# CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS_ENCRYPTION=y -# CONFIG_F2FS_FAULT_INJECTION is not set -CONFIG_F2FS_BD_STAT=y -CONFIG_OPLUS_FEATURE_OF2FS=y -# CONFIG_F2FS_GRADING_SSR is not set -# CONFIG_F2FS_FS_COMPRESSION is not set -# CONFIG_FS_DAX is not set -CONFIG_FS_POSIX_ACL=y -CONFIG_EXPORTFS=y -# CONFIG_EXPORTFS_BLOCK_OPS is not set -CONFIG_FILE_LOCKING=y -CONFIG_MANDATORY_FILE_LOCKING=y -CONFIG_FS_ENCRYPTION=y -CONFIG_FS_ENCRYPTION_ALGS=y CONFIG_FS_ENCRYPTION_INLINE_CRYPT=y CONFIG_FS_VERITY=y -# CONFIG_FS_VERITY_DEBUG is not set CONFIG_FS_VERITY_BUILTIN_SIGNATURES=y -CONFIG_FSNOTIFY=y -CONFIG_DNOTIFY=y -CONFIG_INOTIFY_USER=y -# CONFIG_FANOTIFY is not set CONFIG_QUOTA=y CONFIG_QUOTA_NETLINK_INTERFACE=y -CONFIG_PRINT_QUOTA_WARNING=y -# CONFIG_QUOTA_DEBUG is not set -CONFIG_QUOTA_TREE=y -# CONFIG_QFMT_V1 is not set CONFIG_QFMT_V2=y -CONFIG_QUOTACTL=y -# CONFIG_AUTOFS4_FS is not set CONFIG_FUSE_FS=y -# CONFIG_CUSE is not set CONFIG_OVERLAY_FS=y -# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set -# CONFIG_OVERLAY_FS_INDEX is not set CONFIG_INCREMENTAL_FS=y - -# -# Caches -# -# CONFIG_FSCACHE is not set - -# -# CD-ROM/DVD Filesystems -# -# CONFIG_ISO9660_FS is not set -# CONFIG_UDF_FS is not set - -# -# DOS/FAT/NT Filesystems -# -CONFIG_FAT_FS=y CONFIG_MSDOS_FS=y CONFIG_VFAT_FS=y -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" -# CONFIG_FAT_DEFAULT_UTF8 is not set -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -# CONFIG_PROC_KCORE is not set -CONFIG_PROC_SYSCTL=y -CONFIG_PROC_PAGE_MONITOR=y -# CONFIG_PROC_CHILDREN is not set -CONFIG_PROC_UID=y -CONFIG_FG_TASK_UID=y -CONFIG_OPPO_JANK_INFO=y -CONFIG_KERNFS=y -CONFIG_SYSFS=y -CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y -CONFIG_TMPFS_XATTR=y -# CONFIG_HUGETLBFS is not set -# CONFIG_HUGETLB_PAGE is not set -CONFIG_ARCH_HAS_GIGANTIC_PAGE=y -CONFIG_CONFIGFS_FS=y -CONFIG_MISC_FILESYSTEMS=y -# CONFIG_ORANGEFS_FS is not set -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set CONFIG_ECRYPT_FS=y CONFIG_ECRYPT_FS_MESSAGING=y CONFIG_SDCARD_FS=y -# CONFIG_HFS_FS is not set -# CONFIG_HFSPLUS_FS is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_CRAMFS is not set -# CONFIG_SQUASHFS is not set -# CONFIG_VXFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_OMFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_QNX6FS_FS is not set -# CONFIG_ROMFS_FS is not set -CONFIG_PSTORE=y -CONFIG_PSTORE_ZLIB_COMPRESS=y -# CONFIG_PSTORE_LZO_COMPRESS is not set -# CONFIG_PSTORE_LZ4_COMPRESS is not set -CONFIG_PSTORE_CONSOLE=y -CONFIG_PSTORE_PMSG=y -CONFIG_PSTORE_RAM=y -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set -CONFIG_NETWORK_FILESYSTEMS=y -# CONFIG_NFS_FS is not set -# CONFIG_NFSD is not set -# CONFIG_CEPH_FS is not set -# CONFIG_CIFS is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="iso8859-1" CONFIG_NLS_CODEPAGE_437=y -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -# CONFIG_NLS_ASCII is not set CONFIG_NLS_ISO8859_1=y -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -# CONFIG_NLS_MAC_ROMAN is not set -# CONFIG_NLS_MAC_CELTIC is not set -# CONFIG_NLS_MAC_CENTEURO is not set -# CONFIG_NLS_MAC_CROATIAN is not set -# CONFIG_NLS_MAC_CYRILLIC is not set -# CONFIG_NLS_MAC_GAELIC is not set -# CONFIG_NLS_MAC_GREEK is not set -# CONFIG_NLS_MAC_ICELAND is not set -# CONFIG_NLS_MAC_INUIT is not set -# CONFIG_NLS_MAC_ROMANIAN is not set -# CONFIG_NLS_MAC_TURKISH is not set -CONFIG_NLS_UTF8=y -# CONFIG_DLM is not set -# CONFIG_UNICODE is not set -CONFIG_EXFAT_FS=y -CONFIG_EXFAT_DISCARD=y -# CONFIG_EXFAT_DELAYED_SYNC is not set -# CONFIG_EXFAT_KERNEL_DEBUG is not set -# CONFIG_EXFAT_DEBUG_MSG is not set -CONFIG_EXFAT_DEFAULT_CODEPAGE=437 -CONFIG_EXFAT_DEFAULT_IOCHARSET="utf8" -# CONFIG_FILE_TABLE_DEBUG is not set -# CONFIG_VIRTUALIZATION is not set - -# -# Kernel hacking -# - -# -# printk and dmesg options -# CONFIG_PRINTK_TIME=y -CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7 -CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 -# CONFIG_BOOT_PRINTK_DELAY is not set -# CONFIG_DYNAMIC_DEBUG is not set -# CONFIG_DEBUG_MODULE_LOAD_INFO is not set -# CONFIG_DEBUG_CONSOLE_UNHASHED_POINTERS is not set - -# -# Compile-time checks and compiler options -# CONFIG_DEBUG_INFO=y -# CONFIG_DEBUG_INFO_REDUCED is not set -# CONFIG_DEBUG_INFO_SPLIT is not set -# CONFIG_DEBUG_INFO_DWARF4 is not set -# CONFIG_GDB_SCRIPTS is not set -CONFIG_ENABLE_WARN_DEPRECATED=y -CONFIG_ENABLE_MUST_CHECK=y -CONFIG_FRAME_WARN=2048 -# CONFIG_STRIP_ASM_SYMS is not set -# CONFIG_READABLE_ASM is not set -# CONFIG_UNUSED_SYMBOLS is not set -# CONFIG_PAGE_OWNER is not set -# CONFIG_DEBUG_FS is not set -# CONFIG_HEADERS_CHECK is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -CONFIG_SECTION_MISMATCH_WARN_ONLY=y -CONFIG_ARCH_WANT_FRAME_POINTERS=y -CONFIG_FRAME_POINTER=y -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +CONFIG_PAGE_OWNER=y CONFIG_MAGIC_SYSRQ=y -CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 -CONFIG_MAGIC_SYSRQ_SERIAL=y -CONFIG_DEBUG_KERNEL=y - -# -# Memory Debugging -# -# CONFIG_PAGE_EXTENSION is not set -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_SLUB_DEBUG_PANIC_ON is not set -# CONFIG_PAGE_POISONING is not set -# CONFIG_DEBUG_PAGE_REF is not set -# CONFIG_DEBUG_RODATA_TEST is not set -# CONFIG_DEBUG_OBJECTS is not set -# CONFIG_SLUB_DEBUG_ON is not set -# CONFIG_SLUB_STATS is not set -CONFIG_HAVE_DEBUG_KMEMLEAK=y -# CONFIG_DEBUG_KMEMLEAK is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_VM is not set -CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y -# CONFIG_DEBUG_VIRTUAL is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DEBUG_PER_CPU_MAPS is not set -CONFIG_HAVE_ARCH_KASAN=y -CONFIG_HAVE_ARCH_KASAN_SW_TAGS=y -CONFIG_CC_HAS_KASAN_GENERIC=y -CONFIG_CC_HAS_KASAN_SW_TAGS=y -# CONFIG_KASAN is not set -CONFIG_KASAN_STACK=0 -CONFIG_ARCH_HAS_KCOV=y -CONFIG_CC_HAS_SANCOV_TRACE_PC=y -# CONFIG_KCOV is not set -# CONFIG_DEBUG_SHIRQ is not set - -# -# Debug Lockups and Hangs -# -# CONFIG_SOFTLOCKUP_DETECTOR is not set -# CONFIG_PANIC_ON_RECURSIVE_FAULT is not set -CONFIG_DETECT_HUNG_TASK=y -CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=60 -# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set -CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 -# CONFIG_WQ_WATCHDOG is not set -# CONFIG_PANIC_ON_OOPS is not set -CONFIG_PANIC_ON_OOPS_VALUE=0 CONFIG_PANIC_TIMEOUT=5 -CONFIG_SCHED_DEBUG=y -CONFIG_SCHED_INFO=y -# CONFIG_PANIC_ON_SCHED_BUG is not set -# CONFIG_PANIC_ON_RT_THROTTLING is not set CONFIG_SCHEDSTATS=y -# CONFIG_SCHED_STACK_END_CHECK is not set -# CONFIG_DEBUG_TIMEKEEPING is not set # CONFIG_DEBUG_PREEMPT is not set - -# -# Lock Debugging (spinlocks, mutexes, etc...) -# -# CONFIG_DEBUG_RT_MUTEXES is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_PROVE_LOCKING is not set -# CONFIG_LOCK_STAT is not set -# CONFIG_DEBUG_ATOMIC_SLEEP is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -# CONFIG_LOCK_TORTURE_TEST is not set -# CONFIG_WW_MUTEX_SELFTEST is not set -CONFIG_STACKTRACE=y -# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set -# CONFIG_DEBUG_KOBJECT is not set -CONFIG_HAVE_DEBUG_BUGVERBOSE=y -CONFIG_DEBUG_BUGVERBOSE=y CONFIG_DEBUG_LIST=y -# CONFIG_DEBUG_PI_LIST is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_NOTIFIERS is not set -# CONFIG_DEBUG_CREDENTIALS is not set - -# -# RCU Debugging -# -# CONFIG_PROVE_RCU is not set -# CONFIG_TORTURE_TEST is not set -# CONFIG_RCU_PERF_TEST is not set -# CONFIG_RCU_TORTURE_TEST is not set -CONFIG_RCU_CPU_STALL_TIMEOUT=21 -CONFIG_RCU_PANIC_ON_STALL=0 -# CONFIG_RCU_TRACE is not set -# CONFIG_RCU_EQS_DEBUG is not set -# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set -# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set -# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set -# CONFIG_NOTIFIER_ERROR_INJECTION is not set -# CONFIG_FAULT_INJECTION is not set -# CONFIG_LATENCYTOP is not set -CONFIG_NOP_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_TRACE_CLOCK=y -CONFIG_RING_BUFFER=y -CONFIG_EVENT_TRACING=y -CONFIG_CONTEXT_SWITCH_TRACER=y CONFIG_IPC_LOGGING=y -CONFIG_QCOM_RTB=y -CONFIG_QCOM_RTB_SEPARATE_CPUS=y -CONFIG_TRACING=y -CONFIG_GENERIC_TRACER=y -CONFIG_TRACING_SUPPORT=y -CONFIG_FTRACE=y -# CONFIG_FUNCTION_TRACER is not set -# CONFIG_PREEMPTIRQ_EVENTS is not set -# CONFIG_IRQSOFF_TRACER is not set -# CONFIG_PREEMPT_TRACER is not set -# CONFIG_SCHED_TRACER is not set -# CONFIG_HWLAT_TRACER is not set -# CONFIG_FTRACE_SYSCALLS is not set -# CONFIG_TRACER_SNAPSHOT is not set -CONFIG_BRANCH_PROFILE_NONE=y -# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set -# CONFIG_STACK_TRACER is not set -# CONFIG_BLK_DEV_IO_TRACE is not set -CONFIG_UPROBE_EVENTS=y -CONFIG_BPF_EVENTS=y -CONFIG_PROBE_EVENTS=y -# CONFIG_FTRACE_STARTUP_TEST is not set -# CONFIG_TRACEPOINT_BENCHMARK is not set -# CONFIG_RING_BUFFER_BENCHMARK is not set -# CONFIG_RING_BUFFER_STARTUP_TEST is not set -# CONFIG_TRACE_EVAL_MAP_FILE is not set -CONFIG_TRACING_EVENTS_GPIO=y -# CONFIG_DMA_API_DEBUG is not set - -# -# Runtime Testing -# -# CONFIG_TEST_LIST_SORT is not set -# CONFIG_TEST_SORT is not set -# CONFIG_BACKTRACE_SELF_TEST is not set -# CONFIG_RBTREE_TEST is not set -# CONFIG_INTERVAL_TREE_TEST is not set -# CONFIG_PERCPU_TEST is not set -# CONFIG_ATOMIC64_SELFTEST is not set -# CONFIG_TEST_HEXDUMP is not set -# CONFIG_TEST_STRING_HELPERS is not set -# CONFIG_TEST_KSTRTOX is not set -# CONFIG_TEST_PRINTF is not set -# CONFIG_TEST_BITMAP is not set -# CONFIG_TEST_UUID is not set -# CONFIG_TEST_RHASHTABLE is not set -# CONFIG_TEST_HASH is not set -# CONFIG_TEST_LKM is not set -# CONFIG_TEST_USER_COPY is not set -# CONFIG_TEST_BPF is not set -# CONFIG_TEST_FIRMWARE is not set -# CONFIG_TEST_SYSCTL is not set -# CONFIG_TEST_UDELAY is not set -# CONFIG_MEMTEST is not set -# CONFIG_TEST_STATIC_KEYS is not set -# CONFIG_TEST_KMOD is not set -# CONFIG_TEST_MEMINIT is not set -# CONFIG_TEST_STACKINIT is not set -# CONFIG_BUG_ON_DATA_CORRUPTION is not set -# CONFIG_PANIC_ON_DATA_CORRUPTION is not set -# CONFIG_SAMPLES is not set -CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_KGDB is not set -CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y -# CONFIG_ARCH_WANTS_UBSAN_NO_NULL is not set -# CONFIG_UBSAN is not set -CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y -# CONFIG_ARM64_PTDUMP_CORE is not set -# CONFIG_ARM64_PTDUMP_DEBUGFS is not set -# CONFIG_PID_IN_CONTEXTIDR is not set -# CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set -# CONFIG_DEBUG_WX is not set CONFIG_DEBUG_ALIGN_RODATA=y -# CONFIG_ARM64_RELOC_TEST is not set -# CONFIG_ARM64_STRICT_BREAK_BEFORE_MAKE is not set CONFIG_CORESIGHT=y -CONFIG_CORESIGHT_LINKS_AND_SINKS=y CONFIG_CORESIGHT_LINK_AND_SINK_TMC=y -# CONFIG_CORESIGHT_CATU is not set -# CONFIG_CORESIGHT_SINK_TPIU is not set -# CONFIG_CORESIGHT_SINK_ETBV10 is not set -# CONFIG_CORESIGHT_SOURCE_ETM4X is not set CONFIG_CORESIGHT_DYNAMIC_REPLICATOR=y -# CONFIG_CORESIGHT_DBGUI is not set CONFIG_CORESIGHT_STM=y CONFIG_CORESIGHT_CTI=y -CONFIG_CORESIGHT_OST=y CONFIG_CORESIGHT_TPDA=y CONFIG_CORESIGHT_TPDM=y -# CONFIG_CORESIGHT_TPDM_DEFAULT_ENABLE is not set -# CONFIG_CORESIGHT_QPDI is not set CONFIG_CORESIGHT_HWEVENT=y CONFIG_CORESIGHT_DUMMY=y CONFIG_CORESIGHT_REMOTE_ETM=y CONFIG_CORESIGHT_REMOTE_ETM_DEFAULT_ENABLE=0 -CONFIG_CORESIGHT_CSR=y -# CONFIG_CORESIGHT_TGU is not set CONFIG_CORESIGHT_EVENT=y - -# -# Security options -# -CONFIG_KEYS=y -CONFIG_KEYS_COMPAT=y -# CONFIG_PERSISTENT_KEYRINGS is not set -# CONFIG_BIG_KEYS is not set -# CONFIG_ENCRYPTED_KEYS is not set -# CONFIG_KEY_DH_OPERATIONS is not set -# CONFIG_SECURITY_DMESG_RESTRICT is not set -CONFIG_SECURITY_PERF_EVENTS_RESTRICT=y CONFIG_SECURITY=y -# CONFIG_SECURITY_WRITABLE_HOOKS is not set -# CONFIG_SECURITYFS is not set -CONFIG_SECURITY_NETWORK=y -# CONFIG_SECURITY_NETWORK_XFRM is not set -# CONFIG_SECURITY_PATH is not set -CONFIG_LSM_MMAP_MIN_ADDR=32768 -CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y CONFIG_HARDENED_USERCOPY=y -# CONFIG_HARDENED_USERCOPY_PAGESPAN is not set CONFIG_FORTIFY_SOURCE=y CONFIG_STATIC_USERMODEHELPER=y CONFIG_STATIC_USERMODEHELPER_PATH="" CONFIG_SECURITY_SELINUX=y -# CONFIG_SECURITY_SELINUX_BOOTPARAM is not set -# CONFIG_SECURITY_SELINUX_DISABLE is not set -CONFIG_SECURITY_SELINUX_DEVELOP=y -CONFIG_SECURITY_SELINUX_AVC_STATS=y -CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=0 -CONFIG_SECURITY_SELINUX_SIDTAB_HASH_BITS=9 CONFIG_SECURITY_SMACK=y -# CONFIG_SECURITY_SMACK_BRINGUP is not set -# CONFIG_SECURITY_SMACK_NETFILTER is not set -# CONFIG_SECURITY_SMACK_APPEND_SIGNALS is not set -# CONFIG_SECURITY_TOMOYO is not set -# CONFIG_SECURITY_APPARMOR is not set -# CONFIG_SECURITY_LOADPIN is not set -# CONFIG_SECURITY_YAMA is not set -CONFIG_INTEGRITY=y -# CONFIG_INTEGRITY_SIGNATURE is not set -CONFIG_INTEGRITY_AUDIT=y -# CONFIG_IMA is not set -# CONFIG_EVM is not set -CONFIG_DEFAULT_SECURITY_SELINUX=y -# CONFIG_DEFAULT_SECURITY_SMACK is not set -# CONFIG_DEFAULT_SECURITY_DAC is not set -CONFIG_DEFAULT_SECURITY="selinux" - -# -# Kernel hardening options -# - -# -# Memory initialization -# -CONFIG_INIT_STACK_NONE=y -# CONFIG_INIT_STACK_ALL is not set -# CONFIG_INIT_ON_ALLOC_DEFAULT_ON is not set -# CONFIG_INIT_ON_FREE_DEFAULT_ON is not set -CONFIG_CRYPTO=y - -# -# Crypto core or helper -# -CONFIG_CRYPTO_ALGAPI=y -CONFIG_CRYPTO_ALGAPI2=y -CONFIG_CRYPTO_AEAD=y -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_BLKCIPHER=y -CONFIG_CRYPTO_BLKCIPHER2=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_RNG=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_RNG_DEFAULT=y -CONFIG_CRYPTO_AKCIPHER2=y -CONFIG_CRYPTO_AKCIPHER=y -CONFIG_CRYPTO_KPP2=y -CONFIG_CRYPTO_KPP=y -CONFIG_CRYPTO_ACOMP2=y -CONFIG_CRYPTO_RSA=y -# CONFIG_CRYPTO_DH is not set -CONFIG_CRYPTO_ECDH=y -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -# CONFIG_CRYPTO_USER is not set -CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y -CONFIG_CRYPTO_GF128MUL=y -CONFIG_CRYPTO_NULL=y -CONFIG_CRYPTO_NULL2=y -# CONFIG_CRYPTO_PCRYPT is not set -CONFIG_CRYPTO_WORKQUEUE=y -CONFIG_CRYPTO_CRYPTD=y -# CONFIG_CRYPTO_MCRYPTD is not set -CONFIG_CRYPTO_AUTHENC=y -# CONFIG_CRYPTO_TEST is not set -CONFIG_CRYPTO_SIMD=y - -# -# Authenticated Encryption with Associated Data -# -# CONFIG_CRYPTO_CCM is not set CONFIG_CRYPTO_GCM=y -# CONFIG_CRYPTO_CHACHA20POLY1305 is not set -CONFIG_CRYPTO_SEQIV=y -CONFIG_CRYPTO_ECHAINIV=y - -# -# Block modes -# -CONFIG_CRYPTO_CBC=y -CONFIG_CRYPTO_CTR=y -CONFIG_CRYPTO_CTS=y -CONFIG_CRYPTO_ECB=y -# CONFIG_CRYPTO_LRW is not set -# CONFIG_CRYPTO_PCBC is not set -CONFIG_CRYPTO_XTS=y -# CONFIG_CRYPTO_KEYWRAP is not set -# CONFIG_CRYPTO_ADIANTUM is not set - -# -# Hash modes -# -CONFIG_CRYPTO_CMAC=y -CONFIG_CRYPTO_HMAC=y CONFIG_CRYPTO_XCBC=y -# CONFIG_CRYPTO_VMAC is not set - -# -# Digest -# -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_CRC32=y -# CONFIG_CRYPTO_CRCT10DIF is not set -CONFIG_CRYPTO_GHASH=y -# CONFIG_CRYPTO_POLY1305 is not set -# CONFIG_CRYPTO_MD4 is not set -CONFIG_CRYPTO_MD5=y -# CONFIG_CRYPTO_MICHAEL_MIC is not set -# CONFIG_CRYPTO_RMD128 is not set -# CONFIG_CRYPTO_RMD160 is not set -# CONFIG_CRYPTO_RMD256 is not set -# CONFIG_CRYPTO_RMD320 is not set -CONFIG_CRYPTO_SHA1=y -CONFIG_CRYPTO_SHA256=y -CONFIG_CRYPTO_SHA512=y -# CONFIG_CRYPTO_SHA3 is not set -# CONFIG_CRYPTO_TGR192 is not set -# CONFIG_CRYPTO_WP512 is not set - -# -# Ciphers -# -CONFIG_CRYPTO_AES=y -# CONFIG_CRYPTO_AES_TI is not set -# CONFIG_CRYPTO_ANUBIS is not set -CONFIG_CRYPTO_ARC4=y -# CONFIG_CRYPTO_BLOWFISH is not set -# CONFIG_CRYPTO_CAMELLIA is not set -# CONFIG_CRYPTO_CAST5 is not set -# CONFIG_CRYPTO_CAST6 is not set -CONFIG_CRYPTO_DES=y -# CONFIG_CRYPTO_FCRYPT is not set -# CONFIG_CRYPTO_KHAZAD is not set -# CONFIG_CRYPTO_SALSA20 is not set -# CONFIG_CRYPTO_CHACHA20 is not set -# CONFIG_CRYPTO_SEED is not set -# CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_TEA is not set CONFIG_CRYPTO_TWOFISH=y -CONFIG_CRYPTO_TWOFISH_COMMON=y - -# -# Compression -# -CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_LZO=y -# CONFIG_CRYPTO_842 is not set -CONFIG_CRYPTO_LZ4=y -# CONFIG_CRYPTO_LZ4HC is not set -# CONFIG_CRYPTO_ZSTD is not set - -# -# Random Number Generation -# CONFIG_CRYPTO_ANSI_CPRNG=y -CONFIG_CRYPTO_DRBG_MENU=y -CONFIG_CRYPTO_DRBG_HMAC=y -# CONFIG_CRYPTO_DRBG_HASH is not set -# CONFIG_CRYPTO_DRBG_CTR is not set -CONFIG_CRYPTO_DRBG=y -CONFIG_CRYPTO_JITTERENTROPY=y -# CONFIG_CRYPTO_USER_API_HASH is not set -# CONFIG_CRYPTO_USER_API_SKCIPHER is not set -# CONFIG_CRYPTO_USER_API_RNG is not set -# CONFIG_CRYPTO_USER_API_AEAD is not set -CONFIG_CRYPTO_HASH_INFO=y -CONFIG_CRYPTO_HW=y -# CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_DESC is not set -# CONFIG_CRYPTO_DEV_CCP is not set -# CONFIG_CRYPTO_DEV_NITROX_CNN55XX is not set -# CONFIG_CRYPTO_DEV_CAVIUM_ZIP is not set -# CONFIG_CRYPTO_DEV_QCE is not set CONFIG_CRYPTO_DEV_QCOM_MSM_QCE=y CONFIG_CRYPTO_DEV_QCRYPTO=y CONFIG_CRYPTO_DEV_QCEDEV=y -# CONFIG_CRYPTO_DEV_OTA_CRYPTO is not set -CONFIG_ASYMMETRIC_KEY_TYPE=y -CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y -CONFIG_X509_CERTIFICATE_PARSER=y -CONFIG_PKCS7_MESSAGE_PARSER=y -# CONFIG_PKCS7_TEST_KEY is not set -# CONFIG_SIGNED_PE_FILE_VERIFICATION is not set - -# -# Certificates for signature checking -# -CONFIG_MODULE_SIG_KEY="certs/signing_key.pem" -CONFIG_SYSTEM_TRUSTED_KEYRING=y -CONFIG_SYSTEM_TRUSTED_KEYS="" -# CONFIG_SYSTEM_EXTRA_CERTIFICATE is not set -# CONFIG_SECONDARY_TRUSTED_KEYRING is not set -# CONFIG_SYSTEM_BLACKLIST_KEYRING is not set +CONFIG_CRYPTO_DEV_QCOM_ICE=y CONFIG_ARM64_CRYPTO=y -CONFIG_CRYPTO_SHA256_ARM64=y -# CONFIG_CRYPTO_SHA512_ARM64 is not set CONFIG_CRYPTO_SHA1_ARM64_CE=y CONFIG_CRYPTO_SHA2_ARM64_CE=y CONFIG_CRYPTO_GHASH_ARM64_CE=y -# CONFIG_CRYPTO_CRC32_ARM64_CE is not set -CONFIG_CRYPTO_AES_ARM64=y -CONFIG_CRYPTO_AES_ARM64_CE=y CONFIG_CRYPTO_AES_ARM64_CE_CCM=y CONFIG_CRYPTO_AES_ARM64_CE_BLK=y CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y -# CONFIG_CRYPTO_CHACHA20_NEON is not set -# CONFIG_CRYPTO_AES_ARM64_BS is not set -CONFIG_BINARY_PRINTF=y +CONFIG_STACK_HASH_ORDER_SHIFT=12 -# -# Library routines -# -CONFIG_BITREVERSE=y -CONFIG_HAVE_ARCH_BITREVERSE=y -CONFIG_RATIONAL=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_NET_UTILS=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_IO=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_CRC_CCITT=y -CONFIG_CRC16=y -# CONFIG_CRC_T10DIF is not set -# CONFIG_CRC_ITU_T is not set -CONFIG_CRC32=y -# CONFIG_CRC32_SELFTEST is not set -CONFIG_CRC32_SLICEBY8=y -# CONFIG_CRC32_SLICEBY4 is not set -# CONFIG_CRC32_SARWATE is not set -# CONFIG_CRC32_BIT is not set -# CONFIG_CRC4 is not set -# CONFIG_CRC7 is not set -CONFIG_LIBCRC32C=y -CONFIG_CRC8=y -CONFIG_AUDIT_GENERIC=y -CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y -CONFIG_AUDIT_COMPAT_GENERIC=y -# CONFIG_RANDOM32_SELFTEST is not set -CONFIG_ZLIB_INFLATE=y -CONFIG_ZLIB_DEFLATE=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_LZ4_COMPRESS=y -CONFIG_LZ4_DECOMPRESS=y -# CONFIG_XZ_DEC is not set -# CONFIG_XZ_DEC_BCJ is not set -CONFIG_DECOMPRESS_GZIP=y -CONFIG_DECOMPRESS_BZIP2=y -CONFIG_DECOMPRESS_LZMA=y -CONFIG_DECOMPRESS_LZ4=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_REED_SOLOMON=y -CONFIG_REED_SOLOMON_ENC8=y -CONFIG_REED_SOLOMON_DEC8=y -CONFIG_TEXTSEARCH=y -CONFIG_TEXTSEARCH_KMP=y -CONFIG_TEXTSEARCH_BM=y -CONFIG_TEXTSEARCH_FSM=y -CONFIG_ASSOCIATIVE_ARRAY=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -CONFIG_HAS_DMA=y -# CONFIG_SGL_ALLOC is not set -# CONFIG_DMA_NOOP_OPS is not set -# CONFIG_DMA_VIRT_OPS is not set -CONFIG_CPU_RMAP=y -CONFIG_DQL=y -CONFIG_GLOB=y -# CONFIG_GLOB_SELFTEST is not set -CONFIG_NLATTR=y -CONFIG_CLZ_TAB=y -# CONFIG_CORDIC is not set -# CONFIG_DDR is not set -# CONFIG_IRQ_POLL is not set -CONFIG_MPILIB=y -CONFIG_LIBFDT=y -CONFIG_OID_REGISTRY=y -# CONFIG_SG_SPLIT is not set -CONFIG_SG_POOL=y -CONFIG_ARCH_HAS_SG_CHAIN=y -CONFIG_SBITMAP=y -# CONFIG_STRING_SELFTEST is not set +#ifdef VENDOR_EDIT +#/*ye.zhang@BSP.Bootloader.Bootflow, 2020-6-18, Add for oppo project*/ +CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE=y +CONFIG_OPPO_COMMON_SOFT=y +CONFIG_OPPO_DEVICE_IFNO=y +CONFIG_OPLUS_RF_CABLE_MONITOR=y +#endif + +#ifdef VENDOR_EDIT +#huangjianan@TECH.Storage.FS, 2020/06/03, Add for fs feature +CONFIG_OPLUS_FEATURE_OF2FS=y +CONFIG_OPLUS_FEATURE_PANIC_FLUSH=y +#endif + +#ifdef OPLUS_FEATURE_QCOM_PMICWD +#shukai@BSP.Kernel.Stability, 2020/08/06, Add for qcom pmic watchdog +CONFIG_OPLUS_FEATURE_QCOM_PMICWD=y +#endif +CONFIG_OPLUS_FEATURE_DUMP_DEVICE_INFO=y +#ifdef OPLUS_SYSTEM_KERNEL +#wen.luo@BSP.Kernel.Stability, 2020/03/26, all system oplus feature writer here +CONFIG_OPLUS_FEATURE_PHOENIX=y +CONFIG_DETECT_HUNG_TASK=y +CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE=y +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=60 +#endif + +#zoulian@BSP.Fingerprint.Basic, 2020/03/02, add for fingerprint driver +#ifdef OPLUS_FEATURE_FINGERPRINT +CONFIG_OPPO_FINGERPRINT=y +CONFIG_OPPO_FINGERPRINT_QCOM=y +CONFIG_OPPO_FINGERPRINT_GOODIX_OPTICAL=y +CONFIG_OPPO_FINGERPRINT_JIIOV_OPTICAL=y +#endif + +#fei.zhang@BSP.Kernel.Stability, 2020/03/31, Add for shutdown detect +CONFIG_OPLUS_FEATURE_SHUTDOWN_DETECT=y + +#runyu.ouyang@BSP.Kernel.Stability, 2020/04/03, add slabtrace function +#CONFIG_OPLUS_FEATURE_SLABTRACE_DEBUG is not set + +CONFIG_OPLUS_FEATURE_OPROJECT=y + +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY +#/*Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler*/ +CONFIG_OPLUS_POWER_QCOM=y +CONFIG_OPLUS_WAKELOCK_PROFILER=y +#endif + +#ifdef OPLUS_FEATURE_MODEM_MINIDUMP +#ChenWeidong@NETWORK.RF, 2019/12/05, add for modem crash str save +CONFIG_OPLUS_FEATURE_RECORD_MDMRST=y +#endif + +#ifdef OPLUS_FEATURE_ACM +#Yuwei.Guan@BSP.Kernel.FS,2020/07/08, Add for acm +CONFIG_OPLUS_FEATURE_ACM=y +CONFIG_OPLUS_FEATURE_ACM_LOGGING=y +#endif /* OPLUS_FEATURE_ACM */ + +#ifdef OPLUS_FEATURE_HEALTHINFO +#/* Liujie.Xie@TECH.Kernel.Sched, 2020-05-20, add jank info monitor support*/ +CONFIG_OPPO_JANK_INFO=y +#endif /* OPLUS_FEATURE_HEALTHINFO */ +#ifdef OPLUS_FEATURE_HEALTHINFO +#/* Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-07-07, add alloc wait monitor support*/ +CONFIG_OPPO_MEM_MONITOR=y +CONFIG_FG_TASK_UID=y +CONFIG_OPPO_HEALTHINFO=y +CONFIG_SLUB_DEBUG=y +CONFIG_SCHEDSTATS=y +#endif /* OPLUS_FEATURE_HEALTHINFO */ + +#ifdef OPLUS_FEATURE_MULTI_KSWAPD +CONFIG_OPLUS_MULTI_KSWAPD=y +#endif /*OPLUS_FEATURE_MULTI_KSWAPD*/ + +#ifdef OPLUS_FEATURE_TP_BASIC +#Qicai.Gu@BSP.TP, 2020/08/25, modify for sim detect +CONFIG_SIM_DETECT=y +#endif + +#ifdef OPLUS_FEATURE_ZRAM_OPT +CONFIG_OPLUS_ZRAM_OPT=y +CONFIG_CRYPTO_LZ4=y +CONFIG_PGTABLE_MAPPING=y +#endif /*OPLUS_FEATURE_ZRAM_OPT*/ + +#ifdef OPLUS_FEATURE_FG_IO_OPT +#wangtao@BSP.Kernel.mm 2020/08/24, increase priority of foreground IO +CONFIG_OPPO_FG_IO_OPT=y +#endif + +#ifdef OPLUS_FEATURE_IOMONITOR +CONFIG_IOMONITOR=y +CONFIG_IOMONITOR_WITH_F2FS=y +#endif /*OPLUS_FEATURE_IOMONITOR*/ + +#ifdef OPLUS_FEATURE_LOWMEM_DBG +#Hailong.Liu@BSP.Kernel.MM, 2020/06/19, Add for dump memory usage when lowmmem occurs. +CONFIG_OPLUS_FEATURE_LOWMEM_DBG=y +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ + +#ifdef OPLUS_FEATURE_HANS_FREEZE +#Kun.Zhou@ROM.Framework, 2019/09/23, add for hans freeze manager +CONFIG_OPPO_HANS=y +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ + +#Jiang.Li@TECH.BSP.Stability.PMIC_MONITOR, 2020/04/22 +CONFIG_OPLUS_FEATURE_PMIC_MONITOR=y + +#ifdef OPLUS_BUG_STABILITY +#zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info +CONFIG_PSTORE=y +CONFIG_PSTORE_CONSOLE=y +CONFIG_PSTORE_PMSG=y +CONFIG_PSTORE_RAM=y +#endif + +#Fuchun.Liao@BSP.CHG.Basic 2020/04/09 add for qcom minidump customized +CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE=y + +#ifdef OPLUS_FEATURE_ABNORMAL_CPU +#/* Kun.Zhou@ANDROID.PWS, 2020/08/05, Add for BG CPU abnormal detection */ +CONFIG_CFS_BANDWIDTH=y +#endif /* OPLUS_FEATURE_ABNORMAL_CPU * + +#ifdef VENDOR_EDIT +#/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +CONFIG_UFSFEATURE=y +CONFIG_UFSHPB=y +CONFIG_UFSTW=y +#CONFIG_UFSTW_DEBUGDRV=y +CONFIG_HPB_SUP_ONLY_4=y +CONFIG_HPB_SUP_8_TO_32=y +CONFIG_HPB_SUP_OVER_36=y +CONFIG_UFSTW_IGNORE_GUARANTEE_BIT=y +#endif + +#temp enable RTB log for debug ,Should be remove in release version +CONFIG_QCOM_RTB=y +CONFIG_QCOM_RTB_SEPARATE_CPUS=y + +#ifdef VENDOR_EDIT +#add for kernel system +CONFIG_OPLUS_FEATURE_PROJECTINFO=y +#endif + +#BSP.Kernel.Stability, 2020/12/14, add uboot log +CONFIG_OPLUS_FEATURE_UBOOT_LOG=y + +#ifdef OPLUS_FEATURE_UIFIRST +CONFIG_CAMERA_OPT=y +#endif /*OPLUS_FEATURE_UIFIRST*/ + +#ifdef OPLUS_FEATURE_ION_BOOSTPOOL +#Hailong.Liu@BSP.Kernel.MM, 2020/11/19, add ion boostpool. +CONFIG_OPLUS_ION_BOOSTPOOL=y +#endif /* OPLUS_FEATURE_ION_BOOSTPOOL */ + +#Add for NandSwap +CONFIG_NANDSWAP=y +#CONFIG_NANDSWAP_DEBUG=y diff --git a/arch/arm64/configs/vendor/atoll-perf_defconfig b/arch/arm64/configs/vendor/atoll-perf_defconfig index 3725488ba327..e71d165a1be5 100644 --- a/arch/arm64/configs/vendor/atoll-perf_defconfig +++ b/arch/arm64/configs/vendor/atoll-perf_defconfig @@ -64,7 +64,11 @@ CONFIG_PCI_MSM=y CONFIG_SCHED_MC=y CONFIG_NR_CPUS=8 CONFIG_PREEMPT=y -CONFIG_HZ_100=y +#ifdef OPLUS_FEATURE_HEALTHINFO +#wenbin.liu@PSW.BSP.MM, 2018/06/14 Delete for improve performance +#CONFIG_HZ_100=y +CONFIG_HZ_250=y +#endif /* OPLUS_FEATURE_HEALTHINFO */ CONFIG_MEMORY_HOTPLUG=y CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE=y CONFIG_MEMORY_HOTPLUG_MOVABLE_NODE=y @@ -257,6 +261,11 @@ CONFIG_CFG80211_REG_CELLULAR_HINTS=y CONFIG_CFG80211_INTERNAL_REGDB=y CONFIG_RFKILL=y CONFIG_NFC_NQ=y +#ifdef OPLUS_NFC_BRINGUP +#DengWeiwei@CONNECTIVITY.NFC.HARDWARE.253154, 2020/08/09 +#Add for the kernel Macro for NXP PN557 NFC kernel +CONFIG_NFC_PN553_DEVICES=y +#endif /*OPLUS_NFC_BRINGUP*/ CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y CONFIG_REGMAP_WCD_IRQ=y CONFIG_REGMAP_ALLOW_WRITE_DEBUGFS=y @@ -323,39 +332,75 @@ CONFIG_CLD_LL_CORE=y CONFIG_CNSS_GENL=y CONFIG_INPUT_EVDEV=y CONFIG_KEYBOARD_GPIO=y +#ifdef VENDOR_EDIT +#/*lizhijie@BSP.CHG.Basic, 2020/02/25, Add for Joystick */ +CONFIG_INPUT_JOYSTICK=y +CONFIG_JOYSTICK_XPAD=y +CONFIG_JOYSTICK_XPAD_FF=y +CONFIG_JOYSTICK_XPAD_LEDS=y +#endif /* VENDOR_EDIT */ # CONFIG_INPUT_MOUSE is not set CONFIG_INPUT_JOYSTICK=y CONFIG_JOYSTICK_XPAD=y CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_ATMEL_MXT=y -CONFIG_TOUCHSCREEN_ST=y -CONFIG_TOUCHSCREEN_HIMAX_CHIPSET=y -CONFIG_TOUCHSCREEN_HIMAX_I2C=y -CONFIG_TOUCHSCREEN_HIMAX_INCELL=y -CONFIG_TOUCHSCREEN_HIMAX_IC_HX83112=y -CONFIG_TOUCHSCREEN_HIMAX_DEBUG=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_CORE=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_RMI_DEV=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE_EXTRA_SYSFS=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_TEST_REPORTING=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_CORE=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TOUCH=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DEVICE=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TESTING=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_REFLASH=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_RECOVERY=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_ZEROFLASH=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DIAGNOSTICS=y +#ifdef VENDOR_EDIT +#Qicai.gu@Bsp.Group.Tp, 2020/02/26, Add for oppo project +#CONFIG_TOUCHSCREEN_ATMEL_MXT=y +#CONFIG_TOUCHSCREEN_ST=y +#CONFIG_TOUCHSCREEN_HIMAX_CHIPSET=y +#CONFIG_TOUCHSCREEN_HIMAX_I2C=y +#CONFIG_TOUCHSCREEN_HIMAX_INCELL=y +#CONFIG_TOUCHSCREEN_HIMAX_IC_HX83112=y +#CONFIG_TOUCHSCREEN_HIMAX_DEBUG=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_CORE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_RMI_DEV=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE_EXTRA_SYSFS=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_TEST_REPORTING=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_CORE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TOUCH=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DEVICE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TESTING=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_REFLASH=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_RECOVERY=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_ZEROFLASH=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DIAGNOSTICS=y + +CONFIG_TOUCHPANEL_OPPO=y +CONFIG_TOUCHPANEL_GOODIX=y +CONFIG_TOUCHPANEL_GOODIX_GT9886=y +CONFIG_TOUCHIRQ_UPDATE_QOS=y + +#ifdef OPLUS_FEATURE_TP_BASIC +#Qicai.gu add for FT3518 BSP.TP 2020/8/9 +CONFIG_TOUCHPANEL_FOCAL=y +CONFIG_TOUCHPANEL_FOCAL_FT3518=y +#endif /*OPLUS_FEATURE_TP_BASIC*/ + +#zhaifeibiao@ODM_LQ@BSP.touch,2020/11/03,Add for oppo project +CONFIG_TOUCHPANEL_NOVA_NT36672C_NOFLASH=y +CONFIG_TOUCHPANEL_NOVA=y +CONFIG_TOUCHPANEL_NEW_SET_IRQ_WAKE=y +#ifdef VENDOR_EDIT +#lujiang.yu add for 567 BSP.TP 2020/4/3 +CONFIG_TOUCHPANEL_SAMSUNG=y +CONFIG_TOUCHPANEL_SAMSUNG_S6SY771=y +#endif + +#CONFIG_TOUCHPANEL_NEW_SET_IRQ_WAKE=y +#endif CONFIG_INPUT_MISC=y CONFIG_INPUT_QPNP_POWER_ON=y CONFIG_INPUT_UINPUT=y # CONFIG_SERIO_SERPORT is not set # CONFIG_LEGACY_PTYS is not set # CONFIG_DEVMEM is not set +#ifdef VENDOR_EDIT //Nanwei.Deng@power 2020.8.26 for ftm console enable CONFIG_SERIAL_MSM_GENI=y +CONFIG_SERIAL_MSM_GENI_CONSOLE=y +#endif CONFIG_SERIAL_MSM_WITH_HALF_SAMPLING=y CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_MSM_LEGACY=y @@ -387,8 +432,42 @@ CONFIG_QCOM_DLOAD_MODE=y CONFIG_POWER_RESET_XGENE=y CONFIG_POWER_RESET_SYSCON=y CONFIG_QPNP_QG=y -CONFIG_SMB1355_SLAVE_CHARGER=y +#ifdef VENDOR_EDIT +#/* lizhijie@BSP.CHG.Basic, 2020/02/25, Modify for charging */ +#CONFIG_SMB1355_SLAVE_CHARGER=y +#endif CONFIG_QPNP_SMB5=y +#ifdef VENDOR_EDIT +#/* lizhijie@BSP.CHG.Basic, 2020/02/25, Modify for charging */ +CONFIG_OPPO_SM7125R_CHARGER=y +CONFIG_OPPO_CHIP_SOC_NODE=y +CONFIG_OPPO_SHORT_HW_CHECK=y +CONFIG_OPPO_SHORT_USERSPACE=y +CONFIG_OPPO_SHIP_MODE_SUPPORT=y +CONFIG_OPPO_SMART_CHARGER_SUPPORT=y +CONFIG_OPPO_SHORT_C_BATT_CHECK=y +CONFIG_OPPO_CHECK_CHARGERID_VOLT=y +CONFIG_OPPO_SHORT_IC_CHECK=y +CONFIG_OPPO_CALL_MODE_SUPPORT=y +CONFIG_OPPO_SMOOTH_SOC=y +CONFIG_HID_SONY=y +CONFIG_SONY_FF=y +CONFIG_HID_BETOP_FF=y +CONFIG_OPLUS_CHARGER=y +CONFIG_OPLUS_SM7125R_CHARGER=y +CONFIG_OPLUS_CHIP_SOC_NODE=y +CONFIG_OPLUS_SHORT_HW_CHECK=y +CONFIG_OPLUS_SHORT_USERSPACE=y +CONFIG_OPLUS_SHIP_MODE_SUPPORT=y +CONFIG_OPLUS_SMART_CHARGER_SUPPORT=y +CONFIG_OPLUS_SHORT_C_BATT_CHECK=y +CONFIG_OPLUS_CHECK_CHARGERID_VOLT=y +CONFIG_OPLUS_SHORT_IC_CHECK=y +CONFIG_OPLUS_CALL_MODE_SUPPORT=y +CONFIG_OPLUS_SMOOTH_SOC=y +CONFIG_OPLUS_WPC_INTERFACE_ENABLE=y +CONFIG_OPLUS_CHARGER_OPTIGA=y +#endif CONFIG_SMB1390_CHARGE_PUMP_PSY=y CONFIG_SMB1398_CHARGER=y CONFIG_THERMAL=y @@ -586,9 +665,12 @@ CONFIG_MSM_QMP=y CONFIG_IOMMU_IO_PGTABLE_FAST=y CONFIG_ARM_SMMU=y CONFIG_QCOM_LAZY_MAPPING=y -CONFIG_IOMMU_DEBUG=y -CONFIG_IOMMU_DEBUG_TRACKING=y -CONFIG_IOMMU_TESTS=y +# ifdef OPLUS_BUG_STABILITY +# rendong.shi@BSP.kernel.debug,2017/5/20,remove for some secure issue from qcom request +# CONFIG_IOMMU_DEBUG is not set +# CONFIG_IOMMU_DEBUG_TRACKING is not set +# CONFIG_IOMMU_TESTS is not set +# endif CONFIG_RPMSG_CHAR=y CONFIG_RPMSG_QCOM_GLINK_SMEM=y CONFIG_RPMSG_QCOM_GLINK_SPI=y @@ -683,6 +765,12 @@ CONFIG_EXT4_FS=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y CONFIG_EXT4_ENCRYPTION=y +CONFIG_EXT4_FS_ENCRYPTION=y +CONFIG_EXT4_FS_ICE_ENCRYPTION=y +#ifdef OPLUS_FEATURE_EXFAT_SUPPORT//huyu@BSP.Storage,add 2020/5/8 for kernel 4.19 exfat +CONFIG_NLS_UTF8=y +CONFIG_EXFAT_FS=y +# endif CONFIG_F2FS_FS=y CONFIG_F2FS_FS_SECURITY=y CONFIG_F2FS_FS_ENCRYPTION=y @@ -748,3 +836,167 @@ CONFIG_CRYPTO_AES_ARM64_CE_CCM=y CONFIG_CRYPTO_AES_ARM64_CE_BLK=y CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y CONFIG_STACK_HASH_ORDER_SHIFT=12 + +#ifdef VENDOR_EDIT +#/*ye.zhang@BSP.Bootloader.Bootflow, 2020-6-18, Add for oppo project*/ +CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE=y +CONFIG_OPPO_COMMON_SOFT=y +CONFIG_OPPO_DEVICE_IFNO=y +CONFIG_OPLUS_RF_CABLE_MONITOR=y +#endif + +#ifdef VENDOR_EDIT +#huangjianan@TECH.Storage.FS, 2020/06/03, Add for fs feature +CONFIG_OPLUS_FEATURE_OF2FS=y +CONFIG_OPLUS_FEATURE_PANIC_FLUSH=y +#endif + +#ifdef OPLUS_FEATURE_QCOM_PMICWD +#shukai@BSP.Kernel.Stability, 2020/08/06, Add for qcom pmic watchdog +CONFIG_OPLUS_FEATURE_QCOM_PMICWD=y +#endif +CONFIG_OPLUS_FEATURE_DUMP_DEVICE_INFO=y +#ifdef OPLUS_SYSTEM_KERNEL +#wen.luo@BSP.Kernel.Stability, 2020/03/26, all system oplus feature writer here +CONFIG_OPLUS_FEATURE_PHOENIX=y +CONFIG_DETECT_HUNG_TASK=y +CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE=y +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=60 +#endif + +#zoulian@BSP.Fingerprint.Basic, 2020/03/02, add for fingerprint driver +#ifdef OPLUS_FEATURE_FINGERPRINT +CONFIG_OPPO_FINGERPRINT=y +CONFIG_OPPO_FINGERPRINT_QCOM=y +CONFIG_OPPO_FINGERPRINT_GOODIX_OPTICAL=y +CONFIG_OPPO_FINGERPRINT_JIIOV_OPTICAL=y +#endif + +#fei.zhang@BSP.Kernel.Stability, 2020/03/31, Add for shutdown detect +CONFIG_OPLUS_FEATURE_SHUTDOWN_DETECT=y + +#runyu.ouyang@BSP.Kernel.Stability, 2020/04/03, add slabtrace function +#CONFIG_OPLUS_FEATURE_SLABTRACE_DEBUG is not set + +CONFIG_OPLUS_FEATURE_OPROJECT=y + +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY +#/*Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler*/ +CONFIG_OPLUS_POWER_QCOM=y +CONFIG_OPLUS_WAKELOCK_PROFILER=y +#endif + +#ifdef OPLUS_FEATURE_MODEM_MINIDUMP +#ChenWeidong@NETWORK.RF, 2019/12/05, add for modem crash str save +CONFIG_OPLUS_FEATURE_RECORD_MDMRST=y +#endif + +#ifdef OPLUS_FEATURE_ACM +#Yuwei.Guan@BSP.Kernel.FS,2020/07/08, Add for acm +CONFIG_OPLUS_FEATURE_ACM=y +CONFIG_OPLUS_FEATURE_ACM_LOGGING=y +#endif /* OPLUS_FEATURE_ACM */ + +#ifdef OPLUS_FEATURE_HEALTHINFO +#/* Liujie.Xie@TECH.Kernel.Sched, 2020-05-20, add jank info monitor support*/ +CONFIG_OPPO_JANK_INFO=y +#endif /* OPLUS_FEATURE_HEALTHINFO */ +#ifdef OPLUS_FEATURE_HEALTHINFO +#/* Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-07-07, add alloc wait monitor support*/ +CONFIG_OPPO_MEM_MONITOR=y +CONFIG_FG_TASK_UID=y +CONFIG_OPPO_HEALTHINFO=y +CONFIG_SLUB_DEBUG=y +CONFIG_SCHEDSTATS=y +#endif /* OPLUS_FEATURE_HEALTHINFO */ + +#ifdef OPLUS_FEATURE_MULTI_KSWAPD +CONFIG_OPLUS_MULTI_KSWAPD=y +#endif /*OPLUS_FEATURE_MULTI_KSWAPD*/ + +#ifdef OPLUS_FEATURE_TP_BASIC +#Qicai.Gu@BSP.TP, 2020/08/25, modify for sim detect +CONFIG_SIM_DETECT=y +#endif + +#ifdef OPLUS_FEATURE_ZRAM_OPT +CONFIG_OPLUS_ZRAM_OPT=y +CONFIG_CRYPTO_LZ4=y +CONFIG_PGTABLE_MAPPING=y +#endif /*OPLUS_FEATURE_ZRAM_OPT*/ + +#ifdef OPLUS_FEATURE_FG_IO_OPT +#wangtao@BSP.Kernel.mm 2020/08/24, increase priority of foreground IO +CONFIG_OPPO_FG_IO_OPT=y +#endif + +#ifdef OPLUS_FEATURE_IOMONITOR +CONFIG_IOMONITOR=y +CONFIG_IOMONITOR_WITH_F2FS=y +#endif /*OPLUS_FEATURE_IOMONITOR*/ + +#ifdef OPLUS_FEATURE_LOWMEM_DBG +#Hailong.Liu@BSP.Kernel.MM, 2020/06/19, Add for dump memory usage when lowmmem occurs. +CONFIG_OPLUS_FEATURE_LOWMEM_DBG=y +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ + +#ifdef OPLUS_FEATURE_HANS_FREEZE +#Kun.Zhou@ROM.Framework, 2019/09/23, add for hans freeze manager +CONFIG_OPPO_HANS=y +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ + +#Jiang.Li@TECH.BSP.Stability.PMIC_MONITOR, 2020/04/22 +CONFIG_OPLUS_FEATURE_PMIC_MONITOR=y + +#ifdef OPLUS_BUG_STABILITY +#zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info +CONFIG_PSTORE=y +CONFIG_PSTORE_CONSOLE=y +CONFIG_PSTORE_PMSG=y +CONFIG_PSTORE_RAM=y +#endif + +#Fuchun.Liao@BSP.CHG.Basic 2020/04/09 add for qcom minidump customized +CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE=y + +#ifdef OPLUS_FEATURE_ABNORMAL_CPU +#/* Kun.Zhou@ANDROID.PWS, 2020/08/05, Add for BG CPU abnormal detection */ +CONFIG_CFS_BANDWIDTH=y +#endif /* OPLUS_FEATURE_ABNORMAL_CPU * + +#ifdef VENDOR_EDIT +#/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +CONFIG_UFSFEATURE=y +CONFIG_UFSHPB=y +CONFIG_UFSTW=y +#CONFIG_UFSTW_DEBUGDRV=y +CONFIG_HPB_SUP_ONLY_4=y +CONFIG_HPB_SUP_8_TO_32=y +CONFIG_HPB_SUP_OVER_36=y +CONFIG_UFSTW_IGNORE_GUARANTEE_BIT=y +#endif + +#temp enable RTB log for debug ,Should be remove in release version +CONFIG_QCOM_RTB=y +CONFIG_QCOM_RTB_SEPARATE_CPUS=y + +#ifdef VENDOR_EDIT +#add for kernel system +CONFIG_OPLUS_FEATURE_PROJECTINFO=y +#endif + +#BSP.Kernel.Stability, 2020/12/14, add uboot log +CONFIG_OPLUS_FEATURE_UBOOT_LOG=y + +#ifdef OPLUS_FEATURE_UIFIRST +CONFIG_CAMERA_OPT=y +#endif /*OPLUS_FEATURE_UIFIRST*/ + +#ifdef OPLUS_FEATURE_ION_BOOSTPOOL +#Hailong.Liu@BSP.Kernel.MM, 2020/11/19, add ion boostpool. +CONFIG_OPLUS_ION_BOOSTPOOL=y +#endif /* OPLUS_FEATURE_ION_BOOSTPOOL */ + +#Add for NandSwap +CONFIG_NANDSWAP=y +#CONFIG_NANDSWAP_DEBUG=y diff --git a/arch/arm64/configs/vendor/atoll_defconfig b/arch/arm64/configs/vendor/atoll_defconfig index 2a26b60748e5..f4b634676232 100644 --- a/arch/arm64/configs/vendor/atoll_defconfig +++ b/arch/arm64/configs/vendor/atoll_defconfig @@ -67,8 +67,12 @@ CONFIG_PCI_MSM=y CONFIG_SCHED_MC=y CONFIG_NR_CPUS=8 CONFIG_PREEMPT=y -CONFIG_HZ_100=y CONFIG_MEMORY_HOTPLUG=y +#ifdef OPLUS_FEATURE_HEALTHINFO +#wenbin.liu@PSW.BSP.MM, 2018/06/14 Delete for improve performance +#CONFIG_HZ_100=y +CONFIG_HZ_250=y +#endif /* OPLUS_FEATURE_HEALTHINFO */ CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE=y CONFIG_MEMORY_HOTPLUG_MOVABLE_NODE=y CONFIG_MEMORY_HOTREMOVE=y @@ -266,6 +270,11 @@ CONFIG_CFG80211_INTERNAL_REGDB=y # CONFIG_CFG80211_CRDA_SUPPORT is not set CONFIG_RFKILL=y CONFIG_NFC_NQ=y +#ifdef OPLUS_NFC_BRINGUP +#DengWeiwei@CONNECTIVITY.NFC.HARDWARE.253154, 2020/08/09 +#Add for the kernel Macro for NXP PN557 NFC kernel +CONFIG_NFC_PN553_DEVICES=y +#endif /*OPLUS_NFC_BRINGUP*/ CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y CONFIG_REGMAP_WCD_IRQ=y CONFIG_REGMAP_ALLOW_WRITE_DEBUGFS=y @@ -332,32 +341,67 @@ CONFIG_CLD_LL_CORE=y CONFIG_CNSS_GENL=y CONFIG_INPUT_EVDEV=y CONFIG_KEYBOARD_GPIO=y +#ifdef VENDOR_EDIT +#/*lizhijie@BSP.CHG.Basic, 2020/02/25, Add for Joystick */ +CONFIG_INPUT_JOYSTICK=y +CONFIG_JOYSTICK_XPAD=y +CONFIG_JOYSTICK_XPAD_FF=y +CONFIG_JOYSTICK_XPAD_LEDS=y +#endif /* VENDOR_EDIT */ # CONFIG_INPUT_MOUSE is not set CONFIG_INPUT_JOYSTICK=y CONFIG_JOYSTICK_XPAD=y CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_ATMEL_MXT=y -CONFIG_TOUCHSCREEN_ST=y -CONFIG_TOUCHSCREEN_HIMAX_CHIPSET=y -CONFIG_TOUCHSCREEN_HIMAX_I2C=y -CONFIG_TOUCHSCREEN_HIMAX_INCELL=y -CONFIG_TOUCHSCREEN_HIMAX_IC_HX83112=y -CONFIG_TOUCHSCREEN_HIMAX_DEBUG=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_CORE=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_RMI_DEV=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE_EXTRA_SYSFS=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_TEST_REPORTING=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_CORE=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TOUCH=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DEVICE=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TESTING=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_REFLASH=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_RECOVERY=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_ZEROFLASH=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DIAGNOSTICS=y + +#ifdef VENDOR_EDIT +#Qicai.gu@Bsp.Group.Tp, 2020/02/26, Add for oppo project +#CONFIG_TOUCHSCREEN_ATMEL_MXT=y +#CONFIG_TOUCHSCREEN_ST=y +#CONFIG_TOUCHSCREEN_HIMAX_CHIPSET=y +#CONFIG_TOUCHSCREEN_HIMAX_I2C=y +#CONFIG_TOUCHSCREEN_HIMAX_INCELL=y +#CONFIG_TOUCHSCREEN_HIMAX_IC_HX83112=y +#CONFIG_TOUCHSCREEN_HIMAX_DEBUG=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_CORE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_RMI_DEV=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE_EXTRA_SYSFS=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_TEST_REPORTING=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_CORE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TOUCH=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DEVICE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TESTING=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_REFLASH=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_RECOVERY=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_ZEROFLASH=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DIAGNOSTICS=y + +CONFIG_TOUCHPANEL_OPPO=y +CONFIG_TOUCHPANEL_GOODIX=y +CONFIG_TOUCHPANEL_GOODIX_GT9886=y +CONFIG_TOUCHIRQ_UPDATE_QOS=y + +#ifdef OPLUS_FEATURE_TP_BASIC +#Qicai.gu add for FT3518 BSP.TP 2020/8/9 +CONFIG_TOUCHPANEL_FOCAL=y +CONFIG_TOUCHPANEL_FOCAL_FT3518=y +#endif /*OPLUS_FEATURE_TP_BASIC*/ + +#zhaifeibiao@ODM_LQ@BSP.touch,2020/11/03,Add for oppo project +CONFIG_TOUCHPANEL_NOVA_NT36672C_NOFLASH=y +CONFIG_TOUCHPANEL_NOVA=y +CONFIG_TOUCHPANEL_NEW_SET_IRQ_WAKE=y +#ifdef VENDOR_EDIT +#lujiang.yu add for 567 BSP.TP 2020/4/3 +CONFIG_TOUCHPANEL_SAMSUNG=y +CONFIG_TOUCHPANEL_SAMSUNG_S6SY771=y +#endif + +#CONFIG_TOUCHPANEL_NEW_SET_IRQ_WAKE=y +#endif + CONFIG_INPUT_MISC=y CONFIG_INPUT_QPNP_POWER_ON=y CONFIG_INPUT_UINPUT=y @@ -399,8 +443,42 @@ CONFIG_QCOM_DLOAD_MODE=y CONFIG_POWER_RESET_XGENE=y CONFIG_POWER_RESET_SYSCON=y CONFIG_QPNP_QG=y -CONFIG_SMB1355_SLAVE_CHARGER=y +#ifdef VENDOR_EDIT +#/* lizhijie@BSP.CHG.Basic, 2020/02/25, Modify for charging */ +#CONFIG_SMB1355_SLAVE_CHARGER=y +#endif CONFIG_QPNP_SMB5=y +#ifdef VENDOR_EDIT +#/* lizhijie@BSP.CHG.Basic, 2020/02/25, Modify for charging */ +CONFIG_OPPO_SMOOTH_SOC=y +CONFIG_OPPO_SM7125R_CHARGER=y +CONFIG_OPPO_CHIP_SOC_NODE=y +CONFIG_OPPO_SHORT_HW_CHECK=y +CONFIG_OPPO_SHORT_USERSPACE=y +CONFIG_OPPO_SHIP_MODE_SUPPORT=y +CONFIG_OPPO_SMART_CHARGER_SUPPORT=y +CONFIG_OPPO_SHORT_C_BATT_CHECK=y +CONFIG_OPPO_CHECK_CHARGERID_VOLT=y +CONFIG_OPPO_SHORT_IC_CHECK=y +CONFIG_OPPO_CALL_MODE_SUPPORT=y +CONFIG_HID_SONY=y +CONFIG_SONY_FF=y +CONFIG_HID_BETOP_FF=y +CONFIG_OPLUS_CHARGER=y +CONFIG_OPLUS_SM7125R_CHARGER=y +CONFIG_OPLUS_CHIP_SOC_NODE=y +CONFIG_OPLUS_SHORT_HW_CHECK=y +CONFIG_OPLUS_SHORT_USERSPACE=y +CONFIG_OPLUS_SHIP_MODE_SUPPORT=y +CONFIG_OPLUS_SMART_CHARGER_SUPPORT=y +CONFIG_OPLUS_SHORT_C_BATT_CHECK=y +CONFIG_OPLUS_CHECK_CHARGERID_VOLT=y +CONFIG_OPLUS_SHORT_IC_CHECK=y +CONFIG_OPLUS_CALL_MODE_SUPPORT=y +CONFIG_OPLUS_SMOOTH_SOC=y +CONFIG_OPLUS_WPC_INTERFACE_ENABLE=y +CONFIG_OPLUS_CHARGER_OPTIGA=y +#endif CONFIG_SMB1390_CHARGE_PUMP_PSY=y CONFIG_SMB1398_CHARGER=y CONFIG_THERMAL=y @@ -713,6 +791,12 @@ CONFIG_EXT4_FS=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y CONFIG_EXT4_ENCRYPTION=y +CONFIG_EXT4_FS_ENCRYPTION=y +CONFIG_EXT4_FS_ICE_ENCRYPTION=y +#ifdef OPLUS_FEATURE_EXFAT_SUPPORT//huyu@BSP.Storage,add 2020/5/8 for kernel 4.19 exfat +CONFIG_NLS_UTF8=y +CONFIG_EXFAT_FS=y +# endif CONFIG_F2FS_FS=y CONFIG_F2FS_FS_SECURITY=y CONFIG_F2FS_FS_ENCRYPTION=y @@ -834,3 +918,163 @@ CONFIG_CRYPTO_AES_ARM64_CE_CCM=y CONFIG_CRYPTO_AES_ARM64_CE_BLK=y CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y CONFIG_XZ_DEC=y + +#ifdef VENDOR_EDIT +#/*ye.zhang@BSP.Bootloader.Bootflow, 2020-6-18, Add for oppo project*/ +CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE=y +CONFIG_OPPO_COMMON_SOFT=y +CONFIG_OPPO_DEVICE_IFNO=y +CONFIG_OPLUS_RF_CABLE_MONITOR=y +#endif + +#ifdef OPLUS_FEATURE_TP_BASIC +#Qicai.Gu@BSP.TP, 2020/08/25, modify for sim detect +CONFIG_SIM_DETECT=y +#endif + +#ifdef VENDOR_EDIT +#huangjianan@TECH.Storage.FS, 2020/06/03, Add for fs feature +CONFIG_OPLUS_FEATURE_OF2FS=y +CONFIG_OPLUS_FEATURE_PANIC_FLUSH=y +#endif + +#ifdef OPLUS_FEATURE_QCOM_PMICWD +#shukai@BSP.Kernel.Stability, 2020/08/06, Add for qcom pmic watchdog +CONFIG_OPLUS_FEATURE_QCOM_PMICWD=y +#endif +CONFIG_OPLUS_FEATURE_DUMP_DEVICE_INFO=y +#ifdef OPLUS_SYSTEM_KERNEL +#wen.luo@BSP.Kernel.Stability, 2020/03/26, all system oplus feature writer here +CONFIG_OPLUS_FEATURE_PHOENIX=y +CONFIG_DETECT_HUNG_TASK=y +CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE=y +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=60 +#endif + +#zoulian@BSP.Fingerprint.Basic, 2020/03/02, add for fingerprint driver +#ifdef OPLUS_FEATURE_FINGERPRINT +CONFIG_OPPO_FINGERPRINT=y +CONFIG_OPPO_FINGERPRINT_QCOM=y +CONFIG_OPPO_FINGERPRINT_GOODIX_OPTICAL=y +CONFIG_OPPO_FINGERPRINT_JIIOV_OPTICAL=y +#endif + +#fei.zhang@BSP.Kernel.Stability, 2020/03/31, Add for shutdown detect +CONFIG_OPLUS_FEATURE_SHUTDOWN_DETECT=y + +#runyu.ouyang@BSP.Kernel.Stability, 2020/04/03, add slabtrace function +CONFIG_OPLUS_FEATURE_SLABTRACE_DEBUG=y + +CONFIG_OPLUS_FEATURE_OPROJECT=y + +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY +#/*Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler*/ +CONFIG_OPLUS_POWER_QCOM=y +CONFIG_OPLUS_WAKELOCK_PROFILER=y +#endif + +#ifdef OPLUS_FEATURE_MODEM_MINIDUMP +#ChenWeidong@NETWORK.RF, 2019/12/05, add for modem crash str save +CONFIG_OPLUS_FEATURE_RECORD_MDMRST=y +#endif + +#ifdef OPLUS_FEATURE_ACM +#Yuwei.Guan@BSP.Kernel.FS,2020/07/08, Add for acm +CONFIG_OPLUS_FEATURE_ACM=y +CONFIG_OPLUS_FEATURE_ACM_LOGGING=y +#endif /* OPLUS_FEATURE_ACM */ + +#ifdef OPLUS_FEATURE_HEALTHINFO +#/* Liujie.Xie@TECH.Kernel.Sched, 2020-05-20, add jank info monitor support*/ +CONFIG_OPPO_JANK_INFO=y +#endif /* OPLUS_FEATURE_HEALTHINFO */ +#ifdef OPLUS_FEATURE_HEALTHINFO +#/* Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-07-07, add alloc wait monitor support*/ +CONFIG_OPPO_MEM_MONITOR=y +CONFIG_FG_TASK_UID=y +CONFIG_OPPO_HEALTHINFO=y +CONFIG_SLUB_DEBUG=y +CONFIG_SCHEDSTATS=y +#endif /* OPLUS_FEATURE_HEALTHINFO */ + +#ifdef OPLUS_FEATURE_MULTI_KSWAPD +CONFIG_OPLUS_MULTI_KSWAPD=y +#endif /*OPLUS_FEATURE_MULTI_KSWAPD*/ + +#ifdef OPLUS_FEATURE_ZRAM_OPT +CONFIG_OPLUS_ZRAM_OPT=y +CONFIG_CRYPTO_LZ4=y +CONFIG_PGTABLE_MAPPING=y +#endif /*OPLUS_FEATURE_ZRAM_OPT*/ + +#ifdef OPLUS_FEATURE_FG_IO_OPT +#wangtao@BSP.Kernel.mm 2020/08/24, increase priority of foreground IO +CONFIG_OPPO_FG_IO_OPT=y +#endif + +#ifdef OPLUS_FEATURE_IOMONITOR +CONFIG_IOMONITOR=y +CONFIG_IOMONITOR_WITH_F2FS=y +#endif /*OPLUS_FEATURE_IOMONITOR*/ + +#ifdef OPLUS_FEATURE_LOWMEM_DBG +#Hailong.Liu@BSP.Kernel.MM, 2020/06/19, Add for dump memory usage when lowmmem occurs. +CONFIG_OPLUS_FEATURE_LOWMEM_DBG=y +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ + +#ifdef OPLUS_FEATURE_HANS_FREEZE +#Kun.Zhou@ROM.Framework, 2019/09/23, add for hans freeze manager +CONFIG_OPPO_HANS=y +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ + +#Jiang.Li@TECH.BSP.Stability.PMIC_MONITOR, 2020/04/22 +CONFIG_OPLUS_FEATURE_PMIC_MONITOR=y + +#ifdef OPLUS_BUG_STABILITY +#zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info +CONFIG_PSTORE=y +CONFIG_PSTORE_CONSOLE=y +CONFIG_PSTORE_PMSG=y +CONFIG_PSTORE_RAM=y +#endif + +#Fuchun.Liao@BSP.CHG.Basic 2020/04/09 add for qcom minidump customized +CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE=y + +#ifdef OPLUS_FEATURE_ABNORMAL_CPU +#/* Kun.Zhou@ANDROID.PWS, 2020/08/05, Add for BG CPU abnormal detection */ +CONFIG_CFS_BANDWIDTH=y +#endif /* OPLUS_FEATURE_ABNORMAL_CPU * + +#ifdef VENDOR_EDIT +#/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +CONFIG_UFSFEATURE=y +CONFIG_UFSHPB=y +CONFIG_UFSTW=y +#CONFIG_UFSTW_DEBUGDRV=y +CONFIG_HPB_SUP_ONLY_4=y +CONFIG_HPB_SUP_8_TO_32=y +CONFIG_HPB_SUP_OVER_36=y +CONFIG_UFSTW_IGNORE_GUARANTEE_BIT=y +#endif + +#ifdef VENDOR_EDIT +#add for kernel system +CONFIG_OPLUS_FEATURE_PROJECTINFO=y +#endif + +#BSP.Kernel.Stability, 2020/12/14, add uboot log +CONFIG_OPLUS_FEATURE_UBOOT_LOG=y + +#ifdef OPLUS_FEATURE_UIFIRST +CONFIG_CAMERA_OPT=y +#endif /*OPLUS_FEATURE_UIFIRST*/ + +#ifdef OPLUS_FEATURE_ION_BOOSTPOOL +#Hailong.Liu@BSP.Kernel.MM, 2020/11/19, add ion boostpool. +CONFIG_OPLUS_ION_BOOSTPOOL=y +#endif /* OPLUS_FEATURE_ION_BOOSTPOOL */ + +#Add for NandSwap +CONFIG_NANDSWAP=y +#CONFIG_NANDSWAP_DEBUG=y diff --git a/arch/arm64/configs/vendor/sdmsteppe-perf_defconfig b/arch/arm64/configs/vendor/sdmsteppe-perf_defconfig index f0d00e44ff7d..39f6d520bebc 100644 --- a/arch/arm64/configs/vendor/sdmsteppe-perf_defconfig +++ b/arch/arm64/configs/vendor/sdmsteppe-perf_defconfig @@ -322,18 +322,25 @@ CONFIG_KEYBOARD_GPIO=y CONFIG_INPUT_JOYSTICK=y CONFIG_JOYSTICK_XPAD=y CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_ST=y -CONFIG_TOUCHSCREEN_HIMAX_CHIPSET=y -CONFIG_TOUCHSCREEN_HIMAX_I2C=y -CONFIG_TOUCHSCREEN_HIMAX_INCELL=y -CONFIG_TOUCHSCREEN_HIMAX_IC_HX83112=y -CONFIG_TOUCHSCREEN_HIMAX_DEBUG=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_CORE=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_RMI_DEV=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE_EXTRA_SYSFS=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_TEST_REPORTING=y +#ifndef OPLUS_FEATURE_TP_BASIC //ZhongWenjie@BSP.group 2019-03-29 add for enable tp function +#CONFIG_TOUCHSCREEN_ST=y +#CONFIG_TOUCHSCREEN_HIMAX_CHIPSET=y +#CONFIG_TOUCHSCREEN_HIMAX_I2C=y +#CONFIG_TOUCHSCREEN_HIMAX_INCELL=y +#CONFIG_TOUCHSCREEN_HIMAX_IC_HX83112=y +#CONFIG_TOUCHSCREEN_HIMAX_DEBUG=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_CORE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_RMI_DEV=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE_EXTRA_SYSFS=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_TEST_REPORTING=y +#else //OPLUS_FEATURE_TP_BASIC +CONFIG_TOUCHPANEL_OPPO=y +CONFIG_TOUCHPANEL_SYNAPTICS=y +CONFIG_TOUCHPANEL_SYNAPTICS_S3706=y +CONFIG_TOUCHIRQ_UPDATE_QOS=y +#endif //OPLUS_FEATURE_TP_BASIC CONFIG_INPUT_MISC=y CONFIG_INPUT_QPNP_POWER_ON=y CONFIG_INPUT_UINPUT=y @@ -371,9 +378,28 @@ CONFIG_POWER_RESET_QCOM=y CONFIG_QCOM_DLOAD_MODE=y CONFIG_POWER_RESET_XGENE=y CONFIG_POWER_RESET_SYSCON=y -CONFIG_QPNP_QG=y -CONFIG_SMB1355_SLAVE_CHARGER=y +#CONFIG_QPNP_QG=y +#CONFIG_SMB1355_SLAVE_CHARGER=y CONFIG_QPNP_SMB5=y +#ifdef VENDOR_EDIT +#/* lizhijie@BSP.CHG.Basic, 2020/02/25, Modify for charging */ +CONFIG_OPLUS_CHARGER=y +CONFIG_OPLUS_SM7150R_CHARGER=y +CONFIG_OPLUS_CHIP_SOC_NODE=y +CONFIG_OPLUS_SHORT_HW_CHECK=y +CONFIG_OPLUS_SHORT_USERSPACE=y +CONFIG_OPLUS_SHIP_MODE_SUPPORT=y +CONFIG_OPLUS_SMART_CHARGER_SUPPORT=y +CONFIG_OPLUS_SHORT_C_BATT_CHECK=y +CONFIG_OPLUS_CHECK_CHARGERID_VOLT=y +CONFIG_OPLUS_SHORT_IC_CHECK=y +CONFIG_OPLUS_CALL_MODE_SUPPORT=y +CONFIG_OPLUS_SMOOTH_SOC=y +#CONFIG_OPLUS_WPC_INTERFACE_ENABLE is not set +CONFIG_HID_SONY=y +CONFIG_SONY_FF=y +CONFIG_HID_BETOP_FF=y +#endif CONFIG_SMB1390_CHARGE_PUMP_PSY=y CONFIG_THERMAL=y CONFIG_THERMAL_WRITABLE_TRIPS=y @@ -566,9 +592,12 @@ CONFIG_MSM_QMP=y CONFIG_IOMMU_IO_PGTABLE_FAST=y CONFIG_ARM_SMMU=y CONFIG_QCOM_LAZY_MAPPING=y -CONFIG_IOMMU_DEBUG=y -CONFIG_IOMMU_DEBUG_TRACKING=y -CONFIG_IOMMU_TESTS=y +# ifdef OPLUS_BUG_STABILITY +# rendong.shi@BSP.kernel.debug,2017/5/20,remove for some secure issue from qcom request +# CONFIG_IOMMU_DEBUG is not set +# CONFIG_IOMMU_DEBUG_TRACKING is not set +# CONFIG_IOMMU_TESTS is not set +# endif CONFIG_RPMSG_CHAR=y CONFIG_RPMSG_QCOM_GLINK_SMEM=y CONFIG_RPMSG_QCOM_GLINK_SPI=y @@ -661,6 +690,12 @@ CONFIG_EXT4_FS=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y CONFIG_EXT4_ENCRYPTION=y +CONFIG_EXT4_FS_ENCRYPTION=y +CONFIG_EXT4_FS_ICE_ENCRYPTION=y +#ifdef OPLUS_FEATURE_EXFAT_SUPPORT//huyu@BSP.Storage,add 2020/5/8 for kernel 4.19 exfat +CONFIG_NLS_UTF8=y +CONFIG_EXFAT_FS=y +# endif CONFIG_F2FS_FS=y CONFIG_F2FS_FS_SECURITY=y CONFIG_F2FS_FS_ENCRYPTION=y @@ -726,3 +761,81 @@ CONFIG_CRYPTO_AES_ARM64_CE_CCM=y CONFIG_CRYPTO_AES_ARM64_CE_BLK=y CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y CONFIG_STACK_HASH_ORDER_SHIFT=12 +#ifdef VENDOR_EDIT +#/*ye.zhang@BSP.Bootloader.Bootflow, 2020-6-18, Add for oppo project*/ +CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE=y +CONFIG_OPPO_COMMON_SOFT=y +CONFIG_OPPO_DEVICE_IFNO=y +CONFIG_OPPO_MOTOR=y +CONFIG_MOTOR_DETECT_QOS=y +CONFIG_MOTOR_CLASS_INTERFACE=y +#CONFIG_OPLUS_RF_CABLE_MONITOR=y +#endif + +#ifdef OPLUS_BUG_STABILITY +#zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info +CONFIG_PSTORE=y +CONFIG_PSTORE_CONSOLE=y +CONFIG_PSTORE_PMSG=y +CONFIG_PSTORE_RAM=y +#endif + +#/*bajrang.patidar@BSP.Bootloader.Bootflow, 2020-08-18, Add for oppo project*/ +CONFIG_OPLUS_FEATURE_OPROJECT=y + +#ifdef OPLUS_FEATURE_MODEM_MINIDUMP +#ChenWeidong@NETWORK.RF, 2019/12/05, add for modem crash str save +CONFIG_OPLUS_FEATURE_RECORD_MDMRST=y +#endif +#Fuchun.Liao@BSP.CHG.Basic 2020/04/09 add for qcom minidump customized +CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE=y + +#ifdef OPLUS_FEATURE_HEALTHINFO +#/* Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-07-07, add alloc wait monitor support*/ +CONFIG_OPPO_MEM_MONITOR=y +CONFIG_FG_TASK_UID=y +CONFIG_OPPO_HEALTHINFO=y +CONFIG_SLUB_DEBUG=y +CONFIG_SCHEDSTATS=y +#endif /* OPLUS_FEATURE_HEALTHINFO */ + +#ifdef OPLUS_FEATURE_HANS_FREEZE +#Kun.Zhou@ROM.Framework, 2019/09/23, add for hans freeze manager +CONFIG_OPPO_HANS=y +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ + +#ifdef OPLUS_FEATURE_QCOM_PMICWD +#shukai@BSP.Kernel.Stability, 2020/08/06, Add for qcom pmic watchdog +CONFIG_OPLUS_FEATURE_QCOM_PMICWD=y +#endif +#ifdef OPLUS_SYSTEM_KERNEL +#wen.luo@BSP.Kernel.Stability, 2020/03/26, all system oplus feature writer here +CONFIG_OPLUS_FEATURE_PHOENIX=y +CONFIG_DETECT_HUNG_TASK=y +CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE=y +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=60 +#endif + +#Jiang.Li@TECH.BSP.Stability.PMIC_MONITOR, 2020/04/22 +CONFIG_OPLUS_FEATURE_PMIC_MONITOR=y + +#runyu.ouyang@BSP.Kernel.Stability, 2020/04/03, add slabtrace function +#CONFIG_OPLUS_FEATURE_SLABTRACE_DEBUG=y + +#ifdef VENDOR_EDIT +#huangjianan@TECH.Storage.FS, 2020/06/03, Add for fs feature +CONFIG_OPLUS_FEATURE_OF2FS=y +CONFIG_OPLUS_FEATURE_PANIC_FLUSH=y +#endif + +#ifdef OPLUS_FEATURE_FINGERPRINT +#hemant.jeengar@BSP.Fingerprint.Basic, 2020/09/24, add for fingerprint driver +CONFIG_OPPO_FINGERPRINT=y +CONFIG_OPPO_FINGERPRINT_QCOM=y +CONFIG_OPPO_FINGERPRINT_GOODIX_OPTICAL=y +#endif + +#ifdef VENDOR_EDIT +#yufeng@camera, 2019/05/13, Add for oppo project +CONFIG_REGULATOR_PM8008=y +#endif diff --git a/arch/arm64/configs/vendor/sdmsteppe_defconfig b/arch/arm64/configs/vendor/sdmsteppe_defconfig index 48dbf00e09b1..6d73f96da9c4 100644 --- a/arch/arm64/configs/vendor/sdmsteppe_defconfig +++ b/arch/arm64/configs/vendor/sdmsteppe_defconfig @@ -331,27 +331,34 @@ CONFIG_KEYBOARD_GPIO=y CONFIG_INPUT_JOYSTICK=y CONFIG_JOYSTICK_XPAD=y CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_ST=y -CONFIG_TOUCHSCREEN_HIMAX_CHIPSET=y -CONFIG_TOUCHSCREEN_HIMAX_I2C=y -CONFIG_TOUCHSCREEN_HIMAX_INCELL=y -CONFIG_TOUCHSCREEN_HIMAX_IC_HX83112=y -CONFIG_TOUCHSCREEN_HIMAX_DEBUG=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_CORE=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_RMI_DEV=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE_EXTRA_SYSFS=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_TEST_REPORTING=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_CORE=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TOUCH=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DEVICE=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TESTING=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_REFLASH=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_RECOVERY=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_ZEROFLASH=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DIAGNOSTICS=y +#ifndef OPLUS_FEATURE_TP_BASIC //ZhongWenjie@BSP.group 2019-03-29 add for enable tp function +#CONFIG_TOUCHSCREEN_ST=y +#CONFIG_TOUCHSCREEN_HIMAX_CHIPSET=y +#CONFIG_TOUCHSCREEN_HIMAX_I2C=y +#CONFIG_TOUCHSCREEN_HIMAX_INCELL=y +#CONFIG_TOUCHSCREEN_HIMAX_IC_HX83112=y +#CONFIG_TOUCHSCREEN_HIMAX_DEBUG=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_CORE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_RMI_DEV=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE_EXTRA_SYSFS=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_TEST_REPORTING=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_CORE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TOUCH=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DEVICE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TESTING=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_REFLASH=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_RECOVERY=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_ZEROFLASH=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DIAGNOSTICS=y +#else //OPLUS_FEATURE_TP_BASIC +CONFIG_TOUCHPANEL_OPPO=y +CONFIG_TOUCHPANEL_SYNAPTICS=y +CONFIG_TOUCHPANEL_SYNAPTICS_S3706=y +CONFIG_TOUCHIRQ_UPDATE_QOS=y +#endif //OPLUS_FEATURE_TP_BASIC CONFIG_INPUT_MISC=y CONFIG_INPUT_QPNP_POWER_ON=y CONFIG_INPUT_UINPUT=y @@ -392,9 +399,28 @@ CONFIG_POWER_RESET_QCOM=y CONFIG_QCOM_DLOAD_MODE=y CONFIG_POWER_RESET_XGENE=y CONFIG_POWER_RESET_SYSCON=y -CONFIG_QPNP_QG=y -CONFIG_SMB1355_SLAVE_CHARGER=y +#CONFIG_QPNP_QG=y +#CONFIG_SMB1355_SLAVE_CHARGER=y CONFIG_QPNP_SMB5=y +#ifdef VENDOR_EDIT +#/* lizhijie@BSP.CHG.Basic, 2020/02/25, Modify for charging */ +CONFIG_OPLUS_CHARGER=y +CONFIG_OPLUS_SM7150R_CHARGER=y +CONFIG_OPLUS_CHIP_SOC_NODE=y +CONFIG_OPLUS_SHORT_HW_CHECK=y +CONFIG_OPLUS_SHORT_USERSPACE=y +CONFIG_OPLUS_SHIP_MODE_SUPPORT=y +CONFIG_OPLUS_SMART_CHARGER_SUPPORT=y +CONFIG_OPLUS_SHORT_C_BATT_CHECK=y +CONFIG_OPLUS_CHECK_CHARGERID_VOLT=y +CONFIG_OPLUS_SHORT_IC_CHECK=y +CONFIG_OPLUS_CALL_MODE_SUPPORT=y +CONFIG_OPLUS_SMOOTH_SOC=y +#CONFIG_OPLUS_WPC_INTERFACE_ENABLE is not set +CONFIG_HID_SONY=y +CONFIG_SONY_FF=y +CONFIG_HID_BETOP_FF=y +#endif CONFIG_SMB1390_CHARGE_PUMP_PSY=y CONFIG_THERMAL=y CONFIG_THERMAL_WRITABLE_TRIPS=y @@ -699,6 +725,10 @@ CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y CONFIG_EXT4_ENCRYPTION=y CONFIG_F2FS_FS=y +#ifdef OPLUS_FEATURE_EXFAT_SUPPORT//huyu@BSP.Storage,add 2020/5/8 for kernel 4.19 exfat +CONFIG_NLS_UTF8=y +CONFIG_EXFAT_FS=y +# endif CONFIG_F2FS_FS_SECURITY=y CONFIG_F2FS_FS_ENCRYPTION=y CONFIG_FS_ENCRYPTION_INLINE_CRYPT=y @@ -723,7 +753,7 @@ CONFIG_NLS_ISO8859_1=y CONFIG_PRINTK_TIME=y CONFIG_DYNAMIC_DEBUG=y CONFIG_DEBUG_MODULE_LOAD_INFO=y -CONFIG_DEBUG_CONSOLE_UNHASHED_POINTERS=y +# CONFIG_DEBUG_CONSOLE_UNHASHED_POINTERS is not set CONFIG_DEBUG_INFO=y CONFIG_PAGE_OWNER=y CONFIG_PAGE_OWNER_ENABLE_DEFAULT=y @@ -819,3 +849,82 @@ CONFIG_CRYPTO_AES_ARM64_CE_CCM=y CONFIG_CRYPTO_AES_ARM64_CE_BLK=y CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y CONFIG_XZ_DEC=y + +#ifdef VENDOR_EDIT +#/*ye.zhang@BSP.Bootloader.Bootflow, 2020-6-18, Add for oppo project*/ +CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE=y +CONFIG_OPPO_COMMON_SOFT=y +CONFIG_OPPO_DEVICE_IFNO=y +CONFIG_OPPO_MOTOR=y +CONFIG_MOTOR_DETECT_QOS=y +CONFIG_MOTOR_CLASS_INTERFACE=y +#CONFIG_OPLUS_RF_CABLE_MONITOR=y +#endif + +#ifdef OPLUS_BUG_STABILITY +#zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info +CONFIG_PSTORE=y +CONFIG_PSTORE_CONSOLE=y +CONFIG_PSTORE_PMSG=y +CONFIG_PSTORE_RAM=y +#endif + +#/*bajrang.patidar@BSP.Bootloader.Bootflow, 2020-08-18, Add for oppo project*/ +CONFIG_OPLUS_FEATURE_OPROJECT=y + +#ifdef OPLUS_FEATURE_MODEM_MINIDUMP +#ChenWeidong@NETWORK.RF, 2019/12/05, add for modem crash str save +CONFIG_OPLUS_FEATURE_RECORD_MDMRST=y +#endif +#Fuchun.Liao@BSP.CHG.Basic 2020/04/09 add for qcom minidump customized +CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE=y + +#ifdef OPLUS_FEATURE_HEALTHINFO +#/* Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-07-07, add alloc wait monitor support*/ +CONFIG_OPPO_MEM_MONITOR=y +CONFIG_FG_TASK_UID=y +CONFIG_OPPO_HEALTHINFO=y +CONFIG_SLUB_DEBUG=y +CONFIG_SCHEDSTATS=y +#endif /* OPLUS_FEATURE_HEALTHINFO */ + +#ifdef OPLUS_FEATURE_HANS_FREEZE +#Kun.Zhou@ROM.Framework, 2019/09/23, add for hans freeze manager +CONFIG_OPPO_HANS=y +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ + +#ifdef OPLUS_FEATURE_QCOM_PMICWD +#shukai@BSP.Kernel.Stability, 2020/08/06, Add for qcom pmic watchdog +CONFIG_OPLUS_FEATURE_QCOM_PMICWD=y +#endif +#ifdef OPLUS_SYSTEM_KERNEL +#wen.luo@BSP.Kernel.Stability, 2020/03/26, all system oplus feature writer here +CONFIG_OPLUS_FEATURE_PHOENIX=y +CONFIG_DETECT_HUNG_TASK=y +CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE=y +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=60 +#endif + +#Jiang.Li@TECH.BSP.Stability.PMIC_MONITOR, 2020/04/22 +CONFIG_OPLUS_FEATURE_PMIC_MONITOR=y + +#runyu.ouyang@BSP.Kernel.Stability, 2020/04/03, add slabtrace function +CONFIG_OPLUS_FEATURE_SLABTRACE_DEBUG=y + +#ifdef VENDOR_EDIT +#huangjianan@TECH.Storage.FS, 2020/06/03, Add for fs feature +CONFIG_OPLUS_FEATURE_OF2FS=y +CONFIG_OPLUS_FEATURE_PANIC_FLUSH=y +#endif + +#ifdef OPLUS_FEATURE_FINGERPRINT +#hemant.jeengar@BSP.Fingerprint.Basic, 2020/09/24, add for fingerprint driver +CONFIG_OPPO_FINGERPRINT=y +CONFIG_OPPO_FINGERPRINT_QCOM=y +CONFIG_OPPO_FINGERPRINT_GOODIX_OPTICAL=y +#endif + +#ifdef VENDOR_EDIT +#yufeng@camera, 2019/05/13, Add for oppo project +CONFIG_REGULATOR_PM8008=y +#endif diff --git a/arch/arm64/configs/vendor/sm8150-perf_defconfig b/arch/arm64/configs/vendor/sm8150-perf_defconfig index f1936725ebfa..aeb03bba90eb 100644 --- a/arch/arm64/configs/vendor/sm8150-perf_defconfig +++ b/arch/arm64/configs/vendor/sm8150-perf_defconfig @@ -261,6 +261,13 @@ CONFIG_CFG80211_REG_CELLULAR_HINTS=y CONFIG_CFG80211_INTERNAL_REGDB=y CONFIG_RFKILL=y CONFIG_NFC_NQ=y + +##ifdef OPLUS_FEATURE_BRINGUP +#HuangTengming@CONNECTIVITY.NFC.BASIC.HARDWARE , 2020/05/13, add for : add NFC driver +CONFIG_NFC_PN553_DEVICES=y +CONFIG_NXP_P73_DEVICES=y +#endif /* OPLUS_FEATURE_NFC_BRINGUP */ + CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y CONFIG_REGMAP_ALLOW_WRITE_DEBUGFS=y CONFIG_DMA_CMA=y @@ -332,18 +339,30 @@ CONFIG_KEYBOARD_GPIO=y CONFIG_INPUT_JOYSTICK=y CONFIG_JOYSTICK_XPAD=y CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_ST=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_CORE=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TOUCH=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DEVICE=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TESTING=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_REFLASH=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_RECOVERY=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_ZEROFLASH=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DIAGNOSTICS=y +#ifndef OPLUS_FEATURE_TP_BASIC //wanghao@phone.bsp.tp del for oppo s3706 in 2017-09-20 +#CONFIG_TOUCHSCREEN_ST=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_CORE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TOUCH=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DEVICE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TESTING=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_REFLASH=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_RECOVERY=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_ZEROFLASH=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DIAGNOSTICS=y +#else //OPLUS_FEATURE_TP_BASIC +CONFIG_TOUCHPANEL_OPPO=y +CONFIG_TOUCHPANEL_NOVA=y +CONFIG_TOUCHPANEL_NOVA_NT36672C_NOFLASH=y +CONFIG_TOUCHPANEL_SYNAPTICS=y +CONFIG_TOUCHPANEL_SYNAPTICS_S3706=y +CONFIG_AW8697_HAPTIC=y +CONFIG_TOUCHIRQ_UPDATE_QOS=y +#endif //OPLUS_FEATURE_TP_BASIC CONFIG_INPUT_MISC=y -CONFIG_INPUT_HBTP_INPUT=y +#ifndef OPLUS_FEATURE_TP_BASIC //wanghao@phone.bsp.tp del for oppo s3706 in 2017-09-20 +#CONFIG_INPUT_HBTP_INPUT=y +#endif //OPLUS_FEATURE_TP_BASIC CONFIG_INPUT_QPNP_POWER_ON=y CONFIG_INPUT_QTI_HAPTICS=y CONFIG_INPUT_UINPUT=y @@ -380,9 +399,26 @@ CONFIG_QCOM_DLOAD_MODE=y CONFIG_POWER_RESET_XGENE=y CONFIG_POWER_RESET_SYSCON=y CONFIG_QPNP_FG_GEN4=y -CONFIG_SMB1355_SLAVE_CHARGER=y +#ifdef OPLUS_FEATURE_CHG_BASIC +#/* tongfeng.Huang@BSP.CHG.Basic, 2018/04/14, Modify for charging */ +#CONFIG_SMB1355_SLAVE_CHARGER=y +CONFIG_OPLUS_SM8150R_CHARGER=y +CONFIG_OPLUS_CHIP_SOC_NODE=y CONFIG_QPNP_SMB5=y -CONFIG_QPNP_QNOVO5=y +CONFIG_OPLUS_SHORT_HW_CHECK=y +CONFIG_OPLUS_SHORT_USERSPACE=y +CONFIG_OPLUS_SHIP_MODE_SUPPORT=y +CONFIG_OPLUS_SMART_CHARGER_SUPPORT=y +CONFIG_OPLUS_SHORT_C_BATT_CHECK=y +CONFIG_OPLUS_CHECK_CHARGERID_VOLT=y +CONFIG_OPLUS_SHORT_IC_CHECK=y +CONFIG_OPLUS_CALL_MODE_SUPPORT=y +CONFIG_OPLUS_WPC_INTERFACE_ENABLE=y +CONFIG_HID_SONY=y +CONFIG_SONY_FF=y +CONFIG_HID_BETOP_FF=y +#CONFIG_QPNP_QNOVO5=y +#endif /*OPLUS_FEATURE_CHG_BASIC*/ CONFIG_SMB1390_CHARGE_PUMP_PSY=y CONFIG_THERMAL=y CONFIG_THERMAL_WRITABLE_TRIPS=y @@ -565,9 +601,12 @@ CONFIG_MSM_QMP=y CONFIG_IOMMU_IO_PGTABLE_FAST=y CONFIG_ARM_SMMU=y CONFIG_QCOM_LAZY_MAPPING=y -CONFIG_IOMMU_DEBUG=y -CONFIG_IOMMU_DEBUG_TRACKING=y -CONFIG_IOMMU_TESTS=y +# ifdef OPLUS_BUG_STABILITY +# rendong.shi@BSP.kernel.debug,2017/5/20,remove for some secure issue from qcom request +# CONFIG_IOMMU_DEBUG is not set +# CONFIG_IOMMU_DEBUG_TRACKING is not set +# CONFIG_IOMMU_TESTS is not set +# endif CONFIG_RPMSG_CHAR=y CONFIG_RPMSG_QCOM_GLINK_SMEM=y CONFIG_RPMSG_QCOM_GLINK_SPSS=y @@ -624,6 +663,10 @@ CONFIG_MSM_EVENT_TIMER=y CONFIG_MSM_PM=y CONFIG_MSM_QBT1000=y CONFIG_QCOM_FSA4480_I2C=y +#ifdef OPLUS_ARCH_EXTENDS +#Richeng.Wang@MULTIMEDIA.AUDIODRIVER.HEADSETS, 2020/10/11, Add for max20328 +CONFIG_QCOM_MAX20328_I2C=y +#endif /* OPLUS_ARCH_EXTENDS */ CONFIG_MEM_SHARE_QMI_SERVICE=y CONFIG_RMNET_CTL=y CONFIG_MSM_PERFORMANCE=y @@ -671,6 +714,10 @@ CONFIG_EXT4_FS=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y CONFIG_EXT4_ENCRYPTION=y +#ifdef OPLUS_FEATURE_EXFAT_SUPPORT//huyu@BSP.Storage,add 2020/5/8 for kernel 4.19 exfat +CONFIG_NLS_UTF8=y +CONFIG_EXFAT_FS=y +#endif CONFIG_F2FS_FS=y CONFIG_F2FS_FS_SECURITY=y CONFIG_F2FS_FS_ENCRYPTION=y @@ -737,3 +784,123 @@ CONFIG_CRYPTO_AES_ARM64_CE_CCM=y CONFIG_CRYPTO_AES_ARM64_CE_BLK=y CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y CONFIG_STACK_HASH_ORDER_SHIFT=12 +#ifdef VENDOR_EDIT +#/*ye.zhang@BSP.Bootloader.Bootflow, 2020-6-18, Add for oppo project*/ +CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE=y +CONFIG_OPPO_COMMON_SOFT=y +CONFIG_OPPO_DEVICE_IFNO=y +CONFIG_OPLUS_RF_CABLE_MONITOR=y +#endif +CONFIG_OPLUS_FEATURE_OPROJECT=y +#ifdef VENDOR_EDIT +#/* huangjianan@TECH.Storage.FS, 2020/06/03, Add for fs feature */ +CONFIG_OPLUS_FEATURE_OF2FS=y +#endif +#ifdef OPLUS_FEATURE_HEALTHINFO +#/* Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-07-07, add alloc wait monitor support*/ +CONFIG_OPPO_MEM_MONITOR=y +CONFIG_FG_TASK_UID=y +CONFIG_OPPO_HEALTHINFO=y +CONFIG_SLUB_DEBUG=y +CONFIG_SCHEDSTATS=y +#endif /* OPLUS_FEATURE_HEALTHINFO */ +#ifdef OPLUS_FEATURE_IOMONITOR +CONFIG_IOMONITOR=y +CONFIG_IOMONITOR_WITH_F2FS=y +#endif /*OPLUS_FEATURE_IOMONITOR*/ +#ifdef OPLUS_FEATURE_HEALTHINFO +#/* Liujie.Xie@TECH.Kernel.Sched, 2020-05-20, add jank info monitor support*/ +CONFIG_OPPO_JANK_INFO=y +#endif /* OPLUS_FEATURE_HEALTHINFO */ +CONFIG_OPLUS_FEATURE_PANIC_FLUSH=y +#ifdef OPLUS_FEATURE_TP_BASIC +#Qicai.Gu@BSP.TP, 2020/08/25, modify for sim detect +CONFIG_SIM_DETECT=y +#endif +#ifdef OPLUS_FEATURE_ZRAM_OPT +#/*Hacai.Zhou@Tech.Kernel.mm, add oppo zram opt support*/ +CONFIG_OPLUS_ZRAM_OPT=y +CONFIG_CRYPTO_LZ4=y +CONFIG_PGTABLE_MAPPING=y +#endif /*OPLUS_FEATURE_ZRAM_OPT*/ +#ifdef OPLUS_FEATURE_FG_IO_OPT +#wangtao@BSP.Kernel.mm 2020/08/24, increase priority of foreground IO +CONFIG_OPPO_FG_IO_OPT=y +#endif +#chongdu@BSP.Fingerprint.Basic, 2020-9-1, add for fingerprint driver +#ifdef OPLUS_FEATURE_FINGERPRINT +CONFIG_OPPO_FINGERPRINT=y +CONFIG_OPPO_FINGERPRINT_QCOM=y +CONFIG_OPPO_FINGERPRINT_GOODIX=y +#endif +#ifdef OPLUS_FEATURE_HANS_FREEZE +#Kun.Zhou@ROM.Framework, 2019/09/23, add for hans freeze manager +CONFIG_OPPO_HANS=y +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ +#ifdef OPLUS_FEATURE_MODEM_MINIDUMP +#ChenWeidong@NETWORK.RF, 2019/12/05, add for modem crash str save +CONFIG_OPLUS_FEATURE_RECORD_MDMRST=y +#endif +#Fuchun.Liao@BSP.CHG.Basic 2020/04/09 add for qcom minidump customized +CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE=y +#fei.zhang@BSP.Kernel.Stability, 2020/03/31, Add for shutdown detect +CONFIG_OPLUS_FEATURE_SHUTDOWN_DETECT=y +CONFIG_OPLUS_FEATURE_FEEDBACK=y +#runyu.ouyang@BSP.Kernel.Stability, 2020/04/03, add slabtrace function +CONFIG_SLABTRACE_DEBUG=y +#Jiang.Li@TECH.BSP.Stability.PMIC_MONITOR, 2020/04/22 +CONFIG_OPLUS_FEATURE_PMIC_MONITOR=y +#ifdef OPLUS_FEATURE_QCOM_PMICWD +#shukai@BSP.Kernel.Stability, 2020/08/06, Add for qcom pmic watchdog +CONFIG_OPLUS_FEATURE_QCOM_PMICWD=y +#xupengcheng@MULTIMEDIA.Display.LCD.Stability, 2020/09/23, add for 19696 lcd support power +CONFIG_REGULATOR_KTD2151=y +#xupengcheng@MULTIMEDIA.Display.LCD.Stability, 2020/09/23, add for 19696 lcd backlight +CONFIG_BACKLIGHT_LM3697=y +#endif +#ifdef OPLUS_SYSTEM_KERNEL +#wen.luo@BSP.Kernel.Stability, 2020/03/26, all system oplus feature writer here +CONFIG_OPLUS_FEATURE_PHOENIX=y +CONFIG_DETECT_HUNG_TASK=y +CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE=y +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=60 + + +#ifdef OPLUS_FEATURE_CHG_BASIC +CONFIG_OPPO_MOTOR=y +CONFIG_MOTOR_DETECT_QOS=y +CONFIG_MOTOR_CLASS_INTERFACE=y +#endif +#endif +#zongbao.shang@Cam, 2020/08/06, Add for pm8008 driver +CONFIG_REGULATOR_PM8008=y +#ifdef VENDOR_EDIT +#/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +CONFIG_UFSFEATURE=y +CONFIG_UFSHPB=y +CONFIG_UFSTW=y +#CONFIG_UFSTW_DEBUGDRV=y +CONFIG_HPB_SUP_ONLY_4=y +CONFIG_HPB_SUP_8_TO_32=y +CONFIG_HPB_SUP_OVER_36=y +CONFIG_UFSTW_IGNORE_GUARANTEE_BIT=y +#endif + +#ifdef OPLUS_FEATURE_DUMPDEVICE +#zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info +CONFIG_PSTORE=y +CONFIG_PSTORE_CONSOLE=y +CONFIG_PSTORE_PMSG=y +CONFIG_PSTORE_RAM=y +#endif + +#ifdef OPLUS_FEATURE_LOWMEM_DBG +#Hailong.Liu@BSP.Kernel.MM, 2020/06/19, Add for dump memory usage when lowmmem occurs. +CONFIG_OPLUS_FEATURE_LOWMEM_DBG=y +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ + +#ifdef OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY +#Kui.Zhang@TEC.Kernel.MM, 2019-05-10, add reserved vma for emergency mmap +CONFIG_VIRTUAL_RESERVE_MEMORY=y +#endif /* OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY */ + diff --git a/arch/arm64/configs/vendor/sm8150_defconfig b/arch/arm64/configs/vendor/sm8150_defconfig index cbdc25855310..bec991eafb6b 100644 --- a/arch/arm64/configs/vendor/sm8150_defconfig +++ b/arch/arm64/configs/vendor/sm8150_defconfig @@ -271,6 +271,13 @@ CONFIG_CFG80211_INTERNAL_REGDB=y # CONFIG_CFG80211_CRDA_SUPPORT is not set CONFIG_RFKILL=y CONFIG_NFC_NQ=y + +##ifdef OPLUS_FEATURE_BRINGUP +#HuangTengming@CONNECTIVITY.NFC.BASIC.HARDWARE , 2020/05/13, add for : add NFC driver +CONFIG_NFC_PN553_DEVICES=y +CONFIG_NXP_P73_DEVICES=y +#endif /* OPLUS_FEATURE_NFC_BRINGUP */ + CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y CONFIG_REGMAP_ALLOW_WRITE_DEBUGFS=y CONFIG_DMA_CMA=y @@ -343,18 +350,30 @@ CONFIG_KEYBOARD_GPIO=y CONFIG_INPUT_JOYSTICK=y CONFIG_JOYSTICK_XPAD=y CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_ST=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_CORE=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TOUCH=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DEVICE=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TESTING=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_REFLASH=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_RECOVERY=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_ZEROFLASH=y -CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DIAGNOSTICS=y +#ifndef OPLUS_FEATURE_TP_BASIC //wanghao@phone.bsp.tp del for oppo s3706 in 2017-09-20 +#CONFIG_TOUCHSCREEN_ST=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_CORE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TOUCH=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DEVICE=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_TESTING=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_REFLASH=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_RECOVERY=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_ZEROFLASH=y +#CONFIG_TOUCHSCREEN_SYNAPTICS_TCM_DIAGNOSTICS=y +#else //OPLUS_FEATURE_TP_BASIC +CONFIG_TOUCHPANEL_OPPO=y +CONFIG_TOUCHPANEL_NOVA=y +CONFIG_TOUCHPANEL_NOVA_NT36672C_NOFLASH=y +CONFIG_TOUCHPANEL_SYNAPTICS=y +CONFIG_TOUCHPANEL_SYNAPTICS_S3706=y +CONFIG_AW8697_HAPTIC=y +CONFIG_TOUCHIRQ_UPDATE_QOS=y +#endif //OPLUS_FEATURE_TP_BASIC CONFIG_INPUT_MISC=y -CONFIG_INPUT_HBTP_INPUT=y +#ifndef OPLUS_FEATURE_TP_BASIC //wanghao@phone.bsp.tp del for oppo s3706 in 2017-09-20 +#CONFIG_INPUT_HBTP_INPUT=y +#endif //OPLUS_FEATURE_TP_BASIC CONFIG_INPUT_QPNP_POWER_ON=y CONFIG_INPUT_QTI_HAPTICS=y CONFIG_INPUT_UINPUT=y @@ -394,9 +413,26 @@ CONFIG_QCOM_DLOAD_MODE=y CONFIG_POWER_RESET_XGENE=y CONFIG_POWER_RESET_SYSCON=y CONFIG_QPNP_FG_GEN4=y -CONFIG_SMB1355_SLAVE_CHARGER=y +#ifdef OPLUS_FEATURE_CHG_BASIC +#/* tongfeng.Huang@BSP.CHG.Basic, 2018/04/14, Modify for charging */ +#CONFIG_SMB1355_SLAVE_CHARGER=y +CONFIG_OPLUS_SM8150R_CHARGER=y +CONFIG_OPLUS_CHIP_SOC_NODE=y CONFIG_QPNP_SMB5=y -CONFIG_QPNP_QNOVO5=y +CONFIG_OPLUS_SHORT_HW_CHECK=y +CONFIG_OPLUS_SHORT_USERSPACE=y +CONFIG_OPLUS_SHIP_MODE_SUPPORT=y +CONFIG_OPLUS_SMART_CHARGER_SUPPORT=y +CONFIG_OPLUS_SHORT_C_BATT_CHECK=y +CONFIG_OPLUS_CHECK_CHARGERID_VOLT=y +CONFIG_OPLUS_SHORT_IC_CHECK=y +CONFIG_OPLUS_CALL_MODE_SUPPORT=y +CONFIG_OPLUS_WPC_INTERFACE_ENABLE=y +CONFIG_HID_SONY=y +CONFIG_SONY_FF=y +CONFIG_HID_BETOP_FF=y +#CONFIG_QPNP_QNOVO5=y +#endif /*OPLUS_FEATURE_CHG_BASIC*/ CONFIG_SMB1390_CHARGE_PUMP_PSY=y CONFIG_THERMAL=y CONFIG_THERMAL_WRITABLE_TRIPS=y @@ -651,6 +687,10 @@ CONFIG_MSM_EVENT_TIMER=y CONFIG_MSM_PM=y CONFIG_MSM_QBT1000=y CONFIG_QCOM_FSA4480_I2C=y +#ifdef OPLUS_ARCH_EXTENDS +#Richeng.Wang@MULTIMEDIA.AUDIODRIVER.HEADSETS, 2020/10/11, Add for max20328 +CONFIG_QCOM_MAX20328_I2C=y +#endif /* VENDOR_EDIT */ CONFIG_MEM_SHARE_QMI_SERVICE=y CONFIG_RMNET_CTL=y CONFIG_RMNET_CTL_DEBUG=y @@ -701,6 +741,10 @@ CONFIG_EXT4_FS=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y CONFIG_EXT4_ENCRYPTION=y +#ifdef OPLUS_FEATURE_EXFAT_SUPPORT//huyu@BSP.Storage,add 2020/5/8 for kernel 4.19 exfat +CONFIG_NLS_UTF8=y +CONFIG_EXFAT_FS=y +#endif CONFIG_F2FS_FS=y CONFIG_F2FS_FS_SECURITY=y CONFIG_F2FS_FS_ENCRYPTION=y @@ -822,3 +866,122 @@ CONFIG_CRYPTO_AES_ARM64_CE_CCM=y CONFIG_CRYPTO_AES_ARM64_CE_BLK=y CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y CONFIG_XZ_DEC=y +#ifdef VENDOR_EDIT +#/*ye.zhang@BSP.Bootloader.Bootflow, 2020-6-18, Add for oppo project*/ +CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE=y +CONFIG_OPPO_COMMON_SOFT=y +CONFIG_OPPO_DEVICE_IFNO=y +CONFIG_OPLUS_RF_CABLE_MONITOR=y +#endif +CONFIG_OPLUS_FEATURE_OPROJECT=y +#ifdef VENDOR_EDIT +#/* huangjianan@TECH.Storage.FS, 2020/06/03, Add for fs feature */ +CONFIG_OPLUS_FEATURE_OF2FS=y +#endif +#ifdef OPLUS_FEATURE_HEALTHINFO +#/* Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-07-07, add alloc wait monitor support*/ +CONFIG_OPPO_MEM_MONITOR=y +CONFIG_FG_TASK_UID=y +CONFIG_OPPO_HEALTHINFO=y +CONFIG_SLUB_DEBUG=y +CONFIG_SCHEDSTATS=y +#endif /* OPLUS_FEATURE_HEALTHINFO */ +#ifdef OPLUS_FEATURE_IOMONITOR +CONFIG_IOMONITOR=y +CONFIG_IOMONITOR_WITH_F2FS=y +#endif /*OPLUS_FEATURE_IOMONITOR*/ +#ifdef OPLUS_FEATURE_HEALTHINFO +#/* Liujie.Xie@TECH.Kernel.Sched, 2020-05-20, add jank info monitor support*/ +CONFIG_OPPO_JANK_INFO=y +#endif /* OPLUS_FEATURE_HEALTHINFO */ +CONFIG_OPLUS_FEATURE_PANIC_FLUSH=y +#ifdef OPLUS_FEATURE_TP_BASIC +#Qicai.Gu@BSP.TP, 2020/08/25, modify for sim detect +CONFIG_SIM_DETECT=y +#endif +#ifdef OPLUS_FEATURE_ZRAM_OPT +#/*Hacai.Zhou@Tech.Kernel.mm, add oppo zram opt support*/ +CONFIG_OPLUS_ZRAM_OPT=y +CONFIG_CRYPTO_LZ4=y +CONFIG_PGTABLE_MAPPING=y +#endif /*OPLUS_FEATURE_ZRAM_OPT*/ +#ifdef OPLUS_FEATURE_FG_IO_OPT +#wangtao@BSP.Kernel.mm 2020/08/24, increase priority of foreground IO +CONFIG_OPPO_FG_IO_OPT=y +#endif +#chongdu@BSP.Fingerprint.Basic, 2020-9-1, add for fingerprint driver +#ifdef OPLUS_FEATURE_FINGERPRINT +CONFIG_OPPO_FINGERPRINT=y +CONFIG_OPPO_FINGERPRINT_QCOM=y +CONFIG_OPPO_FINGERPRINT_GOODIX=y +#endif +#ifdef OPLUS_FEATURE_HANS_FREEZE +#Kun.Zhou@ROM.Framework, 2019/09/23, add for hans freeze manager +CONFIG_OPPO_HANS=y +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ +#ifdef OPLUS_FEATURE_MODEM_MINIDUMP +#ChenWeidong@NETWORK.RF, 2019/12/05, add for modem crash str save +CONFIG_OPLUS_FEATURE_RECORD_MDMRST=y +#endif +#Fuchun.Liao@BSP.CHG.Basic 2020/04/09 add for qcom minidump customized +CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE=y +#fei.zhang@BSP.Kernel.Stability, 2020/03/31, Add for shutdown detect +CONFIG_OPLUS_FEATURE_SHUTDOWN_DETECT=y +CONFIG_OPLUS_FEATURE_FEEDBACK=y +#runyu.ouyang@BSP.Kernel.Stability, 2020/04/03, add slabtrace function +CONFIG_SLABTRACE_DEBUG=y +#Jiang.Li@TECH.BSP.Stability.PMIC_MONITOR, 2020/04/22 +CONFIG_OPLUS_FEATURE_PMIC_MONITOR=y +#ifdef OPLUS_FEATURE_QCOM_PMICWD +#shukai@BSP.Kernel.Stability, 2020/08/06, Add for qcom pmic watchdog +CONFIG_OPLUS_FEATURE_QCOM_PMICWD=y +#xupengcheng@MULTIMEDIA.Display.LCD.Stability, 2020/09/23, add for 19696 lcd support power +CONFIG_REGULATOR_KTD2151=y +#xupengcheng@MULTIMEDIA.Display.LCD.Stability, 2020/09/23, add for 19696 lcd backlight +CONFIG_BACKLIGHT_LM3697=y +#endif +#ifdef OPLUS_SYSTEM_KERNEL +#wen.luo@BSP.Kernel.Stability, 2020/03/26, all system oplus feature writer here +CONFIG_OPLUS_FEATURE_PHOENIX=y +CONFIG_DETECT_HUNG_TASK=y +CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE=y +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=60 +#endif +#zongbao.shang@Cam, 2020/08/06, Add for pm8008 driver +CONFIG_REGULATOR_PM8008=y + +#ifdef VENDOR_EDIT +#/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +CONFIG_UFSFEATURE=y +CONFIG_UFSHPB=y +CONFIG_UFSTW=y +#CONFIG_UFSTW_DEBUGDRV=y +CONFIG_HPB_SUP_ONLY_4=y +CONFIG_HPB_SUP_8_TO_32=y +CONFIG_HPB_SUP_OVER_36=y +CONFIG_UFSTW_IGNORE_GUARANTEE_BIT=y + +#ifdef OPLUS_FEATURE_CHG_BASIC +CONFIG_OPPO_MOTOR=y +CONFIG_MOTOR_DETECT_QOS=y +CONFIG_MOTOR_CLASS_INTERFACE=y +#endif +#endif + +#ifdef OPLUS_FEATURE_DUMPDEVICE +#zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info +CONFIG_PSTORE=y +CONFIG_PSTORE_CONSOLE=y +CONFIG_PSTORE_PMSG=y +CONFIG_PSTORE_RAM=y +#endif + +#ifdef OPLUS_FEATURE_LOWMEM_DBG +#Hailong.Liu@BSP.Kernel.MM, 2020/06/19, Add for dump memory usage when lowmmem occurs. +CONFIG_OPLUS_FEATURE_LOWMEM_DBG=y +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ + +#ifdef OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY +#Kui.Zhang@TEC.Kernel.MM, 2019-05-10, add reserved vma for emergency mmap +CONFIG_VIRTUAL_RESERVE_MEMORY=y +#endif /* OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY */ diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index ebcff46a1608..30446b76b623 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -71,3 +71,8 @@ extra-y += $(head-y) vmlinux.lds ifeq ($(CONFIG_DEBUG_EFI),y) AFLAGS_head.o += -DVMLINUX_PATH="\"$(realpath $(objtree)/vmlinux)\"" endif + +#ifdef CONFIG_OPLUS_SECURE_GUARD +obj-$(CONFIG_OPLUS_SECURE_GUARD) += rootguard/ +obj-$(CONFIG_OPLUS_SECURE_GUARD) += oplus_root.o +#endif /* CONFIG_OPLUS_SECURE_GUARD */ diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c index 636657ac89f0..0c59293fed81 100644 --- a/arch/arm64/kernel/asm-offsets.c +++ b/arch/arm64/kernel/asm-offsets.c @@ -163,5 +163,24 @@ int main(void) #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 DEFINE(TRAMP_VALIAS, TRAMP_VALIAS); #endif + +#ifdef CONFIG_OPLUS_SECURE_GUARD +#ifdef CONFIG_OPLUS_ROOT_CHECK + DEFINE(PROOT_TSK_CRED, offsetof(struct task_struct, cred)); + DEFINE(PROOT_CRED_UID, offsetof(struct cred, uid)); + DEFINE(PROOT_CRED_EUID, offsetof(struct cred, euid)); + DEFINE(PROOT_CRED_FSUID, offsetof(struct cred, fsuid)); +#ifdef CONFIG_THREAD_INFO_IN_TASK + DEFINE(PROOT_THREAD_ADDR_LIMIT, offsetof(struct task_struct, thread_info.addr_limit)); +#else + DEFINE(PROOT_THREAD_TSK, offsetof(struct thread_info,task)); + DEFINE(PROOT_THREAD_ADDR_LIMIT, offsetof(struct thread_info, addr_limit)); +#endif +#endif /* CONFIG_OPLUS_ROOT_CHECK */ +#endif /* CONFIG_OPLUS_SECURE_GUARD */ +#ifdef CONFIG_ARM_SDE_INTERFACE + DEFINE(SDEI_EVENT_INTREGS, offsetof(struct sdei_registered_event, interrupted_regs)); + DEFINE(SDEI_EVENT_PRIORITY, offsetof(struct sdei_registered_event, priority)); +#endif return 0; } diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 303447c765f7..b1a02daecbb2 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -969,7 +969,13 @@ el0_svc_naked: // compat entry point cmp wscno, wsc_nr // check upper syscall limit b.hs ni_sys mask_nospec64 xscno, xsc_nr, x19 // enforce bounds for syscall number +#ifdef VENDOR_EDIT +#ifdef CONFIG_OPLUS_ROOT_CHECK + adr x16, oplus_root_check +#else ldr x16, [stbl, xscno, lsl #3] // address in the syscall table +#endif /* CONFIG_OPLUS_ROOT_CHECK */ +#endif /* VENDOR_EDIT */ blr x16 // call sys_* routine b ret_fast_syscall ni_sys: @@ -999,7 +1005,13 @@ __sys_trace: ldp x2, x3, [sp, #S_X2] ldp x4, x5, [sp, #S_X4] ldp x6, x7, [sp, #S_X6] +#ifdef VENDOR_EDIT +#ifdef CONFIG_OPLUS_ROOT_CHECK + adr x16, oplus_root_check +#else ldr x16, [stbl, xscno, lsl #3] // address in the syscall table +#endif /* CONFIG_OPLUS_ROOT_CHECK */ +#endif /* VENDOR_EDIT */ blr x16 // call sys_* routine __sys_trace_return: diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 423a02bf0cde..fae30661d905 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -68,6 +68,8 @@ unsigned long __stack_chk_guard __read_mostly; EXPORT_SYMBOL(__stack_chk_guard); #endif +#ifndef CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE +/* YiXue.Ge@PSW.BSP.Kernel.Drv, 2017/11/27, add for some fault device can not reboot early */ /* * Function pointers to optional machine specific functions */ @@ -76,6 +78,19 @@ EXPORT_SYMBOL_GPL(pm_power_off); void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd); +#else + +#include + +/* + * Function pointers to optional machine specific functions + */ +void (*pm_power_off)(void) = do_poweroff_early; +EXPORT_SYMBOL_GPL(pm_power_off); +void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd) = do_restart_early; + +#endif /* CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE */ + /* * This is our default idle handler. */ @@ -256,6 +271,10 @@ void __show_regs(struct pt_regs *regs) top_reg = 29; } +#ifdef CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE //yixue.ge@bsp.drv add for dump cpu contex for minidump + dumpcpuregs(regs); +#endif + show_regs_print_info(KERN_DEFAULT); print_symbol("pc : %s\n", regs->pc); print_symbol("lr : %s\n", lr); diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index c901ba7cd3d2..902b1029ca0d 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -49,6 +49,9 @@ #include #include #include +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) +#include +#endif /*OPLUS_FEATURE_IOMONITOR*/ struct fault_info { int (*fn)(unsigned long addr, unsigned int esr, @@ -541,6 +544,9 @@ done: */ if (major) { tsk->maj_flt++; +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + iomonitor_update_fs_stats(FS_MAJOR_FAULT, 1); +#endif /*OPLUS_FEATURE_IOMONITOR*/ perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, addr); } else { diff --git a/block/Kconfig b/block/Kconfig index 4d9bcb951d83..0a720a430610 100644 --- a/block/Kconfig +++ b/block/Kconfig @@ -230,3 +230,8 @@ config BLK_MQ_RDMA default y source block/Kconfig.iosched + +#ifdef OPLUS_FEATURE_FG_IO_OPT +#/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ +source block/oppo_foreground_io_opt/Kconfig +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ diff --git a/block/Makefile b/block/Makefile index ab14055d8222..b7874950e867 100644 --- a/block/Makefile +++ b/block/Makefile @@ -35,6 +35,10 @@ obj-$(CONFIG_BLK_DEV_ZONED) += blk-zoned.o obj-$(CONFIG_BLK_WBT) += blk-wbt.o obj-$(CONFIG_BLK_DEBUG_FS) += blk-mq-debugfs.o obj-$(CONFIG_BLK_SED_OPAL) += sed-opal.o +#ifdef OPLUS_FEATURE_FG_IO_OPT +#/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ +obj-$(CONFIG_OPPO_FG_IO_OPT) += oppo_foreground_io_opt/ +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ obj-$(CONFIG_BLK_INLINE_ENCRYPTION) += keyslot-manager.o bio-crypt-ctx.o \ blk-crypto.o -obj-$(CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK) += blk-crypto-fallback.o \ No newline at end of file +obj-$(CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK) += blk-crypto-fallback.o diff --git a/block/blk-core.c b/block/blk-core.c index e601daa1a1fb..600810912dd4 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -47,10 +47,34 @@ #include +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ +#include "oppo_foreground_io_opt/oppo_foreground_io_opt.h" +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ + +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) +#include +#endif /*OPLUS_FEATURE_IOMONITOR*/ + +#ifdef OPLUS_FEATURE_UIFIRST +#include +#endif /*OPLUS_FEATURE_UIFIRST*/ + #ifdef CONFIG_DEBUG_FS struct dentry *blk_debugfs_root; #endif +/*Hank.liu@TECH.BSP Kernel IO Latency 2019-03-21,io information*/ +#if defined(VENDOR_EDIT) && defined(CONFIG_OPPO_HEALTHINFO) +extern void ohm_iolatency_record(struct request * req,unsigned int nr_bytes, int fg, u64 delta_us); +extern unsigned long ufs_outstanding; +static u64 latency_count; +static u32 io_print_count; +bool io_print_flag; +#define PRINT_LATENCY 500*1000 +#define COUNT_TIME 24*60*60*1000 +#endif /*VENDOR_EDIT*/ + EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_remap); EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_remap); EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_complete); @@ -119,6 +143,10 @@ void blk_rq_init(struct request_queue *q, struct request *rq) memset(rq, 0, sizeof(*rq)); INIT_LIST_HEAD(&rq->queuelist); +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ + INIT_LIST_HEAD(&rq->fg_list); +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ INIT_LIST_HEAD(&rq->timeout_list); rq->cpu = -1; rq->q = q; @@ -910,6 +938,10 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) if (!q) return NULL; +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ + INIT_LIST_HEAD(&q->fg_head); +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ q->id = ida_simple_get(&blk_queue_ida, 0, 0, gfp_mask); if (q->id < 0) goto fail_q; @@ -931,7 +963,10 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) q->backing_dev_info->capabilities = BDI_CAP_CGROUP_WRITEBACK; q->backing_dev_info->name = "block"; q->node = node_id; - +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ + fg_bg_max_count_init(q); +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ setup_timer(&q->backing_dev_info->laptop_mode_wb_timer, laptop_mode_timer_fn, (unsigned long) q); setup_timer(&q->timeout, blk_rq_timed_out_timer, (unsigned long) q); @@ -1375,7 +1410,9 @@ out: */ if (ioc_batching(q, ioc)) ioc->nr_batch_requests--; - +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + iomonitor_init_reqstats(rq); +#endif /*OPLUS_FEATURE_IOMONITOR*/ trace_block_getrq(q, bio, op); return rq; @@ -1875,6 +1912,16 @@ void blk_init_request_from_bio(struct request *req, struct bio *bio) if (bio->bi_opf & REQ_RAHEAD) req->cmd_flags |= REQ_FAILFAST_MASK; +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ + if (bio->bi_opf & REQ_FG) + req->cmd_flags |= REQ_FG; +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ + +#ifdef OPLUS_FEATURE_UIFIRST + if (bio->bi_opf & REQ_UX) + req->cmd_flags |= REQ_UX; +#endif /*OPLUS_FEATURE_UIFIRST*/ req->__sector = bio->bi_iter.bi_sector; if (ioprio_valid(bio_prio(bio))) @@ -2402,11 +2449,17 @@ blk_qc_t submit_bio(struct bio *bio) if (op_is_write(bio_op(bio))) { count_vm_events(PGPGOUT, count); +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + iomonitor_update_vm_stats(PGPGOUT, count); +#endif /*OPLUS_FEATURE_IOMONITOR*/ } else { if (bio_flagged(bio, BIO_WORKINGSET)) workingset_read = true; task_io_account_read(bio->bi_iter.bi_size); count_vm_events(PGPGIN, count); +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + iomonitor_update_vm_stats(PGPGIN, count); +#endif /*OPLUS_FEATURE_IOMONITOR*/ } if (unlikely(block_dump)) { @@ -2427,6 +2480,16 @@ blk_qc_t submit_bio(struct bio *bio) */ if (workingset_read) psi_memstall_enter(&pflags); +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ + if (high_prio_for_task(current)) + bio->bi_opf |= REQ_FG; +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ + +#ifdef OPLUS_FEATURE_UIFIRST + if (test_task_ux(current)) + bio->bi_opf |= REQ_UX; +#endif /*OPLUS_FEATURE_UIFIRST*/ ret = generic_make_request(bio); @@ -2711,6 +2774,15 @@ struct request *blk_peek_request(struct request_queue *q) * not be passed by new incoming requests */ rq->rq_flags |= RQF_STARTED; +/*Hank.liu@PSW.BSP Kernel IO Latency 2019-03-19,request start ktime */ +#if defined(VENDOR_EDIT) + rq-> block_io_start = ktime_get(); +#endif + +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + rq->req_td = ktime_get(); +#endif /*OPLUS_FEATURE_IOMONITOR*/ + trace_block_rq_issue(q, rq); } @@ -2771,7 +2843,9 @@ struct request *blk_peek_request(struct request_queue *q) break; } } - +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + iomonitor_record_io_history(rq); +#endif /*OPLUS_FEATURE_IOMONITOR*/ return rq; } EXPORT_SYMBOL(blk_peek_request); @@ -2784,7 +2858,10 @@ static void blk_dequeue_request(struct request *rq) BUG_ON(ELV_ON_HASH(rq)); list_del_init(&rq->queuelist); - +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ + list_del_init(&rq->fg_list); +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ /* * the time frame between a request being removed from the lists * and to it is freed is accounted as io that is in progress at @@ -2793,6 +2870,13 @@ static void blk_dequeue_request(struct request *rq) if (blk_account_rq(rq)) { q->in_flight[rq_is_sync(rq)]++; set_io_start_time_ns(rq); +#ifdef OPLUS_FEATURE_HEALTHINFO +// jiheng.xie@PSW.Tech.BSP.Performance, 2019/03/11 +// Add for ioqueue +#ifdef CONFIG_OPPO_HEALTHINFO + ohm_ioqueue_add_inflight(q, rq); +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ } } @@ -2874,9 +2958,53 @@ bool blk_update_request(struct request *req, blk_status_t error, unsigned int nr_bytes) { int total_bytes; +#if defined(VENDOR_EDIT) && defined(CONFIG_OPPO_HEALTHINFO) +/*Hank.liu@TECH.BSP Kernel IO Latency 2019-03-19,request complete ktime*/ + ktime_t now; + u64 delta_us; + char rwbs[RWBS_LEN]; +#endif trace_block_rq_complete(req, blk_status_to_errno(error), nr_bytes); +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + iomonitor_record_reqstats(req, nr_bytes); +#endif /*OPLUS_FEATURE_IOMONITOR*/ + +/*Hank.liu@TECH.BSP Kernel IO Latency 2019-03-19,request complete ktime*/ +#if defined(VENDOR_EDIT) && defined(CONFIG_OPPO_HEALTHINFO) + if(req->tag >= 0 && req->block_io_start > 0) + { + io_print_flag = false; + now = ktime_get(); + delta_us = ktime_us_delta(now, req->block_io_start); + //by xuweijie ohm_iolatency_record(req, nr_bytes, current_is_fg(), ktime_us_delta(now, req->block_io_start)); + trace_block_time(req->q, req, delta_us, nr_bytes); + + if(delta_us > PRINT_LATENCY) { + if((ktime_to_ms(now)) < COUNT_TIME){ + latency_count ++; + }else{ + latency_count = 0; + } + io_print_flag = true; + blk_fill_rwbs(rwbs,req->cmd_flags, nr_bytes); + + /*if log is continuous, printk the first log.*/ + if(!io_print_count) + pr_info("[IO Latency]UID:%u,slot:%d,outstanding=0x%lx,IO_Type:%s,Block IO/Flash Latency:(%llu/%llu)LBA:%llu,length:%d size:%d,count=%lld\n", + (from_kuid_munged(current_user_ns(),current_uid())), + req->tag,ufs_outstanding,rwbs,delta_us,req->flash_io_latency, + (unsigned long long)blk_rq_pos(req), + nr_bytes >> 9,blk_rq_bytes(req),latency_count); + io_print_count++; + } + + if(!io_print_flag && io_print_count) + io_print_count = 0; + } +#endif + if (!req->bio) return false; diff --git a/block/blk-flush.c b/block/blk-flush.c index 6603352879e7..7c01e15077c7 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c @@ -75,7 +75,10 @@ #include "blk-mq.h" #include "blk-mq-tag.h" #include "blk-mq-sched.h" - +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ +#include "oppo_foreground_io_opt/oppo_foreground_io_opt.h" +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ /* PREFLUSH/FUA sequences */ enum { REQ_FSEQ_PREFLUSH = (1 << 0), /* pre-flushing in progress */ @@ -93,6 +96,11 @@ enum { FLUSH_PENDING_TIMEOUT = 5 * HZ, }; +#ifdef CONFIG_OPLUS_FEATURE_PANIC_FLUSH +/*jason.tang@TECH.BSP.Kernel.Storage, 2019-05-20, add to count flush*/ +extern unsigned long sysctl_blkdev_issue_flush_count; +#endif + static bool blk_kick_flush(struct request_queue *q, struct blk_flush_queue *fq); @@ -142,6 +150,10 @@ static bool blk_flush_queue_rq(struct request *rq, bool add_front) list_add(&rq->queuelist, &rq->q->queue_head); else list_add_tail(&rq->queuelist, &rq->q->queue_head); +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ + queue_throtl_add_request(rq->q, rq, add_front); +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ return true; } } @@ -465,7 +477,15 @@ void blk_insert_flush(struct request *rq) if (q->mq_ops) blk_mq_sched_insert_request(rq, false, true, false, false); else +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ + { list_add_tail(&rq->queuelist, &q->queue_head); + queue_throtl_add_request(q, rq, false); + } +#else + list_add_tail(&rq->queuelist, &q->queue_head); +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ return; } @@ -524,6 +544,11 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, if (!q->make_request_fn) return -ENXIO; +#ifdef CONFIG_OPLUS_FEATURE_PANIC_FLUSH + /*jason.tang@TECH.BSP.Kernel.Storage, 2019-05-20, add to count flush*/ + sysctl_blkdev_issue_flush_count++; +#endif + bio = bio_alloc(gfp_mask, 0); bio_set_dev(bio, bdev); bio->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH; diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 3698445ce5d6..9cbe770444c2 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -17,6 +17,10 @@ #include "blk-mq-debugfs.h" #include "blk-wbt.h" +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ +#include "oppo_foreground_io_opt/oppo_foreground_io_opt.h" +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ struct queue_sysfs_entry { struct attribute attr; ssize_t (*show)(struct request_queue *, char *); @@ -396,6 +400,23 @@ static ssize_t queue_poll_delay_store(struct request_queue *q, const char *page, return count; } +#ifdef OPLUS_FEATURE_HEALTHINFO +// jiheng.xie@PSW.Tech.BSP.Performance, 2019/03/11 +// Add for ioqueue +#ifdef CONFIG_OPPO_HEALTHINFO +static ssize_t queue_show_ohm_inflight(struct request_queue *q, char *page) +{ + ssize_t ret; + + ret = sprintf(page, "async:%d\n", q->in_flight[0]); + ret += sprintf(page + ret, "sync:%d\n", q->in_flight[1]); + ret += sprintf(page + ret, "bg:%d\n", q->in_flight[2]); + ret += sprintf(page + ret, "fg:%d\n", q->in_flight[3]); + return ret; +} +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ + static ssize_t queue_poll_show(struct request_queue *q, char *page) { return queue_var_show(test_bit(QUEUE_FLAG_POLL, &q->queue_flags), page); @@ -638,6 +659,16 @@ static struct queue_sysfs_entry queue_rq_affinity_entry = { .store = queue_rq_affinity_store, }; +#ifdef OPLUS_FEATURE_HEALTHINFO +//Jiheng.Xie@PSW.Tech.BSP.Performance, 2019/03/11, Add for ioqueue +#ifdef CONFIG_OPPO_HEALTHINFO +static struct queue_sysfs_entry queue_ohm_inflight_entry = { + .attr = {.name = "ohm_inflight", .mode = S_IRUGO }, + .show = queue_show_ohm_inflight, +}; +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ + static struct queue_sysfs_entry queue_iostats_entry = { .attr = {.name = "iostats", .mode = S_IRUGO | S_IWUSR }, .show = queue_show_iostats, @@ -687,9 +718,28 @@ static struct queue_sysfs_entry throtl_sample_time_entry = { }; #endif +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ +static struct queue_sysfs_entry queue_fgio_entry = { + .attr = {.name = "fg_io_cnt_max", .mode = S_IRUGO | S_IWUSR }, + .show = queue_fg_count_max_show, + .store = queue_fg_count_max_store, +}; +static struct queue_sysfs_entry queue_bothio_entry = { + .attr = {.name = "both_io_cnt_max", .mode = S_IRUGO | S_IWUSR }, + .show = queue_both_count_max_show, + .store = queue_both_count_max_store, +}; +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ + static struct attribute *default_attrs[] = { &queue_requests_entry.attr, &queue_ra_entry.attr, +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ + &queue_fgio_entry.attr, + &queue_bothio_entry.attr, +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ &queue_max_hw_sectors_entry.attr, &queue_max_sectors_entry.attr, &queue_max_segments_entry.attr, @@ -714,6 +764,13 @@ static struct attribute *default_attrs[] = { &queue_nomerges_entry.attr, &queue_rq_affinity_entry.attr, &queue_iostats_entry.attr, +#ifdef OPLUS_FEATURE_HEALTHINFO +// jiheng.xie@PSW.Tech.BSP.Performance, 2019/03/11 +// Add for ioqueue +#ifdef CONFIG_OPPO_HEALTHINFO + &queue_ohm_inflight_entry.attr, +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ &queue_random_entry.attr, &queue_poll_entry.attr, &queue_wc_entry.attr, diff --git a/block/blk.h b/block/blk.h index aa0eb39fe20e..34eb1db13076 100644 --- a/block/blk.h +++ b/block/blk.h @@ -5,6 +5,9 @@ #include #include #include "blk-mq.h" +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +#include +#endif /* Amount of time in which a process may batch requests */ #define BLK_BATCH_TIME (HZ/50UL) @@ -18,7 +21,10 @@ #ifdef CONFIG_DEBUG_FS extern struct dentry *blk_debugfs_root; #endif - +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +extern unsigned int sysctl_fg_io_opt; +extern struct request * smart_peek_request(struct request_queue *q); +#endif struct blk_flush_queue { unsigned int flush_queue_delayed:1; unsigned int flush_pending_idx:1; @@ -157,11 +163,27 @@ static inline struct request *__elv_next_request(struct request_queue *q) WARN_ON_ONCE(q->mq_ops); while (1) { +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ + if (likely(sysctl_fg_io_opt) +#ifdef CONFIG_PM + &&(q->rpm_status == RPM_ACTIVE) +#endif + ) { + rq = smart_peek_request(q); + if(rq) + return rq; + } + else { +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ if (!list_empty(&q->queue_head)) { rq = list_entry_rq(q->queue_head.next); return rq; } - +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ + } +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ /* * Flush request is running and flush request isn't queueable * in the drive, we can hold the queue till flush request is diff --git a/block/elevator.c b/block/elevator.c index 8320d97240be..813405b4a822 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -42,6 +42,10 @@ #include "blk.h" #include "blk-mq-sched.h" #include "blk-wbt.h" +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ +#include "oppo_foreground_io_opt/oppo_foreground_io_opt.h" +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ static DEFINE_SPINLOCK(elv_list_lock); static LIST_HEAD(elv_list); @@ -415,6 +419,10 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq) } list_add(&rq->queuelist, entry); +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ + queue_throtl_add_request(q, rq, false); +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ } EXPORT_SYMBOL(elv_dispatch_sort); @@ -435,6 +443,10 @@ void elv_dispatch_add_tail(struct request_queue *q, struct request *rq) q->end_sector = rq_end_sector(rq); q->boundary_rq = rq; list_add_tail(&rq->queuelist, &q->queue_head); +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ + queue_throtl_add_request(q, rq, false); +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ } EXPORT_SYMBOL(elv_dispatch_add_tail); @@ -607,6 +619,13 @@ void elv_requeue_request(struct request_queue *q, struct request *rq) */ if (blk_account_rq(rq)) { q->in_flight[rq_is_sync(rq)]--; +#ifdef OPLUS_FEATURE_HEALTHINFO +// jiheng.xie@PSW.Tech.BSP.Performance, 2019/03/11 +// Add for ioqueue +#ifdef CONFIG_OPPO_HEALTHINFO + ohm_ioqueue_dec_inflight(q, rq); +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ if (rq->rq_flags & RQF_SORTED) elv_deactivate_rq(q, rq); } @@ -639,6 +658,10 @@ void elv_drain_elevator(struct request_queue *q) void __elv_add_request(struct request_queue *q, struct request *rq, int where) { +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + rq->req_ti = ktime_get(); +#endif /*OPLUS_FEATURE_IOMONITOR*/ + trace_block_rq_insert(q, rq); blk_pm_add_request(q, rq); @@ -661,12 +684,20 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where) case ELEVATOR_INSERT_FRONT: rq->rq_flags |= RQF_SOFTBARRIER; list_add(&rq->queuelist, &q->queue_head); +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ + queue_throtl_add_request(q, rq, true); +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ break; case ELEVATOR_INSERT_BACK: rq->rq_flags |= RQF_SOFTBARRIER; elv_drain_elevator(q); list_add_tail(&rq->queuelist, &q->queue_head); +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ + queue_throtl_add_request(q, rq, false); +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ /* * We kick the queue here for the following reasons. * - The elevator might have returned NULL previously @@ -801,6 +832,13 @@ void elv_completed_request(struct request_queue *q, struct request *rq) */ if (blk_account_rq(rq)) { q->in_flight[rq_is_sync(rq)]--; +#ifdef OPLUS_FEATURE_HEALTHINFO +// jiheng.xie@PSW.Tech.BSP.Performance, 2019/03/11 +// Add for ioqueue +#ifdef CONFIG_OPPO_HEALTHINFO + ohm_ioqueue_dec_inflight(q, rq); +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ if ((rq->rq_flags & RQF_SORTED) && e->type->ops.sq.elevator_completed_req_fn) e->type->ops.sq.elevator_completed_req_fn(q, rq); diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 7440de44dd85..3f699c507c83 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c @@ -205,6 +205,13 @@ static void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter) __set_bit(GPCMD_LOAD_UNLOAD, filter->write_ok); __set_bit(GPCMD_SET_STREAMING, filter->write_ok); __set_bit(GPCMD_SET_READ_AHEAD, filter->write_ok); +#ifdef OPLUS_FEATURE_STORAGE_TOOL +// jason.wu@BSP.Storage, 2020-6-11 +// add write buffer command for common user +// add vendor command for common user + __set_bit(WRITE_BUFFER, filter->write_ok); + __set_bit(VENDOR_SPECIFIC_CDB, filter->write_ok); +#endif } int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm) @@ -424,6 +431,12 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, int err; unsigned int in_len, out_len, bytes, opcode, cmdlen; char *buffer = NULL; +#ifdef OPLUS_FEATURE_STORAGE_TOOL +// jason.wu@BSP.Storage, 2020-03-03 workaround for samsung device. +// vendor cmd len is 16 and not 10 in spec. +// in current application ,only samsung health will use this cmd. + struct scsi_device *sdev = NULL; +#endif if (!sic) return -EINVAL; @@ -457,6 +470,17 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, req = scsi_req(rq); cmdlen = COMMAND_SIZE(opcode); +#ifdef OPLUS_FEATURE_STORAGE_TOOL +// jason.wu@BSP.Storage, 2020-03-03 workaround for samsung device. +// vendor cmd len is 16 and not 10 in spec. +// in current application ,only samsung health will use this cmd. + sdev = (struct scsi_device*)(q->queuedata); + if ((VENDOR_SPECIFIC_CDB == opcode) + &&(0 == strncmp(sdev->vendor, "SAMSUNG ", 8)) + ){ + cmdlen = 16; + } +#endif /* * get command and data to send to device, if any diff --git a/drivers/Kconfig b/drivers/Kconfig index 43377a3acb97..b6ca8eb0999b 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -105,7 +105,11 @@ source "drivers/usb/Kconfig" source "drivers/uwb/Kconfig" -source "drivers/mmc/Kconfig" +#ifdef VENDOR_EDIT +source "drivers/ommc/Kconfig" +#else +#source "drivers/mmc/Kconfig" +#endif source "drivers/memstick/Kconfig" @@ -225,4 +229,10 @@ source "drivers/sensors/Kconfig" source "drivers/esoc/Kconfig" +#ifdef OPLUS_NFC_BRINGUP +#DengWeiwei@CONNECTIVITY.NFC.HARDWARE.228691, 2020/08/03 +#Add for the kernel Macro for NXP PN557 NFC kernel +source "drivers/nfc/pn553-i2c/Kconfig" +source "drivers/nfc/p73-spi/Kconfig" +#endif /*OPLUS_NFC_BRINGUP*/ endmenu diff --git a/drivers/Makefile b/drivers/Makefile index 4a067525bbdc..a133a2aef6a7 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -133,7 +133,11 @@ obj-$(CONFIG_EDAC) += edac/ obj-$(CONFIG_EISA) += eisa/ obj-$(CONFIG_CPU_FREQ) += cpufreq/ obj-$(CONFIG_CPU_IDLE) += cpuidle/ +ifneq ($(TARGET_PRODUCT),qssi) +obj-y += ommc/ +else obj-y += mmc/ +endif obj-$(CONFIG_MEMSTICK) += memstick/ obj-$(CONFIG_NEW_LEDS) += leds/ obj-$(CONFIG_INFINIBAND) += infiniband/ diff --git a/drivers/android/binder.c b/drivers/android/binder.c index b256a56a70d5..5efdd1180d21 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -78,6 +78,15 @@ #include "binder_internal.h" #include "binder_trace.h" +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst +#include +#endif /* OPLUS_FEATURE_UIFIRST */ + +#ifdef OPLUS_FEATURE_HANS_FREEZE +// Kun.Zhou@ANDROID.RESCONTROL, 2019/09/23, add for hans freeze manager +#include +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ static HLIST_HEAD(binder_deferred_list); static DEFINE_MUTEX(binder_deferred_lock); @@ -507,6 +516,10 @@ struct binder_proc { struct hlist_node deferred_work_node; int deferred_work; bool is_dead; +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/06/15, Add for UIFirst + int proc_type; +#endif /* OPLUS_FEATURE_UIFIRST */ struct list_head todo; struct binder_stats stats; @@ -2837,6 +2850,14 @@ static int binder_fixup_parent(struct binder_transaction *t, return 0; } +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/06/15, Add for UIFirst +static inline bool is_binder_proc_sf(struct binder_proc *proc) +{ + return proc && proc->tsk && strstr(proc->tsk->comm, "surfaceflinger") + && (task_uid(proc->tsk).val == 1000); +} +#endif /* OPLUS_FEATURE_UIFIRST */ /** * binder_proc_transaction() - sends a transaction to a process and wakes it up * @t: transaction to send @@ -2892,6 +2913,13 @@ static bool binder_proc_transaction(struct binder_transaction *t, binder_transaction_priority(thread->task, t, node_prio, node->inherit_rt); binder_enqueue_thread_work_ilocked(thread, &t->work); +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled) { + if (!oneway || proc->proc_type) + binder_set_inherit_ux(thread->task, current); + } +#endif /* OPLUS_FEATURE_UIFIRST */ } else if (!pending_async) { binder_enqueue_work_ilocked(&t->work, &proc->todo); } else { @@ -2975,6 +3003,14 @@ static void binder_transaction(struct binder_proc *proc, int t_debug_id = atomic_inc_return(&binder_last_id); char *secctx = NULL; u32 secctx_sz = 0; +#ifdef OPLUS_FEATURE_HANS_FREEZE +//#Kun.Zhou@ANDROID.RESCONTROL, 2019/09/23, add for hans freeze manager + char buf_data[INTERFACETOKEN_BUFF_SIZE]; + size_t buf_data_size; + char buf[INTERFACETOKEN_BUFF_SIZE] = {0}; + int i = 0; + int j = 0; +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ e = binder_transaction_log_add(&binder_transaction_log); e->debug_id = t_debug_id; @@ -3090,6 +3126,27 @@ static void binder_transaction(struct binder_proc *proc, return_error_line = __LINE__; goto err_dead_binder; } + +#ifdef OPLUS_FEATURE_HANS_FREEZE +//#Kun.Zhou@ANDROID.RESCONTROL, 2019/09/23, add for hans freeze manager + if (!(tr->flags & TF_ONE_WAY) //report sync binder call + && target_proc + && (task_uid(target_proc->tsk).val > MIN_USERAPP_UID) + && (proc->pid != target_proc->pid) + && is_frozen_tg(target_proc->tsk)) { + hans_report(SYNC_BINDER, task_tgid_nr(proc->tsk), task_uid(proc->tsk).val, task_tgid_nr(target_proc->tsk), task_uid(target_proc->tsk).val, "SYNC_BINDER", -1); + } +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ + +#if defined(CONFIG_CFS_BANDWIDTH) + if (!(tr->flags & TF_ONE_WAY) //report sync binder call + && target_proc + && (task_uid(target_proc->tsk).val > MIN_USERAPP_UID || task_uid(target_proc->tsk).val == HANS_SYSTEM_UID) //uid >10000 + && is_belong_cpugrp(target_proc->tsk)) { + hans_report(SYNC_BINDER_CPUCTL, task_tgid_nr(proc->tsk), task_uid(proc->tsk).val, task_tgid_nr(target_proc->tsk), task_uid(target_proc->tsk).val, "SYNC_BINDER_CPUCTL", -1); + } +#endif + e->to_node = target_node->debug_id; if (security_binder_transaction(proc->tsk, target_proc->tsk) < 0) { @@ -3299,6 +3356,32 @@ static void binder_transaction(struct binder_proc *proc, return_error_line = __LINE__; goto err_bad_offset; } +#ifdef OPLUS_FEATURE_HANS_FREEZE +//#Kun.Zhou@ANDROID.RESCONTROL, 2019/09/23, add for hans freeze manager + if ((tr->flags & TF_ONE_WAY) //report async binder call + && target_proc + && (task_uid(target_proc->tsk).val > MIN_USERAPP_UID) + && (proc->pid != target_proc->pid) + && is_frozen_tg(target_proc->tsk)) { + buf_data_size = tr->data_size>INTERFACETOKEN_BUFF_SIZE ?INTERFACETOKEN_BUFF_SIZE:tr->data_size; + if (!copy_from_user(buf_data, (char*)tr->data.ptr.buffer, buf_data_size)) { + //1.skip first PARCEL_OFFSET bytes (useless data) + //2.make sure the invalid address issue is not occuring(j =PARCEL_OFFSET+1, j+=2) + //3.java layer uses 2 bytes char. And only the first bytes has the data.(p+=2) + if (buf_data_size > PARCEL_OFFSET) { + char *p = (char *)(buf_data) + PARCEL_OFFSET; + j = PARCEL_OFFSET + 1; + while (i < INTERFACETOKEN_BUFF_SIZE && j < buf_data_size && *p != '\0') { + buf[i++] = *p; + j += 2; + p += 2; + } + if (i == INTERFACETOKEN_BUFF_SIZE) buf[i-1] = '\0'; + } + hans_report(ASYNC_BINDER, task_tgid_nr(proc->tsk), task_uid(proc->tsk).val, task_tgid_nr(target_proc->tsk), task_uid(target_proc->tsk).val, buf, tr->code); + } + } +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ off_start_offset = ALIGN(tr->data_size, sizeof(void *)); buffer_offset = off_start_offset; off_end_offset = off_start_offset + tr->offsets_size; @@ -3507,6 +3590,12 @@ static void binder_transaction(struct binder_proc *proc, binder_enqueue_thread_work_ilocked(target_thread, &t->work); binder_inner_proc_unlock(target_proc); wake_up_interruptible_sync(&target_thread->wait); +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled && !proc->proc_type) { + binder_unset_inherit_ux(thread->task); + } +#endif /* OPLUS_FEATURE_UIFIRST */ binder_restore_priority(current, in_reply_to->saved_priority); binder_free_transaction(in_reply_to); } else if (!(t->flags & TF_ONE_WAY)) { @@ -4148,11 +4237,36 @@ static int binder_wait_for_work(struct binder_thread *thread, prepare_to_wait(&thread->wait, &wait, TASK_INTERRUPTIBLE); if (binder_has_work_ilocked(thread, do_proc_work)) break; +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/06/15, Add for UIFirst + if (do_proc_work) { + list_add(&thread->waiting_thread_node, + &proc->waiting_threads); + + if (sysctl_uifirst_enabled) { + binder_unset_inherit_ux(thread->task); + } + } +#else /* OPLUS_FEATURE_UIFIRST */ if (do_proc_work) list_add(&thread->waiting_thread_node, &proc->waiting_threads); +#endif /* OPLUS_FEATURE_UIFIRST */ binder_inner_proc_unlock(proc); +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + if (!do_proc_work) + current->in_binder = 1; +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ schedule(); +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + current->in_binder = 0; +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ binder_inner_proc_lock(proc); list_del_init(&thread->waiting_thread_node); if (signal_pending(current)) { @@ -4445,6 +4559,12 @@ retry: trd->sender_pid = task_tgid_nr_ns(sender, task_active_pid_ns(current)); +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled) { + binder_set_inherit_ux(thread->task, t_from->task); + } +#endif /* OPLUS_FEATURE_UIFIRST */ } else { trd->sender_pid = 0; } @@ -5190,6 +5310,10 @@ static int binder_open(struct inode *nodp, struct file *filp) atomic_set(&proc->tmp_ref, 0); get_task_struct(current->group_leader); proc->tsk = current->group_leader; +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/06/15, Add for UIFirst + proc->proc_type = is_binder_proc_sf(proc) ? 1 : 0; +#endif /* OPLUS_FEATURE_UIFIRST */ mutex_init(&proc->files_lock); INIT_LIST_HEAD(&proc->todo); if (binder_supported_policy(current->policy)) { @@ -5959,6 +6083,114 @@ int binder_state_show(struct seq_file *m, void *unused) return 0; } +#ifdef OPLUS_FEATURE_HANS_FREEZE +static void get_uid_pid(int *from_pid, int *from_uid, int *to_pid, int *to_uid, struct binder_transaction *tr) +{ + if (tr->from != NULL && tr->from->proc != NULL + && tr->from->proc->tsk != NULL) { + *from_pid = task_tgid_nr(tr->from->proc->tsk); + } else { + *from_pid = -1; + } + *from_uid = tr->sender_euid.val; + *to_pid = tr->to_thread ? tr->to_thread->proc->pid : -1; + *to_uid = tr->to_thread ? task_uid(tr->to_thread->task).val : -1; +} + +// Kun.Zhou@ROM.Framework, 2019/09/23, add for hans freeze manager +static void hans_check_uid_proc_status(struct binder_proc *proc, enum message_type type) +{ + struct rb_node *n = NULL; + struct binder_thread *thread = NULL; + int from_uid = -1; + int from_pid = -1; + int to_uid = -1; + int to_pid = -1; + struct binder_transaction *btrans = NULL; + bool empty = true; + int need_reply = -1; + struct binder_work *w = NULL; + + /*check binder_thread/transaction_stack/binder_proc ongoing transaction*/ + binder_inner_proc_lock(proc); + for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { + thread = rb_entry(n, struct binder_thread, rb_node); + empty = binder_worklist_empty_ilocked(&thread->todo); + + if (thread->task != NULL) { + /*has "todo" binder thread in worklist?*/ + to_uid = task_uid(thread->task).val; + if (!empty) { + /*scan thread->todo list*/ + list_for_each_entry(w, &thread->todo, entry) { + if (w != NULL && w->type == BINDER_WORK_TRANSACTION) { + btrans = container_of(w, struct binder_transaction, work); + spin_lock(&btrans->lock); + if (btrans != NULL && btrans->to_thread == thread) { + need_reply = (int)(btrans->need_reply == 1); + get_uid_pid(&from_pid, &from_uid, &to_pid, &to_uid, btrans); + spin_unlock(&btrans->lock); + hans_report(type, from_pid, from_uid, to_pid, to_uid, "FROZEN_TRANS_THREAD", need_reply); + } else { + spin_unlock(&btrans->lock); + } + } + } + } + + /*has transcation in transaction_stack?*/ + btrans = thread->transaction_stack; + if (btrans) { + spin_lock(&btrans->lock); + if (btrans->to_thread == thread) { + /*only report incoming binder call*/ + need_reply = (int)(btrans->need_reply == 1); + get_uid_pid(&from_pid, &from_uid, &to_pid, &to_uid, btrans); + spin_unlock(&btrans->lock); + hans_report(type, from_pid, from_uid, to_pid, to_uid, "FROZEN_TRANS_STACK", need_reply); + } else { + spin_unlock(&btrans->lock); + } + } + } + } + + /*has "todo" binder proc in worklist*/ + empty = binder_worklist_empty_ilocked(&proc->todo); + if (proc->tsk != NULL && !empty) { + to_uid = task_uid(proc->tsk).val; + list_for_each_entry(w, &proc->todo, entry) { + if (w != NULL && w->type == BINDER_WORK_TRANSACTION) { + btrans = container_of(w, struct binder_transaction, work); + spin_lock(&btrans->lock); + if (btrans != NULL && btrans->to_thread == thread) { + need_reply = (int)(btrans->need_reply == 1); + get_uid_pid(&from_pid, &from_uid, &to_pid, &to_uid, btrans); + spin_unlock(&btrans->lock); + hans_report(type, from_pid, from_uid, to_pid, to_uid, "FROZEN_TRANS_PROC", need_reply); + } else { + spin_unlock(&btrans->lock); + } + } + } + } + binder_inner_proc_unlock(proc); +} + +void hans_check_frozen_transcation(uid_t uid, enum message_type type) +{ + struct binder_proc *proc; + + mutex_lock(&binder_procs_lock); + hlist_for_each_entry(proc, &binder_procs, proc_node) { + if (proc != NULL && (task_uid(proc->tsk).val == uid)) { + hans_check_uid_proc_status(proc, type); + } + } + mutex_unlock(&binder_procs_lock); +} +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ + int binder_stats_show(struct seq_file *m, void *unused) { struct binder_proc *proc; diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c index 1b5a131278bc..be9ee1d49284 100644 --- a/drivers/android/binder_alloc.c +++ b/drivers/android/binder_alloc.c @@ -32,6 +32,10 @@ #include #include "binder_alloc.h" #include "binder_trace.h" +#ifdef OPLUS_FEATURE_HANS_FREEZE +//#Kun.Zhou@ANDROID.RESCONTROL, 2019/09/23, add for hans freeze manager +#include +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ struct list_lru binder_alloc_lru; @@ -358,6 +362,10 @@ static struct binder_buffer *binder_alloc_new_buf_locked( void __user *end_page_addr; size_t size, data_offsets_size; int ret; +#ifdef OPLUS_FEATURE_HANS_FREEZE +//#Kun.Zhou@ANDROID.RESCONTROL, 2019/09/23, add for hans freeze manager + struct task_struct *p = NULL; +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ if (!binder_alloc_get_vma(alloc)) { pr_err("%d: binder_alloc_buf, no vma\n", @@ -381,6 +389,19 @@ static struct binder_buffer *binder_alloc_new_buf_locked( alloc->pid, extra_buffers_size); return ERR_PTR(-EINVAL); } +#ifdef OPLUS_FEATURE_HANS_FREEZE +//#Kun.Zhou@ANDROID.RESCONTROL, 2019/09/23, add for hans freeze manager + if (is_async + && (alloc->free_async_space < 3 * (size + sizeof(struct binder_buffer)) + || (alloc->free_async_space < ((alloc->buffer_size / 2) * 9 / 10)))) { + rcu_read_lock(); + p = find_task_by_vpid(alloc->pid); + rcu_read_unlock(); + if (p != NULL && is_frozen_tg(p)) { + hans_report(ASYNC_BINDER, task_tgid_nr(current), task_uid(current).val, task_tgid_nr(p), task_uid(p).val, "free_buffer_full", -1); + } + } +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ if (is_async && alloc->free_async_space < size + sizeof(struct binder_buffer)) { binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC, diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 364181591f77..6ec06ade0011 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -196,6 +196,11 @@ static int __fw_state_check(struct fw_state *fw_st, enum fw_status status) #define FW_OPT_NO_WARN (1U << 3) #define FW_OPT_NOCACHE (1U << 4) +#ifdef VENDOR_EDIT +//Tong.Han@Bsp.Group.Tp,2017-12-16,Add interface to get proper fw +#define FW_OPT_COMPARE (1U << 5) +#endif/*VENDOR_EDIT*/ + struct firmware_cache { /* firmware_buf instance will be added into the below list */ spinlock_t lock; @@ -396,8 +401,11 @@ static const char * const fw_path[] = { module_param_string(path, fw_path_para, sizeof(fw_path_para), 0644); MODULE_PARM_DESC(path, "customized firmware image search path with a higher priority than default path"); -static int -fw_get_filesystem_firmware(struct device *device, struct firmware_buf *buf) +#ifdef VENDOR_EDIT +//Wanghao@Bsp.Group.Tp,2018-02-13, Add to avoid direct pass encrypt tp firmware to driver +static int fw_get_filesystem_firmware(struct device *device, + struct firmware_buf *buf, unsigned int opt_flags) +#endif { loff_t size; int i, len; @@ -406,6 +414,14 @@ fw_get_filesystem_firmware(struct device *device, struct firmware_buf *buf) enum kernel_read_file_id id = READING_FIRMWARE; size_t msize = INT_MAX; +#ifdef VENDOR_EDIT + //Wanghao@Bsp.Group.Tp,2018-02-13, Add to avoid direct pass encrypt tp firmware to driver + if(opt_flags & FW_OPT_COMPARE) { + pr_err("%s opt_flags get FW_OPT_COMPARE!\n", __func__); + return rc; + } +#endif/*VENDOR_EDIT*/ + /* Already populated data member means we're loading into a buffer */ if (buf->data) { id = READING_FIRMWARE_PREALLOC_BUFFER; @@ -1039,6 +1055,11 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, struct device *f_dev = &fw_priv->dev; struct firmware_buf *buf = fw_priv->buf; + #ifdef VENDOR_EDIT + //Tong.Han@Bsp.Group.Tp,2017-12-16,Add interface to get proper fw + char *envp[2]={"FwUp=compare", NULL}; + #endif/*VENDOR_EDIT*/ + /* fall back on userspace loading */ if (!buf->data) buf->is_paged_buf = true; @@ -1059,7 +1080,16 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, buf->need_uevent = true; dev_set_uevent_suppress(f_dev, false); dev_dbg(f_dev, "firmware: requesting %s\n", buf->fw_id); + #ifdef VENDOR_EDIT + //Tong.Han@Bsp.Group.Tp,2017-12-16,Add interface to get proper fw + if (opt_flags & FW_OPT_COMPARE) { + kobject_uevent_env(&fw_priv->dev.kobj, KOBJ_CHANGE,envp); + } else { + kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD); + } + #else kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD); + #endif/*VENDOR_EDIT*/ } else { timeout = MAX_JIFFY_OFFSET; } @@ -1233,7 +1263,10 @@ _request_firmware(const struct firmware **firmware_p, const char *name, if (ret <= 0) /* error or already assigned */ goto out; - ret = fw_get_filesystem_firmware(device, fw->priv); +#ifdef VENDOR_EDIT +//Wanghao@Bsp.Group.Tp,2018-02-13, Add to avoid direct pass encrypt tp firmware to driver + ret = fw_get_filesystem_firmware(device, fw->priv, opt_flags); +#endif if (ret) { if (!(opt_flags & FW_OPT_NO_WARN)) dev_dbg(device, @@ -1293,6 +1326,23 @@ request_firmware(const struct firmware **firmware_p, const char *name, } EXPORT_SYMBOL(request_firmware); +#ifdef VENDOR_EDIT +//Tong.Han@Bsp.Group.Tp,2017-12-16,Add interface to get proper fw +int request_firmware_select(const struct firmware **firmware_p, const char *name, + struct device *device) +{ + int ret; + + /* Need to pin this module until return */ + __module_get(THIS_MODULE); + ret = _request_firmware(firmware_p, name, device, NULL, 0, + FW_OPT_UEVENT | FW_OPT_FALLBACK | FW_OPT_COMPARE); + module_put(THIS_MODULE); + return ret; +} +EXPORT_SYMBOL(request_firmware_select); +#endif/*VENDOR_EDIT*/ + /** * request_firmware_direct: - load firmware directly without usermode helper * @firmware_p: pointer to firmware image diff --git a/drivers/base/memory.c b/drivers/base/memory.c index bcbbfa79d0be..20b95413a50f 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -26,7 +26,9 @@ #include #include - +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) +#include +#endif static DEFINE_MUTEX(mem_sysfs_mutex); #define MEMORY_CLASS_NAME "memory" @@ -451,12 +453,32 @@ static DEVICE_ATTR(valid_zones, 0444, show_valid_zones, NULL); #ifdef CONFIG_MEMORY_HOTPLUG static int count_num_free_block_pages(struct zone *zone, int bid) { +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + int order, type, flc; +#else int order, type; +#endif unsigned long freecount = 0; unsigned long flags; spin_lock_irqsave(&zone->lock, flags); for (type = 0; type < MIGRATE_TYPES; type++) { +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + for (flc = 0; flc < FREE_AREA_COUNTS; flc++) { + struct free_area *area; + struct page *page; + for (order = 0; order < MAX_ORDER; ++order) { + area = &(zone->free_area[flc][order]); + list_for_each_entry(page, &area->free_list[type], lru) { + unsigned long pfn = page_to_pfn(page); + int section_nr = pfn_to_section_nr(pfn); + + if (bid == base_memory_block_id(section_nr)) + freecount += (1 << order); + } + } + } +#else for (order = 0; order < MAX_ORDER; ++order) { struct free_area *area; struct page *page; @@ -471,6 +493,7 @@ static int count_num_free_block_pages(struct zone *zone, int bid) } } +#endif } spin_unlock_irqrestore(&zone->lock, flags); diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index f3b6afaf09c7..3091086fcd72 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -133,9 +133,19 @@ void device_pm_add(struct device *dev) dev->bus ? dev->bus->name : "No Bus", dev_name(dev)); device_pm_check_callbacks(dev); mutex_lock(&dpm_list_mtx); +#ifndef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug if (dev->parent && dev->parent->power.is_prepared) dev_warn(dev, "parent %s should not be sleeping\n", dev_name(dev->parent)); +#else + if (dev->parent && dev->parent->power.is_prepared) { + dev_warn(dev, "parent %s should not be sleeping\n", + dev_name(dev->parent)); + pr_info("debug Adding info for %s:%s\n", + dev->bus ? dev->bus->name : "No Bus", dev_name(dev)); + } +#endif /* VENDOR_EDIT */ list_add_tail(&dev->power.entry, &dpm_list); dev->power.in_dpm_list = true; mutex_unlock(&dpm_list_mtx); diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index db2a02b8b54a..21f1d3980e02 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c @@ -19,10 +19,25 @@ #include #include #include +#ifdef OPLUS_FEATURE_LOGKIT +//Yanzhen.Feng@ANDROID.DEBUG.702252, 2016/06/21, Add for Sync App and Kernel time +#include +#include +#endif /* OPLUS_FEATURE_LOGKIT */ #include #include #include +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY +//Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler +#include "../../drivers/soc/oplus/owakelock/oplus_wakelock_profiler_qcom.h" +#endif /* OPLUS_FEATURE_POWERINFO_STANDBY */ + +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY +//SunFaliang@BSP.Power.Basic, 2020/11/18, add for standby monitor +#include +#endif /* OPLUS_FEATURE_POWERINFO_STANDBY */ + #include "power.h" #ifndef CONFIG_SUSPEND @@ -585,6 +600,11 @@ static void wakeup_source_activate(struct wakeup_source *ws) "unregistered wakeup source\n")) return; + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY + //Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler + //wakeup_get_start_hold_time(); + wakeup_get_start_time(); + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY */ ws->active = true; ws->active_count++; ws->last_time = ktime_get(); @@ -726,8 +746,13 @@ static void wakeup_source_deactivate(struct wakeup_source *ws) trace_wakeup_source_deactivate(ws->name, cec); split_counters(&cnt, &inpr); - if (!inpr && waitqueue_active(&wakeup_count_wait_queue)) + if (!inpr && waitqueue_active(&wakeup_count_wait_queue)){ + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY + //Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler + wakeup_get_end_hold_time(); + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY */ wake_up(&wakeup_count_wait_queue); + } } /** @@ -874,8 +899,14 @@ void pm_get_active_wakeup_sources(char *pending_wakeup_source, size_t max) if (!active) len += scnprintf(pending_wakeup_source, max, "Pending Wakeup Sources: "); +#ifndef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG +//Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug len += scnprintf(pending_wakeup_source + len, max - len, "%s ", ws->name); +#else + len += scnprintf(pending_wakeup_source + len, max - len, + "%s, %ld, %ld ", ws->name, ws->active_count, ktime_to_ms(ws->total_time)); +#endif active = true; } else if (!active && (!last_active_ws || @@ -885,11 +916,22 @@ void pm_get_active_wakeup_sources(char *pending_wakeup_source, size_t max) } } if (!active && last_active_ws) { +#ifndef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG +//Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug scnprintf(pending_wakeup_source, max, "Last active Wakeup Source: %s", last_active_ws->name); +#else + scnprintf(pending_wakeup_source, max, + "Last active Wakeup Source: %s, %ld, %ld", + last_active_ws->name, last_active_ws->active_count, ktime_to_ms(last_active_ws->total_time)); +#endif } srcu_read_unlock(&wakeup_srcu, srcuidx); +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG +//Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug + pr_info("%s, active: %d, pending: %s for debug\n", __func__, active, pending_wakeup_source); +#endif } EXPORT_SYMBOL_GPL(pm_get_active_wakeup_sources); @@ -902,7 +944,12 @@ void pm_print_active_wakeup_sources(void) srcuidx = srcu_read_lock(&wakeup_srcu); list_for_each_entry_rcu(ws, &wakeup_sources, entry) { if (ws->active) { + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler + pr_info("active wakeup source: %s, %ld, %ld\n", ws->name, ws->active_count, ktime_to_ms(ws->total_time)); + #else pr_debug("active wakeup source: %s\n", ws->name); + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ active = 1; } else if (!active && (!last_activity_ws || @@ -912,13 +959,48 @@ void pm_print_active_wakeup_sources(void) } } - if (!active && last_activity_ws) + if (!active && last_activity_ws) { + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler + pr_info("last active wakeup source: %s, %ld, %ld\n", + last_activity_ws->name, last_activity_ws->active_count, ktime_to_ms(last_activity_ws->total_time)); + #else pr_debug("last active wakeup source: %s\n", last_activity_ws->name); + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ + } srcu_read_unlock(&wakeup_srcu, srcuidx); } EXPORT_SYMBOL_GPL(pm_print_active_wakeup_sources); +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY +//Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler +void get_ws_listhead(struct list_head **ws) +{ + if (ws) + *ws = &wakeup_sources; +} + +void wakeup_srcu_read_lock(int *srcuidx) +{ + *srcuidx = srcu_read_lock(&wakeup_srcu); +} + +void wakeup_srcu_read_unlock(int srcuidx) +{ + srcu_read_unlock(&wakeup_srcu, srcuidx); +} + +bool ws_all_release(void) +{ + unsigned int cnt, inpr; + + pr_info("Enter: %s\n", __func__); + split_counters(&cnt, &inpr); + return (!inpr) ? true : false; +} +#endif /* OPLUS_FEATURE_POWERINFO_STANDBY */ + /** * pm_wakeup_pending - Check if power transition in progress should be aborted. * @@ -944,6 +1026,14 @@ bool pm_wakeup_pending(void) spin_unlock_irqrestore(&events_lock, flags); if (ret) { + #ifndef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler + pr_debug("PM: Wakeup pending, aborting suspend\n"); + #else + pr_info("PM: Wakeup pending, aborting suspend\n"); + wakeup_reasons_statics(IRQ_NAME_ABORT, WS_CNT_ABORT); + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ + pm_print_active_wakeup_sources(); pm_get_active_wakeup_sources(suspend_abort, MAX_SUSPEND_ABORT_LEN); log_suspend_abort_reason(suspend_abort); @@ -988,6 +1078,11 @@ void pm_system_irq_wakeup(unsigned int irq_number) pr_warn("%s: %d triggered %s\n", __func__, irq_number, name); + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY + //Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler + pr_info("%s: resume caused by irq=%d, name=%s\n", __func__, irq_number, name); + wakeup_reasons_statics(name, WS_CNT_POWERKEY|WS_CNT_RTCALARM); + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY */ } pm_wakeup_irq = irq_number; pm_system_wakeup(); @@ -1169,12 +1264,27 @@ static const struct file_operations wakeup_sources_stats_fops = { .read = seq_read, .llseek = seq_lseek, .release = single_release, +#ifdef OPLUS_FEATURE_LOGKIT +//Yanzhen.Feng@ANDROID.DEBUG.702252, 2016/06/21, Add for Sync App and Kernel time + .write = watchdog_write, +#endif /* OPLUS_FEATURE_LOGKIT */ }; static int __init wakeup_sources_debugfs_init(void) { + #ifndef OPLUS_FEATURE_LOGKIT + //Yanzhen.Feng@ANDROID.DEBUG.702252, 2016/06/21, Modify for Sync App and Kernel time wakeup_sources_stats_dentry = debugfs_create_file("wakeup_sources", S_IRUGO, NULL, NULL, &wakeup_sources_stats_fops); + #else /* OPLUS_FEATURE_LOGKIT */ + wakeup_sources_stats_dentry = debugfs_create_file("wakeup_sources", + S_IRUGO| S_IWUGO, NULL, NULL, &wakeup_sources_stats_fops); + #endif /* OPLUS_FEATURE_LOGKIT */ + + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY + //SunFaliang@BSP.Power.Basic, 2020/11/18, add for standby monitor + proc_create_data("wakeup_sources", 0444, NULL, &wakeup_sources_stats_fops, NULL); + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY */ return 0; } diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 773560348337..1e2ae70621af 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c @@ -499,7 +499,12 @@ EXPORT_SYMBOL_GPL(regcache_drop_region); void regcache_cache_only(struct regmap *map, bool enable) { map->lock(map->lock_arg); + #ifndef OPLUS_ARCH_EXTENDS + /*Suresh.Alla@MULTIMEDIA.AUDIODRIVER.PLATFORM.1234162, 2020/08/14, + *Delete for uart issue due to warning log. + */ WARN_ON(map->cache_bypass && enable); + #endif /* OPLUS_ARCH_EXTENDS */ map->cache_only = enable; trace_regmap_cache_only(map, enable); map->unlock(map->lock_arg); diff --git a/drivers/block/zram/Kconfig b/drivers/block/zram/Kconfig index c8aab3115733..3d901b5b98c0 100644 --- a/drivers/block/zram/Kconfig +++ b/drivers/block/zram/Kconfig @@ -53,3 +53,12 @@ config ZRAM_MEMORY_TRACKING /sys/kernel/debug/zram/zramX/block_state. See Documentation/blockdev/zram.txt for more information. + +#ifdef OPLUS_FEATURE_ZRAM_OPT +config OPLUS_ZRAM_OPT + bool "zram optimization" + depends on ZRAM + default y + help + oplus zram optimization +#endif /*OPLUS_FEATURE_ZRAM_OPT*/ diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 5d5e1be282db..63eddd069629 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2689,7 +2689,12 @@ EXPORT_SYMBOL_GPL(clk_set_flags); static struct dentry *rootdir; static int inited = 0; +#ifndef OPLUS_FEATURE_POWERINFO_STANDBY +//Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug static u32 debug_suspend; +#else +static u32 debug_suspend = 1; +#endif /* VENDOR_EDIT */ static DEFINE_MUTEX(clk_debug_lock); static HLIST_HEAD(clk_debug_list); diff --git a/drivers/clk/qcom/mdss/mdss-dsi-pll-10nm.c b/drivers/clk/qcom/mdss/mdss-dsi-pll-10nm.c index e549ef13f578..d84ae32fa76d 100644 --- a/drivers/clk/qcom/mdss/mdss-dsi-pll-10nm.c +++ b/drivers/clk/qcom/mdss/mdss-dsi-pll-10nm.c @@ -806,9 +806,16 @@ static int dsi_pll_read_stored_trim_codes(struct mdss_pll_resources *pll_res, codes_info->pll_codes.pll_codes_2, codes_info->pll_codes.pll_codes_3); +#ifdef OPLUS_BUG_STABILITY +/*Mark.Yao@PSW.MM.Display.LCD.Params,2019-11-17 fix mipi clk setting error */ + if ((vco_clk_rate / 1000) != (codes_info->clk_rate / 1000) && + codes_info->is_valid) { +#else if (vco_clk_rate != codes_info->clk_rate && - codes_info->is_valid) + codes_info->is_valid) { +#endif /* OPLUS_BUG_STABILITY */ continue; + } pll_res->cache_pll_trim_codes[0] = codes_info->pll_codes.pll_codes_1; diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index ea51a776c6ca..a21d80ef7846 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -204,6 +204,14 @@ struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu) } EXPORT_SYMBOL_GPL(cpufreq_cpu_get_raw); +#ifdef OPLUS_FEATURE_HEALTHINFO +struct list_head *get_cpufreq_policy_list(void) +{ + return &cpufreq_policy_list; +} +EXPORT_SYMBOL(get_cpufreq_policy_list); +#endif /* OPLUS_FEATURE_HEALTHINFO */ + unsigned int cpufreq_generic_get(unsigned int cpu) { struct cpufreq_policy *policy = cpufreq_cpu_get_raw(cpu); @@ -909,6 +917,20 @@ static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf) return sprintf(buf, "%u\n", policy->cpuinfo.max_freq); } +#ifdef OPLUS_FEATURE_HEALTHINFO +//Jiheng.Xie@TECH.BSP.Performance,2019-07-29,add for cpufreq limit info +#ifdef CONFIG_OPPO_HEALTHINFO +static ssize_t show_freq_change_info(struct cpufreq_policy *policy, char *buf) +{ + ssize_t i = 0; + + i += sprintf(buf, "%u,%s\n", policy->org_max, policy->change_comm); + + return i; +} +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ + cpufreq_freq_attr_ro_perm(cpuinfo_cur_freq, 0400); cpufreq_freq_attr_ro(cpuinfo_min_freq); cpufreq_freq_attr_ro(cpuinfo_max_freq); @@ -919,6 +941,12 @@ cpufreq_freq_attr_ro(scaling_cur_freq); cpufreq_freq_attr_ro(bios_limit); cpufreq_freq_attr_ro(related_cpus); cpufreq_freq_attr_ro(affected_cpus); +#ifdef OPLUS_FEATURE_HEALTHINFO +//Jiheng.Xie@TECH.BSP.Performance,2019-07-29,add for cpufreq limit info +#ifdef CONFIG_OPPO_HEALTHINFO +cpufreq_freq_attr_ro(freq_change_info); +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ cpufreq_freq_attr_rw(scaling_min_freq); cpufreq_freq_attr_rw(scaling_max_freq); cpufreq_freq_attr_rw(scaling_governor); @@ -936,6 +964,12 @@ static struct attribute *default_attrs[] = { &scaling_driver.attr, &scaling_available_governors.attr, &scaling_setspeed.attr, +#ifdef OPLUS_FEATURE_HEALTHINFO +//Jiheng.Xie@TECH.BSP.Performance,2019-07-29,add for cpufreq limit info +#ifdef CONFIG_OPPO_HEALTHINFO + &freq_change_info.attr, +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ NULL }; @@ -2244,7 +2278,12 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy, pr_debug("setting new policy for CPU %u: %u - %u kHz\n", new_policy->cpu, new_policy->min, new_policy->max); - +#ifdef OPLUS_FEATURE_HEALTHINFO +//Jiheng.Xie@TECH.BSP.Performance,2019-07-29,add for cpufreq limit info +#ifdef CONFIG_OPPO_HEALTHINFO + policy->org_max = new_policy->max; +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ memcpy(&new_policy->cpuinfo, &policy->cpuinfo, sizeof(policy->cpuinfo)); /* @@ -2282,6 +2321,13 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy, policy->min = new_policy->min; policy->max = new_policy->max; +#ifdef OPLUS_FEATURE_HEALTHINFO +//Jiheng.Xie@TECH.BSP.Performance,2019-07-29,add for cpufreq limit info +#ifdef CONFIG_OPPO_HEALTHINFO + strncpy(policy->change_comm, current->comm, TASK_COMM_LEN); +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ + arch_set_max_freq_scale(policy->cpus, policy->max); trace_cpu_frequency_limits(policy->max, policy->min, policy->cpu); diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 9a4ca5727a74..644371a10164 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -46,6 +46,16 @@ #include #include +#ifdef OPLUS_FEATURE_LOWMEM_DBG +/* #Hailong.Liu@BSP.Kernel.MM, 2020/06/19, Add for dump memory */ +/* usage when lowmmem occurs. */ +#include +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ + +#if defined(OPLUS_FEATURE_PERFORMANCE) && defined(CONFIG_PROC_FS) +#include +#endif + static atomic_long_t name_counter; static inline int is_dma_buf_file(struct file *); @@ -78,7 +88,6 @@ static void dmabuf_dent_put(struct dma_buf *dmabuf) } } - static char *dmabuffs_dname(struct dentry *dentry, char *buffer, int buflen) { struct dma_buf *dmabuf; @@ -131,7 +140,6 @@ static void dma_buf_release(struct dentry *dentry) reservation_object_fini(dmabuf->resv); module_put(dmabuf->owner); - dmabuf_dent_put(dmabuf); } static int dma_buf_file_release(struct inode *inode, struct file *file) @@ -499,6 +507,15 @@ static inline int is_dma_buf_file(struct file *file) return file->f_op == &dma_buf_fops; } +#ifdef OPLUS_FEATURE_LOWMEM_DBG +/* #Hailong.Liu@BSP.Kernel.MM, 2020/06/19, Add for dump memory */ +/* usage when lowmmem occurs. */ +inline int oplus_is_dma_buf_file(struct file *file) +{ + return is_dma_buf_file(file); +} +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ + static struct file *dma_buf_getfile(struct dma_buf *dmabuf, int flags) { static const struct qstr this = QSTR_INIT("dmabuf", 6); @@ -1360,7 +1377,7 @@ int dma_buf_get_flags(struct dma_buf *dmabuf, unsigned long *flags) } EXPORT_SYMBOL(dma_buf_get_flags); -#ifdef CONFIG_DEBUG_FS +#if defined(CONFIG_DEBUG_FS) || (defined(OPLUS_FEATURE_PERFORMANCE) && defined(CONFIG_PROC_FS)) static int dma_buf_debug_show(struct seq_file *s, void *unused) { int ret; @@ -1601,6 +1618,7 @@ static const struct file_operations dma_procs_debug_fops = { .release = single_release }; +#ifdef CONFIG_DEBUG_FS static struct dentry *dma_buf_debugfs_dir; static int dma_buf_init_debugfs(void) @@ -1642,6 +1660,64 @@ static void dma_buf_uninit_debugfs(void) if (dma_buf_debugfs_dir) debugfs_remove_recursive(dma_buf_debugfs_dir); } +#else /* CONFIG_DEBUG_FS */ +static inline int dma_buf_init_debugfs(void) +{ + return 0; +} +static inline void dma_buf_uninit_debugfs(void) +{ +} +#endif /* CONFIG_DEBUG_FS */ + +#if defined(OPLUS_FEATURE_PERFORMANCE) && defined(CONFIG_PROC_FS) +static struct proc_dir_entry *dma_buf_procfs_root; + +int dma_buf_init_procfs(void) +{ + struct proc_dir_entry *p; + int err = 0; + + p = proc_mkdir("dma_buf", NULL); + if (IS_ERR(p)) + return PTR_ERR(p); + + dma_buf_procfs_root = p; + + p = proc_create_data("bufinfo", + S_IFREG | 0664, + dma_buf_procfs_root, + &dma_buf_debug_fops, + NULL); + if (IS_ERR(p)) { + pr_debug("dma_buf: procfs: failed to create node bufinfo\n"); + proc_remove(dma_buf_procfs_root); + dma_buf_procfs_root = NULL; + err = PTR_ERR(dma_buf_procfs_root); + return err; + } + + p = proc_create_data("dmaprocs", + S_IFREG | 0664, + dma_buf_procfs_root, + &dma_procs_debug_fops, + NULL); + if (IS_ERR(p)) { + pr_debug("dma_buf: procfs: failed to create node dmaprocs\n"); + proc_remove(dma_buf_procfs_root); + dma_buf_procfs_root = NULL; + err = PTR_ERR(dma_buf_procfs_root); + } + + return err; +} + +void dma_buf_uninit_procfs(void) +{ + proc_remove(dma_buf_procfs_root); +} +#endif /* defined(OPLUS_FEATURE_PERFORMANCE) && defined(CONFIG_PROC_FS) */ + #else static inline int dma_buf_init_debugfs(void) { @@ -1661,6 +1737,9 @@ static int __init dma_buf_init(void) mutex_init(&db_list.lock); INIT_LIST_HEAD(&db_list.head); dma_buf_init_debugfs(); +#if defined(OPLUS_FEATURE_PERFORMANCE) && defined(CONFIG_PROC_FS) + dma_buf_init_procfs(); +#endif return 0; } subsys_initcall(dma_buf_init); @@ -1669,5 +1748,8 @@ static void __exit dma_buf_deinit(void) { dma_buf_uninit_debugfs(); kern_unmount(dma_buf_mnt); +#if defined(OPLUS_FEATURE_PERFORMANCE) && defined(CONFIG_PROC_FS) + dma_buf_uninit_procfs(); +#endif } __exitcall(dma_buf_deinit); diff --git a/drivers/firmware/qcom/Kconfig b/drivers/firmware/qcom/Kconfig index 61c797430bd6..106d4b2f66dc 100644 --- a/drivers/firmware/qcom/Kconfig +++ b/drivers/firmware/qcom/Kconfig @@ -1,6 +1,8 @@ config MSM_TZ_LOG tristate "MSM Trust Zone (TZ) Log Driver" - depends on DEBUG_FS + #ifdef OPLUS_FEATURE_SECURITY_COMMON + #depends on DEBUG_FS + #endif help This option enables a driver with a debugfs interface for messages produced by the Secure code (Trust zone). These messages provide diff --git a/drivers/firmware/qcom/tz_log.c b/drivers/firmware/qcom/tz_log.c index f0887b823b84..e9dcd46dc0aa 100644 --- a/drivers/firmware/qcom/tz_log.c +++ b/drivers/firmware/qcom/tz_log.c @@ -30,6 +30,10 @@ #include #include +//#ifdef OPLUS_FEATURE_SECURITY_COMMON +#include +#define TZDBG_DIR_NAME "tzdbg" +//#endif /* QSEE_LOG_BUF_SIZE = 32K */ #define QSEE_LOG_BUF_SIZE 0x8000 @@ -808,7 +812,12 @@ static ssize_t tzdbgfs_read(struct file *file, char __user *buf, size_t count, loff_t *offp) { int len = 0; - int *tz_id = file->private_data; +//#ifdef OPLUS_FEATURE_SECURITY_COMMON + struct seq_file *seq = file->private_data; + int *tz_id = (int *)(seq->private); +//else + //int *tz_id = file->private_data; +//#endif if (*tz_id == TZDBG_BOOT || *tz_id == TZDBG_RESET || *tz_id == TZDBG_INTERRUPT || *tz_id == TZDBG_GENERAL || @@ -867,16 +876,29 @@ static ssize_t tzdbgfs_read(struct file *file, char __user *buf, tzdbg.stat[(*tz_id)].data, len); } +//#ifdef OPLUS_FEATURE_SECURITY_COMMON +static int tzdbg_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, NULL, PDE_DATA(inode)); +} +//#elseif +/* static int tzdbgfs_open(struct inode *inode, struct file *pfile) { pfile->private_data = inode->i_private; return 0; } - +*/ +//#endif const struct file_operations tzdbg_fops = { .owner = THIS_MODULE, .read = tzdbgfs_read, - .open = tzdbgfs_open, +//#ifdef OPLUS_FEATURE_SECURITY_COMMON + .open = tzdbg_proc_open, + .release = single_release, +//else + //.open = tzdbgfs_open, +//#endif }; @@ -939,6 +961,61 @@ err: return; } +//#ifdef OPLUS_FEATURE_SECURITY_COMMON +//change tzdbg node to proc. +static int tzdbg_procfs_init(struct platform_device *pdev) +{ + int rc = 0; + int i; + struct proc_dir_entry *dent_dir; + struct proc_dir_entry *dent; + + dent_dir = proc_mkdir(TZDBG_DIR_NAME, NULL); + if (dent_dir == NULL) { + dev_err(&pdev->dev, "tzdbg proc_mkdir failed\n"); + return -ENOMEM; + } + + for (i = 0; i < TZDBG_STATS_MAX; i++) { + tzdbg.debug_tz[i] = i; + dent = proc_create_data(tzdbg.stat[i].name, + 0444, dent_dir, + &tzdbg_fops, &tzdbg.debug_tz[i]); + if (dent == NULL) { + dev_err(&pdev->dev, "TZ proc_create_data failed\n"); + rc = -ENOMEM; + goto err; + } + } + tzdbg.disp_buf = kzalloc(max(debug_rw_buf_size, + tzdbg.hyp_debug_rw_buf_size), GFP_KERNEL); + if (tzdbg.disp_buf == NULL) + goto err; + platform_set_drvdata(pdev, dent_dir); + return 0; +err: + if(dent_dir){ + remove_proc_entry(TZDBG_DIR_NAME, NULL); + } + + return rc; +} + +static void tzdbg_procfs_exit(struct platform_device *pdev) +{ + struct proc_dir_entry *dent_dir; + + kzfree(tzdbg.disp_buf); + dent_dir = platform_get_drvdata(pdev); + if(dent_dir){ + remove_proc_entry(TZDBG_DIR_NAME, NULL); + } + if (g_qsee_log) + dma_free_coherent(&pdev->dev, QSEE_LOG_BUF_SIZE, + (void *)g_qsee_log, coh_pmem); +} +//else +/* static int tzdbgfs_init(struct platform_device *pdev) { int rc = 0; @@ -986,7 +1063,8 @@ static void tzdbgfs_exit(struct platform_device *pdev) dma_free_coherent(&pdev->dev, QSEE_LOG_BUF_SIZE, (void *)g_qsee_log, coh_pmem); } - +*/ +//#endif static int __update_hypdbg_base(struct platform_device *pdev, void __iomem *virt_iobase) { @@ -1138,7 +1216,11 @@ static int tz_log_probe(struct platform_device *pdev) tzdbg.diag_buf = (struct tzdbg_t *)ptr; - if (tzdbgfs_init(pdev)) +//#ifdef OPLUS_FEATURE_SECURITY_COMMON + if (tzdbg_procfs_init(pdev)) +//else + //if (tzdbgfs_init(pdev)) +//#endif goto err; tzdbg_register_qsee_log_buf(pdev); @@ -1156,7 +1238,11 @@ static int tz_log_remove(struct platform_device *pdev) kzfree(tzdbg.diag_buf); if (tzdbg.hyp_diag_buf) kzfree(tzdbg.hyp_diag_buf); - tzdbgfs_exit(pdev); + //#ifdef OPLUS_FEATURE_SECURITY_COMMON + tzdbg_procfs_exit(pdev); + //else + //tzdbgfs_exit(pdev); + //#endif return 0; } diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 0746ac89fcc5..f37dabd6b86c 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -1055,7 +1055,11 @@ EXPORT_SYMBOL(mipi_dsi_dcs_set_tear_scanline); int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi, u16 brightness) { - u8 payload[2] = { brightness & 0xff, brightness >> 8 }; +//#ifdef OPLUS_BUG_STABILITY +//Jiasong.Zhong@PSW.MM.Display.LCD.Stable, 2020/02/27, Add for fix 10bit Backlight + //u8 payload[2] = { brightness & 0xff, brightness >> 8 }; + u8 payload[2] = { brightness >> 8, brightness & 0xff }; +//#endif /* OPLUS_BUG_STABILITY */ ssize_t err; err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS, diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile index 2b1183f91029..8dc3e0128577 100644 --- a/drivers/gpu/drm/msm/Makefile +++ b/drivers/gpu/drm/msm/Makefile @@ -2,6 +2,7 @@ ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/msm -Idrivers/gpu/drm/msm/dsi-staging -Idrivers/gpu/drm/msm/dp ccflags-y += -Idrivers/gpu/drm/msm/display-manager ccflags-$(CONFIG_DRM_MSM_DSI) += -Idrivers/gpu/drm/msm/dsi +ccflags-y += -Idrivers/gpu/drm/msm/oplus ccflags-$(CONFIG_DRM_MSM_DSI_PLL) += -Idrivers/gpu/drm/msm/dsi ccflags-y += -Idrivers/gpu/drm/msm/sde ccflags-y += -Idrivers/media/platform/msm/sde/rotator @@ -219,4 +220,21 @@ msm_drm-$(CONFIG_DRM_MSM) += \ msm_fence.o \ msm_debugfs.o +msm_drm-y += oplus/oppo_mm_kevent_fb.o \ + oplus/oppo_mm_kevent.o \ + oplus/oppo_dsi_support.o \ + oplus/oppo_display_private_api.o \ + oplus/oppo_dc_diming.o \ + oplus/oppo_onscreenfingerprint.o \ + oplus/oppo_aod.o \ + oplus/oppo_ffl.o \ + oplus/oppo_display_panel.o \ + oplus/oppo_display_panel_power.o \ + oplus/oppo_display_panel_seed.o \ + oplus/oppo_display_panel_common.o \ + oplus/oppo_display_panel_hbm.o + +#xupengcheng@MULTIMEDIA.MM.Display.LCD.Stability,2020/09/18,add for 19696 LCD CABC feature +msm_drm-y += oplus/oplus_display_panel_cabc.o + obj-$(CONFIG_DRM_MSM) += msm_drm.o diff --git a/drivers/gpu/drm/msm/dp/dp_aux.c b/drivers/gpu/drm/msm/dp/dp_aux.c index c5d7bbeb6393..4be16e785ab9 100644 --- a/drivers/gpu/drm/msm/dp/dp_aux.c +++ b/drivers/gpu/drm/msm/dp/dp_aux.c @@ -14,7 +14,12 @@ #define pr_fmt(fmt) "[drm-dp] %s: " fmt, __func__ +#ifndef OPLUS_FEATURE_DP_MAX20328 +/*Mark.Yao@PSW.MM.Display.LCD.Stable,2018-11-05 support max20328 dp switch */ #include +#else /* OPLUS_FEATURE_DP_MAX20328 */ +#include +#endif /* OPLUS_FEATURE_DP_MAX20328 */ #include #include @@ -817,7 +822,12 @@ static int dp_aux_configure_aux_switch(struct dp_aux *dp_aux, { struct dp_aux_private *aux; int rc = 0; +#ifndef OPLUS_FEATURE_DP_MAX20328 +/*Mark.Yao@PSW.MM.Display.LCD.Stable,2018-11-05 support max20328 dp switch */ enum fsa_function event = FSA_USBC_DISPLAYPORT_DISCONNECTED; +#else /* OPLUS_FEATURE_DP_MAX20328 */ + enum max20328_function event = MAX20328_USBC_DISPLAYPORT_DISCONNECTED; +#endif /* OPLUS_FEATURE_DP_MAX20328 */ if (!dp_aux) { pr_err("invalid input\n"); @@ -828,19 +838,34 @@ static int dp_aux_configure_aux_switch(struct dp_aux *dp_aux, aux = container_of(dp_aux, struct dp_aux_private, dp_aux); if (!aux->aux_switch_node) { + #ifndef OPLUS_FEATURE_DP_MAX20328 + /*Mark.Yao@PSW.MM.Display.LCD.Stable,2018-11-05 support max20328 dp switch */ pr_debug("undefined fsa4480 handle\n"); + #else /* OPLUS_FEATURE_DP_MAX20328 */ + pr_debug("undefined max20328 handle\n"); + #endif /* OPLUS_FEATURE_DP_MAX20328 */ rc = -EINVAL; goto end; } if (enable) { switch (orientation) { + #ifndef OPLUS_FEATURE_DP_MAX20328 + /*Mark.Yao@PSW.MM.Display.LCD.Stable,2018-11-05 support max20328 dp switch */ case ORIENTATION_CC1: event = FSA_USBC_ORIENTATION_CC1; break; case ORIENTATION_CC2: event = FSA_USBC_ORIENTATION_CC2; break; + #else /* OPLUS_FEATURE_DP_MAX20328 */ + case ORIENTATION_CC1: + event = MAX20328_USBC_ORIENTATION_CC1; + break; + case ORIENTATION_CC2: + event = MAX20328_USBC_ORIENTATION_CC2; + break; + #endif /* OPLUS_FEATURE_DP_MAX20328 */ default: pr_err("invalid orientation\n"); rc = -EINVAL; @@ -851,9 +876,16 @@ static int dp_aux_configure_aux_switch(struct dp_aux *dp_aux, pr_debug("enable=%d, orientation=%d, event=%d\n", enable, orientation, event); + #ifndef OPLUS_FEATURE_DP_MAX20328 + /*Mark.Yao@PSW.MM.Display.LCD.Stable,2018-11-05 support max20328 dp switch */ rc = fsa4480_switch_event(aux->aux_switch_node, event); if (rc) pr_err("failed to configure fsa4480 i2c device (%d)\n", rc); + #else /* OPLUS_FEATURE_DP_MAX20328 */ + rc = max20328_switch_event(event); + if (rc) + pr_err("failed to configure max20328 i2c device (%d)\n", rc); + #endif /* OPLUS_FEATURE_DP_MAX20328 */ end: return rc; } diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index fb7811d5bfee..767768dcb16a 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -21,7 +21,12 @@ #include #include #include +#ifndef OPLUS_FEATURE_DP_MAX20328 +/*Mark.Yao@PSW.MM.Display.LCD.Stable,2018-11-05 support max20328 dp switch */ #include +#else /* OPLUS_FEATURE_DP_MAX20328 */ +#include +#endif /* OPLUS_FEATURE_DP_MAX20328 */ #include "sde_connector.h" @@ -104,7 +109,12 @@ struct dp_display_private { struct workqueue_struct *wq; struct delayed_work hdcp_cb_work; + #ifdef OPLUS_FEATURE_DP_MAX20328 + /*Mark.Yao@PSW.MM.Display.LCD.Stable,2019-04-14 fix dp connect timeout on bootup */ + struct delayed_work connect_work; + #else /* OPLUS_FEATURE_DP_MAX20328 */ struct work_struct connect_work; + #endif /* OPLUS_FEATURE_DP_MAX20328 */ struct work_struct attention_work; struct mutex session_lock; bool suspended; @@ -935,7 +945,12 @@ static int dp_display_usbpd_configure_cb(struct device *dev) /* check for hpd high */ if (dp->hpd->hpd_high) + #ifdef OPLUS_FEATURE_DP_MAX20328 + /*Mark.Yao@PSW.MM.Display.LCD.Stable,2019-04-14 fix dp connect timeout on bootup */ + queue_delayed_work(dp->wq, &dp->connect_work, 0); + #else /* OPLUS_FEATURE_DP_MAX20328 */ queue_work(dp->wq, &dp->connect_work); + #endif /* OPLUS_FEATURE_DP_MAX20328 */ else dp->process_hpd_connect = true; mutex_unlock(&dp->session_lock); @@ -1032,7 +1047,12 @@ static void dp_display_disconnect_sync(struct dp_display_private *dp) dp->aux->abort(dp->aux, false); /* wait for idle state */ + #ifdef OPLUS_FEATURE_DP_MAX20328 + /*Mark.Yao@PSW.MM.Display.LCD.Stable,2019-04-14 fix dp connect timeout on bootup */ + cancel_delayed_work(&dp->connect_work); + #else /* OPLUS_FEATURE_DP_MAX20328 */ cancel_work(&dp->connect_work); + #endif /* OPLUS_FEATURE_DP_MAX20328 */ cancel_work(&dp->attention_work); flush_workqueue(dp->wq); @@ -1124,7 +1144,12 @@ static void dp_display_attention_work(struct work_struct *work) dp_display_handle_disconnect(dp); } else { if (!dp->mst.mst_active) + #ifdef OPLUS_FEATURE_DP_MAX20328 + /*Mark.Yao@PSW.MM.Display.LCD.Stable,2019-04-14 fix dp connect timeout on bootup */ + queue_delayed_work(dp->wq, &dp->connect_work, 0); + #else /* OPLUS_FEATURE_DP_MAX20328 */ queue_work(dp->wq, &dp->connect_work); + #endif /* OPLUS_FEATURE_DP_MAX20328 */ } goto mst_attention; @@ -1134,7 +1159,12 @@ static void dp_display_attention_work(struct work_struct *work) dp_display_handle_disconnect(dp); dp->panel->video_test = true; + #ifdef OPLUS_FEATURE_DP_MAX20328 + /*Mark.Yao@PSW.MM.Display.LCD.Stable,2019-04-14 fix dp connect timeout on bootup */ + queue_delayed_work(dp->wq, &dp->connect_work, 0); + #else /* OPLUS_FEATURE_DP_MAX20328 */ queue_work(dp->wq, &dp->connect_work); + #endif /* OPLUS_FEATURE_DP_MAX20328 */ goto mst_attention; } @@ -1192,18 +1222,34 @@ static int dp_display_usbpd_attention_cb(struct device *dev) dp->debug->mst_hpd_sim) queue_work(dp->wq, &dp->attention_work); else if (dp->process_hpd_connect || !dp->is_connected) + #ifdef OPLUS_FEATURE_DP_MAX20328 + /*Mark.Yao@PSW.MM.Display.LCD.Stable,2019-04-14 fix dp connect timeout on bootup */ + queue_delayed_work(dp->wq, &dp->connect_work, 0); + #else /* OPLUS_FEATURE_DP_MAX20328 */ queue_work(dp->wq, &dp->connect_work); + #endif /* OPLUS_FEATURE_DP_MAX20328 */ else pr_debug("ignored\n"); return 0; } +#ifdef OPLUS_FEATURE_DP_MAX20328 +/*Mark.Yao@PSW.MM.Display.LCD.Stable,2019-04-13 fix dp bootup timeout */ +extern int oppo_display_audio_ready; +#endif /* OPLUS_FEATURE_DP_MAX20328 */ static void dp_display_connect_work(struct work_struct *work) { int rc = 0; + #ifdef OPLUS_FEATURE_DP_MAX20328 + /*Mark.Yao@PSW.MM.Display.LCD.Stable,2019-04-14 fix dp connect timeout on bootup */ + struct delayed_work *dw = to_delayed_work(work); + struct dp_display_private *dp = container_of(dw, + struct dp_display_private, connect_work); + #else /* OPLUS_FEATURE_DP_MAX20328 */ struct dp_display_private *dp = container_of(work, struct dp_display_private, connect_work); + #endif /* OPLUS_FEATURE_DP_MAX20328 */ if (atomic_read(&dp->aborted)) { pr_warn("HPD off requested\n"); @@ -1215,6 +1261,16 @@ static void dp_display_connect_work(struct work_struct *work) return; } + #ifdef OPLUS_FEATURE_DP_MAX20328 + /*Mark.Yao@PSW.MM.Display.LCD.Stable,2019-04-14 fix dp connect timeout on bootup */ + if (!oppo_display_audio_ready) { + if (ktime_to_ms(ktime_get()) < 80000) { + queue_delayed_work(dp->wq, &dp->connect_work, 5*HZ); + pr_warn("Wait for display and audio service ready\n"); + return; + } + } + #endif /* OPLUS_FEATURE_DP_MAX20328 */ rc = dp_display_process_hpd_high(dp); if (!rc && dp->panel->video_test) @@ -2177,7 +2233,12 @@ static int dp_display_create_workqueue(struct dp_display_private *dp) } INIT_DELAYED_WORK(&dp->hdcp_cb_work, dp_display_hdcp_cb_work); + #ifdef OPLUS_FEATURE_DP_MAX20328 + /*Mark.Yao@PSW.MM.Display.LCD.Stable,2019-04-14 fix dp connect timeout on bootup */ + INIT_DELAYED_WORK(&dp->connect_work, dp_display_connect_work); + #else /* OPLUS_FEATURE_DP_MAX20328 */ INIT_WORK(&dp->connect_work, dp_display_connect_work); + #endif /* OPLUS_FEATURE_DP_MAX20328 */ INIT_WORK(&dp->attention_work, dp_display_attention_work); return 0; @@ -2211,6 +2272,10 @@ static int dp_display_fsa4480_callback(struct notifier_block *self, return 0; } +#ifdef OPLUS_FEATURE_DP_MAX20328 +/*Mark.Yao@PSW.MM.Display.LCD.Stable,2018-12-28 limit dp aux switch probe defer times*/ +static int dp_retry_times = 10; +#endif /* OPLUS_FEATURE_DP_MAX20328 */ static int dp_display_init_aux_switch(struct dp_display_private *dp) { int rc = 0; @@ -2230,6 +2295,8 @@ static int dp_display_init_aux_switch(struct dp_display_private *dp) goto end; } +#ifndef OPLUS_FEATURE_DP_MAX20328 +/*Mark.Yao@PSW.MM.Display.LCD.Stable,2018-11-05 support max20328 dp switch */ nb.notifier_call = dp_display_fsa4480_callback; nb.priority = 0; @@ -2240,6 +2307,34 @@ static int dp_display_init_aux_switch(struct dp_display_private *dp) } fsa4480_unreg_notifier(&nb, dp->aux_switch_node); +#else /* OPLUS_FEATURE_DP_MAX20328 */ + if (!of_device_is_compatible(dp->aux_switch_node, "max20328")) { + pr_err("Unsupport aux switch device node %s\n", dp->aux_switch_node->full_name); + dp->aux_switch_node = NULL; + goto end; + } + if (!of_device_is_available(dp->aux_switch_node)) { + pr_err("dp aux switch device not available\n"); + dp->aux_switch_node = NULL; + goto end; + } + nb.notifier_call = dp_display_fsa4480_callback; + nb.priority = 0; + + rc = max20328_reg_notifier(&nb, dp->aux_switch_node); + if (rc) { + pr_err("failed to register notifier (%d)\n", rc); + if (dp_retry_times > 0) { + dp_retry_times--; + } else { + rc = 0; + dp->aux_switch_node = NULL; + } + goto end; + } + max20328_unreg_notifier(&nb, dp->aux_switch_node); +#endif /* OPLUS_FEATURE_DP_MAX20328 */ + end: return rc; } diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c b/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c index 243c213e89e6..27601ab55bed 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c @@ -81,6 +81,11 @@ static const struct of_device_id msm_dsi_of_match[] = { {} }; +// #ifdef OPLUS_BUG_STABILITY +/* Shusheng.Bei@MULTIMEDIA.DISPLAY.LCD, 2020/11/10, modified for bring up NT36672C JDI panel */ +u32 g_scramble_switch_value = 0; +// #endif /*OPLUS_BUG_STABILITY*/ + #ifdef CONFIG_DEBUG_FS static ssize_t debugfs_state_info_read(struct file *file, char __user *buff, @@ -1762,7 +1767,13 @@ static int dsi_ctrl_dts_parse(struct dsi_ctrl *dsi_ctrl, dsi_ctrl != NULL, of_node != NULL); return -EINVAL; } - +// #ifdef OPLUS_BUG_STABILITY +/* Shusheng.Bei@MULTIMEDIA.DISPLAY.LCD, 2020/11/10, modified for bring up NT36672C JDI panel */ + rc = of_property_read_u32(of_node, "oplus,scramble-switch", &g_scramble_switch_value); + if (rc) { + pr_debug("of_property_read_u32() failed\n"); + } +// #endif /*OPLUS_BUG_STABILITY*/ rc = of_property_read_u32(of_node, "cell-index", &index); if (rc) { pr_debug("cell index not set, default to 0\n"); @@ -2401,7 +2412,12 @@ static void dsi_ctrl_handle_error_status(struct dsi_ctrl *dsi_ctrl, 0, 0, 0, 0); } } + #ifndef OPLUS_BUG_STABILITY + /*Mark.Yao@PSW.MM.Display.Lcd.Stability, 2018-05-24,avoid printk too often*/ pr_err("tx timeout error: 0x%lx\n", error); + #else /* OPLUS_BUG_STABILITY */ + pr_err_ratelimited("tx timeout error: 0x%lx\n", error); + #endif /* OPLUS_BUG_STABILITY */ } /* DSI FIFO OVERFLOW error */ diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl_hw_cmn.c b/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl_hw_cmn.c index 655f1f5875e5..b62022e992b8 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl_hw_cmn.c +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl_hw_cmn.c @@ -37,6 +37,11 @@ static const u8 cmd_mode_format_map[DSI_PIXEL_FORMAT_MAX] = { static const u8 video_mode_format_map[DSI_PIXEL_FORMAT_MAX] = { 0x0, 0x1, 0x2, 0x3, 0x3, 0x3, 0x3 }; +// #ifdef OPLUS_BUG_STABILITY +/* Shusheng.Bei@MULTIMEDIA.DISPLAY.LCD, 2020/11/10, modified for bring up NT36672C JDI panel */ +extern u32 g_scramble_switch_value; +// #endif /*OPLUS_BUG_STABILITY*/ + /** * dsi_split_link_setup() - setup dsi split link configurations * @ctrl: Pointer to the controller host hardware. @@ -102,13 +107,17 @@ void dsi_ctrl_hw_cmn_host_setup(struct dsi_ctrl_hw *ctrl, dsi_setup_trigger_controls(ctrl, cfg); dsi_split_link_setup(ctrl, cfg); + #ifdef OPLUS_BUG_STABILITY + /* Liping-M@PSW.MM.Display.LCD,2020/6/03, Modify for LCD MIPI timming */ + DSI_W32(ctrl, DSI_TEST_PATTERN_GEN_VIDEO_ENABLE, 1); + #endif /* OPLUS_BUG_STABILITY */ /* Setup T_CLK_PRE extend register */ - reg_value = DSI_R32(ctrl, DSI_TEST_PATTERN_GEN_VIDEO_ENABLE); - if (cfg->t_clk_pre_extend) - reg_value |= BIT(0); - else - reg_value &= ~BIT(0); - DSI_W32(ctrl, DSI_TEST_PATTERN_GEN_VIDEO_ENABLE, reg_value); + //reg_value = DSI_R32(ctrl, DSI_TEST_PATTERN_GEN_VIDEO_ENABLE); + //if (cfg->t_clk_pre_extend) + // reg_value |= BIT(0); + //else + // reg_value &= ~BIT(0); + //DSI_W32(ctrl, DSI_TEST_PATTERN_GEN_VIDEO_ENABLE, reg_value); /* Setup clocking timing controls */ reg_value = ((cfg->t_clk_post & 0x3F) << 8); @@ -521,7 +530,12 @@ void dsi_ctrl_hw_cmn_video_engine_setup(struct dsi_ctrl_hw *ctrl, DSI_W32(ctrl, DSI_VIDEO_MODE_DATA_CTRL, reg); /* Disable Timing double buffering */ DSI_W32(ctrl, DSI_DSI_TIMING_DB_MODE, 0x0); - +// #ifdef OPLUS_BUG_STABILITY +/* Shusheng.Bei@MULTIMEDIA.DISPLAY.LCD, 2020/11/06, modified for bring up NT36672C JDI panel */ + if (1 == g_scramble_switch_value) { + DSI_W32(ctrl, DSI_SCRAMBLE_CTRL, 0x1); + } +// #endif /*OPLUS_BUG_STABILITY*/ pr_debug("[DSI_%d] Video engine setup done\n", ctrl->index); } diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl_reg.h b/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl_reg.h index 9f3c8c893794..14079b7e0f35 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl_reg.h +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl_reg.h @@ -156,6 +156,8 @@ #define DSI_CPHY_MODE_CTRL (0x02D8) #define DSI_LOGICAL_LANE_SWAP_CTRL (0x0310) #define DSI_SPLIT_LINK (0x0330) - - +// #ifdef OPLUS_BUG_STABILITY +/* Shusheng.Bei@MULTIMEDIA.DISPLAY.LCD, 2020/11/06, modified for bring up NT36672C JDI panel */ +#define DSI_SCRAMBLE_CTRL (0x0328) +// #endif /*OPLUS_BUG_STABILITY*/ #endif /* _DSI_CTRL_REG_H_ */ diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_defs.h b/drivers/gpu/drm/msm/dsi-staging/dsi_defs.h index 3613e8e1588b..b0d08745497e 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_defs.h +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_defs.h @@ -53,6 +53,18 @@ #define display_for_each_ctrl(index, display) \ for (index = 0; (index < (display)->ctrl_count) &&\ (index < MAX_DSI_CTRLS_PER_DISPLAY); index++) +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@MM.Display.LCD.Stability,2020/10/08 + * debug logs +*/ +#define DSI_WARN(fmt, ...) DRM_WARN("[msm-dsi-warn]: "fmt, ##__VA_ARGS__) +#define DSI_ERR(fmt, ...) DRM_DEV_ERROR(NULL, "[msm-dsi-error]: " fmt, \ + ##__VA_ARGS__) +#define DSI_INFO(fmt, ...) DRM_DEV_INFO(NULL, "[msm-dsi-info]: "fmt, \ + ##__VA_ARGS__) +#define DSI_DEBUG(fmt, ...) DRM_DEV_DEBUG(NULL, "[msm-dsi-debug]: "fmt, \ + ##__VA_ARGS__) +#endif /* OPLUS_BUG_STABILITY */ /** * enum dsi_pixel_format - DSI pixel formats * @DSI_PIXEL_FORMAT_RGB565: @@ -282,6 +294,23 @@ enum dsi_dyn_clk_feature_type { * @DSI_CMD_SET_POST_TIMING_SWITCH: Post timing switch * @DSI_CMD_SET_QSYNC_ON Enable qsync mode * @DSI_CMD_SET_QSYNC_OFF Disable qsync mode + #ifdef OPLUS_BUG_STABILITY + * @ Gou shengjun@PSW.MM.Display.LCD.Stability,2018/12/14, add for lcd notes + * @DSI_CMD_POST_ON_BACKLIGHT: Panel on cmd send for AOD and Fingerprint + * @DSI_CMD_AOD_ON: Panel AOD on cmd + * @DSI_CMD_AOD_OFF: Panel AOD off cmd + * @DSI_CMD_HBM_ON: Panel Fingerprint high brightness 670nit on cmd + * @DSI_CMD_HBM_OFF: Panel Fingerprint high brightness off cmd + * @DSI_CMD_AOD_HBM_ON: Panel AOD and Fingerprint high brightness 670nit on cmd + * @DSI_CMD_AOD_HBM_OFF: Panel AOD and Fingerprint high brightness off cmd + * @DSI_CMD_SEED_DCI_P3: Panel seed level 3 cmd + * @DSI_CMD_SEED_SRGB: Panel seed SRGB mode cmd + * @DSI_CMD_SEED_OFF: Panel seed off cmd + * @DSI_CMD_NORMAL_HBM_ON: Panel normal HBM 600nit on cmd + * @DSI_CMD_CABC_OFF: Shutdown IC CABC cmd + * @DSI_CMD_CABC_LOW_LEVEL: Load 11.5% CABC cmd + * @DSI_CMD_CABC_HIGH_LEVEL, Load 25% CABC cmd +#endif // OPLUS_BUG_STABILITY * @DSI_CMD_SET_MAX */ enum dsi_cmd_set_type { @@ -308,6 +337,52 @@ enum dsi_cmd_set_type { DSI_CMD_SET_POST_TIMING_SWITCH, DSI_CMD_SET_QSYNC_ON, DSI_CMD_SET_QSYNC_OFF, +#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.LCD.Stability,2018/07/03 + * optimize screen on +*/ + DSI_CMD_POST_ON_BACKLIGHT, + DSI_CMD_AOD_ON, + DSI_CMD_AOD_OFF, + DSI_CMD_HBM_ON, + DSI_CMD_HBM_OFF, + DSI_CMD_AOD_HBM_ON, + DSI_CMD_AOD_HBM_OFF, +/*mark.yao@PSW.MM.Display.LCD.Stability,2018/4/28,add for sRGB and DCI-P3*/ + DSI_CMD_SEED_MODE0, + DSI_CMD_SEED_MODE1, + DSI_CMD_SEED_MODE2, + DSI_CMD_SEED_MODE3, + DSI_CMD_SEED_MODE4, + DSI_CMD_SEED_OFF, + DSI_CMD_NORMAL_HBM_ON, + DSI_CMD_AOD_HIGH_LIGHT_MODE, + DSI_CMD_AOD_LOW_LIGHT_MODE, + DSI_CMD_CABC_OFF, + DSI_CMD_CABC_LOW_MODE, + DSI_CMD_CABC_HIGH_MODE, + DSI_CMD_DATA_DIMMING_ON, + DSI_CMD_DATA_DIMMING_OFF, + DSI_CMD_OSC_CLK_MODEO0, + DSI_CMD_OSC_CLK_MODEO1, +/*Song.Gao@PSW.MM.Display.LCD.Stability,2020/04/21,add for DC backlight V2 enter and exit sequence*/ + DSI_CMD_SEED_ENTER, + DSI_CMD_SEED_EXIT, + DSI_CMD_HBM_ENTER_SWITCH, + DSI_CMD_HBM_EXIT_SWITCH, + DSI_CMD_LEVELKEY_END, +#ifdef OPLUS_FEATURE_AOD_RAMLESS +/*Jiasong.Zhong@PSW.MM.Display.LCD.Stability,2019/11/18,add FAIL SAFE API for 19125 panel*/ + DSI_CMD_FAILSAFE_ON, + DSI_CMD_FAILSAFE_OFF, +#endif /* OPLUS_FEATURE_AOD_RAMLESS */ +#ifdef OPLUS_FEATURE_LCD_CABC +/*xupengcheng@MULTIMEDIA.MM.Display.LCD.Stability,2020/09/18,add for 19696 LCD CABC feature*/ + DSI_CMD_CABC_UI, + DSI_CMD_CABC_IMAGE, + DSI_CMD_CABC_VIDEO, +#endif /*OPLUS_FEATURE_LCD_CABC*/ +#endif /* OPLUS_BUG_STABILITY */ DSI_CMD_SET_MAX }; @@ -616,6 +691,18 @@ struct dsi_display_mode_priv_info { struct msm_display_dsc_info dsc; bool dsc_enabled; struct msm_roi_caps roi_caps; + #ifdef OPLUS_BUG_STABILITY + /*Sachin Shukla@PSW.MM.Display.LCD.Stable,2019-11-17 add for fingerprint */ + int fod_th_brightness; + int fod_on_vblank; + int fod_off_vblank; + int fod_on_delay; + int fod_off_delay; + int fod_on_vblank_above_th; + int fod_off_vblank_above_th; + int fod_on_delay_above_th; + int fod_off_delay_above_th; + #endif /* OPLUS_BUG_STABILITY */ }; /** diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_display.c b/drivers/gpu/drm/msm/dsi-staging/dsi_display.c index 769801f16010..4c5daa616037 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_display.c +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_display.c @@ -33,6 +33,45 @@ #include "dsi_parser.h" #include "dsi_phy.h" +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.Lcd.Stability, 2018-05-31 + * add for drm notifier for display connect +*/ +#include "oppo_mm_kevent_fb.h" +#include +#include +#include "oppo_display_private_api.h" +#include "oppo_ffl.h" +#include +extern int msm_drm_notifier_call_chain(unsigned long val, void *v); +/* Don't panic if smmu fault*/ +extern int sde_kms_set_smmu_no_fatal_faults(struct drm_device *drm); +#ifdef OPLUS_BUG_STABILITY +//Sachin@PSW.BSP.TP, 2020/02/27, Add for notify TP display fps change +__attribute__((weak)) void sec_refresh_switch(int fps) +{ + return; +} +#endif /* OPLUS_BUG_STABILITY */ + +#ifdef OPLUS_FEATURE_TP_BASIC +//Qicai.gu@PSW.BSP.TP, 2020/08/21, Add for notify TP display fps change +__attribute__((weak)) void lcd_tp_refresh_switch(int fps) +{ + return; +} +#endif /* OPLUS_FEATURE_TP_BASIC*/ + +/* Add for solve sau issue*/ +extern int lcd_closebl_flag; +/* Add for fingerprint silence*/ +extern int lcd_closebl_flag_fp; +/* Add for ffl feature */ +extern bool oppo_ffl_trigger_finish; +/* Add for first osc clk setting*/ +extern int osc_count; +#endif /* OPLUS_BUG_STABILITY */ + #define to_dsi_display(x) container_of(x, struct dsi_display, host) #define INT_BASE_10 10 #define NO_OVERRIDE -1 @@ -45,6 +84,14 @@ #define DSI_CLOCK_BITRATE_RADIX 10 #define MAX_TE_SOURCE_ID 2 +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.Lcd.Stability, 2018-05-31 + * add for drm notifier for display connect +*/ +static struct dsi_display *primary_display; +static struct dsi_display *secondary_display; +#endif /* OPLUS_BUG_STABILITY */ + DEFINE_MUTEX(dsi_display_clk_mutex); static char dsi_display_primary[MAX_CMDLINE_PARAM_LEN]; @@ -198,12 +245,46 @@ int dsi_display_set_backlight(struct drm_connector *connector, panel = dsi_display->panel; + mutex_lock(&panel->panel_lock); if (!dsi_panel_initialized(panel)) { rc = -EINVAL; goto error; } +#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.LCD.Stable,2018-06-27 + * Add key log for debug +*/ + if ((bl_lvl == 0 && panel->bl_config.bl_level != 0) || + (bl_lvl != 0 && panel->bl_config.bl_level == 0)) + pr_err("backlight level changed %d -> %d\n", + panel->bl_config.bl_level, bl_lvl); + /* Add some delay to avoid screen flash */ + if (panel->need_power_on_backlight && bl_lvl) { + panel->need_power_on_backlight = false; + rc = dsi_display_clk_ctrl(dsi_display->dsi_clk_handle, + DSI_CORE_CLK, DSI_CLK_ON); + if (rc) { + pr_err("[%s] failed to send DSI_CMD_POST_ON_BACKLIGHT cmds, rc=%d\n", + panel->name, rc); + goto error; + } + + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_POST_ON_BACKLIGHT); + + rc = dsi_display_clk_ctrl(dsi_display->dsi_clk_handle, + DSI_CORE_CLK, DSI_CLK_OFF); + if (rc) { + pr_err("[%s] failed to send DSI_CMD_POST_ON_BACKLIGHT cmds, rc=%d\n", + panel->name, rc); + goto error; + } + + /* Gou shengjun@PSW.MM.Display.LCD.Stable,2018-10-25 fix ffl dsi abnormal on esd scene */ + //oppo_start_ffl_thread(); + } +#endif /* OPLUS_BUG_STABILITY */ panel->bl_config.bl_level = bl_lvl; /* scale backlight */ @@ -223,6 +304,17 @@ int dsi_display_set_backlight(struct drm_connector *connector, dsi_display->name, rc); goto error; } +#ifdef OPLUS_FEATURE_SAU +/* Gou shengjun@PSW.MM.Display.LCD.Stability,2018/4/28 + * Add for silence/sau reboot +*/ + if(lcd_closebl_flag) { + pr_err("silence reboot we should set backlight to zero\n"); + bl_temp = 0; + } else if (bl_lvl) { + lcd_closebl_flag_fp = 0; + } +#endif /* OPLUS_FEATURE_SAU */ rc = dsi_panel_set_backlight(panel, (u32)bl_temp); if (rc) @@ -241,7 +333,14 @@ error: return rc; } +#ifndef OPLUS_BUG_STABILITY static int dsi_display_cmd_engine_enable(struct dsi_display *display) +/* Sachin Shukla@PSW.MM.Display.LCD.Stability,2018/4/28 + * Add for public function +*/ +#else +int dsi_display_cmd_engine_enable(struct dsi_display *display) +#endif /*OPLUS_BUG_STABILITY*/ { int rc = 0; int i; @@ -285,7 +384,14 @@ done: return rc; } +#ifndef OPLUS_BUG_STABILITY static int dsi_display_cmd_engine_disable(struct dsi_display *display) +#else +/* Sachin Shukla@PSW.MM.Display.LCD.Stability,2018/4/28 + * Add for public function +*/ +int dsi_display_cmd_engine_disable(struct dsi_display *display) +#endif /*OPLUS_BUG_STABILITY*/ { int rc = 0; int i; @@ -471,7 +577,11 @@ error: } /* Allocate memory for cmd dma tx buffer */ +#ifndef OPLUS_BUG_STABILITY static int dsi_host_alloc_cmd_tx_buffer(struct dsi_display *display) +#else +int dsi_host_alloc_cmd_tx_buffer(struct dsi_display *display) +#endif /* OPLUS_BUG_STABILITY */ { int rc = 0, cnt = 0; struct dsi_display_ctrl *display_ctrl; @@ -578,6 +688,21 @@ static bool dsi_display_validate_reg_read(struct dsi_panel *panel) group += len; } +#ifdef OPLUS_BUG_STABILITY +/* Sachin@PSW.MM.Display.Lcd.Stability, 2018-12-04, add for solve esd fail */ + { + unsigned char payload[150] = ""; + int cnt = 0; + + cnt += scnprintf(payload, sizeof(payload), "NULL$$EventID@@%d$$ESD Error is@@",OPPO_MM_DIRVER_FB_EVENT_ID_ESD); + for (i = 0; i < len; ++i) { + cnt += scnprintf(payload + cnt, sizeof(payload) - cnt, "[%02x] ", config->return_buf[i]); + } + DRM_ERROR("ESD check failed: %s\n", payload); + upload_mm_kevent_fb_data(OPPO_MM_DIRVER_FB_EVENT_MODULE_DISPLAY,payload); + } +#endif /*OPLUS_BUG_STABILITY*/ + return false; } @@ -4026,6 +4151,11 @@ static void _dsi_display_calc_pipe_delay(struct dsi_display *display, struct dsi_phy_cfg *cfg; int phy_ver; +#ifdef OPLUS_BUG_STABILITY +/* Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2021/01/05, fix flicker when mipi clock is switched at low brightness */ + u32 cust_pll_delay = display->panel->oppo_priv.pll_delay; +#endif /* OPLUS_BUG_STABILITY */ + m_ctrl = &display->ctrl[display->clk_master_idx]; dsi_ctrl = m_ctrl->ctrl; @@ -4068,11 +4198,21 @@ static void _dsi_display_calc_pipe_delay(struct dsi_display *display, */ phy_ver = dsi_phy_get_version(m_ctrl->phy); if (phy_ver <= DSI_PHY_VERSION_3_0) +#ifdef OPLUS_BUG_STABILITY +/* Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2021/01/05, fix flicker when mipi clock is switched at low brightness */ + delay->pll_delay = cust_pll_delay ? cust_pll_delay : 100; +#else delay->pll_delay = 100; +#endif /* OPLUS_BUG_STABILITY */ else delay->pll_delay = 25; delay->pll_delay = (delay->pll_delay * esc_clk_rate_hz) / 1000000; + +#ifdef OPLUS_BUG_STABILITY +/* Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2021/01/05, fix flicker when mipi clock is switched at low brightness */ + pr_debug("cust_pll_delay = %d, pll_delay = %d\n", cust_pll_delay, delay->pll_delay); +#endif /* OPLUS_BUG_STABILITY */ } static int _dsi_display_dyn_update_clks(struct dsi_display *display, @@ -4652,6 +4792,14 @@ static int dsi_display_set_mode_sub(struct dsi_display *display, pr_err("failed to add DSI PHY timing params"); } } + +#ifdef OPLUS_BUG_STABILITY +/* LiPing-M@PSW.MM.Display.LCD.Stability,2020-05-08 Add for panel osc clk setting */ + if (mode->dsi_mode_flags & DSI_MODE_FLAG_DYN_CLK) { + if(MSM_BOOT_MODE__NORMAL == get_boot_mode() && (osc_count != 0)) + oppo_display_dynamic_clk_update_osc_clk(clk_rate); + } +#endif /* OPLUS_BUG_STABILITY */ error: return rc; } @@ -5098,6 +5246,24 @@ static int dsi_display_bind(struct device *dev, if (!display->disp_node) return 0; +#ifdef OPLUS_FEATURE_SAU +/* Gou shengjun@PSW.MM.Display.LCD.Stability,2018/06/05 + * Add for save select panel and give different feature SAU +*/ + if(0 != oppo_set_display_vendor(display)) { + pr_err("maybe send a null point to oppo display manager 1\n"); + if(0 != set_oppo_display_vendor(display->name)) { + pr_err("maybe send a null point to oppo display manager 2\n"); + } + } + + /* Add for SAU feature request */ + if(is_silence_reboot()) { + lcd_closebl_flag = 1; + lcd_closebl_flag_fp = 1; + } +#endif /* OPLUS_FEATURE_SAU */ + /* defer bind if ext bridge driver is not loaded */ for (i = 0; i < display->panel->host_config.ext_bridge_num; i++) { j = display->panel->host_config.ext_bridge_map[i]; @@ -5376,7 +5542,11 @@ static struct platform_driver dsi_display_driver = { static int dsi_display_init(struct dsi_display *display) { int rc = 0; - struct platform_device *pdev = display->pdev; + struct platform_device *pdev = display->pdev; +#ifdef OPLUS_BUG_STABILITY +/* Sachin@PSW.MM.Display.LCD.Machine, 2019/02/11,add for mm kevent fb. */ + unsigned char payload[150] = ""; +#endif /*OPLUS_BUG_STABILITY*/ mutex_init(&display->display_lock); @@ -5387,8 +5557,18 @@ static int dsi_display_init(struct dsi_display *display) } rc = component_add(&pdev->dev, &dsi_display_comp_ops); + +#ifndef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.LCD.Machine, 2019/02/11,add for mm kevent fb. */ if (rc) pr_err("component add failed, rc=%d\n", rc); +#else + if (rc) { + pr_err("component add failed, rc=%d\n", rc); + scnprintf(payload, sizeof(payload), "NULL$$EventID@@%d$$component add error panel match fault rc=%d",OPPO_MM_DIRVER_FB_EVENT_ID_PANEL_MATCH_FAULT,rc); + upload_mm_kevent_fb_data(OPPO_MM_DIRVER_FB_EVENT_MODULE_DISPLAY,payload); + } +#endif /*OPLUS_BUG_STABILITY*/ pr_debug("component add success: %s\n", display->name); end: @@ -5493,6 +5673,16 @@ int dsi_display_dev_probe(struct platform_device *pdev) platform_set_drvdata(pdev, display); +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.Lcd.Stability, 2020-08-05 + * add for drm notifier for display connect +*/ + if (!strcmp(dsi_type, "primary")) + primary_display = display; + else + secondary_display = display; +#endif /* OPLUS_BUG_STABILITY */ + rc = dsi_display_init(display); if (rc) goto end; @@ -6391,16 +6581,9 @@ int dsi_display_get_modes(struct dsi_display *display, } end = array_idx; /* - * if POMS is enabled and boot up mode is video mode, - * skip bit clk rates update for command mode, - * else if dynamic clk switch is supported then update all - * the bit clk rates. + * if dynamic clk switch is supported then update all the bit + * clk rates. */ - - if (is_cmd_mode && - (display->panel->panel_mode == DSI_OP_VIDEO_MODE)) - continue; - _dsi_display_populate_bit_clks(display, start, end, &array_idx); } @@ -6568,6 +6751,12 @@ int dsi_display_validate_mode_change(struct dsi_display *display, /* dfps and dynamic clock with const fps use case */ if (dsi_display_mode_switch_dfps(cur_mode, adj_mode)) { dsi_panel_get_dfps_caps(display->panel, &dfps_caps); + #ifdef OPLUS_BUG_STABILITY + /*liping-m@PSW.MM.Display.LCD,2019/6/20,for 90FPS LCD */ + if (cur_mode->timing.refresh_rate != adj_mode->timing.refresh_rate) { + pr_err("dsi_cmd set fps: %d\n", adj_mode->timing.refresh_rate); + } + #endif /*OPLUS_BUG_STABILITY*/ if (dfps_caps.dfps_support || dyn_clk_caps->maintain_const_fps) { pr_debug("mode switch is variable refresh\n"); @@ -6710,6 +6899,16 @@ int dsi_display_set_mode(struct dsi_display *display, } } +#ifdef OPLUS_BUG_STABILITY +//yulujiang@PSW.BSP.TP, 2019/09/29, Add for notify TP display fps change + sec_refresh_switch(adj_mode.timing.refresh_rate); +#endif /* OPLUS_BUG_STABILITY */ + +#ifdef OPLUS_FEATURE_TP_BASIC +//Qicai.gu@PSW.BSP.TP, 2020/08/21, Add for notify TP display fps change + lcd_tp_refresh_switch(adj_mode.timing.refresh_rate); +#endif /* OPLUS_FEATURE_TP_BASIC*/ + memcpy(display->panel->cur_mode, &adj_mode, sizeof(adj_mode)); error: mutex_unlock(&display->display_lock); @@ -7523,6 +7722,12 @@ int dsi_display_enable(struct dsi_display *display) } display->panel->panel_initialized = true; +#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.LCD.Stability,2018/4/28 + * when continous splash enabled, we should set power mode to OPPO_DISPLAY_POWER_ON here +*/ + set_oppo_display_power_status(OPPO_DISPLAY_POWER_ON); +#endif /* OPLUS_BUG_STABILITY */ pr_debug("cont splash enabled, display enable not required\n"); return 0; } @@ -7599,6 +7804,11 @@ error: return rc; } +#ifdef OPLUS_FEATURE_AOD_RAMLESS +/*Mark.Yao@PSW.MM.Display.LCD.Stable,2020-01-08 fix aod ramless fingerprint */ +extern ktime_t oppo_onscreenfp_pressed_time; +extern u32 oppo_onscreenfp_vblank_count; +#endif /* OPLUS_FEATURE_AOD_RAMLESS */ int dsi_display_post_enable(struct dsi_display *display) { int rc = 0; @@ -7614,8 +7824,21 @@ int dsi_display_post_enable(struct dsi_display *display) if (display->config.panel_mode == DSI_OP_CMD_MODE) dsi_panel_mode_switch_to_cmd(display->panel); +#ifdef OPLUS_FEATURE_AOD_RAMLESS +/*Mark.Yao@PSW.MM.Display.LCD.Stable,2020-01-08 fix aod ramless fingerprint */ + if (display->config.panel_mode == DSI_OP_VIDEO_MODE) { + if (display->panel->oppo_priv.is_aod_ramless && + display->drm_conn && display->drm_conn->state && + display->drm_conn->state->crtc) { + oppo_onscreenfp_vblank_count = drm_crtc_vblank_count(display->drm_conn->state->crtc); + oppo_onscreenfp_pressed_time = ktime_get(); + } + dsi_panel_mode_switch_to_vid(display->panel); + } +#else if (display->config.panel_mode == DSI_OP_VIDEO_MODE) dsi_panel_mode_switch_to_vid(display->panel); +#endif /* OPLUS_FEATURE_AOD_RAMLESS */ } else { rc = dsi_panel_post_enable(display->panel); if (rc) @@ -7643,6 +7866,14 @@ int dsi_display_pre_disable(struct dsi_display *display) mutex_lock(&display->display_lock); +#ifdef OPLUS_BUG_STABILITY +/*Mark.Yao@PSW.MM.Display.LCD.Stable,2019-05-08 fix race on backlight and power change */ + display->panel->need_power_on_backlight = false; +/* Gou shengjun@PSW.MM.Display.LCD.Stable,2018-10-25 + * fix ffl dsi abnormal on esd scene +*/ + //oppo_stop_ffl_thread(); +#endif /* OPLUS_BUG_STABILITY */ /* enable the clk vote for CMD mode panels */ if (display->config.panel_mode == DSI_OP_CMD_MODE) dsi_display_clk_ctrl(display->dsi_clk_handle, @@ -7668,6 +7899,13 @@ int dsi_display_pre_disable(struct dsi_display *display) int dsi_display_disable(struct dsi_display *display) { int rc = 0; +#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.LCD.Stability,2018/4/13 + * Add a notify for when disable display +*/ + int blank; + struct msm_drm_notifier notifier_data; +#endif /* OPLUS_BUG_STABILITY */ if (!display) { pr_err("Invalid params\n"); @@ -7675,6 +7913,7 @@ int dsi_display_disable(struct dsi_display *display) } SDE_EVT32(SDE_EVTLOG_FUNC_ENTRY); + mutex_lock(&display->display_lock); rc = dsi_display_wake_up(display); @@ -7698,14 +7937,35 @@ int dsi_display_disable(struct dsi_display *display) } if (!display->poms_pending) { + #ifdef OPLUS_BUG_STABILITY + /* Gou shengjun@PSW.MM.Display.LCD.Stability,2018/4/13 + * Add a notify for when disable display + */ + blank = MSM_DRM_BLANK_POWERDOWN; + notifier_data.data = ␣ + notifier_data.id = 0; + msm_drm_notifier_call_chain(MSM_DRM_EARLY_EVENT_BLANK, + ¬ifier_data); + #endif /* OPLUS_BUG_STABILITY */ + rc = dsi_panel_disable(display->panel); if (rc) pr_err("[%s] failed to disable DSI panel, rc=%d\n", display->name, rc); + + #ifdef OPLUS_FEATURE_SAU + /* Gou shengjun@PSW.MM.Display.LCD.Stability,2018/4/13 + * Add a notify for when disable display + */ + set_oppo_display_scene(OPPO_DISPLAY_NORMAL_SCENE); + msm_drm_notifier_call_chain(MSM_DRM_EVENT_BLANK, + ¬ifier_data); + #endif /* OPLUS_FEATURE_SAU */ } mutex_unlock(&display->display_lock); SDE_EVT32(SDE_EVTLOG_FUNC_EXIT); + return rc; } @@ -7800,6 +8060,16 @@ int dsi_display_unprepare(struct dsi_display *display) return rc; } +#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.LCD.Stability,2018/4/28 + * Add for support aod,hbm,seed +*/ +struct dsi_display *get_main_display(void) { + return primary_display; +} +EXPORT_SYMBOL(get_main_display); +#endif /* OPLUS_BUG_STABILITY */ + static int __init dsi_display_register(void) { dsi_phy_drv_register(); diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_display.h b/drivers/gpu/drm/msm/dsi-staging/dsi_display.h index 7bf06a243c5a..d680bc962e9b 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_display.h +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_display.h @@ -702,6 +702,17 @@ enum dsi_pixel_format dsi_display_get_dst_format( * Return: Zero on Success */ int dsi_display_cont_splash_config(void *display); +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.LCD.Stability,2018/10/21 + * Add for support aod,hbm,seed +*/ +struct dsi_display *get_main_display(void); + +/* Add for implement panel register read */ +int dsi_host_alloc_cmd_tx_buffer(struct dsi_display *display); +int dsi_display_cmd_engine_enable(struct dsi_display *display); +int dsi_display_cmd_engine_disable(struct dsi_display *display); +#endif /* OPLUS_BUG_STABILITY */ /* * dsi_display_get_panel_vfp - get panel vsync * @display: Pointer to private display structure diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_drm.c b/drivers/gpu/drm/msm/dsi-staging/dsi_drm.c index 47fc722190b3..6073d42a598d 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_drm.c +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_drm.c @@ -412,6 +412,10 @@ static bool dsi_bridge_mode_fixup(struct drm_bridge *bridge, if (rc) { pr_err("[%s] seamless mode mismatch failure rc=%d\n", c_bridge->display->name, rc); + /* + *Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, add for 19081 LCD + *note: orignal change was abandoned here due to compatibility + */ return false; } @@ -441,6 +445,25 @@ static bool dsi_bridge_mode_fixup(struct drm_bridge *bridge, display->is_cont_splash_enabled)) dsi_mode.dsi_mode_flags |= DSI_MODE_FLAG_DMS; +#ifdef OPLUS_BUG_STABILITY + /*Mark.Yao@PSW.MM.Display.LCD.Stable,2019-12-09 skip dms switch if cont_splash not ready */ + if (display->is_cont_splash_enabled) + dsi_mode.dsi_mode_flags &= ~DSI_MODE_FLAG_DMS; + +#ifdef OPLUS_FEATURE_AOD_RAMLESS +// Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, sepolicy for aod ramless + if (display->panel && display->panel->oppo_priv.is_aod_ramless) { + if (crtc_state->active_changed && (dsi_mode.dsi_mode_flags & DSI_MODE_FLAG_DYN_CLK)) { + DSI_ERR("dyn clk changed when active_changed, WA to skip dyn clk change\n"); + dsi_mode.dsi_mode_flags &= ~DSI_MODE_FLAG_DYN_CLK; + } + + if (dsi_mode.dsi_mode_flags & DSI_MODE_FLAG_DMS) + dsi_mode.dsi_mode_flags |= DSI_MODE_FLAG_SEAMLESS; + } +#endif /* OPLUS_FEATURE_AOD_RAMLESS */ +#endif /* OPLUS_BUG_STABILITY */ + /* Reject seemless transition when active/connectors changed.*/ if ((crtc_state->active_changed || (crtc_state->connectors_changed && clone_mode)) && diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c index 1a3a5e8c6bb2..80424856eaae 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c @@ -23,6 +23,17 @@ #include "dsi_panel.h" #include "dsi_ctrl_hw.h" #include "dsi_parser.h" +#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.LCD.Stability,2018/12/13 + * Add for get boot mode. +*/ +#include +#include "oppo_display_private_api.h" +#include "oppo_dc_diming.h" +#include "oppo_onscreenfingerprint.h" +#include "oppo_aod.h" +#include "oppo_display_panel_common.h" +#endif /* OPLUS_BUG_STABILITY */ /** * topology is currently defined by a set of following 3 values: @@ -44,6 +55,13 @@ #define DEFAULT_PANEL_PREFILL_LINES 25 #define TICKS_IN_MICRO_SECOND 1000000 +__attribute__((weak)) int tp_control_cs_gpio(bool enable) {return 0;} +static bool tp_enable_cs_flag = false; +#ifdef OPLUS_FEATURE_LCD_CABC +//xupengcheng@MULTIMEDIA.MM.Display.LCD.Stability,2020/09/17, add for only 19696 support cabc feature +int is_support_cabc = 0; +#endif/* OPLUS_FEATURE_LCD_CABC */ + enum dsi_dsc_ratio_type { DSC_8BPC_8BPP, DSC_10BPC_8BPP, @@ -116,7 +134,12 @@ int dsi_dsc_create_pps_buf_cmd(struct msm_display_dsc_info *dsc, char *buf, *bp++ = 1; *bp++ = 0; *bp++ = 0; - *bp++ = 10; +#ifdef OPLUS_BUG_STABILITY +/* LiPing-M@PSW.MM.Display.LCD.Feature,2020-06-05, Add for 90hz/60hz switch */ + *bp++ = 0; +#else + *bp++ = 10; +#endif /* OPLUS_BUG_STABILITY */ *bp++ = 0; *bp++ = 128; @@ -290,6 +313,25 @@ static int dsi_panel_gpio_request(struct dsi_panel *panel) } } + #ifdef OPLUS_BUG_STABILITY + /* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, add for 19081 LCD */ + if (gpio_is_valid(r_config->lcd_vci_gpio)) { + rc = gpio_request(r_config->lcd_vci_gpio, "vci_gpio"); + if (rc) { + pr_err("request for vci_gpio failed, rc=%d\n", rc); + goto error_release_vci; + } + } + + if (gpio_is_valid(r_config->err_flag_gpio)) { + rc = gpio_request(r_config->err_flag_gpio, "err_flag_gpio"); + if (rc) { + pr_err("request for err_flag_gpio failed, rc=%d\n", rc); + goto error_release_err_flag; + } + } + #endif /* OPLUS_BUG_STABILITY */ + goto error; error_release_mode_sel: if (gpio_is_valid(panel->bl_config.en_gpio)) @@ -300,6 +342,15 @@ error_release_disp_en: error_release_reset: if (gpio_is_valid(r_config->reset_gpio)) gpio_free(r_config->reset_gpio); +#ifdef OPLUS_BUG_STABILITY +/* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, add for 19081 LCD */ +error_release_vci: + if (gpio_is_valid(r_config->lcd_vci_gpio)) + gpio_free(r_config->lcd_vci_gpio); +error_release_err_flag: + if (gpio_is_valid(r_config->err_flag_gpio)) + gpio_free(r_config->err_flag_gpio); +#endif /* OPLUS_BUG_STABILITY */ error: return rc; } @@ -320,6 +371,13 @@ static int dsi_panel_gpio_release(struct dsi_panel *panel) if (gpio_is_valid(panel->reset_config.lcd_mode_sel_gpio)) gpio_free(panel->reset_config.lcd_mode_sel_gpio); + #ifdef OPLUS_BUG_STABILITY + /* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, add for 19081 LCD */ + if (gpio_is_valid(r_config->lcd_vci_gpio)) + gpio_free(r_config->lcd_vci_gpio); + if (gpio_is_valid(r_config->err_flag_gpio)) + gpio_free(r_config->err_flag_gpio); + #endif /* OPLUS_BUG_STABILITY */ return rc; } @@ -354,6 +412,19 @@ static int dsi_panel_reset(struct dsi_panel *panel) struct dsi_panel_reset_config *r_config = &panel->reset_config; int i; + #ifdef OPLUS_BUG_STABILITY + /* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, add for 19081 LCD */ + if (gpio_is_valid(panel->reset_config.lcd_vci_gpio)) { + rc = gpio_direction_output(panel->reset_config.lcd_vci_gpio, 1); + + if (panel->reset_config.lcd_delay_vci_gpio) + usleep_range(panel->reset_config.lcd_delay_vci_gpio, + panel->reset_config.lcd_delay_vci_gpio + 100); + if (rc) + pr_err("unable to set lcd_vci_gpio dir for disp gpio rc=%d\n", rc); + } + #endif /* OPLUS_BUG_STABILITY */ + if (gpio_is_valid(panel->reset_config.disp_en_gpio)) { rc = gpio_direction_output(panel->reset_config.disp_en_gpio, 1); if (rc) { @@ -362,6 +433,22 @@ static int dsi_panel_reset(struct dsi_panel *panel) } } + #ifdef OPLUS_BUG_STABILITY + /* xupengcheng@MULTIMEDIA.DISPLAY.LCD, 2020/10/29, add for 19781 LCD */ + if(!strcmp(panel->name, "samsung sofef03f_m amoled fhd+ panel with DSC")){ + if (gpio_is_valid(panel->reset_config.lcd_mode_sel_gpio)) { + rc = gpio_direction_output(panel->reset_config.lcd_mode_sel_gpio, 1); + if (rc) { + pr_err("unable to set dir for lcd_mode_sel_gpio gpio rc=%d\n", rc); + } + } + + if (panel->reset_config.lcd_delay_mode_sel_gpio) + usleep_range(panel->reset_config.lcd_delay_mode_sel_gpio, + panel->reset_config.lcd_delay_mode_sel_gpio + 100); + } + #endif + if (r_config->count) { rc = gpio_direction_output(r_config->reset_gpio, r_config->sequence[0].level); @@ -387,24 +474,61 @@ static int dsi_panel_reset(struct dsi_panel *panel) pr_err("unable to set dir for bklt gpio rc=%d\n", rc); } - if (gpio_is_valid(panel->reset_config.lcd_mode_sel_gpio)) { - bool out = true; +#ifndef OPLUS_BUG_STABILITY +/* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, add for 19081/19567 LCD */ + if (gpio_is_valid(panel->reset_config.lcd_mode_sel_gpio)) { + bool out = true; - if ((panel->reset_config.mode_sel_state == MODE_SEL_DUAL_PORT) - || (panel->reset_config.mode_sel_state - == MODE_GPIO_LOW)) - out = false; - else if ((panel->reset_config.mode_sel_state - == MODE_SEL_SINGLE_PORT) || - (panel->reset_config.mode_sel_state - == MODE_GPIO_HIGH)) - out = true; + if ((panel->reset_config.mode_sel_state == MODE_SEL_DUAL_PORT) + || (panel->reset_config.mode_sel_state + == MODE_GPIO_LOW)) + out = false; + else if ((panel->reset_config.mode_sel_state + == MODE_SEL_SINGLE_PORT) || + (panel->reset_config.mode_sel_state + == MODE_GPIO_HIGH)) + out = true; - rc = gpio_direction_output( - panel->reset_config.lcd_mode_sel_gpio, out); - if (rc) - pr_err("unable to set dir for mode gpio rc=%d\n", rc); + rc = gpio_direction_output( + panel->reset_config.lcd_mode_sel_gpio, out); + if (rc) + pr_err("unable to set dir for mode gpio rc=%d\n", rc); + } +#else /* OPLUS_BUG_STABILITY */ + /* xupengcheng@MULTIMEDIA.DISPLAY.LCD, 2020/10/29, add for 19781 LCD time sequence */ + if (true == panel->reset_timing || (!strcmp(panel->name, "samsung sofef03f_m amoled fhd+ panel with DSC"))) /* fixme: note for 19567 to do compatibiliy */ + { + printk(KERN_INFO "%s: jump the code when 19567 90fps LCD\n", __func__); } + else + { + if (gpio_is_valid(panel->reset_config.lcd_mode_sel_gpio)) { + bool out = true; + + if ((panel->reset_config.mode_sel_state == MODE_SEL_DUAL_PORT) + || (panel->reset_config.mode_sel_state + == MODE_GPIO_LOW)) + out = false; + + else if ((panel->reset_config.mode_sel_state + == MODE_SEL_SINGLE_PORT) || + (panel->reset_config.mode_sel_state + == MODE_GPIO_HIGH)) + out = true; + + + rc = gpio_direction_output( + panel->reset_config.lcd_mode_sel_gpio, out); + if (panel->reset_config.lcd_delay_mode_sel_gpio) + usleep_range(panel->reset_config.lcd_delay_mode_sel_gpio, + panel->reset_config.lcd_delay_mode_sel_gpio + 100); + + if (rc) + pr_err("unable to set dir for mode gpio rc=%d\n", rc); + + } + } +#endif /* OPLUS_BUG_STABILITY */ exit: return rc; } @@ -434,6 +558,23 @@ static int dsi_panel_set_pinctrl_state(struct dsi_panel *panel, bool enable) static int dsi_panel_power_on(struct dsi_panel *panel) { int rc = 0; + if(tp_enable_cs_flag) { + tp_enable_cs_flag = false; + tp_control_cs_gpio(true); + } + //#ifdef OPLUS_BUG_STABILITY + if (panel->reset_timing == true) { + //Liping-M@PSW.MM.Display.LCD.Stability,2020/2/27, add project info for 19567 LCD + if (gpio_is_valid(panel->reset_config.lcd_mode_sel_gpio)) { + rc = gpio_direction_output(panel->reset_config.lcd_mode_sel_gpio, 1); + + if (rc) { + pr_err("unable to set dir for lcd_mode_sel_gpio gpio rc=%d\n", rc); + goto error_disable_gpio; + } + } + } + //#endif /* OPLUS_BUG_STABILITY */ rc = dsi_pwr_enable_regulator(&panel->power_info, true); if (rc) { @@ -456,6 +597,15 @@ static int dsi_panel_power_on(struct dsi_panel *panel) goto exit; error_disable_gpio: + //#ifdef OPLUS_BUG_STABILITY + if (panel->reset_timing == true) { + //Liping-M@PSW.MM.Display.LCD.Stability,2020/2/27, add project info for 19567 LCD + if (gpio_is_valid(panel->reset_config.lcd_mode_sel_gpio)) { + gpio_set_value(panel->reset_config.lcd_mode_sel_gpio, 0); + } + } + //#endif /* OPLUS_BUG_STABILITY */ + if (gpio_is_valid(panel->reset_config.disp_en_gpio)) gpio_set_value(panel->reset_config.disp_en_gpio, 0); @@ -474,30 +624,117 @@ exit: static int dsi_panel_power_off(struct dsi_panel *panel) { int rc = 0; - + #ifndef OPLUS_BUG_STABILITY + /* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/23, add for common lcd reset timing */ if (gpio_is_valid(panel->reset_config.disp_en_gpio)) gpio_set_value(panel->reset_config.disp_en_gpio, 0); - if (gpio_is_valid(panel->reset_config.reset_gpio)) - gpio_set_value(panel->reset_config.reset_gpio, 0); + #else /* OPLUS_BUG_STABILITY */ + if (gpio_is_valid(panel->reset_config.disp_en_gpio)) { + gpio_set_value(panel->reset_config.disp_en_gpio, 0); +/* Jiasong.Zhong@PSW.MM.Display.LCD.Stable, 2020/03/25, + * Add for power off Sequence +*/ + usleep_range(5000, 6000); /* fixme: note for project 19365 */ + if (panel->reset_config.lcd_delay_disp_en_gpio) + usleep_range(panel->reset_config.lcd_delay_disp_en_gpio, + panel->reset_config.lcd_delay_disp_en_gpio + 100); + } + if (0 == tp_gesture_enable_flag()) { + if (gpio_is_valid(panel->reset_config.reset_gpio)) { + gpio_set_value(panel->reset_config.reset_gpio, 0); + + usleep_range(10000, 12000); /* fixme: note for project 19365 */ + if (panel->reset_config.lcd_delay_reset_gpio) + usleep_range(panel->reset_config.lcd_delay_reset_gpio, + panel->reset_config.lcd_delay_reset_gpio + 100); + } + } + #endif /* OPLUS_BUG_STABILITY */ + + #ifndef OPLUS_BUG_STABILITY + /* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/23, add for common lcd reset timing */ if (gpio_is_valid(panel->reset_config.lcd_mode_sel_gpio)) gpio_set_value(panel->reset_config.lcd_mode_sel_gpio, 0); + #else /* OPLUS_BUG_STABILITY */ + if (gpio_is_valid(panel->reset_config.lcd_mode_sel_gpio)) { + gpio_set_value(panel->reset_config.lcd_mode_sel_gpio, 0); + + if (panel->reset_config.lcd_delay_mode_sel_gpio) + usleep_range(panel->reset_config.lcd_delay_mode_sel_gpio, + panel->reset_config.lcd_delay_mode_sel_gpio + 100); + } + #endif /* OPLUS_BUG_STABILITY */ rc = dsi_panel_set_pinctrl_state(panel, false); + #ifdef OPLUS_BUG_STABILITY + /* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/23, add for common lcd reset timing */ + if (panel->reset_config.lcd_delay_set_pinctrl_state) + usleep_range(panel->reset_config.lcd_delay_set_pinctrl_state, + panel->reset_config.lcd_delay_set_pinctrl_state + 100); + #endif /* OPLUS_BUG_STABILITY */ if (rc) { pr_err("[%s] failed set pinctrl state, rc=%d\n", panel->name, rc); } + #ifdef OPLUS_BUG_STABILITY + /* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, add for 19081 LCD */ + if (gpio_is_valid(panel->reset_config.lcd_vci_gpio)) { + gpio_set_value(panel->reset_config.lcd_vci_gpio, 0); + + if (panel->reset_config.lcd_delay_vci_gpio) + usleep_range(panel->reset_config.lcd_delay_vci_gpio, + panel->reset_config.lcd_delay_vci_gpio + 100); + } + #endif /* OPLUS_BUG_STABILITY */ + rc = dsi_pwr_enable_regulator(&panel->power_info, false); + #ifdef OPLUS_BUG_STABILITY + /* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/23, add for common lcd reset timing */ + if (panel->reset_config.lcd_delay_enable_regulator) + usleep_range(panel->reset_config.lcd_delay_enable_regulator, + panel->reset_config.lcd_delay_enable_regulator + 100); + #endif /* OPLUS_BUG_STABILITY */ if (rc) pr_err("[%s] failed to enable vregs, rc=%d\n", panel->name, rc); - + /* add end by zhaifeibiao@ODM_LQ@BSP.TP, add tp cs 2020-11-17*/ + if(0 == tp_gesture_enable_flag()){ + tp_enable_cs_flag = true; + tp_control_cs_gpio(false); + } + /* add end by zhaifeibiao@ODM_LQ@BSP.TP, add tp cs 2020-11-17*/ return rc; } + +#ifdef OPLUS_BUG_STABILITY +extern int oppo_seed_backlight; +extern u32 oppo_last_backlight; +extern u32 oppo_backlight_delta; +extern ktime_t oppo_backlight_time; +extern int oppo_dimlayer_bl_enabled; +extern int oppo_dimlayer_bl_enable_real; +extern int oppo_dimlayer_bl_alpha; +extern int oppo_dimlayer_bl_alpha_v2; +#endif /* OPLUS_BUG_STABILITY */ +#ifdef OPLUS_FEATURE_AOD_RAMLESS +// Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, sepolicy for aod ramless +extern int oppo_display_mode; +extern int oppo_display_update_aod_area_unlock(void); +#endif /* OPLUS_FEATURE_AOD_RAMLESS */ + +#ifndef OPLUS_BUG_STABILITY static int dsi_panel_tx_cmd_set(struct dsi_panel *panel, enum dsi_cmd_set_type type) +#else /* OPLUS_BUG_STABILITY */ +/* Gou shengjun@PSW.MM.Display.LCD.Stability,2018/11/21 + * Add for oppo display new structure +*/ +const char *cmd_set_prop_map[]; +int dsi_panel_tx_cmd_set(struct dsi_panel *panel, + enum dsi_cmd_set_type type) +#endif /* OPLUS_BUG_STABILITY */ { int rc = 0, i = 0; ssize_t len; @@ -507,6 +744,12 @@ static int dsi_panel_tx_cmd_set(struct dsi_panel *panel, struct dsi_display_mode *mode; const struct mipi_dsi_host_ops *ops = panel->host->ops; +#ifdef OPLUS_BUG_STABILITY +//Liping-M@PSW.MM.Display.LCD.Stability,2019/7/31, add DC 2.0 + struct dsi_panel_cmd_set *oppo_cmd_set = NULL; +/* xupengcheng@MULTIMEDIA.DISPLAY.LCD, 2020/10/20,add for 19781 discard the first osc clock setting */ + static int osc_cmd_skip_count = 0; +#endif/* OPLUS_BUG_STABILITY */ if (!panel || !panel->cur_mode) return -EINVAL; @@ -516,6 +759,28 @@ static int dsi_panel_tx_cmd_set(struct dsi_panel *panel, count = mode->priv_info->cmd_sets[type].count; state = mode->priv_info->cmd_sets[type].state; +#ifdef OPLUS_BUG_STABILITY +/* xupengcheng@MULTIMEDIA.DISPLAY.LCD, 2020/10/20,add for 19781 discard the first osc clock setting */ + if((0 == osc_cmd_skip_count) && (panel->oppo_priv.is_19781_lcd) && \ + ((DSI_CMD_OSC_CLK_MODEO0 == type)||(DSI_CMD_OSC_CLK_MODEO1 == type))) { + osc_cmd_skip_count = 1; + pr_err("first setting osc clk is skipped"); + goto error; + } +/* Gou shengjun@PSW.MM.Display.LCD.Stability,2018/12/13 + * Add for oppo display new structure +*/ + pr_err("dsi_cmd %s\n", cmd_set_prop_map[type]); + + if (oppo_seed_backlight) { + oppo_cmd_set = oppo_dsi_update_seed_backlight(panel, oppo_seed_backlight, type); + if (!IS_ERR_OR_NULL(oppo_cmd_set)) { + cmds = oppo_cmd_set->cmds; + count = oppo_cmd_set->count; + state = oppo_cmd_set->state; + } + } +#endif /* OPLUS_BUG_STABILITY */ if (count == 0) { pr_debug("[%s] No commands to be sent for state(%d)\n", panel->name, type); @@ -529,6 +794,14 @@ static int dsi_panel_tx_cmd_set(struct dsi_panel *panel, if (cmds->last_command) cmds->msg.flags |= MIPI_DSI_MSG_LASTCOMMAND; +#ifdef OPLUS_BUG_STABILITY +/*Sachin@PSW.MM.Display.LCD.Stable,2019-11-30 add for + * video mode skip last_command +*/ + if (panel->oppo_priv.skip_mipi_last_cmd) + cmds->msg.flags &= ~MIPI_DSI_MSG_LASTCOMMAND; +#endif /* OPLUS_BUG_STABILITY */ + len = ops->transfer(panel->host, &cmds->msg); if (len < 0) { rc = len; @@ -619,6 +892,91 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel, } dsi = &panel->mipi_device; +#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.LCD.Feature,2018-11-21 + * Add for OnScreenFingerprint feature +*/ + if ((get_oppo_display_scene() == OPPO_DISPLAY_AOD_SCENE) && ( bl_lvl == 1)) { + pr_err("dsi_cmd AOD mode return bl_lvl:%d\n",bl_lvl); + return 0; + } + +#ifdef OPLUS_FEATURE_AOD_RAMLESS +// Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, sepolicy for aod ramless + if (panel->oppo_priv.is_aod_ramless && !oppo_display_mode) + return 0; +#endif /* OPLUS_FEATURE_AOD_RAMLESS */ + + if (panel->is_hbm_enabled) + return 0; + +if (oppo_display_get_hbm_mode()) { + return rc; + } + + if (bl_lvl > 1) { + if (bl_lvl > oppo_last_backlight) + oppo_backlight_delta = bl_lvl - oppo_last_backlight; + else + oppo_backlight_delta = oppo_last_backlight - bl_lvl; + oppo_last_backlight = bl_lvl; + oppo_backlight_time = ktime_get(); + } + if (oppo_dimlayer_bl_enabled != oppo_dimlayer_bl_enable_real) { + oppo_dimlayer_bl_enable_real = oppo_dimlayer_bl_enabled; + if (oppo_dimlayer_bl_enable_real) { + pr_err("Enter DC backlight\n"); + } else { + pr_err("Exit DC backlight\n"); + } + } + + bl_lvl = oppo_panel_process_dimming_v2(panel, bl_lvl, false); + + if (oppo_dimlayer_bl_enable_real) { + /* + * avoid effect power and aod mode + */ + if (bl_lvl > 1) + bl_lvl = oppo_dimlayer_bl_alpha; + } + + if (true || !strcmp(panel->name,"samsung amb655uv01 amoled fhd+ panel no DSC")|| + !strcmp(panel->name,"samsung ams643xf01 amoled fhd+ panel without DSC")) { + const struct mipi_dsi_host_ops *ops = dsi->host->ops; + char payload[] = {MIPI_DCS_WRITE_CONTROL_DISPLAY, 0xE0}; + struct mipi_dsi_msg msg; + + if (!strcmp(panel->name,"samsung 20261 ams643ye01 amoled fhd+ panel without DSC")) { + if (bl_lvl > panel->bl_config.bl_normal_max_level) + dsi_panel_tx_cmd_set(panel, DSI_CMD_HBM_ENTER_SWITCH); + else + dsi_panel_tx_cmd_set(panel, DSI_CMD_HBM_EXIT_SWITCH); + + if (rc) + DSI_ERR("[%s] failed to send DSI_CMD_SET_CMD_TO_VID_SWITCH cmds, rc=%d\n", + panel->name, rc); + + + } else { + if (bl_lvl > panel->bl_config.bl_normal_max_level) + payload[1] = 0xE0; + else + payload[1] = 0x20; + + memset(&msg, 0, sizeof(msg)); + msg.channel = dsi->channel; + msg.tx_buf = payload; + msg.tx_len = sizeof(payload); + msg.type = MIPI_DSI_DCS_SHORT_WRITE_PARAM; + + rc = ops->transfer(dsi->host, &msg); + + if (rc < 0) + pr_err("failed to backlight bl_lvl %d - ret=%d\n", bl_lvl, rc); + } + } +#endif /* OPLUS_BUG_STABILITY */ if (panel->bl_config.bl_inverted_dbv) bl_lvl = (((bl_lvl & 0xff) << 8) | (bl_lvl >> 8)); @@ -627,6 +985,12 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel, if (rc < 0) pr_err("failed to update dcs backlight:%d\n", bl_lvl); +#ifdef OPLUS_BUG_STABILITY +/*Sachin@PSW.MM.Display.LCD.Stable,2019-12-15 fix datadimming flash */ + oppo_panel_process_dimming_v2_post(panel, false); + oppo_last_backlight = bl_lvl; +#endif /* OPLUS_BUG_STABILITY */ + return rc; } @@ -689,7 +1053,19 @@ int dsi_panel_set_backlight(struct dsi_panel *panel, u32 bl_lvl) if (panel->host_config.ext_bridge_num) return 0; - pr_debug("backlight type:%d lvl:%d\n", bl->type, bl_lvl); +#ifdef OPLUS_BUG_STABILITY +/* Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/12/16, to limit the backlight log */ + { + static DEFINE_RATELIMIT_STATE(bl_rl, HZ/2, 1); + if(__ratelimit(&bl_rl)) { + DSI_INFO("backlight type:%d lvl:%d\n", bl->type, bl_lvl); + } else { + DSI_DEBUG("backlight type:%d lvl:%d\n", bl->type, bl_lvl); + } + } +#else + DSI_DEBUG("backlight type:%d lvl:%d\n", bl->type, bl_lvl); +#endif switch (bl->type) { case DSI_BACKLIGHT_WLED: rc = backlight_device_set_brightness(bl->raw_bd, bl_lvl); @@ -698,6 +1074,10 @@ int dsi_panel_set_backlight(struct dsi_panel *panel, u32 bl_lvl) rc = dsi_panel_update_backlight(panel, bl_lvl); break; case DSI_BACKLIGHT_EXTERNAL: + //#ifdef OPLUS_BUG_DEBUG + /* xupengcheng@MULTIMEDIA.DISPLAY.LCD, 2020/09/23, add for 19696 backlight IC lm3697*/ + rc = backlight_device_set_brightness(bl->raw_bd, bl_lvl); + //#endif /*OPLUS_BUG_DEBUG*/ break; case DSI_BACKLIGHT_PWM: rc = dsi_panel_update_pwm_backlight(panel, bl_lvl); @@ -724,8 +1104,15 @@ static u32 dsi_panel_get_brightness(struct dsi_backlight_config *bl) if (bd->ops && bd->ops->get_brightness) cur_bl_level = bd->ops->get_brightness(bd); break; - case DSI_BACKLIGHT_DCS: + //#ifdef OPLUS_BUG_DEBUG + /* xupengcheng@MULTIMEDIA.DISPLAY.LCD, 2020/09/23, add for 19696 backlight IC lm3697*/ case DSI_BACKLIGHT_EXTERNAL: + /* Try to query the backlight level from the backlight device */ + if (bd->ops && bd->ops->get_brightness) + cur_bl_level = bd->ops->get_brightness(bd); + break; + //#endif /*OPLUS_BUG_DEBUG*/ + case DSI_BACKLIGHT_DCS: case DSI_BACKLIGHT_PWM: default: /* @@ -777,6 +1164,10 @@ static int dsi_panel_bl_register(struct dsi_panel *panel) case DSI_BACKLIGHT_DCS: break; case DSI_BACKLIGHT_EXTERNAL: + //#ifdef OPLUS_BUG_DEBUG + /* xupengcheng@MULTIMEDIA.DISPLAY.LCD, 2020/09/23, add for 19696 backlight IC lm3697*/ + rc = dsi_panel_wled_register(panel, bl); + //#endif /*OPLUS_BUG_DEBUG*/ break; case DSI_BACKLIGHT_PWM: rc = dsi_panel_pwm_register(panel); @@ -1749,6 +2140,51 @@ const char *cmd_set_prop_map[DSI_CMD_SET_MAX] = { "qcom,mdss-dsi-post-mode-switch-on-command", "qcom,mdss-dsi-qsync-on-commands", "qcom,mdss-dsi-qsync-off-commands", +//#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.LCD.Stability,2018/4/28 + * add for support aod,hbm,seed +*/ + "qcom,mdss-dsi-post-on-backlight", + "qcom,mdss-dsi-aod-on-command", + "qcom,mdss-dsi-aod-off-command", + "qcom,mdss-dsi-hbm-on-command", + "qcom,mdss-dsi-hbm-off-command", + "qcom,mdss-dsi-aod-hbm-on-command", + "qcom,mdss-dsi-aod-hbm-off-command", + "qcom,mdss-dsi-seed-0-command", + "qcom,mdss-dsi-seed-1-command", + "qcom,mdss-dsi-seed-2-command", + "qcom,mdss-dsi-seed-3-command", + "qcom,mdss-dsi-seed-4-command", + "qcom,mdss-dsi-seed-off-command", + "qcom,mdss-dsi-normal-hbm-on-command", + "qcom,mdss-dsi-aod-high-mode-command", + "qcom,mdss-dsi-aod-low-mode-command", + "qcom,mdss-dsi-cabc-off-command", + "qcom,mdss-dsi-cabc-low-mode-command", + "qcom,mdss-dsi-cabc-high-mode-command", + "qcom,mdss-dsi-data-dimming-on-command", + "qcom,mdss-dsi-data-dimming-off-command", + "qcom,mdss-dsi-osc-clk-mode0-command", + "qcom,mdss-dsi-osc-clk-mode1-command", + "qcom,mdss-dsi-seed-enter-command", + "qcom,mdss-dsi-seed-exit-command", + "qcom,mdss-dsi-hbm-enter-switch-command", + "qcom,mdss-dsi-hbm-exit-switch-command", + "qcom,mdss-dsi-levelkey-end-command", +#ifdef OPLUS_FEATURE_AOD_RAMLESS + "qcom,mdss-dsi-failsafe-on-command", + "qcom,mdss-dsi-failsafe-off-command", +#endif /* OPLUS_FEATURE_AOD_RAMLESS */ +#ifdef OPLUS_FEATURE_LCD_CABC +/* xupengcheng@MULTIMEDIA.MM.Display.LCD.Stability,2020/09/18 + * add for 19696 LCD CABC feature + */ + "qcom,mdss-dsi-cabc-ui-command", + "qcom,mdss-dsi-cabc-still-image-command", + "qcom,mdss-dsi-cabc-video-command", +#endif /*OPLUS_FEATURE_LCD_CABC*/ +//#endif /*OPLUS_BUG_STABILITY*/ }; const char *cmd_set_state_map[DSI_CMD_SET_MAX] = { @@ -1775,6 +2211,51 @@ const char *cmd_set_state_map[DSI_CMD_SET_MAX] = { "qcom,mdss-dsi-post-mode-switch-on-command-state", "qcom,mdss-dsi-qsync-on-commands-state", "qcom,mdss-dsi-qsync-off-commands-state", +//#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.LCD.Stability,2018/4/28 + * add for support aod,hbm,seed +*/ + "qcom,mdss-dsi-post-on-backlight-state", + "qcom,mdss-dsi-aod-on-command-state", + "qcom,mdss-dsi-aod-off-command-state", + "qcom,mdss-dsi-hbm-on-command-state", + "qcom,mdss-dsi-hbm-off-command-state", + "qcom,mdss-dsi-aod-hbm-on-command-state", + "qcom,mdss-dsi-aod-hbm-off-command-state", + "qcom,mdss-dsi-seed-0-command-state", + "qcom,mdss-dsi-seed-1-command-state", + "qcom,mdss-dsi-seed-2-command-state", + "qcom,mdss-dsi-seed-3-command-state", + "qcom,mdss-dsi-seed-4-command-state", + "qcom,mdss-dsi-seed-off-command-state", + "qcom,mdss-dsi-normal-hbm-on-command-state", + "qcom,mdss-dsi-aod-high-mode-command-state", + "qcom,mdss-dsi-aod-low-mode-command-state", + "qcom,mdss-dsi-cabc-off-command-state", + "qcom,mdss-dsi-cabc-low-mode-command-state", + "qcom,mdss-dsi-cabc-high-mode-command-state", + "qcom,mdss-dsi-data-dimming-on-command-state", + "qcom,mdss-dsi-data-dimming-off-command-state", + "qcom,mdss-dsi-osc-clk-mode0-command-state", + "qcom,mdss-dsi-osc-clk-mode1-command-state", + "qcom,mdss-dsi-seed-enter-command-state", + "qcom,mdss-dsi-seed-exit-command-state", + "qcom,mdss-dsi-hbm-enter-switch-command-state", + "qcom,mdss-dsi-hbm-exit-switch-command-state", + "qcom,mdss-dsi-levelkey-end-command-state", +#ifdef OPLUS_FEATURE_AOD_RAMLESS + "qcom,mdss-dsi-failsafe-on-command-state", + "qcom,mdss-dsi-failsafe-off-command-state", +#endif /* OPLUS_FEATURE_AOD_RAMLESS */ +#ifdef OPLUS_FEATURE_LCD_CABC +/* xupengcheng@MULTIMEDIA.MM.Display.LCD.Stability,2020/09/18 + * add for 19696 LCD CABC feature + */ + "qcom,mdss-dsi-cabc-ui-command-state", + "qcom,mdss-dsi-cabc-still-image-command-state", + "qcom,mdss-dsi-cabc-video-command-state", +#endif /*OPLUS_FEATURE_LCD_CABC*/ +//#endif /*OPLUS_BUG_STABILITY*/ }; static int dsi_panel_get_cmd_pkt_count(const char *data, u32 length, u32 *cnt) @@ -2006,6 +2487,13 @@ static int dsi_panel_parse_reset_sequence(struct dsi_panel *panel) } pr_err("RESET SEQ LENGTH = %d\n", length); + + #ifdef OPLUS_BUG_STABILITY + /*DuanSu@MULTIMEDIA.DISPLAY.LCD, 2020/08/03, Add for 19567 project reset */ + panel->reset_timing = utils->read_bool(utils->data,"oppo,reset_timing"); + pr_err("oppo,reset_timing: %s", panel->reset_timing ? "true" : "false"); + #endif /* OPLUS_BUG_STABILITY */ + length = length / sizeof(u32); size = length * sizeof(u32); @@ -2120,6 +2608,14 @@ static int dsi_panel_parse_jitter_config( return 0; } +#ifdef OPLUS_BUG_STABILITY +/*Sachin@OPLUS_FEATURE_PANEL_POWER,2020-05-23 add for panle power config */ +__attribute__((weak)) int +dsi_panel_parse_panel_power_cfg(struct dsi_panel *panel) +{ + return 0; +} +#endif /* OPLUS_BUG_STABILITY */ static int dsi_panel_parse_power_cfg(struct dsi_panel *panel) { int rc = 0; @@ -2210,6 +2706,85 @@ static int dsi_panel_parse_gpios(struct dsi_panel *panel) panel->reset_config.mode_sel_state = MODE_SEL_DUAL_PORT; } + + #ifdef OPLUS_BUG_STABILITY + /* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, add for 19081 LCD */ + panel->reset_config.lcd_vci_gpio = utils->get_named_gpio( + utils->data, "qcom,panel-vci-gpio", 0); + if (!gpio_is_valid(panel->reset_config.lcd_vci_gpio)) + pr_debug("%s: %d qcom,panel-vci-gpio not specified\n", __func__, __LINE__); + + panel->reset_config.err_flag_gpio = utils->get_named_gpio( + utils->data, "qcom,err-flag-gpio", 0); + if (!gpio_is_valid(panel->reset_config.err_flag_gpio)) + pr_debug("%s: %d qcom,err-flag-gpio not specified\n", __func__, __LINE__); + + /* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/23, add for lcd reset gpio delay */ + if (utils->read_u32(utils->data, "oplus,lcd-delay-disp-en-gpio", + &panel->reset_config.lcd_delay_disp_en_gpio)) + { + pr_err("failed to read oplus,lcd-delay-disp-en-gpio\n"); + panel->reset_config.lcd_delay_disp_en_gpio=0; + } + + if (utils->read_u32(utils->data, "oplus,lcd-delay-reset-gpio", + &panel->reset_config.lcd_delay_reset_gpio)) + { + pr_err("failed to read oplus,lcd-delay-reset-gpio\n"); + panel->reset_config.lcd_delay_reset_gpio=0; + } + + if (utils->read_u32(utils->data, "oplus,lcd-delay-mode-sel-gpio", + &panel->reset_config.lcd_delay_mode_sel_gpio)) + { + pr_err("failed to read oplus,lcd-delay-mode-sel-gpio\n"); + panel->reset_config.lcd_delay_mode_sel_gpio=0; + } + + if (utils->read_u32(utils->data, "oplus,lcd-delay-set-pinctrl-state", + &panel->reset_config.lcd_delay_set_pinctrl_state)) + { + pr_err("failed to read oplus,lcd-delay-set-pinctrl-state\n"); + panel->reset_config.lcd_delay_set_pinctrl_state=0; + } + + if (utils->read_u32(utils->data, "oplus,lcd-delay-enable-regulator", + &panel->reset_config.lcd_delay_enable_regulator)) + { + pr_err("failed to read oplus,lcd-delay-enable-regulator\n"); + panel->reset_config.lcd_delay_enable_regulator=0; + } + + /* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, add for 19081 LCD */ + if (utils->read_u32(utils->data, "oplus,lcd-delay-vci-gpio", + &panel->reset_config.lcd_delay_vci_gpio)) + { + pr_err("failed to read oplus,lcd-delay-vci-gpio\n"); + panel->reset_config.lcd_delay_vci_gpio=0; + } + + /* xupengcheng@MULTIMEDIA.DISPLAY.LCD, 2020/10/29, add for 19781 LCD */ + if (utils->read_u32(utils->data, "oplus,lcd-delay-lp11-state", + &panel->reset_config.lcd_delay_lp11_state)) + { + pr_err("failed to read oplus,lcd-delay-lp11-state\n"); + panel->reset_config.lcd_delay_lp11_state=0; + } + #endif /* OPLUS_BUG_STABILITY */ + + //#ifdef OPLUS_BUG_DEBUG + /* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/23, add for common lcd reset timing */ + printk(KERN_INFO "%s:panel->reset_config.lcd_delay_disp_en_gpio=%d", __func__, panel->reset_config.lcd_delay_disp_en_gpio); + printk(KERN_INFO "%s:panel->reset_config.lcd_delay_reset_gpio=%d", __func__, panel->reset_config.lcd_delay_reset_gpio); + printk(KERN_INFO "%s:panel->reset_config.lcd_delay_mode_sel_gpio=%d", __func__, panel->reset_config.lcd_delay_mode_sel_gpio); + printk(KERN_INFO "%s:panel->reset_config.lcd_delay_mode_sel_gpio=%d", __func__, panel->reset_config.lcd_delay_set_pinctrl_state); + printk(KERN_INFO "%s:panel->reset_config.lcd_delay_enable_regulator=%d", __func__, panel->reset_config.lcd_delay_enable_regulator); + /* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, add for 19081 LCD */ + printk(KERN_INFO "%s:panel->reset_config.lcd_delay_vci_gpio=%d", __func__, panel->reset_config.lcd_delay_vci_gpio); + /* xupengcheng@MULTIMEDIA.DISPLAY.LCD, 2020/10/29, add for 19781 LCD */ + printk(KERN_INFO "%s:panel->reset_config.lcd_delay_lp11_state=%d", __func__, panel->reset_config.lcd_delay_lp11_state); + //#endif /* OPLUS_BUG_DEBUG */ + /* TODO: release memory */ rc = dsi_panel_parse_reset_sequence(panel); if (rc) { @@ -2314,6 +2889,27 @@ static int dsi_panel_parse_bl_config(struct dsi_panel *panel) panel->bl_config.brightness_max_level = val; } +#ifdef OPLUS_BUG_STABILITY +/*Sachin Shukla@PSW.MM.Display.LCD.Feature,2019-11-04 add for global hbm */ + rc = utils->read_u32(utils->data, "qcom,mdss-dsi-bl-normal-max-level", &val); + if (rc) { + pr_debug("[%s] bl-max-level unspecified, defaulting to max level\n", + panel->name); + panel->bl_config.bl_normal_max_level = panel->bl_config.bl_max_level; + } else { + panel->bl_config.bl_normal_max_level = val; + } + + rc = utils->read_u32(utils->data, "qcom,mdss-brightness-normal-max-level", + &val); + if (rc) { + pr_debug("[%s] brigheness-max-level unspecified, defaulting to 255\n", + panel->name); + panel->bl_config.brightness_normal_max_level = panel->bl_config.brightness_max_level; + } else { + panel->bl_config.brightness_normal_max_level = val; + } + rc = utils->read_u32(utils->data, "qcom,mdss-dsi-bl-default-level", &val); if (rc) { @@ -2327,6 +2923,26 @@ static int dsi_panel_parse_bl_config(struct dsi_panel *panel) panel->bl_config.bl_inverted_dbv = utils->read_bool(utils->data, "qcom,mdss-dsi-bl-inverted-dbv"); + /*Jiasong.Zhong@PSW.MM.Display.LCD.Feature,2019-11-04 add for dc backlight */ + rc = utils->read_u32(utils->data, "qcom,mdss-dsi-dc-backlight-level", &val); + if (rc) { + DSI_DEBUG("[%s] dc backlight unspecified, defaulting to default level 260\n", + panel->name); + oppo_dimlayer_bl_alpha_v2 = 260; + } else { + oppo_dimlayer_bl_alpha_v2 = val; + } + +/* Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/11/20, add for seed backlight */ + rc = utils->read_u32(utils->data, "qcom,mdss-dsi-seed-backlight-max", &val); + if (rc) { + panel->oppo_priv.seed_bl_max = 255; + } else { + panel->oppo_priv.seed_bl_max = val; + } + DSI_DEBUG("[%s] seed backlight max value is %d\n", panel->name, panel->oppo_priv.seed_bl_max); +#endif /* OPLUS_BUG_STABILITY */ + if (panel->bl_config.type == DSI_BACKLIGHT_PWM) { rc = dsi_panel_parse_bl_pwm_config(panel); if (rc) { @@ -3192,6 +3808,25 @@ static int dsi_panel_parse_esd_config(struct dsi_panel *panel) esd_config->esd_enabled = utils->read_bool(utils->data, "qcom,esd-check-enabled"); +#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.LCD.Stability,2018/12/13 +* Add for disable esd check while in test mode. +*/ + switch(get_boot_mode()) + { + case MSM_BOOT_MODE__RF: + case MSM_BOOT_MODE__WLAN: + case MSM_BOOT_MODE__FACTORY: + esd_config->esd_enabled = 0x0; + pr_err("%s force disable esd check while in rf,wlan and factory mode, esd staus: 0x%x\n", + __func__, esd_config->esd_enabled); + break; + + default: + break; + } +#endif /*OPLUS_BUG_STABILITY*/ + if (!esd_config->esd_enabled) return 0; @@ -3318,7 +3953,7 @@ struct dsi_panel *dsi_panel_get(struct device *parent, rc = dsi_panel_parse_qsync_caps(panel, of_node); if (rc) - pr_debug("failed to parse qsync features, rc=%d\n", rc); + pr_err("failed to parse qsync features, rc=%d\n", rc); /* allow qsync support only if DFPS is with VFP approach */ if ((panel->dfps_caps.dfps_support) && @@ -3341,10 +3976,47 @@ struct dsi_panel *dsi_panel_get(struct device *parent, goto error; } +#ifdef OPLUS_BUG_STABILITY +/*Sachin SHukla@PSW.MM.Display.LCD.Feature,2019-10-30 add for fod config */ + rc = dsi_panel_parse_oppo_config(panel); + if (rc) + DSI_ERR("failed to parse panel config, rc=%d\n", rc); +#endif /* OPLUS_BUG_STABILITY */ + +#ifdef OPLUS_FEATURE_LCD_CABC +/*xupengcheng@MULTIMEDIA.MM.Display.LCD.Stability,2020/09/18,add for 19696 LCD CABC feature*/ + if(panel->oppo_priv.is_19696_lcd) + is_support_cabc = true; + else + is_support_cabc = false; + +#endif /*OPLUS_FEATURE_LCD_CABC*/ + +#ifdef OPLUS_BUG_STABILITY +/*Jiasong.ZhongPSW.MM.Display.LCD.Stable,2020-09-17 add for DC backlight */ + rc = dsi_panel_parse_oppo_dc_config(panel); + if (rc) + DSI_ERR("failed to parse dc config, rc=%d\n", rc); +#endif /* OPLUS_BUG_STABILITY */ + +#ifdef OPLUS_BUG_STABILITY +/* xupengcheng@MULTIMEDIA.DISPLAY.LCD.Feature,2020-10-21 optimize osc adaptive */ + rc = oplus_display_get_panel_parameters(panel, utils); + if (rc) + DSI_INFO("failed to get oplus panel parameters\n"); +#endif /* OPLUS_BUG_STABILITY */ + rc = dsi_panel_parse_power_cfg(panel); if (rc) pr_err("failed to parse power config, rc=%d\n", rc); +#ifdef OPLUS_BUG_STABILITY +/*Sachin@OPLUS_FEATURE_PANEL_POWER,2020-05-23 add for panle power config */ + rc = dsi_panel_parse_panel_power_cfg(panel); + if (rc) + DSI_ERR("failed to parse panel_power config, rc=%d\n", rc); +#endif /* OPLUS_BUG_STABILITY */ + rc = dsi_panel_parse_bl_config(panel); if (rc) { pr_err("failed to parse backlight config, rc=%d\n", rc); @@ -3562,21 +4234,9 @@ int dsi_panel_get_mode_count(struct dsi_panel *panel) num_bit_clks = !panel->dyn_clk_caps.dyn_clk_support ? 1 : panel->dyn_clk_caps.bit_clk_list_len; - /* - * Inflate num_of_modes by fps and bit clks in dfps - * Single command mode for video mode panels supporting - * panel operating mode switch. - */ - - num_video_modes = num_video_modes * num_bit_clks * num_dfps_rates; - - if ((panel->panel_mode == DSI_OP_VIDEO_MODE) && - (panel->panel_mode_switch_enabled)) - num_cmd_modes = 1; - else - num_cmd_modes = num_cmd_modes * num_bit_clks; - - panel->num_display_modes = num_video_modes + num_cmd_modes; + /* Inflate num_of_modes by fps and bit clks in dfps */ + panel->num_display_modes = (num_cmd_modes * num_bit_clks) + + (num_video_modes * num_bit_clks * num_dfps_rates); error: return rc; @@ -3700,6 +4360,13 @@ int dsi_panel_get_mode(struct dsi_panel *panel, goto parse_fail; } +#ifdef OPLUS_BUG_STABILITY +/*Sachin Shukla@PSW.MM.Display.LCD.Stable,2019-10-24 add for fingerprint */ + rc = dsi_panel_parse_oppo_mode_config(mode, utils); + if (rc) + pr_err("failed to parse oppo config, rc=%d\n", rc); +#endif + rc = dsi_panel_parse_jitter_config(mode, utils); if (rc) pr_err( @@ -3864,6 +4531,12 @@ int dsi_panel_set_lp1(struct dsi_panel *panel) return -EINVAL; } +#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.Lcd.Stability, 2018-11-21 + * Add to mark power states +*/ + pr_err("%s\n", __func__); +#endif /* OPLUS_BUG_STABILITY */ mutex_lock(&panel->panel_lock); if (!panel->panel_initialized) goto exit; @@ -3884,6 +4557,14 @@ int dsi_panel_set_lp1(struct dsi_panel *panel) if (rc) pr_err("[%s] failed to send DSI_CMD_SET_LP1 cmd, rc=%d\n", panel->name, rc); +#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.LCD.Stable,2018-11-21 + * Fix aod flash problem +*/ + //oppo_update_aod_light_mode_unlock(panel); + panel->need_power_on_backlight = true; + set_oppo_display_power_status(OPPO_DISPLAY_POWER_DOZE); +#endif /* OPLUS_BUG_STABILITY */ exit: mutex_unlock(&panel->panel_lock); return rc; @@ -3898,6 +4579,12 @@ int dsi_panel_set_lp2(struct dsi_panel *panel) return -EINVAL; } +#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.Lcd.Stability, 2018-05-31 + * Add to mark power states +*/ + pr_err("%s\n", __func__); +#endif /* OPLUS_BUG_STABILITY */ mutex_lock(&panel->panel_lock); if (!panel->panel_initialized) goto exit; @@ -3906,6 +4593,12 @@ int dsi_panel_set_lp2(struct dsi_panel *panel) if (rc) pr_err("[%s] failed to send DSI_CMD_SET_LP2 cmd, rc=%d\n", panel->name, rc); +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.LCD.Stability,2018/11/21, + * Set and save display status +*/ + set_oppo_display_power_status(OPPO_DISPLAY_POWER_DOZE_SUSPEND); +#endif /* OPLUS_BUG_STABILITY */ exit: mutex_unlock(&panel->panel_lock); return rc; @@ -3920,6 +4613,12 @@ int dsi_panel_set_nolp(struct dsi_panel *panel) return -EINVAL; } +#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.Lcd.Stability, 2018-11-21 + * Add to mark power states +*/ + pr_err("%s\n", __func__); +#endif /* OPLUS_BUG_STABILITY */ mutex_lock(&panel->panel_lock); if (!panel->panel_initialized) goto exit; @@ -3936,6 +4635,13 @@ int dsi_panel_set_nolp(struct dsi_panel *panel) if (rc) pr_err("[%s] failed to send DSI_CMD_SET_NOLP cmd, rc=%d\n", panel->name, rc); + +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.LCD.Stability,2018/11/21 + * Set and save display status +*/ + set_oppo_display_power_status(OPPO_DISPLAY_POWER_ON); +#endif /* OPLUS_BUG_STABILITY */ exit: mutex_unlock(&panel->panel_lock); return rc; @@ -3960,6 +4666,16 @@ int dsi_panel_prepare(struct dsi_panel *panel) goto error; } } + #ifdef OPLUS_BUG_STABILITY + /* xupengcheng@MULTIMEDIA.DISPLAY.LCD, 2020/10/29, add for 19781 LCD need wait 10ms after lp11 init*/ + if(!strcmp(panel->name, "samsung sofef03f_m amoled fhd+ panel with DSC")){ + if (panel->reset_config.lcd_delay_lp11_state) + usleep_range(panel->reset_config.lcd_delay_lp11_state, + panel->reset_config.lcd_delay_lp11_state + 100); + if (rc) + pr_err("unable to set lcd_delay_lp11_state dir for disp gpio rc=%d\n", rc); + } + #endif /* OPLUS_BUG_STABILITY */ rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_PRE_ON); if (rc) { @@ -4184,6 +4900,12 @@ int dsi_panel_mode_switch_to_cmd(struct dsi_panel *panel) if (rc) pr_err("[%s] failed to send DSI_CMD_SET_POST_VID_TO_CMD_SWITCH cmds, rc=%d\n", panel->name, rc); + +#ifdef OPLUS_FEATURE_AOD_RAMLESS +// Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, sepolicy for aod ramless + oppo_display_update_aod_area_unlock(); +#endif /* OPLUS_FEATURE_AOD_RAMLESS */ + mutex_unlock(&panel->panel_lock); return rc; } @@ -4255,6 +4977,10 @@ int dsi_panel_enable(struct dsi_panel *panel) return -EINVAL; } +//#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.Lcd.Stability, 2018-05-31,add to mark power states*/ + pr_err("%s\n", __func__); +//#endif /* OPLUS_BUG_STABILITY */ mutex_lock(&panel->panel_lock); rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_ON); @@ -4263,7 +4989,17 @@ int dsi_panel_enable(struct dsi_panel *panel) panel->name, rc); else panel->panel_initialized = true; +//#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.LCD.Stable,2018-08-23 + * avoid screen flash when esd reset +*/ + panel->need_power_on_backlight = true; + set_oppo_display_power_status(OPPO_DISPLAY_POWER_ON); +//#endif /* OPLUS_BUG_STABILITY */ mutex_unlock(&panel->panel_lock); +/* add begin by zhaifeibao@ODM_LQ@Multimedia.TP,for tp resume upload fw 2020-11-11*/ + lcd_queue_load_tp_fw(); +/* add begin by zhaifeibao@ODM_LQ@Multimedia.TP,for tp resume upload fw 2020-11-11*/ return rc; } @@ -4321,6 +5057,12 @@ int dsi_panel_disable(struct dsi_panel *panel) return -EINVAL; } +#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.Lcd.Stability, 2018-11-21 + * Add to mark power states +*/ + pr_err("%s\n", __func__); +#endif /* OPLUS_BUG_STABILITY */ mutex_lock(&panel->panel_lock); /* Avoid sending panel off commands when ESD recovery is underway */ @@ -4350,6 +5092,13 @@ int dsi_panel_disable(struct dsi_panel *panel) } panel->panel_initialized = false; panel->power_mode = SDE_MODE_DPMS_OFF; +//#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.LCD.Stable,2018-11-21 + * fix esd not work when enable OnScreenFingerprint +*/ + panel->is_hbm_enabled = false; + set_oppo_display_power_status(OPPO_DISPLAY_POWER_OFF); +//#endif /* OPLUS_BUG_STABILITY */ mutex_unlock(&panel->panel_lock); return rc; @@ -4386,7 +5135,15 @@ int dsi_panel_post_unprepare(struct dsi_panel *panel) pr_err("invalid params\n"); return -EINVAL; } - + #ifdef OPLUS_BUG_STABILITY + /* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, add for 19081 LCD */ + if(!strcmp(panel->name, "samsung sofef03f_m amoled fhd+ panel with DSC")) { + if (panel->err_flag_status == true) { + pr_err("no need to power off when err flag irq comes\n"); + return rc; + } + } + #endif /* OPLUS_BUG_STABILITY */ mutex_lock(&panel->panel_lock); rc = dsi_panel_power_off(panel); diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.h b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.h index 2ed6f0980dea..f4e81da02090 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.h +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.h @@ -29,6 +29,15 @@ #include "dsi_pwr.h" #include "dsi_parser.h" #include "msm_drv.h" +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.LCD.Stability,2018/11/21 + * Add for save display panel power status at oppo display management +*/ +struct oppo_brightness_alpha { + u32 brightness; + u32 alpha; +}; +#endif /*OPLUS_BUG_STABILITY*/ #define MAX_BL_LEVEL 4096 #define MAX_BL_SCALE_LEVEL 1024 @@ -36,7 +45,7 @@ #define DSI_CMD_PPS_SIZE 135 #define DSI_MODE_MAX 5 - +extern int tp_gesture_enable_flag(void); enum dsi_panel_rotation { DSI_PANEL_ROTATE_NONE = 0, DSI_PANEL_ROTATE_HV_FLIP, @@ -115,6 +124,13 @@ struct dsi_backlight_config { u32 bl_max_level; u32 brightness_max_level; u32 brightness_default_level; +#ifdef OPLUS_BUG_STABILITY +/*Sachin Shukla@PSW.MM.Display.LCD.Feature,2019-11-04 add for + * global hbm +*/ + u32 bl_normal_max_level; + u32 brightness_normal_max_level; +#endif /* OPLUS_BUG_STABILITY */ u32 bl_level; u32 bl_scale; u32 bl_scale_ad; @@ -144,6 +160,20 @@ struct dsi_panel_reset_config { int disp_en_gpio; int lcd_mode_sel_gpio; u32 mode_sel_state; + #ifdef OPLUS_BUG_STABILITY + /* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/18, add for 19081 LCD */ + int lcd_vci_gpio; + int err_flag_gpio; + u32 lcd_delay_vci_gpio; + /* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/23, add for lcd reset gpio delay */ + u32 lcd_delay_disp_en_gpio; + u32 lcd_delay_reset_gpio; + u32 lcd_delay_mode_sel_gpio; + u32 lcd_delay_set_pinctrl_state; + u32 lcd_delay_enable_regulator; + /* xupengcheng@MULTIMEDIA.DISPLAY.LCD, 2020/10/30, add for 19781 lp11 delay */ + u32 lcd_delay_lp11_state; + #endif /* OPLUS_BUG_STABILITY */ }; enum esd_check_status_mode { @@ -168,6 +198,38 @@ struct drm_panel_esd_config { u32 groups; }; +#ifdef OPLUS_BUG_STABILITY +/*Sachin hukla@PSW.MM.Display.LCD.Feature,2019-11-07 add for + * oppo custom info +*/ +struct dsi_panel_oppo_privite { + const char *vendor_name; + const char *manufacture_name; + bool skip_mipi_last_cmd; + bool is_pxlw_iris5; +#ifdef OPLUS_FEATURE_AOD_RAMLESS +// Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, sepolicy for aod ramless + bool is_aod_ramless; +#endif /* OPLUS_FEATURE_AOD_RAMLESS */ + /* xupengcheng@MULTIMEDIA.DISPLAY.LCD.Feature,2020-10-21 optimize osc adaptive */ + bool is_osc_support; + bool is_19781_lcd; + u32 osc_clk_mode0_rate; + u32 osc_clk_mode1_rate; + u32 osc_clk_current_rate; + int seed_bl_max; + bool bl_interpolate_nosub; + struct oppo_brightness_alpha *bl_remap; + int bl_remap_count; +#ifdef OPLUS_FEATURE_LCD_CABC +/*xupengcheng@MULTIMEDIA.MM.Display.LCD.Stability,2020/09/18,add for 19696 LCD CABC feature*/ + bool is_19696_lcd; +#endif /*OPLUS_FEATURE_LCD_CABC*/ + u32 pll_delay; + u32 prj_flag; +}; +#endif /* OPLUS_BUG_STABILITY */ + struct dsi_panel { const char *name; const char *type; @@ -218,6 +280,26 @@ struct dsi_panel { bool sync_broadcast_en; int power_mode; enum dsi_panel_physical_type panel_type; + +//#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.Service.Feature,2018/11/21 + * For OnScreenFingerprint feature +*/ + bool is_hbm_enabled; + /* Fix aod flash problem */ + bool need_power_on_backlight; +/*DuanSu@MULTIMEDIA.DISPLAY.LCD, 2020/08/03, Add for 19567 project reset */ + bool reset_timing; +/*Sachin Shukla@PSW.MM.Display.LCD.Feature,2019-10-30 add for fod brightness */ + struct oppo_brightness_alpha *ba_seq; + struct oppo_brightness_alpha *dc_ba_seq; + int ba_count; + int dc_ba_count; + struct dsi_panel_oppo_privite oppo_priv; + /* Chao.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/18, add for 19081 LCD */ + bool is_err_flag_irq_enabled; + bool err_flag_status; +//#endif /* OPLUS_BUG_STABILITY */ }; static inline bool dsi_panel_ulps_feature_enabled(struct dsi_panel *panel) @@ -337,5 +419,14 @@ struct dsi_panel *dsi_panel_ext_bridge_get(struct device *parent, int dsi_panel_parse_esd_reg_read_configs(struct dsi_panel *panel); void dsi_panel_ext_bridge_put(struct dsi_panel *panel); - +//#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.LCD.Stability,2018/11/21 + * Add for oppo display new structure +*/ +int dsi_panel_tx_cmd_set(struct dsi_panel *panel, + enum dsi_cmd_set_type type); +/* add begin by zhangchaofan@ODM_LQ@Multimedia.TP,for tp resume upload fw 2019-11-14*/ +extern void lcd_queue_load_tp_fw(void); +/* add end by zhangchaofan@ODM_LQ@Multimedia.TP,for tp resume upload fw 2019-11-14 */ +//#endif /* OPLUS_BUG_STABILITY */ #endif /* _DSI_PANEL_H_ */ diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_phy_hw_v3_0.c b/drivers/gpu/drm/msm/dsi-staging/dsi_phy_hw_v3_0.c index ca19bf454573..dfc7075cfd3a 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_phy_hw_v3_0.c +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_phy_hw_v3_0.c @@ -236,7 +236,10 @@ static void dsi_phy_hw_v3_0_dphy_lane_settings(struct dsi_phy_hw *phy, DSI_W32(phy, DSIPHY_LNX_CFG1(i), cfg->lanecfg.lane[i][1]); DSI_W32(phy, DSIPHY_LNX_CFG2(i), cfg->lanecfg.lane[i][2]); DSI_W32(phy, DSIPHY_LNX_CFG3(i), cfg->lanecfg.lane[i][3]); - DSI_W32(phy, DSIPHY_LNX_OFFSET_TOP_CTRL(i), 0x0); + //#ifdef OPLUS_BUG_STABILITY + /* Liping-M@PSW.MM.Display.LCD,2020/3/17, Modify for LCD MIPI */ + DSI_W32(phy, DSIPHY_LNX_OFFSET_TOP_CTRL(i), 0x1F); + //#endif /* OPLUS_BUG_STABILITY */ DSI_W32(phy, DSIPHY_LNX_OFFSET_BOT_CTRL(i), 0x0); DSI_W32(phy, DSIPHY_LNX_TX_DCTRL(i), tx_dctrl[i]); } @@ -358,7 +361,10 @@ static void dsi_phy_hw_dphy_enable(struct dsi_phy_hw *phy, DSI_W32(phy, DSIPHY_CMN_GLBL_CTRL, 0x10); /* Enable LDO */ - DSI_W32(phy, DSIPHY_CMN_VREG_CTRL, 0x59); + //#ifdef OPLUS_BUG_STABILITY + /* Liping-M@PSW.MM.Display.LCD,2020/3/17, Modify for LCD MIPI */ + DSI_W32(phy, DSIPHY_CMN_VREG_CTRL, 0x5B); + //#endif /* OPLUS_BUG_STABILITY */ /* Configure PHY lane swap */ dsi_phy_hw_v3_0_lane_swap_config(phy, &cfg->lane_map); diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_pwr.c b/drivers/gpu/drm/msm/dsi-staging/dsi_pwr.c index 415c571443c7..c47e4fb9e2fe 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_pwr.c +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_pwr.c @@ -19,6 +19,7 @@ #include "dsi_pwr.h" #include "dsi_parser.h" +static int tp_gesture_pwr_flag = 0; /* * dsi_pwr_parse_supply_node() - parse power supply node from root device node */ @@ -137,6 +138,15 @@ static int dsi_pwr_enable_vregs(struct dsi_regulator_info *regs, bool enable) if (enable) { for (i = 0; i < regs->count; i++) { + if (tp_gesture_pwr_flag) { + if ((strcmp(regs->vregs[i].vreg_name,"lab")==0) || + (strcmp(regs->vregs[i].vreg_name,"ibb")==0) || + (strcmp(regs->vregs[i].vreg_name,"vddio")==0) ) { + tp_gesture_pwr_flag--; + //pr_info("LQTP-no enable vreg %s\n",regs->vregs[i].vreg_name); + continue; + } + } vreg = ®s->vregs[i]; if (vreg->pre_on_sleep) msleep(vreg->pre_on_sleep); @@ -172,6 +182,16 @@ static int dsi_pwr_enable_vregs(struct dsi_regulator_info *regs, bool enable) } } else { for (i = (regs->count - 1); i >= 0; i--) { + if (tp_gesture_enable_flag()) { + if ((strcmp(regs->vregs[i].vreg_name,"lab")==0) || + (strcmp(regs->vregs[i].vreg_name,"ibb")==0) || + (strcmp(regs->vregs[i].vreg_name,"vddio")==0) ) { + tp_gesture_pwr_flag++; + //pr_info("LQTP-no disable vreg %s\n",regs->vregs[i].vreg_name); + continue; + } + } + if (regs->vregs[i].pre_off_sleep) msleep(regs->vregs[i].pre_off_sleep); diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_pwr.h b/drivers/gpu/drm/msm/dsi-staging/dsi_pwr.h index b86f47153fb0..61a6a5c5b44d 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_pwr.h +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_pwr.h @@ -112,4 +112,5 @@ int dsi_pwr_enable_regulator(struct dsi_regulator_info *regs, bool enable); int dsi_pwr_panel_regulator_mode_set(struct dsi_regulator_info *regs, const char *reg_name, int regulator_mode); +extern int tp_gesture_enable_flag(void); #endif /* _DSI_PWR_H_ */ diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c index 39f1e7c3b4c0..835e3f6a0cc5 100644 --- a/drivers/gpu/drm/msm/msm_atomic.c +++ b/drivers/gpu/drm/msm/msm_atomic.c @@ -73,11 +73,24 @@ EXPORT_SYMBOL(msm_drm_unregister_client); * @v: notifier data, inculde display id and display blank * event(unblank or power down). */ + +#ifndef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.Lcd.Stability, 2018-05-31 +* add for export drm_notifier +*/ static int msm_drm_notifier_call_chain(unsigned long val, void *v) { return blocking_notifier_call_chain(&msm_drm_notifier_list, val, v); } +#else /*OPLUS_BUG_STABILITY*/ +int msm_drm_notifier_call_chain(unsigned long val, void *v) +{ + return blocking_notifier_call_chain(&msm_drm_notifier_list, val, + v); +} +EXPORT_SYMBOL(msm_drm_notifier_call_chain); +#endif /*OPLUS_BUG_STABILITY*/ /* block until specified crtcs are no longer pending update, and * atomically mark them as pending update @@ -263,8 +276,12 @@ msm_disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) blank = MSM_DRM_BLANK_POWERDOWN; notifier_data.data = ␣ notifier_data.id = crtc_idx; - msm_drm_notifier_call_chain(MSM_DRM_EARLY_EVENT_BLANK, - ¬ifier_data); + #ifndef OPLUS_BUG_STABILITY + /*Sachin @PSW.MM.Display.LCD.Stable, 2020/04/09, Add for + remove original drm notify for bug 12684 */ + msm_drm_notifier_call_chain(MSM_DRM_EARLY_EVENT_BLANK, + ¬ifier_data); + #endif /* OPLUS_BUG_STABILITY */ } /* * Each encoder has at most one connector (since we always steal @@ -284,8 +301,12 @@ msm_disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) if (connector->state->crtc && connector->state->crtc->state->active_changed) { DRM_DEBUG_ATOMIC("Notify blank\n"); + #ifndef OPLUS_BUG_STABILITY + /* Saching@PSW.MM.Display.LCD.Stable, 2020/04/09, Add for + remove original drm notify for bug 12684 */ msm_drm_notifier_call_chain(MSM_DRM_EVENT_BLANK, ¬ifier_data); + #endif /* OPLUS_BUG_STABILITY */ } } @@ -502,8 +523,12 @@ static void msm_atomic_helper_commit_modeset_enables(struct drm_device *dev, notifier_data.id = connector->state->crtc->index; DRM_DEBUG_ATOMIC("Notify early unblank\n"); + #ifndef OPLUS_BUG_STABILITY + /* Sachin@PSW.MM.Display.LCD.Stable, 2020/04/09, Add for + remove original drm notify for bug 12684 */ msm_drm_notifier_call_chain(MSM_DRM_EARLY_EVENT_BLANK, - ¬ifier_data); + ¬ifier_data); + #endif /* OPLUS_BUG_STABILITY */ } /* * Each encoder has at most one connector (since we always steal @@ -557,8 +582,12 @@ static void msm_atomic_helper_commit_modeset_enables(struct drm_device *dev, if (splash || (connector->state->crtc && connector->state->crtc->state->active_changed)) { DRM_DEBUG_ATOMIC("Notify unblank\n"); + #ifndef OPLUS_BUG_STABILITY + /*Sachin @PSW.MM.Display.LCD.Stable, 2020/04/09, Add for + remove original drm notify for bug 12684 */ msm_drm_notifier_call_chain(MSM_DRM_EVENT_BLANK, - ¬ifier_data); + ¬ifier_data); + #endif /* OPLUS_BUG_STABILITY */ } } SDE_ATRACE_END("msm_enable"); diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index fb4d64fd1f17..b0d64f9aecc8 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -121,6 +121,12 @@ enum msm_mdp_plane_property { PLANE_PROP_PREFILL_TIME, PLANE_PROP_SCALER_V1, PLANE_PROP_SCALER_V2, +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.LCD.Feature,2018-11-21 + * Support custom propertys +*/ + PLANE_PROP_CUSTOM, +#endif /* OPLUS_BUG_STABILITY */ PLANE_PROP_ROT_OUT_FB, PLANE_PROP_INVERSE_PMA, @@ -161,6 +167,12 @@ enum msm_mdp_crtc_property { CRTC_PROP_SECURITY_LEVEL, CRTC_PROP_IDLE_TIMEOUT, CRTC_PROP_DEST_SCALER, +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.LCD.Feature,2018-11-21 + * Support custom propertys +*/ + CRTC_PROP_CUSTOM, +#endif /* OPLUS_BUG_STABILITY */ CRTC_PROP_CAPTURE_OUTPUT, CRTC_PROP_IDLE_PC_STATE, @@ -191,7 +203,12 @@ enum msm_mdp_conn_property { CONNECTOR_PROP_ROI_V1, CONNECTOR_PROP_BL_SCALE, CONNECTOR_PROP_AD_BL_SCALE, - +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.LCD.Feature,2018-011-21 + * Support custom propertys +*/ + CONNECTOR_PROP_CUSTOM, +#endif /* OPLUS_BUG_STABILITY */ /* enum/bitmask properties */ CONNECTOR_PROP_TOPOLOGY_NAME, CONNECTOR_PROP_TOPOLOGY_CONTROL, diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c index 2a90aa4caec0..6c5e18573931 100644 --- a/drivers/gpu/drm/msm/msm_iommu.c +++ b/drivers/gpu/drm/msm/msm_iommu.c @@ -18,6 +18,12 @@ #include "msm_drv.h" #include "msm_mmu.h" +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.LCD.Machine, 2019/01/29,add for mm kevent fb. */ +#include "oppo_mm_kevent_fb.h" +static int msm_smmu_count = 0; +#endif /* OPLUS_BUG_STABILITY */ + struct msm_iommu { struct msm_mmu base; struct iommu_domain *domain; @@ -28,9 +34,25 @@ static int msm_fault_handler(struct iommu_domain *domain, struct device *dev, unsigned long iova, int flags, void *arg) { struct msm_iommu *iommu = arg; + +#ifdef OPLUS_BUG_STABILITY +/* Sachin@PSW.MM.Display.LCD.Machine, 2019/01/29,add for mm kevent fb. */ + unsigned char payload[150] = ""; +#endif /*OPLUS_BUG_STABILITY*/ + if (iommu->base.handler) return iommu->base.handler(iommu->base.arg, iova, flags); pr_warn_ratelimited("*** fault: iova=%08lx, flags=%d\n", iova, flags); + +#ifdef OPLUS_BUG_STABILITY +/* Sachin@PSW.MM.Display.LCD.Machine, 2019/01/29,add for mm kevent fb. */ + if (msm_smmu_count < 30) { + scnprintf(payload, sizeof(payload), "NULL$$EventID@@%d$$SMMU msm fault@@%08lx flags=%d",OPPO_MM_DIRVER_FB_EVENT_ID_SMMU,iova,flags); + upload_mm_kevent_fb_data(OPPO_MM_DIRVER_FB_EVENT_MODULE_DISPLAY,payload); + msm_smmu_count ++; + } + #endif /*OPLUS_BUG_STABILITY*/ + return 0; } diff --git a/drivers/gpu/drm/msm/sde/sde_color_processing.c b/drivers/gpu/drm/msm/sde/sde_color_processing.c index 7782dffc7e33..529539cb5c4c 100644 --- a/drivers/gpu/drm/msm/sde/sde_color_processing.c +++ b/drivers/gpu/drm/msm/sde/sde_color_processing.c @@ -25,6 +25,16 @@ #include "sde_hw_interrupts.h" #include "sde_core_irq.h" #include "dsi_panel.h" +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@MM.Display.LCD.Stability, 2020/3/31, for + * decoupling display driver +*/ +#include "oppo_display_private_api.h" +#include "oppo_onscreenfingerprint.h" +extern struct drm_msm_pcc oppo_save_pcc; +extern bool oppo_skip_pcc; +extern bool oppo_pcc_enabled; +#endif /* OPLUS_BUG_STABILITY */ struct sde_cp_node { u32 property_id; @@ -345,6 +355,14 @@ static struct sde_kms *get_kms(struct drm_crtc *crtc) return to_sde_kms(priv->kms); } +#ifdef OPLUS_BUG_STABILITY +/* QianXu@MM.Display.LCD.Stability, 2020/3/31, for decoupling display driver */ +struct sde_kms *get_kms_(struct drm_crtc *crtc) +{ + return get_kms(crtc); +} +#endif + static void sde_cp_crtc_prop_attach(struct sde_cp_prop_attach *prop_attach) { @@ -643,6 +661,27 @@ static void sde_cp_crtc_setfeature(struct sde_cp_node *prop_node, struct sde_ad_hw_cfg ad_cfg; sde_cp_get_hw_payload(prop_node, &hw_cfg, &feature_enabled); + +#ifdef OPLUS_BUG_STABILITY +/*Mark.Yao@PSW.MM.Display.LCD.Stable,2019-04-28 fix pcc abnormal on onscreenfinger scene */ + if (prop_node->feature == SDE_CP_CRTC_DSPP_PCC && is_dsi_panel(&sde_crtc->base)) { + if (hw_cfg.payload && (hw_cfg.len == sizeof(oppo_save_pcc))) { + memcpy(&oppo_save_pcc, hw_cfg.payload, hw_cfg.len); + oppo_pcc_enabled = true; + + if (is_skip_pcc(&sde_crtc->base)) { + hw_cfg.payload = NULL; + hw_cfg.len = 0; + oppo_skip_pcc = true; + } else { + oppo_skip_pcc = false; + } + } else { + oppo_pcc_enabled = false; + } + } +#endif /* OPLUS_BUG_STABILITY */ + hw_cfg.num_of_mixers = sde_crtc->num_mixers; hw_cfg.last_feature = 0; @@ -869,6 +908,12 @@ void sde_cp_crtc_apply_properties(struct drm_crtc *crtc) struct sde_cp_node *prop_node = NULL, *n = NULL; struct sde_hw_ctl *ctl; u32 num_mixers = 0, i = 0; + #ifdef OPLUS_BUG_STABILITY + /*Sachin Shukla@PSW.MM.Display.LCD.Stable,2019-04-28 fix + * pcc abnormal on onscreenfinger scene + */ + bool dirty_pcc = false; + #endif /* OPLUS_BUG_STABILITY */ if (!crtc || !crtc->dev) { DRM_ERROR("invalid crtc %pK dev %pK\n", crtc, @@ -890,12 +935,30 @@ void sde_cp_crtc_apply_properties(struct drm_crtc *crtc) mutex_lock(&sde_crtc->crtc_cp_lock); + #ifdef OPLUS_BUG_STABILITY + /*@PSW.MM.Display.LCD.Stable,2019-04-28 fix pcc abnormal + * on onscreenfinger scene + */ + dirty_pcc = sde_cp_crtc_update_pcc(crtc); + if (dirty_pcc) { + set_dspp_flush = true; + } + #endif /* OPLUS_BUG_STABILITY */ + /* Check if dirty lists are empty and ad features are disabled for * early return. If ad properties are active then we need to issue * dspp flush. **/ + #ifdef OPLUS_BUG_STABILITY + /*Sachin Shukla@PSW.MM.Display.LCD.Stable,2019-04-28 fix + *pcc abnormal on onscreenfinger scene + */ + if (!dirty_pcc && list_empty(&sde_crtc->dirty_list) && + list_empty(&sde_crtc->ad_dirty)) { + #else if (list_empty(&sde_crtc->dirty_list) && list_empty(&sde_crtc->ad_dirty)) { + #endif /* OPLUS_BUG_STABILITY */ if (list_empty(&sde_crtc->ad_active)) { DRM_DEBUG_DRIVER("Dirty list is empty\n"); goto exit; diff --git a/drivers/gpu/drm/msm/sde/sde_color_processing.h b/drivers/gpu/drm/msm/sde/sde_color_processing.h index 7481a594f4fc..4815c5e65a6e 100644 --- a/drivers/gpu/drm/msm/sde/sde_color_processing.h +++ b/drivers/gpu/drm/msm/sde/sde_color_processing.h @@ -152,4 +152,10 @@ void sde_cp_crtc_post_ipc(struct drm_crtc *crtc); */ int sde_cp_hist_interrupt(struct drm_crtc *crtc_drm, bool en, struct sde_irq_callback *hist_irq); + +#ifdef OPLUS_BUG_STABILITY +/* QianXu@MM.Display.LCD.Stability, 2020/3/31, for decoupling display driver */ +struct sde_kms *get_kms_(struct drm_crtc *crtc); +#endif + #endif /*_SDE_COLOR_PROCESSING_H */ diff --git a/drivers/gpu/drm/msm/sde/sde_connector.c b/drivers/gpu/drm/msm/sde/sde_connector.c index d0f36c7a00bf..d339115c3215 100644 --- a/drivers/gpu/drm/msm/sde/sde_connector.c +++ b/drivers/gpu/drm/msm/sde/sde_connector.c @@ -23,6 +23,9 @@ #include "dsi_display.h" #include "sde_crtc.h" #include "sde_rm.h" +#ifdef OPLUS_BUG_STABILITY +#include "oppo_display_private_api.h" +#endif /* OPLUS_BUG_STABILITY */ #define BL_NODE_NAME_SIZE 32 @@ -35,6 +38,16 @@ #define SDE_ERROR_CONN(c, fmt, ...) SDE_ERROR("conn%d " fmt,\ (c) ? (c)->base.base.id : -1, ##__VA_ARGS__) +#ifdef OPLUS_BUG_STABILITY +/* Sachin@PSW.MM.Display.LCD.Feature,2020-06-08 + * Force enable dither on OnScreenFingerprint scene,add QCOM patch, + * fix BUG:49203 +*/ +static u32 dither_matrix[DITHER_MATRIX_SZ] = { + 15, 7, 13, 5, 3, 11, 1, 9, 12, 4, 14, 6, 0, 8, 2, 10 +}; +#endif /* OPLUS_BUG_STABILITY */ + static const struct drm_prop_enum_list e_topology_name[] = { {SDE_RM_TOPOLOGY_NONE, "sde_none"}, {SDE_RM_TOPOLOGY_SINGLEPIPE, "sde_singlepipe"}, @@ -64,6 +77,11 @@ static const struct drm_prop_enum_list e_qsync_mode[] = { {SDE_RM_QSYNC_ONE_SHOT_MODE, "one_shot"}, }; +#ifdef OPLUS_BUG_STABILITY +/*Sachin@PSW.MM.Display.LCD.Feature,2019-11-04 add for global hbm */ +extern int oppo_debug_max_brightness; +#endif /* OPLUS_BUG_STABILITY */ + static int sde_backlight_device_update_status(struct backlight_device *bd) { int brightness; @@ -85,9 +103,49 @@ static int sde_backlight_device_update_status(struct backlight_device *bd) if (brightness > display->panel->bl_config.bl_max_level) brightness = display->panel->bl_config.bl_max_level; +#ifndef OPLUS_BUG_STABILITY +/*Sachin Shukla@PSW.MM.Display.LCD.Feature,2019-11-04 add for global hbm */ /* map UI brightness into driver backlight level with rounding */ bl_lvl = mult_frac(brightness, display->panel->bl_config.bl_max_level, display->panel->bl_config.brightness_max_level); +#else /* OPLUS_BUG_STABILITY */ + if (oppo_debug_max_brightness) { + bl_lvl = mult_frac(brightness, oppo_debug_max_brightness, + display->panel->bl_config.brightness_max_level); + } else if (brightness == 0) { + bl_lvl = 0; + } else { + if (display->panel->oppo_priv.bl_remap && display->panel->oppo_priv.bl_remap_count) { + int i = 0; + int count = display->panel->oppo_priv.bl_remap_count; + struct oppo_brightness_alpha *lut = display->panel->oppo_priv.bl_remap; + + for (i = 0; i < display->panel->oppo_priv.bl_remap_count; i++){ + if (display->panel->oppo_priv.bl_remap[i].brightness >= brightness) + break; + } + + if (i == 0) + bl_lvl = lut[0].alpha; + else if (i == count) + bl_lvl = lut[count - 1].alpha; + else + bl_lvl = interpolate(brightness, lut[i-1].brightness, + lut[i].brightness, lut[i-1].alpha, + lut[i].alpha); + } else if (brightness > display->panel->bl_config.brightness_normal_max_level) { + bl_lvl = interpolate(brightness, + display->panel->bl_config.brightness_normal_max_level, + display->panel->bl_config.brightness_max_level, + display->panel->bl_config.bl_normal_max_level, + display->panel->bl_config.bl_max_level); + } else { + bl_lvl = mult_frac(brightness, display->panel->bl_config.bl_normal_max_level, + display->panel->bl_config.brightness_normal_max_level); + } + } + SDE_DEBUG("brightness = %d, bl_lvl = %d\n", brightness, bl_lvl); +#endif /* OPLUS_BUG_STABILITY */ if (!bl_lvl && brightness) bl_lvl = 1; @@ -143,7 +201,12 @@ static int sde_backlight_setup(struct sde_connector *c_conn, display = (struct dsi_display *) c_conn->display; bl_config = &display->panel->bl_config; props.max_brightness = bl_config->brightness_max_level; +#ifndef OPLUS_BUG_STABILITY +/*Sachin@PSW.MM.Display.LCD.Feature,2019-11-04 modify for default brightness*/ + props.brightness = bl_config->brightness_max_level; +#else /* OPLUS_BUG_STABILITY */ props.brightness = bl_config->brightness_default_level; +#endif /* OPLUS_BUG_STABILITY */ snprintf(bl_node_name, BL_NODE_NAME_SIZE, "panel%u-backlight", display_count); c_conn->bl_device = backlight_device_register(bl_node_name, dev->dev, @@ -236,13 +299,71 @@ void sde_connector_unregister_event(struct drm_connector *connector, (void)sde_connector_register_event(connector, event_idx, 0, 0); } +#ifdef OPLUS_BUG_STABILITY +/* Sachin@PSW.MM.Display.LCD.Feature,2020-06-08 + * Force enable dither on OnScreenFingerprint scene,add QCOM patch, + * fix BUG:49203 +*/ +static int _sde_connector_get_default_dither_cfg_v1( + struct sde_connector *c_conn, void *cfg) +{ + struct drm_msm_dither *dither_cfg = (struct drm_msm_dither *)cfg; + enum dsi_pixel_format dst_format = DSI_PIXEL_FORMAT_MAX; + + if (!c_conn || !cfg) { + SDE_ERROR("invalid argument(s), c_conn %pK, cfg %pK\n", + c_conn, cfg); + return -EINVAL; + } + + if (!c_conn->ops.get_dst_format) { + SDE_DEBUG("get_dst_format is unavailable\n"); + return 0; + } + + dst_format = c_conn->ops.get_dst_format(&c_conn->base, c_conn->display); + switch (dst_format) { + case DSI_PIXEL_FORMAT_RGB888: + dither_cfg->c0_bitdepth = 8; + dither_cfg->c1_bitdepth = 8; + dither_cfg->c2_bitdepth = 8; + dither_cfg->c3_bitdepth = 8; + break; + case DSI_PIXEL_FORMAT_RGB666: + case DSI_PIXEL_FORMAT_RGB666_LOOSE: + dither_cfg->c0_bitdepth = 6; + dither_cfg->c1_bitdepth = 6; + dither_cfg->c2_bitdepth = 6; + dither_cfg->c3_bitdepth = 6; + break; + default: + SDE_DEBUG("no default dither config for dst_format %d\n", + dst_format); + return -ENODATA; + } + + memcpy(&dither_cfg->matrix, dither_matrix, + sizeof(u32) * DITHER_MATRIX_SZ); + dither_cfg->temporal_en = 0; + return 0; +} +#endif /* OPLUS_BUG_STABILITY */ + static void _sde_connector_install_dither_property(struct drm_device *dev, struct sde_kms *sde_kms, struct sde_connector *c_conn) { char prop_name[DRM_PROP_NAME_LEN]; struct sde_mdss_cfg *catalog = NULL; - u32 version = 0; - +#ifdef OPLUS_BUG_STABILITY +/* Sachin@PSW.MM.Display.LCD.Feature,2020-06-08 + * Force enable dither on OnScreenFingerprint scene,add QCOM patch,fix BUG:49203 +*/ + struct drm_property_blob *blob_ptr; + void *cfg; + int ret = 0; + u32 version = 0, len = 0; + bool defalut_dither_needed = false; +#endif /* OPLUS_BUG_STABILITY */ if (!dev || !sde_kms || !c_conn) { SDE_ERROR("invld args (s), dev %pK, sde_kms %pK, c_conn %pK\n", dev, sde_kms, c_conn); @@ -259,55 +380,76 @@ static void _sde_connector_install_dither_property(struct drm_device *dev, msm_property_install_blob(&c_conn->property_info, prop_name, DRM_MODE_PROP_BLOB, CONNECTOR_PROP_PP_DITHER); +#ifdef OPLUS_BUG_STABILITY +/* LiPing-M@PSW.MM.Display.LCD.Feature,2020-06-08 + * Force enable dither on OnScreenFingerprint scene,add QCOM patch, + * fix BUG:49203 +*/ + len = sizeof(struct drm_msm_dither); + cfg = kzalloc(len, GFP_KERNEL); + if (!cfg) + return; + + ret = _sde_connector_get_default_dither_cfg_v1(c_conn, cfg); + if (!ret) + defalut_dither_needed = true; +#endif /* OPLUS_BUG_STABILITY */ break; default: SDE_ERROR("unsupported dither version %d\n", version); return; } + +#ifdef OPLUS_BUG_STABILITY +/* Sachin@PSW.MM.Display.LCD.Feature,2020-06-08 + * Force enable dither on OnScreenFingerprint scene,add QCOM patch, + * fix BUG:49203 +*/ + if (defalut_dither_needed) { + blob_ptr = drm_property_create_blob(dev, len, cfg); + if (IS_ERR_OR_NULL(blob_ptr)) + goto exit; + c_conn->blob_dither = blob_ptr; + } +exit: + kfree(cfg); +#endif /* OPLUS_BUG_STABILITY */ + } +#ifdef OPLUS_BUG_STABILITY +/* LiPing-M@PSW.MM.Display.LCD.Feature,2020-06-08 + * Force enable dither on OnScreenFingerprint scene,add QCOM patch,fix BUG:49203 +*/ int sde_connector_get_dither_cfg(struct drm_connector *conn, struct drm_connector_state *state, void **cfg, - size_t *len, bool idle_pc) + size_t *len) { struct sde_connector *c_conn = NULL; struct sde_connector_state *c_state = NULL; size_t dither_sz = 0; - bool is_dirty; u32 *p = (u32 *)cfg; - if (!conn || !state || !p) { - SDE_ERROR("invalid arguments\n"); + if (!conn || !state || !p) return -EINVAL; - } c_conn = to_sde_connector(conn); c_state = to_sde_connector_state(state); - is_dirty = msm_property_is_dirty(&c_conn->property_info, - &c_state->property_state, - CONNECTOR_PROP_PP_DITHER); - - if (!is_dirty && !idle_pc) { - return -ENODATA; - } else if (is_dirty || idle_pc) { - *cfg = msm_property_get_blob(&c_conn->property_info, - &c_state->property_state, - &dither_sz, - CONNECTOR_PROP_PP_DITHER); - /* - * In idle_pc use case return early, when dither is - * already disabled. - */ - if (idle_pc && *cfg == NULL) - return -ENODATA; - /* disable dither based on user config data */ - else if (*cfg == NULL) - return 0; + /* try to get user config data first */ + *cfg = msm_property_get_blob(&c_conn->property_info, + &c_state->property_state, + &dither_sz, + CONNECTOR_PROP_PP_DITHER); + /* if user config data doesn't exist, use default dither blob */ + if (*cfg == NULL && c_conn->blob_dither) { + *cfg = c_conn->blob_dither->data; + dither_sz = c_conn->blob_dither->length; } *len = dither_sz; return 0; } +#endif /* OPLUS_BUG_STABILITY */ int sde_connector_get_mode_info(struct drm_connector_state *conn_state, struct msm_mode_info *mode_info) @@ -463,6 +605,10 @@ static int _sde_connector_update_bl_scale(struct sde_connector *c_conn) struct dsi_display *dsi_display; struct dsi_backlight_config *bl_config; int rc = 0; +#ifdef OPLUS_BUG_STABILITY +/*Sachin@PSW.MM.Display.LCD.Stable,2019-03-7 fix backlight race problem */ + struct backlight_device *bd; +#endif /* OPLUS_BUG_STABILITY */ if (!c_conn) { SDE_ERROR("Invalid params sde_connector null\n"); @@ -477,10 +623,25 @@ static int _sde_connector_update_bl_scale(struct sde_connector *c_conn) return -EINVAL; } +#ifdef OPLUS_BUG_STABILITY +/*Sachin@PSW.MM.Display.LCD.Stable,2019-03-7 fix backlight race problem */ + bd = c_conn->bl_device; + if (!bd) { + SDE_ERROR("Invalid params backlight_device null\n"); + return -EINVAL; + } + + mutex_lock(&bd->update_lock); +#endif /* OPLUS_BUG_STABILITY */ + bl_config = &dsi_display->panel->bl_config; if (!c_conn->allow_bl_update) { c_conn->unset_bl_level = bl_config->bl_level; +#ifdef OPLUS_BUG_STABILITY +/*Sachin@PSW.MM.Display.LCD.Stable,2019-03-7 fix backlight race problem */ + mutex_unlock(&bd->update_lock); +#endif /* OPLUS_BUG_STABILITY */ return 0; } @@ -503,10 +664,24 @@ static int _sde_connector_update_bl_scale(struct sde_connector *c_conn) rc = c_conn->ops.set_backlight(&c_conn->base, dsi_display, bl_config->bl_level); c_conn->unset_bl_level = 0; +#ifdef OPLUS_BUG_STABILITY +/*Sachin@PSW.MM.Display.LCD.Stable,2019-03-7 fix backlight race problem */ + mutex_unlock(&bd->update_lock); +#endif /* OPLUS_BUG_STABILITY */ return rc; } +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@MM.Display.LCD.Stability, 2020/3/31, for + *decoupling display driver +*/ +int _sde_connector_update_bl_scale_(struct sde_connector *c_conn) +{ + return _sde_connector_update_bl_scale(c_conn); +} +#endif /* OPLUS_BUG_STABILITY */ + void sde_connector_set_qsync_params(struct drm_connector *connector) { struct sde_connector *c_conn; @@ -2330,6 +2505,14 @@ struct drm_connector *sde_connector_init(struct drm_device *dev, 0, 0, e_qsync_mode, ARRAY_SIZE(e_qsync_mode), CONNECTOR_PROP_QSYNC_MODE); +#ifdef OPLUS_BUG_STABILITY + /* Gou shengjun@PSW.MM.Display.LCD.Feature,2018-11-21 + * Support custom propertys + */ + msm_property_install_range(&c_conn->property_info,"CONNECTOR_CUST", + 0x0, 0, INT_MAX, 0, CONNECTOR_PROP_CUSTOM); +#endif /* OPLUS_BUG_STABILITY */ + msm_property_install_range(&c_conn->property_info, "bl_scale", 0x0, 0, MAX_BL_SCALE_LEVEL, MAX_BL_SCALE_LEVEL, CONNECTOR_PROP_BL_SCALE); diff --git a/drivers/gpu/drm/msm/sde/sde_connector.h b/drivers/gpu/drm/msm/sde/sde_connector.h index ea8cf3f21718..7a719308947f 100644 --- a/drivers/gpu/drm/msm/sde/sde_connector.h +++ b/drivers/gpu/drm/msm/sde/sde_connector.h @@ -802,18 +802,21 @@ static inline bool sde_connector_needs_offset(struct drm_connector *connector) return (c_conn->connector_type != DRM_MODE_CONNECTOR_VIRTUAL); } +#ifdef OPLUS_BUG_STABILITY +/* Sachin@PSW.MM.Display.LCD.Feature,2020-06-08 + * Force enable dither on OnScreenFingerprint scene,add QCOM patch,fix BUG:49203 +*/ /** * sde_connector_get_dither_cfg - get dither property data * @conn: Pointer to drm_connector struct * @state: Pointer to drm_connector_state struct * @cfg: Pointer to pointer to dither cfg * @len: length of the dither data - * @idle_pc: flag to indicate idle_pc_restore happened * Returns: Zero on success */ int sde_connector_get_dither_cfg(struct drm_connector *conn, - struct drm_connector_state *state, void **cfg, - size_t *len, bool idle_pc); + struct drm_connector_state *state, void **cfg, size_t *len); +#endif /* OPLUS_BUG_STABILITY */ /** * sde_connector_set_blob_data - set connector blob property data @@ -908,4 +911,11 @@ int sde_connector_get_panel_vfp(struct drm_connector *connector, */ int sde_connector_esd_status(struct drm_connector *connector); +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@MM.Display.LCD.Stability, 2020/3/31, for + *decoupling display driver +*/ +int _sde_connector_update_bl_scale_(struct sde_connector *c_conn); +#endif /* OPLUS_BUG_STABILITY */ + #endif /* _SDE_CONNECTOR_H_ */ diff --git a/drivers/gpu/drm/msm/sde/sde_crtc.c b/drivers/gpu/drm/msm/sde/sde_crtc.c index 9972b84dc8eb..c893a5b1a022 100644 --- a/drivers/gpu/drm/msm/sde/sde_crtc.c +++ b/drivers/gpu/drm/msm/sde/sde_crtc.c @@ -42,6 +42,23 @@ #include "sde_power_handle.h" #include "sde_core_perf.h" #include "sde_trace.h" +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.Lcd.Stability, 2018-11-21 + * Add for drm notifier for display connect +*/ +#include +#include +#include "oppo_display_private_api.h" +#include "oppo_onscreenfingerprint.h" + +extern int oppo_dimlayer_fingerprint_failcount; +extern int oppo_underbrightness_alpha; +extern int msm_drm_notifier_call_chain(unsigned long val, void *v); +#ifdef OPLUS_FEATURE_AOD_RAMLESS +// Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, sepolicy for aod ramless +extern int oppo_display_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state); +#endif /* OPLUS_FEATURE_AOD_RAMLESS */ +#endif /* OPLUS_BUG_STABILITY */ #define SDE_PSTATES_MAX (SDE_STAGE_MAX * 4) #define SDE_MULTIRECT_PLANE_MAX (SDE_STAGE_MAX * 2) @@ -113,6 +130,16 @@ static inline struct sde_kms *_sde_crtc_get_kms(struct drm_crtc *crtc) return to_sde_kms(priv->kms); } +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@MM.Display.LCD.Stability, 2020/3/31, for + * decoupling display driver +*/ +struct sde_kms *_sde_crtc_get_kms_(struct drm_crtc *crtc) +{ + return _sde_crtc_get_kms(crtc); +} +#endif /* OPLUS_BUG_STABILITY */ + static inline int _sde_crtc_power_enable(struct sde_crtc *sde_crtc, bool enable) { struct drm_crtc *crtc; @@ -973,6 +1000,11 @@ static void _sde_crtc_setup_blend_cfg(struct sde_crtc_mixer *mixer, /* default to opaque blending */ fg_alpha = sde_plane_get_property(pstate, PLANE_PROP_ALPHA); + #ifdef OPLUS_BUG_STABILITY + /*Sachin@PSW.MM.Display.LCD.Stable,2019-01-12 support plane skip */ + if (pstate->is_skip) + fg_alpha = 0; + #endif /* OPLUS_BUG_STABILITY */ bg_alpha = 0xFF - fg_alpha; blend_op = SDE_BLEND_FG_ALPHA_FG_CONST | SDE_BLEND_BG_ALPHA_BG_CONST; blend_type = sde_plane_get_property(pstate, PLANE_PROP_BLEND_OP); @@ -2138,6 +2170,38 @@ static void _sde_crtc_blend_setup_mixer(struct drm_crtc *crtc, for (i = 0; i < cstate->num_dim_layers; i++) _sde_crtc_setup_dim_layer_cfg(crtc, sde_crtc, mixer, &cstate->dim_layer[i]); + +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.Service.Feature,2018/11/21 + * For OnScreenFingerprint feature +*/ + if (cstate->fingerprint_dim_layer) { + bool is_dim_valid = true; + uint32_t zpos_max = 0; + + drm_atomic_crtc_for_each_plane(plane, crtc) { + state = plane->state; + if (!state) + continue; + pstate = to_sde_plane_state(state); + + if (zpos_max < pstate->stage) + zpos_max = pstate->stage; + SDE_EVT32(pstate->stage, cstate->fingerprint_dim_layer->stage, zpos_max); + if (pstate->stage == cstate->fingerprint_dim_layer->stage) { + is_dim_valid = false; + oppo_dimlayer_fingerprint_failcount++; + SDE_ERROR("Skip fingerprint_dim_layer as it shared plane stage %d %d\n", + pstate->stage, cstate->fingerprint_dim_layer->stage); + SDE_EVT32(pstate->stage, cstate->fingerprint_dim_layer->stage, zpos_max, oppo_dimlayer_fingerprint_failcount); + } + } + if (is_dim_valid) { + _sde_crtc_setup_dim_layer_cfg(crtc, sde_crtc, + mixer, cstate->fingerprint_dim_layer); + } + } +#endif /* OPLUS_BUG_STABILITY */ } _sde_crtc_program_lm_output_roi(crtc); @@ -3051,7 +3115,11 @@ static void sde_crtc_frame_event_work(struct kthread_work *work) spin_unlock_irqrestore(&sde_crtc->spin_lock, flags); SDE_ATRACE_END("crtc_frame_event"); } - +#ifdef OPLUS_BUG_STABILITY +/*Mark.Yao@PSW.MM.Display.LCD.Feature,2019-07-25 support onscreenfinger */ +extern u32 oppo_onscreenfp_vblank_count; +extern ktime_t oppo_onscreenfp_pressed_time; +#endif /* OPLUS_BUG_STABILITY */ void sde_crtc_complete_commit(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { @@ -3066,6 +3134,69 @@ void sde_crtc_complete_commit(struct drm_crtc *crtc, SDE_EVT32_VERBOSE(DRMID(crtc)); sde_core_perf_crtc_update(crtc, 0, false); +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.LCD.Feature,2018-11-21 + * Add for OnScreenFingerprint +*/ + { + struct sde_crtc_state *old_cstate; + struct sde_crtc_state *cstate; + struct msm_drm_notifier notifier_data; + int blank; + + if (!old_state) { + SDE_ERROR("failed to find old cstate"); + return; + } + old_cstate = to_sde_crtc_state(old_state); + cstate = to_sde_crtc_state(crtc->state); + + if (old_cstate->fingerprint_pressed != cstate->fingerprint_pressed) { + blank = cstate->fingerprint_pressed; + notifier_data.data = ␣ + + if (cstate->fingerprint_defer_sync) { + u32 target_vblank = oppo_onscreenfp_vblank_count + 2; + struct timeval vblanktime; + ktime_t exp_ktime; + u32 current_vblank; + int ret; + + current_vblank = drm_crtc_vblank_count_and_time(crtc, &vblanktime); + + /* + * possible hbm setting insert hardware te irq and soft vblank update + * cause vblank calc error, add 4ms check to avoid this scene + */ + if (current_vblank == (oppo_onscreenfp_vblank_count + 1)) { + exp_ktime = ktime_add_ms(oppo_onscreenfp_pressed_time, 4); + if (ktime_compare_safe(exp_ktime, timeval_to_ktime(vblanktime)) > 0) { + target_vblank++; + pr_err("hbm setting may hit into hardware irq and soft update, wait one more vblank\n"); + } + } + + ret = wait_event_timeout(*drm_crtc_vblank_waitqueue(crtc), + target_vblank <= drm_crtc_vblank_count(crtc), + msecs_to_jiffies(50)); + if (!ret) + pr_err("[fingerprint CRTC:%d:%s] vblank wait timed out\n", + crtc->base.id, crtc->name); + + if (current_vblank == drm_crtc_vblank_count(crtc)) { + ret = wait_event_timeout(*drm_crtc_vblank_waitqueue(crtc), + current_vblank != drm_crtc_vblank_count(crtc), + msecs_to_jiffies(17)); + } + } + pr_err("fingerprint status: %s", + blank ? "pressed" : "up"); + usleep_range(17000, 18000); + msm_drm_notifier_call_chain(MSM_DRM_ONSCREENFINGERPRINT_EVENT, + ¬ifier_data); + } + } +#endif /* OPLUS_BUG_STABILITY */ } /** @@ -5251,6 +5382,181 @@ static int _sde_crtc_check_secure_state(struct drm_crtc *crtc, return 0; } + +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.LCD.Feature,2018-11-21 + * Add for OnScreenFingerprint +*/ +extern int oppo_onscreenfp_status; +extern int lcd_closebl_flag_fp; +extern int oppo_dimlayer_hbm; +extern int oppo_dimlayer_bl_alpha_value; +extern int oppo_dimlayer_bl_enable; +extern bool oppo_ffl_trigger_finish; +extern int oppo_dimlayer_bl; +extern ktime_t oppo_backlight_time; +extern u32 oppo_backlight_delta; +#ifdef OPLUS_FEATURE_AOD_RAMLESS +// Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, sepolicy for aod ramless +extern bool is_oppo_aod_ramless(void); +#endif /* OPLUS_FEATURE_AOD_RAMLESS */ + +static int sde_crtc_onscreenfinger_atomic_check(struct sde_crtc_state *cstate, + struct plane_state *pstates, int cnt) +{ + int fp_index = -1; + int fppressed_index = -1; + int aod_index = -1; + int zpos = INT_MAX; + int mode; + int fp_mode = oppo_onscreenfp_status; + int dimlayer_hbm = oppo_dimlayer_hbm; + int dimlayer_bl = 0; + bool dimlayer_is_top = false; + int i; + + for (i = 0; i < cnt; i++) { + mode = sde_plane_check_fingerprint_layer(pstates[i].drm_pstate); + if (mode == 1) + fp_index = i; + if (mode == 2) + fppressed_index = i; + if (mode == 3) + aod_index = i; + if (pstates[i].sde_pstate) + pstates[i].sde_pstate->is_skip = false; + } + + if (!is_dsi_panel(cstate->base.crtc)) + return 0; + + if (oppo_dimlayer_bl_enable) { + int backlight = oppo_get_panel_brightness(); + + if (backlight > 1 && backlight < oppo_dimlayer_bl_alpha_value && + oppo_ffl_trigger_finish == true && !dimlayer_hbm) { + ktime_t now = ktime_get(); + ktime_t delta = ktime_sub(now, oppo_backlight_time); + + if (oppo_backlight_delta > 9) { + if (oppo_dimlayer_bl == 0 && ktime_to_ns(delta) > 25000000) + oppo_dimlayer_bl = 1; + } else { + oppo_dimlayer_bl = 1; + } + if (oppo_dimlayer_bl) + dimlayer_bl = 1; + } else { + oppo_dimlayer_bl = 0; + } + } else { + oppo_dimlayer_bl = 0; + } + + if (fppressed_index >= 0) { + if (fp_mode == 0) { + pstates[fppressed_index].sde_pstate->is_skip = true; + fppressed_index = -1; + } + } + + SDE_EVT32(cstate->fingerprint_dim_layer); + cstate->fingerprint_mode = false; + cstate->fingerprint_pressed = false; + + if (dimlayer_hbm || dimlayer_bl) { + if (fp_index >= 0 && fppressed_index >= 0) { + if (pstates[fp_index].stage >= pstates[fppressed_index].stage) { + SDE_ERROR("Bug!!: fp layer top of fppressed layer\n"); + return -EINVAL; + } + } + + if (lcd_closebl_flag_fp) { + oppo_underbrightness_alpha = 0; + cstate->fingerprint_dim_layer = NULL; + cstate->fingerprint_mode = false; + return 0; + } + + if (dimlayer_hbm) + cstate->fingerprint_mode = true; + else + cstate->fingerprint_mode = false; + + SDE_DEBUG("debug for get cstate->fingerprint_mode = %d\n", cstate->fingerprint_mode); + + if (aod_index >= 0) { + if (zpos > pstates[aod_index].stage) + zpos = pstates[aod_index].stage; + pstates[aod_index].stage++; + } + if (fppressed_index >= 0) { + if (zpos > pstates[fppressed_index].stage) + zpos = pstates[fppressed_index].stage; + pstates[fppressed_index].stage++; + } + if (fp_index >= 0) { + if (zpos > pstates[fp_index].stage) + zpos = pstates[fp_index].stage; + pstates[fp_index].stage++; + } + + for (i = 0; i < cnt; i++) { + if (i == fp_index || i == fppressed_index || + i == aod_index) + continue; + if (pstates[i].stage >= zpos) { + pstates[i].stage++; + } + } + + if (zpos == INT_MAX) { + zpos = 0; + dimlayer_is_top = true; + for (i = 0; i < cnt; i++) { + if (pstates[i].stage > zpos) + zpos = pstates[i].stage; + } + zpos++; + } + + SDE_EVT32(zpos, fp_index, aod_index, fppressed_index, cstate->num_dim_layers); + if (sde_crtc_config_fingerprint_dim_layer(&cstate->base, zpos)) { + //SDE_ERROR("Failed to config dim layer\n"); + if (dimlayer_is_top && !cstate->fingerprint_dim_layer) { + oppo_underbrightness_alpha = 0; + cstate->fingerprint_dim_layer = NULL; + cstate->fingerprint_mode = false; + cstate->fingerprint_pressed = false; + return 0; + } + SDE_EVT32(zpos, fp_index, aod_index, fppressed_index, cstate->num_dim_layers); + return -EINVAL; + } +#ifdef OPLUS_FEATURE_AOD_RAMLESS +// Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, sepolicy for aod ramless + if (fppressed_index >= 0 && !(is_oppo_aod_ramless() && cstate->base.mode.flags & DRM_MODE_FLAG_CMD_MODE_PANEL)) +#else + if (fppressed_index >= 0) +#endif /* OPLUS_FEATURE_AOD_RAMLESS */ + cstate->fingerprint_pressed = true; + else + cstate->fingerprint_pressed = false; + + SDE_DEBUG("debug for get cstate->fingerprint_pressed = %d\n", cstate->fingerprint_pressed); + } else { + oppo_underbrightness_alpha = 0; + cstate->fingerprint_dim_layer = NULL; + cstate->fingerprint_mode = false; + cstate->fingerprint_pressed = false; + } + SDE_EVT32(cstate->fingerprint_dim_layer); + + return 0; +} +#endif /* OPLUS_BUG_STABILITY */ + static int sde_crtc_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state) { @@ -5446,6 +5752,21 @@ static int sde_crtc_atomic_check(struct drm_crtc *crtc, } } +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.Service.Feature,2018/11/21 + * For OnScreenFingerprint feature +*/ +#ifdef OPLUS_FEATURE_AOD_RAMLESS +// Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/09/25, sepolicy for aod ramless + rc = oppo_display_atomic_check(crtc, state); + if (rc) + return rc; +#endif /* OPLUS_FEATURE_AOD_RAMLESS */ + + rc = sde_crtc_onscreenfinger_atomic_check(cstate, pstates, cnt); + if (rc) + goto end; +#endif /* OPLUS_BUG_STABILITY */ /* assign mixer stages based on sorted zpos property */ if (cnt > 0) sort(pstates, cnt, sizeof(pstates[0]), pstate_cmp, NULL); @@ -5732,6 +6053,14 @@ static void sde_crtc_install_properties(struct drm_crtc *crtc, ARRAY_SIZE(e_cwb_data_points), CRTC_PROP_CAPTURE_OUTPUT); +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.LCD.Feature,2018-11-21 + * Support custom propertys +*/ + msm_property_install_range(&sde_crtc->property_info,"CRTC_CUST", + 0x0, 0, INT_MAX, 0, CRTC_PROP_CUSTOM); +#endif + msm_property_install_blob(&sde_crtc->property_info, "capabilities", DRM_MODE_PROP_IMMUTABLE, CRTC_PROP_INFO); @@ -5748,8 +6077,14 @@ static void sde_crtc_install_properties(struct drm_crtc *crtc, if (catalog->has_dim_layer) { msm_property_install_volatile_range(&sde_crtc->property_info, "dim_layer_v1", 0x0, 0, ~0, 0, CRTC_PROP_DIM_LAYER_V1); +#ifdef OPLUS_BUG_STABILITY +/*Sachin Shukla@PSW.MM.Display.LCD.Stable,2019-04-17 fix dc backlight aging test fail */ + sde_kms_info_add_keyint(info, "dim_layer_v1_max_layers", + SDE_MAX_DIM_LAYERS - 1); +#else sde_kms_info_add_keyint(info, "dim_layer_v1_max_layers", SDE_MAX_DIM_LAYERS); +#endif /* OPLUS_BUG_STABILITY */ } sde_kms_info_add_keyint(info, "hw_version", catalog->hwversion); @@ -6928,7 +7263,7 @@ struct drm_crtc *sde_crtc_init(struct drm_device *dev, struct drm_plane *plane) kthread_init_delayed_work(&sde_crtc->idle_notify_work, __sde_crtc_idle_notify_work); - SDE_DEBUG("%s: successfully initialized crtc\n", sde_crtc->name); + SDE_ERROR("%s: successfully initialized crtc\n", sde_crtc->name); return crtc; } diff --git a/drivers/gpu/drm/msm/sde/sde_crtc.h b/drivers/gpu/drm/msm/sde/sde_crtc.h index d3dc1c8528a5..4588dc585cbb 100644 --- a/drivers/gpu/drm/msm/sde/sde_crtc.h +++ b/drivers/gpu/drm/msm/sde/sde_crtc.h @@ -437,6 +437,15 @@ struct sde_crtc_state { u32 padding_dummy; struct sde_crtc_respool rp; +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.Service.Feature,2018/11/21 + * For OnScreenFingerprint feature +*/ + bool fingerprint_mode; + bool fingerprint_pressed; + bool fingerprint_defer_sync; + struct sde_hw_dim_layer *fingerprint_dim_layer; +#endif /* OPLUS_BUG_STABILITY */ }; enum sde_crtc_irq_state { @@ -850,6 +859,13 @@ int sde_crtc_calc_vpadding_param(struct drm_crtc_state *state, uint32_t crtc_y, uint32_t crtc_h, uint32_t *padding_y, uint32_t *padding_start, uint32_t *padding_height); +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@MM.Display.LCD.Stability, 2020/3/31, for + * decoupling display driver +*/ +struct sde_kms *_sde_crtc_get_kms_(struct drm_crtc *crtc); +#endif /* OPLUS_BUG_STABILITY */ + /** * sde_crtc_get_num_datapath - get the number of datapath active * of primary connector diff --git a/drivers/gpu/drm/msm/sde/sde_encoder.c b/drivers/gpu/drm/msm/sde/sde_encoder.c index f455f24da622..3632185076fa 100644 --- a/drivers/gpu/drm/msm/sde/sde_encoder.c +++ b/drivers/gpu/drm/msm/sde/sde_encoder.c @@ -39,6 +39,14 @@ #include "sde_core_irq.h" #include "sde_hw_top.h" #include "sde_hw_qdss.h" +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@MM.Display.LCD.Stability, 2020/3/31, for + * decoupling display driver +*/ +#include "oppo_display_private_api.h" +#include "oppo_onscreenfingerprint.h" +#include "oppo_dc_diming.h" +#endif /* OPLUS_BUG_STABILITY */ #define SDE_DEBUG_ENC(e, fmt, ...) SDE_DEBUG("enc%d " fmt,\ (e) ? (e)->base.base.id : -1, ##__VA_ARGS__) @@ -280,6 +288,11 @@ struct sde_encoder_virt { struct kthread_work input_event_work; struct kthread_work esd_trigger_work; struct input_handler *input_handler; +#ifdef OPLUS_BUG_STABILITY + /*Mark.Yao@PSW.MM.Display.LCD.Stable,2019-12-09 fix + input_handler register/unregister */ + bool input_handler_init; +#endif /* OPLUS_BUG_STABILITY */ bool input_handler_registered; struct msm_display_topology topology; bool vblank_enabled; @@ -1924,11 +1937,13 @@ static int _sde_encoder_update_rsc_client( int wait_count = 0; struct drm_crtc *primary_crtc; int pipe = -1; - int rc = 0; + int rc = 0, lp_mode = -1; int wait_refcount = 0; u32 qsync_mode = 0; struct msm_drm_private *priv; struct sde_kms *sde_kms; + struct list_head *connector_list; + struct drm_connector *conn = NULL, *conn_iter; if (!drm_enc || !drm_enc->dev) { SDE_ERROR("invalid encoder arguments\n"); @@ -1963,6 +1978,8 @@ static int _sde_encoder_update_rsc_client( } sde_kms = to_sde_kms(priv->kms); + connector_list = &sde_kms->dev->mode_config.connector_list; + /** * only primary command mode panel without Qsync can request CMD state. * all other panels/displays can request for VID state including @@ -2003,7 +2020,17 @@ static int _sde_encoder_update_rsc_client( (rsc_state == SDE_RSC_VID_STATE)) rsc_state = SDE_RSC_CLK_STATE; - SDE_EVT32(rsc_state, qsync_mode); + list_for_each_entry(conn_iter, connector_list, head) + if (conn_iter->encoder == drm_enc) + conn = conn_iter; + + if (conn && conn->state) { + lp_mode = sde_connector_get_property(conn->state, CONNECTOR_PROP_LP); + if ((lp_mode == SDE_MODE_DPMS_LP1 || lp_mode == SDE_MODE_DPMS_LP2) && enable) + rsc_state = SDE_RSC_CLK_STATE; + } + + SDE_EVT32(rsc_state, qsync_mode, lp_mode); prefill_lines = config ? mode_info.prefill_lines + config->inline_rotate_prefill : mode_info.prefill_lines; @@ -2091,6 +2118,11 @@ static int _sde_encoder_update_rsc_client( if (crtc->base.id == wait_vblank_crtc_id) { ret = sde_encoder_wait_for_event(drm_enc, MSM_ENC_VBLANK); + if (ret == -EWOULDBLOCK) { + SDE_EVT32(DRMID(drm_enc), wait_vblank_crtc_id, crtc->base.id); + msleep(PRIMARY_VBLANK_WORST_CASE_MS); + ret = 0; + } } else if (primary_crtc->state->active && !drm_atomic_crtc_needs_modeset( primary_crtc->state)) { @@ -3124,6 +3156,11 @@ static int _sde_encoder_input_handler( sde_enc->input_handler = input_handler; sde_enc->input_handler_registered = false; +#ifdef OPLUS_BUG_STABILITY + /*Mark.Yao@PSW.MM.Display.LCD.Stable,2019-12-09 fix + input_handler register/unregister */ + sde_enc->input_handler_init = false; +#endif /* OPLUS_BUG_STABILITY */ return rc; } @@ -3297,7 +3334,15 @@ static void sde_encoder_virt_enable(struct drm_encoder *drm_enc) SDE_ERROR( "input handler registration failed, rc = %d\n", ret); else +#ifdef OPLUS_BUG_STABILITY +/*Sachin@PSW.MM.Display.LCD.Stable,2019-12-09 fix +input_handler register/unregister */ + { sde_enc->input_handler_registered = true; + sde_enc->input_handler_init = true; + } +#endif /* OPLUS_BUG_STABILITY */ + } if (!(msm_is_mode_seamless_vrr(cur_mode) @@ -3400,8 +3445,18 @@ static void sde_encoder_virt_disable(struct drm_encoder *drm_enc) sde_encoder_wait_for_event(drm_enc, MSM_ENC_TX_COMPLETE); if (sde_enc->input_handler && sde_enc->input_handler_registered) { - input_unregister_handler(sde_enc->input_handler); - sde_enc->input_handler_registered = false; + #ifdef OPLUS_BUG_STABILITY + /*Sachin@PSW.MM.Display.LCD.Stable,2019-12-09 fix + input_handler register/unregister */ + if (sde_enc->input_handler_init) { + input_unregister_handler(sde_enc->input_handler); + sde_enc->input_handler_init = false; + } + sde_enc->input_handler_registered = false; + #else + input_unregister_handler(sde_enc->input_handler); + sde_enc->input_handler_registered = false; + #endif /* OPLUS_BUG_STABILITY */ } /* @@ -3931,6 +3986,13 @@ void sde_encoder_helper_trigger_start(struct sde_encoder_phys *phys_enc) } } +void qcdbg_trigger_full_dump(void) +{ + SDE_EVT32(0xbd, 0x1, 0xbd); + SDE_DBG_DUMP("all", "dbg_bus", "vbif_dbg_bus"); +} +EXPORT_SYMBOL(qcdbg_trigger_full_dump); + void sde_encoder_helper_hw_reset(struct sde_encoder_phys *phys_enc) { struct sde_encoder_virt *sde_enc; @@ -4250,7 +4312,13 @@ void sde_encoder_trigger_kickoff_pending(struct drm_encoder *drm_enc) static void _sde_encoder_setup_dither(struct sde_encoder_phys *phys) { - void *dither_cfg = NULL; +#ifdef OPLUS_BUG_STABILITY +/* Sachin@PSW.MM.Display.LCD.Feature,2020-06-08 + * Force enable dither on OnScreenFingerprint scene,add QCOM patch, + * fix BUG:49203 +*/ + void *dither_cfg; +#endif /* OPLUS_BUG_STABILITY */ int ret = 0, rc, i = 0; size_t len = 0; enum sde_rm_topology_name topology; @@ -4284,11 +4352,15 @@ static void _sde_encoder_setup_dither(struct sde_encoder_phys *phys) return; } +#ifdef OPLUS_BUG_STABILITY +/* Sachin@PSW.MM.Display.LCD.Feature,2020-06-08 + * Force enable dither on OnScreenFingerprint scene,add QCOM patch,fix BUG:49203 +*/ ret = sde_connector_get_dither_cfg(phys->connector, - phys->connector->state, &dither_cfg, - &len, sde_enc->idle_pc_restore); + phys->connector->state, &dither_cfg, &len); if (ret) return; +#endif /* OPLUS_BUG_STABILITY */ if (TOPOLOGY_DUALPIPE_MERGE_MODE(topology)) { for (i = 0; i < MAX_CHANNELS_PER_ENC; i++) { @@ -4299,6 +4371,12 @@ static void _sde_encoder_setup_dither(struct sde_encoder_phys *phys) } } } else { +//#ifdef OPLUS_BUG_STABILITY +/* Sachin@PSW.MM.Display.LCD.Feature,2018-11-19 + * Force enable dither on OnScreenFingerprint scene +*/ + if (_sde_encoder_setup_dither_for_onscreenfingerprint(phys, dither_cfg, len)) +//#endif /* OPLUS_BUG_STABILITY */ phys->hw_pp->ops.setup_dither(phys->hw_pp, dither_cfg, len); } } @@ -4671,6 +4749,14 @@ int sde_encoder_prepare_for_kickoff(struct drm_encoder *drm_enc, SDE_DEBUG_ENC(sde_enc, "\n"); SDE_EVT32(DRMID(drm_enc)); +#ifdef OPLUS_BUG_STABILITY +/*Sachin Shukla@PSW.MM.Display.LCD.Stable,2019-03-26 add for dc backlight */ + if (sde_enc->cur_master) { + sde_connector_update_backlight(sde_enc->cur_master->connector, false); + sde_connector_update_hbm(sde_enc->cur_master->connector); + } +#endif /* OPLUS_BUG_STABILITY */ + /* save this for later, in case of errors */ if (sde_enc->cur_master && sde_enc->cur_master->ops.get_wr_line_count) ln_cnt1 = sde_enc->cur_master->ops.get_wr_line_count( @@ -4839,6 +4925,11 @@ void sde_encoder_kickoff(struct drm_encoder *drm_enc, bool is_error) } SDE_ATRACE_END("encoder_kickoff"); +#ifdef OPLUS_BUG_STABILITY +/*Sachin@PSW.MM.Display.LCD.Stable,2020-02-23 add for data dimming */ + sde_connector_update_backlight(sde_enc->cur_master->connector, true); +#endif /* OPLUS_BUG_STABILITY */ + } int sde_encoder_helper_reset_mixers(struct sde_encoder_phys *phys_enc, diff --git a/drivers/gpu/drm/msm/sde/sde_encoder_phys_cmd.c b/drivers/gpu/drm/msm/sde/sde_encoder_phys_cmd.c index e3f55f500691..9cd72e4d39a1 100644 --- a/drivers/gpu/drm/msm/sde/sde_encoder_phys_cmd.c +++ b/drivers/gpu/drm/msm/sde/sde_encoder_phys_cmd.c @@ -34,6 +34,13 @@ #define PP_TIMEOUT_MAX_TRIALS 4 +#ifdef OPLUS_BUG_STABILITY +/*Sachin Shukl@PSW.MM.Display.Lcd.Stability, 2019-09-01, add for runing SDE_RECOVERY_HARD_RESET when pingpong timeout many times*/ +#define PP_TIMEOUT_BAD_TRIALS 10 +#include "oppo_mm_kevent_fb.h" +extern int oppo_dimlayer_fingerprint_failcount; +#endif /*OPLUS_BUG_STABILITY */ + /* * Tearcheck sync start and continue thresholds are empirically found * based on common panels In the future, may want to allow panels to override @@ -545,6 +552,12 @@ static int _sde_encoder_phys_cmd_handle_ppdone_timeout( conn = phys_enc->connector; sde_conn = to_sde_connector(conn); +#ifdef OPLUS_BUG_STABILITY +/*Mark.Yao@PSW.MM.Display.Lcd.Stability, 2018-05-24,avoid recursion handle*/ + if (cmd_enc->pp_timeout_report_cnt >= PP_TIMEOUT_BAD_TRIALS) + return -EFAULT; +#endif /* OPLUS_BUG_STABILITY */ + cmd_enc->pp_timeout_report_cnt++; pending_kickoff_cnt = atomic_read(&phys_enc->pending_kickoff_cnt); @@ -572,6 +585,11 @@ static int _sde_encoder_phys_cmd_handle_ppdone_timeout( sde_conn->panel_dead) goto exit; +//#ifdef VENDOR_EDIT +//Jiasong.Zhong@PSW.MM.Display.LCD.Stable, 2020/10/29, Add log for ramdump,bugID:509564 + SDE_DBG_DUMP("all", "dbg_bus", "vbif_dbg_bus", "panic"); +//#endif /* VENDOR_EDIT */ + /* to avoid flooding, only log first time, and "dead" time */ if (cmd_enc->pp_timeout_report_cnt == 1) { SDE_ERROR_CMDENC(cmd_enc, @@ -599,6 +617,16 @@ static int _sde_encoder_phys_cmd_handle_ppdone_timeout( sde_connector_event_notify(conn, DRM_EVENT_SDE_HW_RECOVERY, sizeof(uint8_t), event); } else if (cmd_enc->pp_timeout_report_cnt) { + #ifndef OPLUS_BUG_STABILITY + /*Sachin@PSW.MM.Display.LCD.Stable,2019-12-15 add wr_ptr_irq + irq kevent data */ + { + unsigned char payload[150] = ""; + scnprintf(payload, sizeof(payload), "NULL$$EventID@@%d$$wr_ptr_irq_timeout@@%d", + OPPO_MM_DIRVER_FB_EVENT_ID_ESD, oppo_dimlayer_fingerprint_failcount); + upload_mm_kevent_fb_data(OPPO_MM_DIRVER_FB_EVENT_MODULE_DISPLAY,payload); + } + #endif /* OPLUS_BUG_STABILITY */ SDE_DBG_DUMP("dsi_dbg_bus", "panic"); } @@ -692,7 +720,12 @@ static int _sde_encoder_phys_cmd_poll_write_pointer_started( phys_enc->hw_intf->idx - INTF_0, timeout_us, ret); + #ifndef OPLUS_BUG_STABILITY + /*Mark.Yao@PSW.MM.Display.LCD.Stable,2018-12-18 fix crash when unplug screen*/ SDE_DBG_DUMP("all", "dbg_bus", "vbif_dbg_bus", "panic"); + #else /* OPLUS_BUG_STABILITY */ + SDE_DBG_DUMP("all", "dbg_bus", "vbif_dbg_bus"); + #endif /* OPLUS_BUG_STABILITY */ } end: diff --git a/drivers/gpu/drm/msm/sde/sde_hw_catalog.h b/drivers/gpu/drm/msm/sde/sde_hw_catalog.h index 95c267021de5..fac86dd616ab 100644 --- a/drivers/gpu/drm/msm/sde/sde_hw_catalog.h +++ b/drivers/gpu/drm/msm/sde/sde_hw_catalog.h @@ -1004,6 +1004,7 @@ struct sde_reg_dma_cfg { SDE_HW_BLK_INFO; u32 version; u32 trigger_sel_off; + u32 broadcast_disabled; u32 xin_id; u32 vbif_idx; enum sde_clk_ctrl_type clk_ctrl; diff --git a/drivers/gpu/drm/msm/sde/sde_hw_dsc.c b/drivers/gpu/drm/msm/sde/sde_hw_dsc.c index dd0a7e055b35..ef5ad6fb0500 100644 --- a/drivers/gpu/drm/msm/sde/sde_hw_dsc.c +++ b/drivers/gpu/drm/msm/sde/sde_hw_dsc.c @@ -146,6 +146,14 @@ static void sde_hw_dsc_config_thresh(struct sde_hw_dsc *hw_dsc, struct sde_hw_blk_reg_map *dsc_c = &hw_dsc->hw; u32 off = 0x0; + #ifdef OPLUS_BUG_STABILITY + /*Mark.Yao@PSW.MM.Display.LCD.Stable,2019-04-18 sync NULL pointer fix from oneplus */ + if (!dsc->buf_thresh) { + SDE_ERROR("dsc->buf_thresh is NULL pointer"); + return; + } + #endif /* OPLUS_BUG_STABILITY */ + lp = dsc->buf_thresh; off = DSC_RC_BUF_THRESH; for (i = 0; i < 14; i++) { diff --git a/drivers/gpu/drm/msm/sde/sde_hw_mdss.h b/drivers/gpu/drm/msm/sde/sde_hw_mdss.h index bd3ef45df834..ab834a71aa27 100644 --- a/drivers/gpu/drm/msm/sde/sde_hw_mdss.h +++ b/drivers/gpu/drm/msm/sde/sde_hw_mdss.h @@ -545,6 +545,8 @@ struct sde_hw_cp_cfg { void *mixer_info; u32 displayv; u32 displayh; + struct sde_hw_dspp *dspp[DSPP_MAX]; + bool broadcast_disabled; }; /** diff --git a/drivers/gpu/drm/msm/sde/sde_hw_pingpong.c b/drivers/gpu/drm/msm/sde/sde_hw_pingpong.c index 64c1a90f5952..3494281de9cd 100644 --- a/drivers/gpu/drm/msm/sde/sde_hw_pingpong.c +++ b/drivers/gpu/drm/msm/sde/sde_hw_pingpong.c @@ -18,6 +18,10 @@ #include "sde_hw_pingpong.h" #include "sde_dbg.h" #include "sde_kms.h" +#ifdef OPLUS_BUG_STABILITY +/*Mark.Yao@PSW.MM.Display.LCD.Feature,2019-07-25 add for aod function */ +#include "oppo_dsi_support.h" +#endif /* OPLUS_BUG_STABILITY */ #define PP_TEAR_CHECK_EN 0x000 #define PP_SYNC_CONFIG_VSYNC 0x004 @@ -163,6 +167,12 @@ static struct sde_pingpong_cfg *_pingpong_offset(enum sde_pingpong pp, return ERR_PTR(-EINVAL); } +#ifdef OPLUS_BUG_STABILITY +/* Gou shengjun@PSW.MM.Display.Lcd.Stability,2018/11/21 + * For solve te sync issue at doze +*/ +extern int oppo_request_power_status; +#endif /*OPLUS_BUG_STABILITY*/ static int sde_hw_pp_setup_te_config(struct sde_hw_pingpong *pp, struct sde_hw_tear_check *te) { @@ -177,7 +187,22 @@ static int sde_hw_pp_setup_te_config(struct sde_hw_pingpong *pp, if (te->hw_vsync_mode) cfg |= BIT(20); +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.Lcd.Stability,2018/11/21 + * For solve te sync issue at doze + */ +{ + int temp_vclks_line = te->vsync_count; + + if((oppo_request_power_status == OPPO_DISPLAY_POWER_DOZE) || (oppo_request_power_status == OPPO_DISPLAY_POWER_DOZE_SUSPEND)) { + temp_vclks_line = temp_vclks_line * 60 * 100 / 3000; + } + cfg |= temp_vclks_line; +} +#else /*OPLUS_BUG_STABILITY*/ cfg |= te->vsync_count; +#endif /*OPLUS_BUG_STABILITY*/ + SDE_REG_WRITE(c, PP_SYNC_CONFIG_VSYNC, cfg); SDE_REG_WRITE(c, PP_SYNC_CONFIG_HEIGHT, te->sync_cfg_height); diff --git a/drivers/gpu/drm/msm/sde/sde_kms.c b/drivers/gpu/drm/msm/sde/sde_kms.c index f47bf72e9ba3..3b7af424031e 100644 --- a/drivers/gpu/drm/msm/sde/sde_kms.c +++ b/drivers/gpu/drm/msm/sde/sde_kms.c @@ -50,6 +50,14 @@ #include #include "soc/qcom/secure_buffer.h" +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@MM.Display.LCD.Stability, 2020/3/31, for + * decoupling display driver +*/ +#include "oppo_display_private_api.h" +#include "oppo_onscreenfingerprint.h" +#endif /* OPLUS_BUG_STABILITY */ + #define CREATE_TRACE_POINTS #include "sde_trace.h" @@ -1377,7 +1385,14 @@ static int _sde_kms_setup_displays(struct drm_device *dev, .soft_reset = dsi_display_soft_reset, .pre_kickoff = dsi_conn_pre_kickoff, .clk_ctrl = dsi_display_clk_ctrl, +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@MM.Display.LCD.Stability, 2020/3/31, for + * decoupling display driver +*/ + .set_power = dsi_display_oppo_set_power, +#else .set_power = dsi_display_set_power, +#endif /* OPLUS_BUG_STABILITY */ .get_mode_info = dsi_conn_get_mode_info, .get_dst_format = dsi_display_get_dst_format, .post_kickoff = dsi_conn_post_kickoff, diff --git a/drivers/gpu/drm/msm/sde/sde_plane.c b/drivers/gpu/drm/msm/sde/sde_plane.c index 686d50391236..8e4a029b59fc 100644 --- a/drivers/gpu/drm/msm/sde/sde_plane.c +++ b/drivers/gpu/drm/msm/sde/sde_plane.c @@ -3976,6 +3976,12 @@ static int sde_plane_sspp_atomic_update(struct drm_plane *plane, case PLANE_PROP_ALPHA: case PLANE_PROP_INPUT_FENCE: case PLANE_PROP_BLEND_OP: +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.LCD.Feature,2018-11-21 + * Support custom property +*/ + case PLANE_PROP_CUSTOM: +#endif /* OPLUS_BUG_STABILITY */ /* no special action required */ break; case PLANE_PROP_FB_TRANSLATION_MODE: @@ -4417,6 +4423,13 @@ static void _sde_plane_install_properties(struct drm_plane *plane, msm_property_install_range(&psde->property_info, "zpos", 0x0, 0, zpos_max, zpos_def, PLANE_PROP_ZPOS); +#ifdef OPLUS_BUG_STABILITY +/* Sachin Shukla@PSW.MM.Display.LCD.Feature,2018-11-21 + * Support custom propertys +*/ + msm_property_install_range(&psde->property_info,"PLANE_CUST", + 0x0, 0, INT_MAX, 0, PLANE_PROP_CUSTOM); +#endif msm_property_install_range(&psde->property_info, "alpha", 0x0, 0, 255, 255, PLANE_PROP_ALPHA); diff --git a/drivers/gpu/drm/msm/sde/sde_plane.h b/drivers/gpu/drm/msm/sde/sde_plane.h index b128fb9475cc..36c881b9c060 100644 --- a/drivers/gpu/drm/msm/sde/sde_plane.h +++ b/drivers/gpu/drm/msm/sde/sde_plane.h @@ -158,6 +158,10 @@ struct sde_plane_state { bool const_alpha_en; bool pending; bool defer_prepare_fb; +#ifdef OPLUS_BUG_STABILITY + /*Sachin Shukla@PSW.MM.Display.LCD.Stable,2019-01-12 add is_skip check */ + bool is_skip; +#endif /* OPLUS_BUG_STABILITY */ uint32_t pipe_order_flags; /* scaler configuration */ diff --git a/drivers/gpu/msm/Makefile b/drivers/gpu/msm/Makefile index b1f075ce037d..b7c240635f1a 100644 --- a/drivers/gpu/msm/Makefile +++ b/drivers/gpu/msm/Makefile @@ -57,3 +57,6 @@ msm_adreno-objs = $(msm_adreno-y) obj-$(CONFIG_QCOM_KGSL) += msm_kgsl_core.o obj-$(CONFIG_QCOM_KGSL) += msm_adreno.o +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) +obj-$(CONFIG_VIRTUAL_RESERVE_MEMORY) += kgsl_reserved_area.o +#endif /*defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY)*/ diff --git a/drivers/gpu/msm/adreno_a6xx_gmu.c b/drivers/gpu/msm/adreno_a6xx_gmu.c index 8d3d331de3ef..dca702199874 100644 --- a/drivers/gpu/msm/adreno_a6xx_gmu.c +++ b/drivers/gpu/msm/adreno_a6xx_gmu.c @@ -946,12 +946,9 @@ static int a6xx_gmu_wait_for_lowest_idle(struct adreno_device *adreno_dev) /* Collect abort data to help with debugging */ gmu_core_regread(device, A6XX_GPU_GMU_AO_GPU_CX_BUSY_STATUS, ®2); - kgsl_regread(device, A6XX_CP_STATUS_1, ®3); - gmu_core_regread(device, A6XX_GMU_RBBM_INT_UNMASKED_STATUS, ®4); - gmu_core_regread(device, A6XX_GMU_GMU_PWR_COL_KEEPALIVE, ®5); - kgsl_regread(device, A6XX_CP_CP2GMU_STATUS, ®6); - kgsl_regread(device, A6XX_CP_CONTEXT_SWITCH_CNTL, ®7); - gmu_core_regread(device, A6XX_GMU_AO_SPARE_CNTL, ®8); + gmu_core_regread(device, A6XX_GMU_RBBM_INT_UNMASKED_STATUS, ®3); + gmu_core_regread(device, A6XX_GMU_GMU_PWR_COL_KEEPALIVE, ®4); + gmu_core_regread(device, A6XX_GMU_AO_SPARE_CNTL, ®5); dev_err(&gmu->pdev->dev, "----------------------[ GMU error ]----------------------\n"); @@ -961,14 +958,23 @@ static int a6xx_gmu_wait_for_lowest_idle(struct adreno_device *adreno_dev) "Timestamps: %llx %llx %llx\n", ts1, ts2, ts3); dev_err(&gmu->pdev->dev, "RPMH_POWER_STATE=%x SPTPRAC_PWR_CLK_STATUS=%x\n", reg, reg1); - dev_err(&gmu->pdev->dev, - "CX_BUSY_STATUS=%x CP_STATUS_1=%x\n", reg2, reg3); + dev_err(&gmu->pdev->dev, "CX_BUSY_STATUS=%x\n", reg2); dev_err(&gmu->pdev->dev, "RBBM_INT_UNMASKED_STATUS=%x PWR_COL_KEEPALIVE=%x\n", - reg4, reg5); - dev_err(&gmu->pdev->dev, - "CP2GMU_STATUS=%x CONTEXT_SWITCH_CNTL=%x AO_SPARE_CNTL=%x\n", - reg6, reg7, reg8); + reg3, reg4); + dev_err(&gmu->pdev->dev, "A6XX_GMU_AO_SPARE_CNTL=%x\n", reg5); + + /* Access GX registers only when GX is ON */ + if (is_on(reg1)) { + kgsl_regread(device, A6XX_CP_STATUS_1, ®6); + kgsl_regread(device, A6XX_CP_CP2GMU_STATUS, ®7); + kgsl_regread(device, A6XX_CP_CONTEXT_SWITCH_CNTL, ®8); + + dev_err(&gmu->pdev->dev, "A6XX_CP_STATUS_1=%x\n", reg6); + dev_err(&gmu->pdev->dev, + "CP2GMU_STATUS=%x CONTEXT_SWITCH_CNTL=%x\n", + reg7, reg8); + } WARN_ON(1); return -ETIMEDOUT; diff --git a/drivers/gpu/msm/adreno_dispatch.c b/drivers/gpu/msm/adreno_dispatch.c index ee12563ea962..55cdca947db3 100644 --- a/drivers/gpu/msm/adreno_dispatch.c +++ b/drivers/gpu/msm/adreno_dispatch.c @@ -2182,6 +2182,10 @@ static int dispatcher_do_fault(struct adreno_device *adreno_dev) if (gx_on) adreno_readreg64(adreno_dev, ADRENO_REG_CP_RB_BASE, ADRENO_REG_CP_RB_BASE_HI, &base); + #if defined(OPLUS_FEATURE_GPU_MINIDUMP) + // MeiDongting@MULTIMEIDA.FEATURE.GPU.MINIDUMP, 2020/04/06, Add for OPPO gpu mini dump + device->snapshotfault = fault; + #endif /*OPLUS_FEATURE_GPU_MINIDUMP*/ /* * Force the CP off for anything but a hard fault to make sure it is diff --git a/drivers/gpu/msm/kgsl.c b/drivers/gpu/msm/kgsl.c index 950a5644db5b..00ef2ab8670d 100644 --- a/drivers/gpu/msm/kgsl.c +++ b/drivers/gpu/msm/kgsl.c @@ -35,6 +35,12 @@ #include #include #include +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) +/* + * collect reserve vma use count + */ +#include "kgsl_reserved_area.h" +#endif #include "kgsl.h" #include "kgsl_debugfs.h" @@ -4538,13 +4544,29 @@ static unsigned long _gpu_find_svm(struct kgsl_process_private *private, } /* Search top down in the CPU VM region for a free address */ +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) +/* + * get the unmap area from resrved area + */ +static unsigned long _cpu_get_unmapped_area(unsigned long bottom, + unsigned long top, unsigned long len, unsigned long align, + unsigned long mmap_flags) +#else static unsigned long _cpu_get_unmapped_area(unsigned long bottom, unsigned long top, unsigned long len, unsigned long align) +#endif { struct vm_unmapped_area_info info; unsigned long addr, err; +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + /* + * get the unmap area from resrved area + */ + info.flags = VM_UNMAPPED_AREA_TOPDOWN|mmap_flags; +#else info.flags = VM_UNMAPPED_AREA_TOPDOWN; +#endif info.low_limit = bottom; info.high_limit = top; info.length = len; @@ -4560,17 +4582,32 @@ static unsigned long _cpu_get_unmapped_area(unsigned long bottom, return err ? err : addr; } +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) +/* + * get unmaped area from normal or reserved vma, decide by mmap_flags + */ +static unsigned long _search_range(struct kgsl_process_private *private, + struct kgsl_mem_entry *entry, + unsigned long start, unsigned long end, + unsigned long len, uint64_t align, unsigned long mmap_flags) +#else static unsigned long _search_range(struct kgsl_process_private *private, struct kgsl_mem_entry *entry, unsigned long start, unsigned long end, unsigned long len, uint64_t align) +#endif { unsigned long cpu, gpu = end, result = -ENOMEM; while (gpu > start) { /* find a new empty spot on the CPU below the last one */ +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + cpu = _cpu_get_unmapped_area(start, gpu, len, + (unsigned long) align, mmap_flags); +#else cpu = _cpu_get_unmapped_area(start, gpu, len, (unsigned long) align); +#endif if (IS_ERR_VALUE(cpu)) { result = cpu; break; @@ -4674,6 +4711,13 @@ static unsigned long _get_svm_area(struct kgsl_process_private *private, vma = find_vma(current->mm, addr); +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + /* + * while vma is NULL, check whether the addr is valid in + * reserve area or not. + */ + try_reserved_region(vma, addr, len, private, entry, result); +#else if (vma == NULL || ((addr + len) <= vma->vm_start)) { result = _gpu_set_svm_region(private, entry, addr, len); @@ -4681,6 +4725,7 @@ static unsigned long _get_svm_area(struct kgsl_process_private *private, if (!IS_ERR_VALUE(result)) return result; } +#endif } else { /* no hint, start search at the top and work down */ addr = end & ~(align - 1); @@ -4690,9 +4735,16 @@ static unsigned long _get_svm_area(struct kgsl_process_private *private, * Search downwards from the hint first. If that fails we * must try to search above it. */ +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + /* + * try to get unmap area from reserved area + */ + result = kgsl_search_range(private, entry, start, end, addr, len, align, hint, _search_range); +#else result = _search_range(private, entry, start, addr, len, align); if (IS_ERR_VALUE(result) && hint != 0) result = _search_range(private, entry, addr, end, len, align); +#endif return result; } @@ -4737,6 +4789,12 @@ kgsl_get_unmapped_area(struct file *file, unsigned long addr, pid_nr(private->pid), current->mm->mmap_base, addr, pgoff, len, (int) val); +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + /* + * record the process pid and svm_oom happend jiffies + */ + record_svm_oom_info(val); +#endif } put: diff --git a/drivers/gpu/msm/kgsl_device.h b/drivers/gpu/msm/kgsl_device.h index b3e3ea603334..4a8ec7be3589 100644 --- a/drivers/gpu/msm/kgsl_device.h +++ b/drivers/gpu/msm/kgsl_device.h @@ -341,6 +341,11 @@ struct kgsl_device { unsigned int num_l3_pwrlevels; /* store current L3 vote to determine if we should change our vote */ unsigned int cur_l3_pwrlevel; + #if defined(OPLUS_FEATURE_GPU_MINIDUMP) + // MeiDongting@MULTIMEIDA.FEATURE.GPU.MINIDUMP, 2020/04/06, Add for OPPO gpu mini dump + bool snapshot_control; + int snapshotfault; + #endif /* OPLUS_FEATURE_GPU_MINIDUMP */ }; #define KGSL_MMU_DEVICE(_mmu) \ @@ -546,6 +551,10 @@ struct kgsl_snapshot { bool first_read; bool gmu_fault; bool recovered; + #if defined(OPLUS_FEATURE_GPU_MINIDUMP) + // MeiDongting@MULTIMEIDA.FEATURE.GPU.MINIDUMP, 2020/04/06, Add for OPPO gpu mini dump + char snapshot_hashid[96]; + #endif /* OPLUS_FEATURE_GPU_MINIDUMP */ }; /** diff --git a/drivers/gpu/msm/kgsl_events.c b/drivers/gpu/msm/kgsl_events.c index d4f4a618d895..cb7e52b3ca8e 100644 --- a/drivers/gpu/msm/kgsl_events.c +++ b/drivers/gpu/msm/kgsl_events.c @@ -287,6 +287,10 @@ int kgsl_add_event(struct kgsl_device *device, struct kgsl_event_group *group, event->group = group; INIT_WORK(&event->work, _kgsl_event_worker); +#ifdef OPLUS_FEATURE_UIFIRST +// caichen@TECH.Kernel.Sched, 2020/05/28, add for uifirst wq + set_uxwork(&event->work); +#endif trace_kgsl_register_event(KGSL_CONTEXT_ID(context), timestamp, func); diff --git a/drivers/gpu/msm/kgsl_iommu.c b/drivers/gpu/msm/kgsl_iommu.c index 9070a8587df6..904dbbd653d4 100644 --- a/drivers/gpu/msm/kgsl_iommu.c +++ b/drivers/gpu/msm/kgsl_iommu.c @@ -24,6 +24,12 @@ #include #include #include +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) +/* + * record the gpu highest addr + */ +#include +#endif #include "kgsl.h" #include "kgsl_device.h" @@ -1107,6 +1113,14 @@ static void setup_64bit_pagetable(struct kgsl_mmu *mmu, pt->compat_va_end = mmu->secure_base; pt->va_start = KGSL_IOMMU_VA_BASE64; pt->va_end = KGSL_IOMMU_VA_END64; + +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + /* + * record the high limit of gpu mmap_base, used for create + * reserved area + */ + gpu_compat_high_limit_addr = pt->compat_va_end; +#endif } if (pagetable->name != KGSL_MMU_GLOBAL_PT && diff --git a/drivers/gpu/msm/kgsl_sharedmem.c b/drivers/gpu/msm/kgsl_sharedmem.c index 33816fe8fd64..78537fe86c6c 100644 --- a/drivers/gpu/msm/kgsl_sharedmem.c +++ b/drivers/gpu/msm/kgsl_sharedmem.c @@ -303,6 +303,14 @@ void kgsl_process_init_sysfs(struct kgsl_device *device, } } +#ifdef OPLUS_FEATURE_HEALTHINFO +//Jiheng.Xie@TECH.BSP.Performance, 2019-07-22, add for gpu total used account +unsigned long gpu_total(void) +{ + return (unsigned long)atomic_long_read(&kgsl_driver.stats.page_alloc); +} +#endif /* OPLUS_FEATURE_HEALTHINFO */ + static ssize_t kgsl_drv_memstat_show(struct device *dev, struct device_attribute *attr, char *buf) diff --git a/drivers/gpu/msm/kgsl_snapshot.c b/drivers/gpu/msm/kgsl_snapshot.c index a1cb0412c277..6142b1749a13 100644 --- a/drivers/gpu/msm/kgsl_snapshot.c +++ b/drivers/gpu/msm/kgsl_snapshot.c @@ -627,6 +627,48 @@ static void kgsl_free_snapshot(struct kgsl_snapshot *snapshot) KGSL_CORE_ERR("snapshot: objects released\n"); } +#if defined(OPLUS_FEATURE_GPU_MINIDUMP) +// MeiDongting@MULTIMEIDA.FEATURE.GPU.MINIDUMP, 2020/04/06, Add for OPPO gpu mini dump + +/************************************************ +adreno.h +#define ADRENO_SOFT_FAULT BIT(0) +#define ADRENO_HARD_FAULT BIT(1) +#define ADRENO_TIMEOUT_FAULT BIT(2) +#define ADRENO_IOMMU_PAGE_FAULT BIT(3) +#define ADRENO_PREEMPT_FAULT BIT(4) +#define ADRENO_GMU_FAULT BIT(5) +#define ADRENO_CTX_DETATCH_TIMEOUT_FAULT BIT(6) +#define ADRENO_GMU_FAULT_SKIP_SNAPSHOT BIT(7) +*************************************************/ +char* kgsl_get_reason(int faulttype, bool gmu_fault){ + if(gmu_fault){ + return "GMUFAULT"; + }else{ + switch(faulttype){ + case 0: + return "SOFTFAULT"; + case 1: + return "HANGFAULT"; + case 2: + return "TIMEOUTFAULT"; + case 3: + return "IOMMUPAGEFAULT"; + case 4: + return "PREEMPTFAULT"; + case 5: + return "GMUFAULT"; + case 6: + return "CTXDETATCHFAULT"; + case 7: + return "GMUSKIPFAULT"; + default: + return "UNKNOW"; + } + } +} +#endif /*OPLUS_FEATURE_GPU_MINIDUMP*/ + /** * kgsl_snapshot() - construct a device snapshot * @device: device to snapshot @@ -740,6 +782,17 @@ void kgsl_device_snapshot(struct kgsl_device *device, pa = __pa(device->snapshot_memory.ptr); KGSL_DRV_ERR(device, "%s snapshot created at pa %pa++0x%zx\n", gmu_fault ? "GMU" : "GPU", &pa, snapshot->size); + #if defined(OPLUS_FEATURE_GPU_MINIDUMP) + // MeiDongting@MULTIMEIDA.FEATURE.GPU.MINIDUMP, 2020/04/06, Add for OPPO gpu mini dump + if(context!= NULL){ + dev_err(device->dev, "falut=%s, pid=%d, processname=%s\n", + kgsl_get_reason(device->snapshotfault, gmu_fault), context->proc_priv->pid, context->proc_priv->comm); + + memset(snapshot->snapshot_hashid, '\0', sizeof(snapshot->snapshot_hashid)); + scnprintf(snapshot->snapshot_hashid, sizeof(snapshot->snapshot_hashid), "%d@%s@%s", + context->proc_priv->pid, context->proc_priv->comm, kgsl_get_reason(device->snapshotfault, gmu_fault)); + } + #endif /* OPLUS_FEATURE_GPU_MINIDUMP */ sysfs_notify(&device->snapshot_kobj, NULL, "timestamp"); @@ -817,6 +870,42 @@ static int snapshot_release(struct kgsl_device *device, return ret; } +#if defined(OPLUS_FEATURE_GPU_MINIDUMP) +// MeiDongting@MULTIMEIDA.FEATURE.GPU.MINIDUMP, 2020/04/06, Add for OPPO gpu mini dump +static bool snapshot_ontrol_on = 0; + +static ssize_t snapshot_control_show(struct kgsl_device *device, char *buf) +{ + return snprintf(buf, PAGE_SIZE, "%d\n", device->snapshot_control); +} + +static ssize_t snapshot_control_store(struct kgsl_device *device, const char *buf, + size_t count) +{ + unsigned int val = 0; + int ret; + + if (device && count > 0) + device->snapshot_control = 0; + + ret = kgsl_sysfs_store(buf, &val); + + if (!ret && device){ + device->snapshot_control = (bool)val; + snapshot_ontrol_on = device->snapshot_control; + } + + return (ssize_t) ret < 0 ? ret : count; +} + +static ssize_t snapshot_hashid_show(struct kgsl_device *device, char *buf) +{ + if(device->snapshot == NULL) + return 0; + return strlcpy(buf, device->snapshot->snapshot_hashid, PAGE_SIZE); +} +#endif /*OPLUS_FEATURE_GPU_MINIDUMP*/ + /* Dump the sysfs binary data to the user */ static ssize_t snapshot_show(struct file *filep, struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t off, @@ -831,6 +920,14 @@ static ssize_t snapshot_show(struct file *filep, struct kobject *kobj, if (device == NULL) return 0; + #if defined(OPLUS_FEATURE_GPU_MINIDUMP) + // MeiDongting@MULTIMEIDA.FEATURE.GPU.MINIDUMP, 2020/04/06, Add for OPPO gpu mini dump + if (snapshot_ontrol_on) { + dev_err(device->dev, "snapshot: snapshot_ontrol_on is true, skip snapshot\n"); + return 0; + } + #endif /* OPLUS_FEATURE_GPU_MINIDUMP */ + mutex_lock(&device->mutex); snapshot = device->snapshot; if (snapshot != NULL) { @@ -1058,6 +1155,12 @@ static SNAPSHOT_ATTR(snapshot_crashdumper, 0644, snapshot_crashdumper_show, static SNAPSHOT_ATTR(snapshot_legacy, 0644, snapshot_legacy_show, snapshot_legacy_store); +#if defined(OPLUS_FEATURE_GPU_MINIDUMP) +// MeiDongting@MULTIMEIDA.FEATURE.GPU.MINIDUMP, 2020/04/06, Add for OPPO gpu mini dump +static SNAPSHOT_ATTR(snapshot_hashid, 0666, snapshot_hashid_show, NULL); +static SNAPSHOT_ATTR(snapshot_control, 0666, snapshot_control_show, snapshot_control_store); +#endif /* OPLUS_FEATURE_GPU_MINIDUMP */ + static ssize_t snapshot_sysfs_show(struct kobject *kobj, struct attribute *attr, char *buf) { @@ -1139,6 +1242,10 @@ int kgsl_device_snapshot_init(struct kgsl_device *device) device->force_panic = 0; device->snapshot_crashdumper = 1; device->snapshot_legacy = 0; + #if defined(OPLUS_FEATURE_GPU_MINIDUMP) + // MeiDongting@MULTIMEIDA.FEATURE.GPU.MINIDUMP, 2020/04/06, Add for OPPO gpu mini dump + device->snapshot_control = 0; + #endif /* OPLUS_FEATURE_GPU_MINIDUMP */ /* * Set this to false so that we only ever keep the first snapshot around @@ -1181,6 +1288,16 @@ int kgsl_device_snapshot_init(struct kgsl_device *device) ret = sysfs_create_file(&device->snapshot_kobj, &attr_snapshot_legacy.attr); + #if defined(OPLUS_FEATURE_GPU_MINIDUMP) + // MeiDongting@MULTIMEIDA.FEATURE.GPU.MINIDUMP, 2020/04/06, Add for OPPO gpu mini dump + ret = sysfs_create_file(&device->snapshot_kobj, &attr_snapshot_hashid.attr); + if (ret) + return ret; + + ret = sysfs_create_file(&device->snapshot_kobj, &attr_snapshot_control.attr); + if (ret) + return ret; + #endif /* OPLUS_FEATURE_GPU_MINIDUMP */ done: return ret; @@ -1208,6 +1325,10 @@ void kgsl_device_snapshot_close(struct kgsl_device *device) device->snapshot_faultcount = 0; device->force_panic = 0; device->snapshot_crashdumper = 1; + #if defined(OPLUS_FEATURE_GPU_MINIDUMP) + // MeiDongting@MULTIMEIDA.FEATURE.GPU.MINIDUMP, 2020/04/06, Add for OPPO gpu mini dump + device->snapshot_control = 0; + #endif /* OPLUS_FEATURE_GPU_MINIDUMP */ } EXPORT_SYMBOL(kgsl_device_snapshot_close); diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 78b524735f92..e0b120c51773 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -933,4 +933,9 @@ config XILINX_XADC The driver can also be build as a module. If so, the module will be called xilinx-xadc. +config OPLUS_SM8150R_CHARGER + tristate "OPPO SM8150 charger driver" + depends on MFD_SPMI_PMIC + help + Enables support for the oppo charging framework endmenu diff --git a/drivers/iio/adc/qcom-spmi-adc5.c b/drivers/iio/adc/qcom-spmi-adc5.c index 4ba747ce108d..bd907199d18c 100644 --- a/drivers/iio/adc/qcom-spmi-adc5.c +++ b/drivers/iio/adc/qcom-spmi-adc5.c @@ -735,24 +735,54 @@ static const struct adc_channels adc_chans_pmic5[ADC_MAX_CHANNEL] = { SCALE_HW_CALIB_DEFAULT) [ADC_MID_CHG_DIV6] = ADC_CHAN_VOLT("chg_mid_chg", 6, SCALE_HW_CALIB_DEFAULT) +#ifdef CONFIG_OPLUS_SM8150R_CHARGER + /* Charger ID detect */ + [ADC_GPIO3] = ADC_CHAN_VOLT("chgID_voltage_adc", 1, + SCALE_HW_CALIB_DEFAULT) +#endif [ADC_XO_THERM_PU2] = ADC_CHAN_TEMP("xo_therm", 1, SCALE_HW_CALIB_XOTHERM) +#ifdef OPLUS_FEATURE_CHG_BASIC + [ADC_BAT_THERM_PU2] = ADC_CHAN_TEMP("bat_therm_pu2", 1, + SCALE_HW_CALIB_DEFAULT) + [ADC_BAT_THERM_PU1] = ADC_CHAN_TEMP("bat_therm_pu1", 1, + SCALE_HW_CALIB_DEFAULT) +#else [ADC_BAT_THERM_PU2] = ADC_CHAN_TEMP("bat_therm_pu2", 1, SCALE_HW_CALIB_BATT_THERM_100K) [ADC_BAT_THERM_PU1] = ADC_CHAN_TEMP("bat_therm_pu1", 1, SCALE_HW_CALIB_BATT_THERM_30K) +#endif /*OPLUS_FEATURE_CHG_BASIC*/ [ADC_BAT_THERM_PU3] = ADC_CHAN_TEMP("bat_therm_pu3", 1, SCALE_HW_CALIB_BATT_THERM_400K) [ADC_BAT_ID_PU2] = ADC_CHAN_TEMP("bat_id", 1, SCALE_HW_CALIB_DEFAULT) [ADC_AMUX_THM1_PU2] = ADC_CHAN_TEMP("amux_thm1_pu2", 1, SCALE_HW_CALIB_THERM_100K_PULLUP) +#ifdef VENDOR_EDIT +/*lizhijie@BSP.CHG.Basic 2020/02/05 lzj add for usbtemp*/ [ADC_AMUX_THM2_PU2] = ADC_CHAN_TEMP("amux_thm2_pu2", 1, SCALE_HW_CALIB_THERM_100K_PULLUP) +#ifdef CONFIG_OPLUS_SM8150R_CHARGER /* tongfeng.huang@BSP.CHG.Basic, 2019/01/16, for pm8150b gpio1 adc */ + [ADC_AMUX_THM3_PU2] = ADC_CHAN_VOLT("amux_thm3_pu2", 1, + SCALE_HW_CALIB_DEFAULT) +#else [ADC_AMUX_THM3_PU2] = ADC_CHAN_TEMP("amux_thm3_pu2", 1, SCALE_HW_CALIB_THERM_100K_PULLUP) - [ADC_AMUX_THM4_PU2] = ADC_CHAN_TEMP("amux_thm4_pu2", 1, +#endif +#else + [ADC_AMUX_THM2_PU2] = ADC_CHAN_VOLT("amux_thm2_pu2", 1, + SCALE_HW_CALIB_DEFAULT) + [ADC_AMUX_THM3_PU2] = ADC_CHAN_VOLT("amux_thm3_pu2", 1, + SCALE_HW_CALIB_DEFAULT) +#endif /*VENDOR_EDIT*/ +#ifdef CONFIG_OPLUS_SM8150R_CHARGER /* tongfeng.huang@BSP.CHG.Basic, 2019/01/16, for pm8150b gpio1 adc */ + [ADC_AMUX_THM4_PU2] = ADC_CHAN_VOLT("amux_thm4_pu2", 1, + SCALE_HW_CALIB_DEFAULT) +#else + [ADC_AMUX_THM4_PU2] = ADC_CHAN_TEMP("amux_thm4_pu2", 1, SCALE_HW_CALIB_THERM_100K_PULLUP) +#endif [ADC_INT_EXT_ISENSE_VBAT_VDATA] = ADC_CHAN_POWER("int_ext_isense", 1, SCALE_HW_CALIB_CUR) [ADC_EXT_ISENSE_VBAT_VDATA] = ADC_CHAN_POWER("ext_isense", 1, @@ -765,12 +795,48 @@ static const struct adc_channels adc_chans_pmic5[ADC_MAX_CHANNEL] = { SCALE_HW_CALIB_PM5_SMB_TEMP) [ADC_GPIO1_PU2] = ADC_CHAN_TEMP("gpio1_pu2", 1, SCALE_HW_CALIB_THERM_100K_PULLUP) +#ifdef CONFIG_OPLUS_SM8150R_CHARGER/*for usbtemp*/ + [ADC_GPIO2_PU2] = ADC_CHAN_VOLT("gpio2_pu2", 1, + SCALE_HW_CALIB_DEFAULT) +#else [ADC_GPIO2_PU2] = ADC_CHAN_TEMP("gpio2_pu2", 1, SCALE_HW_CALIB_THERM_100K_PULLUP) +#endif [ADC_GPIO3_PU2] = ADC_CHAN_TEMP("gpio3_pu2", 1, SCALE_HW_CALIB_THERM_100K_PULLUP) [ADC_GPIO4_PU2] = ADC_CHAN_TEMP("gpio4_pu2", 1, SCALE_HW_CALIB_THERM_100K_PULLUP) + +#ifdef CONFIG_OPLUS_SM7150R_CHARGER +/* Yichun.Chen PSW.BSP.CHG 2019-04-13 for read chargerid */ + [ADC_GPIO4] = ADC_CHAN_VOLT("chgid_voltage", 1, SCALE_HW_CALIB_DEFAULT) + [ADC_AMUX_THM1] = ADC_CHAN_VOLT("usb_temp1", 1, SCALE_HW_CALIB_DEFAULT) + [ADC_AMUX_THM3] = ADC_CHAN_VOLT("usb_temp2", 1, SCALE_HW_CALIB_DEFAULT) +#endif + +#ifdef CONFIG_OPLUS_SM7125R_CHARGER +/*chenhongbin@BSP.CHG.usbtemp. 2020/11/14 add for project 19721 usbtemp read */ + [ADC_AMUX_THM3] = ADC_CHAN_VOLT("usb_temp_adc", 1, SCALE_HW_CALIB_DEFAULT) + [ADC_AMUX_THM2] = ADC_CHAN_VOLT("usb_supplementary_temp_adc", 1, SCALE_HW_CALIB_DEFAULT) +#endif + + +#ifdef OPLUS_FEATURE_TP_BASIC +/*xing.xiong@BSP.Kernel.Driver, 2019/09/10, Add for adc read for aboard */ + [ADC_GPIO4] = ADC_CHAN_VOLT("board_id_vdata", 1, + SCALE_HW_CALIB_DEFAULT) +#endif/*OPLUS_FEATURE_TP_BASIC*/ +#ifdef CONFIG_OPLUS_SM8150R_CHARGER + [ADC_GPIO3] = ADC_CHAN_VOLT("gpio7_v", 1, + SCALE_HW_CALIB_DEFAULT) + [ADC_GPIO4_PU2] = ADC_CHAN_VOLT("gpio8_v", 1, + SCALE_HW_CALIB_DEFAULT) + + [ADC_AMUX_THM4] = ADC_CHAN_VOLT("usb_temp_adc", 1, + SCALE_HW_CALIB_DEFAULT) + [ADC_GPIO2] = ADC_CHAN_VOLT("usb_supplementary_temp_adc", 1, + SCALE_HW_CALIB_DEFAULT) +#endif }; static const struct adc_channels adc_chans_rev2[ADC_MAX_CHANNEL] = { diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig index 1b748ad70af3..f49d7428d8c0 100644 --- a/drivers/input/Kconfig +++ b/drivers/input/Kconfig @@ -222,6 +222,10 @@ menu "Hardware I/O ports" source "drivers/input/serio/Kconfig" source "drivers/input/gameport/Kconfig" +#ifdef VENDOR_EDIT +#zoulian@BSP.Fingerprint.Basic, 2020/08/04, add for fingerprint driver +source "drivers/input/oppo_fp_drivers/Kconfig" +#endif endmenu diff --git a/drivers/input/Makefile b/drivers/input/Makefile index 7133c3bc1b04..d6a8437256e4 100644 --- a/drivers/input/Makefile +++ b/drivers/input/Makefile @@ -32,3 +32,8 @@ obj-$(CONFIG_INPUT_KEYCOMBO) += keycombo.o obj-$(CONFIG_RMI4_CORE) += rmi4/ obj-$(CONFIG_SMI130) += sensors/smi130/ +#ifdef VENDOR_EDIT +#zoulian@BSP.Fingerprint.Basic, 2020/08/04, add for fingerprint driver +obj-$(CONFIG_OPPO_FINGERPRINT) += oppo_fp_drivers/ +obj-$(CONFIG_OPPO_FINGERPRINT) += oppo_secure_common/ +#endif diff --git a/drivers/input/input.c b/drivers/input/input.c index cadb368be8ef..a56dba6d3e09 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -366,11 +366,20 @@ static int input_get_disposition(struct input_dev *dev, return disposition; } +#ifdef OPLUS_FEATURE_SAUPWK +extern void __attribute__((weak)) oppo_sync_saupwk_event(unsigned int , unsigned int , int); +#endif /* OPLUS_FEATURE_SAUPWK */ + static void input_handle_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) { int disposition = input_get_disposition(dev, type, code, &value); +#ifdef OPLUS_FEATURE_SAUPWK + if(oppo_sync_saupwk_event) + oppo_sync_saupwk_event(type, code, value); +#endif /* OPLUS_FEATURE_SAUPWK */ + if (disposition != INPUT_IGNORE_EVENT && type != EV_SYN) add_input_randomness(type, code, value); diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index e0c7a6f358df..ef435287ecdb 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -889,4 +889,14 @@ config INPUT_HISI_POWERKEY To compile this driver as a module, choose M here: the module will be called hisi_powerkey. +config STMVL53L1 + tristate "STM VL53L1 Proximity support" + depends on I2C=y + default y + help + Say Y here if you want to use STMicroelectronics's vl53L1 TOF AF sensor + through I2C interface. + + To compile this driver as a module, choose M here: the + module will be called stmvl53l1. endif diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index 137da08f75a8..7a680dd4182e 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile @@ -85,3 +85,6 @@ obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o obj-$(CONFIG_INPUT_XEN_KBDDEV_FRONTEND) += xen-kbdfront.o obj-$(CONFIG_INPUT_YEALINK) += yealink.o obj-$(CONFIG_INPUT_IDEAPAD_SLIDEBAR) += ideapad_slidebar.o +ifeq ($(TARGET_PRODUCT),msmnile) +obj-$(CONFIG_STMVL53L1) += vl53L1/ +endif \ No newline at end of file diff --git a/drivers/input/misc/qpnp-power-on.c b/drivers/input/misc/qpnp-power-on.c index e4025a6bbac8..51f62ecbff10 100644 --- a/drivers/input/misc/qpnp-power-on.c +++ b/drivers/input/misc/qpnp-power-on.c @@ -35,6 +35,9 @@ #include #include +#include + +#define GPIO109_ADDR 0x3D77000 #define PMIC_VER_8941 0x01 #define PMIC_VERSION_REG 0x0105 #define PMIC_VERSION_REV4_REG 0x0103 @@ -201,6 +204,7 @@ struct pon_regulator { bool enabled; }; +#ifndef OPLUS_FEATURE_QCOM_PMICWD struct qpnp_pon { struct device *dev; struct regmap *regmap; @@ -244,13 +248,17 @@ struct qpnp_pon { struct notifier_block pon_nb; bool legacy_hard_reset_offset; }; +#endif //OPLUS_FEATURE_QCOM_PMICWD static int pon_ship_mode_en; module_param_named( ship_mode_en, pon_ship_mode_en, int, 0600 ); +#ifndef OPLUS_FEATURE_QCOM_PMICWD static struct qpnp_pon *sys_reset_dev; +#endif //OPLUS_FEATURE_QCOM_PMICWD + static DEFINE_SPINLOCK(spon_list_slock); static LIST_HEAD(spon_dev_list); @@ -356,8 +364,12 @@ done: return rc; } +#ifdef OPLUS_FEATURE_QCOM_PMICWD +int qpnp_pon_masked_write(struct qpnp_pon *pon, u16 addr, u8 mask, u8 val) +#else static int qpnp_pon_masked_write(struct qpnp_pon *pon, u16 addr, u8 mask, u8 val) +#endif /* OPLUS_FEATURE_QCOM_PMICWD */ { int rc; @@ -1009,6 +1021,10 @@ static int qpnp_pon_input_dispatch(struct qpnp_pon *pon, u32 pon_type) input_sync(pon->pon_input); } + #ifdef OPLUS_FEATURE_QCOM_PMICWD + pr_err("keycode = %d,key_st = %d\n",cfg->key_code, key_status); + #endif //OPLUS_FEATURE_QCOM_PMICWD + input_report_key(pon->pon_input, cfg->key_code, key_status); input_sync(pon->pon_input); @@ -1625,14 +1641,24 @@ static int qpnp_pon_config_init(struct qpnp_pon *pon, int rc = 0, i = 0, pmic_wd_bark_irq; struct device_node *cfg_node = NULL; struct qpnp_pon_config *cfg; - + void __iomem *gpio_addr = NULL; + u32 detect_gpio_status,detect_gpio_status_1; if (pon->num_pon_config) { pon->pon_cfg = devm_kcalloc(pon->dev, pon->num_pon_config, sizeof(*pon->pon_cfg), GFP_KERNEL); if (!pon->pon_cfg) return -ENOMEM; } - + gpio_addr = ioremap(GPIO109_ADDR , 4); + if (!gpio_addr) { + pr_err("GPIO109_ioremap_fail\n"); + } else { + detect_gpio_status = __raw_readl(gpio_addr); + printk("detect_gpio_status = 0x%x\n",detect_gpio_status); + __raw_writel((~(1 << 20)) & detect_gpio_status, gpio_addr); + detect_gpio_status_1 = __raw_readl(gpio_addr); + printk("detect_gpio_status_1 = 0x%x\n",detect_gpio_status_1); + } /* Iterate through the list of pon configs */ for_each_available_child_of_node(pon->dev->of_node, cfg_node) { if (!of_find_property(cfg_node, "qcom,pon-type", NULL)) @@ -2145,6 +2171,13 @@ static int qpnp_pon_configure_s3_reset(struct qpnp_pon *pon) return 0; } +#ifdef OPLUS_BUG_STABILITY +/* fanhui@PhoneSW.BSP, 2016/05/16, interface to read PMIC reg PON_REASON and POFF_REASON */ +extern char pon_reason[]; +extern char poff_reason[]; +int preason_initialized; +#endif /*OPLUS_BUG_STABILITY*/ + static int qpnp_pon_read_hardware_info(struct qpnp_pon *pon, bool sys_reset) { struct device *dev = pon->dev; @@ -2190,25 +2223,49 @@ static int qpnp_pon_read_hardware_info(struct qpnp_pon *pon, bool sys_reset) /* PON reason */ rc = qpnp_pon_read(pon, QPNP_PON_REASON1(pon), &pon_sts); - if (rc) + if (rc){ +#ifdef OPLUS_BUG_STABILITY +/* fanhui@PhoneSW.BSP, 2016/05/16, interface to read PMIC reg PON_REASON and POFF_REASON */ + dev_err(dev,"Unable to read PON_RESASON1 reg rc: %d\n",rc); + if (!preason_initialized) { + snprintf(pon_reason, 128, "Unable to read PON_RESASON1 reg rc: %d\n", rc); + preason_initialized = 1; + } +#endif /*OPLUS_BUG_STABILITY*/ return rc; - + } if (sys_reset) boot_reason = ffs(pon_sts); index = ffs(pon_sts) - 1; +#ifdef OPLUS_BUG_STABILITY +/* fanhui@PhoneSW.BSP, 2016/05/18, when KPDPWR_N is set it is PWK start*/ + if (pon_sts & 0x80) + index = 7; +#endif /*OPLUS_BUG_STABILITY*/ cold_boot = sys_reset_dev ? !_qpnp_pon_is_warm_reset(sys_reset_dev) : !_qpnp_pon_is_warm_reset(pon); if (index >= ARRAY_SIZE(qpnp_pon_reason) || index < 0) { dev_info(dev, "PMIC@SID%d Power-on reason: Unknown and '%s' boot\n", to_spmi_device(dev->parent)->usid, cold_boot ? "cold" : "warm"); +#ifdef OPLUS_BUG_STABILITY +/* fanhui@PhoneSW.BSP, 2016/05/16, interface to read PMIC reg PON_REASON and POFF_REASON */ + if (!preason_initialized) + snprintf(pon_reason, 128, "Unknown[0x%02X] and '%s' boot\n", pon_sts, cold_boot ? "cold" : "warm"); +#endif /*OPLUS_BUG_STABILITY*/ } else { pon->pon_trigger_reason = index; dev_info(dev, "PMIC@SID%d Power-on reason: %s and '%s' boot\n", to_spmi_device(dev->parent)->usid, qpnp_pon_reason[index], cold_boot ? "cold" : "warm"); +#ifdef OPLUS_BUG_STABILITY +/* fanhui@PhoneSW.BSP, 2016/05/16, interface to read PMIC reg PON_REASON and POFF_REASON */ + if (!preason_initialized) + snprintf(pon_reason, 128, "[0x%02X]%s and '%s' boot\n", pon_sts, + qpnp_pon_reason[index], cold_boot ? "cold" : "warm"); +#endif /*OPLUS_BUG_STABILITY*/ } /* POFF reason */ @@ -2223,6 +2280,13 @@ static int qpnp_pon_read_hardware_info(struct qpnp_pon *pon, bool sys_reset) if (rc) { dev_err(dev, "Register read failed, addr=0x%04X, rc=%d\n", QPNP_POFF_REASON1(pon), rc); +#ifdef OPLUS_BUG_STABILITY +/* fanhui@PhoneSW.BSP, 2016/05/16, interface to read PMIC reg PON_REASON and POFF_REASON */ + if (!preason_initialized) { + snprintf(poff_reason, 128, "Unable to read POFF_RESASON regs rc:%d\n", rc); + preason_initialized = 1; + } +#endif /*OPLUS_BUG_STABILITY*/ return rc; } poff_sts = buf[0] | (buf[1] << 8); @@ -2231,11 +2295,25 @@ static int qpnp_pon_read_hardware_info(struct qpnp_pon *pon, bool sys_reset) if (index >= ARRAY_SIZE(qpnp_poff_reason) || index < 0) { dev_info(dev, "PMIC@SID%d: Unknown power-off reason\n", to_spmi_device(dev->parent)->usid); +#ifdef OPLUS_BUG_STABILITY +/* fanhui@PhoneSW.BSP, 2016/05/16, interface to read PMIC reg PON_REASON and POFF_REASON */ + if (!preason_initialized) { + snprintf(poff_reason, 128, "Unknown[0x%4X]\n", poff_sts); + preason_initialized = 1; + } +#endif /*OPLUS_BUG_STABILITY*/ } else { pon->pon_power_off_reason = index; dev_info(dev, "PMIC@SID%d: Power-off reason: %s\n", to_spmi_device(dev->parent)->usid, qpnp_poff_reason[index]); +#ifdef OPLUS_BUG_STABILITY +/* fanhui@PhoneSW.BSP, 2016/05/16, interface to read PMIC reg PON_REASON and POFF_REASON */ + if (!preason_initialized) { + snprintf(poff_reason, 128, "[0x%04X]%s\n", poff_sts, qpnp_poff_reason[index]); + preason_initialized = 1; + } +#endif /*OPLUS_BUG_STABILITY*/ } if ((pon->pon_trigger_reason == PON_SMPL || @@ -2460,8 +2538,13 @@ static int qpnp_pon_probe(struct platform_device *pdev) if (sys_reset) sys_reset_dev = pon; - qpnp_pon_debugfs_init(pon); + qpnp_pon_debugfs_init(pon); + #ifdef OPLUS_FEATURE_QCOM_PMICWD + pmicwd_init(pdev, pon, sys_reset); + kpdpwr_init(pon, sys_reset); + #endif /* OPLUS_FEATURE_QCOM_PMICWD */ + return 0; } @@ -2542,11 +2625,11 @@ static const struct of_device_id qpnp_pon_match_table[] = { static struct platform_driver qpnp_pon_driver = { .driver = { + #ifdef OPLUS_FEATURE_QCOM_PMICWD + .pm = &qpnp_pm_ops, + #endif //OPLUS_FEATURE_QCOM_PMICWD .name = "qcom,qpnp-power-on", .of_match_table = qpnp_pon_match_table, -#ifdef CONFIG_PM - .pm = &qpnp_pon_pm_ops, -#endif }, .probe = qpnp_pon_probe, .remove = qpnp_pon_remove, diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index d6030ba38063..414b047e9bda 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -1288,12 +1288,7 @@ config TOUCHSCREEN_SYNAPTICS_TCM source "drivers/input/touchscreen/synaptics_tcm/Kconfig" -config TOUCHSCREEN_RAYDIUM_CHIPSET - bool "Raydium WT030 touchpanel CHIPSET" - depends on I2C - help - Say Y here if you have a Raydium WT030 CHIPSET touchscreen. - - If unsure, say N. +#Qicai.gu@Bsp.Group.Tp, 2020/02/26, Add for oppo project +source "drivers/input/touchscreen/oppo_touchscreen/Kconfig" endif diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 21df02a44d42..1befebd38012 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -108,4 +108,7 @@ obj-$(CONFIG_TOUCHSCREEN_ROHM_BU21023) += rohm_bu21023.o obj-$(CONFIG_TOUCHSCREEN_ST) += st/ obj-$(CONFIG_TOUCHSCREEN_HIMAX_CHIPSET) += hxchipset/ obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_TCM) += synaptics_tcm/ -obj-$(CONFIG_TOUCHSCREEN_RAYDIUM_CHIPSET) += raydium_wt030/ + +#Qicai.gu@Bsp.Group.Tp, 2020/02/26, Add for oppo project +obj-$(CONFIG_TOUCHPANEL_OPPO) += oppo_touchscreen/ +obj-$(CONFIG_TOUCHPANEL_OPPO) += touch.o diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index f3c81a86e056..2b723e55ab62 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -47,6 +47,19 @@ #include "irq-gic-common.h" +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY +//Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler +#include "../../drivers/soc/oplus/owakelock/oplus_wakelock_profiler_qcom.h" +#endif /* OPLUS_FEATURE_POWERINFO_STANDBY */ + +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER +/* +*Ruansong@PSW.NW.DATA.2120730, 2019/07/11 +*Add for: print qrtr debug msg and fix QMI wakeup statistics for QCOM platforms using glink. +*/ +int qrtr_first_msg = 0; +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ + struct redist_region { void __iomem *redist_base; phys_addr_t phys_base; @@ -452,6 +465,11 @@ static void gic_show_resume_irq(struct gic_chip_data *gic) if (!msm_show_resume_irq_mask) return; + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY + //Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler + wakeup_reasons_statics(IRQ_NAME_WAKE_SUM, WS_CNT_SUM); + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY */ + for (i = 0; i * 32 < gic->irq_nr; i++) { enabled = readl_relaxed(base + GICD_ICENABLER + i * 4); pending[i] = readl_relaxed(base + GICD_ISPENDR + i * 4); @@ -471,6 +489,26 @@ static void gic_show_resume_irq(struct gic_chip_data *gic) name = desc->action->name; pr_warn("%s: %d triggered %s\n", __func__, irq, name); + +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.2120730, 2019/07/11 + *Add for: print qrtr debug msg and fix QMI wakeup statistics for QCOM platforms using glink + */ + if(name != NULL) + { + if (strncmp(name, IRQ_NAME_GLINK, strlen(IRQ_NAME_GLINK)) == 0) { + qrtr_first_msg = 1; + } + } +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ + + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY + //Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler + do { + wakeup_reasons_statics(name, WS_CNT_MODEM|WS_CNT_WLAN|WS_CNT_ADSP|WS_CNT_CDSP|WS_CNT_SLPI); + } while(0); + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY */ } } @@ -698,10 +736,18 @@ static int __gic_populate_rdist(struct redist_region *region, void __iomem *ptr) gic_data_rdist_rd_base() = ptr; gic_data_rdist()->phys_base = region->phys_base + offset; +#ifndef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG +//Nanwei.Deng@BSP.power.Basic 2018/05/01 pr_info("CPU%d: found redistributor %lx region %d:%pa\n", smp_processor_id(), mpidr, (int)(region - gic_data.redist_regions), &gic_data_rdist()->phys_base); +#else + pr_debug("CPU%d: found redistributor %lx region %d:%pa\n", + smp_processor_id(), mpidr, + (int)(region - gic_data.redist_regions), + &gic_data_rdist()->phys_base); +#endif return 0; } diff --git a/drivers/irqchip/msm_show_resume_irq.c b/drivers/irqchip/msm_show_resume_irq.c index 6b1d323d6215..58475b9eb068 100644 --- a/drivers/irqchip/msm_show_resume_irq.c +++ b/drivers/irqchip/msm_show_resume_irq.c @@ -15,7 +15,12 @@ #include #include +#ifndef OPLUS_FEATURE_POWERINFO_STANDBY +//Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler int msm_show_resume_irq_mask; +#else +int msm_show_resume_irq_mask = 1; +#endif /*OPLUS_FEATURE_POWERINFO_STANDBY*/ module_param_named( debug_mask, msm_show_resume_irq_mask, int, 0664); diff --git a/drivers/leds/leds-qpnp-vibrator-ldo.c b/drivers/leds/leds-qpnp-vibrator-ldo.c index dd19dd1af64d..071d4af5071b 100644 --- a/drivers/leds/leds-qpnp-vibrator-ldo.c +++ b/drivers/leds/leds-qpnp-vibrator-ldo.c @@ -41,7 +41,11 @@ * Define vibration periods: default(5sec), min(50ms), max(15sec) and * overdrive(30ms). */ -#define QPNP_VIB_MIN_PLAY_MS 50 + +#ifdef OPLUS_FEATURE_CHG_BASIC +/*Murphy@BSP.Kernel.Driver, 2019/04/12, Modify for viber min*/ +#define QPNP_VIB_MIN_PLAY_MS 35 +#endif #define QPNP_VIB_PLAY_MS 5000 #define QPNP_VIB_MAX_PLAY_MS 15000 #define QPNP_VIB_OVERDRIVE_PLAY_MS 30 @@ -207,7 +211,13 @@ static enum hrtimer_restart vib_stop_timer(struct hrtimer *timer) stop_timer); chip->state = 0; + + #ifdef OPLUS_FEATURE_CHG_BASIC + //Murphy@BSP.Kernel.Driver, 2019/04/12, fix sometimes the vibrator shake long time issue + queue_work(system_unbound_wq, &chip->vib_work); + #else schedule_work(&chip->vib_work); + #endif return HRTIMER_NORESTART; } @@ -335,9 +345,17 @@ static ssize_t qpnp_vib_store_activate(struct device *dev, mutex_lock(&chip->lock); hrtimer_cancel(&chip->stop_timer); chip->state = val; - pr_debug("state = %d, time = %llums\n", chip->state, chip->vib_play_ms); + #ifdef OPLUS_FEATURE_CHG_BASIC + /*Murphy@BSP.Kernel.Driver, 2019/04/12, Modify for viber log*/ + pr_info("state = %d, time = %llums\n", chip->state, chip->vib_play_ms); + #endif mutex_unlock(&chip->lock); + #ifdef OPLUS_FEATURE_CHG_BASIC + //Murphy@BSP.Kernel.Driver, 2019/04/12, fix sometimes the vibrator shake long time issue + queue_work(system_unbound_wq, &chip->vib_work); + #else schedule_work(&chip->vib_work); + #endif return count; } diff --git a/drivers/md/dm-android-verity.c b/drivers/md/dm-android-verity.c index 20e05936551f..b776387da182 100644 --- a/drivers/md/dm-android-verity.c +++ b/drivers/md/dm-android-verity.c @@ -505,7 +505,12 @@ static void handle_error(void) int mode = verity_mode(); if (mode == DM_VERITY_MODE_RESTART) { DMERR("triggering restart"); +#ifdef OPLUS_BUG_STABILITY +// Bin.Xu@BSP.Kernel.Stability, 2020/4/15, add feature: feedback 2.0, monitor abnormal restart + panic("dm-verity device corrupted"); +#else kernel_restart("dm-verity device corrupted"); +#endif /* OPLUS_BUG_STABILITY */ } else { DMERR("Mounting verity root failed"); } diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c index 62a5f61a6b65..96095d78188e 100644 --- a/drivers/md/dm-verity-target.c +++ b/drivers/md/dm-verity-target.c @@ -304,7 +304,13 @@ out: #ifdef CONFIG_DM_VERITY_AVB dm_verity_avb_error_handler(); #endif + +#ifdef OPLUS_BUG_STABILITY +// Bin.Xu@BSP.Kernel.Stability, 2020/4/15, add feature: feedback 2.0, monitor abnormal restart + panic("dm-verity device corrupted"); +#else kernel_restart("dm-verity device corrupted"); +#endif /* OPLUS_BUG_STABILITY */ } return 1; diff --git a/drivers/media/platform/msm/Makefile b/drivers/media/platform/msm/Makefile index d49afb351534..95f3fd885f97 100644 --- a/drivers/media/platform/msm/Makefile +++ b/drivers/media/platform/msm/Makefile @@ -7,7 +7,13 @@ obj-$(CONFIG_MSM_NPU) += npu/ obj-$(CONFIG_MSM_NPU_V2) += npu_v2/ obj-$(CONFIG_MSM_VIDC_V4L2) += vidc/ obj-$(CONFIG_MSM_VIDC_3X_V4L2) += vidc_3x/ +ifeq ($(TARGET_PRODUCT),msmnile) +obj-$(CONFIG_SPECTRA_CAMERA) += camera_8150/ +else ifeq ($(TARGET_PRODUCT),sm6150) +obj-$(CONFIG_SPECTRA_CAMERA) += camera_7150/ +else ifeq ($(strip $(TARGET_PRODUCT)),$(filter $(TARGET_PRODUCT),atoll)) obj-$(CONFIG_SPECTRA_CAMERA) += camera/ +endif obj-$(CONFIG_MSM_AIS) += ais/ obj-$(CONFIG_TSPP) += broadcast/ obj-$(CONFIG_DVB_MPQ) += dvb/ diff --git a/drivers/media/platform/msm/ais/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c b/drivers/media/platform/msm/ais/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c index 7d3e0b9e99bb..d9fcac093f3a 100644 --- a/drivers/media/platform/msm/ais/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c +++ b/drivers/media/platform/msm/ais/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c @@ -2859,7 +2859,8 @@ static int cam_ife_csid_release(void *hw_priv, csid_hw->ipp_path_config.measure_enabled = 0; else if (res->res_id == CAM_IFE_PIX_PATH_RES_PPP) csid_hw->ppp_path_config.measure_enabled = 0; - else + else if (res->res_id >= CAM_IFE_PIX_PATH_RES_RDI_0 && + res->res_id <= CAM_IFE_PIX_PATH_RES_RDI_3) csid_hw->rdi_path_config[res->res_id].measure_enabled = 0; break; diff --git a/drivers/media/platform/msm/ais/cam_utils/cam_soc_util.h b/drivers/media/platform/msm/ais/cam_utils/cam_soc_util.h index d0bab027790e..1354e8a5f5c7 100644 --- a/drivers/media/platform/msm/ais/cam_utils/cam_soc_util.h +++ b/drivers/media/platform/msm/ais/cam_utils/cam_soc_util.h @@ -36,8 +36,12 @@ #define CAM_SOC_MAX_BASE CAM_SOC_MAX_BLOCK /* maximum number of device regulator */ +#ifndef VENDOR_EDIT +/*Zhixian.Mai@Cam.Drv, 2019/06/15, modify for add main camera vaf crash problem*/ #define CAM_SOC_MAX_REGULATOR 5 - +#else +#define CAM_SOC_MAX_REGULATOR 6 +#endif /* maximum number of device clock */ #define CAM_SOC_MAX_CLK 32 diff --git a/drivers/media/platform/msm/camera/Makefile b/drivers/media/platform/msm/camera/Makefile index 693163369c08..8fbf22cc8cb8 100644 --- a/drivers/media/platform/msm/camera/Makefile +++ b/drivers/media/platform/msm/camera/Makefile @@ -12,3 +12,13 @@ obj-$(CONFIG_SPECTRA_CAMERA) += cam_icp/ obj-$(CONFIG_SPECTRA_CAMERA) += cam_jpeg/ obj-$(CONFIG_SPECTRA_CAMERA) += cam_fd/ obj-$(CONFIG_SPECTRA_CAMERA) += cam_lrme/ + +#VENDOR_EDIT_START +#bsp not added this flag yet, for early stage, added it for porting +#ifndef VENDOR_EDIT +KBUILD_CFLAGS += -DVENDOR_EDIT +KBUILD_CPPFLAGS += -DVENDOR_EDIT +CFLAGS_KERNEL += -DVENDOR_EDIT +CFLAGS_MODULE += -DVENDOR_EDIT +#endif +#VENDOR_EDIT_END \ No newline at end of file diff --git a/drivers/media/platform/msm/camera/cam_core/cam_context_utils.c b/drivers/media/platform/msm/camera/cam_core/cam_context_utils.c index 60e11681b604..619f8645b274 100644 --- a/drivers/media/platform/msm/camera/cam_core/cam_context_utils.c +++ b/drivers/media/platform/msm/camera/cam_core/cam_context_utils.c @@ -642,7 +642,6 @@ int32_t cam_context_flush_ctx_to_hw(struct cam_context *ctx) ctx->dev_name, ctx->ctx_id); flush_args.num_req_pending = 0; - flush_args.last_flush_req = ctx->last_flush_req; while (true) { spin_lock(&ctx->lock); if (list_empty(&temp_list)) { diff --git a/drivers/media/platform/msm/camera/cam_core/cam_hw_mgr_intf.h b/drivers/media/platform/msm/camera/cam_core/cam_hw_mgr_intf.h index 054f95be7d0d..34b6d0b94130 100644 --- a/drivers/media/platform/msm/camera/cam_core/cam_hw_mgr_intf.h +++ b/drivers/media/platform/msm/camera/cam_core/cam_hw_mgr_intf.h @@ -235,8 +235,6 @@ struct cam_hw_config_args { * @num_req_active: Num request to flush, valid when flush type is REQ * @flush_req_active: Request active pointers to flush * @flush_type: The flush type - * @last_flush_req: last flush req_id notified to hw_mgr for the - * given stream * */ struct cam_hw_flush_args { @@ -246,7 +244,6 @@ struct cam_hw_flush_args { uint32_t num_req_active; void *flush_req_active[20]; enum flush_type_t flush_type; - uint32_t last_flush_req; }; /** diff --git a/drivers/media/platform/msm/camera/cam_cpas/cam_cpas_hw.c b/drivers/media/platform/msm/camera/cam_cpas/cam_cpas_hw.c index a68e20745b1a..f6d429fee4c0 100644 --- a/drivers/media/platform/msm/camera/cam_cpas/cam_cpas_hw.c +++ b/drivers/media/platform/msm/camera/cam_cpas/cam_cpas_hw.c @@ -97,7 +97,7 @@ static int cam_cpas_util_vote_bus_client_bw( if (cam_min_camnoc_ib_bw > 0) min_camnoc_ib_bw = (uint64_t)cam_min_camnoc_ib_bw * 1000000L; - CAM_DBG(CAM_CPAS, "cam_min_camnoc_ib_bw = %d, min_camnoc_ib_bw=%llu", + CAM_INFO(CAM_CPAS, "cam_min_camnoc_ib_bw = %d, min_camnoc_ib_bw=%llu", cam_min_camnoc_ib_bw, min_camnoc_ib_bw); if (!bus_client->valid) { @@ -147,7 +147,7 @@ static int cam_cpas_util_vote_bus_client_bw( path->vectors[0].ab = ab; path->vectors[0].ib = ib; - CAM_DBG(CAM_CPAS, "Bus client=[%d][%s] :ab[%llu] ib[%llu], index[%d]", + CAM_INFO(CAM_CPAS, "Bus client=[%d][%s] :ab[%llu] ib[%llu], index[%d]", bus_client->client_id, bus_client->name, ab, ib, idx); msm_bus_scale_client_update_request(bus_client->client_id, idx); @@ -526,7 +526,6 @@ static int cam_cpas_hw_reg_read(struct cam_hw_info *cpas_hw, if (!CAM_CPAS_CLIENT_VALID(client_indx)) return -EINVAL; - mutex_lock(&cpas_core->client_mutex[client_indx]); cpas_client = cpas_core->cpas_client[client_indx]; if (!CAM_CPAS_CLIENT_STARTED(cpas_core, client_indx)) { @@ -534,7 +533,7 @@ static int cam_cpas_hw_reg_read(struct cam_hw_info *cpas_hw, client_indx, cpas_client->data.identifier, cpas_client->data.cell_index); rc = -EPERM; - goto unlock_client; + return rc; } if (mb) @@ -546,8 +545,6 @@ static int cam_cpas_hw_reg_read(struct cam_hw_info *cpas_hw, *value = reg_value; -unlock_client: - mutex_unlock(&cpas_core->client_mutex[client_indx]); return rc; } @@ -596,7 +593,7 @@ static int cam_cpas_util_set_camnoc_axi_clk_rate( clk_rate = required_camnoc_bw / soc_private->camnoc_bus_width; - CAM_DBG(CAM_CPAS, "Setting camnoc axi clk rate : %llu %lld", + CAM_INFO(CAM_CPAS, "Setting camnoc axi clk rate : %llu %lld", required_camnoc_bw, clk_rate); rc = cam_soc_util_set_src_clk_rate(soc_info, clk_rate); @@ -670,7 +667,7 @@ static int cam_cpas_util_apply_client_axi_vote( axi_port->consolidated_axi_vote.compressed_bw = mnoc_bw; axi_port->consolidated_axi_vote.uncompressed_bw = camnoc_bw; - CAM_DBG(CAM_CPAS, + CAM_INFO(CAM_CPAS, "axi[(%d, %d),(%d, %d)] : camnoc_bw[%llu], mnoc_bw[ab: %llu, ib: %llu]", axi_port->mnoc_bus.src, axi_port->mnoc_bus.dst, axi_port->camnoc_bus.src, axi_port->camnoc_bus.dst, diff --git a/drivers/media/platform/msm/camera/cam_hyp_intf/cam_hyp_intf.c b/drivers/media/platform/msm/camera/cam_hyp_intf/cam_hyp_intf.c index 99b52d878df1..20ba313c4ed7 100644 --- a/drivers/media/platform/msm/camera/cam_hyp_intf/cam_hyp_intf.c +++ b/drivers/media/platform/msm/camera/cam_hyp_intf/cam_hyp_intf.c @@ -317,13 +317,11 @@ static long cam_hyp_intf_ioctl(struct file *filp, unsigned int cmd, if (!(_IOC_TYPE(cmd) == MSM_CAM_HYP_INTF_IOCTL_MAGIC && _IOC_NR(cmd) <= MSM_CAM_HYP_INTF_IOCTL_MAX)) { - CAM_ERR(CAM_HYP, "Invalid command %d", cmd); + CAM_ERR(CAM_HYP, "Invalid command"); rc = -EINVAL; goto err; } - switch (cmd) { - case MSM_CAM_HYP_INTF_IOCTL_GET_HYP_HANDLE: dir = _IOC_DIR(cmd); if (dir & _IOC_WRITE) { if (copy_from_user(&data, @@ -341,30 +339,30 @@ static long cam_hyp_intf_ioctl(struct file *filp, unsigned int cmd, cam_hyp_intf_dev = filp->private_data; mutex_lock(&cam_hyp_intf_dev->hyp_intf_lock); + switch (cmd) { + case MSM_CAM_HYP_INTF_IOCTL_GET_HYP_HANDLE: rc = cam_hyp_intf_get_mem_handle(cam_hyp_intf_dev, data.hyp_handle.fd, &(data.hyp_handle.handle)); if (rc < 0) { CAM_ERR(CAM_HYP, "Failed in hyp calls(rc %ld)", rc); - mutex_unlock(&cam_hyp_intf_dev->hyp_intf_lock); goto err; } if (copy_to_user((void __user *)arg, &data, _IOC_SIZE(cmd))) { CAM_ERR(CAM_HYP, "Failed to copy to user"); rc = -EFAULT; - mutex_unlock(&cam_hyp_intf_dev->hyp_intf_lock); goto err; } - mutex_unlock(&cam_hyp_intf_dev->hyp_intf_lock); break; default: - CAM_ERR(CAM_HYP, "Invalid command %d", cmd); + CAM_ERR(CAM_HYP, "invalid command"); rc = -EINVAL; } err: + mutex_unlock(&cam_hyp_intf_dev->hyp_intf_lock); return rc; } diff --git a/drivers/media/platform/msm/camera/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c b/drivers/media/platform/msm/camera/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c index c27aad7ef557..502ee00c3c76 100644 --- a/drivers/media/platform/msm/camera/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c +++ b/drivers/media/platform/msm/camera/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c @@ -2674,93 +2674,11 @@ static int cam_icp_mgr_hfi_resume(struct cam_icp_hw_mgr *hw_mgr) hw_mgr->a5_jtag_debug); } -static int cam_icp_retry_wait_for_abort( - struct cam_icp_hw_ctx_data *ctx_data) -{ - int retry_cnt = 1; - unsigned long rem_jiffies; - int timeout = 1000; - - CAM_WARN(CAM_ICP, "FW timeout in abort ctx: %u retry_left: %d", - ctx_data->ctx_id, retry_cnt); - while (retry_cnt > 0) { - rem_jiffies = wait_for_completion_timeout( - &ctx_data->wait_complete, - msecs_to_jiffies((timeout))); - if (!rem_jiffies) { - retry_cnt--; - if (retry_cnt > 0) { - CAM_WARN(CAM_ICP, - "FW timeout in abort ctx: %u retry_left: %u", - ctx_data->ctx_id, retry_cnt); - continue; - } - } - - if (retry_cnt > 0) - return 0; - } - - return -ETIMEDOUT; -} - -static int cam_icp_mgr_abort_handle_wq( - void *priv, void *data) -{ - int rc; - size_t packet_size; - struct hfi_cmd_work_data *task_data = NULL; - struct cam_icp_hw_ctx_data *ctx_data; - struct hfi_cmd_ipebps_async *abort_cmd; - - if (!data || !priv) { - CAM_ERR(CAM_ICP, "Invalid params %pK %pK", data, priv); - return -EINVAL; - } - - task_data = (struct hfi_cmd_work_data *)data; - ctx_data = - (struct cam_icp_hw_ctx_data *)task_data->data; - packet_size = - sizeof(struct hfi_cmd_ipebps_async) + - sizeof(struct hfi_cmd_abort) - - sizeof(((struct hfi_cmd_ipebps_async *)0)->payload.direct); - abort_cmd = kzalloc(packet_size, GFP_KERNEL); - CAM_DBG(CAM_ICP, "abort pkt size = %d", (int) packet_size); - if (!abort_cmd) { - rc = -ENOMEM; - return rc; - } - - abort_cmd->size = packet_size; - abort_cmd->pkt_type = HFI_CMD_IPEBPS_ASYNC_COMMAND_DIRECT; - if (ctx_data->icp_dev_acquire_info->dev_type == CAM_ICP_RES_TYPE_BPS) - abort_cmd->opcode = HFI_IPEBPS_CMD_OPCODE_BPS_ABORT; - else - abort_cmd->opcode = HFI_IPEBPS_CMD_OPCODE_IPE_ABORT; - - abort_cmd->num_fw_handles = 1; - abort_cmd->fw_handles[0] = ctx_data->fw_handle; - abort_cmd->user_data1 = PTR_TO_U64(ctx_data); - abort_cmd->user_data2 = (uint64_t)0x0; - - rc = hfi_write_cmd(abort_cmd); - if (rc) { - kfree(abort_cmd); - return rc; - } - CAM_DBG(CAM_ICP, "fw_handle = %x ctx_data = %pK ctx_id %d", - ctx_data->fw_handle, ctx_data, ctx_data->ctx_id); - - kfree(abort_cmd); - return rc; -} - static int cam_icp_mgr_abort_handle( struct cam_icp_hw_ctx_data *ctx_data) { int rc = 0; - unsigned long rem_jiffies = 0; + unsigned long rem_jiffies; size_t packet_size; int timeout = 1000; struct hfi_cmd_ipebps_async *abort_cmd; @@ -2892,7 +2810,6 @@ static int cam_icp_mgr_release_ctx(struct cam_icp_hw_mgr *hw_mgr, int ctx_id) hw_mgr->ctx_data[ctx_id].fw_handle = 0; hw_mgr->ctx_data[ctx_id].scratch_mem_size = 0; - hw_mgr->ctx_data[ctx_id].last_flush_req = 0; for (i = 0; i < CAM_FRAME_CMD_MAX; i++) clear_bit(i, hw_mgr->ctx_data[ctx_id].hfi_frame_process.bitmap); kfree(hw_mgr->ctx_data[ctx_id].hfi_frame_process.bitmap); @@ -3500,10 +3417,6 @@ static int cam_icp_mgr_config_hw(void *hw_mgr_priv, void *config_hw_args) CAM_ERR(CAM_ICP, "Fail to send reconfig io cmd"); } - if (req_id <= ctx_data->last_flush_req) - CAM_WARN(CAM_ICP, - "Anomaly submitting flushed req %llu [last_flush %llu] in ctx %u", - req_id, ctx_data->last_flush_req, ctx_data->ctx_id); rc = cam_icp_mgr_enqueue_config(hw_mgr, config_args); if (rc) goto config_err; @@ -4522,46 +4435,6 @@ static int cam_icp_mgr_flush_req(struct cam_icp_hw_ctx_data *ctx_data, return 0; } -static int cam_icp_mgr_enqueue_abort( - struct cam_icp_hw_ctx_data *ctx_data) -{ - int timeout = 1000, rc; - unsigned long rem_jiffies = 0; - struct hfi_cmd_work_data *task_data; - struct crm_workq_task *task; - - task = cam_req_mgr_workq_get_task(icp_hw_mgr.cmd_work); - if (!task) { - CAM_ERR(CAM_ICP, "no empty task"); - return -ENOMEM; - } - - reinit_completion(&ctx_data->wait_complete); - task_data = (struct hfi_cmd_work_data *)task->payload; - task_data->data = (void *)ctx_data; - task_data->type = ICP_WORKQ_TASK_CMD_TYPE; - task->process_cb = cam_icp_mgr_abort_handle_wq; - cam_req_mgr_workq_enqueue_task(task, &icp_hw_mgr, - CRM_TASK_PRIORITY_0); - - rem_jiffies = wait_for_completion_timeout(&ctx_data->wait_complete, - msecs_to_jiffies((timeout))); - if (!rem_jiffies) { - rc = cam_icp_retry_wait_for_abort(ctx_data); - if (rc) { - CAM_ERR(CAM_ICP, - "FW timeout/err in abort handle command ctx: %u", - ctx_data->ctx_id); - cam_icp_mgr_process_dbg_buf(icp_hw_mgr.a5_dbg_lvl); - cam_hfi_queue_dump(); - return rc; - } - } - - CAM_DBG(CAM_ICP, "Abort after flush is success"); - return 0; -} - static int cam_icp_mgr_hw_dump(void *hw_priv, void *hw_dump_args) { struct cam_hw_dump_args *dump_args = hw_dump_args; @@ -4680,10 +4553,8 @@ static int cam_icp_mgr_hw_flush(void *hw_priv, void *hw_flush_args) return -EINVAL; } - ctx_data->last_flush_req = flush_args->last_flush_req; - CAM_DBG(CAM_REQ, "ctx_id %d Flush type %d last_flush_req %u", - ctx_data->ctx_id, flush_args->flush_type, - ctx_data->last_flush_req); + CAM_DBG(CAM_REQ, "ctx_id %d Flush type %d", + ctx_data->ctx_id, flush_args->flush_type); switch (flush_args->flush_type) { case CAM_FLUSH_TYPE_ALL: @@ -4691,7 +4562,7 @@ static int cam_icp_mgr_hw_flush(void *hw_priv, void *hw_flush_args) if (!atomic_read(&hw_mgr->recovery) && flush_args->num_req_active) { mutex_unlock(&hw_mgr->hw_mgr_mutex); - cam_icp_mgr_enqueue_abort(ctx_data); + cam_icp_mgr_abort_handle(ctx_data); } else { mutex_unlock(&hw_mgr->hw_mgr_mutex); } diff --git a/drivers/media/platform/msm/camera/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.h b/drivers/media/platform/msm/camera/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.h index 1a9f8f20ca2c..7219f2be947c 100644 --- a/drivers/media/platform/msm/camera/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.h +++ b/drivers/media/platform/msm/camera/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -219,7 +219,6 @@ struct cam_ctx_clk_info { * @watch_dog: watchdog timer handle * @watch_dog_reset_counter: Counter for watch dog reset * @icp_dev_io_info: io config resource - * @last_flush_req: last flush req for this ctx */ struct cam_icp_hw_ctx_data { void *context_priv; @@ -240,7 +239,6 @@ struct cam_icp_hw_ctx_data { struct cam_req_mgr_timer *watch_dog; uint32_t watch_dog_reset_counter; struct cam_icp_acquire_dev_info icp_dev_io_info; - uint64_t last_flush_req; }; /** diff --git a/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c b/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c index ed15e2d0a849..0409a704cec5 100644 --- a/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c +++ b/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -343,23 +343,6 @@ put: } } -static void __cam_isp_ctx_dequeue_request(struct cam_context *ctx, - struct cam_ctx_request *req) -{ - struct cam_ctx_request *req_current; - struct cam_ctx_request *req_prev; - - spin_lock_bh(&ctx->lock); - list_for_each_entry_safe_reverse(req_current, req_prev, - &ctx->pending_req_list, list) { - if (req->request_id == req_current->request_id) { - list_del_init(&req_current->list); - break; - } - } - spin_unlock_bh(&ctx->lock); -} - static int __cam_isp_ctx_enqueue_request_in_order( struct cam_context *ctx, struct cam_ctx_request *req) { @@ -610,21 +593,11 @@ static int __cam_isp_ctx_handle_buf_done_in_activated_state( trace_cam_buf_done("ISP", ctx, req); req_isp = (struct cam_isp_ctx_req *) req->req_priv; - - if (ctx_isp->active_req_cnt == 1) - ctx_isp->irq_delay_detect = false; - if (ctx_isp->frame_id == 1) ctx_isp->irq_timestamps = done->irq_mono_boot_time; else if (ctx_isp->fps && ((done->irq_mono_boot_time - - ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) { + ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) ctx_isp->irq_delay_detect = true; - trace_cam_isp_irq_delay_detect("IRQ delay at buf_done", - ctx, req->request_id, - ctx_isp->substate_activated, - (done->irq_mono_boot_time - - ctx_isp->irq_timestamps)); - } ctx_isp->irq_timestamps = done->irq_mono_boot_time; @@ -717,8 +690,10 @@ static int __cam_isp_ctx_handle_buf_done_in_activated_state( list_del_init(&req->list); list_add(&req->list, &ctx->pending_req_list); atomic_set(&ctx_isp->process_bubble, 0); +#ifdef VENDOR_EDIT + //Shouyao.Xiong@cam 20200515 fix for bubble can't recovery case:04602392 ctx_isp->bubble_frame_cnt = 0; - +#endif CAM_DBG(CAM_REQ, "Move active request %lld to pending list(cnt = %d) [bubble recovery], ctx %u", req->request_id, ctx_isp->active_req_cnt, ctx->ctx_id); @@ -874,17 +849,9 @@ static int __cam_isp_ctx_reg_upd_in_epoch_state( if (ctx_isp->frame_id == 1) ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time; else if (ctx_isp->fps && ((rup_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) { + ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) ctx_isp->irq_delay_detect = true; - if (req) - trace_cam_isp_irq_delay_detect("IRQ delay at reg_upd", - ctx, req->request_id, - ctx_isp->substate_activated, - (rup_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps)); - } - ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time; return 0; } @@ -937,14 +904,8 @@ static int __cam_isp_ctx_reg_upd_in_activated_state( if (ctx_isp->frame_id == 1) ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time; else if (ctx_isp->fps && ((rup_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) { + ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) ctx_isp->irq_delay_detect = true; - trace_cam_isp_irq_delay_detect("IRQ delay at reg_upd", - ctx, req->request_id, - ctx_isp->substate_activated, - (rup_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps)); - } ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time; end: @@ -968,9 +929,9 @@ static int __cam_isp_ctx_notify_sof_in_activated_state( * In this case, we need to skip the current notification. This * helps the state machine to catch up the delay. */ - +#ifdef VENDOR_EDIT + //Shouyao.Xiong@cam 20200515 fix for bubble can't recovery case:04602392 if (atomic_read(&ctx_isp->process_bubble)) { - if (list_empty(&ctx->active_req_list)) { CAM_ERR(CAM_ISP, "No available active req in bubble"); @@ -1005,6 +966,7 @@ static int __cam_isp_ctx_notify_sof_in_activated_state( CAM_DBG(CAM_ISP, "Delayed bufdone for req: %lld", req->request_id); } +#endif if (ctx->ctx_crm_intf && ctx->ctx_crm_intf->notify_trigger && ctx_isp->active_req_cnt <= 2) { if (ctx_isp->subscribe_event & CAM_TRIGGER_POINT_SOF) { @@ -1118,14 +1080,8 @@ static int __cam_isp_ctx_sof_in_activated_state( if (ctx_isp->frame_id == 1) ctx_isp->irq_timestamps = sof_event_data->irq_mono_boot_time; else if (ctx_isp->fps && ((sof_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) { + ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) ctx_isp->irq_delay_detect = true; - trace_cam_isp_irq_delay_detect("IRQ delay at sof", - ctx, req->request_id, - ctx_isp->substate_activated, - (sof_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps)); - } ctx_isp->irq_timestamps = sof_event_data->irq_mono_boot_time; @@ -1171,14 +1127,8 @@ static int __cam_isp_ctx_reg_upd_in_sof(struct cam_isp_context *ctx_isp, if (ctx_isp->frame_id == 1) ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time; else if (ctx_isp->fps && ((rup_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) { + ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) ctx_isp->irq_delay_detect = true; - trace_cam_isp_irq_delay_detect("IRQ delay at reg_upd", - ctx, req->request_id, - ctx_isp->substate_activated, - (rup_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps)); - } ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time; end: @@ -1267,14 +1217,8 @@ end: ctx_isp->irq_timestamps = epoch_hw_event_data->irq_mono_boot_time; else if (ctx_isp->fps && ((epoch_hw_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) { + ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) ctx_isp->irq_delay_detect = true; - trace_cam_isp_irq_delay_detect("IRQ delay at epoch", - ctx, req->request_id, - ctx_isp->substate_activated, - (epoch_hw_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps)); - } ctx_isp->irq_timestamps = epoch_hw_event_data->irq_mono_boot_time; @@ -1313,14 +1257,8 @@ static int __cam_isp_ctx_sof_in_epoch(struct cam_isp_context *ctx_isp, if (ctx_isp->frame_id == 1) ctx_isp->irq_timestamps = sof_event_data->irq_mono_boot_time; else if (ctx_isp->fps && ((sof_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) { + ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) ctx_isp->irq_delay_detect = true; - trace_cam_isp_irq_delay_detect("IRQ delay at sof", - ctx, 0, - ctx_isp->substate_activated, - (sof_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps)); - } ctx_isp->irq_timestamps = sof_event_data->irq_mono_boot_time; @@ -1403,7 +1341,10 @@ static int __cam_isp_ctx_epoch_in_bubble_applied( notify.req_id = req->request_id; notify.error = CRM_KMD_ERR_BUBBLE; ctx->ctx_crm_intf->notify_err(¬ify); +#ifdef VENDOR_EDIT + //Shouyao.Xiong@cam 20200515 fix for bubble can't recovery case:04602392 atomic_set(&ctx_isp->process_bubble, 1); +#endif CAM_DBG(CAM_REQ, "Notify CRM about Bubble req_id %llu frame %lld, ctx %u", req->request_id, ctx_isp->frame_id, ctx->ctx_id); @@ -1475,7 +1416,7 @@ static int __cam_isp_ctx_handle_error(struct cam_isp_context *ctx_isp, struct cam_isp_ctx_req *req_isp = NULL; struct cam_isp_ctx_req *req_isp_to_report = NULL; struct cam_req_mgr_error_notify notify; - uint64_t error_request_id = 0; + uint64_t error_request_id; struct cam_hw_fence_map_entry *fence_map_out = NULL; struct cam_req_mgr_message req_msg; @@ -2139,7 +2080,7 @@ static int __cam_isp_ctx_apply_req_in_activated_state( req->request_id, ctx_isp->substate_activated, ctx->ctx_id); req_isp = (struct cam_isp_ctx_req *) req->req_priv; - if (ctx_isp->active_req_cnt >= 4) { + if (ctx_isp->active_req_cnt >= 2) { CAM_ERR_RATE_LIMIT(CAM_ISP, "Reject apply request (id %lld) due to congestion(cnt = %d) ctx %u", req->request_id, @@ -2538,20 +2479,23 @@ static int __cam_isp_ctx_flush_req_in_top_state( if (rc) goto end; + spin_lock_bh(&ctx->lock); +#ifdef VENDOR_EDIT + //Shouyao.Xiong@cam 20200519 fix flush block issue by qcom case 04602392 /* * As HW is stopped already No request will move from * one list to other good time to flush reqs. */ - spin_lock_bh(&ctx->lock); CAM_DBG(CAM_ISP, "try to flush pending list"); rc = __cam_isp_ctx_flush_req(ctx, &ctx->pending_req_list, flush_req); +#endif CAM_DBG(CAM_ISP, "try to flush wait list"); rc = __cam_isp_ctx_flush_req(ctx, &ctx->wait_req_list, - flush_req); + flush_req); CAM_DBG(CAM_ISP, "try to flush active list"); rc = __cam_isp_ctx_flush_req(ctx, &ctx->active_req_list, - flush_req); + flush_req); ctx_isp->active_req_cnt = 0; spin_unlock_bh(&ctx->lock); @@ -2566,7 +2510,10 @@ static int __cam_isp_ctx_flush_req_in_top_state( } end: +#ifdef VENDOR_EDIT + //Shouyao.Xiong@cam 20200515 fix for bubble can't recovery case:04602392 ctx_isp->bubble_frame_cnt = 0; +#endif ctx_isp->substate_activated = CAM_ISP_CTX_ACTIVATED_SOF; return rc; } @@ -3384,7 +3331,13 @@ static int __cam_isp_ctx_config_dev_in_top_state( CAM_INFO(CAM_ISP, "request %lld has been flushed, reject packet", packet->header.request_id); + +#ifdef VENDOR_EDIT + //Shouyao.Xiong@cam 20200605 merge qcom patch to fix flush block issue case 04611022 rc = -EBADR; +#else + rc = -EINVAL; +#endif goto free_cpu_buf; } @@ -3455,12 +3408,13 @@ static int __cam_isp_ctx_config_dev_in_top_state( add_req.dev_hdl = ctx->dev_hdl; add_req.req_id = req->request_id; add_req.skip_before_applying = 0; - __cam_isp_ctx_enqueue_request_in_order(ctx, req); rc = ctx->ctx_crm_intf->add_req(&add_req); if (rc) { CAM_ERR(CAM_ISP, "Add req failed: req id=%llu", req->request_id); - __cam_isp_ctx_dequeue_request(ctx, req); + } else { + __cam_isp_ctx_enqueue_request_in_order( + ctx, req); } } else { rc = -EINVAL; @@ -3920,7 +3874,10 @@ static int __cam_isp_ctx_start_dev_in_ready(struct cam_context *ctx, atomic_set(&ctx_isp->process_bubble, 0); ctx_isp->frame_id = 0; ctx_isp->active_req_cnt = 0; +#ifdef VENDOR_EDIT + //Shouyao.Xiong@cam 20200515 fix for bubble can't recovery case:04602392 ctx_isp->bubble_frame_cnt = 0; +#endif ctx_isp->req_info.reported_req_id = 0; ctx_isp->substate_activated = ctx_isp->rdi_only_context ? CAM_ISP_CTX_ACTIVATED_APPLIED : @@ -4059,7 +4016,10 @@ static int __cam_isp_ctx_stop_dev_in_activated_unlock( ctx_isp->req_info.last_applied_time_stamp = 0; ctx_isp->req_info.last_bufdone_time_stamp = 0; ctx_isp->req_info.last_reported_id_time_stamp = 0; +#ifdef VENDOR_EDIT + //Shouyao.Xiong@cam 20200515 fix for bubble can't recovery case:04602392 ctx_isp->bubble_frame_cnt = 0; +#endif atomic_set(&ctx_isp->process_bubble, 0); @@ -4443,7 +4403,10 @@ int cam_isp_context_init(struct cam_isp_context *ctx, ctx->base = ctx_base; ctx->frame_id = 0; ctx->active_req_cnt = 0; +#ifdef VENDOR_EDIT + //Shouyao.Xiong@cam 20200515 fix for bubble can't recovery case:04602392 ctx->bubble_frame_cnt = 0; +#endif ctx->req_info.reported_req_id = 0; ctx->req_info.last_applied_req_id = 0; ctx->req_info.last_bufdone_req_id = 0; diff --git a/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.h b/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.h index 5675c5ee811b..61dbda0bc151 100644 --- a/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.h +++ b/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -272,7 +272,10 @@ struct cam_isp_context { bool irq_delay_detect; uint64_t irq_timestamps; uint32_t fps; - uint32_t bubble_frame_cnt; +#ifdef VENDOR_EDIT + //Shouyao.Xiong@cam 20200515 fix for bubble can't recovery case:04602392 + int32_t bubble_frame_cnt; +#endif }; /** diff --git a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c index 0e9c34e52976..b326dbfc8399 100644 --- a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c +++ b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c @@ -1808,36 +1808,18 @@ err: static int cam_ife_mgr_check_and_update_fe( struct cam_ife_hw_mgr_ctx *ife_ctx, - struct cam_isp_acquire_hw_info *acquire_hw_info, - uint32_t acquire_info_size) + struct cam_isp_acquire_hw_info *acquire_hw_info) { int i; struct cam_isp_in_port_info *in_port = NULL; uint32_t in_port_length = 0; uint32_t total_in_port_length = 0; - if (acquire_hw_info->input_info_offset >= - acquire_hw_info->input_info_size) { - CAM_ERR(CAM_ISP, - "Invalid size offset 0x%x is greater then size 0x%x", - acquire_hw_info->input_info_offset, - acquire_hw_info->input_info_size); - return -EINVAL; - } - in_port = (struct cam_isp_in_port_info *) ((uint8_t *)&acquire_hw_info->data + acquire_hw_info->input_info_offset); for (i = 0; i < acquire_hw_info->num_inputs; i++) { - if (((uint8_t *)in_port + - sizeof(struct cam_isp_in_port_info)) > - ((uint8_t *)acquire_hw_info + - acquire_info_size)) { - CAM_ERR(CAM_ISP, "Invalid size"); - return -EINVAL; - } - if ((in_port->num_out_res > CAM_IFE_HW_OUT_RES_MAX) || (in_port->num_out_res <= 0)) { CAM_ERR(CAM_ISP, "Invalid num output res %u", @@ -2097,8 +2079,7 @@ static int cam_ife_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args) acquire_hw_info = (struct cam_isp_acquire_hw_info *)acquire_args->acquire_info; - rc = cam_ife_mgr_check_and_update_fe(ife_ctx, acquire_hw_info, - acquire_args->acquire_info_size); + rc = cam_ife_mgr_check_and_update_fe(ife_ctx, acquire_hw_info); if (rc) { CAM_ERR(CAM_ISP, "buffer size is not enough"); goto free_cdm; @@ -5084,8 +5065,7 @@ static int cam_ife_hw_mgr_get_err_type( core_idx = evt_payload->core_index; evt_payload->evt_id = CAM_ISP_HW_EVENT_ERROR; - evt_payload->enable_reg_dump = - g_ife_hw_mgr.debug_cfg.enable_reg_dump; + evt_payload->enable_reg_dump = true; list_for_each_entry(isp_ife_camif_res, &ife_hwr_mgr_ctx->res_list_ife_src, list) { diff --git a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/hw_utils/irq_controller/cam_irq_controller.c b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/hw_utils/irq_controller/cam_irq_controller.c index e6a0e015963c..02344d790423 100644 --- a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/hw_utils/irq_controller/cam_irq_controller.c +++ b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/hw_utils/irq_controller/cam_irq_controller.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -511,8 +511,8 @@ int cam_irq_controller_unsubscribe_irq(void *irq_controller, } } + priority = evt_handler->priority; if (found) { - priority = evt_handler->priority; for (i = 0; i < controller->num_registers; i++) { irq_register = &controller->irq_register_arr[i]; irq_register->top_half_enable_mask[priority] &= diff --git a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_csid_ppi_core.c b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_csid_ppi_core.c index 2352b8891b9c..fa8becbfec50 100644 --- a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_csid_ppi_core.c +++ b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_csid_ppi_core.c @@ -73,6 +73,13 @@ static int cam_csid_ppi_enable_hw(struct cam_csid_ppi_hw *ppi_hw) CAM_DBG(CAM_ISP, "PPI:%d init PPI HW", ppi_hw->hw_intf->hw_idx); + ppi_hw->hw_info->open_count++; + if (ppi_hw->hw_info->open_count > 1) { + CAM_DBG(CAM_ISP, "PPI:%d dual vfe already enabled", + ppi_hw->hw_intf->hw_idx); + return 0; + } + for (i = 0; i < soc_info->num_clk; i++) { /* Passing zero in clk_rate results in setting no clk_rate */ rc = cam_soc_util_clk_enable(soc_info->clk[i], @@ -109,6 +116,7 @@ clk_disable: for (--i; i >= 0; i--) cam_soc_util_clk_disable(soc_info->clk[i], soc_info->clk_name[i]); + ppi_hw->hw_info->open_count--; return rc; } @@ -123,6 +131,18 @@ static int cam_csid_ppi_disable_hw(struct cam_csid_ppi_hw *ppi_hw) CAM_DBG(CAM_ISP, "PPI:%d De-init PPI HW", ppi_hw->hw_intf->hw_idx); + if (!ppi_hw->hw_info->open_count) { + CAM_WARN(CAM_ISP, "ppi[%d] unbalanced disable hw", + ppi_hw->hw_intf->hw_idx); + return -EINVAL; + } + /* Decrement the ref count */ + ppi_hw->hw_info->open_count--; + + /* Check for ref count */ + if (ppi_hw->hw_info->open_count) + return rc; + soc_info = &ppi_hw->hw_info->soc_info; ppi_reg = ppi_hw->ppi_info->ppi_reg; diff --git a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c index 27311e862b60..53443258b26f 100644 --- a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c +++ b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c @@ -1442,8 +1442,8 @@ static int cam_ife_csid_enable_csi2( csid_reg = csid_hw->csid_info->csid_reg; soc_info = &csid_hw->hw_info->soc_info; - CAM_DBG(CAM_ISP, "CSID:%d count:%d config csi2 rx res_id:%d", - csid_hw->hw_intf->hw_idx, csid_hw->csi2_cfg_cnt, res->res_id); + CAM_DBG(CAM_ISP, "CSID:%d count:%d config csi2 rx", + csid_hw->hw_intf->hw_idx, csid_hw->csi2_cfg_cnt); /* overflow check before increment */ if (csid_hw->csi2_cfg_cnt == UINT_MAX) { @@ -1453,7 +1453,6 @@ static int cam_ife_csid_enable_csi2( } cid_data = (struct cam_ife_csid_cid_data *)res->res_priv; - cid_data->init_cnt++; res->res_state = CAM_ISP_RESOURCE_STATE_STREAMING; csid_hw->csi2_cfg_cnt++; @@ -1559,7 +1558,6 @@ static int cam_ife_csid_disable_csi2( const struct cam_ife_csid_reg_offset *csid_reg; struct cam_hw_soc_info *soc_info; uint32_t ppi_index = 0; - struct cam_ife_csid_cid_data *cid_data; if (res->res_id >= CAM_IFE_CSID_CID_MAX) { CAM_ERR(CAM_ISP, "CSID:%d Invalid res id :%d", @@ -1569,20 +1567,12 @@ static int cam_ife_csid_disable_csi2( csid_reg = csid_hw->csid_info->csid_reg; soc_info = &csid_hw->hw_info->soc_info; - cid_data = (struct cam_ife_csid_cid_data *)res->res_priv; - CAM_DBG(CAM_ISP, "CSID:%d cnt : %d Disable csi2 rx res->res_id:%d", - csid_hw->hw_intf->hw_idx, csid_hw->csi2_cfg_cnt, res->res_id); - - if (cid_data->init_cnt) - cid_data->init_cnt--; - if (!cid_data->init_cnt) - res->res_state = CAM_ISP_RESOURCE_STATE_RESERVED; + CAM_DBG(CAM_ISP, "CSID:%d cnt : %d Disable csi2 rx", + csid_hw->hw_intf->hw_idx, csid_hw->csi2_cfg_cnt); if (csid_hw->csi2_cfg_cnt) csid_hw->csi2_cfg_cnt--; - CAM_DBG(CAM_ISP, "res_id %d res_state=%d", - res->res_id, res->res_state); if (csid_hw->csi2_cfg_cnt) return 0; @@ -2778,7 +2768,17 @@ static int cam_ife_csid_release(void *hw_priv, csid_hw->hw_intf->hw_idx, res->res_type, res->res_id, res->res_state); +#ifdef VENDOR_EDIT + /*wangyongwu@camera copy from 7250 modify to fix case 4329446 for monkey*/ + if (res->res_type != CAM_ISP_RESOURCE_CID) { + goto end; + } else { + cid_data = (struct cam_ife_csid_cid_data *) res->res_priv; + CAM_WARN(CAM_ISP, "cid data cnt %d", cid_data->cnt); + } +#else goto end; +#endif } CAM_DBG(CAM_ISP, "CSID:%d res type :%d Resource id:%d", diff --git a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.h b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.h index 667fe869c327..d7ca4ed4cce2 100644 --- a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.h +++ b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -409,7 +409,6 @@ struct cam_ife_csid_tpg_cfg { * @dt: Data type * @cnt: Cid resource reference count. * @tpg_set: Tpg used for this cid resource - * @init_cnt cid resource init count * */ struct cam_ife_csid_cid_data { @@ -417,7 +416,6 @@ struct cam_ife_csid_cid_data { uint32_t dt; uint32_t cnt; uint32_t tpg_set; - uint32_t init_cnt; }; /** diff --git a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_soc.h b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_soc.h index 1ceb49ef5e69..97cab07c7ea2 100644 --- a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_soc.h +++ b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_soc.h @@ -40,6 +40,7 @@ struct cam_vfe_soc_private { struct clk *dsp_clk; int32_t dsp_clk_index; int32_t dsp_clk_rate; + uint64_t ife_clk_src; }; /* diff --git a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe170.h b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe170.h index dc1ee4cd4cac..c85847cb2968 100644 --- a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe170.h +++ b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe170.h @@ -80,7 +80,7 @@ static struct cam_vfe_camif_reg_data vfe_170_camif_reg_data = { .reg_update_irq_mask = 0x00000010, .eof_irq_mask = 0x00000002, .error_irq_mask0 = 0x0003FC00, - .error_irq_mask1 = 0x0FFF7E80, + .error_irq_mask1 = 0x0FFF7EBC, .enable_diagnostic_hw = 0x1, }; @@ -314,6 +314,14 @@ static struct cam_vfe_rdi_reg_data vfe_170_rdi_2_data = { .reg_update_irq_mask = 0x80, }; +static struct cam_vfe_rdi_overflow_status vfe170_rdi_irq_status = { + .rdi0_overflow_mask = 0x8, + .rdi1_overflow_mask = 0x10, + .rdi2_overflow_mask = 0x18, + .rdi3_overflow_mask = 0x20, + .rdi_overflow_mask = 0x3c, +}; + static struct cam_vfe_top_ver2_hw_info vfe170_top_hw_info = { .common_reg = &vfe170_top_common_reg, .camif_hw_info = { @@ -329,6 +337,7 @@ static struct cam_vfe_top_ver2_hw_info vfe170_top_hw_info = { .rdi_hw_info = { .common_reg = &vfe170_top_common_reg, .rdi_reg = &vfe170_rdi_reg, + .rdi_irq_status = &vfe170_rdi_irq_status, .reg_data = { &vfe_170_rdi_0_data, &vfe_170_rdi_1_data, diff --git a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe175.h b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe175.h index 2bdbd2435ef0..bc191e3c01e0 100644 --- a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe175.h +++ b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe175.h @@ -81,7 +81,7 @@ static struct cam_vfe_camif_reg_data vfe_175_camif_reg_data = { .reg_update_irq_mask = 0x00000010, .eof_irq_mask = 0x00000002, .error_irq_mask0 = 0x0003FC00, - .error_irq_mask1 = 0xEFFF7E80, + .error_irq_mask1 = 0xEFFF7EBC, .enable_diagnostic_hw = 0x1, }; diff --git a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe175_130.h b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe175_130.h index 83e9278addbe..45e5ad63b580 100644 --- a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe175_130.h +++ b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe175_130.h @@ -82,7 +82,7 @@ static struct cam_vfe_camif_reg_data vfe_175_130_camif_reg_data = { .reg_update_irq_mask = 0x00000010, .eof_irq_mask = 0x00000002, .error_irq_mask0 = 0x0003FC00, - .error_irq_mask1 = 0xEFFF7E80, + .error_irq_mask1 = 0xEFFF7EBC, .enable_diagnostic_hw = 0x1, }; @@ -396,6 +396,14 @@ static struct cam_vfe_rdi_reg_data vfe_175_130_rdi_2_data = { .reg_update_irq_mask = 0x80, }; +static struct cam_vfe_rdi_overflow_status vfe175_130_rdi_irq_status = { + .rdi0_overflow_mask = 0x8, + .rdi1_overflow_mask = 0x10, + .rdi2_overflow_mask = 0x18, + .rdi3_overflow_mask = 0x20, + .rdi_overflow_mask = 0x3c, +}; + static struct cam_vfe_top_ver2_hw_info vfe175_130_top_hw_info = { .common_reg = &vfe175_130_top_common_reg, .camif_hw_info = { @@ -411,6 +419,7 @@ static struct cam_vfe_top_ver2_hw_info vfe175_130_top_hw_info = { .rdi_hw_info = { .common_reg = &vfe175_130_top_common_reg, .rdi_reg = &vfe175_130_rdi_reg, + .rdi_irq_status = &vfe175_130_rdi_irq_status, .reg_data = { &vfe_175_130_rdi_0_data, &vfe_175_130_rdi_1_data, diff --git a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe_lite17x.h b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe_lite17x.h index 9767f9716581..7f9dfc9ec2e2 100644 --- a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe_lite17x.h +++ b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe_lite17x.h @@ -87,6 +87,14 @@ static struct cam_vfe_rdi_reg_data vfe17x_rdi_3_data = { .reg_update_irq_mask = 0x100, }; +static struct cam_vfe_rdi_overflow_status vfe17x_rdi_irq_status = { + .rdi0_overflow_mask = 0x8, + .rdi1_overflow_mask = 0x10, + .rdi2_overflow_mask = 0x18, + .rdi3_overflow_mask = 0x20, + .rdi_overflow_mask = 0x3c, +}; + static struct cam_vfe_top_ver2_hw_info vfe17x_top_hw_info = { .common_reg = &vfe17x_top_common_reg, .camif_hw_info = { @@ -97,6 +105,7 @@ static struct cam_vfe_top_ver2_hw_info vfe17x_top_hw_info = { .rdi_hw_info = { .common_reg = &vfe17x_top_common_reg, .rdi_reg = &vfe17x_rdi_reg, + .rdi_irq_status = &vfe17x_rdi_irq_status, .reg_data = { &vfe17x_rdi_0_data, &vfe17x_rdi_1_data, diff --git a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver2.c b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver2.c index 52de7b10cbe6..7c4303aab686 100644 --- a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver2.c +++ b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver2.c @@ -1393,7 +1393,7 @@ static int cam_vfe_bus_err_bottom_half(void *ctx_priv, evt_payload = evt_payload_priv; common_data = evt_payload->ctx; - enable_dmi_dump = evt_payload->enable_dump; + enable_dmi_dump = 0x3; stats_cfg = common_data->stats_data->stats_cfg_offset; dmi_cfg = common_data->stats_data->dmi_offset_info; val = evt_payload->debug_status_0; diff --git a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver2.c b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver2.c index 112a2d680c30..c4711a42bd68 100644 --- a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver2.c +++ b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver2.c @@ -45,6 +45,11 @@ struct cam_vfe_mux_camif_data { uint32_t irq_debug_cnt; uint32_t camif_debug; uint32_t fps; + struct timeval sof_ts; + struct timeval epoch_ts; + struct timeval eof_ts; + struct timeval rup_ts; + struct timeval error_ts; }; static int cam_vfe_camif_validate_pix_pattern(uint32_t pattern) @@ -174,6 +179,15 @@ static int cam_vfe_camif_resource_init( CAM_ERR(CAM_ISP, "failed to enable dsp clk"); } + camif_data->sof_ts.tv_sec = 0; + camif_data->sof_ts.tv_usec = 0; + camif_data->epoch_ts.tv_sec = 0; + camif_data->epoch_ts.tv_usec = 0; + camif_data->eof_ts.tv_sec = 0; + camif_data->eof_ts.tv_usec = 0; + camif_data->error_ts.tv_sec = 0; + camif_data->error_ts.tv_usec = 0; + return rc; } @@ -592,9 +606,12 @@ static int cam_vfe_camif_handle_irq_bottom_half(void *handler_priv, struct cam_isp_resource_node *camif_node; struct cam_vfe_mux_camif_data *camif_priv; struct cam_vfe_top_irq_evt_payload *payload; + struct cam_vfe_soc_private *soc_private = NULL; uint32_t irq_status0; uint32_t irq_status1; uint32_t val; + struct timespec64 ts; + uint32_t val0, val1; if (!handler_priv || !evt_payload_priv) { CAM_ERR(CAM_ISP, "Invalid params"); @@ -604,11 +621,13 @@ static int cam_vfe_camif_handle_irq_bottom_half(void *handler_priv, camif_node = handler_priv; camif_priv = camif_node->res_priv; payload = evt_payload_priv; + soc_private = camif_priv->soc_info->soc_private; irq_status0 = payload->irq_reg_val[CAM_IFE_IRQ_CAMIF_REG_STATUS0]; irq_status1 = payload->irq_reg_val[CAM_IFE_IRQ_CAMIF_REG_STATUS1]; CAM_DBG(CAM_ISP, "event ID:%d", payload->evt_id); CAM_DBG(CAM_ISP, "irq_status_0 = %x", irq_status0); + CAM_DBG(CAM_ISP, "irq_status_1 = %x", irq_status1); switch (payload->evt_id) { case CAM_ISP_HW_EVENT_SOF: @@ -618,6 +637,11 @@ static int cam_vfe_camif_handle_irq_bottom_half(void *handler_priv, CAM_VFE_CAMIF_IRQ_SOF_DEBUG_CNT_MAX)) { CAM_INFO_RATE_LIMIT(CAM_ISP, "Received SOF"); + camif_priv->sof_ts.tv_sec = + payload->ts.mono_time.tv_sec; + camif_priv->sof_ts.tv_usec = + payload->ts.mono_time.tv_usec; + camif_priv->irq_debug_cnt++; if (camif_priv->irq_debug_cnt == CAM_VFE_CAMIF_IRQ_SOF_DEBUG_CNT_MAX) { @@ -627,6 +651,10 @@ static int cam_vfe_camif_handle_irq_bottom_half(void *handler_priv, } } else { CAM_DBG(CAM_ISP, "Received SOF"); + camif_priv->sof_ts.tv_sec = + payload->ts.mono_time.tv_sec; + camif_priv->sof_ts.tv_usec = + payload->ts.mono_time.tv_usec; } ret = CAM_VFE_IRQ_STATUS_SUCCESS; } @@ -634,38 +662,75 @@ static int cam_vfe_camif_handle_irq_bottom_half(void *handler_priv, case CAM_ISP_HW_EVENT_EPOCH: if (irq_status0 & camif_priv->reg_data->epoch0_irq_mask) { CAM_DBG(CAM_ISP, "Received EPOCH"); + camif_priv->epoch_ts.tv_sec = + payload->ts.mono_time.tv_sec; + camif_priv->epoch_ts.tv_usec = + payload->ts.mono_time.tv_usec; ret = CAM_VFE_IRQ_STATUS_SUCCESS; } break; case CAM_ISP_HW_EVENT_REG_UPDATE: if (irq_status0 & camif_priv->reg_data->reg_update_irq_mask) { CAM_DBG(CAM_ISP, "Received REG_UPDATE_ACK"); + camif_priv->rup_ts.tv_sec = + payload->ts.mono_time.tv_sec; + camif_priv->rup_ts.tv_usec = + payload->ts.mono_time.tv_usec; ret = CAM_VFE_IRQ_STATUS_SUCCESS; } break; case CAM_ISP_HW_EVENT_EOF: if (irq_status0 & camif_priv->reg_data->eof_irq_mask) { CAM_DBG(CAM_ISP, "Received EOF\n"); + camif_priv->eof_ts.tv_sec = + payload->ts.mono_time.tv_sec; + camif_priv->eof_ts.tv_usec = + payload->ts.mono_time.tv_usec; ret = CAM_VFE_IRQ_STATUS_SUCCESS; } break; case CAM_ISP_HW_EVENT_ERROR: - if (irq_status1 & camif_priv->reg_data->error_irq_mask1 && - payload->enable_reg_dump) { + if (irq_status1 & camif_priv->reg_data->error_irq_mask1) { CAM_DBG(CAM_ISP, "Received ERROR\n"); + get_monotonic_boottime64(&ts); + CAM_INFO(CAM_ISP, + "current monotonic time stamp seconds %lld:%lld", + ts.tv_sec, ts.tv_nsec/1000); + CAM_INFO(CAM_ISP, + "CAMIF ERROR time %lld.%lld", + camif_priv->error_ts.tv_sec, + camif_priv->error_ts.tv_usec); + CAM_INFO(CAM_ISP, + "SOF %lld:%lld EPOCH %lld.%lld EOF %lld.%lld RUP %lld.%lld", + camif_priv->sof_ts.tv_sec, + camif_priv->sof_ts.tv_usec, + camif_priv->epoch_ts.tv_sec, + camif_priv->epoch_ts.tv_usec, + camif_priv->eof_ts.tv_sec, + camif_priv->eof_ts.tv_usec, + camif_priv->rup_ts.tv_sec, + camif_priv->rup_ts.tv_usec); + ret = CAM_ISP_HW_ERROR_OVERFLOW; + cam_cpas_reg_read(soc_private->cpas_handle[0], + CAM_CPAS_REG_CAMNOC, 0x420, true, &val0); + cam_cpas_reg_read(soc_private->cpas_handle[0], + CAM_CPAS_REG_CAMNOC, 0x820, true, &val1); + CAM_INFO(CAM_ISP, + "CAMNOC REG ife02_wr offset 0x420: 0x%X ife13_wr offset 0x820: 0x%X", + val0, val1); ret = CAM_ISP_HW_ERROR_OVERFLOW; cam_vfe_camif_reg_dump(camif_node->res_priv); + + if (camif_priv->camif_debug & + CAMIF_DEBUG_ENABLE_SENSOR_DIAG_STATUS) { + val = cam_io_r(camif_priv->mem_base + + camif_priv->camif_reg->vfe_diag_sensor_status); + CAM_DBG(CAM_ISP, "VFE_DIAG_SENSOR_STATUS: 0x%x", + camif_priv->mem_base, val); + } } else { ret = CAM_ISP_HW_ERROR_NONE; } - - if (camif_priv->camif_debug & - CAMIF_DEBUG_ENABLE_SENSOR_DIAG_STATUS) { - val = cam_io_r(camif_priv->mem_base + - camif_priv->camif_reg->vfe_diag_sensor_status); - CAM_DBG(CAM_ISP, "VFE_DIAG_SENSOR_STATUS: 0x%x", - camif_priv->mem_base, val); - } break; default: break; diff --git a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_rdi.c b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_rdi.c index b6056e1c6615..6b6535ff103c 100644 --- a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_rdi.c +++ b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_rdi.c @@ -18,13 +18,20 @@ #include "cam_io_util.h" #include "cam_debug_util.h" #include "cam_cdm_util.h" +#include "cam_vfe_soc.h" +#include "cam_cpas_api.h" struct cam_vfe_mux_rdi_data { void __iomem *mem_base; struct cam_hw_intf *hw_intf; struct cam_vfe_top_ver2_reg_offset_common *common_reg; struct cam_vfe_rdi_ver2_reg *rdi_reg; + struct cam_vfe_rdi_overflow_status *rdi_irq_status; struct cam_vfe_rdi_reg_data *reg_data; + struct cam_hw_soc_info *soc_info; + struct timeval sof_ts; + struct timeval rup_ts; + struct timeval error_ts; enum cam_isp_hw_sync_mode sync_mode; }; @@ -203,6 +210,43 @@ static int cam_vfe_rdi_process_cmd(struct cam_isp_resource_node *rsrc_node, return rc; } +static int cam_vfe_rdi_cpas_reg_dump( +struct cam_vfe_mux_rdi_data *rdi_priv) +{ + struct cam_vfe_soc_private *soc_private = + rdi_priv->soc_info->soc_private; + uint32_t val; + + if (soc_private->cpas_version == CAM_CPAS_TITAN_175_V120) { + cam_cpas_reg_read(soc_private->cpas_handle[0], + CAM_CPAS_REG_CAMNOC, 0x3A20, true, &val); + CAM_INFO(CAM_ISP, "IFE0_nRDI_MAXWR_LOW offset 0x3A20 val 0x%x", + val); + + cam_cpas_reg_read(soc_private->cpas_handle[0], + CAM_CPAS_REG_CAMNOC, 0x5420, true, &val); + CAM_INFO(CAM_ISP, "IFE1_nRDI_MAXWR_LOW offset 0x5420 val 0x%x", + val); + + cam_cpas_reg_read(soc_private->cpas_handle[0], + CAM_CPAS_REG_CAMNOC, 0x3620, true, &val); + CAM_INFO(CAM_ISP, + "IFE0123_RDI_WR_MAXWR_LOW offset 0x3620 val 0x%x", val); + + } else if (soc_private->cpas_version < CAM_CPAS_TITAN_175_V120) { + cam_cpas_reg_read(soc_private->cpas_handle[0], + CAM_CPAS_REG_CAMNOC, 0x420, true, &val); + CAM_INFO(CAM_ISP, "IFE02_MAXWR_LOW offset 0x420 val 0x%x", val); + + cam_cpas_reg_read(soc_private->cpas_handle[0], + CAM_CPAS_REG_CAMNOC, 0x820, true, &val); + CAM_INFO(CAM_ISP, "IFE13_MAXWR_LOW offset 0x820 val 0x%x", val); + } + + return 0; + +} + static int cam_vfe_rdi_handle_irq_top_half(uint32_t evt_id, struct cam_irq_th_payload *th_payload) { @@ -217,6 +261,11 @@ static int cam_vfe_rdi_handle_irq_bottom_half(void *handler_priv, struct cam_vfe_mux_rdi_data *rdi_priv; struct cam_vfe_top_irq_evt_payload *payload; uint32_t irq_status0; + uint32_t irq_status1; + uint32_t irq_rdi_status; + struct cam_hw_soc_info *soc_info = NULL; + struct cam_vfe_soc_private *soc_private = NULL; + struct timespec64 ts; if (!handler_priv || !evt_payload_priv) { CAM_ERR(CAM_ISP, "Invalid params"); @@ -226,21 +275,35 @@ static int cam_vfe_rdi_handle_irq_bottom_half(void *handler_priv, rdi_node = handler_priv; rdi_priv = rdi_node->res_priv; payload = evt_payload_priv; + soc_info = rdi_priv->soc_info; + soc_private = + (struct cam_vfe_soc_private *)soc_info->soc_private; + irq_status0 = payload->irq_reg_val[CAM_IFE_IRQ_CAMIF_REG_STATUS0]; + irq_status1 = payload->irq_reg_val[CAM_IFE_IRQ_CAMIF_REG_STATUS1]; CAM_DBG(CAM_ISP, "event ID:%d", payload->evt_id); CAM_DBG(CAM_ISP, "irq_status_0 = %x", irq_status0); + CAM_DBG(CAM_ISP, "irq_status_1 = %x", irq_status1); switch (payload->evt_id) { case CAM_ISP_HW_EVENT_SOF: if (irq_status0 & rdi_priv->reg_data->sof_irq_mask) { CAM_DBG(CAM_ISP, "Received SOF"); + rdi_priv->sof_ts.tv_sec = + payload->ts.mono_time.tv_sec; + rdi_priv->sof_ts.tv_usec = + payload->ts.mono_time.tv_usec; ret = CAM_VFE_IRQ_STATUS_SUCCESS; } break; case CAM_ISP_HW_EVENT_REG_UPDATE: if (irq_status0 & rdi_priv->reg_data->reg_update_irq_mask) { CAM_DBG(CAM_ISP, "Received REG UPDATE"); + rdi_priv->rup_ts.tv_sec = + payload->ts.mono_time.tv_sec; + rdi_priv->rup_ts.tv_usec = + payload->ts.mono_time.tv_usec; ret = CAM_VFE_IRQ_STATUS_SUCCESS; } break; @@ -248,6 +311,50 @@ static int cam_vfe_rdi_handle_irq_bottom_half(void *handler_priv, break; } + + if (!rdi_priv->rdi_irq_status) + goto end; + + irq_rdi_status = + (irq_status1 & + rdi_priv->rdi_irq_status->rdi_overflow_mask); + if (irq_rdi_status) { + get_monotonic_boottime64(&ts); + CAM_INFO(CAM_ISP, + "current monotonic time stamp seconds %lld:%lld", + ts.tv_sec, ts.tv_nsec/1000); + + CAM_INFO(CAM_ISP, + "SOF %lld:%lld EPOCH %lld.%lld EOF %lld.%lld RUP %lld.%lld", + rdi_priv->sof_ts.tv_sec, + rdi_priv->sof_ts.tv_usec, + rdi_priv->rup_ts.tv_sec, + rdi_priv->rup_ts.tv_usec); + + cam_vfe_rdi_cpas_reg_dump(rdi_priv); + + CAM_INFO(CAM_ISP, "ife_clk_src:%lld", + soc_private->ife_clk_src); + + if (irq_rdi_status & + rdi_priv->rdi_irq_status->rdi0_overflow_mask) { + CAM_INFO(CAM_ISP, "RDI %d overflow", + CAM_ISP_IFE_OUT_RES_RDI_0); + } else if (irq_rdi_status & + rdi_priv->rdi_irq_status->rdi1_overflow_mask) { + CAM_INFO(CAM_ISP, "RDI %d overflow", + CAM_ISP_IFE_OUT_RES_RDI_1); + } else if (irq_rdi_status & + rdi_priv->rdi_irq_status->rdi2_overflow_mask) { + CAM_INFO(CAM_ISP, "RDI %d overflow", + CAM_ISP_IFE_OUT_RES_RDI_2); + } else if (irq_rdi_status & + rdi_priv->rdi_irq_status->rdi3_overflow_mask) { + CAM_INFO(CAM_ISP, "RDI %d overflow", + CAM_ISP_IFE_OUT_RES_RDI_3); + } + } +end: CAM_DBG(CAM_ISP, "returing status = %d", ret); return ret; } @@ -274,6 +381,8 @@ int cam_vfe_rdi_ver2_init( rdi_priv->hw_intf = hw_intf; rdi_priv->common_reg = rdi_info->common_reg; rdi_priv->rdi_reg = rdi_info->rdi_reg; + rdi_priv->soc_info = soc_info; + rdi_priv->rdi_irq_status = rdi_info->rdi_irq_status; switch (rdi_node->res_id) { case CAM_ISP_HW_VFE_IN_RDI0: @@ -304,6 +413,13 @@ int cam_vfe_rdi_ver2_init( rdi_node->top_half_handler = cam_vfe_rdi_handle_irq_top_half; rdi_node->bottom_half_handler = cam_vfe_rdi_handle_irq_bottom_half; + rdi_priv->sof_ts.tv_sec = 0; + rdi_priv->sof_ts.tv_usec = 0; + rdi_priv->rup_ts.tv_sec = 0; + rdi_priv->rup_ts.tv_usec = 0; + rdi_priv->error_ts.tv_sec = 0; + rdi_priv->error_ts.tv_usec = 0; + return 0; err_init: kfree(rdi_priv); diff --git a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_rdi.h b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_rdi.h index a524b4496905..b3a1a9b29183 100644 --- a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_rdi.h +++ b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_rdi.h @@ -28,10 +28,19 @@ struct cam_vfe_rdi_reg_data { uint32_t reg_update_irq_mask; }; +struct cam_vfe_rdi_overflow_status { + uint32_t rdi0_overflow_mask; + uint32_t rdi1_overflow_mask; + uint32_t rdi2_overflow_mask; + uint32_t rdi3_overflow_mask; + uint32_t rdi_overflow_mask; +}; + struct cam_vfe_rdi_ver2_hw_info { struct cam_vfe_top_ver2_reg_offset_common *common_reg; struct cam_vfe_rdi_ver2_reg *rdi_reg; struct cam_vfe_rdi_reg_data *reg_data[CAM_VFE_RDI_VER2_MAX]; + struct cam_vfe_rdi_overflow_status *rdi_irq_status; }; int cam_vfe_rdi_ver2_acquire_resource( diff --git a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_top_ver2.c b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_top_ver2.c index 59e5c2fe51f3..5e1a34a5ed53 100644 --- a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_top_ver2.c +++ b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_top_ver2.c @@ -100,8 +100,11 @@ static int cam_vfe_top_set_hw_clk_rate( struct cam_hw_soc_info *soc_info = NULL; int i, rc = 0; unsigned long max_clk_rate = 0; + struct cam_vfe_soc_private *soc_private = NULL; soc_info = top_priv->common_data.soc_info; + soc_private = + (struct cam_vfe_soc_private *)soc_info->soc_private; for (i = 0; i < CAM_VFE_TOP_VER2_MUX_MAX; i++) { if (top_priv->req_clk_rate[i] > max_clk_rate) @@ -110,10 +113,10 @@ static int cam_vfe_top_set_hw_clk_rate( if (max_clk_rate == top_priv->hw_clk_rate) return 0; - CAM_DBG(CAM_ISP, "VFE: Clock name=%s idx=%d clk=%llu", + CAM_INFO(CAM_ISP, "VFE: Clock name=%s idx=%d clk=%llu", soc_info->clk_name[soc_info->src_clk_idx], soc_info->src_clk_idx, max_clk_rate); - + soc_private->ife_clk_src = max_clk_rate; rc = cam_soc_util_set_src_clk_rate(soc_info, max_clk_rate); if (!rc) diff --git a/drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.c b/drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.c index f9cc52a404b9..364cb6d2517a 100644 --- a/drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.c +++ b/drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.c @@ -957,7 +957,10 @@ static int __cam_req_mgr_check_sync_req_is_ready( int32_t sync_num_slots = 0; uint64_t sync_frame_duration = 0; bool ready = true, sync_ready = true; - +#ifdef VENDOR_EDIT + uint64_t sof_timestamp_delta = 0; + uint64_t master_slave_diff = 0; +#endif if (!link->sync_link) { CAM_ERR(CAM_CRM, "Sync link null"); return -EINVAL; @@ -989,6 +992,12 @@ static int __cam_req_mgr_check_sync_req_is_ready( else sync_frame_duration = DEFAULT_FRAME_DURATION; +#ifdef VENDOR_EDIT + sof_timestamp_delta = + link->sof_timestamp >= sync_link->sof_timestamp + ? link->sof_timestamp - sync_link->sof_timestamp + : sync_link->sof_timestamp - link->sof_timestamp; +#endif CAM_DBG(CAM_CRM, "sync link %x last frame duration is %d ns", sync_link->link_hdl, sync_frame_duration); @@ -1111,10 +1120,17 @@ static int __cam_req_mgr_check_sync_req_is_ready( * difference of two SOF timestamp less than * (sync_frame_duration / 5). */ +#ifndef VENDOR_EDIT if ((link->sof_timestamp > sync_link->sof_timestamp) && (sync_link->sof_timestamp > 0) && (link->sof_timestamp - sync_link->sof_timestamp < sync_frame_duration / 5) && +#else + master_slave_diff = sync_frame_duration; + do_div(master_slave_diff, 5); + if ((sync_link->sof_timestamp > 0) && + (sof_timestamp_delta < master_slave_diff) && +#endif (sync_rd_slot->sync_mode == CAM_REQ_MGR_SYNC_MODE_SYNC)) { /* @@ -1137,6 +1153,13 @@ static int __cam_req_mgr_check_sync_req_is_ready( "sync link %x too quickly, skip next frame of sync link", sync_link->link_hdl); link->sync_link_sof_skip = true; +#ifdef VENDOR_EDIT + }else if (sync_link->req.in_q->slot[sync_slot_idx].status != + CRM_SLOT_STATUS_REQ_APPLIED) { + CAM_DBG(CAM_CRM, + "link %x other not applied", link->link_hdl); + return -EAGAIN; +#endif } } else if ((sync_link->sof_timestamp > 0) && (link->sof_timestamp < sync_link->sof_timestamp) && @@ -2595,6 +2618,7 @@ static int cam_req_mgr_cb_notify_trigger( struct crm_task_payload *task_data; bool send_sof = true; int i = 0; + int64_t sof_time_diff = 0; if (!trigger_data) { CAM_ERR(CAM_CRM, "sof_data is NULL"); @@ -2614,6 +2638,10 @@ static int cam_req_mgr_cb_notify_trigger( if (link->dev_sof_evt[i].dev_hdl == trigger_data->dev_hdl) { if (link->dev_sof_evt[i].sof_done == false) { link->dev_sof_evt[i].sof_done = true; + link->dev_sof_evt[i].frame_id = + trigger_data->frame_id; + link->dev_sof_evt[i].timestamp = + trigger_data->sof_timestamp_val; } else CAM_INFO(CAM_CRM, "Received Spurious SOF"); } else if (link->dev_sof_evt[i].sof_done == false) { @@ -2623,6 +2651,23 @@ static int cam_req_mgr_cb_notify_trigger( if (!send_sof) return 0; + if (link->num_sof_src > 1) { + for (i = 0; i < (link->num_sof_src - 1); i++) { + if (link->dev_sof_evt[i].timestamp >= + link->dev_sof_evt[i+1].timestamp) { + sof_time_diff = link->dev_sof_evt[i].timestamp - + link->dev_sof_evt[i+1].timestamp; + } else { + sof_time_diff = + link->dev_sof_evt[i+1].timestamp - + link->dev_sof_evt[i].timestamp; + } + if ((link->dev_sof_evt[i].frame_id != + link->dev_sof_evt[i+1].frame_id) || + sof_time_diff > TIMESTAMP_DIFF_THRESHOLD) + return 0; + } + } for (i = 0; i < link->num_sof_src; i++) link->dev_sof_evt[i].sof_done = false; @@ -3284,7 +3329,12 @@ int cam_req_mgr_schedule_request( CAM_INFO(CAM_CRM, "request %lld is flushed, last_flush_id to flush %u", sched_req->req_id, link->last_flush_id); +#ifdef VENDOR_EDIT + //Shouyao.Xiong@cam 20200605 merge qcom patch to fix flush block issue case 04611022 rc = -EBADR; +#else + rc = -EINVAL; +#endif goto end; } diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_cci/cam_cci_core.c b/drivers/media/platform/msm/camera/cam_sensor_module/cam_cci/cam_cci_core.c index a06a4c6c6339..05583a04e0fa 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_cci/cam_cci_core.c +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_cci/cam_cci_core.c @@ -13,6 +13,9 @@ #include #include "cam_cci_core.h" #include "cam_cci_dev.h" +#ifdef VENDOR_EDIT +#define DUMP_CCI_REGISTERS 1 +#endif static int32_t cam_cci_convert_type_to_num_bytes( enum camera_sensor_i2c_type type) @@ -1348,6 +1351,10 @@ static int32_t cam_cci_i2c_write(struct v4l2_subdev *sd, int32_t rc = 0; struct cci_device *cci_dev; enum cci_i2c_master_t master; +#ifdef VENDOR_EDIT +//lixin@camera, 20191202, add for define number of attempts + int retry; +#endif cci_dev = v4l2_get_subdevdata(sd); @@ -1409,6 +1416,15 @@ static int32_t cam_cci_i2c_write(struct v4l2_subdev *sd, goto ERROR; } rc = cam_cci_data_queue(cci_dev, c_ctrl, queue, sync_en); +#ifdef VENDOR_EDIT +//lixin@camera, 20191202, add for try again after failed to call cam_cci_data_queue + for (retry = 3; retry > 0 && rc < 0; retry--) { + rc = cam_cci_data_queue(cci_dev, c_ctrl, queue, sync_en); + CAM_ERR(CAM_SENSOR,"Try cam_cci_data_queue again : %d", + rc); + } +#endif + if (rc < 0) { CAM_ERR(CAM_CCI, "failed rc: %d", rc); goto ERROR; diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_cci/cam_cci_dev.h b/drivers/media/platform/msm/camera/cam_sensor_module/cam_cci/cam_cci_dev.h index fd93dedd01f1..2a02637b60a8 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_cci/cam_cci_dev.h +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_cci/cam_cci_dev.h @@ -68,7 +68,12 @@ /* Max bytes that can be read per CCI read transaction */ #define CCI_READ_MAX 256 #define CCI_I2C_READ_MAX_RETRIES 3 -#define CCI_I2C_MAX_READ 8192 +//#ifndef VENDOR_EDIT +//#define CCI_I2C_MAX_READ 8192 +//#else +//add by litao@camera, 20200311 for read eeprom data +#define CCI_I2C_MAX_READ 16384 +//#endif #define CCI_I2C_MAX_WRITE 8192 #define CCI_I2C_MAX_BYTE_COUNT 65535 diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_core.c b/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_core.c index 9ca033e38473..e40ebb8ceabe 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_core.c +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_core.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -51,12 +51,6 @@ static int cam_csiphy_notify_secure_mode(struct csiphy_device *csiphy_dev, return -EINVAL; } - CAM_INFO(CAM_CSIPHY, "PHY : %d offset: %d SEC: %d Mask: %d", - csiphy_dev->soc_info.index, - offset, - protect, - csiphy_dev->csiphy_cpas_cp_reg_mask[offset]); - return 0; } @@ -843,7 +837,6 @@ int32_t cam_csiphy_core_cfg(void *phy_dev, } break; case CAM_RELEASE_DEV: { - int32_t offset; struct cam_release_dev_cmd release; if (!csiphy_dev->acquire_count) { @@ -859,23 +852,6 @@ int32_t cam_csiphy_core_cfg(void *phy_dev, goto release_mutex; } - offset = cam_csiphy_get_instance_offset(csiphy_dev, - release.dev_handle); - if (offset < 0 || offset >= CSIPHY_MAX_INSTANCES) { - CAM_ERR(CAM_CSIPHY, "Invalid offset"); - goto release_mutex; - } - - if (csiphy_dev->csiphy_info.secure_mode[offset]) - cam_csiphy_notify_secure_mode( - csiphy_dev, - CAM_SECURE_MODE_NON_SECURE, offset); - - csiphy_dev->csiphy_info.secure_mode[offset] = - CAM_SECURE_MODE_NON_SECURE; - - csiphy_dev->csiphy_cpas_cp_reg_mask[offset] = 0x0; - rc = cam_destroy_device_hdl(release.dev_handle); if (rc < 0) CAM_ERR(CAM_CSIPHY, "destroying the device hdl"); diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/include/cam_csiphy_1_2_2_hwreg.h b/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/include/cam_csiphy_1_2_2_hwreg.h index 0aa91d58767a..11991e293edb 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/include/cam_csiphy_1_2_2_hwreg.h +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/include/cam_csiphy_1_2_2_hwreg.h @@ -67,6 +67,7 @@ csiphy_reg_t csiphy_2ph_v1_2_2_reg[MAX_LANES][MAX_SETTINGS_PER_LANE] = { {0x0900, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0908, 0x06, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0904, 0x07, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x00C4, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x002C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0034, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0010, 0x50, 0x00, CSIPHY_DEFAULT_PARAMS}, @@ -92,6 +93,7 @@ csiphy_reg_t csiphy_2ph_v1_2_2_reg[MAX_LANES][MAX_SETTINGS_PER_LANE] = { {0x0C80, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0C88, 0x06, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0C84, 0x07, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x07C4, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x072C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0734, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0710, 0x50, 0x00, CSIPHY_DEFAULT_PARAMS}, @@ -103,7 +105,7 @@ csiphy_reg_t csiphy_2ph_v1_2_2_reg[MAX_LANES][MAX_SETTINGS_PER_LANE] = { {0x0704, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0720, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0708, 0x04, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE}, - {0x070c, 0xFF, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x070c, 0xff, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0710, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0738, 0x1F, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0800, 0x02, 0x00, CSIPHY_DEFAULT_PARAMS}, @@ -117,6 +119,7 @@ csiphy_reg_t csiphy_2ph_v1_2_2_reg[MAX_LANES][MAX_SETTINGS_PER_LANE] = { {0x0A00, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0A08, 0x06, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0A04, 0x07, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x02C4, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x022C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0234, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0210, 0x50, 0x00, CSIPHY_DEFAULT_PARAMS}, @@ -142,6 +145,7 @@ csiphy_reg_t csiphy_2ph_v1_2_2_reg[MAX_LANES][MAX_SETTINGS_PER_LANE] = { {0x0B00, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0B08, 0x06, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0B04, 0x07, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x04C4, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x042C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0434, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0410, 0x50, 0x00, CSIPHY_DEFAULT_PARAMS}, @@ -167,6 +171,7 @@ csiphy_reg_t csiphy_2ph_v1_2_2_reg[MAX_LANES][MAX_SETTINGS_PER_LANE] = { {0x0C00, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0C08, 0x06, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0C04, 0x07, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x06C4, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x062C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0634, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0610, 0x50, 0x00, CSIPHY_DEFAULT_PARAMS}, @@ -235,6 +240,8 @@ struct csiphy_reg_t {0x070c, 0xFF, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0710, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0738, 0x1F, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0800, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0000, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x075C, 0xC0, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0760, 0x0D, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0800, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, @@ -310,6 +317,8 @@ struct csiphy_reg_t {0x060c, 0xFF, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0610, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0638, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0800, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0000, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x065C, 0xC0, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0660, 0x0D, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0800, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_eeprom/cam_eeprom_core.c b/drivers/media/platform/msm/camera/cam_sensor_module/cam_eeprom/cam_eeprom_core.c index 173a1ddadf3e..10928ac95909 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_eeprom/cam_eeprom_core.c +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_eeprom/cam_eeprom_core.c @@ -978,6 +978,164 @@ void cam_eeprom_shutdown(struct cam_eeprom_ctrl_t *e_ctrl) e_ctrl->cam_eeprom_state = CAM_EEPROM_INIT; } +#ifdef VENDOR_EDIT +//add by yufeng@camera, 20190115 for write eeprom +static int32_t cam_eeprom_write_data(struct cam_eeprom_ctrl_t *e_ctrl, + void *arg) +{ + int i = 0; + int j = 0; + uint32_t readcalibData; + int32_t rc = 0; + struct cam_control *cmd = (struct cam_control *)arg; + struct cam_write_eeprom_t cam_write_eeprom; + struct cam_sensor_i2c_reg_setting i2c_reg_settings; + struct cam_sensor_i2c_reg_array i2c_reg_arrays[8]; + struct cam_sensor_i2c_reg_array i2c_reg_array; + + memset(&cam_write_eeprom, 0, sizeof(struct cam_write_eeprom_t)); + if (copy_from_user(&cam_write_eeprom, (void __user *) cmd->handle, sizeof(struct cam_write_eeprom_t))) { + + CAM_ERR(CAM_EEPROM, "Failed Copy from User"); + return -EFAULT; + } + CAM_ERR(CAM_EEPROM, "write_eeprom, cam: ID: %x, addr: %x, DataSize: %d, isWRP: %x", + cam_write_eeprom.cam_id, + cam_write_eeprom.baseAddr, + cam_write_eeprom.calibDataSize, + cam_write_eeprom.isWRP); + + i2c_reg_settings.addr_type = CAMERA_SENSOR_I2C_TYPE_WORD; + i2c_reg_settings.data_type = CAMERA_SENSOR_I2C_TYPE_BYTE; + i2c_reg_settings.delay = WRITE_DATA_DELAY; + + //disable write protection + if (cam_write_eeprom.isWRP == 0x01){ + i2c_reg_settings.size = 1; + i2c_reg_array.reg_addr = cam_write_eeprom.WRPaddr; + i2c_reg_array.reg_data = 0x00; + i2c_reg_array.delay = 0; + + i2c_reg_settings.reg_setting = &i2c_reg_array; + + rc = camera_io_dev_read(&e_ctrl->io_master_info, + i2c_reg_array.reg_addr, &readcalibData, + CAMERA_SENSOR_I2C_TYPE_WORD, + CAMERA_SENSOR_I2C_TYPE_BYTE); + CAM_ERR(CAM_EEPROM, "cam: WRPaddr: 0x%x", readcalibData); + if (rc) { + CAM_ERR(CAM_EEPROM, "read WRPaddr failed rc %d",rc); + return rc; + } + if (readcalibData!=0x00) { + rc = camera_io_dev_write(&e_ctrl->io_master_info, &i2c_reg_settings); + if (rc) { + CAM_ERR(CAM_EEPROM, "write WRPaddr failed rc %d",rc); + return rc; + } + CAM_ERR(CAM_EEPROM, "write!cam: WRPaddr: 0x%x", readcalibData); + } + } + //wait for 100ms, and then write eeprom + msleep(100); + //start + + CAM_ERR(CAM_EEPROM, "write start, cam: ID: 0x%x, reg_addr: 0x%x, size: %d", + cam_write_eeprom.cam_id, cam_write_eeprom.baseAddr, cam_write_eeprom.calibDataSize); + CAM_ERR(CAM_EEPROM, "write start, cam: ID: 0x%x, reg_addr: 0x%x, val: %d", + cam_write_eeprom.cam_id, cam_write_eeprom.baseAddr, cam_write_eeprom.calibData[0]); + + if (((cam_write_eeprom.cam_id == 0x01) || (cam_write_eeprom.cam_id==0x02) || (cam_write_eeprom.cam_id==0x03))) { + for (i = 0; i < cam_write_eeprom.calibDataSize;) { + i2c_reg_settings.size = 0; + for (j = 0; (j < WRITE_DATA_MAX_LENGTH && i < cam_write_eeprom.calibDataSize); j++) { + i2c_reg_arrays[j].reg_addr = cam_write_eeprom.baseAddr + i; + i2c_reg_arrays[j].reg_data = cam_write_eeprom.calibData[i]; + i2c_reg_arrays[j].delay = 0; + i2c_reg_settings.size++; + i++; + } + i2c_reg_settings.reg_setting = i2c_reg_arrays; + e_ctrl->cam_eeprom_state = CAM_EEPROM_CONFIG; + rc = camera_io_dev_write(&e_ctrl->io_master_info, &i2c_reg_settings); + if (rc) { + CAM_ERR(CAM_EEPROM, "eeprom write failed rc %d", rc); + return rc; + } + } + }else { + CAM_ERR(CAM_EEPROM, "eeprom write failed "); + } + //end + + //enable write protection + if (cam_write_eeprom.isWRP == 0x01){ + i2c_reg_settings.size = 1; + i2c_reg_array.reg_addr = cam_write_eeprom.WRPaddr; + i2c_reg_array.reg_data = 0x0E; + i2c_reg_array.delay = 0; + i2c_reg_settings.reg_setting = &i2c_reg_array; + + rc = camera_io_dev_read(&e_ctrl->io_master_info, + i2c_reg_array.reg_addr, &readcalibData, + CAMERA_SENSOR_I2C_TYPE_WORD, + CAMERA_SENSOR_I2C_TYPE_BYTE); + if (rc) { + CAM_ERR(CAM_EEPROM, "read WRPaddr failed rc %d",rc); + return rc; + } + if(readcalibData!=0x0E){ + rc = camera_io_dev_write(&e_ctrl->io_master_info, &i2c_reg_settings); + if (rc) { + CAM_ERR(CAM_EEPROM, "write WRPaddr failed rc %d",rc); + return rc; + } + CAM_ERR(CAM_EEPROM, "write!cam: WRPaddr: 0x%x", readcalibData); + } + } + return rc; +} +//add by yufeng@camera, 20190115 for write eeprom +static int32_t cam_eeprom_check_data(struct cam_eeprom_ctrl_t *e_ctrl, + void *arg) +{ + int i = 0; + uint32_t readdata; + int32_t rc = 0; + struct cam_control *cmd = (struct cam_control *)arg; + struct check_eeprom_data_t check_eeprom_data; + memset(&check_eeprom_data, 0, sizeof(struct check_eeprom_data_t)); + if (copy_from_user(&check_eeprom_data, (void __user *) cmd->handle, sizeof(struct check_eeprom_data_t))) { + + CAM_ERR(CAM_EEPROM, "Failed Copy from User"); + return -EFAULT; + } + if (check_eeprom_data.cam_id == 0x01 || check_eeprom_data.cam_id == 0x02 || check_eeprom_data.cam_id == 0x03) { + check_eeprom_data.eepromData_checksum = 0; + for (i = 0; i < check_eeprom_data.checkDataSize; i++ ){ + rc = camera_io_dev_read(&e_ctrl->io_master_info, + (check_eeprom_data.startAddr + i*WRITE_DATA_MAX_LENGTH), &readdata, + CAMERA_SENSOR_I2C_TYPE_WORD, + CAMERA_SENSOR_I2C_TYPE_BYTE); + if (rc) { + CAM_ERR(CAM_EEPROM, "eeprom read failed rc %d",rc); + return rc; + } + check_eeprom_data.eepromData_checksum += readdata; + } + + CAM_DBG(CAM_EEPROM, "eepromData_checksum: %d", check_eeprom_data.eepromData_checksum); + + if (copy_to_user((void __user *) cmd->handle, &check_eeprom_data, sizeof(struct check_eeprom_data_t))) { + + CAM_ERR(CAM_EEPROM, "Failed Copy to User"); + return -EFAULT; + } + } + return rc; +} +#endif + /** * cam_eeprom_driver_cmd - Handle eeprom cmds * @e_ctrl: ctrl structure @@ -1061,6 +1219,34 @@ int32_t cam_eeprom_driver_cmd(struct cam_eeprom_ctrl_t *e_ctrl, void *arg) goto release_mutex; } break; +#ifdef VENDOR_EDIT + //add by yufeng@camera, 20190115 for write eeprom + case CAM_WRITE_CALIBRATION_DATA: + CAM_DBG(CAM_EEPROM, "CAM_WRITE_CALIBRATION_DATA"); + rc = cam_eeprom_write_data(e_ctrl, arg); + if (rc) { + CAM_ERR(CAM_EEPROM, "Failed in write calibration data"); + goto release_mutex; + } + break; + case CAM_CHECK_CALIBRATION_DATA: + CAM_DBG(CAM_EEPROM, "CAM_CHECK_CALIBRATION_DATA"); + rc = cam_eeprom_check_data(e_ctrl, arg); + if (rc) { + CAM_ERR(CAM_EEPROM, "Failed in check eeprom data"); + goto release_mutex; + } + break; + case CAM_WRITE_AE_SYNC_DATA: + CAM_DBG(CAM_EEPROM, "CAM_WRITE_AE_SYNC_DATA"); + rc = cam_eeprom_write_data(e_ctrl, arg); + if (rc) { + CAM_ERR(CAM_EEPROM, "Failed in write AE sync data"); + goto release_mutex; + } + break; +#endif + default: CAM_DBG(CAM_EEPROM, "invalid opcode"); break; diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_eeprom/cam_eeprom_dev.h b/drivers/media/platform/msm/camera/cam_sensor_module/cam_eeprom/cam_eeprom_dev.h index 9c36134a1b8f..69a0997f099a 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_eeprom/cam_eeprom_dev.h +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_eeprom/cam_eeprom_dev.h @@ -185,6 +185,32 @@ struct cam_eeprom_ctrl_t { struct cam_eeprom_memory_block_t cal_data; }; +#ifdef VENDOR_EDIT +/*add by yufeng@camera, 20191023 for write data to eeprom*/ +#define CALIB_DATA_LENGTH 1689 +#define WRITE_DATA_MAX_LENGTH 8 +#define WRITE_DATA_DELAY 5 + +struct cam_write_eeprom_t { + uint32_t cam_id; + uint32_t baseAddr; + uint32_t calibDataSize; + uint32_t isWRP; + uint32_t WRPaddr; + unsigned char calibData[CALIB_DATA_LENGTH]; +} __attribute__ ((packed)); + +//add by yufeng@camera, 20191023 for check eeprom data +#define EEPROM_CHECK_DATA_MAX_SIZE 196 +struct check_eeprom_data_t{ + uint32_t cam_id; + uint32_t checkDataSize; + uint32_t startAddr; + uint32_t eepromData_checksum; +} __attribute__ ((packed)); +#endif + + int32_t cam_eeprom_update_i2c_info(struct cam_eeprom_ctrl_t *e_ctrl, struct cam_eeprom_i2c_info_t *i2c_info); diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_flash/cam_flash_core.c b/drivers/media/platform/msm/camera/cam_sensor_module/cam_flash/cam_flash_core.c index 5201feeadc08..103ca076c080 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_flash/cam_flash_core.c +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_flash/cam_flash_core.c @@ -543,6 +543,21 @@ static int cam_flash_high( return rc; } +#ifdef VENDOR_EDIT +/*Add by hongbo.dai@Camera 20180319 for flash*/ +int cam_flash_on(struct cam_flash_ctrl *flash_ctrl, + struct cam_flash_frame_setting *flash_data, + int mode) { + int rc = 0; + if (mode == 0) { + rc = cam_flash_low(flash_ctrl, flash_data); + } else if (mode == 1) { + rc = cam_flash_high(flash_ctrl, flash_data); + } + return rc; +} +#endif + static int cam_flash_i2c_delete_req(struct cam_flash_ctrl *fctrl, uint64_t req_id) { diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_flash/cam_flash_dev.c b/drivers/media/platform/msm/camera/cam_sensor_module/cam_flash/cam_flash_dev.c index f4c9d254df7c..00e842d45d95 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_flash/cam_flash_dev.c +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_flash/cam_flash_dev.c @@ -12,10 +12,22 @@ */ #include +#ifdef VENDOR_EDIT +/*Add by Zhengrong.Zhang@Camera 20160630 for flash*/ +#include +#include +#include +struct cam_flash_ctrl *vendor_flash_ctrl = NULL; +struct cam_flash_ctrl *front_flash_ctrl = NULL; +#endif #include "cam_flash_dev.h" #include "cam_flash_soc.h" #include "cam_flash_core.h" #include "cam_common_util.h" +#ifdef VENDOR_EDIT +/*Add by hongbo.dai@Camera 20180319 for flash*/ +#include "cam_res_mgr_api.h" +#endif static int32_t cam_flash_driver_cmd(struct cam_flash_ctrl *fctrl, void *arg, struct cam_flash_private_soc *soc_private) @@ -206,6 +218,153 @@ release_mutex: return rc; } +#ifdef VENDOR_EDIT +/*add by hongbo.dai@camera 20180319, suitable proc dev for flash as same as SDM660*/ +volatile static int flash_mode; +volatile static int pre_flash_mode; +static ssize_t flash_on_off(struct cam_flash_ctrl *flash_ctrl) +{ + int rc = 1; + struct timespec ts; + struct rtc_time tm; + struct cam_flash_frame_setting flash_data; + memset(&flash_data, 0, sizeof(flash_data)); + + getnstimeofday(&ts); + rtc_time_to_tm(ts.tv_sec, &tm); + pr_info("flash_mode %d,%d-%02d-%02d %02d:%02d:%02d.%09lu UTC\n", + flash_mode, + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec, ts.tv_nsec); + if(pre_flash_mode == flash_mode) + return rc; + + /*Add by Jindian.Guan@Camera 20170426 not use flashlight when use camera*/ + if(pre_flash_mode == 5 && flash_mode == 0){ + pr_err("camera is opened,not to set flashlight off"); + return rc; + } + + pre_flash_mode = flash_mode; + switch (flash_mode) + { + case 0: + flash_data.led_current_ma[0] = 0; + flash_data.led_current_ma[1] = 0; + cam_flash_off(flash_ctrl); + flash_ctrl->flash_state = CAM_FLASH_STATE_INIT; + break; + case 1: + flash_data.led_current_ma[0] = 110; + flash_data.led_current_ma[1] = 110; + cam_flash_on(flash_ctrl, &flash_data, 0); + break; + case 2: + flash_data.led_current_ma[0] = 1000; + flash_data.led_current_ma[1] = 1000; + cam_flash_on(flash_ctrl, &flash_data, 1); + break; + case 3: + flash_data.led_current_ma[0] = 60; + flash_data.led_current_ma[1] = 60; + cam_flash_on(flash_ctrl, &flash_data, 0); + break; + default: + break; + } + return rc; +} + +static ssize_t flash_proc_write(struct file *filp, const char __user *buff, + size_t len, loff_t *data) +{ + char buf[8] = {0}; + int rc = 0; + if (len > 8) + len = 8; + if (copy_from_user(buf, buff, len)) { + pr_err("proc write error.\n"); + return -EFAULT; + } + flash_mode = simple_strtoul(buf, NULL, 10); + rc = flash_on_off(vendor_flash_ctrl); + if(rc < 0) + pr_err("%s flash write failed %d\n", __func__, __LINE__); + return len; +} +static ssize_t flash_proc_read(struct file *filp, char __user *buff, + size_t len, loff_t *data) +{ + char value[2] = {0}; + snprintf(value, sizeof(value), "%d", flash_mode); + return simple_read_from_buffer(buff, len, data, value,1); +} + +static const struct file_operations led_fops = { + .owner = THIS_MODULE, + .read = flash_proc_read, + .write = flash_proc_write, +}; +static int flash_proc_init(struct cam_flash_ctrl *flash_ctl) +{ + int ret = 0; + char proc_flash[16] = "qcom_flash"; + char strtmp[] = "0"; + struct proc_dir_entry *proc_entry; + if (flash_ctl->flash_name == NULL) { + pr_err("%s get flash name is NULL %d\n", __func__, __LINE__); + return -1; + } else { + if (strcmp(flash_ctl->flash_name, "pmic") != 0) { + pr_err("%s get flash name is PMIC ,so return\n", __func__); + return -1; + } + } + if (flash_ctl->soc_info.index > 0) { + sprintf(strtmp, "%d", flash_ctl->soc_info.index); + strcat(proc_flash, strtmp); + } + proc_entry = proc_create_data(proc_flash, 0666, NULL,&led_fops, NULL); + if (proc_entry == NULL) { + ret = -ENOMEM; + pr_err("[%s]: Error! Couldn't create qcom_flash proc entry\n", __func__); + } + vendor_flash_ctrl = flash_ctl; + return ret; +} + +/*add by hongbo.dai@camera 20181126, for front flashlight*/ +static ssize_t cam_flash_switch_store(struct device *dev, + struct device_attribute *attr, const char *buf, + size_t count) +{ + int rc = 0; + struct cam_flash_ctrl *data = dev_get_drvdata(dev); + + int enable = 0; + + if (kstrtoint(buf, 0, &enable)) { + pr_err("get val error.\n"); + rc = -EINVAL; + } + CAM_ERR(CAM_FLASH, "echo data = %d ", enable); + + flash_mode = enable; + rc = flash_on_off(data); + + return count; +} + +static ssize_t cam_flash_switch_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return snprintf(buf, 5, "%d\n", flash_mode); + //return simple_read_from_buffer(buff, 10, buf, value,1); +} + +static DEVICE_ATTR(fswitch, 0660, cam_flash_switch_show,cam_flash_switch_store); +#endif + static int32_t cam_flash_init_default_params(struct cam_flash_ctrl *fctrl) { /* Validate input parameters */ @@ -501,6 +660,12 @@ static int32_t cam_flash_platform_probe(struct platform_device *pdev) mutex_init(&(fctrl->flash_mutex)); fctrl->flash_state = CAM_FLASH_STATE_INIT; +#ifdef VENDOR_EDIT + /*Add by hongbo.dai@Camera 20181126 for flash*/ + if (flash_proc_init(fctrl) < 0) { + device_create_file(&pdev->dev, &dev_attr_fswitch); + } +#endif CAM_DBG(CAM_FLASH, "Probe success"); return rc; diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_flash/cam_flash_dev.h b/drivers/media/platform/msm/camera/cam_sensor_module/cam_flash/cam_flash_dev.h index 0458ccd8843e..4267b47fe3ad 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_flash/cam_flash_dev.h +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_flash/cam_flash_dev.h @@ -213,6 +213,10 @@ struct cam_flash_ctrl { struct camera_io_master io_master_info; struct i2c_data_settings i2c_data; uint32_t last_flush_req; +#ifdef VENDOR_EDIT + /*Add by Zhengrong.Zhang@Camera 20160809 for flash*/ + const char *flash_name; +#endif }; int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg); @@ -220,6 +224,12 @@ int cam_flash_i2c_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg); int cam_flash_pmic_apply_setting(struct cam_flash_ctrl *fctrl, uint64_t req_id); int cam_flash_i2c_apply_setting(struct cam_flash_ctrl *fctrl, uint64_t req_id); int cam_flash_off(struct cam_flash_ctrl *fctrl); +#ifdef VENDOR_EDIT +/*Add by hongbo.dai@Camera 20180319 for flash*/ +int cam_flash_on(struct cam_flash_ctrl *flash_ctrl, + struct cam_flash_frame_setting *flash_data, + int mode); +#endif int cam_flash_pmic_power_ops(struct cam_flash_ctrl *fctrl, bool regulator_enable); int cam_flash_i2c_power_ops(struct cam_flash_ctrl *fctrl, diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_flash/cam_flash_soc.c b/drivers/media/platform/msm/camera/cam_sensor_module/cam_flash/cam_flash_soc.c index 2e3d83fa5d4f..97e1ec6e27bb 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_flash/cam_flash_soc.c +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_flash/cam_flash_soc.c @@ -241,6 +241,14 @@ int cam_flash_get_dt_data(struct cam_flash_ctrl *fctrl, goto free_soc_private; } +#ifdef VENDOR_EDIT + /*Add by Zhengrong.Zhang@Camera 20160630 for flash*/ + rc = of_property_read_string(of_node, "qcom,flash-name", + &fctrl->flash_name); + if (rc < 0) { + pr_err("get flash_name failed rc %d\n", rc); + } +#endif rc = cam_get_source_node_info(of_node, fctrl, soc_info->soc_private); if (rc) { CAM_ERR(CAM_FLASH, diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_ir_led/cam_ir_led_dev.c b/drivers/media/platform/msm/camera/cam_sensor_module/cam_ir_led/cam_ir_led_dev.c index 23258e732fa6..31dfb2c98fc8 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_ir_led/cam_ir_led_dev.c +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_ir_led/cam_ir_led_dev.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -60,24 +60,6 @@ static int32_t cam_pmic_ir_led_off(struct cam_ir_led_ctrl *ictrl) if (rc) CAM_ERR(CAM_IR_LED, "gpio operation failed(%d)", rc); - CAM_INFO(CAM_IR_LED, "CAM_IR_LED_PACKET_OPCODE_OFF_Output_GPIO_1:%d", - ictrl->soc_info.gpio_data->cam_gpio_common_tbl[0].gpio); - rc = gpio_direction_output( - ictrl->soc_info.gpio_data->cam_gpio_common_tbl[0].gpio, - 0); - if (rc) { - CAM_ERR(CAM_IR_LED, "gpio operation failed(%d)", rc); - return rc; - } - CAM_INFO(CAM_IR_LED, "CAM_IR_LED_PACKET_OPCODE_OFF_Output_GPIO_2:%d", - ictrl->soc_info.gpio_data->cam_gpio_common_tbl[1].gpio); - rc = gpio_direction_output( - ictrl->soc_info.gpio_data->cam_gpio_common_tbl[1].gpio, - 1); - if (rc) { - CAM_ERR(CAM_IR_LED, "gpio operation failed(%d)", rc); - return rc; - } return rc; } @@ -114,7 +96,7 @@ static int32_t cam_pmic_ir_led_on( } rc = gpio_direction_output( ictrl->soc_info.gpio_data->cam_gpio_common_tbl[1].gpio, - 0); + 1); if (rc) { CAM_ERR(CAM_IR_LED, "gpio operation failed(%d)", rc); return rc; diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor/cam_sensor_core.c b/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor/cam_sensor_core.c index 7d048b982909..2d9df00a10c0 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor/cam_sensor_core.c +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor/cam_sensor_core.c @@ -19,7 +19,143 @@ #include "cam_common_util.h" #include "cam_packet_util.h" +#ifdef VENDOR_EDIT +/*Zhixian.mai@cam ,20200417, add for oem hw controller*/ +static uint32_t g_oem_data[CAM_OEM_RW_SIZE_MAX]; +static struct cam_sensor_i2c_reg_array g_reg_setting[CAM_OEM_RW_SIZE_MAX]; +/*add by hongbo.dai@camera 20190221, get DPC Data for IMX471*/ +struct sony_dfct_tbl_t imx471_dfct_tbl; + +static int sensor_imx471_get_dpc_data(struct cam_sensor_ctrl_t *s_ctrl) +{ + int i = 0, j = 0; + int rc = 0; + int check_reg_val, dfct_data_h, dfct_data_l; + int dfct_data = 0; + int fd_dfct_num = 0, sg_dfct_num = 0; + int retry_cnt = 5; + int data_h = 0, data_v = 0; + int fd_dfct_addr = FD_DFCT_ADDR; + int sg_dfct_addr = SG_DFCT_ADDR; + + CAM_INFO(CAM_SENSOR, "sensor_imx471_get_dpc_data enter"); + if (s_ctrl == NULL) { + CAM_ERR(CAM_SENSOR, "Invalid Args"); + return -EINVAL; + } + + memset(&imx471_dfct_tbl, 0, sizeof(struct sony_dfct_tbl_t)); + + for (i = 0; i < retry_cnt; i++) { + check_reg_val = 0; + rc = camera_io_dev_read(&(s_ctrl->io_master_info), + FD_DFCT_NUM_ADDR, &check_reg_val, + CAMERA_SENSOR_I2C_TYPE_WORD, + CAMERA_SENSOR_I2C_TYPE_BYTE); + + if (0 == rc) { + fd_dfct_num = check_reg_val & 0x07; + if (fd_dfct_num > FD_DFCT_MAX_NUM) + fd_dfct_num = FD_DFCT_MAX_NUM; + break; + } + } + + for (i = 0; i < retry_cnt; i++) { + check_reg_val = 0; + rc = camera_io_dev_read(&(s_ctrl->io_master_info), + SG_DFCT_NUM_ADDR, &check_reg_val, + CAMERA_SENSOR_I2C_TYPE_WORD, + CAMERA_SENSOR_I2C_TYPE_WORD); + + if (0 == rc) { + sg_dfct_num = check_reg_val & 0x01FF; + if (sg_dfct_num > SG_DFCT_MAX_NUM) + sg_dfct_num = SG_DFCT_MAX_NUM; + break; + } + } + + CAM_INFO(CAM_SENSOR, " fd_dfct_num = %d, sg_dfct_num = %d", fd_dfct_num, sg_dfct_num); + imx471_dfct_tbl.fd_dfct_num = fd_dfct_num; + imx471_dfct_tbl.sg_dfct_num = sg_dfct_num; + + if (fd_dfct_num > 0) { + for (j = 0; j < fd_dfct_num; j++) { + dfct_data = 0; + for (i = 0; i < retry_cnt; i++) { + dfct_data_h = 0; + rc = camera_io_dev_read(&(s_ctrl->io_master_info), + fd_dfct_addr, &dfct_data_h, + CAMERA_SENSOR_I2C_TYPE_WORD, + CAMERA_SENSOR_I2C_TYPE_WORD); + if (0 == rc) { + break; + } + } + for (i = 0; i < retry_cnt; i++) { + dfct_data_l = 0; + rc = camera_io_dev_read(&(s_ctrl->io_master_info), + fd_dfct_addr+2, &dfct_data_l, + CAMERA_SENSOR_I2C_TYPE_WORD, + CAMERA_SENSOR_I2C_TYPE_WORD); + if (0 == rc) { + break; + } + } + CAM_DBG(CAM_SENSOR, " dfct_data_h = 0x%x, dfct_data_l = 0x%x", dfct_data_h, dfct_data_l); + dfct_data = (dfct_data_h << 16) | dfct_data_l; + data_h = 0; + data_v = 0; + data_h = (dfct_data & (H_DATA_MASK >> j%8)) >> (19 - j%8); //19 = 32 -13; + data_v = (dfct_data & (V_DATA_MASK >> j%8)) >> (7 - j%8); // 7 = 32 -13 -12; + CAM_DBG(CAM_SENSOR, "j = %d, H = %d, V = %d", j, data_h, data_v); + imx471_dfct_tbl.fd_dfct_addr[j] = ((data_h & 0x1FFF) << V_ADDR_SHIFT) | (data_v & 0x0FFF); + CAM_DBG(CAM_SENSOR, "fd_dfct_data[%d] = 0x%08x", j, imx471_dfct_tbl.fd_dfct_addr[j]); + fd_dfct_addr = fd_dfct_addr + 3 + ((j+1)%8 == 0); + } + } + if (sg_dfct_num > 0) { + for (j = 0; j < sg_dfct_num; j++) { + dfct_data = 0; + for (i = 0; i < retry_cnt; i++) { + dfct_data_h = 0; + rc = camera_io_dev_read(&(s_ctrl->io_master_info), + sg_dfct_addr, &dfct_data_h, + CAMERA_SENSOR_I2C_TYPE_WORD, + CAMERA_SENSOR_I2C_TYPE_WORD); + if (0 == rc) { + break; + } + } + for (i = 0; i < retry_cnt; i++) { + dfct_data_l = 0; + rc = camera_io_dev_read(&(s_ctrl->io_master_info), + sg_dfct_addr+2, &dfct_data_l, + CAMERA_SENSOR_I2C_TYPE_WORD, + CAMERA_SENSOR_I2C_TYPE_WORD); + if (0 == rc) { + break; + } + } + CAM_DBG(CAM_SENSOR, " dfct_data_h = 0x%x, dfct_data_l = 0x%x", dfct_data_h, dfct_data_l); + dfct_data = (dfct_data_h << 16) | dfct_data_l; + data_h = 0; + data_v = 0; + data_h = (dfct_data & (H_DATA_MASK >> j%8)) >> (19 - j%8); //19 = 32 -13; + data_v = (dfct_data & (V_DATA_MASK >> j%8)) >> (7 - j%8); // 7 = 32 -13 -12; + CAM_DBG(CAM_SENSOR, "j = %d, H = %d, V = %d", j, data_h, data_v); + imx471_dfct_tbl.sg_dfct_addr[j] = ((data_h & 0x1FFF) << V_ADDR_SHIFT) | (data_v & 0x0FFF); + CAM_DBG(CAM_SENSOR, "sg_dfct_data[%d] = 0x%08x", j, imx471_dfct_tbl.sg_dfct_addr[j]); + sg_dfct_addr = sg_dfct_addr + 3 + ((j+1)%8 == 0); + } + } + + CAM_INFO(CAM_SENSOR, "exit"); + return rc; +} +#endif static void cam_sensor_update_req_mgr( struct cam_sensor_ctrl_t *s_ctrl, struct cam_packet *csl_packet) @@ -620,6 +756,21 @@ int cam_sensor_match_id(struct cam_sensor_ctrl_t *s_ctrl) { int rc = 0; uint32_t chipid = 0; + uint32_t gc02m0_high = 0; + uint32_t gc02m0_low = 0; + uint32_t chipid_high = 0; + uint32_t chipid_low = 0; + /* LuXianglong@OPLUS.COM, add for distinguishing two VCM resource, 20210302 */ + #ifdef VENDOR_EDIT + const uint32_t S5KHM2_FIRST_SOURCE_VCMID = 0xE6; + const uint32_t S5KHM2_SECOND_SOURCE_VCMID = 0xE9; + const uint32_t S5KHM2_VCMID_ADDR = 0x0A; + const uint32_t S5KHM2_EEPROM_I2C_ADDR = (0xA0 >> 1); + const uint16_t S5KHM2_FIRST_SOURCE_SENSORID = 0x1AD2; + const uint16_t S5KHM2_SECOND_SOURCE_SENSORID = 0x1AD3; + uint32_t vcmId = 0; + struct cam_sensor_cci_client eeprom_cci_client; + #endif struct cam_camera_slave_info *slave_info; slave_info = &(s_ctrl->sensordata->slave_info); @@ -636,6 +787,69 @@ int cam_sensor_match_id(struct cam_sensor_ctrl_t *s_ctrl) &chipid, CAMERA_SENSOR_I2C_TYPE_WORD, CAMERA_SENSOR_I2C_TYPE_WORD); + /* LuXianglong@OPLUS.COM, add for distinguishing two VCM resource, 20210302 */ + #ifdef VENDOR_EDIT + if (chipid == S5KHM2_FIRST_SOURCE_SENSORID + && (slave_info->sensor_id == S5KHM2_FIRST_SOURCE_SENSORID + || slave_info->sensor_id == S5KHM2_SECOND_SOURCE_SENSORID)) { + // Read VCM ID from EEPROM of S5KHM2 camera module + memset(&eeprom_cci_client, 0x0, sizeof(struct cam_sensor_cci_client)); + memcpy(&eeprom_cci_client, s_ctrl->io_master_info.cci_client, + sizeof(struct cam_sensor_cci_client)); + eeprom_cci_client.sid = S5KHM2_EEPROM_I2C_ADDR; + cam_cci_i2c_read(&eeprom_cci_client, + S5KHM2_VCMID_ADDR, + &vcmId, CAMERA_SENSOR_I2C_TYPE_WORD, + CAMERA_SENSOR_I2C_TYPE_BYTE); + + // Distinguish VCM resource + if (vcmId == S5KHM2_FIRST_SOURCE_VCMID + && slave_info->sensor_id == S5KHM2_FIRST_SOURCE_SENSORID) { + CAM_ERR(CAM_SENSOR, "First VCM resource match"); + chipid = S5KHM2_FIRST_SOURCE_SENSORID; + } else if (vcmId == S5KHM2_SECOND_SOURCE_VCMID + && slave_info->sensor_id == S5KHM2_SECOND_SOURCE_SENSORID) { + CAM_ERR(CAM_SENSOR, "Second VCM resource match"); + chipid = S5KHM2_SECOND_SOURCE_SENSORID; + } else { + CAM_ERR(CAM_SENSOR, "Failed to match VCM Resource"); + return -ENODEV; + } + } + #endif + + if (slave_info->sensor_id == 0x02d0 || slave_info->sensor_id == 0x02e0) { + gc02m0_high = slave_info->sensor_id_reg_addr & 0xff00; + gc02m0_high = gc02m0_high >> 8; + gc02m0_low = slave_info->sensor_id_reg_addr & 0x00ff; + rc = camera_io_dev_read( + &(s_ctrl->io_master_info), + gc02m0_high, + &chipid_high, CAMERA_SENSOR_I2C_TYPE_BYTE, + CAMERA_SENSOR_I2C_TYPE_BYTE); + + CAM_ERR(CAM_SENSOR, "gc02m0_high: 0x%x chipid_high id 0x%x:", + gc02m0_high, chipid_high); + + rc = camera_io_dev_read( + &(s_ctrl->io_master_info), + gc02m0_low, + &chipid_low, CAMERA_SENSOR_I2C_TYPE_BYTE, + CAMERA_SENSOR_I2C_TYPE_BYTE); + + CAM_ERR(CAM_SENSOR, "gc02m0_low: 0x%x chipid_low id 0x%x:", + gc02m0_low, chipid_low); + + chipid = ((chipid_high << 8) & 0xff00) | (chipid_low & 0x00ff); + + } + #ifdef VENDOR_EDIT + //Fangyan @ Camera.Drv 2020/05/12 for ov02b different sensor id + if ((chipid & 0xff00) == 0x2b00) + { + chipid = 0x2b00; + } + #endif CAM_DBG(CAM_SENSOR, "read id: 0x%x expected id 0x%x:", chipid, slave_info->sensor_id); if (cam_sensor_id_by_mask(s_ctrl, chipid) != slave_info->sensor_id) { @@ -643,6 +857,13 @@ int cam_sensor_match_id(struct cam_sensor_ctrl_t *s_ctrl) chipid, slave_info->sensor_id); return -ENODEV; } + + #ifdef VENDOR_EDIT + /*add by hongbo.dai@camera 20190221, get DPC Data for IMX471*/ + if (slave_info->sensor_id == 0x0471) { + sensor_imx471_get_dpc_data(s_ctrl); + } + #endif return rc; } @@ -990,6 +1211,144 @@ int32_t cam_sensor_driver_cmd(struct cam_sensor_ctrl_t *s_ctrl, } } break; +#ifdef VENDOR_EDIT +/*Zhixian.mai@Cam.Drv 20200329 add for oem ioctl for read /write register*/ + case CAM_OEM_RW_REG:{ + struct cam_oem_rw_ctl oem_ctl; + struct camera_io_master oem_io_master_info; + struct cam_sensor_cci_client oem_cci_client; + + if (copy_from_user(&oem_ctl, (void __user *)cmd->handle, + sizeof(struct cam_oem_rw_ctl))) { + CAM_ERR(CAM_SENSOR, + "Fail in copy oem control infomation form user data"); + goto release_mutex; + } + if (oem_ctl.num_bytes > CAM_OEM_RW_SIZE_MAX){ + CAM_ERR(CAM_SENSOR, + "OEM HW control reg exceed maximum limit !"); + goto release_mutex; + } + memcpy(&oem_io_master_info, &(s_ctrl->io_master_info),sizeof(struct camera_io_master)); + memcpy(&oem_cci_client, s_ctrl->io_master_info.cci_client,sizeof(struct cam_sensor_cci_client)); + oem_io_master_info.cci_client = &oem_cci_client; + if (oem_ctl.slave_addr != 0) { + oem_io_master_info.cci_client->sid = (oem_ctl.slave_addr >> 1); + } + + switch (oem_ctl.cmd_code) { + case CAM_OEM_CMD_READ_DEV: { + int i = 0; + memset(g_oem_data,0,sizeof(g_oem_data)); + if (oem_ctl.num_bytes < CAM_OEM_RW_SIZE_MAX + && oem_ctl.num_bytes > 0) { + for (i = 0; i < oem_ctl.num_bytes; i++) { + rc = cam_cci_i2c_read( + oem_io_master_info.cci_client, + (oem_ctl.reg_addr + i* oem_ctl.reg_data_type), + &g_oem_data[i], + oem_ctl.reg_addr_type, + oem_ctl.reg_data_type); + CAM_DBG(CAM_SENSOR, + "read addr:0x%x Data:0x%x ",(oem_ctl.reg_addr + i*oem_ctl.reg_data_type),g_oem_data[i]); + } + } else { + CAM_ERR(CAM_SENSOR, + "OEM HW control register number is Invalid !"); + goto release_mutex; + + } + + if (rc < 0){ + CAM_ERR(CAM_SENSOR, + "Fail oem ctl data ,slave sensor id is 0x%x",s_ctrl->sensordata->slave_info.sensor_id); + goto release_mutex; + + } + if (copy_to_user((void __user *)oem_ctl.data_addr,g_oem_data, + sizeof(uint32_t) * oem_ctl.num_bytes)) { + CAM_ERR(CAM_SENSOR, + "Fail oem ctl data ,slave sensor id is 0x%x",s_ctrl->sensordata->slave_info.sensor_id); + goto release_mutex; + + } + break; + } + case CAM_OEM_CMD_WRITE_DEV: { + int i = 0; + struct cam_sensor_i2c_reg_setting write_setting; + if (oem_ctl.num_bytes < CAM_OEM_RW_SIZE_MAX + && oem_ctl.num_bytes > 0) { + memset(g_reg_setting,0,sizeof(g_reg_setting)); + if (copy_from_user(&g_reg_setting,(void __user *)oem_ctl.data_addr, + sizeof(struct cam_sensor_i2c_reg_array ) * oem_ctl.num_bytes)) { + CAM_ERR(CAM_SENSOR, + "Fail oem ctl data ,slave sensor id is 0x%x",s_ctrl->sensordata->slave_info.sensor_id); + goto release_mutex; + } + + for ( i= 0 ;i< oem_ctl.num_bytes;i++) { + CAM_DBG(CAM_SENSOR,"Get from OEM addr: 0x%x data: 0x%x ", + g_reg_setting[i].reg_addr,g_reg_setting[i].reg_data); + } + + write_setting.addr_type = oem_ctl.reg_addr_type; + write_setting.data_type = oem_ctl.reg_data_type; + write_setting.size = oem_ctl.num_bytes; + write_setting.reg_setting = g_reg_setting; + + rc = cam_cci_i2c_write_table(&oem_io_master_info,&write_setting); + + if (rc < 0){ + CAM_ERR(CAM_SENSOR, + "Fail oem write data ,slave sensor id is 0x%x",s_ctrl->sensordata->slave_info.sensor_id); + goto release_mutex; + + } + } else { + CAM_ERR(CAM_SENSOR, + "OEM HW control register number is Invalid !"); + goto release_mutex; + + } + + } + break; + default: + CAM_ERR(CAM_SENSOR, + "Unknow OEM cmd ,slave sensor id is 0x%x",s_ctrl->sensordata->slave_info.sensor_id); + break ; + } + + } + break; + + case CAM_OEM_GET_ID : { + if (copy_to_user((void __user *)cmd->handle,&s_ctrl->soc_info.index, + sizeof(uint32_t))) { + CAM_ERR(CAM_SENSOR, + "copy camera id to user fail "); + } + break; + } + /*add by hongbo.dai@camera 20190221, get DPC Data for IMX471*/ + case CAM_GET_DPC_DATA: { + if (0x0471 != s_ctrl->sensordata->slave_info.sensor_id) { + rc = -EFAULT; + goto release_mutex; + } + CAM_INFO(CAM_SENSOR, "imx471_dfct_tbl: fd_dfct_num=%d, sg_dfct_num=%d", + imx471_dfct_tbl.fd_dfct_num, imx471_dfct_tbl.sg_dfct_num); + if (copy_to_user((void __user *) cmd->handle, &imx471_dfct_tbl, + sizeof(struct sony_dfct_tbl_t))) { + CAM_ERR(CAM_SENSOR, "Failed Copy to User"); + rc = -EFAULT; + goto release_mutex; + } + } + break; +#endif + default: CAM_ERR(CAM_SENSOR, "Invalid Opcode: %d", cmd->op_code); rc = -EINVAL; diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor/cam_sensor_dev.c b/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor/cam_sensor_dev.c index 5207eee15f05..584dcce9278b 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor/cam_sensor_dev.c +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor/cam_sensor_dev.c @@ -14,6 +14,41 @@ #include "cam_req_mgr_dev.h" #include "cam_sensor_soc.h" #include "cam_sensor_core.h" +/* hongbo.dai@camera 20181122 add for at camera test */ +#ifdef VENDOR_EDIT +struct cam_sensor_i2c_reg_setting_array { + struct cam_sensor_i2c_reg_array reg_setting[4600]; + unsigned short size; + enum camera_sensor_i2c_type addr_type; + enum camera_sensor_i2c_type data_type; + unsigned short delay; +}; + +struct cam_sensor_settings { + struct cam_sensor_i2c_reg_setting_array imx586_setting; + struct cam_sensor_i2c_reg_setting_array imx471_setting; + struct cam_sensor_i2c_reg_setting_array imx319_setting; + struct cam_sensor_i2c_reg_setting_array s5km5_setting; + struct cam_sensor_i2c_reg_setting_array gc02m0b_setting; + struct cam_sensor_i2c_reg_setting_array gc2375_setting; + struct cam_sensor_i2c_reg_setting_array ov02a1b_setting; + struct cam_sensor_i2c_reg_setting_array hi846_setting; + struct cam_sensor_i2c_reg_setting_array s5kgd1sp_setting; + struct cam_sensor_i2c_reg_setting_array imx616_setting; + struct cam_sensor_i2c_reg_setting_array ov2241_setting; + struct cam_sensor_i2c_reg_setting_array ov02b_setting; + struct cam_sensor_i2c_reg_setting_array gc02m1b_setting; + struct cam_sensor_i2c_reg_setting_array s5kgh1_setting; + struct cam_sensor_i2c_reg_setting_array ov64b_setting; + struct cam_sensor_i2c_reg_setting_array s5khm2s_setting; +}; + +struct cam_sensor_settings sensor_settings = { +#include "CAM_SENSOR_SETTINGS.h" +}; +/*add by hongbo.dai@camera 20181213, for Camera AT current test*/ +static bool is_ftm_current_test = false; +#endif static long cam_sensor_subdev_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) @@ -21,11 +56,160 @@ static long cam_sensor_subdev_ioctl(struct v4l2_subdev *sd, int rc = 0; struct cam_sensor_ctrl_t *s_ctrl = v4l2_get_subdevdata(sd); +/* hongbo.dai@camera 20181122 add for at camera test */ +#ifdef VENDOR_EDIT + struct cam_sensor_i2c_reg_setting sensor_setting; + int i = 0; +#endif switch (cmd) { case VIDIOC_CAM_CONTROL: rc = cam_sensor_driver_cmd(s_ctrl, arg); break; +#ifdef VENDOR_EDIT + /* hongbo.dai@camera 20181122 add for at camera test */ + case VIDIOC_CAM_FTM_POWNER_DOWN: + CAM_ERR(CAM_SENSOR, "FTM power down"); + return cam_sensor_power_down(s_ctrl); + break; + case VIDIOC_CAM_FTM_POWNER_UP: + CAM_ERR(CAM_SENSOR, "FTM power up, sensor id 0x%x", s_ctrl->sensordata->slave_info.sensor_id); + rc = cam_sensor_power_up(s_ctrl); + if(rc < 0) { + CAM_ERR(CAM_SENSOR, "ftm power up failed!"); + break; + } + is_ftm_current_test = true; + if (s_ctrl->sensordata->slave_info.sensor_id == 0x586) { + sensor_setting.reg_setting = sensor_settings.imx586_setting.reg_setting; + sensor_setting.addr_type = CAMERA_SENSOR_I2C_TYPE_WORD; + sensor_setting.data_type = CAMERA_SENSOR_I2C_TYPE_BYTE; + sensor_setting.size = sensor_settings.imx586_setting.size; + sensor_setting.delay = sensor_settings.imx586_setting.delay; + CAM_ERR(CAM_SENSOR,"FTM GET imx586 setting"); + } else if(s_ctrl->sensordata->slave_info.sensor_id == 0x471) { + sensor_setting.reg_setting = sensor_settings.imx471_setting.reg_setting; + sensor_setting.addr_type = CAMERA_SENSOR_I2C_TYPE_WORD; + sensor_setting.data_type = CAMERA_SENSOR_I2C_TYPE_BYTE; + sensor_setting.size = sensor_settings.imx471_setting.size; + sensor_setting.delay = sensor_settings.imx471_setting.delay; + CAM_ERR(CAM_SENSOR,"FTM GET imx471 setting"); + } else if(s_ctrl->sensordata->slave_info.sensor_id == 0x319) { + sensor_setting.reg_setting = sensor_settings.imx319_setting.reg_setting; + sensor_setting.addr_type = CAMERA_SENSOR_I2C_TYPE_WORD; + sensor_setting.data_type = CAMERA_SENSOR_I2C_TYPE_BYTE; + sensor_setting.size = sensor_settings.imx319_setting.size; + sensor_setting.delay = sensor_settings.imx319_setting.delay; + CAM_ERR(CAM_SENSOR,"FTM GET imx319 setting"); + } else if(s_ctrl->sensordata->slave_info.sensor_id == 0x30D5) { + sensor_setting.reg_setting = sensor_settings.s5km5_setting.reg_setting; + sensor_setting.addr_type = CAMERA_SENSOR_I2C_TYPE_WORD; + sensor_setting.data_type = CAMERA_SENSOR_I2C_TYPE_WORD; + sensor_setting.size = sensor_settings.s5km5_setting.size; + sensor_setting.delay = sensor_settings.s5km5_setting.delay; + CAM_ERR(CAM_SENSOR,"FTM GET s5km5 setting"); + } else if(s_ctrl->sensordata->slave_info.sensor_id == 0x02d0) { + sensor_setting.reg_setting = sensor_settings.gc02m0b_setting.reg_setting; + sensor_setting.addr_type = CAMERA_SENSOR_I2C_TYPE_BYTE; + sensor_setting.data_type = CAMERA_SENSOR_I2C_TYPE_BYTE; + sensor_setting.size = sensor_settings.gc02m0b_setting.size; + sensor_setting.delay = sensor_settings.gc02m0b_setting.delay; + CAM_ERR(CAM_SENSOR,"FTM GET gc02m0b setting"); + } else if(s_ctrl->sensordata->slave_info.sensor_id == 0x25) { + sensor_setting.reg_setting = sensor_settings.ov02a1b_setting.reg_setting; + sensor_setting.addr_type = CAMERA_SENSOR_I2C_TYPE_BYTE; + sensor_setting.data_type = CAMERA_SENSOR_I2C_TYPE_BYTE; + sensor_setting.size = sensor_settings.ov02a1b_setting.size; + sensor_setting.delay = sensor_settings.ov02a1b_setting.delay; + CAM_ERR(CAM_SENSOR,"FTM GET ov02a1b setting"); + } else if(s_ctrl->sensordata->slave_info.sensor_id == 0x7500) { + sensor_setting.reg_setting = sensor_settings.gc2375_setting.reg_setting; + sensor_setting.addr_type = CAMERA_SENSOR_I2C_TYPE_BYTE; + sensor_setting.data_type = CAMERA_SENSOR_I2C_TYPE_BYTE; + sensor_setting.size = sensor_settings.gc2375_setting.size; + sensor_setting.delay = sensor_settings.gc2375_setting.delay; + CAM_ERR(CAM_SENSOR,"FTM GET gc2375 setting"); + } else if(s_ctrl->sensordata->slave_info.sensor_id == 0x27) { + sensor_setting.reg_setting = sensor_settings.ov2241_setting.reg_setting; + sensor_setting.addr_type = CAMERA_SENSOR_I2C_TYPE_WORD; + sensor_setting.data_type = CAMERA_SENSOR_I2C_TYPE_BYTE; + sensor_setting.size = sensor_settings.ov2241_setting.size; + sensor_setting.delay = sensor_settings.ov2241_setting.delay; + CAM_ERR(CAM_SENSOR,"FTM GET ov2241 setting"); + } else if(s_ctrl->sensordata->slave_info.sensor_id == 0x4608) { + sensor_setting.reg_setting = sensor_settings.hi846_setting.reg_setting; + sensor_setting.addr_type = CAMERA_SENSOR_I2C_TYPE_WORD; + sensor_setting.data_type = CAMERA_SENSOR_I2C_TYPE_WORD; + sensor_setting.size = sensor_settings.hi846_setting.size; + sensor_setting.delay = sensor_settings.hi846_setting.delay; + CAM_ERR(CAM_SENSOR,"FTM GET HI846 setting"); + } else if(s_ctrl->sensordata->slave_info.sensor_id == 0x0841) { + sensor_setting.reg_setting = sensor_settings.s5kgd1sp_setting.reg_setting; + sensor_setting.addr_type = CAMERA_SENSOR_I2C_TYPE_WORD; + sensor_setting.data_type = CAMERA_SENSOR_I2C_TYPE_WORD; + sensor_setting.size = sensor_settings.s5kgd1sp_setting.size; + sensor_setting.delay = sensor_settings.s5kgd1sp_setting.delay; + CAM_ERR(CAM_SENSOR,"FTM GET s5kgd1sp setting"); + } else if(s_ctrl->sensordata->slave_info.sensor_id == 0x0616) { + sensor_setting.reg_setting = sensor_settings.imx616_setting.reg_setting; + sensor_setting.addr_type = CAMERA_SENSOR_I2C_TYPE_WORD; + sensor_setting.data_type = CAMERA_SENSOR_I2C_TYPE_BYTE; + sensor_setting.size = sensor_settings.imx616_setting.size; + sensor_setting.delay = sensor_settings.imx616_setting.delay; + CAM_ERR(CAM_SENSOR,"FTM GET imx616 setting"); + } else if(s_ctrl->sensordata->slave_info.sensor_id == 0x2b00 || s_ctrl->sensordata->slave_info.sensor_id == 0x2b03) { + sensor_setting.reg_setting = sensor_settings.ov02b_setting.reg_setting; + sensor_setting.addr_type = CAMERA_SENSOR_I2C_TYPE_BYTE; + sensor_setting.data_type = CAMERA_SENSOR_I2C_TYPE_BYTE; + sensor_setting.size = sensor_settings.ov02b_setting.size; + sensor_setting.delay = sensor_settings.ov02b_setting.delay; + CAM_ERR(CAM_SENSOR,"FTM GET ov02b setting"); + } else if(s_ctrl->sensordata->slave_info.sensor_id == 0x02e0) { + sensor_setting.reg_setting = sensor_settings.gc02m1b_setting.reg_setting; + sensor_setting.addr_type = CAMERA_SENSOR_I2C_TYPE_BYTE; + sensor_setting.data_type = CAMERA_SENSOR_I2C_TYPE_BYTE; + sensor_setting.size = sensor_settings.gc02m1b_setting.size; + sensor_setting.delay = sensor_settings.gc02m1b_setting.delay; + CAM_ERR(CAM_SENSOR,"FTM GET gc02m1b setting"); + } else if(s_ctrl->sensordata->slave_info.sensor_id == 0x5664) { + sensor_setting.reg_setting = sensor_settings.ov64b_setting.reg_setting; + sensor_setting.addr_type = CAMERA_SENSOR_I2C_TYPE_WORD; + sensor_setting.data_type = CAMERA_SENSOR_I2C_TYPE_BYTE; + sensor_setting.size = sensor_settings.gc02m1b_setting.size; + sensor_setting.delay = sensor_settings.gc02m1b_setting.delay; + CAM_ERR(CAM_SENSOR,"FTM GET ov64b setting"); + } else if(s_ctrl->sensordata->slave_info.sensor_id == 0x0881 || + s_ctrl->sensordata->slave_info.sensor_id == 0xA000 || + s_ctrl->sensordata->slave_info.sensor_id == 0xA100) { + sensor_setting.reg_setting = sensor_settings.s5kgh1_setting.reg_setting; + sensor_setting.addr_type = CAMERA_SENSOR_I2C_TYPE_WORD; + sensor_setting.data_type = CAMERA_SENSOR_I2C_TYPE_WORD; + sensor_setting.size = sensor_settings.s5kgh1_setting.size; + sensor_setting.delay = sensor_settings.s5kgh1_setting.delay; + CAM_ERR(CAM_SENSOR,"FTM GET s5kgh1 setting"); + } else if(s_ctrl->sensordata->slave_info.sensor_id == 0x1ad2 || + s_ctrl->sensordata->slave_info.sensor_id == 0x1ad3) { + sensor_setting.reg_setting = sensor_settings.s5khm2s_setting.reg_setting; + sensor_setting.addr_type = CAMERA_SENSOR_I2C_TYPE_WORD; + sensor_setting.data_type = CAMERA_SENSOR_I2C_TYPE_WORD; + sensor_setting.size = sensor_settings.s5khm2s_setting.size; + sensor_setting.delay = sensor_settings.s5khm2s_setting.delay; + CAM_ERR(CAM_SENSOR,"FTM GET S5KHM2S setting"); + } + for (i = 0;iio_master_info), &sensor_setting); + + if (rc < 0) { + CAM_ERR(CAM_SENSOR, "FTM Failed to write sensor setting"); + } else { + CAM_ERR(CAM_SENSOR, "FTM successfully to write sensor setting"); + } + break; +#endif default: CAM_ERR(CAM_SENSOR, "Invalid ioctl cmd: %d", cmd); rc = -EINVAL; @@ -46,6 +230,10 @@ static int cam_sensor_subdev_close(struct v4l2_subdev *sd, } mutex_lock(&(s_ctrl->cam_sensor_mutex)); +#ifdef VENDOR_EDIT + //add by hongbo.dai@camea 20181213,ftm test will do it by powerdown + if(!is_ftm_current_test) +#endif cam_sensor_shutdown(s_ctrl); mutex_unlock(&(s_ctrl->cam_sensor_mutex)); diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor_io/cam_sensor_i2c.h b/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor_io/cam_sensor_i2c.h index e79fffb49d77..41c41078d554 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor_io/cam_sensor_i2c.h +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor_io/cam_sensor_i2c.h @@ -26,7 +26,12 @@ #define I2C_COMPARE_MATCH 0 #define I2C_COMPARE_MISMATCH 1 -#define I2C_REG_DATA_MAX (8*1024) +//#ifndef VENDOR_EDIT +//#define I2C_REG_DATA_MAX (8*1024) +//#else +//add by lvchangfu@camera, 20191139 for read eeprom data +#define I2C_REG_DATA_MAX (16*1024) +//#endif /** * @client: CCI client structure diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor_io/cam_sensor_qup_i2c.c b/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor_io/cam_sensor_qup_i2c.c index 9145a1e52f3e..fba01e1a8b52 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor_io/cam_sensor_qup_i2c.c +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor_io/cam_sensor_qup_i2c.c @@ -14,7 +14,12 @@ #include "cam_sensor_i2c.h" #include "cam_sensor_io.h" -#define I2C_REG_DATA_MAX (8*1024) +//#ifndef VENDOR_EDIT +//#define I2C_REG_DATA_MAX (8*1024) +//#else +//add by lvchangfu@camera, 20191139 for read eeprom data +#define I2C_REG_DATA_MAX (16*1024) +//#endif #define I2C_REG_MAX_BUF_SIZE 8 static int32_t cam_qup_i2c_rxdata( diff --git a/drivers/media/platform/msm/camera/cam_smmu/cam_smmu_api.c b/drivers/media/platform/msm/camera/cam_smmu/cam_smmu_api.c index a3a906e2f038..ae0b531a9169 100644 --- a/drivers/media/platform/msm/camera/cam_smmu/cam_smmu_api.c +++ b/drivers/media/platform/msm/camera/cam_smmu/cam_smmu_api.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -410,9 +410,8 @@ end: if (closest_mapping) { buf_handle = GET_MEM_HANDLE(idx, closest_mapping->ion_fd); CAM_INFO(CAM_SMMU, - "Closest map fd %d 0x%lx %llu-%llu 0x%lx-0x%lx buf=%pK mem %0x", + "Closest map fd %d 0x%lx 0x%lx-0x%lx buf=%pK mem %0x", closest_mapping->ion_fd, current_addr, - mapping->len, closest_mapping->len, (unsigned long)closest_mapping->paddr, (unsigned long)closest_mapping->paddr + mapping->len, closest_mapping->buf, diff --git a/drivers/media/platform/msm/camera/cam_sync/cam_sync.c b/drivers/media/platform/msm/camera/cam_sync/cam_sync.c index b53eeebe7eb4..90bb2db33b55 100644 --- a/drivers/media/platform/msm/camera/cam_sync/cam_sync.c +++ b/drivers/media/platform/msm/camera/cam_sync/cam_sync.c @@ -726,10 +726,20 @@ static int cam_sync_handle_deregister_user_payload( list_for_each_entry_safe(user_payload_kernel, temp, &row->user_payload_list, list) { +#ifndef VENDOR_EDIT if (user_payload_kernel->payload_data[0] == userpayload_info.payload[0] && user_payload_kernel->payload_data[1] == userpayload_info.payload[1]) { +#else + /* Weicong.Li@Camera , 2019/10/15 , merge qcom patch to fix UpdateDependency crash, case:04229960 */ + if (user_payload_kernel->payload_data[0] == + userpayload_info.payload[0]) { + CAM_ERR(CAM_SYNC, + "Info: deregister success for sync_obj %d payload[0] %llx", + sync_obj, + user_payload_kernel->payload_data[0]); +#endif list_del_init(&user_payload_kernel->list); kfree(user_payload_kernel); } diff --git a/drivers/media/platform/msm/camera/cam_utils/cam_debug_util.h b/drivers/media/platform/msm/camera/cam_utils/cam_debug_util.h index d7069c09cc2a..7c85f39427e5 100644 --- a/drivers/media/platform/msm/camera/cam_utils/cam_debug_util.h +++ b/drivers/media/platform/msm/camera/cam_utils/cam_debug_util.h @@ -84,7 +84,7 @@ const char *cam_get_module_name(unsigned int module_id); * @args : Arguments which needs to be print in log */ #define CAM_ERR(__module, fmt, args...) \ - pr_err("CAM_ERR: %s: %s: %d " fmt "\n", \ + pr_info("CAM_ERR: %s: %s: %d " fmt "\n", \ cam_get_module_name(__module), __func__, __LINE__, ##args) /* * CAM_WARN @@ -158,7 +158,7 @@ const char *cam_get_module_name(unsigned int module_id); * @brief : This Macro will print error print logs with ratelimit */ #define CAM_ERR_RATE_LIMIT(__module, fmt, args...) \ - pr_err_ratelimited("CAM_ERR: %s: %s: %d " fmt "\n", \ + pr_info_ratelimited("CAM_ERR: %s: %s: %d " fmt "\n", \ cam_get_module_name(__module), __func__, __LINE__, ##args) /* diff --git a/drivers/media/platform/msm/camera/cam_utils/cam_io_util.c b/drivers/media/platform/msm/camera/cam_utils/cam_io_util.c index af785af68f40..8d5f96ac816f 100644 --- a/drivers/media/platform/msm/camera/cam_utils/cam_io_util.c +++ b/drivers/media/platform/msm/camera/cam_utils/cam_io_util.c @@ -272,8 +272,8 @@ int cam_io_dump(void __iomem *base_addr, uint32_t start_offset, int size) p_str += 11; } data = readl_relaxed(base_addr + REG_OFFSET(start_offset, i)); - snprintf(p_str, 10, "%08x ", data); - p_str += 9; + snprintf(p_str, 9, "%08x ", data); + p_str += 8; if ((i + 1) % NUM_REGISTER_PER_LINE == 0) { CAM_ERR(CAM_UTIL, "%s", line_str); line_str[0] = '\0'; diff --git a/drivers/media/platform/msm/camera/cam_utils/cam_soc_util.h b/drivers/media/platform/msm/camera/cam_utils/cam_soc_util.h index d0bab027790e..429dc6e8ab44 100644 --- a/drivers/media/platform/msm/camera/cam_utils/cam_soc_util.h +++ b/drivers/media/platform/msm/camera/cam_utils/cam_soc_util.h @@ -36,7 +36,12 @@ #define CAM_SOC_MAX_BASE CAM_SOC_MAX_BLOCK /* maximum number of device regulator */ -#define CAM_SOC_MAX_REGULATOR 5 +//#ifndef VENDOR_EDIT +/*litao@Cam.Drv, 20200306, add for 19365 sensor porting*/ +//#define CAM_SOC_MAX_REGULATOR 5 +//#else +#define CAM_SOC_MAX_REGULATOR 7 +//#endif /* maximum number of device clock */ #define CAM_SOC_MAX_CLK 32 diff --git a/drivers/media/platform/msm/camera/cam_utils/cam_trace.h b/drivers/media/platform/msm/camera/cam_utils/cam_trace.h index 5e45127baf68..c8b1fb00c124 100644 --- a/drivers/media/platform/msm/camera/cam_utils/cam_trace.h +++ b/drivers/media/platform/msm/camera/cam_utils/cam_trace.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -286,34 +286,6 @@ TRACE_EVENT(cam_irq_handled, ) ); -TRACE_EVENT(cam_isp_irq_delay_detect, - TP_PROTO(const char *text, struct cam_context *ctx, - uint64_t request_id, uint32_t substate, - uint64_t timestamp), - TP_ARGS(text, ctx, request_id, substate, timestamp), - TP_STRUCT__entry( - __string(text, text) - __field(uint32_t, ctx_id) - __field(uint64_t, dev_id) - __field(uint64_t, req_id) - __field(uint32_t, substate) - __field(uint64_t, ts) - ), - TP_fast_assign( - __assign_str(text, text); - __entry->ctx_id = ctx->ctx_id; - __entry->dev_id = ctx->dev_id; - __entry->req_id = request_id; - __entry->substate = substate; - __entry->ts = timestamp; - ), - TP_printk( - "ISP: %s ctx=%u dev_id=%u req_id=%lld substate=%u event=%u delay_by=%llu", - __get_str(text), __entry->ctx_id, __entry->dev_id, - __entry->req_id, __entry->substate, __entry->ts - ) -); - TRACE_EVENT(cam_cdm_cb, TP_PROTO(const char *entity, uint32_t status), TP_ARGS(entity, status), diff --git a/drivers/media/platform/msm/camera_v2/sensor/cci/msm_cci.c b/drivers/media/platform/msm/camera_v2/sensor/cci/msm_cci.c index fe15782812d2..1515f2a00af7 100644 --- a/drivers/media/platform/msm/camera_v2/sensor/cci/msm_cci.c +++ b/drivers/media/platform/msm/camera_v2/sensor/cci/msm_cci.c @@ -52,7 +52,12 @@ /* Max bytes that can be read per CCI read transaction */ #define CCI_READ_MAX 12 #define CCI_I2C_READ_MAX_RETRIES 3 -#define CCI_I2C_MAX_READ 8192 +//#ifndef VENDOR_EDIT +//#define CCI_I2C_MAX_READ 8192 +//#else +//add by litao@camera, 20200311 for read eeprom data +#define CCI_I2C_MAX_READ 16384 +//#endif #define CCI_I2C_MAX_WRITE 8192 #define PRIORITY_QUEUE (QUEUE_0) diff --git a/drivers/media/platform/msm/camera_v2/sensor/csid/include/msm_csid_3_5_hwreg.h b/drivers/media/platform/msm/camera_v2/sensor/csid/include/msm_csid_3_5_hwreg.h index d145c0945eaa..d5463443068e 100644 --- a/drivers/media/platform/msm/camera_v2/sensor/csid/include/msm_csid_3_5_hwreg.h +++ b/drivers/media/platform/msm/camera_v2/sensor/csid/include/msm_csid_3_5_hwreg.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2015, 2018, 2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015, 2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -49,7 +49,7 @@ static struct csid_reg_parms_t csid_v3_5 = { 0xB8, 0xBC, 11, - 0x7FFFF, + 0x7FFF, 0x4, 17, 0x30050000, diff --git a/drivers/media/platform/msm/camera_v2/sensor/csid/msm_csid.c b/drivers/media/platform/msm/camera_v2/sensor/csid/msm_csid.c index 9f0bd6f9e4f0..851bb261ca1b 100644 --- a/drivers/media/platform/msm/camera_v2/sensor/csid/msm_csid.c +++ b/drivers/media/platform/msm/camera_v2/sensor/csid/msm_csid.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -854,14 +854,6 @@ static int msm_csid_release(struct csid_device *csid_dev) msm_camera_enable_irq(csid_dev->irq, false); - if (msm_camera_tz_is_secured( - MSM_CAMERA_TZ_IO_REGION_CSIDCORE0 + csid_dev->pdev->id) == 0) { - msm_camera_vio_w(csid_dev->ctrl_reg->csid_reg.csid_rst_stb_all, - csid_dev->base, - csid_dev->ctrl_reg->csid_reg.csid_rst_cmd_addr, - csid_dev->pdev->id); - } - msm_camera_clk_enable(&csid_dev->pdev->dev, csid_dev->csid_clk_info, csid_dev->csid_clk, diff --git a/drivers/media/platform/msm/camera_v2/sensor/csiphy/include/msm_csiphy_3_5_hwreg.h b/drivers/media/platform/msm/camera_v2/sensor/csiphy/include/msm_csiphy_3_5_hwreg.h index 216bfccd87d0..68f8ea37b080 100644 --- a/drivers/media/platform/msm/camera_v2/sensor/csiphy/include/msm_csiphy_3_5_hwreg.h +++ b/drivers/media/platform/msm/camera_v2/sensor/csiphy/include/msm_csiphy_3_5_hwreg.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2016, 2018-2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2016, 2018-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -26,7 +26,7 @@ static struct csiphy_reg_parms_t csiphy_v3_5 = { static struct csiphy_reg_3ph_parms_t csiphy_v3_5_3ph = { /*MIPI CSI PHY registers*/ - {0x814, 0xD5}, + {0x814, 0x0}, {0x818, 0x1}, {0x188, 0x7F}, {0x18C, 0x7F}, @@ -80,15 +80,15 @@ static struct csiphy_reg_3ph_parms_t csiphy_v3_5_3ph = { {0x4, 0x8}, {0x8, 0x0}, {0xC, 0xA5}, - {0x10, 0x50}, + {0x10, 0x52}, {0x2C, 0x1}, {0x30, 0x2}, - {0x34, 0x1}, + {0x34, 0x3}, {0x38, 0x1}, {0x3C, 0xB8}, {0x1C, 0xA}, {0x14, 0x0}, - {0x0, 0xD7}, + {0x0, 0x0}, {0x700, 0xC0}, }; #endif diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 2d4c9718efc8..899b058b63d1 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -607,7 +607,34 @@ source "drivers/misc/mic/Kconfig" source "drivers/misc/genwqe/Kconfig" source "drivers/misc/echo/Kconfig" source "drivers/misc/cxl/Kconfig" +source "drivers/misc/aw8697_haptic/Kconfig" source "drivers/misc/fpr_FingerprintCard/Kconfig" + +#ifdef OPLUS_FEATURE_CHG_BASIC +source "drivers/misc/oppo_motor/Kconfig" +#endif + +#ifdef OPLUS_FEATURE_TP_BASIC +#Fuchun.Liao@BSP.CHG.Basic 2018/11/26 modify for rf cable monitor +#Qicai.Gu@BSP.TP, 2020/07/30, modify for rf cable monitor +config OPLUS_RF_CABLE_MONITOR + bool "OPLUS rf cable monitor system" + depends on OF + select PINMUX + default n + help + Say Y here to enable OPLUS rf cable monitor system support +#endif /* OPLUS_FEATURE_TP_BASIC */ + +#ifdef OPLUS_FEATURE_TP_BASIC +#Qicai.Gu@BSP.TP, 2020/08/25, modify for sim detect +config SIM_DETECT + tristate "SIM_DETECT system" + default n + help + Say Y here to enable sim detect system support +#endif /* OPLUS_FEATURE_TP_BASIC */ + endmenu config OKL4_USER_VIPC diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 553ddb0d58e7..900db0733f8f 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -41,6 +41,7 @@ obj-$(CONFIG_VMWARE_BALLOON) += vmw_balloon.o obj-$(CONFIG_PCH_PHUB) += pch_phub.o obj-y += ti-st/ obj-y += lis3lv02d/ +obj-$(CONFIG_AW8697_HAPTIC) +=aw8697_haptic/ obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o obj-$(CONFIG_ALTERA_STAPL) +=altera-stapl/ obj-$(CONFIG_INTEL_MEI) += mei/ @@ -70,6 +71,21 @@ obj-$(CONFIG_OKL4_USER_VIRQ) += okl4-virq.o obj-$(CONFIG_OKL4_RINGBUF) += okl4-ringbuf.o obj-$(CONFIG_TEST_IRQ_REQUESTER) += irq_requester.o +#ifdef OPLUS_FEATURE_TP_BASIC +#Qicai.Gu@BSP.TP, 2020/08/10, modify for rf cable monitor +obj-$(CONFIG_OPLUS_RF_CABLE_MONITOR) += oplus_rf_cable_monitor.o +#endif + +#ifdef OPLUS_FEATURE_CHG_BASIC +obj-y += motor.o +obj-y += oppo_motor/ +#endif + +#ifdef OPLUS_FEATURE_TP_BASIC +#Qicai.Gu@BSP.TP, 2020/08/10, modify for sim detect +obj-$(CONFIG_SIM_DETECT) += sim_detect.o +#endif + lkdtm-$(CONFIG_LKDTM) += lkdtm_core.o lkdtm-$(CONFIG_LKDTM) += lkdtm_bugs.o lkdtm-$(CONFIG_LKDTM) += lkdtm_heap.o diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index c5aa3de1cee0..dba0d1934120 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -72,6 +72,9 @@ MODULE_ALIAS("mmc:block"); #define MMC_EXTRACT_INDEX_FROM_ARG(x) ((x & 0x00FF0000) >> 16) #define MMC_EXTRACT_VALUE_FROM_ARG(x) ((x & 0x0000FF00) >> 8) +#define MMC_ABNORMAL_TIMEOUT (10 * HZ) //10s +#define MMC_ABNORMAL_COUNT (30) + #define mmc_req_rel_wr(req) ((req->cmd_flags & REQ_FUA) && \ (rq_data_dir(req) == WRITE)) @@ -1419,6 +1422,10 @@ static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms, pr_err("%s: Card stuck in programming state! %s %s\n", mmc_hostname(card->host), req->rq_disk->disk_name, __func__); +#ifdef VENDOR_EDIT +//yh@bsp, 2015-10-21 Add for special card compatible + card->host->card_stuck_in_programing_status = true; +#endif /* VENDOR_EDIT */ return -ETIMEDOUT; } @@ -1534,6 +1541,39 @@ static int mmc_blk_cmd_error(struct request *req, const char *name, int error, } } +static bool mmc_blk_timeout_check(struct request *req, struct mmc_blk_request *brq) +{ + static unsigned int tout_cnt = 0; + static unsigned long tout_st = 0; + + if (brq->mrq.data && brq->mrq.data->error == -ETIMEDOUT) { + if (tout_st == 0) { + tout_st = jiffies; + return false; + } + else if (tout_cnt >= MMC_ABNORMAL_COUNT + && time_before(jiffies, tout_st + MMC_ABNORMAL_TIMEOUT)) { + tout_st = 0; + tout_cnt = 0; + pr_err("%s: too many timeout!\n", req->rq_disk->disk_name); + return true; + } + else if (!time_before(jiffies, tout_st + MMC_ABNORMAL_TIMEOUT)) { + tout_st = 0; + tout_cnt = 0; + return false; + } + else { + tout_cnt++; + return false; + } + + } + return false; +} + + + /* * Initial r/w and stop cmd error recovery. * We don't know whether the card received the r/w cmd or not, so try to @@ -1559,6 +1599,11 @@ static int mmc_blk_cmd_recovery(struct mmc_card *card, struct request *req, u32 status, stop_status = 0; int err, retry; + if (mmc_card_sd(card) && mmc_blk_timeout_check(req, brq)) { + mmc_card_set_removed(card); + return ERR_NOMEDIUM; + } + if (mmc_card_removed(card)) return ERR_NOMEDIUM; @@ -4251,8 +4296,11 @@ static int mmc_blk_probe(struct mmc_card *card) /* * Check that the card supports the command class(es) we need. */ +#ifndef VENDOR_EDIT +//yh@bsp, 2015/08/03, remove for can not initialize specific sdcard(CSD info mismatch card real capability) if (!(card->csd.cmdclass & CCC_BLOCK_READ)) return -ENODEV; +#endif mmc_fixup_device(card, mmc_blk_fixups); @@ -4304,6 +4352,19 @@ static int mmc_blk_probe(struct mmc_card *card) return 0; } +#ifdef VENDOR_EDIT +//Chunyi.Mei@PSW.BSP.Storage.Sdcard, 2018-12-10, Add for SD Card device information +char *capacity_string(struct mmc_card *card){ + static char cap_str[10] = "unknown"; + struct mmc_blk_data *md = (struct mmc_blk_data *)card->dev.driver_data; + if(md==NULL){ + return 0; + } + string_get_size((u64)get_capacity(md->disk), 512, STRING_UNITS_2, cap_str, sizeof(cap_str)); + return cap_str; +} +#endif + static void mmc_blk_remove(struct mmc_card *card) { struct mmc_blk_data *md = dev_get_drvdata(&card->dev); diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 412a81fdf3ad..b0af4b99cdd5 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -4428,7 +4428,12 @@ void mmc_stop_host(struct mmc_host *host) } host->rescan_disable = 1; +#ifndef VENDOR_EDIT +//tianwen@BSP.Kernel.Stability, 2019/11/01, Modify for system_server hang cancel_delayed_work_sync(&host->detect); +#else + cancel_delayed_work(&host->detect); +#endif /* clear pm flags now and let card drivers set them as needed */ host->pm_flags = 0; diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 3b887a4b9e7c..07a1282254ef 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -706,6 +706,10 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) dev_set_name(&host->class_dev, "mmc%d", host->index); +#ifdef VENDOR_EDIT +//yh@bsp, 2015-10-21 Add for special card compatible + host->card_stuck_in_programing_status = false; +#endif /* VENDOR_EDIT */ host->parent = dev; host->class_dev.parent = dev; host->class_dev.class = &mmc_host_class; @@ -731,7 +735,10 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) setup_timer(&host->retune_timer, mmc_retune_timer, (unsigned long)host); mutex_init(&host->rpmb_req_mutex); - +#ifdef VENDOR_EDIT + //Lycan.Wang@Prd.BasicDrv, 2014-07-09 Add for retry 5 times when new sdcard init error + host->detect_change_retry = 5; +#endif /* VENDOR_EDIT */ /* * By default, hosts do not support SGIO or large requests. * They have to set these according to their abilities. diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 9d48ad90f694..5f57b3e0b1dd 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -20,6 +20,11 @@ #include #include #include +#ifdef VENDOR_EDIT +//Chunyi.Mei@PSW.BSP.Storage.Sdcard, 2018-12-10, Add for SD Card device information +#include +#include +#endif /* VENDOR_EDIT */ #include "core.h" #include "card.h" @@ -34,6 +39,45 @@ #define UHS_SDR50_MIN_DTR (50 * 1000 * 1000) #define UHS_SDR25_MIN_DTR (25 * 1000 * 1000) #define UHS_SDR12_MIN_DTR (12.5 * 1000 * 1000) +#ifdef VENDOR_EDIT +//Chunyi.Mei@PSW.BSP.Storage.Sdcard, 2018-12-10, Add for SD Card device information +struct menfinfo { + unsigned int manfid; + char *manfstring; +}; + +struct menfinfo manufacturers[] = { + {0x41, "KINGSTONE"}, + {0x1b, "SAMSUNG"}, + {0x03, "SANDISK"}, + {0x02, "TOSHIBA"} +}; +#define MANFINFS_SIZE (sizeof(manufacturers)/sizeof(struct menfinfo)) + +const char *string_class[] = { + "Class 0", + "Class 2", + "Class 4", + "Class 6", + "Class 10" +}; +#define CLASS_TYPE_SIZE (sizeof(string_class)/sizeof(const char*)) + +struct card_blk_data { + spinlock_t lock; + struct gendisk *disk; +}; + +#define STR_OTHER "other" +#define STR_UNKNOW "unknown" +#define STR_TYPE_SDXC "SDXC" +#define STR_TYPE_SDHC "SDHC" +#define STR_TYPE_SD "SD" + +#define STR_SPEED_UHS "ultra high speed " +#define STR_SPEED_HS "high speed " + +#endif /* VENDOR_EDIT */ static const unsigned int tran_exp[] = { 10000, 100000, 1000000, 10000000, @@ -274,6 +318,10 @@ static int mmc_read_ssr(struct mmc_card *card) card->ssr.au = sd_au_size[au]; es = UNSTUFF_BITS(card->raw_ssr, 408 - 384, 16); et = UNSTUFF_BITS(card->raw_ssr, 402 - 384, 6); +#ifdef VENDOR_EDIT +//Chunyi.Mei@PSW.BSP.Storage.Sdcard, 2018-12-10, Add for SD Card device information + card->ssr.speed_class = UNSTUFF_BITS(card->raw_ssr, 440 - 384, 8); +#endif /* VENDOR_EDIT */ if (es && et) { eo = UNSTUFF_BITS(card->raw_ssr, 400 - 384, 2); card->ssr.erase_timeout = (et * 1000) / es; @@ -731,6 +779,46 @@ out: return err; } +#ifdef VENDOR_EDIT +//Chunyi.Mei@PSW.BSP.Storage.Sdcard, 2018-12-10, Add for SD Card device information +const char *manfinfo_string(struct mmc_card *card) { + int i = 0; + for (i = 0; i < MANFINFS_SIZE ; i++) { + if(card->cid.manfid == manufacturers[i].manfid) { + return manufacturers[i].manfstring; + } + } + return STR_OTHER; +} + +extern char *capacity_string(struct mmc_card *card); + +const char *type_string(struct mmc_card *card){ + if(card==NULL || card->type!=MMC_TYPE_SD) + return STR_UNKNOW; + if (mmc_card_blockaddr(card)) { + if (mmc_card_ext_capacity(card)) + return STR_TYPE_SDXC; + else + return STR_TYPE_SDHC; + } + return STR_TYPE_SD; +} + +const char *uhs_string(struct mmc_card *card){ + return mmc_card_uhs(card) ? STR_SPEED_UHS: (mmc_card_hs(card) ? STR_SPEED_HS : ""); +} + +const char *speed_class_string(struct mmc_card *card){ + if(card->ssr.speed_class > (CLASS_TYPE_SIZE-1)){ + return STR_UNKNOW; + } + return string_class[card->ssr.speed_class]; +} + +MMC_DEV_ATTR(devinfo, " manufacturer: %s\n size: %s\n type: %s\n speed: %s\n class: %s\n", + manfinfo_string(card), capacity_string(card), type_string(card), uhs_string(card), speed_class_string(card)); +#endif /* VENDOR_EDIT */ MMC_DEV_ATTR(cid, "%08x%08x%08x%08x\n", card->raw_cid[0], card->raw_cid[1], card->raw_cid[2], card->raw_cid[3]); MMC_DEV_ATTR(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1], @@ -773,6 +861,10 @@ static ssize_t mmc_dsr_show(struct device *dev, static DEVICE_ATTR(dsr, S_IRUGO, mmc_dsr_show, NULL); static struct attribute *sd_std_attrs[] = { +#ifdef VENDOR_EDIT +//Chunyi.Mei@PSW.BSP.Storage.Sdcard, 2018-12-10, Add for SD Card device information + &dev_attr_devinfo.attr, +#endif /* VENDOR_EDIT */ &dev_attr_cid.attr, &dev_attr_csd.attr, &dev_attr_scr.attr, @@ -1440,6 +1532,13 @@ int mmc_attach_sd(struct mmc_host *host) WARN_ON(!host->claimed); +#ifdef VENDOR_EDIT + //Lycan.Wang@Prd.BasicDrv, 2014-07-10 Add for retry 5 times when new sdcard init error + if (!host->detect_change_retry) { + pr_err("%s have init error 5 times\n", __func__); + return -ETIMEDOUT; + } +#endif /* VENDOR_EDIT */ err = mmc_send_app_op_cond(host, 0, &ocr); if (err) return err; @@ -1479,7 +1578,16 @@ int mmc_attach_sd(struct mmc_host *host) * Detect and init the card. */ #ifdef CONFIG_MMC_PARANOID_SD_INIT - retries = 5; +#ifndef VENDOR_EDIT + //Lycan.Wang@Prd.BasicDrv, 2014-07-10 Modify for init retry only once when have init error before + retries = 5; +#else /* VENDOR_EDIT */ + if (host->detect_change_retry < 5) + retries = 1; + else + retries = 5; +#endif /* VENDOR_EDIT */ + while (retries) { err = mmc_sd_init_card(host, rocr, NULL); if (err) { @@ -1517,6 +1625,10 @@ int mmc_attach_sd(struct mmc_host *host) goto remove_card; } +#ifdef VENDOR_EDIT + //Tong.han@Bsp.group.Tp, 2015-02-03 Add for retry 5 times when new sdcard init error + host->detect_change_retry = 5; +#endif /* VENDOR_EDIT */ return 0; remove_card: @@ -1526,6 +1638,13 @@ remove_card: err: mmc_detach_bus(host); +#ifdef VENDOR_EDIT + //Lycan.Wang@Prd.BasicDrv, 2014-07-10 Add for retry 5 times when new sdcard init error + if (err)//yh@bsp, 2016-03-17, this err could be caused by rescan disable, here reserve this aborted retry oppotunity. + host->detect_change_retry--; + pr_err("detect_change_retry = %d !!!,err = %d\n", host->detect_change_retry,err); +#endif /* VENDOR_EDIT */ + pr_err("%s: error %d whilst initialising SD card\n", mmc_hostname(host), err); diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c index 47056d8d1bac..6b40881735bf 100644 --- a/drivers/mmc/core/sd_ops.c +++ b/drivers/mmc/core/sd_ops.c @@ -151,7 +151,12 @@ int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) cmd.arg = ocr; cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R3 | MMC_CMD_BCR; +#ifdef VENDOR_EDIT +//yh@Prd.BasicDrv, 2016-08-08 Add for T card compatbile which report "busy state" at init stage + for (i = 200; i; i--) { +#else for (i = 100; i; i--) { +#endif err = mmc_wait_for_app_cmd(host, NULL, &cmd, MMC_CMD_RETRIES); if (err) break; diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c index 5e7af01a21f3..9c7b67b88718 100644 --- a/drivers/mmc/core/slot-gpio.c +++ b/drivers/mmc/core/slot-gpio.c @@ -41,6 +41,15 @@ static irqreturn_t mmc_gpio_cd_irqt(int irq, void *dev_id) mmc_hostname(host), present, present?"INSERT":"REMOVAL"); host->trigger_card_event = true; +#ifdef VENDOR_EDIT + //Lycan.Wang@Prd.BasicDrv, 2014-07-10 Add for retry 5 times when new sdcard init error + host->detect_change_retry = 5; +#endif /* VENDOR_EDIT */ +#ifdef VENDOR_EDIT +//yh@bsp, 2015-10-21 Add for special card compatible + host->card_stuck_in_programing_status = false; +#endif /* VENDOR_EDIT */ + mmc_detect_change(host, msecs_to_jiffies(200)); return IRQ_HANDLED; diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 81dd1286f2cc..384408382220 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -81,8 +81,19 @@ static void sdhci_dump_state(struct sdhci_host *host) mmc->parent->power.disable_depth); } +#ifdef VENDOR_EDIT +//yixue.ge@BSP.drv 2014-06-04 modify for disable sdcard log +static int flag = 0; +#endif void sdhci_dumpregs(struct sdhci_host *host) { +#ifdef VENDOR_EDIT +//yixue.ge@BSP.drv 2014-06-04 modify for disable sdcard log + if(!flag) + flag++; + else + return; +#endif MMC_TRACE(host->mmc, "%s: 0x04=0x%08x 0x06=0x%08x 0x0E=0x%08x 0x30=0x%08x 0x34=0x%08x 0x38=0x%08x\n", __func__, @@ -1279,6 +1290,18 @@ void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) cmd->opcode == MMC_STOP_TRANSMISSION) cmd->flags |= MMC_RSP_BUSY; +#ifdef VENDOR_EDIT +//yh@bsp, 2015-10-21 Add for special card compatible +//Guohua.Zhong@BSP.Storage.Sdcard,20180630 modify for use is_fsck_process whitelist "fsck" + if(host->mmc->card_stuck_in_programing_status && ((cmd->opcode == MMC_WRITE_MULTIPLE_BLOCK) || (cmd->opcode == MMC_WRITE_BLOCK))) + { + printk_once(KERN_INFO "%s:card_stuck_in_programing_status cmd:%d\n", mmc_hostname(host->mmc), cmd->opcode ); + cmd->error = -EIO; + sdhci_finish_mrq(host, cmd->mrq); + return; + } +#endif /* VENDOR_EDIT */ + /* Wait max 10 ms */ timeout = 10000; diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index cb7fc5eb3642..27cff398bbdd 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -287,6 +287,41 @@ config RIONET_RX_SIZE depends on RIONET default "128" +#ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED +#HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function +config IMQ + tristate "IMQ (intermediate queueing device) support" + depends on NETDEVICES && NETFILTER + default y + + ---help--- + The IMQ device(s) is used as placeholder for QoS queueing + disciplines. Every packet entering/leaving the IP stack can be + directed through the IMQ device where it's enqueued/dequeued to the + attached qdisc. This allows you to treat network devices as classes + and distribute bandwidth among them. Iptables is used to specify + through which IMQ device, if any, packets travel. + + More information at: https://github.com/imq/linuximq + + To compile this driver as a module, choose M here: the module + will be called imq. If unsure, say N. + +config IMQ_NUM_DEVS + int "Number of IMQ devices" + range 2 16 + depends on IMQ + default "2" + help + This setting defines how many IMQ devices will be created. + + The default value is 16. + + More information can be found at: https://github.com/imq/linuximq + + If not sure leave the default settings alone. +#endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + config TUN tristate "Universal TUN/TAP device driver support" depends on INET diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 01f12b4d16f5..9b57b88b9def 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -13,6 +13,10 @@ obj-$(CONFIG_DUMMY) += dummy.o obj-$(CONFIG_EQUALIZER) += eql.o obj-$(CONFIG_IFB) += ifb.o obj-$(CONFIG_MACSEC) += macsec.o +ifneq ($(OPLUS_FEATURE_WIFI_LIMMITBGSPEED),) +#HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function +obj-$(CONFIG_IMQ) += imq.o +endif # OPLUS_FEATURE_WIFI_LIMMITBGSPEED obj-$(CONFIG_MACVLAN) += macvlan.o obj-$(CONFIG_MACVTAP) += macvtap.o obj-$(CONFIG_MII) += mii.o diff --git a/drivers/net/wireless/cnss2/main.c b/drivers/net/wireless/cnss2/main.c index cc39db85c446..50a88c6589ca 100644 --- a/drivers/net/wireless/cnss2/main.c +++ b/drivers/net/wireless/cnss2/main.c @@ -21,6 +21,11 @@ #include #include #include +#ifdef OPLUS_BUG_STABILITY +//Laixin@CN.PSW.WiFi.Basic.2828376, 2020/02/19 +//Add for: disable wifi while power off charging because modem img will not mount +#include +#endif /* OPLUS_BUG_STABILITY */ #include "main.h" #include "bus.h" @@ -2185,6 +2190,17 @@ static int cnss_probe(struct platform_device *plat_dev) const struct of_device_id *of_id; const struct platform_device_id *device_id; +#ifdef OPLUS_BUG_STABILITY + //Laixin@CN.PSW.WiFi.Basic.2828376, 2020/02/19 + //Add for: disable wifi while power off charging because modem img will not mount + if (qpnp_is_power_off_charging() && + (get_boot_mode() != MSM_BOOT_MODE__WLAN) && + (get_boot_mode() != MSM_BOOT_MODE__RF)) { + cnss_pr_err("charge mode do not load wifi!\n"); + goto out; + } +#endif /* OPLUS_BUG_STABILITY */ + if (cnss_get_plat_priv(plat_dev)) { cnss_pr_err("Driver is already initialized!\n"); ret = -EEXIST; diff --git a/drivers/nfc/Kconfig b/drivers/nfc/Kconfig index ce35eca4fc92..1d120e4995c0 100644 --- a/drivers/nfc/Kconfig +++ b/drivers/nfc/Kconfig @@ -60,6 +60,8 @@ source "drivers/nfc/s3fwrn5/Kconfig" source "drivers/nfc/st95hf/Kconfig" endmenu +source "drivers/nfc/oppo_nfc/Kconfig" + config NFC_NQ tristate "QTI NCI based NFC Controller Driver for NQx" depends on I2C diff --git a/drivers/nfc/Makefile b/drivers/nfc/Makefile index d8d45190599e..7e671d6613bb 100644 --- a/drivers/nfc/Makefile +++ b/drivers/nfc/Makefile @@ -19,3 +19,10 @@ obj-$(CONFIG_NFC_S3FWRN5) += s3fwrn5/ obj-$(CONFIG_NFC_ST95HF) += st95hf/ obj-$(CONFIG_NFC_NQ) += nq-nci.o obj-$(CONFIG_NTAG_NQ) += nq-ntag.o +obj-$(CONFIG_OPPO_NFC) += oppo_nfc/ +#ifdef OPLUS_NFC_BRINGUP +#DengWeiwei@CONNECTIVITY.NFC.HARDWARE.228691, 2020/08/03 +#Add for the kernel Macro for NXP PN557 NFC kernel +obj-$(CONFIG_NFC_PN553_DEVICES) += pn553-i2c/ +#endif /*OPLUS_NFC_BRINGUP*/ +obj-$(CONFIG_NXP_P73_DEVICES) += p73-spi/ diff --git a/drivers/nfc/nq-nci.c b/drivers/nfc/nq-nci.c index 5f8cc5f061aa..95e3babe5378 100644 --- a/drivers/nfc/nq-nci.c +++ b/drivers/nfc/nq-nci.c @@ -28,7 +28,8 @@ #ifdef CONFIG_COMPAT #include #endif -#include + +#include "oppo_nfc/oppo_nfc.h" struct nqx_platform_data { unsigned int irq_gpio; @@ -48,9 +49,34 @@ static const struct of_device_id msm_match_table[] = { MODULE_DEVICE_TABLE(of, msm_match_table); +#define DEV_COUNT 1 +#define DEVICE_NAME "nq-nci" +#define CLASS_NAME "nqx" +#define MAX_BUFFER_SIZE (320) +#define WAKEUP_SRC_TIMEOUT (2000) +#define MAX_RETRY_COUNT 3 +#define NCI_RESET_CMD_LEN 4 +#define NCI_RESET_RSP_LEN 4 +#define NCI_RESET_NTF_LEN 13 +#define NCI_GET_VERSION_CMD_LEN 8 +#define NCI_GET_VERSION_RSP_LEN 12 + +#ifdef VENDOR_EDIT +//Weiwei.Deng@CN.NFC.Basic.Hardware.1209105, 2019/04/25, +//Modify for : send get firmware version +#define NCI_GET_FW_CMD_LEN 8 +#define NCI_GET_FW_RSP_LEN 14 +#endif /* VENDOR_EDIT */ + struct nqx_dev { wait_queue_head_t read_wq; struct mutex read_mutex; + #ifdef VENDOR_EDIT + //Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, + //add spi ven flag and protect the access to it + /* protect the access to spi_ven_enabled flag */ + struct mutex spi_mutex; + #endif /* VENDOR_EDIT */ struct mutex dev_ref_mutex; struct i2c_client *client; dev_t devno; @@ -66,6 +92,12 @@ struct nqx_dev { unsigned int ese_gpio; /* NFC VEN pin state powered by Nfc */ bool nfc_ven_enabled; + #ifdef VENDOR_EDIT + //Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, + //add spi ven flag and protect the access to it + /* stores the VEN pin state powered by Spi */ + bool spi_ven_enabled; + #endif /* VENDOR_EDIT */ /* NFC_IRQ state */ bool irq_enabled; /* NFC_IRQ wake-up state */ @@ -153,15 +185,22 @@ static irqreturn_t nqx_dev_irq_handler(int irq, void *dev_id) return IRQ_HANDLED; } -static int is_data_available_for_read(struct nqx_dev *nqx_dev) +#ifdef VENDOR_EDIT +//Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, +//add spi ven flag and protect the access to it +static void sn100_access_lock(struct nqx_dev *nqx_dev) { - int ret; - - nqx_enable_irq(nqx_dev); - ret = wait_event_interruptible_timeout(nqx_dev->read_wq, - !nqx_dev->irq_enabled, msecs_to_jiffies(MAX_IRQ_WAIT_TIME)); - return ret; + pr_info("%s: Enter\n", __func__); + mutex_lock(&nqx_dev->spi_mutex); + pr_info("%s: Exit\n", __func__); } +static void sn100_access_unlock(struct nqx_dev *nqx_dev) +{ + pr_info("%s: Enter\n", __func__); + mutex_unlock(&nqx_dev->spi_mutex); + pr_info("%s: Exit\n", __func__); +} +#endif /* VENDOR_EDIT */ static ssize_t nfc_read(struct file *filp, char __user *buf, size_t count, loff_t *offset) @@ -340,6 +379,13 @@ static int sn100_ese_pwr(struct nqx_dev *nqx_dev, unsigned long int arg) { int r = -1; + #ifdef VENDOR_EDIT + //Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, + //add spi ven flag and protect the access to it + dev_err(&nqx_dev->client->dev,"%s:%d arg=%ld\n", __func__, __LINE__, arg); + sn100_access_lock(nqx_dev); + #endif /* VENDOR_EDIT */ + if (arg == 0) { /** * Let's store the NFC VEN pin state @@ -350,29 +396,52 @@ static int sn100_ese_pwr(struct nqx_dev *nqx_dev, unsigned long int arg) */ nqx_dev->nfc_ven_enabled = gpio_get_value(nqx_dev->en_gpio); + #ifdef VENDOR_EDIT + //Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, + //add spi ven flag and protect the access to it + nqx_dev->spi_ven_enabled = true; + #endif /* VENDOR_EDIT */ if (!nqx_dev->nfc_ven_enabled) { - dev_dbg(&nqx_dev->client->dev, "eSE HAL service setting en_gpio HIGH\n"); + dev_err(&nqx_dev->client->dev, "eSE HAL service setting en_gpio HIGH\n"); gpio_set_value(nqx_dev->en_gpio, 1); /* hardware dependent delay */ usleep_range(1000, 1100); } else { - dev_dbg(&nqx_dev->client->dev, "en_gpio already HIGH\n"); + dev_err(&nqx_dev->client->dev, "en_gpio already HIGH\n"); } r = 0; } else if (arg == 1) { + #ifdef VENDOR_EDIT + //Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, + //add spi ven flag and protect the access to it + nqx_dev->spi_ven_enabled = false; + #endif /* VENDOR_EDIT */ if (!nqx_dev->nfc_ven_enabled) { - dev_dbg(&nqx_dev->client->dev, "NFC not enabled, disabling en_gpio\n"); + dev_err(&nqx_dev->client->dev, "NFC not enabled, disabling en_gpio\n"); gpio_set_value(nqx_dev->en_gpio, 0); /* hardware dependent delay */ usleep_range(1000, 1100); } else { - dev_dbg(&nqx_dev->client->dev, "keep en_gpio high as NFC is enabled\n"); + dev_err(&nqx_dev->client->dev, "keep en_gpio high as NFC is enabled\n"); } r = 0; } else if (arg == 3) { // eSE power state r = gpio_get_value(nqx_dev->en_gpio); + #ifdef VENDOR_EDIT + //Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, + //add spi ven flag and protect the access to it + /* If NFC is enable, the VEN is hign, must set spi_ven_enabled to true because esehal will not ESE_SET_PWR=1 below such situation */ + nqx_dev->spi_ven_enabled = !!r; + dev_err(&nqx_dev->client->dev, "ven state r=%d,spi_ven_enabled=%d\n", r, nqx_dev->spi_ven_enabled); + #endif /* VENDOR_EDIT */ } + + #ifdef VENDOR_EDIT + //Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, + //add spi ven flag and protect the access to it + sn100_access_unlock(nqx_dev); + #endif /* VENDOR_EDIT */ return r; } @@ -560,6 +629,13 @@ int nfc_ioctl_power_states(struct file *filp, unsigned long arg) int r = 0; struct nqx_dev *nqx_dev = filp->private_data; + #ifdef VENDOR_EDIT + //Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, + //add spi ven flag and protect the access to it + dev_err(&nqx_dev->client->dev,"%s:%d arg=%ld\n", __func__, __LINE__, arg); + sn100_access_lock(nqx_dev); + #endif /* VENDOR_EDIT */ + if (arg == 0) { /* * We are attempting a hardware reset so let us disable @@ -577,18 +653,30 @@ int nfc_ioctl_power_states(struct file *filp, unsigned long arg) if (gpio_is_valid(nqx_dev->ese_gpio)) { if (!gpio_get_value(nqx_dev->ese_gpio)) { - dev_dbg(&nqx_dev->client->dev, "disabling en_gpio\n"); + dev_err(&nqx_dev->client->dev, "disabling en_gpio\n"); gpio_set_value(nqx_dev->en_gpio, 0); usleep_range(10000, 10100); } else { dev_dbg(&nqx_dev->client->dev, "keeping en_gpio high\n"); } + #ifdef VENDOR_EDIT + //Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, + //add spi ven flag and protect the access to it + } else if(nqx_dev->spi_ven_enabled == false){ + dev_err(&nqx_dev->client->dev, "spi_ven_enabled is false, set en_gpio to low\n"); + gpio_set_value(nqx_dev->en_gpio, 0); + usleep_range(10000, 10100); + } else { + dev_err(&nqx_dev->client->dev, "hold ven state high(%d),spi_ven_enabled=%d\n", + gpio_get_value(nqx_dev->en_gpio), nqx_dev->spi_ven_enabled); + } + #else } else { dev_dbg(&nqx_dev->client->dev, "ese_gpio invalid, set en_gpio to low\n"); gpio_set_value(nqx_dev->en_gpio, 0); usleep_range(10000, 10100); } - + #endif /* VENDOR_EDIT */ if (nqx_dev->pdata->clk_pin_voting) { r = nqx_clock_deselect(nqx_dev); if (r < 0) @@ -597,7 +685,7 @@ int nfc_ioctl_power_states(struct file *filp, unsigned long arg) nqx_dev->nfc_ven_enabled = false; } else if (arg == 1) { nqx_enable_irq(nqx_dev); - dev_dbg(&nqx_dev->client->dev, + dev_err(&nqx_dev->client->dev, "gpio_set_value enable: %s: info: %p\n", __func__, nqx_dev); if (gpio_is_valid(nqx_dev->firm_gpio)) { @@ -605,12 +693,23 @@ int nfc_ioctl_power_states(struct file *filp, unsigned long arg) usleep_range(10000, 10100); } + #ifdef VENDOR_EDIT + //Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, + //add spi ven flag and protect the access to it + if (gpio_get_value(nqx_dev->en_gpio) || nqx_dev->spi_ven_enabled) { + dev_err(&nqx_dev->client->dev, "VEN gpio already high\n"); + } else { + gpio_set_value(nqx_dev->en_gpio, 1); + usleep_range(10000, 10100); + } + #else if (gpio_get_value(nqx_dev->en_gpio)) { dev_dbg(&nqx_dev->client->dev, "VEN gpio already high\n"); } else { gpio_set_value(nqx_dev->en_gpio, 1); usleep_range(10000, 10100); } + #endif /* VENDOR_EDIT */ if (nqx_dev->pdata->clk_pin_voting) { r = nqx_clock_select(nqx_dev); @@ -619,6 +718,20 @@ int nfc_ioctl_power_states(struct file *filp, unsigned long arg) } nqx_dev->nfc_ven_enabled = true; } else if (arg == 2) { + #ifdef VENDOR_EDIT + //Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, + //add spi ven flag and protect the access to it + if(nqx_dev->spi_ven_enabled){ + /* NFCC fw/download should not be allowed if ese is used + * by SPI + */ + dev_err(&nqx_dev->client->dev,"%s NFCC should not be allowed to reset/FW download \n", __func__); + + sn100_access_unlock(nqx_dev); + return -EBUSY; /* Device or resource busy */ + } + #endif /* VENDOR_EDIT */ + /* * We are switching to Dowload Mode, toggle the enable pin * in order to set the NFCC in the new mode @@ -652,7 +765,23 @@ int nfc_ioctl_power_states(struct file *filp, unsigned long arg) } else dev_err(&nqx_dev->client->dev, "firm_gpio is invalid\n"); - } else if (arg == 6) { + } + #ifdef VENDOR_EDIT + //Weiwei.Deng@CN.NFC.Basic.Hardware.1209105, 2019/04/25, + //Modify for : send get firmware version + else if (arg == 5) { + if(nqx_dev->spi_ven_enabled == false){ + dev_err(&nqx_dev->client->dev, "spi_ven_enabled is false, VEN reset START\n"); + msleep(10); + gpio_set_value(nqx_dev->en_gpio, 0); + msleep(10); + gpio_set_value(nqx_dev->en_gpio, 1); + msleep(10); + dev_err(&nqx_dev->client->dev,"%s VEN reset DONE >>>>>>>\n", __func__); + } + } + #endif /* VENDOR_EDIT */ + else if (arg == 6) { /* * Setting firmware download gpio to LOW for SN100U * FW download finished @@ -669,6 +798,11 @@ int nfc_ioctl_power_states(struct file *filp, unsigned long arg) r = -ENOIOCTLCMD; } + #ifdef VENDOR_EDIT + //Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, + //add spi ven flag and protect the access to it + sn100_access_unlock(nqx_dev); + #endif /* VENDOR_EDIT */ return r; } @@ -677,6 +811,11 @@ static long nfc_compat_ioctl(struct file *pfile, unsigned int cmd, unsigned long arg) { long r = 0; + #ifdef VENDOR_EDIT + //Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, + //add spi ven flag and protect the access to it + struct nqx_dev *nqx_dev = pfile->private_data; + #endif /* VENDOR_EDIT */ arg = (compat_u64)arg; switch (cmd) { @@ -684,10 +823,32 @@ static long nfc_compat_ioctl(struct file *pfile, unsigned int cmd, nfc_ioctl_power_states(pfile, arg); break; case ESE_SET_PWR: + #ifdef VENDOR_EDIT + //Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, + //add spi ven flag and protect the access to it + if ((nqx_dev->nqx_info.info.chip_type == NFCC_SN100_A) || + (nqx_dev->nqx_info.info.chip_type == NFCC_SN100_B)) { + r = sn100_ese_pwr(nqx_dev, arg); + } else { + r = nqx_ese_pwr(nqx_dev, arg); + } + #else nqx_ese_pwr(pfile->private_data, arg); + #endif /* VENDOR_EDIT */ break; case ESE_GET_PWR: + #ifdef VENDOR_EDIT + //Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, + //add spi ven flag and protect the access to it + if ((nqx_dev->nqx_info.info.chip_type == NFCC_SN100_A) || + (nqx_dev->nqx_info.info.chip_type == NFCC_SN100_B)) { + r = sn100_ese_pwr(nqx_dev, 3); + } else { + r = nqx_ese_pwr(nqx_dev, 3); + } + #else nqx_ese_pwr(pfile->private_data, 3); + #endif /* VENDOR_EDIT */ break; case SET_RX_BLOCK: break; @@ -747,9 +908,11 @@ static long nfc_ioctl(struct file *pfile, unsigned int cmd, switch (cmd) { case NFC_SET_PWR: + dev_err(&nqx_dev->client->dev,"%s:%d NFC_SET_PWR cmd=%d, arg=%ld\n", __func__, __LINE__, cmd, arg); r = nfc_ioctl_power_states(pfile, arg); break; case ESE_SET_PWR: + dev_err(&nqx_dev->client->dev,"%s:%d ESE_SET_PWR cmd=%d, arg=%ld\n", __func__, __LINE__, cmd, arg); if ((nqx_dev->nqx_info.info.chip_type == NFCC_SN100_A) || (nqx_dev->nqx_info.info.chip_type == NFCC_SN100_B)) r = sn100_ese_pwr(nqx_dev, arg); @@ -757,6 +920,7 @@ static long nfc_ioctl(struct file *pfile, unsigned int cmd, r = nqx_ese_pwr(nqx_dev, arg); break; case ESE_GET_PWR: + dev_err(&nqx_dev->client->dev,"%s:%d ESE_GET_PWR cmd=%d, arg=%ld\n", __func__, __LINE__, cmd, arg); if ((nqx_dev->nqx_info.info.chip_type == NFCC_SN100_A) || (nqx_dev->nqx_info.info.chip_type == NFCC_SN100_B)) r = sn100_ese_pwr(nqx_dev, 3); @@ -792,143 +956,20 @@ static const struct file_operations nfc_dev_fops = { #endif }; -/* - * function: get_nfcc_hw_info() - * - * @client: pointer to i2c_client - * @nqx_dev: pointer to nqx_dev structure - * @nci_reset_rsp_payload_len: payload length of NCI reset cmd - * - * Retrieves NFCC HW information based on the type of NFC chip - * used on the device. Depending on the nci_reset_rsp_payload_len - * value, core INIT command will be sent. - * - * NFC HW NCI version Send Core INIT cmd - * NQ3xx or old 1.0 Yes - * NQ4xx 2.0 No - * Sn1x0x 2.0 No - * - * Return: error codes in case of any failure, - * number of bytes read otherwise - */ -static int get_nfcc_hw_info(struct i2c_client *client, - struct nqx_dev *nqx_dev, char nci_reset_rsp_payload_len) -{ - int ret = 0; - - char *nci_init_cmd = NULL; - char *nci_init_rsp = NULL; - char *nci_reset_ntf = NULL; - char *nfcc_hw_info = NULL; - unsigned char nfcc_hw_info_len = 0; - - nci_init_cmd = kzalloc(NCI_INIT_CMD_LEN + 1, GFP_DMA | GFP_KERNEL); - if (!nci_init_cmd) { - ret = -ENOMEM; - goto err_nfcc_hw_info; - } - - nci_init_rsp = kzalloc(NCI_INIT_RSP_LEN + 1, GFP_DMA | GFP_KERNEL); - if (!nci_init_rsp) { - ret = -ENOMEM; - goto err_nfcc_hw_info; - } - - nci_reset_ntf = kzalloc(NCI_RESET_NTF_LEN + 1, GFP_DMA | GFP_KERNEL); - if (!nci_reset_ntf) { - ret = -ENOMEM; - goto err_nfcc_hw_info; - } - - if (nci_reset_rsp_payload_len == NCI_1_0_RESET_RSP_PAYLOAD_LEN) { - /* - * Chipset is NQ330 or older. - * Send core INIT command to get HW info. - */ - nci_init_cmd[0] = 0x20; - nci_init_cmd[1] = 0x01; - nci_init_cmd[2] = 0x00; - ret = nqx_standby_write(nqx_dev, nci_init_cmd, - NCI_INIT_CMD_LEN); - if (ret < 0) { - dev_err(&client->dev, - "%s: - i2c_master_send failed for Core INIT\n", - __func__); - goto err_nfcc_hw_info; - } - - ret = is_data_available_for_read(nqx_dev); - if (ret <= 0) { - nqx_disable_irq(nqx_dev); - goto err_nfcc_hw_info; - } - - /* Read Response of INIT command */ - ret = i2c_master_recv(client, nci_init_rsp, NCI_INIT_RSP_LEN); - if (ret < 0) { - dev_err(&client->dev, - "%s: - i2c_master_recv get INIT rsp Error\n", - __func__); - goto err_nfcc_hw_info; - } - nfcc_hw_info = nci_init_rsp; - } else { - /* - * Chipset is NQ4xx or later. - * Retrieve NTF data from wait queue. - */ - ret = is_data_available_for_read(nqx_dev); - if (ret <= 0) { - nqx_disable_irq(nqx_dev); - goto err_nfcc_hw_info; - } - - /* Read Notification of RESET command */ - ret = i2c_master_recv(client, nci_reset_ntf, NCI_RESET_NTF_LEN); - if (ret < 0) { - dev_err(&client->dev, - "%s: - i2c_master_recv get RESET ntf Error\n", - __func__); - goto err_nfcc_hw_info; - } - nfcc_hw_info = nci_reset_ntf; - } - - /* Save NFCC HW info */ - nfcc_hw_info_len = - NCI_HEADER_LEN + nfcc_hw_info[NCI_PAYLOAD_LENGTH_INDEX]; - if (nfcc_hw_info_len > PAYLOAD_HEADER_LENGTH) { - nqx_dev->nqx_info.info.chip_type = - nfcc_hw_info[nfcc_hw_info_len - - NFCC_HW_CHIP_ID_OFFSET]; - nqx_dev->nqx_info.info.rom_version = - nfcc_hw_info[nfcc_hw_info_len - - NFCC_HW_ROM_VER_OFFSET]; - nqx_dev->nqx_info.info.fw_major = - nfcc_hw_info[nfcc_hw_info_len - - NFCC_HW_MAJOR_NO_OFFSET]; - nqx_dev->nqx_info.info.fw_minor = - nfcc_hw_info[nfcc_hw_info_len - - NFCC_HW_MINOR_NO_OFFSET]; - } - -err_nfcc_hw_info: - - kfree(nci_reset_ntf); - kfree(nci_init_rsp); - kfree(nci_init_cmd); - - return ret; -} - /* Check for availability of NQ_ NFC controller hardware */ static int nfcc_hw_check(struct i2c_client *client, struct nqx_dev *nqx_dev) { int ret = 0; + int gpio_retry_count = 0; +#ifndef VENDOR_EDIT +//Weiwei.Deng@CN.NFC.Basic.Hardware.1209105, 2019/04/25, +//Modify for : send get firmware version + unsigned char reset_ntf_len = 0; unsigned int enable_gpio = nqx_dev->en_gpio; char *nci_reset_cmd = NULL; char *nci_reset_rsp = NULL; + char *nci_reset_ntf = NULL; char *nci_get_version_cmd = NULL; char *nci_get_version_rsp = NULL; @@ -944,6 +985,12 @@ static int nfcc_hw_check(struct i2c_client *client, struct nqx_dev *nqx_dev) goto done; } + nci_reset_ntf = kzalloc(NCI_RESET_NTF_LEN + 1, GFP_DMA | GFP_KERNEL); + if (!nci_reset_ntf) { + ret = -ENOMEM; + goto done; + } + nci_get_version_cmd = kzalloc(NCI_GET_VERSION_CMD_LEN + 1, GFP_DMA | GFP_KERNEL); if (!nci_get_version_cmd) { @@ -958,6 +1005,7 @@ static int nfcc_hw_check(struct i2c_client *client, struct nqx_dev *nqx_dev) goto done; } +reset_enable_gpio: /* making sure that the NFCC starts in a clean state. */ gpio_set_value(enable_gpio, 1);/* HPD : Enable*/ /* hardware dependent delay */ @@ -1027,37 +1075,49 @@ static int nfcc_hw_check(struct i2c_client *client, struct nqx_dev *nqx_dev) } goto err_nfcc_reset_failed; } - ret = is_data_available_for_read(nqx_dev); - if (ret <= 0) { + nqx_enable_irq(nqx_dev); + ret = wait_event_interruptible(nqx_dev->read_wq, !nqx_dev->irq_enabled); + if (ret < 0) { nqx_disable_irq(nqx_dev); goto err_nfcc_hw_check; } - /* Read Header of RESET command */ - ret = i2c_master_recv(client, nci_reset_rsp, NCI_HEADER_LEN); - if (ret != NCI_HEADER_LEN) { - dev_err(&client->dev, - "%s: - i2c_master_recv get RESET rsp header Error\n", __func__); - goto err_nfcc_hw_check; - } - - ret = i2c_master_recv(client, &nci_reset_rsp[NCI_PAYLOAD_START_INDEX], - nci_reset_rsp[NCI_PAYLOAD_LENGTH_INDEX]); - if (ret != nci_reset_rsp[NCI_PAYLOAD_LENGTH_INDEX]) { - dev_err(&client->dev, - "%s: - i2c_master_recv get RESET rsp data Error\n", __func__); - goto err_nfcc_hw_check; - } - - /* Retrieve NFCC HW info */ - ret = get_nfcc_hw_info(client, nqx_dev, - nci_reset_rsp[NCI_PAYLOAD_LENGTH_INDEX]); + /* Read Response of RESET command */ + ret = i2c_master_recv(client, nci_reset_rsp, NCI_RESET_RSP_LEN); if (ret < 0) { dev_err(&client->dev, - "%s: - Error in getting NFCC HW info\n", __func__); + "%s: - i2c_master_recv Error\n", __func__); + gpio_retry_count = gpio_retry_count + 1; + if (gpio_retry_count < MAX_RETRY_COUNT) + goto reset_enable_gpio; + goto err_nfcc_hw_check; + } + nqx_enable_irq(nqx_dev); + ret = wait_event_interruptible(nqx_dev->read_wq, !nqx_dev->irq_enabled); + if (ret < 0) { + nqx_disable_irq(nqx_dev); goto err_nfcc_hw_check; } + /* Read Notification of RESET command */ + ret = i2c_master_recv(client, nci_reset_ntf, NCI_RESET_NTF_LEN); + if (ret < 0) { + dev_err(&client->dev, + "%s: - i2c_master_recv Error\n", __func__); + goto err_nfcc_hw_check; + } + + reset_ntf_len = 2 + nci_reset_ntf[2]; /*payload + len*/ + if (reset_ntf_len > PAYLOAD_HEADER_LENGTH) { + nqx_dev->nqx_info.info.chip_type = + nci_reset_ntf[reset_ntf_len - 3]; + nqx_dev->nqx_info.info.rom_version = + nci_reset_ntf[reset_ntf_len - 2]; + nqx_dev->nqx_info.info.fw_major = + nci_reset_ntf[reset_ntf_len - 1]; + nqx_dev->nqx_info.info.fw_minor = + nci_reset_ntf[reset_ntf_len]; + } dev_dbg(&client->dev, "%s: - nq - reset cmd answer : NfcNciRx %x %x %x\n", __func__, nci_reset_rsp[0], @@ -1106,9 +1166,87 @@ err_nfcc_hw_check: done: kfree(nci_reset_rsp); + kfree(nci_reset_ntf); kfree(nci_reset_cmd); kfree(nci_get_version_cmd); kfree(nci_get_version_rsp); +#else + unsigned int enable_gpio = nqx_dev->en_gpio; + unsigned int firm_gpio = nqx_dev->firm_gpio; + char *nci_get_fw_cmd = NULL; + char *nci_get_fw_rsp = NULL; + + nci_get_fw_cmd = kzalloc(NCI_GET_FW_CMD_LEN + 1, GFP_DMA | GFP_KERNEL); + if (!nci_get_fw_cmd) { + ret = -ENOMEM; + goto done; + } + + nci_get_fw_rsp = kzalloc(NCI_GET_FW_RSP_LEN + 1, GFP_DMA | GFP_KERNEL); + if (!nci_get_fw_rsp) { + ret = -ENOMEM; + goto done; + } + +reset_enable_gpio: + gpio_set_value(firm_gpio, 1); + /* hardware dependent delay */ + usleep_range(10000, 10100); + /* making sure that the NFCC starts in a clean state. */ + gpio_set_value(enable_gpio, 0);/* ULPM: Disable */ + /* hardware dependent delay */ + usleep_range(10000, 10100); + gpio_set_value(enable_gpio, 1);/* HPD : Enable*/ + /* hardware dependent delay */ + usleep_range(10000, 10100); + + nci_get_fw_cmd[0] = 0x00; + nci_get_fw_cmd[1] = 0x04; + nci_get_fw_cmd[2] = 0xF1; + nci_get_fw_cmd[3] = 0x00; + nci_get_fw_cmd[4] = 0x00; + nci_get_fw_cmd[5] = 0x00; + nci_get_fw_cmd[6] = 0x6E; + nci_get_fw_cmd[7] = 0xEF; + + /*send get FW Version CMD */ + ret = i2c_master_send(client, nci_get_fw_cmd, NCI_GET_FW_CMD_LEN); + if (ret < 0) { + pr_err("%s: - i2c_master_send get fw version Error\n", __func__); + goto err_nfcc_hw_check; + } + pr_err("%s: raw_fw_get_version success----\n", __func__); + /* hardware dependent delay */ + msleep(50); + + /* Read Response of FW Version CMD */ + ret = i2c_master_recv(client, nci_get_fw_rsp, NCI_GET_FW_RSP_LEN); + if (ret < 0) { + dev_err(&client->dev, + "%s: - i2c_master_recv Error\n", __func__); + gpio_retry_count = gpio_retry_count + 1; + if (gpio_retry_count < MAX_RETRY_COUNT) + goto reset_enable_gpio; + goto err_nfcc_hw_check; + } + + ret = 0; + + dev_err(&client->dev,"%s:%d FW: %02x.%02x.%02x",__func__, __LINE__, nci_get_fw_rsp[4], + nci_get_fw_rsp[7], nci_get_fw_rsp[6]); + goto done; + +err_nfcc_hw_check: + ret = -ENXIO; + pr_err("%s: - NFCC HW not available\n", __func__); + +done: + gpio_set_value(firm_gpio, 0); + /* make sure NFCC is not enabled */ + gpio_set_value(enable_gpio, 0); + kfree(nci_get_fw_rsp); + kfree(nci_get_fw_cmd); +#endif /* VENDOR_EDIT */ return ret; } @@ -1222,6 +1360,12 @@ static int nqx_probe(struct i2c_client *client, struct nqx_platform_data *platform_data; struct nqx_dev *nqx_dev; + //#ifdef VENDOR_EDIT + //Zhou.Zheng@CN.NFC.Basic.Hardware,2674926, 2019/12/16, + //Add for : ST NXP chip common software + CHECK_NFC_CHIP(SN100T); + //#endif /* VENDOR_EDIT */ + dev_dbg(&client->dev, "%s: enter\n", __func__); if (client->dev.of_node) { platform_data = devm_kzalloc(&client->dev, @@ -1398,6 +1542,12 @@ static int nqx_probe(struct i2c_client *client, mutex_init(&nqx_dev->read_mutex); mutex_init(&nqx_dev->dev_ref_mutex); spin_lock_init(&nqx_dev->irq_enabled_lock); + #ifdef VENDOR_EDIT + //Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, + //add spi ven flag and protect the access to it + mutex_init(&nqx_dev->spi_mutex); /* init spi_ven_enabled to false */ + nqx_dev->spi_ven_enabled = false; + #endif /* VENDOR_EDIT */ r = alloc_chrdev_region(&nqx_dev->devno, 0, DEV_COUNT, DEVICE_NAME); if (r < 0) { @@ -1448,9 +1598,21 @@ static int nqx_probe(struct i2c_client *client, /* make sure NFCC is not enabled */ gpio_set_value(platform_data->en_gpio, 0); /* We don't think there is hardware switch NFC OFF */ + #ifndef VENDOR_EDIT + //zhang.nan@CN.NFC.Basic.hardware,2108731 2019/06/21, + //Modify for FW26 HW check fail goto err_request_hw_check_failed; + #else + //goto err_request_hw_check_failed; + #endif /* VENDOR_EDIT */ } + #ifdef VENDOR_EDIT + //zhang.nan@CN.NFC.Basic.hardware,2108731 2019/06/22, + //Modify for FW26 HW check fail, need to update chip_type + nqx_dev->nqx_info.info.chip_type = NFCC_SN100_B; + #endif /* VENDOR_EDIT */ + /* Register reboot notifier here */ r = register_reboot_notifier(&nfcc_notifier); if (r) { @@ -1499,6 +1661,11 @@ err_class_create: unregister_chrdev_region(nqx_dev->devno, DEV_COUNT); err_char_dev_register: mutex_destroy(&nqx_dev->read_mutex); + #ifdef VENDOR_EDIT + //Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, + //add spi ven flag and protect the access to it + mutex_destroy(&nqx_dev->spi_mutex); + #endif /* VENDOR_EDIT */ err_clkreq_gpio: gpio_free(platform_data->clkreq_gpio); err_ese_gpio: @@ -1545,6 +1712,14 @@ static int nqx_remove(struct i2c_client *client) class_destroy(nqx_dev->nqx_class); unregister_chrdev_region(nqx_dev->devno, DEV_COUNT); mutex_destroy(&nqx_dev->read_mutex); + #ifdef VENDOR_EDIT + //Dongdong.Chang@CN.NFC.Basic.Hardware.2084619, 2019/04/25, + //add spi ven flag and protect the access to it + mutex_destroy(&nqx_dev->spi_mutex); + nqx_dev->nfc_ven_enabled = false; + nqx_dev->spi_ven_enabled = false; + #endif /* VENDOR_EDIT */ + mutex_destroy(&nqx_dev->dev_ref_mutex); gpio_free(nqx_dev->clkreq_gpio); /* optional gpio, not sure was configured in probe */ diff --git a/drivers/nfc/nq-nci.h b/drivers/nfc/nq-nci.h index 8086569019fe..0f05db846852 100644 --- a/drivers/nfc/nq-nci.h +++ b/drivers/nfc/nq-nci.h @@ -37,34 +37,6 @@ #define BYTE (0x8) #define NCI_IDENTIFIER (0x10) -#define DEV_COUNT 1 -#define DEVICE_NAME "nq-nci" -#define CLASS_NAME "nqx" -/* - * From MW 11.04 buffer size increased to support - * frame size of 554 in FW download mode - * Frame len(2) + Frame Header(6) + DATA(512) + HASH(32) + CRC(2) + RFU(4) - */ -#define MAX_BUFFER_SIZE (558) -#define WAKEUP_SRC_TIMEOUT (2000) -#define MAX_RETRY_COUNT 3 -#define NCI_RESET_CMD_LEN 4 -#define NCI_RESET_RSP_LEN 6 -#define NCI_RESET_NTF_LEN 13 -#define NCI_INIT_CMD_LEN 3 -#define NCI_INIT_RSP_LEN 28 -#define NCI_GET_VERSION_CMD_LEN 8 -#define NCI_GET_VERSION_RSP_LEN 12 -#define NCI_HEADER_LEN 3 -#define NCI_1_0_RESET_RSP_PAYLOAD_LEN 3 -#define NCI_PAYLOAD_START_INDEX 3 -#define NCI_PAYLOAD_LENGTH_INDEX (NCI_PAYLOAD_START_INDEX - 1) -#define MAX_IRQ_WAIT_TIME (90) /* in ms */ -#define NFCC_HW_CHIP_ID_OFFSET 4 -#define NFCC_HW_ROM_VER_OFFSET 3 -#define NFCC_HW_MAJOR_NO_OFFSET 2 -#define NFCC_HW_MINOR_NO_OFFSET 1 - enum nfcc_initial_core_reset_ntf { TIMEDOUT_INITIAL_CORE_RESET_NTF = 0, /* 0*/ ARRIVED_INITIAL_CORE_RESET_NTF, /* 1 */ diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index b2ea3b1b782d..13530f0b863a 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -30,6 +30,10 @@ static struct reserved_mem reserved_mem[MAX_RESERVED_REGIONS]; static int reserved_mem_count; +#ifdef OPLUS_FEATURE_LOWMEM_DBG +static unsigned long reserved_mem_size; +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ + #if defined(CONFIG_HAVE_MEMBLOCK) #include int __init __weak early_init_dt_alloc_reserved_memory_arch(phys_addr_t size, @@ -284,6 +288,9 @@ void __init fdt_init_reserved_mem(void) &rmem->base, &rmem->size); if (err == 0) __reserved_mem_init_node(rmem); +#ifdef OPLUS_FEATURE_LOWMEM_DBG + reserved_mem_size += rmem->size; +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ } } @@ -371,6 +378,13 @@ int of_reserved_mem_device_init_by_idx(struct device *dev, } EXPORT_SYMBOL_GPL(of_reserved_mem_device_init_by_idx); +#ifdef OPLUS_FEATURE_LOWMEM_DBG +unsigned long dt_memory_reserved_pages(void) +{ + return reserved_mem_size >> PAGE_SHIFT; +} +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ + /** * of_reserved_mem_device_release() - release reserved memory device structures * @dev: Pointer to the device to deconfigure @@ -400,3 +414,29 @@ void of_reserved_mem_device_release(struct device *dev) rmem->ops->device_release(rmem, dev); } EXPORT_SYMBOL_GPL(of_reserved_mem_device_release); + +/** + * of_reserved_mem_lookup() - acquire reserved_mem from a device node + * @np: node pointer of the desired reserved-memory region + * + * This function allows drivers to acquire a reference to the reserved_mem + * struct based on a device node handle. + * + * Returns a reserved_mem reference, or NULL on error. + */ +struct reserved_mem *of_reserved_mem_lookup(struct device_node *np) +{ + const char *name; + int i; + + if (!np->full_name) + return NULL; + + name = kbasename(np->full_name); + for (i = 0; i < reserved_mem_count; i++) + if (!strcmp(reserved_mem[i].name, name)) + return &reserved_mem[i]; + + return NULL; +} +EXPORT_SYMBOL_GPL(of_reserved_mem_lookup); diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c index 55502fc4479c..d47f09c84e46 100644 --- a/drivers/pinctrl/pinmux.c +++ b/drivers/pinctrl/pinmux.c @@ -501,11 +501,22 @@ void pinmux_disable_setting(const struct pinctrl_setting *setting) gname = pctlops->get_group_name(pctldev, setting->data.mux.group); +#ifndef OPLUS_FEATURE_CHG_BASIC +/* LiYue@BSP.CHG.Basic, 2019/09/12, Modify for printk rate */ dev_warn(pctldev->dev, "not freeing pin %d (%s) as part of " "deactivating group %s - it is already " "used for some other setting", pins[i], desc->name, gname); +#else + if (printk_ratelimit()) { + dev_warn(pctldev->dev, + "not freeing pin %d (%s) as part of " + "deactivating group %s - it is already " + "used for some other setting", + pins[i], desc->name, gname); + } +#endif } } } diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig index 63454b5cac27..2717ce10e94b 100644 --- a/drivers/power/Kconfig +++ b/drivers/power/Kconfig @@ -1,3 +1,185 @@ source "drivers/power/avs/Kconfig" source "drivers/power/reset/Kconfig" source "drivers/power/supply/Kconfig" + + +#ifdef VENDOR_EDIT /* lizhijie@BSP.CHG.Basic, 2020/02/25, lzj Add for charging */ +config OPPO_SM7150R_CHARGER + tristate "OPPO SM7150R charger driver" + depends on MFD_SPMI_PMIC + help + Enables support for the oppo charging framework + +config OPPO_SM7125R_CHARGER + tristate "OPPO SM7125R charger driver" + depends on MFD_SPMI_PMIC + help + Enables support for the oppo charging framework + +config OPPO_SM8150Q_CHARGER + tristate "OPPO SM8150 charger driver" + depends on MFD_SPMI_PMIC + help + Enables support for the oppo charging framework + +config OPPO_SHORT_C_BATT_CHECK + tristate "OPPO_SHORT_C_BATT CHECK SUPPORT" + default n + depends on MFD_SPMI_PMIC + help + Say Y to include support + +config OPPO_CALL_MODE_SUPPORT + bool "OPPO call mode support" + help + Say Y to include support + +config OPLUS_WPC_INTERFACE_ENABLE + tristate "OPLUS WPC INTERFACE ENABLE" + default n + depends on MFD_SPMI_PMIC + help + Say Y to include support + +config OPPO_SMART_CHARGER_SUPPORT + bool "OPPO smart charger support" + help + Say Y to include support + +config OPPO_SHORT_HW_CHECK + tristate "OPPO_SHORT_HW CHECK SUPPORT" + default n + depends on MFD_SPMI_PMIC + help + Say Y to include support + +config OPPO_CHIP_SOC_NODE + bool "OPPO chip soc node" + help + Say Y to include support + +config OPPO_SHORT_IC_CHECK + tristate "OPPO_SHORT_IC CHECK SUPPORT" + default n + depends on MFD_SPMI_PMIC + help + Say Y to include support + +config OPPO_RTC_DET_SUPPORT + tristate "OPPO RTC DET SUPPORT" + default n + depends on MFD_SPMI_PMIC + help + Say Y to include support + +config OPPO_CHECK_CHARGERID_VOLT + tristate "OPPO CHECK CHARGERID VOLT" + default n + depends on MFD_SPMI_PMIC + help + Say Y to include support + +config OPPO_SHIP_MODE_SUPPORT + tristate "OPPO_SHIP_MODE_SUPPORT" + default n + depends on MFD_SPMI_PMIC + help + Say Y to include support + +config OPPO_SHORT_USERSPACE + bool "OPPO batt userspace" + help + Say Y to include support + +config OPPO_SMOOTH_SOC + bool "OPPO SMOOTH SOC " + help + Say Y to include support + +config OPLUS_SM7150R_CHARGER + tristate "OPLUS SM7125R charger driver" + depends on MFD_SPMI_PMIC + help + Enables support for the OPLUS charging framework + +config OPLUS_SM7125R_CHARGER + tristate "OPLUS SM7125R charger driver" + depends on MFD_SPMI_PMIC + help + Enables support for the OPLUS charging framework + +config OPLUS_SM8150R_CHARGER + tristate "OPLUS SM8150 charger driver" + depends on MFD_SPMI_PMIC + help + Enables support for the oppo charging framework + +config OPLUS_SHORT_C_BATT_CHECK + tristate "OPLUS_SHORT_C_BATT CHECK SUPPORT" + default n + depends on MFD_SPMI_PMIC + help + Say Y to include support + +config OPLUS_CALL_MODE_SUPPORT + bool "OPLUS call mode support" + help + Say Y to include support + +config OPLUS_SMART_CHARGER_SUPPORT + bool "OPLUS smart charger support" + help + Say Y to include support + +config OPLUS_SHORT_HW_CHECK + tristate "OPLUS_SHORT_HW CHECK SUPPORT" + default n + depends on MFD_SPMI_PMIC + help + Say Y to include support + +config OPLUS_CHIP_SOC_NODE + bool "OPLUS chip soc node" + help + Say Y to include support + +config OPLUS_SHORT_IC_CHECK + tristate "OPLUS_SHORT_IC CHECK SUPPORT" + default n + depends on MFD_SPMI_PMIC + help + Say Y to include support + +config OPLUS_RTC_DET_SUPPORT + tristate "OPLUS RTC DET SUPPORT" + default n + depends on MFD_SPMI_PMIC + help + Say Y to include support + +config OPLUS_CHECK_CHARGERID_VOLT + tristate "OPLUS CHECK CHARGERID VOLT" + default n + depends on MFD_SPMI_PMIC + help + Say Y to include support + +config OPLUS_SHIP_MODE_SUPPORT + tristate "OPLUS_SHIP_MODE_SUPPORT" + default n + depends on MFD_SPMI_PMIC + help + Say Y to include support + +config OPLUS_SHORT_USERSPACE + bool "OPLUS batt userspace" + help + Say Y to include support + +config OPLUS_SMOOTH_SOC + bool "OPLUS SMOOTH SOC " + help + Say Y to include support +source "drivers/power/oppo/Kconfig" +#endif + diff --git a/drivers/power/Makefile b/drivers/power/Makefile index ff35c712d824..9a359c2669cf 100644 --- a/drivers/power/Makefile +++ b/drivers/power/Makefile @@ -1,3 +1,19 @@ +KBUILD_CFLAGS += -DVENDOR_EDIT +KBUILD_CPPFLAGS += -DVENDOR_EDIT +CFLAGS_KERNEL += -DVENDOR_EDIT +CFLAGS_MODULE += -DVENDOR_EDIT obj-$(CONFIG_POWER_AVS) += avs/ obj-$(CONFIG_POWER_RESET) += reset/ obj-$(CONFIG_POWER_SUPPLY) += supply/ + +#ifdef OPLUS_FEATURE_CHG_BASIC /* Jianchao.Shi@BSP.CHG.Basic, 2018/01/12, sjc Add for charging */ +obj-$(CONFIG_OPLUS_SM8150R_CHARGER) += oppo/ +#endif + +#ifdef VENDOR_EDIT /* Jianchao.Shi@BSP.CHG.Basic, 2018/01/12, sjc Add for charging */ +obj-$(CONFIG_OPPO_SM7125R_CHARGER) += oppo/ +#endif + +#ifdef VENDOR_EDIT /* Jianchao.Shi@BSP.CHG.Basic, 2018/01/12, sjc Add for charging */ +obj-$(CONFIG_OPLUS_SM7150R_CHARGER) += oppo/ +#endif diff --git a/drivers/power/reset/msm-poweroff.c b/drivers/power/reset/msm-poweroff.c index 57f6eae63569..b88b9bccc57d 100644 --- a/drivers/power/reset/msm-poweroff.c +++ b/drivers/power/reset/msm-poweroff.c @@ -36,6 +36,10 @@ #include #include #include +#ifdef CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE +#include +#include +#endif #define EMERGENCY_DLOAD_MAGIC1 0x322A4F99 #define EMERGENCY_DLOAD_MAGIC2 0xC67E4350 @@ -51,6 +55,9 @@ #define SCM_DLOAD_MINIDUMP 0X20 #define SCM_DLOAD_BOTHDUMPS (SCM_DLOAD_MINIDUMP | SCM_DLOAD_FULLDUMP) +/* if open fulldump disable the pmic watchdog */ +void oppo_set_pmicWd_state(int enable); + static int restart_mode; static void *restart_reason; static bool scm_pmic_arbiter_disable_supported; @@ -77,7 +84,17 @@ static bool force_warm_reboot; static int in_panic; static struct kobject dload_kobj; +static struct kobject dload_kobj; +#ifndef CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE +//Bin.Xu@BSP.Kernel.Stability, 2020/4/4, add checklist: minidump static int dload_type = SCM_DLOAD_FULLDUMP; +#else +#if defined(CONFIG_OPPO_DEBUG_BUILD) +int dload_type = SCM_DLOAD_FULLDUMP; +#else +int dload_type = SCM_DLOAD_MINIDUMP; +#endif +#endif static void *dload_mode_addr; static void *dload_type_addr; static bool dload_mode_enabled; @@ -86,6 +103,14 @@ static void *emergency_dload_mode_addr; static void __iomem *kaslr_imem_addr; #endif static bool scm_dload_supported; +#ifdef CONFIG_OPLUS_FEATURE_PANIC_FLUSH +//Wanghao@BSP.Kernel.Function 2018/12/07, add for 5G modem dump issue +int get_download_mode(void) +{ + return download_mode && (dload_type & SCM_DLOAD_FULLDUMP); +} +EXPORT_SYMBOL(get_download_mode); +#endif static int dload_set(const char *val, const struct kernel_param *kp); /* interface for exporting attributes */ @@ -138,6 +163,45 @@ int scm_set_dload_mode(int arg1, int arg2) &desc); } + +#ifdef OPLUS_BUG_STABILITY +// Bin.Xu@BSP.Kernel.Stability, 2020/4/4, add checklist: minidump +bool is_fulldump_enable(void) +{ + return download_mode && (dload_type & SCM_DLOAD_FULLDUMP); +} + +void oppo_switch_fulldump(int on) +{ + int ret; + + if (dload_mode_addr) { + __raw_writel(0xE47B337D, dload_mode_addr); + __raw_writel(0xCE14091A, + dload_mode_addr + sizeof(unsigned int)); + mb(); + } + if(on){ + ret = scm_set_dload_mode(SCM_DLOAD_FULLDUMP, 0); + if (ret) + pr_err("Failed to set secure DLOAD mode: %d\n", ret); + dload_type = SCM_DLOAD_FULLDUMP; + }else{ + ret = scm_set_dload_mode(SCM_DLOAD_MINIDUMP, 0); + if (ret) + pr_err("Failed to set secure DLOAD mode: %d\n", ret); + dload_type = SCM_DLOAD_MINIDUMP; + } + + if(dload_type == SCM_DLOAD_MINIDUMP) + __raw_writel(EMMC_DLOAD_TYPE, dload_type_addr); + else + __raw_writel(0, dload_type_addr); + dload_mode_enabled = on; +} +EXPORT_SYMBOL(oppo_switch_fulldump); +#endif /* OPLUS_BUG_STABILITY */ + static void set_dload_mode(int on) { int ret; @@ -154,6 +218,14 @@ static void set_dload_mode(int on) if (ret) pr_err("Failed to set secure DLOAD mode: %d\n", ret); +#ifdef CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE +// Bin.Xu@BSP.Kernel.Stability, 2020/4/4, add checklist: minidump + if(dload_type == SCM_DLOAD_MINIDUMP) + __raw_writel(EMMC_DLOAD_TYPE, dload_type_addr); + else + __raw_writel(0, dload_type_addr); +#endif /* CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE */ + dload_mode_enabled = on; } @@ -162,6 +234,15 @@ static bool get_dload_mode(void) return dload_mode_enabled; } +#ifdef OPLUS_FEATURE_ADSP_RECOVERY +/*Suresh.Alla@MULTIMEDIA.AUDIODRVIER.ADSP.2434874, 2020/08/14, Add for adsp issue*/ +bool oem_is_fulldump(void) +{ + return download_mode && (dload_type & SCM_DLOAD_FULLDUMP); +} +EXPORT_SYMBOL(oem_is_fulldump); +#endif /* OPLUS_FEATURE_ADSP_RECOVERY */ + static void enable_emergency_dload_mode(void) { int ret; @@ -179,11 +260,11 @@ static void enable_emergency_dload_mode(void) /* Need disable the pmic wdt, then the emergency dload mode * will not auto reset. */ - qpnp_pon_wd_config(0); /* Make sure all the cookied are flushed to memory */ mb(); } - + + qpnp_pon_wd_config(0); ret = scm_set_dload_mode(SCM_EDLOAD_MODE, 0); if (ret) pr_err("Failed to set secure EDLOAD mode: %d\n", ret); @@ -308,7 +389,22 @@ static void msm_restart_prepare(const char *cmd) need_warm_reset = (get_dload_mode() || (cmd != NULL && cmd[0] != '\0')); } +#ifdef OPLUS_BUG_STABILITY +//Fanhong.Kong@PSW.BSP.CHG,add 2018/3/25 panic reboot reason as kernel for hotfix + if (in_panic){ + //warm reset + qpnp_pon_system_pwr_off(PON_POWER_OFF_WARM_RESET); + qpnp_pon_set_restart_reason( + PON_RESTART_REASON_KERNEL); + flush_cache_all(); + /*outer_flush_all is not supported by 64bit kernel*/ +#ifndef CONFIG_ARM64 + outer_flush_all(); +#endif + return; + } +#endif /* OPLUS_BUG_STABILITY */ if (force_warm_reboot) pr_info("Forcing a warm reset of the system\n"); @@ -343,6 +439,23 @@ static void msm_restart_prepare(const char *cmd) qpnp_pon_set_restart_reason( PON_RESTART_REASON_KEYS_CLEAR); __raw_writel(0x7766550a, restart_reason); + #ifdef OPLUS_FEATURE_AGINGTEST + //xiaofan.yang@PSW.TECH.AgingTest, 2019/01/07,Add for factory agingtest + } else if(!strcmp(cmd, "sbllowmemtest")){ + qpnp_pon_set_restart_reason( + PON_RESTART_REASON_SBL_DDR_CUS); + __raw_writel(0x7766550b, restart_reason); + }else if (!strcmp(cmd, "sblmemtest")){//oppo factory aging test + printk("[%s:%d] lunch ddr test!!\n", current->comm, current->pid); + qpnp_pon_set_restart_reason( + PON_RESTART_REASON_SBL_DDRTEST); + __raw_writel(0x7766550b, restart_reason); + } else if(!strcmp(cmd, "usermemaging")){ + printk("[%s:%d] lunch user memory test!!\n", current->comm, current->pid); + qpnp_pon_set_restart_reason( + PON_RESTART_REASON_MEM_AGING); + __raw_writel(0x7766550b, restart_reason); + #endif } else if (!strncmp(cmd, "oem-", 4)) { unsigned long code; int ret; @@ -353,11 +466,54 @@ static void msm_restart_prepare(const char *cmd) restart_reason); } else if (!strncmp(cmd, "edl", 3)) { enable_emergency_dload_mode(); - } else { + } +#ifdef VENDOR_EDIT +/*xing.xing@BSP.Bootloader.Bootflow, 2019/04/11, Add for oppo boot mode*/ + else if (!strncmp(cmd, "rf", 2)) { + qpnp_pon_set_restart_reason( + PON_RESTART_REASON_RF); + } else if (!strncmp(cmd, "wlan",4)) { + qpnp_pon_set_restart_reason( + PON_RESTART_REASON_WLAN); + #ifdef USE_MOS_MODE + } else if (!strncmp(cmd, "mos", 3)) { + qpnp_pon_set_restart_reason( + PON_RESTART_REASON_MOS); + #endif + } else if (!strncmp(cmd, "ftm", 3)) { + qpnp_pon_set_restart_reason( + PON_RESTART_REASON_FACTORY); + } else if (!strncmp(cmd, "kernel", 6)) { + qpnp_pon_set_restart_reason( + PON_RESTART_REASON_KERNEL); + } else if (!strncmp(cmd, "modem", 5)) { + qpnp_pon_set_restart_reason( + PON_RESTART_REASON_MODEM); + } else if (!strncmp(cmd, "android", 7)) { + qpnp_pon_set_restart_reason( + PON_RESTART_REASON_ANDROID); + } else if (!strncmp(cmd, "silence", 7)) { + qpnp_pon_set_restart_reason( + PON_RESTART_REASON_SILENCE); + } else if (!strncmp(cmd, "sau", 3)) { + qpnp_pon_set_restart_reason( + PON_RESTART_REASON_SAU); + } else if (!strncmp(cmd, "safe", 4)) { + qpnp_pon_set_restart_reason( + PON_RESTART_REASON_SAFE); + } +#endif + else { __raw_writel(0x77665501, restart_reason); } } - +#ifdef VENDOR_EDIT +/*xing.xing@BSP.Bootloader.Bootflow, 2019/04/11, Add for oppo boot mode*/ + else { + qpnp_pon_set_restart_reason( + PON_RESTART_REASON_NORMAL); + } +#endif flush_cache_all(); /*outer_flush_all is not supported by 64bit kernel*/ @@ -539,6 +695,10 @@ static size_t store_dload_mode(struct kobject *kobj, struct attribute *attr, return -EINVAL; } + /* yanghao@BSP.Kernel.Driver, if open fulldump disable the pmic watchdog */ + if(dload_type == SCM_DLOAD_FULLDUMP) + oppo_set_pmicWd_state(0); + mutex_lock(&tcsr_lock); /*Overwrite TCSR reg*/ set_dload_mode(dload_type); @@ -588,6 +748,18 @@ static int msm_restart_probe(struct platform_device *pdev) struct resource *mem; struct device_node *np; int ret = 0; + +#ifdef CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE +/* Fuchun.Liao@BSP.CHG.Basic 2020/04/08 add for minidump customized */ +#ifdef CONFIG_OPPO_USER_BUILD + if (get_eng_version() == AGING) + dload_type = SCM_DLOAD_FULLDUMP; + else + dload_type = SCM_DLOAD_MINIDUMP; +#else + dload_type = SCM_DLOAD_FULLDUMP; +#endif +#endif #ifdef CONFIG_QCOM_DLOAD_MODE if (scm_is_call_available(SCM_SVC_BOOT, SCM_DLOAD_CMD) > 0) diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index 97d338f71a61..13f14ee6ec6b 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -34,6 +34,27 @@ static struct device_type power_supply_dev_type; #define POWER_SUPPLY_DEFERRED_REGISTER_TIME msecs_to_jiffies(10) +#ifdef CONFIG_OPLUS_FEATURE_PANIC_FLUSH +/*jason.tang@TECH.BSP.Kernel.Storage, 2019-05-20, add control ext4 fsync*/ +extern int sysctl_ext4_fsync_enable; +extern int ext4_fsync_enable_status; + +static void power_supply_update_fsync(struct power_supply *psy) +{ + union power_supply_propval ret = {0, }; + if (psy->desc->type == POWER_SUPPLY_TYPE_BATTERY) + { + if (power_supply_get_property(psy, POWER_SUPPLY_PROP_CAPACITY, &ret)) + return; + if (ret.intval < 5 && ext4_fsync_enable_status != 0) { + ext4_fsync_enable_status = 0; + } else if (ret.intval > 5 && ext4_fsync_enable_status != 1) { + ext4_fsync_enable_status = 1; + } + } +} +#endif + static bool __power_supply_is_supplied_by(struct power_supply *supplier, struct power_supply *supply) { @@ -95,6 +116,15 @@ static void power_supply_changed_work(struct work_struct *work) class_for_each_device(power_supply_class, NULL, psy, __power_supply_changed_work); power_supply_update_leds(psy); +#ifdef CONFIG_OPLUS_FEATURE_PANIC_FLUSH +/*jason.tang@TECH.BSP.Kernel.Storage, 2019-05-20, add control ext4 fsync*/ + if(sysctl_ext4_fsync_enable) { + power_supply_update_fsync(psy); + } else { + if(ext4_fsync_enable_status != 0) + ext4_fsync_enable_status = 0; + } +#endif /*CONFIG_OPLUS_FEATURE_PANIC_FLUSH*/ atomic_notifier_call_chain(&power_supply_notifier, PSY_EVENT_PROP_CHANGED, psy); kobject_uevent(&psy->dev.kobj, KOBJ_CHANGE); diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c index 88bfbb203e3b..ea16166058f1 100644 --- a/drivers/power/supply/power_supply_sysfs.c +++ b/drivers/power/supply/power_supply_sysfs.c @@ -225,6 +225,29 @@ static ssize_t power_supply_store_property(struct device *dev, /* Must be in the same order as POWER_SUPPLY_PROP_* */ static struct device_attribute power_supply_attrs[] = { /* Properties of type `int' */ +#ifdef VENDOR_EDIT +/* lizhijie@BSP.CHG.Basic, 2020/02/25, lzj Add for charging */ + POWER_SUPPLY_ATTR(charge_technology), + POWER_SUPPLY_ATTR(fastcharger), + POWER_SUPPLY_ATTR(mmi_charging_enable), + POWER_SUPPLY_ATTR(otg_switch), + POWER_SUPPLY_ATTR(otg_online), + POWER_SUPPLY_ATTR(fast_chg_type), + POWER_SUPPLY_ATTR(batt_fcc), + POWER_SUPPLY_ATTR(batt_soh), + POWER_SUPPLY_ATTR(batt_cc), + POWER_SUPPLY_ATTR(batt_rm), + POWER_SUPPLY_ATTR(batt_soc), + POWER_SUPPLY_ATTR(authenticate), + POWER_SUPPLY_ATTR(charge_timeout), + POWER_SUPPLY_ATTR(notify_code), + POWER_SUPPLY_ATTR(cool_down), + POWER_SUPPLY_ATTR(usb_status), + POWER_SUPPLY_ATTR(usbtemp_volt_l), + POWER_SUPPLY_ATTR(usbtemp_volt_r), + POWER_SUPPLY_ATTR(battery_info), + POWER_SUPPLY_ATTR(battery_info_id), +#endif /* VENDOR_EDIT */ POWER_SUPPLY_ATTR(status), POWER_SUPPLY_ATTR(charge_type), POWER_SUPPLY_ATTR(health), @@ -356,6 +379,11 @@ static struct device_attribute power_supply_attrs[] = { POWER_SUPPLY_ATTR(parallel_disable), POWER_SUPPLY_ATTR(pe_start), POWER_SUPPLY_ATTR(soc_reporting_ready), +#ifdef VENDOR_EDIT + /* Ji.Xu PSW.BSP.CHG 2018-07-23 Save battery capacity to persist partition */ + POWER_SUPPLY_ATTR(soc_notify_ready), + POWER_SUPPLY_ATTR(restore_soc), +#endif /* VENDOR_EDIT */ POWER_SUPPLY_ATTR(debug_battery), POWER_SUPPLY_ATTR(fcc_delta), POWER_SUPPLY_ATTR(icl_reduction), @@ -424,6 +452,50 @@ static struct device_attribute power_supply_attrs[] = { POWER_SUPPLY_ATTR(parallel_output_mode), /* Local extensions of type int64_t */ POWER_SUPPLY_ATTR(charge_counter_ext), +#ifdef VENDOR_EDIT +/* lizhijie@BSP.CHG.Basic, 2020/02/25, lzj Add for charging */ + POWER_SUPPLY_ATTR(adapter_fw_update), + POWER_SUPPLY_ATTR(voocchg_ing), + POWER_SUPPLY_ATTR(chargerid_volt), + POWER_SUPPLY_ATTR(ship_mode), + POWER_SUPPLY_ATTR(call_mode), +#ifdef CONFIG_OPLUS_CHIP_SOC_NODE + POWER_SUPPLY_ATTR(chip_soc), +#endif +#ifdef CONFIG_OPLUS_SMOOTH_SOC + POWER_SUPPLY_ATTR(smooth_soc), + POWER_SUPPLY_ATTR(smooth_switch), +#endif + +#ifdef CONFIG_OPLUS_SHORT_USERSPACE + POWER_SUPPLY_ATTR(short_c_batt_limit_chg), + POWER_SUPPLY_ATTR(short_c_batt_limit_rechg), +#else + POWER_SUPPLY_ATTR(short_c_batt_update_change), + POWER_SUPPLY_ATTR(short_c_batt_in_idle), + POWER_SUPPLY_ATTR(short_c_batt_cv_status), +#endif /*CONFIG_OPLUS_SHORT_USERSPACE*/ +#endif /* VENDOR_EDIT */ +#ifdef VENDOR_EDIT +//lizhijie@BSP.CHG.Basic, 2020/02/25, lzj Add for hw battery check +#ifdef CONFIG_OPLUS_SHORT_HW_CHECK + POWER_SUPPLY_ATTR(short_c_hw_feature), + POWER_SUPPLY_ATTR(short_c_hw_status), +#endif +#ifdef CONFIG_OPLUS_SHORT_IC_CHECK + POWER_SUPPLY_ATTR(short_ic_otp_status), + POWER_SUPPLY_ATTR(short_ic_volt_thresh), + POWER_SUPPLY_ATTR(short_ic_otp_value), +#endif +// add by huangtongfeng for wireless file + POWER_SUPPLY_ATTR(tx_voltag_now), + POWER_SUPPLY_ATTR(tx_current_now), + POWER_SUPPLY_ATTR(cp_voltage_now), + POWER_SUPPLY_ATTR(cp_current_now), + POWER_SUPPLY_ATTR(wireless_mode), + POWER_SUPPLY_ATTR(wireless_type), + POWER_SUPPLY_ATTR(cep_info), +#endif /*VENDOR_EDIT*/ /* Properties of type `const char *' */ POWER_SUPPLY_ATTR(model_name), POWER_SUPPLY_ATTR(manufacturer), diff --git a/drivers/power/supply/qcom/Makefile b/drivers/power/supply/qcom/Makefile index 7bd936244b54..abb3b0abb804 100644 --- a/drivers/power/supply/qcom/Makefile +++ b/drivers/power/supply/qcom/Makefile @@ -7,7 +7,11 @@ obj-$(CONFIG_QPNP_SMB2) += step-chg-jeita.o battery.o qpnp-smb2.o smb-lib.o pmi obj-$(CONFIG_SMB138X_CHARGER) += step-chg-jeita.o smb138x-charger.o smb-lib.o pmic-voter.o storm-watch.o battery.o obj-$(CONFIG_QPNP_QNOVO) += qpnp-qnovo.o battery.o obj-$(CONFIG_QPNP_QNOVO5) += qpnp-qnovo5.o battery.o -obj-$(CONFIG_QPNP_SMB5) += step-chg-jeita.o battery.o qpnp-smb5.o smb5-lib.o pmic-voter.o storm-watch.o schgm-flash.o +#ifdef VENDOR_EDIT /* lizhijie@BSP.CHG.Basic, 2020/02/25, Modify for charging */ +obj-$(CONFIG_QPNP_SMB5) += step-chg-jeita.o battery.o pmic-voter.o storm-watch.o schgm-flash.o +#else +#obj-$(CONFIG_QPNP_SMB5) += step-chg-jeita.o battery.o qpnp-smb5.o smb5-lib.o pmic-voter.o storm-watch.o schgm-flash.o +#endif obj-$(CONFIG_SMB1390_CHARGE_PUMP) += smb1390-charger.o pmic-voter.o obj-$(CONFIG_SMB1390_CHARGE_PUMP_PSY) += smb1390-charger-psy.o pmic-voter.o obj-$(CONFIG_SMB1398_CHARGER) += smb1398-charger.o pmic-voter.o diff --git a/drivers/power/supply/qcom/qg-core.h b/drivers/power/supply/qcom/qg-core.h index 485e49ba9214..ff7eb6b37803 100644 --- a/drivers/power/supply/qcom/qg-core.h +++ b/drivers/power/supply/qcom/qg-core.h @@ -12,6 +12,14 @@ #ifndef __QG_CORE_H__ #define __QG_CORE_H__ +#ifdef VENDOR_EDIT +/* Yichun.Chen PSW.BSP.CHG 2018-05-04 Add for debug */ +#define qg_debug(fmt, ...) \ + printk(KERN_NOTICE "[OPLUS_CHG][%s]"fmt, __func__, ##__VA_ARGS__) + +#define qg_err(fmt, ...) \ + printk(KERN_ERR "[OPLUS_CHG][%s]"fmt, __func__, ##__VA_ARGS__) +#endif #include #include "fg-alg.h" #include "qg-defs.h" @@ -143,6 +151,10 @@ struct qpnp_qg { bool charge_full; bool force_soc; bool fvss_active; +#ifdef VENDOR_EDIT +/* wangchao@ODM.BSP.charge, 2019/12/10, Add for oplus gauge*/ + bool enable_qpnp_qg; +#endif bool tcss_active; bool bass_active; int charge_status; @@ -203,6 +215,36 @@ struct qpnp_qg { struct cycle_counter *counter; /* ttf */ struct ttf *ttf; + +#ifdef VENDOR_EDIT + /* Yichun.Chen PSW.BSP.CHG 2018-06-13 avoid when reboot soc reduce 1% */ + int skip_scale_soc_count; +#endif + +#ifdef VENDOR_EDIT +/* Yichun.Chen PSW.BSP.CHG 2018-08-23 recognize SDI\ATL battery */ + int atl_4_45_battery_id_low; + int atl_4_45_battery_id_high; + int atl_4_4_battery_id_low; + int atl_4_4_battery_id_high; + int sdi_4_45_battery_id_low; + int sdi_4_45_battery_id_high; + int sdi_4_4_battery_id_low; + int sdi_4_4_battery_id_high; + int lw_battery_id_low; + int lw_battery_id_high; + int cl_battery_id_low; + int cl_battery_id_high; +#endif + +#ifdef VENDOR_EDIT +/* Ji.Xu PSW.BSP.CHG 2018-07-23 Save battery capacity to persist partition */ + int batt_info[6]; + int batt_info_id; + bool *batt_range_ocv; + int *batt_range_pct; +#endif + }; struct ocv_all { diff --git a/drivers/power/supply/qcom/qg-soc.c b/drivers/power/supply/qcom/qg-soc.c index dca0e2eb87c5..c717b2f7f328 100644 --- a/drivers/power/supply/qcom/qg-soc.c +++ b/drivers/power/supply/qcom/qg-soc.c @@ -32,7 +32,7 @@ #define VBAT_LOW_HYST_UV 50000 #define FULL_SOC 100 -static int qg_delta_soc_interval_ms = 20000; +static int qg_delta_soc_interval_ms = 10000; module_param_named( soc_interval_ms, qg_delta_soc_interval_ms, int, 0600 ); @@ -197,8 +197,14 @@ static int qg_process_tcss_soc(struct qpnp_qg *chip, int sys_soc) QG_MAX_SOC, qg_iterm_ua, chip->prev_fifo_i_ua); +#ifdef OPLUS_FEATURE_CHG_BASIC +/*zhouhaikang@BSP.CHG.Basic,2020/10/31,add for chg*/ + if(chip->prev_fifo_i_ua >= qg_iterm_ua) + soc_ibat = QG_MAX_SOC; +#endif soc_ibat = CAP(QG_MIN_SOC, QG_MAX_SOC, soc_ibat); - +#ifndef OPLUS_FEATURE_CHG_BASIC +/*zhouhaikang@BSP.CHG.Basic,2020/10/31,add for chg*/ wt_ibat = qg_linear_interpolate(1, chip->soc_tcss_entry, 10000, 10000, soc_ibat); wt_ibat = CAP(QG_MIN_SOC, QG_MAX_SOC, wt_ibat); @@ -207,6 +213,9 @@ static int qg_process_tcss_soc(struct qpnp_qg *chip, int sys_soc) chip->soc_tcss = DIV_ROUND_CLOSEST((soc_ibat * wt_ibat) + (wt_sys * sys_soc), 10000); chip->soc_tcss = CAP(QG_MIN_SOC, QG_MAX_SOC, chip->soc_tcss); +#else + chip->soc_tcss = soc_ibat; +#endif qg_dbg(chip, QG_DEBUG_SOC, "TCSS: fifo_i=%d prev_fifo_i=%d ibatt_tcss_entry=%d qg_term=%d soc_tcss_entry=%d sys_soc=%d soc_ibat=%d wt_ibat=%d wt_sys=%d soc_tcss=%d\n", @@ -282,8 +291,19 @@ int qg_adjust_sys_soc(struct qpnp_qg *chip) /* TCSS */ chip->sys_soc = qg_process_tcss_soc(chip, chip->sys_soc); - +#ifdef OPLUS_FEATURE_CHG_BASIC +/*zhouhaikang@BSP.CHG.Basic,2020/10/31,add for chg*/ + if (chip->sys_soc <= 50) { /* 0.5% */ + /* Hold SOC to 1% of VBAT has not dropped below cutoff */ + rc = qg_get_battery_voltage(chip, &vbat_uv); + if (!rc && vbat_uv >= (vcutoff_uv + VBAT_LOW_HYST_UV)) + soc = 1; + else + soc = 0; + } else if (chip->sys_soc == QG_MAX_SOC) { +#else if (chip->sys_soc == QG_MAX_SOC) { +#endif soc = FULL_SOC; } else if (chip->sys_soc >= (QG_MAX_SOC - 100)) { /* Hold SOC to 100% if we are dropping from 100 to 99 */ @@ -361,7 +381,17 @@ static void get_next_update_time(struct qpnp_qg *chip) static bool is_scaling_required(struct qpnp_qg *chip) { bool input_present = is_input_present(chip); +#ifdef OPLUS_FEATURE_CHG_BASIC +/*zhouhaikang@BSP.CHG.Basic,2020/10/31,add for chg*/ + int ibat = 0; + int rc; + rc = qg_get_battery_current(chip, &ibat); + if(!rc){ + if (chip->catch_up_soc < chip->msoc && is_usb_present(chip) && ibat < 0) + return false; //charger inserted and has charging current, msoc don't drop. + } +#endif if (!chip->profile_loaded) return false; diff --git a/drivers/power/supply/qcom/qg-util.c b/drivers/power/supply/qcom/qg-util.c index 2d14b0ccf340..6731734ab3b8 100644 --- a/drivers/power/supply/qcom/qg-util.c +++ b/drivers/power/supply/qcom/qg-util.c @@ -351,22 +351,30 @@ int qg_write_monotonic_soc(struct qpnp_qg *chip, int msoc) return rc; } - +#ifdef VENDOR_EDIT +int g_oplus_qg_ibta; +extern bool is_batt_id_valid(struct qpnp_qg *chip); +#endif int qg_get_battery_temp(struct qpnp_qg *chip, int *temp) { int rc = 0; - if (chip->battery_missing) { - *temp = 250; - return 0; - } + if (chip->batt_therm_chan == NULL) { + *temp = 250; + return 0; + } + if ((chip->battery_missing) && (!is_batt_id_valid(chip))) { + *temp = -400; + return 0; + } - rc = iio_read_channel_processed(chip->batt_therm_chan, temp); - if (rc < 0) { - pr_err("Failed reading BAT_TEMP over ADC rc=%d\n", rc); - return rc; - } - pr_debug("batt_temp = %d\n", *temp); + rc = iio_read_channel_processed(chip->batt_therm_chan, temp); + if (rc < 0) { + pr_err("Failed reading BAT_TEMP over ADC rc=%d\n", rc); + return rc; + } + pr_debug("batt_temp = %d\n", *temp); + *temp = (*temp) / 100; return 0; } @@ -398,7 +406,8 @@ int qg_get_battery_current(struct qpnp_qg *chip, int *ibat_ua) last_ibat = sign_extend32(last_ibat, 15); *ibat_ua = qg_iraw_to_ua(chip, last_ibat); - + g_oplus_qg_ibta = *ibat_ua / 1000; + /*pr_err("kilody:qg ibat_ua=%d\n", *ibat_ua);*/ release: /* release */ qg_masked_write(chip, chip->qg_base + QG_DATA_CTL2_REG, @@ -424,7 +433,7 @@ int qg_get_battery_voltage(struct qpnp_qg *chip, int *vbat_uv) } *vbat_uv = V_RAW_TO_UV(last_vbat); - + /*pr_err("kilody:qg vbat_uv=%d\n", *vbat_uv);*/ return rc; } diff --git a/drivers/power/supply/qcom/qpnp-fg-gen3.c b/drivers/power/supply/qcom/qpnp-fg-gen3.c index 7134225ffbd5..c44a2c79e206 100644 --- a/drivers/power/supply/qcom/qpnp-fg-gen3.c +++ b/drivers/power/supply/qcom/qpnp-fg-gen3.c @@ -3669,9 +3669,12 @@ static int fg_psy_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG: rc = fg_get_time_to_empty(fg, &pval->intval); break; +#ifndef VENDOR_EDIT + //tongfeng.huangProDrv.CHG,modify 2019/09/23 case POWER_SUPPLY_PROP_SOC_REPORTING_READY: pval->intval = fg->soc_reporting_ready; break; +#endif case POWER_SUPPLY_PROP_DEBUG_BATTERY: pval->intval = is_debug_batt_id(fg); break; @@ -3891,8 +3894,11 @@ static enum power_supply_property fg_psy_props[] = { POWER_SUPPLY_PROP_CHARGE_COUNTER_SHADOW, POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG, +#ifndef VENDOR_EDIT + //tongfeng.huangProDrv.CHG,modify 2019/09/23 POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, POWER_SUPPLY_PROP_SOC_REPORTING_READY, +#endif POWER_SUPPLY_PROP_DEBUG_BATTERY, POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE, POWER_SUPPLY_PROP_CC_STEP, diff --git a/drivers/power/supply/qcom/qpnp-qg.c b/drivers/power/supply/qcom/qpnp-qg.c index 5651c8c0ccf9..b2b3636bb7d7 100644 --- a/drivers/power/supply/qcom/qpnp-qg.c +++ b/drivers/power/supply/qcom/qpnp-qg.c @@ -41,13 +41,33 @@ #include "qg-soc.h" #include "qg-battery-profile.h" #include "qg-defs.h" +#include +#ifdef VENDOR_EDIT +/* Yichun.Chen PSW.BSP.CHG 2018-04-25 Add for OPLUS_CHARGE */ +#include "../../oppo/oplus_gauge.h" +#include "../../oppo/oplus_charger.h" +#include +#include +#include + +static bool use_qpnp_qg = true; +static struct qpnp_qg *the_chip = NULL; +#endif +#ifdef VENDOR_EDIT +/* wangchao@ODM.BSP.charge, 2020/1/19, Add for batt ID check*/ +bool is_batt_id_valid(struct qpnp_qg *chip); + +/* wangyun@TECH.BSP.charge, 2020/07/03, Add for charge with vooc*/ +extern int oplus_chg_get_ffc_status(void); +extern bool oplus_vooc_get_fastchg_ing(void); +#endif static int qg_debug_mask; module_param_named( debug_mask, qg_debug_mask, int, 0600 ); -static int qg_esr_mod_count = 30; +static int qg_esr_mod_count = 5; module_param_named( esr_mod_count, qg_esr_mod_count, int, 0600 ); @@ -76,10 +96,12 @@ static bool is_battery_present(struct qpnp_qg *chip) #define DEBUG_BATT_ID_HIGH 8500 static bool is_debug_batt_id(struct qpnp_qg *chip) { +#ifndef VENDOR_EDIT +/* Yichun.Chen PSW.BSP.CHG 2018-04-24 use oplus BAT_ID */ if (is_between(DEBUG_BATT_ID_LOW, DEBUG_BATT_ID_HIGH, chip->batt_id_ohm)) return true; - +#endif return false; } @@ -128,7 +150,7 @@ static int qg_read_ocv(struct qpnp_qg *chip, u32 *ocv_uv, u32 *ocv_raw, u8 type) temp = *ocv_raw; *ocv_uv = V_RAW_TO_UV(temp); - pr_debug("%s: OCV_RAW=%x OCV=%duV\n", ocv_name, *ocv_raw, *ocv_uv); + pr_err("%s: OCV_RAW=%x OCV=%duV\n", ocv_name, *ocv_raw, *ocv_uv); return rc; } @@ -209,6 +231,8 @@ static void qg_notify_charger(struct qpnp_qg *chip) if (!chip->profile_loaded) return; +#ifndef OPLUS_FEATURE_CHG_BASIC +/*zhouhaikang@BSP.CHG.Basic,2020/10/31,add for chg*/ prop.intval = chip->bp.float_volt_uv; rc = power_supply_set_property(chip->batt_psy, POWER_SUPPLY_PROP_VOLTAGE_MAX, &prop); @@ -217,6 +241,7 @@ static void qg_notify_charger(struct qpnp_qg *chip) rc); return; } +#endif prop.intval = chip->bp.fastchg_curr_ma * 1000; rc = power_supply_set_property(chip->batt_psy, @@ -227,7 +252,7 @@ static void qg_notify_charger(struct qpnp_qg *chip) return; } - pr_debug("Notified charger on float voltage and FCC\n"); + pr_err("Notified charger on float voltage and FCC\n"); rc = power_supply_get_property(chip->batt_psy, POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT, &prop); @@ -328,7 +353,12 @@ static int qg_config_s2_state(struct qpnp_qg *chip, acc_length = chip->dt.sleep_s2_acc_length; break; case S2_DEFAULT: +#ifdef OPLUS_FEATURE_CHG_BASIC +/*zhouhaikang@BSP.CHG.Basic,2020/10/31,add for chg*/ + fifo_length = chip->dt.fast_chg_s2_fifo_length; +#else fifo_length = chip->dt.s2_fifo_length; +#endif acc_interval = chip->dt.s2_acc_intvl_ms; acc_length = chip->dt.s2_acc_length; break; @@ -402,7 +432,7 @@ static int qg_process_fifo(struct qpnp_qg *chip, u32 fifo_length) chip->kdata.fifo_time = (u32)rtc_sec; if (!fifo_length) { - pr_debug("No FIFO data\n"); + pr_err("No FIFO data\n"); return 0; } @@ -498,7 +528,7 @@ static int qg_process_accumulator(struct qpnp_qg *chip) } if (!count || count < 10) { /* Ignore small accumulator data */ - pr_debug("No ACCUMULATOR data!\n"); + pr_err("No ACCUMULATOR data!\n"); return 0; } @@ -667,7 +697,7 @@ static int qg_vbat_low_wa(struct qpnp_qg *chip) for (i = 0; i < chip->kdata.fifo_length; i++) { if (chip->kdata.fifo[i].v > vbat_low_uv) { chip->vbat_low = false; - pr_info("Exit VBAT_LOW vbat_avg=%duV vbat_low=%duV updated fifo_length=%d\n", + pr_err("Exit VBAT_LOW vbat_avg=%duV vbat_low=%duV updated fifo_length=%d\n", chip->kdata.fifo[i].v, vbat_low_uv, chip->dt.s2_fifo_length); break; @@ -954,7 +984,11 @@ static int qg_process_esr_data(struct qpnp_qg *chip) return 0; } - +#ifdef OPLUS_FEATURE_CHG_BASIC +/*zhouhaikang@BSP.CHG.Basic,2020/10/31,add for chg*/ +extern int oplus_chg_get_ffc_status(void);//kilody +extern bool oplus_vooc_get_fastchg_ing(void); +#endif static int qg_esr_estimate(struct qpnp_qg *chip) { int rc, i, ibat = 0; @@ -963,7 +997,11 @@ static int qg_esr_estimate(struct qpnp_qg *chip) if (chip->dt.esr_disable) return 0; - +#ifdef OPLUS_FEATURE_CHG_BASIC +/*zhouhaikang@BSP.CHG.Basic,2020/10/31,add for chg*/ + if(oplus_vooc_get_fastchg_ing()) + return 0; +#endif /* * Charge - enable ESR estimation if IBAT > MIN_IBAT. * Discharge - enable ESR estimation only if enabled via DT. @@ -1315,7 +1353,7 @@ static irqreturn_t qg_vbat_empty_handler(int irq, void *data) chip->battery_missing) return IRQ_HANDLED; - pr_warn("VBATT EMPTY SOC = 0\n"); + pr_err("VBATT EMPTY SOC = 0\n"); chip->catch_up_soc = 0; qg_scale_soc(chip, true); @@ -1421,7 +1459,7 @@ static int qg_awake_cb(struct votable *votable, void *data, int awake, else pm_relax(chip->dev); - pr_debug("client: %s awake: %d\n", client, awake); + pr_err("client: %s awake: %d\n", client, awake); return 0; } @@ -1721,6 +1759,9 @@ static int qg_get_charge_counter(struct qpnp_qg *chip, int *charge_counter) int rc, cc_soc = 0; int64_t temp = 0; + if (chip == NULL) { + return 0; + } if (is_debug_batt_id(chip) || chip->battery_missing) { *charge_counter = -EINVAL; return 0; @@ -1769,7 +1810,7 @@ static int qg_get_power(struct qpnp_qg *chip, int *val, bool average) esr = chip->esr_last * 1000; if (rbatt <= 0 || esr <= 0) { - pr_debug("Invalid rbatt/esr rbatt=%d esr=%d\n", rbatt, esr); + pr_err("Invalid rbatt/esr rbatt=%d esr=%d\n", rbatt, esr); *val = -EINVAL; return 0; } @@ -2014,11 +2055,11 @@ static int qg_psy_set_property(struct power_supply *psy, switch (psp) { case POWER_SUPPLY_PROP_CHARGE_FULL: if (chip->dt.cl_disable) { - pr_warn("Capacity learning disabled!\n"); + pr_err("Capacity learning disabled!\n"); return 0; } if (chip->cl->active) { - pr_warn("Capacity learning active!\n"); + pr_err("Capacity learning active!\n"); return 0; } if (pval->intval <= 0 || pval->intval > chip->cl->nom_cap_uah) { @@ -2115,9 +2156,28 @@ static int qg_psy_get_property(struct power_supply *psy, pval->intval = chip->dt.vbatt_cutoff_mv * 1000; break; case POWER_SUPPLY_PROP_VOLTAGE_MAX: +#ifdef OPLUS_FEATURE_CHG_BASIC +/*zhouhaikang@BSP.CHG.Basic,2020/10/31,add for chg*/ + if(oplus_vooc_get_fastchg_ing()) { + chip->bp.float_volt_uv = 4400000; + } else if (0 == oplus_chg_get_ffc_status()){ + chip->bp.float_volt_uv = 4430000; + } + pr_err("kilody: float_volt_uv=%d\n", chip->bp.float_volt_uv); +#endif pval->intval = chip->bp.float_volt_uv; break; case POWER_SUPPLY_PROP_BATT_FULL_CURRENT: +#ifdef OPLUS_FEATURE_CHG_BASIC +/*zhouhaikang@BSP.CHG.Basic,2020/10/31,add for chg*/ + if(oplus_chg_get_ffc_status() || oplus_vooc_get_fastchg_ing()) { + chip->dt.iterm_ma = 400; + } else { + chip->dt.iterm_ma = 250; + } + chip->dt.iterm_ma = 250; + pr_err("kilody: iterm_ma=%d\n", chip->dt.iterm_ma); +#endif pval->intval = chip->dt.iterm_ma * 1000; break; case POWER_SUPPLY_PROP_BATT_PROFILE_VERSION: @@ -2189,7 +2249,7 @@ static int qg_psy_get_property(struct power_supply *psy, pval->intval = chip->batt_age_level; break; default: - pr_debug("Unsupported property %d\n", psp); + pr_err("Unsupported property %d\n", psp); break; } @@ -2294,7 +2354,7 @@ static int qg_charge_full_update(struct qpnp_qg *chip) rc = power_supply_get_property(chip->batt_psy, POWER_SUPPLY_PROP_RECHARGE_SOC, &prop); if (rc < 0 || prop.intval < 0) { - pr_debug("Failed to get recharge-soc\n"); + pr_err("Failed to get recharge-soc\n"); recharge_soc = DEFAULT_RECHARGE_SOC; } else { recharge_soc = prop.intval; @@ -2497,14 +2557,22 @@ static int qg_battery_status_update(struct qpnp_qg *chip) pr_err("Failed to get battery-present, rc=%d\n", rc); goto done; } - +#ifdef VENDOR_EDIT + /* wangchao@ODM.BSP.charge, 2020/1/19, Add for batt ID check*/ + if (prop.intval) //battery present + { + if (!is_batt_id_valid(chip)) { + prop.intval = 0; + } + } +#endif if (chip->battery_missing && prop.intval) { - pr_warn("Battery inserted!\n"); + pr_err("Battery inserted!\n"); rc = qg_handle_battery_insertion(chip); if (rc < 0) pr_err("Failed in battery-insertion rc=%d\n", rc); } else if (!chip->battery_missing && !prop.intval) { - pr_warn("Battery removed!\n"); + pr_err("Battery removed!\n"); rc = qg_handle_battery_removal(chip); if (rc < 0) pr_err("Failed in battery-removal rc=%d\n", rc); @@ -2544,7 +2612,37 @@ static void qg_sleep_exit_work(struct work_struct *work) vote(chip->awake_votable, SLEEP_EXIT_VOTER, false, 0); } +static int qg_charge_done_update(struct qpnp_qg *chip) +{ + union power_supply_propval prop = {0,}; + int rc, health; + unsigned long rtc_sec = 0; + rc = power_supply_get_property(chip->batt_psy, POWER_SUPPLY_PROP_HEALTH, &prop); + if (rc < 0) { + pr_err("Failed to get battery health, rc=%d\n", rc); + goto out; + } + health = prop.intval; + mutex_lock(&chip->data_lock); + + if (chip->charge_done && chip->catch_up_soc != 100 && chip->msoc >= 90 && health == POWER_SUPPLY_HEALTH_GOOD) { + + get_rtc_time(&rtc_sec); + chip->kdata.fifo_time = (u32)rtc_sec; + chip->kdata.param[QG_GOOD_OCV_UV].data = 4415000; + chip->kdata.param[QG_GOOD_OCV_UV].valid = true; + + vote(chip->awake_votable,GOOD_OCV_VOTER,true,0); + + /* signal the read thread */ + chip->data_ready = true; + wake_up_interruptible(&chip->qg_wait_q); + } + mutex_unlock(&chip->data_lock); +out: + return 0; +} static void qg_status_change_work(struct work_struct *work) { struct qpnp_qg *chip = container_of(work, @@ -2554,7 +2652,7 @@ static void qg_status_change_work(struct work_struct *work) bool input_present = false; if (!is_batt_available(chip)) { - pr_debug("batt-psy not available\n"); + pr_err("batt-psy not available\n"); goto out; } @@ -2615,7 +2713,7 @@ static void qg_status_change_work(struct work_struct *work) rc = qg_charge_full_update(chip); if (rc < 0) pr_err("Failed in charge_full_update, rc=%d\n", rc); - + qg_charge_done_update(chip); ttf_update(chip->ttf, input_present); out: pm_relax(chip->dev); @@ -2695,7 +2793,7 @@ static ssize_t qg_device_read(struct file *file, char __user *buf, size_t count, rc = wait_event_interruptible(chip->qg_wait_q, chip->data_ready); if (rc < 0) { - pr_debug("Failed wait! rc=%d\n", rc); + pr_err("Failed wait! rc=%d\n", rc); return rc; } } @@ -2703,7 +2801,7 @@ static ssize_t qg_device_read(struct file *file, char __user *buf, size_t count, mutex_lock(&chip->data_lock); if (!chip->data_ready) { - pr_debug("No Data, false wakeup\n"); + pr_err("No Data, false wakeup\n"); rc = -EFAULT; goto fail_read; } @@ -2878,7 +2976,7 @@ static int get_batt_id_ohm(struct qpnp_qg *chip, u32 *batt_id_ohm) batt_id_mv = div_s64(batt_id_mv, 1000); if (batt_id_mv == 0) { - pr_debug("batt_id_mv = 0 from ADC\n"); + pr_err("batt_id_mv = 0 from ADC\n"); return 0; } @@ -2895,7 +2993,74 @@ static int get_batt_id_ohm(struct qpnp_qg *chip, u32 *batt_id_ohm) return 0; } +#ifdef VENDOR_EDIT +/* wangchao@ODM.BSP.charge, 2020/1/19, Add for batt ID check*/ +static int get_batt_id_voltage(struct qpnp_qg *chip) +{ + int rc, batt_id_mv; + /* Read battery-id */ + rc = iio_read_channel_processed(chip->batt_id_chan, &batt_id_mv); + if (rc < 0) { + pr_err("Failed to read BATT_ID over ADC, rc=%d\n", rc); + return rc; + } + + batt_id_mv = div_s64(batt_id_mv, 1000); + qg_dbg(chip, QG_DEBUG_PROFILE, "batt_id_mv=%d from ADC\n",batt_id_mv); + + return batt_id_mv; +} + +#define TOTAL_BATTERY_NUMBER 4 +static int batt_id_range[TOTAL_BATTERY_NUMBER][2] = +{ + {70,150},//1K = 108mv + {200,350},//15K = 304mv + {560,1000},//68K = 707mv + {1000,1200}, //150k = 1140mv +}; +static char * batt_vendor[TOTAL_BATTERY_NUMBER + 1] = { + "Liwinon", + "Coslight", + "ATL", + "ATL_T", + "Unknown" +}; + +bool is_batt_id_valid(struct qpnp_qg *chip) +{ + int id, rc, batt_id_voltage; + static bool batt_id_register = false;//register batt_id device info + + batt_id_voltage = get_batt_id_voltage(chip); + if (batt_id_voltage < 0) { + pr_err("Failed to detect batt_id rc=%d\n", rc); + return true; + } + + for(id = 0; id < TOTAL_BATTERY_NUMBER; id++){ + if(batt_id_voltage >= batt_id_range[id][0] + && batt_id_voltage <= batt_id_range[id][1]) + { + break; + } + } + if(!batt_id_register){ + rc = register_device_proc("battery", "V1.0", batt_vendor[id]); + if (rc) { + pr_err("register_battery_devinfo fail\n"); + } + batt_id_register = true; + } + + if(TOTAL_BATTERY_NUMBER == id){ + return false; + }else{ + return true; + } +} +#endif static int qg_load_battery_profile(struct qpnp_qg *chip) { struct device_node *node = chip->dev->of_node; @@ -2931,7 +3096,7 @@ static int qg_load_battery_profile(struct qpnp_qg *chip) profile_node = of_batterydata_get_best_profile(chip->batt_node, chip->batt_id_ohm / 1000, NULL); } - + pr_err("batt_id_ohm=%d\n", chip->batt_id_ohm); if (IS_ERR(profile_node)) { rc = PTR_ERR(profile_node); pr_err("Failed to detect valid QG battery profile %d\n", rc); @@ -3030,7 +3195,7 @@ static int qg_load_battery_profile(struct qpnp_qg *chip) if (chip->ttf->step_chg_cfg_valid) { for (i = 0; i < tuple_len; i++) - pr_debug("Vbatt_low: %d Vbatt_high: %d FCC: %d\n", + pr_err("Vbatt_low: %d Vbatt_high: %d FCC: %d\n", chip->ttf->step_chg_cfg[i].low_threshold, chip->ttf->step_chg_cfg[i].high_threshold, chip->ttf->step_chg_cfg[i].value); @@ -3274,7 +3439,7 @@ done: if (rc < 0) pr_err("Failed to update sdam params rc=%d\n", rc); - pr_info("using %s @ PON ocv_uv=%duV soc=%d\n", + pr_err("using %s @ PON ocv_uv=%duV soc=%d\n", ocv_type, ocv_uv, chip->msoc); /* SOC reporting is now ready */ @@ -3296,7 +3461,12 @@ static int qg_set_wa_flags(struct qpnp_qg *chip) case PM6150_SUBTYPE: chip->wa_flags |= QG_CLK_ADJUST_WA | QG_RECHARGE_SOC_WA; +#ifdef OPLUS_FEATURE_CHG_BASIC +/*zhouhaikang@BSP.CHG.Basic,2020/10/31,add for chg*/ + qg_esr_mod_count = 5; +#else qg_esr_mod_count = 10; +#endif break; default: pr_err("Unsupported PMIC subtype %d\n", @@ -3804,7 +3974,7 @@ static int qg_alg_init(struct qpnp_qg *chip) #define DEFAULT_CL_MAX_INC_DECIPERC 10 #define DEFAULT_CL_MAX_DEC_DECIPERC 20 #define DEFAULT_CL_MIN_LIM_DECIPERC 500 -#define DEFAULT_CL_MAX_LIM_DECIPERC 100 +#define DEFAULT_CL_MAX_LIM_DECIPERC 10 #define DEFAULT_CL_DELTA_BATT_SOC 10 #define DEFAULT_CL_WT_START_SOC 15 #define DEFAULT_SHUTDOWN_TEMP_DIFF 60 /* 6 degC */ @@ -4124,9 +4294,12 @@ static int qg_parse_dt(struct qpnp_qg *chip) } if (of_property_read_bool(node, "qcom,tcss-enable")) { - +#ifdef OPLUS_FEATURE_CHG_BASIC +/*zhouhaikang@BSP.CHG.Basic,2020/10/31,add for chg*/ + chip->dt.tcss_enable = false; +#else chip->dt.tcss_enable = true; - +#endif rc = of_property_read_u32(node, "qcom,tcss-entry-soc", &temp); if (rc < 0) @@ -4460,12 +4633,307 @@ static const struct dev_pm_ops qpnp_qg_pm_ops = { .suspend = qpnp_qg_suspend, .resume = qpnp_qg_resume, }; +#ifdef VENDOR_EDIT +/* Yichun.Chen PSW.BSP.CHG 2018-04-24 OPLUS_CHARGE */ +#define DEFAULT_BATT_TEMP -400 +#define DEFAULT_BATT_VOLT 3800 +#define DEFAULT_BATT_SOC 50 +#define WAIT_FOR_HEALTHD_SOC -1 +#define DEFAULT_BATT_CURRENT 500 +#define MAX_WAIT_FOR_HEALTHD_COUNT 12 +#define BATT_CAPACITY 4100 +#define VBAT_HIGH_THRESHOLD 4500 +#define TBAT_LOW_THRESHOLD -190 +#define TBAT_HIGH_THRESHOLD 530 + +static int oplus_qg_get_battery_mvolts(void) +{ + int rc = 0, uv_bat = 0; + + if (!the_chip) { + return DEFAULT_BATT_VOLT; + } + + rc = qg_get_battery_voltage(the_chip, &uv_bat); + if (rc < 0) { + pr_debug("failed to get battery voltage, return 3800mV\n"); + return DEFAULT_BATT_VOLT; + } + + /* if abnormal, read again */ + if (uv_bat > VBAT_HIGH_THRESHOLD * 1000) { + msleep(80); + qg_get_battery_voltage(the_chip, &uv_bat); + if (rc < 0) { + pr_debug("failed to get battery voltage, return 3800mV\n"); + return DEFAULT_BATT_VOLT; + } + } + return uv_bat/1000; +} + +static int oplus_qg_get_battery_temperature(void) +{ + int rc = 0, temp_bat = 0; + + if (!the_chip) { + return DEFAULT_BATT_TEMP; + } + + rc = qg_get_battery_temp(the_chip, &temp_bat); + if (rc < 0) { + pr_debug("failed to get battery temp, return 25C\n"); + return DEFAULT_BATT_TEMP; + } + + /* if abnormal, read again */ + if (temp_bat < TBAT_LOW_THRESHOLD || temp_bat > TBAT_HIGH_THRESHOLD) { + msleep(80); + rc = qg_get_battery_temp(the_chip, &temp_bat); + if (rc < 0) { + pr_debug("failed to get battery temp, return 25C\n"); + return DEFAULT_BATT_TEMP; + } + } + return temp_bat; +} + +static int oplus_qg_get_batt_remaining_capacity(void) +{ + int soc_bat = -1; + qg_get_charge_counter(the_chip, &soc_bat); + soc_bat = soc_bat/1000; + return soc_bat; +} + + +static int oplus_qg_get_battery_soc(void) +{ + int soc_bat = 0; + + if (!the_chip) { + return DEFAULT_BATT_SOC; + } + + qg_get_battery_capacity(the_chip, &soc_bat); + + if (get_boot_mode() == MSM_BOOT_MODE__RECOVERY) { + return soc_bat; + } + + return soc_bat; +} + +static int oplus_qg_get_average_current(void) +{ + int ua_bat = 0; + int rc=0; + + if (!the_chip) { + return DEFAULT_BATT_CURRENT; + } + + rc = qg_get_battery_current(the_chip, &ua_bat); + return ua_bat/1000; +} + +static int oplus_qg_get_battery_fcc(void) +{ + int rc = 0; + int64_t temp = 0; + + rc = qg_get_learned_capacity(the_chip, &temp); + if (rc < 0 || !temp) { + rc = qg_get_nominal_capacity((int *)&temp, 250, true); + } + temp = temp/1000; + return temp; +} + +static int oplus_qg_get_battery_cc(void) +{ + int cc_soc = 0; + int rc = 0; + + rc = qg_get_cc_soc(the_chip, &cc_soc); + pr_err("kilody: rc=%d,cc_soc=%d\n", rc,cc_soc); + return cc_soc; +} + +static int oplus_qg_get_battery_soh(void) +{ + return the_chip->soh; +} + +static bool oplus_qg_get_battery_authenticate(void) +{ + return true; +} +static int oplus_qg_get_prev_battery_mvolts(void) +{ + int uv_bat = 3800; + + uv_bat = oplus_qg_get_battery_mvolts(); + + return uv_bat; +} + +static int oplus_qg_get_prev_battery_temperature(void) +{ + int temp_bat = 250; + + temp_bat = oplus_qg_get_battery_temperature(); + + return temp_bat; +} + + +static int oplus_qg_get_prev_battery_soc(void) +{ + int soc_bat = 0; + + soc_bat = oplus_qg_get_battery_soc(); + + return soc_bat; +} + +static int oplus_qg_get_prev_average_current(void) +{ + int current_bat = 1000; + + current_bat = oplus_qg_get_average_current(); + + return current_bat; +} + + +static int oplus_qg_get_prev_batt_remaining_capacity(void) +{ + int soc_bat = -1; + + qg_get_charge_counter(the_chip, &soc_bat); + soc_bat = soc_bat/1000; + return soc_bat; +} + +static int oplus_qg_get_battery_mvolts_2cell_max(void) +{ + return oplus_qg_get_battery_mvolts(); +} + +static int oplus_qg_get_battery_mvolts_2cell_min(void) +{ + return oplus_qg_get_battery_mvolts(); +} + +static int oplus_qg_prev_battery_mvolts_2cell_max(void) +{ + return 3800; +} + +static int oplus_qg_prev_battery_mvolts_2cell_min(void) +{ + return 3800; +} + +static void oplus_qg_set_battery_full(bool enable) +{ +} +static int oplus_qg_modify_dod0(void) +{ + return 0; +} + +static int oplus_qg_update_soc_smooth_parameter(void) +{ + return 0; +} +void oplus_set_float_uv_ma(int iterm_ma,int float_volt_uv) +{ + the_chip->dt.iterm_ma = iterm_ma; + the_chip->bp.float_volt_uv = float_volt_uv; + pr_err("kilody: oplus_set_float_uv_ma float_volt_uv=%d\n", float_volt_uv); +} +/*void oplus_set_tcss_enable(bool val) +{ + //the_chip->dt.tcss_enable = val; + pr_err("kilody:set tcss_enable = %d\n", val); +}*/ + +static struct oplus_gauge_operations oplus_gauge_ops = { + .get_battery_mvolts = oplus_qg_get_battery_mvolts, + .get_battery_temperature = oplus_qg_get_battery_temperature, + .get_batt_remaining_capacity = oplus_qg_get_batt_remaining_capacity, + .get_battery_soc = oplus_qg_get_battery_soc, + .get_average_current = oplus_qg_get_average_current, + .set_battery_full = oplus_qg_set_battery_full, + .get_battery_fcc = oplus_qg_get_battery_fcc, + .get_prev_batt_fcc = oplus_qg_get_battery_fcc, + .get_battery_cc = oplus_qg_get_battery_cc, + .get_battery_soh = oplus_qg_get_battery_soh, + .get_battery_authenticate = oplus_qg_get_battery_authenticate, + .get_prev_battery_mvolts = oplus_qg_get_prev_battery_mvolts, + .get_prev_battery_temperature = oplus_qg_get_prev_battery_temperature, + .get_prev_battery_soc = oplus_qg_get_prev_battery_soc, + .get_prev_average_current = oplus_qg_get_prev_average_current, + .get_prev_batt_remaining_capacity = oplus_qg_get_prev_batt_remaining_capacity, + .get_battery_mvolts_2cell_max = oplus_qg_get_battery_mvolts_2cell_max, + .get_battery_mvolts_2cell_min = oplus_qg_get_battery_mvolts_2cell_min, + .get_prev_battery_mvolts_2cell_max = oplus_qg_prev_battery_mvolts_2cell_max, + .get_prev_battery_mvolts_2cell_min = oplus_qg_prev_battery_mvolts_2cell_min, + .update_battery_dod0 = oplus_qg_modify_dod0, + .update_soc_smooth_parameter = oplus_qg_update_soc_smooth_parameter, + .set_float_uv_ma = oplus_set_float_uv_ma, + //.set_tcss_enable = oplus_set_tcss_enable, +}; + +static ssize_t qg_vbat_read(struct file *filp, char __user *buff, size_t count, loff_t *off) +{ + char page[256] = {0}; + int len = 0; + int uv_bat = 0; + + qg_get_battery_voltage(the_chip, &uv_bat); + len = sprintf(page, "%d", uv_bat); + if (len > *off) { + len -= *off; + } else { + len = 0; + } + if (copy_to_user(buff, page, (len < count ? len : count))) { + return -EFAULT; + } + *off += len < count ? len : count; + return (len < count ? len : count); +} + +static const struct file_operations qg_vbat_proc_fops = { + .read = qg_vbat_read, + .llseek = noop_llseek, +}; + +static int init_proc_qg_vbat(void) +{ + struct proc_dir_entry *p = NULL; + + p = proc_create("qg_vbat", 0444, NULL, &qg_vbat_proc_fops); + if (!p) { + chg_err("proc_create qg_vbat fail!\n"); + } + return 0; +} + +#endif static int qpnp_qg_probe(struct platform_device *pdev) { - int rc = 0, soc = 0, nom_cap_uah; + int rc = 0, soc = 0, nom_cap_uah,ret; struct qpnp_qg *chip; +#ifdef VENDOR_EDIT +/* Yichun.Chen PSW.BSP.CHG 2018-04-24 OPLUS_CHARGE */ + struct oplus_gauge_chip *the_oplus_gauge_chip = NULL; +#endif chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); if (!chip) return -ENOMEM; @@ -4645,9 +5113,43 @@ static int qpnp_qg_probe(struct platform_device *pdev) pr_err("Failed in qg_post_init rc=%d\n", rc); goto fail_votable; } - + pr_err("%s\n",__func__); + qg_get_battery_current(chip, &ret); + qg_get_battery_voltage(chip, &ret); + qg_get_battery_temp(chip, &ret); +#ifdef VENDOR_EDIT +/* Yichun.Chen PSW.BSP.CHG 2018-04-24 OPLUS_CHARGE */ + the_chip = chip; + if(use_qpnp_qg) { + the_oplus_gauge_chip = devm_kzalloc(chip->dev, + sizeof(struct oplus_gauge_chip), GFP_KERNEL); + if (!the_oplus_gauge_chip) { + pr_err("kzalloc() failed.\n"); + the_chip = NULL; + return -ENOMEM; + } else { + the_oplus_gauge_chip->dev = chip->dev; + the_oplus_gauge_chip->gauge_ops = &oplus_gauge_ops; + oplus_gauge_init(the_oplus_gauge_chip); + } + } + init_proc_qg_vbat(); +#endif + qg_get_nominal_capacity(&nom_cap_uah,0, true); + pr_err("nom_uah@0C= %d\n", nom_cap_uah); + qg_get_nominal_capacity(&nom_cap_uah,100, true); + pr_err("nom_uah@10C= %d\n", nom_cap_uah); + qg_get_nominal_capacity(&nom_cap_uah,250, true); + pr_err("nom_uah@25C= %d\n", nom_cap_uah); + qg_get_nominal_capacity(&nom_cap_uah,400, true); + pr_err("nom_uah@40C= %d\n", nom_cap_uah); + qg_get_nominal_capacity(&nom_cap_uah,500, true); + pr_err("nom_uah@50C= %d\n", nom_cap_uah); + pr_err("1111\n"); + qg_get_battery_current(chip, &ret); + qg_get_battery_voltage(chip, &ret); qg_get_battery_capacity(chip, &soc); - pr_info("QG initialized! battery_profile=%s SOC=%d QG_subtype=%d\n", + pr_err("QG initialized! battery_profile=%s SOC=%d QG_subtype=%d\n", qg_get_battery_type(chip), soc, chip->qg_subtype); return rc; diff --git a/drivers/power/supply/qcom/qpnp-smb5.c b/drivers/power/supply/qcom/qpnp-smb5.c index b81f64096a70..fc90fc01d023 100644 --- a/drivers/power/supply/qcom/qpnp-smb5.c +++ b/drivers/power/supply/qcom/qpnp-smb5.c @@ -1231,7 +1231,9 @@ static int smb5_usb_main_get_prop(struct power_supply *psy, val->intval = chg->flash_active; break; case POWER_SUPPLY_PROP_FLASH_TRIGGER: - rc = schgm_flash_get_vreg_ok(chg, &val->intval); + val->intval = 0; + if(chg->chg_param.smb_version==PMI632_SUBTYPE) + rc = schgm_flash_get_vreg_ok(chg, &val->intval); break; case POWER_SUPPLY_PROP_TOGGLE_STAT: val->intval = 0; diff --git a/drivers/power/supply/qcom/schgm-flash.c b/drivers/power/supply/qcom/schgm-flash.c index 41986c56a923..f4a040f71b4d 100644 --- a/drivers/power/supply/qcom/schgm-flash.c +++ b/drivers/power/supply/qcom/schgm-flash.c @@ -22,7 +22,10 @@ #include #include #include -#include "smb5-lib.h" +//#ifdef VENDOR_EDIT +/*lizhijie@BSP.CHG.Basic, 2020/02/25 lzj add for charger*/ +//#include "smb5-lib.h" +//#endif #include "schgm-flash.h" #define IS_BETWEEN(left, right, value) \ diff --git a/drivers/power/supply/qcom/schgm-flash.h b/drivers/power/supply/qcom/schgm-flash.h index aaa593202aac..4b2693b10727 100644 --- a/drivers/power/supply/qcom/schgm-flash.h +++ b/drivers/power/supply/qcom/schgm-flash.h @@ -15,6 +15,17 @@ #include + +#ifdef VENDOR_EDIT +/* lizhijie@BSP.CHG.Basic, 2020/02/25, Add for charging */ +#ifdef CONFIG_OPLUS_SM7125R_CHARGER +#include "../../oppo/charger_ic/oplus_battery_msm7125_R.h" +#elif defined CONFIG_OPLUS_SM7150R_CHARGER +#include "../../oppo/charger_ic/oplus_battery_sm7150_R.h" +#else +#include "../../oppo/charger_ic/oplus_battery_msm8150Q.h" +#endif +#endif #define SCHGM_FLASH_BASE 0xA600 #define SCHGM_FLASH_STATUS_2_REG (SCHGM_FLASH_BASE + 0x07) diff --git a/drivers/power/supply/qcom/smb5-reg.h b/drivers/power/supply/qcom/smb5-reg.h index 444841d67c82..c17674607714 100644 --- a/drivers/power/supply/qcom/smb5-reg.h +++ b/drivers/power/supply/qcom/smb5-reg.h @@ -64,6 +64,19 @@ enum { #define BAT_TEMP_STATUS_TOO_HOT_AFP_BIT BIT(1) #define BAT_TEMP_STATUS_TOO_COLD_AFP_BIT BIT(0) +#ifdef VENDOR_EDIT +/* lizhijie@BSP.CHG.Basic, 2020/02/25, Add for charger */ +#define BATTERY_CHARGER_STATUS_8_REG (CHGR_BASE + 0x0E) +//#define PRE_FAST_BIT BIT(7) +#define PRE_FULLON_BIT BIT(6) +//#define PRE_RCHG_BIT BIT(5) +#define PRE_INHIBIT_BIT BIT(3) +#define PRE_OVRV_BIT BIT(4) +#define PRE_TERM_BIT BIT(2) +//#define BAT_ID_BMISS_CMP_BIT BIT(1) +//#define THERM_CMP_BIT BIT(0) +#endif + #define CHARGING_ENABLE_CMD_REG (CHGR_BASE + 0x42) #define CHARGING_ENABLE_CMD_BIT BIT(0) @@ -77,6 +90,11 @@ enum { #define CHARGER_INHIBIT_BIT BIT(0) #define CHGR_FAST_CHARGE_CURRENT_CFG_REG (CHGR_BASE + 0x61) +#ifdef VENDOR_EDIT +/* lizhijie@BSP.CHG.Basic, 2020/02/25, Add for charger */ +#define TCCC_CHARGE_CURRENT_TERMINATION_CFG_REG (CHGR_BASE + 0x63) +#define TCCC_CHARGE_CURRENT_TERMINATION_SETTING_MASK GENMASK(3, 0) +#endif #define CHGR_ADC_ITERM_UP_THD_MSB_REG (CHGR_BASE + 0x67) #define CHGR_ADC_ITERM_UP_THD_LSB_REG (CHGR_BASE + 0x68) @@ -153,6 +171,11 @@ enum { #define DCDC_OTG_CURRENT_LIMIT_CFG_REG (DCDC_BASE + 0x52) +#ifdef VENDOR_EDIT +/* Gang.Yan@PSW.BSP.CHG.Basic, 2020/03/25, Add for set otg current */ +#define DCDC_OTG_CURRENT_LIMIT_1000MA_BIT BIT(2) +#endif /* VENDOR_EDIT */ + #define DCDC_OTG_CFG_REG (DCDC_BASE + 0x53) #define OTG_EN_SRC_CFG_BIT BIT(1) @@ -281,6 +304,20 @@ enum { HVDCP_PULSE_COUNT_MAX_QC2_INVALID = 0xC0 }; +#ifdef OPLUS_FEATURE_CHG_BASIC +#define USBIN_ADAPTER_ALLOW_CFG_REG (USBIN_BASE + 0x60) +enum { + USBIN_ADAPTER_ALLOW_5V = 0, + USBIN_ADAPTER_ALLOW_9V = 2, + USBIN_ADAPTER_ALLOW_5V_OR_9V = 3, + USBIN_ADAPTER_ALLOW_12V = 4, + USBIN_ADAPTER_ALLOW_5V_OR_12V = 5, + USBIN_ADAPTER_ALLOW_9V_TO_12V = 6, + USBIN_ADAPTER_ALLOW_5V_OR_9V_TO_12V = 7, + USBIN_ADAPTER_ALLOW_5V_TO_9V = 8, + USBIN_ADAPTER_ALLOW_5V_TO_12V = 12, +}; +#endif /*OPLUS_FEATURE_CHG_BASIC*/ #define USBIN_OPTIONS_1_CFG_REG (USBIN_BASE + 0x62) #define HVDCP_AUTH_ALG_EN_CFG_BIT BIT(6) #define HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT BIT(5) @@ -308,9 +345,25 @@ enum { #define USBIN_AICL_OPTIONS_CFG_REG (USBIN_BASE + 0x80) #define SUSPEND_ON_COLLAPSE_USBIN_BIT BIT(7) +#ifdef VENDOR_EDIT +/* lizhijie@BSP.CHG.Basic, 2020/02/25, lzj Add for charger */ +#define USBIN_AICL_HDC_EN_BIT BIT(6) +#define USBIN_AICL_START_AT_MAX_BIT BIT(5) +#endif #define USBIN_AICL_PERIODIC_RERUN_EN_BIT BIT(4) #define USBIN_AICL_ADC_EN_BIT BIT(3) #define USBIN_AICL_EN_BIT BIT(2) +#ifdef VENDOR_EDIT +/* lizhijie@BSP.CHG.Basic, 2020/02/25, Add for charger */ +#define USBIN_HV_COLLAPSE_RESPONSE_BIT BIT(1) +#define USBIN_LV_COLLAPSE_RESPONSE_BIT BIT(0) +#endif + +#ifdef VENDOR_EDIT +/* lizhijie@BSP.CHG.Basic, 2020/02/25, Add for charger */ +#define TYPE_C_CFG_REG (USBIN_BASE + 0x58) +#define APSD_START_ON_CC_BIT BIT(7) +#endif #define USB_ENG_SSUPPLY_USB2_REG (USBIN_BASE + 0xC0) #define ENG_SSUPPLY_12V_OV_OPT_BIT BIT(1) @@ -400,6 +453,12 @@ enum { #define TYPEC_CCOUT_VALUE_BIT BIT(1) #define TYPEC_CCOUT_SRC_BIT BIT(0) +#ifdef VENDOR_EDIT +/* lizhijie@BSP.CHG.Basic, 2020/02/25, add for close usb debug mode */ +#define DEBUG_ACCESS_SNK_CFG_REG (TYPEC_BASE + 0x4a) +#endif + + #define DEBUG_ACCESS_SRC_CFG_REG (TYPEC_BASE + 0x4C) #define EN_UNORIENTED_DEBUG_ACCESS_SRC_BIT BIT(0) @@ -503,6 +562,10 @@ enum { #define AICL_CMD_REG (MISC_BASE + 0x44) #define RESTART_AICL_BIT BIT(1) #define RERUN_AICL_BIT BIT(0) +#ifdef VENDOR_EDIT +/* lizhijie@BSP.CHG.Basic, 2020/02/25, Add for charger */ +#define RESTART_AICL_BIT BIT(1) +#endif #define MISC_SMB_EN_CMD_REG (MISC_BASE + 0x48) #define SMB_EN_OVERRIDE_VALUE_BIT BIT(4) diff --git a/drivers/power/supply/qcom/step-chg-jeita.c b/drivers/power/supply/qcom/step-chg-jeita.c index 72191eca56bb..ef4d5bb3ac99 100644 --- a/drivers/power/supply/qcom/step-chg-jeita.c +++ b/drivers/power/supply/qcom/step-chg-jeita.c @@ -63,6 +63,7 @@ struct step_chg_info { int jeita_fv_index; int step_index; int get_config_retry_count; + int step_chg_count; struct step_chg_cfg *step_chg_config; struct jeita_fcc_cfg *jeita_fcc_config; @@ -765,11 +766,18 @@ static void status_change_work(struct work_struct *work) int rc = 0; union power_supply_propval prop = {0, }; + pr_err("step_chg_count = %d\n",chip->step_chg_count); if (!is_batt_available(chip) || !is_bms_available(chip)) goto exit_work; - +#ifdef OPLUS_FEATURE_CHG_BASIC +/*add by huangtongfeng for qcom-step-chg wakelock issue*/ + rc = handle_battery_insertion(chip); + if (rc < 0) { + goto exit_work; + } +#else handle_battery_insertion(chip); - +#endif /* skip elapsed_us debounce for handling battery temperature */ rc = handle_jeita(chip); if (rc < 0) @@ -793,6 +801,8 @@ static void status_change_work(struct work_struct *work) exit_work: __pm_relax(chip->step_chg_ws); + chip->step_chg_count--; + pr_err("step_chg_count = %d\n",chip->step_chg_count); } static int step_chg_notifier_call(struct notifier_block *nb, @@ -807,6 +817,8 @@ static int step_chg_notifier_call(struct notifier_block *nb, if ((strcmp(psy->desc->name, "battery") == 0) || (strcmp(psy->desc->name, "usb") == 0)) { __pm_stay_awake(chip->step_chg_ws); + chip->step_chg_count++; + pr_err("step_chg_count = %d\n",chip->step_chg_count); schedule_delayed_work(&chip->status_change_work, 0); } @@ -860,6 +872,7 @@ int qcom_step_chg_init(struct device *dev, chip->step_index = -EINVAL; chip->jeita_fcc_index = -EINVAL; chip->jeita_fv_index = -EINVAL; + chip->step_chg_count =0; chip->step_chg_config = devm_kzalloc(dev, sizeof(struct step_chg_cfg), GFP_KERNEL); diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index f539b5bc34e9..a69d6dd1cc20 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -1135,5 +1135,10 @@ config VIRTIO_REGULATOR ---help--- This is the virtual regulator driver for virtio. +config REGULATOR_KTD2151 + bool "KTD2151 regulator driver" + help + lcd support power for 19696. + endif diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 54fe7eda680a..17b2ad78658b 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -141,5 +141,6 @@ obj-$(CONFIG_REGULATOR_SPM) += spm-regulator.o obj-$(CONFIG_REGULATOR_RPMH) += rpmh-regulator.o obj-$(CONFIG_REGULATOR_STUB) += stub-regulator.o obj-$(CONFIG_VIRTIO_REGULATOR) += virtio_regulator.o +obj-$(CONFIG_REGULATOR_KTD2151) += ktd2151.o ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG diff --git a/drivers/regulator/qcom_pm8008-regulator.c b/drivers/regulator/qcom_pm8008-regulator.c index 81aaa56e494e..4b15cdc4c17d 100644 --- a/drivers/regulator/qcom_pm8008-regulator.c +++ b/drivers/regulator/qcom_pm8008-regulator.c @@ -25,6 +25,13 @@ #include #include #include +#ifdef VENDOR_EDIT +/*zhixian.Mai@Cam.drv , 20191001 add for pm8008 reset*/ +#include +#include +#include +#include +#endif #define pm8008_err(reg, message, ...) \ pr_err("%s: " message, (reg)->rdesc.name, ##__VA_ARGS__) @@ -53,6 +60,8 @@ #define LDO_VSET_LB_REG(base) (base + 0x40) +#define LDO_VSET_VALID_LB_REG(base) (base + 0x42) + #define LDO_MODE_CTL1_REG(base) (base + 0x45) #define MODE_PRIMARY_MASK GENMASK(2, 0) #define LDO_MODE_NPM 7 @@ -108,6 +117,54 @@ static struct regulator_data reg_data[] = { {"pm8008_l7", "vdd_l7", 10000, 300000}, }; +#ifdef VENDOR_EDIT +/*zhixian.Mai@Cam.drv , 20191001 add for pm8008 reset*/ +struct pm8008_reset_info { + struct platform_device *pdev; + int reset_gpio; +}; + +static struct pm8008_reset_info g_pm8008_reset_info[2]; +struct regmap *g_reset_regmap = NULL; +struct regulator_dev *g_fingherprint_rdev = NULL; +struct mutex reset_lock; +static int pm8008_do_probe(struct platform_device *pdev); +void pm8008_do_reset(void); +void max98927_LR_reset(void); +static void (*func_max98927_LR_reset)(void); + +void reset_pm8008_max98927(void) +{ + static int rst_num = 0; + + pr_err("%s: enter\n", __func__); + + if(0 == rst_num) { + mutex_init(&reset_lock); + } + + if(!func_max98927_LR_reset) { + func_max98927_LR_reset = symbol_request(max98927_LR_reset); + } + + mutex_lock(&reset_lock); + //reset two times + pm8008_do_reset(); + if(func_max98927_LR_reset) { + func_max98927_LR_reset(); + } + pm8008_do_reset(); + if(func_max98927_LR_reset) { + func_max98927_LR_reset(); + } + rst_num++; + mutex_unlock(&reset_lock); + + pr_err("%s: exit, reset %d times\n", __func__, rst_num); +} +EXPORT_SYMBOL(reset_pm8008_max98927); +#endif + /* common functions */ static int pm8008_read(struct regmap *regmap, u16 reg, u8 *val, int count) { @@ -152,16 +209,46 @@ static int pm8008_regulator_get_voltage(struct regulator_dev *rdev) struct pm8008_regulator *pm8008_reg = rdev_get_drvdata(rdev); u8 vset_raw[2]; int rc; - - rc = pm8008_read(pm8008_reg->regmap, - LDO_VSET_LB_REG(pm8008_reg->base), - vset_raw, 2); - if (rc < 0) { - pm8008_err(pm8008_reg, - "failed to read regulator voltage rc=%d\n", rc); - return rc; + int retry = 0; + /*zhixian.Mai @Cam.Drv, 2019/9/29, Add for PM8008 i2c error */ + if( (19781 == get_project()) || (19696 == get_project()) ) { + for (; retry < 3 && rc == -71; retry++) { + reset_pm8008_max98927(); + rc = pm8008_read(pm8008_reg->regmap, + LDO_VSET_VALID_LB_REG(pm8008_reg->base), + vset_raw, 2); + pr_err("failed at pm8008_regulator_get_voltage repty %d \n", retry); + msleep(20); + } + if (retry == 3 && rc == -71) { + panic("%s: i2c err -71, pm8008 can't return to normal!\n", __func__); + } + if (rc != 0) { + return rc; + } + } else if (19721 == get_project()) { + rc = pm8008_read(pm8008_reg->regmap, + LDO_VSET_VALID_LB_REG(pm8008_reg->base), + vset_raw, 2); + if (rc < 0) { + for (; retry < 3 && rc < 0; retry++) { + rc = pm8008_read(pm8008_reg->regmap, + LDO_VSET_VALID_LB_REG(pm8008_reg->base), + vset_raw, 2); + pr_err("failed at pm8008_regulator_get_voltage repty %d \n", retry); + msleep(20); + } + } + } else { + rc = pm8008_read(pm8008_reg->regmap, + LDO_VSET_VALID_LB_REG(pm8008_reg->base), + vset_raw, 2); + if (rc < 0) { + pm8008_err(pm8008_reg, + "failed to read regulator voltage rc=%d\n", rc); + return rc; + } } - pm8008_debug(pm8008_reg, "VSET read [%x][%x]\n", vset_raw[1], vset_raw[0]); return (vset_raw[1] << 8 | vset_raw[0]) * 1000; @@ -173,12 +260,36 @@ static int pm8008_regulator_is_enabled(struct regulator_dev *rdev) int rc; u8 reg; +#ifndef VENDOR_EDIT +/* Bin.Liu@Cam.Drv, 20201221, Add for pm8008 I2C error */ rc = pm8008_read(pm8008_reg->regmap, LDO_ENABLE_REG(pm8008_reg->base), ®, 1); if (rc < 0) { pm8008_err(pm8008_reg, "failed to read enable reg rc=%d\n", rc); return rc; } +#else + int retry = 0; + if (19721 == get_project()) { + rc = pm8008_read(pm8008_reg->regmap, + LDO_ENABLE_REG(pm8008_reg->base), ®, 1); + if (rc < 0) { + for (; retry < 3 && rc < 0; retry++) { + rc = pm8008_read(pm8008_reg->regmap, + LDO_ENABLE_REG(pm8008_reg->base), ®, 1); + pr_err("failed at pm8008_regulator_is_enabled repty %d \n", retry); + msleep(20); + } + } + } else { + rc = pm8008_read(pm8008_reg->regmap, + LDO_ENABLE_REG(pm8008_reg->base), ®, 1); + if (rc < 0) { + pm8008_err(pm8008_reg, "failed to read enable reg rc=%d\n", rc); + return rc; + } + } +#endif return !!(reg & ENABLE_BIT); } @@ -236,6 +347,15 @@ static int pm8008_regulator_enable(struct regulator_dev *rdev) * Wait for the VREG_READY status bit to be set using a timeout delay * calculated from the current commanded voltage. */ + if( (19781 == get_project()) || (19696 == get_project()) ) { + /*zhixian.Mai @Cam.Drv, 2019/10/01, Add for PM8008 i2c error */ + pm8008_debug(pm8008_reg," pm8008-ldo current_uv = %d",current_uv); + /* Get fingherprint regulator for pm8008 reset*/ + if( current_uv > 3200000 && g_fingherprint_rdev == NULL ) { + g_fingherprint_rdev = rdev ; + pm8008_err(pm8008_reg,"pm8008 get g_fingherprint_rdev current_uv = %d",current_uv); + } + } delay_us = STARTUP_DELAY_USEC + DIV_ROUND_UP(current_uv, pm8008_reg->step_rate); delay_ms = DIV_ROUND_UP(delay_us, 1000); @@ -634,6 +754,54 @@ static int pm8008_register_ldo(struct pm8008_regulator *pm8008_reg, return 0; } +#ifdef VENDOR_EDIT +/*zhixian.Mai @Cam.Drv, 2019/9/29, Add for PM8008 i2c error */ +void pm8008_do_reset() +{ + unsigned int val = 0; + int rc = 0; + + gpio_set_value(g_pm8008_reset_info[1].reset_gpio, 0); + gpio_set_value(g_pm8008_reset_info[0].reset_gpio, 0); + + pr_err("pm8008 reset gpio val %d %d ", + gpio_get_value(g_pm8008_reset_info[1].reset_gpio),\ + gpio_get_value(g_pm8008_reset_info[0].reset_gpio)); + + msleep(10); + gpio_set_value(g_pm8008_reset_info[1].reset_gpio, 1); + msleep(10); + /* get defualt i2c address to modify second pm8008 address*/ + //reset_regmap = dev_get_regmap(g_pm8008_reset_info[0].pdev->dev.parent, NULL); + pr_err("pm8008 modify second pm8008 address "); + + rc = regmap_read(g_reset_regmap,0x0644,&val); + if (rc < 0) { + pr_err("pm8008 modify second pm8008 address fail"); + } + pr_err("pm8008-reset pm8008-chip-2 read 0x0644 0x%x",val); + rc = regmap_write(g_reset_regmap,0x0644,0x01); + if (rc < 0) { + pr_err("pm8008 modify second pm8008 address fail rc = %d",rc); + } + msleep(1); + rc = regmap_read(g_reset_regmap,0x0644,&val); + if (rc < 0) { + pr_err("pm8008 read second pm8008 address fail rc = %d",rc); + } + pr_err("pm8008-reset pm8008-chip-2 read 0x0644 0x%x",val); + msleep(10); + gpio_set_value(g_pm8008_reset_info[0].reset_gpio, 1); + pm8008_do_probe(g_pm8008_reset_info[1].pdev); + pm8008_do_probe(g_pm8008_reset_info[0].pdev); + + if( g_fingherprint_rdev != NULL) { + pm8008_regulator_enable(g_fingherprint_rdev); + } + +} +#endif + /* PMIC probe and helper function */ static int pm8008_parse_regulator(struct regmap *regmap, struct device *dev) { @@ -667,10 +835,48 @@ static int pm8008_parse_regulator(struct regmap *regmap, struct device *dev) return 0; } +#ifdef VENDOR_EDIT +/*zhixian.Mai @Cam.Drv, 2019/10/01, Add for PM8008 i2c error */ +static int pm8008_do_probe(struct platform_device *pdev){ + int rc = 0; + struct regmap *regmap; + const char * regulator_name; + struct device_node *regulator_node = pdev->dev.of_node; + + pr_debug("pm8008_regulator_probe X\n"); + + rc = of_property_read_string(regulator_node, "pm8008-name",®ulator_name); + + regmap = dev_get_regmap(pdev->dev.parent, NULL); + if (!regmap) { + pr_err("parent regmap is missing\n"); + return -EINVAL; + } + + pr_err("pm8008 regulaot name is %s\n",regulator_name); + + rc = pm8008_parse_regulator(regmap, &pdev->dev); + if (rc < 0) { + pr_err("failed to parse device tree rc=%d\n", rc); + return rc; + } + + return 0; + +} +#endif + static int pm8008_regulator_probe(struct platform_device *pdev) { int rc = 0; struct regmap *regmap; + const char * regulator_name; + struct device_node *regulator_node = pdev->dev.of_node; + if( (19781 == get_project()) || (19696 == get_project()) ) { + /*zhixian.Mai @Cam.Drv, 2019/10/01, Add for PM8008 i2c error */ + rc = of_property_read_string(regulator_node, "pm8008-name",®ulator_name); + pr_debug("pm8008 regulaot name is %s\n",regulator_name); + } regmap = dev_get_regmap(pdev->dev.parent, NULL); if (!regmap) { @@ -683,6 +889,25 @@ static int pm8008_regulator_probe(struct platform_device *pdev) pr_err("failed to parse device tree rc=%d\n", rc); return rc; } + if( (19781 == get_project()) || (19696 == get_project()) ) { + /*zhixian.Mai @Cam.Drv, 2019/10/01, Add for PM8008 i2c error */ + if (0 == strcmp(regulator_name,"pm8008_regulator-1")) { + /*g_pm8008_reset_info[0] use defualt pm8008 i2c 8bit address 0x8/9 */ + g_pm8008_reset_info[0].pdev = pdev ; + g_pm8008_reset_info[0].reset_gpio = + of_get_named_gpio(regulator_node,"qcom,pm8008-reset-gpio", 0); + pr_debug("pm8008 parse device tree pm8008-chip-1 for reset "); + } + + if (0 == strcmp(regulator_name,"pm8008_regulator-2")) { + g_pm8008_reset_info[1].pdev = pdev; + g_pm8008_reset_info[1].reset_gpio = + of_get_named_gpio(regulator_node,"qcom,pm8008-reset-gpio", 0); + pr_debug("pm8008 parse device tree pm8008-chip-2 for reset "); + // pm8008_do_reset(); + } + pr_debug("pm8008_regulator_probe E\n"); + } return 0; } @@ -693,12 +918,36 @@ static int pm8008_enable_regulator_enable(struct regulator_dev *rdev) struct pm8008_chip *chip = rdev_get_drvdata(rdev); int rc; +#ifndef VENDOR_EDIT +/* Bin.Liu@Cam.Drv, 20201221, Add for pm8008 I2C error */ rc = pm8008_masked_write(chip->regmap, MISC_CHIP_ENABLE_REG, CHIP_ENABLE_BIT, CHIP_ENABLE_BIT); if (rc < 0) { pm8008_err(chip, "failed to enable chip rc=%d\n", rc); return rc; } +#else + int retry = 0; + if (19721 == get_project()) { + rc = pm8008_masked_write(chip->regmap, MISC_CHIP_ENABLE_REG, + CHIP_ENABLE_BIT, CHIP_ENABLE_BIT); + if (rc < 0) { + for (; retry < 3 && rc < 0; retry++) { + rc = pm8008_masked_write(chip->regmap, MISC_CHIP_ENABLE_REG, + CHIP_ENABLE_BIT, CHIP_ENABLE_BIT); + pr_err("failed at pm8008_enable_regulator_enable repty %d \n", retry); + msleep(20); + } + } + } else { + rc = pm8008_masked_write(chip->regmap, MISC_CHIP_ENABLE_REG, + CHIP_ENABLE_BIT, CHIP_ENABLE_BIT); + if (rc < 0) { + pm8008_err(chip, "failed to enable chip rc=%d\n", rc); + return rc; + } + } +#endif pm8008_debug(chip, "regulator enabled\n"); return 0; @@ -775,6 +1024,14 @@ static int pm8008_chip_probe(struct platform_device *pdev) return -ENOMEM; chip->regmap = dev_get_regmap(pdev->dev.parent, NULL); + + if( (19781 == get_project()) || (19696 == get_project()) ) { + /*zhixian.Mai @Cam.Drv, 2019/10/01, Add for PM8008 i2c error */ + if (g_reset_regmap == NULL) { + g_reset_regmap = chip->regmap; + } + } + if (!chip->regmap) { pr_err("parent regmap is missing\n"); return -EINVAL; diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index ade1553c6db1..3f746bbfa6d4 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1966,7 +1966,12 @@ static void qcom_glink_cancel_rx_work(struct qcom_glink *glink) list_for_each_entry_safe(dcmd, tmp, &glink->rx_queue, node) kfree(dcmd); } - +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER +//Ruansong@PSW.NW.DATA.2120730, 2019/07/11 add for RM_TAG_POWER_DEBUG +#define GLINK_NATIVE_IRQ_NUM_MAX 10 +#define GLINK_NATIVE_IRQ_NAME_LEN 24 +static char glink_native_irq_names[GLINK_NATIVE_IRQ_NUM_MAX][GLINK_NATIVE_IRQ_NAME_LEN]; +#endif/*VENDOR_EDIT*/ struct qcom_glink *qcom_glink_native_probe(struct device *dev, unsigned long features, struct qcom_glink_pipe *rx, @@ -1981,6 +1986,13 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev, int irq; int ret; +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER +//Ruansong@PSW.NW.DATA.2120730, 2019/07/11 add for RM_TAG_POWER_DEBUG + static int glink_native_irq_index = 1; + char *glink_native_irq_name = glink_native_irq_names[0]; + snprintf(glink_native_irq_names[0], GLINK_NATIVE_IRQ_NAME_LEN, "glink-native"); +#endif/*VENDOR_EDIT*/ + glink = devm_kzalloc(dev, sizeof(*glink), GFP_KERNEL); if (!glink) return ERR_PTR(-ENOMEM); @@ -2041,11 +2053,26 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev, irqflags = IRQF_TRIGGER_RISING; else irqflags = IRQF_NO_SUSPEND | IRQF_SHARED; - + +#ifndef OPLUS_FEATURE_MODEM_DATA_NWPOWER +//Ruansong@PSW.NW.DATA.2120730, 2019/07/11 add for RM_TAG_POWER_DEBUG ret = devm_request_irq(dev, irq, qcom_glink_native_intr, irqflags, "glink-native", glink); +#else + if(glink_native_irq_index < GLINK_NATIVE_IRQ_NUM_MAX){ + snprintf(glink_native_irq_names[glink_native_irq_index], GLINK_NATIVE_IRQ_NAME_LEN, "glink-native-%s", glink->name); + glink_native_irq_name = glink_native_irq_names[glink_native_irq_index]; + glink_native_irq_index++; + } + ret = devm_request_irq(dev, irq, + qcom_glink_native_intr, + IRQF_NO_SUSPEND | IRQF_SHARED, + glink_native_irq_name, glink); + pr_err("qcom_glink_native_probe: def:%s final:%s index:%d irq:%d\n", glink_native_irq_names[0], glink_native_irq_name, glink_native_irq_index,irq); +#endif/*VENDOR_EDIT*/ + if (ret) { dev_err(dev, "failed to request IRQ\n"); goto unregister; diff --git a/drivers/rtc/qpnp-rtc.c b/drivers/rtc/qpnp-rtc.c index 579877306d92..c6d9b678c6cb 100644 --- a/drivers/rtc/qpnp-rtc.c +++ b/drivers/rtc/qpnp-rtc.c @@ -24,6 +24,11 @@ #include #include +#ifdef OPLUS_FEATURE_POWERINFO_FTM +//Nanwei.Deng@BSP.Power.Basic 2018/05/01 Add for case04863697*/ +#include "soc/oplus/system/boot_mode.h" +#endif + /* RTC/ALARM Register offsets */ #define REG_OFFSET_ALARM_RW 0x40 #define REG_OFFSET_ALARM_CTRL1 0x46 @@ -618,8 +623,17 @@ static int qpnp_rtc_probe(struct platform_device *pdev) } device_init_wakeup(&pdev->dev, 1); - enable_irq_wake(rtc_dd->rtc_alarm_irq); - + #ifdef OPLUS_FEATURE_POWERINFO_FTM + //Nanwei.Deng@BSP.Power.Basic 2018/05/01 Add for case04863697*/ + if (get_boot_mode() == MSM_BOOT_MODE__FACTORY) + { + enable_irq(rtc_dd->rtc_alarm_irq); + } + else + { + enable_irq_wake(rtc_dd->rtc_alarm_irq); + } + #endif dev_dbg(&pdev->dev, "Probe success !!\n"); return 0; @@ -713,7 +727,19 @@ static int qpnp_rtc_restore(struct device *dev) if (rc) pr_err("Request IRQ failed (%d)\n", rc); else - enable_irq_wake(rtc_dd->rtc_alarm_irq); + { + #ifdef OPLUS_FEATURE_POWERINFO_FTM + //Nanwei.Deng@BSP.Power.Basic 2018/05/01 Add for case04863697*/ + if (get_boot_mode() == MSM_BOOT_MODE__FACTORY) + { + enable_irq(rtc_dd->rtc_alarm_irq); + } + else + { + enable_irq_wake(rtc_dd->rtc_alarm_irq); + } + #endif + } } return rc; diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c index 31e7e23cc5be..bd265b791615 100644 --- a/drivers/rtc/rtc-proc.c +++ b/drivers/rtc/rtc-proc.c @@ -139,12 +139,22 @@ static const struct file_operations rtc_proc_fops = { void rtc_proc_add_device(struct rtc_device *rtc) { +#ifdef OPLUS_FEATURE_SAUPWK + extern void __attribute__((weak)) saupwk_rtc_proc_add_device(struct rtc_device *rtc); + if(saupwk_rtc_proc_add_device) + saupwk_rtc_proc_add_device(rtc); +#endif if (is_rtc_hctosys(rtc)) proc_create_data("driver/rtc", 0, NULL, &rtc_proc_fops, rtc); } void rtc_proc_del_device(struct rtc_device *rtc) { +#ifdef OPLUS_FEATURE_SAUPWK + extern void __attribute__((weak)) saupwk_rtc_proc_del_device(struct rtc_device *rtc); + if(saupwk_rtc_proc_del_device) + saupwk_rtc_proc_del_device(rtc); +#endif if (is_rtc_hctosys(rtc)) remove_proc_entry("driver/rtc", NULL); } diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 881906dc33b8..e127f09be638 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -519,7 +519,12 @@ source "drivers/scsi/esas2r/Kconfig" source "drivers/scsi/megaraid/Kconfig.megaraid" source "drivers/scsi/mpt3sas/Kconfig" source "drivers/scsi/smartpqi/Kconfig" -source "drivers/scsi/ufs/Kconfig" + +#ifdef VENDOR_EDIT +source "drivers/scsi/oufs/Kconfig" +#else +#source "drivers/scsi/ufs/Kconfig" +#endif config SCSI_HPTIOP tristate "HighPoint RocketRAID 3xxx/4xxx Controller support" diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 1639bf8b1ab6..60f197baed52 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile @@ -102,7 +102,11 @@ obj-$(CONFIG_MEGARAID_LEGACY) += megaraid.o obj-$(CONFIG_MEGARAID_NEWGEN) += megaraid/ obj-$(CONFIG_MEGARAID_SAS) += megaraid/ obj-$(CONFIG_SCSI_MPT3SAS) += mpt3sas/ +ifneq ($(TARGET_PRODUCT),qssi) +obj-$(CONFIG_SCSI_UFSHCD) += oufs/ +else obj-$(CONFIG_SCSI_UFSHCD) += ufs/ +endif obj-$(CONFIG_SCSI_ACARD) += atp870u.o obj-$(CONFIG_SCSI_SUNESP) += esp_scsi.o sun_esp.o obj-$(CONFIG_SCSI_GDTH) += gdth.o diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 489737392c37..88dae8e74657 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2044,13 +2044,24 @@ sd_spinup_disk(struct scsi_disk *sdkp) * doesn't have any media in it, don't bother * with any more polling. */ +#ifdef OPLUS_FEATURE_CHG_BASIC + if (retries > 25) { + if (media_not_present(sdkp, &sshdr)) + return; + } +#else if (media_not_present(sdkp, &sshdr)) return; +#endif if (the_result) sense_valid = scsi_sense_valid(&sshdr); retries++; +#ifdef OPLUS_FEATURE_CHG_BASIC + } while (retries < 30 && +#else } while (retries < 3 && +#endif (!scsi_status_is_good(the_result) || ((driver_byte(the_result) & DRIVER_SENSE) && sense_valid && sshdr.sense_key == UNIT_ATTENTION))); diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig index 8fa2313508ea..a5936e64d7e2 100644 --- a/drivers/scsi/ufs/Kconfig +++ b/drivers/scsi/ufs/Kconfig @@ -123,6 +123,67 @@ config SCSI_UFSHCD_CMD_LOGGING Select this if you want above mentioned debug information captured. If unsure, say N. +config SCSI_UFS_HISI + tristate "Hisilicon specific hooks to UFS controller platform driver" + depends on (ARCH_HISI || COMPILE_TEST) && SCSI_UFSHCD_PLATFORM + ---help--- + This selects the Hisilicon specific additions to UFSHCD platform driver. + + Select this if you have UFS controller on Hisilicon chipset. + If unsure, say N. + +#ifdef VENDOR_EDIT +#/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +config UFSFEATURE + bool "UFS feature activate" + depends on SCSI_UFSHCD + ---help--- + UFS feature activate such as hpb, tw and etc. + +config UFSHPB + bool "UFSHPB" + depends on SCSI_UFSHCD && UFSFEATURE + ---help--- + UFS HPB Feature Enable + +config HPB_SUP_ONLY_4 + bool "Support 4KB" + depends on SCSI_UFSHCD && UFSFEATURE && UFSHPB + ---help--- + HPB-Read support 4KB chunk + +config HPB_SUP_8_TO_32 + bool "Support 8KB - 32KB" + depends on SCSI_UFSHCD && UFSFEATURE && UFSHPB + ---help--- + HPB-Read support 8KB - 32KB chunk + +config HPB_SUP_OVER_36 + bool "Support 36KB - 512KB" + depends on SCSI_UFSHCD && UFSFEATURE && UFSHPB + ---help--- + HPB-Read support 36KB - 512KB chunk + +config UFSTW + bool "UFSTW" + depends on SCSI_UFSHCD && UFSFEATURE + ---help--- + UFS TW Feature Enable + +config UFSTW_DEBUGDRV + bool "UFSTW Debug driver" + depends on SCSI_UFSHCD && UFSFEATURE && !UFSTW + ---help--- + UFSTW driver should be disabled for operating this driver. + +config UFSTW_IGNORE_GUARANTEE_BIT + bool "UFSTW_IGNORE_GUARANTEE_BIT" + default n + depends on SCSI_UFSHCD && UFSFEATURE && UFSTW + ---help--- + ignore the guarantee bit[31] of dTurboWriteBufferLifeTimeEst for PoC +#endif + config SCSI_UFS_CRYPTO bool "UFS Crypto Engine Support" depends on SCSI_UFSHCD && BLK_INLINE_ENCRYPTION diff --git a/drivers/scsi/ufs/Makefile b/drivers/scsi/ufs/Makefile index fe4c092c006b..644f0871d371 100644 --- a/drivers/scsi/ufs/Makefile +++ b/drivers/scsi/ufs/Makefile @@ -3,6 +3,16 @@ obj-$(CONFIG_SCSI_UFS_DWC_TC_PCI) += tc-dwc-g210-pci.o ufshcd-dwc.o tc-dwc-g210.o obj-$(CONFIG_SCSI_UFS_DWC_TC_PLATFORM) += tc-dwc-g210-pltfrm.o ufshcd-dwc.o tc-dwc-g210.o obj-$(CONFIG_SCSI_UFS_QCOM) += ufs-qcom.o +obj-$(CONFIG_SCSI_UFS_QCOM_ICE) += ufs-qcom-ice.o +obj-$(CONFIG_SCSI_UFSHCD) += ufshcd-core.o +ufshcd-core-objs := ufshcd.o ufs-sysfs.o +#ifdef VENDOR_EDIT +#/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +obj-$(CONFIG_UFSFEATURE) += ufsfeature.o +obj-$(CONFIG_UFSHPB) += ufshpb.o +obj-$(CONFIG_UFSTW) += ufstw.o +obj-$(CONFIG_UFSTW_DEBUGDRV) += ufstw-ddrv.o +#endif obj-$(CONFIG_SCSI_UFSHCD) += ufshcd-core.o ufshcd-core-y := ufshcd.o obj-$(CONFIG_SCSI_UFSHCD_PCI) += ufshcd-pci.o diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h index 988e20a583e6..0fda7a53b4c0 100644 --- a/drivers/scsi/ufs/ufs.h +++ b/drivers/scsi/ufs/ufs.h @@ -174,6 +174,17 @@ enum unit_desc_param { UNIT_DESC_PARAM_PHY_MEM_RSRC_CNT = 0x18, UNIT_DESC_PARAM_CTX_CAPABILITIES = 0x20, UNIT_DESC_PARAM_LARGE_UNIT_SIZE_M1 = 0x22, +#ifdef VENDOR_EDIT +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +#if defined(CONFIG_UFSHPB) + UNIT_DESC_HPB_LU_MAX_ACTIVE_REGIONS = 0x23, + UNIT_DESC_HPB_LU_PIN_REGION_START_OFFSET = 0x25, + UNIT_DESC_HPB_LU_NUM_PIN_REGIONS = 0x27, +#endif +#if defined(CONFIG_UFSTW) + UNIT_DESC_TW_LU_MAX_BUF_SIZE = 0x29, +#endif +#endif }; /* Device descriptor parameters offsets in bytes*/ @@ -205,6 +216,89 @@ enum device_desc_param { DEVICE_DESC_PARAM_UD_LEN = 0x1B, DEVICE_DESC_PARAM_RTT_CAP = 0x1C, DEVICE_DESC_PARAM_FRQ_RTC = 0x1D, + DEVICE_DESC_PARAM_UFS_FEAT = 0x1F, + DEVICE_DESC_PARAM_FFU_TMT = 0x20, + DEVICE_DESC_PARAM_Q_DPTH = 0x21, + DEVICE_DESC_PARAM_DEV_VER = 0x22, + DEVICE_DESC_PARAM_NUM_SEC_WPA = 0x24, + DEVICE_DESC_PARAM_PSA_MAX_DATA = 0x25, + DEVICE_DESC_PARAM_PSA_TMT = 0x29, + DEVICE_DESC_PARAM_PRDCT_REV = 0x2A, +#ifdef VENDOR_EDIT +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +#if defined(CONFIG_UFSHPB) + DEVICE_DESC_PARAM_HPB_VER = 0x40, +#endif +#if defined(CONFIG_UFSFEATURE) + DEVICE_DESC_PARAM_EX_FEAT_SUP = 0x4F, +#endif +#if defined(CONFIG_UFSTW) + DEVICE_DESC_PARAM_TW_RETURN_TO_USER = 0x53, + DEVICE_DESC_PARAM_TW_BUF_TYPE = 0x54, + DEVICE_DESC_PARAM_TW_VER = 0x55, +#endif +#endif +}; + +/* Interconnect descriptor parameters offsets in bytes*/ +enum interconnect_desc_param { + INTERCONNECT_DESC_PARAM_LEN = 0x0, + INTERCONNECT_DESC_PARAM_TYPE = 0x1, + INTERCONNECT_DESC_PARAM_UNIPRO_VER = 0x2, + INTERCONNECT_DESC_PARAM_MPHY_VER = 0x4, +}; + +/* Geometry descriptor parameters offsets in bytes*/ +enum geometry_desc_param { + GEOMETRY_DESC_PARAM_LEN = 0x0, + GEOMETRY_DESC_PARAM_TYPE = 0x1, + GEOMETRY_DESC_PARAM_DEV_CAP = 0x4, + GEOMETRY_DESC_PARAM_MAX_NUM_LUN = 0xC, + GEOMETRY_DESC_PARAM_SEG_SIZE = 0xD, + GEOMETRY_DESC_PARAM_ALLOC_UNIT_SIZE = 0x11, + GEOMETRY_DESC_PARAM_MIN_BLK_SIZE = 0x12, + GEOMETRY_DESC_PARAM_OPT_RD_BLK_SIZE = 0x13, + GEOMETRY_DESC_PARAM_OPT_WR_BLK_SIZE = 0x14, + GEOMETRY_DESC_PARAM_MAX_IN_BUF_SIZE = 0x15, + GEOMETRY_DESC_PARAM_MAX_OUT_BUF_SIZE = 0x16, + GEOMETRY_DESC_PARAM_RPMB_RW_SIZE = 0x17, + GEOMETRY_DESC_PARAM_DYN_CAP_RSRC_PLC = 0x18, + GEOMETRY_DESC_PARAM_DATA_ORDER = 0x19, + GEOMETRY_DESC_PARAM_MAX_NUM_CTX = 0x1A, + GEOMETRY_DESC_PARAM_TAG_UNIT_SIZE = 0x1B, + GEOMETRY_DESC_PARAM_TAG_RSRC_SIZE = 0x1C, + GEOMETRY_DESC_PARAM_SEC_RM_TYPES = 0x1D, + GEOMETRY_DESC_PARAM_MEM_TYPES = 0x1E, + GEOMETRY_DESC_PARAM_SCM_MAX_NUM_UNITS = 0x20, + GEOMETRY_DESC_PARAM_SCM_CAP_ADJ_FCTR = 0x24, + GEOMETRY_DESC_PARAM_NPM_MAX_NUM_UNITS = 0x26, + GEOMETRY_DESC_PARAM_NPM_CAP_ADJ_FCTR = 0x2A, + GEOMETRY_DESC_PARAM_ENM1_MAX_NUM_UNITS = 0x2C, + GEOMETRY_DESC_PARAM_ENM1_CAP_ADJ_FCTR = 0x30, + GEOMETRY_DESC_PARAM_ENM2_MAX_NUM_UNITS = 0x32, + GEOMETRY_DESC_PARAM_ENM2_CAP_ADJ_FCTR = 0x36, + GEOMETRY_DESC_PARAM_ENM3_MAX_NUM_UNITS = 0x38, + GEOMETRY_DESC_PARAM_ENM3_CAP_ADJ_FCTR = 0x3C, + GEOMETRY_DESC_PARAM_ENM4_MAX_NUM_UNITS = 0x3E, + GEOMETRY_DESC_PARAM_ENM4_CAP_ADJ_FCTR = 0x42, + GEOMETRY_DESC_PARAM_OPT_LOG_BLK_SIZE = 0x44, +#ifdef VENDOR_EDIT +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +#if defined(CONFIG_UFSHPB) + GEOMETRY_DESC_HPB_REGION_SIZE = 0x48, + GEOMETRY_DESC_HPB_NUMBER_LU = 0x49, + GEOMETRY_DESC_HPB_SUBREGION_SIZE = 0x4A, + GEOMETRY_DESC_HPB_DEVICE_MAX_ACTIVE_REGIONS = 0x4B, +#endif +#if defined(CONFIG_UFSTW) + GEOMETRY_DESC_TW_MAX_SIZE = 0x4F, + GEOMETRY_DESC_TW_NUMBER_LU = 0x53, + GEOMETRY_DESC_TW_CAP_ADJ_FAC = 0x54, + GEOMETRY_DESC_TW_SUPPORT_USER_REDUCTION_TYPES = 0x55, + GEOMETRY_DESC_TW_SUPPORT_BUF_TYPE = 0x56, + GEOMETRY_DESC_TW_GROUP_NUM_CAP = 0x57, +#endif +#endif }; /* Health descriptor parameters offsets in bytes*/ @@ -257,6 +351,10 @@ enum power_desc_param_offset { enum { MASK_EE_STATUS = 0xFFFF, MASK_EE_URGENT_BKOPS = (1 << 2), +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSTW) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + MASK_EE_TW = (1 << 5), +#endif }; /* Background operation status */ diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 8f5f116c48ba..75797c3d99c2 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -51,8 +51,23 @@ #include "ufs-debugfs.h" #include "ufs-qcom.h" +#ifdef VENDOR_EDIT +//zhenjian Jiang@PSW.BSP.Storage.UFS, 2018-05-04 add for ufs device in /proc/devinfo +#include +/*Hank.liu@PSW.BSP Kernel IO Latency 2019-03-19,ufs slot status */ +unsigned long ufs_outstanding; +#endif + #ifdef CONFIG_DEBUG_FS +#ifdef VENDOR_EDIT +//hank.liu@Tech.Storage.UFS, 2019-10-11 add for ufsplus status node in /proc/devinfo +int ufsplus_tw_status = 0; +EXPORT_SYMBOL(ufsplus_tw_status); +int ufsplus_hpb_status = 0; +EXPORT_SYMBOL(ufsplus_hpb_status); +#endif + static int ufshcd_tag_req_type(struct request *rq) { int rq_type = TS_WRITE; @@ -457,8 +472,18 @@ static int ufshcd_disable_clocks(struct ufs_hba *hba, bool is_gating_context); static int ufshcd_disable_clocks_keep_link_active(struct ufs_hba *hba, bool is_gating_context); +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +void ufshcd_hold_all(struct ufs_hba *hba); +#else static void ufshcd_hold_all(struct ufs_hba *hba); +#endif +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +void ufshcd_release_all(struct ufs_hba *hba); +#else static void ufshcd_release_all(struct ufs_hba *hba); +#endif static int ufshcd_set_vccq_rail_unused(struct ufs_hba *hba, bool unused); static inline void ufshcd_add_delay_before_dme_cmd(struct ufs_hba *hba); static inline void ufshcd_save_tstamp_of_last_dme_cmd(struct ufs_hba *hba); @@ -466,8 +491,6 @@ static int ufshcd_host_reset_and_restore(struct ufs_hba *hba); static void ufshcd_resume_clkscaling(struct ufs_hba *hba); static void ufshcd_suspend_clkscaling(struct ufs_hba *hba); static void __ufshcd_suspend_clkscaling(struct ufs_hba *hba); -static void ufshcd_hold_all(struct ufs_hba *hba); -static void ufshcd_release_all(struct ufs_hba *hba); static void ufshcd_hba_vreg_set_lpm(struct ufs_hba *hba); static void ufshcd_hba_vreg_set_hpm(struct ufs_hba *hba); static int ufshcd_devfreq_target(struct device *dev, @@ -1754,7 +1777,12 @@ out: static int ufshcd_clock_scaling_prepare(struct ufs_hba *hba) { +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) + /* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + #define DOORBELL_CLR_TOUT_US (1500 * 1000) /* 1.5 sec */ +#else #define DOORBELL_CLR_TOUT_US (1000 * 1000) /* 1 sec */ +#endif int ret = 0; /* * make sure that there are no outstanding requests when @@ -2258,6 +2286,13 @@ static void ufshcd_gate_work(struct work_struct *work) unsigned long flags; spin_lock_irqsave(hba->host->host_lock, flags); +#ifdef VENDOR_EDIT +//yh@BSP.Storage.UFS, 2020-1-15 add for fix race condition during hrtimer active(ufshcd_release/ufshcd_gate_work) + if (hba->clk_gating.state == CLKS_OFF) + { + goto rel_lock; + } +#endif /* * In case you are here to cancel this work the gating state * would be marked as REQ_CLKS_ON. In this case save time by @@ -2611,7 +2646,12 @@ static void ufshcd_set_auto_hibern8_timer(struct ufs_hba *hba, u32 delay) * * Return 0 on success, non-zero on failure. */ +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +int ufshcd_hibern8_hold(struct ufs_hba *hba, bool async) +#else static int ufshcd_hibern8_hold(struct ufs_hba *hba, bool async) +#endif { int rc = 0; unsigned long flags; @@ -2977,13 +3017,23 @@ static void ufshcd_exit_hibern8_on_idle(struct ufs_hba *hba) device_remove_file(hba->dev, &hba->hibern8_on_idle.enable_attr); } +#if defined(VENDOR_EDIT) && defined (CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +void ufshcd_hold_all(struct ufs_hba *hba) +#else static void ufshcd_hold_all(struct ufs_hba *hba) +#endif { ufshcd_hold(hba, false); ufshcd_hibern8_hold(hba, false); } +#if defined(VENDOR_EDIT) && defined (CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +void ufshcd_release_all(struct ufs_hba *hba) +#else static void ufshcd_release_all(struct ufs_hba *hba) +#endif { ufshcd_hibern8_release(hba, false); ufshcd_release(hba, false); @@ -3283,7 +3333,12 @@ ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) * * Returns 0 in case of success, non-zero value in case of failure */ +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +int ufshcd_map_sg(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) +#else static int ufshcd_map_sg(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) +#endif { struct ufshcd_sg_entry *prd; struct scatterlist *sg; @@ -3554,7 +3609,12 @@ static int ufshcd_comp_devman_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) * @hba - per adapter instance * @lrb - pointer to local reference block */ +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +int ufshcd_comp_scsi_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) +#else static int ufshcd_comp_scsi_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) +#endif { u32 upiu_flags; int ret = 0; @@ -3566,6 +3626,12 @@ static int ufshcd_comp_scsi_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) lrbp->command_type = UTP_CMD_TYPE_UFS_STORAGE; if (likely(lrbp->cmd)) { +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + ufsf_hpb_change_lun(&hba->ufsf, lrbp); + ufsf_tw_prep_fn(&hba->ufsf, lrbp); + ufsf_hpb_prep_fn(&hba->ufsf, lrbp); +#endif ret = ufshcd_prepare_req_desc_hdr(hba, lrbp, &upiu_flags, lrbp->cmd->sc_data_direction); ufshcd_prepare_utp_scsi_cmd_upiu(lrbp, upiu_flags); @@ -3672,6 +3738,16 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) int tag; int err = 0; bool has_read_lock = false; +#ifdef VENDOR_EDIT +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +#if defined(CONFIG_UFSFEATURE) && defined(CONFIG_UFSHPB) + struct scsi_cmnd *pre_cmd; + struct ufshcd_lrb *add_lrbp; + int add_tag; + int pre_req_err = -EBUSY; + int lun = ufshcd_scsi_to_upiu_lun(cmd->device->lun); +#endif +#endif hba = shost_priv(host); @@ -3772,9 +3848,41 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) if (ufshcd_is_hibern8_on_idle_allowed(hba)) WARN_ON(hba->hibern8_on_idle.state != HIBERN8_EXITED); +#ifdef VENDOR_EDIT +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +#if defined(CONFIG_UFSFEATURE) && defined(CONFIG_UFSHPB) + add_tag = ufsf_hpb_prepare_pre_req(&hba->ufsf, cmd, lun); + if (add_tag == -EAGAIN) { + clear_bit_unlock(tag, &hba->lrb_in_use); + err = SCSI_MLQUEUE_HOST_BUSY; + ufshcd_release_all(hba); + goto out; + } + if (add_tag < 0) { + hba->lrb[tag].hpb_ctx_id = MAX_HPB_CONTEXT_ID; + goto send_orig_cmd; + } + add_lrbp = &hba->lrb[add_tag]; + + pre_req_err = ufsf_hpb_prepare_add_lrbp(&hba->ufsf, add_tag); + if (pre_req_err) + hba->lrb[tag].hpb_ctx_id = MAX_HPB_CONTEXT_ID; +send_orig_cmd: +#endif +#endif /* Vote PM QoS for the request */ ufshcd_vops_pm_qos_req_start(hba, cmd->request); +#ifdef VENDOR_EDIT +//hank.liu@Tech.Storage.UFS, 2019-10-17 add latency_hist node for ufs latency calculate in sysfs. + /* IO svc time latency histogram */ + if (hba->latency_hist_enabled &&(!blk_rq_is_passthrough(cmd->request))) { + cmd->request->lat_hist_io_start = ktime_get(); + cmd->request->lat_hist_enabled = 1; + } else { + cmd->request->lat_hist_enabled = 0; + } +#endif /* IO svc time latency histogram */ if (hba != NULL && cmd->request != NULL) { @@ -3839,9 +3947,26 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) /* issue command to the controller */ spin_lock_irqsave(hba->host->host_lock, flags); +#ifdef VENDOR_EDIT +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +#if defined(CONFIG_UFSFEATURE) && defined(CONFIG_UFSHPB) + if (!pre_req_err) { + ufshcd_vops_setup_xfer_req(hba, add_tag, (add_lrbp->cmd ? true : false)); + ufshcd_send_command(hba, add_tag); + pre_req_err = -EBUSY; + atomic64_inc(&hba->ufsf.ufshpb_lup[add_lrbp->lun]->pre_req_cnt); + ufsf_para.pre_req++; + } +#endif +#endif ufshcd_vops_setup_xfer_req(hba, tag, (lrbp->cmd ? true : false)); err = ufshcd_send_command(hba, tag); +#ifdef VENDOR_EDIT + //hank.liu@TECH.BSP.Storage.UFS, 2019-04-26, Add for monitor ufs driver io time + ufs_outstanding=hba->outstanding_reqs; + cmd->request->ufs_io_start = ktime_get(); +#endif if (err) { spin_unlock_irqrestore(hba->host->host_lock, flags); scsi_dma_unmap(lrbp->cmd); @@ -3858,6 +3983,21 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) out_unlock: spin_unlock_irqrestore(hba->host->host_lock, flags); out: +#ifdef VENDOR_EDIT +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +#if defined(CONFIG_UFSFEATURE) && defined(CONFIG_UFSHPB) + if (!pre_req_err) { + pre_cmd = add_lrbp->cmd; + scsi_dma_unmap(pre_cmd); + add_lrbp->cmd = NULL; + clear_bit_unlock(add_tag, &hba->lrb_in_use); + ufshcd_release_all(hba); + ufshcd_vops_pm_qos_req_end(hba, pre_cmd->request, true); + ufshcd_vops_crypto_engine_cfg_end(hba, lrbp, pre_cmd->request); + ufsf_hpb_end_pre_req(&hba->ufsf, pre_cmd->request); + } +#endif +#endif if (has_read_lock) ufshcd_put_read_lock(hba); return err; @@ -4046,8 +4186,14 @@ static inline void ufshcd_put_dev_cmd_tag(struct ufs_hba *hba, int tag) * NOTE: Since there is only one available tag for device management commands, * it is expected you hold the hba->dev_cmd.lock mutex. */ +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +int ufshcd_exec_dev_cmd(struct ufs_hba *hba, + enum dev_cmd_type cmd_type, int timeout) +#else static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, enum dev_cmd_type cmd_type, int timeout) +#endif { struct ufshcd_lrb *lrbp; int err; @@ -5269,6 +5415,28 @@ static int ufshcd_link_recovery(struct ufs_hba *hba) return ret; } +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add ufs+ node to oppohealthinfo*/ +static void oppo_ufs_update_h8_info(struct ufs_hba *hba, bool hibern8_enter){ + u64 calc_h8_time_ms = 0; + if (hibern8_enter) { + ufsf_para.hibern8_enter_ts = ktime_get(); + } + else { + calc_h8_time_ms = (u64)ktime_ms_delta(ktime_get(), ufsf_para.hibern8_enter_ts); + if (calc_h8_time_ms > 99) { + ufsf_para.hibern8_enter_count_100ms++; + ufsf_para.hibern8_amount_ms_100ms += calc_h8_time_ms; + } + if (ufsf_para.hibern8_max_ms < calc_h8_time_ms) + ufsf_para.hibern8_max_ms = calc_h8_time_ms; + ufsf_para.hibern8_amount_ms += calc_h8_time_ms; + ufsf_para.hibern8_enter_count++; + } +} +#endif + + static int __ufshcd_uic_hibern8_enter(struct ufs_hba *hba) { int ret; @@ -5315,6 +5483,10 @@ static int __ufshcd_uic_hibern8_enter(struct ufs_hba *hba) POST_CHANGE); dev_dbg(hba->dev, "%s: Hibern8 Enter at %lld us", __func__, ktime_to_us(ktime_get())); +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add ufs+ node to oppohealthinfo*/ + oppo_ufs_update_h8_info(hba, true); +#endif } return ret; @@ -5367,6 +5539,10 @@ int ufshcd_uic_hibern8_exit(struct ufs_hba *hba) ktime_to_us(ktime_get())); hba->ufs_stats.last_hibern8_exit_tstamp = ktime_get(); hba->ufs_stats.hibern8_exit_cnt++; +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add ufs+ node to oppohealthinfo*/ + oppo_ufs_update_h8_info(hba, false); +#endif } return ret; @@ -6102,8 +6278,18 @@ static int ufshcd_change_queue_depth(struct scsi_device *sdev, int depth) static int ufshcd_slave_configure(struct scsi_device *sdev) { struct ufs_hba *hba = shost_priv(sdev->host); +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) + /* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + struct ufsf_feature *ufsf = &hba->ufsf; struct request_queue *q = sdev->request_queue; + if (ufsf_is_valid_lun(sdev->lun)) { + ufsf->sdev_ufs_lu[sdev->lun] = sdev; + ufsf->slave_conf_cnt++; + printk(KERN_ERR "%s: ufsfeature set lun %d sdev %p q %p\n", + __func__, (int)sdev->lun, sdev, sdev->request_queue); + } +#endif blk_queue_update_dma_pad(q, PRDT_DATA_BYTE_COUNT_PAD - 1); blk_queue_max_segment_size(q, PRDT_DATA_BYTE_COUNT_MAX); @@ -6274,6 +6460,11 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) if (schedule_work(&hba->eeh_work)) pm_runtime_get_noresume(hba->dev); } +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + if (scsi_status == SAM_STAT_GOOD) + ufsf_hpb_noti_rb(&hba->ufsf, lrbp); +#endif break; case UPIU_TRANSACTION_REJECT_UPIU: /* TODO: handle Reject UPIU Response */ @@ -6432,20 +6623,44 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba, req = cmd->request; if (req) { +#ifdef VENDOR_EDIT + //hank.liu@Tech.Storage.UFS, 2019-10-17 add latency_hist node for ufs latency calculate in sysfs. + cmd->request->flash_io_latency = ktime_us_delta(ktime_get(), cmd->request->ufs_io_start); +#endif /* Update IO svc time latency histogram */ if (req->lat_hist_enabled) { - ktime_t completion; - u_int64_t delta_us; + ktime_t completion; + u_int64_t delta_us; + unsigned int length = blk_rq_sectors(cmd->request); + + completion = ktime_get(); + delta_us = ktime_us_delta(completion,cmd->request->lat_hist_io_start); + if(req_op(cmd->request) == REQ_OP_WRITE || req_op(cmd->request) == REQ_OP_WRITE_SAME){ + blk_update_latency_hist(&hba->io_lat_write, delta_us, length); + }else if(req_op(cmd->request) == REQ_OP_READ){ + blk_update_latency_hist(&hba->io_lat_read, delta_us, length); + }else{ + blk_update_latency_hist(&hba->io_lat_other, delta_us, length); + } + } + } +#endif +#if defined(VENDOR_EDIT) && defined(CONFIG_TRACEPOINTS) +//yh@BSP.Storage.UFS, 2019-09-13 add for ufs io latency info calculate + if (trace_ufshcd_command_enabled()) + { + struct request *req = cmd->request; + u_int64_t delta_us = ktime_us_delta(lrbp->complete_time_stamp, lrbp->issue_time_stamp); + + if (req && bio_has_data(req->bio) && (delta_us > 5000)) + { + trace_printk("ufs_io_latency:%06lld us, io_type:%s, LBA:%08x, size:%d\n", + delta_us, (rq_data_dir(req) == READ) ? "R" : "W", + (unsigned int)req->bio->bi_iter.bi_sector, + cmd->sdb.length); + } + } - completion = ktime_get(); - delta_us = ktime_us_delta(completion, - req->lat_hist_io_start); - /* rq_data_dir() => true if WRITE */ - blk_update_latency_hist(&hba->io_lat_s, - (rq_data_dir(req) == READ), - delta_us); - } - } /* Do not touch lrbp after scsi done */ cmd->scsi_done(cmd); @@ -6856,7 +7071,10 @@ static void ufshcd_exception_event_handler(struct work_struct *work) if (status & MASK_EE_URGENT_BKOPS) ufshcd_bkops_exception_event_handler(hba); - +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + ufsf_tw_ee_handler(&hba->ufsf); +#endif out: ufshcd_scsi_unblock_requests(hba); /* @@ -7671,6 +7889,11 @@ static int ufshcd_eh_device_reset_handler(struct scsi_cmnd *cmd) out: hba->req_abort_count = 0; if (!err) { +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + ufsf_hpb_reset_lu(&hba->ufsf); + ufsf_tw_reset_lu(&hba->ufsf); +#endif err = SUCCESS; } else { dev_err(hba->dev, "%s: failed with err %d\n", __func__, err); @@ -7901,6 +8124,11 @@ static int ufshcd_host_reset_and_restore(struct ufs_hba *hba) */ spin_lock_irqsave(hba->host->host_lock, flags); ufshcd_hba_stop(hba, false); +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + ufsf_hpb_reset_host(&hba->ufsf); + ufsf_tw_reset_host(&hba->ufsf); +#endif hba->silence_err_logs = true; ufshcd_complete_requests(hba); hba->silence_err_logs = false; @@ -8235,6 +8463,12 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) struct scsi_device *sdev_boot = NULL; bool is_bootable_dev = false; bool is_embedded_dev = false; +#ifdef VENDOR_EDIT +//yh@PSW.BSP.Storage.UFS, 2018-05-31 add for ufs device in /proc/devinfo + static char temp_version[5] = {0}; + static char vendor[9] = {0}; + static char model[17] = {0}; +#endif if ((hba->dev_info.b_device_sub_class == UFS_DEV_EMBEDDED_BOOTABLE) || (hba->dev_info.b_device_sub_class == UFS_DEV_REMOVABLE_BOOTABLE)) @@ -8255,6 +8489,21 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) } scsi_device_put(hba->sdev_ufs_device); +#ifdef VENDOR_EDIT +//yh@PSW.BSP.Storage.UFS, 2018-05-31 add for ufs device in /proc/devinfo + strncpy(temp_version, hba->sdev_ufs_device->rev, 4); + strncpy(vendor, hba->sdev_ufs_device->vendor, 8); + strncpy(model, hba->sdev_ufs_device->model, 16); + ret = register_device_proc("ufs_version", temp_version, vendor); + if (ret) { + printk("Fail register_device_proc ufs_version\n"); + } + ret = register_device_proc("ufs", model, vendor); + if (ret) { + printk("Fail register_device_proc ufs \n"); + } +#endif + if (is_bootable_dev) { sdev_boot = __scsi_add_device(hba->host, 0, 0, ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), @@ -8888,6 +9137,17 @@ reinit: } scsi_scan_host(hba->host); +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + ufsf_device_check(hba); + ufsf_hpb_init(&hba->ufsf); + ufsf_tw_init(&hba->ufsf); +#endif + +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSTW_DEBUGDRV) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + ufstwd_dev_init(hba); +#endif pm_runtime_put_sync(hba->dev); } @@ -8919,6 +9179,12 @@ out: if (ret && !ufshcd_eh_in_progress(hba) && !hba->pm_op_in_progress) pm_runtime_put_sync(hba->dev); +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + ufsf_hpb_reset(&hba->ufsf); + ufsf_tw_reset(&hba->ufsf); +#endif + trace_ufshcd_init(dev_name(hba->dev), ret, ktime_to_us(ktime_sub(ktime_get(), start)), hba->curr_dev_pwr_mode, hba->uic_link_state); @@ -9136,6 +9402,15 @@ static int ufshcd_query_ioctl(struct ufs_hba *hba, u8 lun, void __user *buffer) goto out_release_mem; } +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + if (ufsf_check_query(ioctl_data->opcode)) { + err = ufsf_query_ioctl(&hba->ufsf, lun, buffer, ioctl_data, + UFSFEATURE_SELECTOR); + goto out_release_mem; + } +#endif + /* verify legal parameters & send query */ switch (ioctl_data->opcode) { case UPIU_QUERY_OPCODE_READ_DESC: @@ -9145,6 +9420,7 @@ static int ufshcd_query_ioctl(struct ufs_hba *hba, u8 lun, void __user *buffer) case QUERY_DESC_IDN_INTERCONNECT: case QUERY_DESC_IDN_GEOMETRY: case QUERY_DESC_IDN_POWER: + case QUERY_DESC_IDN_HEALTH: index = 0; break; case QUERY_DESC_IDN_UNIT: @@ -10056,12 +10332,23 @@ static void ufshcd_vreg_set_lpm(struct ufs_hba *hba) if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba) && !hba->dev_info.is_lu_power_on_wp) { ufshcd_setup_vreg(hba, false); - } else if (!ufshcd_is_ufs_dev_active(hba)) { + } else if (!ufshcd_is_ufs_dev_active(hba)){ +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + dev_info(hba->dev, "enter LPM\n"); + /* + * Because the Turbo Write feature need flush the data from SLC buffer + * to TLC, When the device enter Hibern8. SO We keep the VCC votage alive, + * and VCCQ VCCQ2 not enter LPM. + */ +#else ufshcd_toggle_vreg(hba->dev, hba->vreg_info.vcc, false); if (!ufshcd_is_link_active(hba)) { ufshcd_config_vreg_lpm(hba, hba->vreg_info.vccq); ufshcd_config_vreg_lpm(hba, hba->vreg_info.vccq2); } +#endif + } } @@ -10143,6 +10430,12 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) req_link_state = UIC_LINK_OFF_STATE; } +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + ufsf_hpb_suspend(&hba->ufsf); + ufsf_tw_suspend(&hba->ufsf); +#endif + ret = ufshcd_crypto_suspend(hba, pm_op); if (ret) goto out; @@ -10278,6 +10571,11 @@ enable_gating: hba->hibern8_on_idle.is_suspended = false; hba->clk_gating.is_suspended = false; ufshcd_release_all(hba); +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + ufsf_hpb_resume(&hba->ufsf); + ufsf_tw_resume(&hba->ufsf); +#endif ufshcd_crypto_resume(hba, pm_op); out: hba->pm_op_in_progress = 0; @@ -10404,6 +10702,12 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) if (hba->clk_scaling.is_allowed) ufshcd_resume_clkscaling(hba); +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) + /* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + ufsf_hpb_resume(&hba->ufsf); + ufsf_tw_resume(&hba->ufsf); +#endif + skip_dev_ops: /* Schedule clock gating in case of no access to UFS device yet */ ufshcd_release_all(hba); @@ -11014,7 +11318,12 @@ ufshcd_exit_latency_hist(struct ufs_hba *hba) */ void ufshcd_remove(struct ufs_hba *hba) { - ufshcd_remove_sysfs_nodes(hba); +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) + /* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + ufsf_hpb_release(&hba->ufsf); + ufsf_tw_release(&hba->ufsf); +#endif + ufs_sysfs_remove_nodes(hba->dev); scsi_remove_host(hba->host); /* disable interrupts */ ufshcd_disable_intr(hba, hba->intr_mask); @@ -11303,6 +11612,11 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) ufshcd_cmd_log_init(hba); +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) + /* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + ufsf_hpb_set_init_state(&hba->ufsf); + ufsf_tw_set_init_state(&hba->ufsf); +#endif async_schedule(ufshcd_async_scan, hba); ufsdbg_add_debugfs(hba); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 41e37bcefb05..14b9beb0e8f2 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -74,6 +74,13 @@ #include "ufs.h" #include "ufshci.h" +#ifdef VENDOR_EDIT +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +#if defined(CONFIG_UFSFEATURE) +#include "ufsfeature.h" +#endif +#endif + #define UFSHCD "ufshcd" #define UFSHCD_DRIVER_VERSION "0.3" @@ -231,6 +238,13 @@ struct ufshcd_lrb { #endif /* CONFIG_SCSI_UFS_CRYPTO */ bool req_abort_skip; + +#ifdef VENDOR_EDIT +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +#if defined(CONFIG_UFSFEATURE) && defined(CONFIG_UFSHPB) + int hpb_ctx_id; +#endif +#endif }; /** @@ -724,6 +738,21 @@ enum ufshcd_card_state { UFS_CARD_STATE_OFFLINE = 2, }; +#ifdef VENDOR_EDIT +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +#if defined(CONFIG_UFSTW_DEBUGDRV) +struct ufstwd_dev_info { + struct ufs_hba *hba; + int lun; + + struct kobject kobj; + struct mutex sysfs_lock; + struct ufstwd_sysfs_entry *sysfs_entries; +}; + +void ufstwd_dev_init(struct ufs_hba *hba); +#endif +#endif /** * struct ufs_hba - per adapter private structure * @mmio_base: UFSHCI base register address @@ -1068,12 +1097,18 @@ struct ufs_hba { bool full_init_linereset; struct pinctrl *pctrl; + int latency_hist_enabled; +#ifdef VENDOR_EDIT +//hank.liu@Tech.Storage.UFS, 2019-10-17 add latency_hist node for ufs latency calculate in sysfs. + struct io_latency_state io_lat_read; + struct io_latency_state io_lat_write; + struct io_latency_state io_lat_other; +#endif struct reset_control *core_reset; struct ufs_desc_size desc_size; bool restore_needed; - int latency_hist_enabled; struct io_latency_state io_lat_s; bool reinit_g4_rate_A; @@ -1081,6 +1116,15 @@ struct ufs_hba { /* distinguish between resume and restore */ bool restore; +#ifdef VENDOR_EDIT +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +#if defined(CONFIG_UFSFEATURE) + struct ufsf_feature ufsf; +#endif +#if defined(CONFIG_UFSTW_DEBUGDRV) + struct ufstwd_dev_info *ufstwd; +#endif +#endif #ifdef CONFIG_SCSI_UFS_CRYPTO /* crypto */ union ufs_crypto_capabilities crypto_capabilities; @@ -1355,6 +1399,18 @@ u32 ufshcd_get_local_unipro_ver(struct ufs_hba *hba); void ufshcd_scsi_block_requests(struct ufs_hba *hba); void ufshcd_scsi_unblock_requests(struct ufs_hba *hba); +#ifdef VENDOR_EDIT +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +#if defined(CONFIG_UFSFEATURE) +int ufshcd_exec_dev_cmd(struct ufs_hba *hba, + enum dev_cmd_type cmd_type, int timeout); +int ufshcd_hibern8_hold(struct ufs_hba *hba, bool async); +void ufshcd_hold_all(struct ufs_hba *hba); +void ufshcd_release_all(struct ufs_hba *hba); +int ufshcd_comp_scsi_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp); +int ufshcd_map_sg(struct ufs_hba *hba, struct ufshcd_lrb *lrbp); +#endif +#endif /* Wrapper functions for safely calling variant operations */ static inline const char *ufshcd_get_var_name(struct ufs_hba *hba) diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig index fc9e98047421..fb5a8316dd30 100644 --- a/drivers/soc/Kconfig +++ b/drivers/soc/Kconfig @@ -17,5 +17,29 @@ source "drivers/soc/ti/Kconfig" source "drivers/soc/ux500/Kconfig" source "drivers/soc/versatile/Kconfig" source "drivers/soc/zte/Kconfig" +source "drivers/soc/oplus/Kconfig" +#ifdef OPLUS_FEATURE_IOMONITOR +source "drivers/soc/oplus/iomonitor/Kconfig" +#endif /*OPLUS_FEATURE_IOMONITOR*/ +#ifdef VENDOR_EDIT +#/*ye.zhang@BSP.Bootloader.Bootflow, 2020-6-18, Add for oppo project*/ +source "drivers/soc/oppo/Kconfig" +#endif +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY +#SunFaliang@BSP.Power.Basic, 2020/07/09, add for owakelock. +source "drivers/soc/oplus/owakelock/Kconfig" +#endif /* OPLUS_FEATURE_POWERINFO_STANDBY */ +#ifdef VENDOR_EDIT +#Jiheng.Xie@BSP.Kernel.Performance 2020/06/18 add for oppo healthinfo +source "drivers/soc/oplus/oppo_healthinfo/Kconfig" +#endif + +#ifdef OPLUS_FEATURE_SENSOR_SMEM +#qiuzuolin@BSP.Sensor.Basic 2020/07/31 add for oplus sensor smem +source "drivers/soc/oplus/sensor/Kconfig" +#endif /* OPLUS_FEATURE_SENSOR_SMEM */ + +#Add for NandSwap +source "drivers/soc/oplus/oplus_nandswap/Kconfig" endmenu diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile index 36dec140ea0d..b18b61e30685 100644 --- a/drivers/soc/Makefile +++ b/drivers/soc/Makefile @@ -23,3 +23,27 @@ obj-$(CONFIG_SOC_TI) += ti/ obj-$(CONFIG_ARCH_U8500) += ux500/ obj-$(CONFIG_PLAT_VERSATILE) += versatile/ obj-$(CONFIG_ARCH_ZX) += zte/ +obj-y += oplus/ + +#ifdef OPLUS_FEATURE_IOMONITOR +obj-$(CONFIG_IOMONITOR) += oplus/iomonitor/ +#endif /*OPLUS_FEATURE_IOMONITOR*/ + +#ifdef VENDOR_EDIT +#/*ye.zhang@BSP.Bootloader.Bootflow, 2020-6-18, Add for oppo project*/ +obj-y += oppo/ +#endif +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY +#SunFaliang@BSP.Power.Basic, 2020/07/09, add for oplus_wakelock_profile. +obj-$(CONFIG_OPLUS_WAKELOCK_PROFILER) += oplus/owakelock/ +#endif /* OPLUS_FEATURE_POWERINFO_STANDBY */ +#ifdef OPLUS_FEATURE_HEALTHINFO +#//wenbin.liu@PSW.Kernel.MM, 2018/05/23, Add for Healthinfo monitor +obj-y += oplus/oppo_healthinfo/ +#endif /* OPLUS_FEATURE_HEALTHINFO */ +#ifdef OPLUS_FEATURE_SENSOR_SMEM +#ChenYajie@BSP.SENSOR, 2020/06/16, Add for sensor info +obj-y += oplus/sensor/ +#endif +#Add for NandSwap +obj-$(CONFIG_NANDSWAP) += oplus/oplus_nandswap/ diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig index 8e393e7bf8da..e1889c62e19f 100644 --- a/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig @@ -857,6 +857,18 @@ config QCOM_FSA4480_I2C for accessing the device, switching between USB and Audio modes, changing orientation. +#ifdef OPLUS_ARCH_EXTENDS +#Richeng.Wang@MULTIMEDIA.AUDIODRIVER.HEADSETS, 2020/10/11, Add for max20328 +config QCOM_MAX20328_I2C + bool "Fairchild MAX20328 chip with I2C" + select REGMAP_I2C + depends on I2C + help + Support for the Fairchild MAX20328 IC switch chip controlled + using I2C. This driver provides common support + for accessing the device, switching between USB and Audio + modes, changing orientation. +#endif /* OPLUS_ARCH_EXTENDS */ if (MSM_PM || MSM_PM_LEGACY) menuconfig MSM_IDLE_STATS bool "Collect idle statistics" diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile index cbc9f4da85b8..74f753a52b38 100644 --- a/drivers/soc/qcom/Makefile +++ b/drivers/soc/qcom/Makefile @@ -44,7 +44,7 @@ obj-$(CONFIG_MSM_GLADIATOR_ERP) += gladiator_erp.o obj-$(CONFIG_QCOM_MINIDUMP) += msm_minidump.o minidump_log.o obj-$(CONFIG_QCOM_SECURE_BUFFER) += secure_buffer.o obj-$(CONFIG_QCOM_MEMORY_DUMP_V2) += memory_dump_v2.o -obj-$(CONFIG_QCOM_WATCHDOG_V2) += watchdog_v2.o +obj-$(CONFIG_QCOM_WATCHDOG_V2) += watchdog_v2.o oppo_watchdog_util.o obj-$(CONFIG_QPNP_PBS) += qpnp-pbs.o obj-$(CONFIG_ICNSS) += icnss.o obj-$(CONFIG_ICNSS_QMI) += icnss_qmi.o wlan_firmware_service_v01.o @@ -90,14 +90,23 @@ obj-$(CONFIG_QCOM_QDSS_BRIDGE) += qdss_bridge.o obj-$(CONFIG_MSM_QBT1000) += qbt1000.o obj-$(CONFIG_MSM_EVENT_TIMER) += event_timer.o obj-$(CONFIG_MSM_IDLE_STATS) += lpm-stats.o -obj-$(CONFIG_QTI_RPM_STATS_LOG) += rpm_stats.o + obj-$(CONFIG_QCOM_FSA4480_I2C) += fsa4480-i2c.o -ifdef CONFIG_QTI_RPMH_API - obj-$(CONFIG_QTI_RPM_STATS_LOG) += rpmh_master_stat.o -endif -ifdef CONFIG_MSM_RPM_SMD - obj-$(CONFIG_QTI_RPM_STATS_LOG) += rpm_master_stat.o -endif + +#ifdef OPLUS_FEATURE_POWERINFO_RPMH +#Nanwei.Deng@BSP.POWER.Basic 2010/10/15 for rpm debug +obj-$(CONFIG_QTI_RPMH_API) += rpm_stats.o +obj-$(CONFIG_QTI_RPMH_API) += rpmh_master_stat.o +#else +# obj-$(CONFIG_QTI_RPM_STATS_LOG) += rpm_stats.o +# ifdef CONFIG_QTI_RPMH_API +# obj-$(CONFIG_QTI_RPM_STATS_LOG) += rpmh_master_stat.o +# endif +# ifdef CONFIG_MSM_RPM_SMD +# obj-$(CONFIG_QTI_RPM_STATS_LOG) += rpm_master_stat.o +# endif +#endif + obj-$(CONFIG_QMP_DEBUGFS_CLIENT) += qmp-debugfs-client.o obj-$(CONFIG_MSM_BGCOM) += bgcom_spi.o obj-$(CONFIG_MSM_BGCOM_INTERFACE) += bgcom_interface.o @@ -115,6 +124,10 @@ obj-$(CONFIG_MSM_HAB) += hab/ obj-$(CONFIG_QCOM_HGSL) += hgsl/ obj-$(CONFIG_QCOM_HYP_CORE_CTL) += hyp_core_ctl.o obj-$(CONFIG_QCOM_AOP_DDRSS_COMMANDS) += aop_ddrss_cmds.o +#ifdef OPLUS_ARCH_EXTENDS +#Richeng.Wang@MULTIMEDIA.AUDIODRIVER.HEADSETS, 2020/10/11, Add for max20328 +obj-$(CONFIG_QCOM_MAX20328_I2C) += max20328.o +#endif obj-$(CONFIG_RMNET_CTL) += rmnet_ctl/ obj-$(CONFIG_QCOM_ADSP_MANUAL_VOTE) += adsp_vote_qmi.o adsp_lpm_voting_v01.o obj-$(CONFIG_CPU_V7) += idle-v7.o diff --git a/drivers/soc/qcom/crypto-qti-common.c b/drivers/soc/qcom/crypto-qti-common.c index 28562ced5f0e..c8e419ebef0d 100644 --- a/drivers/soc/qcom/crypto-qti-common.c +++ b/drivers/soc/qcom/crypto-qti-common.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2020, Linux Foundation. All rights reserved. + * Copyright (C) 2021 Oplus. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -421,7 +422,6 @@ int crypto_qti_keyslot_program(void *priv_data, return err1; } - int crypto_qti_keyslot_evict(void *priv_data, unsigned int slot) { int err = 0; diff --git a/drivers/soc/qcom/fsa4480-i2c.c b/drivers/soc/qcom/fsa4480-i2c.c index cddb520ac4cf..33791e9d1c9f 100644 --- a/drivers/soc/qcom/fsa4480-i2c.c +++ b/drivers/soc/qcom/fsa4480-i2c.c @@ -341,7 +341,12 @@ static void fsa4480_usbc_analog_work_fn(struct work_struct *work) { struct fsa4480_priv *fsa_priv = container_of(work, struct fsa4480_priv, usbc_analog_work); - + #ifdef OPLUS_FEATURE_DP_MAX20328 + /* xiang.fei@PSW.MM.AudioDriver.HeadsetDet, 2019/07/13, Add for max20328 */ + #ifdef CONFIG_QCOM_MAX20328_I2C + return; + #endif + #endif /* OPLUS_FEATURE_DP_MAX20328 */ if (!fsa_priv) { pr_err("%s: fsa container invalid\n", __func__); return; diff --git a/drivers/soc/qcom/minidump_log.c b/drivers/soc/qcom/minidump_log.c index 7c98200f6030..556ede9c7559 100644 --- a/drivers/soc/qcom/minidump_log.c +++ b/drivers/soc/qcom/minidump_log.c @@ -22,6 +22,9 @@ #include #include #include +#ifdef CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE +#include +#endif static void __init register_log_buf(void) { @@ -168,6 +171,10 @@ static int __init do_msm_minidump_log_init(void) { register_kernel_sections(); register_log_buf(); +#ifdef CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE +//yixue.ge@bsp.drv add for dump cpu contex for minidump + register_cpu_contex(); +#endif /* CONFIG_OPLUS_FEATURE_QCOM_MINIDUMP_ENHANCE */ return 0; } diff --git a/drivers/soc/qcom/peripheral-loader.c b/drivers/soc/qcom/peripheral-loader.c index fc7d91dcf537..d9c7f14bc0ae 100644 --- a/drivers/soc/qcom/peripheral-loader.c +++ b/drivers/soc/qcom/peripheral-loader.c @@ -44,6 +44,11 @@ #define CREATE_TRACE_POINTS #include +#ifdef OPLUS_FEATURE_SSR +//Yongpei.Yao@MULTIMEDIA.AUDIODRIVER.SSR, 2020/04/01, Add for adsp/venus SSR dump +#include +#endif /* OPLUS_FEATURE_SSR */ + #include "peripheral-loader.h" #define pil_err(desc, fmt, ...) \ @@ -473,6 +478,57 @@ static void print_aux_minidump_tocs(struct pil_desc *desc) } #endif +#ifdef OPLUS_FEATURE_SSR +//Yongpei.Yao@MULTIMEDIA.AUDIODRIVER.SSR, 2020/04/01, Add for adsp/venus SSR dump +#define CAUSENAME_SIZE 128 +unsigned int BKDRHash(char* str, unsigned int len) +{ + unsigned int seed = 131; /* 31 131 1313 13131 131313 etc.. */ + unsigned int hash = 0; + unsigned int i = 0; + + if (str == NULL) { + return 0; + } + + for(i = 0; i < len; str++, i++) { + hash = (hash * seed) + (*str); + } + + return hash; +} +#endif /*OPLUS_FEATURE_SSR*/ + +#ifdef OPLUS_FEATURE_SSR +//Liu.Wei@NETWORK.RF.10384, 2020/08/03, Add for report adsp crash info +void __adsp_send_uevent(struct device *dev, char *reason) +{ + int ret_val; + char adsp_event[] = "ADSP_EVENT=adsp_crash"; + char adsp_reason[300] = {0}; + char *envp[3]; + + envp[0] = (char *)&adsp_event; + if(reason){ + snprintf(adsp_reason, sizeof(adsp_reason),"ADSP_REASON=%s", reason); + }else{ + snprintf(adsp_reason, sizeof(adsp_reason),"ADSP_REASON=unkown"); + } + adsp_reason[299] = 0; + envp[1] = (char *)&adsp_reason; + envp[2] = 0; + + if(dev){ + ret_val = kobject_uevent_env(&(dev->kobj), KOBJ_CHANGE, envp); + if(!ret_val){ + pr_info("adsp_crash:kobject_uevent_env success!\n"); + }else{ + pr_info("adsp_crash:kobject_uevent_env fail,error=%d!\n", ret_val); + } + } +} +#endif /*OPLUS_FEATURE_SSR*/ + /** * pil_do_ramdump() - Ramdump an image * @desc: descriptor from pil_desc_init() @@ -489,17 +545,33 @@ int pil_do_ramdump(struct pil_desc *desc, struct pil_seg *seg; int count = 0, ret; +#ifdef OPLUS_FEATURE_SSR +//Yongpei.Yao@MULTIMEDIA.AUDIODRIVER.SSR, 2020/04/01, Add for adsp/venus SSR dump + unsigned char payload[100] = ""; + unsigned int hashid; + char strHashSource[CAUSENAME_SIZE]; +#endif /*OPLUS_FEATURE_SSR*/ + #ifdef CONFIG_QCOM_MINIDUMP if (desc->minidump_ss) { - pr_debug("Minidump : md_ss_toc->md_ss_toc_init is 0x%x\n", +#ifdef OPLUS_FEATURE_MODEM_MINIDUMP + //MaiWentian@NETWORK.RF,1213568, 2018/01/05,Add for customized subsystem ramdump to skip generate dump cause by SAU + if (SKIP_GENERATE_RAMDUMP) { + pil_err(desc, "%s: Skip ramdump cuase by ap normal trigger.\n %s", + __func__, desc->name); + SKIP_GENERATE_RAMDUMP = false; + return -1; + } +#endif + pr_info("Minidump : md_ss_toc->md_ss_toc_init is 0x%x\n", (unsigned int)desc->minidump_ss->md_ss_toc_init); - pr_debug("Minidump : md_ss_toc->md_ss_enable_status is 0x%x\n", + pr_info("Minidump : md_ss_toc->md_ss_enable_status is 0x%x\n", (unsigned int)desc->minidump_ss->md_ss_enable_status); - pr_debug("Minidump : md_ss_toc->encryption_status is 0x%x\n", + pr_info("Minidump : md_ss_toc->encryption_status is 0x%x\n", (unsigned int)desc->minidump_ss->encryption_status); - pr_debug("Minidump : md_ss_toc->ss_region_count is 0x%x\n", + pr_info("Minidump : md_ss_toc->ss_region_count is 0x%x\n", (unsigned int)desc->minidump_ss->ss_region_count); - pr_debug("Minidump : md_ss_toc->md_ss_smem_regions_baseptr is 0x%x\n", + pr_info("Minidump : md_ss_toc->md_ss_smem_regions_baseptr is 0x%x\n", (unsigned int) desc->minidump_ss->md_ss_smem_regions_baseptr); @@ -516,12 +588,19 @@ int pil_do_ramdump(struct pil_desc *desc, (desc->minidump_ss->md_ss_toc_init == true) && (desc->minidump_ss->md_ss_enable_status == MD_SS_ENABLED)) { + #ifndef OPLUS_FEATURE_MODEM_MINIDUMP + //MaiWentian@NETWORK.RF,1213568, 2018/01/05,Modify for skip mini dump encryption if (desc->minidump_ss->encryption_status == MD_SS_ENCR_DONE) { - pr_debug("Dumping Minidump for %s\n", + pr_info("Dumping Minidump for %s\n", desc->name); return pil_do_minidump(desc, minidump_dev); } + #else + pr_info("Minidump : Dumping for %s\n", + desc->name); + return pil_do_minidump(desc, minidump_dev); + #endif pr_debug("Minidump aborted for %s\n", desc->name); return -EINVAL; } @@ -553,6 +632,31 @@ int pil_do_ramdump(struct pil_desc *desc, pil_err(desc, "%s: Ramdump collection failed for subsys %s rc:%d\n", __func__, desc->name, ret); +#ifdef OPLUS_FEATURE_SSR +//lijiang@MULTIMEDIA.AUDIODRIVER.FEATURE, 2020/08/19, Add for adsp/venus SSR dump + if(strlen(desc->name) > 0 && (strncmp(desc->name,"venus",strlen(desc->name)) == 0)) { + strncpy(strHashSource,desc->name,strlen(desc->name)); + hashid = BKDRHash(strHashSource,strlen(strHashSource)); + scnprintf(payload, sizeof(payload), "NULL$$EventID@@%d$$EventData@@%d$$PackageName@@%s$$fid@@%u", + OPPO_MM_DIRVER_FB_EVENT_ID_VIDEO_DUMP, ret, desc->name, hashid); +#if 0 + upload_mm_kevent_feedback_data(OPPO_MM_DIRVER_FB_EVENT_MODULE_VIDEO,payload); +#endif + } else if(strlen(desc->name) > 0 && (strncmp(desc->name,"adsp",strlen(desc->name)) == 0)) { + strncpy(strHashSource,desc->name,strlen(desc->name)); + hashid = BKDRHash(strHashSource,strlen(strHashSource)); + scnprintf(payload, sizeof(payload), "NULL$$EventID@@%d$$EventData@@%d$$PackageName@@%s$$fid@@%u", + OPPO_MM_DIRVER_FB_EVENT_ID_ADSP_RESET, ret, desc->name, hashid); +#if 0 + upload_mm_kevent_feedback_data(OPPO_MM_DIRVER_FB_EVENT_MODULE_AUDIO,payload); +#endif + //Liu.Wei@NETWORK.RF.10384, 2020/08/03, Add for report adsp crash info + if(desc->dev){ + __adsp_send_uevent(desc->dev, payload); + } + } +#endif /* OPLUS_FEATURE_SSR */ + if (desc->subsys_vmid > 0) ret = pil_assign_mem_to_subsys(desc, priv->region_start, (priv->region_end - priv->region_start)); diff --git a/drivers/soc/qcom/rpm_stats.c b/drivers/soc/qcom/rpm_stats.c index 1800b76ca653..4bf2bb1921e5 100644 --- a/drivers/soc/qcom/rpm_stats.c +++ b/drivers/soc/qcom/rpm_stats.c @@ -26,6 +26,11 @@ #define RPM_STATS_NUM_REC 2 #define MSM_ARCH_TIMER_FREQ 19200000 +#ifdef OPLUS_FEATURE_POWERINFO_RPMH +//Nanwei.Deng@BSP.Power.Basic 2018/06/11 add for get rpm_stats +void __iomem *rpm_phys_addr = NULL; +#endif /* OPLUS_FEATURE_POWERINFO_RPMH */ + #define GET_PDATA_OF_ATTR(attr) \ (container_of(attr, struct msm_rpmstats_kobj_attr, ka)->pd) @@ -77,7 +82,8 @@ static inline u64 get_time_in_sec(u64 counter) return counter; } - +#ifndef OPLUS_FEATURE_POWERINFO_RPMH +//yunqing.zeng@bsp.power.basic 20190702 Modify for log info more accurate static inline u64 get_time_in_msec(u64 counter) { do_div(counter, MSM_ARCH_TIMER_FREQ); @@ -85,6 +91,13 @@ static inline u64 get_time_in_msec(u64 counter) return counter; } +#else +static inline u64 get_time_in_msec(u64 counter) +{ + do_div(counter, (MSM_ARCH_TIMER_FREQ/MSEC_PER_SEC)); + return counter; +} +#endif /* OPLUS_FEATURE_POWERINFO_RPMH */ static inline int msm_rpmstats_append_data_to_buf(char *buf, struct msm_rpm_stats_data *data, int buflength) @@ -130,6 +143,28 @@ static inline int msm_rpmstats_append_data_to_buf(char *buf, #endif } +#ifdef OPLUS_FEATURE_POWERINFO_RPMH +//Nanwei.Deng@BSP.Power.Basic 2018/06/11 add for get rpm_stats +static inline int oplus_rpmstats_append_data_to_buf(char *buf, + struct msm_rpm_stats_data *data, int buflength,int i) +{ + u64 actual_last_sleep; + + actual_last_sleep = get_time_in_msec(data->accumulated); + if(i == 0) { + //vddlow: aosd: AOSS deep sleep + return snprintf(buf, buflength, + "vlow:%x:%llx\n", + data->count, actual_last_sleep); + } else { + //vddmin: cxsd: cx collapse + return snprintf(buf, buflength, + "vmin:%x:%llx\r\n", + data->count, actual_last_sleep); + } +} +#endif /* OPLUS_FEATURE_POWERINFO_RPMH */ + static inline u32 msm_rpmstats_read_long_register(void __iomem *regbase, int index, int offset) { @@ -185,6 +220,34 @@ static inline int msm_rpmstats_copy_stats( return length; } + +#ifdef OPLUS_FEATURE_POWERINFO_RPMH +//Nanwei.Deng@BSP.Power.Basic 2018/06/11 add for get rpm_stats +static inline int oplus_rpmstats_copy_stats( + struct msm_rpmstats_private_data *prvdata) +{ + void __iomem *reg; + struct msm_rpm_stats_data data; + int i, length; + + reg = prvdata->reg_base; + + for (i = 0, length = 0; i < prvdata->num_records; i++) { + data.count = msm_rpmstats_read_long_register(reg, i, + offsetof(struct msm_rpm_stats_data, count)); + data.accumulated = msm_rpmstats_read_quad_register(reg, + i, offsetof(struct msm_rpm_stats_data, + accumulated)); + + length += oplus_rpmstats_append_data_to_buf(prvdata->buf + length, + &data, sizeof(prvdata->buf) - length,i); + prvdata->read_idx++; + } + + return length; +} +#endif /* OPLUS_FEATURE_POWERINFO_RPMH */ + static ssize_t msm_rpmstats_populate_stats(void) { struct msm_rpmstats_private_data prvdata; @@ -247,6 +310,33 @@ static ssize_t rpmstats_show(struct kobject *kobj, iounmap(prvdata.reg_base); return length; } +#ifdef OPLUS_FEATURE_POWERINFO_RPMH +//Nanwei.Deng@BSP.Power.Basic 2018/06/11 add for get rpm_stats +static ssize_t oplus_rpmstats_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct msm_rpmstats_private_data prvdata; + struct msm_rpmstats_platform_data *pdata = NULL; + + if (rpm_phys_addr == NULL) + { + return 0; + } + pdata = GET_PDATA_OF_ATTR(attr); + prvdata.reg_base =rpm_phys_addr; + + + prvdata.read_idx = prvdata.len = 0; + prvdata.platform_data = pdata; + prvdata.num_records = RPM_STATS_NUM_REC; + + if (prvdata.read_idx < prvdata.num_records) + prvdata.len = oplus_rpmstats_copy_stats(&prvdata); + + return snprintf(buf, prvdata.len, "%s", prvdata.buf); +} + +#endif /* OPLUS_FEATURE_POWERINFO_RPMH */ static int msm_rpmstats_create_sysfs(struct platform_device *pdev, struct msm_rpmstats_platform_data *pd) @@ -254,6 +344,10 @@ static int msm_rpmstats_create_sysfs(struct platform_device *pdev, struct kobject *rpmstats_kobj = NULL; struct msm_rpmstats_kobj_attr *rpms_ka = NULL; int ret = 0; +#ifdef OPLUS_FEATURE_POWERINFO_RPMH +//Nanwei.Deng@BSP.Power.Basic 2018/05/23 add for get /sys/power/system_sleep/oppo_rpmh_stats + struct msm_rpmstats_kobj_attr * oplus_rpms_ka = NULL; +#endif /* OPLUS_FEATURE_POWERINFO_RPMH */ rpmstats_kobj = kobject_create_and_add("system_sleep", power_kobj); if (!rpmstats_kobj) { @@ -280,6 +374,24 @@ static int msm_rpmstats_create_sysfs(struct platform_device *pdev, ret = sysfs_create_file(rpmstats_kobj, &rpms_ka->ka.attr); platform_set_drvdata(pdev, rpms_ka); +#ifdef OPLUS_FEATURE_POWERINFO_RPMH +//Nanwei.Deng@BSP.Power.Basic 2018/05/23 add for get /sys/power/system_sleep/oppo_rpmh_stats + oplus_rpms_ka = kzalloc(sizeof(* oplus_rpms_ka), GFP_KERNEL); + if (! oplus_rpms_ka) { + kobject_put(rpmstats_kobj); + ret = -ENOMEM; + goto fail; + } + + sysfs_attr_init(& oplus_rpms_ka->ka.attr); + oplus_rpms_ka->pd = pd; + oplus_rpms_ka->ka.attr.mode = 0444; + oplus_rpms_ka->ka.attr.name = "oplus_rpmh_stats"; + oplus_rpms_ka->ka.show = oplus_rpmstats_show; + oplus_rpms_ka->ka.store = NULL; + + ret = sysfs_create_file(rpmstats_kobj, & oplus_rpms_ka->ka.attr); +#endif /* OPLUS_FEATURE_POWERINFO_RPMH */ fail: return ret; @@ -325,6 +437,17 @@ static int msm_rpmstats_probe(struct platform_device *pdev) msm_rpmstats_create_sysfs(pdev, pdata); gpdata = pdata; +#ifdef OPLUS_FEATURE_POWERINFO_RPMH + //Nanwei.Deng@BSP.Power.Basic 2018/05/23 add for get /sys/power/system_sleep/ oplus_rpmh_stats + rpm_phys_addr= ioremap_nocache(pdata->phys_addr_base, + pdata->phys_size); + if (!rpm_phys_addr) { + pr_err("%s: ERROR could not ioremap start=%pa, len=%u\n", + __func__, &pdata->phys_addr_base, + pdata->phys_size); + return -ENODEV; + } +#endif /* OPLUS_FEATURE_POWERINFO_RPMH */ return 0; } diff --git a/drivers/soc/qcom/rpmh_master_stat.c b/drivers/soc/qcom/rpmh_master_stat.c index 07839e13b311..00e1bed92bd7 100644 --- a/drivers/soc/qcom/rpmh_master_stat.c +++ b/drivers/soc/qcom/rpmh_master_stat.c @@ -95,6 +95,11 @@ struct msm_rpmh_profile_unit { struct rpmh_master_stats_prv_data { struct kobj_attribute ka; struct kobject *kobj; +#ifdef OPLUS_FEATURE_POWERINFO_RPMH +//Nanwei.Deng@BSP.Power.Basic 2018/06/11 add for get rpm_stats. + struct kobj_attribute opluska; + struct kobject * opluskobj; +#endif /* OPLUS_FEATURE_POWERINFO_RPMH */ }; static struct msm_rpmh_master_stats apss_master_stats; @@ -102,6 +107,39 @@ static void __iomem *rpmh_unit_base; static DEFINE_MUTEX(rpmh_stats_mutex); +#ifdef OPLUS_FEATURE_POWERINFO_RPMH +//Nanwei.Deng@BSP.Power.Basic 2018/06/11 add for get rpm_stats. +static DEFINE_MUTEX( oplus_rpmh_stats_mutex); + +#define MSM_ARCH_TIMER_FREQ 19200000 +static inline u64 get_time_in_msec(u64 counter) +{ + do_div(counter, (MSM_ARCH_TIMER_FREQ/MSEC_PER_SEC)); + return counter; +} +static ssize_t oplus_rpmh_master_stats_print_data(char *prvbuf, ssize_t length, + struct msm_rpmh_master_stats *record, + const char *name) +{ + uint64_t accumulated_duration = record->accumulated_duration; + /* + * If a master is in sleep when reading the sleep stats from SMEM + * adjust the accumulated sleep duration to show actual sleep time. + * This ensures that the displayed stats are real when used for + * the purpose of computing battery utilization. + */ + if (record->last_entered > record->last_exited) + accumulated_duration += + (arch_counter_get_cntvct() + - record->last_entered); + + return snprintf(prvbuf, length, "%s:%x:%llx\n", + name,record->counts, + get_time_in_msec(accumulated_duration)); +} +#endif /* OPLUS_FEATURE_POWERINFO_RPMH */ + + static ssize_t msm_rpmh_master_stats_print_data(char *prvbuf, ssize_t length, struct msm_rpmh_master_stats *record, const char *name) @@ -117,7 +155,8 @@ static ssize_t msm_rpmh_master_stats_print_data(char *prvbuf, ssize_t length, accumulated_duration += (arch_counter_get_cntvct() - record->last_entered); - +#ifndef OPLUS_FEATURE_POWERINFO_RPMH +//yunqing.zeng@bsp.power.basic 2019-06-23 modify for rpmh master info output return snprintf(prvbuf, length, "%s\n\tVersion:0x%x\n" "\tSleep Count:0x%x\n" "\tSleep Last Entered At:0x%llx\n" @@ -126,6 +165,18 @@ static ssize_t msm_rpmh_master_stats_print_data(char *prvbuf, ssize_t length, name, record->version_id, record->counts, record->last_entered, record->last_exited, accumulated_duration); +#else + return snprintf(prvbuf, length, "%s\n\tVersion:0x%x\n" + "\tSleep Count:0x%x\n" + "\tSleep Last Entered At:0x%llx\n" + "\tSleep Last Exited At:0x%llx\n" + "\tSleep Accumulated Duration:0x%llx\n" + "\tSleep Accumulated Duration(mS):0x%llx\n" + "\tSleep Accumulated Duration(mS):%llu\n\n", + name, record->version_id, record->counts, + record->last_entered, record->last_exited, + accumulated_duration, get_time_in_msec(accumulated_duration), get_time_in_msec(accumulated_duration)); +#endif /* OPLUS_FEATURE_POWERINFO_RPMH */ } static ssize_t msm_rpmh_master_stats_show(struct kobject *kobj, @@ -160,6 +211,46 @@ static ssize_t msm_rpmh_master_stats_show(struct kobject *kobj, return length; } +#ifdef OPLUS_FEATURE_POWERINFO_RPMH +//Nanwei.Deng@BSP.Power.Basic 2018/06/11 add for get rpm_stats +static ssize_t oplus_rpmh_master_stats_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + ssize_t length = 0; + int i = 0; + size_t size = 0; + struct msm_rpmh_master_stats *record = NULL; + + mutex_lock(& oplus_rpmh_stats_mutex); + + /* First Read APSS master stats */ + + length = oplus_rpmh_master_stats_print_data(buf, PAGE_SIZE, + &apss_master_stats, "APSS"); + + /* + * Read SMEM data written by masters + */ + + + + for (i = 0; i < ARRAY_SIZE(rpmh_masters); i++) { + record = (struct msm_rpmh_master_stats *) qcom_smem_get( + rpmh_masters[i].pid, + rpmh_masters[i].smem_id, &size); + if (!IS_ERR_OR_NULL(record) && (PAGE_SIZE - length > 0)) + length += oplus_rpmh_master_stats_print_data( + buf + length, PAGE_SIZE - length, + record, + rpmh_masters[i].master_name); + } + + mutex_unlock(&oplus_rpmh_stats_mutex); + + return length; +} +#endif /* OPLUS_FEATURE_POWERINFO_RPMH */ + static inline void msm_rpmh_apss_master_stats_update( struct msm_rpmh_profile_unit *profile_unit) { @@ -235,6 +326,23 @@ static int msm_rpmh_master_stats_probe(struct platform_device *pdev) goto fail_sysfs; } +#ifdef OPLUS_FEATURE_POWERINFO_RPMH +//Nanwei.Deng@BSP.Power.Basic 2018/06/11 add for get rpm_stats + prvdata->opluskobj = rpmh_master_stats_kobj; + + sysfs_attr_init(&prvdata-> opluska.attr); + prvdata->opluska.attr.mode = 0444; + prvdata->opluska.attr.name = "oplus_rpmh_master_stats"; + prvdata->opluska.show = oplus_rpmh_master_stats_show; + prvdata->opluska.store = NULL; + + ret = sysfs_create_file(prvdata->opluskobj, &prvdata->opluska.attr); + if (ret) { + pr_err("sysfs_create_file oppo failed\n"); + goto fail_sysfs_oplus; + } +#endif /* OPLUS_FEATURE_POWERINFO_RPMH */ + rpmh_unit_base = of_iomap(pdev->dev.of_node, 0); if (!rpmh_unit_base) { pr_err("Failed to get rpmh_unit_base\n"); @@ -247,6 +355,11 @@ static int msm_rpmh_master_stats_probe(struct platform_device *pdev) return ret; fail_iomap: +#ifdef OPLUS_FEATURE_POWERINFO_RPMH +//Nanwei.Deng@BSP.Power.Basic 2018/05/23 add for get sys/power/oppo/rpm_stats + sysfs_remove_file(prvdata->opluskobj, &prvdata->opluska.attr); +fail_sysfs_oplus: +#endif /* OPLUS_FEATURE_POWERINFO_RPMH */ sysfs_remove_file(prvdata->kobj, &prvdata->ka.attr); fail_sysfs: kobject_put(prvdata->kobj); @@ -262,7 +375,10 @@ static int msm_rpmh_master_stats_remove(struct platform_device *pdev) prvdata = (struct rpmh_master_stats_prv_data *) platform_get_drvdata(pdev); - +#ifdef OPLUS_FEATURE_POWERINFO_RPMH +//SunFaliang@BSP.Power.Basic 2020/05/26 add for fix unappropriately release logic. + sysfs_remove_file(prvdata->opluskobj, &prvdata->opluska.attr); +#endif /* OPLUS_FEATURE_POWERINFO_RPMH */ sysfs_remove_file(prvdata->kobj, &prvdata->ka.attr); kobject_put(prvdata->kobj); platform_set_drvdata(pdev, NULL); diff --git a/drivers/soc/qcom/rpmh_master_stat.h b/drivers/soc/qcom/rpmh_master_stat.h index c3fe7dcff97d..5d070f86ef5b 100644 --- a/drivers/soc/qcom/rpmh_master_stat.h +++ b/drivers/soc/qcom/rpmh_master_stat.h @@ -11,11 +11,10 @@ * GNU General Public License for more details. * */ - -#if defined(CONFIG_QTI_RPMH_API) && defined(CONFIG_QTI_RPM_STATS_LOG) - +/*#if defined(CONFIG_QTI_RPMH_API) && defined(CONFIG_QTI_RPM_STATS_LOG) */ +#if defined(CONFIG_QTI_RPMH_API) && defined(OPLUS_FEATURE_POWERINFO_RPMH) +/* 2010/10/15 for rpm debug */ void msm_rpmh_master_stats_update(void); - #else static inline void msm_rpmh_master_stats_update(void) {} diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index 72117972b7e5..796263ad4d41 100644 --- a/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c @@ -22,6 +22,14 @@ #include #include +//Yong.Qian@bsp.kernel.stability, 2020/5/14, Add for dump reason +#ifdef OPLUS_FEATURE_AGINGTEST +#include +#include + +#define SMEM_DUMP_INFO 129 +#endif /*OPLUS_FEATURE_AGINGTEST*/ + /* * The Qualcomm shared memory system is a allocate only heap structure that * consists of one of more memory areas that can be accessed by the processors @@ -202,6 +210,20 @@ struct smem_partition_header { __le32 reserved[3]; }; +/** + * struct smem_partition_desc - descriptor for partition + * @virt_base: starting virtual address of partition + * @phys_base: starting physical address of partition + * @cacheline: alignment for "cached" entries + * @size: size of partition + */ +struct smem_partition_desc { + void __iomem *virt_base; + u32 phys_base; + u32 cacheline; + u32 size; +}; + static const u8 SMEM_PART_MAGIC[] = { 0x24, 0x50, 0x52, 0x54 }; /** @@ -257,9 +279,9 @@ struct smem_region { * struct qcom_smem - device data for the smem device * @dev: device pointer * @hwlock: reference to a hwspinlock - * @global_partition_entry: pointer to global partition entry when in use - * @ptable_entries: list of pointers to partitions table entry of current - * processor/host + * @ptable_base: virtual base of partition table + * @global_partition_desc: descriptor for global partition when in use + * @partition_desc: list of partition descriptor of current processor/host * @item_count: max accepted item number * @num_regions: number of @regions * @regions: list of the memory regions defining the shared memory @@ -269,9 +291,10 @@ struct qcom_smem { struct hwspinlock *hwlock; - struct smem_ptable_entry *global_partition_entry; - struct smem_ptable_entry *ptable_entries[SMEM_HOST_COUNT]; u32 item_count; + struct smem_ptable __iomem *ptable_base; + struct smem_partition_desc global_partition_desc; + struct smem_partition_desc partition_desc[SMEM_HOST_COUNT]; unsigned num_regions; struct smem_region regions[0]; @@ -286,12 +309,6 @@ static u32 smem_host_id = SMEM_HOST_APPS; /* Timeout (ms) for the trylock of remote spinlocks */ #define HWSPINLOCK_TIMEOUT 1000 -static struct smem_partition_header * -ptable_entry_to_phdr(struct smem_ptable_entry *entry) -{ - return __smem->regions[0].virt_base + le32_to_cpu(entry->offset); -} - static struct smem_private_entry * phdr_to_last_uncached_entry(struct smem_partition_header *phdr) { @@ -355,18 +372,18 @@ static void *cached_entry_to_item(struct smem_private_entry *e) } static int qcom_smem_alloc_private(struct qcom_smem *smem, - struct smem_ptable_entry *entry, + struct smem_partition_desc *p_desc, unsigned item, size_t size) { struct smem_private_entry *hdr, *end; - struct smem_partition_header *phdr; + struct smem_partition_header __iomem *phdr; size_t alloc_size; void *cached; - void *p_end; + void __iomem *p_end; - phdr = ptable_entry_to_phdr(entry); - p_end = (void *)phdr + le32_to_cpu(entry->size); + phdr = (struct smem_partition_header __iomem *)p_desc->virt_base; + p_end = (void __iomem *)phdr + p_desc->size; hdr = phdr_to_first_uncached_entry(phdr); end = phdr_to_last_uncached_entry(phdr); @@ -459,7 +476,7 @@ static int qcom_smem_alloc_global(struct qcom_smem *smem, */ int qcom_smem_alloc(unsigned host, unsigned item, size_t size) { - struct smem_ptable_entry *entry; + struct smem_partition_desc *p_desc; unsigned long flags; int ret; @@ -481,12 +498,12 @@ int qcom_smem_alloc(unsigned host, unsigned item, size_t size) if (ret) return ret; - if (host < SMEM_HOST_COUNT && __smem->ptable_entries[host]) { - entry = __smem->ptable_entries[host]; - ret = qcom_smem_alloc_private(__smem, entry, item, size); - } else if (__smem->global_partition_entry) { - entry = __smem->global_partition_entry; - ret = qcom_smem_alloc_private(__smem, entry, item, size); + if (host < SMEM_HOST_COUNT && __smem->partition_desc[host].virt_base) { + p_desc = &__smem->partition_desc[host]; + ret = qcom_smem_alloc_private(__smem, p_desc, item, size); + } else if (__smem->global_partition_desc.virt_base) { + p_desc = &__smem->global_partition_desc; + ret = qcom_smem_alloc_private(__smem, p_desc, item, size); } else { ret = qcom_smem_alloc_global(__smem, item, size); } @@ -537,22 +554,20 @@ static void *qcom_smem_get_global(struct qcom_smem *smem, } static void *qcom_smem_get_private(struct qcom_smem *smem, - struct smem_ptable_entry *entry, + struct smem_partition_desc *p_desc, unsigned item, size_t *size) { struct smem_private_entry *e, *end; - struct smem_partition_header *phdr; - void *item_ptr, *p_end; - u32 partition_size; + struct smem_partition_header __iomem *phdr; + void *item_ptr, __iomem *p_end; size_t cacheline; u32 padding_data; u32 e_size; - phdr = ptable_entry_to_phdr(entry); - partition_size = le32_to_cpu(entry->size); - p_end = (void *)phdr + partition_size; - cacheline = le32_to_cpu(entry->cacheline); + phdr = (struct smem_partition_header __iomem *)p_desc->virt_base; + p_end = (void __iomem *)phdr + p_desc->size; + cacheline = p_desc->cacheline; e = phdr_to_first_uncached_entry(phdr); end = phdr_to_last_uncached_entry(phdr); @@ -569,7 +584,7 @@ static void *qcom_smem_get_private(struct qcom_smem *smem, e_size = le32_to_cpu(e->size); padding_data = le16_to_cpu(e->padding_data); - if (e_size < partition_size + if (e_size < p_desc->size && padding_data < e_size) *size = e_size - padding_data; else @@ -605,7 +620,7 @@ static void *qcom_smem_get_private(struct qcom_smem *smem, e_size = le32_to_cpu(e->size); padding_data = le16_to_cpu(e->padding_data); - if (e_size < partition_size + if (e_size < p_desc->size && padding_data < e_size) *size = e_size - padding_data; else @@ -644,7 +659,7 @@ invalid_canary: */ void *qcom_smem_get(unsigned host, unsigned item, size_t *size) { - struct smem_ptable_entry *entry; + struct smem_partition_desc *p_desc; unsigned long flags; int ret; void *ptr = ERR_PTR(-EPROBE_DEFER); @@ -661,12 +676,13 @@ void *qcom_smem_get(unsigned host, unsigned item, size_t *size) if (ret) return ERR_PTR(ret); - if (host < SMEM_HOST_COUNT && __smem->ptable_entries[host]) { - entry = __smem->ptable_entries[host]; - ptr = qcom_smem_get_private(__smem, entry, item, size); - } else if (__smem->global_partition_entry) { - entry = __smem->global_partition_entry; - ptr = qcom_smem_get_private(__smem, entry, item, size); + + if (host < SMEM_HOST_COUNT && __smem->partition_desc[host].virt_base) { + p_desc = &__smem->partition_desc[host]; + ptr = qcom_smem_get_private(__smem, p_desc, item, size); + } else if (__smem->global_partition_desc.virt_base) { + p_desc = &__smem->global_partition_desc; + ptr = qcom_smem_get_private(__smem, p_desc, item, size); } else { ptr = qcom_smem_get_global(__smem, item, size); } @@ -687,31 +703,34 @@ EXPORT_SYMBOL(qcom_smem_get); */ int qcom_smem_get_free_space(unsigned host) { - struct smem_partition_header *phdr; - struct smem_ptable_entry *entry; - struct smem_header *header; - unsigned ret; + struct smem_partition_header __iomem *phdr; + struct smem_partition_desc *p_desc; + struct smem_header *header; + unsigned ret; if (!__smem) return -EPROBE_DEFER; - if (host < SMEM_HOST_COUNT && __smem->ptable_entries[host]) { - entry = __smem->ptable_entries[host]; - phdr = ptable_entry_to_phdr(entry); + + if (host < SMEM_HOST_COUNT && __smem->partition_desc[host].virt_base) { + p_desc = &__smem->partition_desc[host]; + phdr = (struct smem_partition_header __iomem *) + p_desc->virt_base; ret = le32_to_cpu(phdr->offset_free_cached) - le32_to_cpu(phdr->offset_free_uncached); - if (ret > le32_to_cpu(entry->size)) + if (ret > p_desc->size) return -EINVAL; - } else if (__smem->global_partition_entry) { - entry = __smem->global_partition_entry; - phdr = ptable_entry_to_phdr(entry); + } else if (__smem->global_partition_desc.virt_base) { + p_desc = &__smem->global_partition_desc; + phdr = (struct smem_partition_header __iomem *) + p_desc->virt_base; ret = le32_to_cpu(phdr->offset_free_cached) - le32_to_cpu(phdr->offset_free_uncached); - if (ret > le32_to_cpu(entry->size)) + if (ret > p_desc->size) return -EINVAL; } else { header = __smem->regions[0].virt_base; @@ -724,6 +743,17 @@ int qcom_smem_get_free_space(unsigned host) return ret; } EXPORT_SYMBOL(qcom_smem_get_free_space); + +static int addr_in_range(void __iomem *virt_base, unsigned int size, + void *addr) +{ + if (virt_base && addr >= virt_base && + addr < virt_base + size) + return 1; + + return 0; +} + /** * qcom_smem_virt_to_phys() - Convert SMEM address to physical address. @@ -732,26 +762,107 @@ EXPORT_SYMBOL(qcom_smem_get_free_space); * This function should only be used if an SMEM item needs to be handed off * to a DMA engine. */ -phys_addr_t qcom_smem_virt_to_phys(void *addr) +phys_addr_t qcom_smem_virt_to_phys(void *p) { - phys_addr_t phys_addr = 0; + struct smem_partition_desc *p_desc; struct smem_region *area; - void *end; - int i; + u64 offset; + u32 i; + + for (i = 0; i < SMEM_HOST_COUNT; i++) { + p_desc = &__smem->partition_desc[i]; - if (!__smem) - return phys_addr; + if (addr_in_range(p_desc->virt_base, p_desc->size, p)) { + offset = p - p_desc->virt_base; + + return (phys_addr_t)p_desc->phys_base + offset; + } + } + + p_desc = &__smem->global_partition_desc; + + if (addr_in_range(p_desc->virt_base, p_desc->size, p)) { + offset = p - p_desc->virt_base; + + return (phys_addr_t)p_desc->phys_base + offset; + } for (i = 0; i < __smem->num_regions; i++) { area = &__smem->regions[i]; - end = area->virt_base + area->size; - if (addr >= area->virt_base && addr < end) - phys_addr = addr - area->virt_base + area->aux_base; + + if (addr_in_range(area->virt_base, area->size, p)) { + offset = p - area->virt_base; + + return (phys_addr_t)area->aux_base + offset; + } } - return phys_addr; + return 0; } EXPORT_SYMBOL(qcom_smem_virt_to_phys); +//Yong.Qian@bsp.kernel.stability, 2020/5/14, Add for dump reason +#ifdef OPLUS_FEATURE_AGINGTEST +static char caller_function_name[KSYM_SYMBOL_LEN]; +char *parse_function_builtin_return_address(unsigned long function_address) +{ + char *cur = caller_function_name; + + if (!function_address) + return NULL; + + sprint_symbol(caller_function_name, function_address); + strsep(&cur, "+"); + + return caller_function_name; +} +EXPORT_SYMBOL(parse_function_builtin_return_address); + +void save_dump_reason_to_smem(char *reason, char *function_name) +{ + int reason_len = 0, name_len = 0; + int ret; + size_t size; + static int flag = 0; + struct dump_info *dp_info; + + if (flag) + return; + + size = sizeof(struct dump_info); + ret = qcom_smem_alloc(QCOM_SMEM_HOST_ANY, SMEM_DUMP_INFO, size); + if (ret < 0 && ret != -EEXIST) { + pr_err("%s:unable to allocate dp_info \n", __func__); + return; + } + + dp_info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_DUMP_INFO, &size); + if (IS_ERR_OR_NULL(dp_info)) + pr_err("%s: get dp_info failure\n", __func__); + else { + if (reason != NULL) { + pr_err("%s: info : %s\n",__func__, reason); + reason_len = strlen(reason); + reason_len = (reason_len < DUMP_REASON_SIZE)? reason_len:DUMP_REASON_SIZE; + if (((strlen(dp_info->dump_reason) + reason_len) < DUMP_REASON_SIZE)) { + strcat(dp_info->dump_reason, reason); + } + } + if (function_name != NULL) { + name_len = strlen(function_name); + name_len = (name_len < DUMP_REASON_SIZE)? name_len:DUMP_REASON_SIZE; + if (((strlen(dp_info->dump_reason) + name_len + 1) < DUMP_REASON_SIZE)) { + strcat(dp_info->dump_reason, ":"); + strcat(dp_info->dump_reason, function_name); + } + } + } + pr_err("\r%s: dump_reason : %s reason_len=%d function caused panic :%s name_len=%d \n", __func__, + (reason != NULL)?reason:"unknown", reason_len, (function_name != NULL)?function_name:"unknown", name_len); + /* Make sure save_dump_reason_to_smem() is called only once during subsystem crash */ + flag++; +} +EXPORT_SYMBOL(save_dump_reason_to_smem); +#endif /*OPLUS_FEATURE_AGINGTEST*/ static int qcom_smem_get_sbl_version(struct qcom_smem *smem) { @@ -764,12 +875,12 @@ static int qcom_smem_get_sbl_version(struct qcom_smem *smem) return le32_to_cpu(versions[SMEM_MASTER_SBL_VERSION_INDEX]); } -static struct smem_ptable *qcom_smem_get_ptable(struct qcom_smem *smem) +static struct smem_ptable __iomem *qcom_smem_get_ptable(struct qcom_smem *smem) { - struct smem_ptable *ptable; + struct smem_ptable __iomem *ptable; u32 version; - ptable = smem->regions[0].virt_base + smem->regions[0].size - SZ_4K; + ptable = smem->ptable_base; if (memcmp(ptable->magic, SMEM_PTABLE_MAGIC, sizeof(ptable->magic))) return NULL; @@ -800,12 +911,19 @@ static u32 qcom_smem_get_dynamic_item(struct qcom_smem *smem) static int qcom_smem_set_global_partition(struct qcom_smem *smem) { - struct smem_partition_header *header; - struct smem_ptable_entry *entry = NULL; - struct smem_ptable *ptable; + struct smem_partition_header __iomem *header; + struct smem_ptable_entry *entry; + struct smem_ptable __iomem *ptable; + u32 phys_addr; u32 host0, host1, size; + bool found = false; int i; + if (smem->global_partition_desc.virt_base) { + dev_err(smem->dev, "Already found the global partition\n"); + return -EINVAL; + } + ptable = qcom_smem_get_ptable(smem); if (IS_ERR_OR_NULL(ptable)) return -EINVAL; @@ -815,8 +933,10 @@ static int qcom_smem_set_global_partition(struct qcom_smem *smem) host0 = le16_to_cpu(entry->host0); host1 = le16_to_cpu(entry->host1); - if (host0 == SMEM_GLOBAL_HOST && host0 == host1) + if (host0 == SMEM_GLOBAL_HOST && host0 == host1) { + found = true; break; + } } if (!entry) { @@ -829,12 +949,12 @@ static int qcom_smem_set_global_partition(struct qcom_smem *smem) return -EINVAL; } - if (smem->global_partition_entry) { - dev_err(smem->dev, "Already found the global partition\n"); - return -EINVAL; - } + phys_addr = smem->regions[0].aux_base + le32_to_cpu(entry->offset); + header = (struct smem_partition_header __iomem *)devm_ioremap_wc + (smem->dev, phys_addr, le32_to_cpu(entry->size)); + if (!header) + return -ENOMEM; - header = smem->regions[0].virt_base + le32_to_cpu(entry->offset); host0 = le16_to_cpu(header->host0); host1 = le16_to_cpu(header->host1); @@ -860,7 +980,10 @@ static int qcom_smem_set_global_partition(struct qcom_smem *smem) return -EINVAL; } - smem->global_partition_entry = entry; + smem->global_partition_desc.virt_base = (void __iomem *)header; + smem->global_partition_desc.phys_base = phys_addr; + smem->global_partition_desc.size = le32_to_cpu(entry->size); + smem->global_partition_desc.cacheline = le32_to_cpu(entry->cacheline); return 0; } @@ -868,9 +991,10 @@ static int qcom_smem_set_global_partition(struct qcom_smem *smem) static int qcom_smem_enumerate_partitions(struct qcom_smem *smem, unsigned int local_host) { - struct smem_partition_header *header; + struct smem_partition_header __iomem *header; struct smem_ptable_entry *entry; - struct smem_ptable *ptable; + struct smem_ptable __iomem *ptable; + u32 phys_addr; unsigned int remote_host; u32 host0, host1; int i; @@ -905,14 +1029,21 @@ static int qcom_smem_enumerate_partitions(struct qcom_smem *smem, return -EINVAL; } - if (smem->ptable_entries[remote_host]) { + if (smem->partition_desc[remote_host].virt_base) { dev_err(smem->dev, "Already found a partition for host %d\n", remote_host); return -EINVAL; } - header = smem->regions[0].virt_base + le32_to_cpu(entry->offset); + phys_addr = smem->regions[0].aux_base + + le32_to_cpu(entry->offset); + header = (struct smem_partition_header __iomem *)devm_ioremap_wc + (smem->dev, phys_addr, + le32_to_cpu(entry->size)); + if (!header) + return -ENOMEM; + host0 = le16_to_cpu(header->host0); host1 = le16_to_cpu(header->host1); @@ -947,7 +1078,13 @@ static int qcom_smem_enumerate_partitions(struct qcom_smem *smem, return -EINVAL; } - smem->ptable_entries[remote_host] = entry; + smem->partition_desc[remote_host].virt_base = + (void __iomem *)header; + smem->partition_desc[remote_host].phys_base = phys_addr; + smem->partition_desc[remote_host].size = + le32_to_cpu(entry->size); + smem->partition_desc[remote_host].cacheline = + le32_to_cpu(entry->cacheline); } return 0; @@ -979,6 +1116,62 @@ static int qcom_smem_map_memory(struct qcom_smem *smem, struct device *dev, return 0; } + +static int qcom_smem_map_toc(struct qcom_smem *smem, struct device *dev, + const char *name, int i) +{ + struct device_node *np; + struct resource r; + int ret; + + np = of_parse_phandle(dev->of_node, name, 0); + if (!np) { + dev_err(dev, "No %s specified\n", name); + return -EINVAL; + } + + ret = of_address_to_resource(np, 0, &r); + of_node_put(np); + if (ret) + return ret; + + smem->regions[i].aux_base = (u32)r.start; + smem->regions[i].size = resource_size(&r); + /* map starting 4K for smem header */ + smem->regions[i].virt_base = devm_ioremap_wc(dev, r.start, SZ_4K); + /* map last 4k for toc */ + smem->ptable_base = (struct smem_ptable __iomem *)devm_ioremap_wc(dev, + r.start + resource_size(&r) - SZ_4K, SZ_4K); + + if (!smem->regions[i].virt_base || !smem->ptable_base) + return -ENOMEM; + + return 0; +} + +static int qcom_smem_mamp_legacy(struct qcom_smem *smem) +{ + struct smem_header __iomem *header; + u32 phys_addr; + u32 p_size; + + phys_addr = smem->regions[0].aux_base; + header = (struct smem_header __iomem *)smem->regions[0].virt_base; + p_size = readl_relaxed(&header->available); + + /* unmap previously mapped starting 4k for smem header */ + devm_iounmap(smem->dev, smem->regions[0].virt_base); + + smem->regions[0].size = p_size; + smem->regions[0].virt_base = devm_ioremap_wc(smem->dev, + phys_addr, p_size); + + if (!smem->regions[0].virt_base) + return -ENOMEM; + + return 0; +} + static int qcom_smem_probe(struct platform_device *pdev) { @@ -1003,7 +1196,7 @@ static int qcom_smem_probe(struct platform_device *pdev) smem->dev = &pdev->dev; smem->num_regions = num_regions; - ret = qcom_smem_map_memory(smem, &pdev->dev, "memory-region", 0); + ret = qcom_smem_map_toc(smem, &pdev->dev, "memory-region", 0); if (ret) return ret; @@ -1031,6 +1224,7 @@ static int qcom_smem_probe(struct platform_device *pdev) smem->item_count = qcom_smem_get_dynamic_item(smem); break; case SMEM_GLOBAL_HEAP_VERSION: + qcom_smem_mamp_legacy(smem); smem->item_count = SMEM_ITEM_COUNT; break; default: diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c index 9e749e559937..e418dc109fa8 100644 --- a/drivers/soc/qcom/socinfo.c +++ b/drivers/soc/qcom/socinfo.c @@ -34,6 +34,10 @@ #include #include #include +#ifdef OPLUS_ARCH_EXTENDS +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/09/03, Add for fake cpu id +#include +#endif #define BUILD_ID_LENGTH 32 #define CHIP_ID_LENGTH 32 @@ -289,6 +293,11 @@ static union { /* max socinfo format version supported */ #define MAX_SOCINFO_FORMAT SOCINFO_VERSION(0, 15) +#ifdef OPLUS_ARCH_EXTENDS +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/09/03, Add for fake cpu id +static char *fake_cpu_id = "SDM660"; +static char *real_cpu_id = "SDM720G"; +#endif static struct msm_soc_info cpu_of_id[] = { [0] = {MSM_CPU_UNKNOWN, "Unknown CPU"}, @@ -1840,6 +1849,24 @@ int __init socinfo_init(void) pr_warn("New IDs added! ID => CPU mapping needs an update.\n"); cur_cpu = cpu_of_id[socinfo->v0_1.id].generic_soc_type; +#ifdef OPLUS_ARCH_EXTENDS +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/09/03, Add for fake cpu id + if (is_confidential()) { + cpu_of_id[socinfo->v0_1.id].soc_id_string = fake_cpu_id; + } else { + cpu_of_id[socinfo->v0_1.id].soc_id_string = real_cpu_id; + } +#endif + +//Hongbin.Chen@ODM_LQ.BSP.cpuinfo, 2020/12/15, Add for Plato cpu id start + if (is_confidential()) { + if(get_project() == 19721) + { + cpu_of_id[socinfo->v0_1.id].generic_soc_type = MSM_CPU_ATOLL_AB; + cpu_of_id[socinfo->v0_1.id].soc_id_string = "SDM720G"; + } + } +//Hongbin.Chen@ODM_LQ.BSP.cpuinfo, 2020/12/15, Add for Plato cpu id end boot_stats_init(); socinfo_print(); arch_read_hardware_id = msm_read_hardware_id; diff --git a/drivers/soc/qcom/subsys-pil-tz.c b/drivers/soc/qcom/subsys-pil-tz.c index e267ceadf41a..cf7f87c17128 100644 --- a/drivers/soc/qcom/subsys-pil-tz.c +++ b/drivers/soc/qcom/subsys-pil-tz.c @@ -744,6 +744,11 @@ static int pil_shutdown_trusted(struct pil_desc *pil) u32 proc, scm_ret = 0; int rc; struct scm_desc desc = {0}; + #ifdef OPLUS_FEATURE_MODEM_MINIDUMP + //MaiWentian@NETWORK.RF,1213568, 2018/01/05,Modify for skip mini dump encryption + int i = 0; + struct md_ss_toc *toc = NULL; + #endif if (d->subsys_desc.no_auth) return 0; @@ -772,6 +777,19 @@ static int pil_shutdown_trusted(struct pil_desc *pil) if (rc) goto err_clks; + #ifdef OPLUS_FEATURE_MODEM_MINIDUMP + //MaiWentian@NETWORK.RF,1213568, 2018/01/05,Modify for skip mini dump encryption + if ( pil->minidump_id ==3 ) { //only check for modem . currently 3 is modem + pil->minidump_ss->md_ss_enable_status = 0; + pil->minidump_ss->encryption_status = 0; + + for ( i = 0; i < pil->num_aux_minidump_ids; i++ ) { + toc = pil->aux_minidump[i]; + toc->md_ss_enable_status = 0; + toc->encryption_status = 0; + } + } + #endif if (!is_scm_armv8()) { rc = scm_call(SCM_SVC_PIL, PAS_SHUTDOWN_CMD, &proc, @@ -781,7 +799,19 @@ static int pil_shutdown_trusted(struct pil_desc *pil) &desc); scm_ret = desc.ret[0]; } + #ifdef OPLUS_FEATURE_MODEM_MINIDUMP + //MaiWentian@NETWORK.RF,1213568, 2018/01/05,Modify for skip mini dump encryption + if( pil->minidump_id == 3 ) { //only check for modem . currently 3 is modem + pil->minidump_ss->md_ss_enable_status =MD_SS_ENABLED; + pil->minidump_ss->encryption_status =MD_SS_ENCR_DONE; + for (i = 0; i < pil->num_aux_minidump_ids; i++) { + toc = pil->aux_minidump[i]; + toc->md_ss_enable_status = MD_SS_ENABLED; + toc->encryption_status = MD_SS_ENCR_DONE; + } + } + #endif disable_unprepare_clocks(d->proxy_clks, d->proxy_clk_count); disable_regulators(d, d->proxy_regs, d->proxy_reg_count, false); if (d->bus_client) @@ -846,10 +876,19 @@ static struct pil_reset_ops pil_ops_trusted = { .deinit_image = pil_deinit_image_trusted, }; +#ifdef OPLUS_FEATURE_MODEM_MINIDUMP +//MaiWentian@NETWORK.RF,1213568, 2018/01/05,Add for customized subsystem ramdump to skip generate dump cause by SAU +bool SKIP_GENERATE_RAMDUMP = false; +extern void mdmreason_set(char * buf); +#endif static void log_failure_reason(const struct pil_tz_data *d) { size_t size; char *smem_reason, reason[MAX_SSR_REASON_LEN]; + #ifdef OPLUS_FEATURE_AGINGTEST + /* Yong.Qian@bsp.kernel.stability, 2020/5/14, Add for dump reason */ + char *function_name; + #endif /*OPLUS_FEATURE_AGINGTEST*/ const char *name = d->subsys_desc.name; if (d->smem_id == -1) @@ -867,7 +906,25 @@ static void log_failure_reason(const struct pil_tz_data *d) } strlcpy(reason, smem_reason, min(size, (size_t)MAX_SSR_REASON_LEN)); + #ifdef OPLUS_FEATURE_AGINGTEST + /* Yong.Qian@bsp.kernel.stability, 2020/5/14, Add for dump reason */ + function_name = parse_function_builtin_return_address((unsigned long)__builtin_return_address(0)); + save_dump_reason_to_smem(reason, function_name); + #endif /*OPLUS_FEATURE_AGINGTEST*/ pr_err("%s subsystem failure reason: %s.\n", name, reason); + #ifdef OPLUS_FEATURE_MODEM_MINIDUMP + //MaiWentian@NETWORK.RF,1213568, 2018/01/05,Add for customized subsystem ramdump to skip generate dump cause by SAU + if (!strncmp(name, "modem", 4)) { + mdmreason_set(reason); + + pr_err("oppo debug modem subsystem failure reason: %s.\n", reason); + + if(strstr(reason, "OPPO_MODEM_NO_RAMDUMP_EXPECTED") || strstr(reason, "oppomsg:go_to_error_fatal")){ + pr_err("%s will subsys reset",__func__); + SKIP_GENERATE_RAMDUMP = true; + } + } + #endif } static int subsys_shutdown(const struct subsys_desc *subsys, bool force_stop) diff --git a/drivers/soc/qcom/subsystem_restart.c b/drivers/soc/qcom/subsystem_restart.c index ad509458deee..094b62f2785c 100644 --- a/drivers/soc/qcom/subsystem_restart.c +++ b/drivers/soc/qcom/subsystem_restart.c @@ -43,6 +43,10 @@ #include "peripheral-loader.h" +#ifdef OPLUS_BUG_STABILITY +#include +#endif /*OPLUS_BUG_STABILITY */ + #define DISABLE_SSR 0x9889deed /* If set to 0x9889deed, call to subsystem_restart_dev() returns immediately */ static uint disable_restart_work; @@ -212,6 +216,26 @@ struct subsys_device { struct list_head list; }; +#ifdef OPLUS_FEATURE_ADSP_RECOVERY +/*Suresh.Alla@MULTIMEDIA.AUDIODRIVER.ADSP.2434874, 2020/08/14, Add for workaround fix adsp stuck issue*/ +static bool oplus_adsp_ssr = false; + +void oplus_set_ssr_state(bool ssr_state) +{ + oplus_adsp_ssr = ssr_state; + pr_err("%s():oplus_adsp_ssr=%d\n", __func__, oplus_adsp_ssr); + +} +EXPORT_SYMBOL(oplus_set_ssr_state); + +bool oplus_get_ssr_state(void) +{ + pr_err("%s():oplus_adsp_ssr=%d\n", __func__, oplus_adsp_ssr); + return oplus_adsp_ssr; +} +EXPORT_SYMBOL(oplus_get_ssr_state); +#endif /* OPLUS_FEATURE_ADSP_RECOVERY */ + static struct subsys_device *to_subsys(struct device *d) { return container_of(d, struct subsys_device, dev); @@ -1249,6 +1273,18 @@ int subsystem_restart_dev(struct subsys_device *dev) name = dev->desc->name; + #ifdef OPLUS_FEATURE_ADSP_RECOVERY + /*Suresh.Alla@MULTIMEDIA.AUDIODRIVER.ADSP.2434874, 2020/08/14, Add for workaround fix adsp stuck issue*/ + if (name && !strcmp(name, "adsp")) { + if (oplus_get_ssr_state()) { + pr_err("%s: adsp restarting, Ignoring request\n", __func__); + return 0; + } else { + oplus_set_ssr_state(true); + } + } + #endif /* OPLUS_FEATURE_ADSP_RECOVERY */ + send_early_notifications(dev->early_notify); /* @@ -1827,6 +1863,13 @@ struct subsys_device *subsys_register(struct subsys_desc *desc) subsys->dev.bus = &subsys_bus_type; subsys->dev.release = subsys_device_release; subsys->notif_state = -1; +#ifdef OPLUS_BUG_STABILITY + /*YiXue.Ge@PSW.BSP.Kernel.Driver,2017/05/15, + * Add for init subsyst restart level as RESET_SUBSYS_COUPLED at mp build + */ + if(!oppo_daily_build() && !(get_eng_version() == AGING)) + subsys->restart_level = RESET_SUBSYS_COUPLED; +#endif /*OPLUS_BUG_STABILITY */ subsys->desc->sysmon_pid = -1; subsys->desc->state = NULL; strlcpy(subsys->desc->fw_name, desc->name, diff --git a/drivers/soc/qcom/watchdog_v2.c b/drivers/soc/qcom/watchdog_v2.c index e4eaa8b8e77e..b37fada73a03 100644 --- a/drivers/soc/qcom/watchdog_v2.c +++ b/drivers/soc/qcom/watchdog_v2.c @@ -36,6 +36,11 @@ #include #include +#ifdef OPLUS_BUG_STABILITY +/*fanhui@PhoneSW.BSP, 2016-06-22, use self-defined utils*/ +#include "oppo_watchdog_util.h" +#endif + #define MODULE_NAME "msm_watchdog" #define WDT0_ACCSCSSNBARK_INT 0 #define TCSR_WDT_CFG 0x30 @@ -56,9 +61,12 @@ #define MAX_CPU_CTX_SIZE 2048 static struct msm_watchdog_data *wdog_data; - +#ifndef OPLUS_BUG_STABILITY +/*fanhui@PhoneSW.BSP, 2016-06-22, use self-defined utils*/ static int cpu_idle_pc_state[NR_CPUS]; - +#else +int cpu_idle_pc_state[NR_CPUS]; +#endif /* * user_pet_enable: * Require userspace to write to a sysfs file every pet_time milliseconds. @@ -399,9 +407,23 @@ static void ping_other_cpus(struct msm_watchdog_data *wdog_dd) { int cpu; +#ifdef OPLUS_BUG_STABILITY +/* fanhui@PhoneSW.BSP, 2016/05/26, print more info on pet watchdog */ + cpumask_t mask; + get_cpu_ping_mask(&mask); +#endif /*OPLUS_BUG_STABILITY*/ cpumask_clear(&wdog_dd->alive_mask); /* Make sure alive mask is cleared and set in order */ smp_mb(); + +#ifdef OPLUS_BUG_STABILITY +/* fanhui@PhoneSW.BSP, 2016/05/26, only ping cpu need ping */ + for_each_cpu(cpu, &mask) { + wdog_dd->ping_start[cpu] = sched_clock(); + smp_call_function_single(cpu, keep_alive_response, + wdog_dd, 1); + } +#else for_each_cpu(cpu, cpu_online_mask) { if (!cpu_idle_pc_state[cpu] && !cpu_isolated(cpu)) { wdog_dd->ping_start[cpu] = sched_clock(); @@ -409,6 +431,7 @@ static void ping_other_cpus(struct msm_watchdog_data *wdog_dd) wdog_dd, 1); } } +#endif /*OPLUS_BUG_STABILITY*/ } static void pet_task_wakeup(unsigned long data) @@ -454,6 +477,10 @@ static __ref int watchdog_kthread(void *arg) delay_time = msecs_to_jiffies(wdog_dd->pet_time); pet_watchdog(wdog_dd); } +#ifdef OPLUS_BUG_STABILITY +/*fanhui@PhoneSW.BSP, 2016-06-23, reset reocery_tried*/ + reset_recovery_tried(); +#endif /* Check again before scheduling * Could have been changed on other cpu */ @@ -542,10 +569,36 @@ static irqreturn_t wdog_bark_handler(int irq, void *dev_id) nanosec_rem = do_div(wdog_dd->last_pet, 1000000000); dev_info(wdog_dd->dev, "Watchdog last pet at %lu.%06lu\n", (unsigned long) wdog_dd->last_pet, nanosec_rem / 1000); +#ifndef OPLUS_BUG_STABILITY +/* fanhui@PhoneSW.BSP, 2016/04/22, print online cpu */ if (wdog_dd->do_ipi_ping) dump_cpu_alive_mask(wdog_dd); +#else + if (wdog_dd->do_ipi_ping) { + dump_cpu_alive_mask(wdog_dd); + dump_cpu_online_mask(); + } + +#endif + +#ifdef OPLUS_BUG_STABILITY +/* fanhui@PhoneSW.BSP, 2016/01/20, print more info about cpu the wdog on */ + if (try_to_recover_pending(wdog_dd->watchdog_task)) { + pet_watchdog(wdog_dd); + return IRQ_HANDLED; + } + + print_smp_call_cpu(); + dump_wdog_cpu(wdog_dd->watchdog_task); +#endif + +#ifdef OPLUS_BUG_STABILITY +/* fanhui@PhoneSW.BSP, 2016/01/20, delete trigger wdog bite, panic will trigger wdog if in dload mode*/ + panic("Handle a watchdog bite! - Falling back to kernel panic!"); +#else msm_trigger_wdog_bite(); panic("Failed to cause a watchdog bite! - Falling back to kernel panic!"); +#endif return IRQ_HANDLED; } @@ -920,6 +973,14 @@ static int msm_watchdog_probe(struct platform_device *pdev) if (msm_minidump_add_region(&md_entry)) pr_info("Failed to add Watchdog data in Minidump\n"); +#ifdef OPLUS_BUG_STABILITY + /*wanghao@BSP.Kernel.Debug, 2018/06/19, Add for init oppo watch dog log*/ + ret = init_oppo_watchlog(); + if (ret < 0) { + pr_info("Failed to init oppo watchlog"); + } +#endif + return 0; err: kzfree(wdog_dd); diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig index 94f0c88dd075..d0c752fa374c 100644 --- a/drivers/staging/android/Kconfig +++ b/drivers/staging/android/Kconfig @@ -45,6 +45,15 @@ config ANDROID_LOW_MEMORY_KILLER_AUTODETECT_OOM_ADJ_VALUES source "drivers/staging/android/ion/Kconfig" +#ifdef OPLUS_FEATURE_HANS_FREEZE +#Kun.Zhou@ANDROID.RESCONTROL, 2019/09/23, add for hans freeze manager +config OPPO_HANS + bool "HANS kernel and HANS native communication channel" + default y if OPLUS_FEATURE_HANS_FREEZE + ---help--- + Key events (signal/network package/binder) report to HAS native. +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ + endif # if ANDROID endmenu diff --git a/drivers/staging/android/Makefile b/drivers/staging/android/Makefile index 766a635e0bbf..5d23d1e4e52a 100644 --- a/drivers/staging/android/Makefile +++ b/drivers/staging/android/Makefile @@ -5,3 +5,9 @@ obj-y += ion/ obj-$(CONFIG_ASHMEM) += ashmem.o obj-$(CONFIG_ANDROID_VSOC) += vsoc.o obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER) += lowmemorykiller.o + +#ifdef OPLUS_FEATURE_HANS_FREEZE +#Kun.Zhou@ANDROID.RESCONTROL, 2019/09/23, add for hans freeze manager +obj-$(CONFIG_OPPO_HANS) += hans.o +obj-$(CONFIG_OPPO_HANS) += hans_netfilter.o +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ diff --git a/drivers/staging/android/ion/Kconfig b/drivers/staging/android/ion/Kconfig index 563e4a82a73a..607b40eaf88d 100644 --- a/drivers/staging/android/ion/Kconfig +++ b/drivers/staging/android/ion/Kconfig @@ -63,3 +63,10 @@ config ION_DEFER_FREE_NO_SCHED_IDLE Choose this option to remove the SCHED_IDLE flag in case of defer free thereby increasing the priority of defer free thread. if you're not sure say Y here. + +config OPLUS_ION_BOOSTPOOL + bool "Support ION Boost pool" + default n + help + This driver supports ION boost pool. + diff --git a/drivers/staging/android/ion/Makefile b/drivers/staging/android/ion/Makefile index dc638f080d7f..ffd56ba5b247 100644 --- a/drivers/staging/android/ion/Makefile +++ b/drivers/staging/android/ion/Makefile @@ -4,4 +4,9 @@ obj-$(CONFIG_ION) += ion.o ion-ioctl.o ion_heap.o \ ion_carveout_heap.o ion_chunk_heap.o \ ion_system_secure_heap.o ion_cma_heap.o \ ion_secure_util.o ion_cma_secure_heap.o msm/ +#ifdef OPLUS_FEATURE_HEALTHINFO +#Huacai.Zhou@PSW.BSP.kernel.Peformance, 2018/06/18, add foreground process opt support +obj-y += oppo_ion/ +#endif /* OPLUS_FEATURE_HEALTHINFO */ +obj-$(CONFIG_OPLUS_ION_BOOSTPOOL) += oplus_ion_boost_pool.o diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 6f4b2fd05e12..8a8d5105b3fd 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -47,6 +47,18 @@ #include "ion.h" #include "ion_secure_util.h" +#ifdef OPLUS_FEATURE_HEALTHINFO +//Jiheng.Xie@TECH.BSP.Performance, 2019/07/11, add for ion wait monitor +#if defined(CONFIG_OPPO_HEALTHINFO) && defined (CONFIG_OPPO_MEM_MONITOR) +#include +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ + +#ifdef OPLUS_FEATURE_HEALTHINFO +//Jiheng.Xie@TECH.BSP.Kernel.Performance, 2020/03/24, add for ion total used account +#include +#endif /* OPLUS_FEATURE_HEALTHINFO */ + static struct ion_device *internal_dev; static atomic_long_t total_heap_bytes; @@ -173,6 +185,11 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap, ion_buffer_add(dev, buffer); mutex_unlock(&dev->buffer_lock); atomic_long_add(len, &heap->total_allocated); +#ifdef OPLUS_FEATURE_HEALTHINFO +/* Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-06-26, add ion total used account*/ + if (ion_cnt_enable) + atomic_long_add(buffer->size, &ion_total_size); +#endif /* OPLUS_FEATURE_HEALTHINFO */ atomic_long_add(len, &total_heap_bytes); return buffer; @@ -189,6 +206,11 @@ void ion_buffer_destroy(struct ion_buffer *buffer) pr_warn_ratelimited("ION client likely missing a call to dma_buf_kunmap or dma_buf_vunmap\n"); buffer->heap->ops->unmap_kernel(buffer->heap, buffer); } +#ifdef OPLUS_FEATURE_HEALTHINFO +/* Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-06-26, add ion total used account*/ + if (ion_cnt_enable) + atomic_long_sub(buffer->size, &ion_total_size); +#endif /* OPLUS_FEATURE_HEALTHINFO */ buffer->heap->ops->free(buffer); kfree(buffer); } @@ -1061,7 +1083,12 @@ struct dma_buf *ion_alloc_dmabuf(size_t len, unsigned int heap_id_mask, DEFINE_DMA_BUF_EXPORT_INFO(exp_info); struct dma_buf *dmabuf; char task_comm[TASK_COMM_LEN]; - +#ifdef OPLUS_FEATURE_HEALTHINFO +//Jiheng.Xie@TECH.BSP.Performance, 2019/07/11, add for ion wait monitor +#if defined(CONFIG_OPPO_HEALTHINFO) && defined (CONFIG_OPPO_MEM_MONITOR) + unsigned long oppo_ionwait_start = jiffies; +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ pr_debug("%s: len %zu heap_id_mask %u flags %x\n", __func__, len, heap_id_mask, flags); /* @@ -1080,7 +1107,14 @@ struct dma_buf *ion_alloc_dmabuf(size_t len, unsigned int heap_id_mask, /* if the caller didn't specify this heap id */ if (!((1 << heap->id) & heap_id_mask)) continue; - buffer = ion_buffer_create(heap, dev, len, flags); +#ifdef CONFIG_OPLUS_ION_BOOSTPOOL + if (heap->id == ION_SYSTEM_HEAP_ID && + (heap_id_mask & (1UL << ION_CAMERA_HEAP_ID))) + buffer = ion_buffer_create(heap, dev, len, + flags | ION_FLAG_CAMERA_BUFFER); + else +#endif + buffer = ion_buffer_create(heap, dev, len, flags); if (!IS_ERR(buffer) || PTR_ERR(buffer) == -EINTR) break; } @@ -1106,7 +1140,12 @@ struct dma_buf *ion_alloc_dmabuf(size_t len, unsigned int heap_id_mask, _ion_buffer_destroy(buffer); kfree(exp_info.exp_name); } - +#ifdef OPLUS_FEATURE_HEALTHINFO +//Jiheng.Xie@TECH.BSP.Performance, 2019/07/11, add for ion wait monitor +#if defined(CONFIG_OPPO_HEALTHINFO) && defined (CONFIG_OPPO_MEM_MONITOR) + oppo_ionwait_monitor(jiffies_to_msecs(jiffies - oppo_ionwait_start)); +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ return dmabuf; } diff --git a/drivers/staging/android/ion/ion.h b/drivers/staging/android/ion/ion.h index e5b293dc8889..7f9ddbd98bc9 100644 --- a/drivers/staging/android/ion/ion.h +++ b/drivers/staging/android/ion/ion.h @@ -448,6 +448,7 @@ struct ion_page_pool { struct mutex mutex; gfp_t gfp_mask; unsigned int order; + bool boost_flag; struct plist_node list; }; @@ -464,6 +465,7 @@ void ion_page_pool_free_immediate(struct ion_page_pool *pool, int ion_page_pool_total(struct ion_page_pool *pool, bool high); size_t ion_system_heap_secure_page_pool_total(struct ion_heap *heap, int vmid); +inline struct page *ion_page_pool_alloc_pages(struct ion_page_pool *pool); #ifdef CONFIG_ION_SYSTEM_HEAP long ion_page_pool_nr_pages(void); #else diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c index 82e5007b45b4..f7b461dbee17 100644 --- a/drivers/staging/android/ion/ion_page_pool.c +++ b/drivers/staging/android/ion/ion_page_pool.c @@ -33,7 +33,7 @@ */ static long nr_total_pages; -static void *ion_page_pool_alloc_pages(struct ion_page_pool *pool) +inline struct page *ion_page_pool_alloc_pages(struct ion_page_pool *pool) { struct page *page = alloc_pages(pool->gfp_mask, pool->order); @@ -49,6 +49,11 @@ static void ion_page_pool_free_pages(struct ion_page_pool *pool, static int ion_page_pool_add(struct ion_page_pool *pool, struct page *page) { mutex_lock(&pool->mutex); +#ifdef OPLUS_FEATURE_HEALTHINFO +/*Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-09-25, add ion cached account*/ + zone_page_state_add(1L << pool->order, page_zone(page), + NR_IONCACHE_PAGES); +#endif /* OPLUS_FEATURE_HEALTHINFO */ if (PageHighMem(page)) { list_add_tail(&page->lru, &pool->high_items); pool->high_count++; @@ -77,7 +82,11 @@ static struct page *ion_page_pool_remove(struct ion_page_pool *pool, bool high) page = list_first_entry(&pool->low_items, struct page, lru); pool->low_count--; } - +#ifdef OPLUS_FEATURE_HEALTHINFO +/*Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-09-25, add ion cached account*/ + zone_page_state_add(-(1L << pool->order), page_zone(page), + NR_IONCACHE_PAGES); +#endif /* OPLUS_FEATURE_HEALTHINFO */ list_del(&page->lru); nr_total_pages -= 1 << pool->order; mod_node_page_state(page_pgdat(page), NR_KERNEL_MISC_RECLAIMABLE, @@ -94,14 +103,23 @@ struct page *ion_page_pool_alloc(struct ion_page_pool *pool, bool *from_pool) if (fatal_signal_pending(current)) return ERR_PTR(-EINTR); - if (*from_pool && mutex_trylock(&pool->mutex)) { - if (pool->high_count) - page = ion_page_pool_remove(pool, true); - else if (pool->low_count) - page = ion_page_pool_remove(pool, false); - mutex_unlock(&pool->mutex); + if (*from_pool) { + if (pool->boost_flag) { + mutex_lock(&pool->mutex); + if (pool->high_count) + page = ion_page_pool_remove(pool, true); + else if (pool->low_count) + page = ion_page_pool_remove(pool, false); + mutex_unlock(&pool->mutex); + } else if (mutex_trylock(&pool->mutex)) { + if (pool->high_count) + page = ion_page_pool_remove(pool, true); + else if (pool->low_count) + page = ion_page_pool_remove(pool, false); + mutex_unlock(&pool->mutex); + } } - if (!page) { + if (!page && !(pool->boost_flag)) { page = ion_page_pool_alloc_pages(pool); *from_pool = false; } diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c index af1ea09141ab..5a4279ee932d 100644 --- a/drivers/staging/android/ion/ion_system_heap.c +++ b/drivers/staging/android/ion/ion_system_heap.c @@ -31,10 +31,28 @@ #include "ion_system_secure_heap.h" #include "ion_secure_util.h" +#ifdef CONFIG_OPLUS_ION_BOOSTPOOL +#include "oplus_ion_boost_pool.h" +#include +#endif + static gfp_t high_order_gfp_flags = (GFP_HIGHUSER | __GFP_ZERO | __GFP_NOWARN | __GFP_NORETRY) & ~__GFP_RECLAIM; static gfp_t low_order_gfp_flags = GFP_HIGHUSER | __GFP_ZERO; +#ifdef CONFIG_OPLUS_ION_BOOSTPOOL +static struct ion_boost_pool *has_boost_pool(struct ion_system_heap *sys_heap, + unsigned long flags) +{ + if (flags & ION_FLAG_GRAPHIC_BUFFER) { + return sys_heap->gr_pool; + } else if (flags & ION_FLAG_CAMERA_BUFFER) { + return sys_heap->cam_pool; + } + return NULL; +} +#endif + int order_to_index(unsigned int order) { int i; @@ -102,6 +120,15 @@ void free_buffer_page(struct ion_system_heap *heap, bool cached = ion_buffer_cached(buffer); int vmid = get_secure_vmid(buffer->flags); +#ifdef CONFIG_OPLUS_ION_BOOSTPOOL + struct ion_boost_pool *boost_pool = has_boost_pool(heap, buffer->flags); + + if (boost_pool) { + if (0 == boost_pool_free(boost_pool, page, order)) + return; + } +#endif + if (!(buffer->flags & ION_FLAG_POOL_FORCE_ALLOC)) { struct ion_page_pool *pool; @@ -291,6 +318,16 @@ static int ion_system_heap_allocate(struct ion_heap *heap, unsigned int sz; int vmid = get_secure_vmid(buffer->flags); +#ifdef CONFIG_OPLUS_ION_BOOSTPOOL + unsigned int boostpool_sz = 0; + struct ion_boost_pool *boost_pool = has_boost_pool(sys_heap, + buffer->flags); +#ifdef BOOSTPOOL_DEBUG + int boostpool_order[3] = {0}; + unsigned long alloc_start = jiffies; +#endif /* BOOSTPOOL_DEBUG */ +#endif /* CONFIG_OPLUS_ION_BOOSTPOOL */ + if (size / PAGE_SIZE > totalram_pages / 2) return -ENOMEM; @@ -305,6 +342,50 @@ static int ion_system_heap_allocate(struct ion_heap *heap, INIT_LIST_HEAD(&pages); INIT_LIST_HEAD(&pages_from_pool); +#ifdef CONFIG_OPLUS_ION_BOOSTPOOL + if ((buffer->flags & ION_FLAG_CAMERA_BUFFER) && size < SZ_1M) { + boost_pool = NULL; + } + if (boost_pool) { + while (size_remaining > 0) { + + info = boost_pool_allocate(boost_pool, + size_remaining, + max_order); + if (!info) + break; + + sz = (1 << info->order) * PAGE_SIZE; + boostpool_sz += sz; +#ifdef BOOSTPOOL_DEBUG + boostpool_order[order_to_index(info->order)] += 1; +#endif /* BOOSTPOOL_DEBUG */ + + list_add_tail(&info->list, &pages_from_pool); + + mod_node_page_state(page_pgdat(info->page), + NR_UNRECLAIMABLE_PAGES, + (1 << (info->order))); + + size_remaining -= sz; + max_order = info->order; + i++; + } + max_order = orders[0]; + +#ifdef BOOSTPOOL_DEBUG + if (size_remaining != 0) { + pr_info("boostpool %s alloc failed. boostpool_sz: %d size: %d orders(%d, %d, %d) %d ms\n", + __func__, boostpool_sz, (int) size, + boostpool_order[0], boostpool_order[1], + boostpool_order[2], + jiffies_to_msecs(jiffies - alloc_start)); + boost_pool_dump(boost_pool); + } +#endif /* BOOSTPOOL_DEBUG */ + } +#endif /* CONFIG_OPLUS_ION_BOOSTPOOL */ + while (size_remaining > 0) { if (is_secure_vmid_valid(vmid)) info = alloc_from_pool_preferred( @@ -338,6 +419,11 @@ static int ion_system_heap_allocate(struct ion_heap *heap, i++; } +#ifdef CONFIG_OPLUS_ION_BOOSTPOOL + if (boost_pool && buffer->flags & ION_FLAG_CAMERA_BUFFER) + boost_pool_dec_high(boost_pool, size >> PAGE_SHIFT); +#endif /* CONFIG_OPLUS_ION_BOOSTPOOL */ + ret = ion_heap_alloc_pages_mem(&data); if (ret) @@ -402,6 +488,10 @@ static int ion_system_heap_allocate(struct ion_heap *heap, if (nents_sync) sg_free_table(&table_sync); ion_heap_free_pages_mem(&data); +#ifdef CONFIG_OPLUS_ION_BOOSTPOOL + if (boost_pool) + boost_pool_wakeup_process(boost_pool); +#endif /* CONFIG_OPLUS_ION_BOOSTPOOL */ return 0; err_free_sg2: @@ -471,6 +561,9 @@ static int ion_system_heap_shrink(struct ion_heap *heap, gfp_t gfp_mask, int i, j, nr_freed = 0; int only_scan = 0; struct ion_page_pool *pool; +#ifdef CONFIG_OPLUS_ION_BOOSTPOOL + struct ion_boost_pool *boost_pool; +#endif /* CONFIG_OPLUS_ION_BOOSTPOOL */ sys_heap = container_of(heap, struct ion_system_heap, heap); @@ -480,6 +573,23 @@ static int ion_system_heap_shrink(struct ion_heap *heap, gfp_t gfp_mask, for (i = 0; i < NUM_ORDERS; i++) { nr_freed = 0; +#ifdef CONFIG_OPLUS_ION_BOOSTPOOL + if (sys_heap->gr_pool) { + boost_pool = sys_heap->gr_pool; + nr_freed += boost_pool_shrink(boost_pool, + boost_pool->pools[i], + gfp_mask, + nr_to_scan); + } + if (sys_heap->cam_pool) { + boost_pool = sys_heap->cam_pool; + nr_freed += boost_pool_shrink(boost_pool, + boost_pool->pools[i], + gfp_mask, + nr_to_scan); + } +#endif /* CONFIG_OPLUS_ION_BOOSTPOOL */ + for (j = 0; j < VMID_LAST; j++) { if (is_secure_vmid_valid(j)) nr_freed += ion_secure_page_pool_shrink( @@ -613,7 +723,7 @@ static int ion_system_heap_debug_show(struct ion_heap *heap, struct seq_file *s, return 0; } -static void ion_system_heap_destroy_pools(struct ion_page_pool **pools) +void ion_system_heap_destroy_pools(struct ion_page_pool **pools) { int i; @@ -631,8 +741,8 @@ static void ion_system_heap_destroy_pools(struct ion_page_pool **pools) * nothing. If it succeeds you'll eventually need to use * ion_system_heap_destroy_pools to destroy the pools. */ -static int ion_system_heap_create_pools(struct ion_page_pool **pools, - bool cached) +int ion_system_heap_create_pools(struct ion_page_pool **pools, + bool cached, bool boost_flag) { int i; for (i = 0; i < NUM_ORDERS; i++) { @@ -642,6 +752,7 @@ static int ion_system_heap_create_pools(struct ion_page_pool **pools, if (orders[i]) gfp_flags = high_order_gfp_flags; pool = ion_page_pool_create(gfp_flags, orders[i], cached); + pool->boost_flag = boost_flag; if (!pool) goto err_create_pool; pools[i] = pool; @@ -656,6 +767,9 @@ struct ion_heap *ion_system_heap_create(struct ion_platform_heap *data) { struct ion_system_heap *heap; int i; +#ifdef CONFIG_OPLUS_ION_BOOSTPOOL + struct proc_dir_entry *boost_root_dir; +#endif /* CONFIG_OPLUS_ION_BOOSTPOOL */ heap = kzalloc(sizeof(*heap), GFP_KERNEL); if (!heap) @@ -667,15 +781,28 @@ struct ion_heap *ion_system_heap_create(struct ion_platform_heap *data) for (i = 0; i < VMID_LAST; i++) if (is_secure_vmid_valid(i)) if (ion_system_heap_create_pools( - heap->secure_pools[i], false)) + heap->secure_pools[i], false, false)) goto destroy_secure_pools; - if (ion_system_heap_create_pools(heap->uncached_pools, false)) + if (ion_system_heap_create_pools(heap->uncached_pools, false, false)) goto destroy_secure_pools; - if (ion_system_heap_create_pools(heap->cached_pools, true)) + if (ion_system_heap_create_pools(heap->cached_pools, true, false)) goto destroy_uncached_pools; +#ifdef CONFIG_OPLUS_ION_BOOSTPOOL + boost_root_dir = proc_mkdir("boost_pool", NULL); + if (!IS_ERR(boost_root_dir)) { + /* on low memory target, we should not set 128Mib on camera pool. */ + /* TODO set by total ram pages */ + heap->cam_pool = boost_pool_create(heap, ION_FLAG_CAMERA_BUFFER, + 128 * 256, + boost_root_dir, "camera"); + if (!heap->cam_pool) + pr_err("%s: create boost_pool camera failed!\n", + __func__); + } +#endif /* CONFIG_OPLUS_ION_BOOSTPOOL */ mutex_init(&heap->split_page_mutex); heap->heap.debug_show = ion_system_heap_debug_show; diff --git a/drivers/staging/android/ion/ion_system_heap.h b/drivers/staging/android/ion/ion_system_heap.h index 6a913d62c9b5..cdc323679604 100644 --- a/drivers/staging/android/ion/ion_system_heap.h +++ b/drivers/staging/android/ion/ion_system_heap.h @@ -34,6 +34,9 @@ struct ion_system_heap { struct ion_page_pool *secure_pools[VMID_LAST][MAX_ORDER]; /* Prevents unnecessary page splitting */ struct mutex split_page_mutex; +#ifdef CONFIG_OPLUS_ION_BOOSTPOOL + struct ion_boost_pool *gr_pool, *cam_pool; +#endif /* CONFIG_OPLUS_ION_BOOSTPOOL */ }; struct page_info { @@ -49,4 +52,8 @@ void free_buffer_page(struct ion_system_heap *heap, struct ion_buffer *buffer, struct page *page, unsigned int order); +int ion_system_heap_create_pools(struct ion_page_pool **pools, + bool cached, bool boost_flag); + +void ion_system_heap_destroy_pools(struct ion_page_pool **pools); #endif /* _ION_SYSTEM_HEAP_H */ diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 5c7fb1b802cc..8e64432d7288 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -55,6 +55,12 @@ #include #include +#ifdef OPLUS_FEATURE_LOWMEM_DBG +/*yixue.ge@PSW.BSP.Kernel.Driver 20170808 modify for get some data about performance */ +#include +#include +#endif /*OPLUS_FEATURE_LOWMEM_DBG*/ + #ifdef CONFIG_HIGHMEM #define _ZONE ZONE_HIGHMEM #else @@ -64,6 +70,18 @@ #define CREATE_TRACE_POINTS #include "trace/lowmemorykiller.h" +#ifdef OPLUS_FEATURE_LOWMEM_DBG +#include + +static struct kobject *lmk_module_kobj = NULL; +static struct work_struct lowmemorykiller_work; +static char *lmklowmem[2] = { "LMK=LOWMEM", NULL }; +static int uevent_threshold[6] = {0, 0, 0, 0, }; // 1: 58, 2: 117, 3: 176 +static int last_selected_adj = 0; +static void lowmemorykiller_uevent(short adj, int index); +static void lowmemorykiller_work_func(struct work_struct *work); +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ + /* to enable lowmemorykiller */ static int enable_lmk = 1; module_param_named(enable_lmk, enable_lmk, int, 0644); @@ -83,12 +101,23 @@ static int lowmem_minfree[6] = { 4 * 1024, /* 16MB */ 16 * 1024, /* 64MB */ }; +#ifdef OPLUS_FEATURE_LOWMEM_DBG +/*huacai.zhou@PSW.BSP.Kernel.MM 2018-01-15 modify for lowmemkill count */ +static bool lmk_cnt_enable = true; +static unsigned long adaptive_lowmem_kill_count = 0; +static unsigned long tatal_lowmem_kill_count = 0; +#endif /*OPLUS_FEATURE_LOWMEM_DBG*/ static int lowmem_minfree_size = 4; static int lmk_fast_run = 1; static unsigned long lowmem_deathpending_timeout; +#ifdef OPLUS_FEATURE_PERFORMANCE +static unsigned int almk_totalram_ratio = 6; +module_param_named(almk_totalram_ratio, almk_totalram_ratio, uint, 0644); +#endif + #define lowmem_print(level, x...) \ do { \ if (lowmem_debug_level >= (level)) \ @@ -170,6 +199,12 @@ static int adjust_minadj(short *min_score_adj) else ret = VMPRESSURE_ADJUST_NORMAL; *min_score_adj = adj_max_shift; +#ifdef OPLUS_FEATURE_LOWMEM_DBG +/*huacai.zhou@PSW.BSP.Kernel.MM 2018-01-15 modify for adaptive lowmemkill count */ +/*Maybe it can not select task to kill, it's just a rough number */ + if (lmk_cnt_enable) + adaptive_lowmem_kill_count++; +#endif /*OPLUS_FEATURE_LOWMEM_DBG*/ } atomic_set(&shift_adj, 0); @@ -191,8 +226,13 @@ static int lmk_vmpressure_notifier(struct notifier_block *nb, global_node_page_state(NR_SHMEM) - total_swapcache_pages(); other_free = global_zone_page_state(NR_FREE_PAGES); - +#ifdef OPLUS_FEATURE_PERFORMANCE +/*Huacai.Zhou@PSW.Tech.Kernel.Performance, 2019-02-18, do not kill precess when memory is greater than 1GB*/ + if ((other_free + other_file) < totalram_pages/almk_totalram_ratio) + atomic_set(&shift_adj, 1); +#else atomic_set(&shift_adj, 1); +#endif /*OPLUS_FEATURE_PERFORMANCE*/ trace_almk_vmpressure(pressure, other_free, other_file); } else if (pressure >= 90) { if (lowmem_adj_size < array_size) @@ -453,6 +493,59 @@ static int get_minfree_scalefactor(gfp_t gfp_mask) return max_t(int, 1, mult_frac(100, nr_usable, totalram_pages)); } +#ifdef OPLUS_FEATURE_LOWMEM_DBG +/*yixue.ge@PSW.BSP.Kernel.Driver 20170808 modify for get some data about performance */ +static ssize_t lowmem_kill_count_proc_read(struct file *file, char __user *buf, + size_t count,loff_t *off) +{ + char page[256] = {0}; + int len = 0; + + if (!lmk_cnt_enable) + return 0; + + len = sprintf(&page[len],"adaptive_lowmem_kill_count:%lu\ntotal_lowmem_kill_count:%lu\n", + adaptive_lowmem_kill_count, tatal_lowmem_kill_count); + + if(len > *off) + len -= *off; + else + len = 0; + + if(copy_to_user(buf,page,(len < count ? len : count))){ + return -EFAULT; + } + *off += len < count ? len : count; + return (len < count ? len : count); + +} + +struct file_operations lowmem_kill_count_proc_fops = { + .read = lowmem_kill_count_proc_read, +}; + +static int __init setup_lowmem_killinfo(void) +{ + + proc_create("lowmemkillcounts", S_IRUGO, NULL, &lowmem_kill_count_proc_fops); + return 0; +} +module_init(setup_lowmem_killinfo); + +//Jiemin.Zhu@PSW.AD.Performance.Memory.1139862, 2015/06/17, Modify for 8939/16 5.1 for orphan task +static void orphan_foreground_task_kill(struct task_struct *task, short adj, short min_score_adj) +{ + if (min_score_adj == 0) + return; + + if (task->parent->pid == 1 && adj == 0) { + lowmem_print(1, "kill orphan foreground task %s, pid %d, adj %hd, min_score_adj %hd\n", + task->comm, task->pid, adj, min_score_adj); + send_sig(SIGKILL, task, 0); + } +} +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ + static void mark_lmk_victim(struct task_struct *tsk) { struct mm_struct *mm = tsk->mm; @@ -577,9 +670,32 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) continue; } +#ifdef OPLUS_FEATURE_LOWMEM_DBG +//Jiemin.Zhu@PSW.AD.Performance.Memory.1139862, 2016/01/06, Add for D status process issue + if (p->state & TASK_UNINTERRUPTIBLE) { + task_unlock(p); + continue; + } + //resolve kill coredump process, it may continue long time + if (p->signal != NULL && (p->signal->flags & SIGNAL_GROUP_COREDUMP)) { + task_unlock(p); + continue; + } +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ + oom_score_adj = p->signal->oom_score_adj; if (oom_score_adj < min_score_adj) { +#ifdef OPLUS_FEATURE_LOWMEM_DBG +//Jiemin.Zhu@PSW.AD.Performance.Memory.1139862, 2015/06/17, Modify for 8939/16 5.1 for orphan task + tasksize = get_mm_rss(p->mm); +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ task_unlock(p); +#ifdef OPLUS_FEATURE_LOWMEM_DBG +//Jiemin.Zhu@PSW.AD.Performance.Memory.1139862, 2015/06/17, Modify for 8939/16 5.1 for orphan task + if (tasksize > 0) { + orphan_foreground_task_kill(p, oom_score_adj, min_score_adj); + } +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ continue; } tasksize = get_mm_rss(p->mm); @@ -628,6 +744,11 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) } task_unlock(selected); trace_lowmemory_kill(selected, cache_size, cache_limit, free); +#ifdef OPLUS_FEATURE_LOWMEM_DBG +/*yixue.ge@PSW.BSP.Kernel.Driver 20170808 modify for get some data about performance */ + if (lmk_cnt_enable) + tatal_lowmem_kill_count++; +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ lowmem_print(1, "Killing '%s' (%d) (tgid %d), adj %hd,\n" "to free %ldkB on behalf of '%s' (%d) because\n" "cache %ldkB is below limit %ldkB for oom score %hd\n" @@ -653,12 +774,59 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) (long)(PAGE_SIZE / 1024), sc->gfp_mask); - if (lowmem_debug_level >= 2 && selected_oom_score_adj == 0) { +#ifdef OPLUS_FEATURE_LOWMEM_DBG +/*huacai.zhou@PSW.BSP.Kernel.MM. 2018/01/15, modify for show more meminfo*/ show_mem(SHOW_MEM_FILTER_NODES, NULL); +#endif /*OPLUS_FEATURE_LOWMEM_DBG*/ + +#ifdef OPLUS_FEATURE_LOWMEM_DBG +/*Zhenjian.Jiang@PSW.BSP.Kernel.MM. 2019/03/19, modify for show more meminfo when adj <= 300*/ + if (selected_oom_score_adj <= 300) { +#else + if (lowmem_debug_level >= 2 && selected_oom_score_adj == 0) { +#endif /*OPLUS_FEATURE_LOWMEM_DBG*/ +#ifndef OPLUS_FEATURE_LOWMEM_DBG +/*huacai.zhou@PSW.BSP.Kernel.MM. 2018/01/15, modify for show more meminfo*/ + show_mem(SHOW_MEM_FILTER_NODES, NULL); +#endif /*OPLUS_FEATURE_LOWMEM_DBG*/ show_mem_call_notifiers(); dump_tasks(NULL, NULL); } +#ifdef OPLUS_FEATURE_LOWMEM_DBG +//Jiemin.Zhu@PSW.AD.Performance.Memory.1139862, 2016/05/31, Add for lowmemorykiller uevent + if (selected_oom_score_adj == 0) { + lowmem_print(1, "Killing %s, adj is %hd, so send uevent to userspace\n", + selected->comm, selected_oom_score_adj); + schedule_work(&lowmemorykiller_work); + } else { + for (i = 1; i < 3; i++) { + if (selected_oom_score_adj == lowmem_adj[i]) { + //uevent must be continuous adj record + if (last_selected_adj != selected_oom_score_adj) { + last_selected_adj = selected_oom_score_adj; + uevent_threshold[i] = 0; + break; + } + uevent_threshold[i]++; + if (uevent_threshold[i] == i * 5) { + dump_tasks(NULL, NULL); + lowmemorykiller_uevent(selected_oom_score_adj, i); + uevent_threshold[i] = 0; + } + break; + } + } + } + +//Jiemin.Zhu@PSW.AD.Performance.Memory.1139862, 2017/12/27, Add for print more memory logs in aging test version + if (min_score_adj == 0) { + lowmem_print(1, "min_score_adj is 0, so send uevent to userspace\n"); + dump_tasks(NULL, NULL); + schedule_work(&lowmemorykiller_work); + } +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ + lowmem_deathpending_timeout = jiffies + HZ; rem += selected_tasksize; rcu_read_unlock(); @@ -703,6 +871,21 @@ static int lmk_hotplug_callback(struct notifier_block *self, return NOTIFY_OK; } +#ifdef OPLUS_FEATURE_LOWMEM_DBG +//Jiemin.Zhu@PSW.AD.Performance.Memory.1139862, 2016/05/31, Add for lowmemorykiller uevent +static void lowmemorykiller_work_func(struct work_struct *work) +{ + kobject_uevent_env(lmk_module_kobj, KOBJ_CHANGE, lmklowmem); + lowmem_print(1, "lowmemorykiller send uevent: %s\n", lmklowmem[0]); +} + +static void lowmemorykiller_uevent(short adj, int index) +{ + lowmem_print(1, "kill adj %hd more than %d times and so send uevent to userspace\n", adj, index * 5); + schedule_work(&lowmemorykiller_work); +} +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ + static struct shrinker lowmem_shrinker = { .scan_objects = lowmem_scan, .count_objects = lowmem_count, @@ -720,6 +903,12 @@ static int __init lowmem_init(void) vmpressure_notifier_register(&lmk_vmpr_nb); if (register_hotmemory_notifier(&lmk_memory_callback_nb)) lowmem_print(1, "Registering memory hotplug notifier failed\n"); +#ifdef OPLUS_FEATURE_LOWMEM_DBG +//Jiemin.Zhu@PSW.AD.Performance.Memory.1139862, 2016/05/31, Add for lowmemorykiller uevent + lmk_module_kobj = kset_find_obj(module_kset, KBUILD_MODNAME); + lowmem_print(1, "kernel obj name %s\n", lmk_module_kobj->name); + INIT_WORK(&lowmemorykiller_work, lowmemorykiller_work_func); +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ return 0; } device_initcall(lowmem_init); @@ -818,4 +1007,7 @@ module_param_array_named(minfree, lowmem_minfree, uint, &lowmem_minfree_size, S_IRUGO | S_IWUSR); module_param_named(debug_level, lowmem_debug_level, uint, S_IRUGO | S_IWUSR); module_param_named(lmk_fast_run, lmk_fast_run, int, S_IRUGO | S_IWUSR); - +#ifdef OPLUS_FEATURE_LOWMEM_DBG +/*huacai.zhou@PSW.BSP.Kernel.MM 2018-01-15 modify for lowmemkill count */ +module_param_named(lmk_cnt_enable, lmk_cnt_enable, bool, S_IRUGO | S_IWUSR); +#endif /*OPLUS_FEATURE_LOWMEM_DBG*/ diff --git a/drivers/staging/android/uapi/msm_ion.h b/drivers/staging/android/uapi/msm_ion.h index af421310dc96..e26458618b77 100644 --- a/drivers/staging/android/uapi/msm_ion.h +++ b/drivers/staging/android/uapi/msm_ion.h @@ -42,6 +42,10 @@ enum ion_heap_ids { ION_HEAP_ID_RESERVED = 31 /** Bit reserved for ION_FLAG_SECURE flag */ }; +/* boost pool flag. */ +#define ION_FLAG_GRAPHIC_BUFFER ION_BIT(13) +#define ION_FLAG_CAMERA_BUFFER ION_BIT(12) + /** * Newly added heap ids have to be #define(d) since all API changes must * include a new #define. diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 190d9dccad04..31c9e6c42db4 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -202,6 +202,12 @@ config THERMAL_EMULATION because userland can easily disable the thermal policy by simply flooding this sysfs node with low temperature values. +config HORAE_THERMAL_SHELL + bool "Horae shell temp driver" + default y + help + Provide three thermal zones(front, frame and back) to get real shell temp. + config HISI_THERMAL tristate "Hisilicon thermal driver" depends on ARCH_HISI || COMPILE_TEST diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile index f83602a6ff71..89fcce8304d7 100644 --- a/drivers/thermal/Makefile +++ b/drivers/thermal/Makefile @@ -63,3 +63,4 @@ obj-$(CONFIG_GENERIC_ADC_THERMAL) += thermal-generic-adc.o obj-$(CONFIG_ZX2967_THERMAL) += zx2967_thermal.o obj-$(CONFIG_UNIPHIER_THERMAL) += uniphier_thermal.o obj-$(CONFIG_THERMAL_TSENS) += msm-tsens.o tsens2xxx.o tsens-dbg.o tsens-mtc.o tsens1xxx.o tsens_calib.o +obj-$(CONFIG_HORAE_THERMAL_SHELL) += horae_shell_temp.o diff --git a/drivers/thermal/qcom/bcl_peripheral.c b/drivers/thermal/qcom/bcl_peripheral.c index ffc8760305a2..751703053363 100644 --- a/drivers/thermal/qcom/bcl_peripheral.c +++ b/drivers/thermal/qcom/bcl_peripheral.c @@ -625,6 +625,8 @@ static void bcl_probe_soc(struct platform_device *pdev) soc_data->ops.get_temp = bcl_read_soc; soc_data->ops.set_trips = bcl_set_soc; INIT_WORK(&bcl_perph->soc_eval_work, bcl_evaluate_soc); +#ifndef OPLUS_BUG_STABILITY +//Nanwei.Deng@BSP.Power.Basic, 2018/08/06, Modify for 1+ patch bcl_perph->psy_nb.notifier_call = battery_supply_callback; ret = power_supply_reg_notifier(&bcl_perph->psy_nb); if (ret < 0) { @@ -639,6 +641,22 @@ static void bcl_probe_soc(struct platform_device *pdev) return; } thermal_zone_device_update(soc_data->tz_dev, THERMAL_DEVICE_UP); + #else + soc_data->tz_dev = thermal_zone_of_sensor_register(&pdev->dev, + BCL_SOC_MONITOR, soc_data, &soc_data->ops); + if (IS_ERR(soc_data->tz_dev)) { + pr_err("vbat register failed. err:%ld\n", + PTR_ERR(soc_data->tz_dev)); + return; + } + thermal_zone_device_update(soc_data->tz_dev, THERMAL_DEVICE_UP); + bcl_perph->psy_nb.notifier_call = battery_supply_callback; + ret = power_supply_reg_notifier(&bcl_perph->psy_nb); + if (ret < 0) { + pr_err("Unable to register soc notifier. err:%d\n", ret); + return; + } +#endif schedule_work(&bcl_perph->soc_eval_work); } diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 6ba0d96849d3..923a7163f9e2 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -771,7 +771,10 @@ static size_t __process_echoes(struct tty_struct *tty) #if defined(CONFIG_TTY_FLUSH_LOCAL_ECHO) if (ldata->echo_commit != tail) { if (!tty->delayed_work) { + #ifndef OPLUS_BUG_STABILITY + /* zhangzongyu@PSW.BSP.Kernel.Statbility 2020/3/21 avoid multi init work */ INIT_DELAYED_WORK(&tty->echo_delayed_work, continue_process_echoes); + #endif /* OPLUS_BUG_STABILITY */ schedule_delayed_work(&tty->echo_delayed_work, 1); } tty->delayed_work = 1; @@ -1920,6 +1923,14 @@ static void n_tty_close(struct tty_struct *tty) if (tty->link) n_tty_packet_mode_flush(tty); +#ifdef OPLUS_BUG_STABILITY +/* yanghao@PSW.BSP.Kernel.Statbility 2018/10/12 when uart stop should cancel_delay work first */ +#if defined(CONFIG_TTY_FLUSH_LOCAL_ECHO) + if(tty->echo_delayed_work.work.func) + cancel_delayed_work_sync(&tty->echo_delayed_work); +#endif +#endif /* OPLUS_BUG_STABILITY */ + vfree(ldata); tty->disc_data = NULL; } @@ -1948,6 +1959,12 @@ static int n_tty_open(struct tty_struct *tty) mutex_init(&ldata->output_lock); tty->disc_data = ldata; +#ifdef OPLUS_BUG_STABILITY +/* zhangzongyu@PSW.BSP.Kernel.Statbility 2020/3/21 avoid multi init work */ +#if defined(CONFIG_TTY_FLUSH_LOCAL_ECHO) + INIT_DELAYED_WORK(&tty->echo_delayed_work, continue_process_echoes); +#endif +#endif /* OPLUS_BUG_STABILITY */ tty->closing = 0; /* indicate buffer work may resume */ clear_bit(TTY_LDISC_HALTED, &tty->flags); diff --git a/drivers/tty/serial/msm_geni_serial.c b/drivers/tty/serial/msm_geni_serial.c index 4aeff0b472f3..2bda9edf14c5 100644 --- a/drivers/tty/serial/msm_geni_serial.c +++ b/drivers/tty/serial/msm_geni_serial.c @@ -415,6 +415,23 @@ static bool geni_wait_for_cmd_done(struct uart_port *uport, bool is_irq_masked) return timeout ? 0 : 1; } +#ifdef OPLUS_FEATURE_POWERINFO_FTM +//Jiaochao.Shi@BSP.CHG.Basic 2018/05/01 add for console +static struct pinctrl *serial_pinctrl = NULL; +static struct pinctrl_state *serial_pinctrl_state_disable = NULL; +#endif + +#ifdef OPLUS_FEATURE_POWERINFO_FTM +//Nanwei.Deng@BSP.CHG.Basic 2018/05/01 Add for debug console reg issue 969323*/ +extern bool oem_disable_uart(void); +bool boot_with_console(void) +{ + return !oem_disable_uart(); +} + +EXPORT_SYMBOL(boot_with_console); +#endif + static void msm_geni_serial_config_port(struct uart_port *uport, int cfg_flags) { if (cfg_flags & UART_CONFIG_TYPE) @@ -963,6 +980,13 @@ __msm_geni_serial_console_write(struct uart_port *uport, const char *s, int fifo_depth = DEF_FIFO_DEPTH_WORDS; int tx_wm = DEF_TX_WM; +#ifdef OPLUS_FEATURE_POWERINFO_FTM +//Nanwei.Deng@BSP.CHG.Basic 2018/05/01 add for console + if (!boot_with_console()) { + return; + } +#endif + for (i = 0; i < count; i++) { if (s[i] == '\n') new_line++; @@ -3154,6 +3178,32 @@ exit_ver_info: return ret; } +#ifdef OPLUS_FEATURE_POWERINFO_FTM +//Jiaochao.Shi@BSP.CHG.Basic 2018/05/01 add for console +static bool oppo_charge_id_reconfig(struct platform_device *pdev, struct uart_driver *drv) +{ + //TODO: add charger id control here + //Jiaochao.Shi@BSP.CHG.Basic 2018/05/01 add for console + if (drv == &msm_geni_console_driver) { + pr_err("%s: console start get pinctrl\n", __FUNCTION__); + serial_pinctrl = devm_pinctrl_get(&pdev->dev); + if (IS_ERR_OR_NULL(serial_pinctrl)) { + dev_err(&pdev->dev, "No serial_pinctrl config specified!\n"); + } else { + serial_pinctrl_state_disable = + pinctrl_lookup_state(serial_pinctrl, PINCTRL_SLEEP); + if (IS_ERR_OR_NULL(serial_pinctrl_state_disable)) { + dev_err(&pdev->dev, "No serial_pinctrl_state_disable config specified!\n"); + } else { + pinctrl_select_state(serial_pinctrl, serial_pinctrl_state_disable); + } + } + return true; + } + return false; +} +#endif + static int msm_geni_serial_probe(struct platform_device *pdev) { int ret = 0; @@ -3177,6 +3227,13 @@ static int msm_geni_serial_probe(struct platform_device *pdev) dev_err(&pdev->dev, "%s: No matching device found", __func__); return -ENODEV; } + +#ifdef OPLUS_FEATURE_POWERINFO_FTM +//Nanwei.Deng@BSP.CHG.Basic 2018/05/01 Add for debug console reg issue 969323*/ + if (!boot_with_console() && oppo_charge_id_reconfig(pdev, drv)) { + return -ENODEV; + } +#endif if (pdev->dev.of_node) { if (drv->cons) { @@ -3715,6 +3772,13 @@ static int __init msm_geni_serial_init(void) msm_geni_console_port.uport.line = i; } +#ifdef OPLUS_FEATURE_POWERINFO_FTM +//Nanwei.Deng@BSP.CHG.Basic 2018/05/01 Add for debug console reg issue 969323*/ + if (!boot_with_console()) { + msm_geni_console_driver.cons = NULL; + } +#endif + ret = console_register(&msm_geni_console_driver); if (ret) return ret; diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c index ba64768f5764..1253333515bf 100644 --- a/drivers/tty/sysrq.c +++ b/drivers/tty/sysrq.c @@ -160,6 +160,22 @@ static struct sysrq_key_op sysrq_reboot_op = { .enable_mask = SYSRQ_ENABLE_BOOT, }; +#ifdef CONFIG_OPLUS_FEATURE_PANIC_FLUSH +/* yanwu@TECH.Storage.FS.oF2FS, 2019-09-16, add for urgent flush */ +extern int panic_flush_device_cache(int timeout); +static void sysrq_handle_flush(int key) +{ + panic_flush_device_cache(0); +} + +static struct sysrq_key_op sysrq_flush_op = { + .handler = sysrq_handle_flush, + .help_msg = "flush(y)", + .action_msg = "Emergency Flush", + .enable_mask = SYSRQ_ENABLE_SYNC, +}; +#endif + static void sysrq_handle_sync(int key) { emergency_sync(); @@ -483,7 +499,12 @@ static struct sysrq_key_op *sysrq_key_table[36] = { /* x: May be registered on sparc64 for global PMU dump */ NULL, /* x */ /* y: May be registered on sparc64 for global register dump */ +#ifdef CONFIG_OPLUS_FEATURE_PANIC_FLUSH +/* yanwu@TECH.Storage.FS.oF2FS, 2019-09-16, add for urgent flush */ + &sysrq_flush_op, /* y */ +#else NULL, /* y */ +#endif &sysrq_ftrace_dump_op, /* z */ }; @@ -524,6 +545,8 @@ static void __sysrq_put_key_op(int key, struct sysrq_key_op *op_p) sysrq_key_table[i] = op_p; } +extern void qcdbg_trigger_full_dump(void); + void __handle_sysrq(int key, bool check_mask) { struct sysrq_key_op *op_p; @@ -549,6 +572,7 @@ void __handle_sysrq(int key, bool check_mask) */ if (!check_mask || sysrq_on_mask(op_p->enable_mask)) { pr_info("%s\n", op_p->action_msg); + qcdbg_trigger_full_dump(); console_loglevel = orig_log_level; op_p->handler(key); } else { diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index cf11882d2602..454ec3d02377 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -495,6 +495,14 @@ static void flush_to_ldisc(struct work_struct *work) { struct tty_port *port = container_of(work, struct tty_port, buf.work); struct tty_bufhead *buf = &port->buf; + #ifdef OPLUS_BUG_STABILITY + /* zhenjian Jiang@PSW.BSP.Kernel.Statbility 2018/11/30 add for migration checklist fix typeC null pointer bug */ + struct tty_struct *tty; + + tty = READ_ONCE(port->itty); + if (tty == NULL) + return; + #endif /* OPLUS_BUG_STABILITY */ mutex_lock(&buf->lock); @@ -524,7 +532,21 @@ static void flush_to_ldisc(struct work_struct *work) continue; } + #ifdef OPLUS_BUG_STABILITY + /* yanghao@PSW.BSP.Kernel.Statbility 2018/10/12 + * the tty->driver_data should use after uart_open + * but current occur the workqueue run before uart_open + * when tty->driver_data != NULL means the uart_open finish + */ + if(tty->driver_data != NULL) + count = receive_buf(port, head, count); + else { + count = 0; + pr_info("oppo driver_data == NULL skip the buf process, uart_open is not finished\n"); + } + #else count = receive_buf(port, head, count); + #endif /* OPLUS_BUG_STABILITY */ if (!count) break; head->read += count; diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index dd12c3b86eb4..646d15e2ea58 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c @@ -34,10 +34,21 @@ static int tty_port_default_receive_buf(struct tty_port *port, if (!disc) return 0; + #ifdef OPLUS_BUG_STABILITY + /* zhangzongyu@PSW.BSP.Kernel.Statbility 2020/3/21 */ + if(tty->driver_data != NULL) + ret = tty_ldisc_receive_buf(disc, p, (char *)f, count); + else { + ret = 0; + pr_info("oppo driver_data == NULL skip the buf process, uart_open is not finished\n"); + } + #else ret = tty_ldisc_receive_buf(disc, p, (char *)f, count); + #endif tty_ldisc_deref(disc); + return ret; } diff --git a/drivers/uio/msm_sharedmem/msm_sharedmem.c b/drivers/uio/msm_sharedmem/msm_sharedmem.c index c3a9138c721c..83760b463e49 100644 --- a/drivers/uio/msm_sharedmem/msm_sharedmem.c +++ b/drivers/uio/msm_sharedmem/msm_sharedmem.c @@ -25,6 +25,14 @@ #define CLIENT_ID_PROP "qcom,client-id" #define MPSS_RMTS_CLIENT_ID 1 +//#ifdef VENDOR_EDIT +//Zhengpeng.Tan@NW.MDM.NV.892767, 2016/11/30 +//add for nv backup and restore +//#ifdef FEATURE_OPPO_NV_BACKUP +#define MPSS_OEMBACK_CLIENT_ID 4 +//#endif /* FEATURE_OPPO_NV_BACKUP */ +//#endif /* VENDOR_EDIT */ + static int uio_get_mem_index(struct uio_info *info, struct vm_area_struct *vma) { if (vma->vm_pgoff >= MAX_UIO_MAPS) @@ -81,7 +89,15 @@ static void setup_shared_ram_perms(u32 client_id, phys_addr_t addr, u32 size, int ret; u32 source_vmlist[1] = {VMID_HLOS}; - if (client_id != MPSS_RMTS_CLIENT_ID) + //#ifndef VENDOR_EDIT + //Zhengpeng.Tan@NW.MDM.NV.892767, 2016/11/30 + //add for nv backup and restore + //#ifdef FEATURE_OPPO_NV_BACKUP + //if (client_id != MPSS_RMTS_CLIENT_ID) + //#else + if ((client_id != MPSS_RMTS_CLIENT_ID) && (client_id != MPSS_OEMBACK_CLIENT_ID)) + //#endif /* FEATURE_OPPO_NV_BACKUP */ + //#endif /* VENDOR_EDIT */ return; if (vm_nav_path) { diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c index af9c698323ba..0b1dc21a92af 100644 --- a/drivers/usb/dwc3/dwc3-msm.c +++ b/drivers/usb/dwc3/dwc3-msm.c @@ -4907,6 +4907,12 @@ static int dwc3_msm_gadget_vbus_draw(struct dwc3_msm *mdwc, unsigned int mA) if (mdwc->max_power == mA || psy_type != POWER_SUPPLY_TYPE_USB) return 0; +#ifdef OPLUS_FEATURE_CHG_BASIC + dev_info(mdwc->dev, "Avail curr from USB = %u, pre max_power = %u\n", mA, mdwc->max_power); + if (mA == 0 || mA == 2) { + return 0; + } +#endif /* Set max current limit in uA */ pval.intval = 1000 * mA; diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index d32d63b6e8ed..aa1a2857100d 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c @@ -408,7 +408,10 @@ static int dwc3_ep0_handle_status(struct dwc3 *dwc, dwc->ep0_usb_req.request.length = sizeof(*response_pkt); dwc->ep0_usb_req.request.buf = dwc->setup_buf; dwc->ep0_usb_req.request.complete = dwc3_ep0_status_cmpl; - +#ifdef OPLUS_FEATURE_CHG_BASIC +/* Gang.Yan@BSP.CHG.Basic, Add for dump issue */ + dwc->ep0_usb_req.request.dma = DMA_ERROR_CODE; +#endif return __dwc3_gadget_ep0_queue(dep, &dwc->ep0_usb_req); } @@ -865,7 +868,10 @@ static int dwc3_ep0_set_sel(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) dwc->ep0_usb_req.request.length = dep->endpoint.maxpacket; dwc->ep0_usb_req.request.buf = dwc->setup_buf; dwc->ep0_usb_req.request.complete = dwc3_ep0_set_sel_cmpl; - +#ifdef OPLUS_FEATURE_CHG_BASIC +/* Gang.Yan@BSP.CHG.Basic, 2020/03/25, Add for dump issue */ + dwc->ep0_usb_req.request.dma = DMA_ERROR_CODE; +#endif return __dwc3_gadget_ep0_queue(dep, &dwc->ep0_usb_req); } diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index c43681de5392..5835d669ffef 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -855,6 +855,10 @@ out: static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep) { +#ifdef VENDOR_EDIT +/*Gang.Yan@BSP.CHG.BASIC,06/04/2020,CR 2645944 to solve the dump*/ + int retries = 40; +#endif struct dwc3_request *req; int ret; @@ -876,7 +880,15 @@ static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep) dwc->eps[0]->trb_enqueue = 0; dwc->eps[1]->trb_enqueue = 0; } - +#ifdef VENDOR_EDIT +/*Gang.Yan@BSP.CHG.BASIC,06/04/2020,CR 2645944 to solve the dump*/ + do { + udelay(50); + } while ((dep->flags & DWC3_EP_END_TRANSFER_PENDING) && --retries); + if (!retries) + dbg_log_string("ep end_xfer cmd completion timeout for %d", + dep->number); +#endif /* - giveback all requests to gadget driver */ while (!list_empty(&dep->started_list)) { req = next_request(&dep->started_list); diff --git a/drivers/usb/gadget/function/f_accessory.c b/drivers/usb/gadget/function/f_accessory.c index a62c8eece18b..0316ae9a239b 100644 --- a/drivers/usb/gadget/function/f_accessory.c +++ b/drivers/usb/gadget/function/f_accessory.c @@ -302,6 +302,10 @@ static void acc_complete_set_string(struct usb_ep *ep, struct usb_request *req) struct acc_dev *dev = ep->driver_data; char *string_dest = NULL; int length = req->actual; +#ifdef OPLUS_FEATURE_CHG_BASIC +/* tongfeng.Huang@BSP.CHG.Basic, 2018/11/17, Add for dump issue */ + unsigned long flags; +#endif if (req->status != 0) { pr_err("acc_complete_set_string, err %d\n", req->status); @@ -327,7 +331,32 @@ static void acc_complete_set_string(struct usb_ep *ep, struct usb_request *req) case ACCESSORY_STRING_SERIAL: string_dest = dev->serial; break; +#ifdef OPLUS_FEATURE_CHG_BASIC +/* Gang.Yan@BSP.CHG.Basic, 2020/03/25, Add for dump issue */ + default: + pr_err("unknown accessory string index %d\n", + dev->string_index); + return; +#endif } +#ifdef OPLUS_FEATURE_CHG_BASIC +/* Gang.Yan@BSP.CHG.Basic, 2020/03/25, Add for dump issue */ + if (!length) { + pr_debug("zero length for accessory string index %d\n", + dev->string_index); + return; + } + + if (length >= ACC_STRING_SIZE) + length = ACC_STRING_SIZE - 1; + + spin_lock_irqsave(&dev->lock, flags); + memcpy(string_dest, req->buf, length); + /* ensure zero termination */ + string_dest[length] = 0; + spin_unlock_irqrestore(&dev->lock, flags); + +#else if (string_dest) { unsigned long flags; @@ -343,6 +372,7 @@ static void acc_complete_set_string(struct usb_ep *ep, struct usb_request *req) pr_err("unknown accessory string index %d\n", dev->string_index); } +#endif } static void acc_complete_set_hid_report_desc(struct usb_ep *ep, diff --git a/drivers/usb/pd/policy_engine.c b/drivers/usb/pd/policy_engine.c index ff13ee1e70de..0b01e13f230d 100644 --- a/drivers/usb/pd/policy_engine.c +++ b/drivers/usb/pd/policy_engine.c @@ -413,6 +413,10 @@ struct usbpd { int requested_current; /* mA */ bool pd_connected; bool in_explicit_contract; +#ifdef VENDOR_EDIT +/*Gang.Yan@BSP.CHG.BASIC, 2020/09/09,add for PD+SVOOC adapter*/ + bool in_good_connect; +#endif bool peer_usb_comm; bool peer_pr_swap; bool peer_dr_swap; @@ -491,7 +495,11 @@ struct usbpd { }; static LIST_HEAD(_usbpd); /* useful for debugging */ - +#ifdef VENDOR_EDIT +/*Gang.Yan@BSP.CHG.BASIC, 2020/09/09,add for PD+SVOOC adapter*/ +int oplus_usbpd_send_svdm(u16 svid, u8 cmd, enum usbpd_svdm_cmd_type cmd_type, + int obj_pos, const u32 *vdos, int num_vdos); +#endif static const unsigned int usbpd_extcon_cable[] = { EXTCON_USB, EXTCON_USB_HOST, @@ -862,6 +870,10 @@ static int pd_select_pdo(struct usbpd *pd, int pdo_pos, int uv, int ua) return 0; } +#ifdef VENDOR_EDIT +/*lizhijie@BSP.CHG.Basic 2020/03/16 lzj add for TYPE c to c*/ +extern void oplus_set_opluschg_pd_sdp(bool value); +#endif static int pd_eval_src_caps(struct usbpd *pd) { int i; @@ -900,6 +912,14 @@ static int pd_eval_src_caps(struct usbpd *pd) power_supply_set_property(pd->usb_psy, POWER_SUPPLY_PROP_PD_ACTIVE, &val); +#ifdef VENDOR_EDIT +/*lizhijie@BSP.CHG.Basic 2020/03/16 lzj add for TYPE c to c*/ + if (pd->peer_usb_comm && pd->current_dr == DR_UFP && !pd->pd_connected) { + printk("set opluschg_pd_sdp = true\n"); + oplus_set_opluschg_pd_sdp(true); + } +#endif + /* First time connecting to a PD source and it supports USB data */ if (pd->peer_usb_comm && pd->current_dr == DR_UFP && !pd->pd_connected) start_usb_peripheral(pd); @@ -1414,9 +1434,12 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state) phy_params.data_role = pd->current_dr; phy_params.power_role = pd->current_pr; - if (pd->vconn_enabled) - phy_params.frame_filter_val |= - FRAME_FILTER_EN_SOPI; +#ifndef VENDOR_EDIT +/* tongfeng.Huang@BSP.CHG.Basic, 2020/02/13, add for pd+vooc adapter compatibility */ + //if (pd->vconn_enabled) + // phy_params->frame_filter_val |= FRAME_FILTER_EN_SOPI; +#endif + ret = pd_phy_open(&phy_params); if (ret) { @@ -1590,6 +1613,10 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state) pd_send_hard_reset(pd); pd->in_explicit_contract = false; +#ifdef VENDOR_EDIT +/*Gang.Yan@BSP.CHG.BASIC, 2020/09/09,add for PD+SVOOC adapter*/ + pd->in_good_connect = false; +#endif pd->rdo = 0; rx_msg_cleanup(pd); reset_vdm_state(pd); @@ -1650,11 +1677,12 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state) phy_params.data_role = pd->current_dr; phy_params.power_role = pd->current_pr; - - if (pd->vconn_enabled) - phy_params.frame_filter_val |= - FRAME_FILTER_EN_SOPI; - +#ifndef VENDOR_EDIT +/* tongfeng.Huang@BSP.CHG.Basic, 2020/02/13, add for pd+vooc adapter compatibility */ + //if (pd->vconn_enabled) + //phy_params.frame_filter_val |= + //FRAME_FILTER_EN_SOPI; +#endif ret = pd_phy_open(&phy_params); if (ret) { WARN_ON_ONCE(1); @@ -1726,6 +1754,12 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state) dual_role_instance_changed(pd->dual_role); pd->in_explicit_contract = true; +#ifdef VENDOR_EDIT +/*Gang.Yan@BSP.CHG.BASIC, 2020/09/09,add for PD+SVOOC adapter*/ + pd->in_good_connect = true; + oplus_usbpd_send_svdm(USBPD_SID, USBPD_SVDM_DISCOVER_SVIDS, + SVDM_CMD_TYPE_INITIATOR, 0, NULL, 0); +#endif if (pd->vdm_tx) kick_sm(pd, 0); @@ -1848,7 +1882,14 @@ int usbpd_send_vdm(struct usbpd *pd, u32 vdm_hdr, const u32 *vdos, int num_vdos) kfree(pd->vdm_tx); pd->vdm_tx = NULL; } - +#ifdef VENDOR_EDIT +/*Gang.Yan@BSP.CHG.BASIC, 2020/09/09,add for PD+SVOOC adapter*/ + if (pd->current_state != PE_SRC_READY && + pd->current_state != PE_SNK_READY) { + usbpd_err(&pd->dev, "VDM not allowed: PD not in Ready state\n"); + return -EAGAIN; + } +#endif vdm_tx = kzalloc(sizeof(*vdm_tx), GFP_KERNEL); if (!vdm_tx) return -ENOMEM; @@ -2406,10 +2447,15 @@ static void vconn_swap(struct usbpd *pd) pd->vconn_enabled = true; +#ifndef VENDOR_EDIT +/* tongfeng.Huang@BSP.CHG.Basic, 2020/02/13, add for pd+vooc adapter compatibility */ + //pd_phy_update_frame_filter(FRAME_FILTER_EN_SOP | + // FRAME_FILTER_EN_SOPI | + // FRAME_FILTER_EN_HARD_RESET); +#else pd_phy_update_frame_filter(FRAME_FILTER_EN_SOP | - FRAME_FILTER_EN_SOPI | FRAME_FILTER_EN_HARD_RESET); - +#endif /* * Small delay to ensure Vconn has ramped up. This is well * below tVCONNSourceOn (100ms) so we still send PS_RDY within @@ -2537,6 +2583,10 @@ static void usbpd_sm(struct work_struct *w) pd->in_pr_swap = false; pd->pd_connected = false; pd->in_explicit_contract = false; +#ifdef VENDOR_EDIT +/*Gang.Yan@BSP.CHG.BASIC, 2020/09/09,add for PD+SVOOC adapter*/ + pd->in_good_connect = false; +#endif pd->hard_reset_recvd = false; pd->caps_count = 0; pd->hard_reset_count = 0; @@ -2626,6 +2676,10 @@ static void usbpd_sm(struct work_struct *w) POWER_SUPPLY_PROP_PR_SWAP, &val); pd->in_explicit_contract = false; +#ifdef VENDOR_EDIT +/*Gang.Yan@BSP.CHG.BASIC, 2020/09/09,add for PD+SVOOC adapter*/ + pd->in_good_connect = false; +#endif pd->selected_pdo = pd->requested_pdo = 0; pd->rdo = 0; rx_msg_cleanup(pd); @@ -4099,6 +4153,8 @@ static ssize_t select_pdo_store(struct device *dev, int pdo, uv = 0, ua = 0; int ret; + return size; + mutex_lock(&pd->swap_lock); /* Only allowed if we are already in explicit sink contract */ @@ -4510,6 +4566,94 @@ static void usbpd_release(struct device *dev) kfree(pd); } +#ifdef VENDOR_EDIT +/* lizhijie@BSP.CHG.Basic, 2020/03/06, lzj Add for PD */ +struct usbpd *pd_lobal = NULL; +int oplus_usbpd_send_svdm(u16 svid, u8 cmd, enum usbpd_svdm_cmd_type cmd_type, + int obj_pos, const u32 *vdos, int num_vdos) { + struct usbpd *pd = pd_lobal; + u32 svdm_hdr = SVDM_HDR(svid, 0, obj_pos, cmd_type, cmd); + + return usbpd_send_vdm(pd, svdm_hdr, vdos, num_vdos); +} +bool oplus_check_pd_state_ready(void) +{ + return (pd_lobal->in_good_connect); +} +EXPORT_SYMBOL(oplus_check_pd_state_ready); + +int oplus_pdo_select(int vbus_mv, int ibus_ma) +{ + int i = 0; + int rc = 0; + u32 pdo = 0; + struct usbpd *pd = pd_lobal; + + for (i = 0; i < ARRAY_SIZE(pd->received_pdos); i++) { + pdo = pd->received_pdos[i]; + if (vbus_mv == PD_SRC_PDO_FIXED_VOLTAGE(pdo) * 50 || pdo == 0) + break; + } + + mutex_lock(&pd->swap_lock); + + /* Only allowed if we are already in explicit sink contract */ + if (pd->current_state != PE_SNK_READY || !is_sink_tx_ok(pd)) { + printk(KERN_ERR "%s: cannot select new pdo yet\n", __func__); + rc = -EBUSY; + goto out; + } + + if (i > 7) { + printk(KERN_ERR "%s: inval pdo[0x%x]\n", __func__, pdo); + rc = -EINVAL; + goto out; + } + + if (vbus_mv != PD_SRC_PDO_FIXED_VOLTAGE(pdo) * 50) { + if (i > 0) { + printk(KERN_ERR "%s: can not find vbus_mv[%d], the last pdos[%d]=[%d]\n", __func__, + vbus_mv, i -1, PD_SRC_PDO_FIXED_VOLTAGE(pd->received_pdos[i - 1]) * 50); + } else { + printk(KERN_ERR "%s: can not find vbus_mv[%d], pdos0=[%d]\n", __func__, + vbus_mv, PD_SRC_PDO_FIXED_VOLTAGE(pd->received_pdos[i]) * 50); + } + rc = -EINVAL; + goto out; + } + + rc = pd_select_pdo(pd, i + 1, vbus_mv * 1000, ibus_ma * 1000); + if (rc) { + printk(KERN_ERR "%s: pd_select_pdo fail, rc=%d\n", __func__, rc); + goto out; + } + + reinit_completion(&pd->is_ready); + pd->send_request = true; + kick_sm(pd, 0); + + /* wait for operation to complete */ + if (!wait_for_completion_timeout(&pd->is_ready, msecs_to_jiffies(1000))) { + printk(KERN_ERR "%s: pdo[%d], vbus_mv[%d], ibus_ma[%d] request timed out\n", + __func__, i, vbus_mv, ibus_ma); + rc = -ETIMEDOUT; + goto out; + } + + /* determine if request was accepted/rejected */ + if (pd->selected_pdo != pd->requested_pdo || + pd->current_voltage != pd->requested_voltage) { + printk(KERN_ERR "%s: request rejected\n", __func__); + rc = -EINVAL; + } + +out: + pd->send_request = false; + mutex_unlock(&pd->swap_lock); + return rc; +} +EXPORT_SYMBOL(oplus_pdo_select); +#endif /*VENDOR_EDIT*/ static int num_pd_instances; @@ -4707,6 +4851,11 @@ struct usbpd *usbpd_create(struct device *parent) /* force read initial power_supply values */ psy_changed(&pd->psy_nb, PSY_EVENT_PROP_CHANGED, pd->usb_psy); +#ifdef VENDOR_EDIT +/* lizhijie@PSW.BSP.CHG.Basic, 2020/03/06, lzj Add for handle xiaomi typec headset dsp crash issue(1+) */ + pd_lobal = pd; +#endif + return pd; del_inst: diff --git a/drivers/usb/phy/phy-msm-qusb-v2.c b/drivers/usb/phy/phy-msm-qusb-v2.c index 75d4aa92a3a9..02cb1bdf8daf 100644 --- a/drivers/usb/phy/phy-msm-qusb-v2.c +++ b/drivers/usb/phy/phy-msm-qusb-v2.c @@ -30,7 +30,11 @@ /* QUSB2PHY_PWR_CTRL1 register related bits */ #define PWR_CTRL1_POWR_DOWN BIT(0) + +#ifdef VENDOR_EDIT +//Gang.Yan@BSP.CHG.Basic,2020/08/12,CR#2591923,add for rerun CDP #define CLAMP_N_EN BIT(1) +#endif /* QUSB2PHY_PLL_COMMON_STATUS_ONE register related bits */ #define CORE_READY_STATUS BIT(0) @@ -78,9 +82,12 @@ /* STAT5 register bits */ #define VSTATUS_PLL_LOCK_STATUS_MASK BIT(0) +#ifdef VENDOR_EDIT +//Gang.Yan@BSP.CHG.Basic,2020/08/12,CR#2591923,add for rerun CDP /* DEBUG_CTRL4 register bits */ #define FORCED_UTMI_DPPULLDOWN BIT(2) #define FORCED_UTMI_DMPULLDOWN BIT(3) +#endif enum qusb_phy_reg { PORT_TUNE1, @@ -92,8 +99,11 @@ enum qusb_phy_reg { BIAS_CTRL_2, DEBUG_CTRL1, DEBUG_CTRL2, +#ifdef VENDOR_EDIT +//Gang.Yan@BSP.CHG.Basic,2020/08/12,CR#2591923,add for rerun CDP DEBUG_CTRL3, DEBUG_CTRL4, +#endif STAT5, USB2_PHY_REG_MAX, }; @@ -389,9 +399,16 @@ static void qusb_phy_get_tune1_param(struct qusb_phy *qphy) qphy->tune_val = TUNE_VAL_MASK(qphy->tune_val, qphy->efuse_bit_pos, bit_mask); reg = readb_relaxed(qphy->base + qphy->phy_reg[PORT_TUNE1]); +#ifndef VENDOR_EDIT +//Gang.Yan@BSP.CHG.Basic,2020/07/31,add of 19365 solve bad board + if (qphy->tune_val) { + reg = reg & 0x0f; + reg |= (qphy->tune_val << 4); + } +#else reg = reg & 0x0f; reg |= (qphy->tune_val << 4); - +#endif qphy->tune_val = reg; } @@ -408,7 +425,8 @@ static void qusb_phy_write_seq(void __iomem *base, u32 *seq, int cnt, usleep_range(delay, (delay + 2000)); } } - +#ifdef VENDOR_EDIT +//Gang.Yan@BSP.CHG.Basic,2020/08/12,CR#2591923,add for rerun CDP static void msm_usb_write_readback(void __iomem *base, u32 offset, const u32 mask, u32 val) { @@ -427,6 +445,7 @@ static void msm_usb_write_readback(void __iomem *base, u32 offset, pr_err("%s: write: %x to QSCRATCH: %x FAILED\n", __func__, val, offset); } +#endif static void qusb_phy_reset(struct qusb_phy *qphy) { @@ -466,7 +485,8 @@ static void qusb_phy_host_init(struct usb_phy *phy) qusb_phy_write_seq(qphy->base, qphy->qusb_phy_host_init_seq, qphy->host_init_seq_len, 0); - +#ifndef VENDOR_EDIT +//Gang.Yan@BSP.CHG.Basic,2020/07/31,add of 19365 solve bad board if (qphy->efuse_reg) { if (!qphy->tune_val) qusb_phy_get_tune1_param(qphy); @@ -478,7 +498,9 @@ static void qusb_phy_host_init(struct usb_phy *phy) qphy->tune_val = readb_relaxed(qphy->base + qphy->phy_reg[PORT_TUNE1]); } - +#else + qusb_phy_get_tune1_param(qphy); +#endif writel_relaxed(qphy->tune_val | BIT(7), qphy->base + qphy->phy_reg[PORT_TUNE1]); pr_debug("%s(): Programming TUNE1 parameter as:%x\n", @@ -517,6 +539,88 @@ static void qusb_phy_host_init(struct usb_phy *phy) } } +#ifdef VENDOR_EDIT +/* Gang.Yan PSW.BSP.CHG 2020-03-06 for usb eye */ +static int DEVICE_TUNE1; +module_param_named(DEVICE_TUNE1, DEVICE_TUNE1, int, 0600); +static int DEVICE_TUNE2; +module_param_named(DEVICE_TUNE2, DEVICE_TUNE2, int, 0600); +static int DEVICE_TUNE3; +module_param_named(DEVICE_TUNE3, DEVICE_TUNE3, int, 0600); +static int DEVICE_TUNE4; +module_param_named(DEVICE_TUNE4, DEVICE_TUNE4, int, 0600); +static int DEVICE_TUNE5; +module_param_named(DEVICE_TUNE5, DEVICE_TUNE5, int, 0600); +static int DEVICE_BIAS2; +module_param_named(DEVICE_BIAS2, DEVICE_BIAS2, int, 0600); + +static int HOST_TUNE1; +module_param_named(HOST_TUNE1, HOST_TUNE1, int, 0600); +static int HOST_TUNE2; +module_param_named(HOST_TUNE2, HOST_TUNE2, int, 0600); +static int HOST_TUNE3; +module_param_named(HOST_TUNE3, HOST_TUNE3, int, 0600); +static int HOST_TUNE4; +module_param_named(HOST_TUNE4, HOST_TUNE4, int, 0600); +static int HOST_TUNE5; +module_param_named(HOST_TUNE5, HOST_TUNE5, int, 0600); +static int HOST_BIAS2; +module_param_named(HOST_BIAS2, HOST_BIAS2, int, 0600); + +static void override_phy_tune(struct usb_phy *phy) +{ + struct qusb_phy *qphy = container_of(phy, struct qusb_phy, phy); + + if (qphy->phy.flags & PHY_HOST_MODE) { + if (HOST_TUNE1 != 0) + writel_relaxed(HOST_TUNE1, qphy->base + 0x240); + if (HOST_TUNE2 != 0) + writel_relaxed(HOST_TUNE2, qphy->base + 0x244); + if (HOST_TUNE3 != 0) + writel_relaxed(HOST_TUNE3, qphy->base + 0x248); + if (HOST_TUNE4 != 0) + writel_relaxed(HOST_TUNE4, qphy->base + 0x24C); + if (HOST_TUNE5 != 0) + writel_relaxed(HOST_TUNE5, qphy->base + 0x250); + if (HOST_BIAS2 != 0) + writel_relaxed(HOST_BIAS2, qphy->base + qphy->phy_reg[BIAS_CTRL_2]); + HOST_TUNE1 = readb_relaxed(qphy->base + 0x240); + HOST_TUNE2 = readb_relaxed(qphy->base + 0x244); + HOST_TUNE3 = readb_relaxed(qphy->base + 0x248); + HOST_TUNE4 = readb_relaxed(qphy->base + 0x24C); + HOST_TUNE5 = readb_relaxed(qphy->base + 0x250); + HOST_BIAS2 = readb_relaxed(qphy->base + qphy->phy_reg[BIAS_CTRL_2]); + } else { + if (DEVICE_TUNE1 != 0) + writel_relaxed(DEVICE_TUNE1, qphy->base + 0x240); + if (DEVICE_TUNE2 != 0) + writel_relaxed(DEVICE_TUNE2, qphy->base + 0x244); + if (DEVICE_TUNE3 != 0) + writel_relaxed(DEVICE_TUNE3, qphy->base + 0x248); + if (DEVICE_TUNE4 != 0) + writel_relaxed(DEVICE_TUNE4, qphy->base + 0x24C); + if (DEVICE_TUNE5 != 0) + writel_relaxed(DEVICE_TUNE5, qphy->base + 0x250); + if (DEVICE_BIAS2 != 0) + writel_relaxed(DEVICE_BIAS2, qphy->base + qphy->phy_reg[BIAS_CTRL_2]); + DEVICE_TUNE1 = readb_relaxed(qphy->base + 0x240); + DEVICE_TUNE2 = readb_relaxed(qphy->base + 0x244); + DEVICE_TUNE3 = readb_relaxed(qphy->base + 0x248); + DEVICE_TUNE4 = readb_relaxed(qphy->base + 0x24C); + DEVICE_TUNE5 = readb_relaxed(qphy->base + 0x250); + DEVICE_BIAS2 = readb_relaxed(qphy->base + qphy->phy_reg[BIAS_CTRL_2]); + } + + dev_err(phy->dev, "%s %x %x %x %x %x %x %x\n", __func__, + readb_relaxed(qphy->base + qphy->phy_reg[BIAS_CTRL_2]), + readb_relaxed(qphy->base + 0x240), readb_relaxed(qphy->base + 0x244), + readb_relaxed(qphy->base + 0x248), readb_relaxed(qphy->base + 0x24C), + readb_relaxed(qphy->base + 0x250), qphy->phy.flags & PHY_HOST_MODE); + + return; +} +#endif + static int qusb_phy_init(struct usb_phy *phy) { struct qusb_phy *qphy = container_of(phy, struct qusb_phy, phy); @@ -529,6 +633,10 @@ static int qusb_phy_init(struct usb_phy *phy) if (qphy->qusb_phy_host_init_seq && qphy->phy.flags & PHY_HOST_MODE) { qusb_phy_host_init(phy); +#ifdef VENDOR_EDIT +/* Gang.Yan PSW.BSP.CHG 2020-03-06 for usb eye */ + override_phy_tune(phy); +#endif return 0; } @@ -591,6 +699,10 @@ static int qusb_phy_init(struct usb_phy *phy) if (qphy->bias_ctrl2) writel_relaxed(qphy->bias_ctrl2, qphy->base + qphy->phy_reg[BIAS_CTRL_2]); +#ifdef VENDOR_EDIT +/* Gang.Yan PSW.BSP.CHG 2020-03-06 for usb eye */ + override_phy_tune(phy); +#endif /* ensure above writes are completed before re-enabling PHY */ wmb(); @@ -769,6 +881,8 @@ static int qusb_phy_notify_disconnect(struct usb_phy *phy, return 0; } +#ifdef VENDOR_EDIT +//Gang.Yan@BSP.CHG.Basic,2020/08/12,CR#2591923,add for rerun CDP static int msm_qusb_phy_drive_dp_pulse(struct usb_phy *phy, unsigned int interval_ms) { @@ -824,6 +938,7 @@ static int msm_qusb_phy_drive_dp_pulse(struct usb_phy *phy, return 0; } +#endif static int qusb_phy_dpdm_regulator_enable(struct regulator_dev *rdev) { @@ -1224,8 +1339,10 @@ static int qusb_phy_probe(struct platform_device *pdev) qphy->phy.type = USB_PHY_TYPE_USB2; qphy->phy.notify_connect = qusb_phy_notify_connect; qphy->phy.notify_disconnect = qusb_phy_notify_disconnect; +#ifdef VENDOR_EDIT +//Gang.Yan@BSP.CHG.Basic,2020/08/12,CR#2591923,add for rerun CDP qphy->phy.drive_dp_pulse = msm_qusb_phy_drive_dp_pulse; - +#endif ret = usb_add_phy_dev(&qphy->phy); if (ret) return ret; diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 298ce75a2178..c3b122f68d65 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig @@ -476,6 +476,10 @@ config BACKLIGHT_ARCXCNN If you have an ARCxCnnnn family backlight say Y to enable the backlight driver. +config BACKLIGHT_LM3697 + bool "LM3697 Backlight" + help + lcd backlight for 19696. endif # BACKLIGHT_CLASS_DEVICE endif # BACKLIGHT_LCD_SUPPORT diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index f6627e5e2120..d63afd6042a3 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile @@ -58,3 +58,4 @@ obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o obj-$(CONFIG_BACKLIGHT_TPS65217) += tps65217_bl.o obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o obj-$(CONFIG_BACKLIGHT_ARCXCNN) += arcxcnn_bl.o +obj-$(CONFIG_BACKLIGHT_LM3697) += lm3697_bl.o diff --git a/drivers/video/backlight/qcom-spmi-wled.c b/drivers/video/backlight/qcom-spmi-wled.c index 0c025a574780..738bf34c7e58 100644 --- a/drivers/video/backlight/qcom-spmi-wled.c +++ b/drivers/video/backlight/qcom-spmi-wled.c @@ -202,6 +202,12 @@ static const int version_table[] = { [2] = WLED_PM8150L, }; +#ifdef OPLUS_BUG_STABILITY +/* Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/12/17, close cabc when low brightness */ +#define CABC_EN_DYN_INVALID (-EINVAL) +#define CABC_EN_DYN_ENABLED (1) +#define CABC_EN_DYN_DISABLED (0) +#endif /* OPLUS_BUG_STABILITY */ struct wled_config { int boost_i_limit; int ovp; @@ -214,6 +220,11 @@ struct wled_config { bool en_cabc; bool ext_pfet_sc_pro_en; bool auto_calib_enabled; +#ifdef OPLUS_BUG_STABILITY +/* Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/12/17, close cabc when low brightness */ + int cabc_en_dyn; + u32 cabc_en_dyn_brightness; +#endif /* OPLUS_BUG_STABILITY */ }; struct wled_flash_config { @@ -426,16 +437,39 @@ static int wled5_sample_hold_control(struct wled *wled, u16 brightness, return rc; } +#ifdef OPLUS_BUG_STABILITY +/* Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/12/17, close cabc when low brightness */ +static int wled5_cabc_config(struct wled *wled, bool enable); +#endif /* OPLUS_BUG_STABILITY */ static int wled5_set_brightness(struct wled *wled, u16 brightness) { int rc, offset; u16 low_limit = wled->max_brightness * 1 / 1000; u8 val, v[2], brightness_msb_mask; +#ifdef OPLUS_BUG_STABILITY +/* Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/12/17, close cabc when low brightness */ + struct wled_config *cfg = &wled->cfg; + int cabc_en_dyn_tmp = CABC_EN_DYN_ENABLED; +#endif /* OPLUS_BUG_STABILITY */ /* WLED5's lower limit is 0.1% */ if (brightness > 0 && brightness < low_limit) brightness = low_limit; +#ifdef OPLUS_BUG_STABILITY +/* Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/12/17, close cabc when low brightness */ + if((CABC_EN_DYN_INVALID != cfg->cabc_en_dyn) && brightness) { + if(brightness <= cfg->cabc_en_dyn_brightness) + cabc_en_dyn_tmp = CABC_EN_DYN_DISABLED; + + if(cabc_en_dyn_tmp != cfg->cabc_en_dyn) { + cfg->cabc_en_dyn = cabc_en_dyn_tmp; + rc = wled5_cabc_config(wled, !!cabc_en_dyn_tmp); + pr_info("brightness: %d, cabc enable: %d\n", brightness, cabc_en_dyn_tmp); + } + } +#endif /* OPLUS_BUG_STABILITY */ + brightness_msb_mask = 0xf; if (wled->max_brightness == WLED_MAX_BRIGHTNESS_15B) brightness_msb_mask = 0x7f; @@ -1377,6 +1411,11 @@ static const struct wled_config wled4_config_defaults = { .en_cabc = 0, .ext_pfet_sc_pro_en = 0, .auto_calib_enabled = 0, +#ifdef OPLUS_BUG_STABILITY +/* Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/12/17, close cabc when low brightness */ + .cabc_en_dyn = CABC_EN_DYN_INVALID, + .cabc_en_dyn_brightness = 0, +#endif /* OPLUS_BUG_STABILITY */ }; static const struct wled_config wled5_config_defaults = { @@ -1390,6 +1429,11 @@ static const struct wled_config wled5_config_defaults = { .en_cabc = 0, .ext_pfet_sc_pro_en = 0, .auto_calib_enabled = 0, +#ifdef OPLUS_BUG_STABILITY +/* Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/12/17, close cabc when low brightness */ + .cabc_en_dyn = CABC_EN_DYN_INVALID, + .cabc_en_dyn_brightness = 0, +#endif /* OPLUS_BUG_STABILITY */ }; struct wled_var_cfg { @@ -2302,6 +2346,19 @@ static int wled_configure(struct wled *wled, struct device *dev) *bool_opts[i].val_ptr = true; } +#ifdef OPLUS_BUG_STABILITY +/* Yuwei.Zhang@MULTIMEDIA.DISPLAY.LCD, 2020/12/17, close cabc when low brightness */ + if (is_wled5(wled)) { + rc = of_property_read_u32(dev->of_node, "qcom,cabc-en-brightness", &val); + if (!rc) { + cfg->cabc_en_dyn = cfg->cabc_sel ? CABC_EN_DYN_ENABLED : CABC_EN_DYN_DISABLED; + cfg->cabc_en_dyn_brightness = val; + } + pr_info("cabc_sel = %d, cabc_en_dyn = %d, cabc_en_dyn_brightness = %d\n", + cfg->cabc_sel, cfg->cabc_en_dyn, cfg->cabc_en_dyn_brightness); + } +#endif /* OPLUS_BUG_STABILITY */ + wled->sc_irq = platform_get_irq_byname(wled->pdev, "sc-irq"); if (wled->sc_irq < 0) dev_dbg(&wled->pdev->dev, "sc irq is not used\n"); diff --git a/fs/Kconfig b/fs/Kconfig index 7363d6b87d9b..ea05d26b8ca8 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -14,7 +14,12 @@ config FS_IOMAP bool source "fs/ext2/Kconfig" -source "fs/ext4/Kconfig" +#ifdef VENDOR_EDIT +#Yuwei.Guan@TECH.Storage.FS.OEXT4,2020/04/18, add to use oext4 Kconfig +source "fs/oext4/Kconfig" +#else +#source "fs/ext4/Kconfig" +#endif source "fs/jbd2/Kconfig" config FS_MBCACHE @@ -32,7 +37,12 @@ source "fs/gfs2/Kconfig" source "fs/ocfs2/Kconfig" source "fs/btrfs/Kconfig" source "fs/nilfs2/Kconfig" -source "fs/f2fs/Kconfig" + +#ifdef CONFIG_OPLUS_FEATURE_OF2FS +source "fs/of2fs/Kconfig" +#else +#source "fs/f2fs/Kconfig" +#endif config FS_DAX bool "Direct Access (DAX) support" @@ -313,6 +323,11 @@ source "fs/nls/Kconfig" source "fs/dlm/Kconfig" source "fs/unicode/Kconfig" +#ifdef OPLUS_FEATURE_EXFAT_SUPPORT +#huyu@BSP.Driver, 2020/08/13, Add for exfat filesystem +source "fs/exfat/Kconfig" +#endif /*OPLUS_FEATURE_EXFAT_SUPPORT*/ + config FILE_TABLE_DEBUG bool "Enable FILE_TABLE_DEBUG" help diff --git a/fs/Makefile b/fs/Makefile index 580e49be1219..c3530611718b 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -67,7 +67,12 @@ obj-$(CONFIG_DLM) += dlm/ # Do not add any filesystems before this line obj-$(CONFIG_FSCACHE) += fscache/ obj-$(CONFIG_REISERFS_FS) += reiserfs/ + +ifneq ($(TARGET_PRODUCT),qssi) +obj-$(CONFIG_EXT4_FS) += oext4/ +else obj-$(CONFIG_EXT4_FS) += ext4/ +endif # We place ext4 before ext2 so that clean ext3 root fs's do NOT mount using the # ext2 driver, which doesn't know about journalling! Explicitly request ext2 # by giving the rootfstype= parameter. @@ -85,7 +90,11 @@ obj-$(CONFIG_ISO9660_FS) += isofs/ obj-$(CONFIG_HFSPLUS_FS) += hfsplus/ # Before hfs to find wrapped HFS+ obj-$(CONFIG_HFS_FS) += hfs/ obj-$(CONFIG_ECRYPT_FS) += ecryptfs/ +ifneq ($(TARGET_PRODUCT),qssi) +obj-$(CONFIG_SDCARD_FS) += osdcardfs/ +else obj-$(CONFIG_SDCARD_FS) += sdcardfs/ +endif obj-$(CONFIG_VXFS_FS) += freevxfs/ obj-$(CONFIG_NFS_FS) += nfs/ obj-$(CONFIG_EXPORTFS) += exportfs/ @@ -128,8 +137,16 @@ obj-$(CONFIG_TRACING) += tracefs/ obj-$(CONFIG_OCFS2_FS) += ocfs2/ obj-$(CONFIG_BTRFS_FS) += btrfs/ obj-$(CONFIG_GFS2_FS) += gfs2/ +ifeq ($(CONFIG_OPLUS_FEATURE_OF2FS),y) +obj-$(CONFIG_F2FS_FS) += of2fs/ +else obj-$(CONFIG_F2FS_FS) += f2fs/ +endif obj-y += exofs/ # Multiple modules obj-$(CONFIG_CEPH_FS) += ceph/ obj-$(CONFIG_PSTORE) += pstore/ obj-$(CONFIG_EFIVAR_FS) += efivarfs/ +#ifdef OPLUS_FEATURE_EXFAT_SUPPORT +#huyu@BSP.Driver, 2020/08/13, Add for exfat filesystem +obj-$(CONFIG_EXFAT_FS) += exfat/ +#endif /*OPLUS_FEATURE_EXFAT_SUPPORT*/ diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 2c433c95adb5..a0f558a6a687 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -2188,6 +2188,12 @@ static void fill_extnum_info(struct elfhdr *elf, struct elf_shdr *shdr4extnum, shdr4extnum->sh_info = segs; } +#ifdef OPLUS_BUG_STABILITY +// Bin.Xu@BSP.Kernel.Stability, 2020/4/1, transplant checklist: pre-allocation 64KB memory for coredump +static elf_addr_t *oppo_coredump_addr = NULL; +#define PREALLOC_DUMPMEM_SIZE 64 * 1024 +#endif /* OPLUS_BUG_STABILITY */ + /* * Actual dumper * @@ -2279,7 +2285,20 @@ static int elf_core_dump(struct coredump_params *cprm) if (segs - 1 > ULONG_MAX / sizeof(*vma_filesz)) goto end_coredump; + +#ifdef OPLUS_BUG_STABILITY +// Bin.Xu@BSP.Kernel.Stability, 2020/4/1, transplant checklist: pre-allocation 64KB memory for coredump + if (oppo_coredump_addr && (segs - 1) * sizeof(*vma_filesz) <= PREALLOC_DUMPMEM_SIZE) + vma_filesz = oppo_coredump_addr; + else { + kfree(oppo_coredump_addr); + oppo_coredump_addr = NULL; + vma_filesz = vmalloc((segs - 1) * sizeof(*vma_filesz)); + } +#else vma_filesz = vmalloc((segs - 1) * sizeof(*vma_filesz)); +#endif /* OPLUS_BUG_STABILITY */ + if (!vma_filesz) goto end_coredump; @@ -2387,7 +2406,18 @@ end_coredump: cleanup: free_note_info(&info); kfree(shdr4extnum); + /* yanghao@PSW.Kernel.stability add for the lowmomery or not have order 4 page size + * will alloc failed and the coredump can't format success 2019/01/14 + */ +#ifdef OPLUS_BUG_STABILITY + if ((oppo_coredump_addr != NULL) && (vma_filesz == oppo_coredump_addr)) { + kvfree(vma_filesz); + oppo_coredump_addr = NULL; + } else + vfree(vma_filesz); +#else vfree(vma_filesz); +#endif /* VENDOR_EDIT end */ kfree(phdr4note); kfree(elf); out: @@ -2399,11 +2429,23 @@ out: static int __init init_elf_binfmt(void) { register_binfmt(&elf_format); + +#ifdef OPLUS_BUG_STABILITY +// Bin.Xu@BSP.Kernel.Stability, 2020/4/1, transplant checklist: pre-allocation 64KB memory for coredump + oppo_coredump_addr = kvmalloc(PREALLOC_DUMPMEM_SIZE, GFP_KERNEL); +#endif /* OPLUS_BUG_STABILITY */ + return 0; } static void __exit exit_elf_binfmt(void) { +#ifdef OPLUS_BUG_STABILITY +// Bin.Xu@BSP.Kernel.Stability, 2020/4/1, transplant checklist: pre-allocation 64KB memory for coredump + if (oppo_coredump_addr) + kvfree(oppo_coredump_addr); +#endif /* OPLUS_BUG_STABILITY */ + /* Remove the COFF and ELF loaders. */ unregister_binfmt(&elf_format); } diff --git a/fs/block_dev.c b/fs/block_dev.c index a245256aea2b..6ecb078ff9f9 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -35,6 +35,9 @@ #include #include #include "internal.h" +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) +#include +#endif /*OPLUS_FEATURE_IOMONITOR*/ struct bdev_inode { struct block_device bdev; @@ -256,6 +259,9 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter, bio.bi_opf = dio_bio_write_op(iocb); task_io_account_write(ret); } +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + iomonitor_update_rw_stats(DIO_WRITE, file, ret); +#endif /*OPLUS_FEATURE_IOMONITOR*/ qc = submit_bio(&bio); for (;;) { @@ -397,6 +403,9 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) } else { bio->bi_opf = dio_bio_write_op(iocb); task_io_account_write(bio->bi_iter.bi_size); +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + iomonitor_update_rw_stats(DIO_WRITE, file, bio->bi_iter.bi_size); +#endif /*OPLUS_FEATURE_IOMONITOR*/ } dio->size += bio->bi_iter.bi_size; @@ -1653,6 +1662,9 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder) mutex_unlock(&bdev->bd_mutex); bdput(whole); + if(res) + bdput(bdev); + } if (res) diff --git a/fs/dcache.c b/fs/dcache.c index 2f01b271023d..3028750ddc8d 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1417,7 +1417,12 @@ static enum d_walk_ret select_collect(void *_data, struct dentry *dentry) goto out; if (dentry->d_flags & DCACHE_SHRINK_LIST) { + #ifdef OPLUS_BUG_STABILITY + /*xing.xiong@BSP.Kernel.Stability, Modify for hungtask dcache*/ + goto out; + #else data->found++; + #endif /*OPLUS_BUG_STABILITY*/ } else { if (dentry->d_flags & DCACHE_LRU_LIST) d_lru_del(dentry); diff --git a/fs/direct-io.c b/fs/direct-io.c index 094421f05fda..e687396790ac 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -38,6 +38,9 @@ #include #include #include +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) +#include +#endif /*OPLUS_FEATURE_IOMONITOR*/ /* * How many user pages to map in one call to get_user_pages(). This determines @@ -876,6 +879,9 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page, * Read accounting is performed in submit_bio() */ task_io_account_write(len); +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + iomonitor_update_rw_stats(DIO_WRITE, NULL, len); +#endif /*OPLUS_FEATURE_IOMONITOR*/ } /* diff --git a/fs/eventpoll.c b/fs/eventpoll.c index e85f19b018fe..26b2130ce1d3 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1827,9 +1827,21 @@ fetch_events: } spin_unlock_irqrestore(&ep->lock, flags); +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + current->in_epoll = 1; +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ if (!freezable_schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS)) timed_out = 1; +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + current->in_epoll = 0; +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ spin_lock_irqsave(&ep->lock, flags); } diff --git a/fs/exec.c b/fs/exec.c index e8e592d2020f..90459bead433 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1690,6 +1690,11 @@ static int exec_binprm(struct linux_binprm *bprm) return ret; } +#ifdef CONFIG_OPLUS_SECURE_GUARD +#if defined(CONFIG_OPLUS_EXECVE_BLOCK) || defined(CONFIG_OPLUS_EXECVE_REPORT) +extern int oplus_exec_block(struct file *file); +#endif /* CONFIG_OPLUS_EXECVE_BLOCK or CONFIG_OPLUS_EXECVE_REPORT */ +#endif /* CONFIG_OPLUS_SECURE_GUARD */ /* * sys_execve() executes a new program. */ @@ -1744,6 +1749,15 @@ static int do_execveat_common(int fd, struct filename *filename, if (IS_ERR(file)) goto out_unmark; +#ifdef CONFIG_OPLUS_SECURE_GUARD +#if defined(CONFIG_OPLUS_EXECVE_BLOCK) || defined(CONFIG_OPLUS_EXECVE_REPORT) + retval = oplus_exec_block(file); + if (retval){ + fput(file); + goto out_unmark; + } +#endif /* CONFIG_OPLUS_EXECVE_BLOCK or CONFIG_OPLUS_EXECVE_REPORT */ +#endif /* CONFIG_OPLUS_SECURE_GUARD */ sched_exec(); bprm->file = file; diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index f3773d66e7c0..4d5662d73ac0 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -14,6 +14,11 @@ #include #include +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSTW) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +#include +#endif + #include "f2fs.h" #include "node.h" #include "segment.h" @@ -1564,6 +1569,10 @@ int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) } if (cpc->reason != CP_RESIZE) mutex_lock(&sbi->cp_mutex); +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSTW) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + bdev_set_turbo_write(sbi->sb->s_bdev); +#endif if (!is_sbi_flag_set(sbi, SBI_IS_DIRTY) && ((cpc->reason & CP_FASTBOOT) || (cpc->reason & CP_SYNC) || @@ -1632,8 +1641,12 @@ stop: f2fs_update_time(sbi, CP_TIME); trace_f2fs_write_checkpoint(sbi->sb, cpc->reason, "finish checkpoint"); out: +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSTW) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + bdev_clear_turbo_write(sbi->sb->s_bdev); +#endif if (cpc->reason != CP_RESIZE) - mutex_unlock(&sbi->cp_mutex); + mutex_unlock(&sbi->cp_mutex); return err; } diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 48350276ac87..44e73035cffa 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -28,6 +28,10 @@ #include #include +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) +#include +#endif /*OPLUS_FEATURE_IOMONITOR*/ + #ifdef CONFIG_F2FS_CHECK_FS #define f2fs_bug_on(sbi, condition) BUG_ON(condition) #else @@ -3078,6 +3082,12 @@ static inline void f2fs_update_iostat(struct f2fs_sb_info *sbi, spin_lock(&sbi->iostat_lock); sbi->rw_iostat[type] += io_bytes; +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + if (type == FS_GC_DATA_IO || type == FS_GC_NODE_IO) + iomonitor_update_fs_stats(FS_GC_OPT, 1); + else if (type == FS_DISCARD) + iomonitor_update_fs_stats(FS_DISCARD_OPT, 1); +#endif /*OPLUS_FEATURE_IOMONITOR*/ if (type == APP_WRITE_IO || type == APP_DIRECT_IO) sbi->rw_iostat[APP_BUFFERED_IO] = sbi->rw_iostat[APP_WRITE_IO] - diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index f45234243c62..1fdc82324fed 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -21,6 +21,11 @@ #include #include +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSTW) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +#include +#endif + #include "f2fs.h" #include "node.h" #include "segment.h" @@ -253,6 +258,15 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end, .for_reclaim = 0, }; unsigned int seq_id = 0; +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSTW) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + bool turbo_set = false; +#endif +#ifdef CONFIG_F2FS_BD_STAT + u64 fsync_begin = 0, fsync_end = 0, wr_file_end, cp_begin = 0, + cp_end = 0, sync_node_begin = 0, sync_node_end = 0, + flush_begin = 0, flush_end = 0; +#endif if (unlikely(f2fs_readonly(inode->i_sb) || is_sbi_flag_set(sbi, SBI_CP_DISABLED))) @@ -326,6 +340,11 @@ go_write: clear_inode_flag(inode, FI_UPDATE_WRITE); goto out; } +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSTW) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + bdev_set_turbo_write(sbi->sb->s_bdev); + turbo_set = true; +#endif sync_nodes: atomic_inc(&sbi->wb_sync_req[NODE]); ret = f2fs_fsync_node_pages(sbi, inode, &wbc, atomic, &seq_id); @@ -372,6 +391,11 @@ flush_out: } f2fs_update_time(sbi, REQ_TIME); out: +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSTW) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + if (turbo_set) + bdev_clear_turbo_write(sbi->sb->s_bdev); +#endif trace_f2fs_sync_file_exit(inode, cp_reason, datasync, ret); f2fs_trace_ios(NULL, 1); trace_android_fs_fsync_end(inode, start, end - start); diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 017daaa26b50..3d4bd33eb2ea 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -183,6 +183,33 @@ bool f2fs_need_SSR(struct f2fs_sb_info *sbi) SM_I(sbi)->min_ssr_sections + reserved_sections(sbi)); } +/* VENDOR_EDIT yanwu@TECH.Storage.FS.oF2FS, + * 2019/08/13, add code to optimize gc + */ +block_t of2fs_seg_freefrag(struct f2fs_sb_info *sbi, unsigned int segno, + block_t* blocks, unsigned int n) +{ + struct seg_entry *se = get_seg_entry(sbi, segno); + unsigned long *cur_map = (unsigned long *)se->cur_valid_map; + unsigned int pos, pos0; + block_t total_blocks = 0; + // free and valid segment is not fragment + if (!se->valid_blocks || se->valid_blocks == sbi->blocks_per_seg) + return total_blocks; + pos0 = __find_rev_next_zero_bit(cur_map, sbi->blocks_per_seg, 0); + while (pos0 < sbi->blocks_per_seg) { + unsigned int blks, order; + pos = __find_rev_next_bit(cur_map, sbi->blocks_per_seg, pos0 + 1); + blks = pos - pos0; + order = ilog2(blks); + if (order < n) + blocks[order] += blks; + total_blocks += blks; + pos0 = __find_rev_next_zero_bit(cur_map, sbi->blocks_per_seg, pos + 1); + } + return total_blocks; +} + void f2fs_register_inmem_page(struct inode *inode, struct page *page) { struct inmem_pages *new; diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index aa5ff287834a..403978e6e5ae 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -29,6 +29,9 @@ #include #include #include "internal.h" +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) +#include +#endif /*OPLUS_FEATURE_IOMONITOR*/ /* * 4MB minimal write chunk size @@ -1988,7 +1991,9 @@ void wb_workfn(struct work_struct *work) WB_REASON_FORKER_THREAD); trace_writeback_pages_written(pages_written); } - +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + iomonitor_update_fs_stats(FS_DIRTY_PAGES, pages_written); +#endif /*OPLUS_FEATURE_IOMONITOR*/ if (!list_empty(&wb->work_list)) wb_wakeup(wb); else if (wb_has_dirty_io(wb) && dirty_writeback_interval) diff --git a/fs/fuse/Makefile b/fs/fuse/Makefile index 60da84a86dab..0d4c2c4a6bfa 100644 --- a/fs/fuse/Makefile +++ b/fs/fuse/Makefile @@ -5,4 +5,4 @@ obj-$(CONFIG_FUSE_FS) += fuse.o obj-$(CONFIG_CUSE) += cuse.o -fuse-objs := dev.o dir.o file.o inode.o control.o xattr.o acl.o +fuse-objs := dev.o dir.o file.o inode.o control.o xattr.o acl.o shortcircuit.o diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 59e9ceb138cd..07ce99bcd4cc 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -23,6 +23,10 @@ #include #include #include +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance +#include "fuse_shortcircuit.h" +#endif /* VENDOR_EDIT */ MODULE_ALIAS_MISCDEV(FUSE_MINOR); MODULE_ALIAS("devname:fuse"); @@ -326,7 +330,7 @@ static void queue_request(struct fuse_iqueue *fiq, struct fuse_req *req) req->in.h.len = sizeof(struct fuse_in_header) + len_args(req->in.numargs, (struct fuse_arg *) req->in.args); list_add_tail(&req->list, &fiq->pending); - wake_up_locked(&fiq->waitq); + wake_up(&fiq->waitq); kill_fasync(&fiq->fasync, SIGIO, POLL_IN); } @@ -338,16 +342,16 @@ void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget, forget->forget_one.nodeid = nodeid; forget->forget_one.nlookup = nlookup; - spin_lock(&fiq->waitq.lock); + spin_lock(&fiq->lock); if (fiq->connected) { fiq->forget_list_tail->next = forget; fiq->forget_list_tail = forget; - wake_up_locked(&fiq->waitq); + wake_up(&fiq->waitq); kill_fasync(&fiq->fasync, SIGIO, POLL_IN); } else { kfree(forget); } - spin_unlock(&fiq->waitq.lock); + spin_unlock(&fiq->lock); } static void flush_bg_queue(struct fuse_conn *fc) @@ -360,10 +364,10 @@ static void flush_bg_queue(struct fuse_conn *fc) req = list_entry(fc->bg_queue.next, struct fuse_req, list); list_del(&req->list); fc->active_background++; - spin_lock(&fiq->waitq.lock); + spin_lock(&fiq->lock); req->in.h.unique = fuse_get_unique(fiq); queue_request(fiq, req); - spin_unlock(&fiq->waitq.lock); + spin_unlock(&fiq->lock); } } @@ -382,9 +386,9 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req) if (test_and_set_bit(FR_FINISHED, &req->flags)) goto put_request; - spin_lock(&fiq->waitq.lock); + spin_lock(&fiq->lock); list_del_init(&req->intr_entry); - spin_unlock(&fiq->waitq.lock); + spin_unlock(&fiq->lock); WARN_ON(test_bit(FR_PENDING, &req->flags)); WARN_ON(test_bit(FR_SENT, &req->flags)); if (test_bit(FR_BACKGROUND, &req->flags)) { @@ -422,16 +426,16 @@ put_request: static void queue_interrupt(struct fuse_iqueue *fiq, struct fuse_req *req) { - spin_lock(&fiq->waitq.lock); + spin_lock(&fiq->lock); if (test_bit(FR_FINISHED, &req->flags)) { - spin_unlock(&fiq->waitq.lock); + spin_unlock(&fiq->lock); return; } if (list_empty(&req->intr_entry)) { list_add_tail(&req->intr_entry, &fiq->interrupts); - wake_up_locked(&fiq->waitq); + wake_up(&fiq->waitq); } - spin_unlock(&fiq->waitq.lock); + spin_unlock(&fiq->lock); kill_fasync(&fiq->fasync, SIGIO, POLL_IN); } @@ -461,16 +465,16 @@ static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req) if (!err) return; - spin_lock(&fiq->waitq.lock); + spin_lock(&fiq->lock); /* Request is not yet in userspace, bail out */ if (test_bit(FR_PENDING, &req->flags)) { list_del(&req->list); - spin_unlock(&fiq->waitq.lock); + spin_unlock(&fiq->lock); __fuse_put_request(req); req->out.h.error = -EINTR; return; } - spin_unlock(&fiq->waitq.lock); + spin_unlock(&fiq->lock); } /* @@ -487,9 +491,9 @@ static void __fuse_request_send(struct fuse_conn *fc, struct fuse_req *req) struct fuse_iqueue *fiq = &fc->iq; BUG_ON(test_bit(FR_BACKGROUND, &req->flags)); - spin_lock(&fiq->waitq.lock); + spin_lock(&fiq->lock); if (!fiq->connected) { - spin_unlock(&fiq->waitq.lock); + spin_unlock(&fiq->lock); req->out.h.error = -ENOTCONN; } else { req->in.h.unique = fuse_get_unique(fiq); @@ -497,7 +501,7 @@ static void __fuse_request_send(struct fuse_conn *fc, struct fuse_req *req) /* acquire extra reference, since request is still needed after request_end() */ __fuse_get_request(req); - spin_unlock(&fiq->waitq.lock); + spin_unlock(&fiq->lock); request_wait_answer(fc, req); /* Pairs with smp_wmb() in request_end() */ @@ -570,8 +574,16 @@ ssize_t fuse_simple_request(struct fuse_conn *fc, struct fuse_args *args) req->out.numargs = args->out.numargs; memcpy(req->out.args, args->out.args, args->out.numargs * sizeof(struct fuse_arg)); + req->out.canonical_path = args->out.canonical_path; fuse_request_send(fc, req); ret = req->out.h.error; +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance + if (!ret) { + if (req->private_lower_rw_file != NULL) + args->private_lower_rw_file = req->private_lower_rw_file; + } +#endif /* VENDOR_EDIT */ if (!ret && args->out.argvar) { BUG_ON(args->out.numargs != 1); ret = req->out.args[0].size; @@ -630,12 +642,12 @@ static int fuse_request_send_notify_reply(struct fuse_conn *fc, __clear_bit(FR_ISREPLY, &req->flags); req->in.h.unique = unique; - spin_lock(&fiq->waitq.lock); + spin_lock(&fiq->lock); if (fiq->connected) { queue_request(fiq, req); err = 0; } - spin_unlock(&fiq->waitq.lock); + spin_unlock(&fiq->lock); return err; } @@ -1079,12 +1091,12 @@ static int request_pending(struct fuse_iqueue *fiq) * Unlike other requests this is assembled on demand, without a need * to allocate a separate fuse_req structure. * - * Called with fiq->waitq.lock held, releases it + * Called with fiq->lock held, releases it */ static int fuse_read_interrupt(struct fuse_iqueue *fiq, struct fuse_copy_state *cs, size_t nbytes, struct fuse_req *req) -__releases(fiq->waitq.lock) +__releases(fiq->lock) { struct fuse_in_header ih; struct fuse_interrupt_in arg; @@ -1100,7 +1112,7 @@ __releases(fiq->waitq.lock) ih.unique = req->intr_unique; arg.unique = req->in.h.unique; - spin_unlock(&fiq->waitq.lock); + spin_unlock(&fiq->lock); if (nbytes < reqsize) return -EINVAL; @@ -1137,7 +1149,7 @@ static struct fuse_forget_link *dequeue_forget(struct fuse_iqueue *fiq, static int fuse_read_single_forget(struct fuse_iqueue *fiq, struct fuse_copy_state *cs, size_t nbytes) -__releases(fiq->waitq.lock) +__releases(fiq->lock) { int err; struct fuse_forget_link *forget = dequeue_forget(fiq, 1, NULL); @@ -1151,7 +1163,7 @@ __releases(fiq->waitq.lock) .len = sizeof(ih) + sizeof(arg), }; - spin_unlock(&fiq->waitq.lock); + spin_unlock(&fiq->lock); kfree(forget); if (nbytes < ih.len) return -EINVAL; @@ -1169,7 +1181,7 @@ __releases(fiq->waitq.lock) static int fuse_read_batch_forget(struct fuse_iqueue *fiq, struct fuse_copy_state *cs, size_t nbytes) -__releases(fiq->waitq.lock) +__releases(fiq->lock) { int err; unsigned max_forgets; @@ -1183,13 +1195,13 @@ __releases(fiq->waitq.lock) }; if (nbytes < ih.len) { - spin_unlock(&fiq->waitq.lock); + spin_unlock(&fiq->lock); return -EINVAL; } max_forgets = (nbytes - ih.len) / sizeof(struct fuse_forget_one); head = dequeue_forget(fiq, max_forgets, &count); - spin_unlock(&fiq->waitq.lock); + spin_unlock(&fiq->lock); arg.count = count; ih.len += count * sizeof(struct fuse_forget_one); @@ -1219,7 +1231,7 @@ __releases(fiq->waitq.lock) static int fuse_read_forget(struct fuse_conn *fc, struct fuse_iqueue *fiq, struct fuse_copy_state *cs, size_t nbytes) -__releases(fiq->waitq.lock) +__releases(fiq->lock) { if (fc->minor < 16 || fiq->forget_list_head.next->next == NULL) return fuse_read_single_forget(fiq, cs, nbytes); @@ -1248,21 +1260,22 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, unsigned reqsize; restart: - spin_lock(&fiq->waitq.lock); - err = -EAGAIN; - if ((file->f_flags & O_NONBLOCK) && fiq->connected && - !request_pending(fiq)) - goto err_unlock; + for (;;) { + spin_lock(&fiq->lock); + if (!fiq->connected || request_pending(fiq)) + break; + spin_unlock(&fiq->lock); - err = wait_event_interruptible_exclusive_locked(fiq->waitq, + if (file->f_flags & O_NONBLOCK) + return -EAGAIN; + err = wait_event_interruptible_exclusive(fiq->waitq, !fiq->connected || request_pending(fiq)); if (err) - goto err_unlock; - + return err; + } err = -ENODEV; if (!fiq->connected) goto err_unlock; - if (!list_empty(&fiq->interrupts)) { req = list_entry(fiq->interrupts.next, struct fuse_req, intr_entry); @@ -1280,7 +1293,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, req = list_entry(fiq->pending.next, struct fuse_req, list); clear_bit(FR_PENDING, &req->flags); list_del_init(&req->list); - spin_unlock(&fiq->waitq.lock); + spin_unlock(&fiq->lock); in = &req->in; reqsize = in->h.len; @@ -1312,6 +1325,8 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, spin_lock(&fpq->lock); clear_bit(FR_LOCKED, &req->flags); if (!fpq->connected) { + if(req->in.h.opcode == FUSE_CANONICAL_PATH) + printk("fuse_dev_do_read: FUSE_CANONICAL_PATH, fpq->connected is false, req:0x%p, unique:%ul\n", req, req->in.h.unique); err = -ENODEV; req->out.h.error = err; goto out_end; @@ -1344,7 +1359,7 @@ out_end: return err; err_unlock: - spin_unlock(&fiq->waitq.lock); + spin_unlock(&fiq->lock); return err; } @@ -1921,13 +1936,17 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud, cs->move_pages = 0; err = copy_out_args(cs, &req->out, nbytes); - if (req->in.h.opcode == FUSE_CANONICAL_PATH) { + fuse_copy_finish(cs); + if (!err && req->in.h.opcode == FUSE_CANONICAL_PATH) { char *path = (char *)req->out.args[0].value; path[req->out.args[0].size - 1] = 0; - req->out.h.error = kern_path(path, 0, req->canonical_path); + req->out.h.error = kern_path(path, 0, req->out.canonical_path); } - fuse_copy_finish(cs); +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance + fuse_setup_shortcircuit(fc, req); +#endif /* VENDOR_EDIT */ spin_lock(&fpq->lock); clear_bit(FR_LOCKED, &req->flags); @@ -2061,12 +2080,12 @@ static unsigned fuse_dev_poll(struct file *file, poll_table *wait) fiq = &fud->fc->iq; poll_wait(file, &fiq->waitq, wait); - spin_lock(&fiq->waitq.lock); + spin_lock(&fiq->lock); if (!fiq->connected) mask = POLLERR; else if (request_pending(fiq)) mask |= POLLIN | POLLRDNORM; - spin_unlock(&fiq->waitq.lock); + spin_unlock(&fiq->lock); return mask; } @@ -2157,15 +2176,15 @@ void fuse_abort_conn(struct fuse_conn *fc) fc->max_background = UINT_MAX; flush_bg_queue(fc); - spin_lock(&fiq->waitq.lock); + spin_lock(&fiq->lock); fiq->connected = 0; list_splice_init(&fiq->pending, &to_end2); list_for_each_entry(req, &to_end2, list) clear_bit(FR_PENDING, &req->flags); while (forget_pending(fiq)) kfree(dequeue_forget(fiq, 1, NULL)); - wake_up_all_locked(&fiq->waitq); - spin_unlock(&fiq->waitq.lock); + wake_up_all(&fiq->waitq); + spin_unlock(&fiq->lock); kill_fasync(&fiq->fasync, SIGIO, POLL_IN); end_polls(fc); wake_up_all(&fc->blocked_waitq); diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index d84819c9174c..4a878c5ac0fb 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -16,6 +16,135 @@ #include #include +#ifdef CONFIG_OPLUS_FEATURE_ACM +//Yuwei.Guan@BSP.Kernel.FS,2020/07/08, Add for acm +#include +#define ACM_PHOTO 1 +#define ACM_VIDEO 2 +#define ACM_NOMEDIA 3 +#define ACM_NOMEDIA_NAME ".nomedia" + +#define MIN_FNAME_LEN 2 +static int is_media_extension(const unsigned char *s, const char *sub) +{ + size_t slen = strlen((const char *)s); + size_t sublen = strlen(sub); + + if (slen < sublen + MIN_FNAME_LEN) + return 0; + + if (s[slen - sublen - 1] != '.') + return 0; + + if (!strncasecmp((const char *)s + slen - sublen, sub, sublen)) + return 1; + return 0; +} + +static int is_photo_file(struct dentry *dentry) +{ + static const char *const ext[] = { + "jpg", "jpe", "jpeg", "gif", "png", "bmp", "wbmp", + "webp", "dng", "cr2", "nef", "nrw", "arw", "rw2", + "orf", "raf", "pef", "srw", "heic", "heif", NULL + }; + int i; + + for (i = 0; ext[i]; i++) { + if (is_media_extension(dentry->d_name.name, ext[i])) + return ACM_PHOTO; + } + + return 0; +} + +static int is_video_file(struct dentry *dentry) +{ + static const char *const ext[] = { + "mpeg", "mpg", "mp4", "m4v", "mov", "3gp", "3gpp", "3g2", + "3gpp2", "mkv", "webm", "ts", "avi", "f4v", "flv", "m2ts", + "divx", "wmv", "asf", NULL + }; + int i; + + for (i = 0; ext[i]; i++) { + if (is_media_extension(dentry->d_name.name, ext[i])) + return ACM_VIDEO; + } + + return 0; +} + +static int is_nomedia_file(struct dentry *dentry) +{ + if (strcmp(dentry->d_name.name, ACM_NOMEDIA_NAME) == 0) + return ACM_NOMEDIA; + else + return 0; +} + +static int get_monitor_file_type(struct dentry *dentry) +{ + int file_type = 0; + + if ((file_type = is_photo_file(dentry)) != 0) + return file_type; + + file_type = is_video_file(dentry); + + return file_type; +} + +static int should_monitor_file(struct dentry *dentry, int operation) +{ + int file_type = 0; + + if (operation == FUSE_UNLINK) { + if (acm_opstat(ACM_FLAG_LOGGING | ACM_FLAG_DEL)) + file_type = get_monitor_file_type(dentry); + } else if (operation == FUSE_RENAME || operation == FUSE_RENAME2) { + if (acm_opstat(ACM_FLAG_LOGGING)) + file_type = get_monitor_file_type(dentry); + } else if (operation == FUSE_CREATE || operation == FUSE_MKNOD) { + if (acm_opstat(ACM_FLAG_LOGGING | ACM_FLAG_CRT)) + file_type = is_nomedia_file(dentry); + } + + return file_type; +} + +static int monitor_acm(struct dentry *dentry, int op) +{ + struct inode *inode = d_inode(dentry); + int file_type = 0x0f; + int err = 0; + + if (!acm_opstat(ACM_FLAG_LOGGING | ACM_FLAG_DEL | ACM_FLAG_CRT)) + goto monitor_ret; + + if (S_ISREG(inode->i_mode)) { + file_type = should_monitor_file(dentry, op); + if (file_type == 0) { + goto monitor_ret; + } + } else if (S_ISDIR(inode->i_mode)) { + if (!(acm_opstat(ACM_FLAG_DEL))) { + goto monitor_ret; + } + } else { + goto monitor_ret; + } + + printk("ACM: %s %s op=%d file_type=%d\n", __func__, dentry->d_name.name, + op, file_type); + + err = acm_search(dentry, file_type, op); + +monitor_ret: + return err; +} +#endif + static bool fuse_use_readdirplus(struct inode *dir, struct dir_context *ctx) { struct fuse_conn *fc = get_fuse_conn(dir); @@ -263,50 +392,6 @@ invalid: goto out; } -/* - * Get the canonical path. Since we must translate to a path, this must be done - * in the context of the userspace daemon, however, the userspace daemon cannot - * look up paths on its own. Instead, we handle the lookup as a special case - * inside of the write request. - */ -static void fuse_dentry_canonical_path(const struct path *path, struct path *canonical_path) { - struct inode *inode = path->dentry->d_inode; - struct fuse_conn *fc = get_fuse_conn(inode); - struct fuse_req *req; - int err; - char *path_name; - - req = fuse_get_req(fc, 1); - err = PTR_ERR(req); - if (IS_ERR(req)) - goto default_path; - - path_name = (char*)__get_free_page(GFP_KERNEL); - if (!path_name) { - fuse_put_request(fc, req); - goto default_path; - } - - req->in.h.opcode = FUSE_CANONICAL_PATH; - req->in.h.nodeid = get_node_id(inode); - req->in.numargs = 0; - req->out.numargs = 1; - req->out.args[0].size = PATH_MAX; - req->out.args[0].value = path_name; - req->canonical_path = canonical_path; - req->out.argvar = 1; - fuse_request_send(fc, req); - err = req->out.h.error; - fuse_put_request(fc, req); - free_page((unsigned long)path_name); - if (!err) - return; -default_path: - canonical_path->dentry = path->dentry; - canonical_path->mnt = path->mnt; - path_get(canonical_path); -} - static int invalid_nodeid(u64 nodeid) { return !nodeid || nodeid == FUSE_ROOT_ID; @@ -325,6 +410,44 @@ static void fuse_dentry_release(struct dentry *dentry) kfree_rcu(fd, rcu); } +/* + * Get the canonical path. Since we must translate to a path, this must be done + * in the context of the userspace daemon, however, the userspace daemon cannot + * look up paths on its own. Instead, we handle the lookup as a special case + * inside of the write request. + */ +static void fuse_dentry_canonical_path(const struct path *path, + struct path *canonical_path) +{ + struct inode *inode = d_inode(path->dentry); + struct fuse_conn *fc = get_fuse_conn(inode); + FUSE_ARGS(args); + char *path_name; + int err; + + path_name = (char *)__get_free_page(GFP_KERNEL); + if (!path_name) + goto default_path; + + args.in.h.opcode = FUSE_CANONICAL_PATH; + args.in.h.nodeid = get_node_id(inode); + args.in.numargs = 0; + args.out.numargs = 1; + args.out.args[0].size = PATH_MAX; + args.out.args[0].value = path_name; + args.out.argvar = 1; + args.out.canonical_path = canonical_path; + + err = fuse_simple_request(fc, &args); + free_page((unsigned long)path_name); + if (err > 0) + return; +default_path: + canonical_path->dentry = path->dentry; + canonical_path->mnt = path->mnt; + path_get(canonical_path); +} + const struct dentry_operations fuse_dentry_operations = { .d_revalidate = fuse_dentry_revalidate, .d_init = fuse_dentry_init, @@ -335,7 +458,6 @@ const struct dentry_operations fuse_dentry_operations = { const struct dentry_operations fuse_root_dentry_operations = { .d_init = fuse_dentry_init, .d_release = fuse_dentry_release, - .d_canonical_path = fuse_dentry_canonical_path, }; int fuse_valid_type(int m) @@ -482,6 +604,13 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, mode &= ~current_umask(); flags &= ~O_NOCTTY; + +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance + if (fc->writeback_cache) + flags &= ~O_APPEND; +#endif /* VENDOR_EDIT */ + memset(&inarg, 0, sizeof(inarg)); memset(&outentry, 0, sizeof(outentry)); inarg.flags = flags; @@ -499,6 +628,10 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, args.out.args[0].value = &outentry; args.out.args[1].size = sizeof(outopen); args.out.args[1].value = &outopen; +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance + args.private_lower_rw_file = NULL; +#endif /* VENDOR_EDIT */ err = fuse_simple_request(fc, &args); if (err) goto out_free_ff; @@ -511,6 +644,11 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, ff->fh = outopen.fh; ff->nodeid = outentry.nodeid; ff->open_flags = outopen.open_flags; +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance + if (args.private_lower_rw_file != NULL) + ff->rw_lower_file = args.private_lower_rw_file; +#endif /* VENDOR_EDIT */ inode = fuse_iget(dir->i_sb, outentry.nodeid, outentry.generation, &outentry.attr, entry_attr_timeout(&outentry), 0); if (!inode) { @@ -531,6 +669,10 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, file->private_data = ff; fuse_finish_open(inode, file); } +#ifdef CONFIG_OPLUS_FEATURE_ACM +//Yuwei.Guan@BSP.Kernel.FS,2020/07/08, Add for acm + monitor_acm(entry, args.in.h.opcode); +#endif return err; out_free_ff: @@ -631,6 +773,11 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_args *args, fuse_change_entry_timeout(entry, &outarg); fuse_invalidate_attr(dir); +#ifdef CONFIG_OPLUS_FEATURE_ACM +//Yuwei.Guan@BSP.Kernel.FS,2020/07/08, Add for acm + if (args->in.h.opcode == FUSE_MKNOD) + monitor_acm(entry, args->in.h.opcode); +#endif return 0; out_put_forget_req: @@ -723,6 +870,14 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry) args.in.numargs = 1; args.in.args[0].size = entry->d_name.len + 1; args.in.args[0].value = entry->d_name.name; +#ifdef CONFIG_OPLUS_FEATURE_ACM +//Yuwei.Guan@BSP.Kernel.FS,2020/07/08, Add for acm + err = monitor_acm(entry, args.in.h.opcode); + if (err) { + err = ACM_DELETE_ERR; + return err; + } +#endif err = fuse_simple_request(fc, &args); if (!err) { struct inode *inode = d_inode(entry); @@ -759,6 +914,14 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry) args.in.numargs = 1; args.in.args[0].size = entry->d_name.len + 1; args.in.args[0].value = entry->d_name.name; +#ifdef CONFIG_OPLUS_FEATURE_ACM +//Yuwei.Guan@BSP.Kernel.FS,2020/07/08, Add for acm + err = monitor_acm(entry, args.in.h.opcode); + if (err) { + err = ACM_DELETE_ERR; + return err; + } +#endif err = fuse_simple_request(fc, &args); if (!err) { clear_nlink(d_inode(entry)); @@ -821,7 +984,10 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent, if (d_really_is_positive(newent)) fuse_invalidate_entry(newent); } - +#ifdef CONFIG_OPLUS_FEATURE_ACM +//Yuwei.Guan@BSP.Kernel.FS,2020/07/08, Add for acm + monitor_acm(oldent, args.in.h.opcode); +#endif return err; } @@ -851,7 +1017,6 @@ static int fuse_rename2(struct inode *olddir, struct dentry *oldent, FUSE_RENAME, sizeof(struct fuse_rename_in)); } - return err; } diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 25458a78d24f..4b411588b108 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -7,6 +7,10 @@ */ #include "fuse_i.h" +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance +#include "fuse_shortcircuit.h" +#endif /* VENDOR_EDIT */ #include #include @@ -20,10 +24,13 @@ #include static const struct file_operations fuse_direct_io_file_operations; - +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance static int fuse_send_open(struct fuse_conn *fc, u64 nodeid, struct file *file, - int opcode, struct fuse_open_out *outargp) + int opcode, struct fuse_open_out *outargp, + struct file **lower_file) { + ssize_t ret; struct fuse_open_in inarg; FUSE_ARGS(args); @@ -40,8 +47,35 @@ static int fuse_send_open(struct fuse_conn *fc, u64 nodeid, struct file *file, args.out.args[0].size = sizeof(*outargp); args.out.args[0].value = outargp; + ret = fuse_simple_request(fc, &args); + if (args.private_lower_rw_file != NULL) + *lower_file = args.private_lower_rw_file; + return ret; +} +#else +static int fuse_send_open(struct fuse_conn *fc, u64 nodeid, struct file *file, + int opcode, struct fuse_open_out *outargp) +{ + struct fuse_open_in inarg; + FUSE_ARGS(args); + + memset(&inarg, 0, sizeof(inarg)); + inarg.flags = file->f_flags & ~(O_CREAT | O_EXCL | O_NOCTTY); + + if (!fc->atomic_o_trunc) + inarg.flags &= ~O_TRUNC; + args.in.h.opcode = opcode; + args.in.h.nodeid = nodeid; + args.in.numargs = 1; + args.in.args[0].size = sizeof(inarg); + args.in.args[0].value = &inarg; + args.out.numargs = 1; + args.out.args[0].size = sizeof(*outargp); + args.out.args[0].value = outargp; + return fuse_simple_request(fc, &args); } +#endif /* VENDOR_EDIT */ struct fuse_file *fuse_file_alloc(struct fuse_conn *fc) { @@ -51,6 +85,10 @@ struct fuse_file *fuse_file_alloc(struct fuse_conn *fc) if (unlikely(!ff)) return NULL; +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance + ff->rw_lower_file = NULL; +#endif /* VENDOR_EDIT */ ff->fc = fc; ff->reserved_req = fuse_request_alloc(0); if (unlikely(!ff->reserved_req)) { @@ -131,7 +169,13 @@ int fuse_do_open(struct fuse_conn *fc, u64 nodeid, struct file *file, struct fuse_open_out outarg; int err; +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance + err = fuse_send_open(fc, nodeid, file, opcode, &outarg, + &(ff->rw_lower_file)); +#else err = fuse_send_open(fc, nodeid, file, opcode, &outarg); +#endif /* VENDOR_EDIT */ if (!err) { ff->fh = outarg.fh; ff->open_flags = outarg.open_flags; @@ -257,6 +301,10 @@ void fuse_release_common(struct file *file, bool isdir) struct fuse_req *req = ff->reserved_req; int opcode = isdir ? FUSE_RELEASEDIR : FUSE_RELEASE; +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance + fuse_shortcircuit_release(ff); +#endif /* VENDOR_EDIT */ fuse_prepare_release(ff, file->f_flags, opcode); if (ff->flock) { @@ -926,6 +974,11 @@ static ssize_t fuse_file_read_iter(struct kiocb *iocb, struct iov_iter *to) { struct inode *inode = iocb->ki_filp->f_mapping->host; struct fuse_conn *fc = get_fuse_conn(inode); +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance + struct fuse_file *ff = iocb->ki_filp->private_data; + ssize_t ret_val; +#endif /* VENDOR_EDIT */ /* * In auto invalidate mode, always update attributes on read. @@ -939,8 +992,17 @@ static ssize_t fuse_file_read_iter(struct kiocb *iocb, struct iov_iter *to) if (err) return err; } +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance + if (ff && ff->rw_lower_file) + ret_val = fuse_shortcircuit_read_iter(iocb, to); + else + ret_val = generic_file_read_iter(iocb, to); + return ret_val; +#else return generic_file_read_iter(iocb, to); +#endif /* VENDOR_EDIT */ } static void fuse_write_fill(struct fuse_req *req, struct fuse_file *ff, @@ -1178,12 +1240,28 @@ static ssize_t fuse_file_write_iter(struct kiocb *iocb, struct iov_iter *from) { struct file *file = iocb->ki_filp; struct address_space *mapping = file->f_mapping; +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance + struct fuse_file *ff = file->private_data; +#endif /* VENDOR_EDIT */ ssize_t written = 0; ssize_t written_buffered = 0; struct inode *inode = mapping->host; ssize_t err; loff_t endbyte = 0; +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance + if (ff && ff->rw_lower_file) { + /* Update size (EOF optimization) and mode (SUID clearing) */ + err = fuse_update_attributes(mapping->host, file); + if (err) + return err; + + return fuse_shortcircuit_write_iter(iocb, from); + } +#endif /* VENDOR_EDIT */ + if (get_fuse_conn(inode)->writeback_cache) { /* Update size (EOF optimization) and mode (SUID clearing) */ err = fuse_update_attributes(mapping->host, file); diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 74bae9703ee6..3a2754322adc 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -155,6 +155,12 @@ struct fuse_file { /** Has flock been performed on this file? */ bool flock:1; + +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance + /* the read write file */ + struct file *rw_lower_file; +#endif /* VENDOR_EDIT */ }; /** One input argument of a request */ @@ -212,6 +218,9 @@ struct fuse_out { /** Array of arguments */ struct fuse_arg args[2]; + + /* Path used for completing d_canonical_path */ + struct path *canonical_path; }; /** FUSE page descriptor */ @@ -234,7 +243,15 @@ struct fuse_args { unsigned argvar:1; unsigned numargs; struct fuse_arg args[2]; + + /* Path used for completing d_canonical_path */ + struct path *canonical_path; } out; +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance + /** fuse shortcircuit file */ + struct file *private_lower_rw_file; +#endif /* VENDOR_EDIT */ }; #define FUSE_ARGS(args) struct fuse_args args = {} @@ -370,9 +387,6 @@ struct fuse_req { /** Inode used in the request or NULL */ struct inode *inode; - /** Path used for completing d_canonical_path */ - struct path *canonical_path; - /** AIO control block */ struct fuse_io_priv *io; @@ -384,12 +398,21 @@ struct fuse_req { /** Request is stolen from fuse_file->reserved_req */ struct file *stolen_file; + +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance + /** fuse shortcircuit file */ + struct file *private_lower_rw_file; +#endif /* VENDOR_EDIT */ }; struct fuse_iqueue { /** Connection established */ unsigned connected; + /** Lock protecting accesses to members of this structure */ + spinlock_t lock; + /** Readers of the connection are waiting on this */ wait_queue_head_t waitq; @@ -544,6 +567,11 @@ struct fuse_conn { /** handle fs handles killing suid/sgid/cap on write/chown/trunc */ unsigned handle_killpriv:1; +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance + /** Shortcircuited IO. */ + unsigned shortcircuit_io:1; +#endif /* VENDOR_EDIT */ /* * The following bitfields are only for optimization purposes * and hence races in setting them will not cause malfunction @@ -986,4 +1014,10 @@ struct posix_acl; struct posix_acl *fuse_get_acl(struct inode *inode, int type); int fuse_set_acl(struct inode *inode, struct posix_acl *acl, int type); +#ifdef CONFIG_OPLUS_FEATURE_ACM +//Yuwei.Guan@BSP.Kernel.FS,2020/07/08, Add for acm +void acm_fuse_init_cache(void); +void acm_fuse_free_cache(void); +#endif + #endif /* _FS_FUSE_I_H */ diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 97138986f02b..63658154708a 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -49,6 +49,13 @@ MODULE_PARM_DESC(max_user_congthresh, "Global limit for the maximum congestion threshold an " "unprivileged user can set"); +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance +static bool shortcircuit = true; +module_param(shortcircuit, bool, 0644); +MODULE_PARM_DESC(shortcircuit, "Enable or disable fuse shortcircuit. Default: y/Y/1"); +#endif /* VENDOR_EDIT */ + #define FUSE_SUPER_MAGIC 0x65735546 #define FUSE_DEFAULT_BLKSIZE 512 @@ -584,6 +591,7 @@ static int fuse_show_options(struct seq_file *m, struct dentry *root) static void fuse_iqueue_init(struct fuse_iqueue *fiq) { memset(fiq, 0, sizeof(struct fuse_iqueue)); + spin_lock_init(&fiq->lock); init_waitqueue_head(&fiq->waitq); INIT_LIST_HEAD(&fiq->pending); INIT_LIST_HEAD(&fiq->interrupts); @@ -910,6 +918,16 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req) fc->async_dio = 1; if (arg->flags & FUSE_WRITEBACK_CACHE) fc->writeback_cache = 1; +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance + if (arg->flags & FUSE_SHORTCIRCUIT || fc->writeback_cache) { + /** an ugly way to determine FuseDaemon by writeback_cache + * since currently only FuseDaemon enable WBC + */ + fc->shortcircuit_io = shortcircuit ? 1 : 0; + pr_info("fuse sct flag: %d\n", shortcircuit); + } +#endif /* VENDOR_EDIT */ if (arg->flags & FUSE_PARALLEL_DIROPS) fc->parallel_dirops = 1; if (arg->flags & FUSE_HANDLE_KILLPRIV) @@ -951,7 +969,12 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req) FUSE_FLOCK_LOCKS | FUSE_HAS_IOCTL_DIR | FUSE_AUTO_INVAL_DATA | FUSE_DO_READDIRPLUS | FUSE_READDIRPLUS_AUTO | FUSE_ASYNC_DIO | FUSE_WRITEBACK_CACHE | FUSE_NO_OPEN_SUPPORT | +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance + FUSE_SHORTCIRCUIT | +#endif /* VENDOR_EDIT */ FUSE_PARALLEL_DIROPS | FUSE_HANDLE_KILLPRIV | FUSE_POSIX_ACL; + req->in.h.opcode = FUSE_INIT; req->in.numargs = 1; req->in.args[0].size = sizeof(*arg); @@ -1167,6 +1190,11 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) fuse_send_init(fc, init_req); +#ifdef CONFIG_OPLUS_FEATURE_ACM +//Yuwei.Guan@BSP.Kernel.FS,2020/07/08, Add for acm + acm_fuse_init_cache(); +#endif + return 0; err_unlock: @@ -1198,6 +1226,10 @@ static void fuse_sb_destroy(struct super_block *sb) struct fuse_conn *fc = get_fuse_conn_super(sb); if (fc) { +#ifdef CONFIG_OPLUS_FEATURE_ACM +//Yuwei.Guan@BSP.Kernel.FS,2020/07/08, Add for acm + acm_fuse_free_cache(); +#endif fuse_send_destroy(fc); fuse_abort_conn(fc); diff --git a/fs/iomap.c b/fs/iomap.c index 1e573a59ea71..879913992b25 100644 --- a/fs/iomap.c +++ b/fs/iomap.c @@ -28,6 +28,9 @@ #include #include #include +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) +#include +#endif /*OPLUS_FEATURE_IOMONITOR*/ #include "internal.h" @@ -930,6 +933,9 @@ iomap_dio_actor(struct inode *inode, loff_t pos, loff_t length, if (dio->flags & IOMAP_DIO_WRITE) { bio_set_op_attrs(bio, REQ_OP_WRITE, REQ_SYNC | REQ_IDLE); task_io_account_write(bio->bi_iter.bi_size); +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + iomonitor_update_rw_stats(DIO_WRITE, NULL, n); +#endif /*OPLUS_FEATURE_IOMONITOR*/ } else { bio_set_op_attrs(bio, REQ_OP_READ, 0); if (dio->flags & IOMAP_DIO_DIRTY) diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 6870103a0f59..b2c6b7d68b15 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -29,6 +29,11 @@ #include #include +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSTW) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +#include +#endif + /* * IO end handler for temporary buffer_heads handling writes to the journal. */ @@ -532,6 +537,10 @@ void jbd2_journal_commit_transaction(journal_t *journal) write_unlock(&journal->j_state_lock); jbd_debug(3, "JBD2: commit phase 2a\n"); +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSTW) + /* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + bdev_set_turbo_write(journal->j_dev); +#endif /* * Now start flushing things to disk, in the order they appear @@ -768,7 +777,7 @@ start_journal_io: commit_transaction->t_state = T_COMMIT_DFLUSH; write_unlock(&journal->j_state_lock); - /* + /* * If the journal is not located on the file system device, * then we must flush the file system device before we issue * the commit record @@ -1132,6 +1141,10 @@ restart_loop: write_unlock(&journal->j_state_lock); wake_up(&journal->j_wait_done_commit); +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSTW) + /* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + bdev_clear_turbo_write(journal->j_dev); +#endif /* * Calculate overall stats */ diff --git a/fs/namespace.c b/fs/namespace.c index 53db6cdba8ea..0c1bfc642374 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -30,6 +30,13 @@ #include "pnode.h" #include "internal.h" +#ifdef CONFIG_OPLUS_SECURE_GUARD +#ifdef CONFIG_OPLUS_MOUNT_BLOCK +#ifdef CONFIG_OPLUS_KEVENT_UPLOAD +#include +#endif /* CONFIG_OPLUS_KEVENT_UPLOAD */ +#endif /* CONFIG_OPLUS_MOUNT_BLOCK */ +#endif /* CONFIG_OPLUS_SECURE_GUARD*/ /* Maximum number of mounts in a mount namespace */ unsigned int sysctl_mount_max __read_mostly = 100000; @@ -2842,6 +2849,11 @@ char *copy_mount_string(const void __user *data) return data ? strndup_user(data, PAGE_SIZE) : NULL; } +#ifdef CONFIG_OPLUS_SECURE_GUARD +#ifdef CONFIG_OPLUS_MOUNT_BLOCK +extern int oplus_mount_block(const char __user *dir_name, unsigned long flags); +#endif /* CONFIG_OPLUS_MOUNT_BLOCK */ +#endif /* CONFIG_OPLUS_SECURE_GUARD */ /* * Flags is a 32-bit value that allows up to 31 non-fs dependent flags to * be given to the mount() call (ie: read-only, no-dev, no-suid etc). @@ -2863,6 +2875,14 @@ long do_mount(const char *dev_name, const char __user *dir_name, unsigned int mnt_flags = 0, sb_flags; int retval = 0; +#ifdef CONFIG_OPLUS_SECURE_GUARD +#ifdef CONFIG_OPLUS_MOUNT_BLOCK + retval = oplus_mount_block(dir_name, flags); + if (retval < 0){ + return -EPERM; + } +#endif /* CONFIG_OPLUS_MOUNT_BLOCK */ +#endif /* CONFIG_OPLUS_SECURE_GUARD */ /* Discard magic */ if ((flags & MS_MGC_MSK) == MS_MGC_VAL) flags &= ~MS_MGC_MSK; diff --git a/fs/pipe.c b/fs/pipe.c index fa3c2c25cec5..66f3494987f7 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -1053,6 +1053,58 @@ static inline unsigned int round_pipe_size(unsigned int size) return roundup_pow_of_two(nr_pages) << PAGE_SHIFT; } +#ifdef OPLUS_BUG_STABILITY +//Weitao.Chen@AD.Stability, 2020/11/07, Add for avoiding critical process set pipe buffer error +static inline bool is_zygote_process(struct task_struct *t) +{ + const struct cred *tcred = __task_cred(t); + + struct task_struct * first_child = NULL; + if(t->children.next && t->children.next != (struct list_head*)&t->children.next) + first_child = container_of(t->children.next, struct task_struct, sibling); + if(!strcmp(t->comm, "main") && (tcred->uid.val == 0) && (t->parent != 0 && !strcmp(t->parent->comm,"init")) ) + return true; + else + return false; + return false; +} +#define SYSTEM_APP_UID 1000 +static inline bool is_system_uid(struct task_struct *t) +{ + int cur_uid; + cur_uid = task_uid(t).val; + if (cur_uid == SYSTEM_APP_UID) + return true; + + return false; +} + +static inline bool is_system_process(struct task_struct *t) +{ + pr_err("in system_process, t->comm is %s,grouplead command is %s",t->comm,t->group_leader->comm); + if (is_system_uid(t)) { + if (t->group_leader && (!strncmp(t->group_leader->comm,"system_server", 13) || + !strncmp(t->group_leader->comm, "surfaceflinger", 14) || + !strncmp(t->group_leader->comm, "Binder:", 7) || + !strncmp(t->group_leader->comm, "sensor", 6) || + !strncmp(t->group_leader->comm, "suspend", 7) || + !strncmp(t->group_leader->comm, "composer", 8))) + return true; + } + return false; +} + +static inline bool is_critial_process(struct task_struct *t) +{ + if( is_zygote_process(t) || is_system_process(t)) { + pr_err("in pipe set buffer size, critical svc, we are not gonna return EPERM"); + return true; + } + + return false; +} +#endif /* OPLUS_BUG_STABILITY */ + /* * Allocate a new array of pipe buffers and copy the info over. Returns the * pipe size if successful, or return -ERROR on error. @@ -1079,16 +1131,29 @@ static long pipe_set_size(struct pipe_inode_info *pipe, unsigned long arg) * Decreasing the pipe capacity is always permitted, even * if the user is currently over a limit. */ + #ifndef OPLUS_BUG_STABILITY + //Weitao.Chen@AD.Stability, 2020/11/07, Add for avoiding critical process set pipe buffer error if (nr_pages > pipe->buffers && size > pipe_max_size && !capable(CAP_SYS_RESOURCE)) + #else /* OPLUS_BUG_STABILITY */ + if (nr_pages > pipe->buffers && + size > pipe_max_size && !capable(CAP_SYS_RESOURCE) && !is_critial_process(current)) + #endif /* OPLUS_BUG_STABILITY */ return -EPERM; user_bufs = account_pipe_buffers(pipe->user, pipe->buffers, nr_pages); - + #ifndef OPLUS_BUG_STABILITY + //Weitao.Chen@AD.Stability, 2020/11/07, Add for avoiding critical process set pipe buffer error if (nr_pages > pipe->buffers && (too_many_pipe_buffers_hard(user_bufs) || too_many_pipe_buffers_soft(user_bufs)) && is_unprivileged_user()) { + #else /* OPLUS_BUG_STABILITY */ + if (nr_pages > pipe->buffers && + (too_many_pipe_buffers_hard(user_bufs) || + too_many_pipe_buffers_soft(user_bufs)) && + is_unprivileged_user() && !is_critial_process(current)) { + #endif /* OPLUS_BUG_STABILITY */ ret = -EPERM; goto out_revert_acct; } diff --git a/fs/proc/Kconfig b/fs/proc/Kconfig index 08dce22afec1..53d39b26f247 100644 --- a/fs/proc/Kconfig +++ b/fs/proc/Kconfig @@ -88,3 +88,7 @@ config PROC_UID depends on PROC_FS && RT_MUTEXES help Provides aggregated per-uid information under /proc/uid. +#ifdef OPLUS_FEATURE_HEALTHINFO +#//Huacai.Zhou@PSW.BSP.kernel.Peformance, 2018/06/18, add foreground process opt support +source fs/proc/oppo_healthinfo/Kconfig +#endif /* OPLUS_FEATURE_HEALTHINFO */ diff --git a/fs/proc/Makefile b/fs/proc/Makefile index d8dcb188db6d..a61351c8f683 100644 --- a/fs/proc/Makefile +++ b/fs/proc/Makefile @@ -33,3 +33,11 @@ proc-$(CONFIG_PROC_KCORE) += kcore.o proc-$(CONFIG_PROC_VMCORE) += vmcore.o proc-$(CONFIG_PRINTK) += kmsg.o proc-$(CONFIG_PROC_PAGE_MONITOR) += page.o +#ifdef OPLUS_FEATURE_HEALTHINFO +#Huacai.Zhou@PSW.BSP.kernel.Peformance, 2018/06/18, add foreground process opt support +obj-y += oppo_healthinfo/ +#endif /* OPLUS_FEATURE_HEALTHINFO */ +#ifdef OPLUS_FEATURE_TASK_CPUSTATS +#Hailong.Liu@TECH.Kernel.CPU, 2019/10/24, stat cpu usage on each tick. +proc-y += task_cpustats.o +#endif /* OPLUS_FEATURE_TASK_CPUSTATS */ diff --git a/fs/proc/base.c b/fs/proc/base.c index b37ec658c63a..05d8660df8c8 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -104,6 +104,24 @@ #include "../../lib/kstrtox.h" +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO +#include +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ + +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst +#define GLOBAL_SYSTEM_UID KUIDT_INIT(1000) +#define GLOBAL_SYSTEM_GID KGIDT_INIT(1000) +extern const struct file_operations proc_static_ux_operations; +#ifdef CONFIG_CAMERA_OPT +extern const struct file_operations proc_camera_opt_operations; +#endif +extern bool is_special_entry(struct dentry *dentry, const char* special_proc); +#endif /* OPLUS_FEATURE_UIFIRST */ + /* NOTE: * Implementing inode permission operations in /proc is almost * certainly an error. Permission checks need to happen during @@ -2000,6 +2018,13 @@ int pid_revalidate(struct dentry *dentry, unsigned int flags) if (task) { task_dump_owner(task, inode->i_mode, &inode->i_uid, &inode->i_gid); +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (is_special_entry(dentry, "static_ux")) { + inode->i_uid = GLOBAL_SYSTEM_UID; + inode->i_gid = GLOBAL_SYSTEM_GID; + } +#endif /* OPLUS_FEATURE_UIFIRST */ inode->i_mode &= ~(S_ISUID | S_ISGID); security_task_to_inode(task, inode); put_task_struct(task); @@ -3251,6 +3276,15 @@ static int proc_pid_patch_state(struct seq_file *m, struct pid_namespace *ns, static const struct file_operations proc_task_operations; static const struct inode_operations proc_task_inode_operations; +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) +/* + * read the reserved mmaps and reserved area + */ +extern int proc_pid_reserve_area(struct seq_file *m, struct pid_namespace *ns, + struct pid *pid, struct task_struct *task); +extern const struct file_operations proc_pid_rmaps_operations; +#endif + static const struct pid_entry tgid_base_stuff[] = { DIR("task", S_IRUGO|S_IXUGO, proc_task_inode_operations, proc_task_operations), DIR("fd", S_IRUSR|S_IXUSR, proc_fd_inode_operations, proc_fd_operations), @@ -3288,6 +3322,10 @@ static const struct pid_entry tgid_base_stuff[] = { ONE("stat", S_IRUGO, proc_tgid_stat), ONE("statm", S_IRUGO, proc_pid_statm), REG("maps", S_IRUGO, proc_pid_maps_operations), +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + REG("reserve_maps", S_IRUSR, proc_pid_rmaps_operations), + ONE("reserve_area", S_IRUSR, proc_pid_reserve_area), +#endif #ifdef CONFIG_NUMA REG("numa_maps", S_IRUGO, proc_pid_numa_maps_operations), #endif @@ -3368,6 +3406,12 @@ static const struct pid_entry tgid_base_stuff[] = { #ifdef CONFIG_CPU_FREQ_TIMES ONE("time_in_state", 0444, proc_time_in_state_show), #endif +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + REG("jank_info", S_IRUGO | S_IWUGO, proc_jank_trace_operations), +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ }; static int proc_tgid_base_readdir(struct file *file, struct dir_context *ctx) @@ -3771,6 +3815,13 @@ static const struct pid_entry tid_base_stuff[] = { #ifdef CONFIG_CPU_FREQ_TIMES ONE("time_in_state", 0444, proc_time_in_state_show), #endif +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + REG("static_ux", S_IRUGO | S_IWUGO, proc_static_ux_operations), +#endif /* OPLUS_FEATURE_UIFIRST */ +#ifdef CONFIG_CAMERA_OPT + REG("camera_opt", S_IRUGO | S_IWUGO, proc_camera_opt_operations), +#endif }; static int proc_tid_base_readdir(struct file *file, struct dir_context *ctx) diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c index 585651de1f5b..c782612645bb 100644 --- a/fs/proc/meminfo.c +++ b/fs/proc/meminfo.c @@ -20,6 +20,16 @@ #include #include "internal.h" +#ifdef OPLUS_FEATURE_HEALTHINFO +/* Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-06-26, add ion total used account*/ +#include +#endif /* OPLUS_FEATURE_HEALTHINFO */ + +#ifdef OPLUS_FEATURE_HEALTHINFO +//Jiheng.Xie@TECH.BSP.Performance, 2019-07-22, add for gpu total used account +extern unsigned long gpu_total(void); +#endif /* OPLUS_FEATURE_HEALTHINFO */ + void __attribute__((weak)) arch_report_meminfo(struct seq_file *m) { } @@ -158,7 +168,17 @@ static int meminfo_proc_show(struct seq_file *m, void *v) show_val_kb(m, "CmaFree: ", global_zone_page_state(NR_FREE_CMA_PAGES)); #endif - +#ifdef OPLUS_FEATURE_HEALTHINFO +/* Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-06-26, add ion total used account*/ +#ifdef CONFIG_ION + show_val_kb(m, "IonTotalCache: ", global_zone_page_state(NR_IONCACHE_PAGES));; + show_val_kb(m, "IonTotalUsed: ", ion_total() >> PAGE_SHIFT); +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ +#ifdef OPLUS_FEATURE_HEALTHINFO +//Jiheng.Xie@TECH.BSP.Performance, 2019-07-22, add for gpu total used account + show_val_kb(m, "GPUTotalUsed: ", gpu_total() >> PAGE_SHIFT); +#endif /* OPLUS_FEATURE_HEALTHINFO */ hugetlb_report_meminfo(m); arch_report_meminfo(m); diff --git a/fs/proc/reserve_mmap.c b/fs/proc/reserve_mmap.c index a2e41e9c1da6..89a89602e2a5 100644 --- a/fs/proc/reserve_mmap.c +++ b/fs/proc/reserve_mmap.c @@ -76,11 +76,7 @@ static const struct seq_operations proc_pid_rmaps_op = { .start = reserve_vma_m_start, .next = reserve_vma_m_next, .stop = m_stop, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,186) - .show = show_map -#else .show = show_pid_map -#endif }; static int pid_rmaps_open(struct inode *inode, struct file *file) diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 59749dfaef67..c3834e146b38 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c @@ -23,7 +23,7 @@ #ifdef arch_idle_time -static u64 get_idle_time(int cpu) +u64 get_idle_time(int cpu) { u64 idle; @@ -33,7 +33,7 @@ static u64 get_idle_time(int cpu) return idle; } -static u64 get_iowait_time(int cpu) +u64 get_iowait_time(int cpu) { u64 iowait; @@ -45,7 +45,7 @@ static u64 get_iowait_time(int cpu) #else -static u64 get_idle_time(int cpu) +u64 get_idle_time(int cpu) { u64 idle, idle_usecs = -1ULL; @@ -61,7 +61,7 @@ static u64 get_idle_time(int cpu) return idle; } -static u64 get_iowait_time(int cpu) +u64 get_iowait_time(int cpu) { u64 iowait, iowait_usecs = -1ULL; diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 741364f8f5d8..66e235a71461 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -863,6 +863,28 @@ static int show_smap(struct seq_file *m, void *v, int is_pid) /* mmap_sem is held in m_start */ walk_page_vma(vma, &smaps_walk); +#ifdef VENDOR_EDIT //yixue.ge@bsp.drv modify for android.bg get pss too slow + if (strcmp(current->comm, "android.bg") == 0) { + if ((unsigned long)(mss->pss >> (10 + PSS_SHIFT)) > 0) { + seq_printf(m, + "Pss: %8lu kB\n", + ( unsigned long)(mss->pss >> (10 + PSS_SHIFT))); + } + if ((mss->private_clean >> 10) > 0) { + seq_printf(m, + "Private_Clean: %8lu kB\n", + mss->private_clean >> 10); + } + if ((mss->private_dirty >> 10) > 0) { + seq_printf(m, + "Private_Dirty: %8lu kB\n", + mss->private_dirty >> 10); + } + m_cache_vma(m, vma); + return 0; + } +#endif /*VENDOR_EDIT*/ + if (!rollup_mode) { show_map_vma(m, vma, is_pid); if (vma_get_anon_name(vma)) { @@ -1012,6 +1034,10 @@ const struct file_operations proc_tid_smaps_operations = { .release = proc_map_release, }; +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) +#include "reserve_mmap.c" +#endif + enum clear_refs_types { CLEAR_REFS_ALL = 1, CLEAR_REFS_ANON, @@ -1732,7 +1758,12 @@ cont: break; } pte_unmap_unlock(pte - 1, ptl); +#if defined(OPLUS_FEATURE_PROCESS_RECLAIM) && defined(CONFIG_PROCESS_RECLAIM_ENHANCE) + reclaimed = reclaim_pages_from_list(&page_list, vma, NULL); +#else reclaimed = reclaim_pages_from_list(&page_list, vma); +#endif + rp->nr_reclaimed += reclaimed; rp->nr_to_reclaim -= reclaimed; if (rp->nr_to_reclaim < 0) diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index d814723fb27d..7e47d032e91b 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c @@ -373,6 +373,13 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record) scnprintf(name, sizeof(name), "powerpc-opal-%s-%llu", record->psi->name, record->id); break; +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info + case PSTORE_TYPE_DEVICE_INFO: + scnprintf(name, sizeof(name), "device-info-%s-%lld", record->psi->name, record->id); + break; +#endif + case PSTORE_TYPE_UNKNOWN: scnprintf(name, sizeof(name), "unknown-%s-%llu", record->psi->name, record->id); diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 8af9efa0ca0a..6bd52e58b861 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -607,7 +607,36 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c) record.size = c; psinfo->write(&record); } +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info +static void pstore_console_init(void ) +{ + size_t oldsize; + size_t size =0; + struct ramoops_context *cxt = psinfo->data; + struct pstore_record record; + if (psinfo == NULL) + return; + + size = cxt->console_size; + + pstore_record_init(&record, psinfo); + record.type = PSTORE_TYPE_CONSOLE; + record.buf = psinfo->buf; + record.size = size; + + oldsize = psinfo->bufsize; + + if (size > psinfo->bufsize) + size = psinfo->bufsize; + memset(record.buf, ' ', size); + + psinfo->write(&record); + + psinfo->bufsize = oldsize ; +} +#endif static struct console pstore_console = { .name = "pstore", .write = pstore_console_write, @@ -617,6 +646,11 @@ static struct console pstore_console = { static void pstore_register_console(void) { +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info + /*pstore memset befor use*/ + pstore_console_init(); +#endif register_console(&pstore_console); } diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 8291b5b6e370..2b9e319762c7 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -56,6 +56,13 @@ static ulong ramoops_pmsg_size = MIN_MEM_SIZE; module_param_named(pmsg_size, ramoops_pmsg_size, ulong, 0400); MODULE_PARM_DESC(pmsg_size, "size of user space message log"); +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info +static ulong ramoops_device_info_size = MIN_MEM_SIZE; +module_param_named(device_info_size, ramoops_device_info_size, ulong, 0400); +MODULE_PARM_DESC(device_info_size, "size of device info"); +#endif /* OPLUS_FEATURE_DUMPDEVICE */ + static unsigned long long mem_address; module_param_hw(mem_address, ullong, other, 0400); MODULE_PARM_DESC(mem_address, @@ -83,6 +90,9 @@ MODULE_PARM_DESC(ramoops_ecc, "ECC buffer size in bytes (1 is a special value, means 16 " "bytes ECC)"); +#ifndef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info +/*move this define to pstore.h*/ struct ramoops_context { struct persistent_ram_zone **dprzs; /* Oops dump zones */ struct persistent_ram_zone *cprz; /* Console zone */ @@ -108,7 +118,7 @@ struct ramoops_context { unsigned int pmsg_read_cnt; struct pstore_info pstore; }; - +#endif static struct platform_device *dummy; static struct ramoops_platform_data *dummy_data; @@ -120,6 +130,10 @@ static int ramoops_pstore_open(struct pstore_info *psi) cxt->console_read_cnt = 0; cxt->ftrace_read_cnt = 0; cxt->pmsg_read_cnt = 0; +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info + cxt->device_info_read_cnt = 0; +#endif /* OPLUS_FEATURE_DUMPDEVICE */ return 0; } @@ -280,6 +294,14 @@ static ssize_t ramoops_pstore_read(struct pstore_record *record) 1, &record->id, &record->type, PSTORE_TYPE_PMSG, 0); +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info + if (!prz_ok(prz)) + prz = ramoops_get_next_prz(&cxt->dprz, &cxt->device_info_read_cnt, + 1, &record->id, &record->type, + PSTORE_TYPE_DEVICE_INFO, 0); +#endif /* OPLUS_FEATURE_DUMPDEVICE */ + /* ftrace is last since it may want to dynamically allocate memory. */ if (!prz_ok(prz)) { if (!(cxt->flags & RAMOOPS_FLAG_FTRACE_PER_CPU)) { @@ -402,6 +424,14 @@ static int notrace ramoops_pstore_write(struct pstore_record *record) } else if (record->type == PSTORE_TYPE_PMSG) { pr_warn_ratelimited("PMSG shouldn't call %s\n", __func__); return -EINVAL; +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info + } else if (record->type == PSTORE_TYPE_DEVICE_INFO) { + if (!cxt->dprz) + return -ENOMEM; + persistent_ram_write(cxt->dprz, record->buf, record->size); + return 0; +#endif /* OPLUS_FEATURE_DUMPDEVICE */ } if (record->type != PSTORE_TYPE_DMESG) @@ -492,6 +522,12 @@ static int ramoops_pstore_erase(struct pstore_record *record) case PSTORE_TYPE_PMSG: prz = cxt->mprz; break; +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info + case PSTORE_TYPE_DEVICE_INFO: + prz = cxt->dprz; + break; +#endif /* OPLUS_FEATURE_DUMPDEVICE */ default: return -EINVAL; } @@ -710,6 +746,10 @@ static int ramoops_parse_dt(struct platform_device *pdev, parse_size("console-size", pdata->console_size); parse_size("ftrace-size", pdata->ftrace_size); parse_size("pmsg-size", pdata->pmsg_size); +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info + parse_size("devinfo-size", pdata->device_info_size); +#endif /* OPLUS_FEATURE_DUMPDEVICE */ parse_size("ecc-size", pdata->ecc_info.ecc_size); parse_size("flags", pdata->flags); @@ -759,7 +799,10 @@ static int ramoops_probe(struct platform_device *pdev) } if (!pdata->mem_size || (!pdata->record_size && !pdata->console_size && - !pdata->ftrace_size && !pdata->pmsg_size)) { +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info + !pdata->ftrace_size && !pdata->pmsg_size && !pdata->device_info_size)) { +#endif /* OPLUS_FEATURE_DUMPDEVICE */ pr_err("The memory size and the record/console size must be " "non-zero\n"); goto fail_out; @@ -773,6 +816,11 @@ static int ramoops_probe(struct platform_device *pdev) pdata->ftrace_size = rounddown_pow_of_two(pdata->ftrace_size); if (pdata->pmsg_size && !is_power_of_2(pdata->pmsg_size)) pdata->pmsg_size = rounddown_pow_of_two(pdata->pmsg_size); +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info + if (pdata->device_info_size && !is_power_of_2(pdata->device_info_size)) + pdata->device_info_size = rounddown_pow_of_two(pdata->device_info_size); +#endif /* OPLUS_FEATURE_DUMPDEVICE */ cxt->size = pdata->mem_size; cxt->phys_addr = pdata->mem_address; @@ -784,11 +832,18 @@ static int ramoops_probe(struct platform_device *pdev) cxt->dump_oops = pdata->dump_oops; cxt->flags = pdata->flags; cxt->ecc_info = pdata->ecc_info; +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info + cxt->device_info_size = pdata->device_info_size; +#endif /* OPLUS_FEATURE_DUMPDEVICE */ paddr = cxt->phys_addr; dump_mem_sz = cxt->size - cxt->console_size - cxt->ftrace_size - - cxt->pmsg_size; +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info + - cxt->pmsg_size - cxt->device_info_size; +#endif /* OPLUS_FEATURE_DUMPDEVICE */ err = ramoops_init_przs("dump", dev, cxt, &cxt->dprzs, &paddr, dump_mem_sz, cxt->record_size, &cxt->max_dump_cnt, 0, 0); @@ -816,6 +871,13 @@ static int ramoops_probe(struct platform_device *pdev) if (err) goto fail_init_mprz; +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info + err = ramoops_init_prz("devinfo", dev, cxt, &cxt->dprz, &paddr, + cxt->device_info_size, 0); + if (err) + goto fail_init_dprz; +#endif /* OPLUS_FEATURE_DUMPDEVICE */ cxt->pstore.data = cxt; /* * Prepare frontend flags based on which areas are initialized. @@ -866,6 +928,11 @@ static int ramoops_probe(struct platform_device *pdev) ramoops_pmsg_size = pdata->pmsg_size; ramoops_ftrace_size = pdata->ftrace_size; +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info + ramoops_device_info_size = pdata->device_info_size; +#endif /* OPLUS_FEATURE_DUMPDEVICE */ + pr_info("attached 0x%lx@0x%llx, ecc: %d/%d\n", cxt->size, (unsigned long long)cxt->phys_addr, cxt->ecc_info.ecc_size, cxt->ecc_info.block_size); @@ -877,6 +944,11 @@ fail_buf: fail_clear: cxt->pstore.bufsize = 0; persistent_ram_free(cxt->mprz); +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info +fail_init_dprz: + persistent_ram_free(cxt->dprz); +#endif /* OPLUS_FEATURE_DUMPDEVICE */ fail_init_mprz: fail_init_fprz: persistent_ram_free(cxt->cprz); @@ -897,6 +969,10 @@ static int ramoops_remove(struct platform_device *pdev) persistent_ram_free(cxt->mprz); persistent_ram_free(cxt->cprz); +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info + persistent_ram_free(cxt->dprz); +#endif /* OPLUS_FEATURE_DUMPDEVICE */ ramoops_free_przs(cxt); return 0; @@ -935,6 +1011,10 @@ static void ramoops_register_dummy(void) dummy_data->record_size = record_size; dummy_data->console_size = ramoops_console_size; dummy_data->ftrace_size = ramoops_ftrace_size; +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info + dummy_data->device_info_size = ramoops_device_info_size; +#endif /* OPLUS_FEATURE_DUMPDEVICE */ dummy_data->pmsg_size = ramoops_pmsg_size; dummy_data->dump_oops = dump_oops; dummy_data->flags = RAMOOPS_FLAG_FTRACE_PER_CPU; diff --git a/fs/read_write.c b/fs/read_write.c index 0da6e4f19d7f..ef5d625a3eb5 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -24,6 +24,12 @@ #include #include +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) +#include +#include +DEFINE_TRACE(syscall_read_timeout); +DEFINE_TRACE(syscall_write_timeout); +#endif /*OPLUS_FEATURE_IOMONITOR*/ const struct file_operations generic_ro_fops = { .llseek = generic_file_llseek, @@ -425,6 +431,9 @@ ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos) /* The cast to a user pointer is valid due to the set_fs() */ result = vfs_read(file, (void __user *)buf, count, pos); set_fs(old_fs); +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + iomonitor_update_rw_stats(KERNEL_READ, file, result); +#endif /*OPLUS_FEATURE_IOMONITOR*/ return result; } EXPORT_SYMBOL(kernel_read); @@ -506,6 +515,10 @@ ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t fsnotify_modify(file); add_wchar(current, ret); } +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + if (ret > 0) + iomonitor_update_rw_stats(KERNEL_WRITE, file, ret); +#endif /*OPLUS_FEATURE_IOMONITOR*/ inc_syscw(current); return ret; } @@ -522,7 +535,9 @@ ssize_t kernel_write(struct file *file, const void *buf, size_t count, /* The cast to a user pointer is valid due to the set_fs() */ res = vfs_write(file, (__force const char __user *)buf, count, pos); set_fs(old_fs); - +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + iomonitor_update_rw_stats(KERNEL_WRITE, file, res); +#endif /*OPLUS_FEATURE_IOMONITOR*/ return res; } EXPORT_SYMBOL(kernel_write); @@ -572,12 +587,20 @@ SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count) { struct fd f = fdget_pos(fd); ssize_t ret = -EBADF; - +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + unsigned long read_time = jiffies; +#endif /*OPLUS_FEATURE_IOMONITOR*/ if (f.file) { loff_t pos = file_pos_read(f.file); ret = vfs_read(f.file, buf, count, &pos); if (ret >= 0) file_pos_write(f.file, pos); +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + if (ret > 0) { + iomonitor_update_rw_stats(USER_READ, f.file, ret); + trace_syscall_read_timeout(f.file, jiffies_to_msecs(jiffies - read_time)); + } +#endif /*OPLUS_FEATURE_IOMONITOR*/ fdput_pos(f); } return ret; @@ -588,12 +611,20 @@ SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf, { struct fd f = fdget_pos(fd); ssize_t ret = -EBADF; - +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + unsigned long write_time = jiffies; +#endif /*OPLUS_FEATURE_IOMONITOR*/ if (f.file) { loff_t pos = file_pos_read(f.file); ret = vfs_write(f.file, buf, count, &pos); if (ret >= 0) file_pos_write(f.file, pos); +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + if (ret > 0) { + iomonitor_update_rw_stats(USER_WRITE, f.file, ret); + trace_syscall_write_timeout(f.file, jiffies_to_msecs(jiffies - write_time)); + } +#endif /*OPLUS_FEATURE_IOMONITOR*/ fdput_pos(f); } @@ -616,7 +647,10 @@ SYSCALL_DEFINE4(pread64, unsigned int, fd, char __user *, buf, ret = vfs_read(f.file, buf, count, &pos); fdput(f); } - +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + if (ret > 0) + iomonitor_update_rw_stats(USER_READ, f.file, ret); +#endif /*OPLUS_FEATURE_IOMONITOR*/ return ret; } @@ -636,7 +670,10 @@ SYSCALL_DEFINE4(pwrite64, unsigned int, fd, const char __user *, buf, ret = vfs_write(f.file, buf, count, &pos); fdput(f); } - +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + if (ret > 0) + iomonitor_update_rw_stats(USER_WRITE, f.file, ret); +#endif /*OPLUS_FEATURE_IOMONITOR*/ return ret; } @@ -1023,6 +1060,10 @@ static ssize_t do_readv(unsigned long fd, const struct iovec __user *vec, if (ret > 0) add_rchar(current, ret); +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + if (ret > 0) + iomonitor_update_rw_stats(USER_READ, f.file, ret); +#endif /*OPLUS_FEATURE_IOMONITOR*/ inc_syscr(current); return ret; } @@ -1043,6 +1084,10 @@ static ssize_t do_writev(unsigned long fd, const struct iovec __user *vec, if (ret > 0) add_wchar(current, ret); +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + if (ret > 0) + iomonitor_update_rw_stats(USER_WRITE, f.file, ret); +#endif /*OPLUS_FEATURE_IOMONITOR*/ inc_syscw(current); return ret; } @@ -1072,6 +1117,10 @@ static ssize_t do_preadv(unsigned long fd, const struct iovec __user *vec, if (ret > 0) add_rchar(current, ret); +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + if (ret > 0) + iomonitor_update_rw_stats(USER_READ, f.file, ret); +#endif /*OPLUS_FEATURE_IOMONITOR*/ inc_syscr(current); return ret; } @@ -1095,6 +1144,10 @@ static ssize_t do_pwritev(unsigned long fd, const struct iovec __user *vec, if (ret > 0) add_wchar(current, ret); +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + if (ret > 0) + iomonitor_update_rw_stats(USER_WRITE, f.file, ret); +#endif /*OPLUS_FEATURE_IOMONITOR*/ inc_syscw(current); return ret; } @@ -1168,6 +1221,10 @@ static size_t compat_readv(struct file *file, } if (ret > 0) add_rchar(current, ret); +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + if (ret > 0) + iomonitor_update_rw_stats(USER_READ, file, ret); +#endif /*OPLUS_FEATURE_IOMONITOR*/ inc_syscr(current); return ret; } @@ -1278,6 +1335,10 @@ static size_t compat_writev(struct file *file, } if (ret > 0) add_wchar(current, ret); +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + if (ret > 0) + iomonitor_update_rw_stats(USER_WRITE, file, ret); +#endif /*OPLUS_FEATURE_IOMONITOR*/ inc_syscw(current); return ret; } @@ -1456,7 +1517,12 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, else in.file->f_pos = pos; } - +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + if (retval > 0) { + iomonitor_update_rw_stats(USER_READ, in.file, retval); + iomonitor_update_rw_stats(USER_WRITE,in.file, retval); + } +#endif /*OPLUS_FEATURE_IOMONITOR*/ inc_syscr(current); inc_syscw(current); if (pos > max) @@ -1619,7 +1685,12 @@ done: fsnotify_modify(file_out); add_wchar(current, ret); } - +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + if (ret > 0) { + iomonitor_update_rw_stats(USER_READ, file_in, ret); + iomonitor_update_rw_stats(USER_WRITE,file_in, ret); + } +#endif /*OPLUS_FEATURE_IOMONITOR*/ inc_syscr(current); inc_syscw(current); diff --git a/fs/sync.c b/fs/sync.c index 12f2aa594c50..98f18a3d163a 100644 --- a/fs/sync.c +++ b/fs/sync.c @@ -18,6 +18,19 @@ #include #include "internal.h" +#ifdef OPLUS_FEATURE_HEALTHINFO +// wenbin.liu@PSW.BSP.MM, 2018/05/02 +// Add for get cpu load +#ifdef CONFIG_OPPO_HEALTHINFO +#include +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) +#include +#include +DEFINE_TRACE(syscall_sync_timeout); +#endif /*OPLUS_FEATURE_IOMONITOR*/ + #define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \ SYNC_FILE_RANGE_WAIT_AFTER) @@ -215,12 +228,29 @@ static int do_fsync(unsigned int fd, int datasync) { struct fd f = fdget(fd); int ret = -EBADF; - +#ifdef OPLUS_FEATURE_HEALTHINFO +// wenbin.liu@PSW.BSP.MM, 2018/08/06 +// Add for record fsync time +#ifdef CONFIG_OPPO_HEALTHINFO + unsigned long fsync_time = jiffies; +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ if (f.file) { ret = vfs_fsync(f.file, datasync); fdput(f); +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) && defined(OPLUS_FEATURE_HEALTHINFO) + iomonitor_update_fs_stats(FS_FSYNC, 1); + trace_syscall_sync_timeout(f.file, jiffies_to_msecs(jiffies - fsync_time)); +#endif /*OPLUS_FEATURE_IOMONITOR & CONFIG_OPPO_HEALTHINFO*/ inc_syscfs(current); } +#ifdef OPLUS_FEATURE_HEALTHINFO +// wenbin.liu@PSW.BSP.MM, 2018/08/06 +// Add for record fsync time +#ifdef CONFIG_OPPO_HEALTHINFO + ohm_schedstats_record(OHM_SCHED_FSYNC, current, jiffies_to_msecs(jiffies - fsync_time)); +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ return ret; } diff --git a/fs/xattr.c b/fs/xattr.c index 35ead9b764c6..ab5989f759b1 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -229,6 +229,10 @@ out: } EXPORT_SYMBOL_GPL(vfs_setxattr); +#ifndef OPLUS_FEATURE_SDCARDFS_SUPPORT +//huyu@BSP.Storage.Sdcard, 2020/4/8 add for export this api for sdcardfs use +static +#endif ssize_t xattr_getsecurity(struct inode *inode, const char *name, void *value, size_t size) @@ -254,7 +258,10 @@ out: out_noalloc: return len; } +#ifdef OPLUS_FEATURE_SDCARDFS_SUPPORT +//huyu@BSP.Storage.Sdcard, 2020/4/8 add for export this api for sdcardfs use EXPORT_SYMBOL_GPL(xattr_getsecurity); +#endif /* * vfs_getxattr_alloc - allocate memory, if necessary, before calling getxattr diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h index b186c4b464e0..a1de7b6f7df9 100644 --- a/include/linux/backing-dev-defs.h +++ b/include/linux/backing-dev-defs.h @@ -185,6 +185,14 @@ struct backing_dev_info { enum { BLK_RW_ASYNC = 0, BLK_RW_SYNC = 1, +#ifdef OPLUS_FEATURE_HEALTHINFO +// jiheng.xie@PSW.Tech.BSP.Performance, 2019/03/11 +// Add for ioqueue +#ifdef CONFIG_OPPO_HEALTHINFO + BLK_RW_BG = 2, + BLK_RW_FG = 3, +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ }; void clear_wb_congested(struct bdi_writeback_congested *congested, int sync); diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 608efe564607..e93c56fa26f2 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -201,6 +201,7 @@ enum { BLK_MQ_REQ_NOWAIT = (1 << 0), /* return when out of requests */ BLK_MQ_REQ_RESERVED = (1 << 1), /* allocate from reserved pool */ BLK_MQ_REQ_INTERNAL = (1 << 2), /* allocate internal/sched tag */ + BLK_MQ_REQ_PREEMPT = (1 << 3), /* set RQF_PREEMPT */ }; struct request *blk_mq_alloc_request(struct request_queue *q, unsigned int op, diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 173673a37250..feb28e9fec19 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -239,6 +239,10 @@ enum req_flag_bits { __REQ_INTEGRITY, /* I/O includes block integrity payload */ __REQ_FUA, /* forced unit access */ __REQ_PREFLUSH, /* request for cache flush */ +#ifdef OPLUS_FEATURE_UIFIRST + __REQ_UX, /* ux activity */ + __REQ_FG, /* foreground activity */ +#endif __REQ_RAHEAD, /* read ahead, can fail anytime */ __REQ_BACKGROUND, /* background IO */ @@ -246,6 +250,12 @@ enum req_flag_bits { /* command specific flags for REQ_OP_WRITE_ZEROES: */ __REQ_NOUNMAP, /* do not free blocks when zeroing */ + /* Android specific flags */ + __REQ_NOENCRYPT, /* + * ok to not encrypt (already encrypted at fs + * level) + */ + __REQ_URGENT, /* urgent request */ __REQ_NOWAIT, /* Don't wait if request will block */ /* @@ -268,8 +278,13 @@ enum req_flag_bits { #define REQ_INTEGRITY (1ULL << __REQ_INTEGRITY) #define REQ_FUA (1ULL << __REQ_FUA) #define REQ_PREFLUSH (1ULL << __REQ_PREFLUSH) +#ifdef OPLUS_FEATURE_UIFIRST +#define REQ_UX (1ULL << __REQ_UX) +#define REQ_FG (1ULL << __REQ_FG) +#endif #define REQ_RAHEAD (1ULL << __REQ_RAHEAD) #define REQ_BACKGROUND (1ULL << __REQ_BACKGROUND) +#define REQ_NOENCRYPT (1ULL << __REQ_NOENCRYPT) #define REQ_NOUNMAP (1ULL << __REQ_NOUNMAP) #define REQ_NOWAIT (1ULL << __REQ_NOWAIT) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index d6215795604c..d98d9399c3a9 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -98,6 +98,9 @@ typedef __u32 __bitwise req_flags_t; #define RQF_MQ_INFLIGHT ((__force req_flags_t)(1 << 6)) /* don't call prep for this one */ #define RQF_DONTPREP ((__force req_flags_t)(1 << 7)) +/* set for "ide_preempt" requests and also for requests for which the SCSI + "quiesce" state must be ignored. */ +#define RQF_PREEMPT ((__force req_flags_t)(1 << 8)) /* contains copies of user pages */ #define RQF_COPY_USER ((__force req_flags_t)(1 << 9)) /* vaguely specified driver internal error. Ignored by the block layer */ @@ -144,6 +147,20 @@ struct request { unsigned int cmd_flags; /* op and common flags */ req_flags_t rq_flags; +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + ktime_t req_tg; + ktime_t req_ti; + ktime_t req_td; + ktime_t req_tc; +#endif /*OPLUS_FEATURE_IOMONITOR*/ + +#ifdef VENDOR_EDIT +/*Hank.liu@PSW.BSP Kernel IO Latency 2019-03-19,Add some info in each request*/ + ktime_t block_io_start; //save block io start ktime + ktime_t ufs_io_start; //save ufs io start ktime + u64 flash_io_latency; //save mmc host command latency +#endif /*VENDOR_EDIT*/ + int internal_tag; unsigned long atomic_flags; @@ -156,6 +173,10 @@ struct request { struct bio *bio; struct bio *biotail; +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ + struct list_head fg_list; +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ /* * The hash is used inside the scheduler, and killed once the * request reaches the dispatch list. The ipi_list is only used @@ -407,6 +428,14 @@ struct request_queue { * Together with queue_head for cacheline sharing */ struct list_head queue_head; +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ + struct list_head fg_head; + int fg_count; + int both_count; + int fg_count_max; + int both_count_max; +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ struct request *last_merge; struct elevator_queue *elevator; int nr_rqs[2]; /* # allocated [a]sync rqs */ @@ -534,8 +563,15 @@ struct request_queue { struct list_head tag_busy_list; unsigned int nr_sorted; +#ifndef OPLUS_FEATURE_HEALTHINFO +// jiheng.xie@PSW.Tech.BSP.Performance, 2019/03/11 +// Modify for ioqueue unsigned int in_flight[2]; - +#else /* OPLUS_FEATURE_HEALTHINFO */ +#ifdef CONFIG_OPPO_HEALTHINFO + unsigned int in_flight[4]; +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ /* * Number of active block driver functions for which blk_drain_queue() * must wait. Must be incremented around functions that unlock the @@ -623,6 +659,11 @@ struct request_queue { #define BLK_MAX_WRITE_HINTS 5 u64 write_hints[BLK_MAX_WRITE_HINTS]; + +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSTW) + /* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + bool turbo_write_dev; +#endif }; #define QUEUE_FLAG_QUEUED 0 /* uses generic tag queueing */ @@ -656,6 +697,7 @@ struct request_queue { #define QUEUE_FLAG_SCSI_PASSTHROUGH 27 /* queue supports SCSI commands */ #define QUEUE_FLAG_QUIESCED 28 /* queue has been quiesced */ #define QUEUE_FLAG_PREEMPT_ONLY 29 /* only process REQ_PREEMPT requests */ +#define QUEUE_FLAG_INLINECRYPT 30 /* inline encryption support */ #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ (1 << QUEUE_FLAG_STACKABLE) | \ @@ -735,6 +777,30 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) __clear_bit(flag, &q->queue_flags); } +#ifdef OPLUS_FEATURE_HEALTHINFO +// jiheng.xie@PSW.Tech.BSP.Performance, 2019/03/11 +// Add for ioqueue +#ifdef CONFIG_OPPO_HEALTHINFO +static inline void ohm_ioqueue_add_inflight(struct request_queue *q, + struct request *rq) +{ + if (rq->cmd_flags & REQ_FG) + q->in_flight[BLK_RW_FG]++; + else + q->in_flight[BLK_RW_BG]++; +} + +static inline void ohm_ioqueue_dec_inflight(struct request_queue *q, + struct request *rq) +{ + if (rq->cmd_flags & REQ_FG) + q->in_flight[BLK_RW_FG]--; + else + q->in_flight[BLK_RW_BG]--; +} +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ + #define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) #define blk_queue_dying(q) test_bit(QUEUE_FLAG_DYING, &(q)->queue_flags) @@ -2012,6 +2078,16 @@ static const u_int64_t latency_x_axis_us[] = { 7000, 9000, 10000 +#ifdef VENDOR_EDIT +//yh@BSP.Storage.UFS, 2019-02-19 add for ufs fw upgrade/health info + ,20000 + ,40000 + ,60000 + ,80000 + ,100000 + ,150000 + ,200000 +#endif }; #define BLK_IO_LAT_HIST_DISABLE 0 diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index ed0ff1538049..8a71d65d8568 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -151,6 +151,14 @@ struct cpufreq_policy { /* For cpufreq driver's internal use */ void *driver_data; +#ifdef OPLUS_FEATURE_HEALTHINFO +//Jiheng.Xie@TECH.BSP.Performance,2019-07-29,add for cpufreq limit info +#ifdef CONFIG_OPPO_HEALTHINFO + /* For get changed freq info */ + char change_comm[TASK_COMM_LEN]; + unsigned int org_max; +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ }; /* Only for ACPI */ @@ -931,6 +939,10 @@ extern void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq, extern void arch_set_max_freq_scale(struct cpumask *cpus, unsigned long policy_max_freq); +#ifdef OPLUS_FEATURE_HEALTHINFO +struct list_head *get_cpufreq_policy_list(void); +#endif /* OPLUS_FEATURE_HEALTHINFO */ + /* the following are really really optional */ extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; extern struct freq_attr cpufreq_freq_attr_scaling_boost_freqs; diff --git a/include/linux/firmware.h b/include/linux/firmware.h index d4508080348d..303acad8f65e 100644 --- a/include/linux/firmware.h +++ b/include/linux/firmware.h @@ -52,6 +52,11 @@ int request_firmware_into_buf(const struct firmware **firmware_p, const char *name, struct device *device, void *buf, size_t size); void release_firmware(const struct firmware *fw); +#ifdef VENDOR_EDIT +//Tong.Han@Bsp.Group.Tp,2017-12-16,Add interface to get proper fw +int request_firmware_select(const struct firmware **fw, const char *name, + struct device *device); +#endif/*VENDOR_EDIT*/ #else static inline int request_firmware(const struct firmware **fw, const char *name, diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h index a83fbaffaac6..c2941e77022c 100644 --- a/include/linux/fscrypt.h +++ b/include/linux/fscrypt.h @@ -846,6 +846,21 @@ static inline int fscrypt_encrypt_symlink(struct inode *inode, return 0; } +/* fscrypt_ice.c */ +#ifdef CONFIG_PFK +extern int fscrypt_using_hardware_encryption(const struct inode *inode); +extern void fscrypt_set_ice_dun(const struct inode *inode, + struct bio *bio, u64 dun); +extern void fscrypt_set_ice_skip(struct bio *bio, int bi_crypt_skip); +extern bool fscrypt_mergeable_bio(struct bio *bio, u64 dun, bool bio_encrypted, + int bi_crypt_skip); +#else +static inline int fscrypt_using_hardware_encryption(const struct inode *inode) +{ + return 0; +} +#endif + /* If *pagep is a bounce page, free it and set *pagep to the pagecache page */ static inline void fscrypt_finalize_bounce_page(struct page **pagep) { diff --git a/include/linux/input/qpnp-power-on.h b/include/linux/input/qpnp-power-on.h index 4fa954a9b1de..13658aeae399 100644 --- a/include/linux/input/qpnp-power-on.h +++ b/include/linux/input/qpnp-power-on.h @@ -61,8 +61,85 @@ enum pon_restart_reason { PON_RESTART_REASON_DMVERITY_CORRUPTED = 0x04, PON_RESTART_REASON_DMVERITY_ENFORCE = 0x05, PON_RESTART_REASON_KEYS_CLEAR = 0x06, +#ifdef VENDOR_EDIT +/*xing.xing@BSP.Bootloader.Bootflow, 2019/04/11, Add for oppo boot mode*/ + PON_RESTART_REASON_SILENCE = 0x21, + PON_RESTART_REASON_SAU = 0x22, + PON_RESTART_REASON_RF = 0x23, + PON_RESTART_REASON_WLAN = 0x24, + PON_RESTART_REASON_MOS = 0x25, + PON_RESTART_REASON_FACTORY = 0x26, + PON_RESTART_REASON_KERNEL = 0x27, + PON_RESTART_REASON_MODEM = 0x28, + PON_RESTART_REASON_ANDROID = 0x29, + PON_RESTART_REASON_SAFE = 0x2A, + #ifdef OPLUS_FEATURE_AGINGTEST + //xiaofan.yang@PSW.TECH.AgingTest, 2019/01/07,Add for factory agingtest + PON_RESTART_REASON_SBL_DDRTEST = 0x2B, + PON_RESTART_REASON_SBL_DDR_CUS = 0x2C, + PON_RESTART_REASON_MEM_AGING = 0x2D, + //0x2E is SBLTEST FAIL, just happen in ddrtest fail when xbl setup + #endif + PON_RESTART_REASON_NORMAL = 0x3E, +#endif }; +#ifdef OPLUS_FEATURE_QCOM_PMICWD +struct qpnp_pon { + struct device *dev; + struct regmap *regmap; + struct input_dev *pon_input; + struct qpnp_pon_config *pon_cfg; + struct pon_regulator *pon_reg_cfg; + struct list_head restore_regs; + struct list_head list; + struct mutex restore_lock; + struct delayed_work bark_work; + struct dentry *debugfs; + struct device_node *pbs_dev_node; + struct task_struct *wd_task; + struct mutex wd_task_mutex; + unsigned int pmicwd_state;//|reserver|rst type|timeout|enable| + u8 suspend_state;//record the suspend state + u16 base; + u8 subtype; + u8 pon_ver; + u8 warm_reset_reason1; + u8 warm_reset_reason2; + u8 twm_state; + int num_pon_config; + int num_pon_reg; + int pon_trigger_reason; + int pon_power_off_reason; + u32 dbc_time_us; + u32 uvlo; + int warm_reset_poff_type; + int hard_reset_poff_type; + int shutdown_poff_type; + int resin_warm_reset_type; + int resin_hard_reset_type; + int resin_shutdown_type; + bool is_spon; + bool store_hard_reset_reason; + bool resin_hard_reset_disable; + bool resin_shutdown_disable; + bool ps_hold_hard_reset_disable; + bool ps_hold_shutdown_disable; + bool kpdpwr_dbc_enable; + bool support_twm_config; + bool resin_pon_reset; + ktime_t kpdpwr_last_release_time; + struct notifier_block pon_nb; + bool legacy_hard_reset_offset; +}; + +extern const struct dev_pm_ops qpnp_pm_ops; +extern struct qpnp_pon *sys_reset_dev; +int qpnp_pon_masked_write(struct qpnp_pon *pon, u16 addr, u8 mask, u8 val); +void pmicwd_init(struct platform_device *pdev, struct qpnp_pon *pon, bool sys_reset); +void kpdpwr_init(struct qpnp_pon *pon, bool sys_reset); +#endif /* OPLUS_FEATURE_QCOM_PMICWD */ + #ifdef CONFIG_INPUT_QPNP_POWER_ON int qpnp_pon_system_pwr_off(enum pon_power_off_type type); int qpnp_pon_is_warm_reset(void); diff --git a/include/linux/kobject.h b/include/linux/kobject.h index af4776747c79..277ef6fc2191 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h @@ -29,8 +29,13 @@ #include #define UEVENT_HELPER_PATH_LEN 256 +#ifdef OPLUS_FEATURE_CHG_BASIC +#define UEVENT_NUM_ENVP 128 /* number of env pointers */ +#define UEVENT_BUFFER_SIZE 4096 /* buffer for the variables */ +#else #define UEVENT_NUM_ENVP 64 /* number of env pointers */ #define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */ +#endif /*OPLUS_FEATURE_CHG_BASIC*/ #ifdef CONFIG_UEVENT_HELPER /* path to the userspace helper executed on an event */ diff --git a/include/linux/mm.h b/include/linux/mm.h index 34236fbc5079..1771f219d1e9 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -216,6 +216,17 @@ extern unsigned int kobjsize(const void *objp); #define VM_NOHUGEPAGE 0x40000000 /* MADV_NOHUGEPAGE marked this vma */ #define VM_MERGEABLE 0x80000000 /* KSM may merge identical pages */ +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) +/* + * new vm flags of vma in reserved area + */ +#define VM_BACKUP_CREATE 0x100000000UL /* Created backup vma for emergency */ +#define VM_BACKUP_ALLOC 0x200000000UL /* Alloced memory from backup vma */ + +#define BACKUP_ALLOC_FLAG(vm_flags) ((vm_flags) & VM_BACKUP_ALLOC) +#define BACKUP_CREATE_FLAG(vm_flags) ((vm_flags) & VM_BACKUP_CREATE) +#endif + #ifdef CONFIG_ARCH_USES_HIGH_VMA_FLAGS #define VM_HIGH_ARCH_BIT_0 32 /* bit only usable on 64-bit architectures */ #define VM_HIGH_ARCH_BIT_1 33 /* bit only usable on 64-bit architectures */ @@ -2474,6 +2485,11 @@ static inline unsigned long vm_start_gap(struct vm_area_struct *vma) { unsigned long vm_start = vma->vm_start; +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + if (BACKUP_ALLOC_FLAG(vma->vm_flags)) + return vm_start; +#endif + if (vma->vm_flags & VM_GROWSDOWN) { vm_start -= stack_guard_gap; if (vm_start > vma->vm_start) @@ -2486,6 +2502,11 @@ static inline unsigned long vm_end_gap(struct vm_area_struct *vma) { unsigned long vm_end = vma->vm_end; +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + if (BACKUP_ALLOC_FLAG(vma->vm_flags)) + return vm_end; +#endif + if (vma->vm_flags & VM_GROWSUP) { vm_end += stack_guard_gap; if (vm_end < vma->vm_end) @@ -2849,6 +2870,10 @@ struct reclaim_param { int nr_to_reclaim; /* pages reclaimed */ int nr_reclaimed; +#if defined(OPLUS_FEATURE_PROCESS_RECLAIM) && defined(CONFIG_PROCESS_RECLAIM_ENHANCE) + bool inactive_lru; + struct task_struct *reclaimed_task; +#endif }; extern struct reclaim_param reclaim_task_anon(struct task_struct *task, int nr_to_reclaim); diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 811f4c0d320a..2e9845dad415 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -522,6 +522,16 @@ struct mm_struct { #endif struct work_struct async_put_work; +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + struct vm_area_struct *reserve_vma; + struct vm_area_struct *reserve_mmap; + struct rb_root reserve_mm_rb; + unsigned long reserve_highest_vm_end; + int reserve_map_count; + int do_reserve_mmap; + int vm_search_two_way; +#endif + #if IS_ENABLED(CONFIG_HMM) /* HMM needs to track a few things per mm */ struct hmm *hmm; diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 5079511a759c..ac8040741569 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -158,6 +158,10 @@ struct sd_ssr { unsigned int au; /* In sectors */ unsigned int erase_timeout; /* In milliseconds */ unsigned int erase_offset; /* In milliseconds */ +#ifdef VENDOR_EDIT +//Chunyi.Mei@PSW.BSP.Storage.Sdcard, 2018-12-10, Add for SD Card device information + unsigned int speed_class; /* speed_class */ +#endif /* VENDOR_EDIT */ }; struct sd_switch_caps { diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 328e78d9281b..acc01b3c46af 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -25,6 +25,14 @@ #define MMC_AUTOSUSPEND_DELAY_MS 3000 +#ifdef VENDOR_EDIT +//Gavin.Lei@BSP.Storage.SDCard 2020-7-20 Add for abnormal SD card compatible +#define MAX_MULTIREAD_TIMEOUT_ERR_CNT 10 +#define MMC_MULTIREAD_CNT_WINDOW_S (150) +#define MAX_MULTIWRITE_TIMEOUT_ERR_CNT 10 +#define MMC_MULTIWRITE_CNT_WINDOW_S (300) +#endif /* VENDOR_EDIT */ + struct mmc_ios { unsigned int clock; /* clock rate */ unsigned int old_rate; /* saved clock rate */ @@ -604,6 +612,10 @@ struct mmc_host { struct delayed_work detect; int detect_change; /* card detect flag */ +#ifdef VENDOR_EDIT +//Lycan.Wang@Prd.BasicDrv, 2014-07-10 Add for retry 5 times when new sdcard init error + int detect_change_retry; +#endif /* VENDOR_EDIT */ struct mmc_slot slot; const struct mmc_bus_ops *bus_ops; /* current bus driver */ @@ -620,6 +632,11 @@ struct mmc_host { bool sdio_irq_pending; atomic_t sdio_irq_thread_abort; +#ifdef VENDOR_EDIT +//yh@bsp, 2015-10-21 Add for special card compatible + bool card_stuck_in_programing_status; +#endif /* VENDOR_EDIT */ + mmc_pm_flag_t pm_flags; /* requested pm features */ struct led_trigger *led; /* activity led */ @@ -631,6 +648,20 @@ struct mmc_host { struct dentry *debugfs_root; +#ifdef VENDOR_EDIT +//Gavin.Lei@BSP.Storage.SDCard 2020-7-20 Add for abnormal SD card compatible + unsigned int card_multiread_timeout_err_cnt; + sector_t old_blk_rq_rd_pos; + bool card_first_rd_timeout; + unsigned long card_rd_timeout_start; + bool card_is_rd_abnormal; + unsigned int card_multiwrite_timeout_err_cnt; + sector_t old_blk_rq_wr_pos; + bool card_first_wr_timeout; + unsigned long card_wr_timeout_start; + bool card_is_wr_abnormal; +#endif /* VENDOR_EDIT */ + bool err_occurred; u32 err_stats[MMC_ERR_MAX]; ktime_t last_failed_rq_time; diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 42e4654d712e..71446abdfef4 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -19,7 +19,9 @@ #include #include #include - +#if defined(OPLUS_FEATURE_MULTI_KSWAPD) && defined(CONFIG_OPLUS_MULTI_KSWAPD) +#include +#endif /*OPLUS_FEATURE_MULTI_KSWAPD*/ /* Free memory management - zoned buddy allocator. */ #ifndef CONFIG_FORCE_MAX_ZONEORDER #define MAX_ORDER 11 @@ -28,6 +30,9 @@ #endif #define MAX_ORDER_NR_PAGES (1 << (MAX_ORDER - 1)) +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) +#define FREE_AREA_COUNTS 4 +#endif /* * PAGE_ALLOC_COSTLY_ORDER is the order at which allocations are deemed * costly to service. That is between allocation orders which should @@ -153,6 +158,10 @@ enum zone_stat_item { NR_ZSPAGES, /* allocated in zsmalloc */ #endif NR_FREE_CMA_PAGES, +#ifdef OPLUS_FEATURE_HEALTHINFO +/*Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-09-25, add ion cached account*/ + NR_IONCACHE_PAGES, +#endif /* OPLUS_FEATURE_HEALTHINFO */ NR_VM_ZONE_STAT_ITEMS }; enum node_stat_item { @@ -363,6 +372,14 @@ enum zone_type { #ifndef __GENERATING_BOUNDS_H +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) +struct page_label { + unsigned long label; + unsigned long segment; +}; +#endif + + struct zone { /* Read-mostly fields */ @@ -447,7 +464,9 @@ struct zone { unsigned long managed_pages; unsigned long spanned_pages; unsigned long present_pages; - +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + struct page_label zone_label[FREE_AREA_COUNTS]; +#endif const char *name; #ifdef CONFIG_MEMORY_ISOLATION @@ -470,7 +489,11 @@ struct zone { ZONE_PADDING(_pad1_) /* free areas of different sizes */ +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + struct free_area free_area[FREE_AREA_COUNTS][MAX_ORDER]; +#else struct free_area free_area[MAX_ORDER]; +#endif /* zone flags, see below */ unsigned long flags; @@ -665,8 +688,12 @@ typedef struct pglist_data { int node_id; wait_queue_head_t kswapd_wait; wait_queue_head_t pfmemalloc_wait; +#if defined(OPLUS_FEATURE_MULTI_KSWAPD) && defined(CONFIG_OPLUS_MULTI_KSWAPD) + struct task_struct *kswapd[MAX_KSWAPD_THREADS]; +#else struct task_struct *kswapd; /* Protected by mem_hotplug_begin/end() */ +#endif /*OPLUS_FEATURE_MULTI_KSWAPD*/ int kswapd_order; enum zone_type kswapd_classzone_idx; diff --git a/include/linux/msm_drm_notify.h b/include/linux/msm_drm_notify.h index 924ba852c99c..9b497367aaf7 100644 --- a/include/linux/msm_drm_notify.h +++ b/include/linux/msm_drm_notify.h @@ -20,6 +20,15 @@ /* A hardware display blank early change occurred */ #define MSM_DRM_EARLY_EVENT_BLANK 0x02 +//#ifdef VENDOR_EDIT +/* Gou shengjun@PSW.MM.Display.LCD.Feature,2018-10-12 + * add for OnScreenFingerprint +*/ +/* event for onscreenfingerprint scene */ +#define MSM_DRM_ONSCREENFINGERPRINT_EVENT 0x10 +//#endif /* VENDOR_EDIT */ + + enum { /* panel: power on */ MSM_DRM_BLANK_UNBLANK, diff --git a/include/linux/mutex.h b/include/linux/mutex.h index 153274f78402..1f9fb9c051ce 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h @@ -64,6 +64,10 @@ struct mutex { #ifdef CONFIG_DEBUG_LOCK_ALLOC struct lockdep_map dep_map; #endif +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + struct task_struct *ux_dep_task; +#endif /* OPLUS_FEATURE_UIFIRST */ }; static inline struct task_struct *__mutex_owner(struct mutex *lock) @@ -84,6 +88,11 @@ struct mutex_waiter { #endif }; +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst +#include +#endif /* OPLUS_FEATURE_UIFIRST */ + #ifdef CONFIG_DEBUG_MUTEXES #define __DEBUG_MUTEX_INITIALIZER(lockname) \ @@ -121,12 +130,23 @@ do { \ # define __DEP_MAP_MUTEX_INITIALIZER(lockname) #endif +#ifndef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst #define __MUTEX_INITIALIZER(lockname) \ { .owner = ATOMIC_LONG_INIT(0) \ , .wait_lock = __SPIN_LOCK_UNLOCKED(lockname.wait_lock) \ , .wait_list = LIST_HEAD_INIT(lockname.wait_list) \ __DEBUG_MUTEX_INITIALIZER(lockname) \ __DEP_MAP_MUTEX_INITIALIZER(lockname) } +#else /* OPLUS_FEATURE_UIFIRST */ +#define __MUTEX_INITIALIZER(lockname) \ + { .owner = ATOMIC_LONG_INIT(0) \ + , .wait_lock = __SPIN_LOCK_UNLOCKED(lockname.wait_lock) \ + , .wait_list = LIST_HEAD_INIT(lockname.wait_list) \ + , .ux_dep_task = NULL \ + __DEBUG_MUTEX_INITIALIZER(lockname) \ + __DEP_MAP_MUTEX_INITIALIZER(lockname) } +#endif /* OPLUS_FEATURE_UIFIRST */ #define DEFINE_MUTEX(mutexname) \ struct mutex mutexname = __MUTEX_INITIALIZER(mutexname) diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h index bb4fda7317be..8746bc803038 100644 --- a/include/linux/of_reserved_mem.h +++ b/include/linux/of_reserved_mem.h @@ -45,6 +45,10 @@ int early_init_dt_alloc_reserved_memory_arch(phys_addr_t size, void fdt_init_reserved_mem(void); void fdt_reserved_mem_save_node(unsigned long node, const char *uname, phys_addr_t base, phys_addr_t size); +struct reserved_mem *of_reserved_mem_lookup(struct device_node *np); +#ifdef OPLUS_FEATURE_LOWMEM_DBG +unsigned long dt_memory_reserved_pages(void); +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ #else static inline int of_reserved_mem_device_init_by_idx(struct device *dev, struct device_node *np, int idx) @@ -56,6 +60,11 @@ static inline void of_reserved_mem_device_release(struct device *pdev) { } static inline void fdt_init_reserved_mem(void) { } static inline void fdt_reserved_mem_save_node(unsigned long node, const char *uname, phys_addr_t base, phys_addr_t size) { } +#ifdef OPLUS_FEATURE_LOWMEM_DBG +unsigned long dt_memory_reserved_pages(void) { + return 0; +} +#endif /* OPLUS_FEATURE_LOWMEM_DBG */ #endif /** diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h index 56255547bc89..6acf172590f3 100644 --- a/include/linux/pm_wakeup.h +++ b/include/linux/pm_wakeup.h @@ -62,6 +62,10 @@ struct wakeup_source { struct timer_list timer; unsigned long timer_expires; ktime_t total_time; + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY + //Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler + ktime_t total_time_backup; + #endif /*OPLUS_FEATURE_POWERINFO_STANDBY*/ ktime_t max_time; ktime_t last_time; ktime_t start_prevent_time; diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index b8c434c34c8c..7debb266ddbd 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -33,6 +33,19 @@ * space. Unused/unknown fields will not appear in sysfs. */ +/*lizhijie add for temp_compile*/ +/****************************************************/ +#ifndef VENDOR_EDIT +#define VENDOR_EDIT "VENDOR_EDIT" +#endif +/****************************************************/ +/*lizhijie add for temp_compile*/ +/****************************************************/ +#ifndef VENDOR_EDIT +#define VENDOR_EDIT "VENDOR_EDIT" +#endif +/****************************************************/ + enum { POWER_SUPPLY_STATUS_UNKNOWN = 0, POWER_SUPPLY_STATUS_CHARGING, @@ -163,7 +176,30 @@ enum { enum power_supply_property { /* Properties of type `int' */ - POWER_SUPPLY_PROP_STATUS = 0, +//#ifdef VENDOR_EDIT +/* LIZHIJIE@BSP.CHG.Basic, 2020/02/25, LZJ Add for charging */ + POWER_SUPPLY_PROP_CHARGE_TECHNOLOGY = 0, + POWER_SUPPLY_PROP_FAST_CHARGE, + POWER_SUPPLY_PROP_MMI_CHARGING_ENABLE, + POWER_SUPPLY_PROP_OTG_SWITCH, + POWER_SUPPLY_PROP_OTG_ONLINE, + POWER_SUPPLY_PROP_FAST_CHG_TYPE, + POWER_SUPPLY_PROP_BATTERY_FCC, + POWER_SUPPLY_PROP_BATTERY_SOH, + POWER_SUPPLY_PROP_BATTERY_CC, + POWER_SUPPLY_PROP_BATTERY_RM, + POWER_SUPPLY_PROP_BATTERY_SOC, + POWER_SUPPLY_PROP_AUTHENTICATE, + POWER_SUPPLY_PROP_CHARGE_TIMEOUT, + POWER_SUPPLY_PROP_BATTERY_NOTIFY_CODE, + POWER_SUPPLY_PROP_COOL_DOWN, + POWER_SUPPLY_PROP_USB_STATUS, + POWER_SUPPLY_PROP_USBTEMP_VOLT_L, + POWER_SUPPLY_PROP_USBTEMP_VOLT_R, + POWER_SUPPLY_PROP_BATTERY_INFO, + POWER_SUPPLY_PROP_BATTERY_INFO_ID, +//#endif /* VENDOR_EDIT */ + POWER_SUPPLY_PROP_STATUS, POWER_SUPPLY_PROP_CHARGE_TYPE, POWER_SUPPLY_PROP_HEALTH, POWER_SUPPLY_PROP_PRESENT, @@ -294,6 +330,11 @@ enum power_supply_property { POWER_SUPPLY_PROP_PARALLEL_DISABLE, POWER_SUPPLY_PROP_PE_START, POWER_SUPPLY_PROP_SOC_REPORTING_READY, +#ifdef VENDOR_EDIT +/* Ji.Xu PSW.BSP.CHG 2018-07-23 Save battery capacity to persist partition */ + POWER_SUPPLY_PROP_SOC_NOTIFY_READY, + POWER_SUPPLY_PROP_RESTORE_SOC, +#endif /* VENDOR_EDIT */ POWER_SUPPLY_PROP_DEBUG_BATTERY, POWER_SUPPLY_PROP_FCC_DELTA, POWER_SUPPLY_PROP_ICL_REDUCTION, @@ -362,6 +403,51 @@ enum power_supply_property { POWER_SUPPLY_PROP_PARALLEL_OUTPUT_MODE, /* Local extensions of type int64_t */ POWER_SUPPLY_PROP_CHARGE_COUNTER_EXT, +//#ifdef VENDOR_EDIT +/* lizhijie@BSP.CHG.Basic, 2020/02/25, lzj Add for charging */ + POWER_SUPPLY_PROP_ADAPTER_FW_UPDATE, + POWER_SUPPLY_PROP_VOOCCHG_ING, + POWER_SUPPLY_PROP_CHARGERID_VOLT, + POWER_SUPPLY_PROP_SHIP_MODE, + POWER_SUPPLY_PROP_CALL_MODE, +#ifdef CONFIG_OPLUS_CHIP_SOC_NODE + POWER_SUPPLY_PROP_CHIP_SOC, +#endif +#ifdef CONFIG_OPLUS_SMOOTH_SOC + POWER_SUPPLY_PROP_SMOOTH_SOC, + POWER_SUPPLY_PROP_SMOOTH_SWITCH, +#endif +#ifdef CONFIG_OPLUS_SHORT_USERSPACE + POWER_SUPPLY_PROP_SHORT_C_LIMIT_CHG, + POWER_SUPPLY_PROP_SHORT_C_LIMIT_RECHG, +#else + POWER_SUPPLY_PROP_SHORT_C_BATT_UPDATE_CHANGE, + POWER_SUPPLY_PROP_SHORT_C_BATT_IN_IDLE, + POWER_SUPPLY_PROP_SHORT_C_BATT_CV_STATUS, +#endif /*CONFIG_OPPO_SHORT_USERSPACE*/ +//#endif /* VENDOR_EDIT */ +//#ifdef VENDOR_EDIT +//lizhijie@PSW.BSP.CHG, 2020/02/25, Add for hw battery check +#ifdef CONFIG_OPLUS_SHORT_HW_CHECK + POWER_SUPPLY_PROP_SHORT_C_HW_FEATURE, + POWER_SUPPLY_PROP_SHORT_C_HW_STATUS, +#endif +#ifdef CONFIG_OPLUS_SHORT_IC_CHECK + POWER_SUPPLY_PROP_SHORT_C_IC_OTP_STATUS, + POWER_SUPPLY_PROP_SHORT_C_IC_VOLT_THRESH, + POWER_SUPPLY_PROP_SHORT_C_IC_OTP_VALUE, +#endif +#ifdef OPLUS_FEATURE_CHG_BASIC +/* zhouhaikang@BSP.CHG.Basic, 2020/09/09, zhk Add for charging */ + POWER_SUPPLY_PROP_TX_VOLTAGE_NOW, + POWER_SUPPLY_PROP_TX_CURRENT_NOW, + POWER_SUPPLY_PROP_CP_VOLTAGE_NOW, + POWER_SUPPLY_PROP_CP_CURRENT_NOW, + POWER_SUPPLY_PROP_WIRELESS_MODE, + POWER_SUPPLY_PROP_WIRELESS_TYPE, + POWER_SUPPLY_PROP_CEP_INFO, +#endif +//#endif /*VENDOR_EDIT*/ /* Properties of type `const char *' */ POWER_SUPPLY_PROP_MODEL_NAME, POWER_SUPPLY_PROP_MANUFACTURER, diff --git a/include/linux/pstore.h b/include/linux/pstore.h index 70913ec87785..d39ae3bc916f 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h @@ -30,6 +30,11 @@ #include #include +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info +#include +#endif /* OPLUS_FEATURE_DUMPDEVICE */ + struct module; /* pstore record types (see fs/pstore/inode.c for filename templates) */ @@ -44,6 +49,10 @@ enum pstore_type_id { PSTORE_TYPE_PPC_COMMON = 6, PSTORE_TYPE_PMSG = 7, PSTORE_TYPE_PPC_OPAL = 8, +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info + PSTORE_TYPE_DEVICE_INFO = 9, +#endif /* OPLUS_FEATURE_DUMPDEVICE */ PSTORE_TYPE_UNKNOWN = 255 }; @@ -276,4 +285,37 @@ pstore_ftrace_write_timestamp(struct pstore_ftrace_record *rec, u64 val) } #endif +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info +/*move from ram.c*/ +struct ramoops_context { + struct persistent_ram_zone **dprzs; /* Oops dump zones */ + struct persistent_ram_zone *cprz; /* Console zone */ + struct persistent_ram_zone **fprzs; /* Ftrace zones */ + struct persistent_ram_zone *mprz; /* PMSG zone */ + struct persistent_ram_zone *dprz; + phys_addr_t phys_addr; + unsigned long size; + unsigned int memtype; + size_t record_size; + size_t console_size; + size_t ftrace_size; + size_t pmsg_size; + size_t device_info_size; + int dump_oops; + u32 flags; + struct persistent_ram_ecc_info ecc_info; + unsigned int max_dump_cnt; + unsigned int dump_write_cnt; + /* _read_cnt need clear on ramoops_pstore_open */ + unsigned int dump_read_cnt; + unsigned int console_read_cnt; + unsigned int max_ftrace_cnt; + unsigned int ftrace_read_cnt; + unsigned int pmsg_read_cnt; + unsigned int device_info_read_cnt; + struct pstore_info pstore; +}; +#endif /* OPLUS_FEATURE_DUMPDEVICE */ + #endif /*_LINUX_PSTORE_H*/ diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h index 10fe2e28701f..268ff2d14658 100644 --- a/include/linux/pstore_ram.h +++ b/include/linux/pstore_ram.h @@ -98,6 +98,10 @@ struct ramoops_platform_data { unsigned long console_size; unsigned long ftrace_size; unsigned long pmsg_size; +#ifdef OPLUS_FEATURE_DUMPDEVICE +//zhangzongyu@BSP.Kernel.Stability, 2020/05/10, Add for dump device info + unsigned long device_info_size; +#endif /* OPLUS_FEATURE_DUMPDEVICE */ int dump_oops; u32 flags; struct persistent_ram_ecc_info ecc_info; diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h index 8ddf79e9207a..4fcfde4eef0f 100644 --- a/include/linux/ratelimit.h +++ b/include/linux/ratelimit.h @@ -6,8 +6,8 @@ #include #include -#define DEFAULT_RATELIMIT_INTERVAL (5 * HZ) -#define DEFAULT_RATELIMIT_BURST 10 +#define DEFAULT_RATELIMIT_INTERVAL (0 * HZ) +#define DEFAULT_RATELIMIT_BURST 20000 /* issue num suppressed message on exit */ #define RATELIMIT_MSG_ON_RELEASE BIT(0) diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 7268a54b8956..7089bd3884eb 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -14,8 +14,13 @@ extern int isolate_lru_page(struct page *page); extern void putback_lru_page(struct page *page); +#if defined(OPLUS_FEATURE_PROCESS_RECLAIM) && defined(CONFIG_PROCESS_RECLAIM_ENHANCE) extern unsigned long reclaim_pages_from_list(struct list_head *page_list, - struct vm_area_struct *vma); + struct vm_area_struct *vma, struct mm_walk *walk); +#else +extern unsigned long reclaim_pages_from_list(struct list_head *page_list, + struct vm_area_struct *vma); +#endif /* * The anon_vma heads a list of private "related" vmas, to scan if diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h index fa3291f9b38a..c9fb772716ee 100644 --- a/include/linux/rwsem.h +++ b/include/linux/rwsem.h @@ -46,6 +46,10 @@ struct rw_semaphore { /* count for waiters preempt to queue in wait list */ long m_count; #endif +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + struct task_struct *ux_dep_task; +#endif /* OPLUS_FEATURE_UIFIRST */ }; /* @@ -61,6 +65,11 @@ extern struct rw_semaphore *rwsem_down_write_failed_killable(struct rw_semaphore extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *); extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst +#include +#endif /* OPLUS_FEATURE_UIFIRST */ + /* Include the arch specific part */ #include @@ -82,7 +91,12 @@ static inline int rwsem_is_locked(struct rw_semaphore *sem) #endif #ifdef CONFIG_RWSEM_SPIN_ON_OWNER +#ifndef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst #define __RWSEM_OPT_INIT(lockname) , .osq = OSQ_LOCK_UNLOCKED, .owner = NULL +#else /* OPLUS_FEATURE_UIFIRST */ +#define __RWSEM_OPT_INIT(lockname) , .osq = OSQ_LOCK_UNLOCKED, .owner = NULL, .ux_dep_task = NULL +#endif /* OPLUS_FEATURE_UIFIRST */ #else #define __RWSEM_OPT_INIT(lockname) #endif diff --git a/include/linux/sched.h b/include/linux/sched.h index 0e460d26a8cd..757d954fa4a4 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -28,6 +28,13 @@ #include #include +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO +#include +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ + /* task_struct member predeclarations (sorted alphabetically): */ struct audit_context; struct backing_dev_info; @@ -203,6 +210,24 @@ struct task_group; #endif +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst +extern int sysctl_uifirst_enabled; +extern int sysctl_launcher_boost_enabled; +#endif /* OPLUS_FEATURE_UIFIRST */ +#ifdef OPLUS_FEATURE_UIFIRST +// Liujie.Xie@TECH.Kernel.Sched, 2020/02/26, add for heavy load task +extern int sysctl_cpu_multi_thread; +#endif +#ifdef OPLUS_FEATURE_UIFIRST +// XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/06/23, Add for UIFirst(sldie boost) +extern int sysctl_slide_boost_enabled; +extern int sysctl_boost_task_threshold; +#ifdef CONFIG_CAMERA_OPT +extern int sysctl_camera_opt_enabled; +#endif +#endif /* OPLUS_FEATURE_UIFIRST */ + /* Task command name length: */ #define TASK_COMM_LEN 16 @@ -732,6 +757,13 @@ struct wake_q_node { struct wake_q_node *next; }; +#if defined(OPLUS_FEATURE_PROCESS_RECLAIM) && defined(CONFIG_PROCESS_RECLAIM_ENHANCE) +union reclaim_limit { + unsigned long stop_jiffies; + unsigned long stop_scan_addr; +}; +#endif + struct task_struct { #ifdef CONFIG_THREAD_INFO_IN_TASK /* @@ -1013,6 +1045,7 @@ struct task_struct { #ifdef CONFIG_DETECT_HUNG_TASK /* hung task detection */ unsigned long last_switch_count; + unsigned long last_switch_time; bool hang_detection_enabled; #endif /* Filesystem information: */ @@ -1330,6 +1363,9 @@ struct task_struct { unsigned int memcg_nr_pages_over_high; #endif +#if defined(OPLUS_FEATURE_PROCESS_RECLAIM) && defined(CONFIG_PROCESS_RECLAIM_ENHANCE) + union reclaim_limit reclaim; +#endif #ifdef CONFIG_UPROBES struct uprobe_task *utask; #endif @@ -1358,6 +1394,31 @@ struct task_struct { /* Used by LSM modules for access restriction: */ void *security; #endif +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + int static_ux; + atomic64_t dynamic_ux; + struct list_head ux_entry; + int ux_depth; + u64 enqueue_time; + u64 dynamic_ux_start; +#ifdef CONFIG_CAMERA_OPT + int camera_opt; +#endif +#endif /* OPLUS_FEATURE_UIFIRST */ +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + int jank_trace; + struct oppo_jank_monitor_info oppo_jank_info; + unsigned in_mutex:1; + unsigned in_downread:1; + unsigned in_downwrite:1; + unsigned in_futex:1; + unsigned in_binder:1; + unsigned in_epoll:1; +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ /* * New fields for task_struct should be added above here, so that @@ -1582,6 +1643,11 @@ extern struct pid *cad_pid; #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ #define PF_SUSPEND_TASK 0x80000000 /* This thread called freeze_processes() and should not be frozen */ +#if defined(OPLUS_FEATURE_PROCESS_RECLAIM) && defined(CONFIG_PROCESS_RECLAIM_ENHANCE) +#define PF_RECLAIM_SHRINK 0x02000000 /* Flag the task is memory compresser */ + +#define current_is_reclaimer() (current->flags & PF_RECLAIM_SHRINK) +#endif /* * Only the _current_ task can read/write to tsk->flags, but other @@ -1782,12 +1848,16 @@ extern void kick_process(struct task_struct *tsk); #else static inline void kick_process(struct task_struct *tsk) { } #endif - +#ifdef CONFIG_CAMERA_OPT +extern void set_camera_opt(struct task_struct *tsk); +#endif extern void __set_task_comm(struct task_struct *tsk, const char *from, bool exec); - static inline void set_task_comm(struct task_struct *tsk, const char *from) { __set_task_comm(tsk, from, false); +#ifdef CONFIG_CAMERA_OPT + set_camera_opt(tsk); +#endif } extern char *__get_task_comm(char *to, size_t len, struct task_struct *tsk); diff --git a/include/linux/sched/cpufreq.h b/include/linux/sched/cpufreq.h index e0234142b2f2..941e2066a794 100644 --- a/include/linux/sched/cpufreq.h +++ b/include/linux/sched/cpufreq.h @@ -20,6 +20,12 @@ #define SCHED_CPUFREQ_RT_DL (SCHED_CPUFREQ_RT | SCHED_CPUFREQ_DL) +#ifdef OPLUS_FEATURE_UIFIRST +// XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/08/18, Add for UIFirst(slide boost) +#define SCHED_CPUFREQ_RESET (1U << 7) +#define SCHED_CPUFREQ_BOOST (1U << 9) +#endif /* OPLUS_FEATURE_UIFIRST */ + #ifdef CONFIG_CPU_FREQ struct update_util_data { void (*func)(struct update_util_data *data, u64 time, unsigned int flags); diff --git a/include/linux/security.h b/include/linux/security.h index 666c75c2269c..4ed667faf778 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -1838,5 +1838,14 @@ static inline int security_perf_event_write(struct perf_event *event) } #endif /* CONFIG_SECURITY */ #endif /* CONFIG_PERF_EVENTS */ - +#ifdef CONFIG_OPLUS_SECURE_GUARD +#ifdef CONFIG_SECURITY +extern int get_current_security_context(char **context, u32 *context_len); +#else +static inline int get_current_security_context(char **context, u32 *context_len) +{ + return -EOPNOTSUPP; +} +#endif +#endif /* CONFIG_OPLUS_SECURE_GUARD */ #endif /* ! __LINUX_SECURITY_H */ diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 9578eb274918..c019f342d094 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -40,6 +40,11 @@ #include #include #include +#ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED +//HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function +#include +#endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + /* The interface for checksum offload between the stack and networking drivers * is as follows... @@ -693,6 +698,10 @@ struct sk_buff { * first. This is owned by whoever has the skb queued ATM. */ char cb[48] __aligned(8); + #ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED + //HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function + void *cb_next; + #endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ unsigned long _skb_refdst; void (*destructor)(struct sk_buff *skb); @@ -702,6 +711,11 @@ struct sk_buff { #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) unsigned long _nfct; #endif + #ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED + //HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function + struct nf_queue_entry *nf_queue_entry; + #endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) struct nf_bridge_info *nf_bridge; #endif @@ -782,6 +796,12 @@ struct sk_buff { #ifdef CONFIG_NET_SWITCHDEV __u8 offload_fwd_mark:1; #endif + + #ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED + //HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function + __u8 imq_flags:IMQ_F_BITS; + #endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + #ifdef CONFIG_NET_CLS_ACT __u8 tc_skip_classify:1; __u8 tc_at_ingress:1; @@ -970,6 +990,13 @@ void skb_tx_error(struct sk_buff *skb); void consume_skb(struct sk_buff *skb); void __consume_stateless_skb(struct sk_buff *skb); void __kfree_skb(struct sk_buff *skb); + +#ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED +//HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function +int skb_save_cb(struct sk_buff *skb); +int skb_restore_cb(struct sk_buff *skb); +#endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + extern struct kmem_cache *skbuff_head_cache; void kfree_skb_partial(struct sk_buff *skb, bool head_stolen); @@ -3853,6 +3880,13 @@ static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src, dst->_nfct = src->_nfct; nf_conntrack_get(skb_nfct(src)); #endif + + #ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED + //HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function + dst->imq_flags = src->imq_flags; + dst->nf_queue_entry = src->nf_queue_entry; + #endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) dst->nf_bridge = src->nf_bridge; nf_bridge_get(src->nf_bridge); diff --git a/include/linux/soc/qcom/smem.h b/include/linux/soc/qcom/smem.h index 3621c2ae2748..93f6435986bd 100644 --- a/include/linux/soc/qcom/smem.h +++ b/include/linux/soc/qcom/smem.h @@ -12,4 +12,15 @@ void *qcom_smem_get(unsigned host, unsigned item, size_t *size); int qcom_smem_get_free_space(unsigned host); phys_addr_t qcom_smem_virt_to_phys(void *addr); +//Yong.Qian@bsp.kernel.stability, 2020/5/14, Add for dump reason +#ifdef OPLUS_FEATURE_AGINGTEST +#define DUMP_REASON_SIZE 256 + +struct dump_info{ + char dump_reason[DUMP_REASON_SIZE]; //dump reason +}; + +char *parse_function_builtin_return_address(unsigned long function_address); +void save_dump_reason_to_smem(char *reason, char *function_name); +#endif /*OPLUS_FEATURE_AGINGTEST*/ #endif diff --git a/include/linux/swap.h b/include/linux/swap.h index 7b46981941b2..98e56d1994c3 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -14,6 +14,11 @@ #include #include +#if defined(CONFIG_NANDSWAP) +#include <../drivers/soc/oplus/oplus_nandswap/nandswap.h> +#define SWAP_NANDSWAP_PRIO 2020 /* just a magic number */ +#endif + struct notifier_block; struct bio; @@ -173,7 +178,12 @@ enum { SWP_STABLE_WRITES = (1 << 10), /* no overwrite PG_writeback pages */ SWP_SYNCHRONOUS_IO = (1 << 11), /* synchronous IO is efficient */ /* add others here before... */ +#if defined(CONFIG_NANDSWAP) + SWP_NANDSWAP = (1 << 12), /* mark the device used for nandswap */ + SWP_SCANNING = (1 << 13), /* refcount in scan_swap_map */ +#else SWP_SCANNING = (1 << 12), /* refcount in scan_swap_map */ +#endif }; #define SWAP_CLUSTER_MAX 32UL diff --git a/include/linux/task_io_accounting_ops.h b/include/linux/task_io_accounting_ops.h index 733ab62ae141..4f52ae4329bf 100644 --- a/include/linux/task_io_accounting_ops.h +++ b/include/linux/task_io_accounting_ops.h @@ -6,11 +6,17 @@ #define __TASK_IO_ACCOUNTING_OPS_INCLUDED #include +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) +#include +#endif /*OPLUS_FEATURE_IOMONITOR*/ #ifdef CONFIG_TASK_IO_ACCOUNTING static inline void task_io_account_read(size_t bytes) { current->ioac.read_bytes += bytes; +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + iomonitor_record_task_io(current, bytes, false); +#endif /*OPLUS_FEATURE_IOMONITOR*/ } /* @@ -25,6 +31,10 @@ static inline unsigned long task_io_get_inblock(const struct task_struct *p) static inline void task_io_account_write(size_t bytes) { current->ioac.write_bytes += bytes; +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + iomonitor_record_task_io(current, bytes, true); +#endif /*OPLUS_FEATURE_IOMONITOR*/ + } /* diff --git a/include/linux/wait.h b/include/linux/wait.h index 158715445ffb..71ce91bdfdf0 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -240,7 +240,6 @@ extern void init_wait_entry(struct wait_queue_entry *wq_entry, int flags); * on purpose; we use long where we can return timeout values and int * otherwise. */ - #define ___wait_event(wq_head, condition, state, exclusive, ret, cmd) \ ({ \ __label__ __out; \ diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 1c527abb1ae5..912a68175e67 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -17,6 +17,11 @@ struct workqueue_struct; struct work_struct; +#ifdef OPLUS_FEATURE_UIFIRST +// caichen@TECH.Kernel.Sched, 2020/06/25, add for uifirst +#include +#endif + typedef void (*work_func_t)(struct work_struct *work); void delayed_work_timer_fn(unsigned long __data); @@ -105,6 +110,10 @@ struct work_struct { #ifdef CONFIG_LOCKDEP struct lockdep_map lockdep_map; #endif +#ifdef OPLUS_FEATURE_UIFIRST +// caichen@TECH.Kernel.Sched, 2020/05/28, add for uifirst wq + int ux_work; +#endif }; #define WORK_DATA_INIT() ATOMIC_LONG_INIT((unsigned long)WORK_STRUCT_NO_POOL) @@ -199,7 +208,12 @@ static inline unsigned int work_static(struct work_struct *work) return *work_data_bits(work) & WORK_STRUCT_STATIC; } #else -static inline void __init_work(struct work_struct *work, int onstack) { } +static inline void __init_work(struct work_struct *work, int onstack) { +#ifdef OPLUS_FEATURE_UIFIRST +// caichen@TECH.Kernel.Sched, 2020/05/28, add for uifirst wq + work->ux_work = 0; +#endif +} static inline void destroy_work_on_stack(struct work_struct *work) { } static inline void destroy_delayed_work_on_stack(struct delayed_work *work) { } static inline unsigned int work_static(struct work_struct *work) { return 0; } diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 1a587cdbfb20..911873a636c3 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h @@ -29,6 +29,7 @@ #include #define SIP_LIST_ELEMENTS 2 +#define OPLUS_FEATURE_WIFI_LUCKYMONEY struct sip_length { int msg_length[SIP_LIST_ELEMENTS]; @@ -94,7 +95,27 @@ struct nf_conn { struct hlist_node nat_bysource; #endif /* all members below initialized via memset */ - struct { } __nfct_init_offset; + u8 __nfct_init_offset[0]; + //#ifdef OPLUS_FEATURE_WIFI_SLA + //HuangJunyuan@CONNECTIVITY.WIFI.INTERNET.1197891, 2018/04/10,Add code for appo sla function + u32 oplus_game_skb_len; + u32 oplus_game_detect_status; + u32 oplus_game_time_interval; + u32 oplus_game_up_count; + u32 oplus_game_down_count; + u32 oplus_game_lost_count; + u32 oplus_game_same_count; + u32 oplus_http_flag; + u32 oplus_skb_count; + int oplus_app_type; + s64 oplus_game_timestamp; + s64 oplus_game_last_timestamp; + //#endif /* OPLUS_FEATURE_WIFI_SLA */ + +#ifdef OPLUS_FEATURE_WIFI_LUCKYMONEY + //HuangYuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/18, Add for WeChat lucky money recognition + u32 oplus_app_uid; + #endif /* OPLUS_FEATURE_WIFI_LUCKYMONEY */ /* If we were expected by an expectation, this will be it */ struct nf_conn *master; diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h index 814058d0f167..f77b5a0157f1 100644 --- a/include/net/netfilter/nf_queue.h +++ b/include/net/netfilter/nf_queue.h @@ -32,6 +32,12 @@ void nf_register_queue_handler(struct net *net, const struct nf_queue_handler *q void nf_unregister_queue_handler(struct net *net); void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); +#ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED +//HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function +void nf_register_queue_imq_handler(const struct nf_queue_handler *qh); +void nf_unregister_queue_imq_handler(void); +#endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + void nf_queue_entry_get_refs(struct nf_queue_entry *entry); void nf_queue_entry_release_refs(struct nf_queue_entry *entry); diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index fefc0b715827..bd2b06a6e527 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h @@ -132,6 +132,11 @@ struct netns_ipv4 { struct inet_timewait_death_row tcp_death_row; int sysctl_max_syn_backlog; + #ifdef OPLUS_BUG_STABILITY + //PengHao@CONNECTIVITY.WIFI.INTERNET.1854960,2019/03/30,add for disable tcp random timestamp,some networks limit tcp syn before login + int sysctl_tcp_random_timestamp; + #endif /* OPLUS_BUG_STABILITY */ + #ifdef CONFIG_NET_L3_MASTER_DEV int sysctl_udp_l3mdev_accept; #endif diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index de557a527da9..ee34959d49bd 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -109,6 +109,11 @@ int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q, void __qdisc_run(struct Qdisc *q); +#ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED +//HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function +struct sk_buff *qdisc_dequeue_skb(struct Qdisc *q, bool *validate); +#endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + static inline void qdisc_run(struct Qdisc *q) { if (qdisc_run_begin(q)) diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 37876d842f2e..79652f062885 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -571,6 +571,16 @@ static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch, return sch->enqueue(skb, sch, to_free); } +#ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED +//HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function +static inline int qdisc_enqueue_root(struct sk_buff *skb, struct Qdisc *sch, + struct sk_buff **to_free) +{ + qdisc_skb_cb(skb)->pkt_len = skb->len; + return qdisc_enqueue(skb, sch, to_free) & NET_XMIT_MASK; +} +#endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + static inline bool qdisc_is_percpu_stats(const struct Qdisc *q) { return q->flags & TCQ_F_CPUSTATS; diff --git a/include/net/sock.h b/include/net/sock.h index ebf247618722..3b56f5fc1780 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -185,6 +185,20 @@ struct sock_common { struct proto *skc_prot; possible_net_t skc_net; + //#ifdef OPLUS_FEATURE_WIFI_SLA + //HuangJunyuan@CONNECTIVITY.WIFI.INTERNET.1197891, 2018/04/10,Add code for appo sla function + u32 skc_oplus_mark; + //#endif /* OPLUS_FEATURE_WIFI_SLA */ + +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.211400, 2020/06/01 + *Add for classify glink wakeup services + */ + u32 skc_oplus_pid; + u64 skc_oplus_last_rcv_stamp[2];//index 0 = last, index 1 = now + u64 skc_oplus_last_send_stamp[2];//index 0 = last, index 1 = now +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ #if IS_ENABLED(CONFIG_IPV6) struct in6_addr skc_v6_daddr; struct in6_addr skc_v6_rcv_saddr; @@ -352,6 +366,20 @@ struct sock { #define sk_flags __sk_common.skc_flags #define sk_rxhash __sk_common.skc_rxhash +//#ifdef OPLUS_FEATURE_WIFI_SLA +//HuangJunyuan@CONNECTIVITY.WIFI.INTERNET.1197891, 2018/04/10,Add code for appo sla function +#define oplus_sla_mark __sk_common.skc_oplus_mark +//#endif /* OPLUS_FEATURE_WIFI_SLA */ +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER +/* +*Ruansong@PSW.NW.DATA.211400, 2020/06/01 +*Add for classify glink wakeup services +*/ +#define oplus_last_rcv_stamp __sk_common.skc_oplus_last_rcv_stamp +#define oplus_last_send_stamp __sk_common.skc_oplus_last_send_stamp +#define sk_oplus_pid __sk_common.skc_oplus_pid +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ + socket_lock_t sk_lock; atomic_t sk_drops; int sk_rcvlowat; @@ -1835,6 +1863,12 @@ static inline void sk_dst_confirm(struct sock *sk) static inline void sock_confirm_neigh(struct sk_buff *skb, struct neighbour *n) { + #ifdef OPLUS_BUG_STABILITY + //WangWei@CONNECTIVITY.WIFI.NETWORK.1357567, 2018/04/27. + //Remove for [1357567],some AP doesn't send arp when it needs to send data to DUT + //We remove this code to send arp more frequently to notify our mac to AP + return; + #endif /* OPLUS_BUG_STABILITY */ if (skb_get_dst_pending_confirm(skb)) { struct sock *sk = skb->sk; unsigned long now = jiffies; diff --git a/include/net/tcp.h b/include/net/tcp.h index ea72414ab52e..8627c09f021d 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -290,6 +290,11 @@ extern int sysctl_tcp_use_userconfig; extern struct percpu_counter tcp_sockets_allocated; extern unsigned long tcp_memory_pressure; +#ifdef OPLUS_BUG_STABILITY +//ZhaoMengqing@CONNECTIVITY.WIFI.INTERNET.1394484, 2019/04/02,add for: When find TCP SYN-ACK Timestamp value error, just do not use Timestamp +extern int sysctl_tcp_ts_control[2]; +#endif /* OPLUS_BUG_STABILITY */ + /* optimized version of sk_under_memory_pressure() for TCP sockets */ static inline bool tcp_under_memory_pressure(const struct sock *sk) { diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 203fec0bd88c..8dff09d7cfc6 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -666,6 +666,9 @@ struct Scsi_Host { /* The controller does not support WRITE SAME */ unsigned no_write_same:1; + /* Inline encryption support? */ + unsigned inlinecrypt_support:1; + unsigned use_blk_mq:1; unsigned use_cmd_list:1; diff --git a/include/soc/qcom/boot_stats.h b/include/soc/qcom/boot_stats.h index f3a70e8a3b83..649d371cb036 100644 --- a/include/soc/qcom/boot_stats.h +++ b/include/soc/qcom/boot_stats.h @@ -49,7 +49,11 @@ static inline void update_marker(const char *name) { }; static inline int boot_marker_enabled(void) { return 0; } static inline void measure_wake_up_time(void) { }; #endif -#ifdef CONFIG_QTI_RPM_STATS_LOG + + +#ifdef OPLUS_FEATURE_POWERINFO_RPMH +/*#Nanwei.Deng@BSP.POWER.Basic 2010/10/15 for rpm debug */ +/*#ifdef CONFIG_QTI_RPM_STATS_LOG */ uint64_t get_sleep_exit_time(void); #else static inline uint64_t get_sleep_exit_time(void) { return 0; } diff --git a/include/soc/qcom/ramdump.h b/include/soc/qcom/ramdump.h index 4e23ccf269a7..8a8e9bbba6a3 100644 --- a/include/soc/qcom/ramdump.h +++ b/include/soc/qcom/ramdump.h @@ -22,6 +22,10 @@ struct ramdump_segment { unsigned long size; }; +#ifdef OPLUS_FEATURE_MODEM_MINIDUMP +//MaiWentian@NETWORK.RF,1213568, 2018/01/05,Add for customized subsystem ramdump to skip generate dump cause by SAU +extern bool SKIP_GENERATE_RAMDUMP; +#endif #ifdef CONFIG_MSM_SUBSYSTEM_RESTART extern void *create_ramdump_device(const char *dev_name, struct device *parent); extern void destroy_ramdump_device(void *dev); diff --git a/include/soc/qcom/subsystem_restart.h b/include/soc/qcom/subsystem_restart.h index ac7a0c90a22f..e77d5435b3cd 100644 --- a/include/soc/qcom/subsystem_restart.h +++ b/include/soc/qcom/subsystem_restart.h @@ -152,6 +152,12 @@ struct notif_data { #if defined(CONFIG_MSM_SUBSYSTEM_RESTART) +#ifdef OPLUS_FEATURE_ADSP_RECOVERY +/*Suresh.Alla@MULTIMEDIA.AUDIODRIVER.ADSP.2434874, 2020/08/14, Add for workaround fix adsp stuck issue*/ +extern void oplus_set_ssr_state(bool ssr_state); +extern bool oplus_get_ssr_state(void); +#endif /* OPLUS_FEATURE_ADSP_RECOVERY */ + extern int subsys_get_restart_level(struct subsys_device *dev); extern int subsystem_restart_dev(struct subsys_device *dev); extern int subsystem_restart(const char *name); @@ -177,6 +183,15 @@ struct subsys_device *find_subsys_device(const char *str); extern int wait_for_shutdown_ack(struct subsys_desc *desc); #else +#ifdef OPLUS_FEATURE_ADSP_RECOVERY +/*Suresh.Alla@MULTIMEDIA.AUDIODRIVER.ADSP.2434874, 2020/08/14,Add for workaround fix adsp stuck issue*/ +static inline void oplus_set_ssr_state(bool ssr_state) {} +static inline bool oplus_get_ssr_state(void) +{ + return false; +} +#endif /* OPLUS_FEATURE_ADSP_RECOVERY */ + static inline int subsys_get_restart_level(struct subsys_device *dev) { return 0; diff --git a/include/trace/events/block.h b/include/trace/events/block.h index 81b43f5bdf23..592663614fbf 100644 --- a/include/trace/events/block.h +++ b/include/trace/events/block.h @@ -145,6 +145,66 @@ TRACE_EVENT(block_rq_complete, __entry->nr_sector, __entry->error) ); +/*Hank.liu@PSW.BSP Kernel IO Latency 2019-03-19,block io time trace to collect a request information*/ +#if defined(VENDOR_EDIT) && defined(CONFIG_OPPO_HEALTHINFO) +/** +* block_time - trace block io latency during send request to complete request +* @q: queue containing the block operation request +* @rq: block operations request +* @delta_us: block io latency +* @nr_bytes: number of completed bytes +* +* The block_time tracepoint event can collect each request information. +* it include uid,sector,nr_sector,bytes,errors,delta_us,flash_io_latency,tag,now time, +* rwbs,cmd and so on. +*/ +TRACE_EVENT(block_time, + + TP_PROTO(struct request_queue *q, struct request *rq, + u64 delta_us,unsigned int nr_bytes), + + TP_ARGS(q, rq, delta_us, nr_bytes), + + TP_STRUCT__entry( + __field( dev_t, dev ) + __field( u32, current_uid ) + __field( sector_t, sector ) + __field( unsigned int, nr_sector ) + __field( unsigned int, bytes ) + __field( u64, delta_us ) + __field( u64, flash_io_latency) + __field( int, tag ) + __field( u64, now ) + __array( char, rwbs, RWBS_LEN ) + __dynamic_array( char, cmd, 1 ) + ), + + TP_fast_assign( + __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; + __entry->current_uid = from_kuid_munged(current_user_ns(),current_uid()); + __entry->sector = blk_rq_trace_sector(rq); + __entry->nr_sector = blk_rq_trace_nr_sectors(rq); + __entry->bytes = blk_rq_bytes(rq); + __entry->delta_us = delta_us; + __entry->flash_io_latency = rq->flash_io_latency; + __entry->tag = rq->tag; + __entry->now = ktime_to_us(ktime_get()); + + blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq)); + __get_str(cmd)[0] = '\0'; + ), + + TP_printk("%d,%d,%d,%llu,%llu,%d,%llu,%s,(%s),%llu,%u,%u", + MAJOR(__entry->dev), MINOR(__entry->dev), + __entry->current_uid,__entry->flash_io_latency , + __entry->delta_us,__entry->tag, + __entry->now,__entry->rwbs, __get_str(cmd), + (unsigned long long)__entry->sector, + __entry->nr_sector,__entry->bytes) +); + +#endif /*VENDOR_EDIT*/ + DECLARE_EVENT_CLASS(block_rq, TP_PROTO(struct request_queue *q, struct request *rq), diff --git a/include/uapi/asm-generic/mman-common.h b/include/uapi/asm-generic/mman-common.h index 6d319c46fd90..62542397bf2c 100644 --- a/include/uapi/asm-generic/mman-common.h +++ b/include/uapi/asm-generic/mman-common.h @@ -25,6 +25,9 @@ #else # define MAP_UNINITIALIZED 0x0 /* Don't support this flag */ #endif +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) +#define MAP_BACKUP_CREATE 0x10000000 /* created backup vmap area */ +#endif /* * Flags for mlock diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h index 8fb4d4259e9e..9a8f7fba470f 100644 --- a/include/uapi/linux/fuse.h +++ b/include/uapi/linux/fuse.h @@ -269,7 +269,10 @@ struct fuse_file_lock { #define FUSE_PARALLEL_DIROPS (1 << 18) #define FUSE_HANDLE_KILLPRIV (1 << 19) #define FUSE_POSIX_ACL (1 << 20) - +#ifdef VENDOR_EDIT +//shubin@BSP.Kernel.FS 2020/08/20 improving fuse storage performance +#define FUSE_SHORTCIRCUIT (1 << 30) +#endif /* VENDOR_EDIT */ /** * CUSE INIT request/reply flags * diff --git a/include/uapi/linux/netfilter.h b/include/uapi/linux/netfilter.h index cca10e767cd8..43f3dfabb5ab 100644 --- a/include/uapi/linux/netfilter.h +++ b/include/uapi/linux/netfilter.h @@ -14,7 +14,14 @@ #define NF_QUEUE 3 #define NF_REPEAT 4 #define NF_STOP 5 /* Deprecated, for userspace nf_queue compatibility. */ + +#ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED +//HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function +#define NF_IMQ_QUEUE 6 +#define NF_MAX_VERDICT NF_IMQ_QUEUE +#else /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ #define NF_MAX_VERDICT NF_STOP +#endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ /* we overload the higher bits for encoding auxiliary data such as the queue * number or errno values. Not nice, but better than additional function diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h index 5fa3fcc10128..10002c6443fb 100644 --- a/include/uapi/linux/netlink.h +++ b/include/uapi/linux/netlink.h @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _UAPI__LINUX_NETLINK_H #define _UAPI__LINUX_NETLINK_H +#define OPLUS_FEATURE_WIFI_LUCKYMONEY #include #include /* for __kernel_sa_family_t */ @@ -32,7 +33,39 @@ #define NETLINK_SOCKEV 23 /* Socket Administrative Events */ #define NETLINK_INET_DIAG NETLINK_SOCK_DIAG -#define MAX_LINKS 32 +#ifdef OPLUS_FEATURE_WIFI_LUCKYMONEY +//HuangYuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/18, Add for WeChat lucky money recognition +#define NETLINK_OPLUS_NF_HOOKS 32 +#endif /* OPLUS_FEATURE_WIFI_LUCKYMONEY */ + +#ifdef OPLUS_FEATURE_HANS_FREEZE +//#Kun.Zhou@ANDROID.RESCONTROL, 2019/09/23, add for hans freeze manager +#define NETLINK_OPPO_HANS 28 /* Socket for freezing solution*/ +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ +//#ifdef OPLUS_FEATURE_WIFI_SLA +//HuangJunyuan@CONNECTIVITY.WIFI.INTERNET.1197891, 2018/04/10,Add code for appo sla function +#define NETLINK_OPLUS_SLA 33 /*SLA NETLINK SOCK*/ +//#endif /* OPLUS_FEATURE_WIFI_SLA */ + +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER +/* +*Ruansong@PSW.NW.DATA.212300, 2020/06/01 +*Add for classify glink wakeup services and count IPA wakeup +*/ +#define NETLINK_OPLUS_NWPOWERSTATE 36 /*OPLUS NW PowerState*/ +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ + +//#ifdef OPLUS_FEATURE_DHCP +//LianGenglin@CONNECTIVITY.WIFI.INTERNET, 2020/05/09, Add for Dhcp conflict +#define NETLINK_OPLUS_DHCP 38 +//#endif /* OPLUS_FEATURE_DHCP */ + +/*#Zhao.Pan@MULTIMEDIA.AUDIODRIVER.FEATURE.FEEDBACK, 2020.10.28, add for multimedia kevent*/ +/* #define OPLUS_NETLINK_MM_KEVENT 41 (defined in oplus_mm_kevent.h file) */ + +//#define MAX_LINKS 40 +#define MAX_LINKS 42 +//#endif /* OPLUS_FEATURE_WIFI_CAPCENTER */ struct sockaddr_nl { __kernel_sa_family_t nl_family; /* AF_NETLINK */ diff --git a/include/uapi/media/cam_defs.h b/include/uapi/media/cam_defs.h index 0fa3777ee7a5..8b4461edf814 100644 --- a/include/uapi/media/cam_defs.h +++ b/include/uapi/media/cam_defs.h @@ -16,7 +16,27 @@ #define CAM_RELEASE_DEV (CAM_COMMON_OPCODE_BASE + 0x6) #define CAM_SD_SHUTDOWN (CAM_COMMON_OPCODE_BASE + 0x7) #define CAM_FLUSH_REQ (CAM_COMMON_OPCODE_BASE + 0x8) +#ifndef VENDOR_EDIT +/*Modified by Zhengrong.Zhang@Cam.Drv, 20180421, for [ois calibration]*/ #define CAM_COMMON_OPCODE_MAX (CAM_COMMON_OPCODE_BASE + 0x9) +#else +#define CAM_GET_FUSE_ID (CAM_COMMON_OPCODE_BASE + 0x9) +#define CAM_GET_OIS_GYRO_OFFSET (CAM_COMMON_OPCODE_BASE + 0xA) +#define CAM_GET_OIS_HALL_POSITION (CAM_COMMON_OPCODE_BASE + 0xB) +/*added by hongbo.dai@Cam.Drv, 20180501, for [Cam ois ]*/ +#define CAM_OIS_GYRO_OFFSET_CALIBRATION (CAM_COMMON_OPCODE_BASE + 0xC) +#define CAM_GET_OIS_EIS_HALL (CAM_COMMON_OPCODE_BASE + 0xD) +#define CAM_SET_GYRO_POWER_STATUS (CAM_COMMON_OPCODE_BASE + 0xE) +#define CAM_GET_GYRO_NOISE (CAM_COMMON_OPCODE_BASE + 0xF) +/*add by yufeng@camera, 20190618 for write eeprom */ +#define CAM_WRITE_CALIBRATION_DATA (CAM_COMMON_OPCODE_BASE + 0x10) +#define CAM_CHECK_CALIBRATION_DATA (CAM_COMMON_OPCODE_BASE + 0x11) +#define CAM_WRITE_AE_SYNC_DATA (CAM_COMMON_OPCODE_BASE + 0x12) +#define CAM_GET_GYRO_ENERGY (CAM_COMMON_OPCODE_BASE + 0x13) +//add by lifeiping@Cam.Drv, 20200423, add dpc read for imx471 +#define CAM_GET_DPC_DATA (CAM_COMMON_OPCODE_BASE + 0x14) +#define CAM_COMMON_OPCODE_MAX (CAM_COMMON_OPCODE_BASE + 0x15) +#endif #define CAM_COMMON_OPCODE_BASE_v2 0x150 #define CAM_ACQUIRE_HW (CAM_COMMON_OPCODE_BASE_v2 + 0x1) @@ -86,6 +106,12 @@ struct cam_control { #define VIDIOC_CAM_CONTROL \ _IOWR('V', BASE_VIDIOC_PRIVATE, struct cam_control) +#ifdef VENDOR_EDIT + /*add by hongbo.dai@Camera,20180326 for AT test*/ +#define VIDIOC_CAM_FTM_POWNER_UP 0 +#define VIDIOC_CAM_FTM_POWNER_DOWN 1 +#endif + /** * struct cam_hw_version - Structure for HW version of camera devices * @@ -651,5 +677,34 @@ struct cam_dump_req_cmd { uint32_t reserved; }; +#ifdef VENDOR_EDIT +/*zhixian.mai cam@drv , 20200416 add for hw interface */ +#define CAM_OEM_COMMON_OPCODE_BASE 0x8000 + +#define CAM_OEM_RW_SIZE_MAX 128 +#define CAM_OEM_RW_REG (CAM_OEM_COMMON_OPCODE_BASE + 1) +#define CAM_OEM_GET_ID (CAM_OEM_COMMON_OPCODE_BASE + 2) + +#define CAM_OEM_CMD_READ_DEV 0 +#define CAM_OEM_CMD_WRITE_DEV 1 + +struct cam_oem_rw_ctl { + int32_t cmd_code; + uint64_t data_addr; + int32_t reg_addr; + uint32_t slave_addr; + uint32_t reg_data_type; + int32_t reg_addr_type; + int16_t num_bytes; +}; + +struct cam_oem_write_i2c_reg_array { + uint32_t reg_addr; + uint32_t reg_data; + uint32_t delay; + uint32_t data_mask; +}; + +#endif #endif /* __UAPI_CAM_DEFS_H__ */ diff --git a/include/uapi/media/cam_sensor.h b/include/uapi/media/cam_sensor.h index 8fc180b7b632..11588f14c273 100644 --- a/include/uapi/media/cam_sensor.h +++ b/include/uapi/media/cam_sensor.h @@ -505,4 +505,26 @@ struct cam_ir_led_set_on_off { uint32_t pwm_duty_on_ns; uint32_t pwm_period_ns; } __attribute__((packed)); + +#ifdef VENDOR_EDIT +// Feiping.Li@Cam.Drv, 20200421, add dpc read for imx471 +#define FD_DFCT_MAX_NUM 5 +#define SG_DFCT_MAX_NUM 299 +#define FD_DFCT_NUM_ADDR 0x7678 +#define SG_DFCT_NUM_ADDR 0x767A +#define FD_DFCT_ADDR 0x8B00 +#define SG_DFCT_ADDR 0x8B10 +#define V_ADDR_SHIFT 12 +#define H_DATA_MASK 0xFFF80000 +#define V_DATA_MASK 0x0007FF80 + +struct sony_dfct_tbl_t { + //---- single static defect ---- + int sg_dfct_num; // the number of single static defect + int sg_dfct_addr[SG_DFCT_MAX_NUM]; // [ u25 ( upper-u13 = x-addr, lower-u12 = y-addr ) ] + //---- FD static defect ---- + int fd_dfct_num; // the number of FD static defect + int fd_dfct_addr[FD_DFCT_MAX_NUM]; // [ u25 ( upper-u13 = x-addr, lower-u12 = y-addr ) ] +} __attribute__ ((packed)); +#endif #endif diff --git a/include/uapi/media/msm_camsensor_sdk.h b/include/uapi/media/msm_camsensor_sdk.h index b5ff07592ad9..0d36e8460979 100644 --- a/include/uapi/media/msm_camsensor_sdk.h +++ b/include/uapi/media/msm_camsensor_sdk.h @@ -22,7 +22,12 @@ #define CSI_DECODE_DPCM_10_8_10 5 #define MAX_CID 16 #define I2C_SEQ_REG_DATA_MAX 1024 -#define I2C_REG_DATA_MAX (8*1024) +//#ifndef VENDOR_EDIT +//#define I2C_REG_DATA_MAX (8*1024) +//#else +//add by lvchangfu@camera, 20191139 for read eeprom data +#define I2C_REG_DATA_MAX (16*1024) +//#endif #define MSM_V4L2_PIX_FMT_META v4l2_fourcc('M', 'E', 'T', 'A') /* META */ #define MSM_V4L2_PIX_FMT_SBGGR14 v4l2_fourcc('B', 'G', '1', '4') diff --git a/include/uapi/scsi/ufs/ioctl.h b/include/uapi/scsi/ufs/ioctl.h index cc495c9ebcb8..2c08eafde54e 100644 --- a/include/uapi/scsi/ufs/ioctl.h +++ b/include/uapi/scsi/ufs/ioctl.h @@ -9,6 +9,11 @@ */ #define UFS_IOCTL_QUERY 0x5388 +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSFEATURE) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +#define UFSFEATURE_QUERY_OPCODE 0x5500 +#endif + /** * struct ufs_ioctl_query_data - used to transfer data to and from user via ioctl * @opcode: type of data to query (descriptor/attribute/flag) diff --git a/include/uapi/scsi/ufs/ufs.h b/include/uapi/scsi/ufs/ufs.h index 38ab40c8685f..0a690ae7d51a 100644 --- a/include/uapi/scsi/ufs/ufs.h +++ b/include/uapi/scsi/ufs/ufs.h @@ -5,15 +5,23 @@ /* Flag idn for Query Requests*/ enum flag_idn { - QUERY_FLAG_IDN_FDEVICEINIT = 0x01, - QUERY_FLAG_IDN_PERMANENT_WPE = 0x02, - QUERY_FLAG_IDN_PWR_ON_WPE = 0x03, - QUERY_FLAG_IDN_BKOPS_EN = 0x04, - QUERY_FLAG_IDN_RESERVED1 = 0x05, - QUERY_FLAG_IDN_PURGE_ENABLE = 0x06, - QUERY_FLAG_IDN_RESERVED2 = 0x07, - QUERY_FLAG_IDN_FPHYRESOURCEREMOVAL = 0x08, - QUERY_FLAG_IDN_BUSY_RTC = 0x09, + QUERY_FLAG_IDN_FDEVICEINIT = 0x01, + QUERY_FLAG_IDN_PERMANENT_WPE = 0x02, + QUERY_FLAG_IDN_PWR_ON_WPE = 0x03, + QUERY_FLAG_IDN_BKOPS_EN = 0x04, + QUERY_FLAG_IDN_LIFE_SPAN_MODE_ENABLE = 0x05, + QUERY_FLAG_IDN_PURGE_ENABLE = 0x06, + QUERY_FLAG_IDN_RESERVED2 = 0x07, + QUERY_FLAG_IDN_FPHYRESOURCEREMOVAL = 0x08, + QUERY_FLAG_IDN_BUSY_RTC = 0x09, + QUERY_FLAG_IDN_RESERVED3 = 0x0A, + QUERY_FLAG_IDN_PERMANENTLY_DISABLE_FW_UPDATE = 0x0B, +#if defined(VENDOR_EDIT) && defined(CONFIG_UFSTW) +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ + QUERY_FLAG_IDN_TW_EN = 0x0E, + QUERY_FLAG_IDN_TW_BUF_FLUSH_EN = 0x0F, + QUERY_FLAG_IDN_TW_FLUSH_DURING_HIBERN = 0x10, +#endif }; /* Attribute idn for Query requests */ @@ -36,7 +44,19 @@ enum attr_idn { QUERY_ATTR_IDN_SECONDS_PASSED = 0x0F, QUERY_ATTR_IDN_CNTX_CONF = 0x10, QUERY_ATTR_IDN_CORR_PRG_BLK_NUM = 0x11, + QUERY_ATTR_IDN_FFU_STATUS = 0x14, QUERY_ATTR_IDN_REF_CLK_GATING_WAIT_TIME = 0x17, +#ifdef VENDOR_EDIT +/* Hank.liu@TECH.PLAT.Storage, 2019-10-31, add UFS+ hpb and tw driver*/ +#if defined(CONFIG_UFSTW) + QUERY_ATTR_IDN_TW_FLUSH_STATUS = 0x1C, + QUERY_ATTR_IDN_TW_BUF_SIZE = 0x1D, + QUERY_ATTR_IDN_TW_BUF_LIFETIME_EST = 0x1E, +#endif +#if defined(CONFIG_UFSFEATURE) + QUERY_ATTR_IDN_SUP_VENDOR_OPTIONS = 0xFF, +#endif +#endif }; #define QUERY_ATTR_IDN_REF_CLK_GATING_WAIT_TIME \ diff --git a/init/main.c b/init/main.c index 8cf7d4c1afe4..5d12fde311c7 100644 --- a/init/main.c +++ b/init/main.c @@ -98,6 +98,11 @@ #include "do_mounts.h" +//#ifdef OPLUS_FEATURE_PHOENIX +// Kun.Hu@TECH.BSP.Stability.PHOENIX_PROJECT 2019/06/11, Add for phoenix project +#include "../drivers/soc/oplus/system/oppo_phoenix/oppo_phoenix.h" +//#endif //OPLUS_FEATURE_PHOENIX + static int kernel_init(void *); extern void init_IRQ(void); @@ -598,6 +603,12 @@ asmlinkage __visible void __init start_kernel(void) trap_init(); mm_init(); +//#ifdef OPLUS_FEATURE_PHOENIX + // Kun.Hu@PSW.TECH.RELIABILTY, 2018/11/15, add for project phoenix(hang oppo) + if(phx_set_boot_stage) + phx_set_boot_stage(KERNEL_MM_INIT_DONE); +//#endif //OPLUS_FEATURE_PHOENIX + ftrace_init(); /* trace_printk can be enabled here */ @@ -650,6 +661,11 @@ asmlinkage __visible void __init start_kernel(void) WARN(!irqs_disabled(), "Interrupts were enabled early\n"); early_boot_irqs_disabled = false; local_irq_enable(); +//#ifdef OPLUS_FEATURE_PHOENIX + // Kun.Hu@TECH.BSP.Stability.PHOENIX_PROJECT 2019/06/11, Add for phoenix project + if(phx_set_boot_stage) + phx_set_boot_stage(KERNEL_LOCAL_IRQ_ENABLE); +//#endif kmem_cache_init_late(); @@ -721,6 +737,11 @@ asmlinkage __visible void __init start_kernel(void) taskstats_init_early(); delayacct_init(); +//#ifdef OPLUS_FEATURE_PHOENIX + // Kun.Hu@PSW.TECH.RELIABILTY, 2018/11/15, add for project phoenix(hang oppo) + if(phx_set_boot_stage) + phx_set_boot_stage(KERNEL_DELAYACCT_INIT_DONE); +//#endif check_bugs(); acpi_subsystem_init(); @@ -939,10 +960,20 @@ static void __init do_basic_setup(void) cpuset_init_smp(); shmem_init(); driver_init(); +//#ifdef OPLUS_FEATURE_PHOENIX + // Kun.Hu@TECH.BSP.Stability.PHOENIX_PROJECT 2019/06/11, Add for phoenix project + if(phx_set_boot_stage) + phx_set_boot_stage(KERNEL_DRIVER_INIT_DONE); +//#endif init_irq_proc(); do_ctors(); usermodehelper_enable(); do_initcalls(); +//#ifdef OPLUS_FEATURE_PHOENIX + // Kun.Hu@TECH.BSP.Stability.PHOENIX_PROJECT 2019/06/11, Add for phoenix project + if(phx_set_boot_stage) + phx_set_boot_stage(KERNEL_DO_INITCALLS_DONE); +//#endif } static void __init do_pre_smp_initcalls(void) @@ -1047,6 +1078,13 @@ static int __ref kernel_init(void *unused) ; } #endif + +//#ifdef OPLUS_FEATURE_PHOENIX + // Kun.Hu@TECH.BSP.Stability.PHOENIX_PROJECT 2019/06/11, Add for phoenix project + if(phx_set_boot_stage) + phx_set_boot_stage(KERNEL_INIT_DONE); +//#endif + if (ramdisk_execute_command) { ret = run_init_process(ramdisk_execute_command); if (!ret) @@ -1113,6 +1151,11 @@ static noinline void __init kernel_init_freeable(void) do_basic_setup(); +//#ifdef OPLUS_FEATURE_PHOENIX + // Kun.Hu@TECH.BSP.Stability.PHOENIX_PROJECT 2019/06/11, Add for phoenix project + if(phx_set_boot_stage) + phx_set_boot_stage(KERNEL_DO_BASIC_SETUP_DONE); +//#endif /* Open the /dev/console on the rootfs, this should never fail */ if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) pr_err("Warning: unable to open an initial console.\n"); diff --git a/kernel/Makefile b/kernel/Makefile index 3d6ca8e9d04c..e7c8ca81e80f 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -12,6 +12,11 @@ obj-y = fork.o exec_domain.o panic.o \ notifier.o ksysfs.o cred.o reboot.o \ async.o range.o smpboot.o ucount.o +#ifdef CONFIG_OPLUS_FEATURE_PANIC_FLUSH +#yanwu@TECH.Storage.FS.oF2FS, 2019/09/13, flush device cache in panic if necessary +obj-y += panic_flush.o +#endif + obj-$(CONFIG_MODULES) += kmod.o obj-$(CONFIG_MULTIUSER) += groups.o @@ -45,6 +50,9 @@ obj-y += printk/ obj-y += irq/ obj-y += rcu/ obj-y += livepatch/ +#ifdef CONFIG_OPLUS_SECURE_GUARD +obj-$(CONFIG_OPLUS_SECURE_GUARD) += keventupload/ +#endif /* CONFIG_OPLUS_SECURE_GUARD */ obj-$(CONFIG_CHECKPOINT_RESTORE) += kcmp.o obj-$(CONFIG_FREEZER) += freezer.o @@ -117,6 +125,16 @@ obj-$(CONFIG_TORTURE_TEST) += torture.o obj-$(CONFIG_HAS_IOMEM) += memremap.o +#ifdef OPLUS_FEATURE_UIFIRST +#XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst +obj-y += uifirst/ +#endif /* OPLUS_FEATURE_UIFIRST */ + +#ifdef OPLUS_FEATURE_UIFIRST +#Liujie.Xie@TECH.Kernel.Sched, 2020/03/23, add for heavy load task +obj-y += oppo_special_opt/ +#endif /* OPLUS_FEATURE_UIFIRST */ + $(obj)/configs.o: $(obj)/config_data.h targets += config_data.gz diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 8c3850ab1da5..dac2d94251bb 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -4207,7 +4207,6 @@ repeat: it->flags &= ~CSS_TASK_ITER_SKIPPED; else it->task_pos = it->task_pos->next; - if (it->task_pos == it->tasks_head) { it->task_pos = it->mg_tasks_head->next; it->cur_tasks_head = it->mg_tasks_head; diff --git a/kernel/exit.c b/kernel/exit.c index d9013af253bf..b93389a0f04a 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -68,6 +68,10 @@ #include #include +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) +#include +#endif + static void __unhash_process(struct task_struct *p, bool group_dead) { nr_threads--; @@ -544,6 +548,9 @@ static void exit_mm(void) task_unlock(current); mm_update_next_owner(mm); +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_OPPO_HEALTHINFO) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + trigger_svm_oom_event(mm, 0, 0); +#endif mm_released = mmput(mm); if (test_thread_flag(TIF_MEMDIE)) exit_oom_victim(); diff --git a/kernel/fork.c b/kernel/fork.c index d3a966a54739..fe946282b138 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -106,12 +106,26 @@ #define CREATE_TRACE_POINTS #include +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst +#include +#endif /* OPLUS_FEATURE_UIFIRST */ +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO +#include +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ /* * Minimum number of threads to boot the kernel */ #define MIN_THREADS 20 +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) +#include +#endif + /* * Maximum number of threads */ @@ -705,6 +719,13 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, if (is_vm_hugetlb_page(tmp)) reset_vma_resv_huge_pages(tmp); +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + /* + * dup the reserved vma from parent process + */ + if (BACKUP_CREATE_FLAG(tmp->vm_flags)) + mm->reserve_vma = tmp; +#endif /* * Link in the new vma and copy the page table entries. */ @@ -727,6 +748,13 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, if (retval) goto out; } + +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + retval = dup_reserved_mmap(mm, oldmm, vm_area_cachep); + if (retval) + goto out; +#endif + /* a new mm has just been created */ retval = arch_dup_mmap(oldmm, mm); out: @@ -827,6 +855,9 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, mm->mmap = NULL; mm->mm_rb = RB_ROOT; mm->vmacache_seqnum = 0; +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + init_reserve_mm(mm); +#endif #ifdef CONFIG_SPECULATIVE_PAGE_FAULT rwlock_init(&mm->mm_rb_lock); #endif @@ -1255,6 +1286,7 @@ static int copy_mm(unsigned long clone_flags, struct task_struct *tsk) tsk->nvcsw = tsk->nivcsw = 0; #ifdef CONFIG_DETECT_HUNG_TASK tsk->last_switch_count = tsk->nvcsw + tsk->nivcsw; + tsk->last_switch_time = 0; #endif tsk->mm = NULL; @@ -1875,6 +1907,18 @@ static __latent_entropy struct task_struct *copy_process( p->sequential_io_avg = 0; #endif +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + init_task_ux_info(p); +#endif /* OPLUS_FEATURE_UIFIRST */ +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + p->jank_trace = 0; + memset(&p->oppo_jank_info, 0, sizeof(struct oppo_jank_monitor_info)); +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ + /* Perform scheduler related setup. Assign this task to a CPU. */ retval = sched_fork(clone_flags, p); if (retval) diff --git a/kernel/futex.c b/kernel/futex.c index 123c0a7e03a2..3faad67e87bc 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -73,6 +73,12 @@ #include "locking/rtmutex_common.h" +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst +#include +#include +#endif /* OPLUS_FEATURE_UIFIRST */ + /* * READ this before attempting to hack on futexes! * @@ -243,6 +249,11 @@ struct futex_q { struct plist_node list; struct task_struct *task; +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + struct task_struct *wait_for; + atomic_t ux_waitings; +#endif /* OPLUS_FEATURE_UIFIRST */ spinlock_t *lock_ptr; union futex_key key; struct futex_pi_state *pi_state; @@ -1717,6 +1728,15 @@ futex_wake(u32 __user *uaddr, unsigned int flags, int nr_wake, u32 bitset) if (!(this->bitset & bitset)) continue; +#ifdef OPLUS_FEATURE_UIFIRST +// Liujie.Xie@TECH.Kernel.Sched, 2019/10/08, add for ui first + if (sysctl_uifirst_enabled) { + int ux_waitings = atomic_read(&(this->ux_waitings)); + if (ux_waitings > 0) { + futex_unset_inherit_ux_refs(current, ux_waitings); + } + } +#endif /* OPLUS_FEATURE_UIFIRST */ mark_wake_futex(&wake_q, this); if (++ret >= nr_wake) break; @@ -2370,6 +2390,12 @@ static inline void __queue_me(struct futex_q *q, struct futex_hash_bucket *hb) * the others are woken last, in FIFO order. */ prio = min(current->normal_prio, MAX_RT_PRIO); +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled && test_task_ux(current)) { + prio = min(current->normal_prio, MAX_RT_PRIO - 1); + } +#endif /* OPLUS_FEATURE_UIFIRST */ plist_node_init(&q->list, prio); plist_add(&q->list, &hb->chain); @@ -2711,6 +2737,17 @@ static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q, * access to the hash list and forcing another memory barrier. */ set_current_state(TASK_INTERRUPTIBLE); +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled) { + if (!timeout) { + futex_set_inherit_ux_refs(q->wait_for, current); + if (test_set_dynamic_ux(current)) { + atomic_inc(&(q->ux_waitings)); + } + } + } +#endif /* OPLUS_FEATURE_UIFIRST */ queue_me(q, hb); /* Arm the timer */ @@ -2727,8 +2764,22 @@ static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q, * flagged for rescheduling. Only call schedule if there * is no timeout, or if it has yet to expire. */ - if (!timeout || timeout->task) + if (!timeout || timeout->task) { +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + current->in_futex = 1; +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ freezable_schedule(); +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + current->in_futex = 0; +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ + } + } __set_current_state(TASK_RUNNING); } @@ -2809,8 +2860,32 @@ out: return ret; } +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst +static struct task_struct* get_futex_owner_by_pid_local(u32 owner_tid) { + struct task_struct* futex_owner = NULL; + + if (owner_tid > 0 && owner_tid <= PID_MAX_DEFAULT) { + rcu_read_lock(); + futex_owner = find_task_by_vpid(owner_tid); + if (futex_owner) { + get_task_struct(futex_owner); + } + rcu_read_unlock(); + } + + return futex_owner; +} +#endif /* OPLUS_FEATURE_UIFIRST */ + +#ifndef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst static int futex_wait(u32 __user *uaddr, unsigned int flags, u32 val, ktime_t *abs_time, u32 bitset) +#else /* OPLUS_FEATURE_UIFIRST */ +static int futex_wait(u32 __user *uaddr, unsigned int flags, u32 val, + ktime_t *abs_time, u32 bitset, u32 owner_tid) +#endif /* OPLUS_FEATURE_UIFIRST */ { struct hrtimer_sleeper timeout, *to = NULL; struct restart_block *restart; @@ -2821,6 +2896,20 @@ static int futex_wait(u32 __user *uaddr, unsigned int flags, u32 val, if (!bitset) return -EINVAL; q.bitset = bitset; +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled && (bitset == FUTEX_BITSET_MATCH_ANY) && test_task_ux(current)) { + struct task_struct* owner_task = get_futex_owner_by_pid_local(owner_tid); + //Kezhi.Zhu@TECH.Kernel.Sched if same process or shared lock + if (owner_task != NULL) { + if ((current->tgid == owner_task->tgid) || (flags & FLAGS_SHARED)) { + q.wait_for = owner_task; + } else { + put_task_struct(owner_task); + } + } + } +#endif /* OPLUS_FEATURE_UIFIRST */ if (abs_time) { to = &timeout; @@ -2872,6 +2961,10 @@ retry: restart->futex.time = *abs_time; restart->futex.bitset = bitset; restart->futex.flags = flags | FLAGS_HAS_TIMEOUT; +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + restart->futex.uaddr2 = (u32*)(long)owner_tid; +#endif /* OPLUS_FEATURE_UIFIRST */ ret = -ERESTART_RESTARTBLOCK; @@ -2880,6 +2973,10 @@ out: hrtimer_cancel(&to->timer); destroy_hrtimer_on_stack(&to->timer); } +#ifdef OPLUS_FEATURE_UIFIRST + if (q.wait_for) + put_task_struct(q.wait_for); +#endif /* OPLUS_FEATURE_UIFIRST */ return ret; } @@ -2895,8 +2992,14 @@ static long futex_wait_restart(struct restart_block *restart) } restart->fn = do_no_restart_syscall; +#ifndef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst return (long)futex_wait(uaddr, restart->futex.flags, restart->futex.val, tp, restart->futex.bitset); +#else /* OPLUS_FEATURE_UIFIRST */ + return (long)futex_wait(uaddr, restart->futex.flags, + restart->futex.val, tp, restart->futex.bitset, (u32)(restart->futex.uaddr2)); +#endif /* OPLUS_FEATURE_UIFIRST */ } @@ -3896,7 +3999,12 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout, case FUTEX_WAIT: val3 = FUTEX_BITSET_MATCH_ANY; case FUTEX_WAIT_BITSET: - return futex_wait(uaddr, flags, val, timeout, val3); +#ifndef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + return futex_wait(uaddr, flags, val, timeout, val3); +#else /* OPLUS_FEATURE_UIFIRST */ + return futex_wait(uaddr, flags, val, timeout, val3, (u32)uaddr2); +#endif /* OPLUS_FEATURE_UIFIRST */ case FUTEX_WAKE: val3 = FUTEX_BITSET_MATCH_ANY; case FUTEX_WAKE_BITSET: diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh index 9ff449888d9c..6247106fe2be 100755 --- a/kernel/gen_kheaders.sh +++ b/kernel/gen_kheaders.sh @@ -23,6 +23,8 @@ arch/$SRCARCH/include/ # else iter=$(($(cat /tmp/iter) + 1)); echo $iter > /tmp/iter; fi # find $src_file_list -name "*.h" | xargs ls -l > /tmp/src-ls-$iter # find $obj_file_list -name "*.h" | xargs ls -l > /tmp/obj-ls-$iter +# find $src_file_list -type f | xargs ls -l > /tmp/src-ls-$iter +# find $obj_file_list -type f | xargs ls -l > /tmp/obj-ls-$iter # include/generated/compile.h is ignored because it is touched even when none # of the source files changed. This causes pointless regeneration, so let us diff --git a/kernel/hung_task.c b/kernel/hung_task.c index a9cdea43d863..8893fc58b482 100644 --- a/kernel/hung_task.c +++ b/kernel/hung_task.c @@ -23,6 +23,10 @@ #include #include +#ifdef CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE +#include +#endif + /* * The number of tasks checked: */ @@ -87,6 +91,7 @@ static struct notifier_block panic_block = { .notifier_call = hung_task_panic, }; +#ifndef CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE static void check_hung_task(struct task_struct *t, unsigned long timeout) { unsigned long switch_count = t->nvcsw + t->nivcsw; @@ -108,9 +113,13 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout) if (switch_count != t->last_switch_count) { t->last_switch_count = switch_count; + t->last_switch_time = jiffies; return; } + if (time_is_after_jiffies(t->last_switch_time + timeout * HZ)) + return; + trace_sched_process_hang(t); if (sysctl_hung_task_panic) { @@ -140,6 +149,7 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout) touch_nmi_watchdog(); } +#endif /* * To avoid extending the RCU grace period for an unbounded amount of time, @@ -175,6 +185,10 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout) unsigned long last_break = jiffies; struct task_struct *g, *t; +#if defined(CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE) && defined(CONFIG_OPLUS_FEATURE_DEATH_HEALER) + unsigned int iowait_count = 0; +#endif + /* * If the system crashed already then all bets are off, * do not report extra hung tasks: @@ -192,14 +206,21 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout) goto unlock; last_break = jiffies; } +#if defined(CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE) && defined(CONFIG_OPLUS_FEATURE_DEATH_HEALER) + io_check_hung_detection(t, timeout, &iowait_count, &hung_task_show_lock, &hung_task_call_panic); +#else /* use "==" to skip the TASK_KILLABLE tasks waiting on NFS */ if (t->state == TASK_UNINTERRUPTIBLE) /* Check for selective monitoring */ if (!sysctl_hung_task_selective_monitoring || t->hang_detection_enabled) check_hung_task(t, timeout); +#endif } unlock: +#if defined(CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE) && defined(CONFIG_OPLUS_FEATURE_DEATH_HEALER) + io_block_panic(&iowait_count, sysctl_hung_task_maxiowait_count); +#endif rcu_read_unlock(); if (hung_task_show_lock) debug_show_all_locks(); diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c index e280a3dc25fb..d31882934ab9 100644 --- a/kernel/irq/cpuhotplug.c +++ b/kernel/irq/cpuhotplug.c @@ -14,6 +14,9 @@ #include #include "internals.h" +#ifdef OPLUS_FEATURE_CHG_BASIC +#include "soc/oplus/system/oppo_project.h" +#endif /* For !GENERIC_IRQ_EFFECTIVE_AFF_MASK this looks at general affinity mask */ static inline bool irq_needs_fixup(struct irq_data *d) @@ -201,10 +204,19 @@ void irq_migrate_all_off_this_cpu(void) affinity_broken = migrate_one_irq(desc); raw_spin_unlock(&desc->lock); +#ifndef OPLUS_FEATURE_CHG_BASIC if (affinity_broken) { pr_info_ratelimited("IRQ %u: no longer affine to CPU%u\n", irq, smp_processor_id()); } +#else + if (get_eng_version() != OEM_RELEASE){ + if (affinity_broken) { + pr_info_ratelimited("IRQ %u: no longer affine to CPU%u\n", + irq, smp_processor_id()); + } + } +#endif /*OPLUS_FEATURE_CHG_BASIC*/ } } diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c index 57e28af96c5b..a26d35545530 100644 --- a/kernel/locking/mutex.c +++ b/kernel/locking/mutex.c @@ -36,6 +36,10 @@ # include "mutex.h" #endif +#ifdef CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE +#include +#endif + void __mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key) { @@ -45,6 +49,10 @@ __mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key) #ifdef CONFIG_MUTEX_SPIN_ON_OWNER osq_lock_init(&lock->osq); #endif +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + lock->ux_dep_task = NULL; +#endif /* OPLUS_FEATURE_UIFIRST */ debug_mutex_init(lock, name, key); } @@ -795,7 +803,16 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, if (!use_ww_ctx) { /* add waiting tasks to the end of the waitqueue (FIFO): */ +#ifndef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst list_add_tail(&waiter.list, &lock->wait_list); +#else /* OPLUS_FEATURE_UIFIRST */ + if (sysctl_uifirst_enabled) { + mutex_list_add(current, &waiter.list, &lock->wait_list, lock); + } else { + list_add_tail(&waiter.list, &lock->wait_list); + } +#endif /* OPLUS_FEATURE_UIFIRST */ #ifdef CONFIG_DEBUG_MUTEXES waiter.ww_ctx = MUTEX_POISON_WW_CTX; @@ -830,7 +847,12 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, * wait_lock. This ensures the lock cancellation is ordered * against mutex_unlock() and wake-ups do not go missing. */ +#ifdef CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE + if (unlikely(signal_pending_state(state, current)) + || hung_long_and_fatal_signal_pending(current)) { +#else if (unlikely(signal_pending_state(state, current))) { +#endif ret = -EINTR; goto err; } @@ -840,9 +862,31 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, if (ret) goto err; } +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled) { + mutex_set_inherit_ux(lock, current); + } +#endif /* OPLUS_FEATURE_UIFIRST */ spin_unlock(&lock->wait_lock); +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + if (state & TASK_UNINTERRUPTIBLE) { + current->in_mutex = 1; + } +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ schedule_preempt_disabled(); +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + if (state & TASK_UNINTERRUPTIBLE) { + current->in_mutex = 0; + } +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ /* * ww_mutex needs to always recheck its position since its waiter @@ -1062,6 +1106,12 @@ static noinline void __sched __mutex_unlock_slowpath(struct mutex *lock, unsigne spin_lock(&lock->wait_lock); debug_mutex_unlock(lock); +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled) { + mutex_unset_inherit_ux(lock, current); + } +#endif /* OPLUS_FEATURE_UIFIRST */ if (!list_empty(&lock->wait_list)) { /* get the first entry from the wait-list: */ struct mutex_waiter *waiter = diff --git a/kernel/locking/rwsem-xadd.c b/kernel/locking/rwsem-xadd.c index 350861f0da16..b307e5c612a5 100644 --- a/kernel/locking/rwsem-xadd.c +++ b/kernel/locking/rwsem-xadd.c @@ -93,6 +93,10 @@ void __init_rwsem(struct rw_semaphore *sem, const char *name, #ifdef CONFIG_RWSEM_PRIO_AWARE sem->m_count = 0; #endif +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + sem->ux_dep_task = NULL; +#endif /* OPLUS_FEATURE_UIFIRST */ } EXPORT_SYMBOL(__init_rwsem); @@ -270,6 +274,13 @@ __rwsem_down_read_failed_common(struct rw_semaphore *sem, int state) is_first_waiter))) __rwsem_mark_wake(sem, RWSEM_WAKE_ANY, &wake_q); +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled) { + rwsem_set_inherit_ux(current, waiter.task, READ_ONCE(sem->owner), sem); + } +#endif /* OPLUS_FEATURE_UIFIRST */ + raw_spin_unlock_irq(&sem->wait_lock); wake_up_q(&wake_q); @@ -285,7 +296,19 @@ __rwsem_down_read_failed_common(struct rw_semaphore *sem, int state) raw_spin_unlock_irq(&sem->wait_lock); break; } +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + current->in_downread = 1; +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ schedule(); +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + current->in_downread = 0; +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ } __set_current_state(TASK_RUNNING); @@ -574,6 +597,13 @@ __rwsem_down_write_failed_common(struct rw_semaphore *sem, int state) } else count = atomic_long_add_return(RWSEM_WAITING_BIAS, &sem->count); +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled) { + rwsem_set_inherit_ux(waiter.task, current, READ_ONCE(sem->owner), sem); + } +#endif /* OPLUS_FEATURE_UIFIRST */ + /* wait until we successfully acquire the lock */ set_current_state(state); while (true) { @@ -586,7 +616,19 @@ __rwsem_down_write_failed_common(struct rw_semaphore *sem, int state) if (signal_pending_state(state, current)) goto out_nolock; +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + current->in_downwrite = 1; +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ schedule(); +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + current->in_downwrite = 0; +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ set_current_state(state); } while ((count = atomic_long_read(&sem->count)) & RWSEM_ACTIVE_MASK); @@ -699,6 +741,13 @@ locked: if (!list_empty(&sem->wait_list)) __rwsem_mark_wake(sem, RWSEM_WAKE_ANY, &wake_q); +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled) { + rwsem_unset_inherit_ux(sem, current); + } +#endif /* OPLUS_FEATURE_UIFIRST */ + raw_spin_unlock_irqrestore(&sem->wait_lock, flags); wake_up_q(&wake_q); diff --git a/kernel/locking/rwsem.h b/kernel/locking/rwsem.h index df2d6ee84d26..004057187d65 100644 --- a/kernel/locking/rwsem.h +++ b/kernel/locking/rwsem.h @@ -95,6 +95,10 @@ static inline void rwsem_set_reader_owned(struct rw_semaphore *sem) #define RWSEM_MAX_PREEMPT_ALLOWED 3000 +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst +extern bool test_task_ux(struct task_struct *task); +#endif /* OPLUS_FEATURE_UIFIRST */ /* * Return true if current waiter is added in the front of the rwsem wait list. */ @@ -122,11 +126,27 @@ static inline bool rwsem_list_add_per_prio(struct rwsem_waiter *waiter_in, return true; } +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled) { + if (rwsem_list_add(waiter_in->task, &waiter_in->list, &sem->wait_list, sem)) { + return &waiter_in->list == head->next; + } + } +#endif /* OPLUS_FEATURE_UIFIRST */ + if (waiter_in->task->prio < DEFAULT_PRIO && sem->m_count < RWSEM_MAX_PREEMPT_ALLOWED) { list_for_each(pos, head) { waiter = list_entry(pos, struct rwsem_waiter, list); +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled && waiter_in->task->prio > MAX_RT_PRIO && + test_task_ux(waiter->task)) { + continue; + } +#endif /* OPLUS_FEATURE_UIFIRST */ if (waiter->task->prio > waiter_in->task->prio) { list_add(&waiter_in->list, pos->prev); sem->m_count++; diff --git a/kernel/locking/semaphore.c b/kernel/locking/semaphore.c index 561acdd39960..08bed12114df 100644 --- a/kernel/locking/semaphore.c +++ b/kernel/locking/semaphore.c @@ -34,6 +34,10 @@ #include #include +#ifdef CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE +#include +#endif + static noinline void __down(struct semaphore *sem); static noinline int __down_interruptible(struct semaphore *sem); static noinline int __down_killable(struct semaphore *sem); @@ -212,7 +216,11 @@ static inline int __sched __down_common(struct semaphore *sem, long state, waiter.up = false; for (;;) { +#ifdef CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE + if (signal_pending_state(state, current) || hung_long_and_fatal_signal_pending(current)) +#else if (signal_pending_state(state, current)) +#endif goto interrupted; if (unlikely(timeout <= 0)) goto timed_out; diff --git a/kernel/panic.c b/kernel/panic.c index e41e9eab6025..1f9a4cbbbfe4 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -31,6 +31,10 @@ #define CREATE_TRACE_POINTS #include #include +#ifdef OPLUS_FEATURE_AGINGTEST +/* Yong.Qian@bsp.kernel.stability, 2020/5/14, Add for dump reason */ +#include +#endif /*OPLUS_FEATURE_AGINGTEST*/ #define PANIC_TIMER_STEP 100 #define PANIC_BLINK_SPD 18 @@ -125,6 +129,13 @@ void nmi_panic(struct pt_regs *regs, const char *msg) } EXPORT_SYMBOL(nmi_panic); +#ifdef CONFIG_OPLUS_FEATURE_PANIC_FLUSH +/* yanwu@TECH.Storage.FS.oF2FS, 2019/09/13, flush device cache in panic if necessary */ +extern int panic_flush_device_cache(int timeout); +void dumpcpuregs(struct pt_regs *pt_regs); +extern int get_download_mode(void); +#endif + /** * panic - halt the system * @fmt: The text string to print @@ -141,7 +152,10 @@ void panic(const char *fmt, ...) int state = 0; int old_cpu, this_cpu; bool _crash_kexec_post_notifiers = crash_kexec_post_notifiers; - +#ifdef OPLUS_FEATURE_AGINGTEST +/* Yong.Qian@bsp.kernel.stability, 2020/5/14, Add for dump reason */ + char *function_name; +#endif /*OPLUS_FEATURE_AGINGTEST*/ trace_kernel_panic(0); /* @@ -180,7 +194,18 @@ void panic(const char *fmt, ...) vsnprintf(buf, sizeof(buf), fmt, args); va_end(args); dump_stack_minidump(0); +#ifdef CONFIG_OPLUS_FEATURE_PANIC_FLUSH +/* yanwu@TECH.Storage.FS.oF2FS, 2019/09/13, flush device cache in panic if necessary */ + dumpcpuregs(0); + if(!get_download_mode()) + panic_flush_device_cache(2000); +#endif pr_emerg("Kernel panic - not syncing: %s\n", buf); +#ifdef OPLUS_FEATURE_AGINGTEST +/* Yong.Qian@bsp.kernel.stability, 2020/5/14, Add for dump reason */ + function_name = parse_function_builtin_return_address((unsigned long)__builtin_return_address(0)); + save_dump_reason_to_smem(buf, function_name); +#endif /*OPLUS_FEATURE_AGINGTEST*/ #ifdef CONFIG_DEBUG_BUGVERBOSE /* * Avoid nested stack-dumping if a panic occurs during oops processing diff --git a/kernel/power/autosleep.c b/kernel/power/autosleep.c index 9af5a50d3489..a9d9edfc9de8 100644 --- a/kernel/power/autosleep.c +++ b/kernel/power/autosleep.c @@ -24,6 +24,32 @@ static struct workqueue_struct *autosleep_wq; static DEFINE_MUTEX(autosleep_lock); static struct wakeup_source *autosleep_ws; +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY +//Nanwei.Deng@BSP.CHG.Basic, 2018/11/19, add for analysis power coumption. +static void wakelock_printk(struct work_struct *work); +static struct workqueue_struct *wakelock_printk_work_queue = NULL; +static DECLARE_DELAYED_WORK(wakelock_printk_work, wakelock_printk); +static void wakelock_printk(struct work_struct *work) +{ + pr_info("%s for debug\n", __func__); + pm_print_active_wakeup_sources(); + queue_delayed_work(wakelock_printk_work_queue, &wakelock_printk_work, msecs_to_jiffies(50*1000)); +} + +void wakelock_printk_control(int on) +{ + if (wakelock_printk_work_queue == NULL) { + printk(KERN_INFO"%s: wakelock_printk_work_queue is NULL, do nothing\n", __func__); + return; + } + if (on) { + queue_delayed_work(wakelock_printk_work_queue, &wakelock_printk_work, msecs_to_jiffies(50*1000)); + } else { + cancel_delayed_work(&wakelock_printk_work); + } +} +#endif /* VENDOR_EDIT */ + static void try_to_suspend(struct work_struct *work) { unsigned int initial_count, final_count; @@ -95,6 +121,12 @@ int pm_autosleep_set_state(suspend_state_t state) return -EINVAL; #endif +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY +//Nanwei.Deng@BSP.CHG.Basic, 2018/11/19, add for analysis power coumption. + wakelock_printk_control(0); +#endif /* VENDOR_EDIT */ + + __pm_stay_awake(autosleep_ws); mutex_lock(&autosleep_lock); @@ -111,11 +143,25 @@ int pm_autosleep_set_state(suspend_state_t state) } mutex_unlock(&autosleep_lock); + +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY +//Nanwei.Deng@BSP.CHG.Basic, 2018/11/19, add for analysis power coumption. + wakelock_printk_control(1); +#endif /* VENDOR_EDIT */ + return 0; } int __init pm_autosleep_init(void) { +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY +//Nanwei.Deng@BSP.CHG.Basic, 2018/11/19, add for analysis power coumption. + wakelock_printk_work_queue = create_singlethread_workqueue("wakelock_printk"); + if (wakelock_printk_work_queue == NULL) + printk(KERN_INFO "%s: failed to create work queue\n", __func__); + wakelock_printk_control(1); +#endif /* VENDOR_EDIT */ + autosleep_ws = wakeup_source_register(NULL, "autosleep"); if (!autosleep_ws) return -ENOMEM; diff --git a/kernel/power/main.c b/kernel/power/main.c index 2dd7daa1ca5b..8e0391454d2e 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -15,6 +15,10 @@ #include #include #include +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY +//Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler +#include +#endif /* OPLUS_FEATURE_POWERINFO_STANDBY */ #include "power.h" @@ -206,6 +210,11 @@ static ssize_t pm_test_store(struct kobject *kobj, struct kobj_attribute *attr, } unlock_system_sleep(); +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG +//Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug + pr_info("%s buf:%s, pm_test_level:%d,level:%d\n", __func__, buf, + pm_test_level, level); +#endif /* VENDOR_EDIT */ return error ? error : n; } @@ -570,6 +579,11 @@ static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr, suspend_state_t state; int error; + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler + pr_info("PM: enter state_store, buf=%s.\n", buf); + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY */ + error = pm_autosleep_lock(); if (error) return error; @@ -626,7 +640,33 @@ power_attr(state); * is allowed to write to 'state', but the transition will be aborted if there * are any wakeup events detected after 'wakeup_count' was written to. */ +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY +//Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler +static void pm_wakeup_count_marker(char *annotation) +{ + struct timespec ts; + struct rtc_time tm; + getnstimeofday(&ts); + rtc_time_to_tm(ts.tv_sec, &tm); + pr_info("PM: wakeup_count %s %d-%02d-%02d %02d:%02d:%02d.%09lu UTC\n", + annotation, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec, ts.tv_nsec); +} + +static ssize_t wakeup_count_show(struct kobject *kobj, + struct kobj_attribute *attr, + char *buf) +{ + unsigned int val, error; + + pm_wakeup_count_marker("read enter"); + error = pm_get_wakeup_count(&val, true); + pm_wakeup_count_marker("read exit"); + + return error ? sprintf(buf, "%u\n", val) : -EINTR; +} +#else static ssize_t wakeup_count_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) @@ -636,6 +676,7 @@ static ssize_t wakeup_count_show(struct kobject *kobj, return pm_get_wakeup_count(&val, true) ? sprintf(buf, "%u\n", val) : -EINTR; } +#endif /* OPLUS_FEATURE_POWERINFO_STANDBY */ static ssize_t wakeup_count_store(struct kobject *kobj, struct kobj_attribute *attr, @@ -644,6 +685,11 @@ static ssize_t wakeup_count_store(struct kobject *kobj, unsigned int val; int error; + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY + //Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler + pm_wakeup_count_marker("store"); + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY */ + error = pm_autosleep_lock(); if (error) return error; @@ -812,6 +858,39 @@ power_attr(pm_freeze_timeout); #endif /* CONFIG_FREEZER*/ +#ifdef OPLUS_BUG_STABILITY +/* fanhui@PhoneSW.BSP, 2016/05/16, interface to read PMIC reg PON_REASON and POFF_REASON */ +char pon_reason[128]; +static ssize_t pon_reason_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + return sprintf(buf, "%s", pon_reason); +} + +static ssize_t pon_reason_store(struct kobject *kobj, + struct kobj_attribute *attr, + const char *buf, size_t n) +{ + return -EINVAL; +} +power_attr(pon_reason); + +char poff_reason[128]; +static ssize_t poff_reason_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + return sprintf(buf, "%s", poff_reason); +} + +static ssize_t poff_reason_store(struct kobject *kobj, + struct kobj_attribute *attr, + const char *buf, size_t n) +{ + return -EINVAL; +} +power_attr(poff_reason); +#endif /*OPLUS_BUG_STABILITY*/ + static struct attribute * g[] = { &state_attr.attr, #ifdef CONFIG_PM_TRACE @@ -841,6 +920,11 @@ static struct attribute * g[] = { #ifdef CONFIG_FREEZER &pm_freeze_timeout_attr.attr, #endif +#ifdef OPLUS_BUG_STABILITY +/* fanhui@PhoneSW.BSP, 2016/05/16, interface to read PMIC reg PON_REASON and POFF_REASON */ + &pon_reason_attr.attr, + &poff_reason_attr.attr, +#endif /*OPLUS_BUG_STABILITY*/ NULL, }; diff --git a/kernel/power/process.c b/kernel/power/process.c index 1ae7f93efde9..f2ca3664a0a3 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c @@ -27,8 +27,12 @@ /* * Timeout for stopping processes */ +#ifndef OPLUS_FEATURE_POWERINFO_STANDBY +//PengNan@BSP.Power.Basic, add for debugging freezing failed, 2020/08/17 unsigned int __read_mostly freeze_timeout_msecs = 20 * MSEC_PER_SEC; - +#else +unsigned int __read_mostly freeze_timeout_msecs = 2 * MSEC_PER_SEC; +#endif /*OPLUS_FEATURE_POWERINFO_STANDBY*/ static int try_to_freeze_tasks(bool user_only) { struct task_struct *g, *p; diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 63f6557b4fcc..708bffc8c2e6 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -36,6 +36,12 @@ #include "power.h" #include +#ifdef OPLUS_FEATURE_TP_BASIC +//Cong.Dai@psw.bsp.tp 2018/08/30 modified for stop system enter sleep before low irq handled +#include +__attribute__((weak)) int check_touchirq_triggered(void) {return 0;} +#endif /* OPLUS_FEATURE_TP_BASIC */ + const char * const pm_labels[] = { [PM_SUSPEND_TO_IDLE] = "freeze", [PM_SUSPEND_STANDBY] = "standby", @@ -325,9 +331,21 @@ MODULE_PARM_DESC(pm_test_delay, static int suspend_test(int level) { #ifdef CONFIG_PM_DEBUG + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug + pr_info("%s pm_test_level:%d, level:%d\n", __func__, + pm_test_level, level); + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ + if (pm_test_level == level) { + #ifndef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug pr_info("suspend debug: Waiting for %d second(s).\n", pm_test_delay); + #else + pr_err("suspend debug: Waiting for %d second(s).\n", + pm_test_delay); + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ mdelay(pm_test_delay * 1000); return 1; } @@ -396,8 +414,16 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) int error, last_dev; error = platform_suspend_prepare(state); + #ifndef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug if (error) goto Platform_finish; + #else + if (error) { + pr_info("%s platform_suspend_prepare fail\n", __func__); + goto Platform_finish; + } + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ error = dpm_suspend_late(PMSG_SUSPEND); if (error) { @@ -409,8 +435,16 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) goto Platform_finish; } error = platform_suspend_prepare_late(state); + #ifndef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug if (error) goto Devices_early_resume; + #else + if (error) { + pr_info("%s prepare late fail\n", __func__); + goto Devices_early_resume; + } + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ if (state == PM_SUSPEND_TO_IDLE && pm_test_level != TEST_PLATFORM) { s2idle_loop(); @@ -427,11 +461,27 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) goto Platform_early_resume; } error = platform_suspend_prepare_noirq(state); + #ifndef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug if (error) goto Platform_wake; + #else + if (error) { + pr_info("%s prepare_noirq fail\n", __func__); + goto Platform_wake; + } + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ + #ifndef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug if (suspend_test(TEST_PLATFORM)) goto Platform_wake; + #else + if (suspend_test(TEST_PLATFORM)) { + pr_info("%s test_platform fail\n", __func__); + goto Platform_wake; + } + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ error = disable_nonboot_cpus(); if (error || suspend_test(TEST_CPUS)) { @@ -441,6 +491,18 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) arch_suspend_disable_irqs(); BUG_ON(!irqs_disabled()); +#ifdef OPLUS_FEATURE_TP_BASIC +//Cong.Dai@psw.bsp.tp 2018/08/30 modified for stop system enter sleep before low irq handled + if (check_touchirq_triggered()) { + error = -EBUSY; + goto Enable_irqs; + } +#endif /* OPLUS_FEATURE_TP_BASIC */ + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug + pr_info("%s syscore_suspend\n", __func__); + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ + error = syscore_suspend(); if (!error) { @@ -458,6 +520,10 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) syscore_resume(); } +#ifdef OPLUS_FEATURE_TP_BASIC +//Cong.Dai@psw.bsp.tp 2018/08/30 modified for stop system enter sleep before low irq handled + Enable_irqs: +#endif /* OPLUS_FEATURE_TP_BASIC */ arch_suspend_enable_irqs(); BUG_ON(irqs_disabled()); @@ -488,14 +554,30 @@ int suspend_devices_and_enter(suspend_state_t state) int error; bool wakeup = false; + #ifndef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug if (!sleep_state_supported(state)) return -ENOSYS; + #else + if (!sleep_state_supported(state)) { + pr_info("sleep_state_supported false\n"); + return -ENOSYS; + } + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ pm_suspend_target_state = state; error = platform_suspend_begin(state); + #ifndef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug if (error) goto Close; + #else + if (error) { + pr_info("%s platform_suspend_begin fail\n", __func__); + goto Close; + } + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ suspend_console(); suspend_test_start(); @@ -507,13 +589,26 @@ int suspend_devices_and_enter(suspend_state_t state) goto Recover_platform; } suspend_test_finish("suspend devices"); + #ifndef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug if (suspend_test(TEST_DEVICES)) goto Recover_platform; + #else + if (suspend_test(TEST_DEVICES)) { + pr_info("%s TEST_DEVICES fail\n", __func__); + goto Recover_platform; + } + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ do { error = suspend_enter(state, &wakeup); } while (!error && !wakeup && platform_suspend_again(state)); + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug + pr_info("suspend_enter end, error:%d, wakeup:%d\n", error, wakeup); + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ + Resume_devices: suspend_test_start(); dpm_resume_end(PMSG_RESUME); @@ -545,6 +640,61 @@ static void suspend_finish(void) pm_restore_console(); } +#ifdef OPLUS_BUG_STABILITY +//Bin.Xu@BSP.Kernel.Stability,2020/4/11,add check-list screen on too slowly when press pwrkey +/** + * Sync the filesystem in seperate workqueue. + * Then check it finishing or not periodically and + * abort if any wakeup source comes in. That can reduce + * the wakeup latency + */ +static bool sys_sync_completed = false; +static void sys_sync_work_func(struct work_struct *work); +static DECLARE_WORK(sys_sync_work, sys_sync_work_func); +static DECLARE_WAIT_QUEUE_HEAD(sys_sync_wait); +static void sys_sync_work_func(struct work_struct *work) +{ + printk(KERN_INFO "PM: Syncing filesystems ... \n"); + sys_sync(); + sys_sync_completed = true; + wake_up(&sys_sync_wait); +} + +static int sys_sync_queue(void) +{ + int work_status = work_busy(&sys_sync_work); + + /*Check if the previous work still running.*/ + if (!(work_status & WORK_BUSY_PENDING)) { + if (work_status & WORK_BUSY_RUNNING) { + while (wait_event_timeout(sys_sync_wait, sys_sync_completed, + msecs_to_jiffies(100)) == 0) { + if (pm_wakeup_pending()) { + pr_info("PM: Pre-Syncing abort\n"); + goto abort; + } + } + pr_info("PM: Pre-Syncing done\n"); + } + sys_sync_completed = false; + schedule_work(&sys_sync_work); + } + + while (wait_event_timeout(sys_sync_wait, sys_sync_completed, + msecs_to_jiffies(100)) == 0) { + if (pm_wakeup_pending()) { + pr_info("PM: Syncing abort\n"); + goto abort; + } + } + + pr_info("PM: Syncing done\n"); + return 0; +abort: + return -EAGAIN; +} +#endif + /** * enter_state - Do common work needed to enter system sleep state. * @state: System sleep state to enter. @@ -566,14 +716,32 @@ static int enter_state(suspend_state_t state) } #endif } else if (!valid_state(state)) { + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug + pr_info("%s invalid_state\n", __func__); + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ return -EINVAL; } + + #ifndef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug if (!mutex_trylock(&pm_mutex)) return -EBUSY; + #else + if (!mutex_trylock(&pm_mutex)) { + pr_info("%s mutex_trylock fail\n", __func__); + return -EBUSY; + } + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ if (state == PM_SUSPEND_TO_IDLE) s2idle_begin(); +#ifdef OPLUS_BUG_STABILITY +//Bin.Xu@BSP.Kernel.Stability,2020/4/11,add check-list screen on too slowly when press pwrkey + if (sys_sync_queue()) + goto Unlock; +#else #ifndef CONFIG_SUSPEND_SKIP_SYNC trace_suspend_resume(TPS("sync_filesystems"), 0, true); pr_info("Syncing filesystems ... "); @@ -581,12 +749,22 @@ static int enter_state(suspend_state_t state) pr_cont("done.\n"); trace_suspend_resume(TPS("sync_filesystems"), 0, false); #endif +#endif /* VENDOR EDIT */ pm_pr_dbg("Preparing system for sleep (%s)\n", mem_sleep_labels[state]); pm_suspend_clear_flags(); error = suspend_prepare(state); + #ifndef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug if (error) goto Unlock; + #else + if (error) { + pr_info("%s suspend_prepare error:%d\n", __func__, error); + goto Unlock; + } + pr_info("%s suspend_prepare success\n", __func__); + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ if (suspend_test(TEST_FREEZER)) goto Finish; @@ -596,6 +774,10 @@ static int enter_state(suspend_state_t state) pm_restrict_gfp_mask(); error = suspend_devices_and_enter(state); pm_restore_gfp_mask(); + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG + //Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug + pr_info("%s suspend_devices_and_enter end\n", __func__); + #endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ Finish: events_check_enabled = false; @@ -613,9 +795,16 @@ static void pm_suspend_marker(char *annotation) getnstimeofday(&ts); rtc_time_to_tm(ts.tv_sec, &tm); +#ifndef OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG +//Nanwei.Deng@BSP.CHG.Basic 2018/05/03 modify for power debug pr_info("PM: suspend %s %d-%02d-%02d %02d:%02d:%02d.%09lu UTC\n", annotation, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, ts.tv_nsec); +#else + pr_err("PM: suspend %s %d-%02d-%02d %02d:%02d:%02d.%09lu UTC\n", + annotation, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec, ts.tv_nsec); +#endif /* OPLUS_FEATURE_POWERINFO_STANDBY_DEBUG */ } /** diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 4a727c8b84dc..1128e62a0331 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -59,6 +59,25 @@ #include "braille.h" #include "internal.h" +#ifdef OPLUS_FEATURE_POWERINFO_FTM +//Nanwei.Deng@BSP.CHG.Basic 2018/05/01 Add for debug console reg issue 969323*/ +#include +static bool __read_mostly printk_disable_uart = true; /*set true avoid early console output*/ +static int __init printk_uart_disabled(char *str) +{ + if (str[0] == '1') + printk_disable_uart = true; + else + printk_disable_uart = false; + return 0; +} +early_param("printk.disable_uart", printk_uart_disabled); + +bool oem_disable_uart(void) +{ + return printk_disable_uart; +} +#endif /*OPLUS_FEATURE_POWERINFO_FTM*/ #ifdef CONFIG_EARLY_PRINTK_DIRECT extern void printascii(char *); #endif @@ -591,6 +610,19 @@ static int log_store(int facility, int level, u32 size, pad_len; u16 trunc_msg_len = 0; + #ifdef OPLUS_FEATURE_CHG_BASIC + //part 1/2: yixue.ge 2015-04-22 add for add cpu number and current id and current comm to kmsg + int this_cpu = smp_processor_id(); + char tbuf[64]; + unsigned tlen; + if (console_suspended == 0) { + tlen = snprintf(tbuf, sizeof(tbuf), " (%x)[%d:%s]", + this_cpu, current->pid, current->comm); + } else { + tlen = snprintf(tbuf, sizeof(tbuf), " %x)", this_cpu); + } + text_len += tlen; + #endif //add end part 1/3 /* number of '\0' padding bytes to next message */ size = msg_used_size(text_len, dict_len, &pad_len); @@ -615,7 +647,13 @@ static int log_store(int facility, int level, /* fill message */ msg = (struct printk_log *)(log_buf + log_next_idx); + #ifndef OPLUS_FEATURE_CHG_BASIC + //part 2/2: yixue.ge 2015-04-22 add for add cpu number and current id and current comm to kmsg memcpy(log_text(msg), text, text_len); + #else + memcpy(log_text(msg), tbuf, tlen); + memcpy(log_text(msg) + tlen, text, text_len-tlen); + #endif //add end part 3/3 msg->text_len = text_len; if (trunc_msg_len) { memcpy(log_text(msg) + text_len, trunc_msg, trunc_msg_len); @@ -968,7 +1006,9 @@ static int devkmsg_open(struct inode *inode, struct file *file) if (!user) return -ENOMEM; - ratelimit_default_init(&user->rs); + /* Lijingxiang@BSP.Kernel.Debug,2020/07/17, Modify for debug kernel init */ + ratelimit_state_init(&user->rs, HZ, 300); + ratelimit_set_flags(&user->rs, RATELIMIT_MSG_ON_RELEASE); mutex_init(&user->lock); @@ -1714,6 +1754,15 @@ static void call_console_drivers(const char *ext_text, size_t ext_len, return; for_each_console(con) { +#ifdef OPLUS_FEATURE_POWERINFO_FTM +//Nanwei.Deng@BSP.CHG.Basic 2018/05/01 Add for debug console reg issue 969323*/ + if ((con->flags & CON_CONSDEV) && + (printk_disable_uart || + get_boot_mode() == MSM_BOOT_MODE__FACTORY || + get_boot_mode() == MSM_BOOT_MODE__RF || + get_boot_mode() == MSM_BOOT_MODE__WLAN)) + continue; +#endif /*VENDOR_EDIT*/ if (exclusive_console && con != exclusive_console) continue; if (!(con->flags & CON_ENABLED)) @@ -3241,6 +3290,57 @@ out: } EXPORT_SYMBOL_GPL(kmsg_dump_get_buffer); +#ifdef CONFIG_OPLUS_FEATURE_UBOOT_LOG +//BSP.kernel.stability, 2020/03/06, Add for get kernel boot log +#include +bool back_kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog, + char *buf, size_t size, size_t *len) +{ + unsigned long flags; + u64 seq; + u32 idx; + size_t l = 0; + bool ret = false; + + logbuf_lock_irqsave(flags); + if (dumper->cur_seq < log_first_seq) { + l += scnprintf(buf + l, size - l, "Lost some logs: cur_seq:%lld, log_first_seq:%lld\n", dumper->cur_seq, log_first_seq); + //messages are gone, move to first available one + dumper->cur_seq = log_first_seq; + dumper->cur_idx = log_first_idx; + } + + // last entry + if (dumper->cur_seq >= dumper->next_seq) { + logbuf_unlock_irqrestore(flags); + goto out; + } + + + // record log form cur_seq until the buf is full + seq = dumper->cur_seq; + idx = dumper->cur_idx; + while (l + LOG_LINE_MAX + PREFIX_MAX < size && seq < dumper->next_seq) { + struct printk_log *msg = log_from_idx(idx); + + l += msg_print_text(msg, syslog, buf + l, size - l); + idx = log_next(idx); + seq++; + } + dumper->cur_seq = seq; + dumper->cur_idx = idx; + + ret = true; + logbuf_unlock_irqrestore(flags); +out: + if (len) + *len = l; + return ret; +} +EXPORT_SYMBOL(back_kmsg_dump_get_buffer); +#endif + + /** * kmsg_dump_rewind_nolock - reset the interator (unlocked version) * @dumper: registered kmsg dumper diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c index 2ddaec40956f..dbea7b0cc270 100644 --- a/kernel/sched/completion.c +++ b/kernel/sched/completion.c @@ -16,6 +16,9 @@ #include #include +#ifdef CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE +#include +#endif /** * complete: - signals a single thread waiting on this completion * @x: holds the state of this particular completion @@ -82,7 +85,11 @@ do_wait_for_common(struct completion *x, __add_wait_queue_entry_tail_exclusive(&x->wait, &wait); do { +#ifdef CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE + if (signal_pending_state(state, current) || hung_long_and_fatal_signal_pending(current)) { +#else if (signal_pending_state(state, current)) { +#endif timeout = -ERESTARTSYS; break; } diff --git a/kernel/sched/core.c b/kernel/sched/core.c index b1e87f06023d..600bace15467 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -48,6 +48,11 @@ #define CREATE_TRACE_POINTS #include +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst +#include +#endif /* OPLUS_FEATURE_UIFIRST */ + DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); /* @@ -3143,6 +3148,50 @@ unsigned long long task_sched_runtime(struct task_struct *p) unsigned int capacity_margin_freq = 1280; /* ~20% margin */ +#ifdef OPLUS_FEATURE_UIFIRST +// XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/08/18, Add for UIFirst(slide boost) +extern int sysctl_frame_rate; +extern unsigned int sched_ravg_window; +extern bool ux_task_misfit(struct task_struct *p, int cpu); +u64 ux_task_load[NR_CPUS] = {0}; +u64 ux_load_ts[NR_CPUS] = {0}; +static u64 calc_freq_ux_load(struct task_struct *p, u64 wallclock) +{ + unsigned int maxtime = 0, factor = 0; + unsigned int window_size = sched_ravg_window / NSEC_PER_MSEC; + u64 timeline = 0, freq_exec_load = 0, freq_ravg_load = 0; + u64 wakeclock = p->last_wake_ts; + + if (wallclock < wakeclock) + return 0; + + switch (sysctl_frame_rate) { + case 60: + case 90: + maxtime = 5; + break; + case 120: + maxtime = 4; + break; + default: + return 0; + } + + timeline = wallclock - wakeclock; + factor = window_size / maxtime; + freq_exec_load = timeline * factor; + + if (freq_exec_load > sched_ravg_window) + freq_exec_load = sched_ravg_window; + + freq_ravg_load = (p->ravg.prev_window + p->ravg.curr_window) << 1; + if (freq_ravg_load > sched_ravg_window) + freq_ravg_load = sched_ravg_window; + + return max(freq_exec_load, freq_ravg_load); +} +#endif + /* * This function gets called by the timer code, with HZ frequency. * We call it with interrupts disabled. @@ -3176,7 +3225,24 @@ void scheduler_tick(void) early_notif = early_detection_notify(rq, wallclock); if (early_notif) flag = SCHED_CPUFREQ_WALT | SCHED_CPUFREQ_EARLY_DET; - + #ifdef OPLUS_FEATURE_UIFIRST + // XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/08/18, Add for UIFirst(slide boost) + if (sysctl_uifirst_enabled && sysctl_slide_boost_enabled) { + if(rq->curr && rq->curr->static_ux == 2 && !ux_task_misfit(rq->curr, cpu)) { + ux_task_load[cpu] = calc_freq_ux_load(rq->curr, wallclock); + ux_load_ts[cpu] = wallclock; + flag |= (SCHED_CPUFREQ_WALT | SCHED_CPUFREQ_BOOST); + } + else if (ux_task_load[cpu] != 0) { + ux_task_load[cpu] = 0; + ux_load_ts[cpu] = wallclock; + flag |= (SCHED_CPUFREQ_WALT | SCHED_CPUFREQ_RESET); + } + } else { + ux_task_load[cpu] = 0; + ux_load_ts[cpu] = 0; + } + #endif cpufreq_update_util(rq, flag); rq_unlock(rq, &rf); @@ -3546,6 +3612,11 @@ static void __sched notrace __schedule(bool preempt) switch_count = &prev->nvcsw; } +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + prev->enqueue_time = rq->clock; +#endif /* OPLUS_FEATURE_UIFIRST */ + next = pick_next_task(rq, prev, &rf); clear_tsk_need_resched(prev); clear_preempt_need_resched(); @@ -6344,6 +6415,10 @@ void __init sched_init_smp(void) sched_init_granularity(); free_cpumask_var(non_isolated_cpus); +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + ux_init_cpu_data(); +#endif /* OPLUS_FEATURE_UIFIRST */ init_sched_rt_class(); init_sched_dl_class(); @@ -6463,6 +6538,10 @@ void __init sched_init(void) init_cfs_rq(&rq->cfs); init_rt_rq(&rq->rt); init_dl_rq(&rq->dl); +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + ux_init_rq_data(rq); +#endif /* OPLUS_FEATURE_UIFIRST */ #ifdef CONFIG_FAIR_GROUP_SCHED root_task_group.shares = ROOT_TASK_GROUP_LOAD; INIT_LIST_HEAD(&rq->leaf_cfs_rq_list); @@ -7581,3 +7660,10 @@ void sched_exit(struct task_struct *p) #endif /* CONFIG_SCHED_WALT */ __read_mostly bool sched_predl = 1; +#ifdef OPLUS_BUG_STABILITY +/*fanhui@PhoneSW.BSP, 2016-06-23, get current task on one cpu*/ +struct task_struct *oppo_get_cpu_task(int cpu) +{ + return cpu_curr(cpu); +} +#endif diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 78159f1d5df0..d2e885d978b9 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -60,6 +60,10 @@ struct sugov_policy { bool work_in_progress; bool need_freq_update; +#ifdef OPLUS_FEATURE_UIFIRST + // XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/08/18, Add for UIFirst(slide boost) + unsigned int flags; +#endif }; struct sugov_cpu { @@ -130,6 +134,11 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time) * to the separate rate limits. */ +#ifdef OPLUS_FEATURE_UIFIRST + // XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/08/18, Add for UIFirst(slide boost) + if (sg_policy->flags & SCHED_CPUFREQ_BOOST) + return true; +#endif delta_ns = time - sg_policy->last_freq_update_time; return delta_ns >= sg_policy->min_rate_limit_ns; } @@ -141,6 +150,12 @@ static bool sugov_up_down_rate_limit(struct sugov_policy *sg_policy, u64 time, delta_ns = time - sg_policy->last_freq_update_time; +#ifdef OPLUS_FEATURE_UIFIRST + // XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/08/18, Add for UIFirst(slide boost) + if (sg_policy->flags & SCHED_CPUFREQ_BOOST) + return false; +#endif + if (next_freq > sg_policy->next_freq && delta_ns < sg_policy->up_rate_delay_ns) return true; @@ -426,7 +441,10 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, flags &= ~SCHED_CPUFREQ_RT_DL; sugov_set_iowait_boost(sg_cpu, time, flags); sg_cpu->last_update = time; - +#ifdef OPLUS_FEATURE_UIFIRST + // XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/08/18, Add for UIFirst(slide boost) + sg_policy->flags = flags; +#endif if (!sugov_should_update_freq(sg_policy, time)) return; @@ -563,7 +581,10 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time, trace_sugov_util_update(sg_cpu->cpu, sg_cpu->util, sg_policy->avg_cap, max, sg_cpu->walt_load.nl, sg_cpu->walt_load.pl, flags); - +#ifdef OPLUS_FEATURE_UIFIRST + // XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/08/18, Add for UIFirst(slide boost) + sg_policy->flags = flags; +#endif if (sugov_should_update_freq(sg_policy, time) && !(flags & SCHED_CPUFREQ_CONTINUE)) { if (flags & SCHED_CPUFREQ_RT_DL) @@ -1039,7 +1060,10 @@ static int sugov_start(struct cpufreq_policy *policy) sg_policy->work_in_progress = false; sg_policy->need_freq_update = false; sg_policy->cached_raw_freq = 0; - +#ifdef OPLUS_FEATURE_UIFIRST + // XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/08/18, Add for UIFirst(slide boost) + sg_policy->flags = 0; +#endif for_each_cpu(cpu, policy->cpus) { struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu); diff --git a/kernel/sched/cpupri.c b/kernel/sched/cpupri.c index 7c57a25fb3e4..72b13562ddf8 100644 --- a/kernel/sched/cpupri.c +++ b/kernel/sched/cpupri.c @@ -73,6 +73,10 @@ drop_nopreempt_cpus(struct cpumask *lowest_mask) } } +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/06/15, Add for UIFirst +extern void drop_ux_task_cpus(struct task_struct *p, struct cpumask *lowest_mask); +#endif /* OPLUS_FEATURE_UIFIRST */ /** * cpupri_find - find the best (lowest-pri) CPU in the system * @cp: The cpupri context @@ -94,7 +98,10 @@ int cpupri_find(struct cpupri *cp, struct task_struct *p, int idx = 0; int task_pri = convert_prio(p->prio); bool drop_nopreempts = task_pri <= MAX_RT_PRIO; - +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/06/15, Add for UIFirst + bool drop_uxtasks = sysctl_uifirst_enabled; +#endif /* OPLUS_FEATURE_UIFIRST */ BUG_ON(task_pri >= CPUPRI_NR_PRIORITIES); retry: @@ -137,6 +144,11 @@ retry: cpu_isolated_mask); if (drop_nopreempts) drop_nopreempt_cpus(lowest_mask); +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/06/15, Add for UIFirst + if (drop_uxtasks) + drop_ux_task_cpus(p, lowest_mask); +#endif /* OPLUS_FEATURE_UIFIRST */ /* * We have to ensure that we have at least one bit * still set in the array, since the map could have @@ -159,6 +171,14 @@ retry: drop_nopreempts = false; goto retry; } +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/06/15, Add for UIFirst + if (drop_uxtasks) { + drop_uxtasks = false; + goto retry; + } +#endif /* OPLUS_FEATURE_UIFIRST */ + return 0; } diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 63b887b27e84..2428d95faa79 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -40,6 +40,33 @@ #include "tune.h" #include "walt.h" +#ifdef OPLUS_FEATURE_UIFIRST +// Liujie.Xie@TECH.Kernel.Sched, 2020/02/26, add for heavy load task +#include +#endif +#ifdef OPLUS_FEATURE_UIFIRST +// XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/08/18, Add for UIFirst(slide boost) +extern unsigned int walt_scale_demand_divisor; +bool ux_task_misfit(struct task_struct *p, int cpu); +#define scale_demand(d) ((d)/walt_scale_demand_divisor) +#endif /* OPLUS_FEATURE_UIFIRST */ +#ifdef OPLUS_FEATURE_HEALTHINFO +// wenbin.liu@PSW.BSP.MM, 2018/05/02 +// Add for get cpu load +#ifdef CONFIG_OPPO_HEALTHINFO +#include +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ + +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst +#include +#endif /* OPLUS_FEATURE_UIFIRST */ + +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) +#include +#endif /*OPLUS_FEATURE_IOMONITOR*/ + #ifdef CONFIG_SMP static inline bool task_fits_max(struct task_struct *p, int cpu); #endif /* CONFIG_SMP */ @@ -893,6 +920,12 @@ static void update_tg_load_avg(struct cfs_rq *cfs_rq, int force) } #endif /* CONFIG_SMP */ +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO +extern void update_jank_trace_info(struct task_struct *tsk, int trace_type, unsigned int cpu, u64 delta); +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ /* * Update the current task's runtime statistics. */ @@ -926,6 +959,12 @@ static void update_curr(struct cfs_rq *cfs_rq) trace_sched_stat_runtime(curtask, delta_exec, curr->vruntime); cpuacct_charge(curtask, delta_exec); account_group_exec_runtime(curtask, delta_exec); +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + update_jank_trace_info(curtask, JANK_TRACE_RUNNING, cpu_of(rq_of(cfs_rq)), delta_exec); +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ } account_cfs_rq_runtime(cfs_rq, delta_exec); @@ -977,6 +1016,19 @@ update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se) return; } trace_sched_stat_wait(p, delta); +#ifdef OPLUS_FEATURE_HEALTHINFO +// wenbin.liu@PSW.BSP.MM, 2018/05/26 +// Add for get sched latency stat +#ifdef CONFIG_OPPO_HEALTHINFO + ohm_schedstats_record(OHM_SCHED_SCHEDLATENCY, p, (delta >> 20)); +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + update_jank_trace_info(p, JANK_TRACE_RUNNABLE, 0, delta); +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ } schedstat_set(se->statistics.wait_max, @@ -1016,6 +1068,12 @@ update_stats_enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se) if (tsk) { account_scheduler_latency(tsk, delta >> 10, 1); trace_sched_stat_sleep(tsk, delta); +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + update_jank_trace_info(tsk, JANK_TRACE_SSTATE, 0, delta); +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ } } if (block_start) { @@ -1035,8 +1093,31 @@ update_stats_enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se) schedstat_add(se->statistics.iowait_sum, delta); schedstat_inc(se->statistics.iowait_count); trace_sched_stat_iowait(tsk, delta); +#ifdef OPLUS_FEATURE_HEALTHINFO +// wenbin.liu@PSW.BSP.MM, 2018/05/09 +// Add for get iowait +#ifdef CONFIG_OPPO_HEALTHINFO + ohm_schedstats_record(OHM_SCHED_IOWAIT, tsk, (delta >> 20)); +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ +#if defined(OPLUS_FEATURE_IOMONITOR) && defined(CONFIG_IOMONITOR) + iomonitor_record_iowait(tsk, (delta >> 20)); +#endif /*OPLUS_FEATURE_IOMONITOR*/ } - +#ifdef OPLUS_FEATURE_HEALTHINFO +// Jiheng,Xie@TECH.BSP.Performance, 2019/05/18,add for get dstate statictics +#ifdef CONFIG_OPPO_HEALTHINFO + if(!tsk->in_iowait) { + ohm_schedstats_record(OHM_SCHED_DSTATE, tsk, (delta >> 20)); + } +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ +#ifdef OPLUS_FEATURE_HEALTHINFO +// Liujie.Xie@TECH.Kernel.Sched, 2019/08/29, add for jank monitor +#ifdef CONFIG_OPPO_JANK_INFO + update_jank_trace_info(tsk, JANK_TRACE_DSTATE, 0, delta); +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ trace_sched_stat_blocked(tsk, delta); trace_sched_blocked_reason(tsk); @@ -4179,6 +4260,12 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr) ideal_runtime = sched_slice(cfs_rq, curr); delta_exec = curr->sum_exec_runtime - curr->prev_sum_exec_runtime; +#ifdef OPLUS_FEATURE_UIFIRST + // Liujie.Xie@TECH.Kernel.Sched, 2020/02/26, add for heavy load task + if (is_heavy_load_task(current)) + ideal_runtime = HEAVY_LOAD_RUNTIME; +#endif + if (delta_exec > ideal_runtime) { resched_curr(rq_of(cfs_rq)); /* @@ -4188,6 +4275,11 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr) clear_buddies(cfs_rq, curr); return; } +#ifdef OPLUS_FEATURE_UIFIRST + // Liujie.Xie@TECH.Kernel.Sched, 2020/02/26, add for heavy load task + if (is_heavy_load_task(current)) + return; +#endif /* * Ensure that a task that missed wakeup preemption by a @@ -5323,6 +5415,12 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags) flags = ENQUEUE_WAKEUP; } +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled) { + enqueue_ux_thread(rq, p); + } +#endif /* OPLUS_FEATURE_UIFIRST */ for_each_sched_entity(se) { cfs_rq = cfs_rq_of(se); @@ -5396,6 +5494,12 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags) } flags |= DEQUEUE_SLEEP; } +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled) { + dequeue_ux_thread(rq, p); + } +#endif /* OPLUS_FEATURE_UIFIRST */ for_each_sched_entity(se) { cfs_rq = cfs_rq_of(se); @@ -7343,6 +7447,7 @@ struct find_best_target_env { bool need_idle; int fastpath; int skip_cpu; + bool strict_max; }; static bool is_packing_eligible(struct task_struct *p, int target_cpu, @@ -7382,7 +7487,15 @@ static int start_cpu(struct task_struct *p, bool boosted, { struct root_domain *rd = cpu_rq(smp_processor_id())->rd; int start_cpu = -1; - +#ifdef OPLUS_FEATURE_UIFIRST + // XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/08/03, Add for UIfirst (slide boost) + if (sysctl_uifirst_enabled && sysctl_slide_boost_enabled && p->static_ux == 2 && + (task_util(p) >= sysctl_boost_task_threshold || + scale_demand(p->ravg.sum) >= sysctl_boost_task_threshold)) { + start_cpu = rd->mid_cap_orig_cpu == -1 ? + rd->max_cap_orig_cpu : rd->mid_cap_orig_cpu; + } +#endif if (boosted) { if (rd->mid_cap_orig_cpu != -1 && task_fits_max(p, rd->mid_cap_orig_cpu)) @@ -7390,6 +7503,12 @@ static int start_cpu(struct task_struct *p, bool boosted, return rd->max_cap_orig_cpu; } +#ifdef OPLUS_FEATURE_UIFIRST + // Liujie.Xie@TECH.Kernel.Sched, 2020/02/26, add for heavy load task + if (sysctl_cpu_multi_thread && !is_heavy_load_task(p)) + return rd->min_cap_orig_cpu; +#endif + /* A task always fits on its rtg_target */ if (rtg_target) { int rtg_target_cpu = cpumask_first_and(rtg_target, @@ -7444,7 +7563,7 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu, int prev_cpu = task_cpu(p); bool next_group_higher_cap = false; int isolated_candidate = -1; - + struct rq *prev_cpu_rq = cpu_rq(prev_cpu); *backup_cpu = -1; /* @@ -7459,6 +7578,13 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu, if (prefer_idle && boosted) target_capacity = 0; +#ifdef OPLUS_FEATURE_UIFIRST +// Liujie.Xie@TECH.Kernel.Sched, 2020/02/26, add for heavy load task + if (fbt_env->strict_max || p->in_iowait ||(sysctl_cpu_multi_thread && !is_heavy_load_task(p))) +#else + if (fbt_env->strict_max) +#endif + most_spare_wake_cap = LONG_MIN; /* Find start CPU based on boost value */ cpu = start_cpu(p, boosted, fbt_env->rtg_target); if (cpu < 0) @@ -7468,7 +7594,11 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu, sd = rcu_dereference(per_cpu(sd_ea, cpu)); if (!sd) return -1; - + if (!cpu_isolated(prev_cpu) && cpu_online(prev_cpu) && sysctl_slide_boost_enabled && test_dynamic_ux(p, DYNAMIC_UX_BINDER) + && (prev_cpu_rq->curr->sched_class != &rt_sched_class || !test_task_ux(prev_cpu_rq->curr) )){ + target_cpu = prev_cpu; + goto out; + } /* fast path for prev_cpu */ if ((capacity_orig_of(prev_cpu) == capacity_orig_of(cpu)) && !cpu_isolated(prev_cpu) && cpu_online(prev_cpu) && @@ -7504,6 +7634,22 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu, if (!cpu_online(i) || cpu_isolated(i)) continue; +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/06/15, Add for UIFirst + if (sysctl_uifirst_enabled && test_task_ux(p)) { + if (sysctl_launcher_boost_enabled && is_heavy_ux_task(p) && !test_ux_task_cpu(i)) + continue; + + if (!sysctl_launcher_boost_enabled || !is_heavy_ux_task(p)) { + if (cpu_rq(i)->rt.rt_nr_running) + continue; + + if (!list_empty(&cpu_rq(i)->ux_thread_list)) + continue; + } + } +#endif /* OPLUS_FEATURE_UIFIRST */ + if (isolated_candidate == -1) isolated_candidate = i; /* @@ -7533,6 +7679,14 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu, most_spare_wake_cap = spare_wake_cap; most_spare_cap_cpu = i; } +#ifdef OPLUS_FEATURE_UIFIRST + // Liujie.Xie@TECH.Kernel.Sched, 2020/02/26, add for heavy load task + else if (spare_wake_cap == most_spare_wake_cap && sysctl_cpu_multi_thread + && !is_heavy_load_task(p) + && cpu_rq(i)->nr_running < cpu_rq(most_spare_cap_cpu)->nr_running) { + most_spare_cap_cpu = i; + } +#endif /* * Cumulative demand may already be accounting for the @@ -7764,6 +7918,8 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu, next_group_higher_cap = (capacity_orig_of(group_first_cpu(sg)) < capacity_orig_of(group_first_cpu(sg->next))); + if (p->in_iowait && !next_group_higher_cap && most_spare_cap_cpu != -1) + break; /* * If we've found a cpu, but the boost is ON_ALL we continue * visiting other clusters. If the boost is ON_BIG we visit @@ -7795,6 +7951,14 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu, break; } } +#ifdef OPLUS_FEATURE_UIFIRST + // Liujie.Xie@TECH.Kernel.Sched, 2020/02/26, add for heavy load task + if (sysctl_cpu_multi_thread && !is_heavy_load_task(p) + && next_group_higher_cap + && (best_idle_cpu != -1 || target_cpu != -1 || most_spare_cap_cpu != -1)) { + break; + } +#endif } while (sg = sg->next, sg != sd->groups); @@ -8142,6 +8306,7 @@ static int find_energy_efficient_cpu(struct sched_domain *sd, goto out; } + /* prepopulate energy diff environment */ eenv = get_eenv(p, prev_cpu); if (eenv->max_cpu_count < 2) @@ -8248,6 +8413,20 @@ out: if (target_cpu < 0) target_cpu = prev_cpu; +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled && sysctl_launcher_boost_enabled && + !fbt_env.fastpath && is_heavy_ux_task(p) && !test_ux_prefer_cpu(p, target_cpu)) { + find_ux_task_cpu(p, &target_cpu); + } +#endif /* OPLUS_FEATURE_UIFIRST */ +#ifdef OPLUS_FEATURE_UIFIRST +// XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/06/23, Add for UIFirst(sldie boost) + if (sysctl_uifirst_enabled && sysctl_slide_boost_enabled && + p->static_ux == 2 && ux_task_misfit(p, cpu)) { + find_ux_task_cpu(p, &target_cpu); + } +#endif /* OPLUS_FEATURE_UIFIRST */ trace_sched_task_util(p, next_cpu, backup_cpu, target_cpu, sync, need_idle, fbt_env.fastpath, placement_boost, rtg_target ? cpumask_first(rtg_target) : -1, start_t, @@ -8580,6 +8759,11 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_ if (unlikely(se == pse)) return; +#ifdef OPLUS_FEATURE_UIFIRST + // Liujie.Xie@TECH.Kernel.Sched, 2020/02/26, add for heavy load task + if (is_heavy_load_task(current)) + return; +#endif /* * This is possible from callers such as attach_tasks(), in which we @@ -8623,6 +8807,12 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_ find_matching_se(&se, &pse); update_curr(cfs_rq_of(se)); BUG_ON(!pse); +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled && test_task_ux(p) && !test_task_ux(curr)) { + goto preempt; + } +#endif /* OPLUS_FEATURE_UIFIRST */ if (wakeup_preempt_entity(se, pse) == 1) { /* * Bias pick_next to pick the sched entity that is @@ -8660,6 +8850,10 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf struct sched_entity *se; struct task_struct *p; int new_tasks; +#ifdef OPLUS_FEATURE_UIFIRST + // Liujie.Xie@TECH.Kernel.Sched, 2020/02/26, add for heavy load task + struct task_struct *pos; +#endif again: if (!cfs_rq->nr_running) @@ -8713,6 +8907,12 @@ again: } while (cfs_rq); p = task_of(se); +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled) { + pick_ux_thread(rq, &p, &se); + } +#endif /* OPLUS_FEATURE_UIFIRST */ /* * Since we haven't yet done put_prev_entity and if the selected task @@ -8753,11 +8953,25 @@ simple: do { se = pick_next_entity(cfs_rq, NULL); +#ifndef OPLUS_FEATURE_UIFIRST +// caichen@TECH.Kernel.Sched, 2019/03/10, add for heavy load task set_next_entity(cfs_rq, se); +#endif cfs_rq = group_cfs_rq(se); } while (cfs_rq); p = task_of(se); +#ifdef OPLUS_FEATURE_UIFIRST + // caichen@TECH.Kernel.Sched, 2020/03/10, add for heavy load task + pos = list_first_entry(&rq->cfs_tasks, typeof(*pos), se.group_node); + if (sysctl_cpu_multi_thread && is_heavy_load_task(pos) && p != pos) { + p = pos; + se = &p->se; + } + for_each_sched_entity(se) { + set_next_entity(cfs_rq_of(se), se); + } +#endif if (hrtick_enabled(rq)) hrtick_start_fair(rq, p); @@ -9127,6 +9341,10 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env) if (throttled_lb_pair(task_group(p), env->src_cpu, env->dst_cpu)) return 0; + if (p->in_iowait && is_min_capacity_cpu(env->dst_cpu) && + !is_min_capacity_cpu(env->src_cpu)) + return 0; + if (!cpumask_test_cpu(env->dst_cpu, &p->cpus_allowed)) { int cpu; @@ -9319,15 +9537,18 @@ redo: if (!can_migrate_task(p, env)) goto next; - /* - * Depending of the number of CPUs and tasks and the - * cgroup hierarchy, task_h_load() can return a null - * value. Make sure that env->imbalance decreases - * otherwise detach_tasks() will stop only after - * detaching up to loop_max tasks. - */ - load = max_t(unsigned long, task_h_load(p), 1); +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled && test_task_ux(p)) { + if (sysctl_launcher_boost_enabled && is_heavy_ux_task(p) && test_ux_task_cpu(task_cpu(p)) && + !test_ux_task_cpu(env->dst_cpu)) + goto next; + if ((!sysctl_launcher_boost_enabled || is_heavy_ux_task(p)) && !list_empty(&env->dst_rq->ux_thread_list)) + goto next; + } +#endif /* OPLUS_FEATURE_UIFIRST */ + load = max_t(unsigned long, task_h_load(p), 1); if (sched_feat(LB_MIN) && load < 16 && !env->sd->nr_balance_failed) goto next; @@ -13051,6 +13272,18 @@ static inline void walt_check_for_rotation(struct rq *rq) { } #endif +#ifdef OPLUS_FEATURE_UIFIRST + // XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/08/18, Add for UIFirst(slide boost) +bool ux_task_misfit(struct task_struct *p, int cpu) +{ + int num_mincpu = cpumask_weight(topology_core_cpumask(0)); + if ((scale_demand(p->ravg.sum) >= sysctl_boost_task_threshold || + task_util(p) >= sysctl_boost_task_threshold) && cpu < num_mincpu) + return true; + + return false; +} +#endif static DEFINE_RAW_SPINLOCK(migration_lock); void check_for_migration(struct rq *rq, struct task_struct *p) @@ -13061,7 +13294,13 @@ void check_for_migration(struct rq *rq, struct task_struct *p) int prev_cpu = task_cpu(p); struct sched_domain *sd = NULL; + #ifdef OPLUS_FEATURE_UIFIRST + // XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/08/03, Add for UIfirst (slide boost) + if (rq->misfit_task_load || (sysctl_uifirst_enabled && sysctl_slide_boost_enabled && + p->static_ux == 2 && ux_task_misfit(p, prev_cpu))) { + #else if (rq->misfit_task_load) { + #endif if (rq->curr->state != TASK_RUNNING || rq->curr->nr_cpus_allowed == 1) return; diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index aab08251e8db..0fe851a1a140 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -1477,7 +1477,10 @@ task_may_not_preempt(struct task_struct *task, int cpu) (task == cpu_ksoftirqd || task_thread_info(task)->preempt_count & SOFTIRQ_MASK)); } - +#if defined (CONFIG_SCHED_WALT) && defined (OPLUS_FEATURE_UIFIRST) +extern bool is_sf(struct task_struct *p); +extern sysctl_slide_boost_enabled; +#endif static int select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags, int sibling_count_hint) @@ -1546,7 +1549,11 @@ select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags, cpu = target; } rcu_read_unlock(); - +#if defined (CONFIG_SCHED_WALT) && defined (OPLUS_FEATURE_UIFIRST) + if (sysctl_slide_boost_enabled == 2 && is_sf(p) && cpu != -1) { + return cpu; + } +#endif out: return cpu; } diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index dc63c7ae9e73..2704a491b31b 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -957,6 +957,10 @@ struct rq { struct cpuidle_state *idle_state; int idle_state_idx; #endif +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + struct list_head ux_thread_list; +#endif /* OPLUS_FEATURE_UIFIRST */ }; static inline int cpu_of(struct rq *rq) diff --git a/kernel/sched/tune.c b/kernel/sched/tune.c index 5670542c774e..55a7c31f842c 100644 --- a/kernel/sched/tune.c +++ b/kernel/sched/tune.c @@ -553,6 +553,10 @@ int schedtune_cpu_boost(int cpu) return bg->boost_max; } +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst +extern bool test_task_ux(struct task_struct *task); +#endif /* OPLUS_FEATURE_UIFIRST */ int schedtune_task_boost(struct task_struct *p) { struct schedtune *st; @@ -565,6 +569,12 @@ int schedtune_task_boost(struct task_struct *p) rcu_read_lock(); st = task_schedtune(p); task_boost = st->boost; +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/06/15, Add for UIFirst + if (sysctl_uifirst_enabled && sysctl_launcher_boost_enabled && p->static_ux == 2) { + task_boost = 60; + } +#endif /* OPLUS_FEATURE_UIFIRST */ rcu_read_unlock(); return task_boost; @@ -582,6 +592,12 @@ int schedtune_prefer_idle(struct task_struct *p) rcu_read_lock(); st = task_schedtune(p); prefer_idle = st->prefer_idle; +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + if (sysctl_uifirst_enabled && sysctl_launcher_boost_enabled && test_task_ux(p)) { + prefer_idle = 1; + } +#endif /* OPLUS_FEATURE_UIFIRST */ rcu_read_unlock(); return prefer_idle; diff --git a/kernel/sched/walt.c b/kernel/sched/walt.c index be19e3b0c25d..aaf55d581134 100644 --- a/kernel/sched/walt.c +++ b/kernel/sched/walt.c @@ -30,7 +30,17 @@ #include "walt.h" #include - +#ifdef OPLUS_FEATURE_UIFIRST +// XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/06/23, Add for UIFirst(sldie boost) +#include +#endif +#ifdef OPLUS_FEATURE_UIFIRST +// XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/08/03, Add for UIFirst(slide boost) +#include +extern u64 ux_task_load[]; +extern u64 ux_load_ts[]; +#define UX_LOAD_WINDOW 8000000 +#endif /* OPLUS_FEATURE_UIFIRST */ const char *task_event_names[] = {"PUT_PREV_TASK", "PICK_NEXT_TASK", "TASK_WAKE", "TASK_MIGRATE", "TASK_UPDATE", "IRQ_UPDATE"}; @@ -515,7 +525,12 @@ u64 freq_policy_load(struct rq *rq) u64 aggr_grp_load = cluster->aggr_grp_load; u64 load, tt_load = 0; u64 coloc_boost_load = cluster->coloc_boost_load; - +#ifdef OPLUS_FEATURE_UIFIRST + // XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/08/18, Add for UIFirst(slide boost) + u64 wallclock = sched_ktime_clock(); + u64 timeline = 0; + int cpu = cpu_of(rq); +#endif /* OPLUS_FEATURE_UIFIRST */ if (rq->ed_task != NULL) { load = sched_ravg_window; goto done; @@ -542,6 +557,15 @@ u64 freq_policy_load(struct rq *rq) default: break; } +#ifdef OPLUS_FEATURE_UIFIRST + // XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/08/18, Add for UIFirst(slide boost) + if (sysctl_uifirst_enabled && sysctl_slide_boost_enabled && ux_load_ts[cpu]) { + timeline = wallclock - ux_load_ts[cpu]; + if (timeline >= UX_LOAD_WINDOW) + ux_task_load[cpu] = 0; + load = max_t(u64, load, ux_task_load[cpu]); + } +#endif /* OPLUS_FEATURE_UIFIRST */ done: trace_sched_load_to_gov(rq, aggr_grp_load, tt_load, sched_freq_aggr_en, @@ -774,6 +798,25 @@ migrate_top_tasks(struct task_struct *p, struct rq *src_rq, struct rq *dst_rq) } } +#ifdef OPLUS_FEATURE_EDTASK_IMPROVE +/* Chuck.Huang@Power.basic, 2020-09-03, Add for improving ed task migration */ +void migrate_ed_task(struct task_struct *p, u64 wallclock, + struct rq *src_rq, struct rq *dest_rq) +{ + int src_cpu = cpu_of(src_rq); + int dest_cpu = cpu_of(dest_rq); + + /* For ed task, reset last_wake_ts if task migrate to faster cpu */ + if (capacity_orig_of(src_cpu) < capacity_orig_of(dest_cpu)) { + p->last_wake_ts = wallclock; + if(dest_rq->ed_task == p) { + dest_rq->ed_task = NULL; + } + } +} +extern int sysctl_ed_task_enabled; +#endif + void fixup_busy_time(struct task_struct *p, int new_cpu) { struct rq *src_rq = task_rq(p); @@ -892,6 +935,13 @@ void fixup_busy_time(struct task_struct *p, int new_cpu) } } +#ifdef OPLUS_FEATURE_EDTASK_IMPROVE +/* Chuck.Huang@Power.basic, 2020-09-03, Add for improving ed task migration */ + if (sysctl_ed_task_enabled) { + migrate_ed_task(p, wallclock, src_rq, dest_rq); + } +#endif + done: if (p->state == TASK_WAKING) double_rq_unlock(src_rq, dest_rq); diff --git a/kernel/signal.c b/kernel/signal.c index a067e2c8942b..c76f94435316 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -54,6 +54,10 @@ #include #include #include "audit.h" /* audit_signal_info() */ +#ifdef OPLUS_FEATURE_HANS_FREEZE +// Kun.Zhou@AD.RESCONTROL, 2019/09/23, add for hans freeze manager +#include +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ /* * SLAB caches for signal bits. @@ -1218,6 +1222,25 @@ int do_send_sig_info(int sig, struct siginfo *info, struct task_struct *p, unsigned long flags; int ret = -ESRCH; +#ifdef OPLUS_FEATURE_HANS_FREEZE +//#Kun.Zhou@ANDROID.RESCONTROL, 2019/09/23, add for hans freeze manager + if (is_frozen_tg(p) /*signal receiver thread group is frozen?*/ + && (sig == SIGKILL || sig == SIGTERM || sig == SIGABRT || sig == SIGQUIT)) { + if (hans_report(SIGNAL, task_tgid_nr(current), task_uid(current).val, task_tgid_nr(p), task_uid(p).val, "signal", -1) == HANS_ERROR) { + printk(KERN_ERR "HANS: report signal-freeze failed, sig = %d, caller = %d, target_uid = %d\n", sig, task_tgid_nr(current), task_uid(p).val); + } + } +#endif /*OPLUS_FEATURE_HANS_FREEZE*/ + +#if defined(CONFIG_CFS_BANDWIDTH) + if (is_belong_cpugrp(p) /*signal receiver thread group is cpuctl?*/ + && (sig == SIGKILL || sig == SIGTERM || sig == SIGABRT || sig == SIGQUIT)) { + if (hans_report(SIGNAL, task_tgid_nr(current), task_uid(current).val, task_tgid_nr(p), task_uid(p).val, "signal", -1) == HANS_ERROR) { + printk(KERN_ERR "HANS: report signal-cpuctl failed, sig = %d, caller = %d, target_uid = %d\n", sig, task_tgid_nr(current), task_uid(p).val); + } + } +#endif + if (lock_task_sighand(p, &flags)) { ret = send_signal(sig, info, p, group); unlock_task_sighand(p, &flags); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index f0e34bec38cd..b774b30cf813 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -94,9 +94,15 @@ #ifdef CONFIG_LOCKUP_DETECTOR #include #endif - +#if defined(OPLUS_FEATURE_MULTI_KSWAPD) && defined(CONFIG_OPLUS_MULTI_KSWAPD) +#include +#endif /*OPLUS_FEATURE_MULTI_KSWAPD*/ #if defined(CONFIG_SYSCTL) +#if defined(CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE) && defined(CONFIG_OPLUS_FEATURE_DEATH_HEALER) +#include +#endif + /* External variables not in a header file. */ extern int suid_dumpable; #ifdef CONFIG_COREDUMP @@ -131,10 +137,30 @@ static unsigned long zero_ul; static unsigned long one_ul = 1; static unsigned long long_max = LONG_MAX; static int one_hundred = 100; +#if defined(OPLUS_FEATURE_ZRAM_OPT) && defined(CONFIG_OPLUS_ZRAM_OPT) +extern int direct_vm_swappiness; +static int two_hundred = 200; +#endif /*OPLUS_FEATURE_ZRAM_OPT*/ + +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ +unsigned int sysctl_fg_io_opt = 1; +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ + +#ifdef OPLUS_FEATURE_EDTASK_IMPROVE +/* Chuck.Huang@Power.basic, 2020-09-03, Add for improving ed task migration */ +int sysctl_ed_task_enabled = 1; +#endif + static int one_thousand = 1000; #ifdef CONFIG_SCHED_WALT static int two_million = 2000000; #endif +#ifdef CONFIG_OPLUS_FEATURE_PANIC_FLUSH +unsigned int sysctl_ext4_fsync_enable = 1; +unsigned int ext4_fsync_enable_status = 0; +unsigned long sysctl_blkdev_issue_flush_count = 0; +#endif /*CONFIG_OPLUS_FEATURE_PANIC_FLUSH*/ #ifdef CONFIG_PRINTK static int ten_thousand = 10000; #endif @@ -305,10 +331,41 @@ static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1; #endif /* CONFIG_SMP */ #endif /* CONFIG_SCHED_DEBUG */ +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst +int sysctl_uifirst_enabled = 1; +int sysctl_launcher_boost_enabled = 0; +#endif /* OPLUS_FEATURE_UIFIRST */ + +#ifdef OPLUS_FEATURE_UIFIRST +// Liujie.Xie@TECH.Kernel.Sched, 2020/02/26, add for heavy load task +int sysctl_cpu_multi_thread = 0; +#endif + #ifdef CONFIG_COMPACTION static int min_extfrag_threshold; static int max_extfrag_threshold = 1000; #endif +#ifdef OPLUS_FEATURE_UIFIRST +// XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/06/23, Add for UIFirst(sldie boost) +int sysctl_slide_boost_enabled = 0; +int sysctl_boost_task_threshold = 51; +#ifdef CONFIG_CAMERA_OPT +int sysctl_camera_opt_enabled = 0; +#endif +int sysctl_frame_rate = 60; +int sched_frame_rate_handler(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) +{ + int ret; + + if (write && *ppos) + *ppos = 0; + + ret = proc_dointvec(table, write, buffer, lenp, ppos); + + return ret; +} +#endif /* OPLUS_FEATURE_UIFIRST */ static struct ctl_table kern_table[] = { { @@ -440,6 +497,46 @@ static struct ctl_table kern_table[] = { .mode = 0644, .proc_handler = sched_updown_migrate_handler, }, +#if defined(OPLUS_FEATURE_FG_IO_OPT) && defined(CONFIG_OPPO_FG_IO_OPT) +/*Huacai.Zhou@Tech.Kernel.MM, 2020-03-23,add foreground io opt*/ + { + .procname = "fg_io_opt", + .data = &sysctl_fg_io_opt, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec, + }, +#endif /*OPLUS_FEATURE_FG_IO_OPT*/ +#ifdef OPLUS_FEATURE_EDTASK_IMPROVE +/* Chuck.Huang@Power.basic, 2020-09-03, Add for improving ed task migration */ + { + .procname = "ed_task_enabled", + .data = &sysctl_ed_task_enabled, + .maxlen = sizeof(int), + .mode = 0666, + .proc_handler = proc_dointvec, + }, +#endif +#ifdef CONFIG_OPLUS_FEATURE_PANIC_FLUSH +/*jason.tang@TECH.BSP.Kernel.Storage, 2019-05-20, add control ext4 fsync*/ +{ + .procname = "ext4_fsync_enable", + .data = &sysctl_ext4_fsync_enable, + .maxlen = sizeof(unsigned int), + .mode = 0666, + .proc_handler = proc_dointvec, +}, +#endif +#ifdef CONFIG_OPLUS_FEATURE_PANIC_FLUSH +/*jason.tang@TECH.BSP.Kernel.Storage, 2019-05-20, add to count flush*/ +{ + .procname = "blkdev_issue_flush_count", + .data = &sysctl_blkdev_issue_flush_count, + .maxlen = sizeof(unsigned long), + .mode = 0644, + .proc_handler = proc_dointvec, +}, +#endif #ifdef CONFIG_SCHED_DEBUG { .procname = "sched_min_granularity_ns", @@ -1262,7 +1359,25 @@ static struct ctl_table kern_table[] = { .extra1 = &zero, .extra2 = &one, }, - +#if defined(CONFIG_OPLUS_FEATURE_HUNG_TASK_ENHANCE) && defined(CONFIG_OPLUS_FEATURE_DEATH_HEALER) +/* record the hung task killing */ + { + .procname = "hung_task_kill", + .data = &sysctl_hung_task_oppo_kill, + .maxlen = 128, + .mode = 0666, + .proc_handler = proc_dostring, + }, +/* Foreground background optimization,change max io count */ + { + .procname = "hung_task_maxiowait_count", + .data = &sysctl_hung_task_maxiowait_count, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = &five, + }, +#endif #endif #ifdef CONFIG_RT_MUTEXES { @@ -1404,6 +1519,66 @@ static struct ctl_table kern_table[] = { .proc_handler = proc_dointvec, }, #endif +#ifdef OPLUS_FEATURE_UIFIRST +// XieLiujie@BSP.KERNEL.PERFORMANCE, 2020/05/25, Add for UIFirst + { + .procname = "uifirst_enabled", + .data = &sysctl_uifirst_enabled, + .maxlen = sizeof(int), + .mode = 0666, + .proc_handler = proc_dointvec, + }, + { + .procname = "launcher_boost_enabled", + .data = &sysctl_launcher_boost_enabled, + .maxlen = sizeof(int), + .mode = 0666, + .proc_handler = proc_dointvec, + }, +#endif /* OPLUS_FEATURE_UIFIRST */ +#ifdef OPLUS_FEATURE_UIFIRST + // Liujie.Xie@TECH.Kernel.Sched, 2020/02/26, add for heavy load task + { + .procname = "cpu_multi_thread", + .data = &sysctl_cpu_multi_thread, + .maxlen = sizeof(int), + .mode = 0666, + .proc_handler = proc_dointvec, + }, +#endif /* OPLUS_FEATURE_UIFIRST */ +#ifdef OPLUS_FEATURE_UIFIRST +// XuHaifeng@BSP.KERNEL.PERFORMANCE, 2020/06/23, Add for UIFirst(sldie boost) + { + .procname = "slide_boost_enabled", + .data = &sysctl_slide_boost_enabled, + .maxlen = sizeof(int), + .mode = 0666, + .proc_handler = proc_dointvec, + }, + { + .procname = "boost_task_threshold", + .data = &sysctl_boost_task_threshold, + .maxlen = sizeof(int), + .mode = 0666, + .proc_handler = proc_dointvec, + }, + { + .procname = "frame_rate", + .data = &sysctl_frame_rate, + .maxlen = sizeof(int), + .mode = 0666, + .proc_handler = sched_frame_rate_handler, + }, +#ifdef CONFIG_CAMERA_OPT + { + .procname = "camera_opt_enable", + .data = &sysctl_camera_opt_enabled, + .maxlen = sizeof(int), + .mode = 0666, + .proc_handler = proc_dointvec, + }, +#endif +#endif /* OPLUS_FEATURE_UIFIRST */ { } }; @@ -1462,7 +1637,7 @@ static struct ctl_table vm_table[] = { .proc_handler = overcommit_kbytes_handler, }, { - .procname = "page-cluster", + .procname = "page-cluster", .data = &page_cluster, .maxlen = sizeof(int), .mode = 0644, @@ -1538,8 +1713,23 @@ static struct ctl_table vm_table[] = { .mode = 0644, .proc_handler = proc_dointvec_minmax, .extra1 = &zero, +#if defined(OPLUS_FEATURE_ZRAM_OPT) && defined(CONFIG_OPLUS_ZRAM_OPT) + .extra2 = &two_hundred, +#else .extra2 = &one_hundred, +#endif /*OPLUS_FEATURE_ZRAM_OPT*/ }, +#if defined(OPLUS_FEATURE_ZRAM_OPT) && defined(CONFIG_OPLUS_ZRAM_OPT) + { + .procname = "direct_swappiness", + .data = &direct_vm_swappiness, + .maxlen = sizeof(direct_vm_swappiness), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = &zero, + .extra2 = &two_hundred, + }, +#endif { .procname = "want_old_faultaround_pte", .data = &want_old_faultaround_pte, @@ -1609,7 +1799,13 @@ static struct ctl_table vm_table[] = { .procname = "compact_memory", .data = &sysctl_compact_memory, .maxlen = sizeof(int), +#ifdef VENDOR_EDIT +/*Huacai.Zhou@PSW.kernel.mm, 2018-08-20, modify permission for coloros.athena*/ + .mode = 0222, +#else .mode = 0200, + +#endif /*VENDOR_EDIT*/ .proc_handler = sysctl_compaction_handler, }, { @@ -1640,6 +1836,17 @@ static struct ctl_table vm_table[] = { .proc_handler = min_free_kbytes_sysctl_handler, .extra1 = &zero, }, +#if defined(OPLUS_FEATURE_MULTI_KSWAPD) && defined(CONFIG_OPLUS_MULTI_KSWAPD) + { + .procname = "kswapd_threads", + .data = &kswapd_threads, + .maxlen = sizeof(kswapd_threads), + .mode = 0644, + .proc_handler = kswapd_threads_sysctl_handler, + .extra1 = &one, + .extra2 = &max_kswapd_threads, + }, +#endif /*OPLUS_FEATURE_MULTI_KSWAPD*/ { .procname = "watermark_scale_factor", .data = &watermark_scale_factor, @@ -1996,7 +2203,7 @@ static struct ctl_table fs_table[] = { .mode = 0555, .child = inotify_table, }, -#endif +#endif #ifdef CONFIG_EPOLL { .procname = "epoll", @@ -2442,12 +2649,12 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, int *i, vleft, first = 1, err = 0; size_t left; char *kbuf = NULL, *p; - + if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) { *lenp = 0; return 0; } - + i = (int *) tbl_data; vleft = table->maxlen / sizeof(*i); left = *lenp; @@ -2673,7 +2880,7 @@ static int do_proc_douintvec(struct ctl_table *table, int write, * @ppos: file position * * Reads/writes up to table->maxlen/sizeof(unsigned int) integer - * values from/to the user buffer, treated as an ASCII string. + * values from/to the user buffer, treated as an ASCII string. * * Returns 0 on success. */ @@ -3129,7 +3336,7 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp, * @ppos: file position * * Reads/writes up to table->maxlen/sizeof(unsigned int) integer - * values from/to the user buffer, treated as an ASCII string. + * values from/to the user buffer, treated as an ASCII string. * The values read are assumed to be in seconds, and are converted into * jiffies. * @@ -3151,8 +3358,8 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write, * @ppos: pointer to the file position * * Reads/writes up to table->maxlen/sizeof(unsigned int) integer - * values from/to the user buffer, treated as an ASCII string. - * The values read are assumed to be in 1/USER_HZ seconds, and + * values from/to the user buffer, treated as an ASCII string. + * The values read are assumed to be in 1/USER_HZ seconds, and * are converted into jiffies. * * Returns 0 on success. @@ -3174,8 +3381,8 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, * @ppos: the current position in the file * * Reads/writes up to table->maxlen/sizeof(unsigned int) integer - * values from/to the user buffer, treated as an ASCII string. - * The values read are assumed to be in 1/1000 seconds, and + * values from/to the user buffer, treated as an ASCII string. + * The values read are assumed to be in 1/1000 seconds, and * are converted into jiffies. * * Returns 0 on success. diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index 9f15dc0493ad..d8a1bb786e95 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c @@ -34,6 +34,10 @@ #define CREATE_TRACE_POINTS #include +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY +//Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler +#include "../../drivers/soc/oplus/owakelock/oplus_wakelock_profiler_qcom.h" +#endif /* OPLUS_FEATURE_POWERINFO_STANDBY */ /** * struct alarm_base - Alarm timer bases @@ -238,7 +242,10 @@ static enum hrtimer_restart alarmtimer_fired(struct hrtimer *timer) if (alarm->function) restart = alarm->function(alarm, base->gettime()); - +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY + //Nanwei.Deng@BSP.Power.Basic 2018/04/28 add for count alarm times + alarmtimer_wakeup_count(alarm); +#endif /*VENDOR_EDIT*/ spin_lock_irqsave(&base->lock, flags); if (restart != ALARMTIMER_NORESTART) { hrtimer_set_expires(&alarm->timer, alarm->node.expires); @@ -284,6 +291,10 @@ static int alarmtimer_suspend(struct device *dev) type = freezer_alarmtype; freezer_delta = 0; spin_unlock_irqrestore(&freezer_delta_lock, flags); + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY + //Nanwei.Deng@Kernel.Driver, 2018/11/19, add for analysis power coumption. count alarm times + alarmtimer_suspend_flag_set(); + #endif /*VENDOR_EDIT*/ rtc = alarmtimer_get_rtcdev(); /* If we have no rtcdev, just return */ @@ -313,6 +324,11 @@ static int alarmtimer_suspend(struct device *dev) if (ktime_to_ns(min) < 2 * NSEC_PER_SEC) { __pm_wakeup_event(ws, 2 * MSEC_PER_SEC); + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY + //Nanwei.Deng@BSP.Power.Basic 2018/11/19, add for analysis power coumption. count alarm times + alarmtimer_suspend_flag_clear(); + alarmtimer_busy_flag_set(); + #endif /* VENDOR_EDIT */ return -EBUSY; } @@ -334,6 +350,10 @@ static int alarmtimer_suspend(struct device *dev) static int alarmtimer_resume(struct device *dev) { struct rtc_device *rtc; + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY + //Nanwei.Deng@Kernel.Driver, 2018/11/19, add for analysis power coumption. count alarm times + alarmtimer_suspend_flag_clear(); + #endif /*VENDOR_EDIT*/ rtc = alarmtimer_get_rtcdev(); if (rtc) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index f93f40dd7aaf..f914f91b06cd 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -502,6 +502,11 @@ static inline void debug_work_deactivate(struct work_struct *work) void __init_work(struct work_struct *work, int onstack) { +#ifdef OPLUS_FEATURE_UIFIRST +// caichen@TECH.Kernel.Sched, 2020/05/01, add for uifirst wq + work->ux_work = 0; +#endif + if (onstack) debug_object_init_on_stack(work, &work_debug_descr); else @@ -1327,7 +1332,17 @@ static void insert_work(struct pool_workqueue *pwq, struct work_struct *work, /* we own @work, set data and link */ set_work_pwq(work, pwq, extra_flags); +#ifdef OPLUS_FEATURE_UIFIRST +// caichen@TECH.Kernel.Sched, 2020/05/01, add for ui first wq + if(is_uxwork(work)){ + list_add(&work->entry, head); + }else{ + list_add_tail(&work->entry, head); + } +#else list_add_tail(&work->entry, head); +#endif + get_pwq(pwq); /* @@ -2051,6 +2066,11 @@ __acquires(&pool->lock) bool cpu_intensive = pwq->wq->flags & WQ_CPU_INTENSIVE; int work_color; struct worker *collision; +#ifdef OPLUS_FEATURE_UIFIRST +// caichen@TECH.Kernel.Sched, 2020/05/01, add for ui first wq + bool is_uxworker = false; +#endif + #ifdef CONFIG_LOCKDEP /* * It is permissible to free the struct work_struct from @@ -2141,9 +2161,22 @@ __acquires(&pool->lock) * flush_work() and complete() primitives (except for single-threaded * workqueues), so hiding them isn't a problem. */ +#ifdef OPLUS_FEATURE_UIFIRST +// caichen@TECH.Kernel.Sched, 2020/05/01, add for ui first wq + if(is_uxwork(work)){ + set_ux_worker_task(worker->task); + is_uxworker = true; + } +#endif lockdep_invariant_state(true); trace_workqueue_execute_start(work); worker->current_func(work); +#ifdef OPLUS_FEATURE_UIFIRST +// caichen@TECH.Kernel.Sched, 2020/05/01, add for ui first wq + if(sysctl_uifirst_enabled && is_uxworker) + reset_ux_worker_task(worker->task); +#endif + /* * While we must be careful to not use "work" after this, the trace * point will only record its address. diff --git a/lib/show_mem.c b/lib/show_mem.c index 0beaa1d899aa..94d5fd30d4db 100644 --- a/lib/show_mem.c +++ b/lib/show_mem.c @@ -9,6 +9,16 @@ #include #include +#ifdef OPLUS_FEATURE_HEALTHINFO +/* Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-06-26, add ion total used account*/ +#include +#endif /* OPLUS_FEATURE_HEALTHINFO */ + +#ifdef OPLUS_FEATURE_HEALTHINFO +//Jiheng.Xie@TECH.BSP.Performance, 2019-07-22, add for gpu total used account +extern unsigned long gpu_total(void); +#endif /* OPLUS_FEATURE_HEALTHINFO */ + void show_mem(unsigned int filter, nodemask_t *nodemask) { pg_data_t *pgdat; @@ -49,4 +59,12 @@ void show_mem(unsigned int filter, nodemask_t *nodemask) #ifdef CONFIG_MEMORY_FAILURE printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages)); #endif +#ifdef OPLUS_FEATURE_HEALTHINFO +/* Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-06-26, add ion total used account*/ + printk("%lu pages ion total used\n", ion_total()>> PAGE_SHIFT); +#endif /* OPLUS_FEATURE_HEALTHINFO */ +#ifdef OPLUS_FEATURE_HEALTHINFO +//Jiheng.Xie@BSP.Kernel.MM, 2020-05-25, add gpu total used account + printk("%lu pages gpu total used\n", gpu_total()>> PAGE_SHIFT); +#endif /* OPLUS_FEATURE_HEALTHINFO */ } diff --git a/mm/Kconfig b/mm/Kconfig index 9ddaeebca18c..32acf8950dc4 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -851,3 +851,47 @@ config FORCE_ALLOC_FROM_DMA_ZONE always using ZONE_DMA memory. If unsure, say "n". + +#ifdef OPLUS_FEATURE_MULTI_KSWAPD +source "mm/multi_kswapd/Kconfig" +#endif /*OPLUS_FEATURE_MULTI_KSWAPD*/ + +#ifdef OPLUS_FEATURE_PROCESS_RECLAIM +# inactive pages only +config PROCESS_RECLAIM_ENHANCE + bool "Enable process reclaim enchance" + depends on PROCESS_RECLAIM + default y + help + It allows to reclaim different type pages of the process by + /proc/process_reclaim. + + (echo inactive_file > /proc/PID/reclaim) reclaims inactive file-backed + pages only. + (echo inactive_anon > /proc/PID/reclaim) reclaims inactive anonymous + pages only. + (echo inactive > /proc/PID/reclaim) reclaims inactive file-backed and + anonymous pages only. + Any other vaule, please reference PROCESS_RECLAIM. +#endif /* OPLUS_FEATURE_PROCESS_RECLAIM */ + +#ifdef OPLUS_FEATURE_HEALTHINFO +#/* Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-07-07, add alloc wait monitor support*/ +source "mm/oppo_healthinfo/Kconfig" +#endif /* OPLUS_FEATURE_HEALTHINFO */ + +#ifdef OPLUS_FEATURE_MULTI_FREEAREA +config PHYSICAL_ANTI_FRAGMENTATION + bool "Physical memory anti-fragmentation" + default y + help + Turn on the function of Physical memory anti-fragmentation. +#endif /* OPLUS_FEATURE_MULTI_FREEAREA */ + +#ifdef OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY +config VIRTUAL_RESERVE_MEMORY + bool "reserved vma for gpu emergency mmap" + default y + help + support reserved vma for gpu emergency mmap. +#endif /* OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY */ diff --git a/mm/Makefile b/mm/Makefile index 61e1aac6a150..71ec494802db 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -105,3 +105,28 @@ obj-$(CONFIG_HARDENED_USERCOPY) += usercopy.o obj-$(CONFIG_PERCPU_STATS) += percpu-stats.o obj-$(CONFIG_HMM) += hmm.o obj-$(CONFIG_PROCESS_RECLAIM) += process_reclaim.o + +#ifdef OPLUS_FEATURE_PROCESS_RECLAIM +ifdef CONFIG_PROCESS_RECLAIM_ENHANCE +obj-y += process_mm_reclaim.o +else +obj-y += process_mm_reclaim_weak.o +endif +#endif /* OPLUS_FEATURE_PROCESS_RECLAIM */ + +#ifdef OPLUS_FEATURE_HEALTHINFO +#/* Jiheng.Xie@TECH.BSP.Kernel, 2019-12-11, add for slub debug*/ +obj-y += oppo_healthinfo/ +#endif /* OPLUS_FEATURE_HEALTHINFO */ + +#ifdef OPLUS_FEATURE_MULTI_KSWAPD +obj-$(CONFIG_OPLUS_MULTI_KSWAPD) += multi_kswapd/ +#endif /*OPLUS_FEATURE_MULTI_KSWAPD*/ + +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) +obj-$(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) += multi_freearea.o +#endif + +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) +obj-$(CONFIG_VIRTUAL_RESERVE_MEMORY) += resmap_account.o +#endif /*defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) diff --git a/mm/compaction.c b/mm/compaction.c index 4455fc8afdbd..898a33f964b5 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -24,7 +24,9 @@ #include #include #include "internal.h" - +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) +#include +#endif #ifdef CONFIG_COMPACTION static inline void count_compact_event(enum vm_event_item item) { @@ -1324,7 +1326,9 @@ static enum compact_result __compact_finished(struct zone *zone, { unsigned int order; const int migratetype = cc->migratetype; - +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + int flc = 0; +#endif if (cc->contended || fatal_signal_pending(current)) return COMPACT_CONTENDED; @@ -1363,8 +1367,15 @@ static enum compact_result __compact_finished(struct zone *zone, } /* Direct compactor: Is a suitable page free? */ +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + for (flc = 0; flc < FREE_AREA_COUNTS; flc++) { +#endif for (order = cc->order; order < MAX_ORDER; order++) { +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + struct free_area *area = &zone->free_area[flc][order]; +#else struct free_area *area = &zone->free_area[order]; +#endif bool can_steal; /* Job done if page is free of the right migratetype */ @@ -1406,7 +1417,9 @@ static enum compact_result __compact_finished(struct zone *zone, return COMPACT_CONTINUE; } } - +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + } +#endif return COMPACT_NO_SUITABLE_PAGE; } diff --git a/mm/huge_memory.c b/mm/huge_memory.c index bd229a949abd..d7b9be145e21 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2191,6 +2191,8 @@ void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, unsigned long address, bool freeze, struct page *page) { spinlock_t *ptl; + bool was_locked = false; + pmd_t _pmd; struct mm_struct *mm = vma->vm_mm; unsigned long haddr = address & HPAGE_PMD_MASK; bool was_locked = false; diff --git a/mm/madvise.c b/mm/madvise.c index a823608a5258..edba5db3b0ad 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -192,9 +192,15 @@ out: } #ifdef CONFIG_SWAP +#if defined(CONFIG_NANDSWAP) +int swapin_walk_pmd_entry(pmd_t *pmd, unsigned long start, + unsigned long end, struct mm_walk *walk) +#else static int swapin_walk_pmd_entry(pmd_t *pmd, unsigned long start, unsigned long end, struct mm_walk *walk) +#endif { + pte_t *orig_pte; struct vm_area_struct *vma = walk->private; unsigned long index; @@ -207,7 +213,10 @@ static int swapin_walk_pmd_entry(pmd_t *pmd, unsigned long start, swp_entry_t entry; struct page *page; spinlock_t *ptl; - +#if defined(CONFIG_NANDSWAP) + if (!list_empty(&vma->vm_mm->mmap_sem.wait_list)) + return -1; +#endif orig_pte = pte_offset_map_lock(vma->vm_mm, pmd, start, &ptl); pte = *(orig_pte + ((index - start) / PAGE_SIZE)); pte_unmap_unlock(orig_pte, ptl); diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index b238ff690916..530f4817d9df 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -42,6 +42,9 @@ #include "internal.h" +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) +#include "multi_freearea.h" +#endif /* * online_page_callback contains pointer to current page onlining function. * Initially it is generic_online_page(). If it is required it could be @@ -425,6 +428,9 @@ static void shrink_zone_span(struct zone *zone, unsigned long start_pfn, zone->spanned_pages = pfn - zone_start_pfn + 1; } +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + ajust_zone_label(zone); +#endif /* * The section is not biggest or smallest mem_section in the zone, it * only creates a hole in the zone. So in this case, we need not @@ -451,6 +457,9 @@ static void shrink_zone_span(struct zone *zone, unsigned long start_pfn, /* The zone has no valid section */ zone->zone_start_pfn = 0; zone->spanned_pages = 0; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + ajust_zone_label(zone); +#endif zone_span_writeunlock(zone); } @@ -796,6 +805,9 @@ static void __meminit resize_zone_range(struct zone *zone, unsigned long start_p zone->zone_start_pfn = start_pfn; zone->spanned_pages = max(start_pfn + nr_pages, old_end_pfn) - zone->zone_start_pfn; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + ajust_zone_label(zone); +#endif } static void __meminit resize_pgdat_range(struct pglist_data *pgdat, unsigned long start_pfn, diff --git a/mm/mmap.c b/mm/mmap.c index 573e0ac6f1f5..84431ea09828 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -52,6 +52,10 @@ #include #include +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) +#include +#endif + #include "internal.h" #ifndef arch_mmap_check @@ -434,7 +438,16 @@ static void vma_gap_update(struct vm_area_struct *vma) static inline void vma_rb_insert(struct vm_area_struct *vma, struct mm_struct *mm) { +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + struct rb_root *root; + + if (BACKUP_ALLOC_FLAG(vma->vm_flags)) + root = &mm->reserve_mm_rb; + else + root = &mm->mm_rb; +#else struct rb_root *root = &mm->mm_rb; +#endif /* All rb_subtree_gap values must be consistent prior to insertion */ validate_mm_rb(root, NULL); @@ -444,7 +457,16 @@ static inline void vma_rb_insert(struct vm_area_struct *vma, static void __vma_rb_erase(struct vm_area_struct *vma, struct mm_struct *mm) { +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + struct rb_root *root; + + if (BACKUP_ALLOC_FLAG(vma->vm_flags)) + root = &mm->reserve_mm_rb; + else + root = &mm->mm_rb; +#else struct rb_root *root = &mm->mm_rb; +#endif /* * Note rb_erase_augmented is a fairly large inline function, * so make sure we instantiate it only once with our desired @@ -470,7 +492,14 @@ static __always_inline void vma_rb_erase_ignore(struct vm_area_struct *vma, * with the possible exception of the "next" vma being erased if * next->vm_start was reduced. */ +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + if (BACKUP_ALLOC_FLAG(vma->vm_flags)) + validate_mm_rb(&mm->reserve_mm_rb, ignore); + else + validate_mm_rb(&mm->mm_rb, ignore); +#else validate_mm_rb(&mm->mm_rb, ignore); +#endif __vma_rb_erase(vma, mm); } @@ -482,7 +511,14 @@ static __always_inline void vma_rb_erase(struct vm_area_struct *vma, * All rb_subtree_gap values must be consistent prior to erase, * with the possible exception of the vma being erased. */ +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + if (BACKUP_ALLOC_FLAG(vma->vm_flags)) + validate_mm_rb(&mm->reserve_mm_rb, vma); + else + validate_mm_rb(&mm->mm_rb, vma); +#else validate_mm_rb(&mm->mm_rb, vma); +#endif __vma_rb_erase(vma, mm); } @@ -525,7 +561,14 @@ static int find_vma_links(struct mm_struct *mm, unsigned long addr, { struct rb_node **__rb_link, *__rb_parent, *rb_prev; +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + if (is_backed_addr(mm, addr, end)) + __rb_link = &mm->reserve_mm_rb.rb_node; + else + __rb_link = &mm->mm_rb.rb_node; +#else __rb_link = &mm->mm_rb.rb_node; +#endif rb_prev = __rb_parent = NULL; while (*__rb_link) { @@ -587,8 +630,17 @@ void __vma_link_rb(struct mm_struct *mm, struct vm_area_struct *vma, /* Update tracking information for the gap following the new vma. */ if (vma->vm_next) vma_gap_update(vma->vm_next); +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + else { + if (BACKUP_ALLOC_FLAG(vma->vm_flags)) + mm->reserve_highest_vm_end = vm_end_gap(vma); + else + mm->highest_vm_end = vm_end_gap(vma); + } +#else else mm->highest_vm_end = vm_end_gap(vma); +#endif /* * vma->vm_prev wasn't known when we followed the rbtree to find the @@ -652,7 +704,14 @@ static void vma_link(struct mm_struct *mm, struct vm_area_struct *vma, if (mapping) i_mmap_unlock_write(mapping); +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + if (BACKUP_ALLOC_FLAG(vma->vm_flags)) + mm->reserve_map_count++; + else + mm->map_count++; +#else mm->map_count++; +#endif validate_mm(mm); } @@ -669,7 +728,14 @@ static void __insert_vm_struct(struct mm_struct *mm, struct vm_area_struct *vma) &prev, &rb_link, &rb_parent)) BUG(); __vma_link(mm, vma, prev, rb_link, rb_parent); +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + if (BACKUP_ALLOC_FLAG(vma->vm_flags)) + mm->reserve_map_count++; + else + mm->map_count++; +#else mm->map_count++; +#endif } static __always_inline void __vma_unlink_common(struct mm_struct *mm, @@ -688,8 +754,17 @@ static __always_inline void __vma_unlink_common(struct mm_struct *mm, prev = vma->vm_prev; if (prev) prev->vm_next = next; +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + else { + if (BACKUP_ALLOC_FLAG(vma->vm_flags)) + mm->reserve_mmap = next; + else + mm->mmap = next; + } +#else else mm->mmap = next; +#endif } if (next) next->vm_prev = prev; @@ -933,8 +1008,18 @@ again: if (start_changed) vma_gap_update(vma); if (end_changed) { +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + if (!next) { + if (BACKUP_ALLOC_FLAG(vma->vm_flags)) + mm->reserve_highest_vm_end = + vm_end_gap(vma); + else + mm->highest_vm_end = vm_end_gap(vma); + } +#else if (!next) mm->highest_vm_end = vm_end_gap(vma); +#endif else if (!adjust_next) vma_gap_update(next); } @@ -961,7 +1046,14 @@ again: uprobe_munmap(next, next->vm_start, next->vm_end); if (next->anon_vma) anon_vma_merge(vma, next); +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + if (BACKUP_ALLOC_FLAG(next->vm_flags)) + mm->reserve_map_count--; + else + mm->map_count--; +#else mm->map_count--; +#endif vm_raw_write_end(next); put_vma(next); /* @@ -999,6 +1091,16 @@ again: } else if (next) vma_gap_update(next); +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + else { + if (BACKUP_ALLOC_FLAG(vma->vm_flags)) + VM_WARN_ON(mm->reserve_highest_vm_end != + vm_end_gap(vma)); + else + VM_WARN_ON(mm->highest_vm_end != + vm_end_gap(vma)); + } +#else else { /* * If remove_next == 2 we obviously can't @@ -1021,6 +1123,7 @@ again: */ VM_WARN_ON(mm->highest_vm_end != vm_end_gap(vma)); } +#endif } if (insert && file) uprobe_mmap(insert); @@ -1190,8 +1293,17 @@ struct vm_area_struct *__vma_merge(struct mm_struct *mm, if (prev) next = prev->vm_next; +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + else { + if (BACKUP_ALLOC_FLAG(vm_flags)) + next = mm->reserve_mmap; + else + next = mm->mmap; + } +#else else next = mm->mmap; +#endif area = next; if (area && area->vm_end == end) /* cases 6, 7, 8 */ next = next->vm_next; @@ -1581,6 +1693,11 @@ unsigned long do_mmap(struct file *file, unsigned long addr, vm_flags |= VM_NORESERVE; } +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + if (reserved_area_checking(mm, &vm_flags, flags, addr, len)) + return -ENOMEM; +#endif + addr = mmap_region(file, addr, len, vm_flags, pgoff, uf); if (!IS_ERR_VALUE(addr) && ((vm_flags & VM_LOCKED) || @@ -1631,7 +1748,11 @@ SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + retval = vm_mmap_pgoff_with_check(file, addr, len, prot, flags, pgoff); +#else retval = vm_mmap_pgoff(file, addr, len, prot, flags, pgoff); +#endif out_fput: if (file) fput(file); @@ -1861,6 +1982,10 @@ out: vma_set_page_prot(vma); vm_write_end(vma); +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + if (BACKUP_CREATE_FLAG(vm_flags) && (!mm->reserve_vma)) + mm->reserve_vma = vma; +#endif return addr; @@ -1992,6 +2117,14 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) struct mm_struct *mm = current->mm; struct vm_area_struct *vma; unsigned long length, low_limit, high_limit, gap_start, gap_end; +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + struct rb_root *rb_r; + + if (info->flags & VM_UNMAPPED_AREA_RESERVED) + rb_r = &mm->reserve_mm_rb; + else + rb_r = &mm->mm_rb; +#endif /* Adjust search length to account for worst case alignment overhead */ length = info->length + info->align_mask; @@ -2012,14 +2145,28 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) low_limit = info->low_limit + length; /* Check highest gap, which does not precede any rbtree node */ +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + + if (info->flags & VM_UNMAPPED_AREA_RESERVED) + gap_start = mm->reserve_highest_vm_end; + else + gap_start = mm->highest_vm_end; +#else gap_start = mm->highest_vm_end; +#endif if (gap_start <= high_limit) goto found_highest; /* Check if rbtree root looks promising */ +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + if (RB_EMPTY_ROOT(rb_r)) + return -ENOMEM; + vma = rb_entry(rb_r->rb_node, struct vm_area_struct, vm_rb); +#else if (RB_EMPTY_ROOT(&mm->mm_rb)) return -ENOMEM; vma = rb_entry(mm->mm_rb.rb_node, struct vm_area_struct, vm_rb); +#endif if (vma->rb_subtree_gap < length) return -ENOMEM; @@ -2165,8 +2312,23 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, info.flags = VM_UNMAPPED_AREA_TOPDOWN; info.length = len; info.low_limit = max(PAGE_SIZE, mmap_min_addr); +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + /* + * create reserved area must be below the gpu high limit addr + */ + if (check_reserve_mmap_doing(mm)) { + info.high_limit = (gpu_compat_high_limit_addr < mm->mmap_base) ? + gpu_compat_high_limit_addr : mm->mmap_base; + info.align_offset = 0; + info.align_mask = RESERVE_AREA_ALIGN_SIZE - 1; + } else { + info.high_limit = mm->mmap_base; + info.align_mask = 0; + } +#else info.high_limit = mm->mmap_base; info.align_mask = 0; +#endif addr = vm_unmapped_area(&info); /* @@ -2238,7 +2400,14 @@ static struct vm_area_struct *__find_vma(struct mm_struct *mm, struct rb_node *rb_node; struct vm_area_struct *vma = NULL; +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + if (start_is_backed_addr(mm, addr)) + rb_node = mm->reserve_mm_rb.rb_node; + else + rb_node = mm->mm_rb.rb_node; +#else rb_node = mm->mm_rb.rb_node; +#endif while (rb_node) { struct vm_area_struct *tmp; @@ -2435,8 +2604,19 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) anon_vma_interval_tree_post_update_vma(vma); if (vma->vm_next) vma_gap_update(vma->vm_next); +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + else { + if (BACKUP_ALLOC_FLAG(vma->vm_flags)) + mm->reserve_highest_vm_end = + vm_end_gap(vma); + esle + mm->highest_vm_end = + vm_end_gap(vma); + } +#else else mm->highest_vm_end = vm_end_gap(vma); +#endif spin_unlock(&mm->page_table_lock); perf_event_mmap(vma); @@ -2632,15 +2812,35 @@ static void unmap_region(struct mm_struct *mm, struct vm_area_struct *vma, struct vm_area_struct *prev, unsigned long start, unsigned long end) { +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) struct vm_area_struct *next = prev ? prev->vm_next : mm->mmap; + unsigned long free_flooring_addr = FIRST_USER_ADDRESS; + unsigned long free_ceiling_addr = USER_PGTABLES_CEILING; +#else + struct vm_area_struct *next = prev ? prev->vm_next : mm->mmap; +#endif struct mmu_gather tlb; +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + if (BACKUP_ALLOC_FLAG(vma->vm_flags)) { + free_flooring_addr = mm->reserve_vma->vm_start; + free_ceiling_addr = mm->reserve_vma->vm_end; + next = prev ? prev->vm_next : mm->reserve_mmap; + } else + next = prev ? prev->vm_next : mm->mmap; +#endif + lru_add_drain(); tlb_gather_mmu(&tlb, mm, start, end); update_hiwater_rss(mm); unmap_vmas(&tlb, vma, start, end); +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + free_pgtables(&tlb, vma, prev ? prev->vm_end : free_flooring_addr, + next ? next->vm_start : free_ceiling_addr); +#else free_pgtables(&tlb, vma, prev ? prev->vm_end : FIRST_USER_ADDRESS, next ? next->vm_start : USER_PGTABLES_CEILING); +#endif tlb_finish_mmu(&tlb, start, end); } @@ -2654,12 +2854,25 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma, { struct vm_area_struct **insertion_point; struct vm_area_struct *tail_vma = NULL; +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + int backed_alloc = 0; + if (BACKUP_ALLOC_FLAG(vma->vm_flags)) { + backed_alloc = 1; + insertion_point = (prev ? &prev->vm_next : &mm->reserve_mmap); + } else + insertion_point = (prev ? &prev->vm_next : &mm->mmap); +#else insertion_point = (prev ? &prev->vm_next : &mm->mmap); +#endif vma->vm_prev = NULL; do { vma_rb_erase(vma, mm); +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + (backed_alloc) ? mm->reserve_map_count-- : mm->map_count--; +#else mm->map_count--; +#endif tail_vma = vma; vma = vma->vm_next; } while (vma && vma->vm_start < end); @@ -2667,8 +2880,18 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma, if (vma) { vma->vm_prev = prev; vma_gap_update(vma); +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + } else { + if (backed_alloc) + mm->reserve_highest_vm_end = + prev ? vm_end_gap(prev) : 0; + else + mm->highest_vm_end = prev ? vm_end_gap(prev) : 0; + } +#else } else mm->highest_vm_end = prev ? vm_end_gap(prev) : 0; +#endif tail_vma->vm_next = NULL; /* Kill the cache */ @@ -2767,6 +2990,9 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len, { unsigned long end; struct vm_area_struct *vma, *prev, *last; +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + int backed_addr_unmap = 0; +#endif if ((offset_in_page(start)) || start > TASK_SIZE || len > TASK_SIZE-start) return -EINVAL; @@ -2775,6 +3001,11 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len, if (len == 0) return -EINVAL; +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + if (is_backed_addr(mm, start, start+len)) + backed_addr_unmap = 1; +#endif + /* Find the first overlapping VMA */ vma = find_vma(mm, start); if (!vma) @@ -2818,7 +3049,14 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len, if (error) return error; } +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + if (backed_addr_unmap) + vma = prev ? prev->vm_next : mm->reserve_mmap; + else + vma = prev ? prev->vm_next : mm->mmap; +#else vma = prev ? prev->vm_next : mm->mmap; +#endif if (unlikely(uf)) { /* @@ -3163,6 +3401,10 @@ void exit_mmap(struct mm_struct *mm) if (!vma) /* Can happen if dup_mmap() received an OOM */ return; +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + exit_reserved_mmap(mm); +#endif + lru_add_drain(); flush_cache_mm(mm); tlb_gather_mmu(&tlb, mm, 0, -1); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 8deb1367dc88..89943ec17ec3 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -75,6 +75,17 @@ #include #include "internal.h" +#ifdef OPLUS_FEATURE_HEALTHINFO +/* Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-07-07, add alloc wait monitor support*/ +#ifdef CONFIG_OPPO_MEM_MONITOR +#include +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ + +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) +#include "multi_freearea.h" +#endif + /* prevent >1 _updater_ of zone percpu pageset ->high and ->batch fields */ static DEFINE_MUTEX(pcp_batch_high_lock); #define MIN_PERCPU_PAGELIST_FRACTION (8) @@ -181,6 +192,7 @@ static int __init early_init_on_free(char *buf) } early_param("init_on_free", early_init_on_free); + /* * A cached value of the page's pageblock's migratetype, used when the page is * put on a pcplist. Used to avoid the pageblock migratetype lookup when @@ -876,6 +888,9 @@ static inline void __free_one_page(struct page *page, unsigned long uninitialized_var(buddy_pfn); struct page *buddy; unsigned int max_order; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + unsigned int flc; +#endif max_order = min_t(unsigned int, MAX_ORDER, pageblock_order + 1); @@ -906,7 +921,12 @@ continue_merging: clear_page_guard(zone, buddy, order, migratetype); } else { list_del(&buddy->lru); +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + flc = page_to_flc(buddy); + zone->free_area[flc][order].nr_free--; +#else zone->free_area[order].nr_free--; +#endif rmv_page_order(buddy); } combined_pfn = buddy_pfn & pfn; @@ -958,15 +978,27 @@ done_merging: higher_buddy = higher_page + (buddy_pfn - combined_pfn); if (pfn_valid_within(buddy_pfn) && page_is_buddy(higher_page, higher_buddy, order + 1)) { +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + flc = page_to_flc(page); + list_add_tail(&page->lru, + &zone->free_area[flc][order].free_list[migratetype]); +#else list_add_tail(&page->lru, &zone->free_area[order].free_list[migratetype]); +#endif goto out; } } - +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + list_sort_add(page, zone, order, migratetype); +out: + flc = page_to_flc(page); + zone->free_area[flc][order].nr_free++; +#else list_add(&page->lru, &zone->free_area[order].free_list[migratetype]); out: zone->free_area[order].nr_free++; +#endif } /* @@ -1361,6 +1393,7 @@ static void __free_pages_boot_core(struct page *page, unsigned int order) page_zone(page)->managed_pages += nr_pages; set_page_refcounted(page); __free_pages(page, order); + } #if defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) || \ @@ -1733,6 +1766,9 @@ static inline void expand(struct zone *zone, struct page *page, int migratetype) { unsigned long size = 1 << high; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + unsigned int flc = 0; +#endif while (high > low) { area--; @@ -1748,9 +1784,14 @@ static inline void expand(struct zone *zone, struct page *page, */ if (set_page_guard(zone, &page[size], high, migratetype)) continue; - +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + list_sort_add(&page[size], zone, high, migratetype); + flc = page_to_flc(&page[size]); + zone->free_area[flc][high].nr_free++; +#else list_add(&page[size].lru, &area->free_list[migratetype]); area->nr_free++; +#endif set_page_order(&page[size], high); } } @@ -1884,22 +1925,37 @@ struct page *__rmqueue_smallest(struct zone *zone, unsigned int order, unsigned int current_order; struct free_area *area; struct page *page; - +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + unsigned int flc = 0, flc_tmp = 0, flc_last = 0; + for (flc = 0; flc < FREE_AREA_COUNTS; flc++) { + flc_tmp = ajust_flc(flc, order); +#endif /* Find a page of the appropriate size in the preferred list */ for (current_order = order; current_order < MAX_ORDER; ++current_order) { +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + area = &(zone->free_area[flc_tmp][current_order]); +#else area = &(zone->free_area[current_order]); +#endif page = list_first_entry_or_null(&area->free_list[migratetype], struct page, lru); if (!page) continue; list_del(&page->lru); rmv_page_order(page); +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + flc_last = page_to_flc(page); + zone->free_area[flc_last][current_order].nr_free--; +#else area->nr_free--; +#endif expand(zone, page, order, current_order, area, migratetype); set_pcppage_migratetype(page, migratetype); return page; } - +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + } +#endif return NULL; } @@ -1982,8 +2038,13 @@ static int move_freepages(struct zone *zone, } order = page_order(page); +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + __list_del_entry(&page->lru); + list_sort_add(page, zone, order, migratetype); +#else list_move(&page->lru, &zone->free_area[order].free_list[migratetype]); +#endif page += 1 << order; pages_moved += 1 << order; } @@ -2069,7 +2130,10 @@ static void steal_suitable_fallback(struct zone *zone, struct page *page, int start_type, bool whole_block) { unsigned int current_order = page_order(page); +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) +#else struct free_area *area; +#endif int free_pages, movable_pages, alike_pages; int old_block_type; @@ -2131,8 +2195,13 @@ static void steal_suitable_fallback(struct zone *zone, struct page *page, return; single_page: +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + __list_del_entry(&page->lru); + list_sort_add(page, zone, current_order, start_type); +#else area = &zone->free_area[current_order]; list_move(&page->lru, &area->free_list[start_type]); +#endif } /* @@ -2228,6 +2297,9 @@ static bool unreserve_highatomic_pageblock(const struct alloc_context *ac, struct page *page; int order; bool ret; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + int flc; +#endif for_each_zone_zonelist_nodemask(zone, z, zonelist, ac->high_zoneidx, ac->nodemask) { @@ -2240,8 +2312,15 @@ static bool unreserve_highatomic_pageblock(const struct alloc_context *ac, continue; spin_lock_irqsave(&zone->lock, flags); +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + for (flc = 0; flc < FREE_AREA_COUNTS; flc++) { +#endif for (order = 0; order < MAX_ORDER; order++) { +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + struct free_area *area = &(zone->free_area[flc][order]); +#else struct free_area *area = &(zone->free_area[order]); +#endif page = list_first_entry_or_null( &area->free_list[MIGRATE_HIGHATOMIC], @@ -2286,6 +2365,9 @@ static bool unreserve_highatomic_pageblock(const struct alloc_context *ac, return ret; } } +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + } +#endif spin_unlock_irqrestore(&zone->lock, flags); } @@ -2310,15 +2392,26 @@ __rmqueue_fallback(struct zone *zone, int order, int start_migratetype) struct page *page; int fallback_mt; bool can_steal; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + unsigned int flc = 0, flc_tmp = 0; +#endif /* * Find the largest available free page in the other list. This roughly * approximates finding the pageblock with the most free pages, which * would be too costly to do exactly. */ - for (current_order = MAX_ORDER - 1; current_order >= order; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + for (flc = 0; flc < FREE_AREA_COUNTS; flc++) { + flc_tmp = ajust_flc(flc, order); +#endif + for (current_order = MAX_ORDER - 1; current_order >= order; --current_order) { +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + area = &(zone->free_area[flc_tmp][current_order]); +#else area = &(zone->free_area[current_order]); +#endif fallback_mt = find_suitable_fallback(area, current_order, start_migratetype, false, &can_steal); if (fallback_mt == -1) @@ -2338,18 +2431,35 @@ __rmqueue_fallback(struct zone *zone, int order, int start_migratetype) goto do_steal; } - +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + } +#endif return false; find_smallest: +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + for (flc = 0; flc < FREE_AREA_COUNTS; flc++) { + flc_tmp = ajust_flc(flc, order); +#endif for (current_order = order; current_order < MAX_ORDER; current_order++) { +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + area = &(zone->free_area[flc_tmp][current_order]); +#else area = &(zone->free_area[current_order]); +#endif fallback_mt = find_suitable_fallback(area, current_order, start_migratetype, false, &can_steal); if (fallback_mt != -1) +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + goto do_steal; +#else break; +#endif } +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + } +#endif /* * This should not happen - we already found a suitable fallback @@ -2676,6 +2786,9 @@ void mark_free_pages(struct zone *zone) unsigned long flags; unsigned int order, t; struct page *page; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + unsigned int flc; +#endif if (zone_is_empty(zone)) return; @@ -2700,8 +2813,14 @@ void mark_free_pages(struct zone *zone) } for_each_migratetype_order(order, t) { +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + for (flc = 0; flc < FREE_AREA_COUNTS; flc++) { + list_for_each_entry(page, + &zone->free_areai[flc][order].free_list[t], lru) { +#else list_for_each_entry(page, &zone->free_area[order].free_list[t], lru) { +#endif unsigned long i; pfn = page_to_pfn(page); @@ -2713,6 +2832,9 @@ void mark_free_pages(struct zone *zone) swsusp_set_page_free(pfn_to_page(pfn + i)); } } +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + } +#endif } spin_unlock_irqrestore(&zone->lock, flags); } @@ -2808,6 +2930,9 @@ int __isolate_free_page(struct page *page, unsigned int order) unsigned long watermark; struct zone *zone; int mt; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + unsigned int flc; +#endif BUG_ON(!PageBuddy(page)); @@ -2830,7 +2955,13 @@ int __isolate_free_page(struct page *page, unsigned int order) /* Remove page from free list */ list_del(&page->lru); +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + flc = page_to_flc(page); + zone->free_area[flc][order].nr_free--; +#else zone->free_area[order].nr_free--; +#endif + rmv_page_order(page); /* @@ -3090,6 +3221,9 @@ bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark, long min = mark; int o; const bool alloc_harder = (alloc_flags & (ALLOC_HARDER|ALLOC_OOM)); +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + int flc; +#endif /* free_pages may go negative - that's OK */ free_pages -= (1 << order) - 1; @@ -3137,8 +3271,15 @@ bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark, return true; /* For a high-order request, check at least one suitable page is free */ +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + for (flc = 0; flc < FREE_AREA_COUNTS; flc++) { +#endif for (o = order; o < MAX_ORDER; o++) { +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + struct free_area *area = &z->free_area[flc][o]; +#else struct free_area *area = &z->free_area[o]; +#endif int mt; if (!area->nr_free) @@ -3167,6 +3308,9 @@ bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark, !list_empty(&area->free_list[MIGRATE_HIGHATOMIC])) return true; } +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + } +#endif return false; } @@ -4074,6 +4218,12 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, int no_progress_loops; unsigned int cpuset_mems_cookie; int reserve_flags; +#ifdef OPLUS_FEATURE_HEALTHINFO +/* Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-07-07, add alloc wait monitor support*/ +#ifdef CONFIG_OPPO_MEM_MONITOR + unsigned long oppo_alloc_start = jiffies; +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ /* * We also sanity check to catch abuse of atomic reserves being used by @@ -4309,6 +4459,12 @@ fail: warn_alloc(gfp_mask, ac->nodemask, "page allocation failure: order:%u", order); got_pg: +#ifdef OPLUS_FEATURE_HEALTHINFO +/* Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-07-07, add alloc wait monitor support*/ +#ifdef CONFIG_OPPO_MEM_MONITOR + memory_alloc_monitor(gfp_mask, order, jiffies_to_msecs(jiffies - oppo_alloc_start)); +#endif +#endif /* OPLUS_FEATURE_HEALTHINFO */ return page; } @@ -4878,6 +5034,9 @@ void show_free_areas(unsigned int filter, nodemask_t *nodemask) int cpu; struct zone *zone; pg_data_t *pgdat; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + int flc = 0; +#endif for_each_populated_zone(zone) { if (show_mem_node_skip(filter, zone_to_nid(zone), nodemask)) @@ -5029,7 +5188,11 @@ void show_free_areas(unsigned int filter, nodemask_t *nodemask) for_each_populated_zone(zone) { unsigned int order; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + unsigned long nr[FREE_AREA_COUNTS][MAX_ORDER], flags, total = 0; +#else unsigned long nr[MAX_ORDER], flags, total = 0; +#endif unsigned char types[MAX_ORDER]; if (show_mem_node_skip(filter, zone_to_nid(zone), nodemask)) @@ -5038,26 +5201,51 @@ void show_free_areas(unsigned int filter, nodemask_t *nodemask) printk(KERN_CONT "%s: ", zone->name); spin_lock_irqsave(&zone->lock, flags); +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + for (flc = 0 ; flc < FREE_AREA_COUNTS; flc++) { +#endif for (order = 0; order < MAX_ORDER; order++) { - struct free_area *area = &zone->free_area[order]; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + struct free_area *area = &zone->free_area[flc][order]; +#else + struct free_area *area = &zone->free_area[order]; +#endif int type; - nr[order] = area->nr_free; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + nr[flc][order] = area->nr_free; + total += nr[flc][order] << order; +#else + nr[order] = area->nr_free; total += nr[order] << order; - +#endif types[order] = 0; for (type = 0; type < MIGRATE_TYPES; type++) { if (!list_empty(&area->free_list[type])) types[order] |= 1 << type; } } +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + } +#endif spin_unlock_irqrestore(&zone->lock, flags); +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + for (flc = 0 ; flc < FREE_AREA_COUNTS; flc++) { +#endif for (order = 0; order < MAX_ORDER; order++) { printk(KERN_CONT "%lu*%lukB ", - nr[order], K(1UL) << order); - if (nr[order]) +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + nr[flc][order], K(1UL) << order); + if (nr[flc][order]) +#else + nr[order], K(1UL) << order); + if (nr[order]) +#endif show_migration_types(types[order]); } +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + } +#endif printk(KERN_CONT "= %lukB\n", K(total)); } @@ -5595,10 +5783,21 @@ not_early: static void __meminit zone_init_free_lists(struct zone *zone) { unsigned int order, t; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + int flc; + + for (flc = 0; flc < FREE_AREA_COUNTS; flc++) { + for_each_migratetype_order(order, t) { + INIT_LIST_HEAD(&zone->free_area[flc][order].free_list[t]); + zone->free_area[flc][order].nr_free = 0; + } + } +#else for_each_migratetype_order(order, t) { INIT_LIST_HEAD(&zone->free_area[order].free_list[t]); zone->free_area[order].nr_free = 0; } +#endif } #ifndef __HAVE_ARCH_MEMMAP_INIT @@ -6344,6 +6543,10 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat) set_pageblock_order(); setup_usemap(pgdat, zone, zone_start_pfn, size); init_currently_empty_zone(zone, zone_start_pfn, size); +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + ajust_zone_label(zone); +#endif + memmap_init(size, nid, j, zone_start_pfn); } } @@ -7962,6 +8165,9 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn) unsigned int order, i; unsigned long pfn; unsigned long flags; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + unsigned int flc; +#endif /* find the first valid pfn */ for (pfn = start_pfn; pfn < end_pfn; pfn++) if (pfn_valid(pfn)) @@ -7997,7 +8203,12 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn) #endif list_del(&page->lru); rmv_page_order(page); +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + flc = page_to_flc(page); + zone->free_area[flc][order].nr_free--; +#else zone->free_area[order].nr_free--; +#endif for (i = 0; i < (1 << order); i++) SetPageReserved((page+i)); post_alloc_hook(page, order, GFP_NOWAIT); diff --git a/mm/rmap.c b/mm/rmap.c index 6614dc769ea6..f226ba7c90b0 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -307,6 +307,74 @@ int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src) return -ENOMEM; } +#ifdef OPLUS_BUG_STABILITY +/*wanghao@BSP.Kernel.Function 2019/10/10 add for avoid apk recursive fork*/ +#define RECURSIVE_MAX_FORK_TIME 30 + +/* + * Attach the anon_vmas from src to dst. + * Returns length of anon_vma_chain on success, -ENOMEM on failure. + * + * If dst->anon_vma is NULL this function tries to find and reuse existing + * anon_vma which has no vmas and only one child anon_vma. This prevents + * degradation of anon_vma hierarchy to endless linear chain in case of + * constantly forking task. On the other hand, an anon_vma with more than one + * child isn't reused even if there was no alive vma, thus rmap walker has a + * good chance of avoiding scanning the whole hierarchy when it searches where + * page is mapped. + */ +int anon_vma_clone_oppo(struct vm_area_struct *dst, struct vm_area_struct *src) +{ + struct anon_vma_chain *avc, *pavc; + struct anon_vma *root = NULL; + int length = 0; + + list_for_each_entry_reverse(pavc, &src->anon_vma_chain, same_vma) { + struct anon_vma *anon_vma; + + avc = anon_vma_chain_alloc(GFP_NOWAIT | __GFP_NOWARN); + if (unlikely(!avc)) { + unlock_anon_vma_root(root); + root = NULL; + avc = anon_vma_chain_alloc(GFP_KERNEL); + if (!avc) + goto enomem_failure; + } + anon_vma = pavc->anon_vma; + root = lock_anon_vma_root(root, anon_vma); + anon_vma_chain_link(dst, avc, anon_vma); + length++; + + /* + * Reuse existing anon_vma if its degree lower than two, + * that means it has no vma and only one anon_vma child. + * + * Do not chose parent anon_vma, otherwise first child + * will always reuse it. Root anon_vma is never reused: + * it has self-parent reference and at least one child. + */ + if (!dst->anon_vma && anon_vma != src->anon_vma && + anon_vma->degree < 2) + dst->anon_vma = anon_vma; + } + if (dst->anon_vma) + dst->anon_vma->degree++; + unlock_anon_vma_root(root); + return length; + + enomem_failure: + /* + * dst->anon_vma is dropped here otherwise its degree can be incorrectly + * decremented in unlink_anon_vmas(). + * We can safely do this because callers of anon_vma_clone() don't care + * about dst->anon_vma if anon_vma_clone() failed. + */ + dst->anon_vma = NULL; + unlink_anon_vmas(dst); + return -ENOMEM; +} +#endif + /* * Attach vma to its own anon_vma, as well as to the anon_vmas that * the corresponding VMA in the parent process is attached to. @@ -329,10 +397,20 @@ int anon_vma_fork(struct vm_area_struct *vma, struct vm_area_struct *pvma) * First, attach the new VMA to the parent VMA's anon_vmas, * so rmap can find non-COWed pages in child processes. */ +#ifdef OPLUS_BUG_STABILITY + /*wanghao@BSP.Kernel.Function 2019/10/10 add for avoid apk recursive fork*/ + error = anon_vma_clone_oppo(vma, pvma); + if (error < 0) + return error; + else if (error > RECURSIVE_MAX_FORK_TIME) { + pr_err("[anon_vma_fork]%d: recursive fork more then 30 timges, pid is %d[%s]\n", __LINE__, get_current()->pid, get_current()->comm); + return -ENOMEM; + } +#else error = anon_vma_clone(vma, pvma); if (error) return error; - +#endif /* An existing anon_vma has been reused, all done then. */ if (vma->anon_vma) return 0; diff --git a/mm/slab_common.c b/mm/slab_common.c index 7fe72acfa501..47a1f142cb72 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -1080,9 +1080,15 @@ new_kmalloc_cache(int idx, int type, unsigned long flags) } else { name = kmalloc_info[idx].name; } +#if defined(CONFIG_OPLUS_FEATURE_SLABTRACE_DEBUG) +/* wen.luo@BSP.Kernel.Stability 2020-03-10, simple slabtrce for memleak analysis */ + kmalloc_caches[type][idx] = create_kmalloc_cache(name, + kmalloc_info[idx].size, flags|SLAB_STORE_USER); +#else kmalloc_caches[type][idx] = create_kmalloc_cache(name, kmalloc_info[idx].size, flags); +#endif } /* @@ -1235,6 +1241,12 @@ static void print_slabinfo_header(struct seq_file *m) seq_puts(m, " : globalstat "); seq_puts(m, " : cpustat "); #endif +#ifdef OPLUS_FEATURE_HEALTHINFO +/* Kui.Zhang@PSW.BSP.Kernel.Performance, 2018-11-12, if SLAB_STAT_DEBUG is + * is enabled, /proc/slabinfo is created for getting more slab details. */ + seq_puts(m, " "); + +#endif /* OPLUS_FEATURE_HEALTHINFO */ seq_putc(m, '\n'); } @@ -1290,8 +1302,16 @@ static void cache_show(struct kmem_cache *s, struct seq_file *m) seq_printf(m, " : tunables %4u %4u %4u", sinfo.limit, sinfo.batchcount, sinfo.shared); +#ifndef OPLUS_FEATURE_HEALTHINFO + /* Kui.Zhang@PSW.BSP.Kernel.Performance, 2018-11-12, if SLAB_STAT_DEBUG is + * is enabled, /proc/slabinfo is created for getting more slab details. */ seq_printf(m, " : slabdata %6lu %6lu %6lu", sinfo.active_slabs, sinfo.num_slabs, sinfo.shared_avail); +#else /* OPLUS_FEATURE_HEALTHINFO */ + seq_printf(m, " : slabdata %6lu %6lu %6lu %1d", + sinfo.active_slabs, sinfo.num_slabs, sinfo.shared_avail, + ((s->flags & SLAB_RECLAIM_ACCOUNT) == SLAB_RECLAIM_ACCOUNT) ? 1: 0); +#endif /* OPLUS_FEATURE_HEALTHINFO */ slabinfo_show_stats(m, s); seq_putc(m, '\n'); } diff --git a/mm/slub.c b/mm/slub.c index f950312acfde..980a4f8b100e 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -40,6 +40,19 @@ #include "internal.h" +/* wen.luo@BSP.Kernel.Stability 2020-03-10, simple slabtrce for memleak analysis */ +/* Enalbe slabtrace: + * CONFIG_OPLUS_FEATURE_SLABTRACE_DEBUG=y + * Get more info disable Randomize_base + * CONFIG_RANDOMIZE_BASE=n + * after add the config, cat /proc/slabtrace to get slab userinfo + */ +#if defined(CONFIG_OPLUS_FEATURE_SLABTRACE_DEBUG) +#ifndef CONFIG_RANDOMIZE_BASE +#define COMPACT_OPLUS_SLUB_TRACK +#endif +#endif + /* * Lock order: * 1. slab_mutex (Global Mutex) @@ -202,7 +215,15 @@ static inline bool kmem_cache_has_cpu_partial(struct kmem_cache *s) struct track { unsigned long addr; /* Called from address */ #ifdef CONFIG_STACKTRACE +#if defined(COMPACT_OPLUS_SLUB_TRACK) +/* wen.luo@BSP.Kernel.Stability 2020-03-10, simple slabtrce for memleak analysis */ +/* Store the offset after MODULES_VADDR for + * kernel module and kernel text address + */ + u32 addrs[TRACK_ADDRS_COUNT]; +#else unsigned long addrs[TRACK_ADDRS_COUNT]; /* Called from address */ +#endif #endif int cpu; /* Was running on cpu */ int pid; /* Pid context */ @@ -460,7 +481,13 @@ static inline bool cmpxchg_double_slab(struct kmem_cache *s, struct page *page, * Node listlock must be held to guarantee that the page does * not vanish from under us. */ -static void get_map(struct kmem_cache *s, struct page *page, unsigned long *map) +#if defined(CONFIG_OPLUS_FEATURE_SLABTRACE_DEBUG) +/* wen.luo@BSP.Kernel.Stability 2020-03-10, simple slabtrce for memleak analysis */ +void +#else +static void +#endif +get_map(struct kmem_cache *s, struct page *page, unsigned long *map) { void *p; void *addr = page_address(page); @@ -468,6 +495,10 @@ static void get_map(struct kmem_cache *s, struct page *page, unsigned long *map) for (p = page->freelist; p; p = get_freepointer(s, p)) set_bit(slab_index(p, s, addr), map); } +#if defined(CONFIG_OPLUS_FEATURE_SLABTRACE_DEBUG) +/* wen.luo@BSP.Kernel.Stability 2020-03-10, simple slabtrce for memleak analysis */ +EXPORT_SYMBOL(get_map); +#endif static inline int size_from_object(struct kmem_cache *s) { @@ -566,6 +597,35 @@ static void set_track(struct kmem_cache *s, void *object, if (addr) { #ifdef CONFIG_STACKTRACE +#if defined(COMPACT_OPLUS_SLUB_TRACK) +/* wen.luo@BSP.Kernel.Stability 2020-03-10, simple slabtrce for memleak analysis */ + unsigned long addrs[TRACK_ADDRS_COUNT]; + struct stack_trace trace; + int i; + + memset(addrs, 0, sizeof(addrs)); + trace.nr_entries = 0; + trace.max_entries = TRACK_ADDRS_COUNT; + + trace.entries = addrs; + trace.skip = 3; + save_stack_trace(&trace); + + /* See rant in lockdep.c */ + if (trace.nr_entries != 0 && + trace.entries[trace.nr_entries - 1] == ULONG_MAX) + trace.nr_entries--; + + for (i = trace.nr_entries; i < TRACK_ADDRS_COUNT; i++) + addrs[i] = 0; + + for (i = 0; i < TRACK_ADDRS_COUNT; i++) { + if (addrs[i]) + p->addrs[i] = addrs[i] - MODULES_VADDR; + else + p->addrs[i] = 0; + } +#else struct stack_trace trace; int i; @@ -584,6 +644,7 @@ static void set_track(struct kmem_cache *s, void *object, for (i = trace.nr_entries; i < TRACK_ADDRS_COUNT; i++) p->addrs[i] = 0; +#endif #endif p->addr = addr; p->cpu = smp_processor_id(); @@ -610,6 +671,29 @@ static void print_track(const char *s, struct track *t) pr_err("INFO: %s in %pS age=%lu cpu=%u pid=%d\n", s, (void *)t->addr, jiffies - t->when, t->cpu, t->pid); #ifdef CONFIG_STACKTRACE +#if defined(COMPACT_OPLUS_SLUB_TRACK) +/* wen.luo@BSP.Kernel.Stability 2020-03-10, simple slabtrce for memleak analysis */ + { + int i; + unsigned long addrs[TRACK_ADDRS_COUNT]; + + /* we store the offset after MODULES_VADDR for + * kernel module and kernel text address + */ + for (i = 0; i < TRACK_ADDRS_COUNT; i++) { + if (t->addrs[i]) + addrs[i] = MODULES_VADDR + t->addrs[i]; + else + addrs[i] = 0; + } + for (i = 0; i < TRACK_ADDRS_COUNT; i++) { + if (addrs[i]) + pr_err("\t%pS\n", (void *)addrs[i]); + else + break; + } + } +#else { int i; for (i = 0; i < TRACK_ADDRS_COUNT; i++) @@ -619,6 +703,7 @@ static void print_track(const char *s, struct track *t) break; } #endif +#endif } static void print_tracking(struct kmem_cache *s, void *object) @@ -2419,10 +2504,20 @@ static bool has_cpu_slab(int cpu, void *info) return c->page || slub_percpu_partial(c); } -static void flush_all(struct kmem_cache *s) +#if defined(CONFIG_OPLUS_FEATURE_SLABTRACE_DEBUG) +/* wen.luo@BSP.Kernel.Stability 2020-03-10, simple slabtrce for memleak analysis */ +void +#else +static void +#endif +flush_all(struct kmem_cache *s) { on_each_cpu_cond(has_cpu_slab, flush_cpu_slab, s, 1, GFP_ATOMIC); } +#if defined(CONFIG_OPLUS_FEATURE_SLABTRACE_DEBUG) +/* wen.luo@BSP.Kernel.Stability 2020-03-10, simple slabtrce for memleak analysis */ +EXPORT_SYMBOL(flush_all); +#endif /* * Use the cpu notifier to insure that the cpu slabs are flushed when @@ -4577,9 +4672,22 @@ static long validate_slab_cache(struct kmem_cache *s) * and freed. */ +#if defined(CONFIG_OPLUS_FEATURE_SLABTRACE_DEBUG) +/* wen.luo@BSP.Kernel.Stability 2020-03-10, simple slabtrce for memleak analysis */ +#define OPLUS_MEMCFG_SLABTRACE_CNT 4 +#if (OPLUS_MEMCFG_SLABTRACE_CNT > TRACK_ADDRS_COUNT) +#error (OPLUS_MEMCFG_SLABTRACE_CNT > TRACK_ADDRS_COUNT) +#endif +#endif struct location { unsigned long count; unsigned long addr; +#if defined(CONFIG_OPLUS_FEATURE_SLABTRACE_DEBUG) +/* wen.luo@BSP.Kernel.Stability 2020-03-10, simple slabtrce for memleak analysis */ +#ifdef CONFIG_STACKTRACE + unsigned long addrs[OPLUS_MEMCFG_SLABTRACE_CNT]; /* caller address */ +#endif +#endif long long sum_time; long min_time; long max_time; @@ -4602,7 +4710,13 @@ static void free_loc_track(struct loc_track *t) get_order(sizeof(struct location) * t->max)); } -static int alloc_loc_track(struct loc_track *t, unsigned long max, gfp_t flags) +#if defined(CONFIG_OPLUS_FEATURE_SLABTRACE_DEBUG) +/* wen.luo@BSP.Kernel.Stability 2020-03-10, simple slabtrce for memleak analysis */ +int +#else +static int +#endif +alloc_loc_track(struct loc_track *t, unsigned long max, gfp_t flags) { struct location *l; int order; @@ -4621,6 +4735,10 @@ static int alloc_loc_track(struct loc_track *t, unsigned long max, gfp_t flags) t->loc = l; return 1; } +#if defined(CONFIG_OPLUS_FEATURE_SLABTRACE_DEBUG) +/* wen.luo@BSP.Kernel.Stability 2020-03-10, simple slabtrce for memleak analysis */ +EXPORT_SYMBOL(alloc_loc_track); +#endif static int add_location(struct loc_track *t, struct kmem_cache *s, const struct track *track) diff --git a/mm/swap.c b/mm/swap.c index d8a04ac681c0..61d37ab818ee 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -1021,4 +1021,7 @@ void __init swap_setup(void) * Right now other parts of the system means that we * _really_ don't want to cluster much more */ +#if defined(OPLUS_FEATURE_ZRAM_OPT) && defined(CONFIG_OPLUS_ZRAM_OPT) + page_cluster = 0; +#endif /*OPLUS_FEATURE_ZRAM_OPT*/ } diff --git a/mm/swap_slots.c b/mm/swap_slots.c index f778aa38127e..5fdfd526cdb6 100644 --- a/mm/swap_slots.c +++ b/mm/swap_slots.c @@ -328,8 +328,12 @@ swp_entry_t get_swap_page(struct page *page) * so cache->free_lock is not taken. */ cache = raw_cpu_ptr(&swp_slots); - +#if defined(CONFIG_NANDSWAP) + if (check_cache_active() && + !current_is_nswapoutd()) { +#else if (check_cache_active()) { +#endif mutex_lock(&cache->alloc_lock); if (cache->slots) { repeat: diff --git a/mm/swapfile.c b/mm/swapfile.c index 72c0a28a0e10..192a325c26ee 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -959,6 +959,7 @@ start_over: int ret; spin_unlock(&swap_avail_lock); + ret = swap_ratio(&si, node); if (ret < 0) { /* @@ -977,6 +978,14 @@ start_over: spin_unlock(&swap_avail_lock); start: spin_lock(&si->lock); +#if defined(CONFIG_NANDSWAP) + if ((current_is_nswapoutd() && !(si->flags & SWP_NANDSWAP)) || + (!current_is_nswapoutd() && (si->flags & SWP_NANDSWAP))) { + spin_lock(&swap_avail_lock); + spin_unlock(&si->lock); + goto nextsi; + } +#endif if (!si->highest_bit || !(si->flags & SWP_WRITEOK)) { spin_lock(&swap_avail_lock); if (plist_node_empty(&si->avail_lists[node])) { @@ -3326,7 +3335,10 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) setup_swap_ratio(p, prio); } enable_swap_info(p, prio, swap_map, cluster_info, frontswap_map); - +#if defined(CONFIG_NANDSWAP) + if (p->prio == SWAP_NANDSWAP_PRIO) + p->flags |= SWP_NANDSWAP; +#endif pr_info("Adding %uk swap on %s. Priority:%d extents:%d across:%lluk %s%s%s%s%s\n", p->pages<<(PAGE_SHIFT-10), name->name, p->prio, nr_extents, (unsigned long long)span<<(PAGE_SHIFT-10), diff --git a/mm/util.c b/mm/util.c index 44ffa7caed6e..52895ca70bf3 100644 --- a/mm/util.c +++ b/mm/util.c @@ -17,6 +17,9 @@ #include #include +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) +#include +#endif #include "internal.h" @@ -238,13 +241,20 @@ void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma, struct vm_area_struct *prev, struct rb_node *rb_parent) { struct vm_area_struct *next; +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + struct vm_area_struct *curr_vma = NULL; +#endif vma->vm_prev = prev; if (prev) { next = prev->vm_next; prev->vm_next = vma; } else { +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + curr_vma = vma; +#else mm->mmap = vma; +#endif if (rb_parent) next = rb_entry(rb_parent, struct vm_area_struct, vm_rb); @@ -254,6 +264,15 @@ void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma, vma->vm_next = next; if (next) next->vm_prev = vma; + +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + if (curr_vma) { + if (BACKUP_ALLOC_FLAG(vma->vm_flags)) + mm->reserve_mmap = curr_vma; + else + mm->mmap = curr_vma; + } +#endif } /* Check if the vma is being used as a stack by this task */ @@ -332,6 +351,14 @@ unsigned long vm_mmap_pgoff(struct file *file, unsigned long addr, return -EINTR; ret = do_mmap_pgoff(file, addr, len, prot, flag, pgoff, &populate, &uf); +#if defined(OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY) && defined(CONFIG_VIRTUAL_RESERVE_MEMORY) + /* + * update the mm->mmap_base while create reserved area pass, + * the gap between stack and mmap_base is decreased. + */ + if (!IS_ERR_VALUE(ret) && check_reserve_mmap_doing(mm)) + mm->mmap_base += PAGE_ALIGN(len); +#endif up_write(&mm->mmap_sem); userfaultfd_unmap_complete(mm, &uf); if (populate) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 7e3bcd86c957..641f7af7a3d4 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2843,7 +2843,11 @@ static int s_show(struct seq_file *m, void *p) seq_printf(m, "0x%pK-0x%pK %7ld", v->addr, v->addr + v->size, v->size); - if (v->caller) +#ifdef VENDOR_EDIT //wanghao@bsp.drv modify for android.bg get pss too slow + if (v->caller && (strcmp(current->comm, "android.bg") != 0)) +#else + if (v->caller) +#endif seq_printf(m, " %pS", v->caller); if (v->nr_pages) diff --git a/mm/vmscan.c b/mm/vmscan.c index f60ba74a2da1..be495c83a219 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -57,11 +57,24 @@ #include #include +#if defined(OPLUS_FEATURE_PROCESS_RECLAIM) && defined(CONFIG_PROCESS_RECLAIM_ENHANCE) +/* + * collect interrupt doing time during process reclaim, only effect in age test + */ +#include +#endif + #include "internal.h" #define CREATE_TRACE_POINTS #include +#if defined(OPLUS_FEATURE_ZRAM_OPT) && defined(CONFIG_FG_TASK_UID) +#include +#endif /*OPLUS_FEATURE_ZRAM_OPT*/ +#if defined(OPLUS_FEATURE_MULTI_KSWAPD) && defined(CONFIG_OPLUS_MULTI_KSWAPD) +#include +#endif /*OPLUS_FEATURE_MULTI_KSWAPD*/ struct scan_control { /* How many pages shrink_list() should reclaim */ unsigned long nr_to_reclaim; @@ -124,6 +137,13 @@ struct scan_control { * on memory until last task zap it. */ struct vm_area_struct *target_vma; + +#if defined(OPLUS_FEATURE_PROCESS_RECLAIM) && defined(CONFIG_PROCESS_RECLAIM_ENHANCE) + /* robin.ren@PSW.BSP.Kernel.Performance, 2019-03-13, + * use mm_walk to regonize the behaviour of process reclaim. + */ + struct mm_walk *walk; +#endif }; #ifdef ARCH_HAS_PREFETCH @@ -158,6 +178,12 @@ struct scan_control { * From 0 .. 100. Higher means more swappy. */ int vm_swappiness = 60; +#if defined(OPLUS_FEATURE_ZRAM_OPT) && defined(CONFIG_OPLUS_ZRAM_OPT) +/* + * Direct reclaim swappiness, exptct 0 - 60. Higher means more swappy and slower. + */ +int direct_vm_swappiness = 60; +#endif /*OPLUS_FEATURE_ZRAM_OPT*/ /* * The total number of pages which are beyond the high watermark within all * zones. @@ -993,6 +1019,10 @@ static unsigned long shrink_page_list(struct list_head *page_list, enum page_references references = PAGEREF_RECLAIM; bool dirty, writeback; +#if defined(OPLUS_FEATURE_PROCESS_RECLAIM) && defined(CONFIG_PROCESS_RECLAIM_ENHANCE) + if (sc->walk && is_reclaim_should_cancel(sc->walk)) + break; +#endif cond_resched(); page = lru_to_page(page_list); @@ -1418,9 +1448,51 @@ unsigned long reclaim_clean_pages_from_list(struct zone *zone, return ret; } +#if defined(CONFIG_NANDSWAP) +unsigned long nswap_reclaim_page_list(struct list_head *page_list, + struct vm_area_struct *vma, bool scan) +{ + unsigned long nr_reclaimed; + unsigned long nr_scan = 0; + struct page *page; + struct scan_control sc = { + .gfp_mask = GFP_KERNEL, + .priority = DEF_PRIORITY, + .may_writepage = 1, + .may_unmap = 1, + .may_swap = 1, + .target_vma = vma, + }; + + list_for_each_entry(page, page_list, lru) { + ClearPageActive(page); + } + + nr_reclaimed = shrink_page_list(page_list, NULL, &sc, + TTU_IGNORE_ACCESS, NULL, true); + + while (!list_empty(page_list)) { + page = lru_to_page(page_list); + if (PageSwapCache(page) && !PageDirty(page)) + nr_scan++; + list_del(&page->lru); + dec_node_page_state(page, NR_ISOLATED_ANON + + page_is_file_cache(page)); + putback_lru_page(page); + } + + return scan ? nr_scan : nr_reclaimed; +} +#endif + #ifdef CONFIG_PROCESS_RECLAIM +#if defined(OPLUS_FEATURE_PROCESS_RECLAIM) && defined(CONFIG_PROCESS_RECLAIM_ENHANCE) +unsigned long reclaim_pages_from_list(struct list_head *page_list, + struct vm_area_struct *vma, struct mm_walk *walk) +#else unsigned long reclaim_pages_from_list(struct list_head *page_list, struct vm_area_struct *vma) +#endif { struct scan_control sc = { .gfp_mask = GFP_KERNEL, @@ -1429,6 +1501,9 @@ unsigned long reclaim_pages_from_list(struct list_head *page_list, .may_unmap = 1, .may_swap = 1, .target_vma = vma, +#if defined(OPLUS_FEATURE_PROCESS_RECLAIM) && defined(CONFIG_PROCESS_RECLAIM_ENHANCE) + .walk = walk, +#endif }; unsigned long nr_reclaimed; @@ -1682,7 +1757,15 @@ int isolate_lru_page(struct page *page) int ret = -EBUSY; VM_BUG_ON_PAGE(!page_count(page), page); +#if defined(OPLUS_FEATURE_PROCESS_RECLAIM) && defined(CONFIG_PROCESS_RECLAIM_ENHANCE) + /* + * Because process reclaim is doing page by + * page, so there many compound pages are relcaimed, so too many warning msg on this case. + */ + WARN_RATELIMIT((!current_is_reclaimer() && PageTail(page)), "trying to isolate tail page"); +#else WARN_RATELIMIT(PageTail(page), "trying to isolate tail page"); +#endif if (PageLRU(page)) { struct zone *zone = page_zone(page); @@ -1829,6 +1912,14 @@ putback_inactive_pages(struct lruvec *lruvec, struct list_head *page_list) */ static int current_may_throttle(void) { +#if defined(OPLUS_FEATURE_ZRAM_OPT) && defined(CONFIG_OPLUS_ZRAM_OPT) + if ((current->signal->oom_score_adj < 0) +#ifdef CONFIG_FG_TASK_UID + || is_fg(current_uid().val) +#endif + ) + return 0; +#endif /*OPLUS_FEATURE_ZRAM_OPT*/ return !(current->flags & PF_LESS_THROTTLE) || current->backing_dev_info == NULL || bdi_write_congested(current->backing_dev_info); @@ -2224,8 +2315,13 @@ static bool inactive_list_is_low(struct lruvec *lruvec, bool file, inactive_ratio = 0; } else { gb = (inactive + active) >> (30 - PAGE_SHIFT); +#if defined(OPLUS_FEATURE_ZRAM_OPT) && defined(CONFIG_OPLUS_ZRAM_OPT) + if (file && gb) + inactive_ratio = min(2UL, int_sqrt(10 * gb)); +#else if (gb) inactive_ratio = int_sqrt(10 * gb); +#endif /*OPLUS_FEATURE_ZRAM_OPT*/ else inactive_ratio = 1; } @@ -2282,8 +2378,14 @@ static void get_scan_count(struct lruvec *lruvec, struct mem_cgroup *memcg, unsigned long ap, fp; enum lru_list lru; +#if defined(OPLUS_FEATURE_ZRAM_OPT) && defined(CONFIG_OPLUS_ZRAM_OPT) + if (!current_is_kswapd()) + swappiness = direct_vm_swappiness; + if (!sc->may_swap || (mem_cgroup_get_nr_swap_pages(memcg) <= total_swap_pages>>6)) { +#else /* If we have no swap space, do not bother scanning anon pages. */ if (!sc->may_swap || mem_cgroup_get_nr_swap_pages(memcg) <= 0) { +#endif /*OPLUS_FEATURE_ZRAM_OPT*/ scan_balance = SCAN_FILE; goto out; } @@ -3632,7 +3734,11 @@ static void kswapd_try_to_sleep(pg_data_t *pgdat, int alloc_order, int reclaim_o * If there are applications that are active memory-allocators * (most normal use), this basically shouldn't matter. */ +#if defined(OPLUS_FEATURE_MULTI_KSWAPD) && defined(CONFIG_OPLUS_MULTI_KSWAPD) + int kswapd(void *p) +#else static int kswapd(void *p) +#endif /*OPLUS_FEATURE_MULTI_KSWAPD*/ { unsigned int alloc_order, reclaim_order; unsigned int classzone_idx = MAX_NR_ZONES - 1; @@ -3797,6 +3903,9 @@ unsigned long shrink_all_memory(unsigned long nr_to_reclaim) restore their cpu bindings. */ static int kswapd_cpu_online(unsigned int cpu) { +#if defined(OPLUS_FEATURE_MULTI_KSWAPD) && defined(CONFIG_OPLUS_MULTI_KSWAPD) + return kswapd_cpu_online_ext(cpu); +#else int nid; for_each_node_state(nid, N_MEMORY) { @@ -3810,6 +3919,7 @@ static int kswapd_cpu_online(unsigned int cpu) set_cpus_allowed_ptr(pgdat->kswapd, mask); } return 0; +#endif /*OPLUS_FEATURE_MULTI_KSWAPD*/ } /* @@ -3818,6 +3928,9 @@ static int kswapd_cpu_online(unsigned int cpu) */ int kswapd_run(int nid) { +#if defined(OPLUS_FEATURE_MULTI_KSWAPD) && defined(CONFIG_OPLUS_MULTI_KSWAPD) + return kswapd_run_ext(nid); +#else pg_data_t *pgdat = NODE_DATA(nid); int ret = 0; @@ -3833,6 +3946,7 @@ int kswapd_run(int nid) pgdat->kswapd = NULL; } return ret; +#endif /*OPLUS_FEATURE_MULTI_KSWAPD*/ } /* @@ -3841,12 +3955,16 @@ int kswapd_run(int nid) */ void kswapd_stop(int nid) { +#if defined(OPLUS_FEATURE_MULTI_KSWAPD) && defined(CONFIG_OPLUS_MULTI_KSWAPD) + return kswapd_stop_ext(nid); +#else struct task_struct *kswapd = NODE_DATA(nid)->kswapd; if (kswapd) { kthread_stop(kswapd); NODE_DATA(nid)->kswapd = NULL; } +#endif /*OPLUS_FEATURE_MULTI_KSWAPD*/ } static int __init kswapd_init(void) diff --git a/mm/vmstat.c b/mm/vmstat.c index 828233c3dba6..c4132c5c7e0a 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -30,6 +30,10 @@ #include "internal.h" +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) +#include "multi_freearea.h" +#endif + #define NUMA_STATS_THRESHOLD (U16_MAX - 2) #ifdef CONFIG_VM_EVENT_COUNTERS @@ -950,26 +954,39 @@ static void fill_contig_page_info(struct zone *zone, struct contig_page_info *info) { unsigned int order; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + int flc; +#endif info->free_pages = 0; info->free_blocks_total = 0; info->free_blocks_suitable = 0; - for (order = 0; order < MAX_ORDER; order++) { - unsigned long blocks; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + for (flc = 0; flc < FREE_AREA_COUNTS; flc++) { +#endif + for (order = 0; order < MAX_ORDER; order++) { + unsigned long blocks; - /* Count number of free blocks */ - blocks = zone->free_area[order].nr_free; - info->free_blocks_total += blocks; + /* Count number of free blocks */ +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + blocks = zone->free_area[flc][order].nr_free; +#else + blocks = zone->free_area[order].nr_free; +#endif + info->free_blocks_total += blocks; - /* Count free base pages */ - info->free_pages += blocks << order; + /* Count free base pages */ + info->free_pages += blocks << order; - /* Count the suitable free blocks */ - if (order >= suitable_order) - info->free_blocks_suitable += blocks << - (order - suitable_order); - } + /* Count the suitable free blocks */ + if (order >= suitable_order) + info->free_blocks_suitable += blocks << + (order - suitable_order); + } +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + } +#endif } /* @@ -1054,7 +1071,10 @@ const char * const vmstat_text[] = { "nr_zspages", #endif "nr_free_cma", - +#ifdef OPLUS_FEATURE_HEALTHINFO +/*Huacai.Zhou@PSW.BSP.Kernel.MM, 2018-09-25, add ion cached account*/ + "nr_ioncache_pages", +#endif /* OPLUS_FEATURE_HEALTHINFO */ /* enum numa_stat_item counters */ #ifdef CONFIG_NUMA "numa_hit", @@ -1285,10 +1305,20 @@ static void frag_show_print(struct seq_file *m, pg_data_t *pgdat, struct zone *zone) { int order; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + int flc = 0; +#endif seq_printf(m, "Node %d, zone %8s ", pgdat->node_id, zone->name); +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + for (flc = 0; flc < FREE_AREA_COUNTS; flc++) { + for (order = 0; order < MAX_ORDER; ++order) + seq_printf(m, "%6lu ", zone->free_area[flc][order].nr_free); + } +#else for (order = 0; order < MAX_ORDER; ++order) seq_printf(m, "%6lu ", zone->free_area[order].nr_free); +#endif seq_putc(m, '\n'); } @@ -1307,6 +1337,11 @@ static void pagetypeinfo_showfree_print(struct seq_file *m, { int order, mtype; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + int flc; + + for (flc = 0; flc < FREE_AREA_COUNTS; flc++) { +#endif for (mtype = 0; mtype < MIGRATE_TYPES; mtype++) { seq_printf(m, "Node %4d, zone %8s, type %12s ", pgdat->node_id, @@ -1317,7 +1352,11 @@ static void pagetypeinfo_showfree_print(struct seq_file *m, struct free_area *area; struct list_head *curr; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + area = &(zone->free_area[flc][order]); +#else area = &(zone->free_area[order]); +#endif list_for_each(curr, &area->free_list[mtype]) freecount++; @@ -1325,6 +1364,9 @@ static void pagetypeinfo_showfree_print(struct seq_file *m, } seq_putc(m, '\n'); } +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + } +#endif } /* Print out the free pages at each order for each migatetype */ @@ -1935,6 +1977,9 @@ struct workqueue_struct *mm_percpu_wq; void __init init_mm_internals(void) { int ret __maybe_unused; +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + struct proc_dir_entry *pentry; +#endif mm_percpu_wq = alloc_workqueue("mm_percpu_wq", WQ_MEM_RECLAIM, 0); @@ -1961,6 +2006,13 @@ void __init init_mm_internals(void) proc_create("pagetypeinfo", 0400, NULL, &pagetypeinfo_file_operations); proc_create("vmstat", 0444, NULL, &vmstat_file_operations); proc_create("zoneinfo", 0444, NULL, &zoneinfo_file_operations); +#if defined(OPLUS_FEATURE_MULTI_FREEAREA) && defined(CONFIG_PHYSICAL_ANTI_FRAGMENTATION) + pentry = proc_create("free_area_list_show", S_IRWXUGO, NULL, &proc_free_area_fops); + if (!pentry) { + pr_err("vmstat: failed to create '/proc/free_area_list_show'\n"); + return; + } +#endif #endif } diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 84cedf4ebc5c..e9c237634981 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -69,7 +69,11 @@ * A single 'zspage' is composed of up to 2^N discontiguous 0-order (single) * pages. ZS_MAX_ZSPAGE_ORDER defines upper limit on N. */ +#if defined(OPLUS_FEATURE_ZRAM_OPT) && defined(CONFIG_OPLUS_ZRAM_OPT) +#define ZS_MAX_ZSPAGE_ORDER 3 +#else #define ZS_MAX_ZSPAGE_ORDER 2 +#endif /*OPLUS_FEATURE_ZRAM_OPT*/ #define ZS_MAX_PAGES_PER_ZSPAGE (_AC(1, UL) << ZS_MAX_ZSPAGE_ORDER) #define ZS_HANDLE_SIZE (sizeof(unsigned long)) @@ -119,7 +123,11 @@ #define FULLNESS_BITS 2 #define CLASS_BITS 8 +#if defined(OPLUS_FEATURE_ZRAM_OPT) && defined(CONFIG_OPLUS_ZRAM_OPT) +#define ISOLATED_BITS (ZS_MAX_ZSPAGE_ORDER+1) +#else #define ISOLATED_BITS 3 +#endif /*OPLUS_FEATURE_ZRAM_OPT*/ #define MAGIC_VAL_BITS 8 #define MAX(a, b) ((a) >= (b) ? (a) : (b)) diff --git a/net/Makefile b/net/Makefile index 9e3c324df362..ab3212660445 100644 --- a/net/Makefile +++ b/net/Makefile @@ -88,3 +88,25 @@ obj-$(CONFIG_QRTR) += qrtr/ obj-$(CONFIG_NET_NCSI) += ncsi/ obj-$(CONFIG_RMNET_DATA) += rmnet_data/ obj-$(CONFIG_RMNET_USB) += rmnet_usb/ +#ifdef OPLUS_FEATURE_WIFI_SLA +#HuangJunyuan@CONNECTIVITY.WIFI.INTERNET.1197891, 2018/04/10,Add code for appo sla function +obj-y += oplus_sla/ +#endif /* OPLUS_FEATURE_WIFI_SLA */ + +OPLUS_FEATURE_WIFI_LUCKYMONEY = 1 +ifneq ($(OPLUS_FEATURE_WIFI_LUCKYMONEY),) +#HuangYuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/18, Add for WeChat lucky money recognition +obj-y += oplus_nf_hooks/ +endif #/* OPLUS_FEATURE_WIFI_LUCKYMONEY */ + +OPLUS_FEATURE_DHCP = 1 +ifneq ($(OPLUS_FEATURE_DHCP),) +#LianGenglin@CONNECTIVITY.WIFI.INTERNET, 2020/05/09, Add for Dhcp conflict +obj-y += oplus_dhcp/ +endif #/* OPLUS_FEATURE_DHCP */ + +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER +#Ruansong@PSW.NW.DATA.213000, 2020/06/01. +#Add for classify glink wakeup services and count IPA wakeup. +obj-y += oplus_nwpower/ +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ \ No newline at end of file diff --git a/net/core/dev.c b/net/core/dev.c index 4af3fa399e22..8858fe2b8a0f 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -144,6 +144,11 @@ #include #include #include +#ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED +//HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function +#include +#endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + #include #include #include @@ -2999,7 +3004,13 @@ static int xmit_one(struct sk_buff *skb, struct net_device *dev, unsigned int len; int rc; + #ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED + //HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function + if ((!list_empty(&ptype_all) || !list_empty(&dev->ptype_all)) && + !(skb->imq_flags & IMQ_F_ENQUEUE)) + #else /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all)) + #endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ dev_queue_xmit_nit(skb, dev); len = skb->len; @@ -3037,6 +3048,11 @@ out: *ret = rc; return skb; } +#ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED +//HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function +EXPORT_SYMBOL_GPL(dev_hard_start_xmit); +#endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + static struct sk_buff *validate_xmit_vlan(struct sk_buff *skb, netdev_features_t features) diff --git a/net/core/secure_seq.c b/net/core/secure_seq.c index 7232274de334..477eebd0178f 100644 --- a/net/core/secure_seq.c +++ b/net/core/secure_seq.c @@ -119,6 +119,14 @@ u32 secure_tcp_ts_off(const struct net *net, __be32 saddr, __be32 daddr) if (net->ipv4.sysctl_tcp_timestamps != 1) return 0; + #ifdef OPLUS_BUG_STABILITY + //PengHao@CONNECTIVITY.WIFI.INTERNET.1854960,2019/03/30,add for disable tcp random timestamp,some networks limit tcp syn before login + if (net->ipv4.sysctl_tcp_random_timestamp == 0) + { + return 0; + } + #endif /* OPLUS_BUG_STABILITY */ + ts_secret_init(); return siphash_2u32((__force u32)saddr, (__force u32)daddr, &ts_secret); diff --git a/net/core/skbuff.c b/net/core/skbuff.c index eb54fbb09cc5..98bc510eed31 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -82,6 +82,88 @@ static struct kmem_cache *skbuff_fclone_cache __read_mostly; int sysctl_max_skb_frags __read_mostly = MAX_SKB_FRAGS; EXPORT_SYMBOL(sysctl_max_skb_frags); +#ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED +//HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function +static struct kmem_cache *skbuff_cb_store_cache __read_mostly; + +/* Control buffer save/restore for IMQ devices */ +struct skb_cb_table { + char cb[48] __aligned(8); + void *cb_next; + atomic_t refcnt; +}; + +static DEFINE_SPINLOCK(skb_cb_store_lock); + +int skb_save_cb(struct sk_buff *skb) +{ + struct skb_cb_table *next; + + next = kmem_cache_alloc(skbuff_cb_store_cache, GFP_ATOMIC); + if (!next) + return -ENOMEM; + + BUILD_BUG_ON(sizeof(skb->cb) != sizeof(next->cb)); + + memcpy(next->cb, skb->cb, sizeof(skb->cb)); + next->cb_next = skb->cb_next; + + atomic_set(&next->refcnt, 1); + + skb->cb_next = next; + return 0; +} +EXPORT_SYMBOL(skb_save_cb); + +int skb_restore_cb(struct sk_buff *skb) +{ + struct skb_cb_table *next; + + if (!skb->cb_next) + return 0; + + next = skb->cb_next; + + BUILD_BUG_ON(sizeof(skb->cb) != sizeof(next->cb)); + + memcpy(skb->cb, next->cb, sizeof(skb->cb)); + skb->cb_next = next->cb_next; + + spin_lock(&skb_cb_store_lock); + + if (atomic_dec_and_test(&next->refcnt)) + kmem_cache_free(skbuff_cb_store_cache, next); + + spin_unlock(&skb_cb_store_lock); + + return 0; +} +EXPORT_SYMBOL(skb_restore_cb); + +static void skb_copy_stored_cb(struct sk_buff * , const struct sk_buff * ) __attribute__ ((unused)); +static void skb_copy_stored_cb(struct sk_buff *new, const struct sk_buff *__old) +{ + struct skb_cb_table *next; + struct sk_buff *old; + + if (!__old->cb_next) { + new->cb_next = NULL; + return; + } + + spin_lock(&skb_cb_store_lock); + + old = (struct sk_buff *)__old; + + next = old->cb_next; + atomic_inc(&next->refcnt); + new->cb_next = next; + + spin_unlock(&skb_cb_store_lock); +} +#endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + + /** * skb_panic - private function for out-of-line support * @skb: buffer @@ -624,6 +706,30 @@ void skb_release_head_state(struct sk_buff *skb) WARN_ON(in_irq()); skb->destructor(skb); } + #ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED + //HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function + /* + * This should not happen. When it does, avoid memleak by restoring + * the chain of cb-backups. + */ + while (skb->cb_next != NULL) { + if (net_ratelimit()) + pr_warn("IMQ: kfree_skb: skb->cb_next: %08x\n", + (unsigned int)(uintptr_t)skb->cb_next); + + skb_restore_cb(skb); + } + /* + * This should not happen either, nf_queue_entry is nullified in + * imq_dev_xmit(). If we have non-NULL nf_queue_entry then we are + * leaking entry pointers, maybe memory. We don't know if this is + * pointer to already freed memory, or should this be freed. + * If this happens we need to add refcounting, etc for nf_queue_entry. + */ + if (skb->nf_queue_entry && net_ratelimit()) + pr_warn("%s\n", "IMQ: kfree_skb: skb->nf_queue_entry != NULL"); + #endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + #if IS_ENABLED(CONFIG_NF_CONNTRACK) nf_conntrack_put(skb_nfct(skb)); #endif @@ -814,6 +920,13 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old) #endif __nf_copy(new, old, false); + #ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED + //HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function + new->cb_next = NULL; + /*skb_copy_stored_cb(new, old);*/ + #endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + + /* Note : this field could be in headers_start/headers_end section * It is not yet because we do not want to have a 16 bit hole */ @@ -3956,6 +4069,14 @@ void __init skb_init(void) 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); + #ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED + //HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function + skbuff_cb_store_cache = kmem_cache_create("skbuff_cb_store_cache", + sizeof(struct skb_cb_table), + 0, + SLAB_HWCACHE_ALIGN|SLAB_PANIC, + NULL); + #endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ } static int diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index a403001c50af..5df59f47d371 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c @@ -1116,6 +1116,15 @@ struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu) goto out; } dst->ops->update_pmtu(dst, sk, NULL, mtu, true); + #ifdef OPLUS_FEATURE_WIFI_MTUDETECT + //TangRongzheng@CONNECTIVITY.WIFI.NETWORK.1066205, 2016/11/03. + //Add for [1066205] when receives ICMP_FRAG_NEEDED, reduces the mtu of net_device. + pr_err("%s: current_mtu = %d , frag_mtu = %d mtu = %d\n", __func__, dst->dev->mtu, dst_mtu(dst),mtu); + //do not use dst_mtu here, because dst_mtu should be changed by update_pmtu after inet_csk_rebuild_route + if (dst->dev->mtu > mtu && mtu > IPV6_MIN_MTU) { + dst->dev->mtu = mtu; + } + #endif /* OPLUS_FEATURE_WIFI_MTUDETECT */ dst = __sk_dst_check(sk, 0); if (!dst) diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c index 8bd0d7b26632..9c7d67bcac78 100644 --- a/net/ipv4/netfilter/ipt_REJECT.c +++ b/net/ipv4/netfilter/ipt_REJECT.c @@ -30,6 +30,12 @@ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Netfilter Core Team "); MODULE_DESCRIPTION("Xtables: packet \"rejection\" target for IPv4"); +//#ifdef OPLUS_FEATURE_WIFI_SLA +//HuangJunyuan@CONNECTIVITY.WIFI.INTERNET.1197891, 2018/04/10,Add code for appo sla function +void (*mark_streams_for_iptables_reject)(struct sk_buff *skb,enum ipt_reject_with reject_type) = NULL; +EXPORT_SYMBOL(mark_streams_for_iptables_reject); +//#endif /* OPLUS_FEATURE_WIFI_SLA */ + static unsigned int reject_tg(struct sk_buff *skb, const struct xt_action_param *par) { @@ -64,7 +70,12 @@ reject_tg(struct sk_buff *skb, const struct xt_action_param *par) /* Doesn't happen. */ break; } - + //#ifdef OPLUS_FEATURE_WIFI_SLA + //HuangJunyuan@CONNECTIVITY.WIFI.INTERNET.1197891, 2018/04/10,Add code for appo sla function + if (mark_streams_for_iptables_reject) { + mark_streams_for_iptables_reject(skb,reject->with); + } + //#endif /* OPLUS_FEATURE_WIFI_SLA */ return NF_DROP; } diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 902ff04951c5..61edffaa8f9f 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -791,7 +791,16 @@ static struct ctl_table ipv4_table[] = { .extra1 = &tcp_use_userconfig_min, .extra2 = &tcp_use_userconfig_max, }, - + #ifdef OPLUS_BUG_STABILITY + //ZhaoMengqingCONNECTIVITY.WIFI.INTERNET.1394484, 2019/04/02,add for: When find TCP SYN-ACK Timestamp value error, just do not use Timestamp + { + .procname = "tcp_timestamps_control", + .data = &sysctl_tcp_ts_control, + .maxlen = sizeof(sysctl_tcp_ts_control), + .mode = 0664, + .proc_handler = proc_dointvec + }, + #endif /* OPLUS_BUG_STABILITY */ { } }; @@ -1209,6 +1218,16 @@ static struct ctl_table ipv4_net_table[] = { .extra1 = &three, .extra2 = &hundred, }, + #ifdef OPLUS_BUG_STABILITY + //PengHao@CONNECTIVITY.WIFI.INTERNET.1854960,2019/03/30,add for disable tcp random timestamp,some networks limit tcp syn before login + { + .procname = "tcp_random_timestamp", + .data = &init_net.ipv4.sysctl_tcp_random_timestamp, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, + #endif /* OPLUS_BUG_STABILITY */ { } }; diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 8bd532f118b8..af72e4fcec98 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -306,6 +306,12 @@ EXPORT_SYMBOL(sysctl_tcp_delack_seg); int sysctl_tcp_use_userconfig __read_mostly; EXPORT_SYMBOL(sysctl_tcp_use_userconfig); +#ifdef OPLUS_BUG_STABILITY +//ZhaoMengqing@CONNECTIVITY.WIFI.INTERNET.1394484, 2019/04/02,add for: When find TCP SYN-ACK Timestamp value error, just do not use Timestamp +int sysctl_tcp_ts_control[2] __read_mostly = {0,0}; +EXPORT_SYMBOL(sysctl_tcp_ts_control); +#endif /* OPLUS_BUG_STABILITY */ + /* * Current number of TCP sockets. */ diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 00a85567d2ae..18162b98775d 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -121,9 +121,25 @@ int sysctl_tcp_invalid_ratelimit __read_mostly = HZ/2; #define TCP_REMNANT (TCP_FLAG_FIN|TCP_FLAG_URG|TCP_FLAG_SYN|TCP_FLAG_PSH) #define TCP_HP_BITS (~(TCP_RESERVED_BITS|TCP_FLAG_PSH)) +//#ifdef OPLUS_FEATURE_WIFI_SLA +//HuangJunyuan@CONNECTIVITY.WIFI.NETWORK.4502, 2018/04/10,Add code for appo sla function +void (*statistic_dev_rtt)(struct sock *sk,long rtt) = NULL; +EXPORT_SYMBOL(statistic_dev_rtt); +//#endif /* OPLUS_FEATURE_WIFI_SLA */ + #define REXMIT_NONE 0 /* no loss recovery to do */ #define REXMIT_LOST 1 /* retransmit packets marked lost */ #define REXMIT_NEW 2 /* FRTO-style transmit of unsent/new packets */ +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER +/* +*Ruansong@PSW.NW.DATA.213300, 2020/06/01 +*Add for classify glink wakeup services +*/ +#include +extern atomic_t tcpsynretrans_hook_boot; +extern struct work_struct oplus_tcp_input_tcpsynretrans_hook_work; +extern struct oplus_tcp_hook_struct oplus_tcp_input_tcpsynretrans_hook; +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ static void tcp_gro_dev_warn(struct sock *sk, const struct sk_buff *skb, unsigned int len) @@ -780,6 +796,13 @@ static void tcp_rtt_estimator(struct sock *sk, long mrtt_us) tp->rtt_seq = tp->snd_nxt; tp->mdev_max_us = tcp_rto_min_us(sk); } + //#ifdef OPLUS_FEATURE_WIFI_SLA + //HuangJunyuan@CONNECTIVITY.WIFI.NETWORK.4502, 2018/04/10, + //Add code for appo sla function + if(TCP_ESTABLISHED == sk->sk_state && NULL != statistic_dev_rtt){ + statistic_dev_rtt(sk,mrtt_us); + } + //#endif /* OPLUS_FEATURE_WIFI_SLA */ } else { /* no previous measure. */ srtt = m << 3; /* take the measured time to be rtt */ @@ -4678,6 +4701,13 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb) struct tcp_sock *tp = tcp_sk(sk); bool fragstolen; int eaten; +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.213400, 2020/06/01 + *Add for classify glink wakeup services + */ + struct timespec now_ts; +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ if (TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq) { __kfree_skb(skb); @@ -4736,6 +4766,30 @@ queue_and_out: if (!after(TCP_SKB_CB(skb)->end_seq, tp->rcv_nxt)) { /* A retransmit, 2nd most common case. Force an immediate ack. */ +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.213500, 2020/06/01 + *Add for classify glink wakeup services + */ + if (atomic_read(&tcpsynretrans_hook_boot) == 1) { + now_ts = current_kernel_time(); + if (((now_ts.tv_sec * 1000 + now_ts.tv_nsec / 1000000) - sk->oplus_last_rcv_stamp[0]) > OPLUS_TCP_RETRANSMISSION_INTERVAL) { + if (sk->sk_v6_daddr.s6_addr32[0] == 0 && sk->sk_v6_daddr.s6_addr32[1] == 0) { + oplus_tcp_input_tcpsynretrans_hook.ipv4_addr = sk->sk_daddr; + oplus_tcp_input_tcpsynretrans_hook.is_ipv6 = false; + schedule_work(&oplus_tcp_input_tcpsynretrans_hook_work); + } else { + oplus_tcp_input_tcpsynretrans_hook.ipv6_addr1 = (u64)ntohl(sk->sk_v6_daddr.s6_addr32[0]) << 32 | ntohl(sk->sk_v6_daddr.s6_addr32[1]); + oplus_tcp_input_tcpsynretrans_hook.ipv6_addr2 = (u64)ntohl(sk->sk_v6_daddr.s6_addr32[2]) << 32 | ntohl(sk->sk_v6_daddr.s6_addr32[3]); + oplus_tcp_input_tcpsynretrans_hook.is_ipv6 = true; + schedule_work(&oplus_tcp_input_tcpsynretrans_hook_work); + } + oplus_tcp_input_tcpsynretrans_hook.uid = from_kuid_munged(&init_user_ns, sk->sk_uid); + oplus_tcp_input_tcpsynretrans_hook.pid = sk->sk_oplus_pid; + } + } +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ + NET_INC_STATS(sock_net(sk), LINUX_MIB_DELAYEDACKLOST); tcp_dsack_set(sk, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq); @@ -5692,6 +5746,17 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, struct tcp_fastopen_cookie foc = { .len = -1 }; int saved_clamp = tp->rx_opt.mss_clamp; bool fastopen_fail; + #ifdef OPLUS_BUG_STABILITY + //ZhaoMengqing@CONNECTIVITY.WIFI.INTERNET.1394484, 2019/04/02,add for: When find TCP SYN-ACK Timestamp value error, just do not use Timestamp + static int ts_error_count = 0; + int ts_error_threshold = sysctl_tcp_ts_control[0]; + + //when network change (frameworks set sysctl_tcp_ts_control[1] = 1), clear ts_error_count + if (sysctl_tcp_ts_control[1] == 1) { + ts_error_count = 0; + sysctl_tcp_ts_control[1] = 0; + } + #endif /* OPLUS_BUG_STABILITY */ tcp_parse_options(sock_net(sk), skb, &tp->rx_opt, 0, &foc); if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr) @@ -5715,9 +5780,27 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, tcp_time_stamp(tp))) { NET_INC_STATS(sock_net(sk), LINUX_MIB_PAWSACTIVEREJECTED); + #ifdef OPLUS_BUG_STABILITY + //ZhaoMengqing@CONNECTIVITY.WiFi.Network.internet.1394484, 2019/04/02,add for: When find TCP SYN-ACK Timestamp value error, just do not use Timestamp + //if count > threshold, disable TCP Timestamps + if (ts_error_threshold > 0) { + ts_error_count++; + if (ts_error_count >= ts_error_threshold) { + sock_net(sk)->ipv4.sysctl_tcp_timestamps = 0; + ts_error_count = 0; + } + } + #endif /* OPLUS_BUG_STABILITY */ goto reset_and_undo; } - + #ifdef OPLUS_BUG_STABILITY + //ZhaoMengqing@CONNECTIVITY.WiFi.Network.internet.1394484, 2019/04/02,add for: When find TCP SYN-ACK Timestamp value error, just do not use Timestamp + //if other connection's Timestamp is correct, the network environment may be OK + if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr && + ts_error_threshold > 0 && ts_error_count > 0) { + ts_error_count--; + } + #endif /* OPLUS_BUG_STABILITY */ /* Now ACK is acceptable. * * "If the RST bit is set diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 8762416fa53e..63290b1d4c49 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -85,6 +85,20 @@ #include #include +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER +/* +*Ruansong@PSW.NW.DATA.213600, 2020/06/01 +*Add for classify glink wakeup services +*/ +#include +extern atomic_t oplus_tcp_is_input; +extern atomic_t ipa_wakeup_hook_boot; +extern atomic_t custom_rule_penetrate_bpf_boot; +extern struct work_struct oplus_tcp_input_hook_work; +extern struct oplus_tcp_hook_struct oplus_tcp_input_hook; +extern struct timespec oplus_tcp_last_transmission_stamp; +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ + #ifdef CONFIG_TCP_MD5SIG static int tcp_v4_md5_hash_hdr(char *md5_hash, const struct tcp_md5sig_key *key, __be32 daddr, __be32 saddr, const struct tcphdr *th); @@ -1634,6 +1648,29 @@ int tcp_v4_rcv(struct sk_buff *skb) struct sock *sk; int ret; +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.213700, 2020/06/01. + *Add for classify glink wakeup services. + */ + struct timespec now_ts; + struct iphdr *tmp_iph; + bool sch_work = false; + + if (atomic_read(&ipa_wakeup_hook_boot) == 1) { + if (atomic_read(&oplus_tcp_is_input) == 0) { + now_ts = current_kernel_time(); + tmp_iph = ip_hdr(skb); + if (((now_ts.tv_sec * 1000 + now_ts.tv_nsec / 1000000) - (oplus_tcp_last_transmission_stamp.tv_sec * 1000 + oplus_tcp_last_transmission_stamp.tv_nsec / 1000000)) > OPLUS_TRANSMISSION_INTERVAL) { + atomic_set(&oplus_tcp_is_input, 1); + oplus_tcp_input_hook.ipv4_addr = tmp_iph->saddr; + oplus_tcp_input_hook.is_ipv6 = false; + } + } + oplus_tcp_last_transmission_stamp = current_kernel_time(); + } +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ + if (skb->pkt_type != PACKET_HOST) goto discard_it; @@ -1666,6 +1703,25 @@ lookup: if (!sk) goto no_tcp_socket; +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.213800, 2020/06/01. + *Add for classify glink wakeup services. + */ + if (atomic_read(&ipa_wakeup_hook_boot) == 1) { + if (atomic_read(&oplus_tcp_is_input) == 1 && !sch_work) { + if (sk->sk_state != TCP_TIME_WAIT) { + oplus_tcp_input_hook.uid = from_kuid_munged(&init_user_ns, sk->sk_uid); + oplus_tcp_input_hook.pid = sk->sk_oplus_pid; + } + schedule_work(&oplus_tcp_input_hook_work); + sch_work = true; + } + sk->oplus_last_rcv_stamp[0] = sk->oplus_last_rcv_stamp[1]; + sk->oplus_last_rcv_stamp[1] = oplus_tcp_last_transmission_stamp.tv_sec * 1000 + oplus_tcp_last_transmission_stamp.tv_nsec / 1000000; + } +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ + process: if (sk->sk_state == TCP_TIME_WAIT) goto do_time_wait; @@ -1775,6 +1831,16 @@ bad_packet: } discard_it: +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.213900, 2020/06/01. + *Add for classify glink wakeup services. + */ + if (atomic_read(&ipa_wakeup_hook_boot) == 1 && atomic_read(&oplus_tcp_is_input) == 1 && !sch_work) { + schedule_work(&oplus_tcp_input_hook_work); + sch_work = true; + } +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ /* Discard frame. */ kfree_skb(skb); return 0; @@ -2520,6 +2586,11 @@ static int __net_init tcp_sk_init(struct net *net) net->ipv4.sysctl_tcp_timestamps = 1; net->ipv4.sysctl_tcp_default_init_rwnd = TCP_INIT_CWND * 2; + #ifdef OPLUS_BUG_STABILITY + //PengHao@CONNECTIVITY.WIFI.INTERNET.1854960,2019/03/30,add for disable tcp random timestamp,some networks limit tcp syn before login + net->ipv4.sysctl_tcp_random_timestamp = 1; + #endif /* OPLUS_BUG_STABILITY */ + return 0; fail: tcp_sk_exit(net); diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 00a3164b148d..2e03f2c0998f 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -62,6 +62,22 @@ int sysctl_tcp_tso_win_divisor __read_mostly = 3; /* By default, RFC2861 behavior. */ int sysctl_tcp_slow_start_after_idle __read_mostly = 1; +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER +/* +*Ruansong@PSW.NW.DATA.212800, 2020/06/01 +*Add for classify glink wakeup services +*/ +#include +extern atomic_t oplus_tcp_is_input; +extern atomic_t ipa_wakeup_hook_boot; +extern struct timespec oplus_tcp_last_transmission_stamp; +extern struct work_struct oplus_tcp_output_hook_work; +extern struct oplus_tcp_hook_struct oplus_tcp_output_hook; +extern atomic_t tcpsynretrans_hook_boot; +extern struct work_struct oplus_tcp_output_tcpsynretrans_hook_work; +extern struct oplus_tcp_hook_struct oplus_tcp_output_tcpsynretrans_hook; +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ + static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, int push_one, gfp_t gfp); @@ -1005,6 +1021,13 @@ static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, struct tcp_md5sig_key *md5; struct tcphdr *th; int err; +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.212900, 2020/06/01 + *Add for classify glink wakeup services + */ + struct timespec now_ts; +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ BUG_ON(!skb || !tcp_skb_pcount(skb)); tp = tcp_sk(sk); @@ -1132,6 +1155,45 @@ static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, err = icsk->icsk_af_ops->queue_xmit(sk, skb, &inet->cork.fl); +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.213000, 2020/06/01. + *Add for classify glink wakeup services. + */ + if (atomic_read(&ipa_wakeup_hook_boot) == 1) { + if (atomic_read(&oplus_tcp_is_input) == 0) { + now_ts = current_kernel_time(); + + if (((now_ts.tv_sec * 1000 + now_ts.tv_nsec / 1000000) - + (oplus_tcp_last_transmission_stamp.tv_sec * 1000 + + oplus_tcp_last_transmission_stamp.tv_nsec / 1000000)) > OPLUS_TRANSMISSION_INTERVAL) { + atomic_set(&oplus_tcp_is_input, 3); + + if (sk->sk_v6_daddr.s6_addr32[0] == 0 && sk->sk_v6_daddr.s6_addr32[1] == 0) { + oplus_tcp_output_hook.ipv4_addr = sk->sk_daddr; + oplus_tcp_output_hook.is_ipv6 = false; + schedule_work(&oplus_tcp_output_hook_work); + } else { + oplus_tcp_output_hook.ipv6_addr1 = (u64)ntohl(sk->sk_v6_daddr.s6_addr32[0]) << 32 + | ntohl(sk->sk_v6_daddr.s6_addr32[1]); + oplus_tcp_output_hook.ipv6_addr2 = (u64)ntohl(sk->sk_v6_daddr.s6_addr32[2]) << 32 + | ntohl(sk->sk_v6_daddr.s6_addr32[3]); + oplus_tcp_output_hook.is_ipv6 = true; + schedule_work(&oplus_tcp_output_hook_work); + } + + oplus_tcp_output_hook.uid = from_kuid_munged(&init_user_ns, sk->sk_uid); + oplus_tcp_output_hook.pid = sk->sk_oplus_pid; + } + } + + oplus_tcp_last_transmission_stamp = current_kernel_time(); + sk->oplus_last_send_stamp[0] = sk->oplus_last_send_stamp[1]; + sk->oplus_last_send_stamp[1] = oplus_tcp_last_transmission_stamp.tv_sec * 1000 + + oplus_tcp_last_transmission_stamp.tv_nsec / 1000000; + } +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ + if (unlikely(err > 0)) { tcp_enter_cwr(sk); err = net_xmit_eval(err); @@ -2853,7 +2915,13 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs) struct tcp_sock *tp = tcp_sk(sk); unsigned int cur_mss; int diff, len, err; - +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.213100, 2020/06/01 + *Add for classify glink wakeup services + */ + struct timespec now_ts; +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ /* Inconclusive MTU probe */ if (icsk->icsk_mtup.probe_size) @@ -2942,6 +3010,29 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs) if (likely(!err)) { TCP_SKB_CB(skb)->sacked |= TCPCB_EVER_RETRANS; +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.213200, 2020/06/01 + *Add for classify glink wakeup services + */ + if (atomic_read(&tcpsynretrans_hook_boot) == 1) { + now_ts = current_kernel_time(); + if (((now_ts.tv_sec * 1000 + now_ts.tv_nsec / 1000000) - sk->oplus_last_send_stamp[0]) > OPLUS_TCP_RETRANSMISSION_INTERVAL) { + if (sk->sk_v6_daddr.s6_addr32[0] == 0 && sk->sk_v6_daddr.s6_addr32[1] == 0) { + oplus_tcp_output_tcpsynretrans_hook.ipv4_addr = sk->sk_daddr; + oplus_tcp_output_tcpsynretrans_hook.is_ipv6 = false; + schedule_work(&oplus_tcp_output_tcpsynretrans_hook_work); + } else { + oplus_tcp_output_tcpsynretrans_hook.ipv6_addr1 = (u64)ntohl(sk->sk_v6_daddr.s6_addr32[0]) << 32 | ntohl(sk->sk_v6_daddr.s6_addr32[1]); + oplus_tcp_output_tcpsynretrans_hook.ipv6_addr2 = (u64)ntohl(sk->sk_v6_daddr.s6_addr32[2]) << 32 | ntohl(sk->sk_v6_daddr.s6_addr32[3]); + oplus_tcp_output_tcpsynretrans_hook.is_ipv6 = true; + schedule_work(&oplus_tcp_output_tcpsynretrans_hook_work); + } + oplus_tcp_output_tcpsynretrans_hook.uid = from_kuid_munged(&init_user_ns, sk->sk_uid); + oplus_tcp_output_tcpsynretrans_hook.pid = sk->sk_oplus_pid; + } + } +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ } else if (err != -EBUSY) { NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPRETRANSFAIL, segs); } diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index 8ad1e317c631..8f34dc471fe7 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c @@ -159,6 +159,15 @@ static void tcp_mtu_probing(struct inet_connection_sock *icsk, struct sock *sk) { struct net *net = sock_net(sk); + #ifdef OPLUS_FEATURE_WIFI_MTUDETECT + //Rongzheng.tang@PSW.CN.WiFi.Network.internet.1066205, 2016/11/03, + /* + * Modify for [804055] enabling mtu probing when an ICMP black hole detected, + * help avoid the problem of MTU black holes. + */ + net->ipv4.sysctl_tcp_mtu_probing = 1; + #endif /* VENDOR_EDIT */ + /* Black hole detection */ if (net->ipv4.sysctl_tcp_mtu_probing) { if (!icsk->icsk_mtup.enabled) { diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 98ab1564aade..b26c5b471853 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -1498,6 +1498,14 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk, if (confirm_neigh) dst_confirm_neigh(dst, daddr); +#ifdef OPLUS_BUG_STABILITY + //Huang.junyuan@PSW.CN.WiFi.Network.internet, 2020/06/08, + //ipv6 RFC8201 test + if (mtu < IPV6_MIN_MTU) { + return; + } +#endif /* OPLUS_BUG_STABILITY */ + mtu = max_t(u32, mtu, IPV6_MIN_MTU); if (mtu >= dst_mtu(dst)) return; diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 20b4a14b9e1a..b1fa32208238 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -69,6 +69,20 @@ #include #include +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER +/* +*Ruansong@PSW.NW.DATA.214200, 2020/06/01. +*Add for classify glink wakeup services. +*/ +#include +extern atomic_t oplus_tcp_is_input; +extern atomic_t ipa_wakeup_hook_boot; +extern atomic_t custom_rule_penetrate_bpf_boot; +extern struct work_struct oplus_tcp_input_hook_work; +extern struct oplus_tcp_hook_struct oplus_tcp_input_hook; +extern struct timespec oplus_tcp_last_transmission_stamp; +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ + static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb); static void tcp_v6_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb, struct request_sock *req); @@ -1409,6 +1423,29 @@ static int tcp_v6_rcv(struct sk_buff *skb) int ret; struct net *net = dev_net(skb->dev); +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.214200, 2020/06/01. + *Add for classify glink wakeup services. + */ + struct timespec now_ts; + struct ipv6hdr *tmp_iph; + bool sch_work = false; + + if (atomic_read(&ipa_wakeup_hook_boot) == 1) { + if (atomic_read(&oplus_tcp_is_input) == 0) { + now_ts = current_kernel_time(); + tmp_iph = ipv6_hdr(skb); + if (((now_ts.tv_sec * 1000 + now_ts.tv_nsec / 1000000) - (oplus_tcp_last_transmission_stamp.tv_sec * 1000 + oplus_tcp_last_transmission_stamp.tv_nsec / 1000000)) > OPLUS_TRANSMISSION_INTERVAL) { + atomic_set(&oplus_tcp_is_input, 2); + oplus_tcp_input_hook.ipv6_addr1 = (u64)ntohl(tmp_iph->saddr.s6_addr32[0]) << 32 | ntohl(tmp_iph->saddr.s6_addr32[1]); + oplus_tcp_input_hook.ipv6_addr2 = (u64)ntohl(tmp_iph->saddr.s6_addr32[2]) << 32 | ntohl(tmp_iph->saddr.s6_addr32[3]); + oplus_tcp_input_hook.is_ipv6 = true; + } + } + oplus_tcp_last_transmission_stamp = current_kernel_time(); + } +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ if (skb->pkt_type != PACKET_HOST) goto discard_it; @@ -1440,6 +1477,25 @@ lookup: if (!sk) goto no_tcp_socket; +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.214300, 200/06/01. + *Add for classify glink wakeup services. + */ + if (atomic_read(&ipa_wakeup_hook_boot) == 1) { + if (atomic_read(&oplus_tcp_is_input) == 2 && !sch_work) { + if (sk->sk_state != TCP_TIME_WAIT) { + oplus_tcp_input_hook.uid = from_kuid_munged(&init_user_ns, sk->sk_uid); + oplus_tcp_input_hook.pid = sk->sk_oplus_pid; + } + schedule_work(&oplus_tcp_input_hook_work); + sch_work = true; + } + sk->oplus_last_rcv_stamp[0]= sk->oplus_last_rcv_stamp[1]; + sk->oplus_last_rcv_stamp[1] = oplus_tcp_last_transmission_stamp.tv_sec * 1000 + oplus_tcp_last_transmission_stamp.tv_nsec / 1000000; + } +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ + process: if (sk->sk_state == TCP_TIME_WAIT) goto do_time_wait; @@ -1543,6 +1599,16 @@ bad_packet: } discard_it: +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.214400, 2020/06/01. + *Add for classify glink wakeup services. + */ + if (atomic_read(&ipa_wakeup_hook_boot) == 1 && atomic_read(&oplus_tcp_is_input) == 2 && !sch_work) { + schedule_work(&oplus_tcp_input_hook_work); + sch_work = true; + } +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ kfree_skb(skb); return 0; diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig index 7fe5ca21f0be..40e40c171b52 100644 --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig @@ -881,6 +881,21 @@ config NETFILTER_XT_TARGET_LOG To compile it as a module, choose M here. If unsure, say N. +#ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED +#HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function +config NETFILTER_XT_TARGET_IMQ + tristate '"IMQ" target support' + depends on NETFILTER_XTABLES + depends on IP_NF_MANGLE || IP6_NF_MANGLE + select IMQ + default y + help + This option adds a `IMQ' target which is used to specify if and + to which imq device packets should get enqueued/dequeued. + + To compile it as a module, choose M here. If unsure, say N. +#endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + config NETFILTER_XT_TARGET_MARK tristate '"MARK" target support' depends on NETFILTER_ADVANCED diff --git a/net/netfilter/Makefile b/net/netfilter/Makefile index aeaaf2522674..ee4edee41d2a 100644 --- a/net/netfilter/Makefile +++ b/net/netfilter/Makefile @@ -125,6 +125,10 @@ obj-$(CONFIG_NETFILTER_XT_TARGET_CT) += xt_CT.o obj-$(CONFIG_NETFILTER_XT_TARGET_DSCP) += xt_DSCP.o obj-$(CONFIG_NETFILTER_XT_TARGET_HL) += xt_HL.o obj-$(CONFIG_NETFILTER_XT_TARGET_HMARK) += xt_HMARK.o +ifneq ($(OPLUS_FEATURE_WIFI_LIMMITBGSPEED),) +#HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function +obj-$(CONFIG_NETFILTER_XT_TARGET_IMQ) += xt_IMQ.o +endif # OPLUS_FEATURE_WIFI_LIMMITBGSPEED obj-$(CONFIG_NETFILTER_XT_TARGET_LED) += xt_LED.o obj-$(CONFIG_NETFILTER_XT_TARGET_LOG) += xt_LOG.o obj-$(CONFIG_NETFILTER_XT_TARGET_NETMAP) += xt_NETMAP.o diff --git a/net/netfilter/core.c b/net/netfilter/core.c index 52cd2901a097..57ae6d90252b 100644 --- a/net/netfilter/core.c +++ b/net/netfilter/core.c @@ -474,6 +474,15 @@ int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state, if (ret == 0) ret = -EPERM; return ret; + #ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED + //HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function + case NF_IMQ_QUEUE: + ret = nf_queue(skb, state, e, s, verdict); + if (ret == -ECANCELED) + continue; + return ret; + #endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + case NF_QUEUE: ret = nf_queue(skb, state, e, s, verdict); if (ret == 1) diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c index b06ef4c62522..a054ded981df 100644 --- a/net/netfilter/nf_queue.c +++ b/net/netfilter/nf_queue.c @@ -27,6 +27,24 @@ * receives, no matter what. */ +#ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED +//HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function +static const struct nf_queue_handler __rcu *queue_imq_handler __read_mostly; + +void nf_register_queue_imq_handler(const struct nf_queue_handler *qh) +{ + rcu_assign_pointer(queue_imq_handler, qh); +} +EXPORT_SYMBOL_GPL(nf_register_queue_imq_handler); + +void nf_unregister_queue_imq_handler(void) +{ + RCU_INIT_POINTER(queue_imq_handler, NULL); + synchronize_rcu(); +} +EXPORT_SYMBOL_GPL(nf_unregister_queue_imq_handler); +#endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + /* return EBUSY when somebody else is registered, return EEXIST if the * same handler is registered, return 0 in case of success. */ void nf_register_queue_handler(struct net *net, const struct nf_queue_handler *qh) @@ -111,9 +129,16 @@ unsigned int nf_queue_nf_hook_drop(struct net *net) } EXPORT_SYMBOL_GPL(nf_queue_nf_hook_drop); +#ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED +//HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function +static int __nf_queue(struct sk_buff *skb, const struct nf_hook_state *state, + const struct nf_hook_entries *entries, + unsigned int index, unsigned int verdict) +#else /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ static int __nf_queue(struct sk_buff *skb, const struct nf_hook_state *state, const struct nf_hook_entries *entries, unsigned int index, unsigned int queuenum) +#endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ { int status = -ENOENT; struct nf_queue_entry *entry = NULL; @@ -121,8 +146,23 @@ static int __nf_queue(struct sk_buff *skb, const struct nf_hook_state *state, const struct nf_queue_handler *qh; struct net *net = state->net; + #ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED + //HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function + unsigned int queuetype = verdict & NF_VERDICT_MASK; + unsigned int queuenum = verdict >> NF_VERDICT_QBITS; + #endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + /* QUEUE == DROP if no one is waiting, to be safe. */ + #ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED + //HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function + if (queuetype == NF_IMQ_QUEUE) { + qh = rcu_dereference(queue_imq_handler); + } else { + qh = rcu_dereference(net->nf.queue_handler); + } + #else /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ qh = rcu_dereference(net->nf.queue_handler); + #endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ if (!qh) { status = -ESRCH; goto err; @@ -173,8 +213,21 @@ int nf_queue(struct sk_buff *skb, struct nf_hook_state *state, { int ret; + #ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED + //HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function + ret = __nf_queue(skb, state, entries, index, verdict); + #else /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ ret = __nf_queue(skb, state, entries, index, verdict >> NF_VERDICT_QBITS); + #endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + if (ret < 0) { + #ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED + //HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function + /* IMQ Bypass */ + if (ret == -ECANCELED && skb->imq_flags == 0) { + return 1; + } + #endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ if (ret == -ESRCH && (verdict & NF_VERDICT_FLAG_QUEUE_BYPASS)) return 1; @@ -260,6 +313,10 @@ next_hook: entry->state.okfn(entry->state.net, entry->state.sk, skb); local_bh_enable(); break; + #ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED + //HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function + case NF_IMQ_QUEUE: + #endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ case NF_QUEUE: err = nf_queue(skb, &entry->state, hooks, i, verdict); if (err == 1) diff --git a/net/netfilter/xt_HARDIDLETIMER.c b/net/netfilter/xt_HARDIDLETIMER.c index ea8b103a3f39..04a7c183b62f 100644 --- a/net/netfilter/xt_HARDIDLETIMER.c +++ b/net/netfilter/xt_HARDIDLETIMER.c @@ -157,6 +157,11 @@ static enum alarmtimer_restart hardidletimer_tg_alarmproc(struct alarm *alarm, return ALARMTIMER_NORESTART; } +#ifdef OPLUS_FEATURE_POWERINFO_STANDBY +//Nanwei.Deng@BSP.Power.Basic, 2020/07/27, add for wakelock profiler +enum alarmtimer_restart (*net_alarm_func)(struct alarm *, ktime_t now) = hardidletimer_tg_alarmproc; +#endif /* OPLUS_FEATURE_POWERINFO_STANDBY */ + static int hardidletimer_tg_create(struct hardidletimer_tg_info *info) { int ret; @@ -188,6 +193,11 @@ static int hardidletimer_tg_create(struct hardidletimer_tg_info *info) alarm_init(&info->timer->alarm, ALARM_BOOTTIME, hardidletimer_tg_alarmproc); + #ifdef OPLUS_FEATURE_POWERINFO_STANDBY + //Yunqing.Zeng@BSP.Power.Basic 2017/12/12 add for filter net alarm counter + net_alarm_func = hardidletimer_tg_alarmproc; + #endif /* VENDOR_EDIT */ + info->timer->alarm.data = info->timer; info->timer->refcnt = 1; info->timer->send_nl_msg = (info->send_nl_msg == 0) ? false : true; diff --git a/net/netfilter/xt_owner.c b/net/netfilter/xt_owner.c index 3d705c688a27..2e8e73085cfa 100644 --- a/net/netfilter/xt_owner.c +++ b/net/netfilter/xt_owner.c @@ -20,6 +20,27 @@ #include #include + +//Yuanhua.Du@NETWORK.DATA, 2020/04/018, Add for new TAG format +#ifndef OPLUS_FEATURE_XTOWNER_INPUT +#define OPLUS_FEATURE_XTOWNER_INPUT +#endif + +#ifdef OPLUS_FEATURE_XTOWNER_INPUT +//Shangjin.Tang@NETWORK.DATA, 2019/09/05 +//add for BUG 2212301 +#include +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) +#include +#include +#include +#endif +#include +#include +#define XT_SOCKET_SUPPORTED_HOOKS \ + ((1 << NF_INET_PRE_ROUTING) | (1 << NF_INET_LOCAL_IN)) +#endif /*OPLUS_FEATURE_XTOWNER_INPUT*/ + static int owner_check(const struct xt_mtchk_param *par) { struct xt_owner_match_info *info = par->matchinfo; @@ -59,6 +80,46 @@ static int owner_check(const struct xt_mtchk_param *par) return 0; } +#ifdef OPLUS_FEATURE_XTOWNER_INPUT +//Shangjin.Tang@NETWORK.DATA, 2019/09/05 +//add for BUG 2212301 +static struct sock *oem_qtaguid_find_sk(const struct sk_buff *skb, + struct xt_action_param *par) +{ + const struct nf_hook_state *parst = par->state; + struct sock *sk; + unsigned int hook_mask = (1 << parst->hook); + + + pr_debug("qtaguid[%d]: find_sk(skb=%pK) family=%d\n", + parst->hook, skb, parst->pf); + + /* + * Let's not abuse the the xt_socket_get*_sk(), or else it will + * return garbage SKs. + */ + if (!(hook_mask & XT_SOCKET_SUPPORTED_HOOKS)) + return NULL; + + switch (parst->pf) { + case NFPROTO_IPV6: + sk = nf_sk_lookup_slow_v6(dev_net(skb->dev), skb, parst->in); + break; + case NFPROTO_IPV4: + sk = nf_sk_lookup_slow_v4(dev_net(skb->dev), skb, parst->in); + break; + default: + return NULL; + } + + if (sk) { + pr_debug("qtaguid[%d]: %p->sk_proto=%u->sk_state=%d\n", parst->hook, sk, sk->sk_protocol, sk->sk_state); + } + + return sk; +} +#endif /*OPLUS_FEATURE_XTOWNER_INPUT*/ + static bool owner_mt(const struct sk_buff *skb, struct xt_action_param *par) { @@ -67,6 +128,57 @@ owner_mt(const struct sk_buff *skb, struct xt_action_param *par) struct sock *sk = skb_to_full_sk(skb); struct net *net = xt_net(par); + #ifdef OPLUS_FEATURE_XTOWNER_INPUT + //Shangjin.Tang@NETWORK.DATA, 2019/09/05 + //add for BUG 2212301 + /* + * When in TCP_TIME_WAIT the sk is not a "struct sock" but + * "struct inet_timewait_sock" which is missing fields + * So we ignore it + */ + if (sk && sk->sk_state == TCP_TIME_WAIT){ + pr_debug("owner_mt 1 : sk: %p, sk->sk_state: %d \n", sk, sk->sk_state); + sk = NULL; + } + if (sk == NULL) { + /* + * A missing sk->sk_socket happens when packets are in-flight + * and the matching socket is already closed and gone. + */ + sk = oem_qtaguid_find_sk(skb, par); + /* + * TCP_NEW_SYN_RECV are not "struct sock" but "struct request_sock" + * where we can get a pointer to a full socket to retrieve uid/gid. + * When in TCP_TIME_WAIT, sk is a struct inet_timewait_sock + * which is missing fields and does not contain any reference + * to a full socket, so just ignore the socket + */ + if (sk && sk->sk_state == TCP_NEW_SYN_RECV) { + pr_debug("owner_mt 2 : sk: %p, sk->sk_state: %d \n", sk, sk->sk_state); + sock_gen_put(sk); + sk = sk_to_full_sk(sk); + } else if (sk && (!sk_fullsock(sk) || sk->sk_state == TCP_TIME_WAIT)) { + pr_debug("owner_mt 3 : sk: %p, sk->sk_state: %d \n", sk, sk->sk_state); + sock_gen_put(sk); + sk = NULL; + } + //#ifdef OPLUS_FEATURE_XTOWNER_INPUT + /* Wen.Luo@BSP.Kernel.Stability 2019/12/20 add for bug-id:2710161, sock memleak, add WRAN_ON follow other sk_state */ + else if (sk && sk->sk_state == TCP_CLOSE) { + sock_gen_put(sk); + } else if (sk) { + pr_debug("owner_mt: sk: %px, sk->sk_state: %d \n", sk, sk->sk_state); + //WARN_ON(1); + sock_gen_put(sk); + } + //#endif + } + + if(sk) { + pr_debug("owner_mt: sk: %p, sk->sk_state: %d, sk->sk_socket: %p\n", sk, sk->sk_state, sk->sk_socket); + } + #endif /*OPLUS_FEATURE_XTOWNER_INPUT*/ + if (sk == NULL || sk->sk_socket == NULL) return (info->match ^ info->invert) == 0; else if (info->match & info->invert & XT_OWNER_SOCKET) @@ -79,14 +191,14 @@ owner_mt(const struct sk_buff *skb, struct xt_action_param *par) filp = sk->sk_socket->file; if (filp == NULL) return ((info->match ^ info->invert) & - (XT_OWNER_UID | XT_OWNER_GID)) == 0; + (XT_OWNER_UID | XT_OWNER_GID)) == 0; if (info->match & XT_OWNER_UID) { kuid_t uid_min = make_kuid(net->user_ns, info->uid_min); kuid_t uid_max = make_kuid(net->user_ns, info->uid_max); if ((uid_gte(filp->f_cred->fsuid, uid_min) && - uid_lte(filp->f_cred->fsuid, uid_max)) ^ - !(info->invert & XT_OWNER_UID)) + uid_lte(filp->f_cred->fsuid, uid_max)) ^ + !(info->invert & XT_OWNER_UID)) return false; } @@ -94,8 +206,8 @@ owner_mt(const struct sk_buff *skb, struct xt_action_param *par) kgid_t gid_min = make_kgid(net->user_ns, info->gid_min); kgid_t gid_max = make_kgid(net->user_ns, info->gid_max); if ((gid_gte(filp->f_cred->fsgid, gid_min) && - gid_lte(filp->f_cred->fsgid, gid_max)) ^ - !(info->invert & XT_OWNER_GID)) + gid_lte(filp->f_cred->fsgid, gid_max)) ^ + !(info->invert & XT_OWNER_GID)) return false; } @@ -109,8 +221,15 @@ static struct xt_match owner_mt_reg __read_mostly = { .checkentry = owner_check, .match = owner_mt, .matchsize = sizeof(struct xt_owner_match_info), +#ifndef OPLUS_FEATURE_XTOWNER_INPUT +//Yuanhua.Du@NETWORK.DATA.2180713, 2019/07/20, Add NF_INET_LOCAL_IN for iptables owner match rules .hooks = (1 << NF_INET_LOCAL_OUT) | (1 << NF_INET_POST_ROUTING), +#else + .hooks = (1 << NF_INET_LOCAL_OUT) | + (1 << NF_INET_POST_ROUTING) | + (1 << NF_INET_LOCAL_IN), +#endif .me = THIS_MODULE, }; diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 42ee9a5bfc5c..0874eed88aa7 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -244,6 +244,11 @@ struct packet_skb_cb { static void __fanout_unlink(struct sock *sk, struct packet_sock *po); static void __fanout_link(struct sock *sk, struct packet_sock *po); +//#ifdef OPLUS_FEATURE_DHCP +//LianGenglin@CONNECTIVITY.WIFI.INTERNET, 2020/05/09, Add for Dhcp conflict +int (*handle_dhcp)(struct sock *sk, struct sk_buff *skb, struct net_device *dev, struct packet_type *pt) = NULL; +EXPORT_SYMBOL(handle_dhcp); +//#endif /* OPLUS_FEATURE_DHCP */ static int packet_direct_xmit(struct sk_buff *skb) { struct net_device *dev = skb->dev; @@ -2160,6 +2165,14 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, /* drop conntrack reference */ nf_reset(skb); +//#ifdef OPLUS_FEATURE_DHCP +//LianGenglin@CONNECTIVITY.WIFI.INTERNET, 2020/05/09, Add for Dhcp conflict + if (handle_dhcp != NULL && handle_dhcp(sk, skb, dev, pt)) { + printk("drop dhcp offer packet"); + goto drop; + } +//#endif /* OPLUS_FEATURE_DHCP */ + spin_lock(&sk->sk_receive_queue.lock); po->stats.stats1.tp_packets++; sock_skb_set_dropcount(sk, skb); diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c index 730f7731395c..7339a15ab885 100644 --- a/net/qrtr/qrtr.c +++ b/net/qrtr/qrtr.c @@ -46,6 +46,14 @@ #define AID_VENDOR_QRTR KGIDT_INIT(2906) +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER +/* +*Ruansong@PSW.NW.DATA.200400, 2020/06/01. +*Add for classify glink wakeup services. +*/ +int modem_wakeup_src_count[MODEM_WAKEUP_SRC_NUM] = { 0 }; +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ + /** * struct qrtr_hdr_v1 - (I|R)PCrouter packet header version 1 * @version: protocol version @@ -224,6 +232,15 @@ static void qrtr_log_tx_msg(struct qrtr_node *node, struct qrtr_hdr_v1 *hdr, type = le32_to_cpu(hdr->type); +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.200400, 2020/06/01. + *Add for classify glink wakeup services. + */ + if (qrtr_first_msg) { + qrtr_first_msg = 0; + } +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ if (type == QRTR_TYPE_DATA) { skb_copy_bits(skb, QRTR_HDR_MAX_SIZE, &pl_buf, sizeof(pl_buf)); QRTR_INFO(node->ilc, @@ -237,12 +254,28 @@ static void qrtr_log_tx_msg(struct qrtr_node *node, struct qrtr_hdr_v1 *hdr, skb_copy_bits(skb, QRTR_HDR_MAX_SIZE, &pkt, sizeof(pkt)); if (type == QRTR_TYPE_NEW_SERVER || type == QRTR_TYPE_DEL_SERVER) +#ifndef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.200400, 2020/06/01. + *Add for classify glink wakeup services. + */ QRTR_INFO(node->ilc, "TX CTRL: cmd:0x%x SVC[0x%x:0x%x] addr[0x%x:0x%x]\n", type, le32_to_cpu(pkt.server.service), le32_to_cpu(pkt.server.instance), le32_to_cpu(pkt.server.node), le32_to_cpu(pkt.server.port)); +#else + { + QRTR_INFO(node->ilc, + "TX CTRL: cmd:0x%x SVC[0x%x:0x%x] addr[0x%x:0x%x]\n", + type, le32_to_cpu(pkt.server.service), + le32_to_cpu(pkt.server.instance), + le32_to_cpu(pkt.server.node), + le32_to_cpu(pkt.server.port)); + oplus_match_qrtr_service_port(hdr->type, le32_to_cpu(pkt.server.service), le32_to_cpu(pkt.server.port)); + } +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ else if (type == QRTR_TYPE_DEL_CLIENT || type == QRTR_TYPE_RESUME_TX) QRTR_INFO(node->ilc, @@ -279,6 +312,16 @@ static void qrtr_log_rx_msg(struct qrtr_node *node, struct sk_buff *skb) if (cb->type == QRTR_TYPE_DATA) { skb_copy_bits(skb, 0, &pl_buf, sizeof(pl_buf)); +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.200400, 2020/06/01. + *Add for classify glink wakeup services. + */ + if (qrtr_first_msg) + modem_wakeup_src_count[MODEM_QMI_WS_INDEX]++; + + oplus_match_qrtr_wakeup(cb->src_node, cb->src_port, cb->dst_port, (unsigned int)pl_buf, (unsigned int)(pl_buf >> 32)); +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ QRTR_INFO(node->ilc, "RX DATA: Len:0x%x CF:0x%x src[0x%x:0x%x] dst[0x%x:0x%x] [%08x %08x]\n", skb->len, cb->confirm_rx, cb->src_node, cb->src_port, @@ -288,12 +331,28 @@ static void qrtr_log_rx_msg(struct qrtr_node *node, struct sk_buff *skb) skb_copy_bits(skb, 0, &pkt, sizeof(pkt)); if (cb->type == QRTR_TYPE_NEW_SERVER || cb->type == QRTR_TYPE_DEL_SERVER) +#ifndef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.200400, 2020/06/01. + *Add for classify glink wakeup services. + */ QRTR_INFO(node->ilc, "RX CTRL: cmd:0x%x SVC[0x%x:0x%x] addr[0x%x:0x%x]\n", cb->type, le32_to_cpu(pkt.server.service), le32_to_cpu(pkt.server.instance), le32_to_cpu(pkt.server.node), le32_to_cpu(pkt.server.port)); +#else + { + QRTR_INFO(node->ilc, + "RX CTRL: cmd:0x%x SVC[0x%x:0x%x] addr[0x%x:0x%x]\n", + cb->type, le32_to_cpu(pkt.server.service), + le32_to_cpu(pkt.server.instance), + le32_to_cpu(pkt.server.node), + le32_to_cpu(pkt.server.port)); + oplus_match_qrtr_service_port(cb->type, le32_to_cpu(pkt.server.service), le32_to_cpu(pkt.server.port)); + } +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ else if (cb->type == QRTR_TYPE_DEL_CLIENT || cb->type == QRTR_TYPE_RESUME_TX) QRTR_INFO(node->ilc, diff --git a/net/qrtr/qrtr.h b/net/qrtr/qrtr.h index 6a2cccb1296e..87d538645aba 100644 --- a/net/qrtr/qrtr.h +++ b/net/qrtr/qrtr.h @@ -4,6 +4,23 @@ #include +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER +/* +*Ruansong@PSW.NW.DATA.2120730, 2019/07/11 +*Add for: print qrtr debug msg and fix QMI wakeup statistics for QCOM platforms using glink. +*/ +#define MODEM_WAKEUP_SRC_NUM 3 +#define MODEM_QMI_WS_INDEX 2 +#define QRTR_FIRST_HEAD "QrtrFirst " +#define QRTR_FIRST_HEAD_COUNT 10 +extern int modem_wakeup_src_count[MODEM_WAKEUP_SRC_NUM]; +extern int qrtr_first_msg; +extern char qrtr_first_msg_details[256]; +extern char *sub_qrtr_first_msg_details; + +#include +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ + struct sk_buff; /* endpoint node id auto assignment */ diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 091a9746627f..8c4daf9f25e6 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -158,6 +158,17 @@ trace: return skb; } +#ifdef OPLUS_FEATURE_WIFI_LIMMITBGSPEED +//HuangJunyuan@CONNECTIVITY.WIFI.INTERNET, 2018/06/26, Add for limit speed function +struct sk_buff *qdisc_dequeue_skb(struct Qdisc *q, bool *validate) +{ + int packets; + + return dequeue_skb(q, validate, &packets); +} +EXPORT_SYMBOL(qdisc_dequeue_skb); +#endif /* OPLUS_FEATURE_WIFI_LIMMITBGSPEED */ + /* * Transmit possibly several skbs, and handle the return status as * required. Owning running seqcount bit guarantees that diff --git a/net/socket.c b/net/socket.c index c74acb4139c8..c1da717a1bef 100644 --- a/net/socket.c +++ b/net/socket.c @@ -437,6 +437,15 @@ struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname) sock->file = file; file->f_flags = O_RDWR | (flags & O_NONBLOCK); file->private_data = sock; +#ifdef OPLUS_FEATURE_MODEM_DATA_NWPOWER + /* + *Ruansong@PSW.NW.DATA.211800, 2020/06/01 + *Add for classify glink wakeup services + */ + if (sock->sk) { + sock->sk->sk_oplus_pid = current->tgid; + } +#endif /* OPLUS_FEATURE_MODEM_DATA_NWPOWER */ return file; } EXPORT_SYMBOL(sock_alloc_file); @@ -2099,8 +2108,14 @@ static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg, } out_freectl: - if (ctl_buf != ctl) + if (ctl_buf != ctl){ +#ifdef CONFIG_OPLUS_SECURE_GUARD +#ifdef CONFIG_OPLUS_ROOT_CHECK + memset(ctl_buf, 0, ctl_len); +#endif /* CONFIG_OPLUS_ROOT_CHECK */ +#endif /* CONFIG_OPLUS_SECURE_GUARD */ sock_kfree_s(sock->sk, ctl_buf, ctl_len); + } out_freeiov: kfree(iov); return err; diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 041c556acaa5..c6edc34d6b51 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -7011,6 +7011,15 @@ void selinux_complete_init(void) iterate_supers(delayed_superblock_init, NULL); } + +#ifdef CONFIG_OPLUS_SECURE_GUARD +int get_current_security_context(char **context, u32 *context_len) +{ + u32 sid = current_sid(); + return security_sid_to_context(&selinux_state, sid, context, context_len); +} +#endif /* CONFIG_OPLUS_SECURE_GUARD */ + /* SELinux requires early initialization in order to label all processes and objects when they are created. */ security_initcall(selinux_init); diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 123dcd1b9327..3430ba930cde 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1578,11 +1578,15 @@ static int soc_probe_component(struct snd_soc_card *card, "ASoC: failed to probe component %d\n", ret); goto err_probe; } - + #ifndef OPLUS_ARCH_EXTENDS + /*Jianfeng.Qiu@PSW.MM.AudioDriver.Platform.1234162, 2018/03/30, + *Delete for uart issue duo to warning log. + */ WARN(dapm->idle_bias_off && dapm->bias_level != SND_SOC_BIAS_OFF, "codec %s can not start from non-off bias with idle_bias_off==1\n", component->name); + #endif /* OPLUS_ARCH_EXTENDS */ } /* machine specific init */ diff --git a/sound/usb/stream.c b/sound/usb/stream.c index b46af30f375c..8c9153c86095 100644 --- a/sound/usb/stream.c +++ b/sound/usb/stream.c @@ -742,6 +742,13 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no) /* some quirks for attributes here */ switch (chip->usb_id) { +#ifdef OPLUS_FEATURE_CHG_BASIC +/* LiYue@BSP.CHG.Basic, 2019/09/12, add for ISK UK400 */ + case USB_ID(0x0451, 0x17ed): /* ISK UK400 */ + if (stream == SNDRV_PCM_STREAM_PLAYBACK) + fp->attributes &= ~(UAC_EP_CS_ATTR_FILL_MAX); + break; +#endif case USB_ID(0x0a92, 0x0053): /* AudioTrak Optoplay */ /* Optoplay sets the sample rate attribute although * it seems not supporting it in fact.