summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AndroidKernel.mk44
-rw-r--r--Makefile3
-rw-r--r--arch/arm/Makefile5
-rw-r--r--arch/arm/boot/dts/qcom/apq8098-v2.1-mediabox.dts8
-rw-r--r--arch/arm/include/asm/Kbuild3
-rw-r--r--arch/arm/include/asm/mach-types.h1
-rw-r--r--arch/arm/include/asm/unistd.h26
-rw-r--r--arch/arm/include/uapi/asm/Kbuild3
-rw-r--r--arch/arm/include/uapi/asm/unistd.h420
-rw-r--r--arch/arm/kernel/calls.S409
-rw-r--r--arch/arm/kernel/entry-common.S76
-rw-r--r--arch/arm/tools/Makefile68
-rw-r--r--arch/arm/tools/syscall.tbl407
-rw-r--r--arch/arm/tools/syscallhdr.sh30
-rw-r--r--arch/arm/tools/syscallnr.sh33
-rw-r--r--arch/arm/tools/syscalltbl.sh21
-rw-r--r--drivers/crypto/msm/qcedev.c205
-rw-r--r--drivers/hwmon/qpnp-adc-common.c4
-rw-r--r--drivers/hwmon/qpnp-adc-voltage.c14
-rw-r--r--drivers/media/platform/msm/camera_v2/common/cam_soc_api.c6
-rw-r--r--drivers/media/platform/msm/camera_v2/msm.c6
-rw-r--r--drivers/media/platform/msm/camera_v2/sensor/flash/msm_flash.c5
-rw-r--r--drivers/media/platform/msm/camera_v2/sensor/io/msm_camera_dt_util.c4
-rw-r--r--drivers/media/platform/msm/camera_v2/sensor/ir_cut/msm_ir_cut.c4
-rw-r--r--drivers/media/platform/msm/sde/rotator/sde_rotator_r3.c160
-rw-r--r--drivers/media/platform/msm/sde/rotator/sde_rotator_r3_internal.h16
-rw-r--r--drivers/misc/hdcp.c38
-rw-r--r--drivers/mmc/host/sdhci-msm-ice.c5
-rw-r--r--drivers/platform/msm/ipa/ipa_v2/rmnet_ipa.c4
-rw-r--r--drivers/platform/msm/ipa/ipa_v3/ipa_rt.c4
-rw-r--r--drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c5
-rw-r--r--drivers/soc/qcom/glink_debugfs.c6
-rw-r--r--drivers/soc/qcom/msm-spm.c4
-rw-r--r--drivers/soc/qcom/rpm_master_stat.c10
-rw-r--r--drivers/soc/qcom/smp2p.c30
-rw-r--r--drivers/soc/qcom/sysmon-qmi.c4
-rw-r--r--drivers/staging/android/ion/ion_cma_heap.c6
-rw-r--r--drivers/staging/android/ion/ion_cma_secure_heap.c4
-rw-r--r--drivers/staging/android/ion/ion_system_secure_heap.c14
-rw-r--r--drivers/staging/android/ion/msm/msm_ion.c18
-rw-r--r--drivers/staging/android/lowmemorykiller.c3
-rw-r--r--drivers/tty/serial/msm_smd_tty.c6
-rw-r--r--drivers/usb/gadget/function/f_qc_rndis.c25
-rw-r--r--drivers/video/fbdev/msm/mdss_cec_core.c40
-rw-r--r--drivers/video/fbdev/msm/mdss_cec_core.h3
-rw-r--r--drivers/video/fbdev/msm/mdss_dsi.c10
-rw-r--r--drivers/video/fbdev/msm/mdss_dsi_cmd.h3
-rw-r--r--drivers/video/fbdev/msm/mdss_dsi_host.c14
-rw-r--r--drivers/video/fbdev/msm/mdss_dsi_panel.c4
-rw-r--r--drivers/video/fbdev/msm/mdss_fb.c29
-rw-r--r--drivers/video/fbdev/msm/mdss_fb.h3
-rw-r--r--drivers/video/fbdev/msm/mdss_hdcp_1x.c10
-rw-r--r--drivers/video/fbdev/msm/mdss_hdmi_cec.c203
-rw-r--r--drivers/video/fbdev/msm/mdss_hdmi_edid.c313
-rw-r--r--drivers/video/fbdev/msm/mdss_hdmi_edid.h13
-rw-r--r--drivers/video/fbdev/msm/mdss_hdmi_hdcp2p2.c48
-rw-r--r--drivers/video/fbdev/msm/mdss_hdmi_panel.c125
-rw-r--r--drivers/video/fbdev/msm/mdss_hdmi_panel.h12
-rw-r--r--drivers/video/fbdev/msm/mdss_hdmi_tx.c249
-rw-r--r--drivers/video/fbdev/msm/mdss_hdmi_tx.h9
-rw-r--r--drivers/video/fbdev/msm/mdss_hdmi_util.c63
-rw-r--r--drivers/video/fbdev/msm/mdss_hdmi_util.h3
-rw-r--r--drivers/video/fbdev/msm/mdss_mdp.h4
-rw-r--r--drivers/video/fbdev/msm/mdss_mdp_cdm.c21
-rw-r--r--drivers/video/fbdev/msm/mdss_mdp_cdm.h3
-rw-r--r--drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c16
-rw-r--r--drivers/video/fbdev/msm/mdss_mdp_intf_video.c128
-rw-r--r--drivers/video/fbdev/msm/mdss_mdp_pp.c54
-rw-r--r--drivers/video/fbdev/msm/mdss_mdp_splash_logo.c7
-rw-r--r--drivers/video/fbdev/msm/mdss_panel.h30
-rw-r--r--include/linux/sched/sysctl.h7
-rw-r--r--include/uapi/video/msm_hdmi_modes.h10
-rw-r--r--mm/zsmalloc.c11
73 files changed, 2206 insertions, 1406 deletions
diff --git a/AndroidKernel.mk b/AndroidKernel.mk
index c7d3c22fa269..1e4726094308 100644
--- a/AndroidKernel.mk
+++ b/AndroidKernel.mk
@@ -47,12 +47,32 @@ else
KERNEL_CROSS_COMPILE := $(shell pwd)/$(TARGET_TOOLS_PREFIX)
endif
+ifeq ($(KERNEL_LLVM_SUPPORT), true)
+ ifeq ($(KERNEL_SD_LLVM_SUPPORT), true) #Using sd-llvm compiler
+ ifeq ($(shell echo $(SDCLANG_PATH) | head -c 1),/)
+ KERNEL_LLVM_BIN := $(SDCLANG_PATH)/clang
+ else
+ KERNEL_LLVM_BIN := $(shell pwd)/$(SDCLANG_PATH)/clang
+ endif
+ $(warning "Using sdllvm" $(KERNEL_LLVM_BIN))
+ else
+ KERNEL_LLVM_BIN := $(shell pwd)/$(CLANG) #Using aosp-llvm compiler
+ $(warning "Using aosp-llvm" $(KERNEL_LLVM_BIN))
+ endif
+endif
+
ifeq ($(TARGET_PREBUILT_KERNEL),)
KERNEL_GCC_NOANDROID_CHK := $(shell (echo "int main() {return 0;}" | $(KERNEL_CROSS_COMPILE)gcc -E -mno-android - > /dev/null 2>&1 ; echo $$?))
+
+real_cc :=
+ifeq ($(KERNEL_LLVM_SUPPORT),true)
+real_cc := REAL_CC=$(KERNEL_LLVM_BIN) CLANG_TRIPLE=aarch64-linux-gnu-
+else
ifeq ($(strip $(KERNEL_GCC_NOANDROID_CHK)),0)
KERNEL_CFLAGS := KCFLAGS=-mno-android
endif
+endif
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
@@ -138,43 +158,43 @@ $(KERNEL_OUT):
mkdir -p $(KERNEL_OUT)
$(KERNEL_CONFIG): $(KERNEL_OUT)
- $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(KERNEL_DEFCONFIG)
+ $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_DEFCONFIG)
$(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \
echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \
- $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) oldconfig; fi
+ $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) oldconfig; fi
$(TARGET_PREBUILT_INT_KERNEL): $(KERNEL_OUT) $(KERNEL_HEADERS_INSTALL)
$(hide) echo "Building kernel..."
$(hide) rm -rf $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts
- $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(KERNEL_CFLAGS)
- $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(KERNEL_CFLAGS) modules
- $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) INSTALL_MOD_PATH=$(BUILD_ROOT_LOC)../$(KERNEL_MODULES_INSTALL) INSTALL_MOD_STRIP=1 $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) modules_install
+ $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_CFLAGS)
+ $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_CFLAGS) modules
+ $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) INSTALL_MOD_PATH=$(BUILD_ROOT_LOC)../$(KERNEL_MODULES_INSTALL) INSTALL_MOD_STRIP=1 $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) modules_install
$(mv-modules)
$(clean-module-folder)
$(KERNEL_HEADERS_INSTALL): $(KERNEL_OUT)
$(hide) if [ ! -z "$(KERNEL_HEADER_DEFCONFIG)" ]; then \
rm -f $(BUILD_ROOT_LOC)$(KERNEL_CONFIG); \
- $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_HEADER_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(KERNEL_HEADER_DEFCONFIG); \
- $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_HEADER_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) headers_install; fi
+ $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_HEADER_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_HEADER_DEFCONFIG); \
+ $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_HEADER_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) headers_install; fi
$(hide) if [ "$(KERNEL_HEADER_DEFCONFIG)" != "$(KERNEL_DEFCONFIG)" ]; then \
echo "Used a different defconfig for header generation"; \
rm -f $(BUILD_ROOT_LOC)$(KERNEL_CONFIG); \
- $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(KERNEL_DEFCONFIG); fi
+ $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_DEFCONFIG); fi
$(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \
echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \
- $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) oldconfig; fi
+ $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) oldconfig; fi
kerneltags: $(KERNEL_OUT) $(KERNEL_CONFIG)
- $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) tags
+ $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) tags
kernelconfig: $(KERNEL_OUT) $(KERNEL_CONFIG)
env KCONFIG_NOTIMESTAMP=true \
- $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) menuconfig
+ $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) menuconfig
env KCONFIG_NOTIMESTAMP=true \
- $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) savedefconfig
+ $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) savedefconfig
cp $(KERNEL_OUT)/defconfig $(TARGET_KERNEL_SOURCE)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_DEFCONFIG)
endif
diff --git a/Makefile b/Makefile
index 30a6975cca35..7ad3e94711b0 100644
--- a/Makefile
+++ b/Makefile
@@ -734,6 +734,9 @@ KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier)
KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
KBUILD_CFLAGS += $(call cc-disable-warning, duplicate-decl-specifier)
+KBUILD_CFLAGS += -Wno-undefined-optimized
+KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare
+
# Quiet clang warning: comparison of unsigned expression < 0 is always false
KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare)
# CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 8d728d63aea0..d0e39999656a 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -313,8 +313,11 @@ all: $(KBUILD_IMAGE) $(KBUILD_DTBS)
boot := arch/arm/boot
+archheaders:
+ $(Q)$(MAKE) $(build)=arch/arm/tools uapi
+
archprepare:
- $(Q)$(MAKE) $(build)=arch/arm/tools include/generated/mach-types.h
+ $(Q)$(MAKE) $(build)=arch/arm/tools kapi
# Convert bzImage to zImage
bzImage: zImage
diff --git a/arch/arm/boot/dts/qcom/apq8098-v2.1-mediabox.dts b/arch/arm/boot/dts/qcom/apq8098-v2.1-mediabox.dts
index 1fa49d8a060d..74edd4e9ac0f 100644
--- a/arch/arm/boot/dts/qcom/apq8098-v2.1-mediabox.dts
+++ b/arch/arm/boot/dts/qcom/apq8098-v2.1-mediabox.dts
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2016-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
@@ -38,6 +38,12 @@
qcom,display-type = "primary";
};
+&mdss_fb2 {
+ qcom,cont-splash-memory {
+ linux,contiguous-region = <&cont_splash_mem>;
+ };
+};
+
&slim_aud {
tasha_codec {
wsa_spkr_sd1: msm_cdc_pinctrll {
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index 72e6efb8e910..730b4e850f6f 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -37,3 +37,6 @@ generic-y += termbits.h
generic-y += termios.h
generic-y += timex.h
generic-y += trace_clock.h
+
+generated-y += mach-types.h
+generated-y += unistd-nr.h
diff --git a/arch/arm/include/asm/mach-types.h b/arch/arm/include/asm/mach-types.h
deleted file mode 100644
index 948178cc6ba8..000000000000
--- a/arch/arm/include/asm/mach-types.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <generated/mach-types.h>
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index 7b84657fba35..076090d2dbf5 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -14,12 +14,7 @@
#define __ASM_ARM_UNISTD_H
#include <uapi/asm/unistd.h>
-
-/*
- * This may need to be greater than __NR_last_syscall+1 in order to
- * account for the padding in the syscall table
- */
-#define __NR_syscalls (392)
+#include <asm/unistd-nr.h>
#define __ARCH_WANT_STAT64
#define __ARCH_WANT_SYS_GETHOSTNAME
@@ -52,4 +47,23 @@
#define __IGNORE_fadvise64_64
#define __IGNORE_migrate_pages
+#ifdef __ARM_EABI__
+/*
+ * The following syscalls are obsolete and no longer available for EABI:
+ * __NR_time
+ * __NR_umount
+ * __NR_stime
+ * __NR_alarm
+ * __NR_utime
+ * __NR_getrlimit
+ * __NR_select
+ * __NR_readdir
+ * __NR_mmap
+ * __NR_socketcall
+ * __NR_syscall
+ * __NR_ipc
+ */
+#define __IGNORE_getrlimit
+#endif
+
#endif /* __ASM_ARM_UNISTD_H */
diff --git a/arch/arm/include/uapi/asm/Kbuild b/arch/arm/include/uapi/asm/Kbuild
index a1c05f93d920..46a76cd6acb6 100644
--- a/arch/arm/include/uapi/asm/Kbuild
+++ b/arch/arm/include/uapi/asm/Kbuild
@@ -18,3 +18,6 @@ header-y += stat.h
header-y += statfs.h
header-y += swab.h
header-y += unistd.h
+genhdr-y += unistd-common.h
+genhdr-y += unistd-oabi.h
+genhdr-y += unistd-eabi.h
diff --git a/arch/arm/include/uapi/asm/unistd.h b/arch/arm/include/uapi/asm/unistd.h
index ede692ffa32e..a9e85739a912 100644
--- a/arch/arm/include/uapi/asm/unistd.h
+++ b/arch/arm/include/uapi/asm/unistd.h
@@ -17,406 +17,14 @@
#if defined(__thumb__) || defined(__ARM_EABI__)
#define __NR_SYSCALL_BASE 0
+#include <asm/unistd-eabi.h>
#else
#define __NR_SYSCALL_BASE __NR_OABI_SYSCALL_BASE
+#include <asm/unistd-oabi.h>
#endif
-/*
- * This file contains the system call numbers.
- */
-
-#define __NR_restart_syscall (__NR_SYSCALL_BASE+ 0)
-#define __NR_exit (__NR_SYSCALL_BASE+ 1)
-#define __NR_fork (__NR_SYSCALL_BASE+ 2)
-#define __NR_read (__NR_SYSCALL_BASE+ 3)
-#define __NR_write (__NR_SYSCALL_BASE+ 4)
-#define __NR_open (__NR_SYSCALL_BASE+ 5)
-#define __NR_close (__NR_SYSCALL_BASE+ 6)
- /* 7 was sys_waitpid */
-#define __NR_creat (__NR_SYSCALL_BASE+ 8)
-#define __NR_link (__NR_SYSCALL_BASE+ 9)
-#define __NR_unlink (__NR_SYSCALL_BASE+ 10)
-#define __NR_execve (__NR_SYSCALL_BASE+ 11)
-#define __NR_chdir (__NR_SYSCALL_BASE+ 12)
-#define __NR_time (__NR_SYSCALL_BASE+ 13)
-#define __NR_mknod (__NR_SYSCALL_BASE+ 14)
-#define __NR_chmod (__NR_SYSCALL_BASE+ 15)
-#define __NR_lchown (__NR_SYSCALL_BASE+ 16)
- /* 17 was sys_break */
- /* 18 was sys_stat */
-#define __NR_lseek (__NR_SYSCALL_BASE+ 19)
-#define __NR_getpid (__NR_SYSCALL_BASE+ 20)
-#define __NR_mount (__NR_SYSCALL_BASE+ 21)
-#define __NR_umount (__NR_SYSCALL_BASE+ 22)
-#define __NR_setuid (__NR_SYSCALL_BASE+ 23)
-#define __NR_getuid (__NR_SYSCALL_BASE+ 24)
-#define __NR_stime (__NR_SYSCALL_BASE+ 25)
-#define __NR_ptrace (__NR_SYSCALL_BASE+ 26)
-#define __NR_alarm (__NR_SYSCALL_BASE+ 27)
- /* 28 was sys_fstat */
-#define __NR_pause (__NR_SYSCALL_BASE+ 29)
-#define __NR_utime (__NR_SYSCALL_BASE+ 30)
- /* 31 was sys_stty */
- /* 32 was sys_gtty */
-#define __NR_access (__NR_SYSCALL_BASE+ 33)
-#define __NR_nice (__NR_SYSCALL_BASE+ 34)
- /* 35 was sys_ftime */
-#define __NR_sync (__NR_SYSCALL_BASE+ 36)
-#define __NR_kill (__NR_SYSCALL_BASE+ 37)
-#define __NR_rename (__NR_SYSCALL_BASE+ 38)
-#define __NR_mkdir (__NR_SYSCALL_BASE+ 39)
-#define __NR_rmdir (__NR_SYSCALL_BASE+ 40)
-#define __NR_dup (__NR_SYSCALL_BASE+ 41)
-#define __NR_pipe (__NR_SYSCALL_BASE+ 42)
-#define __NR_times (__NR_SYSCALL_BASE+ 43)
- /* 44 was sys_prof */
-#define __NR_brk (__NR_SYSCALL_BASE+ 45)
-#define __NR_setgid (__NR_SYSCALL_BASE+ 46)
-#define __NR_getgid (__NR_SYSCALL_BASE+ 47)
- /* 48 was sys_signal */
-#define __NR_geteuid (__NR_SYSCALL_BASE+ 49)
-#define __NR_getegid (__NR_SYSCALL_BASE+ 50)
-#define __NR_acct (__NR_SYSCALL_BASE+ 51)
-#define __NR_umount2 (__NR_SYSCALL_BASE+ 52)
- /* 53 was sys_lock */
-#define __NR_ioctl (__NR_SYSCALL_BASE+ 54)
-#define __NR_fcntl (__NR_SYSCALL_BASE+ 55)
- /* 56 was sys_mpx */
-#define __NR_setpgid (__NR_SYSCALL_BASE+ 57)
- /* 58 was sys_ulimit */
- /* 59 was sys_olduname */
-#define __NR_umask (__NR_SYSCALL_BASE+ 60)
-#define __NR_chroot (__NR_SYSCALL_BASE+ 61)
-#define __NR_ustat (__NR_SYSCALL_BASE+ 62)
-#define __NR_dup2 (__NR_SYSCALL_BASE+ 63)
-#define __NR_getppid (__NR_SYSCALL_BASE+ 64)
-#define __NR_getpgrp (__NR_SYSCALL_BASE+ 65)
-#define __NR_setsid (__NR_SYSCALL_BASE+ 66)
-#define __NR_sigaction (__NR_SYSCALL_BASE+ 67)
- /* 68 was sys_sgetmask */
- /* 69 was sys_ssetmask */
-#define __NR_setreuid (__NR_SYSCALL_BASE+ 70)
-#define __NR_setregid (__NR_SYSCALL_BASE+ 71)
-#define __NR_sigsuspend (__NR_SYSCALL_BASE+ 72)
-#define __NR_sigpending (__NR_SYSCALL_BASE+ 73)
-#define __NR_sethostname (__NR_SYSCALL_BASE+ 74)
-#define __NR_setrlimit (__NR_SYSCALL_BASE+ 75)
-#define __NR_getrlimit (__NR_SYSCALL_BASE+ 76) /* Back compat 2GB limited rlimit */
-#define __NR_getrusage (__NR_SYSCALL_BASE+ 77)
-#define __NR_gettimeofday (__NR_SYSCALL_BASE+ 78)
-#define __NR_settimeofday (__NR_SYSCALL_BASE+ 79)
-#define __NR_getgroups (__NR_SYSCALL_BASE+ 80)
-#define __NR_setgroups (__NR_SYSCALL_BASE+ 81)
-#define __NR_select (__NR_SYSCALL_BASE+ 82)
-#define __NR_symlink (__NR_SYSCALL_BASE+ 83)
- /* 84 was sys_lstat */
-#define __NR_readlink (__NR_SYSCALL_BASE+ 85)
-#define __NR_uselib (__NR_SYSCALL_BASE+ 86)
-#define __NR_swapon (__NR_SYSCALL_BASE+ 87)
-#define __NR_reboot (__NR_SYSCALL_BASE+ 88)
-#define __NR_readdir (__NR_SYSCALL_BASE+ 89)
-#define __NR_mmap (__NR_SYSCALL_BASE+ 90)
-#define __NR_munmap (__NR_SYSCALL_BASE+ 91)
-#define __NR_truncate (__NR_SYSCALL_BASE+ 92)
-#define __NR_ftruncate (__NR_SYSCALL_BASE+ 93)
-#define __NR_fchmod (__NR_SYSCALL_BASE+ 94)
-#define __NR_fchown (__NR_SYSCALL_BASE+ 95)
-#define __NR_getpriority (__NR_SYSCALL_BASE+ 96)
-#define __NR_setpriority (__NR_SYSCALL_BASE+ 97)
- /* 98 was sys_profil */
-#define __NR_statfs (__NR_SYSCALL_BASE+ 99)
-#define __NR_fstatfs (__NR_SYSCALL_BASE+100)
- /* 101 was sys_ioperm */
-#define __NR_socketcall (__NR_SYSCALL_BASE+102)
-#define __NR_syslog (__NR_SYSCALL_BASE+103)
-#define __NR_setitimer (__NR_SYSCALL_BASE+104)
-#define __NR_getitimer (__NR_SYSCALL_BASE+105)
-#define __NR_stat (__NR_SYSCALL_BASE+106)
-#define __NR_lstat (__NR_SYSCALL_BASE+107)
-#define __NR_fstat (__NR_SYSCALL_BASE+108)
- /* 109 was sys_uname */
- /* 110 was sys_iopl */
-#define __NR_vhangup (__NR_SYSCALL_BASE+111)
- /* 112 was sys_idle */
-#define __NR_syscall (__NR_SYSCALL_BASE+113) /* syscall to call a syscall! */
-#define __NR_wait4 (__NR_SYSCALL_BASE+114)
-#define __NR_swapoff (__NR_SYSCALL_BASE+115)
-#define __NR_sysinfo (__NR_SYSCALL_BASE+116)
-#define __NR_ipc (__NR_SYSCALL_BASE+117)
-#define __NR_fsync (__NR_SYSCALL_BASE+118)
-#define __NR_sigreturn (__NR_SYSCALL_BASE+119)
-#define __NR_clone (__NR_SYSCALL_BASE+120)
-#define __NR_setdomainname (__NR_SYSCALL_BASE+121)
-#define __NR_uname (__NR_SYSCALL_BASE+122)
- /* 123 was sys_modify_ldt */
-#define __NR_adjtimex (__NR_SYSCALL_BASE+124)
-#define __NR_mprotect (__NR_SYSCALL_BASE+125)
-#define __NR_sigprocmask (__NR_SYSCALL_BASE+126)
- /* 127 was sys_create_module */
-#define __NR_init_module (__NR_SYSCALL_BASE+128)
-#define __NR_delete_module (__NR_SYSCALL_BASE+129)
- /* 130 was sys_get_kernel_syms */
-#define __NR_quotactl (__NR_SYSCALL_BASE+131)
-#define __NR_getpgid (__NR_SYSCALL_BASE+132)
-#define __NR_fchdir (__NR_SYSCALL_BASE+133)
-#define __NR_bdflush (__NR_SYSCALL_BASE+134)
-#define __NR_sysfs (__NR_SYSCALL_BASE+135)
-#define __NR_personality (__NR_SYSCALL_BASE+136)
- /* 137 was sys_afs_syscall */
-#define __NR_setfsuid (__NR_SYSCALL_BASE+138)
-#define __NR_setfsgid (__NR_SYSCALL_BASE+139)
-#define __NR__llseek (__NR_SYSCALL_BASE+140)
-#define __NR_getdents (__NR_SYSCALL_BASE+141)
-#define __NR__newselect (__NR_SYSCALL_BASE+142)
-#define __NR_flock (__NR_SYSCALL_BASE+143)
-#define __NR_msync (__NR_SYSCALL_BASE+144)
-#define __NR_readv (__NR_SYSCALL_BASE+145)
-#define __NR_writev (__NR_SYSCALL_BASE+146)
-#define __NR_getsid (__NR_SYSCALL_BASE+147)
-#define __NR_fdatasync (__NR_SYSCALL_BASE+148)
-#define __NR__sysctl (__NR_SYSCALL_BASE+149)
-#define __NR_mlock (__NR_SYSCALL_BASE+150)
-#define __NR_munlock (__NR_SYSCALL_BASE+151)
-#define __NR_mlockall (__NR_SYSCALL_BASE+152)
-#define __NR_munlockall (__NR_SYSCALL_BASE+153)
-#define __NR_sched_setparam (__NR_SYSCALL_BASE+154)
-#define __NR_sched_getparam (__NR_SYSCALL_BASE+155)
-#define __NR_sched_setscheduler (__NR_SYSCALL_BASE+156)
-#define __NR_sched_getscheduler (__NR_SYSCALL_BASE+157)
-#define __NR_sched_yield (__NR_SYSCALL_BASE+158)
-#define __NR_sched_get_priority_max (__NR_SYSCALL_BASE+159)
-#define __NR_sched_get_priority_min (__NR_SYSCALL_BASE+160)
-#define __NR_sched_rr_get_interval (__NR_SYSCALL_BASE+161)
-#define __NR_nanosleep (__NR_SYSCALL_BASE+162)
-#define __NR_mremap (__NR_SYSCALL_BASE+163)
-#define __NR_setresuid (__NR_SYSCALL_BASE+164)
-#define __NR_getresuid (__NR_SYSCALL_BASE+165)
- /* 166 was sys_vm86 */
- /* 167 was sys_query_module */
-#define __NR_poll (__NR_SYSCALL_BASE+168)
-#define __NR_nfsservctl (__NR_SYSCALL_BASE+169)
-#define __NR_setresgid (__NR_SYSCALL_BASE+170)
-#define __NR_getresgid (__NR_SYSCALL_BASE+171)
-#define __NR_prctl (__NR_SYSCALL_BASE+172)
-#define __NR_rt_sigreturn (__NR_SYSCALL_BASE+173)
-#define __NR_rt_sigaction (__NR_SYSCALL_BASE+174)
-#define __NR_rt_sigprocmask (__NR_SYSCALL_BASE+175)
-#define __NR_rt_sigpending (__NR_SYSCALL_BASE+176)
-#define __NR_rt_sigtimedwait (__NR_SYSCALL_BASE+177)
-#define __NR_rt_sigqueueinfo (__NR_SYSCALL_BASE+178)
-#define __NR_rt_sigsuspend (__NR_SYSCALL_BASE+179)
-#define __NR_pread64 (__NR_SYSCALL_BASE+180)
-#define __NR_pwrite64 (__NR_SYSCALL_BASE+181)
-#define __NR_chown (__NR_SYSCALL_BASE+182)
-#define __NR_getcwd (__NR_SYSCALL_BASE+183)
-#define __NR_capget (__NR_SYSCALL_BASE+184)
-#define __NR_capset (__NR_SYSCALL_BASE+185)
-#define __NR_sigaltstack (__NR_SYSCALL_BASE+186)
-#define __NR_sendfile (__NR_SYSCALL_BASE+187)
- /* 188 reserved */
- /* 189 reserved */
-#define __NR_vfork (__NR_SYSCALL_BASE+190)
-#define __NR_ugetrlimit (__NR_SYSCALL_BASE+191) /* SuS compliant getrlimit */
-#define __NR_mmap2 (__NR_SYSCALL_BASE+192)
-#define __NR_truncate64 (__NR_SYSCALL_BASE+193)
-#define __NR_ftruncate64 (__NR_SYSCALL_BASE+194)
-#define __NR_stat64 (__NR_SYSCALL_BASE+195)
-#define __NR_lstat64 (__NR_SYSCALL_BASE+196)
-#define __NR_fstat64 (__NR_SYSCALL_BASE+197)
-#define __NR_lchown32 (__NR_SYSCALL_BASE+198)
-#define __NR_getuid32 (__NR_SYSCALL_BASE+199)
-#define __NR_getgid32 (__NR_SYSCALL_BASE+200)
-#define __NR_geteuid32 (__NR_SYSCALL_BASE+201)
-#define __NR_getegid32 (__NR_SYSCALL_BASE+202)
-#define __NR_setreuid32 (__NR_SYSCALL_BASE+203)
-#define __NR_setregid32 (__NR_SYSCALL_BASE+204)
-#define __NR_getgroups32 (__NR_SYSCALL_BASE+205)
-#define __NR_setgroups32 (__NR_SYSCALL_BASE+206)
-#define __NR_fchown32 (__NR_SYSCALL_BASE+207)
-#define __NR_setresuid32 (__NR_SYSCALL_BASE+208)
-#define __NR_getresuid32 (__NR_SYSCALL_BASE+209)
-#define __NR_setresgid32 (__NR_SYSCALL_BASE+210)
-#define __NR_getresgid32 (__NR_SYSCALL_BASE+211)
-#define __NR_chown32 (__NR_SYSCALL_BASE+212)
-#define __NR_setuid32 (__NR_SYSCALL_BASE+213)
-#define __NR_setgid32 (__NR_SYSCALL_BASE+214)
-#define __NR_setfsuid32 (__NR_SYSCALL_BASE+215)
-#define __NR_setfsgid32 (__NR_SYSCALL_BASE+216)
-#define __NR_getdents64 (__NR_SYSCALL_BASE+217)
-#define __NR_pivot_root (__NR_SYSCALL_BASE+218)
-#define __NR_mincore (__NR_SYSCALL_BASE+219)
-#define __NR_madvise (__NR_SYSCALL_BASE+220)
-#define __NR_fcntl64 (__NR_SYSCALL_BASE+221)
- /* 222 for tux */
- /* 223 is unused */
-#define __NR_gettid (__NR_SYSCALL_BASE+224)
-#define __NR_readahead (__NR_SYSCALL_BASE+225)
-#define __NR_setxattr (__NR_SYSCALL_BASE+226)
-#define __NR_lsetxattr (__NR_SYSCALL_BASE+227)
-#define __NR_fsetxattr (__NR_SYSCALL_BASE+228)
-#define __NR_getxattr (__NR_SYSCALL_BASE+229)
-#define __NR_lgetxattr (__NR_SYSCALL_BASE+230)
-#define __NR_fgetxattr (__NR_SYSCALL_BASE+231)
-#define __NR_listxattr (__NR_SYSCALL_BASE+232)
-#define __NR_llistxattr (__NR_SYSCALL_BASE+233)
-#define __NR_flistxattr (__NR_SYSCALL_BASE+234)
-#define __NR_removexattr (__NR_SYSCALL_BASE+235)
-#define __NR_lremovexattr (__NR_SYSCALL_BASE+236)
-#define __NR_fremovexattr (__NR_SYSCALL_BASE+237)
-#define __NR_tkill (__NR_SYSCALL_BASE+238)
-#define __NR_sendfile64 (__NR_SYSCALL_BASE+239)
-#define __NR_futex (__NR_SYSCALL_BASE+240)
-#define __NR_sched_setaffinity (__NR_SYSCALL_BASE+241)
-#define __NR_sched_getaffinity (__NR_SYSCALL_BASE+242)
-#define __NR_io_setup (__NR_SYSCALL_BASE+243)
-#define __NR_io_destroy (__NR_SYSCALL_BASE+244)
-#define __NR_io_getevents (__NR_SYSCALL_BASE+245)
-#define __NR_io_submit (__NR_SYSCALL_BASE+246)
-#define __NR_io_cancel (__NR_SYSCALL_BASE+247)
-#define __NR_exit_group (__NR_SYSCALL_BASE+248)
-#define __NR_lookup_dcookie (__NR_SYSCALL_BASE+249)
-#define __NR_epoll_create (__NR_SYSCALL_BASE+250)
-#define __NR_epoll_ctl (__NR_SYSCALL_BASE+251)
-#define __NR_epoll_wait (__NR_SYSCALL_BASE+252)
-#define __NR_remap_file_pages (__NR_SYSCALL_BASE+253)
- /* 254 for set_thread_area */
- /* 255 for get_thread_area */
-#define __NR_set_tid_address (__NR_SYSCALL_BASE+256)
-#define __NR_timer_create (__NR_SYSCALL_BASE+257)
-#define __NR_timer_settime (__NR_SYSCALL_BASE+258)
-#define __NR_timer_gettime (__NR_SYSCALL_BASE+259)
-#define __NR_timer_getoverrun (__NR_SYSCALL_BASE+260)
-#define __NR_timer_delete (__NR_SYSCALL_BASE+261)
-#define __NR_clock_settime (__NR_SYSCALL_BASE+262)
-#define __NR_clock_gettime (__NR_SYSCALL_BASE+263)
-#define __NR_clock_getres (__NR_SYSCALL_BASE+264)
-#define __NR_clock_nanosleep (__NR_SYSCALL_BASE+265)
-#define __NR_statfs64 (__NR_SYSCALL_BASE+266)
-#define __NR_fstatfs64 (__NR_SYSCALL_BASE+267)
-#define __NR_tgkill (__NR_SYSCALL_BASE+268)
-#define __NR_utimes (__NR_SYSCALL_BASE+269)
-#define __NR_arm_fadvise64_64 (__NR_SYSCALL_BASE+270)
-#define __NR_pciconfig_iobase (__NR_SYSCALL_BASE+271)
-#define __NR_pciconfig_read (__NR_SYSCALL_BASE+272)
-#define __NR_pciconfig_write (__NR_SYSCALL_BASE+273)
-#define __NR_mq_open (__NR_SYSCALL_BASE+274)
-#define __NR_mq_unlink (__NR_SYSCALL_BASE+275)
-#define __NR_mq_timedsend (__NR_SYSCALL_BASE+276)
-#define __NR_mq_timedreceive (__NR_SYSCALL_BASE+277)
-#define __NR_mq_notify (__NR_SYSCALL_BASE+278)
-#define __NR_mq_getsetattr (__NR_SYSCALL_BASE+279)
-#define __NR_waitid (__NR_SYSCALL_BASE+280)
-#define __NR_socket (__NR_SYSCALL_BASE+281)
-#define __NR_bind (__NR_SYSCALL_BASE+282)
-#define __NR_connect (__NR_SYSCALL_BASE+283)
-#define __NR_listen (__NR_SYSCALL_BASE+284)
-#define __NR_accept (__NR_SYSCALL_BASE+285)
-#define __NR_getsockname (__NR_SYSCALL_BASE+286)
-#define __NR_getpeername (__NR_SYSCALL_BASE+287)
-#define __NR_socketpair (__NR_SYSCALL_BASE+288)
-#define __NR_send (__NR_SYSCALL_BASE+289)
-#define __NR_sendto (__NR_SYSCALL_BASE+290)
-#define __NR_recv (__NR_SYSCALL_BASE+291)
-#define __NR_recvfrom (__NR_SYSCALL_BASE+292)
-#define __NR_shutdown (__NR_SYSCALL_BASE+293)
-#define __NR_setsockopt (__NR_SYSCALL_BASE+294)
-#define __NR_getsockopt (__NR_SYSCALL_BASE+295)
-#define __NR_sendmsg (__NR_SYSCALL_BASE+296)
-#define __NR_recvmsg (__NR_SYSCALL_BASE+297)
-#define __NR_semop (__NR_SYSCALL_BASE+298)
-#define __NR_semget (__NR_SYSCALL_BASE+299)
-#define __NR_semctl (__NR_SYSCALL_BASE+300)
-#define __NR_msgsnd (__NR_SYSCALL_BASE+301)
-#define __NR_msgrcv (__NR_SYSCALL_BASE+302)
-#define __NR_msgget (__NR_SYSCALL_BASE+303)
-#define __NR_msgctl (__NR_SYSCALL_BASE+304)
-#define __NR_shmat (__NR_SYSCALL_BASE+305)
-#define __NR_shmdt (__NR_SYSCALL_BASE+306)
-#define __NR_shmget (__NR_SYSCALL_BASE+307)
-#define __NR_shmctl (__NR_SYSCALL_BASE+308)
-#define __NR_add_key (__NR_SYSCALL_BASE+309)
-#define __NR_request_key (__NR_SYSCALL_BASE+310)
-#define __NR_keyctl (__NR_SYSCALL_BASE+311)
-#define __NR_semtimedop (__NR_SYSCALL_BASE+312)
-#define __NR_vserver (__NR_SYSCALL_BASE+313)
-#define __NR_ioprio_set (__NR_SYSCALL_BASE+314)
-#define __NR_ioprio_get (__NR_SYSCALL_BASE+315)
-#define __NR_inotify_init (__NR_SYSCALL_BASE+316)
-#define __NR_inotify_add_watch (__NR_SYSCALL_BASE+317)
-#define __NR_inotify_rm_watch (__NR_SYSCALL_BASE+318)
-#define __NR_mbind (__NR_SYSCALL_BASE+319)
-#define __NR_get_mempolicy (__NR_SYSCALL_BASE+320)
-#define __NR_set_mempolicy (__NR_SYSCALL_BASE+321)
-#define __NR_openat (__NR_SYSCALL_BASE+322)
-#define __NR_mkdirat (__NR_SYSCALL_BASE+323)
-#define __NR_mknodat (__NR_SYSCALL_BASE+324)
-#define __NR_fchownat (__NR_SYSCALL_BASE+325)
-#define __NR_futimesat (__NR_SYSCALL_BASE+326)
-#define __NR_fstatat64 (__NR_SYSCALL_BASE+327)
-#define __NR_unlinkat (__NR_SYSCALL_BASE+328)
-#define __NR_renameat (__NR_SYSCALL_BASE+329)
-#define __NR_linkat (__NR_SYSCALL_BASE+330)
-#define __NR_symlinkat (__NR_SYSCALL_BASE+331)
-#define __NR_readlinkat (__NR_SYSCALL_BASE+332)
-#define __NR_fchmodat (__NR_SYSCALL_BASE+333)
-#define __NR_faccessat (__NR_SYSCALL_BASE+334)
-#define __NR_pselect6 (__NR_SYSCALL_BASE+335)
-#define __NR_ppoll (__NR_SYSCALL_BASE+336)
-#define __NR_unshare (__NR_SYSCALL_BASE+337)
-#define __NR_set_robust_list (__NR_SYSCALL_BASE+338)
-#define __NR_get_robust_list (__NR_SYSCALL_BASE+339)
-#define __NR_splice (__NR_SYSCALL_BASE+340)
-#define __NR_arm_sync_file_range (__NR_SYSCALL_BASE+341)
-#define __NR_sync_file_range2 __NR_arm_sync_file_range
-#define __NR_tee (__NR_SYSCALL_BASE+342)
-#define __NR_vmsplice (__NR_SYSCALL_BASE+343)
-#define __NR_move_pages (__NR_SYSCALL_BASE+344)
-#define __NR_getcpu (__NR_SYSCALL_BASE+345)
-#define __NR_epoll_pwait (__NR_SYSCALL_BASE+346)
-#define __NR_kexec_load (__NR_SYSCALL_BASE+347)
-#define __NR_utimensat (__NR_SYSCALL_BASE+348)
-#define __NR_signalfd (__NR_SYSCALL_BASE+349)
-#define __NR_timerfd_create (__NR_SYSCALL_BASE+350)
-#define __NR_eventfd (__NR_SYSCALL_BASE+351)
-#define __NR_fallocate (__NR_SYSCALL_BASE+352)
-#define __NR_timerfd_settime (__NR_SYSCALL_BASE+353)
-#define __NR_timerfd_gettime (__NR_SYSCALL_BASE+354)
-#define __NR_signalfd4 (__NR_SYSCALL_BASE+355)
-#define __NR_eventfd2 (__NR_SYSCALL_BASE+356)
-#define __NR_epoll_create1 (__NR_SYSCALL_BASE+357)
-#define __NR_dup3 (__NR_SYSCALL_BASE+358)
-#define __NR_pipe2 (__NR_SYSCALL_BASE+359)
-#define __NR_inotify_init1 (__NR_SYSCALL_BASE+360)
-#define __NR_preadv (__NR_SYSCALL_BASE+361)
-#define __NR_pwritev (__NR_SYSCALL_BASE+362)
-#define __NR_rt_tgsigqueueinfo (__NR_SYSCALL_BASE+363)
-#define __NR_perf_event_open (__NR_SYSCALL_BASE+364)
-#define __NR_recvmmsg (__NR_SYSCALL_BASE+365)
-#define __NR_accept4 (__NR_SYSCALL_BASE+366)
-#define __NR_fanotify_init (__NR_SYSCALL_BASE+367)
-#define __NR_fanotify_mark (__NR_SYSCALL_BASE+368)
-#define __NR_prlimit64 (__NR_SYSCALL_BASE+369)
-#define __NR_name_to_handle_at (__NR_SYSCALL_BASE+370)
-#define __NR_open_by_handle_at (__NR_SYSCALL_BASE+371)
-#define __NR_clock_adjtime (__NR_SYSCALL_BASE+372)
-#define __NR_syncfs (__NR_SYSCALL_BASE+373)
-#define __NR_sendmmsg (__NR_SYSCALL_BASE+374)
-#define __NR_setns (__NR_SYSCALL_BASE+375)
-#define __NR_process_vm_readv (__NR_SYSCALL_BASE+376)
-#define __NR_process_vm_writev (__NR_SYSCALL_BASE+377)
-#define __NR_kcmp (__NR_SYSCALL_BASE+378)
-#define __NR_finit_module (__NR_SYSCALL_BASE+379)
-#define __NR_sched_setattr (__NR_SYSCALL_BASE+380)
-#define __NR_sched_getattr (__NR_SYSCALL_BASE+381)
-#define __NR_renameat2 (__NR_SYSCALL_BASE+382)
-#define __NR_seccomp (__NR_SYSCALL_BASE+383)
-#define __NR_getrandom (__NR_SYSCALL_BASE+384)
-#define __NR_memfd_create (__NR_SYSCALL_BASE+385)
-#define __NR_bpf (__NR_SYSCALL_BASE+386)
-#define __NR_execveat (__NR_SYSCALL_BASE+387)
-#define __NR_userfaultfd (__NR_SYSCALL_BASE+388)
-#define __NR_membarrier (__NR_SYSCALL_BASE+389)
-#define __NR_mlock2 (__NR_SYSCALL_BASE+390)
+#include <asm/unistd-common.h>
+#define __NR_sync_file_range2 __NR_arm_sync_file_range
/*
* The following SWIs are ARM private.
@@ -428,24 +36,4 @@
#define __ARM_NR_usr32 (__ARM_NR_BASE+4)
#define __ARM_NR_set_tls (__ARM_NR_BASE+5)
-/*
- * The following syscalls are obsolete and no longer available for EABI.
- */
-#if !defined(__KERNEL__)
-#if defined(__ARM_EABI__)
-#undef __NR_time
-#undef __NR_umount
-#undef __NR_stime
-#undef __NR_alarm
-#undef __NR_utime
-#undef __NR_getrlimit
-#undef __NR_select
-#undef __NR_readdir
-#undef __NR_mmap
-#undef __NR_socketcall
-#undef __NR_syscall
-#undef __NR_ipc
-#endif
-#endif
-
#endif /* _UAPI__ASM_ARM_UNISTD_H */
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
deleted file mode 100644
index ac368bb068d1..000000000000
--- a/arch/arm/kernel/calls.S
+++ /dev/null
@@ -1,409 +0,0 @@
-/*
- * linux/arch/arm/kernel/calls.S
- *
- * Copyright (C) 1995-2005 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This file is included thrice in entry-common.S
- */
-/* 0 */ CALL(sys_restart_syscall)
- CALL(sys_exit)
- CALL(sys_fork)
- CALL(sys_read)
- CALL(sys_write)
-/* 5 */ CALL(sys_open)
- CALL(sys_close)
- CALL(sys_ni_syscall) /* was sys_waitpid */
- CALL(sys_creat)
- CALL(sys_link)
-/* 10 */ CALL(sys_unlink)
- CALL(sys_execve)
- CALL(sys_chdir)
- CALL(OBSOLETE(sys_time)) /* used by libc4 */
- CALL(sys_mknod)
-/* 15 */ CALL(sys_chmod)
- CALL(sys_lchown16)
- CALL(sys_ni_syscall) /* was sys_break */
- CALL(sys_ni_syscall) /* was sys_stat */
- CALL(sys_lseek)
-/* 20 */ CALL(sys_getpid)
- CALL(sys_mount)
- CALL(OBSOLETE(sys_oldumount)) /* used by libc4 */
- CALL(sys_setuid16)
- CALL(sys_getuid16)
-/* 25 */ CALL(OBSOLETE(sys_stime))
- CALL(sys_ptrace)
- CALL(OBSOLETE(sys_alarm)) /* used by libc4 */
- CALL(sys_ni_syscall) /* was sys_fstat */
- CALL(sys_pause)
-/* 30 */ CALL(OBSOLETE(sys_utime)) /* used by libc4 */
- CALL(sys_ni_syscall) /* was sys_stty */
- CALL(sys_ni_syscall) /* was sys_getty */
- CALL(sys_access)
- CALL(sys_nice)
-/* 35 */ CALL(sys_ni_syscall) /* was sys_ftime */
- CALL(sys_sync)
- CALL(sys_kill)
- CALL(sys_rename)
- CALL(sys_mkdir)
-/* 40 */ CALL(sys_rmdir)
- CALL(sys_dup)
- CALL(sys_pipe)
- CALL(sys_times)
- CALL(sys_ni_syscall) /* was sys_prof */
-/* 45 */ CALL(sys_brk)
- CALL(sys_setgid16)
- CALL(sys_getgid16)
- CALL(sys_ni_syscall) /* was sys_signal */
- CALL(sys_geteuid16)
-/* 50 */ CALL(sys_getegid16)
- CALL(sys_acct)
- CALL(sys_umount)
- CALL(sys_ni_syscall) /* was sys_lock */
- CALL(sys_ioctl)
-/* 55 */ CALL(sys_fcntl)
- CALL(sys_ni_syscall) /* was sys_mpx */
- CALL(sys_setpgid)
- CALL(sys_ni_syscall) /* was sys_ulimit */
- CALL(sys_ni_syscall) /* was sys_olduname */
-/* 60 */ CALL(sys_umask)
- CALL(sys_chroot)
- CALL(sys_ustat)
- CALL(sys_dup2)
- CALL(sys_getppid)
-/* 65 */ CALL(sys_getpgrp)
- CALL(sys_setsid)
- CALL(sys_sigaction)
- CALL(sys_ni_syscall) /* was sys_sgetmask */
- CALL(sys_ni_syscall) /* was sys_ssetmask */
-/* 70 */ CALL(sys_setreuid16)
- CALL(sys_setregid16)
- CALL(sys_sigsuspend)
- CALL(sys_sigpending)
- CALL(sys_sethostname)
-/* 75 */ CALL(sys_setrlimit)
- CALL(OBSOLETE(sys_old_getrlimit)) /* used by libc4 */
- CALL(sys_getrusage)
- CALL(sys_gettimeofday)
- CALL(sys_settimeofday)
-/* 80 */ CALL(sys_getgroups16)
- CALL(sys_setgroups16)
- CALL(OBSOLETE(sys_old_select)) /* used by libc4 */
- CALL(sys_symlink)
- CALL(sys_ni_syscall) /* was sys_lstat */
-/* 85 */ CALL(sys_readlink)
- CALL(sys_uselib)
- CALL(sys_swapon)
- CALL(sys_reboot)
- CALL(OBSOLETE(sys_old_readdir)) /* used by libc4 */
-/* 90 */ CALL(OBSOLETE(sys_old_mmap)) /* used by libc4 */
- CALL(sys_munmap)
- CALL(sys_truncate)
- CALL(sys_ftruncate)
- CALL(sys_fchmod)
-/* 95 */ CALL(sys_fchown16)
- CALL(sys_getpriority)
- CALL(sys_setpriority)
- CALL(sys_ni_syscall) /* was sys_profil */
- CALL(sys_statfs)
-/* 100 */ CALL(sys_fstatfs)
- CALL(sys_ni_syscall) /* sys_ioperm */
- CALL(OBSOLETE(ABI(sys_socketcall, sys_oabi_socketcall)))
- CALL(sys_syslog)
- CALL(sys_setitimer)
-/* 105 */ CALL(sys_getitimer)
- CALL(sys_newstat)
- CALL(sys_newlstat)
- CALL(sys_newfstat)
- CALL(sys_ni_syscall) /* was sys_uname */
-/* 110 */ CALL(sys_ni_syscall) /* was sys_iopl */
- CALL(sys_vhangup)
- CALL(sys_ni_syscall)
- CALL(OBSOLETE(sys_syscall)) /* call a syscall */
- CALL(sys_wait4)
-/* 115 */ CALL(sys_swapoff)
- CALL(sys_sysinfo)
- CALL(OBSOLETE(ABI(sys_ipc, sys_oabi_ipc)))
- CALL(sys_fsync)
- CALL(sys_sigreturn_wrapper)
-/* 120 */ CALL(sys_clone)
- CALL(sys_setdomainname)
- CALL(sys_newuname)
- CALL(sys_ni_syscall) /* modify_ldt */
- CALL(sys_adjtimex)
-/* 125 */ CALL(sys_mprotect)
- CALL(sys_sigprocmask)
- CALL(sys_ni_syscall) /* was sys_create_module */
- CALL(sys_init_module)
- CALL(sys_delete_module)
-/* 130 */ CALL(sys_ni_syscall) /* was sys_get_kernel_syms */
- CALL(sys_quotactl)
- CALL(sys_getpgid)
- CALL(sys_fchdir)
- CALL(sys_bdflush)
-/* 135 */ CALL(sys_sysfs)
- CALL(sys_personality)
- CALL(sys_ni_syscall) /* reserved for afs_syscall */
- CALL(sys_setfsuid16)
- CALL(sys_setfsgid16)
-/* 140 */ CALL(sys_llseek)
- CALL(sys_getdents)
- CALL(sys_select)
- CALL(sys_flock)
- CALL(sys_msync)
-/* 145 */ CALL(sys_readv)
- CALL(sys_writev)
- CALL(sys_getsid)
- CALL(sys_fdatasync)
- CALL(sys_sysctl)
-/* 150 */ CALL(sys_mlock)
- CALL(sys_munlock)
- CALL(sys_mlockall)
- CALL(sys_munlockall)
- CALL(sys_sched_setparam)
-/* 155 */ CALL(sys_sched_getparam)
- CALL(sys_sched_setscheduler)
- CALL(sys_sched_getscheduler)
- CALL(sys_sched_yield)
- CALL(sys_sched_get_priority_max)
-/* 160 */ CALL(sys_sched_get_priority_min)
- CALL(sys_sched_rr_get_interval)
- CALL(sys_nanosleep)
- CALL(sys_mremap)
- CALL(sys_setresuid16)
-/* 165 */ CALL(sys_getresuid16)
- CALL(sys_ni_syscall) /* vm86 */
- CALL(sys_ni_syscall) /* was sys_query_module */
- CALL(sys_poll)
- CALL(sys_ni_syscall) /* was nfsservctl */
-/* 170 */ CALL(sys_setresgid16)
- CALL(sys_getresgid16)
- CALL(sys_prctl)
- CALL(sys_rt_sigreturn_wrapper)
- CALL(sys_rt_sigaction)
-/* 175 */ CALL(sys_rt_sigprocmask)
- CALL(sys_rt_sigpending)
- CALL(sys_rt_sigtimedwait)
- CALL(sys_rt_sigqueueinfo)
- CALL(sys_rt_sigsuspend)
-/* 180 */ CALL(ABI(sys_pread64, sys_oabi_pread64))
- CALL(ABI(sys_pwrite64, sys_oabi_pwrite64))
- CALL(sys_chown16)
- CALL(sys_getcwd)
- CALL(sys_capget)
-/* 185 */ CALL(sys_capset)
- CALL(sys_sigaltstack)
- CALL(sys_sendfile)
- CALL(sys_ni_syscall) /* getpmsg */
- CALL(sys_ni_syscall) /* putpmsg */
-/* 190 */ CALL(sys_vfork)
- CALL(sys_getrlimit)
- CALL(sys_mmap2)
- CALL(ABI(sys_truncate64, sys_oabi_truncate64))
- CALL(ABI(sys_ftruncate64, sys_oabi_ftruncate64))
-/* 195 */ CALL(ABI(sys_stat64, sys_oabi_stat64))
- CALL(ABI(sys_lstat64, sys_oabi_lstat64))
- CALL(ABI(sys_fstat64, sys_oabi_fstat64))
- CALL(sys_lchown)
- CALL(sys_getuid)
-/* 200 */ CALL(sys_getgid)
- CALL(sys_geteuid)
- CALL(sys_getegid)
- CALL(sys_setreuid)
- CALL(sys_setregid)
-/* 205 */ CALL(sys_getgroups)
- CALL(sys_setgroups)
- CALL(sys_fchown)
- CALL(sys_setresuid)
- CALL(sys_getresuid)
-/* 210 */ CALL(sys_setresgid)
- CALL(sys_getresgid)
- CALL(sys_chown)
- CALL(sys_setuid)
- CALL(sys_setgid)
-/* 215 */ CALL(sys_setfsuid)
- CALL(sys_setfsgid)
- CALL(sys_getdents64)
- CALL(sys_pivot_root)
- CALL(sys_mincore)
-/* 220 */ CALL(sys_madvise)
- CALL(ABI(sys_fcntl64, sys_oabi_fcntl64))
- CALL(sys_ni_syscall) /* TUX */
- CALL(sys_ni_syscall)
- CALL(sys_gettid)
-/* 225 */ CALL(ABI(sys_readahead, sys_oabi_readahead))
- CALL(sys_setxattr)
- CALL(sys_lsetxattr)
- CALL(sys_fsetxattr)
- CALL(sys_getxattr)
-/* 230 */ CALL(sys_lgetxattr)
- CALL(sys_fgetxattr)
- CALL(sys_listxattr)
- CALL(sys_llistxattr)
- CALL(sys_flistxattr)
-/* 235 */ CALL(sys_removexattr)
- CALL(sys_lremovexattr)
- CALL(sys_fremovexattr)
- CALL(sys_tkill)
- CALL(sys_sendfile64)
-/* 240 */ CALL(sys_futex)
- CALL(sys_sched_setaffinity)
- CALL(sys_sched_getaffinity)
- CALL(sys_io_setup)
- CALL(sys_io_destroy)
-/* 245 */ CALL(sys_io_getevents)
- CALL(sys_io_submit)
- CALL(sys_io_cancel)
- CALL(sys_exit_group)
- CALL(sys_lookup_dcookie)
-/* 250 */ CALL(sys_epoll_create)
- CALL(ABI(sys_epoll_ctl, sys_oabi_epoll_ctl))
- CALL(ABI(sys_epoll_wait, sys_oabi_epoll_wait))
- CALL(sys_remap_file_pages)
- CALL(sys_ni_syscall) /* sys_set_thread_area */
-/* 255 */ CALL(sys_ni_syscall) /* sys_get_thread_area */
- CALL(sys_set_tid_address)
- CALL(sys_timer_create)
- CALL(sys_timer_settime)
- CALL(sys_timer_gettime)
-/* 260 */ CALL(sys_timer_getoverrun)
- CALL(sys_timer_delete)
- CALL(sys_clock_settime)
- CALL(sys_clock_gettime)
- CALL(sys_clock_getres)
-/* 265 */ CALL(sys_clock_nanosleep)
- CALL(sys_statfs64_wrapper)
- CALL(sys_fstatfs64_wrapper)
- CALL(sys_tgkill)
- CALL(sys_utimes)
-/* 270 */ CALL(sys_arm_fadvise64_64)
- CALL(sys_pciconfig_iobase)
- CALL(sys_pciconfig_read)
- CALL(sys_pciconfig_write)
- CALL(sys_mq_open)
-/* 275 */ CALL(sys_mq_unlink)
- CALL(sys_mq_timedsend)
- CALL(sys_mq_timedreceive)
- CALL(sys_mq_notify)
- CALL(sys_mq_getsetattr)
-/* 280 */ CALL(sys_waitid)
- CALL(sys_socket)
- CALL(ABI(sys_bind, sys_oabi_bind))
- CALL(ABI(sys_connect, sys_oabi_connect))
- CALL(sys_listen)
-/* 285 */ CALL(sys_accept)
- CALL(sys_getsockname)
- CALL(sys_getpeername)
- CALL(sys_socketpair)
- CALL(sys_send)
-/* 290 */ CALL(ABI(sys_sendto, sys_oabi_sendto))
- CALL(sys_recv)
- CALL(sys_recvfrom)
- CALL(sys_shutdown)
- CALL(sys_setsockopt)
-/* 295 */ CALL(sys_getsockopt)
- CALL(ABI(sys_sendmsg, sys_oabi_sendmsg))
- CALL(sys_recvmsg)
- CALL(ABI(sys_semop, sys_oabi_semop))
- CALL(sys_semget)
-/* 300 */ CALL(sys_semctl)
- CALL(sys_msgsnd)
- CALL(sys_msgrcv)
- CALL(sys_msgget)
- CALL(sys_msgctl)
-/* 305 */ CALL(sys_shmat)
- CALL(sys_shmdt)
- CALL(sys_shmget)
- CALL(sys_shmctl)
- CALL(sys_add_key)
-/* 310 */ CALL(sys_request_key)
- CALL(sys_keyctl)
- CALL(ABI(sys_semtimedop, sys_oabi_semtimedop))
-/* vserver */ CALL(sys_ni_syscall)
- CALL(sys_ioprio_set)
-/* 315 */ CALL(sys_ioprio_get)
- CALL(sys_inotify_init)
- CALL(sys_inotify_add_watch)
- CALL(sys_inotify_rm_watch)
- CALL(sys_mbind)
-/* 320 */ CALL(sys_get_mempolicy)
- CALL(sys_set_mempolicy)
- CALL(sys_openat)
- CALL(sys_mkdirat)
- CALL(sys_mknodat)
-/* 325 */ CALL(sys_fchownat)
- CALL(sys_futimesat)
- CALL(ABI(sys_fstatat64, sys_oabi_fstatat64))
- CALL(sys_unlinkat)
- CALL(sys_renameat)
-/* 330 */ CALL(sys_linkat)
- CALL(sys_symlinkat)
- CALL(sys_readlinkat)
- CALL(sys_fchmodat)
- CALL(sys_faccessat)
-/* 335 */ CALL(sys_pselect6)
- CALL(sys_ppoll)
- CALL(sys_unshare)
- CALL(sys_set_robust_list)
- CALL(sys_get_robust_list)
-/* 340 */ CALL(sys_splice)
- CALL(sys_sync_file_range2)
- CALL(sys_tee)
- CALL(sys_vmsplice)
- CALL(sys_move_pages)
-/* 345 */ CALL(sys_getcpu)
- CALL(sys_epoll_pwait)
- CALL(sys_kexec_load)
- CALL(sys_utimensat)
- CALL(sys_signalfd)
-/* 350 */ CALL(sys_timerfd_create)
- CALL(sys_eventfd)
- CALL(sys_fallocate)
- CALL(sys_timerfd_settime)
- CALL(sys_timerfd_gettime)
-/* 355 */ CALL(sys_signalfd4)
- CALL(sys_eventfd2)
- CALL(sys_epoll_create1)
- CALL(sys_dup3)
- CALL(sys_pipe2)
-/* 360 */ CALL(sys_inotify_init1)
- CALL(sys_preadv)
- CALL(sys_pwritev)
- CALL(sys_rt_tgsigqueueinfo)
- CALL(sys_perf_event_open)
-/* 365 */ CALL(sys_recvmmsg)
- CALL(sys_accept4)
- CALL(sys_fanotify_init)
- CALL(sys_fanotify_mark)
- CALL(sys_prlimit64)
-/* 370 */ CALL(sys_name_to_handle_at)
- CALL(sys_open_by_handle_at)
- CALL(sys_clock_adjtime)
- CALL(sys_syncfs)
- CALL(sys_sendmmsg)
-/* 375 */ CALL(sys_setns)
- CALL(sys_process_vm_readv)
- CALL(sys_process_vm_writev)
- CALL(sys_kcmp)
- CALL(sys_finit_module)
-/* 380 */ CALL(sys_sched_setattr)
- CALL(sys_sched_getattr)
- CALL(sys_renameat2)
- CALL(sys_seccomp)
- CALL(sys_getrandom)
-/* 385 */ CALL(sys_memfd_create)
- CALL(sys_bpf)
- CALL(sys_execveat)
- CALL(sys_userfaultfd)
- CALL(sys_membarrier)
- CALL(sys_mlock2)
-#ifndef syscalls_counted
-.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls
-#define syscalls_counted
-#endif
-.rept syscalls_padding
- CALL(sys_ni_syscall)
-.endr
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index b9967792ac44..9cf480b07565 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -13,6 +13,11 @@
#include <asm/ftrace.h>
#include <asm/unwind.h>
#include <asm/memory.h>
+#ifdef CONFIG_AEABI
+#include <asm/unistd-oabi.h>
+#endif
+
+ .equ NR_syscalls, __NR_syscalls
#ifdef CONFIG_NEED_RET_TO_USER
#include <mach/entry-macro.S>
@@ -130,21 +135,6 @@ ENTRY(ret_from_fork)
b ret_slow_syscall
ENDPROC(ret_from_fork)
- .equ NR_syscalls,0
-#define CALL(x) .equ NR_syscalls,NR_syscalls+1
-#include "calls.S"
-
-/*
- * Ensure that the system call table is equal to __NR_syscalls,
- * which is the value the rest of the system sees
- */
-.ifne NR_syscalls - __NR_syscalls
-.error "__NR_syscalls is not equal to the size of the syscall table"
-.endif
-
-#undef CALL
-#define CALL(x) .long x
-
/*=============================================================================
* SWI handler
*-----------------------------------------------------------------------------
@@ -292,22 +282,48 @@ __cr_alignment:
#endif
.ltorg
+ .macro syscall_table_start, sym
+ .equ __sys_nr, 0
+ .type \sym, #object
+ENTRY(\sym)
+ .endm
+
+ .macro syscall, nr, func
+ .ifgt __sys_nr - \nr
+ .error "Duplicated/unorded system call entry"
+ .endif
+ .rept \nr - __sys_nr
+ .long sys_ni_syscall
+ .endr
+ .long \func
+ .equ __sys_nr, \nr + 1
+ .endm
+
+ .macro syscall_table_end, sym
+ .ifgt __sys_nr - __NR_syscalls
+ .error "System call table too big"
+ .endif
+ .rept __NR_syscalls - __sys_nr
+ .long sys_ni_syscall
+ .endr
+ .size \sym, . - \sym
+ .endm
+
+#define NATIVE(nr, func) syscall nr, func
+
/*
* This is the syscall table declaration for native ABI syscalls.
* With EABI a couple syscalls are obsolete and defined as sys_ni_syscall.
*/
-#define ABI(native, compat) native
+ syscall_table_start sys_call_table
+#define COMPAT(nr, native, compat) syscall nr, native
#ifdef CONFIG_AEABI
-#define OBSOLETE(syscall) sys_ni_syscall
+#include <calls-eabi.S>
#else
-#define OBSOLETE(syscall) syscall
+#include <calls-oabi.S>
#endif
-
- .type sys_call_table, #object
-ENTRY(sys_call_table)
-#include "calls.S"
-#undef ABI
-#undef OBSOLETE
+#undef COMPAT
+ syscall_table_end sys_call_table
/*============================================================================
* Special system call wrappers
@@ -412,14 +428,10 @@ ENDPROC(sys_oabi_readahead)
* Let's declare a second syscall table for old ABI binaries
* using the compatibility syscall entries.
*/
-#define ABI(native, compat) compat
-#define OBSOLETE(syscall) syscall
-
- .type sys_oabi_call_table, #object
-ENTRY(sys_oabi_call_table)
-#include "calls.S"
-#undef ABI
-#undef OBSOLETE
+ syscall_table_start sys_oabi_call_table
+#define COMPAT(nr, native, compat) syscall nr, compat
+#include <calls-oabi.S>
+ syscall_table_end sys_oabi_call_table
#endif
diff --git a/arch/arm/tools/Makefile b/arch/arm/tools/Makefile
index 32d05c8219dc..971920f048d0 100644
--- a/arch/arm/tools/Makefile
+++ b/arch/arm/tools/Makefile
@@ -4,7 +4,73 @@
# Copyright (C) 2001 Russell King
#
-include/generated/mach-types.h: $(src)/gen-mach-types $(src)/mach-types
+gen := arch/$(ARCH)/include/generated
+kapi := $(gen)/asm
+uapi := $(gen)/uapi/asm
+syshdr := $(srctree)/$(src)/syscallhdr.sh
+sysnr := $(srctree)/$(src)/syscallnr.sh
+systbl := $(srctree)/$(src)/syscalltbl.sh
+syscall := $(srctree)/$(src)/syscall.tbl
+
+gen-y := $(gen)/calls-oabi.S
+gen-y += $(gen)/calls-eabi.S
+kapi-hdrs-y := $(kapi)/unistd-nr.h
+kapi-hdrs-y += $(kapi)/mach-types.h
+uapi-hdrs-y := $(uapi)/unistd-common.h
+uapi-hdrs-y += $(uapi)/unistd-oabi.h
+uapi-hdrs-y += $(uapi)/unistd-eabi.h
+
+targets += $(addprefix ../../../,$(gen-y) $(kapi-hdrs-y) $(uapi-hdrs-y))
+
+PHONY += kapi uapi
+
+kapi: $(kapi-hdrs-y) $(gen-y)
+
+uapi: $(uapi-hdrs-y)
+
+# Create output directory if not already present
+_dummy := $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)') \
+ $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)')
+
+$(kapi)/mach-types.h: $(src)/gen-mach-types $(src)/mach-types
@$(kecho) ' Generating $@'
@mkdir -p $(dir $@)
$(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; }
+
+quiet_cmd_syshdr = SYSHDR $@
+ cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@' \
+ '$(syshdr_abi_$(basetarget))' \
+ '$(syshdr_pfx_$(basetarget))' \
+ '__NR_SYSCALL_BASE'
+
+quiet_cmd_systbl = SYSTBL $@
+ cmd_systbl = $(CONFIG_SHELL) '$(systbl)' '$<' '$@' \
+ '$(systbl_abi_$(basetarget))'
+
+quiet_cmd_sysnr = SYSNR $@
+ cmd_sysnr = $(CONFIG_SHELL) '$(sysnr)' '$<' '$@' \
+ '$(syshdr_abi_$(basetarget))'
+
+syshdr_abi_unistd-common := common
+$(uapi)/unistd-common.h: $(syscall) $(syshdr) FORCE
+ $(call if_changed,syshdr)
+
+syshdr_abi_unistd-oabi := oabi
+$(uapi)/unistd-oabi.h: $(syscall) $(syshdr) FORCE
+ $(call if_changed,syshdr)
+
+syshdr_abi_unistd-eabi := eabi
+$(uapi)/unistd-eabi.h: $(syscall) $(syshdr) FORCE
+ $(call if_changed,syshdr)
+
+sysnr_abi_unistd-nr := common,oabi,eabi,compat
+$(kapi)/unistd-nr.h: $(syscall) $(sysnr) FORCE
+ $(call if_changed,sysnr)
+
+systbl_abi_calls-oabi := common,oabi
+$(gen)/calls-oabi.S: $(syscall) $(systbl) FORCE
+ $(call if_changed,systbl)
+
+systbl_abi_calls-eabi := common,eabi
+$(gen)/calls-eabi.S: $(syscall) $(systbl) FORCE
+ $(call if_changed,systbl)
diff --git a/arch/arm/tools/syscall.tbl b/arch/arm/tools/syscall.tbl
new file mode 100644
index 000000000000..f4e9585226f3
--- /dev/null
+++ b/arch/arm/tools/syscall.tbl
@@ -0,0 +1,407 @@
+#
+# Linux system call numbers and entry vectors
+#
+# The format is:
+# <num> <abi> <name> [<entry point> [<oabi compat entry point>]]
+#
+# Where abi is:
+# common - for system calls shared between oabi and eabi (may have compat)
+# oabi - for oabi-only system calls (may have compat)
+# eabi - for eabi-only system calls
+#
+# For each syscall number, "common" is mutually exclusive with oabi and eabi
+#
+0 common restart_syscall sys_restart_syscall
+1 common exit sys_exit
+2 common fork sys_fork
+3 common read sys_read
+4 common write sys_write
+5 common open sys_open
+6 common close sys_close
+# 7 was sys_waitpid
+8 common creat sys_creat
+9 common link sys_link
+10 common unlink sys_unlink
+11 common execve sys_execve
+12 common chdir sys_chdir
+13 oabi time sys_time
+14 common mknod sys_mknod
+15 common chmod sys_chmod
+16 common lchown sys_lchown16
+# 17 was sys_break
+# 18 was sys_stat
+19 common lseek sys_lseek
+20 common getpid sys_getpid
+21 common mount sys_mount
+22 oabi umount sys_oldumount
+23 common setuid sys_setuid16
+24 common getuid sys_getuid16
+25 oabi stime sys_stime
+26 common ptrace sys_ptrace
+27 oabi alarm sys_alarm
+# 28 was sys_fstat
+29 common pause sys_pause
+30 oabi utime sys_utime
+# 31 was sys_stty
+# 32 was sys_gtty
+33 common access sys_access
+34 common nice sys_nice
+# 35 was sys_ftime
+36 common sync sys_sync
+37 common kill sys_kill
+38 common rename sys_rename
+39 common mkdir sys_mkdir
+40 common rmdir sys_rmdir
+41 common dup sys_dup
+42 common pipe sys_pipe
+43 common times sys_times
+# 44 was sys_prof
+45 common brk sys_brk
+46 common setgid sys_setgid16
+47 common getgid sys_getgid16
+# 48 was sys_signal
+49 common geteuid sys_geteuid16
+50 common getegid sys_getegid16
+51 common acct sys_acct
+52 common umount2 sys_umount
+# 53 was sys_lock
+54 common ioctl sys_ioctl
+55 common fcntl sys_fcntl
+# 56 was sys_mpx
+57 common setpgid sys_setpgid
+# 58 was sys_ulimit
+# 59 was sys_olduname
+60 common umask sys_umask
+61 common chroot sys_chroot
+62 common ustat sys_ustat
+63 common dup2 sys_dup2
+64 common getppid sys_getppid
+65 common getpgrp sys_getpgrp
+66 common setsid sys_setsid
+67 common sigaction sys_sigaction
+# 68 was sys_sgetmask
+# 69 was sys_ssetmask
+70 common setreuid sys_setreuid16
+71 common setregid sys_setregid16
+72 common sigsuspend sys_sigsuspend
+73 common sigpending sys_sigpending
+74 common sethostname sys_sethostname
+75 common setrlimit sys_setrlimit
+# Back compat 2GB limited rlimit
+76 oabi getrlimit sys_old_getrlimit
+77 common getrusage sys_getrusage
+78 common gettimeofday sys_gettimeofday
+79 common settimeofday sys_settimeofday
+80 common getgroups sys_getgroups16
+81 common setgroups sys_setgroups16
+82 oabi select sys_old_select
+83 common symlink sys_symlink
+# 84 was sys_lstat
+85 common readlink sys_readlink
+86 common uselib sys_uselib
+87 common swapon sys_swapon
+88 common reboot sys_reboot
+89 oabi readdir sys_old_readdir
+90 oabi mmap sys_old_mmap
+91 common munmap sys_munmap
+92 common truncate sys_truncate
+93 common ftruncate sys_ftruncate
+94 common fchmod sys_fchmod
+95 common fchown sys_fchown16
+96 common getpriority sys_getpriority
+97 common setpriority sys_setpriority
+# 98 was sys_profil
+99 common statfs sys_statfs
+100 common fstatfs sys_fstatfs
+# 101 was sys_ioperm
+102 oabi socketcall sys_socketcall sys_oabi_socketcall
+103 common syslog sys_syslog
+104 common setitimer sys_setitimer
+105 common getitimer sys_getitimer
+106 common stat sys_newstat
+107 common lstat sys_newlstat
+108 common fstat sys_newfstat
+# 109 was sys_uname
+# 110 was sys_iopl
+111 common vhangup sys_vhangup
+# 112 was sys_idle
+# syscall to call a syscall!
+113 oabi syscall sys_syscall
+114 common wait4 sys_wait4
+115 common swapoff sys_swapoff
+116 common sysinfo sys_sysinfo
+117 oabi ipc sys_ipc sys_oabi_ipc
+118 common fsync sys_fsync
+119 common sigreturn sys_sigreturn_wrapper
+120 common clone sys_clone
+121 common setdomainname sys_setdomainname
+122 common uname sys_newuname
+# 123 was sys_modify_ldt
+124 common adjtimex sys_adjtimex
+125 common mprotect sys_mprotect
+126 common sigprocmask sys_sigprocmask
+# 127 was sys_create_module
+128 common init_module sys_init_module
+129 common delete_module sys_delete_module
+# 130 was sys_get_kernel_syms
+131 common quotactl sys_quotactl
+132 common getpgid sys_getpgid
+133 common fchdir sys_fchdir
+134 common bdflush sys_bdflush
+135 common sysfs sys_sysfs
+136 common personality sys_personality
+# 137 was sys_afs_syscall
+138 common setfsuid sys_setfsuid16
+139 common setfsgid sys_setfsgid16
+140 common _llseek sys_llseek
+141 common getdents sys_getdents
+142 common _newselect sys_select
+143 common flock sys_flock
+144 common msync sys_msync
+145 common readv sys_readv
+146 common writev sys_writev
+147 common getsid sys_getsid
+148 common fdatasync sys_fdatasync
+149 common _sysctl sys_sysctl
+150 common mlock sys_mlock
+151 common munlock sys_munlock
+152 common mlockall sys_mlockall
+153 common munlockall sys_munlockall
+154 common sched_setparam sys_sched_setparam
+155 common sched_getparam sys_sched_getparam
+156 common sched_setscheduler sys_sched_setscheduler
+157 common sched_getscheduler sys_sched_getscheduler
+158 common sched_yield sys_sched_yield
+159 common sched_get_priority_max sys_sched_get_priority_max
+160 common sched_get_priority_min sys_sched_get_priority_min
+161 common sched_rr_get_interval sys_sched_rr_get_interval
+162 common nanosleep sys_nanosleep
+163 common mremap sys_mremap
+164 common setresuid sys_setresuid16
+165 common getresuid sys_getresuid16
+# 166 was sys_vm86
+# 167 was sys_query_module
+168 common poll sys_poll
+169 common nfsservctl
+170 common setresgid sys_setresgid16
+171 common getresgid sys_getresgid16
+172 common prctl sys_prctl
+173 common rt_sigreturn sys_rt_sigreturn_wrapper
+174 common rt_sigaction sys_rt_sigaction
+175 common rt_sigprocmask sys_rt_sigprocmask
+176 common rt_sigpending sys_rt_sigpending
+177 common rt_sigtimedwait sys_rt_sigtimedwait
+178 common rt_sigqueueinfo sys_rt_sigqueueinfo
+179 common rt_sigsuspend sys_rt_sigsuspend
+180 common pread64 sys_pread64 sys_oabi_pread64
+181 common pwrite64 sys_pwrite64 sys_oabi_pwrite64
+182 common chown sys_chown16
+183 common getcwd sys_getcwd
+184 common capget sys_capget
+185 common capset sys_capset
+186 common sigaltstack sys_sigaltstack
+187 common sendfile sys_sendfile
+# 188 reserved
+# 189 reserved
+190 common vfork sys_vfork
+# SuS compliant getrlimit
+191 common ugetrlimit sys_getrlimit
+192 common mmap2 sys_mmap2
+193 common truncate64 sys_truncate64 sys_oabi_truncate64
+194 common ftruncate64 sys_ftruncate64 sys_oabi_ftruncate64
+195 common stat64 sys_stat64 sys_oabi_stat64
+196 common lstat64 sys_lstat64 sys_oabi_lstat64
+197 common fstat64 sys_fstat64 sys_oabi_fstat64
+198 common lchown32 sys_lchown
+199 common getuid32 sys_getuid
+200 common getgid32 sys_getgid
+201 common geteuid32 sys_geteuid
+202 common getegid32 sys_getegid
+203 common setreuid32 sys_setreuid
+204 common setregid32 sys_setregid
+205 common getgroups32 sys_getgroups
+206 common setgroups32 sys_setgroups
+207 common fchown32 sys_fchown
+208 common setresuid32 sys_setresuid
+209 common getresuid32 sys_getresuid
+210 common setresgid32 sys_setresgid
+211 common getresgid32 sys_getresgid
+212 common chown32 sys_chown
+213 common setuid32 sys_setuid
+214 common setgid32 sys_setgid
+215 common setfsuid32 sys_setfsuid
+216 common setfsgid32 sys_setfsgid
+217 common getdents64 sys_getdents64
+218 common pivot_root sys_pivot_root
+219 common mincore sys_mincore
+220 common madvise sys_madvise
+221 common fcntl64 sys_fcntl64 sys_oabi_fcntl64
+# 222 for tux
+# 223 is unused
+224 common gettid sys_gettid
+225 common readahead sys_readahead sys_oabi_readahead
+226 common setxattr sys_setxattr
+227 common lsetxattr sys_lsetxattr
+228 common fsetxattr sys_fsetxattr
+229 common getxattr sys_getxattr
+230 common lgetxattr sys_lgetxattr
+231 common fgetxattr sys_fgetxattr
+232 common listxattr sys_listxattr
+233 common llistxattr sys_llistxattr
+234 common flistxattr sys_flistxattr
+235 common removexattr sys_removexattr
+236 common lremovexattr sys_lremovexattr
+237 common fremovexattr sys_fremovexattr
+238 common tkill sys_tkill
+239 common sendfile64 sys_sendfile64
+240 common futex sys_futex
+241 common sched_setaffinity sys_sched_setaffinity
+242 common sched_getaffinity sys_sched_getaffinity
+243 common io_setup sys_io_setup
+244 common io_destroy sys_io_destroy
+245 common io_getevents sys_io_getevents
+246 common io_submit sys_io_submit
+247 common io_cancel sys_io_cancel
+248 common exit_group sys_exit_group
+249 common lookup_dcookie sys_lookup_dcookie
+250 common epoll_create sys_epoll_create
+251 common epoll_ctl sys_epoll_ctl sys_oabi_epoll_ctl
+252 common epoll_wait sys_epoll_wait sys_oabi_epoll_wait
+253 common remap_file_pages sys_remap_file_pages
+# 254 for set_thread_area
+# 255 for get_thread_area
+256 common set_tid_address sys_set_tid_address
+257 common timer_create sys_timer_create
+258 common timer_settime sys_timer_settime
+259 common timer_gettime sys_timer_gettime
+260 common timer_getoverrun sys_timer_getoverrun
+261 common timer_delete sys_timer_delete
+262 common clock_settime sys_clock_settime
+263 common clock_gettime sys_clock_gettime
+264 common clock_getres sys_clock_getres
+265 common clock_nanosleep sys_clock_nanosleep
+266 common statfs64 sys_statfs64_wrapper
+267 common fstatfs64 sys_fstatfs64_wrapper
+268 common tgkill sys_tgkill
+269 common utimes sys_utimes
+270 common arm_fadvise64_64 sys_arm_fadvise64_64
+271 common pciconfig_iobase sys_pciconfig_iobase
+272 common pciconfig_read sys_pciconfig_read
+273 common pciconfig_write sys_pciconfig_write
+274 common mq_open sys_mq_open
+275 common mq_unlink sys_mq_unlink
+276 common mq_timedsend sys_mq_timedsend
+277 common mq_timedreceive sys_mq_timedreceive
+278 common mq_notify sys_mq_notify
+279 common mq_getsetattr sys_mq_getsetattr
+280 common waitid sys_waitid
+281 common socket sys_socket
+282 common bind sys_bind sys_oabi_bind
+283 common connect sys_connect sys_oabi_connect
+284 common listen sys_listen
+285 common accept sys_accept
+286 common getsockname sys_getsockname
+287 common getpeername sys_getpeername
+288 common socketpair sys_socketpair
+289 common send sys_send
+290 common sendto sys_sendto sys_oabi_sendto
+291 common recv sys_recv
+292 common recvfrom sys_recvfrom
+293 common shutdown sys_shutdown
+294 common setsockopt sys_setsockopt
+295 common getsockopt sys_getsockopt
+296 common sendmsg sys_sendmsg sys_oabi_sendmsg
+297 common recvmsg sys_recvmsg
+298 common semop sys_semop sys_oabi_semop
+299 common semget sys_semget
+300 common semctl sys_semctl
+301 common msgsnd sys_msgsnd
+302 common msgrcv sys_msgrcv
+303 common msgget sys_msgget
+304 common msgctl sys_msgctl
+305 common shmat sys_shmat
+306 common shmdt sys_shmdt
+307 common shmget sys_shmget
+308 common shmctl sys_shmctl
+309 common add_key sys_add_key
+310 common request_key sys_request_key
+311 common keyctl sys_keyctl
+312 common semtimedop sys_semtimedop sys_oabi_semtimedop
+313 common vserver
+314 common ioprio_set sys_ioprio_set
+315 common ioprio_get sys_ioprio_get
+316 common inotify_init sys_inotify_init
+317 common inotify_add_watch sys_inotify_add_watch
+318 common inotify_rm_watch sys_inotify_rm_watch
+319 common mbind sys_mbind
+320 common get_mempolicy sys_get_mempolicy
+321 common set_mempolicy sys_set_mempolicy
+322 common openat sys_openat
+323 common mkdirat sys_mkdirat
+324 common mknodat sys_mknodat
+325 common fchownat sys_fchownat
+326 common futimesat sys_futimesat
+327 common fstatat64 sys_fstatat64 sys_oabi_fstatat64
+328 common unlinkat sys_unlinkat
+329 common renameat sys_renameat
+330 common linkat sys_linkat
+331 common symlinkat sys_symlinkat
+332 common readlinkat sys_readlinkat
+333 common fchmodat sys_fchmodat
+334 common faccessat sys_faccessat
+335 common pselect6 sys_pselect6
+336 common ppoll sys_ppoll
+337 common unshare sys_unshare
+338 common set_robust_list sys_set_robust_list
+339 common get_robust_list sys_get_robust_list
+340 common splice sys_splice
+341 common arm_sync_file_range sys_sync_file_range2
+342 common tee sys_tee
+343 common vmsplice sys_vmsplice
+344 common move_pages sys_move_pages
+345 common getcpu sys_getcpu
+346 common epoll_pwait sys_epoll_pwait
+347 common kexec_load sys_kexec_load
+348 common utimensat sys_utimensat
+349 common signalfd sys_signalfd
+350 common timerfd_create sys_timerfd_create
+351 common eventfd sys_eventfd
+352 common fallocate sys_fallocate
+353 common timerfd_settime sys_timerfd_settime
+354 common timerfd_gettime sys_timerfd_gettime
+355 common signalfd4 sys_signalfd4
+356 common eventfd2 sys_eventfd2
+357 common epoll_create1 sys_epoll_create1
+358 common dup3 sys_dup3
+359 common pipe2 sys_pipe2
+360 common inotify_init1 sys_inotify_init1
+361 common preadv sys_preadv
+362 common pwritev sys_pwritev
+363 common rt_tgsigqueueinfo sys_rt_tgsigqueueinfo
+364 common perf_event_open sys_perf_event_open
+365 common recvmmsg sys_recvmmsg
+366 common accept4 sys_accept4
+367 common fanotify_init sys_fanotify_init
+368 common fanotify_mark sys_fanotify_mark
+369 common prlimit64 sys_prlimit64
+370 common name_to_handle_at sys_name_to_handle_at
+371 common open_by_handle_at sys_open_by_handle_at
+372 common clock_adjtime sys_clock_adjtime
+373 common syncfs sys_syncfs
+374 common sendmmsg sys_sendmmsg
+375 common setns sys_setns
+376 common process_vm_readv sys_process_vm_readv
+377 common process_vm_writev sys_process_vm_writev
+378 common kcmp sys_kcmp
+379 common finit_module sys_finit_module
+380 common sched_setattr sys_sched_setattr
+381 common sched_getattr sys_sched_getattr
+382 common renameat2 sys_renameat2
+383 common seccomp sys_seccomp
+384 common getrandom sys_getrandom
+385 common memfd_create sys_memfd_create
+386 common bpf sys_bpf
+387 common execveat sys_execveat
+388 common userfaultfd sys_userfaultfd
+389 common membarrier sys_membarrier
+390 common mlock2 sys_mlock2
diff --git a/arch/arm/tools/syscallhdr.sh b/arch/arm/tools/syscallhdr.sh
new file mode 100644
index 000000000000..72d4b2e3bdec
--- /dev/null
+++ b/arch/arm/tools/syscallhdr.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+in="$1"
+out="$2"
+my_abis=`echo "($3)" | tr ',' '|'`
+prefix="$4"
+offset="$5"
+
+fileguard=_ASM_ARM_`basename "$out" | sed \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
+ -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`
+if echo $out | grep -q uapi; then
+ fileguard="_UAPI$fileguard"
+fi
+grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
+ echo "#ifndef ${fileguard}"
+ echo "#define ${fileguard} 1"
+ echo ""
+
+ while read nr abi name entry ; do
+ if [ -z "$offset" ]; then
+ echo "#define __NR_${prefix}${name} $nr"
+ else
+ echo "#define __NR_${prefix}${name} ($offset + $nr)"
+ fi
+ done
+
+ echo ""
+ echo "#endif /* ${fileguard} */"
+) > "$out"
diff --git a/arch/arm/tools/syscallnr.sh b/arch/arm/tools/syscallnr.sh
new file mode 100644
index 000000000000..d2971296469a
--- /dev/null
+++ b/arch/arm/tools/syscallnr.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+in="$1"
+out="$2"
+my_abis=`echo "($3)" | tr ',' '|'`
+align=1
+
+fileguard=_ASM_ARM_`basename "$out" | sed \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
+ -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`
+
+grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | tail -n1 | (
+ echo "#ifndef ${fileguard}
+#define ${fileguard} 1
+
+/*
+ * This needs to be greater than __NR_last_syscall+1 in order to account
+ * for the padding in the syscall table.
+ */
+"
+
+ while read nr abi name entry; do
+ nr=$(($nr + 1))
+ while [ "$(($nr / (256 * $align) ))" -gt 0 ]; do
+ align=$(( $align * 4 ))
+ done
+ nr=$(( ($nr + $align - 1) & ~($align - 1) ))
+ echo "/* aligned to $align */"
+ echo "#define __NR_syscalls $nr"
+ done
+
+ echo ""
+ echo "#endif /* ${fileguard} */"
+) > "$out"
diff --git a/arch/arm/tools/syscalltbl.sh b/arch/arm/tools/syscalltbl.sh
new file mode 100644
index 000000000000..5ca834545ed3
--- /dev/null
+++ b/arch/arm/tools/syscalltbl.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+in="$1"
+out="$2"
+my_abis=`echo "($3)" | tr ',' '|'`
+
+grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
+ while read nr abi name entry compat; do
+ if [ "$abi" = "eabi" -a -n "$compat" ]; then
+ echo "$in: error: a compat entry for an EABI syscall ($name) makes no sense" >&2
+ exit 1
+ fi
+
+ if [ -n "$entry" ]; then
+ if [ -z "$compat" ]; then
+ echo "NATIVE($nr, $entry)"
+ else
+ echo "COMPAT($nr, $entry, $compat)"
+ fi
+ fi
+ done
+) > "$out"
diff --git a/drivers/crypto/msm/qcedev.c b/drivers/crypto/msm/qcedev.c
index 425fd6b4b9f5..f4cd405717d1 100644
--- a/drivers/crypto/msm/qcedev.c
+++ b/drivers/crypto/msm/qcedev.c
@@ -1,6 +1,6 @@
/* Qualcomm CE device driver.
*
- * Copyright (c) 2010-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2010-2018, 2020, 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
@@ -1605,107 +1605,131 @@ long qcedev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
int err = 0;
struct qcedev_handle *handle;
struct qcedev_control *podev;
- struct qcedev_async_req qcedev_areq;
+ struct qcedev_async_req *qcedev_areq;
struct qcedev_stat *pstat;
+ qcedev_areq = kzalloc(sizeof(struct qcedev_async_req), GFP_KERNEL);
+ if (!qcedev_areq)
+ return -ENOMEM;
+
handle = file->private_data;
podev = handle->cntl;
- qcedev_areq.handle = handle;
+ qcedev_areq->handle = handle;
if (podev == NULL || podev->magic != QCEDEV_MAGIC) {
pr_err("%s: invalid handle %pK\n",
__func__, podev);
- return -ENOENT;
+ err = -ENOENT;
+ goto exit_free_qcedev_areq;
}
/* Verify user arguments. */
- if (_IOC_TYPE(cmd) != QCEDEV_IOC_MAGIC)
- return -ENOTTY;
+ if (_IOC_TYPE(cmd) != QCEDEV_IOC_MAGIC) {
+ err = -ENOTTY;
+ goto exit_free_qcedev_areq;
+ }
- init_completion(&qcedev_areq.complete);
+ init_completion(&qcedev_areq->complete);
pstat = &_qcedev_stat;
switch (cmd) {
case QCEDEV_IOCTL_ENC_REQ:
case QCEDEV_IOCTL_DEC_REQ:
- if (copy_from_user(&qcedev_areq.cipher_op_req,
+ if (copy_from_user(&qcedev_areq->cipher_op_req,
(void __user *)arg,
- sizeof(struct qcedev_cipher_op_req)))
- return -EFAULT;
- qcedev_areq.op_type = QCEDEV_CRYPTO_OPER_CIPHER;
+ sizeof(struct qcedev_cipher_op_req))) {
+ err = -EFAULT;
+ goto exit_free_qcedev_areq;
+ }
+ qcedev_areq->op_type = QCEDEV_CRYPTO_OPER_CIPHER;
- if (qcedev_check_cipher_params(&qcedev_areq.cipher_op_req,
- podev))
- return -EINVAL;
+ if (qcedev_check_cipher_params(&qcedev_areq->cipher_op_req,
+ podev)) {
+ err = -EINVAL;
+ goto exit_free_qcedev_areq;
+ }
- err = qcedev_vbuf_ablk_cipher(&qcedev_areq, handle);
+ err = qcedev_vbuf_ablk_cipher(qcedev_areq, handle);
if (err)
- return err;
+ goto exit_free_qcedev_areq;
if (copy_to_user((void __user *)arg,
- &qcedev_areq.cipher_op_req,
- sizeof(struct qcedev_cipher_op_req)))
- return -EFAULT;
+ &qcedev_areq->cipher_op_req,
+ sizeof(struct qcedev_cipher_op_req))) {
+ err = -EFAULT;
+ goto exit_free_qcedev_areq;
+ }
break;
case QCEDEV_IOCTL_SHA_INIT_REQ:
{
struct scatterlist sg_src;
- if (copy_from_user(&qcedev_areq.sha_op_req,
+ if (copy_from_user(&qcedev_areq->sha_op_req,
(void __user *)arg,
- sizeof(struct qcedev_sha_op_req)))
- return -EFAULT;
+ sizeof(struct qcedev_sha_op_req))) {
+ err = -EFAULT;
+ goto exit_free_qcedev_areq;
+ }
mutex_lock(&hash_access_lock);
- if (qcedev_check_sha_params(&qcedev_areq.sha_op_req, podev)) {
+ if (qcedev_check_sha_params(&qcedev_areq->sha_op_req, podev)) {
mutex_unlock(&hash_access_lock);
- return -EINVAL;
+ err = -EINVAL;
+ goto exit_free_qcedev_areq;
}
- qcedev_areq.op_type = QCEDEV_CRYPTO_OPER_SHA;
- err = qcedev_hash_init(&qcedev_areq, handle, &sg_src);
+ qcedev_areq->op_type = QCEDEV_CRYPTO_OPER_SHA;
+ err = qcedev_hash_init(qcedev_areq, handle, &sg_src);
if (err) {
mutex_unlock(&hash_access_lock);
- return err;
+ goto exit_free_qcedev_areq;
}
mutex_unlock(&hash_access_lock);
- if (copy_to_user((void __user *)arg, &qcedev_areq.sha_op_req,
- sizeof(struct qcedev_sha_op_req)))
- return -EFAULT;
+ if (copy_to_user((void __user *)arg, &qcedev_areq->sha_op_req,
+ sizeof(struct qcedev_sha_op_req))) {
+ err = -EFAULT;
+ goto exit_free_qcedev_areq;
}
handle->sha_ctxt.init_done = true;
+ }
break;
case QCEDEV_IOCTL_GET_CMAC_REQ:
- if (!podev->ce_support.cmac)
- return -ENOTTY;
+ if (!podev->ce_support.cmac) {
+ err = -ENOTTY;
+ goto exit_free_qcedev_areq;
+ }
case QCEDEV_IOCTL_SHA_UPDATE_REQ:
{
struct scatterlist sg_src;
- if (copy_from_user(&qcedev_areq.sha_op_req,
+ if (copy_from_user(&qcedev_areq->sha_op_req,
(void __user *)arg,
- sizeof(struct qcedev_sha_op_req)))
- return -EFAULT;
+ sizeof(struct qcedev_sha_op_req))) {
+ err = -EFAULT;
+ goto exit_free_qcedev_areq;
+ }
mutex_lock(&hash_access_lock);
- if (qcedev_check_sha_params(&qcedev_areq.sha_op_req, podev)) {
+ if (qcedev_check_sha_params(&qcedev_areq->sha_op_req, podev)) {
mutex_unlock(&hash_access_lock);
- return -EINVAL;
+ err = -EINVAL;
+ goto exit_free_qcedev_areq;
}
- qcedev_areq.op_type = QCEDEV_CRYPTO_OPER_SHA;
+ qcedev_areq->op_type = QCEDEV_CRYPTO_OPER_SHA;
- if (qcedev_areq.sha_op_req.alg == QCEDEV_ALG_AES_CMAC) {
- err = qcedev_hash_cmac(&qcedev_areq, handle, &sg_src);
+ if (qcedev_areq->sha_op_req.alg == QCEDEV_ALG_AES_CMAC) {
+ err = qcedev_hash_cmac(qcedev_areq, handle, &sg_src);
if (err) {
mutex_unlock(&hash_access_lock);
- return err;
+ goto exit_free_qcedev_areq;
}
} else {
if (handle->sha_ctxt.init_done == false) {
pr_err("%s Init was not called\n", __func__);
mutex_unlock(&hash_access_lock);
- return -EINVAL;
+ err = -EINVAL;
+ goto exit_free_qcedev_areq;
}
- err = qcedev_hash_update(&qcedev_areq, handle, &sg_src);
+ err = qcedev_hash_update(qcedev_areq, handle, &sg_src);
if (err) {
mutex_unlock(&hash_access_lock);
- return err;
+ goto exit_free_qcedev_areq;
}
}
@@ -1713,15 +1737,17 @@ long qcedev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
pr_err("Invalid sha_ctxt.diglen %d\n",
handle->sha_ctxt.diglen);
mutex_unlock(&hash_access_lock);
- return -EINVAL;
+ err = -EINVAL;
+ goto exit_free_qcedev_areq;
}
- memcpy(&qcedev_areq.sha_op_req.digest[0],
+ memcpy(&qcedev_areq->sha_op_req.digest[0],
&handle->sha_ctxt.digest[0],
handle->sha_ctxt.diglen);
mutex_unlock(&hash_access_lock);
- if (copy_to_user((void __user *)arg, &qcedev_areq.sha_op_req,
+ if (copy_to_user((void __user *)arg, &qcedev_areq->sha_op_req,
sizeof(struct qcedev_sha_op_req)))
- return -EFAULT;
+ err = -EFAULT;
+ goto exit_free_qcedev_areq;
}
break;
@@ -1729,37 +1755,44 @@ long qcedev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
if (handle->sha_ctxt.init_done == false) {
pr_err("%s Init was not called\n", __func__);
- return -EINVAL;
+ err = -EINVAL;
+ goto exit_free_qcedev_areq;
}
- if (copy_from_user(&qcedev_areq.sha_op_req,
+ if (copy_from_user(&qcedev_areq->sha_op_req,
(void __user *)arg,
- sizeof(struct qcedev_sha_op_req)))
- return -EFAULT;
+ sizeof(struct qcedev_sha_op_req))) {
+ err = -EFAULT;
+ goto exit_free_qcedev_areq;
+ }
mutex_lock(&hash_access_lock);
- if (qcedev_check_sha_params(&qcedev_areq.sha_op_req, podev)) {
+ if (qcedev_check_sha_params(&qcedev_areq->sha_op_req, podev)) {
mutex_unlock(&hash_access_lock);
- return -EINVAL;
+ err = -EINVAL;
+ goto exit_free_qcedev_areq;
}
- qcedev_areq.op_type = QCEDEV_CRYPTO_OPER_SHA;
- err = qcedev_hash_final(&qcedev_areq, handle);
+ qcedev_areq->op_type = QCEDEV_CRYPTO_OPER_SHA;
+ err = qcedev_hash_final(qcedev_areq, handle);
if (err) {
mutex_unlock(&hash_access_lock);
- return err;
+ goto exit_free_qcedev_areq;
}
if (handle->sha_ctxt.diglen > QCEDEV_MAX_SHA_DIGEST) {
pr_err("Invalid sha_ctxt.diglen %d\n",
handle->sha_ctxt.diglen);
mutex_unlock(&hash_access_lock);
- return -EINVAL;
+ err = -EINVAL;
+ goto exit_free_qcedev_areq;
}
- qcedev_areq.sha_op_req.diglen = handle->sha_ctxt.diglen;
- memcpy(&qcedev_areq.sha_op_req.digest[0],
+ qcedev_areq->sha_op_req.diglen = handle->sha_ctxt.diglen;
+ memcpy(&qcedev_areq->sha_op_req.digest[0],
&handle->sha_ctxt.digest[0],
handle->sha_ctxt.diglen);
mutex_unlock(&hash_access_lock);
- if (copy_to_user((void __user *)arg, &qcedev_areq.sha_op_req,
- sizeof(struct qcedev_sha_op_req)))
- return -EFAULT;
+ if (copy_to_user((void __user *)arg, &qcedev_areq->sha_op_req,
+ sizeof(struct qcedev_sha_op_req))) {
+ err = -EFAULT;
+ goto exit_free_qcedev_areq;
+ }
handle->sha_ctxt.init_done = false;
break;
@@ -1767,48 +1800,56 @@ long qcedev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
{
struct scatterlist sg_src;
- if (copy_from_user(&qcedev_areq.sha_op_req,
+ if (copy_from_user(&qcedev_areq->sha_op_req,
(void __user *)arg,
- sizeof(struct qcedev_sha_op_req)))
- return -EFAULT;
+ sizeof(struct qcedev_sha_op_req))) {
+ err = -EFAULT;
+ goto exit_free_qcedev_areq;
+ }
mutex_lock(&hash_access_lock);
- if (qcedev_check_sha_params(&qcedev_areq.sha_op_req, podev)) {
+ if (qcedev_check_sha_params(&qcedev_areq->sha_op_req, podev)) {
mutex_unlock(&hash_access_lock);
- return -EINVAL;
+ err = -EINVAL;
+ goto exit_free_qcedev_areq;
}
- qcedev_areq.op_type = QCEDEV_CRYPTO_OPER_SHA;
- qcedev_hash_init(&qcedev_areq, handle, &sg_src);
- err = qcedev_hash_update(&qcedev_areq, handle, &sg_src);
+ qcedev_areq->op_type = QCEDEV_CRYPTO_OPER_SHA;
+ qcedev_hash_init(qcedev_areq, handle, &sg_src);
+ err = qcedev_hash_update(qcedev_areq, handle, &sg_src);
if (err) {
mutex_unlock(&hash_access_lock);
- return err;
+ goto exit_free_qcedev_areq;
}
- err = qcedev_hash_final(&qcedev_areq, handle);
+ err = qcedev_hash_final(qcedev_areq, handle);
if (err) {
mutex_unlock(&hash_access_lock);
- return err;
+ goto exit_free_qcedev_areq;
}
if (handle->sha_ctxt.diglen > QCEDEV_MAX_SHA_DIGEST) {
pr_err("Invalid sha_ctxt.diglen %d\n",
handle->sha_ctxt.diglen);
mutex_unlock(&hash_access_lock);
- return -EINVAL;
+ err = -EINVAL;
+ goto exit_free_qcedev_areq;
}
- qcedev_areq.sha_op_req.diglen = handle->sha_ctxt.diglen;
- memcpy(&qcedev_areq.sha_op_req.digest[0],
+ qcedev_areq->sha_op_req.diglen = handle->sha_ctxt.diglen;
+ memcpy(&qcedev_areq->sha_op_req.digest[0],
&handle->sha_ctxt.digest[0],
handle->sha_ctxt.diglen);
mutex_unlock(&hash_access_lock);
- if (copy_to_user((void __user *)arg, &qcedev_areq.sha_op_req,
- sizeof(struct qcedev_sha_op_req)))
- return -EFAULT;
+ if (copy_to_user((void __user *)arg, &qcedev_areq->sha_op_req,
+ sizeof(struct qcedev_sha_op_req))) {
+ err = -EFAULT;
+ goto exit_free_qcedev_areq;
+ }
}
break;
-
default:
- return -ENOTTY;
+ err = -ENOTTY;
+ goto exit_free_qcedev_areq;
}
+exit_free_qcedev_areq:
+ kfree(qcedev_areq);
return err;
}
EXPORT_SYMBOL(qcedev_ioctl);
diff --git a/drivers/hwmon/qpnp-adc-common.c b/drivers/hwmon/qpnp-adc-common.c
index 812b96b381e3..6f4c094309f6 100644
--- a/drivers/hwmon/qpnp-adc-common.c
+++ b/drivers/hwmon/qpnp-adc-common.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2018, 2020, 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
@@ -1247,7 +1247,7 @@ int32_t qpnp_adc_scale_default(struct qpnp_vadc_chip *vadc,
} else {
qpnp_adc_scale_with_calib_param(adc_code, adc_properties,
chan_properties, &scale_voltage);
- if (!chan_properties->calib_type == CALIB_ABSOLUTE)
+ if (!(chan_properties->calib_type == CALIB_ABSOLUTE))
scale_voltage *= 1000;
}
diff --git a/drivers/hwmon/qpnp-adc-voltage.c b/drivers/hwmon/qpnp-adc-voltage.c
index 6ed947e5603b..81ad68548c6b 100644
--- a/drivers/hwmon/qpnp-adc-voltage.c
+++ b/drivers/hwmon/qpnp-adc-voltage.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2016, 2020, 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
@@ -1488,7 +1488,7 @@ int32_t qpnp_vadc_calib_vref(struct qpnp_vadc_chip *vadc,
conv.mode_sel = ADC_OP_NORMAL_MODE << QPNP_VADC_OP_MODE_SHIFT;
conv.hw_settle_time = ADC_CHANNEL_HW_SETTLE_DELAY_0US;
conv.fast_avg_setup = ADC_FAST_AVG_SAMPLE_1;
- conv.cal_val = calib_type;
+ conv.cal_val = (enum qpnp_adc_cal_val)calib_type;
if (vadc->vadc_hc) {
rc = qpnp_vadc_hc_configure(vadc, &conv);
@@ -1561,7 +1561,7 @@ int32_t qpnp_vadc_calib_gnd(struct qpnp_vadc_chip *vadc,
conv.mode_sel = ADC_OP_NORMAL_MODE << QPNP_VADC_OP_MODE_SHIFT;
conv.hw_settle_time = ADC_CHANNEL_HW_SETTLE_DELAY_0US;
conv.fast_avg_setup = ADC_FAST_AVG_SAMPLE_1;
- conv.cal_val = calib_type;
+ conv.cal_val = (enum qpnp_adc_cal_val)calib_type;
if (vadc->vadc_hc) {
rc = qpnp_vadc_hc_configure(vadc, &conv);
@@ -1679,10 +1679,10 @@ static int32_t qpnp_vadc_calib_device(struct qpnp_vadc_chip *vadc)
(calib_read_1 - calib_read_2);
vadc->adc->amux_prop->chan_prop->adc_graph[CALIB_RATIOMETRIC].dx =
vadc->adc->adc_prop->adc_vdd_reference;
- vadc->adc->amux_prop->chan_prop->adc_graph[CALIB_RATIOMETRIC].adc_vref
- = calib_read_1;
- vadc->adc->amux_prop->chan_prop->adc_graph[CALIB_RATIOMETRIC].adc_gnd
- = calib_read_2;
+ vadc->adc->amux_prop->chan_prop->adc_graph[CALIB_RATIOMETRIC].adc_vref =
+ calib_read_1;
+ vadc->adc->amux_prop->chan_prop->adc_graph[CALIB_RATIOMETRIC].adc_gnd =
+ calib_read_2;
calib_fail:
return rc;
diff --git a/drivers/media/platform/msm/camera_v2/common/cam_soc_api.c b/drivers/media/platform/msm/camera_v2/common/cam_soc_api.c
index a0c606ce9a29..2dca190413d1 100644
--- a/drivers/media/platform/msm/camera_v2/common/cam_soc_api.c
+++ b/drivers/media/platform/msm/camera_v2/common/cam_soc_api.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2017, 2020, 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
@@ -205,7 +205,7 @@ int msm_camera_get_clk_info(struct platform_device *pdev,
{
int rc = 0;
- if (!pdev || !&pdev->dev || !clk_info || !clk_ptr || !num_clk)
+ if (!pdev || (&pdev->dev == NULL) || !clk_info || !clk_ptr || !num_clk)
return -EINVAL;
rc = msm_camera_get_clk_info_internal(&pdev->dev,
@@ -507,7 +507,7 @@ int msm_camera_put_clk_info(struct platform_device *pdev,
{
int rc = 0;
- if (!pdev || !&pdev->dev || !clk_info || !clk_ptr)
+ if (!pdev || (&pdev->dev == NULL) || !clk_info || !clk_ptr)
return -EINVAL;
rc = msm_camera_put_clk_info_internal(&pdev->dev,
diff --git a/drivers/media/platform/msm/camera_v2/msm.c b/drivers/media/platform/msm/camera_v2/msm.c
index 7689aa3dba77..e16d08681695 100644
--- a/drivers/media/platform/msm/camera_v2/msm.c
+++ b/drivers/media/platform/msm/camera_v2/msm.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2018, 2020, 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
@@ -622,7 +622,7 @@ static inline int __msm_remove_session_cmd_ack_q(void *d1, void *d2)
{
struct msm_command_ack *cmd_ack = d1;
- if (!(&cmd_ack->command_q))
+ if (&cmd_ack->command_q == NULL)
return 0;
msm_queue_drain(&cmd_ack->command_q, struct msm_command, list);
@@ -632,7 +632,7 @@ static inline int __msm_remove_session_cmd_ack_q(void *d1, void *d2)
static void msm_remove_session_cmd_ack_q(struct msm_session *session)
{
- if ((!session) || !(&session->command_ack_q))
+ if ((!session) || (&session->command_ack_q == NULL))
return;
mutex_lock(&session->lock);
diff --git a/drivers/media/platform/msm/camera_v2/sensor/flash/msm_flash.c b/drivers/media/platform/msm/camera_v2/sensor/flash/msm_flash.c
index c77367ed1603..4ca4ac1860c8 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/flash/msm_flash.c
+++ b/drivers/media/platform/msm/camera_v2/sensor/flash/msm_flash.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2009-2017, 2020, 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
@@ -363,7 +363,8 @@ static int32_t msm_flash_i2c_release(
{
int32_t rc = 0;
- if (!(&flash_ctrl->power_info) || !(&flash_ctrl->flash_i2c_client)) {
+ if ((&flash_ctrl->power_info == NULL) ||
+ (&flash_ctrl->flash_i2c_client == NULL)) {
pr_err("%s:%d failed: %pK %pK\n",
__func__, __LINE__, &flash_ctrl->power_info,
&flash_ctrl->flash_i2c_client);
diff --git a/drivers/media/platform/msm/camera_v2/sensor/io/msm_camera_dt_util.c b/drivers/media/platform/msm/camera_v2/sensor/io/msm_camera_dt_util.c
index 457bd1730232..4a4f0995785f 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/io/msm_camera_dt_util.c
+++ b/drivers/media/platform/msm/camera_v2/sensor/io/msm_camera_dt_util.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2017, 2020, 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
@@ -1353,7 +1353,7 @@ int msm_cam_sensor_handle_reg_gpio(int seq_val,
CDBG("%s: %d GPIO offset: %d, seq_val: %d\n", __func__, __LINE__,
gpio_offset, seq_val);
- if ((gconf->gpio_num_info->valid[gpio_offset] == 1)) {
+ if (gconf->gpio_num_info->valid[gpio_offset] == 1) {
gpio_set_value_cansleep(
gconf->gpio_num_info->gpio_num
[gpio_offset], val);
diff --git a/drivers/media/platform/msm/camera_v2/sensor/ir_cut/msm_ir_cut.c b/drivers/media/platform/msm/camera_v2/sensor/ir_cut/msm_ir_cut.c
index a0e35ba99a25..2516914e4b53 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/ir_cut/msm_ir_cut.c
+++ b/drivers/media/platform/msm/camera_v2/sensor/ir_cut/msm_ir_cut.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2016, 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
@@ -499,7 +499,6 @@ static long msm_ir_cut_subdev_do_ioctl(
struct msm_ir_cut_cfg_data_t ir_cut_data;
CDBG("Enter");
- ir_cut_data.cfg_type = u32->cfg_type;
switch (cmd) {
case VIDIOC_MSM_IR_CUT_CFG32:
@@ -509,6 +508,7 @@ static long msm_ir_cut_subdev_do_ioctl(
return msm_ir_cut_subdev_ioctl(sd, cmd, arg);
}
+ ir_cut_data.cfg_type = u32->cfg_type;
rc = msm_ir_cut_subdev_ioctl(sd, cmd, &ir_cut_data);
CDBG("Exit");
diff --git a/drivers/media/platform/msm/sde/rotator/sde_rotator_r3.c b/drivers/media/platform/msm/sde/rotator/sde_rotator_r3.c
index 10f72a2155db..d08191cfff32 100644
--- a/drivers/media/platform/msm/sde/rotator/sde_rotator_r3.c
+++ b/drivers/media/platform/msm/sde/rotator/sde_rotator_r3.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2017, 2020, 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,30 +49,56 @@
/* Macro for constructing the REGDMA command */
#define SDE_REGDMA_WRITE(p, off, data) \
do { \
- *p++ = REGDMA_OP_REGWRITE | \
- ((off) & REGDMA_ADDR_OFFSET_MASK); \
- *p++ = (data); \
+ SDEROT_DBG("SDEREG.W:[%s:0x%X] <= 0x%X\n", #off, (off),\
+ (u32)(data));\
+ writel_relaxed_no_log( \
+ (REGDMA_OP_REGWRITE | \
+ ((off) & REGDMA_ADDR_OFFSET_MASK)), \
+ p); \
+ p += sizeof(u32); \
+ writel_relaxed_no_log(data, p); \
+ p += sizeof(u32); \
} while (0)
#define SDE_REGDMA_MODIFY(p, off, mask, data) \
do { \
- *p++ = REGDMA_OP_REGMODIFY | \
- ((off) & REGDMA_ADDR_OFFSET_MASK); \
- *p++ = (mask); \
- *p++ = (data); \
+ SDEROT_DBG("SDEREG.M:[%s:0x%X] <= 0x%X\n", #off, (off),\
+ (u32)(data));\
+ writel_relaxed_no_log( \
+ (REGDMA_OP_REGMODIFY | \
+ ((off) & REGDMA_ADDR_OFFSET_MASK)), \
+ p); \
+ p += sizeof(u32); \
+ writel_relaxed_no_log(mask, p); \
+ p += sizeof(u32); \
+ writel_relaxed_no_log(data, p); \
+ p += sizeof(u32); \
} while (0)
#define SDE_REGDMA_BLKWRITE_INC(p, off, len) \
do { \
- *p++ = REGDMA_OP_BLKWRITE_INC | \
- ((off) & REGDMA_ADDR_OFFSET_MASK); \
- *p++ = (len); \
+ SDEROT_DBG("SDEREG.B:[%s:0x%X:0x%X]\n", #off, (off),\
+ (u32)(len));\
+ writel_relaxed_no_log( \
+ (REGDMA_OP_BLKWRITE_INC | \
+ ((off) & REGDMA_ADDR_OFFSET_MASK)), \
+ p); \
+ p += sizeof(u32); \
+ writel_relaxed_no_log(len, p); \
+ p += sizeof(u32); \
} while (0)
#define SDE_REGDMA_BLKWRITE_DATA(p, data) \
do { \
- *(p) = (data); \
- (p)++; \
+ SDEROT_DBG("SDEREG.I:[:] <= 0x%X\n", (u32)(data));\
+ writel_relaxed_no_log(data, p); \
+ p += sizeof(u32); \
+ } while (0)
+
+#define SDE_REGDMA_READ(p, data) \
+ do { \
+ data = readl_relaxed_no_log(p); \
+ p += sizeof(u32); \
} while (0)
/* Macro for directly accessing mapped registers */
@@ -454,7 +480,7 @@ static void sde_hw_rotator_unmap_vaddr(struct sde_dbg_buf *dbgbuf)
static void sde_hw_rotator_setup_timestamp_packet(
struct sde_hw_rotator_context *ctx, u32 mask, u32 swts)
{
- u32 *wrptr;
+ char __iomem *wrptr;
wrptr = sde_hw_rotator_get_regdma_segment(ctx);
@@ -520,7 +546,7 @@ static void sde_hw_rotator_setup_fetchengine(struct sde_hw_rotator_context *ctx,
struct sde_mdp_format_params *fmt;
struct sde_mdp_data *data;
struct sde_rot_data_type *mdata = sde_rot_get_mdata();
- u32 *wrptr;
+ char __iomem *wrptr;
u32 opmode = 0;
u32 chroma_samp = 0;
u32 src_format = 0;
@@ -697,7 +723,7 @@ static void sde_hw_rotator_setup_wbengine(struct sde_hw_rotator_context *ctx,
u32 flags)
{
struct sde_mdp_format_params *fmt;
- u32 *wrptr;
+ char __iomem *wrptr;
u32 pack = 0;
u32 dst_format = 0;
int i;
@@ -838,13 +864,18 @@ static u32 sde_hw_rotator_start_no_regdma(struct sde_hw_rotator_context *ctx,
enum sde_rot_queue_prio queue_id)
{
struct sde_hw_rotator *rot = ctx->rot;
- u32 *wrptr;
- u32 *rdptr;
- u8 *addr;
+ char __iomem *wrptr;
+ char __iomem *mem_rdptr;
+ char __iomem *addr;
u32 mask;
+ u32 cmd0, cmd1, cmd2;
u32 blksize;
- rdptr = sde_hw_rotator_get_regdma_segment_base(ctx);
+ /*
+ * when regdma is not using, the regdma segment is just a normal
+ * DRAM, and not an iomem.
+ */
+ mem_rdptr = sde_hw_rotator_get_regdma_segment_base(ctx);
wrptr = sde_hw_rotator_get_regdma_segment(ctx);
if (rot->irq_num >= 0) {
@@ -862,54 +893,65 @@ static u32 sde_hw_rotator_start_no_regdma(struct sde_hw_rotator_context *ctx,
SDEROT_DBG("BEGIN %d\n", ctx->timestamp);
/* Write all command stream to Rotator blocks */
/* Rotator will start right away after command stream finish writing */
- while (rdptr < wrptr) {
- u32 op = REGDMA_OP_MASK & *rdptr;
+ while (mem_rdptr < wrptr) {
+ u32 op = REGDMA_OP_MASK & readl_relaxed_no_log(mem_rdptr);
switch (op) {
case REGDMA_OP_NOP:
SDEROT_DBG("NOP\n");
- rdptr++;
+ mem_rdptr += sizeof(u32);
break;
case REGDMA_OP_REGWRITE:
+ SDE_REGDMA_READ(mem_rdptr, cmd0);
+ SDE_REGDMA_READ(mem_rdptr, cmd1);
SDEROT_DBG("REGW %6.6x %8.8x\n",
- rdptr[0] & REGDMA_ADDR_OFFSET_MASK,
- rdptr[1]);
+ cmd0 & REGDMA_ADDR_OFFSET_MASK,
+ cmd1);
addr = rot->mdss_base +
- (*rdptr++ & REGDMA_ADDR_OFFSET_MASK);
- writel_relaxed(*rdptr++, addr);
+ (cmd0 & REGDMA_ADDR_OFFSET_MASK);
+ writel_relaxed(cmd1, addr);
break;
case REGDMA_OP_REGMODIFY:
+ SDE_REGDMA_READ(mem_rdptr, cmd0);
+ SDE_REGDMA_READ(mem_rdptr, cmd1);
+ SDE_REGDMA_READ(mem_rdptr, cmd2);
SDEROT_DBG("REGM %6.6x %8.8x %8.8x\n",
- rdptr[0] & REGDMA_ADDR_OFFSET_MASK,
- rdptr[1], rdptr[2]);
+ cmd0 & REGDMA_ADDR_OFFSET_MASK,
+ cmd1, cmd2);
addr = rot->mdss_base +
- (*rdptr++ & REGDMA_ADDR_OFFSET_MASK);
- mask = *rdptr++;
- writel_relaxed((readl_relaxed(addr) & mask) | *rdptr++,
+ (cmd0 & REGDMA_ADDR_OFFSET_MASK);
+ mask = cmd1;
+ writel_relaxed((readl_relaxed(addr) & mask) | cmd2,
addr);
break;
case REGDMA_OP_BLKWRITE_SINGLE:
+ SDE_REGDMA_READ(mem_rdptr, cmd0);
+ SDE_REGDMA_READ(mem_rdptr, cmd1);
SDEROT_DBG("BLKWS %6.6x %6.6x\n",
- rdptr[0] & REGDMA_ADDR_OFFSET_MASK,
- rdptr[1]);
+ cmd0 & REGDMA_ADDR_OFFSET_MASK,
+ cmd1);
addr = rot->mdss_base +
- (*rdptr++ & REGDMA_ADDR_OFFSET_MASK);
- blksize = *rdptr++;
+ (cmd0 & REGDMA_ADDR_OFFSET_MASK);
+ blksize = cmd1;
while (blksize--) {
- SDEROT_DBG("DATA %8.8x\n", rdptr[0]);
- writel_relaxed(*rdptr++, addr);
+ SDE_REGDMA_READ(mem_rdptr, cmd0);
+ SDEROT_DBG("DATA %8.8x\n", cmd0);
+ writel_relaxed(cmd0, addr);
}
break;
case REGDMA_OP_BLKWRITE_INC:
+ SDE_REGDMA_READ(mem_rdptr, cmd0);
+ SDE_REGDMA_READ(mem_rdptr, cmd1);
SDEROT_DBG("BLKWI %6.6x %6.6x\n",
- rdptr[0] & REGDMA_ADDR_OFFSET_MASK,
- rdptr[1]);
+ cmd0 & REGDMA_ADDR_OFFSET_MASK,
+ cmd1);
addr = rot->mdss_base +
- (*rdptr++ & REGDMA_ADDR_OFFSET_MASK);
- blksize = *rdptr++;
+ (cmd0 & REGDMA_ADDR_OFFSET_MASK);
+ blksize = cmd1;
while (blksize--) {
- SDEROT_DBG("DATA %8.8x\n", rdptr[0]);
- writel_relaxed(*rdptr++, addr);
+ SDE_REGDMA_READ(mem_rdptr, cmd0);
+ SDEROT_DBG("DATA %8.8x\n", cmd0);
+ writel_relaxed(cmd0, addr);
addr += 4;
}
break;
@@ -918,7 +960,7 @@ static u32 sde_hw_rotator_start_no_regdma(struct sde_hw_rotator_context *ctx,
* Skip data for now for unregonized OP mode
*/
SDEROT_DBG("UNDEFINED\n");
- rdptr++;
+ mem_rdptr += sizeof(u32);
break;
}
}
@@ -936,11 +978,11 @@ static u32 sde_hw_rotator_start_regdma(struct sde_hw_rotator_context *ctx,
enum sde_rot_queue_prio queue_id)
{
struct sde_hw_rotator *rot = ctx->rot;
- u32 *wrptr;
+ char __iomem *wrptr;
u32 regdmaSlot;
u32 offset;
- long length;
- long ts_length;
+ u32 length;
+ u32 ts_length;
u32 enableInt;
u32 swts = 0;
u32 mask = 0;
@@ -957,13 +999,13 @@ static u32 sde_hw_rotator_start_regdma(struct sde_hw_rotator_context *ctx,
* Start REGDMA with command offset and size
*/
regdmaSlot = sde_hw_rotator_get_regdma_ctxidx(ctx);
- length = ((long)wrptr - (long)ctx->regdma_base) / 4;
- offset = (u32)(ctx->regdma_base - (u32 *)(rot->mdss_base +
- REGDMA_RAM_REGDMA_CMD_RAM));
+ length = (wrptr - ctx->regdma_base) / 4;
+ offset = (ctx->regdma_base - (rot->mdss_base +
+ REGDMA_RAM_REGDMA_CMD_RAM)) / sizeof(u32);
enableInt = ((ctx->timestamp & 1) + 1) << 30;
SDEROT_DBG(
- "regdma(%d)[%d] <== INT:0x%X|length:%ld|offset:0x%X, ts:%X\n",
+ "regdma(%d)[%d] <== INT:0x%X|length:%d|offset:0x%X, ts:%X\n",
queue_id, regdmaSlot, enableInt, length, offset,
ctx->timestamp);
@@ -989,6 +1031,7 @@ static u32 sde_hw_rotator_start_regdma(struct sde_hw_rotator_context *ctx,
sde_hw_rotator_setup_timestamp_packet(ctx, mask, swts);
offset += length;
ts_length = sde_hw_rotator_get_regdma_segment(ctx) - wrptr;
+ ts_length /= sizeof(u32);
WARN_ON((length + ts_length) > SDE_HW_ROT_REGDMA_SEG_SIZE);
/* ensure command packet is issue before the submit command */
@@ -2564,21 +2607,22 @@ int sde_rotator_r3_init(struct sde_rot_mgr *mgr)
/* REGDMA initialization */
if (rot->mode == ROT_REGDMA_OFF) {
for (i = 0; i < SDE_HW_ROT_REGDMA_TOTAL_CTX; i++)
- rot->cmd_wr_ptr[0][i] = &rot->cmd_queue[
- SDE_HW_ROT_REGDMA_SEG_SIZE * i];
+ rot->cmd_wr_ptr[0][i] = (char __iomem *)(
+ &rot->cmd_queue[
+ SDE_HW_ROT_REGDMA_SEG_SIZE * i]);
} else {
for (i = 0; i < SDE_HW_ROT_REGDMA_TOTAL_CTX; i++)
rot->cmd_wr_ptr[ROT_QUEUE_HIGH_PRIORITY][i] =
- (u32 *)(rot->mdss_base +
+ rot->mdss_base +
REGDMA_RAM_REGDMA_CMD_RAM +
- SDE_HW_ROT_REGDMA_SEG_SIZE * 4 * i);
+ SDE_HW_ROT_REGDMA_SEG_SIZE * 4 * i;
for (i = 0; i < SDE_HW_ROT_REGDMA_TOTAL_CTX; i++)
rot->cmd_wr_ptr[ROT_QUEUE_LOW_PRIORITY][i] =
- (u32 *)(rot->mdss_base +
+ rot->mdss_base +
REGDMA_RAM_REGDMA_CMD_RAM +
SDE_HW_ROT_REGDMA_SEG_SIZE * 4 *
- (i + SDE_HW_ROT_REGDMA_TOTAL_CTX));
+ (i + SDE_HW_ROT_REGDMA_TOTAL_CTX);
}
atomic_set(&rot->timestamp[0], 0);
diff --git a/drivers/media/platform/msm/sde/rotator/sde_rotator_r3_internal.h b/drivers/media/platform/msm/sde/rotator/sde_rotator_r3_internal.h
index 5502cc09ae19..325bacb5ba03 100644
--- a/drivers/media/platform/msm/sde/rotator/sde_rotator_r3_internal.h
+++ b/drivers/media/platform/msm/sde/rotator/sde_rotator_r3_internal.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2017, 2020, 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
@@ -207,8 +207,8 @@ struct sde_hw_rotator_context {
struct sde_rot_hw_resource *hwres;
enum sde_rot_queue_prio q_id;
u32 session_id;
- u32 *regdma_base;
- u32 *regdma_wrptr;
+ char __iomem *regdma_base;
+ char __iomem *regdma_wrptr;
u32 timestamp;
struct completion rot_comp;
wait_queue_head_t regdma_waitq;
@@ -249,7 +249,7 @@ struct sde_hw_rotator {
u32 cmd_queue[SDE_HW_ROT_REGDMA_RAM_SIZE];
/* Cmd Queue Write Ptr */
- u32 *cmd_wr_ptr[ROT_QUEUE_MAX][SDE_HW_ROT_REGDMA_TOTAL_CTX];
+ char __iomem *cmd_wr_ptr[ROT_QUEUE_MAX][SDE_HW_ROT_REGDMA_TOTAL_CTX];
/* Rotator Context */
struct sde_hw_rotator_context
@@ -301,7 +301,7 @@ static inline u32 sde_hw_rotator_get_regdma_ctxidx(
* @ctx: Rotator Context
* return: base segment address
*/
-static inline u32 *sde_hw_rotator_get_regdma_segment_base(
+static inline char __iomem *sde_hw_rotator_get_regdma_segment_base(
struct sde_hw_rotator_context *ctx)
{
SDEROT_DBG("regdma base @slot[%d]: %p\n",
@@ -317,11 +317,11 @@ static inline u32 *sde_hw_rotator_get_regdma_segment_base(
* @ctx: Rotator Context
* return: segment address
*/
-static inline u32 *sde_hw_rotator_get_regdma_segment(
+static inline char __iomem *sde_hw_rotator_get_regdma_segment(
struct sde_hw_rotator_context *ctx)
{
u32 idx = sde_hw_rotator_get_regdma_ctxidx(ctx);
- u32 *addr = ctx->regdma_wrptr;
+ char __iomem *addr = ctx->regdma_wrptr;
SDEROT_DBG("regdma slot[%d] ==> %p\n", idx, addr);
return addr;
@@ -335,7 +335,7 @@ static inline u32 *sde_hw_rotator_get_regdma_segment(
*/
static inline void sde_hw_rotator_put_regdma_segment(
struct sde_hw_rotator_context *ctx,
- u32 *wrptr)
+ char __iomem *wrptr)
{
u32 idx = sde_hw_rotator_get_regdma_ctxidx(ctx);
diff --git a/drivers/misc/hdcp.c b/drivers/misc/hdcp.c
index cc11ede6a456..ea81ccda4ee5 100644
--- a/drivers/misc/hdcp.c
+++ b/drivers/misc/hdcp.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2020, 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
@@ -2085,7 +2085,8 @@ static void hdcp_lib_clean(struct hdcp_lib_handle *handle)
handle->authenticated = false;
/* AV mute the sink first to avoid artifacts */
- handle->client_ops->mute_sink(handle->client_ctx);
+ if (handle->client_ops->mute_sink)
+ handle->client_ops->mute_sink(handle->client_ctx);
hdcp_lib_txmtr_deinit(handle);
if (!handle->legacy_app)
@@ -2332,19 +2333,20 @@ bool hdcp1_check_if_supported_load_app(void)
/* start hdcp1 app */
if (hdcp1_supported && !hdcp1_handle->qsee_handle) {
+ mutex_init(&hdcp1_ta_cmd_lock);
rc = qseecom_start_app(&hdcp1_handle->qsee_handle,
HDCP1_APP_NAME,
QSEECOM_SBUFF_SIZE);
if (rc) {
pr_err("hdcp1 qseecom_start_app failed %d\n", rc);
hdcp1_supported = false;
+ hdcp1_srm_supported = false;
kfree(hdcp1_handle);
}
}
/* if hdcp1 app succeeds load SRM TA as well */
if (hdcp1_supported && !hdcp1_handle->srm_handle) {
- mutex_init(&hdcp1_ta_cmd_lock);
rc = qseecom_start_app(&hdcp1_handle->srm_handle,
SRMAPP_NAME,
QSEECOM_SBUFF_SIZE);
@@ -2395,13 +2397,19 @@ int hdcp1_set_keys(uint32_t *aksv_msb, uint32_t *aksv_lsb)
if (aksv_msb == NULL || aksv_lsb == NULL)
return -EINVAL;
- if (!hdcp1_supported || !hdcp1_handle)
- return -EINVAL;
+ mutex_lock(&hdcp1_ta_cmd_lock);
+
+ if (!hdcp1_supported || !hdcp1_handle) {
+ rc = -EINVAL;
+ goto end;
+ }
hdcp1_qsee_handle = hdcp1_handle->qsee_handle;
- if (!hdcp1_qsee_handle)
- return -EINVAL;
+ if (!hdcp1_qsee_handle) {
+ rc = -EINVAL;
+ goto end;
+ }
/* set keys and request aksv */
key_set_req = (struct hdcp1_key_set_req *)hdcp1_qsee_handle->sbuf;
@@ -2417,13 +2425,15 @@ int hdcp1_set_keys(uint32_t *aksv_msb, uint32_t *aksv_lsb)
if (rc < 0) {
pr_err("qseecom cmd failed err=%d\n", rc);
- return -ENOKEY;
+ rc = -ENOKEY;
+ goto end;
}
rc = key_set_rsp->ret;
if (rc) {
pr_err("set key cmd failed, rsp=%d\n", key_set_rsp->ret);
- return -ENOKEY;
+ rc = -ENOKEY;
+ goto end;
}
/* copy bytes into msb and lsb */
@@ -2436,7 +2446,9 @@ int hdcp1_set_keys(uint32_t *aksv_msb, uint32_t *aksv_lsb)
*aksv_lsb |= key_set_rsp->ksv[6] << 8;
*aksv_lsb |= key_set_rsp->ksv[7];
- return 0;
+end:
+ mutex_unlock(&hdcp1_ta_cmd_lock);
+ return rc;
}
int hdcp1_validate_receiver_ids(struct hdcp_srm_device_id_t *device_ids,
@@ -2576,8 +2588,10 @@ int hdcp1_set_enc(bool enable)
hdcp1_qsee_handle = hdcp1_handle->qsee_handle;
- if (!hdcp1_qsee_handle)
- return -EINVAL;
+ if (!hdcp1_qsee_handle) {
+ rc = -EINVAL;
+ goto end;
+ }
if (hdcp1_enc_enabled == enable) {
pr_info("already %s\n", enable ? "enabled" : "disabled");
diff --git a/drivers/mmc/host/sdhci-msm-ice.c b/drivers/mmc/host/sdhci-msm-ice.c
index e73bdfd424cc..ca2a411878bf 100644
--- a/drivers/mmc/host/sdhci-msm-ice.c
+++ b/drivers/mmc/host/sdhci-msm-ice.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015, 2017, 2020, 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
@@ -301,6 +301,7 @@ void sdhci_msm_ice_hci_update_noncq_cfg(struct sdhci_host *host,
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
struct sdhci_msm_host *msm_host = pltfm_host->priv;
unsigned int crypto_params = 0;
+ unsigned int crypto_enable = !bypass;
/*
* The naming convention got changed between ICE2.0 and ICE3.0
* registers fields. Below is the equivalent names for
@@ -311,7 +312,7 @@ void sdhci_msm_ice_hci_update_noncq_cfg(struct sdhci_host *host,
*/
/* Configure ICE bypass mode */
crypto_params |=
- (!bypass & MASK_SDHCI_MSM_ICE_HCI_PARAM_CE)
+ (crypto_enable & MASK_SDHCI_MSM_ICE_HCI_PARAM_CE)
<< OFFSET_SDHCI_MSM_ICE_HCI_PARAM_CE;
/* Configure Crypto Configure Index (CCI) */
crypto_params |= (key_index &
diff --git a/drivers/platform/msm/ipa/ipa_v2/rmnet_ipa.c b/drivers/platform/msm/ipa/ipa_v2/rmnet_ipa.c
index 7518e437acd2..79515ba637ee 100644
--- a/drivers/platform/msm/ipa/ipa_v2/rmnet_ipa.c
+++ b/drivers/platform/msm/ipa/ipa_v2/rmnet_ipa.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2020, 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
@@ -701,7 +701,7 @@ static int wwan_add_ul_flt_rule_to_ipa(void)
/* send ipa_fltr_installed_notif_req_msg_v01 to Q6*/
req->source_pipe_index =
ipa2_get_ep_mapping(IPA_CLIENT_APPS_LAN_WAN_PROD);
- req->install_status = QMI_RESULT_SUCCESS_V01;
+ req->install_status = IPA_QMI_RESULT_SUCCESS_V01;
req->filter_index_list_len = num_q6_rule;
mutex_lock(&ipa_qmi_lock);
for (i = 0; i < num_q6_rule; i++) {
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_rt.c b/drivers/platform/msm/ipa/ipa_v3/ipa_rt.c
index 5413e62a75d8..bc63b3188276 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_rt.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_rt.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2020, 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
@@ -1243,7 +1243,7 @@ int ipa3_add_rt_rule_after(struct ipa_ioc_add_rt_rule_after *rules)
tbl = __ipa3_find_rt_tbl(rules->ip, rules->rt_tbl_name);
if (tbl == NULL || (tbl->cookie != IPA_RT_TBL_COOKIE)) {
IPAERR_RL("failed finding rt tbl name = %s\n",
- rules->rt_tbl_name ? rules->rt_tbl_name : "");
+ (rules->rt_tbl_name != NULL) ? rules->rt_tbl_name : "");
ret = -EINVAL;
goto bail;
}
diff --git a/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c b/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c
index cccd597646a7..3392cd0413a9 100644
--- a/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c
+++ b/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2020, 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
@@ -722,7 +722,8 @@ static int ipa3_wwan_add_ul_flt_rule_to_ipa(void)
retval = -EFAULT;
}
- req->install_status = QMI_RESULT_SUCCESS_V01;
+ req->install_status = (enum ipa_qmi_result_type_v01)
+ IPA_QMI_RESULT_SUCCESS_V01;
req->rule_id_valid = 1;
req->rule_id_len = rmnet_ipa3_ctx->num_q6_rules;
for (i = 0; i < rmnet_ipa3_ctx->num_q6_rules; i++) {
diff --git a/drivers/soc/qcom/glink_debugfs.c b/drivers/soc/qcom/glink_debugfs.c
index 8e65e4ac9b8e..4bc01704d8aa 100644
--- a/drivers/soc/qcom/glink_debugfs.c
+++ b/drivers/soc/qcom/glink_debugfs.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2015, 2020, 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
@@ -559,9 +559,9 @@ void glink_dfs_update_list(struct dentry *curr_dent, struct dentry *parent,
dbgfs_dent_s->parent = parent;
dbgfs_dent_s->self = curr_dent;
strlcpy(dbgfs_dent_s->self_name,
- curr, strlen(curr) + 1);
+ curr, sizeof(dbgfs_dent_s->self_name));
strlcpy(dbgfs_dent_s->par_name, par_dir,
- strlen(par_dir) + 1);
+ sizeof(dbgfs_dent_s->par_name));
mutex_lock(&dent_list_lock_lha0);
list_add_tail(&dbgfs_dent_s->list_node, &dent_list);
mutex_unlock(&dent_list_lock_lha0);
diff --git a/drivers/soc/qcom/msm-spm.c b/drivers/soc/qcom/msm-spm.c
index 508aa77c7e42..ea49db406eef 100644
--- a/drivers/soc/qcom/msm-spm.c
+++ b/drivers/soc/qcom/msm-spm.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2016, 2020, 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
@@ -153,7 +153,7 @@ static void msm_spm_drv_flush_shadow(struct msm_spm_driver_data *dev,
{
BUG_ON(!dev);
- BUG_ON(!dev->reg_shadow);
+ BUG_ON(dev->reg_shadow == NULL);
__raw_writel(dev->reg_shadow[reg_index],
dev->reg_base_addr + dev->reg_offsets[reg_index]);
diff --git a/drivers/soc/qcom/rpm_master_stat.c b/drivers/soc/qcom/rpm_master_stat.c
index b8bf3a059677..a53af5344490 100644
--- a/drivers/soc/qcom/rpm_master_stat.c
+++ b/drivers/soc/qcom/rpm_master_stat.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2017, 2020, 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
@@ -351,7 +351,7 @@ static struct msm_rpm_master_stats_platform_data
{
struct msm_rpm_master_stats_platform_data *pdata;
struct device_node *node = dev->of_node;
- int rc = 0, i;
+ int rc = 0, i, rpm_master_name_len = 0;
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
@@ -387,7 +387,7 @@ static struct msm_rpm_master_stats_platform_data
* Read master names from DT
*/
for (i = 0; i < pdata->num_masters; i++) {
- const char *master_name;
+ const char *master_name = NULL;
of_property_read_string_index(node, "qcom,masters",
i, &master_name);
@@ -395,9 +395,9 @@ static struct msm_rpm_master_stats_platform_data
strlen(master_name) + 1, GFP_KERNEL);
if (!pdata->masters[i])
goto err;
-
+ rpm_master_name_len = strlen(master_name);
strlcpy(pdata->masters[i], master_name,
- strlen(master_name) + 1);
+ rpm_master_name_len + 1);
}
return pdata;
err:
diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c
index 1de38bfd0adf..e269de5be22f 100644
--- a/drivers/soc/qcom/smp2p.c
+++ b/drivers/soc/qcom/smp2p.c
@@ -1,6 +1,6 @@
/* drivers/soc/qcom/smp2p.c
*
- * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016, 2020, 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
@@ -989,17 +989,29 @@ void smp2p_init_header(struct smp2p_smem __iomem *header_ptr,
int local_pid, int remote_pid,
uint32_t features, uint32_t version)
{
- header_ptr->magic = SMP2P_MAGIC;
- SMP2P_SET_LOCAL_PID(header_ptr->rem_loc_proc_id, local_pid);
- SMP2P_SET_REMOTE_PID(header_ptr->rem_loc_proc_id, remote_pid);
- SMP2P_SET_FEATURES(header_ptr->feature_version, features);
- SMP2P_SET_ENT_TOTAL(header_ptr->valid_total_ent, SMP2P_MAX_ENTRY);
- SMP2P_SET_ENT_VALID(header_ptr->valid_total_ent, 0);
- header_ptr->flags = 0;
+ uint32_t rem_loc_proc_id = 0;
+ uint32_t valid_total_ent = 0;
+ uint32_t feature_version = 0;
+
+ writel_relaxed(SMP2P_MAGIC, &header_ptr->magic);
+
+ SMP2P_SET_LOCAL_PID(rem_loc_proc_id, local_pid);
+ SMP2P_SET_REMOTE_PID(rem_loc_proc_id, remote_pid);
+ writel_relaxed(rem_loc_proc_id, &header_ptr->rem_loc_proc_id);
+
+ SMP2P_SET_FEATURES(feature_version, features);
+ writel_relaxed(feature_version, &header_ptr->feature_version);
+
+ SMP2P_SET_ENT_TOTAL(valid_total_ent, SMP2P_MAX_ENTRY);
+ SMP2P_SET_ENT_VALID(valid_total_ent, 0);
+ writel_relaxed(valid_total_ent, &header_ptr->valid_total_ent);
+
+ writel_relaxed(0, &header_ptr->flags);
/* ensure that all fields are valid before version is written */
wmb();
- SMP2P_SET_VERSION(header_ptr->feature_version, version);
+ SMP2P_SET_VERSION(feature_version, version);
+ writel_relaxed(feature_version, &header_ptr->feature_version);
}
/**
diff --git a/drivers/soc/qcom/sysmon-qmi.c b/drivers/soc/qcom/sysmon-qmi.c
index 1063b96d8d83..e3b947390856 100644
--- a/drivers/soc/qcom/sysmon-qmi.c
+++ b/drivers/soc/qcom/sysmon-qmi.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2015, 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2015, 2017, 2020, 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
@@ -474,7 +474,7 @@ int sysmon_send_shutdown(struct subsys_desc *dest_desc)
shutdown_ack_ret = wait_for_shutdown_ack(dest_desc);
if (shutdown_ack_ret < 0) {
pr_err("shutdown_ack SMP2P bit for %s not set\n", data->name);
- if (!&data->ind_recv.done) {
+ if (!completion_done(&data->ind_recv)) {
pr_err("QMI shutdown indication not received\n");
ret = shutdown_ack_ret;
}
diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c
index bd481af4035c..ad3fdf8aa15b 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -4,6 +4,8 @@
* Copyright (C) Linaro 2012
* Author: <benjamin.gaignard@linaro.org> for ST-Ericsson.
*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ *
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
@@ -221,7 +223,7 @@ struct ion_heap *ion_cma_heap_create(struct ion_platform_heap *data)
/* set device as private heaps data, later it will be
* used to make the link with reserved CMA memory */
heap->priv = data->priv;
- heap->type = ION_HEAP_TYPE_DMA;
+ heap->type = (enum ion_heap_type)ION_HEAP_TYPE_DMA;
cma_heap_has_outer_cache = data->has_outer_cache;
return heap;
}
@@ -363,7 +365,7 @@ struct ion_heap *ion_cma_secure_heap_create(struct ion_platform_heap *data)
* used to make the link with reserved CMA memory
*/
heap->priv = data->priv;
- heap->type = ION_HEAP_TYPE_HYP_CMA;
+ heap->type = (enum ion_heap_type)ION_HEAP_TYPE_HYP_CMA;
cma_heap_has_outer_cache = data->has_outer_cache;
return heap;
}
diff --git a/drivers/staging/android/ion/ion_cma_secure_heap.c b/drivers/staging/android/ion/ion_cma_secure_heap.c
index 6102b1765182..6fde2a5105c4 100644
--- a/drivers/staging/android/ion/ion_cma_secure_heap.c
+++ b/drivers/staging/android/ion/ion_cma_secure_heap.c
@@ -3,7 +3,7 @@
*
* Copyright (C) Linaro 2012
* Author: <benjamin.gaignard@linaro.org> for ST-Ericsson.
- * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017, 2020, The Linux Foundation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@@ -854,7 +854,7 @@ struct ion_heap *ion_secure_cma_heap_create(struct ion_platform_heap *data)
mutex_init(&sheap->chunk_lock);
mutex_init(&sheap->alloc_lock);
sheap->heap.ops = &ion_secure_cma_ops;
- sheap->heap.type = ION_HEAP_TYPE_SECURE_DMA;
+ sheap->heap.type = (enum ion_heap_type)ION_HEAP_TYPE_SECURE_DMA;
sheap->npages = data->size >> PAGE_SHIFT;
sheap->base = data->base;
sheap->heap_size = data->size;
diff --git a/drivers/staging/android/ion/ion_system_secure_heap.c b/drivers/staging/android/ion/ion_system_secure_heap.c
index c7585118a41c..53662683d0e1 100644
--- a/drivers/staging/android/ion/ion_system_secure_heap.c
+++ b/drivers/staging/android/ion/ion_system_secure_heap.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2018, 2020, 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,10 +49,10 @@ struct prefetch_info {
static bool is_cp_flag_present(unsigned long flags)
{
- return flags && (ION_FLAG_CP_TOUCH ||
- ION_FLAG_CP_BITSTREAM ||
- ION_FLAG_CP_PIXEL ||
- ION_FLAG_CP_NON_PIXEL ||
+ return flags & (ION_FLAG_CP_TOUCH |
+ ION_FLAG_CP_BITSTREAM |
+ ION_FLAG_CP_PIXEL |
+ ION_FLAG_CP_NON_PIXEL |
ION_FLAG_CP_CAMERA);
}
@@ -117,7 +117,7 @@ static int ion_system_secure_heap_allocate(struct ion_heap *heap,
heap);
if (!ion_heap_is_system_secure_heap_type(secure_heap->heap.type) ||
- !is_cp_flag_present(flags)) {
+ !(is_cp_flag_present(flags) || (flags & ION_FLAG_SECURE))) {
pr_info("%s: Incorrect heap type or incorrect flags\n",
__func__);
return -EINVAL;
@@ -392,7 +392,7 @@ struct ion_heap *ion_system_secure_heap_create(struct ion_platform_heap *unused)
if (!heap)
return ERR_PTR(-ENOMEM);
heap->heap.ops = &system_secure_heap_ops;
- heap->heap.type = ION_HEAP_TYPE_SYSTEM_SECURE;
+ heap->heap.type = (enum ion_heap_type)ION_HEAP_TYPE_SYSTEM_SECURE;
heap->sys_heap = get_ion_heap(ION_SYSTEM_HEAP_ID);
heap->destroy_heap = false;
diff --git a/drivers/staging/android/ion/msm/msm_ion.c b/drivers/staging/android/ion/msm/msm_ion.c
index d3069fe4dd78..1a3aca407c9e 100644
--- a/drivers/staging/android/ion/msm/msm_ion.c
+++ b/drivers/staging/android/ion/msm/msm_ion.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2018, 2020, 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
@@ -809,13 +809,15 @@ long msm_ion_custom_ioctl(struct ion_client *client,
int ret;
ret = ion_walk_heaps(client, data.prefetch_data.heap_id,
- ION_HEAP_TYPE_SECURE_DMA,
- (void *)data.prefetch_data.len,
- ion_secure_cma_prefetch);
+ (enum ion_heap_type)
+ ION_HEAP_TYPE_SECURE_DMA,
+ (void *)data.prefetch_data.len,
+ ion_secure_cma_prefetch);
if (ret)
return ret;
ret = ion_walk_heaps(client, data.prefetch_data.heap_id,
+ (enum ion_heap_type)
ION_HEAP_TYPE_SYSTEM_SECURE,
(void *)&data.prefetch_data,
ion_system_secure_heap_prefetch);
@@ -828,14 +830,16 @@ long msm_ion_custom_ioctl(struct ion_client *client,
int ret;
ret = ion_walk_heaps(client, data.prefetch_data.heap_id,
- ION_HEAP_TYPE_SECURE_DMA,
- (void *)data.prefetch_data.len,
- ion_secure_cma_drain_pool);
+ (enum ion_heap_type)
+ ION_HEAP_TYPE_SECURE_DMA,
+ (void *)data.prefetch_data.len,
+ ion_secure_cma_drain_pool);
if (ret)
return ret;
ret = ion_walk_heaps(client, data.prefetch_data.heap_id,
+ (enum ion_heap_type)
ION_HEAP_TYPE_SYSTEM_SECURE,
(void *)&data.prefetch_data,
ion_system_secure_heap_drain);
diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
index 80070f67a895..ee4c11b4e164 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -294,6 +294,7 @@ static int lmk_vmpressure_notifier(struct notifier_block *nb,
if (pressure >= 95) {
other_file = global_page_state(NR_FILE_PAGES) + zcache_pages() -
global_page_state(NR_SHMEM) -
+ global_page_state(NR_UNEVICTABLE) -
total_swapcache_pages();
other_free = global_page_state(NR_FREE_PAGES);
@@ -307,6 +308,7 @@ static int lmk_vmpressure_notifier(struct notifier_block *nb,
other_file = global_page_state(NR_FILE_PAGES) + zcache_pages() -
global_page_state(NR_SHMEM) -
+ global_page_state(NR_UNEVICTABLE) -
total_swapcache_pages();
other_free = global_page_state(NR_FREE_PAGES);
@@ -319,6 +321,7 @@ static int lmk_vmpressure_notifier(struct notifier_block *nb,
} else if (atomic_read(&shift_adj)) {
other_file = global_page_state(NR_FILE_PAGES) + zcache_pages() -
global_page_state(NR_SHMEM) -
+ global_page_state(NR_UNEVICTABLE) -
total_swapcache_pages();
other_free = global_page_state(NR_FREE_PAGES);
diff --git a/drivers/tty/serial/msm_smd_tty.c b/drivers/tty/serial/msm_smd_tty.c
index ea3f221a0b25..0092437faaa2 100644
--- a/drivers/tty/serial/msm_smd_tty.c
+++ b/drivers/tty/serial/msm_smd_tty.c
@@ -1,5 +1,5 @@
/* Copyright (C) 2007 Google, Inc.
- * Copyright (c) 2009-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2009-2015, 2020, The Linux Foundation. All rights reserved.
* Author: Brian Swetland <swetland@google.com>
*
* This software is licensed under the terms of the GNU General Public
@@ -368,7 +368,7 @@ static int smd_tty_dummy_probe(struct platform_device *pdev)
int n;
for (n = 0; n < MAX_SMD_TTYS; ++n) {
- if (!smd_tty[n].dev_name)
+ if (smd_tty[n].dev_name == NULL)
continue;
if (pdev->id == smd_tty[n].edge &&
@@ -502,7 +502,7 @@ static int smd_tty_port_activate(struct tty_port *tport,
struct smd_tty_info *info;
const char *peripheral = NULL;
- if (n >= MAX_SMD_TTYS || !smd_tty[n].ch_name)
+ if (n >= MAX_SMD_TTYS || smd_tty[n].ch_name == NULL)
return -ENODEV;
info = smd_tty + n;
diff --git a/drivers/usb/gadget/function/f_qc_rndis.c b/drivers/usb/gadget/function/f_qc_rndis.c
index 8e558c364abc..2d62b07cb3f6 100644
--- a/drivers/usb/gadget/function/f_qc_rndis.c
+++ b/drivers/usb/gadget/function/f_qc_rndis.c
@@ -6,7 +6,7 @@
* Copyright (C) 2008 Nokia Corporation
* Copyright (C) 2009 Samsung Electronics
* Author: Michal Nazarewicz (mina86@mina86.com)
- * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2018, 2020, 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
@@ -330,18 +330,8 @@ static struct usb_endpoint_descriptor rndis_qc_ss_notify_desc = {
.bInterval = RNDIS_QC_LOG2_STATUS_INTERVAL_MSEC + 4,
};
-static struct usb_ss_ep_comp_descriptor ss_intr_comp_desc = {
- .bLength = sizeof(ss_intr_comp_desc),
- .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
-
- /* the following 3 values can be tweaked if necessary */
- /* .bMaxBurst = 0, */
- /* .bmAttributes = 0, */
- .wBytesPerInterval = cpu_to_le16(RNDIS_QC_STATUS_BYTECOUNT),
-};
-
static struct usb_ss_ep_comp_descriptor rndis_qc_ss_intr_comp_desc = {
- .bLength = sizeof(ss_intr_comp_desc),
+ .bLength = sizeof(rndis_qc_ss_intr_comp_desc),
.bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
/* the following 3 values can be tweaked if necessary */
@@ -350,15 +340,6 @@ static struct usb_ss_ep_comp_descriptor rndis_qc_ss_intr_comp_desc = {
.wBytesPerInterval = cpu_to_le16(RNDIS_QC_STATUS_BYTECOUNT),
};
-static struct usb_ss_ep_comp_descriptor ss_bulk_comp_desc = {
- .bLength = sizeof(ss_bulk_comp_desc),
- .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
-
- /* the following 2 values can be tweaked if necessary */
- /* .bMaxBurst = 0, */
- /* .bmAttributes = 0, */
-};
-
static struct usb_endpoint_descriptor rndis_qc_ss_in_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
@@ -378,7 +359,7 @@ static struct usb_endpoint_descriptor rndis_qc_ss_out_desc = {
};
static struct usb_ss_ep_comp_descriptor rndis_qc_ss_bulk_comp_desc = {
- .bLength = sizeof(ss_bulk_comp_desc),
+ .bLength = sizeof(rndis_qc_ss_bulk_comp_desc),
.bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
/* the following 2 values can be tweaked if necessary */
diff --git a/drivers/video/fbdev/msm/mdss_cec_core.c b/drivers/video/fbdev/msm/mdss_cec_core.c
index 1d9950494d65..ab7a8056016a 100644
--- a/drivers/video/fbdev/msm/mdss_cec_core.c
+++ b/drivers/video/fbdev/msm/mdss_cec_core.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2017, 2020, 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
@@ -594,6 +594,41 @@ end:
return ret;
}
+static ssize_t cec_wta_clear_logical_addr(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ int clear_flag;
+ unsigned long flags;
+ ssize_t ret;
+ struct cec_ctl *ctl = cec_get_ctl(dev);
+ struct cec_ops *ops;
+
+ if (!ctl) {
+ pr_err("Invalid ctl\n");
+ ret = -EINVAL;
+ goto end;
+ }
+
+ ops = ctl->init_data.ops;
+
+ ret = kstrtoint(buf, 10, &clear_flag);
+ if (ret) {
+ pr_err("kstrtoint failed\n");
+ goto end;
+ }
+
+ ret = count;
+
+ spin_lock_irqsave(&ctl->lock, flags);
+ if (ctl->enabled) {
+ if (ops && ops->clear_logical_addr)
+ ops->clear_logical_addr(ops->data, !!clear_flag);
+ }
+ spin_unlock_irqrestore(&ctl->lock, flags);
+end:
+ return ret;
+}
+
static ssize_t cec_rda_msg(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -703,6 +738,8 @@ static DEVICE_ATTR(enable_compliance, S_IRUGO | S_IWUSR,
cec_rda_enable_compliance, cec_wta_enable_compliance);
static DEVICE_ATTR(logical_addr, S_IRUSR | S_IWUSR,
cec_rda_logical_addr, cec_wta_logical_addr);
+static DEVICE_ATTR(clear_logical_addr, 0200,
+ NULL, cec_wta_clear_logical_addr);
static DEVICE_ATTR(rd_msg, S_IRUGO, cec_rda_msg, NULL);
static DEVICE_ATTR(wr_msg, S_IWUSR | S_IRUSR, NULL, cec_wta_msg);
@@ -710,6 +747,7 @@ static struct attribute *cec_fs_attrs[] = {
&dev_attr_enable.attr,
&dev_attr_enable_compliance.attr,
&dev_attr_logical_addr.attr,
+ &dev_attr_clear_logical_addr.attr,
&dev_attr_rd_msg.attr,
&dev_attr_wr_msg.attr,
NULL,
diff --git a/drivers/video/fbdev/msm/mdss_cec_core.h b/drivers/video/fbdev/msm/mdss_cec_core.h
index 12b7677c5dee..481884a732d8 100644
--- a/drivers/video/fbdev/msm/mdss_cec_core.h
+++ b/drivers/video/fbdev/msm/mdss_cec_core.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2016, 2020, 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
@@ -67,6 +67,7 @@ struct cec_ops {
int (*send_msg)(void *data,
struct cec_msg *msg);
void (*wt_logical_addr)(void *data, u8 addr);
+ void (*clear_logical_addr)(void *data, bool flag);
void (*wakeup_en)(void *data, bool en);
bool (*is_wakeup_en)(void *data);
void (*device_suspend)(void *data, bool suspend);
diff --git a/drivers/video/fbdev/msm/mdss_dsi.c b/drivers/video/fbdev/msm/mdss_dsi.c
index c2cfc8e0532e..bffbb731dd4a 100644
--- a/drivers/video/fbdev/msm/mdss_dsi.c
+++ b/drivers/video/fbdev/msm/mdss_dsi.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2020, 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
@@ -1704,7 +1704,7 @@ static int mdss_dsi_unblank(struct mdss_panel_data *pdata)
mipi->vsync_enable && mipi->hw_vsync_mode) {
mdss_dsi_set_tear_on(ctrl_pdata);
if (mdss_dsi_is_te_based_esd(ctrl_pdata))
- enable_irq(gpio_to_irq(ctrl_pdata->disp_te_gpio));
+ panel_update_te_irq(pdata, true);
}
ctrl_pdata->ctrl_state |= CTRL_STATE_PANEL_INIT;
@@ -1775,9 +1775,8 @@ static int mdss_dsi_blank(struct mdss_panel_data *pdata, int power_state)
if ((pdata->panel_info.type == MIPI_CMD_PANEL) &&
mipi->vsync_enable && mipi->hw_vsync_mode) {
if (mdss_dsi_is_te_based_esd(ctrl_pdata)) {
- disable_irq(gpio_to_irq(
- ctrl_pdata->disp_te_gpio));
- atomic_dec(&ctrl_pdata->te_irq_ready);
+ panel_update_te_irq(pdata, false);
+ atomic_dec(&ctrl_pdata->te_irq_ready);
}
mdss_dsi_set_tear_off(ctrl_pdata);
}
@@ -3686,6 +3685,7 @@ static int mdss_dsi_ctrl_probe(struct platform_device *pdev)
pdata = &ctrl_pdata->panel_data;
init_completion(&pdata->te_done);
+ mutex_init(&pdata->te_mutex);
if (pdata->panel_info.type == MIPI_CMD_PANEL) {
if (!te_irq_registered) {
rc = devm_request_irq(&pdev->dev,
diff --git a/drivers/video/fbdev/msm/mdss_dsi_cmd.h b/drivers/video/fbdev/msm/mdss_dsi_cmd.h
index 0ca968a00460..f323a2b665b6 100644
--- a/drivers/video/fbdev/msm/mdss_dsi_cmd.h
+++ b/drivers/video/fbdev/msm/mdss_dsi_cmd.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2016, 2020, 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
@@ -101,6 +101,7 @@ struct dsi_cmd_desc {
#define CMD_CLK_CTRL 0x0004
#define CMD_REQ_UNICAST 0x0008
#define CMD_REQ_DMA_TPG 0x0040
+#define CMD_REQ_DCS 0x0080
#define CMD_REQ_NO_MAX_PKT_SIZE 0x0008
#define CMD_REQ_LP_MODE 0x0010
#define CMD_REQ_HS_MODE 0x0020
diff --git a/drivers/video/fbdev/msm/mdss_dsi_host.c b/drivers/video/fbdev/msm/mdss_dsi_host.c
index 34cedaaa5864..a34a3424d990 100644
--- a/drivers/video/fbdev/msm/mdss_dsi_host.c
+++ b/drivers/video/fbdev/msm/mdss_dsi_host.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2018, 2020, 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
@@ -2668,7 +2668,7 @@ int mdss_dsi_cmdlist_rx(struct mdss_dsi_ctrl_pdata *ctrl,
}
static inline bool mdss_dsi_delay_cmd(struct mdss_dsi_ctrl_pdata *ctrl,
- bool from_mdp)
+ bool from_mdp, struct dcs_cmd_req *req)
{
unsigned long flags;
bool mdp_busy = false;
@@ -2678,9 +2678,9 @@ static inline bool mdss_dsi_delay_cmd(struct mdss_dsi_ctrl_pdata *ctrl,
goto exit;
/* delay only for split dsi, cmd mode and burst mode enabled cases */
- if (!mdss_dsi_is_hw_config_split(ctrl->shared_data) ||
+ if ((!mdss_dsi_is_hw_config_split(ctrl->shared_data) ||
!(ctrl->panel_mode == DSI_CMD_MODE) ||
- !ctrl->burst_mode_enabled)
+ !ctrl->burst_mode_enabled) && !(req->flags & CMD_REQ_DCS))
goto exit;
/* delay only if cmd is not from mdp and panel has been initialized */
@@ -2689,8 +2689,10 @@ static inline bool mdss_dsi_delay_cmd(struct mdss_dsi_ctrl_pdata *ctrl,
/* if broadcast enabled, apply delay only if this is the ctrl trigger */
if (mdss_dsi_sync_wait_enable(ctrl) &&
- !mdss_dsi_sync_wait_trigger(ctrl))
+ (!mdss_dsi_sync_wait_trigger(ctrl) && !(req->flags & CMD_REQ_DCS)))
goto exit;
+ else
+ need_wait = true;
spin_lock_irqsave(&ctrl->mdp_lock, flags);
if (ctrl->mdp_busy == true)
@@ -2830,7 +2832,7 @@ int mdss_dsi_cmdlist_commit(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp)
* mdp path
*/
mutex_lock(&ctrl->mutex);
- if (mdss_dsi_delay_cmd(ctrl, from_mdp))
+ if (mdss_dsi_delay_cmd(ctrl, from_mdp, req))
ctrl->mdp_callback->fxn(ctrl->mdp_callback->data,
MDP_INTF_CALLBACK_DSI_WAIT);
mutex_unlock(&ctrl->mutex);
diff --git a/drivers/video/fbdev/msm/mdss_dsi_panel.c b/drivers/video/fbdev/msm/mdss_dsi_panel.c
index bf695ae0beaf..fd269d7baf09 100644
--- a/drivers/video/fbdev/msm/mdss_dsi_panel.c
+++ b/drivers/video/fbdev/msm/mdss_dsi_panel.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2018, 2020, 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
@@ -234,7 +234,7 @@ static void mdss_dsi_panel_bklt_dcs(struct mdss_dsi_ctrl_pdata *ctrl, int level)
memset(&cmdreq, 0, sizeof(cmdreq));
cmdreq.cmds = &backlight_cmd;
cmdreq.cmds_cnt = 1;
- cmdreq.flags = CMD_REQ_COMMIT | CMD_CLK_CTRL;
+ cmdreq.flags = CMD_REQ_COMMIT | CMD_CLK_CTRL | CMD_REQ_DCS;
cmdreq.rlen = 0;
cmdreq.cb = NULL;
diff --git a/drivers/video/fbdev/msm/mdss_fb.c b/drivers/video/fbdev/msm/mdss_fb.c
index f56e50d516cd..31f4ef83b8b3 100644
--- a/drivers/video/fbdev/msm/mdss_fb.c
+++ b/drivers/video/fbdev/msm/mdss_fb.c
@@ -1,7 +1,7 @@
/*
* Core MDSS framebuffer driver.
*
- * Copyright (c) 2008-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2008-2020, The Linux Foundation. All rights reserved.
* Copyright (C) 2007 Google Incorporated
*
* This software is licensed under the terms of the GNU General Public
@@ -3507,16 +3507,19 @@ static int mdss_fb_pan_display(struct fb_var_screeninfo *var,
{
struct mdp_display_commit disp_commit;
struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)info->par;
+ struct mdss_data_type *mdata = mfd_to_mdata(mfd);
/*
- * during mode switch through mode sysfs node, it will trigger a
- * pan_display after switch. This assumes that fb has been adjusted,
- * however when using overlays we may not have the right size at this
- * point, so it needs to go through PREPARE first. Abort pan_display
- * operations until that happens
+ * Abort pan_display operations in following cases:
+ * 1. during mode switch through mode sysfs node, it will trigger a
+ * pan_display after switch. This assumes that fb has been adjusted,
+ * however when using overlays we may not have the right size at this
+ * point, so it needs to go through PREPARE first.
+ * 2. When the splash handoff is pending.
*/
- if (mfd->switch_state != MDSS_MDP_NO_UPDATE_REQUESTED) {
- pr_debug("fb%d: pan_display skipped during switch\n",
+ if ((mfd->switch_state != MDSS_MDP_NO_UPDATE_REQUESTED) ||
+ (mdss_fb_is_hdmi_primary(mfd) && mdata->handoff_pending)) {
+ pr_debug("fb%d: pan_display skipped during switch or handoff\n",
mfd->index);
return 0;
}
@@ -4072,17 +4075,23 @@ static int mdss_fb_set_par(struct fb_info *info)
mfd->fbi->fix.smem_len = PAGE_ALIGN(mfd->fbi->fix.line_length *
mfd->fbi->var.yres) * mfd->fb_page;
- old_format = mdss_grayscale_to_mdp_format(var->grayscale);
- if (!IS_ERR_VALUE(old_format)) {
+ old_format = mfd->panel_info->out_format;
+ mfd->panel_info->out_format =
+ mdss_grayscale_to_mdp_format(var->grayscale);
+ if (!IS_ERR_VALUE(mfd->panel_info->out_format)) {
if (old_format != mfd->panel_info->out_format)
mfd->panel_reconfig = true;
}
+ if (mdss_fb_is_hdmi_primary(mfd) && mfd->panel_reconfig)
+ mfd->force_null_commit = true;
+
if (mfd->panel_reconfig || (mfd->fb_imgType != old_imgType)) {
mdss_fb_blank_sub(FB_BLANK_POWERDOWN, info, mfd->op_enable);
mdss_fb_var_to_panelinfo(var, mfd->panel_info);
mdss_fb_blank_sub(FB_BLANK_UNBLANK, info, mfd->op_enable);
mfd->panel_reconfig = false;
+ mfd->force_null_commit = false;
}
return ret;
diff --git a/drivers/video/fbdev/msm/mdss_fb.h b/drivers/video/fbdev/msm/mdss_fb.h
index 301c1386a639..4d2888246b7c 100644
--- a/drivers/video/fbdev/msm/mdss_fb.h
+++ b/drivers/video/fbdev/msm/mdss_fb.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2008-2020, 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
@@ -292,6 +292,7 @@ struct msm_fb_data_type {
int op_enable;
u32 fb_imgType;
int panel_reconfig;
+ int force_null_commit;
u32 panel_orientation;
u32 dst_format;
diff --git a/drivers/video/fbdev/msm/mdss_hdcp_1x.c b/drivers/video/fbdev/msm/mdss_hdcp_1x.c
index 8df9080129b9..0b394ea270cd 100644
--- a/drivers/video/fbdev/msm/mdss_hdcp_1x.c
+++ b/drivers/video/fbdev/msm/mdss_hdcp_1x.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2020, 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
@@ -1348,16 +1348,16 @@ static int hdcp_1x_authentication_part2(struct hdcp_1x *hdcp)
}
do {
- rc = hdcp_1x_transfer_v_h(hdcp);
- if (rc)
- goto error;
-
/* do not proceed further if no device connected */
if (!hdcp->current_tp.dev_count) {
rc = -EINVAL;
goto error;
}
+ rc = hdcp_1x_transfer_v_h(hdcp);
+ if (rc)
+ goto error;
+
rc = hdcp_1x_write_ksv_fifo(hdcp);
} while (--v_retry && rc);
error:
diff --git a/drivers/video/fbdev/msm/mdss_hdmi_cec.c b/drivers/video/fbdev/msm/mdss_hdmi_cec.c
index a4ed01210e04..12a9267f3749 100644
--- a/drivers/video/fbdev/msm/mdss_hdmi_cec.c
+++ b/drivers/video/fbdev/msm/mdss_hdmi_cec.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2017, 2020 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
@@ -17,6 +17,7 @@
#include <linux/slab.h>
#include <linux/device.h>
#include <linux/input.h>
+#include <linux/circ_buf.h>
#include "mdss_hdmi_cec.h"
#include "mdss_panel.h"
@@ -33,12 +34,19 @@
#define CEC_OP_KEY_PRESS 0x44
#define CEC_OP_STANDBY 0x36
+#define CEC_RECV_Q_SIZE 4
+#define CEC_RECV_Q_MASK 3
+
struct hdmi_cec_ctrl {
bool cec_enabled;
bool cec_wakeup_en;
bool cec_device_suspend;
-
+ bool cec_clear_logical_addr;
+ u32 cec_logical_addr;
u32 cec_msg_wr_status;
+ struct cec_msg recv_msg[CEC_RECV_Q_SIZE];
+ u32 head;
+ u32 tail;
spinlock_t lock;
struct work_struct cec_read_work;
struct completion cec_msg_wr_done;
@@ -60,6 +68,20 @@ static int hdmi_cec_msg_send(void *data, struct cec_msg *msg)
return -EINVAL;
}
+ if (msg->sender_id != cec_ctrl->cec_logical_addr &&
+ msg->recvr_id == 0xF) {
+ /*
+ * If the current logical address is not the
+ * same as the sender_id and if the message is
+ * broadcasting, the message is looping back.
+ * Abort the message sending in that case
+ */
+ DEV_ERR("%s: abort potential MAL msg %d:%d logical %d\n",
+ __func__, msg->sender_id, msg->recvr_id,
+ cec_ctrl->cec_logical_addr);
+ return -EINVAL;
+ }
+
io = cec_ctrl->init_data.io;
reinit_completion(&cec_ctrl->cec_msg_wr_done);
@@ -68,10 +90,6 @@ static int hdmi_cec_msg_send(void *data, struct cec_msg *msg)
if (msg->retransmit > 0 && msg->retransmit < RETRANSMIT_MAX_NUM)
frame_retransmit = msg->retransmit;
- /* toggle cec in order to flush out bad hw state, if any */
- DSS_REG_W(io, HDMI_CEC_CTRL, 0);
- DSS_REG_W(io, HDMI_CEC_CTRL, BIT(0));
-
frame_retransmit = (frame_retransmit & 0xF) << 4;
DSS_REG_W(io, HDMI_CEC_RETRANSMIT, BIT(0) | frame_retransmit);
@@ -164,88 +182,130 @@ static void hdmi_cec_deinit_input_event(struct hdmi_cec_ctrl *cec_ctrl)
cec_ctrl->input = NULL;
}
-static void hdmi_cec_msg_recv(struct work_struct *work)
+static int hdmi_cec_msg_read(struct hdmi_cec_ctrl *cec_ctrl)
{
- int i;
- u32 data;
- struct hdmi_cec_ctrl *cec_ctrl = NULL;
struct dss_io_data *io = NULL;
- struct cec_msg msg;
- struct cec_cbs *cbs;
+ struct cec_msg *msg;
+ u32 data;
+ int i;
+ u32 head;
+ u32 tail;
- cec_ctrl = container_of(work, struct hdmi_cec_ctrl, cec_read_work);
if (!cec_ctrl || !cec_ctrl->init_data.io) {
DEV_ERR("%s: invalid input\n", __func__);
- return;
+ return -EINVAL;
}
if (!cec_ctrl->cec_enabled) {
DEV_ERR("%s: cec not enabled\n", __func__);
- return;
+ return -ENODEV;
}
- io = cec_ctrl->init_data.io;
- cbs = cec_ctrl->init_data.cbs;
+ head = cec_ctrl->head;
+ tail = READ_ONCE(cec_ctrl->tail);
+ if (CIRC_SPACE(head, tail, CEC_RECV_Q_SIZE) < 1) {
+ DEV_ERR("%s: no more space to hold the buffer\n", __func__);
+ return 0; /* Let's just kick the thread */
+ }
- data = DSS_REG_R(io, HDMI_CEC_RD_DATA);
+ msg = &cec_ctrl->recv_msg[head];
- msg.recvr_id = (data & 0x000F);
- msg.sender_id = (data & 0x00F0) >> 4;
- msg.frame_size = (data & 0x1F00) >> 8;
- DEV_DBG("%s: Recvd init=[%u] dest=[%u] size=[%u]\n", __func__,
- msg.sender_id, msg.recvr_id,
- msg.frame_size);
+ io = cec_ctrl->init_data.io;
+ data = DSS_REG_R(io, HDMI_CEC_RD_DATA);
- if (msg.frame_size < 1 || msg.frame_size > MAX_CEC_FRAME_SIZE) {
+ msg->recvr_id = (data & 0x000F);
+ msg->sender_id = (data & 0x00F0) >> 4;
+ msg->frame_size = (data & 0x1F00) >> 8;
+ if (msg->frame_size < 1 || msg->frame_size > MAX_CEC_FRAME_SIZE) {
DEV_ERR("%s: invalid message (frame length = %d)\n",
- __func__, msg.frame_size);
- return;
- } else if (msg.frame_size == 1) {
+ __func__, msg->frame_size);
+ return -EINVAL;
+ } else if (msg->frame_size == 1) {
DEV_DBG("%s: polling message (dest[%x] <- init[%x])\n",
- __func__, msg.recvr_id, msg.sender_id);
- return;
+ __func__, msg->recvr_id, msg->sender_id);
+ return -EINVAL;
}
/* data block 0 : opcode */
data = DSS_REG_R_ND(io, HDMI_CEC_RD_DATA);
- msg.opcode = data & 0xFF;
+ msg->opcode = data & 0xFF;
/* data block 1-14 : operand 0-13 */
- for (i = 0; i < msg.frame_size - 2; i++) {
+ for (i = 0; i < msg->frame_size - 2; i++) {
data = DSS_REG_R_ND(io, HDMI_CEC_RD_DATA);
- msg.operand[i] = data & 0xFF;
+ msg->operand[i] = data & 0xFF;
}
for (; i < MAX_OPERAND_SIZE; i++)
- msg.operand[i] = 0;
+ msg->operand[i] = 0;
+
+ /*
+ * Clearing the logical address is used when the system doesn't
+ * need to process CEC command any more.
+ */
+ if (cec_ctrl->cec_clear_logical_addr)
+ return -EINVAL;
+
+ /* Update head */
+ smp_store_release(&cec_ctrl->head, (head + 1) & CEC_RECV_Q_MASK);
DEV_DBG("%s: opcode 0x%x, wakup_en %d, device_suspend %d\n", __func__,
- msg.opcode, cec_ctrl->cec_wakeup_en,
+ msg->opcode, cec_ctrl->cec_wakeup_en,
cec_ctrl->cec_device_suspend);
- if ((msg.opcode == CEC_OP_SET_STREAM_PATH ||
- msg.opcode == CEC_OP_KEY_PRESS) &&
- cec_ctrl->input && cec_ctrl->cec_wakeup_en &&
- cec_ctrl->cec_device_suspend) {
- DEV_DBG("%s: Sending power on at wakeup\n", __func__);
- input_report_key(cec_ctrl->input, KEY_POWER, 1);
- input_sync(cec_ctrl->input);
- input_report_key(cec_ctrl->input, KEY_POWER, 0);
- input_sync(cec_ctrl->input);
- }
-
- if ((msg.opcode == CEC_OP_STANDBY) &&
- cec_ctrl->input && cec_ctrl->cec_wakeup_en &&
- !cec_ctrl->cec_device_suspend) {
- DEV_DBG("%s: Sending power off on standby\n", __func__);
- input_report_key(cec_ctrl->input, KEY_POWER, 1);
- input_sync(cec_ctrl->input);
- input_report_key(cec_ctrl->input, KEY_POWER, 0);
- input_sync(cec_ctrl->input);
- }
-
- if (cbs && cbs->msg_recv_notify)
- cbs->msg_recv_notify(cbs->data, &msg);
+ return 0;
+}
+
+static void hdmi_cec_msg_recv(struct work_struct *work)
+{
+ struct hdmi_cec_ctrl *cec_ctrl = NULL;
+ struct cec_msg msg;
+ struct cec_cbs *cbs;
+ u32 head;
+ u32 tail;
+
+ cec_ctrl = container_of(work, struct hdmi_cec_ctrl, cec_read_work);
+ if (!cec_ctrl || !cec_ctrl->init_data.io) {
+ DEV_ERR("%s: invalid input\n", __func__);
+ return;
+ }
+
+ cbs = cec_ctrl->init_data.cbs;
+
+ /* Read head before reading contents */
+ head = smp_load_acquire(&cec_ctrl->head);
+ tail = cec_ctrl->tail;
+ while (CIRC_CNT(head, tail, CEC_RECV_Q_SIZE) >= 1) {
+ memcpy(&msg, &cec_ctrl->recv_msg[tail], sizeof(msg));
+ tail = (tail + 1) & CEC_RECV_Q_MASK;
+
+ /* Finishing reading before incrementing tail */
+ smp_store_release(&cec_ctrl->tail, tail);
+
+ if ((msg.opcode == CEC_OP_SET_STREAM_PATH ||
+ msg.opcode == CEC_OP_KEY_PRESS) &&
+ cec_ctrl->input && cec_ctrl->cec_wakeup_en &&
+ cec_ctrl->cec_device_suspend) {
+ DEV_DBG("%s: Sending power on at wakeup\n", __func__);
+ input_report_key(cec_ctrl->input, KEY_POWER, 1);
+ input_sync(cec_ctrl->input);
+ input_report_key(cec_ctrl->input, KEY_POWER, 0);
+ input_sync(cec_ctrl->input);
+ }
+
+ if ((msg.opcode == CEC_OP_STANDBY) &&
+ cec_ctrl->input && cec_ctrl->cec_wakeup_en &&
+ !cec_ctrl->cec_device_suspend) {
+ DEV_DBG("%s: Sending power off on standby\n", __func__);
+ input_report_key(cec_ctrl->input, KEY_POWER, 1);
+ input_sync(cec_ctrl->input);
+ input_report_key(cec_ctrl->input, KEY_POWER, 0);
+ input_sync(cec_ctrl->input);
+ }
+
+ if (cbs && cbs->msg_recv_notify)
+ cbs->msg_recv_notify(cbs->data, &msg);
+ }
}
/**
@@ -296,6 +356,9 @@ int hdmi_cec_isr(void *input)
if ((cec_intr & BIT(2)) && (cec_intr & BIT(3))) {
DEV_DBG("%s: CEC_IRQ_FRAME_ERROR\n", __func__);
DSS_REG_W(io, HDMI_CEC_INT, cec_intr | BIT(2));
+ /* toggle cec in order to flush out bad hw state, if any */
+ DSS_REG_W(io, HDMI_CEC_CTRL, 0);
+ DSS_REG_W(io, HDMI_CEC_CTRL, BIT(0));
spin_lock_irqsave(&cec_ctrl->lock, flags);
cec_ctrl->cec_msg_wr_status |= CEC_STATUS_WR_ERROR;
@@ -308,8 +371,12 @@ int hdmi_cec_isr(void *input)
if ((cec_intr & BIT(6)) && (cec_intr & BIT(7))) {
DEV_DBG("%s: CEC_IRQ_FRAME_RD_DONE\n", __func__);
+ rc = hdmi_cec_msg_read(cec_ctrl);
+ if (!rc)
+ queue_work(cec_ctrl->init_data.workq,
+ &cec_ctrl->cec_read_work);
+
DSS_REG_W(io, HDMI_CEC_INT, cec_intr | BIT(6));
- queue_work(cec_ctrl->init_data.workq, &cec_ctrl->cec_read_work);
}
return rc;
@@ -360,8 +427,23 @@ static void hdmi_cec_write_logical_addr(void *input, u8 addr)
return;
}
- if (cec_ctrl->cec_enabled)
+ if (cec_ctrl->cec_enabled) {
DSS_REG_W(cec_ctrl->init_data.io, HDMI_CEC_ADDR, addr & 0xF);
+ cec_ctrl->cec_logical_addr = addr & 0xF;
+ }
+}
+
+static void hdmi_cec_clear_logical_addr(void *input, bool clear_flag)
+{
+ struct hdmi_cec_ctrl *cec_ctrl = (struct hdmi_cec_ctrl *)input;
+
+ if (!cec_ctrl || !cec_ctrl->init_data.io) {
+ DEV_ERR("%s: Invalid input\n", __func__);
+ return;
+ }
+
+ if (cec_ctrl->cec_enabled)
+ cec_ctrl->cec_clear_logical_addr = clear_flag;
}
static int hdmi_cec_enable(void *input, bool enable)
@@ -474,6 +556,7 @@ void *hdmi_cec_init(struct hdmi_cec_init_data *init_data)
/* populate hardware specific operations to client */
ops->send_msg = hdmi_cec_msg_send;
ops->wt_logical_addr = hdmi_cec_write_logical_addr;
+ ops->clear_logical_addr = hdmi_cec_clear_logical_addr;
ops->enable = hdmi_cec_enable;
ops->data = cec_ctrl;
ops->wakeup_en = hdmi_cec_wakeup_en;
diff --git a/drivers/video/fbdev/msm/mdss_hdmi_edid.c b/drivers/video/fbdev/msm/mdss_hdmi_edid.c
index 0c04fd35c0d5..6f0234500d70 100644
--- a/drivers/video/fbdev/msm/mdss_hdmi_edid.c
+++ b/drivers/video/fbdev/msm/mdss_hdmi_edid.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2017,2019-2020, 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,6 +51,9 @@
/* Support for first 5 EDID blocks */
#define MAX_EDID_SIZE (EDID_BLOCK_SIZE * MAX_EDID_BLOCKS)
+/* Max refresh rate supported in Hz */
+#define MAX_REFRESH_RATE_SUPPORTED 60
+
#define BUFF_SIZE_3D 128
#define DTD_MAX 0x04
@@ -89,6 +92,7 @@ enum extended_data_block_types {
VIDEO_CAPABILITY_DATA_BLOCK = 0x0,
VENDOR_SPECIFIC_VIDEO_DATA_BLOCK = 0x01,
HDMI_VIDEO_DATA_BLOCK = 0x04,
+ COLORIMETRY_DATA_BLOCK = 0x05,
HDR_STATIC_METADATA_DATA_BLOCK = 0x06,
Y420_VIDEO_DATA_BLOCK = 0x0E,
VIDEO_FORMAT_PREFERENCE_DATA_BLOCK = 0x0D,
@@ -122,6 +126,16 @@ struct hdmi_edid_sink_caps {
bool ind_view_support;
};
+struct hdmi_edid_y420_cmdb {
+ u8 *vic_list;
+ u32 len;
+};
+
+struct hdmi_edid_colorimetry {
+ u8 standards;
+ u8 metadata_profiles;
+};
+
struct hdmi_edid_ctrl {
u8 pt_scan_info;
u8 it_scan_info;
@@ -147,12 +161,18 @@ struct hdmi_edid_ctrl {
bool keep_resv_timings;
bool edid_override;
bool hdr_supported;
+ bool override_default_vic;
+
+ bool y420_cmdb_present;
+ bool y420_cmdb_supports_all;
+ struct hdmi_edid_y420_cmdb y420_cmdb;
struct hdmi_edid_sink_data sink_data;
struct hdmi_edid_init_data init_data;
struct hdmi_edid_sink_caps sink_caps;
struct hdmi_edid_override_data override_data;
struct hdmi_edid_hdr_data hdr_data;
+ struct hdmi_edid_colorimetry colorimetry;
};
static bool hdmi_edid_is_mode_supported(struct hdmi_edid_ctrl *edid_ctrl,
@@ -172,8 +192,10 @@ static bool hdmi_edid_is_mode_supported(struct hdmi_edid_ctrl *edid_ctrl,
return true;
}
-static int hdmi_edid_reset_parser(struct hdmi_edid_ctrl *edid_ctrl)
+int hdmi_edid_reset_parser(void *input)
{
+ struct hdmi_edid_ctrl *edid_ctrl = (struct hdmi_edid_ctrl *)input;
+
if (!edid_ctrl) {
DEV_ERR("%s: invalid input\n", __func__);
return -EINVAL;
@@ -187,6 +209,9 @@ static int hdmi_edid_reset_parser(struct hdmi_edid_ctrl *edid_ctrl)
edid_ctrl->sink_data.num_of_elements = 0;
+ /* reset deep color */
+ edid_ctrl->deep_color = 0;
+
/* reset scan info data */
edid_ctrl->pt_scan_info = 0;
edid_ctrl->it_scan_info = 0;
@@ -200,6 +225,7 @@ static int hdmi_edid_reset_parser(struct hdmi_edid_ctrl *edid_ctrl)
/* reset resolution related sink data */
memset(&edid_ctrl->sink_data, 0, sizeof(edid_ctrl->sink_data));
+ memset(&edid_ctrl->sink_caps, 0, sizeof(edid_ctrl->sink_caps));
/* reset audio related data */
memset(edid_ctrl->audio_data_block, 0,
@@ -224,6 +250,10 @@ static int hdmi_edid_reset_parser(struct hdmi_edid_ctrl *edid_ctrl)
edid_ctrl->hdr_data.avg_luminance = 0;
edid_ctrl->hdr_data.min_luminance = 0;
+ edid_ctrl->y420_cmdb_present = false;
+ edid_ctrl->y420_cmdb_supports_all = false;
+ kfree(edid_ctrl->y420_cmdb.vic_list);
+ memset(&edid_ctrl->y420_cmdb, 0, sizeof(edid_ctrl->y420_cmdb));
return 0;
}
@@ -915,28 +945,6 @@ static const u8 *hdmi_edid_find_hfvsdb(const u8 *in_buf)
return vsd;
}
-static void hdmi_edid_set_y420_support(struct hdmi_edid_ctrl *edid_ctrl,
- u32 video_format)
-{
- u32 i = 0;
-
- if (!edid_ctrl) {
- DEV_ERR("%s: Invalid input\n", __func__);
- return;
- }
-
- for (i = 0; i < edid_ctrl->sink_data.num_of_elements; ++i) {
- if (video_format ==
- edid_ctrl->sink_data.disp_mode_list[i].video_format) {
- edid_ctrl->sink_data.disp_mode_list[i].y420_support =
- true;
- DEV_DBG("%s: Yuv420 supported for format %d\n",
- __func__,
- edid_ctrl->sink_data.disp_mode_list[i].video_format);
- }
- }
-}
-
static void hdmi_edid_add_sink_y420_format(struct hdmi_edid_ctrl *edid_ctrl,
u32 video_format)
{
@@ -963,6 +971,17 @@ static void hdmi_edid_add_sink_y420_format(struct hdmi_edid_ctrl *edid_ctrl,
video_format, msm_hdmi_mode_2string(video_format),
supported ? "Supported" : "Not-Supported");
+ /* override the default resolution */
+ if (edid_ctrl->override_default_vic) {
+ if (!ret && supported) {
+ sink->disp_mode_list[0].video_format = video_format;
+ sink->disp_mode_list[0].y420_support = true;
+ sink->disp_mode_list[0].rgb_support = false;
+ edid_ctrl->override_default_vic = false;
+ return;
+ }
+ }
+
if (!ret && supported) {
sink->disp_mode_list[sink->num_of_elements].video_format
= video_format;
@@ -1039,10 +1058,12 @@ static void hdmi_edid_parse_Y420CMDB(struct hdmi_edid_ctrl *edid_ctrl,
{
u32 offset = 0;
u8 svd_len = 0;
- u32 i = 0, j = 0;
+ u32 i = 0, j = 0, k = 0;
u32 video_format = 0;
u32 len = 0;
const u8 *svd = NULL;
+ struct hdmi_edid_y420_cmdb *y420_cmdb = NULL;
+
if (!edid_ctrl) {
DEV_ERR("%s: invalid input\n", __func__);
@@ -1053,6 +1074,18 @@ static void hdmi_edid_parse_Y420CMDB(struct hdmi_edid_ctrl *edid_ctrl,
len = in_buf[0] & 0x1F;
/*
+ * When the Length field is set to L==1, the Y420CMDB does not include
+ * a YCBCR 4:2:0 Capability Bit Map and all the SVDs in the regular
+ * Video Data Block support YCBCR 4:2:0 sampling mode.
+ */
+ if (len == 1) {
+ DEV_DBG("%s: All SVDs supports Y420 sampling mode, len = %d\n",
+ __func__, len);
+ edid_ctrl->y420_cmdb_supports_all = true;
+ return;
+ }
+
+ /*
* The Y420 Capability map data block should be parsed along with the
* video data block. Each bit in Y420CMDB maps to each SVD in data
* block
@@ -1060,16 +1093,33 @@ static void hdmi_edid_parse_Y420CMDB(struct hdmi_edid_ctrl *edid_ctrl,
svd = hdmi_edid_find_block(edid_ctrl->edid_buf+0x80, DBC_START_OFFSET,
VIDEO_DATA_BLOCK, &svd_len);
+ if (!svd_len)
+ return;
+
+ y420_cmdb = &edid_ctrl->y420_cmdb;
+ y420_cmdb->vic_list = kzalloc(svd_len, GFP_KERNEL);
+ if (!y420_cmdb->vic_list) {
+ DEV_ERR("%s: failed to allocated memory for y420 vic_list\n",
+ __func__);
+ return;
+ }
+
++svd;
- for (i = 0; i < svd_len; i++, j++) {
+
+ for (i = 0, k = 0; i < svd_len; i++, svd++) {
video_format = *svd & 0x7F;
- if (in_buf[offset] & (1 << j))
- hdmi_edid_set_y420_support(edid_ctrl, video_format);
+ if (in_buf[offset] & (1 << j)) {
+ y420_cmdb->vic_list[k++] = video_format;
+ DEV_DBG("%s: Y420 capability for VIC %d\n",
+ __func__, video_format);
+ y420_cmdb->len++;
+ }
- if (j & 0x80) {
- j = j/8;
+ j++;
+ if (j & 0x8) {
+ j = 0;
offset++;
- if (offset >= len)
+ if (offset >= len + 1)
break;
}
}
@@ -1104,6 +1154,26 @@ static void hdmi_edid_parse_hvdb(struct hdmi_edid_ctrl *edid_ctrl,
}
+static void hdmi_edid_parse_colorimetry(
+ struct hdmi_edid_ctrl *edid_ctrl, const u8 *in_buf)
+{
+ u8 len = 0;
+
+ if (!edid_ctrl) {
+ DEV_ERR("%s: invalid input\n", __func__);
+ return;
+ }
+
+ len = in_buf[0] & 0x1F;
+ if ((in_buf[1] != COLORIMETRY_DATA_BLOCK) || (len < 3)) {
+ DEV_ERR("%s: Not a Colorimetry tag code\n", __func__);
+ return;
+ }
+
+ edid_ctrl->colorimetry.standards = in_buf[2];
+ edid_ctrl->colorimetry.metadata_profiles = in_buf[3];
+}
+
static void hdmi_edid_extract_extended_data_blocks(
struct hdmi_edid_ctrl *edid_ctrl, const u8 *in_buf)
{
@@ -1130,8 +1200,8 @@ static void hdmi_edid_extract_extended_data_blocks(
break;
}
- /* The extended data block should at least be 2 bytes long */
- if (len < 2) {
+ /* The extended data block should at least be 1 bytes long */
+ if (len < 1) {
DEV_DBG("%s: invalid block size\n", __func__);
continue;
}
@@ -1173,6 +1243,7 @@ static void hdmi_edid_extract_extended_data_blocks(
case Y420_CAPABILITY_MAP_DATA_BLOCK:
DEV_DBG("%s found Y420CMDB byte 3 = 0x%x",
__func__, etag[2]);
+ edid_ctrl->y420_cmdb_present = true;
hdmi_edid_parse_Y420CMDB(edid_ctrl, etag);
break;
case Y420_VIDEO_DATA_BLOCK:
@@ -1186,6 +1257,11 @@ static void hdmi_edid_extract_extended_data_blocks(
hdmi_edid_parse_hdrdb(edid_ctrl, etag);
edid_ctrl->hdr_supported = true;
break;
+ case COLORIMETRY_DATA_BLOCK:
+ DEV_DBG("%s found COLORIMETRY block. byte 3 = 0x%x",
+ __func__, etag[2]);
+ hdmi_edid_parse_colorimetry(edid_ctrl, etag);
+ break;
default:
DEV_DBG("%s: Tag Code %d not supported\n",
__func__, etag[1]);
@@ -1216,6 +1292,9 @@ static void hdmi_edid_extract_3d_present(struct hdmi_edid_ctrl *edid_ctrl,
}
offset = HDMI_VSDB_3D_EVF_DATA_OFFSET(vsd);
+ if (offset >= len - 1)
+ return;
+
DEV_DBG("%s: EDID: 3D present @ 0x%x = %02x\n", __func__,
offset, vsd[offset]);
@@ -1331,7 +1410,10 @@ static void hdmi_edid_extract_sink_caps(struct hdmi_edid_ctrl *edid_ctrl,
return;
/* Max TMDS clock is in multiples of 5Mhz. */
- edid_ctrl->sink_caps.max_pclk_in_hz = vsd[7] * 5000000;
+ if (len >= 7 && vsd[7]) {
+ edid_ctrl->sink_caps.max_pclk_in_hz = vsd[7] * 5000000;
+ DEV_DBG("%s: MaxTMDS=%dMHz\n", __func__, (u32)vsd[7] * 5);
+ }
vsd = hdmi_edid_find_hfvsdb(in_buf);
@@ -1344,9 +1426,13 @@ static void hdmi_edid_extract_sink_caps(struct hdmi_edid_ctrl *edid_ctrl,
* the sink shall set this filed to 0. The max TMDS support
* clock Rate = Max_TMDS_Character_Rates * 5Mhz.
*/
- if (vsd[5] != 0)
+ if (vsd[5] != 0) {
edid_ctrl->sink_caps.max_pclk_in_hz =
vsd[5] * 5000000;
+ DEV_DBG("%s: HF-VSDB: MaxTMDS=%dMHz\n",
+ __func__, (u32)vsd[5] * 5);
+ }
+
edid_ctrl->sink_caps.scdc_present =
(vsd[6] & 0x80) ? true : false;
edid_ctrl->sink_caps.scramble_support =
@@ -1376,8 +1462,19 @@ static void hdmi_edid_extract_latency_fields(struct hdmi_edid_ctrl *edid_ctrl,
vsd = hdmi_edid_find_block(in_buf, DBC_START_OFFSET,
VENDOR_SPECIFIC_DATA_BLOCK, &len);
- if (vsd == NULL || len == 0 || len > MAX_DATA_BLOCK_SIZE ||
- !(vsd[8] & BIT(7))) {
+ if (vsd == NULL || len == 0 || len > MAX_DATA_BLOCK_SIZE) {
+ DEV_DBG("%s: No/Invalid vendor Specific Data Block\n",
+ __func__);
+ return;
+ }
+
+ if (len < 8) {
+ DEV_DBG("%s: No extra Vendor Specific information present\n",
+ __func__);
+ return;
+ }
+
+ if (!(vsd[8] & BIT(7))) {
edid_ctrl->video_latency = (u16)-1;
edid_ctrl->audio_latency = (u16)-1;
DEV_DBG("%s: EDID: No audio/video latency present\n", __func__);
@@ -1410,8 +1507,8 @@ static u32 hdmi_edid_extract_ieee_reg_id(struct hdmi_edid_ctrl *edid_ctrl,
return 0;
}
- DEV_DBG("%s: EDID: VSD PhyAddr=%04x, MaxTMDS=%dMHz\n", __func__,
- ((u32)vsd[4] << 8) + (u32)vsd[5], (u32)vsd[7] * 5);
+ DEV_DBG("%s: EDID: VSD PhyAddr=%04x\n", __func__,
+ ((u32)vsd[4] << 8) + (u32)vsd[5]);
edid_ctrl->physical_address = ((u16)vsd[4] << 8) + (u16)vsd[5];
@@ -1455,7 +1552,9 @@ static void hdmi_edid_extract_dc(struct hdmi_edid_ctrl *edid_ctrl,
if (vsd == NULL || len == 0 || len > MAX_DATA_BLOCK_SIZE)
return;
- edid_ctrl->deep_color = (vsd[6] >> 0x3) & 0xF;
+ edid_ctrl->deep_color = 0;
+ if (len >= 6)
+ edid_ctrl->deep_color = (vsd[6] >> 0x3) & 0xF;
vsd = hdmi_edid_find_hfvsdb(in_buf);
@@ -1650,7 +1749,12 @@ static void hdmi_edid_detail_desc(struct hdmi_edid_ctrl *edid_ctrl,
timing.pixel_freq = pixel_clk;
timing.refresh_rate = refresh_rate;
timing.interlaced = interlaced;
- timing.supported = true;
+ if (!interlaced)
+ timing.supported = true;
+
+ if (refresh_rate > (MAX_REFRESH_RATE_SUPPORTED * khz_to_hz))
+ timing.supported = false;
+
timing.ar = aspect_ratio_4_3 ? HDMI_RES_AR_4_3 :
(aspect_ratio_5_4 ? HDMI_RES_AR_5_4 :
HDMI_RES_AR_16_9);
@@ -1718,6 +1822,7 @@ static void hdmi_edid_add_sink_video_format(struct hdmi_edid_ctrl *edid_ctrl,
struct hdmi_edid_sink_data *sink_data = &edid_ctrl->sink_data;
struct disp_mode_info *disp_mode_list = sink_data->disp_mode_list;
u32 i = 0;
+ bool y420_supported = false;
if (video_format >= HDMI_VFRMT_MAX) {
DEV_ERR("%s: video format: %s is not supported\n", __func__,
@@ -1729,21 +1834,56 @@ static void hdmi_edid_add_sink_video_format(struct hdmi_edid_ctrl *edid_ctrl,
video_format, msm_hdmi_mode_2string(video_format),
supported ? "Supported" : "Not-Supported");
+ if (edid_ctrl->y420_cmdb_present && video_format < HDMI_VFRMT_END) {
+ if (edid_ctrl->y420_cmdb_supports_all) {
+ y420_supported = true;
+ goto done;
+ }
+
+ for (i = 0; i < edid_ctrl->y420_cmdb.len; i++) {
+ if (video_format == edid_ctrl->y420_cmdb.vic_list[i]) {
+ y420_supported = true;
+ break;
+ }
+ }
+ }
+
+done:
+ /* override the default resolution */
+ if (edid_ctrl->override_default_vic) {
+ if (!ret && supported) {
+ disp_mode_list[0].video_format = video_format;
+ disp_mode_list[0].rgb_support = true;
+ if (y420_supported)
+ disp_mode_list[0].y420_support = true;
+ edid_ctrl->override_default_vic = false;
+ return;
+ }
+ }
+
for (i = 0; i < sink_data->num_of_elements; i++) {
u32 vic = disp_mode_list[i].video_format;
if (vic == video_format) {
DEV_DBG("%s: vic %d already added\n", __func__, vic);
+ if (supported)
+ disp_mode_list[i].rgb_support = true;
+ if (y420_supported)
+ disp_mode_list[i].y420_support = true;
return;
}
}
- if (!ret && supported) {
+ if (!ret && (supported || y420_supported)) {
/* todo: MHL */
disp_mode_list[sink_data->num_of_elements].video_format =
video_format;
- disp_mode_list[sink_data->num_of_elements].rgb_support =
- true;
+ if (supported)
+ disp_mode_list[sink_data->num_of_elements].
+ rgb_support = true;
+ if (y420_supported)
+ disp_mode_list[sink_data->num_of_elements].
+ y420_support = true;
sink_data->num_of_elements++;
}
} /* hdmi_edid_add_sink_video_format */
@@ -1914,6 +2054,12 @@ static void hdmi_edid_get_extended_video_formats(
return;
}
+ if (db_len < 8) {
+ DEV_DBG("%s: No extra Vendor Specific information present\n",
+ __func__);
+ return;
+ }
+
/* check if HDMI_Video_present flag is set or not */
if (!(vsd[8] & BIT(5))) {
DEV_DBG("%s: extended vfmts are not supported by the sink.\n",
@@ -2289,6 +2435,9 @@ int hdmi_edid_parser(void *input)
u16 ieee_reg_id;
int status = 0;
u32 i = 0;
+ u32 cea_idx = 1;
+ u32 sink_caps_pclk_khz = 0;
+ u32 max_pclk_khz = 0;
struct hdmi_edid_ctrl *edid_ctrl = (struct hdmi_edid_ctrl *)input;
if (!edid_ctrl) {
@@ -2298,7 +2447,7 @@ int hdmi_edid_parser(void *input)
}
/* reset edid data for new hdmi connection */
- hdmi_edid_reset_parser(edid_ctrl);
+ hdmi_edid_reset_parser(input);
edid_buf = edid_ctrl->edid_buf;
@@ -2315,7 +2464,7 @@ int hdmi_edid_parser(void *input)
/* EDID_CEA_EXTENSION_FLAG[0x7E] - CEC extension byte */
num_of_cea_blocks = edid_buf[EDID_BLOCK_SIZE - 2];
- DEV_DBG("%s: No. of CEA blocks is [%u]\n", __func__,
+ DEV_DBG("%s: No. of CEA/Extended EDID blocks is [%u]\n", __func__,
num_of_cea_blocks);
/* Find out any CEA extension blocks following block 0 */
@@ -2334,30 +2483,42 @@ int hdmi_edid_parser(void *input)
num_of_cea_blocks = MAX_EDID_BLOCKS - 1;
}
- /* check for valid CEA block */
- if (edid_buf[EDID_BLOCK_SIZE] != 2) {
- DEV_ERR("%s: Invalid CEA block\n", __func__);
- num_of_cea_blocks = 0;
- goto bail;
+ if (edid_buf[EDID_BLOCK_SIZE] == 0xF0) {
+ DEV_DBG("%s: Extended EDID Block Map found\n", __func__);
+ edid_buf += EDID_BLOCK_SIZE;
+ cea_idx++;
}
- /* goto to CEA extension edid block */
- edid_buf += EDID_BLOCK_SIZE;
+ for (i = cea_idx; i <= num_of_cea_blocks; i++) {
- ieee_reg_id = hdmi_edid_extract_ieee_reg_id(edid_ctrl, edid_buf);
- DEV_DBG("%s: ieee_reg_id = 0x%08x\n", __func__, ieee_reg_id);
- if (ieee_reg_id == EDID_IEEE_REG_ID)
- edid_ctrl->sink_mode = SINK_MODE_HDMI;
- else
- edid_ctrl->sink_mode = SINK_MODE_DVI;
+ /* check for valid CEA block */
+ if (edid_buf[EDID_BLOCK_SIZE] != 2) {
+ DEV_ERR("%s: Not a CEA block\n", __func__);
+ edid_buf += EDID_BLOCK_SIZE;
+ continue;
+ }
- hdmi_edid_extract_sink_caps(edid_ctrl, edid_buf);
- hdmi_edid_extract_latency_fields(edid_ctrl, edid_buf);
- hdmi_edid_extract_dc(edid_ctrl, edid_buf);
- hdmi_edid_extract_speaker_allocation_data(edid_ctrl, edid_buf);
- hdmi_edid_extract_audio_data_blocks(edid_ctrl, edid_buf);
- hdmi_edid_extract_3d_present(edid_ctrl, edid_buf);
- hdmi_edid_extract_extended_data_blocks(edid_ctrl, edid_buf);
+ /* goto to CEA extension edid block */
+ edid_buf += EDID_BLOCK_SIZE;
+
+ ieee_reg_id = hdmi_edid_extract_ieee_reg_id(edid_ctrl,
+ edid_buf);
+ DEV_DBG("%s: ieee_reg_id = 0x%06x\n", __func__, ieee_reg_id);
+ if (ieee_reg_id == EDID_IEEE_REG_ID)
+ edid_ctrl->sink_mode = SINK_MODE_HDMI;
+ else
+ edid_ctrl->sink_mode = SINK_MODE_DVI;
+
+ if (ieee_reg_id == EDID_IEEE_REG_ID) {
+ hdmi_edid_extract_sink_caps(edid_ctrl, edid_buf);
+ hdmi_edid_extract_latency_fields(edid_ctrl, edid_buf);
+ hdmi_edid_extract_dc(edid_ctrl, edid_buf);
+ hdmi_edid_extract_3d_present(edid_ctrl, edid_buf);
+ }
+ hdmi_edid_extract_speaker_allocation_data(edid_ctrl, edid_buf);
+ hdmi_edid_extract_audio_data_blocks(edid_ctrl, edid_buf);
+ hdmi_edid_extract_extended_data_blocks(edid_ctrl, edid_buf);
+ }
bail:
for (i = 1; i <= num_of_cea_blocks; i++) {
@@ -2369,6 +2530,13 @@ bail:
edid_ctrl->cea_blks = num_of_cea_blocks;
+ sink_caps_pclk_khz =
+ hdmi_edid_get_sink_caps_max_tmds_clk(edid_ctrl) / 1000;
+ max_pclk_khz = hdmi_edid_get_max_pclk(edid_ctrl);
+ if (sink_caps_pclk_khz && max_pclk_khz)
+ hdmi_edid_set_max_pclk_rate(edid_ctrl,
+ min(max_pclk_khz, sink_caps_pclk_khz));
+
hdmi_edid_get_display_mode(edid_ctrl);
if (edid_ctrl->keep_resv_timings)
@@ -2561,6 +2729,18 @@ void hdmi_edid_get_hdr_data(void *input,
*hdr_data = &edid_ctrl->hdr_data;
}
+u8 hdmi_edid_get_colorimetry(void *input)
+{
+ struct hdmi_edid_ctrl *edid_ctrl = (struct hdmi_edid_ctrl *)input;
+
+ if (!edid_ctrl) {
+ DEV_ERR("%s: invalid input\n", __func__);
+ return 0;
+ }
+
+ return edid_ctrl->colorimetry.standards;
+}
+
bool hdmi_edid_is_s3d_mode_supported(void *input, u32 video_mode, u32 s3d_mode)
{
int i;
@@ -2687,6 +2867,7 @@ void hdmi_edid_set_video_resolution(void *input, u32 resolution, bool reset)
edid_ctrl->sink_data.disp_mode_list[0].video_format =
resolution;
edid_ctrl->sink_data.disp_mode_list[0].rgb_support = true;
+ edid_ctrl->override_default_vic = true;
}
} /* hdmi_edid_set_video_resolution */
diff --git a/drivers/video/fbdev/msm/mdss_hdmi_edid.h b/drivers/video/fbdev/msm/mdss_hdmi_edid.h
index 63785e95bd59..d258aa9f95bc 100644
--- a/drivers/video/fbdev/msm/mdss_hdmi_edid.h
+++ b/drivers/video/fbdev/msm/mdss_hdmi_edid.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2017,2019-2020, 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
@@ -20,6 +20,15 @@
#define EDID_BLOCK_ADDR 0xA0
#define MAX_EDID_BLOCKS 5
+#define EDID_COLORIMETRY_xvYCC_601 (1 << 0)
+#define EDID_COLORIMETRY_xvYCC_709 (1 << 1)
+#define EDID_COLORIMETRY_sYCC_601 (1 << 2)
+#define EDID_COLORIMETRY_ADBYCC_601 (1 << 3)
+#define EDID_COLORIMETRY_ADB_RGB (1 << 4)
+#define EDID_COLORIMETRY_BT2020_CYCC (1 << 5)
+#define EDID_COLORIMETRY_BT2020_YCC (1 << 6)
+#define EDID_COLORIMETRY_BT2020_RGB (1 << 7)
+
struct hdmi_edid_init_data {
struct kobject *kobj;
struct hdmi_util_ds_data ds_data;
@@ -60,6 +69,7 @@ struct hdmi_edid_override_data {
};
int hdmi_edid_parser(void *edid_ctrl);
+int hdmi_edid_reset_parser(void *edid_ctrl);
u32 hdmi_edid_get_raw_data(void *edid_ctrl, u8 *buf, u32 size);
u8 hdmi_edid_get_sink_scaninfo(void *edid_ctrl, u32 resolution);
bool hdmi_edid_is_dvi_mode(void *input);
@@ -83,5 +93,6 @@ void hdmi_edid_config_override(void *input, bool enable,
void hdmi_edid_set_max_pclk_rate(void *input, u32 max_pclk_khz);
bool hdmi_edid_is_audio_supported(void *input);
u32 hdmi_edid_get_sink_caps_max_tmds_clk(void *input);
+u8 hdmi_edid_get_colorimetry(void *input);
#endif /* __HDMI_EDID_H__ */
diff --git a/drivers/video/fbdev/msm/mdss_hdmi_hdcp2p2.c b/drivers/video/fbdev/msm/mdss_hdmi_hdcp2p2.c
index 46e289b6dbd3..6399be1328e2 100644
--- a/drivers/video/fbdev/msm/mdss_hdmi_hdcp2p2.c
+++ b/drivers/video/fbdev/msm/mdss_hdmi_hdcp2p2.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2017,2019-2020, 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
@@ -393,31 +393,22 @@ exit:
return count;
}
-static ssize_t hdmi_hdcp2p2_sysfs_wta_min_level_change(struct device *dev,
- struct device_attribute *attr, const char *buf, size_t count)
+static void mdss_hdmi_hdcp2p2_min_level_change(void *client_ctx,
+ int min_enc_level)
{
struct hdmi_hdcp2p2_ctrl *ctrl =
- hdmi_get_featuredata_from_sysfs_dev(dev, HDMI_TX_FEAT_HDCP2P2);
+ (struct hdmi_hdcp2p2_ctrl *)client_ctx;
struct hdcp_lib_wakeup_data cdata = {
HDCP_LIB_WKUP_CMD_QUERY_STREAM_TYPE};
bool enc_notify = true;
enum hdcp_states enc_lvl;
- int min_enc_lvl;
- int rc;
if (!ctrl) {
pr_err("invalid input\n");
- rc = -EINVAL;
- goto exit;
- }
-
- rc = kstrtoint(buf, 10, &min_enc_lvl);
- if (rc) {
- DEV_ERR("%s: kstrtoint failed. rc=%d\n", __func__, rc);
- goto exit;
+ return;
}
- switch (min_enc_lvl) {
+ switch (min_enc_level) {
case 0:
enc_lvl = HDCP_STATE_AUTH_ENC_NONE;
break;
@@ -431,7 +422,7 @@ static ssize_t hdmi_hdcp2p2_sysfs_wta_min_level_change(struct device *dev,
enc_notify = false;
}
- pr_debug("enc level changed %d\n", min_enc_lvl);
+ pr_debug("enc level changed %d\n", min_enc_level);
cdata.context = ctrl->lib_ctx;
hdmi_hdcp2p2_wakeup_lib(ctrl, &cdata);
@@ -441,10 +432,6 @@ static ssize_t hdmi_hdcp2p2_sysfs_wta_min_level_change(struct device *dev,
if (enc_notify && ctrl->init_data.notify_status)
ctrl->init_data.notify_status(ctrl->init_data.cb_data, enc_lvl);
-
- rc = count;
-exit:
- return rc;
}
static void hdmi_hdcp2p2_auth_failed(struct hdmi_hdcp2p2_ctrl *ctrl)
@@ -584,13 +571,10 @@ static int hdmi_hdcp2p2_read_version(struct hdmi_hdcp2p2_ctrl *ctrl,
return rc;
}
-static DEVICE_ATTR(min_level_change, S_IWUSR, NULL,
- hdmi_hdcp2p2_sysfs_wta_min_level_change);
static DEVICE_ATTR(tethered, S_IRUGO | S_IWUSR, hdmi_hdcp2p2_sysfs_rda_tethered,
hdmi_hdcp2p2_sysfs_wta_tethered);
static struct attribute *hdmi_hdcp2p2_fs_attrs[] = {
- &dev_attr_min_level_change.attr,
&dev_attr_tethered.attr,
NULL,
};
@@ -756,6 +740,14 @@ static void hdmi_hdcp2p2_recv_msg(struct hdmi_hdcp2p2_ctrl *ctrl)
goto exit;
}
+ if (ddc_data->ddc_max_retries_fail) {
+ pr_debug("rxstatus ddc failed\n");
+
+ ddc_data->ddc_max_retries_fail = false;
+ rc = -ENOLINK;
+ goto exit;
+ }
+
if (ddc_data->reauth_req) {
ddc_data->reauth_req = false;
@@ -913,6 +905,15 @@ static void hdmi_hdcp2p2_link_work(struct kthread_work *work)
ddc_data = &ddc_ctrl->hdcp2p2_ddc_data;
+ if (ddc_data->ddc_max_retries_fail) {
+ pr_debug("rxstatus ddc failed\n");
+
+ ddc_data->ddc_max_retries_fail = false;
+ rc = -ENOLINK;
+ cdata.cmd = HDCP_LIB_WKUP_CMD_STOP;
+ goto exit;
+ }
+
if (ddc_data->reauth_req) {
pr_debug("reauth triggered by sink\n");
@@ -1030,6 +1031,7 @@ void *hdmi_hdcp2p2_init(struct hdcp_init_data *init_data)
static struct hdcp_client_ops client_ops = {
.wakeup = hdmi_hdcp2p2_wakeup,
+ .notify_lvl_change = mdss_hdmi_hdcp2p2_min_level_change,
.srm_cb = hdmi_hdcp2p2_srm_cb,
};
diff --git a/drivers/video/fbdev/msm/mdss_hdmi_panel.c b/drivers/video/fbdev/msm/mdss_hdmi_panel.c
index af72973a3988..f0447116539f 100644
--- a/drivers/video/fbdev/msm/mdss_hdmi_panel.c
+++ b/drivers/video/fbdev/msm/mdss_hdmi_panel.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2020, 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
@@ -137,12 +137,36 @@ enum {
DATA_BYTE_13,
};
+enum hdmi_colorimetry {
+ HDMI_COLORIMETRY_DEFAULT,
+ HDMI_COLORIMETRY_ITU_R_601,
+ HDMI_COLORIMETRY_ITU_R_709,
+ HDMI_COLORIMETRY_EXTENDED
+};
+
+enum hdmi_ext_colorimetry {
+ HDMI_COLORIMETRY_XV_YCC_601,
+ HDMI_COLORIMETRY_XV_YCC_709,
+ HDMI_COLORIMETRY_S_YCC_601,
+ HDMI_COLORIMETRY_ADOBE_YCC_601,
+ HDMI_COLORIMETRY_ADOBE_RGB,
+ HDMI_COLORIMETRY_C_YCBCR_BT2020,
+ HDMI_COLORIMETRY_YCBCR_BT2020,
+ HDMI_COLORIMETRY_RESERVED
+
+};
+
enum hdmi_quantization_range {
HDMI_QUANTIZATION_DEFAULT,
HDMI_QUANTIZATION_LIMITED_RANGE,
HDMI_QUANTIZATION_FULL_RANGE
};
+enum hdmi_ycc_quantization_range {
+ HDMI_YCC_QUANTIZATION_LIMITED_RANGE,
+ HDMI_YCC_QUANTIZATION_FULL_RANGE
+};
+
enum hdmi_scaling_info {
HDMI_SCALING_NONE,
HDMI_SCALING_HORZ,
@@ -189,12 +213,29 @@ static int hdmi_panel_config_avi(struct hdmi_panel *panel)
avi->bar_info.start_of_right_bar = timing->active_h + 1;
avi->act_fmt_info_present = true;
- avi->rgb_quantization_range = HDMI_QUANTIZATION_DEFAULT;
- avi->yuv_quantization_range = HDMI_QUANTIZATION_DEFAULT;
+ if (pinfo->is_ce_mode) {
+ avi->rgb_quantization_range =
+ HDMI_QUANTIZATION_LIMITED_RANGE;
+ avi->yuv_quantization_range =
+ HDMI_YCC_QUANTIZATION_LIMITED_RANGE;
+ } else {
+ avi->rgb_quantization_range =
+ HDMI_QUANTIZATION_FULL_RANGE;
+ avi->yuv_quantization_range =
+ HDMI_YCC_QUANTIZATION_FULL_RANGE;
+ }
avi->scaling_info = HDMI_SCALING_NONE;
- avi->colorimetry_info = 0;
+ if (avi->pixel_format == MDP_Y_CBCR_H2V2) {
+ if (pinfo->yres < 720)
+ avi->colorimetry_info = HDMI_COLORIMETRY_ITU_R_601;
+ else
+ avi->colorimetry_info = HDMI_COLORIMETRY_ITU_R_709;
+ } else {
+ avi->colorimetry_info = HDMI_COLORIMETRY_DEFAULT;
+ }
+
avi->ext_colorimetry_info = 0;
avi->pixel_rpt_factor = 0;
@@ -602,13 +643,29 @@ end:
return rc;
}
+static inline int get_bitdepth(enum hdmi_deep_color_depth bitdepth)
+{
+ switch (bitdepth) {
+ case HDMI_DEEP_COLOR_DEPTH_24BPP:
+ return 24;
+ case HDMI_DEEP_COLOR_DEPTH_30BPP:
+ return 30;
+ case HDMI_DEEP_COLOR_DEPTH_36BPP:
+ return 36;
+ default:
+ return 0;
+ }
+}
+
static int hdmi_panel_setup_dc(struct hdmi_panel *panel)
{
u32 hdmi_ctrl_reg;
u32 vbi_pkt_reg;
int rc = 0;
- pr_debug("Deep Color: %s\n", panel->data->dc_enable ? "ON" : "OFF");
+ pr_debug("Deep Color: %s, bitdepth = %d\n",
+ panel->data->dc_enable ? "ON" : "OFF",
+ get_bitdepth(panel->data->bitdepth));
/* enable deep color if supported */
if (panel->data->dc_enable) {
@@ -740,6 +797,15 @@ static int hdmi_panel_setup_scrambler(struct hdmi_panel *panel)
rc = hdmi_setup_ddc_timers(panel->ddc,
HDMI_TX_DDC_TIMER_SCRAMBLER_STATUS, timeout_hsync);
} else {
+ tmds_clock_ratio = 0;
+ rc = hdmi_scdc_write(panel->ddc,
+ HDMI_TX_SCDC_TMDS_BIT_CLOCK_RATIO_UPDATE,
+ tmds_clock_ratio);
+ if (rc) {
+ pr_err("TMDS CLK RATIO ERR\n");
+ return rc;
+ }
+
hdmi_scdc_write(panel->ddc,
HDMI_TX_SCDC_SCRAMBLING_ENABLE, 0x0);
@@ -789,6 +855,53 @@ end:
return panel->vic;
}
+static int hdmi_panel_avi_update_colorimetry(void *input,
+ bool use_bt2020)
+{
+ struct hdmi_panel *panel = input;
+ struct mdss_panel_info *pinfo;
+ struct hdmi_video_config *vid_cfg;
+ struct hdmi_avi_infoframe_config *avi;
+ int rc = 0;
+
+ if (!panel) {
+ DEV_ERR("%s: invalid hdmi panel\n", __func__);
+ rc = -EINVAL;
+ goto error;
+ }
+
+ /* Configure AVI infoframe */
+ rc = hdmi_panel_config_avi(panel);
+ if (rc) {
+ DEV_ERR("%s: failed to configure AVI\n", __func__);
+ goto error;
+ }
+
+ pinfo = panel->data->pinfo;
+ vid_cfg = &panel->vid_cfg;
+ avi = &vid_cfg->avi_iframe;
+
+ /* Update Colorimetry */
+ avi->ext_colorimetry_info = 0;
+
+ if (use_bt2020) {
+ avi->colorimetry_info = HDMI_COLORIMETRY_EXTENDED;
+ avi->ext_colorimetry_info = HDMI_COLORIMETRY_YCBCR_BT2020;
+ } else if (avi->pixel_format == MDP_Y_CBCR_H2V2) {
+ if (pinfo->yres < 720)
+ avi->colorimetry_info = HDMI_COLORIMETRY_ITU_R_601;
+ else
+ avi->colorimetry_info = HDMI_COLORIMETRY_ITU_R_709;
+ } else {
+ avi->colorimetry_info = HDMI_COLORIMETRY_DEFAULT;
+ }
+
+ hdmi_panel_set_avi_infoframe(panel);
+
+error:
+ return rc;
+}
+
static int hdmi_panel_power_on(void *input)
{
int rc = 0;
@@ -915,6 +1028,8 @@ void *hdmi_panel_init(struct hdmi_panel_init_data *data)
data->ops->off = hdmi_panel_power_off;
data->ops->vendor = hdmi_panel_set_vendor_specific_infoframe;
data->ops->update_fps = hdmi_panel_update_fps;
+ data->ops->update_colorimetry =
+ hdmi_panel_avi_update_colorimetry;
}
end:
return panel;
diff --git a/drivers/video/fbdev/msm/mdss_hdmi_panel.h b/drivers/video/fbdev/msm/mdss_hdmi_panel.h
index cb40f0cad55e..04cd971e2db0 100644
--- a/drivers/video/fbdev/msm/mdss_hdmi_panel.h
+++ b/drivers/video/fbdev/msm/mdss_hdmi_panel.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2016-2020, 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
@@ -16,6 +16,13 @@
#include "mdss_panel.h"
#include "mdss_hdmi_util.h"
+enum hdmi_deep_color_depth {
+ HDMI_DEEP_COLOR_DEPTH_24BPP,
+ HDMI_DEEP_COLOR_DEPTH_30BPP,
+ HDMI_DEEP_COLOR_DEPTH_36BPP,
+ HDMI_DEEP_COLOR_DEPTH_RESERVED,
+};
+
/**
* struct hdmi_panel_data - panel related data information
*
@@ -29,6 +36,7 @@
* @is_it_content: set to true if content is IT
* @scrambler: set to true if scrambler needs to be enabled
* @dc_enable: set to true if deep color is enabled
+ * @bitdepth: set the output bitdepth like 24/30 bpp
*/
struct hdmi_panel_data {
struct mdss_panel_info *pinfo;
@@ -41,6 +49,7 @@ struct hdmi_panel_data {
bool is_it_content;
bool scrambler;
bool dc_enable;
+ enum hdmi_deep_color_depth bitdepth;
};
/**
@@ -56,6 +65,7 @@ struct hdmi_panel_ops {
int (*off)(void *input);
void (*vendor)(void *input);
int (*update_fps)(void *input, u32 fps);
+ int (*update_colorimetry)(void *input, bool use_bt2020);
};
/**
diff --git a/drivers/video/fbdev/msm/mdss_hdmi_tx.c b/drivers/video/fbdev/msm/mdss_hdmi_tx.c
index 0778e43fe0ff..b70937a8f5fe 100644
--- a/drivers/video/fbdev/msm/mdss_hdmi_tx.c
+++ b/drivers/video/fbdev/msm/mdss_hdmi_tx.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017, 2019, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2017,2019-2020, 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
@@ -122,6 +122,11 @@ static int hdmi_tx_get_cable_status(struct platform_device *pdev, u32 vote);
static int hdmi_tx_update_ppm(struct hdmi_tx_ctrl *hdmi_ctrl, s32 ppm);
static int hdmi_tx_enable_pll_update(struct hdmi_tx_ctrl *hdmi_ctrl,
int enable);
+static void hdmi_tx_hpd_polarity_setup(struct hdmi_tx_ctrl *hdmi_ctrl,
+ bool polarity);
+static int hdmi_tx_notify_events(struct hdmi_tx_ctrl *hdmi_ctrl, int val);
+static void hdmi_panel_update_colorimetry(struct hdmi_tx_ctrl *ctrl,
+ bool use_bt2020);
static struct mdss_hw hdmi_tx_hw = {
.hw_ndx = MDSS_HW_HDMI,
@@ -305,7 +310,7 @@ static inline bool hdmi_tx_metadata_type_one(struct hdmi_tx_ctrl *hdmi_ctrl)
return hdr_data->metadata_type_one;
}
-static inline bool hdmix_tx_sink_dc_support(struct hdmi_tx_ctrl *hdmi_ctrl)
+static inline bool hdmi_tx_sink_dc_support(struct hdmi_tx_ctrl *hdmi_ctrl)
{
void *edid_fd = hdmi_tx_get_fd(HDMI_TX_FEAT_EDID);
@@ -325,8 +330,7 @@ static inline bool hdmi_tx_dc_support(struct hdmi_tx_ctrl *hdmi_ctrl)
true);
return hdmi_ctrl->dc_feature_on &&
- hdmi_ctrl->dc_support &&
- hdmix_tx_sink_dc_support(hdmi_ctrl) &&
+ hdmi_tx_sink_dc_support(hdmi_ctrl) &&
(tmds_clk_with_dc <= hdmi_edid_get_max_pclk(edid_fd));
}
@@ -429,9 +433,17 @@ static inline void hdmi_tx_send_audio_notification(
}
}
-static inline void hdmi_tx_send_video_notification(
+static inline int hdmi_tx_send_video_notification(
struct hdmi_tx_ctrl *hdmi_ctrl, int val, bool async)
{
+ int ret = 0;
+
+ if (!hdmi_ctrl) {
+ pr_err("invalid hdmi_ctrl input\n");
+ ret = -EINVAL;
+ goto end;
+ }
+
if (hdmi_ctrl && hdmi_ctrl->ext_audio_data.intf_ops.hpd) {
u32 flags = 0;
@@ -440,9 +452,13 @@ static inline void hdmi_tx_send_video_notification(
else
flags |= MSM_EXT_DISP_HPD_VIDEO;
- hdmi_ctrl->ext_audio_data.intf_ops.hpd(hdmi_ctrl->ext_pdev,
- hdmi_ctrl->ext_audio_data.type, val, flags);
+ ret = hdmi_ctrl->ext_audio_data.intf_ops.hpd(
+ hdmi_ctrl->ext_pdev,
+ hdmi_ctrl->ext_audio_data.type,
+ val, flags);
}
+end:
+ return ret;
}
static inline void hdmi_tx_ack_state(
@@ -548,8 +564,8 @@ static ssize_t hdmi_tx_sysfs_rda_connected(struct device *dev,
}
mutex_lock(&hdmi_ctrl->tx_lock);
- ret = snprintf(buf, PAGE_SIZE, "%d\n", hdmi_ctrl->hpd_state);
- DEV_DBG("%s: '%d'\n", __func__, hdmi_ctrl->hpd_state);
+ ret = snprintf(buf, PAGE_SIZE, "%d\n", hdmi_ctrl->notification_status);
+ DEV_DBG("%s: '%d'\n", __func__, hdmi_ctrl->notification_status);
mutex_unlock(&hdmi_ctrl->tx_lock);
return ret;
@@ -883,8 +899,7 @@ static ssize_t hdmi_tx_sysfs_wta_hpd(struct device *dev,
* No need to blocking wait for display/audio in this
* case since HAL is not up so no ACK can be expected.
*/
- hdmi_tx_send_audio_notification(hdmi_ctrl, 0);
- hdmi_tx_send_video_notification(hdmi_ctrl, 0, true);
+ hdmi_tx_notify_events(hdmi_ctrl, 0);
}
break;
@@ -1329,9 +1344,13 @@ static ssize_t hdmi_tx_sysfs_wta_hdr_stream(struct device *dev,
hdr_op = hdmi_hdr_get_ops(ctrl->curr_hdr_state,
ctrl->hdr_ctrl.hdr_state);
- if (hdr_op == HDR_SEND_INFO)
+ if (hdr_op == HDR_SEND_INFO) {
hdmi_panel_set_hdr_infoframe(ctrl);
- else if (hdr_op == HDR_CLEAR_INFO)
+ if (ctrl->hdr_ctrl.hdr_stream.eotf)
+ hdmi_panel_update_colorimetry(ctrl, true);
+ else
+ hdmi_panel_update_colorimetry(ctrl, false);
+ } else if (hdr_op == HDR_CLEAR_INFO)
hdmi_panel_clear_hdr_infoframe(ctrl);
ctrl->curr_hdr_state = ctrl->hdr_ctrl.hdr_state;
@@ -1848,7 +1867,6 @@ static int hdmi_tx_read_edid(struct hdmi_tx_ctrl *hdmi_ctrl)
}
} while ((cea_blks-- > 0) && (block++ < MAX_EDID_BLOCKS));
end:
-
return ret;
}
@@ -2429,11 +2447,60 @@ static void hdmi_tx_update_hdr_info(struct hdmi_tx_ctrl *hdmi_ctrl)
}
}
+static int hdmi_tx_notify_events(struct hdmi_tx_ctrl *hdmi_ctrl, int val)
+{
+ int rc = 0;
+
+ if (val == hdmi_ctrl->notification_status) {
+ pr_debug("%s: No change in notification status %d -> %d\n",
+ __func__, hdmi_ctrl->notification_status, val);
+ goto end;
+ }
+
+ reinit_completion(&hdmi_ctrl->notification_comp);
+ if (atomic_read(&hdmi_ctrl->notification_pending)) {
+ pr_debug("%s: wait for previous event to finish\n", __func__);
+ rc = wait_for_completion_timeout(
+ &hdmi_ctrl->notification_comp, HZ);
+ if (rc <= 0) {
+ pr_debug("%s: wait for pending notification timed out\n",
+ __func__);
+ hdmi_ctrl->pending_event = val;
+ hdmi_ctrl->handle_pe = true;
+ rc = -ETIMEDOUT;
+ goto end;
+ }
+ }
+
+ hdmi_ctrl->notification_status = val;
+ atomic_set(&hdmi_ctrl->notification_pending, 1);
+
+ if (val) {
+ rc = hdmi_tx_send_video_notification(hdmi_ctrl, val, true);
+ } else {
+ hdmi_tx_send_audio_notification(hdmi_ctrl, val);
+ rc = hdmi_tx_send_video_notification(hdmi_ctrl, val, true);
+ }
+
+ if (!rc) {
+ pr_debug("%s: Successfully sent %s notification\n", __func__,
+ val ? "CONNECT" : "DISCONNECT");
+ } else {
+ pr_err("%s: %s notification failed\n", __func__,
+ val ? "CONNECT" : "DISCONNECT");
+ atomic_set(&hdmi_ctrl->notification_pending, 0);
+ }
+end:
+ return rc;
+}
+
static void hdmi_tx_hpd_int_work(struct work_struct *work)
{
struct hdmi_tx_ctrl *hdmi_ctrl = NULL;
int rc = -EINVAL;
int retry = MAX_EDID_READ_RETRY;
+ unsigned long flags;
+ u32 hpd_state;
hdmi_ctrl = container_of(work, struct hdmi_tx_ctrl, hpd_int_work);
if (!hdmi_ctrl) {
@@ -2441,36 +2508,39 @@ static void hdmi_tx_hpd_int_work(struct work_struct *work)
return;
}
- mutex_lock(&hdmi_ctrl->tx_lock);
-
if (!hdmi_ctrl->hpd_initialized) {
DEV_DBG("hpd not initialized\n");
- mutex_unlock(&hdmi_ctrl->tx_lock);
return;
}
+ spin_lock_irqsave(&hdmi_ctrl->hpd_state_lock, flags);
+ hpd_state = hdmi_ctrl->hpd_state;
+ spin_unlock_irqrestore(&hdmi_ctrl->hpd_state_lock, flags);
+
DEV_DBG("%s: %s\n", __func__,
- hdmi_ctrl->hpd_state ? "CONNECT" : "DISCONNECT");
+ hpd_state ? "CONNECT" : "DISCONNECT");
+
+ if (hpd_state) {
+ hdmi_tx_hpd_polarity_setup(hdmi_ctrl,
+ HPD_DISCONNECT_POLARITY);
- if (hdmi_ctrl->hpd_state) {
while (rc && retry--)
rc = hdmi_tx_read_sink_info(hdmi_ctrl);
if (!retry && rc)
pr_warn_ratelimited("%s: EDID read failed\n", __func__);
hdmi_tx_update_deep_color(hdmi_ctrl);
hdmi_tx_update_hdr_info(hdmi_ctrl);
- }
- mutex_unlock(&hdmi_ctrl->tx_lock);
+ hdmi_tx_notify_events(hdmi_ctrl, hpd_state);
- if (hdmi_ctrl->hpd_state)
- hdmi_tx_send_video_notification(hdmi_ctrl,
- hdmi_ctrl->hpd_state, true);
- else {
- hdmi_tx_send_audio_notification(hdmi_ctrl,
- hdmi_ctrl->hpd_state);
- hdmi_tx_send_video_notification(hdmi_ctrl,
- hdmi_ctrl->hpd_state, true);
+ } else {
+ rc = hdmi_tx_notify_events(hdmi_ctrl, hpd_state);
+
+ if (!rc && !hdmi_ctrl->panel_power_on) {
+ atomic_set(&hdmi_ctrl->notification_pending, 0);
+ hdmi_tx_hpd_polarity_setup(hdmi_ctrl,
+ HPD_CONNECT_POLARITY);
+ }
}
} /* hdmi_tx_hpd_int_work */
@@ -3065,6 +3135,34 @@ static void hdmi_panel_clear_hdr_infoframe(struct hdmi_tx_ctrl *ctrl)
DSS_REG_W(io, HDMI_GEN_PKT_CTRL, packet_control);
}
+static void hdmi_panel_update_colorimetry(struct hdmi_tx_ctrl *hdmi_ctrl,
+ bool use_bt2020)
+{
+ void *pdata;
+
+ if (!hdmi_ctrl) {
+ DEV_ERR("%s: invalid hdmi ctrl data\n", __func__);
+ return;
+ }
+
+ pdata = hdmi_tx_get_fd(HDMI_TX_FEAT_PANEL);
+ if (!pdata) {
+ DEV_ERR("%s: invalid panel data\n", __func__);
+ return;
+ }
+
+ /* If there is no change in colorimetry, just return */
+ if (use_bt2020 && hdmi_ctrl->use_bt2020)
+ return;
+ else if (!use_bt2020 && !hdmi_ctrl->use_bt2020)
+ return;
+
+ if (hdmi_ctrl->panel_ops.update_colorimetry)
+ hdmi_ctrl->panel_ops.update_colorimetry(pdata, use_bt2020);
+
+ hdmi_ctrl->use_bt2020 = use_bt2020;
+}
+
static int hdmi_tx_audio_info_setup(struct platform_device *pdev,
struct msm_ext_disp_audio_setup_params *params)
{
@@ -3289,7 +3387,7 @@ static int hdmi_tx_power_off(struct hdmi_tx_ctrl *hdmi_ctrl)
hdmi_tx_core_off(hdmi_ctrl);
hdmi_ctrl->panel_power_on = false;
- hdmi_ctrl->dc_support = false;
+ hdmi_ctrl->vic = 0;
if (hdmi_ctrl->hpd_off_pending || hdmi_ctrl->panel_suspend)
hdmi_tx_hpd_off(hdmi_ctrl);
@@ -3337,6 +3435,10 @@ static int hdmi_tx_power_on(struct hdmi_tx_ctrl *hdmi_ctrl)
hdmi_ctrl->panel.scrambler = hdmi_edid_get_sink_scrambler_support(
edata);
hdmi_ctrl->panel.dc_enable = hdmi_tx_dc_support(hdmi_ctrl);
+ if (hdmi_ctrl->panel.dc_enable)
+ hdmi_ctrl->panel.bitdepth = HDMI_DEEP_COLOR_DEPTH_30BPP;
+ else
+ hdmi_ctrl->panel.bitdepth = HDMI_DEEP_COLOR_DEPTH_24BPP;
if (hdmi_ctrl->panel_ops.on)
hdmi_ctrl->panel_ops.on(pdata);
@@ -3362,8 +3464,6 @@ static int hdmi_tx_power_on(struct hdmi_tx_ctrl *hdmi_ctrl)
hdmi_ctrl->panel_power_on = true;
- hdmi_tx_hpd_polarity_setup(hdmi_ctrl, HPD_DISCONNECT_POLARITY);
-
if (hdmi_ctrl->hdmi_tx_hpd_done)
hdmi_ctrl->hdmi_tx_hpd_done(hdmi_ctrl->downstream_data);
@@ -3415,6 +3515,9 @@ static void hdmi_tx_hpd_off(struct hdmi_tx_ctrl *hdmi_ctrl)
hdmi_ctrl->hpd_initialized = false;
hdmi_ctrl->hpd_off_pending = false;
+ hdmi_ctrl->dc_support = false;
+
+ hdmi_edid_reset_parser(hdmi_tx_get_fd(HDMI_TX_FEAT_EDID));
DEV_DBG("%s: HPD is now OFF\n", __func__);
} /* hdmi_tx_hpd_off */
@@ -3473,6 +3576,7 @@ static int hdmi_tx_hpd_on(struct hdmi_tx_ctrl *hdmi_ctrl)
/* Turn on HPD HW circuit */
DSS_REG_W(io, HDMI_HPD_CTRL, reg_val | BIT(28));
+ atomic_set(&hdmi_ctrl->notification_pending, 0);
hdmi_tx_hpd_polarity_setup(hdmi_ctrl, HPD_CONNECT_POLARITY);
DEV_DBG("%s: HPD is now ON\n", __func__);
}
@@ -3697,6 +3801,11 @@ static int hdmi_tx_dev_init(struct hdmi_tx_ctrl *hdmi_ctrl)
spin_lock_init(&hdmi_ctrl->hpd_state_lock);
+ hdmi_ctrl->pending_event = 0;
+ hdmi_ctrl->handle_pe = false;
+ atomic_set(&hdmi_ctrl->notification_pending, 0);
+ init_completion(&hdmi_ctrl->notification_comp);
+
return 0;
fail_create_workq:
@@ -3972,9 +4081,11 @@ sysfs_err:
static int hdmi_tx_evt_handle_check_param(struct hdmi_tx_ctrl *hdmi_ctrl)
{
+ struct mdss_panel_info *pinfo = &hdmi_ctrl->panel_data.panel_info;
int new_vic = -1;
int rc = 0;
+ pinfo->is_ce_mode = false;
new_vic = hdmi_panel_get_vic(hdmi_ctrl->evt_arg, &hdmi_ctrl->ds_data);
if ((new_vic < 0) || (new_vic > HDMI_VFRMT_MAX)) {
@@ -3991,7 +4102,20 @@ static int hdmi_tx_evt_handle_check_param(struct hdmi_tx_ctrl *hdmi_ctrl)
rc = 1;
DEV_DBG("%s: res change %d ==> %d\n", __func__,
hdmi_ctrl->vic, new_vic);
+ goto done;
}
+
+ /*
+ * Since bootloader doesn't support DC return 1
+ * for panel reconfig.
+ */
+ if (hdmi_ctrl->panel_data.panel_info.cont_splash_enabled
+ && hdmi_tx_dc_support(hdmi_ctrl)) {
+ rc = 1;
+ DEV_DBG("%s: Bitdepth changed\n", __func__);
+ }
+done:
+ pinfo->is_ce_mode = hdmi_util_is_ce_mode(new_vic);
end:
return rc;
}
@@ -4012,6 +4136,9 @@ static int hdmi_tx_evt_handle_resume(struct hdmi_tx_ctrl *hdmi_ctrl)
goto end;
}
+ if (hdmi_tx_is_cec_wakeup_en(hdmi_ctrl))
+ hdmi_ctrl->mdss_util->disable_wake_irq(&hdmi_tx_hw);
+
end:
return rc;
}
@@ -4070,6 +4197,9 @@ static int hdmi_tx_evt_handle_suspend(struct hdmi_tx_ctrl *hdmi_ctrl)
if (!hdmi_ctrl->hpd_state && !hdmi_ctrl->panel_power_on)
hdmi_tx_hpd_off(hdmi_ctrl);
+ if (hdmi_tx_is_cec_wakeup_en(hdmi_ctrl))
+ hdmi_ctrl->mdss_util->enable_wake_irq(&hdmi_tx_hw);
+
hdmi_ctrl->panel_suspend = true;
hdmi_tx_cec_device_suspend(hdmi_ctrl);
end:
@@ -4113,8 +4243,12 @@ end:
static int hdmi_tx_evt_handle_close(struct hdmi_tx_ctrl *hdmi_ctrl)
{
if (hdmi_ctrl->hpd_feature_on && hdmi_ctrl->hpd_initialized &&
- !hdmi_ctrl->hpd_state)
+ !hdmi_ctrl->notification_status) {
+ atomic_set(&hdmi_ctrl->notification_pending, 0);
+ complete_all(&hdmi_ctrl->notification_comp);
+
hdmi_tx_hpd_polarity_setup(hdmi_ctrl, HPD_CONNECT_POLARITY);
+ }
return 0;
}
@@ -4166,6 +4300,15 @@ static int hdmi_tx_post_evt_handle_unblank(struct hdmi_tx_ctrl *hdmi_ctrl)
{
hdmi_tx_ack_state(hdmi_ctrl, true);
hdmi_tx_send_audio_notification(hdmi_ctrl, true);
+
+ atomic_set(&hdmi_ctrl->notification_pending, 0);
+ complete_all(&hdmi_ctrl->notification_comp);
+
+ if (hdmi_ctrl->handle_pe) {
+ hdmi_ctrl->handle_pe = false;
+ hdmi_tx_notify_events(hdmi_ctrl, hdmi_ctrl->pending_event);
+ }
+
return 0;
}
@@ -4182,8 +4325,7 @@ static int hdmi_tx_post_evt_handle_resume(struct hdmi_tx_ctrl *hdmi_ctrl)
&hdmi_ctrl->hpd_int_done, HZ/10);
if (!timeout) {
pr_debug("cable removed during suspend\n");
- hdmi_tx_send_audio_notification(hdmi_ctrl, 0);
- hdmi_tx_send_video_notification(hdmi_ctrl, 0, true);
+ hdmi_tx_notify_events(hdmi_ctrl, 0);
}
}
@@ -4194,8 +4336,7 @@ static int hdmi_tx_post_evt_handle_panel_on(struct hdmi_tx_ctrl *hdmi_ctrl)
{
if (hdmi_ctrl->panel_suspend) {
pr_debug("panel suspend has triggered\n");
- hdmi_tx_send_audio_notification(hdmi_ctrl, 0);
- hdmi_tx_send_video_notification(hdmi_ctrl, 0, true);
+ hdmi_tx_notify_events(hdmi_ctrl, 0);
}
return 0;
@@ -4259,6 +4400,38 @@ static int hdmi_tx_event_handler(struct mdss_panel_data *panel_data,
return rc;
}
+static enum mdss_mdp_csc_type mdss_hdmi_get_csc_type(
+ struct mdss_panel_data *panel_data)
+{
+ struct mdss_panel_info *pinfo;
+ struct mdp_hdr_stream_ctrl *hdr_ctrl;
+ struct mdp_hdr_stream *hdr_data;
+ enum mdss_mdp_csc_type csc_type = MDSS_MDP_CSC_RGB2YUV_709L;
+
+ struct hdmi_tx_ctrl *hdmi_ctrl =
+ hdmi_tx_get_drvdata_from_panel_data(panel_data);
+
+ if (!hdmi_ctrl) {
+ DEV_ERR("%s: invalid hdmi ctrl data\n", __func__);
+ goto error;
+ }
+
+ pinfo = &hdmi_ctrl->panel_data.panel_info;
+ hdr_ctrl = &hdmi_ctrl->hdr_ctrl;
+ hdr_data = &hdr_ctrl->hdr_stream;
+
+ if ((hdr_ctrl->hdr_state == HDR_ENABLE) &&
+ (hdr_data->eotf != 0))
+ csc_type = MDSS_MDP_CSC_RGB2YUV_2020L;
+ else if (pinfo->is_ce_mode)
+ csc_type = MDSS_MDP_CSC_RGB2YUV_709L;
+ else
+ csc_type = MDSS_MDP_CSC_RGB2YUV_709FR;
+
+error:
+ return csc_type;
+}
+
static int hdmi_tx_register_panel(struct hdmi_tx_ctrl *hdmi_ctrl)
{
int rc = 0;
@@ -4269,6 +4442,7 @@ static int hdmi_tx_register_panel(struct hdmi_tx_ctrl *hdmi_ctrl)
}
hdmi_ctrl->panel_data.event_handler = hdmi_tx_event_handler;
+ hdmi_ctrl->panel_data.get_csc_type = mdss_hdmi_get_csc_type;
if (!hdmi_ctrl->pdata.primary)
hdmi_ctrl->vic = DEFAULT_VIDEO_RESOLUTION;
@@ -5005,6 +5179,7 @@ static int hdmi_tx_probe(struct platform_device *pdev)
hdmi_ctrl->pdata.primary = true;
hdmi_ctrl->vic = vic;
hdmi_ctrl->panel_data.panel_info.is_prim_panel = true;
+ hdmi_ctrl->panel_data.panel_info.is_ce_mode = true;
hdmi_ctrl->panel_data.panel_info.cont_splash_enabled =
hdmi_ctrl->mdss_util->panel_intf_status(DISPLAY_1,
MDSS_PANEL_INTF_HDMI) ? true : false;
diff --git a/drivers/video/fbdev/msm/mdss_hdmi_tx.h b/drivers/video/fbdev/msm/mdss_hdmi_tx.h
index 92b9d84e9107..7eb749fde97d 100644
--- a/drivers/video/fbdev/msm/mdss_hdmi_tx.h
+++ b/drivers/video/fbdev/msm/mdss_hdmi_tx.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2020, 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
@@ -93,6 +93,12 @@ struct hdmi_tx_ctrl {
struct work_struct fps_work;
struct mdp_hdr_stream_ctrl hdr_ctrl;
+ int pending_event;
+ bool handle_pe;
+ atomic_t notification_pending;
+ struct completion notification_comp;
+ u32 notification_status;
+
spinlock_t hpd_state_lock;
u32 panel_power_on;
@@ -132,6 +138,7 @@ struct hdmi_tx_ctrl {
bool power_data_enable[HDMI_TX_MAX_PM];
bool dc_support;
bool dc_feature_on;
+ bool use_bt2020;
void (*hdmi_tx_hpd_done)(void *data);
void *downstream_data;
diff --git a/drivers/video/fbdev/msm/mdss_hdmi_util.c b/drivers/video/fbdev/msm/mdss_hdmi_util.c
index 8e854c54bae8..88bceabc4783 100644
--- a/drivers/video/fbdev/msm/mdss_hdmi_util.c
+++ b/drivers/video/fbdev/msm/mdss_hdmi_util.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017, 2019, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2020, 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
@@ -566,6 +566,67 @@ int msm_hdmi_get_timing_info(
return ret;
}
+static u32 cea_mode_alternate_clock(struct msm_hdmi_mode_timing_info *info)
+{
+ u32 clock = info->pixel_freq;
+
+ if (info->refresh_rate % 6 != 0)
+ return clock;
+
+ clock = DIV_ROUND_CLOSEST(clock * 1000, 1001);
+
+ return clock;
+}
+
+bool hdmi_util_is_ce_mode(u32 vic)
+{
+ struct msm_hdmi_mode_timing_info info1 = {0};
+ struct msm_hdmi_mode_timing_info info2 = {0};
+ u32 mode = 0;
+ u32 clock1, clock2, clock2_alt;
+ bool is_ce_mode = false;
+
+ if (vic <= HDMI_VFRMT_640x480p60_4_3) {
+ is_ce_mode = false;
+ goto end;
+ }
+
+ if (vic >= HDMI_VFRMT_720x480p60_4_3 &&
+ vic <= HDMI_VFRMT_3840x2160p60_64_27) {
+ is_ce_mode = true;
+ goto end;
+ }
+
+ msm_hdmi_get_timing_info(&info1, vic);
+
+ for (mode = HDMI_VFRMT_720x480p60_4_3; mode < HDMI_VFRMT_END; mode++) {
+
+ msm_hdmi_get_timing_info(&info2, mode);
+
+ clock1 = info1.pixel_freq;
+ clock2 = info2.pixel_freq;
+ clock2_alt = cea_mode_alternate_clock(&info2);
+
+ if ((clock1 == clock2) || (clock1 == clock2_alt)) {
+ if (info1.active_h == info2.active_h &&
+ info1.front_porch_h == info2.front_porch_h &&
+ info1.pulse_width_h == info2.pulse_width_h &&
+ info1.back_porch_h == info2.back_porch_h &&
+ info1.active_v == info2.active_v &&
+ info1.front_porch_v == info2.front_porch_v &&
+ info1.pulse_width_v == info2.pulse_width_v &&
+ info1.back_porch_v == info2.back_porch_v) {
+ is_ce_mode = true;
+ break;
+ }
+ }
+ continue;
+ }
+end:
+ pr_debug("%s: vic = %d, is_ce_mode = %d\n", __func__, vic, is_ce_mode);
+ return is_ce_mode;
+}
+
int hdmi_get_supported_mode(struct msm_hdmi_mode_timing_info *info,
struct hdmi_util_ds_data *ds_data, u32 mode)
{
diff --git a/drivers/video/fbdev/msm/mdss_hdmi_util.h b/drivers/video/fbdev/msm/mdss_hdmi_util.h
index fe554f8e9e67..2f752dc79c7a 100644
--- a/drivers/video/fbdev/msm/mdss_hdmi_util.h
+++ b/drivers/video/fbdev/msm/mdss_hdmi_util.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2020, 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
@@ -490,6 +490,7 @@ static inline int hdmi_tx_get_h_total(const struct msm_hdmi_mode_timing_info *t)
return 0;
}
+bool hdmi_util_is_ce_mode(u32 vic);
/* video timing related utility routines */
int hdmi_get_video_id_code(struct msm_hdmi_mode_timing_info *timing_in,
struct hdmi_util_ds_data *ds_data);
diff --git a/drivers/video/fbdev/msm/mdss_mdp.h b/drivers/video/fbdev/msm/mdss_mdp.h
index 90a38b79e561..9c93c500d127 100644
--- a/drivers/video/fbdev/msm/mdss_mdp.h
+++ b/drivers/video/fbdev/msm/mdss_mdp.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2020, 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
@@ -271,10 +271,12 @@ enum mdss_mdp_csc_type {
MDSS_MDP_CSC_RGB2YUV_601L,
MDSS_MDP_CSC_RGB2YUV_601FR,
MDSS_MDP_CSC_RGB2YUV_709L,
+ MDSS_MDP_CSC_RGB2YUV_709FR,
MDSS_MDP_CSC_RGB2YUV_2020L,
MDSS_MDP_CSC_RGB2YUV_2020FR,
MDSS_MDP_CSC_YUV2YUV,
MDSS_MDP_CSC_RGB2RGB,
+ MDSS_MDP_CSC_RGB2RGB_L,
MDSS_MDP_MAX_CSC
};
diff --git a/drivers/video/fbdev/msm/mdss_mdp_cdm.c b/drivers/video/fbdev/msm/mdss_mdp_cdm.c
index 10928e6bceaa..7fede8fa1709 100644
--- a/drivers/video/fbdev/msm/mdss_mdp_cdm.c
+++ b/drivers/video/fbdev/msm/mdss_mdp_cdm.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2020, 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
@@ -116,6 +116,7 @@ struct mdss_mdp_cdm *mdss_mdp_cdm_init(struct mdss_mdp_ctl *ctl, u32 intf_type)
cdm->out_intf = intf_type;
cdm->is_bypassed = true;
+ cdm->is_only_clamped = false;
memset(&cdm->setup, 0x0, sizeof(struct mdp_cdm_cfg));
return cdm;
@@ -137,11 +138,22 @@ static int mdss_mdp_cdm_csc_setup(struct mdss_mdp_cdm *cdm,
if ((data->csc_type == MDSS_MDP_CSC_RGB2YUV_601L) ||
(data->csc_type == MDSS_MDP_CSC_RGB2YUV_601FR) ||
- (data->csc_type == MDSS_MDP_CSC_RGB2YUV_709L)) {
+ (data->csc_type == MDSS_MDP_CSC_RGB2YUV_709L) ||
+ (data->csc_type == MDSS_MDP_CSC_RGB2YUV_709FR) ||
+ (data->csc_type == MDSS_MDP_CSC_RGB2YUV_2020L) ||
+ (data->csc_type == MDSS_MDP_CSC_RGB2YUV_2020FR)) {
op_mode |= BIT(2); /* DST_DATA_FORMAT = YUV */
op_mode &= ~BIT(1); /* SRC_DATA_FORMAT = RGB */
op_mode |= BIT(0); /* EN = 1 */
cdm->is_bypassed = false;
+ } else if ((cdm->out_intf == MDP_CDM_CDWN_OUTPUT_HDMI) &&
+ ((data->csc_type == MDSS_MDP_CSC_RGB2RGB_L) ||
+ (data->csc_type == MDSS_MDP_CSC_RGB2RGB))) {
+ op_mode &= ~BIT(2); /* DST_DATA_FORMAT = RGB */
+ op_mode &= ~BIT(1); /* SRC_DATA_FORMAT = RGB */
+ op_mode |= BIT(0); /* EN = 1 */
+ cdm->is_bypassed = false;
+ cdm->is_only_clamped = true;
} else {
op_mode = 0;
cdm->is_bypassed = true;
@@ -299,8 +311,11 @@ static int mdss_mdp_cdm_out_packer_setup(struct mdss_mdp_cdm *cdm,
}
opmode &= ~0x6;
opmode |= (fmt->chroma_sample << 1);
- if (!cdm->is_bypassed)
+ if (!cdm->is_bypassed) {
cdm_enable |= BIT(19);
+ if (cdm->is_only_clamped)
+ opmode = 0;
+ }
} else {
/* Disable HDMI pacler for WB */
diff --git a/drivers/video/fbdev/msm/mdss_mdp_cdm.h b/drivers/video/fbdev/msm/mdss_mdp_cdm.h
index 3b7fdced6623..b2897d41044d 100644
--- a/drivers/video/fbdev/msm/mdss_mdp_cdm.h
+++ b/drivers/video/fbdev/msm/mdss_mdp_cdm.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014,2016, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2020, 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,6 +60,7 @@ struct mdss_mdp_cdm {
bool is_bypassed;
struct mdp_cdm_cfg setup;
struct completion free_comp;
+ bool is_only_clamped;
};
struct mdss_mdp_cdm *mdss_mdp_cdm_init(struct mdss_mdp_ctl *ctl,
diff --git a/drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c b/drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c
index 83ab9c3973af..fea8f0917dee 100644
--- a/drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c
+++ b/drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2018, 2020, 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
@@ -1228,11 +1228,12 @@ static int mdss_mdp_cmd_intf_callback(void *data, int event)
__func__, atomic_read(&ctx->rdptr_cnt), event);
/*
- * if we are going to suspended or pp split is not enabled,
- * just return
+ * if we are going to suspended, just return
*/
- if (ctx->intf_stopped || !is_pingpong_split(ctx->ctl->mfd))
+ if (ctx->intf_stopped) {
+ pr_debug("%s: Intf stopped\n", __func__);
return -EINVAL;
+ }
atomic_inc(&ctx->rdptr_cnt);
/* enable clks and rd_ptr interrupt */
@@ -2099,7 +2100,7 @@ static int mdss_mdp_cmd_wait4pingpong(struct mdss_mdp_ctl *ctl, void *arg)
struct mdss_mdp_cmd_ctx *ctx;
struct mdss_panel_data *pdata;
unsigned long flags;
- int rc = 0, te_irq;
+ int rc = 0;
ctx = (struct mdss_mdp_cmd_ctx *) ctl->intf_ctx[MASTER_CTX];
if (!ctx) {
@@ -2155,8 +2156,7 @@ static int mdss_mdp_cmd_wait4pingpong(struct mdss_mdp_ctl *ctl, void *arg)
atomic_read(&ctx->koff_cnt));
/* enable TE irq to check if it is coming from the panel */
- te_irq = gpio_to_irq(pdata->panel_te_gpio);
- enable_irq(te_irq);
+ panel_update_te_irq(pdata, true);
/* wait for 20ms to ensure we are getting the next TE */
usleep_range(20000, 20010);
@@ -2179,7 +2179,7 @@ static int mdss_mdp_cmd_wait4pingpong(struct mdss_mdp_ctl *ctl, void *arg)
}
/* disable te irq */
- disable_irq_nosync(te_irq);
+ panel_update_te_irq(pdata, false);
ctx->pp_timeout_report_cnt++;
rc = -EPERM;
diff --git a/drivers/video/fbdev/msm/mdss_mdp_intf_video.c b/drivers/video/fbdev/msm/mdss_mdp_intf_video.c
index e27f6bc49892..3761fa4af0eb 100644
--- a/drivers/video/fbdev/msm/mdss_mdp_intf_video.c
+++ b/drivers/video/fbdev/msm/mdss_mdp_intf_video.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2020, 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
@@ -103,6 +103,9 @@ struct mdss_mdp_video_ctx {
u32 intf_irq_mask;
spinlock_t mdss_mdp_video_lock;
spinlock_t mdss_mdp_intf_intr_lock;
+
+ enum mdss_mdp_csc_type cdm_csc_type;
+ bool yuv_conv;
};
static void mdss_mdp_fetch_start_config(struct mdss_mdp_video_ctx *ctx,
@@ -1023,6 +1026,8 @@ static int mdss_mdp_video_ctx_stop(struct mdss_mdp_ctl *ctl,
mdss_mdp_set_intf_intr_callback(ctx, MDSS_MDP_INTF_IRQ_PROG_LINE,
NULL, NULL);
+ ctx->yuv_conv = false;
+
ctx->ref_cnt--;
end:
mutex_unlock(&ctl->offlock);
@@ -1092,13 +1097,6 @@ static int mdss_mdp_video_stop(struct mdss_mdp_ctl *ctl, int panel_power_state)
{
int intfs_num, ret = 0;
- if (ctl->cdm) {
- if (!mdss_mdp_cdm_destroy(ctl->cdm))
- mdss_mdp_ctl_write(ctl,
- MDSS_MDP_REG_CTL_FLUSH, BIT(26));
- ctl->cdm = NULL;
- }
-
intfs_num = ctl->intf_num - MDSS_MDP_INTF0;
ret = mdss_mdp_video_intfs_stop(ctl, ctl->panel_data, intfs_num);
if (IS_ERR_VALUE(ret)) {
@@ -1106,6 +1104,12 @@ static int mdss_mdp_video_stop(struct mdss_mdp_ctl *ctl, int panel_power_state)
return ret;
}
+ if (ctl->cdm) {
+ if (!mdss_mdp_cdm_destroy(ctl->cdm))
+ mdss_mdp_ctl_write(ctl,
+ MDSS_MDP_REG_CTL_FLUSH, BIT(26));
+ ctl->cdm = NULL;
+ }
MDSS_XLOG(ctl->num, ctl->vsync_cnt);
mdss_mdp_ctl_reset(ctl, false);
@@ -1645,6 +1649,75 @@ end:
return rc;
}
+static int mdss_mdp_update_csc_matrix(struct mdss_mdp_ctl *ctl)
+{
+ struct mdss_mdp_video_ctx *ctx;
+ struct mdss_data_type *mdata;
+ struct mdss_panel_data *pdata;
+ struct mdss_panel_info *pinfo;
+ struct mdss_mdp_format_params *fmt;
+ enum mdss_mdp_csc_type csc_type;
+ int rc = 0;
+
+ ctx = (struct mdss_mdp_video_ctx *) ctl->intf_ctx[MASTER_CTX];
+ if (!ctx) {
+ pr_err("%s: invalid ctx\n", __func__);
+ return -ENODEV;
+ }
+
+ mdata = ctl->mdata;
+ pdata = ctl->panel_data;
+ pinfo = &pdata->panel_info;
+
+ if (!mdss_mdp_is_cdm_supported(mdata, ctl->intf_type, 0)) {
+ pr_debug("%s: CDM is not supported\n", __func__);
+ goto error;
+ }
+
+ if (IS_ERR_OR_NULL(ctl->cdm)) {
+ pr_debug("%s: CDM is not initialized\n", __func__);
+ goto error;
+ }
+
+ if (!ctx->yuv_conv) {
+ pr_debug("%s: CDM not configured to convert to YUV yet\n",
+ __func__);
+ goto error;
+ }
+
+ fmt = mdss_mdp_get_format_params(pinfo->out_format);
+ if (fmt->is_yuv) {
+ csc_type = MDSS_MDP_CSC_RGB2YUV_709L;
+ if (pdata->get_csc_type)
+ csc_type = pdata->get_csc_type(pdata);
+
+ pr_debug("cdm_csc_type = %d csc_type = %d\n",
+ ctx->cdm_csc_type, csc_type);
+ if (ctx->cdm_csc_type != csc_type) {
+
+ mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON);
+ rc = mdss_mdp_csc_setup(MDSS_MDP_BLOCK_CDM,
+ ctl->cdm->num, csc_type);
+ mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF);
+
+ if (rc) {
+ pr_err("%s: CDM CSC setup failed, rc = %d\n",
+ __func__, rc);
+ goto error;
+ }
+
+ pr_debug("%s: updating csc %d to %d\n", __func__,
+ ctx->cdm_csc_type, csc_type);
+
+ ctx->cdm_csc_type = csc_type;
+ pinfo->csc_type = csc_type;
+ ctl->flush_bits |= BIT(26);
+ }
+ }
+error:
+ return rc;
+}
+
static int mdss_mdp_video_display(struct mdss_mdp_ctl *ctl, void *arg)
{
struct mdss_mdp_video_ctx *ctx;
@@ -1736,6 +1809,8 @@ static int mdss_mdp_video_display(struct mdss_mdp_ctl *ctl, void *arg)
CTL_INTF_EVENT_FLAG_DEFAULT);
}
+ rc = mdss_mdp_update_csc_matrix(ctl);
+
rc = mdss_mdp_video_avr_trigger_setup(ctl);
if (rc) {
pr_err("avr trigger setup failed\n");
@@ -1955,10 +2030,24 @@ static int mdss_mdp_video_cdm_setup(struct mdss_mdp_cdm *cdm,
{
struct mdp_cdm_cfg setup;
- if (fmt->is_yuv)
- setup.csc_type = MDSS_MDP_CSC_RGB2YUV_601FR;
- else
- setup.csc_type = MDSS_MDP_CSC_RGB2RGB;
+ if (fmt->is_yuv) {
+ if (pinfo->is_ce_mode) {
+ if (pinfo->yres < 720)
+ setup.csc_type = MDSS_MDP_CSC_RGB2YUV_601L;
+ else
+ setup.csc_type = MDSS_MDP_CSC_RGB2YUV_709L;
+ } else {
+ if (pinfo->yres < 720)
+ setup.csc_type = MDSS_MDP_CSC_RGB2YUV_601FR;
+ else
+ setup.csc_type = MDSS_MDP_CSC_RGB2YUV_709FR;
+ }
+ } else {
+ if (pinfo->is_ce_mode)
+ setup.csc_type = MDSS_MDP_CSC_RGB2RGB_L;
+ else
+ setup.csc_type = MDSS_MDP_CSC_RGB2RGB;
+ }
switch (fmt->chroma_sample) {
case MDSS_MDP_CHROMA_RGB:
@@ -1984,8 +2073,10 @@ static int mdss_mdp_video_cdm_setup(struct mdss_mdp_cdm *cdm,
return -EINVAL;
}
+ pinfo->csc_type = setup.csc_type;
+
setup.out_format = pinfo->out_format;
- setup.mdp_csc_bit_depth = MDP_CDM_CSC_8BIT;
+ setup.mdp_csc_bit_depth = MDP_CDM_CSC_10BIT;
setup.output_width = pinfo->xres + pinfo->lcdc.xres_pad;
setup.output_height = pinfo->yres + pinfo->lcdc.yres_pad;
return mdss_mdp_cdm_setup(cdm, &setup);
@@ -2120,6 +2211,7 @@ static int mdss_mdp_video_ctx_setup(struct mdss_mdp_ctl *ctl,
}
if (mdss_mdp_is_cdm_supported(mdata, ctl->intf_type, 0)) {
+ bool needs_qr_conversion = false;
fmt = mdss_mdp_get_format_params(pinfo->out_format);
if (!fmt) {
@@ -2127,7 +2219,11 @@ static int mdss_mdp_video_ctx_setup(struct mdss_mdp_ctl *ctl,
pinfo->out_format);
return -EINVAL;
}
- if (fmt->is_yuv) {
+
+ if (ctl->intf_type == MDSS_INTF_HDMI && pinfo->is_ce_mode)
+ needs_qr_conversion = true;
+
+ if (fmt->is_yuv || needs_qr_conversion) {
ctl->cdm =
mdss_mdp_cdm_init(ctl, MDP_CDM_CDWN_OUTPUT_HDMI);
if (!IS_ERR_OR_NULL(ctl->cdm)) {
@@ -2137,6 +2233,10 @@ static int mdss_mdp_video_ctx_setup(struct mdss_mdp_ctl *ctl,
__func__);
return -EINVAL;
}
+ if (fmt->is_yuv)
+ ctx->yuv_conv = true;
+
+ ctx->cdm_csc_type = pinfo->csc_type;
ctl->flush_bits |= BIT(26);
} else {
pr_err("%s: failed to initialize cdm\n",
diff --git a/drivers/video/fbdev/msm/mdss_mdp_pp.c b/drivers/video/fbdev/msm/mdss_mdp_pp.c
index 5b9798e2c24e..edc154b2b0c6 100644
--- a/drivers/video/fbdev/msm/mdss_mdp_pp.c
+++ b/drivers/video/fbdev/msm/mdss_mdp_pp.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2020, 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
@@ -120,6 +120,18 @@ struct mdp_csc_cfg mdp_csc_8bit_convert[MDSS_MDP_MAX_CSC] = {
{ 0x0, 0xff, 0x0, 0xff, 0x0, 0xff,},
{ 0x0010, 0x00eb, 0x0010, 0x00f0, 0x0010, 0x00f0,},
},
+ [MDSS_MDP_CSC_RGB2YUV_709FR] = {
+ 0,
+ {
+ 0x006d, 0x016e, 0x0025,
+ 0xffc5, 0xff3b, 0x0100,
+ 0x0100, 0xff17, 0xffe9
+ },
+ { 0x0, 0x0, 0x0,},
+ { 0x0, 0x0080, 0x0080,},
+ { 0x0, 0xff, 0x0, 0xff, 0x0, 0xff,},
+ { 0x0, 0xff, 0x0, 0xff, 0x0, 0xff,},
+ },
[MDSS_MDP_CSC_RGB2YUV_2020L] = {
0,
{
@@ -168,6 +180,18 @@ struct mdp_csc_cfg mdp_csc_8bit_convert[MDSS_MDP_MAX_CSC] = {
{ 0x0, 0xff, 0x0, 0xff, 0x0, 0xff,},
{ 0x0, 0xff, 0x0, 0xff, 0x0, 0xff,},
},
+ [MDSS_MDP_CSC_RGB2RGB_L] = {
+ 0,
+ {
+ 0x01b7, 0x0000, 0x0000,
+ 0x0000, 0x01b7, 0x0000,
+ 0x0000, 0x0000, 0x01b7,
+ },
+ { 0x0, 0x0, 0x0,},
+ { 0x10, 0x10, 0x10,},
+ { 0x0, 0xff, 0x0, 0xff, 0x0, 0xff,},
+ { 0x10, 0xeb, 0x10, 0xeb, 0x10, 0xeb,},
+ },
};
struct mdp_csc_cfg mdp_csc_10bit_convert[MDSS_MDP_MAX_CSC] = {
@@ -267,6 +291,18 @@ struct mdp_csc_cfg mdp_csc_10bit_convert[MDSS_MDP_MAX_CSC] = {
{ 0x0, 0x3ff, 0x0, 0x3ff, 0x0, 0x3ff,},
{ 0x0040, 0x03ac, 0x0040, 0x03c0, 0x0040, 0x03c0,},
},
+ [MDSS_MDP_CSC_RGB2YUV_709FR] = {
+ 0,
+ {
+ 0x006d, 0x016e, 0x0025,
+ 0xffc5, 0xff3b, 0x0100,
+ 0x0100, 0xff17, 0xffe9
+ },
+ { 0x0, 0x0, 0x0,},
+ { 0x0, 0x0200, 0x0200,},
+ { 0x0, 0x3ff, 0x0, 0x3ff, 0x0, 0x3ff,},
+ { 0x0, 0x3ff, 0x0, 0x3ff, 0x0, 0x3ff,},
+ },
[MDSS_MDP_CSC_RGB2YUV_2020L] = {
0,
{
@@ -315,6 +351,18 @@ struct mdp_csc_cfg mdp_csc_10bit_convert[MDSS_MDP_MAX_CSC] = {
{ 0x0, 0x3ff, 0x0, 0x3ff, 0x0, 0x3ff,},
{ 0x0, 0x3ff, 0x0, 0x3ff, 0x0, 0x3ff,},
},
+ [MDSS_MDP_CSC_RGB2RGB_L] = {
+ 0,
+ {
+ 0x01b7, 0x0000, 0x0000,
+ 0x0000, 0x01b7, 0x0000,
+ 0x0000, 0x0000, 0x01b7,
+ },
+ { 0x0, 0x0, 0x0,},
+ { 0x40, 0x40, 0x40,},
+ { 0x0, 0x3ff, 0x0, 0x3ff, 0x0, 0x3ff,},
+ { 0x40, 0x3ac, 0x40, 0x3ac, 0x40, 0x3ac,},
+ },
};
static struct mdss_mdp_format_params dest_scaler_fmt = {
@@ -3369,7 +3417,7 @@ static int pp_ad_calc_bl(struct msm_fb_data_type *mfd, int bl_in, int *bl_out,
}
if (!ad->bl_mfd || !ad->bl_mfd->panel_info ||
- !ad->bl_att_lut) {
+ ad->bl_att_lut == NULL) {
pr_err("Invalid ad info: bl_mfd = 0x%pK, ad->bl_mfd->panel_info = 0x%pK, bl_att_lut = 0x%pK\n",
ad->bl_mfd,
(!ad->bl_mfd) ? NULL : ad->bl_mfd->panel_info,
@@ -6920,7 +6968,7 @@ static int is_valid_calib_dspp_addr(char __iomem *ptr)
ret = MDP_PP_OPS_READ | MDP_PP_OPS_WRITE;
break;
/* Dither enable/disable */
- } else if ((ptr == base + MDSS_MDP_REG_DSPP_DITHER_DEPTH)) {
+ } else if (ptr == base + MDSS_MDP_REG_DSPP_DITHER_DEPTH) {
ret = MDP_PP_OPS_READ | MDP_PP_OPS_WRITE;
break;
/* Six zone and mem color */
diff --git a/drivers/video/fbdev/msm/mdss_mdp_splash_logo.c b/drivers/video/fbdev/msm/mdss_mdp_splash_logo.c
index 5df1ed7c89a5..b55a6824ffc1 100644
--- a/drivers/video/fbdev/msm/mdss_mdp_splash_logo.c
+++ b/drivers/video/fbdev/msm/mdss_mdp_splash_logo.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2015, 2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2020, 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,8 +286,9 @@ int mdss_mdp_splash_cleanup(struct msm_fb_data_type *mfd,
/* 1-to-1 mapping */
mdss_mdp_splash_iommu_attach(mfd);
- if (use_borderfill && mdp5_data->handoff &&
- !mfd->splash_info.iommu_dynamic_attached) {
+ if ((use_borderfill && mdp5_data->handoff &&
+ !mfd->splash_info.iommu_dynamic_attached) ||
+ mfd->force_null_commit) {
/*
* Set up border-fill on the handed off pipes.
* This is needed to ensure that there are no memory
diff --git a/drivers/video/fbdev/msm/mdss_panel.h b/drivers/video/fbdev/msm/mdss_panel.h
index f8993f3774e6..bc2513296fd8 100644
--- a/drivers/video/fbdev/msm/mdss_panel.h
+++ b/drivers/video/fbdev/msm/mdss_panel.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2008-2020, 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
@@ -19,6 +19,9 @@
#include <linux/stringify.h>
#include <linux/types.h>
#include <linux/debugfs.h>
+#include <linux/of_gpio.h>
+#include <linux/gpio.h>
+#include <linux/interrupt.h>
/* panel id type */
struct panel_id {
@@ -800,6 +803,8 @@ struct mdss_panel_info {
u32 rst_seq_len;
u32 vic; /* video identification code */
u32 deep_color;
+ bool is_ce_mode; /* CE video format */
+ u8 csc_type;
struct mdss_rect roi;
struct mdss_dsi_dual_pu_roi dual_roi;
int pwm_pmic_gpio;
@@ -990,6 +995,7 @@ struct mdss_panel_data {
* and teardown.
*/
int (*event_handler) (struct mdss_panel_data *pdata, int e, void *arg);
+ enum mdss_mdp_csc_type (*get_csc_type)(struct mdss_panel_data *pdata);
struct device_node *(*get_fb_node)(struct platform_device *pdev);
struct list_head timings_list;
@@ -1007,6 +1013,8 @@ struct mdss_panel_data {
bool panel_disable_mode;
int panel_te_gpio;
+ bool is_te_irq_enabled;
+ struct mutex te_mutex;
struct completion te_done;
};
@@ -1018,6 +1026,26 @@ struct mdss_panel_debugfs_info {
struct mdss_panel_debugfs_info *next;
};
+static inline void panel_update_te_irq(struct mdss_panel_data *pdata,
+ bool enable)
+{
+ if (!pdata) {
+ pr_err("Invalid Params\n");
+ return;
+ }
+
+ mutex_lock(&pdata->te_mutex);
+ if (enable && !pdata->is_te_irq_enabled) {
+ enable_irq(gpio_to_irq(pdata->panel_te_gpio));
+ pdata->is_te_irq_enabled = true;
+ } else if (!enable && pdata->is_te_irq_enabled) {
+ disable_irq(gpio_to_irq(pdata->panel_te_gpio));
+ pdata->is_te_irq_enabled = false;
+ }
+ mutex_unlock(&pdata->te_mutex);
+
+}
+
/**
* mdss_get_panel_framerate() - get panel frame rate based on panel information
* @panel_info: Pointer to panel info containing all panel information
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index 52d5609bff8e..e54065331f72 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -104,9 +104,10 @@ extern unsigned int sysctl_numa_balancing_scan_period_max;
extern unsigned int sysctl_numa_balancing_scan_size;
#ifdef CONFIG_SCHED_DEBUG
-extern unsigned int sysctl_sched_migration_cost;
-extern unsigned int sysctl_sched_nr_migrate;
-extern unsigned int sysctl_sched_time_avg;
+extern __read_mostly unsigned int sysctl_sched_migration_cost;
+extern __read_mostly unsigned int sysctl_sched_nr_migrate;
+extern __read_mostly unsigned int sysctl_sched_time_avg;
+
extern unsigned int sysctl_sched_shares_window;
int sched_proc_update_handler(struct ctl_table *table, int write,
diff --git a/include/uapi/video/msm_hdmi_modes.h b/include/uapi/video/msm_hdmi_modes.h
index 5b4b2b492be4..1a8fbabe0d81 100644
--- a/include/uapi/video/msm_hdmi_modes.h
+++ b/include/uapi/video/msm_hdmi_modes.h
@@ -271,13 +271,13 @@ struct msm_hdmi_mode_timing_info {
720, 5, 5, 20, false, 74250, 60000, false, true, HDMI_RES_AR_16_9, 0}
#define HDMI_VFRMT_1920x1080i60_16_9_TIMING \
{HDMI_VFRMT_1920x1080i60_16_9, 1920, 88, 44, 148, false, \
- 540, 2, 5, 5, false, 74250, 60000, true, true, HDMI_RES_AR_16_9, 0}
+ 540, 2, 5, 5, false, 74250, 60000, true, false, HDMI_RES_AR_16_9, 0}
#define HDMI_VFRMT_1440x480i60_4_3_TIMING \
{HDMI_VFRMT_1440x480i60_4_3, 1440, 38, 124, 114, true, \
- 240, 4, 3, 15, true, 27000, 60000, true, true, HDMI_RES_AR_4_3, 0}
+ 240, 4, 3, 15, true, 27000, 60000, true, false, HDMI_RES_AR_4_3, 0}
#define HDMI_VFRMT_1440x480i60_16_9_TIMING \
{HDMI_VFRMT_1440x480i60_16_9, 1440, 38, 124, 114, true, \
- 240, 4, 3, 15, true, 27000, 60000, true, true, HDMI_RES_AR_16_9, 0}
+ 240, 4, 3, 15, true, 27000, 60000, true, false, HDMI_RES_AR_16_9, 0}
#define HDMI_VFRMT_1920x1080p60_16_9_TIMING \
{HDMI_VFRMT_1920x1080p60_16_9, 1920, 88, 44, 148, false, \
1080, 4, 5, 36, false, 148500, 60000, false, true, HDMI_RES_AR_16_9, 0}
@@ -292,10 +292,10 @@ struct msm_hdmi_mode_timing_info {
720, 5, 5, 20, false, 74250, 50000, false, true, HDMI_RES_AR_16_9, 0}
#define HDMI_VFRMT_1440x576i50_4_3_TIMING \
{HDMI_VFRMT_1440x576i50_4_3, 1440, 24, 126, 138, true, \
- 288, 2, 3, 19, true, 27000, 50000, true, true, HDMI_RES_AR_4_3, 0}
+ 288, 2, 3, 19, true, 27000, 50000, true, false, HDMI_RES_AR_4_3, 0}
#define HDMI_VFRMT_1440x576i50_16_9_TIMING \
{HDMI_VFRMT_1440x576i50_16_9, 1440, 24, 126, 138, true, \
- 288, 2, 3, 19, true, 27000, 50000, true, true, HDMI_RES_AR_16_9, 0}
+ 288, 2, 3, 19, true, 27000, 50000, true, false, HDMI_RES_AR_16_9, 0}
#define HDMI_VFRMT_1920x1080p50_16_9_TIMING \
{HDMI_VFRMT_1920x1080p50_16_9, 1920, 528, 44, 148, false, \
1080, 4, 5, 36, false, 148500, 50000, false, true, HDMI_RES_AR_16_9, 0}
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 21de9ad7f151..3f1b584bd5d0 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -479,7 +479,7 @@ static bool is_zspage_isolated(struct zspage *zspage)
return zspage->isolated;
}
-static int is_first_page(struct page *page)
+static __maybe_unused int is_first_page(struct page *page)
{
return PagePrivate(page);
}
@@ -564,20 +564,23 @@ static int get_size_class_index(int size)
return min(zs_size_classes - 1, idx);
}
+/* type can be of enum type zs_stat_type or fullness_group */
static inline void zs_stat_inc(struct size_class *class,
- enum zs_stat_type type, unsigned long cnt)
+ int type, unsigned long cnt)
{
class->stats.objs[type] += cnt;
}
+/* type can be of enum type zs_stat_type or fullness_group */
static inline void zs_stat_dec(struct size_class *class,
- enum zs_stat_type type, unsigned long cnt)
+ int type, unsigned long cnt)
{
class->stats.objs[type] -= cnt;
}
+/* type can be of enum type zs_stat_type or fullness_group */
static inline unsigned long zs_stat_get(struct size_class *class,
- enum zs_stat_type type)
+ int type)
{
return class->stats.objs[type];
}