diff --git a/packages/kernel/linux-drivers/RTL8188FU/package.mk b/packages/kernel/linux-drivers/RTL8188FU/package.mk index b36552212..77eb0f554 100644 --- a/packages/kernel/linux-drivers/RTL8188FU/package.mk +++ b/packages/kernel/linux-drivers/RTL8188FU/package.mk @@ -1,5 +1,5 @@ PKG_NAME="RTL8188FU" -PKG_VERSION="dfe0a50" +PKG_VERSION="f5df53df6e1e0f4c4d38df412ec35cd96c06cf23" PKG_LICENSE="GPL" PKG_SITE="https://github.com/kelebek333/rtl8188fu" PKG_URL="${PKG_SITE}.git" diff --git a/packages/kernel/linux-drivers/RTL8192EU/package.mk b/packages/kernel/linux-drivers/RTL8192EU/package.mk index ce5db333f..23ff96eb3 100644 --- a/packages/kernel/linux-drivers/RTL8192EU/package.mk +++ b/packages/kernel/linux-drivers/RTL8192EU/package.mk @@ -3,8 +3,8 @@ # Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="RTL8192EU" -PKG_VERSION="4c9751be79ef847ef44ef63203278f4f05f21e52" -PKG_SHA256="09a957d70eeec4042116b95a6614676645346dece3c53a467a1a13e8b33a1c83" +PKG_VERSION="e39c4e7a66b05fab6eceb2bb251d399c003fb544" +PKG_SHA256="7e16b1d7970a2d9d2c3af8d423cbb7fe522c4329088825ea5e9d2a3ec23e2a49" PKG_LICENSE="GPL" PKG_SITE="https://github.com/Mange/rtl8192eu-linux-driver" PKG_URL="https://github.com/Mange/rtl8192eu-linux-driver/archive/${PKG_VERSION}.tar.gz" diff --git a/packages/kernel/linux-drivers/RTL8812AU/package.mk b/packages/kernel/linux-drivers/RTL8812AU/package.mk index f4871c617..05e2c04ea 100644 --- a/packages/kernel/linux-drivers/RTL8812AU/package.mk +++ b/packages/kernel/linux-drivers/RTL8812AU/package.mk @@ -4,7 +4,7 @@ # Copyright (C) 2021-present Fewtarius PKG_NAME="RTL8812AU" -PKG_VERSION="8c13f8c" +PKG_VERSION="b7c68a25d41cf14da9f7176ccc260d6efba5c5db" PKG_LICENSE="GPL" PKG_SITE="https://github.com/morrownr/8812au-20210629" PKG_URL="${PKG_SITE}.git" diff --git a/packages/kernel/linux-drivers/RTL8814AU/package.mk b/packages/kernel/linux-drivers/RTL8814AU/package.mk index 1ea01168a..ff236292c 100644 --- a/packages/kernel/linux-drivers/RTL8814AU/package.mk +++ b/packages/kernel/linux-drivers/RTL8814AU/package.mk @@ -4,7 +4,7 @@ # Copyright (C) 2021-present Fewtarius PKG_NAME="RTL8814AU" -PKG_VERSION="a538e38" +PKG_VERSION="3f2f6805617bcfef66f2fd2129acbc87b181fd36" PKG_LICENSE="GPL" PKG_SITE="https://github.com/morrownr/8814au" PKG_URL="${PKG_SITE}.git" diff --git a/packages/kernel/linux-drivers/RTL8821AU/package.mk b/packages/kernel/linux-drivers/RTL8821AU/package.mk index 58206b9b2..d08fb4317 100644 --- a/packages/kernel/linux-drivers/RTL8821AU/package.mk +++ b/packages/kernel/linux-drivers/RTL8821AU/package.mk @@ -4,7 +4,7 @@ # Copyright (C) 2021-present Fewtarius PKG_NAME="RTL8821AU" -PKG_VERSION="377d3ca" +PKG_VERSION="b46c98dec45ae413add32b04a96253979b858bc6" PKG_LICENSE="GPL" PKG_SITE="https://github.com/morrownr/8821au-20210708" PKG_URL="${PKG_SITE}.git" diff --git a/packages/kernel/linux-drivers/RTL8821CU/package.mk b/packages/kernel/linux-drivers/RTL8821CU/package.mk index 1f1e23559..8b87d4379 100644 --- a/packages/kernel/linux-drivers/RTL8821CU/package.mk +++ b/packages/kernel/linux-drivers/RTL8821CU/package.mk @@ -4,7 +4,7 @@ # Copyright (C) 2021-present Fewtarius PKG_NAME="RTL8821CU" -PKG_VERSION="4dfe0bc" +PKG_VERSION="122ef09302885dfe2cb9ec9cf16a7df699d1cadb" PKG_LICENSE="GPL" PKG_SITE="https://github.com/morrownr/8821cu-20210118" PKG_URL="${PKG_SITE}.git" diff --git a/packages/kernel/linux-drivers/RTL88x2BU/package.mk b/packages/kernel/linux-drivers/RTL88x2BU/package.mk index 4b78f5ae1..3c952eb38 100644 --- a/packages/kernel/linux-drivers/RTL88x2BU/package.mk +++ b/packages/kernel/linux-drivers/RTL88x2BU/package.mk @@ -4,7 +4,7 @@ # Copyright (C) 2021-present Fewtarius PKG_NAME="RTL88x2BU" -PKG_VERSION="f56d097" +PKG_VERSION="6a2916db1a01625b9f2fc77d466f07e498735c44" PKG_LICENSE="GPL" PKG_SITE="https://github.com/morrownr/88x2bu-20210702" PKG_URL="${PKG_SITE}.git" diff --git a/packages/misc/modules/sources/PortMaster.sh b/packages/misc/modules/sources/PortMaster.sh index 3d2758774..7429f1de6 100755 --- a/packages/misc/modules/sources/PortMaster.sh +++ b/packages/misc/modules/sources/PortMaster.sh @@ -11,10 +11,11 @@ then sed -i -e "s#/dev/tty0#/dev/tty#" /storage/roms/ports/PortMaster.sh fi -cd /storage/roms/ports/PortMaster -./PortMaster.sh - if [ -e "/storage/roms/ports/PortMaster.sh" ] then mv /storage/roms/ports/PortMaster.sh /storage/roms/ports/PortMaster/ fi + +cd /storage/roms/ports/PortMaster +./PortMaster.sh 2>/dev/null + diff --git a/packages/misc/modules/sources/ThemeMaster.sh b/packages/misc/modules/sources/ThemeMaster.sh index db441f55f..3c9f19d0e 100755 --- a/packages/misc/modules/sources/ThemeMaster.sh +++ b/packages/misc/modules/sources/ThemeMaster.sh @@ -12,4 +12,4 @@ then fi cd /storage/roms/ports/ThemeMaster -./ThemeMaster.sh +./ThemeMaster.sh 2>/dev/null diff --git a/projects/Rockchip/devices/RG552/linux/linux.aarch64.conf b/projects/Rockchip/devices/RG552/linux/linux.aarch64.conf index 95bd66227..ee13db8e5 100644 --- a/projects/Rockchip/devices/RG552/linux/linux.aarch64.conf +++ b/projects/Rockchip/devices/RG552/linux/linux.aarch64.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 5.19.0-rc8 Kernel Configuration +# Linux/arm64 5.19.16 Kernel Configuration # CONFIG_CC_VERSION_TEXT="aarch64-libreelec-linux-gnueabi-gcc-10.3.0 (GCC) 10.3.0" CONFIG_CC_IS_GCC=y @@ -29,7 +29,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32 # CONFIG_WERROR is not set CONFIG_LOCALVERSION="" # CONFIG_LOCALVERSION_AUTO is not set -CONFIG_BUILD_SALT="-ragnarok" +CONFIG_BUILD_SALT="-JELOS" CONFIG_DEFAULT_INIT="" CONFIG_DEFAULT_HOSTNAME="@DEVICENAME@" CONFIG_SYSVIPC=y @@ -100,14 +100,14 @@ CONFIG_BPF_JIT_DEFAULT_ON=y # CONFIG_BPF_PRELOAD is not set # end of BPF subsystem -CONFIG_PREEMPT_BUILD=y +CONFIG_HAVE_PREEMPT_LAZY=y +CONFIG_PREEMPT_LAZY=y # CONFIG_PREEMPT_NONE is not set # CONFIG_PREEMPT_VOLUNTARY is not set -CONFIG_PREEMPT=y +# CONFIG_PREEMPT is not set +CONFIG_PREEMPT_RT=y CONFIG_PREEMPT_COUNT=y CONFIG_PREEMPTION=y -# CONFIG_PREEMPT_DYNAMIC is not set -CONFIG_PREEMPT_RT=y # # CPU/Task time and stats accounting @@ -136,6 +136,8 @@ CONFIG_TASKS_RCU=y CONFIG_TASKS_TRACE_RCU=y CONFIG_RCU_STALL_COMMON=y CONFIG_RCU_NEED_SEGCBLIST=y +CONFIG_RCU_BOOST=y +CONFIG_RCU_BOOST_DELAY=500 CONFIG_RCU_NOCB_CPU=y # end of RCU Subsystem @@ -226,6 +228,7 @@ CONFIG_SYSFS_SYSCALL=y CONFIG_FHANDLE=y CONFIG_POSIX_TIMERS=y CONFIG_PRINTK=y +CONFIG_HAVE_ATOMIC_CONSOLE=y # CONFIG_BUG is not set CONFIG_BASE_FULL=y CONFIG_FUTEX=y @@ -339,6 +342,7 @@ CONFIG_ARCH_ROCKCHIP=y # CONFIG_ARM64_ERRATUM_819472 is not set # CONFIG_ARM64_ERRATUM_832075 is not set CONFIG_ARM64_ERRATUM_834220=y +CONFIG_ARM64_ERRATUM_1742098=y # CONFIG_ARM64_ERRATUM_845719 is not set # CONFIG_ARM64_ERRATUM_843419 is not set CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y @@ -347,6 +351,7 @@ CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y # CONFIG_ARM64_ERRATUM_1165522 is not set # CONFIG_ARM64_ERRATUM_1319367 is not set # CONFIG_ARM64_ERRATUM_1530923 is not set +CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y # CONFIG_ARM64_ERRATUM_1286807 is not set # CONFIG_ARM64_ERRATUM_1463225 is not set # CONFIG_ARM64_ERRATUM_1542419 is not set @@ -355,6 +360,7 @@ CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y CONFIG_ARM64_ERRATUM_2077057=y # CONFIG_ARM64_ERRATUM_2054223 is not set # CONFIG_ARM64_ERRATUM_2067961 is not set +CONFIG_ARM64_ERRATUM_2441009=y # CONFIG_CAVIUM_ERRATUM_22375 is not set # CONFIG_CAVIUM_ERRATUM_23154 is not set # CONFIG_CAVIUM_ERRATUM_27456 is not set @@ -481,8 +487,6 @@ CONFIG_ARCH_NR_GPIO=0 # Boot options # CONFIG_CMDLINE="" -CONFIG_CMDLINE_FROM_BOOTLOADER=y -# CONFIG_CMDLINE_FORCE is not set # CONFIG_EFI is not set # end of Boot options @@ -615,6 +619,7 @@ CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE=y CONFIG_HAVE_FUNCTION_ERROR_INJECTION=y CONFIG_HAVE_NMI=y CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y CONFIG_HAVE_ARCH_TRACEHOOK=y CONFIG_HAVE_DMA_CONTIGUOUS=y CONFIG_GENERIC_SMP_IDLE_THREAD=y @@ -673,6 +678,7 @@ CONFIG_CLONE_BACKWARDS=y CONFIG_OLD_SIGSUSPEND3=y CONFIG_COMPAT_OLD_SIGACTION=y CONFIG_COMPAT_32BIT_TIME=y +CONFIG_ARCH_SUPPORTS_RT=y CONFIG_HAVE_ARCH_VMAP_STACK=y CONFIG_VMAP_STACK=y CONFIG_HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET=y @@ -785,7 +791,6 @@ CONFIG_LOCK_SPIN_ON_OWNER=y CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y CONFIG_QUEUED_SPINLOCKS=y CONFIG_ARCH_USE_QUEUED_RWLOCKS=y -CONFIG_QUEUED_RWLOCKS=y CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE=y CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y CONFIG_FREEZER=y @@ -815,9 +820,7 @@ CONFIG_ZSMALLOC=y # # SLAB allocator options # -# CONFIG_SLAB is not set CONFIG_SLUB=y -# CONFIG_SLOB is not set # CONFIG_SLAB_MERGE_DEFAULT is not set # CONFIG_SLAB_FREELIST_RANDOM is not set # CONFIG_SLAB_FREELIST_HARDENED is not set @@ -847,7 +850,6 @@ CONFIG_MMU_NOTIFIER=y CONFIG_DEFAULT_MMAP_MIN_ADDR=32768 CONFIG_ARCH_SUPPORTS_MEMORY_FAILURE=y # CONFIG_MEMORY_FAILURE is not set -# CONFIG_TRANSPARENT_HUGEPAGE is not set # CONFIG_CMA is not set CONFIG_GENERIC_EARLY_IOREMAP=y # CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set @@ -1356,7 +1358,6 @@ CONFIG_SOCK_RX_QUEUE_MAPPING=y CONFIG_XPS=y CONFIG_CGROUP_NET_PRIO=y CONFIG_CGROUP_NET_CLASSID=y -CONFIG_NET_RX_BUSY_POLL=y CONFIG_BQL=y CONFIG_NET_FLOW_LIMIT=y @@ -2382,7 +2383,7 @@ CONFIG_USB_NET_RNDIS_HOST=y # CONFIG_USB_VL600 is not set # CONFIG_USB_NET_CH9200 is not set # CONFIG_USB_NET_AQC111 is not set -# CONFIG_USB_RTL8153_ECM is not set +CONFIG_USB_RTL8153_ECM=y CONFIG_WLAN=y CONFIG_WLAN_VENDOR_ADMTEK=y # CONFIG_ADM8211 is not set @@ -2597,6 +2598,7 @@ CONFIG_INPUT_FF_MEMLESS=y CONFIG_INPUT_POLLDEV=y # CONFIG_INPUT_SPARSEKMAP is not set CONFIG_INPUT_MATRIXKMAP=y +CONFIG_INPUT_VIVALDIFMAP=y # # Userland interfaces @@ -2606,9 +2608,6 @@ CONFIG_INPUT_JOYDEV=y CONFIG_INPUT_EVDEV=y # CONFIG_INPUT_EVBUG is not set -# -# Input Device Drivers -# # # Input Device Drivers # @@ -2617,8 +2616,10 @@ CONFIG_KEYBOARD_ADC=y # CONFIG_KEYBOARD_ADP5588 is not set # CONFIG_KEYBOARD_ADP5589 is not set CONFIG_KEYBOARD_ATKBD=y +# CONFIG_KEYBOARD_QT1050 is not set # CONFIG_KEYBOARD_QT1070 is not set # CONFIG_KEYBOARD_QT2160 is not set +# CONFIG_KEYBOARD_DLINK_DIR685 is not set # CONFIG_KEYBOARD_LKKBD is not set CONFIG_KEYBOARD_GPIO=y CONFIG_KEYBOARD_GPIO_POLLED=y @@ -2636,11 +2637,11 @@ CONFIG_KEYBOARD_GPIO_POLLED=y # CONFIG_KEYBOARD_STOWAWAY is not set # CONFIG_KEYBOARD_SUNKBD is not set # CONFIG_KEYBOARD_OMAP4 is not set -CONFIG_KEYBOARD_ROCKCHIP=y +# CONFIG_KEYBOARD_TM2_TOUCHKEY is not set # CONFIG_KEYBOARD_XTKBD is not set -CONFIG_KEYBOARD_CROS_EC=y # CONFIG_KEYBOARD_CAP11XX is not set # CONFIG_KEYBOARD_BCM is not set +# CONFIG_KEYBOARD_CYPRESS_SF is not set CONFIG_INPUT_MOUSE=y # CONFIG_MOUSE_PS2 is not set # CONFIG_MOUSE_SERIAL is not set @@ -2838,7 +2839,7 @@ CONFIG_SERIO=y CONFIG_SERIO_SERPORT=m # CONFIG_SERIO_AMBAKMI is not set # CONFIG_SERIO_PCIPS2 is not set -# CONFIG_SERIO_LIBPS2 is not set +CONFIG_SERIO_LIBPS2=y # CONFIG_SERIO_RAW is not set # CONFIG_SERIO_ALTERA_PS2 is not set # CONFIG_SERIO_PS2MULT is not set @@ -3294,7 +3295,6 @@ CONFIG_CHARGER_BQ24735=y # CONFIG_CHARGER_BQ25890 is not set # CONFIG_CHARGER_BQ25980 is not set # CONFIG_CHARGER_BQ256XX is not set -CONFIG_CHARGER_RK817=y # CONFIG_CHARGER_SMB347 is not set # CONFIG_BATTERY_GAUGE_LTC2941 is not set # CONFIG_BATTERY_GOLDFISH is not set @@ -4712,7 +4712,6 @@ CONFIG_DRM_PANEL_BRIDGE=y # CONFIG_DRM_CHIPONE_ICN6211 is not set # CONFIG_DRM_CHRONTEL_CH7033 is not set CONFIG_DRM_DISPLAY_CONNECTOR=y -# CONFIG_DRM_FSL_LDB is not set # CONFIG_DRM_ITE_IT6505 is not set # CONFIG_DRM_LONTIUM_LT8912B is not set # CONFIG_DRM_LONTIUM_LT9211 is not set @@ -5293,7 +5292,6 @@ CONFIG_HID_ALPS=y CONFIG_USB_HID=y # CONFIG_HID_PID is not set CONFIG_USB_HIDDEV=y -CONFIG_HID_LOGITECH=y # end of USB HID support # @@ -5574,26 +5572,6 @@ CONFIG_USB_CONFIGFS_ACM=y CONFIG_USB_CONFIGFS_MASS_STORAGE=y # CONFIG_USB_CONFIGFS_F_LB_SS is not set CONFIG_USB_CONFIGFS_F_FS=y -# CONFIG_USB_ZERO is not set -# CONFIG_USB_AUDIO is not set -# CONFIG_USB_ETH is not set -# CONFIG_USB_G_NCM is not set -CONFIG_USB_GADGETFS=m -CONFIG_USB_FUNCTIONFS=m -# CONFIG_USB_FUNCTIONFS_ETH is not set -# CONFIG_USB_FUNCTIONFS_RNDIS is not set -CONFIG_USB_FUNCTIONFS_GENERIC=y -CONFIG_USB_MASS_STORAGE=m -CONFIG_USB_G_SERIAL=m -# CONFIG_USB_MIDI_GADGET is not set -# CONFIG_USB_G_PRINTER is not set -# CONFIG_USB_CDC_COMPOSITE is not set -# CONFIG_USB_G_ACM_MS is not set -# CONFIG_USB_G_MULTI is not set -# CONFIG_USB_G_HID is not set -# CONFIG_USB_G_DBGP is not set -# CONFIG_USB_G_WEBCAM is not set -# CONFIG_USB_RAW_GADGET is not set # CONFIG_USB_CONFIGFS_F_UAC1 is not set # CONFIG_USB_CONFIGFS_F_UAC1_LEGACY is not set # CONFIG_USB_CONFIGFS_F_UAC2 is not set @@ -5765,7 +5743,6 @@ CONFIG_LEDS_TRIGGER_ONESHOT=y CONFIG_LEDS_TRIGGER_DISK=y CONFIG_LEDS_TRIGGER_HEARTBEAT=y CONFIG_LEDS_TRIGGER_BACKLIGHT=y -CONFIG_LEDS_TRIGGER_CPU=y # CONFIG_LEDS_TRIGGER_ACTIVITY is not set CONFIG_LEDS_TRIGGER_GPIO=y CONFIG_LEDS_TRIGGER_DEFAULT_ON=y @@ -7241,7 +7218,6 @@ CONFIG_CRYPTO_CRC32C=y CONFIG_CRYPTO_CRC32=y # CONFIG_CRYPTO_XXHASH is not set # CONFIG_CRYPTO_BLAKE2B is not set -# CONFIG_CRYPTO_BLAKE2S is not set CONFIG_CRYPTO_CRCT10DIF=y # CONFIG_CRYPTO_CRC64_ROCKSOFT is not set CONFIG_CRYPTO_GHASH=y @@ -7601,7 +7577,6 @@ CONFIG_LOCK_DEBUGGING_SUPPORT=y # CONFIG_LOCK_STAT is not set # CONFIG_DEBUG_RT_MUTEXES is not set CONFIG_DEBUG_SPINLOCK=y -# CONFIG_DEBUG_MUTEXES is not set # CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set # CONFIG_DEBUG_RWSEMS is not set # CONFIG_DEBUG_LOCK_ALLOC is not set diff --git a/projects/Rockchip/packages/linux/package.mk b/projects/Rockchip/packages/linux/package.mk index a9971d494..20da0b3dd 100644 --- a/projects/Rockchip/packages/linux/package.mk +++ b/projects/Rockchip/packages/linux/package.mk @@ -17,12 +17,12 @@ PKG_IS_KERNEL_PKG="yes" PKG_STAMP="${KERNEL_TARGET} ${KERNEL_MAKE_EXTRACMD}" PKG_PATCH_DIRS+="${DEVICE}" PKG_GIT_CLONE_BRANCH="main" -GET_HANDLER_SUPPORT="git" case ${DEVICE} in RG351P|RG351V|RG351MP) PKG_URL="${PKG_SITE}/rk3326-kernel.git" PKG_VERSION="a19b4df7c" + GET_HANDLER_SUPPORT="git" ;; RG552) PKG_VERSION="5.19.16" @@ -32,6 +32,7 @@ case ${DEVICE} in RG353P|RG503) PKG_URL="${PKG_SITE}/rk356x-kernel.git" PKG_VERSION="7e1b435e1" + GET_HANDLER_SUPPORT="git" ;; esac diff --git a/projects/Rockchip/packages/linux/patches/RG552/rk3399-mainline.patch b/projects/Rockchip/packages/linux/patches/RG552/rk3399-mainline.patch index 0ed44a289..2aeeb499f 100644 --- a/projects/Rockchip/packages/linux/patches/RG552/rk3399-mainline.patch +++ b/projects/Rockchip/packages/linux/patches/RG552/rk3399-mainline.patch @@ -1,18 +1,42 @@ -diff -rupN linux-5.19.16.orig/arch/arm64/boot/dts/rockchip/Makefile linux-5.19.16/arch/arm64/boot/dts/rockchip/Makefile ---- linux-5.19.16.orig/arch/arm64/boot/dts/rockchip/Makefile 2022-10-18 17:21:09.156513337 -0400 -+++ linux-5.19.16/arch/arm64/boot/dts/rockchip/Makefile 2022-10-18 18:31:56.495365497 -0400 -@@ -42,6 +42,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-na - dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-orangepi.dtb +diff --git a/Makefile b/Makefile +index cfbe6a7de640..9d7efe88dffb 100644 +--- a/Makefile ++++ b/Makefile +@@ -819,6 +819,8 @@ KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) + KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) + KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) + KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) ++KBUILD_CFLAGS += $(call cc-disable-warning, unused-label) ++KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) + + ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE + KBUILD_CFLAGS += -O2 +@@ -1068,7 +1070,7 @@ endif + KBUILD_CFLAGS += -Werror=date-time + + # enforce correct pointer usage +-KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types) ++# KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types) + + # Require designated initializers for all marked structures + KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init) +diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile +index 8c15593c0ca4..959e3900fba5 100644 +--- a/arch/arm64/boot/dts/rockchip/Makefile ++++ b/arch/arm64/boot/dts/rockchip/Makefile +@@ -46,6 +46,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-orangepi.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-pinebook-pro.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-pinephone-pro.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-puma-haikou.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rg552-linux.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc-mezzanine.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc-plus.dtb -diff -rupN linux-5.19.16.orig/arch/arm64/boot/dts/rockchip/rk3399-opp.dtsi linux-5.19.16/arch/arm64/boot/dts/rockchip/rk3399-opp.dtsi ---- linux-5.19.16.orig/arch/arm64/boot/dts/rockchip/rk3399-opp.dtsi 2022-10-18 17:21:09.156513337 -0400 -+++ linux-5.19.16/arch/arm64/boot/dts/rockchip/rk3399-opp.dtsi 2022-10-18 18:31:56.495365497 -0400 -@@ -101,6 +101,10 @@ +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-opp.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-opp.dtsi +index fee5e7111279..ed30638a6aa3 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-opp.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-opp.dtsi +@@ -101,6 +101,10 @@ opp05 { opp-hz = /bits/ 64 <800000000>; opp-microvolt = <1100000 1100000 1150000>; }; @@ -23,9 +47,11 @@ diff -rupN linux-5.19.16.orig/arch/arm64/boot/dts/rockchip/rk3399-opp.dtsi linux }; }; -diff -rupN linux-5.19.16.orig/arch/arm64/boot/dts/rockchip/rk3399-rg552-linux.dts linux-5.19.16/arch/arm64/boot/dts/rockchip/rk3399-rg552-linux.dts ---- linux-5.19.16.orig/arch/arm64/boot/dts/rockchip/rk3399-rg552-linux.dts 1969-12-31 19:00:00.000000000 -0500 -+++ linux-5.19.16/arch/arm64/boot/dts/rockchip/rk3399-rg552-linux.dts 2022-10-18 18:31:56.495365497 -0400 +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rg552-linux.dts b/arch/arm64/boot/dts/rockchip/rk3399-rg552-linux.dts +new file mode 100644 +index 000000000000..ddd87d3f943a +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rg552-linux.dts @@ -0,0 +1,1407 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* @@ -1434,9 +1460,11 @@ diff -rupN linux-5.19.16.orig/arch/arm64/boot/dts/rockchip/rk3399-rg552-linux.dt +&vopl_mmu { + status = "okay"; +}; -diff -rupN linux-5.19.16.orig/arch/arm64/configs/rg552_defconfig linux-5.19.16/arch/arm64/configs/rg552_defconfig ---- linux-5.19.16.orig/arch/arm64/configs/rg552_defconfig 1969-12-31 19:00:00.000000000 -0500 -+++ linux-5.19.16/arch/arm64/configs/rg552_defconfig 2022-10-18 18:31:56.499365511 -0400 +diff --git a/arch/arm64/configs/rg552_defconfig b/arch/arm64/configs/rg552_defconfig +new file mode 100644 +index 000000000000..38a272f8b053 +--- /dev/null ++++ b/arch/arm64/configs/rg552_defconfig @@ -0,0 +1,7577 @@ +# +# Automatically generated file; DO NOT EDIT. @@ -9015,10 +9043,11 @@ diff -rupN linux-5.19.16.orig/arch/arm64/configs/rg552_defconfig linux-5.19.16/a +# CONFIG_MEMTEST is not set +# end of Kernel Testing and Coverage +# end of Kernel hacking -diff -rupN linux-5.19.16.orig/drivers/gpu/drm/panel/Kconfig linux-5.19.16/drivers/gpu/drm/panel/Kconfig ---- linux-5.19.16.orig/drivers/gpu/drm/panel/Kconfig 2022-10-18 17:21:09.884507731 -0400 -+++ linux-5.19.16/drivers/gpu/drm/panel/Kconfig 2022-10-18 18:31:56.503365526 -0400 -@@ -577,6 +577,15 @@ config DRM_PANEL_SHARP_LS043T1LE01 +diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig +index a582ddd583c2..65618a7896ee 100644 +--- a/drivers/gpu/drm/panel/Kconfig ++++ b/drivers/gpu/drm/panel/Kconfig +@@ -588,6 +588,15 @@ config DRM_PANEL_SHARP_LS043T1LE01 Say Y here if you want to enable support for Sharp LS043T1LE01 qHD (540x960) DSI panel as found on the Qualcomm APQ8074 Dragonboard @@ -9034,10 +9063,11 @@ diff -rupN linux-5.19.16.orig/drivers/gpu/drm/panel/Kconfig linux-5.19.16/driver config DRM_PANEL_SHARP_LS060T1SX01 tristate "Sharp LS060T1SX01 FullHD video mode panel" depends on OF -diff -rupN linux-5.19.16.orig/drivers/gpu/drm/panel/Makefile linux-5.19.16/drivers/gpu/drm/panel/Makefile ---- linux-5.19.16.orig/drivers/gpu/drm/panel/Makefile 2022-10-18 17:21:09.884507731 -0400 -+++ linux-5.19.16/drivers/gpu/drm/panel/Makefile 2022-10-18 18:31:56.511365555 -0400 -@@ -58,6 +58,7 @@ obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += +diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile +index 34e717382dbb..b99d0950c6fa 100644 +--- a/drivers/gpu/drm/panel/Makefile ++++ b/drivers/gpu/drm/panel/Makefile +@@ -59,6 +59,7 @@ obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += panel-seiko-43wvf1g.o obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o obj-$(CONFIG_DRM_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o @@ -9045,10 +9075,12 @@ diff -rupN linux-5.19.16.orig/drivers/gpu/drm/panel/Makefile linux-5.19.16/drive obj-$(CONFIG_DRM_PANEL_SHARP_LS060T1SX01) += panel-sharp-ls060t1sx01.o obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7701) += panel-sitronix-st7701.o obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7703) += panel-sitronix-st7703.o -diff -rupN linux-5.19.16.orig/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c linux-5.19.16/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c ---- linux-5.19.16.orig/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c 1969-12-31 19:00:00.000000000 -0500 -+++ linux-5.19.16/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c 2022-10-18 18:31:56.511365555 -0400 -@@ -0,0 +1,369 @@ +diff --git a/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c b/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c +new file mode 100644 +index 000000000000..b177b43c04e5 +--- /dev/null ++++ b/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c +@@ -0,0 +1,367 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2022 Maya Matuszczyk @@ -9385,7 +9417,7 @@ diff -rupN linux-5.19.16.orig/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c li + return 0; +} + -+static int sharp_ls054_remove(struct mipi_dsi_device *dsi) ++static void sharp_ls054_remove(struct mipi_dsi_device *dsi) +{ + struct sharp_ls054 *ctx = mipi_dsi_get_drvdata(dsi); + int ret; @@ -9395,8 +9427,6 @@ diff -rupN linux-5.19.16.orig/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c li + dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); + + drm_panel_remove(&ctx->panel); -+ -+ return 0; +} + +static const struct of_device_id sharp_ls054b3sx01_of_match[] = { @@ -9418,239 +9448,47 @@ diff -rupN linux-5.19.16.orig/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c li +MODULE_AUTHOR("Maya Matuszczyk "); +MODULE_DESCRIPTION("Panel driver for Sharp LS054B3SX01 1152x1080 Video Mode DSI Panel"); +MODULE_LICENSE("GPL v2"); -diff -rupN linux-5.19.16.orig/drivers/gpu/drm/panel/panel-sitronix-st7701.c linux-5.19.16/drivers/gpu/drm/panel/panel-sitronix-st7701.c ---- linux-5.19.16.orig/drivers/gpu/drm/panel/panel-sitronix-st7701.c 2022-10-18 17:21:09.884507731 -0400 -+++ linux-5.19.16/drivers/gpu/drm/panel/panel-sitronix-st7701.c 2022-10-18 18:31:56.511365555 -0400 -@@ -25,6 +25,11 @@ - #define DSI_CMD2_BK0_LNESET 0xC0 /* Display Line setting */ - #define DSI_CMD2_BK0_PORCTRL 0xC1 /* Porch control */ - #define DSI_CMD2_BK0_INVSEL 0xC2 /* Inversion selection, Frame Rate Control */ -+#define DSI_CMD2_BK0_SECTRL1 0xE0 /* Sunlight Readable Enhancement */ -+#define DSI_CMD2_BK0_NRCTRL 0xE1 /* Noise Reduce Control */ -+#define DSI_CMD2_BK0_SECTRL2 0xE2 /* Sharpness Control */ -+#define DSI_CMD2_BK0_CCCTRL 0xE3 /* Color Calibration Control */ -+#define DSI_CMD2_BK0_SKCTRL 0xE4 /* Skin Tone Preservation Control */ +diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig +index e2752f7364bc..061b5de1fe7b 100644 +--- a/drivers/input/Kconfig ++++ b/drivers/input/Kconfig +@@ -51,6 +51,19 @@ config INPUT_FF_MEMLESS + To compile this driver as a module, choose M here: the + module will be called ff-memless. - /* Command2, BK1 commands */ - #define DSI_CMD2_BK1_VRHS 0xB0 /* Vop amplitude setting */ -@@ -86,6 +91,8 @@ - #define DSI_MIPISET1_EOT_EN BIT(3) - #define DSI_CMD2_BK1_MIPISET1_SET (BIT(7) | DSI_MIPISET1_EOT_EN) - -+struct st7701; ++config INPUT_POLLDEV ++ tristate "Polled input device skeleton" ++ help ++ Say Y here if you are using a driver for an input ++ device that periodically polls hardware state. This ++ option is only useful for out-of-tree drivers since ++ in-tree drivers select it automatically. + - struct st7701_panel_desc { - const struct drm_display_mode *mode; - unsigned int lanes; -@@ -94,6 +101,8 @@ struct st7701_panel_desc { - const char *const *supply_names; - unsigned int num_supplies; - unsigned int panel_sleep_delay; -+ void (*init_sequence)(struct st7701 *st7701); -+ unsigned int reset_level; - }; - - struct st7701 { -@@ -104,6 +113,7 @@ struct st7701 { - struct regulator_bulk_data *supplies; - struct gpio_desc *reset; - unsigned int sleep_delay; -+ enum drm_panel_orientation orientation; - }; - - static inline struct st7701 *panel_to_st7701(struct drm_panel *panel) -@@ -123,7 +133,7 @@ static inline int st7701_dsi_write(struc - st7701_dsi_write(st7701, d, ARRAY_SIZE(d)); \ - } - --static void st7701_init_sequence(struct st7701 *st7701) -+static void ts8550b_init_sequence(struct st7701 *st7701) - { - const struct drm_display_mode *mode = st7701->desc->mode; - -@@ -194,12 +204,81 @@ static void st7701_init_sequence(struct - 0x77, 0x01, 0x00, 0x00, DSI_CMD2BKX_SEL_NONE); - } - -+static void kd50t048a_init_sequence(struct st7701 *st7701) -+{ -+ ST7701_DSI(st7701, MIPI_DCS_SOFT_RESET, 0x00); ++ If unsure, say N. + -+ /* We need to wait 5ms before sending new commands */ -+ usleep_range(5000, 10000); ++ To compile this driver as a module, choose M here: the ++ module will be called input-polldev. + -+ ST7701_DSI(st7701, MIPI_DCS_EXIT_SLEEP_MODE, 0x00); -+ -+ msleep(st7701->sleep_delay); -+ -+ ST7701_DSI(st7701, DSI_CMD2BKX_SEL, -+ 0x77, 0x01, 0x00, 0x00, DSI_CMD2BK0_SEL); -+ /* Command2, BK0 */ -+ ST7701_DSI(st7701, DSI_CMD2_BK0_PVGAMCTRL, 0x00, 0x0D, 0x14, 0x0D, -+ 0x10, 0x05, 0x02, 0x08, 0x08, 0x1E, 0x05, 0x13, 0x11, -+ 0xA3, 0x29, 0x18); -+ ST7701_DSI(st7701, DSI_CMD2_BK0_NVGAMCTRL, 0x00, 0x0C, 0x14, 0x0C, -+ 0x10, 0x05, 0x03, 0x08, 0x07, 0x20, 0x05, 0x13, 0x11, -+ 0xA4, 0x29, 0x18); -+ ST7701_DSI(st7701, DSI_CMD2_BK0_LNESET, 0xE9, 0x03); -+ ST7701_DSI(st7701, DSI_CMD2_BK0_PORCTRL, 0x11, 0x02); -+ ST7701_DSI(st7701, DSI_CMD2_BK0_INVSEL, 0x31, 0x08); -+ -+ /* Command2, BK1 */ -+ ST7701_DSI(st7701, DSI_CMD2BKX_SEL, 0x77, 0x01, 0x00, 0x00, DSI_CMD2BK1_SEL); -+ ST7701_DSI(st7701, DSI_CMD2_BK1_VRHS, 0x6C); -+ ST7701_DSI(st7701, DSI_CMD2_BK1_VCOM, 0x43); -+ ST7701_DSI(st7701, DSI_CMD2_BK1_VGHSS, 0x07); -+ ST7701_DSI(st7701, DSI_CMD2_BK1_TESTCMD, 0x80); -+ ST7701_DSI(st7701, DSI_CMD2_BK1_VGLS, 0x47); -+ ST7701_DSI(st7701, DSI_CMD2_BK1_PWCTLR1, 0x85); -+ ST7701_DSI(st7701, DSI_CMD2_BK1_PWCTLR2, 0x20); -+ ST7701_DSI(st7701, DSI_CMD2_BK1_SPD1, 0x78); -+ ST7701_DSI(st7701, DSI_CMD2_BK1_SPD2, 0x78); -+ ST7701_DSI(st7701, DSI_CMD2_BK1_MIPISET1, 0x88); -+ -+ /** -+ * ST7701_SPEC_V1.2 is unable to provide enough information above this -+ * specific command sequence, so grab the same from vendor BSP driver. -+ */ -+ ST7701_DSI(st7701, DSI_CMD2_BK0_SECTRL1, 0x00, 0x00, 0x02); -+ ST7701_DSI(st7701, DSI_CMD2_BK0_NRCTRL, 0x08, 0x00, 0x0A, 0x00, 0x07, 0x00, 0x09, -+ 0x00, 0x00, 0x33, 0x33); -+ ST7701_DSI(st7701, DSI_CMD2_BK0_SECTRL2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); -+ ST7701_DSI(st7701, DSI_CMD2_BK0_CCCTRL, 0x00, 0x00, 0x33, 0x33); -+ ST7701_DSI(st7701, DSI_CMD2_BK0_SKCTRL, 0x44, 0x44); -+ ST7701_DSI(st7701, 0xE5, 0x0E, 0x60, 0xA0, 0xA0, 0x10, 0x60, 0xA0, -+ 0xA0, 0x0A, 0x60, 0xA0, 0xA0, 0x0C, 0x60, 0xA0, 0xA0); -+ ST7701_DSI(st7701, 0xE6, 0x00, 0x00, 0x33, 0x33); -+ ST7701_DSI(st7701, 0xE7, 0x44, 0x44); -+ ST7701_DSI(st7701, 0xE8, 0x0D, 0x60, 0xA0, 0xA0, 0x0F, 0x60, 0xA0, -+ 0xA0, 0x09, 0x60, 0xA0, 0xA0, 0x0B, 0x60, 0xA0, 0xA0); -+ ST7701_DSI(st7701, 0xEB, 0x02, 0x01, 0xE4, 0xE4, 0x44, 0x00, 0x40); -+ ST7701_DSI(st7701, 0xEC, 0x02, 0x01); -+ ST7701_DSI(st7701, 0xED, 0xAB, 0x89, 0x76, 0x54, 0x01, 0xFF, 0xFF, -+ 0xFF, 0xFF, 0xFF, 0xFF, 0x10, 0x45, 0x67, 0x98, 0xBA); -+ /* disable Command2 */ -+ ST7701_DSI(st7701, DSI_CMD2BKX_SEL, -+ 0x77, 0x01, 0x00, 0x00, DSI_CMD2BKX_SEL_NONE); -+ -+ ST7701_DSI(st7701, MIPI_DCS_SET_PIXEL_FORMAT, 0x70); -+ ST7701_DSI(st7701, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0xEC); -+ ST7701_DSI(st7701, MIPI_DCS_WRITE_POWER_SAVE, 0xB3); -+ ST7701_DSI(st7701, MIPI_DCS_SET_CABC_MIN_BRIGHTNESS, 0xFF); -+} -+ -+ - static int st7701_prepare(struct drm_panel *panel) - { - struct st7701 *st7701 = panel_to_st7701(panel); - int ret; + config INPUT_SPARSEKMAP + tristate "Sparse keymap support library" + help +diff --git a/drivers/input/Makefile b/drivers/input/Makefile +index 2266c7d010ef..e0c6fc3146e9 100644 +--- a/drivers/input/Makefile ++++ b/drivers/input/Makefile +@@ -10,6 +10,7 @@ input-core-y := input.o input-compat.o input-mt.o input-poller.o ff-core.o + input-core-y += touchscreen.o -- gpiod_set_value(st7701->reset, 0); -+ gpiod_set_value(st7701->reset, st7701->desc->reset_level); - - ret = regulator_bulk_enable(st7701->desc->num_supplies, - st7701->supplies); -@@ -207,10 +286,10 @@ static int st7701_prepare(struct drm_pan - return ret; - msleep(20); - -- gpiod_set_value(st7701->reset, 1); -+ gpiod_set_value(st7701->reset, !st7701->desc->reset_level); - msleep(150); - -- st7701_init_sequence(st7701); -+ st7701->desc->init_sequence(st7701); - - return 0; - } -@@ -241,7 +320,7 @@ static int st7701_unprepare(struct drm_p - - msleep(st7701->sleep_delay); - -- gpiod_set_value(st7701->reset, 0); -+ gpiod_set_value(st7701->reset, st7701->desc->reset_level); - - /** - * During the Resetting period, the display will be blanked -@@ -280,6 +359,8 @@ static int st7701_get_modes(struct drm_p - connector->display_info.width_mm = desc_mode->width_mm; - connector->display_info.height_mm = desc_mode->height_mm; - -+ drm_connector_set_panel_orientation(connector, st7701->orientation); -+ - return 1; - } - -@@ -323,6 +404,44 @@ static const struct st7701_panel_desc ts - .supply_names = ts8550b_supply_names, - .num_supplies = ARRAY_SIZE(ts8550b_supply_names), - .panel_sleep_delay = 80, /* panel need extra 80ms for sleep out cmd */ -+ .reset_level = 0, -+ .init_sequence = ts8550b_init_sequence, -+}; -+ -+static const struct drm_display_mode kd50t048a_mode = { -+ .clock = 27500, -+ -+ .hdisplay = 480, -+ .hsync_start = 480 + 2, -+ .hsync_end = 480 + 2 + 10, -+ .htotal = 480 + 2 + 10 + 2, -+ -+ .vdisplay = 854, -+ .vsync_start = 854 + 12, -+ .vsync_end = 854 + 12 + 2, -+ .vtotal = 854 + 12 + 2 + 60, -+ -+ .width_mm = 69, -+ .height_mm = 139, -+ -+ .type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED, -+}; -+ -+static const char * const kd50t048a_supply_names[] = { -+ "VCC", -+ "IOVCC", -+}; -+ -+static const struct st7701_panel_desc kd50t048a_desc = { -+ .mode = &kd50t048a_mode, -+ .lanes = 2, -+ .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_VIDEO_BURST, -+ .format = MIPI_DSI_FMT_RGB888, -+ .supply_names = kd50t048a_supply_names, -+ .num_supplies = ARRAY_SIZE(kd50t048a_supply_names), -+ .panel_sleep_delay = 0, -+ .reset_level = 1, /* reset is inverted compared to ts8550b */ -+ .init_sequence = kd50t048a_init_sequence, - }; - - static int st7701_dsi_probe(struct mipi_dsi_device *dsi) -@@ -380,6 +499,12 @@ static int st7701_dsi_probe(struct mipi_ - - drm_panel_add(&st7701->panel); - -+ ret = of_drm_get_panel_orientation(dsi->dev.of_node, &st7701->orientation); -+ if (ret < 0) { -+ dev_err(&dsi->dev, "%pOF: failed to get orientation %d\n", &dsi->dev.of_node, ret); -+ return ret; -+ } -+ - mipi_dsi_set_drvdata(dsi, st7701); - st7701->dsi = dsi; - st7701->desc = desc; -@@ -399,6 +524,7 @@ static int st7701_dsi_remove(struct mipi - - static const struct of_device_id st7701_of_match[] = { - { .compatible = "techstar,ts8550b", .data = &ts8550b_desc }, -+ { .compatible = "elida,kd50t048a", .data = &kd50t048a_desc }, - { } - }; - MODULE_DEVICE_TABLE(of, st7701_of_match); -diff -rupN linux-5.19.16.orig/drivers/input/input-polldev.c linux-5.19.16/drivers/input/input-polldev.c ---- linux-5.19.16.orig/drivers/input/input-polldev.c 1969-12-31 19:00:00.000000000 -0500 -+++ linux-5.19.16/drivers/input/input-polldev.c 2022-10-18 18:31:56.511365555 -0400 + obj-$(CONFIG_INPUT_FF_MEMLESS) += ff-memless.o ++obj-$(CONFIG_INPUT_POLLDEV) += input-polldev.o + obj-$(CONFIG_INPUT_SPARSEKMAP) += sparse-keymap.o + obj-$(CONFIG_INPUT_MATRIXKMAP) += matrix-keymap.o + obj-$(CONFIG_INPUT_VIVALDIFMAP) += vivaldi-fmap.o +diff --git a/drivers/input/input-polldev.c b/drivers/input/input-polldev.c +new file mode 100644 +index 000000000000..9bf1c9aeb4c4 +--- /dev/null ++++ b/drivers/input/input-polldev.c @@ -0,0 +1,362 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* @@ -10014,127 +9852,10 @@ diff -rupN linux-5.19.16.orig/drivers/input/input-polldev.c linux-5.19.16/driver + input_unregister_device(dev->input); +} +EXPORT_SYMBOL(input_unregister_polled_device); -diff -rupN linux-5.19.16.orig/drivers/input/joystick/adc-joystick.c linux-5.19.16/drivers/input/joystick/adc-joystick.c ---- linux-5.19.16.orig/drivers/input/joystick/adc-joystick.c 2022-10-18 17:21:10.000506838 -0400 -+++ linux-5.19.16/drivers/input/joystick/adc-joystick.c 2022-10-18 18:31:56.511365555 -0400 -@@ -28,6 +28,17 @@ struct adc_joystick { - int num_chans; - }; - -+static void adc_joystick_poll(struct input_dev *input) -+{ -+ struct adc_joystick *joy = input_get_drvdata(input); -+ int i, val; -+ for (i = 0; i < joy->num_chans; i++) { -+ iio_read_channel_raw(&joy->chans[i], &val); -+ input_report_abs(input, joy->axes[i].code, val); -+ } -+ input_sync(input); -+} -+ - static int adc_joystick_handle(const void *data, void *private) - { - struct adc_joystick *joy = private; -@@ -179,6 +190,8 @@ static int adc_joystick_probe(struct pla - int error; - int bits; - int i; -+ int polling; -+ polling = 1; - - joy = devm_kzalloc(dev, sizeof(*joy), GFP_KERNEL); - if (!joy) -@@ -192,19 +205,26 @@ static int adc_joystick_probe(struct pla - return error; - } - -- /* Count how many channels we got. NULL terminated. */ -- for (i = 0; joy->chans[i].indio_dev; i++) { -- bits = joy->chans[i].channel->scan_type.storagebits; -- if (!bits || bits > 16) { -- dev_err(dev, "Unsupported channel storage size\n"); -- return -EINVAL; -- } -- if (bits != joy->chans[0].channel->scan_type.storagebits) { -- dev_err(dev, "Channels must have equal storage size\n"); -- return -EINVAL; -- } -+ if (polling == 0) -+ { -+ /* Count how many channels we got. NULL terminated. */ -+ for (i = 0; joy->chans[i].indio_dev; i++) { -+ bits = joy->chans[i].channel->scan_type.storagebits; -+ if (!bits || bits > 16) { -+ dev_err(dev, "Unsupported channel storage size\n"); -+ return -EINVAL; -+ } -+ if (bits != joy->chans[0].channel->scan_type.storagebits) { -+ dev_err(dev, "Channels must have equal storage size\n"); -+ return -EINVAL; -+ } -+ } -+ joy->num_chans = i; -+ } -+ else -+ { -+ joy->num_chans = device_get_child_node_count(dev); - } -- joy->num_chans = i; - - input = devm_input_allocate_device(dev); - if (!input) { -@@ -215,8 +235,17 @@ static int adc_joystick_probe(struct pla - joy->input = input; - input->name = pdev->name; - input->id.bustype = BUS_HOST; -- input->open = adc_joystick_open; -- input->close = adc_joystick_close; -+ -+ if (polling == 1) -+ { -+ input_setup_polling(input, adc_joystick_poll); -+ input_set_poll_interval(input, 10); -+ } -+ else -+ { -+ input->open = adc_joystick_open; -+ input->close = adc_joystick_close; -+ } - - error = adc_joystick_set_axes(dev, joy); - if (error) -@@ -229,16 +258,19 @@ static int adc_joystick_probe(struct pla - return error; - } - -- joy->buffer = iio_channel_get_all_cb(dev, adc_joystick_handle, joy); -- if (IS_ERR(joy->buffer)) { -- dev_err(dev, "Unable to allocate callback buffer\n"); -- return PTR_ERR(joy->buffer); -- } -+ if (polling == 0) -+ { -+ joy->buffer = iio_channel_get_all_cb(dev, adc_joystick_handle, joy); -+ if (IS_ERR(joy->buffer)) { -+ dev_err(dev, "Unable to allocate callback buffer\n"); -+ return PTR_ERR(joy->buffer); -+ } - -- error = devm_add_action_or_reset(dev, adc_joystick_cleanup, joy->buffer); -- if (error) { -- dev_err(dev, "Unable to add action\n"); -- return error; -+ error = devm_add_action_or_reset(dev, adc_joystick_cleanup, joy->buffer); -+ if (error) { -+ dev_err(dev, "Unable to add action\n"); -+ return error; -+ } - } - - return 0; -diff -rupN linux-5.19.16.orig/drivers/input/joystick/Kconfig linux-5.19.16/drivers/input/joystick/Kconfig ---- linux-5.19.16.orig/drivers/input/joystick/Kconfig 2022-10-18 17:21:10.000506838 -0400 -+++ linux-5.19.16/drivers/input/joystick/Kconfig 2022-10-18 18:31:56.511365555 -0400 +diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig +index 9dcf3f51f2dd..42eba36d3138 100644 +--- a/drivers/input/joystick/Kconfig ++++ b/drivers/input/joystick/Kconfig @@ -392,6 +392,12 @@ config JOYSTICK_FSIA6B To compile this driver as a module, choose M here: the module will be called fsia6b. @@ -10148,9 +9869,10 @@ diff -rupN linux-5.19.16.orig/drivers/input/joystick/Kconfig linux-5.19.16/drive config JOYSTICK_N64 bool "N64 controller" depends on MACH_NINTENDO64 -diff -rupN linux-5.19.16.orig/drivers/input/joystick/Makefile linux-5.19.16/drivers/input/joystick/Makefile ---- linux-5.19.16.orig/drivers/input/joystick/Makefile 2022-10-18 17:21:10.000506838 -0400 -+++ linux-5.19.16/drivers/input/joystick/Makefile 2022-10-18 18:31:56.511365555 -0400 +diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile +index 3937535f0098..d0aaa1a01c18 100644 +--- a/drivers/input/joystick/Makefile ++++ b/drivers/input/joystick/Makefile @@ -30,6 +30,7 @@ obj-$(CONFIG_JOYSTICK_PXRC) += pxrc.o obj-$(CONFIG_JOYSTICK_QWIIC) += qwiic-joystick.o obj-$(CONFIG_JOYSTICK_SENSEHAT) += sensehat-joystick.o @@ -10159,9 +9881,11 @@ diff -rupN linux-5.19.16.orig/drivers/input/joystick/Makefile linux-5.19.16/driv obj-$(CONFIG_JOYSTICK_SPACEBALL) += spaceball.o obj-$(CONFIG_JOYSTICK_SPACEORB) += spaceorb.o obj-$(CONFIG_JOYSTICK_STINGER) += stinger.o -diff -rupN linux-5.19.16.orig/drivers/input/joystick/singleadcjoy.c linux-5.19.16/drivers/input/joystick/singleadcjoy.c ---- linux-5.19.16.orig/drivers/input/joystick/singleadcjoy.c 1969-12-31 19:00:00.000000000 -0500 -+++ linux-5.19.16/drivers/input/joystick/singleadcjoy.c 2022-10-18 18:31:56.511365555 -0400 +diff --git a/drivers/input/joystick/singleadcjoy.c b/drivers/input/joystick/singleadcjoy.c +new file mode 100644 +index 000000000000..9db235407fc7 +--- /dev/null ++++ b/drivers/input/joystick/singleadcjoy.c @@ -0,0 +1,1416 @@ +/*----------------------------------------------------------------------------*/ + @@ -11579,91 +11303,11 @@ diff -rupN linux-5.19.16.orig/drivers/input/joystick/singleadcjoy.c linux-5.19.1 +/*----------------------------------------------------------------------------*/ +late_initcall(joypad_init); +module_exit(joypad_exit); -diff -rupN linux-5.19.16.orig/drivers/input/Kconfig linux-5.19.16/drivers/input/Kconfig ---- linux-5.19.16.orig/drivers/input/Kconfig 2022-10-18 17:21:09.996506869 -0400 -+++ linux-5.19.16/drivers/input/Kconfig 2022-10-18 18:31:56.511365555 -0400 -@@ -51,6 +51,19 @@ config INPUT_FF_MEMLESS - To compile this driver as a module, choose M here: the - module will be called ff-memless. - -+config INPUT_POLLDEV -+ tristate "Polled input device skeleton" -+ help -+ Say Y here if you are using a driver for an input -+ device that periodically polls hardware state. This -+ option is only useful for out-of-tree drivers since -+ in-tree drivers select it automatically. -+ -+ If unsure, say N. -+ -+ To compile this driver as a module, choose M here: the -+ module will be called input-polldev. -+ - config INPUT_SPARSEKMAP - tristate "Sparse keymap support library" - help -diff -rupN linux-5.19.16.orig/drivers/input/Makefile linux-5.19.16/drivers/input/Makefile ---- linux-5.19.16.orig/drivers/input/Makefile 2022-10-18 17:21:09.996506869 -0400 -+++ linux-5.19.16/drivers/input/Makefile 2022-10-18 18:31:56.511365555 -0400 -@@ -10,6 +10,7 @@ input-core-y := input.o input-compat.o i - input-core-y += touchscreen.o - - obj-$(CONFIG_INPUT_FF_MEMLESS) += ff-memless.o -+obj-$(CONFIG_INPUT_POLLDEV) += input-polldev.o - obj-$(CONFIG_INPUT_SPARSEKMAP) += sparse-keymap.o - obj-$(CONFIG_INPUT_MATRIXKMAP) += matrix-keymap.o - obj-$(CONFIG_INPUT_VIVALDIFMAP) += vivaldi-fmap.o -diff -rupN linux-5.19.16.orig/drivers/mfd/rk808.c linux-5.19.16/drivers/mfd/rk808.c ---- linux-5.19.16.orig/drivers/mfd/rk808.c 2022-10-18 17:21:10.192505359 -0400 -+++ linux-5.19.16/drivers/mfd/rk808.c 2022-10-18 18:31:56.511365555 -0400 -@@ -67,6 +67,10 @@ static bool rk817_is_volatile_reg(struct - case RK817_SECONDS_REG ... RK817_WEEKS_REG: - case RK817_RTC_STATUS_REG: - case RK817_CODEC_DTOP_LPT_SRST: -+ case RK817_GAS_GAUGE_ADC_CONFIG0 ... RK817_GAS_GAUGE_CUR_ADC_K0: -+ case RK817_PMIC_CHRG_STS: -+ case RK817_PMIC_CHRG_OUT: -+ case RK817_PMIC_CHRG_IN: - case RK817_INT_STS_REG0: - case RK817_INT_STS_REG1: - case RK817_INT_STS_REG2: -@@ -74,7 +78,7 @@ static bool rk817_is_volatile_reg(struct - return true; - } - -- return true; -+ return false; - } - - static const struct regmap_config rk818_regmap_config = { -@@ -127,6 +131,11 @@ static const struct resource rk817_pwrke - DEFINE_RES_IRQ(RK817_IRQ_PWRON_FALL), - }; - -+static const struct resource rk817_charger_resources[] = { -+ DEFINE_RES_IRQ(RK817_IRQ_PLUG_IN), -+ DEFINE_RES_IRQ(RK817_IRQ_PLUG_OUT), -+}; -+ - static const struct mfd_cell rk805s[] = { - { .name = "rk808-clkout", }, - { .name = "rk808-regulator", }, -@@ -166,6 +175,11 @@ static const struct mfd_cell rk817s[] = - .resources = &rk817_rtc_resources[0], - }, - { .name = "rk817-codec",}, -+ { -+ .name = "rk817-charger", -+ .num_resources = ARRAY_SIZE(rk817_charger_resources), -+ .resources = &rk817_charger_resources[0], -+ }, - }; - - static const struct mfd_cell rk818s[] = { -diff -rupN linux-5.19.16.orig/drivers/power/supply/cw2015_battery.c linux-5.19.16/drivers/power/supply/cw2015_battery.c ---- linux-5.19.16.orig/drivers/power/supply/cw2015_battery.c 2022-10-18 17:21:10.536502710 -0400 -+++ linux-5.19.16/drivers/power/supply/cw2015_battery.c 2022-10-18 18:31:56.515365570 -0400 -@@ -552,7 +552,7 @@ static enum power_supply_property cw_bat +diff --git a/drivers/power/supply/cw2015_battery.c b/drivers/power/supply/cw2015_battery.c +index 6d52641151d9..620039a1e792 100644 +--- a/drivers/power/supply/cw2015_battery.c ++++ b/drivers/power/supply/cw2015_battery.c +@@ -553,7 +553,7 @@ static enum power_supply_property cw_battery_properties[] = { }; static const struct power_supply_desc cw2015_bat_desc = { @@ -11672,1216 +11316,31 @@ diff -rupN linux-5.19.16.orig/drivers/power/supply/cw2015_battery.c linux-5.19.1 .type = POWER_SUPPLY_TYPE_BATTERY, .properties = cw_battery_properties, .num_properties = ARRAY_SIZE(cw_battery_properties), -diff -rupN linux-5.19.16.orig/drivers/power/supply/Kconfig linux-5.19.16/drivers/power/supply/Kconfig ---- linux-5.19.16.orig/drivers/power/supply/Kconfig 2022-10-18 17:21:10.532502741 -0400 -+++ linux-5.19.16/drivers/power/supply/Kconfig 2022-10-18 18:31:56.511365555 -0400 -@@ -708,6 +708,12 @@ config CHARGER_BQ256XX - charge management and system power path management devices for single - cell Li-ion and Li-polymer batteries. - -+config CHARGER_RK817 -+ tristate "Rockchip RK817 PMIC Battery Charger" -+ depends on MFD_RK808 -+ help -+ Say Y to include support for Rockchip RK817 Battery Charger. -+ - config CHARGER_SMB347 - tristate "Summit Microelectronics SMB3XX Battery Charger" - depends on I2C -diff -rupN linux-5.19.16.orig/drivers/power/supply/Makefile linux-5.19.16/drivers/power/supply/Makefile ---- linux-5.19.16.orig/drivers/power/supply/Makefile 2022-10-18 17:21:10.532502741 -0400 -+++ linux-5.19.16/drivers/power/supply/Makefile 2022-10-18 18:31:56.515365570 -0400 -@@ -91,6 +91,7 @@ obj-$(CONFIG_CHARGER_BQ2515X) += bq2515x - obj-$(CONFIG_CHARGER_BQ25890) += bq25890_charger.o - obj-$(CONFIG_CHARGER_BQ25980) += bq25980_charger.o - obj-$(CONFIG_CHARGER_BQ256XX) += bq256xx_charger.o -+obj-$(CONFIG_CHARGER_RK817) += rk817_charger.o - obj-$(CONFIG_CHARGER_SMB347) += smb347-charger.o - obj-$(CONFIG_CHARGER_TPS65090) += tps65090-charger.o - obj-$(CONFIG_CHARGER_TPS65217) += tps65217_charger.o -diff -rupN linux-5.19.16.orig/drivers/power/supply/rk817_charger.c linux-5.19.16/drivers/power/supply/rk817_charger.c ---- linux-5.19.16.orig/drivers/power/supply/rk817_charger.c 1969-12-31 19:00:00.000000000 -0500 -+++ linux-5.19.16/drivers/power/supply/rk817_charger.c 2022-10-18 18:31:56.515365570 -0400 -@@ -0,0 +1,1157 @@ -+// SPDX-License-Identifier: GPL-2.0-only -+/* -+ * Charger Driver for Rockchip rk817 -+ * -+ * Copyright (c) 2021 -+ * -+ * Authors: Maya Matuszczyk -+ * Chris Morgan -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* Charging statuses reported by hardware register */ -+enum rk817_charge_status { -+ CHRG_OFF, -+ DEAD_CHRG, -+ TRICKLE_CHRG, -+ CC_OR_CV_CHRG, -+ CHARGE_FINISH, -+ USB_OVER_VOL, -+ BAT_TMP_ERR, -+ BAT_TIM_ERR, -+}; -+ -+/* Max charging current read to/written from hardware register. -+ * Note how highest value corresponding to 0x7 is the lowest -+ * current, this is per the datasheet. -+ */ -+enum rk817_chg_cur { -+ CHG_1A, -+ CHG_1_5A, -+ CHG_2A, -+ CHG_2_5A, -+ CHG_2_75A, -+ CHG_3A, -+ CHG_3_5A, -+ CHG_0_5A, -+}; -+ -+struct rk817_charger { -+ struct device *dev; -+ struct rk808 *rk808; -+ -+ struct power_supply *bat_ps; -+ struct power_supply *chg_ps; -+ bool plugged_in; -+ bool battery_present; -+ -+ /* voltage_k and voltage_b values are used to calibrate the ADC -+ * voltage readings. While they are documented in the BSP kernel and -+ * datasheet as voltage_k and voltage_b, there is no further -+ * information explaining them in more detail. -+ */ -+ -+ uint32_t voltage_k; -+ uint32_t voltage_b; -+ -+ /* soc - state of charge - like the BSP this is stored as a percentage, -+ * to the thousandth. BSP has a display state of charge (dsoc) and a -+ * remaining state of charge (rsoc). This value will be used for both -+ * purposes here so we don't do any fancy math to try and "smooth" the -+ * charge and just report it as it is. Note for example an soc of 100 -+ * is stored as 100000, an soc of 50 is stored as 50000, etc. -+ */ -+ int soc; -+ -+ /* Capacity of battery when fully charged, equal or less than design -+ * capacity depending upon wear. BSP kernel saves to nvram in mAh, -+ * so this value is in mAh not the standard uAh. -+ */ -+ int fcc_mah; -+ -+ /* Calibrate the SOC on a fully charged battery, this way we can use -+ * the calibrated SOC value to correct for columb counter drift. -+ */ -+ bool soc_cal; -+ -+ /* Implementation specific immutable properties from device tree */ -+ int res_div; -+ int sleep_enter_current_ua; -+ int sleep_filter_current_ua; -+ int bat_charge_full_design_uah; -+ int bat_voltage_min_design_uv; -+ int bat_voltage_max_design_uv; -+ -+ /* Values updated periodically by driver for display. */ -+ int charge_now_uah; -+ int volt_avg_uv; -+ int cur_avg_ua; -+ int max_chg_cur_ua; -+ int max_chg_volt_uv; -+ int charge_status; -+ int charger_input_volt_avg_uv; -+ -+ /* Work queue to periodically update values. */ -+ struct delayed_work work; -+}; -+ -+/* ADC coefficients extracted from BSP kernel */ -+#define ADC_TO_CURRENT(adc_value, res_div) \ -+ (adc_value * 172 / res_div) -+ -+#define CURRENT_TO_ADC(current, samp_res) \ -+ (current * samp_res / 172) -+ -+#define CHARGE_TO_ADC(capacity, res_div) \ -+ (capacity * res_div * 3600 / 172 * 1000) -+ -+#define ADC_TO_CHARGE_UAH(adc_value, res_div) \ -+ (adc_value / 3600 * 172 / res_div) -+ -+static u8 rk817_chg_cur_to_reg(u32 chg_cur_ma) -+{ -+ if (chg_cur_ma >= 3500) -+ return CHG_3_5A; -+ else if (chg_cur_ma >= 3000) -+ return CHG_3A; -+ else if (chg_cur_ma >= 2750) -+ return CHG_2_75A; -+ else if (chg_cur_ma >= 2500) -+ return CHG_2_5A; -+ else if (chg_cur_ma >= 2000) -+ return CHG_2A; -+ else if (chg_cur_ma >= 1500) -+ return CHG_1_5A; -+ else if (chg_cur_ma >= 1000) -+ return CHG_1A; -+ else if (chg_cur_ma >= 500) -+ return CHG_0_5A; -+ else -+ return -EINVAL; -+} -+ -+static int rk817_chg_cur_from_reg(u8 reg) -+{ -+ switch (reg) { -+ case CHG_0_5A: -+ return 500000; -+ case CHG_1A: -+ return 1000000; -+ case CHG_1_5A: -+ return 1500000; -+ case CHG_2A: -+ return 2000000; -+ case CHG_2_5A: -+ return 2500000; -+ case CHG_2_75A: -+ return 2750000; -+ case CHG_3A: -+ return 3000000; -+ case CHG_3_5A: -+ return 3500000; -+ default: -+ return -EINVAL; -+ } -+} -+ -+static void rk817_bat_calib_vol(struct rk817_charger *charger) -+{ -+ uint32_t vcalib0 = 0; -+ uint32_t vcalib1 = 0; -+ u8 bulk_reg[2]; -+ -+ /* calibrate voltage */ -+ regmap_bulk_read(charger->rk808->regmap, RK817_GAS_GAUGE_VCALIB0_H, -+ bulk_reg, 2); -+ vcalib0 = get_unaligned_be16(bulk_reg); -+ -+ regmap_bulk_read(charger->rk808->regmap, RK817_GAS_GAUGE_VCALIB1_H, -+ bulk_reg, 2); -+ vcalib1 = get_unaligned_be16(bulk_reg); -+ -+ /* values were taken from BSP kernel */ -+ charger->voltage_k = (4025 - 2300) * 1000 / -+ ((vcalib1 - vcalib0) ? (vcalib1 - vcalib0) : 1); -+ charger->voltage_b = 4025 - (charger->voltage_k * vcalib1) / 1000; -+} -+ -+static void rk817_bat_calib_cur(struct rk817_charger *charger) -+{ -+ u8 bulk_reg[2]; -+ -+ /* calibrate current */ -+ regmap_bulk_read(charger->rk808->regmap, RK817_GAS_GAUGE_IOFFSET_H, -+ bulk_reg, 2); -+ regmap_bulk_write(charger->rk808->regmap, RK817_GAS_GAUGE_CAL_OFFSET_H, -+ bulk_reg, 2); -+} -+ -+/* note that only the fcc_mah is really used by this driver, the other values -+ * are to ensure we can remain backwards compatible with the BSP kernel. -+ */ -+static int rk817_record_battery_nvram_values(struct rk817_charger *charger) -+{ -+ u8 bulk_reg[3]; -+ int ret; -+ -+ /* write the soc value to the nvram location used by the BSP kernel -+ * for the dsoc value. -+ */ -+ put_unaligned_le24(charger->soc, bulk_reg); -+ ret = regmap_bulk_write(charger->rk808->regmap, RK817_GAS_GAUGE_BAT_R1, -+ bulk_reg, 3); -+ if (ret < 0) -+ return ret; -+ /* write the same value to the nvram location used by the BSP kernel -+ * for the rsoc value. -+ */ -+ put_unaligned_le24(charger->soc, bulk_reg); -+ ret = regmap_bulk_write(charger->rk808->regmap, RK817_GAS_GAUGE_DATA0, -+ bulk_reg, 3); -+ if (ret < 0) -+ return ret; -+ /* write the fcc_mah in mAh, just as the BSP kernel does. */ -+ put_unaligned_le24(charger->fcc_mah, bulk_reg); -+ ret = regmap_bulk_write(charger->rk808->regmap, RK817_GAS_GAUGE_DATA3, -+ bulk_reg, 3); -+ if (ret < 0) -+ return ret; -+ -+ return 0; -+} -+ -+static int rk817_bat_calib_cap(struct rk817_charger *charger) -+{ -+ struct rk808 *rk808 = charger->rk808; -+ int tmp, charge_now, charge_now_adc, volt_avg; -+ u8 bulk_reg[4]; -+ -+ /* Calibrate the soc and fcc on a fully charged battery */ -+ -+ if (charger->charge_status == CHARGE_FINISH && (!charger->soc_cal)) { -+ /* soc should be 100000 and columb counter should show the full -+ * charge capacity. Note that if the device is unplugged for a -+ * period of several days the columb counter will have a large -+ * margin of error, so setting it back to the full charge on -+ * a completed charge cycle should correct this (my device was -+ * showing 33% battery after 3 days unplugged when it should -+ * have been closer to 95% based on voltage and charge -+ * current). -+ */ -+ -+ charger->soc = 100000; -+ charge_now_adc = CHARGE_TO_ADC(charger->fcc_mah, -+ charger->res_div); -+ put_unaligned_be32(charge_now_adc, bulk_reg); -+ regmap_bulk_write(rk808->regmap, RK817_GAS_GAUGE_Q_INIT_H3, -+ bulk_reg, 4); -+ -+ charger->soc_cal = 1; -+ dev_dbg(charger->dev, -+ "Fully charged. SOC is %d, full capacity is %d\n", -+ charger->soc, charger->fcc_mah * 1000); -+ } -+ -+ /* The columb counter can drift up slightly, so we should correct for -+ * it. But don't correct it until we're at 100% soc. -+ */ -+ if (charger->charge_status == CHARGE_FINISH && charger->soc_cal) { -+ regmap_bulk_read(rk808->regmap, RK817_GAS_GAUGE_Q_PRES_H3, -+ bulk_reg, 4); -+ charge_now_adc = get_unaligned_be32(bulk_reg); -+ if (charge_now_adc < 0) -+ return charge_now_adc; -+ charge_now = ADC_TO_CHARGE_UAH(charge_now_adc, -+ charger->res_div); -+ -+ /* Re-init columb counter with updated values to correct drift. -+ */ -+ if (charge_now / 1000 > charger->fcc_mah) { -+ dev_dbg(charger->dev, -+ "Recalibrating columb counter to %d uah\n", -+ charge_now); -+ /* Order of operations matters here to ensure we keep -+ * enough precision until the last step to keep from -+ * making needless updates to columb counter. -+ */ -+ charge_now_adc = CHARGE_TO_ADC(charger->fcc_mah, -+ charger->res_div); -+ put_unaligned_be32(charge_now_adc, bulk_reg); -+ regmap_bulk_write(rk808->regmap, -+ RK817_GAS_GAUGE_Q_INIT_H3, -+ bulk_reg, 4); -+ } -+ } -+ -+ /* Calibrate the fully charged capacity when we previously had a full -+ * battery (soc_cal = 1) and are now empty (at or below minimum design -+ * voltage). If our columb counter is still positive, subtract that -+ * from our fcc value to get a calibrated fcc, and if our columb -+ * counter is negative add that to our fcc (but not to exceed our -+ * design capacity). -+ */ -+ regmap_bulk_read(charger->rk808->regmap, RK817_GAS_GAUGE_BAT_VOL_H, -+ bulk_reg, 2); -+ tmp = get_unaligned_be16(bulk_reg); -+ volt_avg = (charger->voltage_k * tmp) + 1000 * charger->voltage_b; -+ if (volt_avg <= charger->bat_voltage_min_design_uv && -+ charger->soc_cal) { -+ regmap_bulk_read(rk808->regmap, RK817_GAS_GAUGE_Q_PRES_H3, -+ bulk_reg, 4); -+ charge_now_adc = get_unaligned_be32(bulk_reg); -+ charge_now = ADC_TO_CHARGE_UAH(charge_now_adc, -+ charger->res_div); -+ /* Note, if charge_now is negative this will add it (what we -+ * want) and if it's positive this will subtract (also what -+ * we want). -+ */ -+ charger->fcc_mah = charger->fcc_mah - (charge_now / 1000); -+ -+ dev_dbg(charger->dev, -+ "Recalibrating full charge capacity to %d uah\n", -+ charger->fcc_mah * 1000); -+ } -+ -+ rk817_record_battery_nvram_values(charger); -+ -+ return 0; -+} -+ -+static void rk817_read_props(struct rk817_charger *charger) -+{ -+ int tmp, reg; -+ u8 bulk_reg[4]; -+ -+ /* Recalibrate voltage and current readings if we need to BSP does both -+ * on CUR_CALIB_UPD, ignoring VOL_CALIB_UPD. Curiously enough, both -+ * documentation and the BSP show that you perform an update if bit 7 -+ * is 1, but you clear the status by writing a 1 to bit 7. -+ */ -+ regmap_read(charger->rk808->regmap, RK817_GAS_GAUGE_ADC_CONFIG1, ®); -+ if (reg & RK817_VOL_CUR_CALIB_UPD) { -+ rk817_bat_calib_cur(charger); -+ rk817_bat_calib_vol(charger); -+ regmap_write_bits(charger->rk808->regmap, -+ RK817_GAS_GAUGE_ADC_CONFIG1, -+ RK817_VOL_CUR_CALIB_UPD, -+ RK817_VOL_CUR_CALIB_UPD); -+ } -+ -+ /* Update reported charge. */ -+ regmap_bulk_read(charger->rk808->regmap, RK817_GAS_GAUGE_Q_PRES_H3, -+ bulk_reg, 4); -+ tmp = get_unaligned_be32(bulk_reg); -+ charger->charge_now_uah = ADC_TO_CHARGE_UAH(tmp, charger->res_div); -+ if (charger->charge_now_uah < 0) -+ charger->charge_now_uah = 0; -+ if (charger->charge_now_uah > charger->fcc_mah * 1000) -+ charger->charge_now_uah = charger->fcc_mah * 1000; -+ -+ /* Update soc based on reported charge. */ -+ charger->soc = charger->charge_now_uah * 100 / charger->fcc_mah; -+ -+ /* Update reported voltage. */ -+ regmap_bulk_read(charger->rk808->regmap, RK817_GAS_GAUGE_BAT_VOL_H, -+ bulk_reg, 2); -+ tmp = get_unaligned_be16(bulk_reg); -+ charger->volt_avg_uv = (charger->voltage_k * tmp) + 1000 * -+ charger->voltage_b; -+ -+ /* Update reported current. Note value from registers is a signed 16 -+ * bit int. -+ */ -+ regmap_bulk_read(charger->rk808->regmap, RK817_GAS_GAUGE_BAT_CUR_H, -+ bulk_reg, 2); -+ tmp = (short int)get_unaligned_be16(bulk_reg); -+ charger->cur_avg_ua = ADC_TO_CURRENT(tmp, charger->res_div); -+ -+ /* Update the max charge current. This value shouldn't change, but we -+ * can read it to report what the PMIC says it is instead of simply -+ * returning the default value. -+ */ -+ regmap_read(charger->rk808->regmap, RK817_PMIC_CHRG_OUT, ®); -+ charger->max_chg_cur_ua = -+ rk817_chg_cur_from_reg(reg & RK817_CHRG_CUR_SEL); -+ -+ /* Update max charge voltage. Like the max charge current this value -+ * shouldn't change, but we can report what the PMIC says. -+ */ -+ regmap_read(charger->rk808->regmap, RK817_PMIC_CHRG_OUT, ®); -+ charger->max_chg_volt_uv = ((((reg & RK817_CHRG_VOL_SEL) >> 4) * -+ 50000) + 4100000); -+ -+ /* Check if battery still present. */ -+ regmap_read(charger->rk808->regmap, RK817_PMIC_CHRG_STS, ®); -+ charger->battery_present = (reg & RK817_BAT_EXS); -+ -+ /* Get which type of charge we are using (if any). */ -+ regmap_read(charger->rk808->regmap, RK817_PMIC_CHRG_STS, ®); -+ charger->charge_status = (reg >> 4) & 0x07; -+ -+ /* Get charger input voltage. Note that on my example hardware (an -+ * Odroid Go Advance) the voltage of the power connector is measured -+ * on the register labelled USB in the datasheet; I don't know if this -+ * is how it is designed or just a quirk of the implementation. I -+ * believe this will also measure the voltage of the USB output when in -+ * OTG mode, if that is the case we may need to change this in the -+ * future to return 0 if the power supply status is offline (I can't -+ * test this with my current implementation. Also, when the voltage -+ * should be zero sometimes the ADC still shows a single bit (which -+ * would register as 20000uv). When this happens set it to 0. -+ */ -+ regmap_bulk_read(charger->rk808->regmap, RK817_GAS_GAUGE_USB_VOL_H, -+ bulk_reg, 2); -+ reg = get_unaligned_be16(bulk_reg); -+ if (reg > 1) { -+ tmp = ((charger->voltage_k * reg / 1000 + charger->voltage_b) * -+ 60 / 46); -+ charger->charger_input_volt_avg_uv = tmp * 1000; -+ } else { -+ charger->charger_input_volt_avg_uv = 0; -+ } -+ -+ /* Calibrate battery capacity and soc. */ -+ rk817_bat_calib_cap(charger); -+} -+ -+static int rk817_bat_get_prop(struct power_supply *ps, -+ enum power_supply_property prop, -+ union power_supply_propval *val) -+{ -+ struct rk817_charger *charger = power_supply_get_drvdata(ps); -+ -+ switch (prop) { -+ case POWER_SUPPLY_PROP_PRESENT: -+ val->intval = charger->battery_present; -+ break; -+ case POWER_SUPPLY_PROP_STATUS: -+ if (charger->cur_avg_ua < 0) { -+ val->intval = POWER_SUPPLY_STATUS_DISCHARGING; -+ break; -+ } -+ switch (charger->charge_status) { -+ case CHRG_OFF: -+ val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; -+ break; -+ /* Dead charge is documented, but not explained. I never -+ * observed it but assume it's a pre-charge for a dead -+ * battery. -+ */ -+ case DEAD_CHRG: -+ case TRICKLE_CHRG: -+ case CC_OR_CV_CHRG: -+ val->intval = POWER_SUPPLY_STATUS_CHARGING; -+ break; -+ case CHARGE_FINISH: -+ val->intval = POWER_SUPPLY_STATUS_FULL; -+ break; -+ default: -+ val->intval = POWER_SUPPLY_STATUS_UNKNOWN; -+ return -EINVAL; -+ -+ } -+ break; -+ case POWER_SUPPLY_PROP_CHARGE_TYPE: -+ switch (charger->charge_status) { -+ case CHRG_OFF: -+ case CHARGE_FINISH: -+ val->intval = POWER_SUPPLY_CHARGE_TYPE_NONE; -+ break; -+ case TRICKLE_CHRG: -+ val->intval = POWER_SUPPLY_CHARGE_TYPE_TRICKLE; -+ break; -+ case DEAD_CHRG: -+ case CC_OR_CV_CHRG: -+ val->intval = POWER_SUPPLY_CHARGE_TYPE_STANDARD; -+ break; -+ default: -+ val->intval = POWER_SUPPLY_CHARGE_TYPE_UNKNOWN; -+ break; -+ } -+ break; -+ case POWER_SUPPLY_PROP_CHARGE_FULL: -+ val->intval = charger->fcc_mah * 1000; -+ break; -+ case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: -+ val->intval = charger->bat_charge_full_design_uah; -+ break; -+ case POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN: -+ val->intval = 0; -+ break; -+ case POWER_SUPPLY_PROP_CHARGE_NOW: -+ val->intval = charger->charge_now_uah; -+ break; -+ case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: -+ val->intval = charger->bat_voltage_min_design_uv; -+ break; -+ case POWER_SUPPLY_PROP_CAPACITY: -+ /* Add 500 so that values like 99999 are 100% not 99%. */ -+ val->intval = (charger->soc + 500) / 1000; -+ if (val->intval > 100) -+ val->intval = 100; -+ if (val->intval < 0) -+ val->intval = 0; -+ break; -+ case POWER_SUPPLY_PROP_VOLTAGE_AVG: -+ val->intval = charger->volt_avg_uv; -+ break; -+ case POWER_SUPPLY_PROP_CURRENT_AVG: -+ val->intval = charger->cur_avg_ua; -+ break; -+ case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX: -+ val->intval = charger->max_chg_cur_ua; -+ break; -+ case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX: -+ val->intval = charger->max_chg_volt_uv; -+ break; -+ case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN: -+ val->intval = charger->bat_voltage_max_design_uv; -+ break; -+ default: -+ return -EINVAL; -+ } -+ return 0; -+} -+ -+static int rk817_chg_get_prop(struct power_supply *ps, -+ enum power_supply_property prop, -+ union power_supply_propval *val) -+{ -+ struct rk817_charger *charger = power_supply_get_drvdata(ps); -+ -+ switch (prop) { -+ case POWER_SUPPLY_PROP_ONLINE: -+ val->intval = charger->plugged_in; -+ break; -+ case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN: -+ /* max voltage from datasheet at 5.5v (default 5.0v) */ -+ val->intval = 5500000; -+ break; -+ case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: -+ /* min voltage from datasheet at 3.8v (default 5.0v) */ -+ val->intval = 3800000; -+ break; -+ case POWER_SUPPLY_PROP_VOLTAGE_AVG: -+ val->intval = charger->charger_input_volt_avg_uv; -+ break; -+ /* While it's possible that other implementations could use different -+ * USB types, the current implementation for this PMIC (the Odroid Go -+ * Advance) only uses a dedicated charging port with no rx/tx lines. -+ */ -+ case POWER_SUPPLY_PROP_USB_TYPE: -+ val->intval = POWER_SUPPLY_USB_TYPE_DCP; -+ break; -+ default: -+ return -EINVAL; -+ } -+ return 0; -+ -+} -+ -+static irqreturn_t rk817_plug_in_isr(int irq, void *cg) -+{ -+ struct rk817_charger *charger; -+ -+ charger = (struct rk817_charger *)cg; -+ charger->plugged_in = 1; -+ power_supply_changed(charger->chg_ps); -+ power_supply_changed(charger->bat_ps); -+ /* try to recalibrate capacity if we hit full charge. */ -+ charger->soc_cal = 0; -+ -+ rk817_read_props(charger); -+ -+ dev_dbg(charger->dev, "Power Cord Inserted\n"); -+ -+ return IRQ_HANDLED; -+} -+ -+static irqreturn_t rk817_plug_out_isr(int irq, void *cg) -+{ -+ struct rk817_charger *charger; -+ struct rk808 *rk808; -+ -+ charger = (struct rk817_charger *)cg; -+ rk808 = charger->rk808; -+ charger->plugged_in = 0; -+ power_supply_changed(charger->bat_ps); -+ power_supply_changed(charger->chg_ps); -+ -+ /* For some reason the bits of RK817_PMIC_CHRG_IN reset whenever the -+ * power cord is unplugged. This was not documented in the BSP kernel -+ * or the datasheet and only discovered by trial and error. Set minimum -+ * USB input voltage to 4.5v and enable USB voltage input limit. -+ */ -+ regmap_write_bits(rk808->regmap, RK817_PMIC_CHRG_IN, -+ RK817_USB_VLIM_SEL, (0x05 << 4)); -+ regmap_write_bits(rk808->regmap, RK817_PMIC_CHRG_IN, RK817_USB_VLIM_EN, -+ (0x01 << 7)); -+ -+ /* Set average USB input current limit to 1.5A and enable USB current -+ * input limit. -+ */ -+ regmap_write_bits(rk808->regmap, RK817_PMIC_CHRG_IN, -+ RK817_USB_ILIM_SEL, 0x03); -+ regmap_write_bits(rk808->regmap, RK817_PMIC_CHRG_IN, RK817_USB_ILIM_EN, -+ (0x01 << 3)); -+ -+ rk817_read_props(charger); -+ -+ dev_dbg(charger->dev, "Power Cord Removed\n"); -+ -+ return IRQ_HANDLED; -+} -+ -+static enum power_supply_property rk817_bat_props[] = { -+ POWER_SUPPLY_PROP_PRESENT, -+ POWER_SUPPLY_PROP_STATUS, -+ POWER_SUPPLY_PROP_CHARGE_TYPE, -+ POWER_SUPPLY_PROP_CHARGE_FULL, -+ POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, -+ POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN, -+ POWER_SUPPLY_PROP_CHARGE_NOW, -+ POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX, -+ POWER_SUPPLY_PROP_VOLTAGE_AVG, -+ POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, -+ POWER_SUPPLY_PROP_CURRENT_AVG, -+ POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, -+ POWER_SUPPLY_PROP_CAPACITY, -+ POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, -+}; -+ -+static enum power_supply_property rk817_chg_props[] = { -+ POWER_SUPPLY_PROP_ONLINE, -+ POWER_SUPPLY_PROP_USB_TYPE, -+ POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, -+ POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, -+ POWER_SUPPLY_PROP_VOLTAGE_AVG, -+}; -+ -+static enum power_supply_usb_type rk817_usb_type[] = { -+ POWER_SUPPLY_USB_TYPE_DCP, -+ POWER_SUPPLY_USB_TYPE_UNKNOWN, -+}; -+ -+static const struct power_supply_desc rk817_bat_desc = { -+ .name = "rk817-battery", -+ .type = POWER_SUPPLY_TYPE_BATTERY, -+ .properties = rk817_bat_props, -+ .num_properties = ARRAY_SIZE(rk817_bat_props), -+ .get_property = rk817_bat_get_prop, -+}; -+ -+static const struct power_supply_desc rk817_chg_desc = { -+ .name = "rk817-charger", -+ .type = POWER_SUPPLY_TYPE_USB, -+ .usb_types = rk817_usb_type, -+ .num_usb_types = ARRAY_SIZE(rk817_usb_type), -+ .properties = rk817_chg_props, -+ .num_properties = ARRAY_SIZE(rk817_chg_props), -+ .get_property = rk817_chg_get_prop, -+}; -+ -+static int rk817_read_battery_nvram_values(struct rk817_charger *charger) -+{ -+ u8 bulk_reg[3]; -+ int ret; -+ -+ /* Read the nvram data for full charge capacity. */ -+ ret = regmap_bulk_read(charger->rk808->regmap, -+ RK817_GAS_GAUGE_DATA3, bulk_reg, 3); -+ if (ret < 0) -+ return ret; -+ charger->fcc_mah = get_unaligned_le24(bulk_reg); -+ -+ /* Sanity checking for values equal to zero or less than would be -+ * practical for this device (BSP Kernel assumes 500mAH or less) for -+ * practicality purposes. -+ */ -+ if (charger->fcc_mah < 500) { -+ dev_info(charger->dev, -+ "Invalid NVRAM max charge, setting to %u uAH\n", -+ charger->bat_charge_full_design_uah); -+ charger->fcc_mah = charger->bat_charge_full_design_uah / 1000; -+ } -+ -+ /* Read the nvram for state of charge. */ -+ ret = regmap_bulk_read(charger->rk808->regmap, -+ RK817_GAS_GAUGE_BAT_R1, bulk_reg, 3); -+ if (ret < 0) -+ return ret; -+ charger->soc = get_unaligned_le24(bulk_reg); -+ -+ return 0; -+} -+ -+static int -+rk817_read_or_set_full_charge_on_boot(struct rk817_charger *charger, -+ struct power_supply_battery_info *bat_info) -+{ -+ struct rk808 *rk808 = charger->rk808; -+ u8 bulk_reg[4]; -+ u32 boot_voltage, boot_charge_mah, tmp; -+ int ret, reg, off_time; -+ int soc_tmp1, soc_tmp2, soc_tmp3; -+ bool first_boot; -+ -+ /* Check if the battery is uninitalized. If it is, the columb counter -+ * needs to be set up. -+ */ -+ ret = regmap_read(rk808->regmap, RK817_GAS_GAUGE_GG_STS, ®); -+ if (ret < 0) -+ return ret; -+ first_boot = reg & RK817_BAT_CON; -+ /* If the battery is uninitialized, use the poweron voltage and an ocv -+ * lookup to guess our charge. The number won't be very accurate until -+ * we hit either our minimum voltage (0%) or full charge (100%). -+ */ -+ if (first_boot) { -+ regmap_bulk_read(rk808->regmap, RK817_GAS_GAUGE_PWRON_VOL_H, -+ bulk_reg, 2); -+ tmp = get_unaligned_be16(bulk_reg); -+ boot_voltage = (charger->voltage_k * tmp) + -+ 1000 * charger->voltage_b; -+ /* Since only implementation has no working thermistor, assume -+ * 20C for OCV lookup. If lookup fails, report error with OCV -+ * table. -+ */ -+ charger->soc = power_supply_batinfo_ocv2cap(bat_info, -+ boot_voltage, -+ 20) * 1000; -+ if (charger->soc < 0) -+ charger->soc = 0; -+ -+ /* Guess that full charge capacity is the design capacity */ -+ charger->fcc_mah = charger->bat_charge_full_design_uah / 1000; -+ /* Set battery as "set up". BSP driver uses this value even -+ * though datasheet claims it's a read-only value. -+ */ -+ regmap_write_bits(rk808->regmap, RK817_GAS_GAUGE_GG_STS, -+ RK817_BAT_CON, 0); -+ /* Save nvram values */ -+ ret = rk817_record_battery_nvram_values(charger); -+ if (ret < 0) -+ return ret; -+ } else { -+ ret = rk817_read_battery_nvram_values(charger); -+ if (ret < 0) -+ return ret; -+ -+ regmap_bulk_read(rk808->regmap, RK817_GAS_GAUGE_Q_PRES_H3, -+ bulk_reg, 4); -+ tmp = get_unaligned_be32(bulk_reg); -+ if (tmp < 0) -+ tmp = 0; -+ boot_charge_mah = ADC_TO_CHARGE_UAH(tmp, -+ charger->res_div) / 1000; -+ /* Check if the columb counter has been off for more than 300 -+ * minutes as it tends to drift downward. If so, re-init soc -+ * with the boot voltage instead. Note the unit values for the -+ * OFF_CNT register appear to be in decaminutes and stops -+ * counting at 2550 (0xFF) minutes. BSP kernel used OCV, but -+ * for me occasionally that would show invalid values. Boot -+ * voltage is only accurate for me on first poweron (not -+ * reboots), but we shouldn't ever encounter an OFF_CNT more -+ * than 0 on a reboot anyway. -+ */ -+ regmap_read(rk808->regmap, RK817_GAS_GAUGE_OFF_CNT, &off_time); -+ if (off_time >= 30) { -+ regmap_bulk_read(rk808->regmap, -+ RK817_GAS_GAUGE_PWRON_VOL_H, -+ bulk_reg, 2); -+ tmp = get_unaligned_be16(bulk_reg); -+ boot_voltage = (charger->voltage_k * tmp) + -+ 1000 * charger->voltage_b; -+ charger->soc = -+ power_supply_batinfo_ocv2cap(bat_info, -+ boot_voltage, -+ 20) * 1000; -+ } else { -+ charger->soc = (boot_charge_mah * 1000 * 100 / -+ charger->fcc_mah); -+ } -+ } -+ -+ regmap_bulk_read(rk808->regmap, RK817_GAS_GAUGE_PWRON_VOL_H, -+ bulk_reg, 2); -+ tmp = get_unaligned_be16(bulk_reg); -+ boot_voltage = (charger->voltage_k * tmp) + 1000 * charger->voltage_b; -+ soc_tmp1 = power_supply_batinfo_ocv2cap(bat_info, -+ boot_voltage, 20) * 1000; -+ regmap_bulk_read(rk808->regmap, RK817_GAS_GAUGE_Q_PRES_H3, -+ bulk_reg, 4); -+ tmp = get_unaligned_be32(bulk_reg); -+ if (tmp < 0) -+ tmp = 0; -+ boot_charge_mah = ADC_TO_CHARGE_UAH(tmp, charger->res_div) / 1000; -+ soc_tmp2 = (boot_charge_mah * 1000 * 100 / charger->fcc_mah); -+ regmap_bulk_read(rk808->regmap, RK817_GAS_GAUGE_OCV_VOL_H, -+ bulk_reg, 2); -+ tmp = get_unaligned_be16(bulk_reg); -+ boot_voltage = (charger->voltage_k * tmp) + 1000 * charger->voltage_b; -+ soc_tmp3 = power_supply_batinfo_ocv2cap(bat_info, -+ boot_voltage, 20) * 1000; -+ -+ /* Now we have our full charge capacity and soc, init the columb -+ * counter. -+ */ -+ boot_charge_mah = charger->soc * charger->fcc_mah / 100 / 1000; -+ if (boot_charge_mah > charger->fcc_mah) -+ boot_charge_mah = charger->fcc_mah; -+ tmp = CHARGE_TO_ADC(boot_charge_mah, charger->res_div); -+ put_unaligned_be32(tmp, bulk_reg); -+ ret = regmap_bulk_write(rk808->regmap, RK817_GAS_GAUGE_Q_INIT_H3, -+ bulk_reg, 4); -+ if (ret < 0) -+ return ret; -+ -+ /* Set QMAX value to max design capacity. */ -+ tmp = CHARGE_TO_ADC((charger->bat_charge_full_design_uah / 1000), -+ charger->res_div); -+ put_unaligned_be32(tmp, bulk_reg); -+ ret = regmap_bulk_write(rk808->regmap, RK817_GAS_GAUGE_Q_MAX_H3, -+ bulk_reg, 4); -+ if (ret < 0) -+ return ret; -+ -+ return 0; -+} -+ -+static int rk817_battery_init(struct rk817_charger *charger, -+ struct power_supply_battery_info *bat_info) -+{ -+ struct rk808 *rk808 = charger->rk808; -+ u32 tmp, max_chg_vol_mv, max_chg_cur_ma; -+ u8 max_chg_vol_reg, chg_term_i_reg, max_chg_cur_reg; -+ int ret, chg_term_ma; -+ u8 bulk_reg[2]; -+ -+ /* Get initial plug state */ -+ regmap_read(rk808->regmap, RK817_SYS_STS, &tmp); -+ charger->plugged_in = (tmp & RK817_PLUG_IN_STS); -+ -+ /* Turn on all ADC functions to measure battery, USB, and sys voltage, -+ * as well as batt temp. Note only tested implementation so far does -+ * not use a battery with a thermistor. -+ */ -+ regmap_write(rk808->regmap, RK817_GAS_GAUGE_ADC_CONFIG0, 0xfc); -+ -+ /* Set relax mode voltage sampling interval and ADC offset calibration -+ * interval to 8 minutes to mirror BSP kernel. Set voltage and current -+ * modes to average to mirror BSP kernel. -+ */ -+ regmap_write(rk808->regmap, RK817_GAS_GAUGE_GG_CON, 0x04); -+ -+ /* Calibrate voltage like the BSP does here. */ -+ rk817_bat_calib_vol(charger); -+ -+ /* Write relax threshold, derived from sleep enter current. */ -+ tmp = CURRENT_TO_ADC(charger->sleep_enter_current_ua, -+ charger->res_div); -+ put_unaligned_be16(tmp, bulk_reg); -+ regmap_bulk_write(rk808->regmap, RK817_GAS_GAUGE_RELAX_THRE_H, -+ bulk_reg, 2); -+ -+ /* Write sleep sample current, derived from sleep filter current. */ -+ tmp = CURRENT_TO_ADC(charger->sleep_filter_current_ua, -+ charger->res_div); -+ put_unaligned_be16(tmp, bulk_reg); -+ regmap_bulk_write(rk808->regmap, RK817_GAS_GAUGE_SLEEP_CON_SAMP_CUR_H, -+ bulk_reg, 2); -+ -+ /* Restart battery relax voltage */ -+ regmap_write_bits(rk808->regmap, RK817_GAS_GAUGE_GG_STS, -+ RK817_RELAX_VOL_UPD, (0x0 << 2)); -+ -+ /* Set OCV Threshold Voltage to 127.5mV. This was hard coded like this -+ * in the BSP. -+ */ -+ regmap_write(rk808->regmap, RK817_GAS_GAUGE_OCV_THRE_VOL, 0xff); -+ -+ /* Set maximum charging voltage to battery max voltage. Trying to be -+ * incredibly safe with these value, as setting them wrong could -+ * overcharge the battery, which would be very bad. -+ */ -+ max_chg_vol_mv = bat_info->constant_charge_voltage_max_uv / 1000; -+ max_chg_cur_ma = bat_info->constant_charge_current_max_ua / 1000; -+ -+ if (max_chg_vol_mv < 4100) { -+ return dev_err_probe(charger->dev, -EINVAL, -+ "invalid max charger voltage, value %u unsupported\n", -+ max_chg_vol_mv * 1000); -+ } -+ if (max_chg_vol_mv > 4450) { -+ dev_info(charger->dev, -+ "Setting max charge voltage to 4450000uv\n"); -+ max_chg_vol_mv = 4450; -+ } -+ -+ if (max_chg_cur_ma < 500) { -+ return dev_err_probe(charger->dev, -EINVAL, -+ "invalid max charger current, value %u unsupported\n", -+ max_chg_cur_ma * 1000); -+ } -+ if (max_chg_cur_ma > 3500) -+ dev_info(charger->dev, -+ "Setting max charge current to 3500000ua\n"); -+ -+ /* Now that the values are sanity checked, if we subtract 4100 from the -+ * max voltage and divide by 50, we conviently get the exact value for -+ * the registers, which are 4.1v, 4.15v, 4.2v, 4.25v, 4.3v, 4.35v, -+ * 4.4v, and 4.45v; these correspond to values 0x00 through 0x07. -+ */ -+ max_chg_vol_reg = (max_chg_vol_mv - 4100) / 50; -+ -+ max_chg_cur_reg = rk817_chg_cur_to_reg(max_chg_cur_ma); -+ -+ if (max_chg_vol_reg < 0 || max_chg_vol_reg > 7) { -+ return dev_err_probe(charger->dev, -EINVAL, -+ "invalid max charger voltage, value %u unsupported\n", -+ max_chg_vol_mv * 1000); -+ } -+ if (max_chg_cur_reg < 0 || max_chg_cur_reg > 7) { -+ return dev_err_probe(charger->dev, -EINVAL, -+ "invalid max charger current, value %u unsupported\n", -+ max_chg_cur_ma * 1000); -+ } -+ -+ /* Write the values to the registers, and deliver an emergency warning -+ * in the event they are not written correctly. -+ */ -+ ret = regmap_write_bits(rk808->regmap, RK817_PMIC_CHRG_OUT, -+ RK817_CHRG_VOL_SEL, (max_chg_vol_reg << 4)); -+ if (ret) { -+ dev_emerg(charger->dev, -+ "Danger, unable to set max charger voltage: %u\n", -+ ret); -+ } -+ -+ ret = regmap_write_bits(rk808->regmap, RK817_PMIC_CHRG_OUT, -+ RK817_CHRG_CUR_SEL, max_chg_cur_reg); -+ if (ret) { -+ dev_emerg(charger->dev, -+ "Danger, unable to set max charger current: %u\n", -+ ret); -+ } -+ -+ /* Set charge finishing mode to analog */ -+ regmap_write_bits(rk808->regmap, RK817_PMIC_CHRG_TERM, -+ RK817_CHRG_TERM_ANA_DIG, (0x0 << 2)); -+ -+ /* Set charge finish current, warn if value not in range and keep -+ * default. -+ */ -+ chg_term_ma = bat_info->charge_term_current_ua / 1000; -+ if (chg_term_ma < 150 || chg_term_ma > 400) { -+ dev_warn(charger->dev, -+ "Invalid charge termination %u, keeping default\n", -+ chg_term_ma * 1000); -+ chg_term_ma = 200; -+ } -+ -+ /* Values of 150ma, 200ma, 300ma, and 400ma correspond to 00, 01, 10, -+ * and 11. -+ */ -+ chg_term_i_reg = (chg_term_ma - 100) / 100; -+ regmap_write_bits(rk808->regmap, RK817_PMIC_CHRG_TERM, -+ RK817_CHRG_TERM_ANA_SEL, chg_term_i_reg); -+ -+ ret = rk817_read_or_set_full_charge_on_boot(charger, bat_info); -+ if (ret < 0) -+ return ret; -+ -+ /* Set minimum USB input voltage to 4.5v and enable USB voltage input -+ * limit. -+ */ -+ regmap_write_bits(rk808->regmap, RK817_PMIC_CHRG_IN, -+ RK817_USB_VLIM_SEL, (0x05 << 4)); -+ regmap_write_bits(rk808->regmap, RK817_PMIC_CHRG_IN, RK817_USB_VLIM_EN, -+ (0x01 << 7)); -+ -+ /* Set average USB input current limit to 1.5A and enable USB current -+ * input limit. -+ */ -+ regmap_write_bits(rk808->regmap, RK817_PMIC_CHRG_IN, -+ RK817_USB_ILIM_SEL, 0x03); -+ regmap_write_bits(rk808->regmap, RK817_PMIC_CHRG_IN, RK817_USB_ILIM_EN, -+ (0x01 << 3)); -+ -+ return 0; -+} -+ -+static void rk817_charging_monitor(struct work_struct *work) -+{ -+ struct rk817_charger *charger; -+ -+ charger = container_of(work, struct rk817_charger, work.work); -+ -+ rk817_read_props(charger); -+ -+ /* Run every 8 seconds like the BSP driver did. */ -+ schedule_delayed_work(&charger->work, msecs_to_jiffies(8000)); -+} -+ -+static int rk817_charger_probe(struct platform_device *pdev) -+{ -+ struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent); -+ struct rk817_charger *charger; -+ struct device_node *node; -+ struct power_supply_battery_info *bat_info; -+ struct device *dev = &pdev->dev; -+ struct power_supply_config pscfg = {}; -+ int plugin_irq, plugout_irq; -+ int of_value; -+ int ret; -+ -+ node = of_get_child_by_name(dev->parent->of_node, "charger"); -+ if (!node) -+ return -ENODEV; -+ -+ charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); -+ if (!charger) -+ return -ENOMEM; -+ -+ charger->rk808 = rk808; -+ -+ charger->dev = &pdev->dev; -+ platform_set_drvdata(pdev, charger); -+ -+ rk817_bat_calib_vol(charger); -+ -+ pscfg.drv_data = charger; -+ pscfg.of_node = node; -+ -+ /* Get sample resistor value. Note only values of 10000 or 20000 -+ * microohms are allowed. Schematic for my test implementation (an -+ * Odroid Go Advance) shows a 10 milliohm resistor for reference. -+ */ -+ ret = of_property_read_u32(node, "rockchip,resistor-sense-micro-ohms", -+ &of_value); -+ if (ret < 0) { -+ return dev_err_probe(dev, ret, -+ "Error reading sample resistor value\n"); -+ } -+ /* Store as a 1 or a 2, since all we really use the value for is as a -+ * divisor in some calculations. -+ */ -+ charger->res_div = (of_value == 20000) ? 2 : 1; -+ -+ /* Get sleep enter current value. Not sure what this value is for -+ * other than to help calibrate the relax threshold. -+ */ -+ ret = of_property_read_u32(node, -+ "rockchip,sleep-enter-current-microamp", -+ &of_value); -+ if (ret < 0) { -+ return dev_err_probe(dev, ret, -+ "Error reading sleep enter cur value\n"); -+ } -+ charger->sleep_enter_current_ua = of_value; -+ -+ /* Get sleep filter current value */ -+ ret = of_property_read_u32(node, -+ "rockchip,sleep-filter-current-microamp", -+ &of_value); -+ if (ret < 0) { -+ return dev_err_probe(dev, ret, -+ "Error reading sleep filter cur value\n"); -+ } -+ -+ charger->sleep_filter_current_ua = of_value; -+ -+ charger->bat_ps = devm_power_supply_register(&pdev->dev, -+ &rk817_bat_desc, &pscfg); -+ -+ charger->chg_ps = devm_power_supply_register(&pdev->dev, -+ &rk817_chg_desc, &pscfg); -+ -+ if (IS_ERR(charger->chg_ps)) -+ return dev_err_probe(dev, -EINVAL, -+ "Battery failed to probe\n"); -+ -+ if (IS_ERR(charger->chg_ps)) -+ return dev_err_probe(dev, -EINVAL, -+ "Charger failed to probe\n"); -+ -+ ret = power_supply_get_battery_info(charger->bat_ps, -+ &bat_info); -+ if (ret) { -+ return dev_err_probe(dev, ret, -+ "Unable to get battery info: %d\n", ret); -+ } -+ -+ if ((!bat_info->charge_full_design_uah) || -+ (!bat_info->voltage_min_design_uv) || -+ (!bat_info->voltage_max_design_uv) || -+ (!bat_info->constant_charge_voltage_max_uv) || -+ (!bat_info->constant_charge_current_max_ua) || -+ (!bat_info->charge_term_current_ua)) { -+ return dev_err_probe(dev, -EINVAL, -+ "Required battery info missing.\n"); -+ } -+ -+ charger->bat_charge_full_design_uah = bat_info->charge_full_design_uah; -+ charger->bat_voltage_min_design_uv = bat_info->voltage_min_design_uv; -+ charger->bat_voltage_max_design_uv = bat_info->voltage_max_design_uv; -+ -+ /* Has to run after power_supply_get_battery_info as it depends on some -+ * values discovered from that routine. -+ */ -+ ret = rk817_battery_init(charger, bat_info); -+ if (ret) -+ return ret; -+ -+ power_supply_put_battery_info(charger->bat_ps, bat_info); -+ -+ plugin_irq = platform_get_irq(pdev, 0); -+ if (plugin_irq < 0) -+ return plugin_irq; -+ -+ plugout_irq = platform_get_irq(pdev, 1); -+ if (plugout_irq < 0) -+ return plugout_irq; -+ -+ ret = devm_request_threaded_irq(charger->dev, plugin_irq, NULL, -+ rk817_plug_in_isr, -+ IRQF_TRIGGER_RISING | IRQF_ONESHOT, -+ "rk817_plug_in", charger); -+ if (ret) { -+ return dev_err_probe(&pdev->dev, ret, -+ "plug_in_irq request failed!\n"); -+ } -+ -+ ret = devm_request_threaded_irq(charger->dev, plugout_irq, NULL, -+ rk817_plug_out_isr, -+ IRQF_TRIGGER_RISING | IRQF_ONESHOT, -+ "rk817_plug_out", charger); -+ if (ret) { -+ return dev_err_probe(&pdev->dev, ret, -+ "plug_out_irq request failed!\n"); -+ } -+ -+ INIT_DELAYED_WORK(&charger->work, rk817_charging_monitor); -+ /* Get and populate the first set of values. */ -+ schedule_delayed_work(&charger->work, 0); -+ -+ return 0; -+} -+ -+ -+static struct platform_driver rk817_charger_driver = { -+ .probe = rk817_charger_probe, -+ .driver = { -+ .name = "rk817-charger", -+ }, -+}; -+module_platform_driver(rk817_charger_driver); -+ -+MODULE_DESCRIPTION("Battery power supply driver for RK817 PMIC"); -+MODULE_AUTHOR("Maya Matuszczyk "); -+MODULE_LICENSE("GPL"); -diff -rupN linux-5.19.16.orig/include/linux/compiler.h linux-5.19.16/include/linux/compiler.h ---- linux-5.19.16.orig/include/linux/compiler.h 2022-10-18 17:21:10.828500461 -0400 -+++ linux-5.19.16/include/linux/compiler.h 2022-10-18 18:31:56.515365570 -0400 -@@ -213,6 +213,8 @@ void ftrace_likely_update(struct ftrace_ - #define function_nocfi(x) (x) - #endif +diff --git a/include/linux/compiler.h b/include/linux/compiler.h +index 973a1bfd7ef5..330784b5cf4f 100644 +--- a/include/linux/compiler.h ++++ b/include/linux/compiler.h +@@ -203,6 +203,8 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, + __v; \ + }) +#include + #endif /* __KERNEL__ */ /* -@@ -245,6 +247,4 @@ static inline void *offset_to_ptr(const +@@ -243,6 +245,4 @@ static inline void *offset_to_ptr(const int *off) */ #define prevent_tail_call_optimization() mb() -#include - #endif /* __LINUX_COMPILER_H */ -diff -rupN linux-5.19.16.orig/include/linux/input-polldev.h linux-5.19.16/include/linux/input-polldev.h ---- linux-5.19.16.orig/include/linux/input-polldev.h 1969-12-31 19:00:00.000000000 -0500 -+++ linux-5.19.16/include/linux/input-polldev.h 2022-10-18 18:31:56.515365570 -0400 +diff --git a/include/linux/input-polldev.h b/include/linux/input-polldev.h +new file mode 100644 +index 000000000000..14821fd231c0 +--- /dev/null ++++ b/include/linux/input-polldev.h @@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _INPUT_POLLDEV_H @@ -12941,1551 +11400,3 @@ diff -rupN linux-5.19.16.orig/include/linux/input-polldev.h linux-5.19.16/includ +void input_unregister_polled_device(struct input_polled_dev *dev); + +#endif -diff -rupN linux-5.19.16.orig/include/linux/mfd/rk808.h linux-5.19.16/include/linux/mfd/rk808.h ---- linux-5.19.16.orig/include/linux/mfd/rk808.h 2022-10-18 17:21:10.864500184 -0400 -+++ linux-5.19.16/include/linux/mfd/rk808.h 2022-10-18 18:31:56.515365570 -0400 -@@ -519,6 +519,77 @@ enum rk809_reg_id { - #define MIC_DIFF_DIS (0x0 << 7) - #define MIC_DIFF_EN (0x1 << 7) - -+/* RK817 Battery Registers */ -+#define RK817_GAS_GAUGE_ADC_CONFIG0 0x50 -+#define RK817_GG_EN (0x1 << 7) -+#define RK817_SYS_VOL_ADC_EN (0x1 << 6) -+#define RK817_TS_ADC_EN (0x1 << 5) -+#define RK817_USB_VOL_ADC_EN (0x1 << 4) -+#define RK817_BAT_VOL_ADC_EN (0x1 << 3) -+#define RK817_BAT_CUR_ADC_EN (0x1 << 2) -+ -+#define RK817_GAS_GAUGE_ADC_CONFIG1 0x55 -+ -+#define RK817_VOL_CUR_CALIB_UPD BIT(7) -+ -+#define RK817_GAS_GAUGE_GG_CON 0x56 -+#define RK817_GAS_GAUGE_GG_STS 0x57 -+ -+#define RK817_BAT_CON (0x1 << 4) -+#define RK817_RELAX_VOL_UPD (0x3 << 2) -+#define RK817_RELAX_STS (0x1 << 1) -+ -+#define RK817_GAS_GAUGE_RELAX_THRE_H 0x58 -+#define RK817_GAS_GAUGE_RELAX_THRE_L 0x59 -+#define RK817_GAS_GAUGE_OCV_THRE_VOL 0x62 -+#define RK817_GAS_GAUGE_OCV_VOL_H 0x63 -+#define RK817_GAS_GAUGE_OCV_VOL_L 0x64 -+#define RK817_GAS_GAUGE_PWRON_VOL_H 0x6b -+#define RK817_GAS_GAUGE_PWRON_VOL_L 0x6c -+#define RK817_GAS_GAUGE_PWRON_CUR_H 0x6d -+#define RK817_GAS_GAUGE_PWRON_CUR_L 0x6e -+#define RK817_GAS_GAUGE_OFF_CNT 0x6f -+#define RK817_GAS_GAUGE_Q_INIT_H3 0x70 -+#define RK817_GAS_GAUGE_Q_INIT_H2 0x71 -+#define RK817_GAS_GAUGE_Q_INIT_L1 0x72 -+#define RK817_GAS_GAUGE_Q_INIT_L0 0x73 -+#define RK817_GAS_GAUGE_Q_PRES_H3 0x74 -+#define RK817_GAS_GAUGE_Q_PRES_H2 0x75 -+#define RK817_GAS_GAUGE_Q_PRES_L1 0x76 -+#define RK817_GAS_GAUGE_Q_PRES_L0 0x77 -+#define RK817_GAS_GAUGE_BAT_VOL_H 0x78 -+#define RK817_GAS_GAUGE_BAT_VOL_L 0x79 -+#define RK817_GAS_GAUGE_BAT_CUR_H 0x7a -+#define RK817_GAS_GAUGE_BAT_CUR_L 0x7b -+#define RK817_GAS_GAUGE_USB_VOL_H 0x7e -+#define RK817_GAS_GAUGE_USB_VOL_L 0x7f -+#define RK817_GAS_GAUGE_SYS_VOL_H 0x80 -+#define RK817_GAS_GAUGE_SYS_VOL_L 0x81 -+#define RK817_GAS_GAUGE_Q_MAX_H3 0x82 -+#define RK817_GAS_GAUGE_Q_MAX_H2 0x83 -+#define RK817_GAS_GAUGE_Q_MAX_L1 0x84 -+#define RK817_GAS_GAUGE_Q_MAX_L0 0x85 -+#define RK817_GAS_GAUGE_SLEEP_CON_SAMP_CUR_H 0x8f -+#define RK817_GAS_GAUGE_SLEEP_CON_SAMP_CUR_L 0x90 -+#define RK817_GAS_GAUGE_CAL_OFFSET_H 0x91 -+#define RK817_GAS_GAUGE_CAL_OFFSET_L 0x92 -+#define RK817_GAS_GAUGE_VCALIB0_H 0x93 -+#define RK817_GAS_GAUGE_VCALIB0_L 0x94 -+#define RK817_GAS_GAUGE_VCALIB1_H 0x95 -+#define RK817_GAS_GAUGE_VCALIB1_L 0x96 -+#define RK817_GAS_GAUGE_IOFFSET_H 0x97 -+#define RK817_GAS_GAUGE_IOFFSET_L 0x98 -+#define RK817_GAS_GAUGE_BAT_R1 0x9a -+#define RK817_GAS_GAUGE_BAT_R2 0x9b -+#define RK817_GAS_GAUGE_BAT_R3 0x9c -+#define RK817_GAS_GAUGE_DATA0 0x9d -+#define RK817_GAS_GAUGE_DATA1 0x9e -+#define RK817_GAS_GAUGE_DATA2 0x9f -+#define RK817_GAS_GAUGE_DATA3 0xa0 -+#define RK817_GAS_GAUGE_DATA4 0xa1 -+#define RK817_GAS_GAUGE_DATA5 0xa2 -+#define RK817_GAS_GAUGE_CUR_ADC_K0 0xb0 -+ - #define RK817_POWER_EN_REG(i) (0xb1 + (i)) - #define RK817_POWER_SLP_EN_REG(i) (0xb5 + (i)) - -@@ -544,10 +615,30 @@ enum rk809_reg_id { - #define RK817_LDO_ON_VSEL_REG(idx) (0xcc + (idx) * 2) - #define RK817_BOOST_OTG_CFG (0xde) - -+#define RK817_PMIC_CHRG_OUT 0xe4 -+#define RK817_CHRG_VOL_SEL (0x07 << 4) -+#define RK817_CHRG_CUR_SEL (0x07 << 0) -+ -+#define RK817_PMIC_CHRG_IN 0xe5 -+#define RK817_USB_VLIM_EN (0x01 << 7) -+#define RK817_USB_VLIM_SEL (0x07 << 4) -+#define RK817_USB_ILIM_EN (0x01 << 3) -+#define RK817_USB_ILIM_SEL (0x07 << 0) -+#define RK817_PMIC_CHRG_TERM 0xe6 -+#define RK817_CHRG_TERM_ANA_DIG (0x01 << 2) -+#define RK817_CHRG_TERM_ANA_SEL (0x03 << 0) -+#define RK817_CHRG_EN (0x01 << 6) -+ -+#define RK817_PMIC_CHRG_STS 0xeb -+#define RK817_BAT_EXS BIT(7) -+#define RK817_CHG_STS (0x07 << 4) -+ - #define RK817_ID_MSB 0xed - #define RK817_ID_LSB 0xee - - #define RK817_SYS_STS 0xf0 -+#define RK817_PLUG_IN_STS (0x1 << 6) -+ - #define RK817_SYS_CFG(i) (0xf1 + (i)) - - #define RK817_ON_SOURCE_REG 0xf5 -diff -rupN linux-5.19.16.orig/scripts/dtc/include-prefixes/arm64/rockchip/Makefile linux-5.19.16/scripts/dtc/include-prefixes/arm64/rockchip/Makefile ---- linux-5.19.16.orig/scripts/dtc/include-prefixes/arm64/rockchip/Makefile 2022-10-18 17:21:09.156513337 -0400 -+++ linux-5.19.16/scripts/dtc/include-prefixes/arm64/rockchip/Makefile 2022-10-18 18:31:56.495365497 -0400 -@@ -42,6 +42,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-na - dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-orangepi.dtb - dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-pinebook-pro.dtb - dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-puma-haikou.dtb -+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rg552-linux.dtb - dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc.dtb - dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc-mezzanine.dtb - dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc-plus.dtb -diff -rupN linux-5.19.16.orig/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-opp.dtsi linux-5.19.16/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-opp.dtsi ---- linux-5.19.16.orig/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-opp.dtsi 2022-10-18 17:21:09.156513337 -0400 -+++ linux-5.19.16/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-opp.dtsi 2022-10-18 18:31:56.495365497 -0400 -@@ -101,6 +101,10 @@ - opp-hz = /bits/ 64 <800000000>; - opp-microvolt = <1100000 1100000 1150000>; - }; -+ opp06 { -+ opp-hz = /bits/ 64 <900000000>; -+ opp-microvolt = <1100000 1100000 1150000>; -+ }; - }; - }; - -diff -rupN linux-5.19.16.orig/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-rg552-linux.dts linux-5.19.16/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-rg552-linux.dts ---- linux-5.19.16.orig/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-rg552-linux.dts 1969-12-31 19:00:00.000000000 -0500 -+++ linux-5.19.16/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-rg552-linux.dts 2022-10-18 18:31:56.495365497 -0400 -@@ -0,0 +1,1407 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd. -+ * Copyright (c) 2018 Akash Gajjar -+ * Copyright (c) 2022 Maya Matuszczyk -+ */ -+ -+ -+/dts-v1/; -+#include -+#include -+#include -+#include "rk3399.dtsi" -+#include "rk3399-opp.dtsi" -+ -+/ { -+ model = "Anbernic RG552"; -+ compatible = "anbernic,rg552", "rockchip,rk3399"; -+ -+ aliases { -+ mmc0 = &sdio0; -+ mmc1 = &sdmmc; -+ mmc2 = &sdhci; -+ }; -+ -+ chosen { -+ stdout-path = "serial2:1500000n8"; -+ }; -+ -+ memory { -+ device_type = "memory"; -+ reg = <0x0 0x00200000 0x0 0xf7e00000>; -+ }; -+ -+ volume-keys { -+ compatible = "gpio-keys"; -+ autorepeat; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&vol_pwr_btn>; -+ -+ sw1 { -+ debounce-interval = <100>; -+ gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; -+ label = "BTN PWR"; -+ linux,code = ; -+ wakeup-source; -+ }; -+ sw2 { -+ label = "BTN VOL+"; -+ linux,code = ; -+ gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>; -+ }; -+ sw3 { -+ label = "BTN VOL-"; -+ linux,code = ; -+ gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>; -+ }; -+ }; -+ -+ adc-keys { -+ compatible = "adc-keys"; -+ io-channels = <&saradc 1>; -+ io-channel-names = "buttons"; -+ keyup-threshold-microvolt = <1800000>; -+ poll-interval = <100>; -+ -+ home-key { -+ linux,code = ; -+ label = "F Button"; -+ press-threshold-microvolt = <1750>; -+ }; -+ }; -+ -+ joypad: singleadc-joypad { -+ compatible = "singleadc-joypad"; -+ -+ pwms = <&pwm3 0 200000000 0>; -+ pwm-names = "enable"; -+ rumble-boost-weak = <0x0000>; -+ rumble-boost-strong = <0x0000>; -+ -+ joypad-name = "retrogame_joypad"; -+ joypad-product = <0x1101>; -+ joypad-revision = <0x0100>; -+ -+ status = "okay"; -+ -+ /* gpio pincontrol setup */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&btn_pins>; -+ -+ /* Analog mux define */ -+ io-channel-names = "amux_adc"; -+ io-channels = <&saradc 4>; -+ -+ /* adc mux channel count */ -+ amux-count = <4>; -+ /* adc mux select(a,b) gpio */ -+ amux-a-gpios = <&gpio1 RK_PA1 GPIO_ACTIVE_LOW>; -+ amux-b-gpios = <&gpio1 RK_PA0 GPIO_ACTIVE_LOW>; -+ /* adc mux enable gpio */ -+ amux-en-gpios = <&gpio1 RK_PA4 GPIO_ACTIVE_LOW>; -+ -+ /* adc calculate scale */ -+ button-adc-scale = <2>; -+ -+ /* adc deadzone range */ -+ button-adc-deadzone = <64>; -+ -+ /* -+ specifies fuzz value that is used to filter noise from -+ the event stream. -+ */ -+ button-adc-fuzz = <32>; -+ button-adc-flat = <32>; -+ -+ /* -+ Analog Stick data tuning value(precent) -+ p = positive direction, n = negative direction -+ report value = (real_adc_data * tuning_value) / 100 -+ */ -+ abs_x-p-tuning = <300>; -+ abs_x-n-tuning = <300>; -+ -+ abs_y-p-tuning = <300>; -+ abs_y-n-tuning = <300>; -+ -+ abs_rx-p-tuning = <300>; -+ abs_rx-n-tuning = <300>; -+ -+ abs_ry-p-tuning = <300>; -+ abs_ry-n-tuning = <300>; -+ -+ /* poll device interval (ms), adc read interval */ -+ poll-interval = <10>; -+ -+ /* required for RG552(invert) */ -+ invert-absx; -+ invert-absy; -+ -+ /* gpio button auto repeat set value : default disable */ -+ /* -+ autorepeat; -+ */ -+ sw1 { -+ gpios = <&gpio3 RK_PA0 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-UP"; -+ linux,code = ; -+ }; -+ sw2 { -+ gpios = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-DOWN"; -+ linux,code = ; -+ }; -+ sw3 { -+ gpios = <&gpio3 RK_PA3 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-LEFT"; -+ linux,code = ; -+ }; -+ sw4 { -+ gpios = <&gpio3 RK_PA2 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-RIGHT"; -+ linux,code = ; -+ }; -+ sw5 { -+ gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>; -+ label = "GPIO KEY BTN-A"; -+ linux,code = ; -+ }; -+ sw6 { -+ gpios = <&gpio3 RK_PA7 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-B"; -+ linux,code = ; -+ }; -+ sw7 { -+ gpios = <&gpio3 RK_PA4 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-X"; -+ linux,code = ; -+ }; -+ sw8 { -+ gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-Y"; -+ linux,code = ; -+ }; -+ sw9 { -+ gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_SELECT"; -+ linux,code = ; -+ }; -+ sw10 { -+ gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_START"; -+ linux,code = ; -+ }; -+ sw11 { -+ gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_F"; -+ linux,code = ; -+ }; -+ sw12 { -+ gpios = <&gpio3 RK_PD0 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_TL"; -+ linux,code = ; -+ }; -+ sw13 { -+ gpios = <&gpio3 RK_PD2 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_TR"; -+ linux,code = ; -+ }; -+ sw14 { -+ gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_TL2"; -+ linux,code = ; -+ }; -+ sw15 { -+ gpios = <&gpio3 RK_PD3 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_TR2"; -+ linux,code = ; -+ }; -+ sw16 { -+ gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_THUMBL"; -+ linux,code = ; -+ }; -+ sw17 { -+ gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_THUMBR"; -+ linux,code = ; -+ }; -+ }; -+ -+ leds: gpio-leds { -+ compatible = "gpio-leds"; -+ pinctrl-names = "default"; -+ pinctrl-0 =<&leds_gpio>; -+ -+ led@1 { -+ gpios = <&gpio1 RK_PC4 GPIO_ACTIVE_HIGH>; -+ label = "battery_green"; -+ default-state= "on"; -+ // retain-state-suspended; -+ }; -+ -+ led@2 { -+ gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>; -+ label = "battery_red"; -+ // retain-state-suspended; -+ }; -+ -+ }; -+ -+ es8316-sound { -+ compatible = "simple-audio-card"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hp_det_pin>; -+ simple-audio-card,name = "rockchip,es8316-codec"; -+ simple-audio-card,format = "i2s"; -+ simple-audio-card,mclk-fs = <256>; -+ -+ simple-audio-card,widgets = -+ "Headphone", "Headphones", -+ "Speaker", "Speaker"; -+ simple-audio-card,routing = -+ "Headphones", "HPOL", -+ "Headphones", "HPOR", -+ "Speaker Amplifier INL", "HPOL", -+ "Speaker Amplifier INR", "HPOR", -+ "Speaker", "Speaker Amplifier OUTL", -+ "Speaker", "Speaker Amplifier OUTR"; -+ -+ simple-audio-card,hp-det-gpio = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>; -+ simple-audio-card,aux-devs = <&speaker_amp>; -+ simple-audio-card,pin-switches = "Speaker"; -+ -+ simple-audio-card,cpu { -+ sound-dai = <&i2s1>; -+ }; -+ -+ simple-audio-card,codec { -+ sound-dai = <&es8316>; -+ }; -+ }; -+ -+ speaker_amp: speaker-amplifier { -+ compatible = "simple-audio-amplifier"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spk_en_pin>; -+ enable-gpios = <&gpio1 RK_PC5 GPIO_ACTIVE_HIGH>; -+ sound-name-prefix = "Speaker Amplifier"; -+ VCC-supply = <&vcc5v0_sys>; -+ }; -+ -+ fan: pwm-fan { -+ compatible = "pwm-fan"; -+ pwms = <&pwm1 0 10000 1>; -+ #cooling-cells = <2>; -+ cooling-levels = <80 140 200 255>; -+ fan-supply = <&vcc5v0_sys>; -+ }; -+ -+ backlight: backlight { -+ status = "okay"; -+ compatible = "pwm-backlight"; -+ pwms = <&pwm0 0 25000 0>; -+ //power-supply = <&vcc12v_dcin>; -+ brightness-levels = < -+ 0 1 2 3 4 5 6 7 -+ 8 9 10 11 12 13 14 15 -+ 16 17 18 19 20 21 22 23 -+ 24 25 26 27 28 29 30 31 -+ 32 33 34 35 36 37 38 39 -+ 40 41 42 43 44 45 46 47 -+ 48 49 50 51 52 53 54 55 -+ 56 57 58 59 60 61 62 63 -+ 64 65 66 67 68 69 70 71 -+ 72 73 74 75 76 77 78 79 -+ 80 81 82 83 84 85 86 87 -+ 88 89 90 91 92 93 94 95 -+ 96 97 98 99 100 101 102 103 -+ 104 105 106 107 108 109 110 111 -+ 112 113 114 115 116 117 118 119 -+ 120 121 122 123 124 125 126 127 -+ 128 129 130 131 132 133 134 135 -+ 136 137 138 139 140 141 142 143 -+ 144 145 146 147 148 149 150 151 -+ 152 153 154 155 156 157 158 159 -+ 160 161 162 163 164 165 166 167 -+ 168 169 170 171 172 173 174 175 -+ 176 177 178 179 180 181 182 183 -+ 184 185 186 187 188 189 190 191 -+ 192 193 194 195 196 197 198 199 -+ 200 201 202 203 204 205 206 207 -+ 208 209 210 211 212 213 214 215 -+ 216 217 218 219 220 221 222 223 -+ 224 225 226 227 228 229 230 231 -+ 232 233 234 235 236 237 238 239 -+ 240 241 242 243 244 245 246 247 -+ 248 249 250 251 252 253 254 255>; -+ default-brightness-level = <200>; -+ }; -+ bat: battery { -+ compatible = "simple-battery"; -+ charge-full-design-microamp-hours = <6400000>; -+ voltage-max-design-microvolt = <4350000>; -+ voltage-min-design-microvolt = <3400000>; -+ constant-charge-current-max-microamp = <1500000>; -+ constant-charge-voltage-max-microvolt = <4350000>; -+ factory-internal-resistance-micro-ohms = <150000>; -+ resistance-temp-table = <20 150>; -+ -+ ocv-capacity-celsius = <20>; -+ ocv-capacity-table-0 = <4308000 100>,<4217000 95>, -+ <4161000 90>,<4110000 85>, -+ <4066000 80>,<4007000 75>, -+ <3974000 70>,<3937000 65>, -+ <3896000 60>,<3853000 55>, -+ <3827000 50>,<3807000 45>, -+ <3793000 40>,<3780000 35>, -+ <3768000 30>,<3756000 25>, -+ <3740000 20>,<3716000 15>, -+ <3689000 10>,<3675000 5>, -+ <3400000 0>; -+ }; -+ -+ mains_charger: dc-charger { -+ compatible = "gpio-charger"; -+ charger-type = "mains"; -+ gpios = <&gpio4 RK_PD0 GPIO_ACTIVE_LOW>; -+ -+ /* Also triggered by USB charger */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&dc_det_pin>; -+ monitored-battery = <&bat>; -+ }; -+ -+ xin32k: xin32k { -+ compatible = "fixed-clock"; -+ clock-frequency = <32768>; -+ clock-output-names = "xin32k"; -+ #clock-cells = <0>; -+ }; -+ -+ clkin_gmac: external-gmac-clock { -+ compatible = "fixed-clock"; -+ clock-frequency = <125000000>; -+ clock-output-names = "clkin_gmac"; -+ #clock-cells = <0>; -+ }; -+ -+ /* TODO: shouldn't be here */ -+ vcc12v_dcin: vcc12v-dcin { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc12v_dcin"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <12000000>; -+ regulator-max-microvolt = <12000000>; -+ }; -+ -+ vcc_sys: vcc-sys { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc_sys"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ regulator-always-on; -+ vin-supply = <&vcc12v_dcin>; -+ }; -+ -+ vcc3v3_sys: vcc3v3-sys { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc3v3_sys"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ vin-supply = <&vcc5v0_sys>; -+ }; -+ -+ vcc3v0_sd: vcc3v0-sd { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdmmc0_pwr_h>; -+ regulator-name = "vcc3v0_sd"; -+ regulator-always-on; -+ regulator-min-microvolt = <3000000>; -+ regulator-max-microvolt = <3000000>; -+ vin-supply = <&vcc3v3_sys>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc5v0_host: vcc5v0-host-regulator { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpio = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&vcc5v0_host_en>; -+ regulator-name = "vcc5v0_host"; -+ regulator-always-on; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ vin-supply = <&vcc5v0_usb>; -+ }; -+ -+ vcc5v0_typec: vcc5v0-typec-regulator { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&vcc5v0_typec_en>; -+ regulator-name = "vcc5v0_typec"; -+ regulator-always-on; -+ vin-supply = <&vcc5v0_usb>; -+ }; -+ -+ vcc5v0_sys: vcc5v0-sys { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc5v0_sys"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ vin-supply = <&vcc12v_dcin>; -+ }; -+ -+ vcc5v0_usb: vcc5v0-usb { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc5v0_usb"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ vin-supply = <&vcc12v_dcin>; -+ }; -+ -+ vdd_log: vdd-log { -+ compatible = "pwm-regulator"; -+ pwms = <&pwm2 0 25000 1>; -+ regulator-name = "vdd_log"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <800000>; -+ regulator-max-microvolt = <1700000>; -+ vin-supply = <&vcc5v0_sys>; -+ }; -+ -+ vcc5v5_lcd: vcc5v5-lcd { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpio = <&gpio4 RK_PD3 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&vcc5v5_lcd_en>; -+ regulator-name = "vcc5v5_lcd"; -+ regulator-min-microvolt = <5500000>; -+ regulator-max-microvolt = <5500000>; -+ vin-supply = <&vcc5v0_sys>; -+ }; -+ -+ vcc5v5_neg_lcd: vcc5v5-neg-lcd { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&vcc5v5_neg_lcd_en>; -+ regulator-name = "vcc5v5_neg_lcd"; -+ /* -+ * technically negative -+ */ -+ regulator-min-microvolt = <5500000>; -+ regulator-max-microvolt = <5500000>; -+ vin-supply = <&vcc5v0_sys>; -+ }; -+ -+ vcc_wifi: vcc-wifi-regulator { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpio = <&gpio3 RK_PC1 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&wifi_pwr>; -+ regulator-name = "wifi_enable"; -+ regulator-always-on; -+ regulator-boot-on; -+ }; -+ -+ dmc_opp_table: dmc_opp_table { -+ compatible = "operating-points-v2"; -+ -+ opp-300000000 { -+ opp-hz = /bits/ 64 <300000000>; -+ opp-microvolt = <900000>; -+ }; -+ opp-666000000 { -+ opp-hz = /bits/ 64 <666000000>; -+ opp-microvolt = <900000>; -+ }; -+ opp-800000000 { -+ opp-hz = /bits/ 64 <800000000>; -+ opp-microvolt = <900000>; -+ }; -+ opp-856000000 { -+ opp-hz = /bits/ 64 <856000000>; -+ opp-microvolt = <900000>; -+ }; -+ opp-928000000 { -+ opp-hz = /bits/ 64 <928000000>; -+ opp-microvolt = <900000>; -+ }; -+ opp-933000000 { -+ opp-hz = /bits/ 64 <933000000>; -+ opp-microvolt = <900000>; -+ }; -+ }; -+}; -+ -+&cluster0_opp { -+ opp-1512000000 { -+ opp-hz = /bits/ 64 <1512000000>; -+ opp-microvolt = <1200000>; -+ }; -+ opp-1608000000 { -+ opp-hz = /bits/ 64 <1608000000>; -+ opp-microvolt = <1200000>; -+ }; -+ opp-1704000000 { -+ opp-hz = /bits/ 64 <1704000000>; -+ opp-microvolt = <1225000>; -+ }; -+}; -+ -+&cluster1_opp { -+ opp-1992000000 { -+ opp-hz = /bits/ 64 <1992000000>; -+ opp-microvolt = <1250000>; -+ }; -+ opp-2016000000 { -+ opp-hz = /bits/ 64 <2016000000>; -+ opp-microvolt = <1250000>; -+ }; -+ opp-2040000000 { -+ opp-hz = /bits/ 64 <2040000000>; -+ opp-microvolt = <1250000>; -+ }; -+ opp-2088000000 { -+ opp-hz = /bits/ 64 <2088000000>; -+ opp-microvolt = <1250000>; -+ }; -+ opp-2184000000 { -+ opp-hz = /bits/ 64 <2184000000>; -+ opp-microvolt = <1350000>; -+ }; -+}; -+ -+&cpu_thermal { -+ trips { -+ cpu_warm: cpu_warm { -+ temperature = <50000>; -+ hysteresis = <2000>; -+ type = "active"; -+ }; -+ -+ cpu_hot: cpu_hot { -+ temperature = <55000>; -+ hysteresis = <2000>; -+ type = "active"; -+ }; -+ -+ cpu_scalding: cpu_scalding { -+ temperature = <65000>; -+ hysteresis = <5000>; -+ type = "active"; -+ }; -+ }; -+ -+ cooling-maps { -+ map1 { -+ trip = <&cpu_warm>; -+ cooling-device = <&fan THERMAL_NO_LIMIT 1>; -+ }; -+ -+ map2 { -+ trip = <&cpu_hot>; -+ cooling-device = <&fan THERMAL_NO_LIMIT 1>; -+ }; -+ -+ map3 { -+ trip = <&cpu_scalding>; -+ cooling-device = <&fan 2 THERMAL_NO_LIMIT>; -+ }; -+ }; -+}; -+ -+&cpu_l0 { -+ cpu-supply = <&vdd_cpu_l>; -+}; -+ -+&cpu_l1 { -+ cpu-supply = <&vdd_cpu_l>; -+}; -+ -+&cpu_l2 { -+ cpu-supply = <&vdd_cpu_l>; -+}; -+ -+&cpu_l3 { -+ cpu-supply = <&vdd_cpu_l>; -+}; -+ -+&cpu_b0 { -+ cpu-supply = <&vdd_cpu_b>; -+}; -+ -+&cpu_b1 { -+ cpu-supply = <&vdd_cpu_b>; -+}; -+ -+&saradc { -+ status = "okay"; -+}; -+ -+&sdio0 { -+ clock-frequency = <150000000>; -+ clock-freq-min-max = <100000 150000000>; -+ supports-sd; -+ no-sdio; -+ bus-width = <4>; -+ disable-wp; -+ cap-sd-highspeed; -+ cap-sdio-irq; -+ keep-power-in-suspend; -+ card-detect-delay = <800>; -+ cd-gpios = <&gpio2 RK_PC1 GPIO_ACTIVE_LOW>; /*[> CD GPIO <]*/ -+ num-slots = <1>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdio0_clk &sdio0_cmd &sdio0_cd &sdio0_bus4>; -+ sd-uhs-sdr104; -+ vqmmc-supply = <&vcc3v0_touch>; -+ status = "okay"; -+}; -+ -+&sdmmc { -+ bus-width = <4>; -+ cap-sd-highspeed; -+ cd-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; -+ disable-wp; -+ max-frequency = <150000000>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_bus4>; -+ vmmc-supply = <&vcc3v0_sd>; -+ vqmmc-supply = <&vcc_sdio>; -+ status = "okay"; -+}; -+ -+&emmc_phy { -+ status = "okay"; -+}; -+ -+&gpu { -+ mali-supply = <&vdd_gpu>; -+ status = "okay"; -+}; -+ -+&pwm0 { -+ status = "okay"; -+}; -+ -+&pwm1 { -+ status = "okay"; -+}; -+ -+&pwm2 { -+ status = "okay"; -+ pinctrl-names = "active"; -+ pinctrl-0 = <&pwm2_pin_pull_down>; -+}; -+ -+&pwm3 { -+ status = "okay"; -+ label = "rumble-pwm"; -+}; -+ -+&saradc { -+ vref-supply = <&vcc_1v8>; -+ status = "okay"; -+}; -+ -+&sdhci { -+ assigned-clock-rates = <150000000>; -+ -+ bus-width = <8>; -+ mmc-hs400-1_8v; -+ mmc-hs400-enhanced-strobe; -+ non-removable; -+ -+ status = "okay"; -+}; -+ -+&hdmi { -+ ddc-i2c-bus = <&i2c3>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hdmi_cec>; -+ status = "okay"; -+}; -+ -+&mipi_dsi { -+ status = "okay"; -+ clock-master; -+ -+ ports { -+ mipi_out: port@1 { -+ #address-cells = <0>; -+ #size-cells = <0>; -+ reg = <1>; -+ -+ mipi_out_panel: endpoint { -+ remote-endpoint = <&mipi_in_panel>; -+ }; -+ }; -+ }; -+ -+ panel@0 { -+ reg = <0>; -+ compatible = "sharp,ls054b3sx01"; -+ backlight = <&backlight>; -+ rotation = <270>; -+ -+ iovcc-supply = <&vcc1v8_dvp>; -+ vsp-supply = <&vcc5v5_lcd>; -+ vsn-supply = <&vcc5v5_neg_lcd>; -+ -+ reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_HIGH>; -+ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&lcd_reset_gpio>; -+ -+ port { -+ mipi_in_panel: endpoint { -+ remote-endpoint = <&mipi_out_panel>; -+ }; -+ }; -+ }; -+}; -+ -+&i2c0 { -+ clock-frequency = <400000>; -+ i2c-scl-rising-time-ns = <168>; -+ i2c-scl-falling-time-ns = <4>; -+ status = "okay"; -+ -+ rk808: pmic@1b { -+ compatible = "rockchip,rk808"; -+ reg = <0x1b>; -+ interrupt-parent = <&gpio3>; -+ interrupts = <10 IRQ_TYPE_LEVEL_LOW>; -+ #clock-cells = <1>; -+ clock-output-names = "xin32k", "rk808-clkout2"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pmic_int_l>; -+ rockchip,system-power-controller; -+ wakeup-source; -+ -+ vcc1-supply = <&vcc5v0_sys>; -+ vcc2-supply = <&vcc5v0_sys>; -+ vcc3-supply = <&vcc5v0_sys>; -+ vcc4-supply = <&vcc5v0_sys>; -+ vcc6-supply = <&vcc5v0_sys>; -+ vcc7-supply = <&vcc5v0_sys>; -+ vcc8-supply = <&vcc3v3_sys>; -+ vcc9-supply = <&vcc5v0_sys>; -+ vcc10-supply = <&vcc5v0_sys>; -+ vcc11-supply = <&vcc5v0_sys>; -+ vcc12-supply = <&vcc3v3_sys>; -+ vddio-supply = <&vcca_1v8>; -+ -+ rtc { -+ status = "okay"; -+ }; -+ -+ regulators { // are all those regulator-on-in-suspend really needed?/ -+ vdd_center: DCDC_REG1 { -+ regulator-name = "vdd_center"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <750000>; -+ regulator-max-microvolt = <1350000>; -+ regulator-ramp-delay = <6001>; -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdd_cpu_l: DCDC_REG2 { -+ regulator-name = "vdd_cpu_l"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <750000>; -+ regulator-max-microvolt = <1350000>; -+ regulator-ramp-delay = <6001>; -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc_ddr: DCDC_REG3 { -+ regulator-name = "vcc_ddr"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ }; -+ }; -+ -+ vcc_1v8: DCDC_REG4 { -+ regulator-name = "vcc_1v8"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <1800000>; -+ }; -+ }; -+ -+ vcc1v8_dvp: LDO_REG1 { -+ regulator-name = "vcc1v8_dvp"; -+ //regulator-always-on; -+ //regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <1800000>; -+ }; -+ }; -+ -+ vcc3v0_touch: LDO_REG2 { -+ regulator-name = "vcc3v0_touch"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcca_1v8: LDO_REG3 { -+ regulator-name = "vcca_1v8"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <1800000>; -+ }; -+ }; -+ -+ vcc_sdio: LDO_REG4 { -+ regulator-name = "vcc_sdio"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <3000000>; -+ }; -+ }; -+ -+ vcca3v0_codec: LDO_REG5 { -+ regulator-name = "vcca3v0_codec"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3000000>; -+ regulator-max-microvolt = <3000000>; -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc_1v5: LDO_REG6 { -+ regulator-name = "vcc_1v5"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1500000>; -+ regulator-max-microvolt = <1500000>; -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <1500000>; -+ }; -+ }; -+ -+ vcca1v8_codec: LDO_REG7 { -+ regulator-name = "vcca1v8_codec"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc_3v0: LDO_REG8 { -+ regulator-name = "vcc_3v0"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3000000>; -+ regulator-max-microvolt = <3000000>; -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <3000000>; -+ }; -+ }; -+ -+ vcc3v3_s3: vcc_lan: SWITCH_REG1 { -+ regulator-name = "vcc3v3_s3"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc3v3_s0: SWITCH_REG2 { -+ regulator-name = "vcc3v3_s0"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ }; -+ }; -+ -+ vdd_cpu_b: regulator@40 { -+ compatible = "silergy,syr827"; -+ reg = <0x40>; -+ fcs,suspend-voltage-selector = <1>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&vsel1_pin>; -+ regulator-name = "vdd_cpu_b"; -+ regulator-min-microvolt = <712500>; -+ regulator-max-microvolt = <1500000>; -+ regulator-ramp-delay = <1000>; -+ regulator-always-on; -+ regulator-boot-on; -+ vin-supply = <&vcc5v0_sys>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdd_gpu: regulator@41 { -+ compatible = "silergy,syr828"; -+ reg = <0x41>; -+ fcs,suspend-voltage-selector = <1>; -+ vsel-gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&vsel2_pin>; -+ regulator-name = "vdd_gpu"; -+ regulator-min-microvolt = <712500>; -+ regulator-max-microvolt = <1500000>; -+ regulator-ramp-delay = <1000>; -+ regulator-always-on; -+ regulator-boot-on; -+ vin-supply = <&vcc5v0_sys>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ cw2015@62 { -+ compatible = "cellwise,cw2015"; -+ reg = <0x62>; -+ cellwise,battery-profile = /bits/ 8 < -+ 0x15 0x7E 0x66 0x5B 0x58 0x55 0x51 0x4D -+ 0x4A 0x47 0x44 0x47 0x4D 0x46 0x32 0x27 -+ 0x1F 0x1A 0x15 0x16 0x21 0x30 0x3F 0x4A -+ 0x46 0x5C 0x0C 0x29 0x19 0x31 0x59 0x74 -+ 0x7B 0x7D 0x81 0x82 0x3F 0x1A 0x58 0x22 -+ 0x06 0x42 0x2B 0x63 0x89 0x93 0x94 0x3C -+ 0x57 0x7D 0x93 0xAE 0x80 0xC2 0xD2 0xCB -+ 0x2F 0x00 0x64 0xA5 0xB5 0x1F 0xB0 0x11 -+ >; -+ cellwise,monitor-interval-ms = <5000>; -+ power-supplies = <&mains_charger>; -+ monitored-battery = <&bat>; -+ }; -+}; -+ -+&i2c1 { -+ clock-frequency = <100000>; -+ i2c-scl-rising-time-ns = <300>; -+ i2c-scl-falling-time-ns = <15>; -+ status = "okay"; -+ -+ es8316: es8316@11 { -+ compatible = "everest,es8316"; -+ reg = <0x11>; -+ clocks = <&cru SCLK_I2S_8CH_OUT>; -+ clock-names = "mclk"; -+ #sound-dai-cells = <0>; -+ }; -+}; -+ -+&i2c3 { -+ i2c-scl-rising-time-ns = <450>; -+ i2c-scl-falling-time-ns = <15>; -+ status = "okay"; -+}; -+ -+&i2c4 { -+ i2c-scl-rising-time-ns = <600>; -+ i2c-scl-falling-time-ns = <20>; -+ status = "okay"; -+ -+ gt9xx: gt9xx@14 { -+ compatible = "goodix,gt927"; -+ goodix,config-name = "rg552_goodix_927_cfg.bin"; -+ reg = <0x14>; -+ irq-gpios = <&gpio3 RK_PD7 GPIO_ACTIVE_HIGH>; -+ reset-gpios = <&gpio3 RK_PD6 GPIO_ACTIVE_HIGH>; -+ touchscreen-size-x = <1152>; -+ touchscreen-size-y = <1920>; -+ touchscreen-inverted-x; -+ touchscreen-inverted-y; -+ interrupt-parent = <&gpio3>; -+ interrupts = ; -+ }; -+ -+ fusb0: typec-portc@22 { -+ compatible = "fcs,fusb302"; -+ status = "okay"; -+ reg = <0x22>; -+ interrupt-parent = <&gpio1>; -+ interrupts = ; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&fusb0_int>; -+ vbus-supply = <&vcc5v0_typec>; -+ -+ connector { -+ compatible = "usb-c-connector"; -+ data-role = "dual"; -+ label = "USB-C"; -+ op-sink-microwatt = <1000000>; -+ power-role = "dual"; -+ sink-pdos = -+ ; -+ source-pdos = -+ ; -+ try-power-role = "sink"; -+ -+ ports { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ port@0 { -+ reg = <0>; -+ -+ usbc_hs: endpoint { -+ remote-endpoint = <&u2phy0_typec_hs>; -+ }; -+ }; -+ -+ port@1 { -+ reg = <1>; -+ -+ usbc_ss: endpoint { -+ remote-endpoint = <&tcphy0_typec_ss>; -+ }; -+ }; -+ // displayport maybe? -+ }; -+ }; -+ }; -+}; -+ -+&i2s1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_8ch_mclk_pin>, <&i2s1_2ch_bus>; -+ rockchip,i2s-broken-burst-len; -+ rockchip,playback-channels = <8>; -+ rockchip,capture-channels = <8>; -+ status = "okay"; -+}; -+ -+&i2s2 { -+ status = "okay"; -+}; -+ -+&io_domains { -+ status = "okay"; -+ -+ bt656-supply = <&vcc1v8_dvp>; -+ audio-supply = <&vcca3v0_codec>; -+ sdmmc-supply = <&vcc_sdio>; -+ gpio1830-supply = <&vcc_3v0>; -+}; -+ -+&pmu_io_domains { -+ pmu1830-supply = <&vcc_3v0>; -+ status = "okay"; -+}; -+ -+&pinctrl { -+ dc-charger { -+ dc_det_pin: dc-det-pin { -+ rockchip,pins = <4 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+ -+ es8316 { -+ hp_det_pin: hp-det-pin { -+ rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ -+ spk_en_pin: spk-en-pin { -+ rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_down>; -+ }; -+ }; -+ -+ i2s1 { -+ i2s_8ch_mclk_pin: i2s-8ch-mclk-pin { -+ rockchip,pins = <4 RK_PA0 1 &pcfg_pull_none>; -+ }; -+ }; -+ -+ fusb302x { -+ fusb0_int: fusb0-int { -+ rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+ -+ pmic { -+ pmic_int_l: pmic-int-l { -+ rockchip,pins = <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ -+ vsel1_pin: vsel1-pin { -+ rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; -+ }; -+ -+ vsel2_pin: vsel2-pin { -+ rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; -+ }; -+ }; -+ -+ sdcard { -+ sdmmc0_pwr_h: sdmmc0-pwr-h { -+ rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ }; -+ -+ sdio-pwrseq { -+ wifi_enable_h: wifi-enable-h { -+ rockchip,pins = <2 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ usb-typec { -+ vcc5v0_typec_en: vcc5v0_typec_en { -+ rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+ -+ usb2 { -+ vcc5v0_host_en: vcc5v0-host-en { -+ rockchip,pins = <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ gpio-leds { -+ leds_gpio: leds-gpio { -+ rockchip,pins = -+ <1 RK_PC4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+ -+ lcd-panel { -+ lcd_reset_gpio: lcd-reset-gpio { -+ rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ vcc5v5_lcd_en: vcc5v5-lcd-en { -+ rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ vcc5v5_neg_lcd_en: vcc5v5-neg-lcd-en { -+ rockchip,pins = <0 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ wifi { -+ wifi_pwr: wifi-pwr-en { -+ rockchip,pins = <3 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ btns { -+ btn_pins: btn-pins { -+ rockchip,pins = -+ <3 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PD2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PC0 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ vol_pwr_btn: vol-pwr-btn { -+ rockchip,pins = -+ <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+}; -+ -+&tcphy0 { -+ status = "okay"; -+}; -+ -+&tcphy0_usb3 { -+ port { -+ tcphy0_typec_ss: endpoint { -+ remote-endpoint = <&usbc_ss>; -+ }; -+ }; -+}; -+ -+&tcphy1 { -+ status = "okay"; -+}; -+ -+&tsadc { -+ /* tshut mode 0:CRU 1:GPIO */ -+ rockchip,hw-tshut-mode = <1>; -+ /* tshut polarity 0:LOW 1:HIGH */ -+ rockchip,hw-tshut-polarity = <1>; -+ status = "okay"; -+}; -+ -+&u2phy0 { -+ status = "okay"; -+ -+ u2phy0_otg: otg-port { -+ status = "okay"; -+ }; -+ -+ u2phy0_host: host-port { -+ phy-supply = <&vcc5v0_host>; -+ status = "okay"; -+ }; -+ -+ port { -+ u2phy0_typec_hs: endpoint { -+ remote-endpoint = <&usbc_hs>; -+ }; -+ }; -+}; -+ -+&u2phy1 { -+ status = "okay"; -+ -+ u2phy1_otg: otg-port { -+ status = "okay"; -+ }; -+ -+ u2phy1_host: host-port { -+ phy-supply = <&vcc5v0_host>; -+ status = "okay"; -+ }; -+}; -+ -+&uart0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; -+ status = "okay"; -+}; -+ -+&uart2 { -+ status = "okay"; -+}; -+ -+&usb_host0_ehci { -+ status = "okay"; -+}; -+ -+&usb_host0_ohci { -+ status = "okay"; -+}; -+ -+&usb_host1_ehci { -+ status = "okay"; -+}; -+ -+&usb_host1_ohci { -+ status = "okay"; -+}; -+ -+&usbdrd3_0 { -+ status = "okay"; -+}; -+ -+&usbdrd_dwc3_0 { -+ status = "okay"; -+ dr_mode = "host"; -+}; -+ -+&usbdrd3_1 { -+ status = "okay"; -+}; -+ -+&usbdrd_dwc3_1 { -+ status = "okay"; -+ dr_mode = "host"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ wifi_card: device@1 { -+ compatible = "usbbda,f179"; -+ reg = <1>; -+ #size-cells = <0>; -+ #address-cells = <2>; -+ -+ interface@0 { -+ compatible = "usbifbda,f179.config1.0"; -+ reg = <0 1>; -+ }; -+ }; -+}; -+ -+&vopb { -+ status = "okay"; -+}; -+ -+&vopb_mmu { -+ status = "okay"; -+}; -+ -+&vopl { -+ status = "okay"; -+}; -+ -+&vopl_mmu { -+ status = "okay"; -+};