From 984050a2dfe5173f81439dce09b16eda10f2d1e7 Mon Sep 17 00:00:00 2001 From: igorpecovnik <6281704+igorpecovnik@users.noreply.github.com> Date: Thu, 18 Jul 2024 13:51:18 +0000 Subject: [PATCH 01/43] tools: Bump `SHELLCHECK_VERSION` from 0.9.0 to 0.10.0 --- lib/functions/general/shellcheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions/general/shellcheck.sh b/lib/functions/general/shellcheck.sh index 3549aa5ee542..8e2af29ea481 100644 --- a/lib/functions/general/shellcheck.sh +++ b/lib/functions/general/shellcheck.sh @@ -49,7 +49,7 @@ function shellcheck_debian_control_scripts() { function run_tool_shellcheck() { # Default version - SHELLCHECK_VERSION=${SHELLCHECK_VERSION:-0.9.0} # https://github.com/koalaman/shellcheck/releases + SHELLCHECK_VERSION=${SHELLCHECK_VERSION:-0.10.0} # https://github.com/koalaman/shellcheck/releases declare non_cache_dir="/armbian-tools/shellcheck" # To deploy/reuse cached SHELLCHECK in a Docker image. From 8edcf2a0cb3c09e340391f93574d37c706b2384a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2024 18:14:32 +0000 Subject: [PATCH 02/43] build(deps): bump setuptools from 70.2.0 to 70.3.0 Bumps [setuptools](https://github.com/pypa/setuptools) from 70.2.0 to 70.3.0. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/setuptools/compare/v70.2.0...v70.3.0) --- updated-dependencies: - dependency-name: setuptools dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 84d818d1bf56..920e33409277 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ # Always use a fixed version, this is important for correct hashing. # Dependabot will keep these versions up to date. -setuptools == 70.2.0 # for building Python packages +setuptools == 70.3.0 # for building Python packages pyelftools == 0.31 # for building U-Boot unidiff == 0.7.5 # for parsing unified diff GitPython == 3.1.43 # for manipulating git repos From f1e63eb8df1ac7b7941e3583ada347aeb02ed8c3 Mon Sep 17 00:00:00 2001 From: igorpecovnik <6281704+igorpecovnik@users.noreply.github.com> Date: Thu, 18 Jul 2024 13:51:18 +0000 Subject: [PATCH 03/43] tools: Bump `ORAS_VERSION` from 0.16.0 to 1.2.0 --- lib/functions/general/oci-oras.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions/general/oci-oras.sh b/lib/functions/general/oci-oras.sh index 19eb88c4c136..71e99a591ca8 100644 --- a/lib/functions/general/oci-oras.sh +++ b/lib/functions/general/oci-oras.sh @@ -9,7 +9,7 @@ function run_tool_oras() { # Default version - ORAS_VERSION=${ORAS_VERSION:-0.16.0} # https://github.com/oras-project/oras/releases + ORAS_VERSION=${ORAS_VERSION:-1.2.0} # https://github.com/oras-project/oras/releases #ORAS_VERSION=${ORAS_VERSION:-"1.0.0-rc.1"} # https://github.com/oras-project/oras/releases declare non_cache_dir="/armbian-tools/oras" # To deploy/reuse cached ORAS in a Docker image. From e5fe080b0a24f44e5364d3f7085e7174f71ed0d1 Mon Sep 17 00:00:00 2001 From: igorpecovnik <6281704+igorpecovnik@users.noreply.github.com> Date: Thu, 18 Jul 2024 13:51:21 +0000 Subject: [PATCH 04/43] tools: Bump `BATCAT_VERSION` from 0.23.0 to 0.24.0 --- lib/functions/general/bat-cat.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions/general/bat-cat.sh b/lib/functions/general/bat-cat.sh index 755c15405ecf..f389909efa2a 100644 --- a/lib/functions/general/bat-cat.sh +++ b/lib/functions/general/bat-cat.sh @@ -9,7 +9,7 @@ function run_tool_batcat() { # Default version - BATCAT_VERSION=${BATCAT_VERSION:-0.23.0} # https://github.com/sharkdp/bat/releases + BATCAT_VERSION=${BATCAT_VERSION:-0.24.0} # https://github.com/sharkdp/bat/releases declare non_cache_dir="/armbian-tools/batcat" # To deploy/reuse cached batcat in a Docker image. From a6c1308e2468c7782bfbd945b195b84d3384dce8 Mon Sep 17 00:00:00 2001 From: Ivan Podogov Date: Fri, 19 Jul 2024 23:16:08 +0100 Subject: [PATCH 05/43] Add board config for Retro Lite CM5 --- config/boards/retro-lite-cm5.csc | 47 ++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 config/boards/retro-lite-cm5.csc diff --git a/config/boards/retro-lite-cm5.csc b/config/boards/retro-lite-cm5.csc new file mode 100644 index 000000000000..2d7516afb40c --- /dev/null +++ b/config/boards/retro-lite-cm5.csc @@ -0,0 +1,47 @@ +# Rockchip RK3588S octa core 4/8/16GB RAM SoC NVMe USB3 USB-C GbE +BOARD_NAME="Retro Lite CM5" +BOARDFAMILY="rockchip-rk3588" +BOARD_MAINTAINER="ginkage" +BOOT_SOC="rk3588" +KERNEL_TARGET="vendor" +FULL_DESKTOP="yes" +BOOT_LOGO="desktop" +BOOT_FDT_FILE="rockchip/rk3588s-retro-lite-cm5.dtb" +BOOT_SCENARIO="spl-blobs" +IMAGE_PARTITION_TABLE="gpt" +DDR_BLOB="rk35/rk3588_ddr_lp4_2112MHz_lp5_2400MHz_v1.16.bin" +BL31_BLOB="rk35/rk3588_bl31_v1.45.elf" + +function post_family_tweaks__retrolitecm5_naming_audios() { + display_alert "$BOARD" "Renaming Retro Lite CM5 audios" "info" + + mkdir -p $SDCARD/etc/udev/rules.d/ + echo 'SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-hdmi0-sound", ENV{SOUND_DESCRIPTION}="HDMI0 Audio"' > $SDCARD/etc/udev/rules.d/90-naming-audios.rules + echo 'SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-dp0-sound", ENV{SOUND_DESCRIPTION}="DP0 Audio"' >> $SDCARD/etc/udev/rules.d/90-naming-audios.rules + echo 'SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-wm8960-sound", ENV{SOUND_DESCRIPTION}="WM8960 Audio"' >> $SDCARD/etc/udev/rules.d/90-naming-audios.rules + + return 0 +} + +# Mainline U-Boot +function post_family_config__retro_lite_cm5_use_mainline_uboot() { + display_alert "$BOARD" "Using mainline U-Boot for $BOARD / $BRANCH" "info" + + declare -g BOOTCONFIG="generic-rk3588_defconfig" # Use generic defconfig which should boot all RK3588 boards + declare -g BOOTDELAY=1 # Wait for UART interrupt to enter UMS/RockUSB mode etc + declare -g BOOTSOURCE="https://github.com/u-boot/u-boot.git" # We ❤️ Mainline U-Boot + declare -g BOOTBRANCH="tag:v2024.07-rc4" + declare -g BOOTPATCHDIR="v2024.07/board_${BOARD}" + # Don't set BOOTDIR, allow shared U-Boot source directory for disk space efficiency + + declare -g UBOOT_TARGET_MAP="BL31=${RKBIN_DIR}/${BL31_BLOB} ROCKCHIP_TPL=${RKBIN_DIR}/${DDR_BLOB};;u-boot-rockchip.bin" + + # Disable stuff from rockchip64_common; we're using binman here which does all the work already + unset uboot_custom_postprocess write_uboot_platform write_uboot_platform_mtd + + # Just use the binman-provided u-boot-rockchip.bin, which is ready-to-go + function write_uboot_platform() { + dd "if=$1/u-boot-rockchip.bin" "of=$2" bs=32k seek=1 conv=notrunc status=none + } +} + From e4032228dd0ca424eaaf7c17a5a27637b2f2d519 Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Sun, 21 Jul 2024 09:02:43 +0200 Subject: [PATCH 06/43] oci-oras: fix for ORAS > 1.x, as it now requires `HOME` to be set (fixes `download-artifact`) - it hasn't HOME when run under the matrix-prepare multiprocess launcher, so use TMPDIR - fixes https://github.com/armbian/build/pull/6964 --- lib/functions/general/oci-oras.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/functions/general/oci-oras.sh b/lib/functions/general/oci-oras.sh index 71e99a591ca8..b41f14f6c424 100644 --- a/lib/functions/general/oci-oras.sh +++ b/lib/functions/general/oci-oras.sh @@ -81,9 +81,11 @@ function run_tool_oras() { fi # Run oras, possibly with retries... + declare ORAS_HOME="${HOME:-"${TMPDIR}"}" # oras _requires_ a HOME to work atleast in 1.2+ + display_alert "Running ORAS ${ACTUAL_VERSION}" "HOME='${ORAS_HOME}'; retries='${retries:-1}'; cmdline: $*" "debug" if [[ "${retries:-1}" -gt 1 ]]; then display_alert "Calling ORAS with retries ${retries}" "$*" "debug" - sleep_seconds="30" do_with_retries "${retries}" "${ORAS_BIN}" "$@" + sleep_seconds="30" do_with_retries "${retries}" env -i "HOME=${ORAS_HOME}" "${ORAS_BIN}" "$@" else # If any parameters passed, call ORAS, otherwise exit. We call it this way (sans-parameters) early to prepare ORAS tooling. if [[ $# -eq 0 ]]; then @@ -92,7 +94,7 @@ function run_tool_oras() { fi display_alert "Calling ORAS" "$*" "debug" - "${ORAS_BIN}" "$@" + env -i "HOME=${ORAS_HOME}" "${ORAS_BIN}" "$@" fi } From ec83684f244d868b21a1014187c0e05a2e51ac14 Mon Sep 17 00:00:00 2001 From: amazingfate Date: Sun, 21 Jul 2024 15:43:08 +0800 Subject: [PATCH 07/43] mesa-vpu: use kisak mesa ppa instead of oibaf --- extensions/mesa-vpu.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/extensions/mesa-vpu.sh b/extensions/mesa-vpu.sh index 05261fdde4d7..6bca0d325ce2 100644 --- a/extensions/mesa-vpu.sh +++ b/extensions/mesa-vpu.sh @@ -20,7 +20,7 @@ function extension_prepare_config__3d() { elif [[ "${DISTRIBUTION}" == "Ubuntu" ]]; then - EXTRA_IMAGE_SUFFIXES+=("-oibaf") + EXTRA_IMAGE_SUFFIXES+=("-kisak") fi @@ -62,13 +62,13 @@ function post_install_kernel_debs__3d() { elif [[ "${DISTRIBUTION}" == "Ubuntu" ]]; then - display_alert "Adding oibaf PPAs" "${EXTENSION}" "info" - do_with_retries 3 chroot_sdcard add-apt-repository ppa:oibaf/graphics-drivers --yes --no-update + display_alert "Adding kisak PPAs" "${EXTENSION}" "info" + do_with_retries 3 chroot_sdcard add-apt-repository ppa:kisak/kisak-mesa --yes --no-update - display_alert "Pinning oibaf PPAs" "${EXTENSION}" "info" - cat <<- EOF > "${SDCARD}"/etc/apt/preferences.d/mesa-oibaf-graphics-drivers-pin + display_alert "Pinning kisak PPAs" "${EXTENSION}" "info" + cat <<- EOF > "${SDCARD}"/etc/apt/preferences.d/mesa-kisak-kisak-mesa-pin Package: * - Pin: release o=LP-PPA-oibaf-graphics-drivers + Pin: release o=LP-PPA-kisak-kisak-mesa Pin-Priority: 1001 EOF @@ -94,7 +94,7 @@ function post_install_kernel_debs__3d() { EOF fi - display_alert "Updating sources list, after oibaf PPAs" "${EXTENSION}" "info" + display_alert "Updating sources list, after kisak PPAs" "${EXTENSION}" "info" do_with_retries 3 chroot_sdcard_apt_get_update display_alert "Installing 3D extension packages" "${EXTENSION}" "info" From f3f89a78ec92b12b334afbdfe489cb29a27da261 Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Sat, 20 Jul 2024 11:28:54 +0200 Subject: [PATCH 08/43] utils-dpkgdeb: force rebuild of all artifacts, due to https://github.com/armbian/build/pull/6964 (ORAS change) --- lib/functions/compilation/packages/utils-dpkgdeb.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/functions/compilation/packages/utils-dpkgdeb.sh b/lib/functions/compilation/packages/utils-dpkgdeb.sh index 96d4eca25709..98b4a20fd38a 100644 --- a/lib/functions/compilation/packages/utils-dpkgdeb.sh +++ b/lib/functions/compilation/packages/utils-dpkgdeb.sh @@ -183,3 +183,5 @@ function generic_artifact_package_hook_helper() { # produce log asset for script (@TODO: batcat?) LOG_ASSET="deb-${artifact_name:?}-${script}.sh" do_with_log_asset run_host_command_logged cat "${package_DEBIAN_dir}/${script}" } + +# 2024-07-20: change here to force a rebuild of hopefully all artifacts. From 49e0ec5d0ec6096292fc3b0e13c855d4297cbcb9 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Sun, 21 Jul 2024 18:51:41 +0200 Subject: [PATCH 09/43] Temporally move TI build targets to EOS as Git is out of reach TBD: - establish mirror for 3rd party Git hosts - revert once starts to work --- config/boards/{sk-am62b.conf => sk-am62b.eos} | 0 config/boards/{sk-am64b.conf => sk-am64b.eos} | 0 config/boards/{sk-am68.conf => sk-am68.eos} | 0 config/boards/{sk-tda4vm.conf => sk-tda4vm.eos} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename config/boards/{sk-am62b.conf => sk-am62b.eos} (100%) rename config/boards/{sk-am64b.conf => sk-am64b.eos} (100%) rename config/boards/{sk-am68.conf => sk-am68.eos} (100%) rename config/boards/{sk-tda4vm.conf => sk-tda4vm.eos} (100%) diff --git a/config/boards/sk-am62b.conf b/config/boards/sk-am62b.eos similarity index 100% rename from config/boards/sk-am62b.conf rename to config/boards/sk-am62b.eos diff --git a/config/boards/sk-am64b.conf b/config/boards/sk-am64b.eos similarity index 100% rename from config/boards/sk-am64b.conf rename to config/boards/sk-am64b.eos diff --git a/config/boards/sk-am68.conf b/config/boards/sk-am68.eos similarity index 100% rename from config/boards/sk-am68.conf rename to config/boards/sk-am68.eos diff --git a/config/boards/sk-tda4vm.conf b/config/boards/sk-tda4vm.eos similarity index 100% rename from config/boards/sk-tda4vm.conf rename to config/boards/sk-tda4vm.eos From c1dc5a2be1f5db4909f35b64b777a96e87c65941 Mon Sep 17 00:00:00 2001 From: Paolo Sabatino Date: Mon, 22 Jul 2024 18:48:42 +0200 Subject: [PATCH 10/43] rockchip64: fix rk3399 miniloader --- config/sources/families/include/rockchip64_common.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/sources/families/include/rockchip64_common.inc b/config/sources/families/include/rockchip64_common.inc index 1e225e847144..df4cf6c88077 100644 --- a/config/sources/families/include/rockchip64_common.inc +++ b/config/sources/families/include/rockchip64_common.inc @@ -99,7 +99,7 @@ case "$BOOT_SOC" in CPUMAX=${CPUMAX:="2016000"} BOOT_SCENARIO="${BOOT_SCENARIO:=only-blobs}" DDR_BLOB="${DDR_BLOB:-"rk33/rk3399_ddr_933MHz_v1.25.bin"}" - MINILOADER_BLOB="${MINILOADER_BLOB:-"rk33/rk3399_loader_v1.30.130.bin"}" + MINILOADER_BLOB="${MINILOADER_BLOB:-"rk33/rk3399_miniloader_v1.26.bin"}" BL31_BLOB="${BL31_BLOB:-"rk33/rk3399_bl31_v1.35.elf"}" ;; From f82e6e8d0c58ce40984d8f12d45054f0808d6c24 Mon Sep 17 00:00:00 2001 From: Paolo Sabatino Date: Sat, 20 Jul 2024 13:17:49 +0200 Subject: [PATCH 11/43] rorkchip64: fix rk3328 gpio2 bank addressing --- ...t-RK3328-iomux-width-flag-for-GPIO2-B-pins.patch | 13 +++++++++++++ ...t-RK3328-iomux-width-flag-for-GPIO2-B-pins.patch | 13 +++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 patch/kernel/archive/rockchip64-6.6/pinctrl-rockchip-correct-RK3328-iomux-width-flag-for-GPIO2-B-pins.patch create mode 100644 patch/kernel/archive/rockchip64-6.9/pinctrl-rockchip-correct-RK3328-iomux-width-flag-for-GPIO2-B-pins.patch diff --git a/patch/kernel/archive/rockchip64-6.6/pinctrl-rockchip-correct-RK3328-iomux-width-flag-for-GPIO2-B-pins.patch b/patch/kernel/archive/rockchip64-6.6/pinctrl-rockchip-correct-RK3328-iomux-width-flag-for-GPIO2-B-pins.patch new file mode 100644 index 000000000000..bc751233a684 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.6/pinctrl-rockchip-correct-RK3328-iomux-width-flag-for-GPIO2-B-pins.patch @@ -0,0 +1,13 @@ +diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c +index 3f56991f5b89..f6da91941fbd 100644 +--- a/drivers/pinctrl/pinctrl-rockchip.c ++++ b/drivers/pinctrl/pinctrl-rockchip.c +@@ -3813,7 +3813,7 @@ static struct rockchip_pin_bank rk3328_pin_banks[] = { + PIN_BANK_IOMUX_FLAGS(0, 32, "gpio0", 0, 0, 0, 0), + PIN_BANK_IOMUX_FLAGS(1, 32, "gpio1", 0, 0, 0, 0), + PIN_BANK_IOMUX_FLAGS(2, 32, "gpio2", 0, +- 0, ++ IOMUX_WIDTH_2BIT, + IOMUX_WIDTH_3BIT, + 0), + PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3", diff --git a/patch/kernel/archive/rockchip64-6.9/pinctrl-rockchip-correct-RK3328-iomux-width-flag-for-GPIO2-B-pins.patch b/patch/kernel/archive/rockchip64-6.9/pinctrl-rockchip-correct-RK3328-iomux-width-flag-for-GPIO2-B-pins.patch new file mode 100644 index 000000000000..bc751233a684 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.9/pinctrl-rockchip-correct-RK3328-iomux-width-flag-for-GPIO2-B-pins.patch @@ -0,0 +1,13 @@ +diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c +index 3f56991f5b89..f6da91941fbd 100644 +--- a/drivers/pinctrl/pinctrl-rockchip.c ++++ b/drivers/pinctrl/pinctrl-rockchip.c +@@ -3813,7 +3813,7 @@ static struct rockchip_pin_bank rk3328_pin_banks[] = { + PIN_BANK_IOMUX_FLAGS(0, 32, "gpio0", 0, 0, 0, 0), + PIN_BANK_IOMUX_FLAGS(1, 32, "gpio1", 0, 0, 0, 0), + PIN_BANK_IOMUX_FLAGS(2, 32, "gpio2", 0, +- 0, ++ IOMUX_WIDTH_2BIT, + IOMUX_WIDTH_3BIT, + 0), + PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3", From 4ae0a958146810117050d0dbd359b99691a0fa0c Mon Sep 17 00:00:00 2001 From: Paolo Sabatino Date: Sun, 21 Jul 2024 14:40:12 +0200 Subject: [PATCH 12/43] rockchip64: bump edge kernel to 6.10 --- config/kernel/linux-rockchip64-edge.config | 92 +- .../families/include/rockchip64_common.inc | 2 +- config/sources/mainline-kernel.conf.sh | 4 +- .../rockchip64-6.10/0000.patching_config.yaml | 37 + .../add-board-fine3399-dts.patch | 876 + .../rockchip64-6.10/add-board-helios64.patch | 1038 + .../add-board-xiaobao-nas-dts.patch | 779 + .../board-firefly-rk3399-dts.patch | 282 + ...rd-helios64-dts-fix-stability-issues.patch | 72 + .../board-helios64-remove-pcie-ep-gpios.patch | 25 + .../board-nanopc-t4-add-typec-dp.patch | 147 + ...board-nanopi-m4v2-dts-add-sound-card.patch | 190 + .../board-nanopi-r2c-plus.patch | 30 + .../rockchip64-6.10/board-nanopi-r2s.patch | 735 + .../board-nanopi-r4s-pwmfan.patch | 58 + .../board-orangepi-r1-plus.patch | 216 + .../board-orangepi-rk3399-pcie.patch | 68 + .../board-pbp-add-dp-alt-mode.patch | 421 + .../board-radxa-e25-sdmmc0-fix.patch | 35 + .../board-radxa-e25-usb3-and-emmc-fix.patch | 64 + .../board-rk3328-roc-cc-dts-enable-dmc.patch | 75 + .../board-rk3328-roc-cc-dts-ram-profile.patch | 330 + .../board-rk3328-roc-pc-dts-ram-profile.patch | 301 + .../rockchip64-6.10/board-rk3328-roc-pc.patch | 593 + .../board-rock3a-emmc-sfc.patch | 54 + .../rockchip64-6.10/board-rock3a-usb3.patch | 44 + .../board-rock64-mail-supply.patch | 29 + .../board-rockpi3-enable-dmc.patch | 44 + .../board-rockpi4-0003-arm64-dts-pcie.patch | 130 + .../board-rockpis-0001-arm64-dts.patch | 408 + ...s-rk3308-Add-gmac-node-at-dtsi-level.patch | 24 + ...ip-add-cpu-s-thermal-config-for-rk33.patch | 87 + ...ockchip-add-tsadc-support-for-rk3308.patch | 71 + ...-dts-rockchip-add-i2s_8ch-for-rk3308.patch | 126 + ...12-arm64-dts-rk3308-Add-rk-timer-rtc.patch | 32 + ...ecs-Add-RK3308-internal-codec-driver.patch | 2638 + ...s-0019-Sync-rk3308_codec-to-BSP-tree.patch | 6738 +++ ...-rockchip-Add-acodec-node-for-rk3308.patch | 50 + ...308_codec-replace-codec-to-component.patch | 459 + ...027-arm64-dts-rk3308-add-otp-cpuinfo.patch | 115 + ...s-rk3308-add-reserved-memory-ramoops.patch | 99 + ...ckpro64-0001-Add-pcie-bus-scan-delay.patch | 64 + ...d-rockpro64-change-rx_delay-for-gmac.patch | 26 + .../board-rockpro64-fix-emmc.patch | 123 + ...board-rockpro64-fix-spi1-flash-speed.patch | 105 + .../board-rockpro64-work-led-heartbeat.patch | 95 + .../board-rocks0-0001-deviceTree.patch | 366 + .../drv-spi-spidev-remove-warnings.patch | 32 + .../dt/rk3308-sakurapi-rk3308b.dts | 226 + .../archive/rockchip64-6.10/dt/rk3318-box.dts | 1007 + .../dt/rk3328-nanopi-neo3-rev02.dts | 195 + .../dt/rk3328-nanopi-r2-rev00.dts | 126 + .../dt/rk3328-nanopi-r2-rev06.dts | 92 + .../dt/rk3328-nanopi-r2-rev20.dts | 39 + .../dt/rk3328-orangepi-r1-plus-lts.dts | 449 + .../rockchip64-6.10/dt/rk3328-z28pro.dts | 1 + .../rockchip64-6.10/dt/rk3399-fine3399.dts | 797 + .../rockchip64-6.10/dt/rk3399-nanopi-m4v2.dts | 87 + .../rockchip64-6.10/dt/rk3399-nanopi-r4se.dts | 17 + .../dt/rk3399-orangepi-4-lts.dts | 1334 + .../rockchip64-6.10/dt/rk3399-orangepi-4.dts | 1194 + .../rockchip64-6.10/dt/rk3399-rock-pi-4.dts | 1 + .../rockchip64-6.10/dt/rk3399-rock-pi-4c.dts | 69 + .../rockchip64-6.10/dt/rk3399-tinker-2.dts | 751 + .../rockchip64-6.10/dt/rk3399-xiaobao-nas.dts | 774 + .../dt/rk3399pro-tinker-edge-r.dts | 1080 + .../dt/rk3566-firefly-roc-pc.dts | 760 + .../rockchip64-6.10/dt/rk3566-jp-tvbox.dts | 579 + .../dt/rk3566-orangepi-3b-sata.dts | 17 + .../rockchip64-6.10/dt/rk3566-orangepi-3b.dts | 869 + .../rockchip64-6.10/dt/rk3566-panther-x2.dts | 579 + .../dt/rk3566-radxa-zero-3.dtsi | 531 + .../dt/rk3566-radxa-zero-3e.dts | 52 + .../dt/rk3566-radxa-zero-3w.dts | 92 + .../rockchip64-6.10/dt/rk3566-rock-3c.dts | 786 + .../dt/rk3568-hinlink-h66k.dts | 21 + .../dt/rk3568-hinlink-h68k.dts | 889 + .../rockchip64-6.10/dt/rk3568-odroid-m1.dts | 775 + .../general-add-miniDP-dt-doc.patch | 133 + .../general-add-miniDP-virtual-extcon.patch | 382 + ...eral-add-overlay-compilation-support.patch | 64 + .../general-add-overlay-configfs.patch | 419 + .../general-add-panel-simple-dsi.patch | 856 + .../general-add-pll-hdmi-timings.patch | 155 + .../general-add-xtx-spi-nor-chips.patch | 82 + .../general-cryptov1-trng.patch | 304 + .../general-disable-mtu-validation.patch | 51 + .../general-fix-es8316-kernel-panic.patch | 105 + .../general-fix-inno-usb2-phy-init.patch | 28 + ...fix-mmc-signal-voltage-before-reboot.patch | 46 + .../general-hdmi-clock-fixes.patch | 539 + ..._DMA_block_memory_allocation_to_2048.patch | 21 + .../general-legacy-rockchip-hwrng.patch | 436 + .../general-legacy-rockchip-hwrng_5.10.patch | 523 + ...l-possibility-of-disabling-rk808-rtc.patch | 51 + .../general-rk3328-dtsi-trb-ent-quirk.patch | 61 + ...08-configurable-switch-voltage-steps.patch | 104 + .../general-rockchip-overlays.patch | 28 + .../general-rt5651-add-mclk.patch | 133 + .../general-v4l2-iep-driver.patch | 1808 + .../general-v4l2-rkvdec-00-fixes.patch | 659 + .../general-v4l2-rkvdec-01-vp9.patch | 493 + .../general-v4l2-rkvdec-02-hevc.patch | 3226 + ...eneral-workaround-broadcom-bt-serdev.patch | 26 + .../kernel-6.8-tools-cgroup-makefile.patch | 17 + ...dma_alloc_noncontiguous-allow-DMA_AT.patch | 26 + ...rent-dst-bufs-for-Hantro-V4L2-driver.patch | 24 + ...rent-dst-bufs-for-Rkvdec-V4L2-driver.patch | 24 + ...-r8152-add-LED-configuration-from-OF.patch | 79 + .../archive/rockchip64-6.10/overlay/Makefile | 57 + .../overlay/README.rockchip-overlays | 259 + .../overlay/rk3308-b@1.3ghz.dtso | 27 + .../rockchip64-6.10/overlay/rk3308-bs.dtso | 39 + .../overlay/rk3308-bs@1.3ghz.dtso | 26 + .../rockchip64-6.10/overlay/rk3308-emmc.dtso | 13 + .../overlay/rk3308-s0-ext-antenna.dtso | 48 + .../overlay/rk3308-sdio@10mhz.dtso | 14 + .../overlay/rk3308-sdio@4mhz.dtso | 14 + .../overlay/rockchip-fixup.scr-cmd | 65 + .../overlay/rockchip-rk3318-box-cpu-hs.dtso | 24 + .../overlay/rockchip-rk3318-box-emmc-ddr.dtso | 14 + .../rockchip-rk3318-box-emmc-hs200.dtso | 14 + .../rockchip-rk3318-box-led-conf1.dtso | 49 + .../rockchip-rk3318-box-led-conf2.dtso | 63 + .../rockchip-rk3318-box-led-conf3.dtso | 305 + .../rockchip-rk3318-box-led-conf4.dtso | 38 + .../rockchip-rk3318-box-wlan-ap6330.dtso | 106 + .../rockchip-rk3318-box-wlan-ap6334.dtso | 117 + .../overlay/rockchip-rk3318-box-wlan-ext.dtso | 33 + .../overlay/rockchip-rk3328-i2c0.dtso | 13 + .../overlay/rockchip-rk3328-i2s1-pcm5102.dtso | 104 + .../overlay/rockchip-rk3328-opp-1.4ghz.dtso | 15 + .../overlay/rockchip-rk3328-opp-1.5ghz.dtso | 15 + .../overlay/rockchip-rk3328-spi-spidev.dtso | 33 + .../overlay/rockchip-rk3328-uart1.dtso | 17 + .../overlay/rockchip-rk3399-dwc3-0-host.dtso | 13 + .../overlay/rockchip-rk3399-i2c7.dtso | 11 + .../overlay/rockchip-rk3399-i2c8.dtso | 11 + .../overlay/rockchip-rk3399-opp-2ghz.dtso | 24 + .../overlay/rockchip-rk3399-pcie-gen2.dtso | 12 + .../rockchip-rk3399-spi-jedec-nor.dtso | 72 + .../overlay/rockchip-rk3399-spi-spidev.dtso | 72 + .../overlay/rockchip-rk3399-uart4.dtso | 20 + .../overlay/rockchip-rk3399-w1-gpio.dtso | 20 + .../overlay/rockchip-rk3566-sata2.dtso | 20 + .../overlay/rockchip-rk3568-hk-i2c0.dtso | 14 + .../overlay/rockchip-rk3568-hk-i2c1.dtso | 12 + .../overlay/rockchip-rk3568-hk-pwm1.dtso | 13 + .../overlay/rockchip-rk3568-hk-pwm2.dtso | 13 + .../overlay/rockchip-rk3568-hk-pwm9.dtso | 13 + .../rockchip-rk3568-hk-spi-spidev.dtso | 22 + .../rockchip-rk3568-hk-uart0-rts_cts.dtso | 14 + .../overlay/rockchip-rk3568-hk-uart0.dtso | 13 + .../overlay/rockchip-rk3568-hk-uart1.dtso | 15 + .../rockchip-rk3568-nanopi-r5c-leds.dtso | 11 + .../rockchip-rk3568-nanopi-r5s-leds.dtso | 15 + .../rockchip-rockpi4cplus-usb-host.dtso | 16 + .../overlay/rockchip-rockpro64-lcd.dtso | 58 + ...28-iomux-width-flag-for-GPIO2-B-pins.patch | 13 + .../regulator-add-fan53200-driver.patch | 597 + .../rk3308-0001-pinctrl-slew-mux.patch | 257 + .../rk3308-0002-iodomains.patch | 159 + ...3308-0003-pinctrl-io-voltage-domains.patch | 202 + .../rk3328-add-dmc-driver.patch | 1901 + .../rockchip64-6.10/rk3328-add-rga-node.patch | 37 + .../rk3328-dtsi-mali-opp-table.patch | 48 + .../rk3328-dtsi-mmc-reset-properties.patch | 43 + .../rk3328-dtsi-sdmmc-ext-node.patch | 37 + .../rockchip64-6.10/rk3328-dtsi-spdif.patch | 128 + .../rk3328-dtsi-usb3-reset-properties.patch | 25 + .../rk3328-gpu-cooling-target.patch | 37 + .../rk3328-roc-cc-add-missing-nodes.patch | 79 + .../rk3399-add-sclk-i2sout-src-clock.patch | 98 + .../rk3399-dmc-polling-rate.patch | 35 + ...k3399-enable-dwc3-xhci-usb-trb-quirk.patch | 119 + .../rockchip64-6.10/rk3399-fix-pci-phy.patch | 47 + .../rockchip64-6.10/rk3399-fix-usb-phy.patch | 26 + ...plement-rockchip-PCIe-bus-scan-delay.patch | 181 + .../rk3399-sd-drive-level-8ma.patch | 159 + .../rk3399-sd-pwr-pinctrl.patch | 28 + .../rk3399-unlock-temperature.patch | 127 + .../rk35xx-montjoie-crypto-v2-rk35xx.patch | 2327 + .../wifi-4003-add-bcm43342-chip.patch | 45 + .../wifi-4003-ssv-6051-driver.patch | 49482 ++++++++++++++++ 184 files changed, 101748 insertions(+), 36 deletions(-) create mode 100644 patch/kernel/archive/rockchip64-6.10/0000.patching_config.yaml create mode 100644 patch/kernel/archive/rockchip64-6.10/add-board-fine3399-dts.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/add-board-helios64.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/add-board-xiaobao-nas-dts.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-firefly-rk3399-dts.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-helios64-dts-fix-stability-issues.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-helios64-remove-pcie-ep-gpios.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-nanopc-t4-add-typec-dp.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-nanopi-m4v2-dts-add-sound-card.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-nanopi-r2c-plus.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-nanopi-r2s.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-nanopi-r4s-pwmfan.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-orangepi-r1-plus.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-orangepi-rk3399-pcie.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-pbp-add-dp-alt-mode.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-radxa-e25-sdmmc0-fix.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-radxa-e25-usb3-and-emmc-fix.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-cc-dts-enable-dmc.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-cc-dts-ram-profile.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-pc-dts-ram-profile.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-pc.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rock3a-emmc-sfc.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rock3a-usb3.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rock64-mail-supply.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpi3-enable-dmc.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpi4-0003-arm64-dts-pcie.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0001-arm64-dts.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0005-arm64-dts-rk3308-Add-gmac-node-at-dtsi-level.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0007-arm64-dts-rockchip-add-cpu-s-thermal-config-for-rk33.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0008-thermal-rockchip-add-tsadc-support-for-rk3308.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0010-arm64-dts-rockchip-add-i2s_8ch-for-rk3308.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0012-arm64-dts-rk3308-Add-rk-timer-rtc.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0018-ASoC-codecs-Add-RK3308-internal-codec-driver.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0019-Sync-rk3308_codec-to-BSP-tree.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0020-arm64-dts-rockchip-Add-acodec-node-for-rk3308.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0022-ASoC-rk3308_codec-replace-codec-to-component.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0027-arm64-dts-rk3308-add-otp-cpuinfo.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0029-arm64-dts-rk3308-add-reserved-memory-ramoops.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpro64-0001-Add-pcie-bus-scan-delay.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpro64-change-rx_delay-for-gmac.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpro64-fix-emmc.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpro64-fix-spi1-flash-speed.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpro64-work-led-heartbeat.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rocks0-0001-deviceTree.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/drv-spi-spidev-remove-warnings.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3308-sakurapi-rk3308b.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3318-box.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-neo3-rev02.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev00.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev06.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev20.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3328-orangepi-r1-plus-lts.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3328-z28pro.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399-fine3399.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399-nanopi-m4v2.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399-nanopi-r4se.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399-orangepi-4-lts.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399-orangepi-4.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399-rock-pi-4.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399-rock-pi-4c.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399-tinker-2.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399-xiaobao-nas.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399pro-tinker-edge-r.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3566-firefly-roc-pc.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3566-jp-tvbox.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3566-orangepi-3b-sata.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3566-orangepi-3b.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3566-panther-x2.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3.dtsi create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3e.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3w.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3566-rock-3c.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3568-hinlink-h66k.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3568-hinlink-h68k.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3568-odroid-m1.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/general-add-miniDP-dt-doc.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-add-miniDP-virtual-extcon.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-add-overlay-compilation-support.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-add-overlay-configfs.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-add-panel-simple-dsi.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-add-pll-hdmi-timings.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-add-xtx-spi-nor-chips.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-cryptov1-trng.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-disable-mtu-validation.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-fix-es8316-kernel-panic.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-fix-inno-usb2-phy-init.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-fix-mmc-signal-voltage-before-reboot.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-hdmi-clock-fixes.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-increasing_DMA_block_memory_allocation_to_2048.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-legacy-rockchip-hwrng.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-legacy-rockchip-hwrng_5.10.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-possibility-of-disabling-rk808-rtc.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-rk3328-dtsi-trb-ent-quirk.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-rk808-configurable-switch-voltage-steps.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-rockchip-overlays.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-rt5651-add-mclk.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-v4l2-iep-driver.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-v4l2-rkvdec-00-fixes.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-v4l2-rkvdec-01-vp9.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-v4l2-rkvdec-02-hevc.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-workaround-broadcom-bt-serdev.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/kernel-6.8-tools-cgroup-makefile.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/media-0001-dma-mapping-let-dma_alloc_noncontiguous-allow-DMA_AT.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/media-0002-Enable-non-coherent-dst-bufs-for-Hantro-V4L2-driver.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/media-0003-Enable-non-coherent-dst-bufs-for-Rkvdec-V4L2-driver.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/net-usb-r8152-add-LED-configuration-from-OF.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/Makefile create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/README.rockchip-overlays create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rk3308-b@1.3ghz.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rk3308-bs.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rk3308-bs@1.3ghz.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rk3308-emmc.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rk3308-s0-ext-antenna.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rk3308-sdio@10mhz.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rk3308-sdio@4mhz.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-fixup.scr-cmd create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-cpu-hs.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-emmc-ddr.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-emmc-hs200.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-led-conf1.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-led-conf2.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-led-conf3.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-led-conf4.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-wlan-ap6330.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-wlan-ap6334.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-wlan-ext.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3328-i2c0.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3328-i2s1-pcm5102.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3328-opp-1.4ghz.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3328-opp-1.5ghz.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3328-spi-spidev.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3328-uart1.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3399-dwc3-0-host.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3399-i2c7.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3399-i2c8.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3399-opp-2ghz.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3399-pcie-gen2.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3399-spi-jedec-nor.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3399-spi-spidev.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3399-uart4.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3399-w1-gpio.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3566-sata2.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-hk-i2c0.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-hk-i2c1.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-hk-pwm1.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-hk-pwm2.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-hk-pwm9.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-hk-spi-spidev.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-hk-uart0-rts_cts.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-hk-uart0.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-hk-uart1.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-nanopi-r5c-leds.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-nanopi-r5s-leds.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rockpi4cplus-usb-host.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rockpro64-lcd.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/pinctrl-rockchip-correct-RK3328-iomux-width-flag-for-GPIO2-B-pins.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/regulator-add-fan53200-driver.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3308-0001-pinctrl-slew-mux.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3308-0002-iodomains.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3308-0003-pinctrl-io-voltage-domains.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3328-add-dmc-driver.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3328-add-rga-node.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3328-dtsi-mali-opp-table.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3328-dtsi-mmc-reset-properties.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3328-dtsi-sdmmc-ext-node.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3328-dtsi-spdif.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3328-dtsi-usb3-reset-properties.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3328-gpu-cooling-target.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3328-roc-cc-add-missing-nodes.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3399-add-sclk-i2sout-src-clock.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3399-dmc-polling-rate.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3399-enable-dwc3-xhci-usb-trb-quirk.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3399-fix-pci-phy.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3399-fix-usb-phy.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3399-rp64-pcie-Reimplement-rockchip-PCIe-bus-scan-delay.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3399-sd-drive-level-8ma.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3399-sd-pwr-pinctrl.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3399-unlock-temperature.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk35xx-montjoie-crypto-v2-rk35xx.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/wifi-4003-add-bcm43342-chip.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/wifi-4003-ssv-6051-driver.patch diff --git a/config/kernel/linux-rockchip64-edge.config b/config/kernel/linux-rockchip64-edge.config index 9583a87f678c..d37b1f7be426 100644 --- a/config/kernel/linux-rockchip64-edge.config +++ b/config/kernel/linux-rockchip64-edge.config @@ -1,24 +1,22 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 6.9.3 Kernel Configuration +# Linux/arm64 6.10.0 Kernel Configuration # -CONFIG_CC_VERSION_TEXT="aarch64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" +CONFIG_CC_VERSION_TEXT="aarch64-linux-gnu-gcc (Ubuntu 11.2.0-17ubuntu1) 11.2.0" CONFIG_CC_IS_GCC=y -CONFIG_GCC_VERSION=110400 +CONFIG_GCC_VERSION=110200 CONFIG_CLANG_VERSION=0 CONFIG_AS_IS_GNU=y CONFIG_AS_VERSION=23800 CONFIG_LD_IS_BFD=y CONFIG_LD_VERSION=23800 CONFIG_LLD_VERSION=0 -CONFIG_CC_CAN_LINK=y -CONFIG_CC_CAN_LINK_STATIC=y CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_CC_HAS_ASM_INLINE=y CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y -CONFIG_PAHOLE_VERSION=125 +CONFIG_PAHOLE_VERSION=122 CONFIG_IRQ_WORK=y CONFIG_BUILDTIME_TABLE_SORT=y CONFIG_THREAD_INFO_IN_TASK=y @@ -119,7 +117,7 @@ CONFIG_PREEMPTION=y CONFIG_TICK_CPU_ACCOUNTING=y # CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set # CONFIG_IRQ_TIME_ACCOUNTING is not set -CONFIG_SCHED_THERMAL_PRESSURE=y +CONFIG_SCHED_HW_PRESSURE=y CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT_V3=y CONFIG_TASKSTATS=y @@ -140,6 +138,7 @@ CONFIG_PREEMPT_RCU=y # CONFIG_RCU_EXPERT is not set CONFIG_TREE_SRCU=y CONFIG_TASKS_RCU_GENERIC=y +CONFIG_NEED_TASKS_RCU=y CONFIG_TASKS_RCU=y CONFIG_TASKS_TRACE_RCU=y CONFIG_RCU_STALL_COMMON=y @@ -171,6 +170,7 @@ CONFIG_CC_NO_STRINGOP_OVERFLOW=y CONFIG_ARCH_SUPPORTS_INT128=y CONFIG_NUMA_BALANCING=y CONFIG_NUMA_BALANCING_DEFAULT_ENABLED=y +CONFIG_SLAB_OBJ_EXT=y CONFIG_CGROUPS=y CONFIG_PAGE_COUNTER=y # CONFIG_CGROUP_FAVOR_DYNMODS is not set @@ -236,7 +236,7 @@ CONFIG_POSIX_TIMERS=y CONFIG_PRINTK=y CONFIG_BUG=y CONFIG_ELF_CORE=y -CONFIG_BASE_FULL=y +# CONFIG_BASE_SMALL is not set CONFIG_FUTEX=y CONFIG_FUTEX_PI=y CONFIG_EPOLL=y @@ -314,6 +314,7 @@ CONFIG_BUILTIN_RETURN_ADDRESS_STRIPS_PAC=y # Platform selection # # CONFIG_ARCH_ACTIONS is not set +# CONFIG_ARCH_AIROHA is not set # CONFIG_ARCH_SUNXI is not set # CONFIG_ARCH_ALPINE is not set # CONFIG_ARCH_APPLE is not set @@ -395,6 +396,9 @@ CONFIG_ARM64_ERRATUM_2457168=y CONFIG_ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD=y CONFIG_ARM64_ERRATUM_2966298=y CONFIG_ARM64_ERRATUM_3117295=y +CONFIG_ARM64_WORKAROUND_SPECULATIVE_SSBS=y +CONFIG_ARM64_ERRATUM_3194386=y +# CONFIG_ARM64_ERRATUM_3312417 is not set CONFIG_CAVIUM_ERRATUM_22375=y CONFIG_CAVIUM_ERRATUM_23144=y CONFIG_CAVIUM_ERRATUM_23154=y @@ -723,6 +727,7 @@ CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y CONFIG_ARCH_WANT_PMD_MKWRITE=y CONFIG_HAVE_MOD_ARCH_SPECIFIC=y CONFIG_MODULES_USE_ELF_RELA=y +CONFIG_ARCH_WANTS_EXECMEM_LATE=y CONFIG_HAVE_SOFTIRQ_ON_OWN_STACK=y CONFIG_SOFTIRQ_ON_OWN_STACK=y CONFIG_ARCH_HAS_ELF_RANDOMIZE=y @@ -761,6 +766,7 @@ CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y CONFIG_ARCH_SUPPORTS_PAGE_TABLE_CHECK=y CONFIG_ARCH_HAVE_TRACE_MMIO_ACCESS=y CONFIG_ARCH_HAS_HW_PTE_YOUNG=y +CONFIG_ARCH_HAS_KERNEL_FPU_SUPPORT=y # # GCOV-based kernel profiling @@ -775,7 +781,6 @@ CONFIG_FUNCTION_ALIGNMENT=4 # end of General architecture-dependent options CONFIG_RT_MUTEXES=y -CONFIG_BASE_SMALL=0 CONFIG_MODULES=y # CONFIG_MODULE_DEBUG is not set # CONFIG_MODULE_FORCE_LOAD is not set @@ -805,7 +810,6 @@ CONFIG_BLK_DEV_INTEGRITY_T10=y CONFIG_BLK_DEV_WRITE_MOUNTED=y CONFIG_BLK_DEV_ZONED=y CONFIG_BLK_DEV_THROTTLING=y -# CONFIG_BLK_DEV_THROTTLING_LOW is not set CONFIG_BLK_WBT=y CONFIG_BLK_WBT_MQ=y # CONFIG_BLK_CGROUP_IOLATENCY is not set @@ -813,7 +817,6 @@ CONFIG_BLK_WBT_MQ=y # CONFIG_BLK_CGROUP_IOCOST is not set # CONFIG_BLK_CGROUP_IOPRIO is not set CONFIG_BLK_DEBUG_FS=y -CONFIG_BLK_DEBUG_FS_ZONED=y # CONFIG_BLK_SED_OPAL is not set # CONFIG_BLK_INLINE_ENCRYPTION is not set @@ -917,7 +920,7 @@ CONFIG_SPARSEMEM=y CONFIG_SPARSEMEM_EXTREME=y CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y CONFIG_SPARSEMEM_VMEMMAP=y -CONFIG_HAVE_FAST_GUP=y +CONFIG_HAVE_GUP_FAST=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_MEMORY_ISOLATION=y CONFIG_EXCLUSIVE_SYSTEM_RAM=y @@ -950,6 +953,7 @@ CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y # CONFIG_TRANSPARENT_HUGEPAGE_NEVER is not set CONFIG_THP_SWAP=y # CONFIG_READ_ONLY_THP_FOR_FS is not set +CONFIG_PGTABLE_HAS_HUGE_LEAVES=y CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y CONFIG_USE_PERCPU_NUMA_NODE_ID=y @@ -987,6 +991,7 @@ CONFIG_LRU_GEN_WALKS_MMU=y CONFIG_ARCH_SUPPORTS_PER_VMA_LOCK=y CONFIG_PER_VMA_LOCK=y CONFIG_LOCK_MM_AND_FIND_VMA=y +CONFIG_EXECMEM=y # # Data Access Monitoring @@ -1001,6 +1006,7 @@ CONFIG_NET_INGRESS=y CONFIG_NET_EGRESS=y CONFIG_NET_XGRESS=y CONFIG_NET_REDIRECT=y +CONFIG_SKB_DECRYPTED=y CONFIG_SKB_EXTENSIONS=y # @@ -1814,6 +1820,7 @@ CONFIG_BT_MTKUART=m CONFIG_BT_HCIRSI=m CONFIG_BT_VIRTIO=m # CONFIG_BT_NXPUART is not set +# CONFIG_BT_INTEL_PCIE is not set # end of Bluetooth device drivers CONFIG_AF_RXRPC=m @@ -1923,6 +1930,7 @@ CONFIG_LWTUNNEL_BPF=y CONFIG_DST_CACHE=y CONFIG_GRO_CELLS=y CONFIG_SOCK_VALIDATE_XMIT=y +CONFIG_NET_IEEE8021Q_HELPERS=y CONFIG_NET_SELFTESTS=y CONFIG_NET_SOCK_MSG=y CONFIG_NET_DEVLINK=y @@ -2734,6 +2742,7 @@ CONFIG_VXLAN=m CONFIG_GENEVE=m # CONFIG_BAREUDP is not set CONFIG_GTP=m +# CONFIG_PFCP is not set CONFIG_AMT=m CONFIG_MACSEC=m CONFIG_NETCONSOLE=m @@ -3098,6 +3107,7 @@ CONFIG_SFP=m # # MII PHY device drivers # +# CONFIG_AIR_EN8811H_PHY is not set CONFIG_AMD_PHY=m CONFIG_ADIN_PHY=m CONFIG_ADIN1100_PHY=m @@ -3174,7 +3184,6 @@ CONFIG_CAN_C_CAN=m CONFIG_CAN_C_CAN_PLATFORM=m CONFIG_CAN_C_CAN_PCI=m CONFIG_CAN_CC770=m -CONFIG_CAN_CC770_ISA=m CONFIG_CAN_CC770_PLATFORM=m CONFIG_CAN_CTUCANFD=m CONFIG_CAN_CTUCANFD_PCI=m @@ -3193,7 +3202,6 @@ CONFIG_CAN_KVASER_PCI=m CONFIG_CAN_PEAK_PCI=m CONFIG_CAN_PEAK_PCIEC=y CONFIG_CAN_PLX_PCI=m -CONFIG_CAN_SJA1000_ISA=m CONFIG_CAN_SJA1000_PLATFORM=m CONFIG_CAN_SOFTING=m @@ -3531,6 +3539,7 @@ CONFIG_RTLWIFI_PCI=m CONFIG_RTLWIFI_USB=m # CONFIG_RTLWIFI_DEBUG is not set CONFIG_RTL8192C_COMMON=m +CONFIG_RTL8192D_COMMON=m CONFIG_RTL8723_COMMON=m CONFIG_RTLBTCOEXIST=m CONFIG_RTL8XXXU=m @@ -3542,6 +3551,7 @@ CONFIG_RTW88_SDIO=m CONFIG_RTW88_USB=m CONFIG_RTW88_8822B=m CONFIG_RTW88_8822C=m +CONFIG_RTW88_8723X=m CONFIG_RTW88_8723D=m CONFIG_RTW88_8821C=m # CONFIG_RTW88_8822BE is not set @@ -3552,6 +3562,7 @@ CONFIG_RTW88_8822CS=m CONFIG_RTW88_8822CU=m CONFIG_RTW88_8723DE=m # CONFIG_RTW88_8723DS is not set +# CONFIG_RTW88_8723CS is not set CONFIG_RTW88_8723DU=m CONFIG_RTW88_8821CE=m CONFIG_RTW88_8821CS=m @@ -3996,10 +4007,9 @@ CONFIG_SERIAL_JSM=m CONFIG_SERIAL_SIFIVE=m CONFIG_SERIAL_SCCNXP=y CONFIG_SERIAL_SCCNXP_CONSOLE=y -CONFIG_SERIAL_SC16IS7XX_CORE=m CONFIG_SERIAL_SC16IS7XX=m -CONFIG_SERIAL_SC16IS7XX_I2C=y -CONFIG_SERIAL_SC16IS7XX_SPI=y +CONFIG_SERIAL_SC16IS7XX_I2C=m +CONFIG_SERIAL_SC16IS7XX_SPI=m CONFIG_SERIAL_ALTERA_JTAGUART=m CONFIG_SERIAL_ALTERA_UART=m CONFIG_SERIAL_ALTERA_UART_MAXPORTS=4 @@ -4187,7 +4197,6 @@ CONFIG_SPI_FSL_SPI=m CONFIG_SPI_OC_TINY=m # CONFIG_SPI_PCI1XXXX is not set CONFIG_SPI_PL022=y -# CONFIG_SPI_PXA2XX is not set CONFIG_SPI_ROCKCHIP=y CONFIG_SPI_ROCKCHIP_SFC=m # CONFIG_SPI_SC18IS602 is not set @@ -4263,6 +4272,7 @@ CONFIG_PINCTRL_MAX77620=y # CONFIG_PINCTRL_OCELOT is not set CONFIG_PINCTRL_RK805=y CONFIG_PINCTRL_ROCKCHIP=y +# CONFIG_PINCTRL_SCMI is not set CONFIG_PINCTRL_SINGLE=y CONFIG_PINCTRL_STMFX=m CONFIG_PINCTRL_SX150X=y @@ -4615,6 +4625,7 @@ CONFIG_SENSORS_PMBUS=m # CONFIG_SENSORS_ACBEL_FSG032 is not set # CONFIG_SENSORS_ADM1266 is not set CONFIG_SENSORS_ADM1275=m +# CONFIG_SENSORS_ADP1050 is not set CONFIG_SENSORS_BEL_PFE=m CONFIG_SENSORS_BPA_RS600=m CONFIG_SENSORS_DELTA_AHE50DC_FAN=m @@ -4662,6 +4673,7 @@ CONFIG_SENSORS_TPS53679=m # CONFIG_SENSORS_TPS546D24 is not set CONFIG_SENSORS_UCD9000=m CONFIG_SENSORS_UCD9200=m +# CONFIG_SENSORS_XDP710 is not set CONFIG_SENSORS_XDPE152=m CONFIG_SENSORS_XDPE122=m # CONFIG_SENSORS_XDPE122_REGULATOR is not set @@ -5980,12 +5992,12 @@ CONFIG_DRM_FBDEV_EMULATION=y CONFIG_DRM_FBDEV_OVERALLOC=100 # CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM is not set # CONFIG_DRM_LOAD_EDID_FIRMWARE is not set -CONFIG_DRM_DP_AUX_BUS=m CONFIG_DRM_DISPLAY_HELPER=y +CONFIG_DRM_DISPLAY_DP_AUX_BUS=m +# CONFIG_DRM_DISPLAY_DP_AUX_CEC is not set +# CONFIG_DRM_DISPLAY_DP_AUX_CHARDEV is not set CONFIG_DRM_DISPLAY_DP_HELPER=y CONFIG_DRM_DISPLAY_HDMI_HELPER=y -# CONFIG_DRM_DP_AUX_CHARDEV is not set -CONFIG_DRM_DP_CEC=y CONFIG_DRM_TTM=m CONFIG_DRM_VRAM_HELPER=m CONFIG_DRM_TTM_HELPER=m @@ -6072,6 +6084,7 @@ CONFIG_DRM_PANEL_KINGDISPLAY_KD097D04=m CONFIG_DRM_PANEL_LEADTEK_LTK500HD1829=m CONFIG_DRM_PANEL_LG_LB035Q02=m # CONFIG_DRM_PANEL_LG_LG4573 is not set +# CONFIG_DRM_PANEL_LG_SW43408 is not set # CONFIG_DRM_PANEL_MAGNACHIP_D53E6EA8966 is not set # CONFIG_DRM_PANEL_MANTIX_MLAF057WE51 is not set CONFIG_DRM_PANEL_NEC_NL8048HL11=m @@ -6093,11 +6106,13 @@ CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=m CONFIG_DRM_PANEL_RAYDIUM_RM67191=m CONFIG_DRM_PANEL_RAYDIUM_RM68200=m # CONFIG_DRM_PANEL_RAYDIUM_RM692E5 is not set +# CONFIG_DRM_PANEL_RAYDIUM_RM69380 is not set CONFIG_DRM_PANEL_RONBO_RB070D30=m CONFIG_DRM_PANEL_SAMSUNG_S6E88A0_AMS452EF01=m CONFIG_DRM_PANEL_SAMSUNG_ATNA33XC20=m CONFIG_DRM_PANEL_SAMSUNG_DB7430=m # CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set +# CONFIG_DRM_PANEL_SAMSUNG_S6E3FA7 is not set CONFIG_DRM_PANEL_SAMSUNG_S6D16D0=m CONFIG_DRM_PANEL_SAMSUNG_S6D27A1=m # CONFIG_DRM_PANEL_SAMSUNG_S6D7AA0 is not set @@ -6214,10 +6229,12 @@ CONFIG_DRM_XEN=y CONFIG_DRM_XEN_FRONTEND=m CONFIG_DRM_LIMA=m CONFIG_DRM_PANFROST=m +# CONFIG_DRM_PANTHOR is not set CONFIG_DRM_TIDSS=m CONFIG_DRM_GUD=m # CONFIG_DRM_SSD130X is not set # CONFIG_DRM_POWERVR is not set +# CONFIG_DRM_WERROR is not set CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y # @@ -6492,6 +6509,7 @@ CONFIG_SND_SOC=m CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y CONFIG_SND_SOC_COMPRESS=y # CONFIG_SND_SOC_TOPOLOGY_BUILD is not set +# CONFIG_SND_SOC_CARD_KUNIT_TEST is not set CONFIG_SND_SOC_UTILS_KUNIT_TEST=m CONFIG_SND_SOC_ADI=m CONFIG_SND_SOC_ADI_AXI_I2S=m @@ -6665,6 +6683,7 @@ CONFIG_SND_SOC_PCM5102A=m CONFIG_SND_SOC_PCM512x=m CONFIG_SND_SOC_PCM512x_I2C=m CONFIG_SND_SOC_PCM512x_SPI=m +# CONFIG_SND_SOC_PCM6240 is not set # CONFIG_SND_SOC_PEB2466 is not set CONFIG_SND_SOC_RK3308=m CONFIG_SND_SOC_RK3328=m @@ -6913,6 +6932,7 @@ CONFIG_HID_UDRAW_PS3=m CONFIG_HID_U2FZERO=m CONFIG_HID_WACOM=m CONFIG_HID_WIIMOTE=m +# CONFIG_HID_WINWING is not set CONFIG_HID_XINMO=m CONFIG_HID_ZEROPLUS=m CONFIG_ZEROPLUS_FF=y @@ -7176,7 +7196,7 @@ CONFIG_USB_HSIC_USB3503=y # CONFIG_USB_HSIC_USB4604 is not set CONFIG_USB_LINK_LAYER_TEST=m CONFIG_USB_CHAOSKEY=m -# CONFIG_USB_ONBOARD_HUB is not set +# CONFIG_USB_ONBOARD_DEV is not set CONFIG_USB_ATM=m CONFIG_USB_SPEEDTOUCH=m CONFIG_USB_CXACRU=m @@ -7475,7 +7495,6 @@ CONFIG_LEDS_TRIGGER_CAMERA=m CONFIG_LEDS_TRIGGER_PANIC=y CONFIG_LEDS_TRIGGER_NETDEV=m CONFIG_LEDS_TRIGGER_PATTERN=m -CONFIG_LEDS_TRIGGER_AUDIO=m CONFIG_LEDS_TRIGGER_TTY=m # @@ -7545,6 +7564,7 @@ CONFIG_RTC_DRV_RC5T619=m CONFIG_RTC_DRV_S35390A=m CONFIG_RTC_DRV_FM3130=m CONFIG_RTC_DRV_RX8010=m +# CONFIG_RTC_DRV_RX8111 is not set CONFIG_RTC_DRV_RX8581=m CONFIG_RTC_DRV_RX8025=m CONFIG_RTC_DRV_EM3027=m @@ -7677,7 +7697,6 @@ CONFIG_UIO=m # CONFIG_UIO_SERCOS3 is not set # CONFIG_UIO_PCI_GENERIC is not set # CONFIG_UIO_NETX is not set -# CONFIG_UIO_PRUSS is not set # CONFIG_UIO_MF624 is not set CONFIG_VFIO=m CONFIG_VFIO_DEVICE_CDEV=y @@ -7704,6 +7723,7 @@ CONFIG_VFIO_PCI=m CONFIG_IRQ_BYPASS_MANAGER=y CONFIG_VIRT_DRIVERS=y +CONFIG_VMGENID=y CONFIG_NITRO_ENCLAVES=m CONFIG_VIRTIO_ANCHOR=y CONFIG_VIRTIO=y @@ -7718,6 +7738,7 @@ CONFIG_VIRTIO_INPUT=m CONFIG_VIRTIO_MMIO=y # CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set CONFIG_VIRTIO_DMA_SHARED_BUFFER=m +# CONFIG_VIRTIO_DEBUG is not set CONFIG_VDPA=m CONFIG_VDPA_SIM=m CONFIG_VDPA_SIM_NET=m @@ -7773,7 +7794,6 @@ CONFIG_XEN_FRONT_PGDIR_SHBUF=m # CONFIG_GREYBUS is not set # CONFIG_COMEDI is not set CONFIG_STAGING=y -# CONFIG_PRISM2_USB is not set CONFIG_RTLLIB=m CONFIG_RTLLIB_CRYPTO_CCMP=m CONFIG_RTLLIB_CRYPTO_TKIP=m @@ -7867,7 +7887,6 @@ CONFIG_FB_TFT_UC1701=m CONFIG_FB_TFT_UPD161704=m # CONFIG_MOST_COMPONENTS is not set # CONFIG_KS7010 is not set -# CONFIG_PI433 is not set # CONFIG_XIL_AXIS_FIFO is not set CONFIG_FIELDBUS_DEV=m CONFIG_HMS_ANYBUSS_BUS=m @@ -7894,6 +7913,8 @@ CONFIG_CROS_USBPD_NOTIFY=y # CONFIG_CROS_KUNIT_EC_PROTO_TEST is not set # CONFIG_MELLANOX_PLATFORM is not set CONFIG_SURFACE_PLATFORMS=y +CONFIG_ARM64_PLATFORM_DEVICES=y +# CONFIG_EC_ACER_ASPIRE1 is not set CONFIG_HAVE_CLK=y CONFIG_HAVE_CLK_PREPARE=y CONFIG_COMMON_CLK=y @@ -7964,6 +7985,7 @@ CONFIG_ARM64_ERRATUM_858921=y CONFIG_MAILBOX=y CONFIG_ARM_MHU=y CONFIG_ARM_MHU_V2=m +CONFIG_ARM_MHU_V3=m CONFIG_PLATFORM_MHU=y # CONFIG_PL320_MBOX is not set CONFIG_ROCKCHIP_MBOX=y @@ -8226,6 +8248,7 @@ CONFIG_AD7091R=m CONFIG_AD7091R5=m # CONFIG_AD7091R8 is not set CONFIG_AD7124=m +# CONFIG_AD7173 is not set # CONFIG_AD7192 is not set CONFIG_AD7266=m # CONFIG_AD7280 is not set @@ -8243,6 +8266,7 @@ CONFIG_AD7791=m CONFIG_AD7793=m CONFIG_AD7887=m CONFIG_AD7923=m +# CONFIG_AD7944 is not set CONFIG_AD7949=m CONFIG_AD799X=m # CONFIG_AD9467 is not set @@ -8395,6 +8419,8 @@ CONFIG_AD3552R=m # CONFIG_AD5593R is not set # CONFIG_AD5504 is not set # CONFIG_AD5624R_SPI is not set +# CONFIG_AD9739A is not set +# CONFIG_ADI_AXI_DAC is not set # CONFIG_LTC2688 is not set CONFIG_AD5686=m CONFIG_AD5686_SPI=m @@ -8559,6 +8585,7 @@ CONFIG_ADUX1020=m CONFIG_AL3010=m CONFIG_AL3320A=m CONFIG_APDS9300=m +# CONFIG_APDS9306 is not set CONFIG_APDS9960=m # CONFIG_AS73211 is not set CONFIG_BH1750=m @@ -8779,7 +8806,6 @@ CONFIG_MAX31865=m # CONFIG_NTB is not set CONFIG_PWM=y -CONFIG_PWM_SYSFS=y # CONFIG_PWM_DEBUG is not set CONFIG_PWM_ATMEL_TCB=m # CONFIG_PWM_CLK is not set @@ -8856,6 +8882,7 @@ CONFIG_PHY_ROCKCHIP_PCIE=y CONFIG_PHY_ROCKCHIP_SNPS_PCIE3=y CONFIG_PHY_ROCKCHIP_TYPEC=y CONFIG_PHY_ROCKCHIP_USB=y +CONFIG_PHY_ROCKCHIP_USBDP=m CONFIG_PHY_SAMSUNG_USB2=y # CONFIG_PHY_TUSB1210 is not set # end of PHY Subsystem @@ -9644,7 +9671,6 @@ CONFIG_CRYPTO_USER_API_RNG=m # CONFIG_CRYPTO_USER_API_RNG_CAVP is not set CONFIG_CRYPTO_USER_API_AEAD=m CONFIG_CRYPTO_USER_API_ENABLE_OBSOLETE=y -CONFIG_CRYPTO_STATS=y # end of Userspace interface CONFIG_CRYPTO_HASH_INFO=y @@ -9851,13 +9877,13 @@ CONFIG_NEED_DMA_MAP_STATE=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y CONFIG_DMA_DECLARE_COHERENT=y CONFIG_ARCH_HAS_SETUP_DMA_OPS=y -CONFIG_ARCH_HAS_TEARDOWN_DMA_OPS=y CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE=y CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU=y CONFIG_ARCH_HAS_DMA_PREP_COHERENT=y CONFIG_SWIOTLB=y # CONFIG_SWIOTLB_DYNAMIC is not set CONFIG_DMA_BOUNCE_UNALIGNED_KMALLOC=y +CONFIG_DMA_NEED_SYNC=y # CONFIG_DMA_RESTRICTED_POOL is not set CONFIG_DMA_NONCOHERENT_MMAP=y CONFIG_DMA_COHERENT_POOL=y @@ -9877,7 +9903,6 @@ CONFIG_CMA_ALIGNMENT=8 # CONFIG_DMA_API_DEBUG is not set # CONFIG_DMA_MAP_BENCHMARK is not set CONFIG_SGL_ALLOC=y -# CONFIG_FORCE_NR_CPUS is not set CONFIG_CPU_RMAP=y CONFIG_DQL=y CONFIG_GLOB=y @@ -9888,7 +9913,7 @@ CONFIG_CLZ_TAB=y CONFIG_IRQ_POLL=y CONFIG_MPILIB=y CONFIG_SIGNATURE=y -CONFIG_DIMLIB=y +CONFIG_DIMLIB=m CONFIG_LIBFDT=y CONFIG_OID_REGISTRY=y CONFIG_UCS2_STRING=y @@ -10027,6 +10052,7 @@ CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y # CONFIG_DEBUG_VIRTUAL is not set CONFIG_DEBUG_MEMORY_INIT=y # CONFIG_DEBUG_PER_CPU_MAPS is not set +# CONFIG_MEM_ALLOC_PROFILING is not set CONFIG_HAVE_ARCH_KASAN=y CONFIG_HAVE_ARCH_KASAN_SW_TAGS=y CONFIG_HAVE_ARCH_KASAN_HW_TAGS=y @@ -10120,6 +10146,7 @@ CONFIG_RCU_TRACE=y # CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set # CONFIG_LATENCYTOP is not set # CONFIG_DEBUG_CGROUP_REF is not set +CONFIG_USER_STACKTRACE_SUPPORT=y CONFIG_NOP_TRACER=y CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y @@ -10253,8 +10280,6 @@ CONFIG_MEMCPY_KUNIT_TEST=m # CONFIG_OVERFLOW_KUNIT_TEST is not set # CONFIG_STACKINIT_KUNIT_TEST is not set # CONFIG_FORTIFY_KUNIT_TEST is not set -# CONFIG_STRCAT_KUNIT_TEST is not set -# CONFIG_STRSCPY_KUNIT_TEST is not set # CONFIG_SIPHASH_KUNIT_TEST is not set # CONFIG_TEST_UDELAY is not set # CONFIG_TEST_STATIC_KEYS is not set @@ -10263,6 +10288,7 @@ CONFIG_MEMCPY_KUNIT_TEST=m CONFIG_TEST_MEMCAT_P=m # CONFIG_TEST_MEMINIT is not set # CONFIG_TEST_FREE_PAGES is not set +# CONFIG_TEST_FPU is not set # CONFIG_TEST_OBJPOOL is not set CONFIG_ARCH_USE_MEMTEST=y CONFIG_MEMTEST=y diff --git a/config/sources/families/include/rockchip64_common.inc b/config/sources/families/include/rockchip64_common.inc index df4cf6c88077..4c2143c6984b 100644 --- a/config/sources/families/include/rockchip64_common.inc +++ b/config/sources/families/include/rockchip64_common.inc @@ -32,7 +32,7 @@ case $BRANCH in ;; edge) - declare -g KERNEL_MAJOR_MINOR="6.9" + declare -g KERNEL_MAJOR_MINOR="6.10" declare -g LINUXFAMILY=rockchip64 declare -g LINUXCONFIG='linux-rockchip64-'$BRANCH ;; diff --git a/config/sources/mainline-kernel.conf.sh b/config/sources/mainline-kernel.conf.sh index 09e911c2a30d..09ecbd051649 100644 --- a/config/sources/mainline-kernel.conf.sh +++ b/config/sources/mainline-kernel.conf.sh @@ -7,8 +7,8 @@ # Shared versioning logic for Armbian mainline kernels. function mainline_kernel_decide_version__upstream_release_candidate_number() { [[ -n "${KERNELBRANCH}" ]] && return 0 # if already set, don't touch it; that way other hooks can run in any order - if [[ "${KERNEL_MAJOR_MINOR}" == "6.10" ]]; then # @TODO: roll over to next MAJOR.MINOR and MAJOR.MINOR-rc1 when it is released - declare -g KERNELBRANCH="tag:v6.10-rc7" + if [[ "${KERNEL_MAJOR_MINOR}" == "6.11" ]]; then # @TODO: roll over to next MAJOR.MINOR and MAJOR.MINOR-rc1 when it is released + declare -g KERNELBRANCH="tag:v6.11-rc1" display_alert "mainline-kernel: upstream release candidate" "Using KERNELBRANCH='${KERNELBRANCH}' for KERNEL_MAJOR_MINOR='${KERNEL_MAJOR_MINOR}'" "info" fi } diff --git a/patch/kernel/archive/rockchip64-6.10/0000.patching_config.yaml b/patch/kernel/archive/rockchip64-6.10/0000.patching_config.yaml new file mode 100644 index 000000000000..61a898c1035a --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/0000.patching_config.yaml @@ -0,0 +1,37 @@ +config: # This is file 'patch/kernel/archive/rockchip64-6.8/0000.patching_config.yaml' + + # Just some info stuff; not used by the patching scripts + name: rockchip64-6.10 + kind: kernel + type: mainline # or: vendor + branch: linux-6.10.y + last-known-good-tag: v6.10 + maintainers: + - { github: rpardini, name: Ricardo Pardini, email: ricardo@pardini.net, armbian-forum: rpardini } + - { github: paolosabatino, name: Paolo Sabatino, email: paolo.sabatino@gmail.com, armbian-forum: jock } + + # .dts files in these directories will be copied as-is to the build tree; later ones overwrite earlier ones. + # This is meant to provide a way to "add a board DTS" without having to null-patch them in. + dts-directories: + - { source: "dt", target: "arch/arm64/boot/dts/rockchip" } + + # every file in these directories will be copied as-is to the build tree; later ones overwrite earlier ones + # This is meant as a way to have overlays, bare, in a directory, without having to null-patch them in. + # @TODO need a solution to auto-Makefile the overlays as well + overlay-directories: + - { source: "overlay", target: "arch/arm64/boot/dts/rockchip/overlay" } + + # the Makefile in each of these directories will be magically patched to include the dts files copied + # or patched-in; overlay subdir will be included "-y" if it exists. + # No more Makefile patching needed, yay! + auto-patch-dt-makefile: + - { directory: "arch/arm64/boot/dts/rockchip", config-var: "CONFIG_ARCH_ROCKCHIP" } + + # configuration for when applying patches to git / auto-rewriting patches (development cycle helpers) + patches-to-git: + do-not-commit-files: + - "MAINTAINERS" # constant churn, drop them. sorry. + - "Documentation/devicetree/bindings/arm/rockchip.yaml" # constant churn, conflicts on every bump, drop it. sorry. + do-not-commit-regexes: # Python-style regexes + - "^arch/([a-zA-Z0-9]+)/boot/dts/([a-zA-Z0-9]+)/Makefile$" # ignore DT Makefile patches, we've an auto-patcher now + diff --git a/patch/kernel/archive/rockchip64-6.10/add-board-fine3399-dts.patch b/patch/kernel/archive/rockchip64-6.10/add-board-fine3399-dts.patch new file mode 100644 index 000000000000..e4f6ac366906 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/add-board-fine3399-dts.patch @@ -0,0 +1,876 @@ +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-fine3399.dts b/arch/arm64/boot/dts/rockchip/rk3399-fine3399.dts +new file mode 100644 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-fine3399.dts +@@ -0,0 +1,871 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++ ++/dts-v1/; ++#include ++#include ++#include ++#include "rk3399.dtsi" ++#include "rk3399-opp.dtsi" ++ ++ ++/ { ++ model = "Rockchip Fine3399"; ++ compatible = "rockchip,fine3399", "rockchip,rk3399"; ++ ++ aliases { ++ mmc0 = &sdio0; ++ mmc1 = &sdmmc; ++ mmc2 = &sdhci; ++ }; ++ ++ chosen { ++ stdout-path = "serial2:1500000n8"; ++ }; ++ ++ clkin_gmac: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "clkin_gmac"; ++ #clock-cells = <0>; ++ }; ++ ++ dc_12v: dc-12v { ++ compatible = "regulator-fixed"; ++ regulator-name = "dc_12v"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <12000000>; ++ regulator-max-microvolt = <12000000>; ++ }; ++ ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ clocks = <&rk808 1>; ++ clock-names = "ext_clock"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_reg_on_h>; ++ reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>; // bsp ++ }; ++ ++ /* switched by pmic_sleep */ ++ vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc1v8_s3"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vin-supply = <&vcc_1v8>; ++ }; ++ ++ vcc3v3_sys: vcc3v3_pcie: vcc3v3_bl: vcc3v3-sys { // sch ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&dc_12v>; ++ }; ++ ++ vcc_sys: vcc-sys { // sch ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&dc_12v>; ++ }; ++ ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc_phy_h>; ++ regulator-name = "vcc_phy"; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ 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 = <1400000>; ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ leds: gpio-leds { ++ compatible = "gpio-leds"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&user_led2>; ++ ++ user_led2 { ++ label = "blue:work_led"; ++ gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>; // sch ++ linux,default-trigger = "heartbeat"; ++ }; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ autorepeat; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&power_key>; ++ ++ power { ++ debounce-interval = <100>; ++ gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; // bsp ++ label = "GPIO Key Power"; ++ linux,code = ; ++ wakeup-source; ++ }; ++ }; ++ ++ fan0: pwm-fan { ++ compatible = "pwm-fan"; ++ cooling-levels = <0 30 60 90 120 160>; ++ #cooling-cells = <2>; ++ fan-supply = <&vcc_sys>; ++ pwms = <&pwm1 0 40000 0>; ++ }; ++ ++ // pwm3 ++ ir-receiver { ++ compatible = "gpio-ir-receiver"; ++ gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_LOW>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&ir_int>; ++ }; ++ ++ adc-keys { ++ compatible = "adc-keys"; ++ io-channels = <&saradc 1>; ++ io-channel-names = "buttons"; ++ keyup-threshold-microvolt = <1750000>; ++ poll-interval = <100>; ++ ++ recovery { ++ label = "Recovery"; ++ linux,code = ; // ?? ++ press-threshold-microvolt = <0>; ++ }; ++ }; ++ ++ backlight: backlight { ++ compatible = "pwm-backlight"; ++ brightness-levels = <0 4 8 16 32 64 128 255>; ++ default-brightness-level = <5>; ++ pwms = <&pwm0 0 1000000 0>; ++ status = "okay"; ++ }; ++ ++}; ++ ++&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>; ++}; ++ ++&gpu { ++ mali-supply = <&vdd_gpu>; ++ status = "okay"; ++}; ++ ++&cpu_thermal { ++ trips { ++ cpu_warm: cpu_warm { ++ temperature = <50000>; ++ hysteresis = <2000>; ++ type = "active"; ++ }; ++ ++ cpu_hot: cpu_hot { ++ temperature = <65000>; ++ hysteresis = <2000>; ++ type = "active"; ++ }; ++ }; ++ ++ cooling-maps { ++ map2 { ++ trip = <&cpu_warm>; ++ cooling-device = <&fan0 THERMAL_NO_LIMIT 1>; ++ }; ++ ++ map3 { ++ trip = <&cpu_hot>; ++ cooling-device = <&fan0 4 THERMAL_NO_LIMIT>; ++ }; ++ }; ++}; ++ ++&emmc_phy { ++ status = "okay"; ++}; ++ ++&gmac { ++ assigned-clocks = <&cru SCLK_RMII_SRC>; ++ assigned-clock-parents = <&clkin_gmac>; ++ clock_in_out = "input"; ++ phy-supply = <&vcc_phy>; ++ phy-mode = "rgmii"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rgmii_pins>; ++ snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; // bsp ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++ tx_delay = <0x28>; ++ rx_delay = <0x11>; ++ status = "okay"; ++}; ++ ++&gpu { ++ mali-supply = <&vdd_gpu>; ++ status = "okay"; ++}; ++ ++&gpu_thermal { ++ trips { ++ gpu_warm: gpu_warm { ++ temperature = <50000>; ++ hysteresis = <2000>; ++ type = "active"; ++ }; ++ ++ gpu_hot: gpu_hot { ++ temperature = <65000>; ++ hysteresis = <2000>; ++ type = "active"; ++ }; ++ }; ++ ++ cooling-maps { ++ map1 { ++ trip = <&gpu_warm>; ++ cooling-device = <&fan0 THERMAL_NO_LIMIT 1>; ++ }; ++ ++ map2 { ++ trip = <&gpu_hot>; ++ cooling-device = <&fan0 4 THERMAL_NO_LIMIT>; ++ }; ++ }; ++}; ++ ++&hdmi { ++ ddc-i2c-bus = <&i2c3>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hdmi_cec>; ++ status = "okay"; ++}; ++ ++&hdmi_sound { ++ status = "okay"; ++}; ++ ++&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 = <&gpio1>; ++ interrupts = ; ++ #clock-cells = <1>; ++ clock-output-names = "xin32k", "rk808-clkout2"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l &pmic_dvs2>; ++ rockchip,system-power-controller; ++ wakeup-source; ++ ++ vcc1-supply = <&vcc3v3_sys>; ++ vcc2-supply = <&vcc3v3_sys>; ++ vcc3-supply = <&vcc3v3_sys>; ++ vcc4-supply = <&vcc3v3_sys>; ++ vcc6-supply = <&vcc3v3_sys>; ++ vcc7-supply = <&vcc3v3_sys>; ++ vcc8-supply = <&vcc3v3_sys>; ++ vcc9-supply = <&vcc3v3_sys>; ++ vcc10-supply = <&vcc3v3_sys>; ++ vcc11-supply = <&vcc3v3_sys>; ++ vcc12-supply = <&vcc3v3_sys>; ++ vddio-supply = <&vcc1v8_pmu>; ++ ++ regulators { ++ 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-off-in-suspend; ++ }; ++ }; ++ ++ vcc3v0_tp: LDO_REG2 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-name = "vcc3v0_tp"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc1v8_pmu: LDO_REG3 { ++ regulator-name = "vcc1v8_pmu"; ++ 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_sd: LDO_REG4 { ++ regulator-name = "vcc_sd"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3300000>; ++ }; ++ }; ++ ++ 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: 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 = <&cpu_b_sleep>; ++ 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 = <&vcc_sys>; ++ ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_gpu: regulator@41 { ++ compatible = "silergy,syr828"; ++ reg = <0x41>; ++ fcs,suspend-voltage-selector = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&gpu_sleep>; ++ regulator-name = "vdd_gpu"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ regulator-always-on; ++ regulator-boot-on; ++ vin-supply = <&vcc_sys>; ++ ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++}; ++ ++// Used for HDMI ++&i2c3 { ++ i2c-scl-rising-time-ns = <450>; ++ i2c-scl-falling-time-ns = <15>; ++ status = "okay"; ++}; ++ ++// HDMI sound ++&i2s2 { ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ ++ bt656-supply = <&vcc_3v0>; ++ audio-supply = <&vcca1v8_codec>; ++ sdmmc-supply = <&vcc_sd>; ++ gpio1830-supply = <&vcc_3v0>; ++}; ++ ++&pmu_io_domains { ++ status = "okay"; ++ pmu1830-supply = <&vcc_1v8>; ++}; ++ ++&pcie_phy { ++ status = "okay"; ++}; ++ ++&pcie0 { ++ ep-gpios = <&gpio4 RK_PD3 GPIO_ACTIVE_HIGH>; // sch ++ max-link-speed = <2>; ++ num-lanes = <2>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_clkreqn_cpm>; ++ status = "okay"; ++}; ++ ++&pinctrl { ++ pmic { ++ cpu_b_sleep: cpu-b-sleep { ++ rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ gpu_sleep: gpu-sleep { ++ rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ pmic_dvs2: pmic-dvs2 { ++ rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>; // bsp ++ }; ++ }; ++ ++ sdio-pwrseq { ++ wifi_reg_on_h: wifi-reg-on-h { ++ rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ wifi { ++ wifi_host_wake_l: wifi-host-wake-l { ++ rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ spi2 { ++ spi2_cs0: spi2-cs0 { ++ rockchip,pins = ++ <2 RK_PB4 2 &pcfg_pull_up>; ++ }; ++ }; ++ ++ display_pin:display-pin { ++ DC_pin: dc-pin { ++ rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ reset_pin: reset-pin { ++ rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ bt { ++ bt_enable_h: bt-enable-h { ++ rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ bt_host_wake_l: bt-host-wake-l { ++ rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ bt_wake_l: bt-wake-l { ++ rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ gmac { ++ vcc_phy_h: vcc-phy-h { ++ rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ leds { ++ user_led2: user_led2 { ++ rockchip,pins = ++ <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ ir { ++ ir_int: ir-int { ++ rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ buttons { ++ power_key: power_key { ++ rockchip,pins = ++ <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++}; ++ ++// TFT ++&pwm0 { ++ status = "okay"; ++}; ++ ++// FAN ++&pwm1 { ++ status = "okay"; ++}; ++ ++&pwm2 { ++ status = "okay"; ++}; ++ ++&saradc { ++ vref-supply = <&vcca1v8_s3>; ++ status = "okay"; ++}; ++ ++&sdio0 { ++ bus-width = <4>; ++ cap-sd-highspeed; ++ cap-sdio-irq; ++ clock-frequency = <50000000>; ++ disable-wp; ++ keep-power-in-suspend; ++ max-frequency = <50000000>; ++ mmc-pwrseq = <&sdio_pwrseq>; ++ non-removable; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; ++ sd-uhs-sdr104; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ brcmf: wifi@1 { ++ reg = <1>; ++ compatible = "brcm,bcm4329-fmac"; ++ interrupt-parent = <&gpio0>; ++ interrupts = ; ++ interrupt-names = "host-wake"; ++ brcm,drive-strength = <5>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_host_wake_l>; ++ }; ++}; ++ ++&sdmmc { ++ bus-width = <4>; ++ cap-sd-highspeed; ++ cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; // bsp ++ clock-frequency = <150000000>; ++ disable-wp; ++ sd-uhs-sdr104; ++ max-frequency = <150000000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; ++ vqmmc-supply = <&vcc_sd>; ++ status = "okay"; ++}; ++ ++&sdhci { ++ bus-width = <8>; ++ mmc-hs400-1_8v; ++ mmc-hs400-enhanced-strobe; ++ keep-power-in-suspend; ++ non-removable; ++ status = "okay"; ++}; ++/* ++&spi1 { ++ status = "okay"; ++ ++ norflash: flash@0 { ++ compatible = "jedec,spi-nor"; ++ reg = <0>; ++ spi-max-frequency = <50000000>; ++ }; ++}; ++*/ ++ ++&spi2 { ++ status = "okay"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_clk &spi2_tx &spi2_cs0>; ++ ++ st7735r@0 { ++ status = "okay"; ++ compatible = "sitronix,st7735r"; ++ reg = <0>; ++ rgb; ++ rotate = <270>; ++ width = <80>; ++ height = <160>; ++ fps = <30>; ++ buswidth = <8>; ++ backlight = <&backlight>; ++ dc-gpios = <&gpio4 RK_PD5 GPIO_ACTIVE_HIGH>; ++ reset-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_LOW>; ++ led-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>; ++ spi-max-frequency = <32000000>; ++ spi-cpol; ++ spi-cpha; ++ }; ++}; ++ ++&tcphy0 { ++ status = "okay"; ++}; ++ ++&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 { ++ status = "okay"; ++ }; ++}; ++ ++&u2phy1 { ++ status = "okay"; ++ ++ u2phy1_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy1_host: host-port { ++ status = "okay"; ++ }; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; ++ status = "okay"; ++ ++ bluetooth { ++ compatible = "brcm,bcm43438-bt"; ++ clocks = <&rk808 1>; ++ clock-names = "lpo"; ++ device-wakeup-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>; ++ host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; ++ shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; ++ max-speed = <4000000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; ++ vbat-supply = <&vcc3v3_sys>; ++ vddio-supply = <&vcc_1v8>; ++ }; ++}; ++ ++// Debug TTL ++&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"; ++}; ++ ++&vopb { ++ status = "okay"; ++}; ++ ++&vopb_mmu { ++ status = "okay"; ++}; ++ ++&vopl { ++ status = "okay"; ++}; ++ ++&vopl_mmu { ++ status = "okay"; ++}; ++ ++&iep_mmu { ++ status = "okay"; ++}; diff --git a/patch/kernel/archive/rockchip64-6.10/add-board-helios64.patch b/patch/kernel/archive/rockchip64-6.10/add-board-helios64.patch new file mode 100644 index 000000000000..be107a49e16a --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/add-board-helios64.patch @@ -0,0 +1,1038 @@ +From 98834ee2745daea7ee9c2f620acc1d09a4da2cdc Mon Sep 17 00:00:00 2001 +From: Aditya Prayoga +Date: Tue, 15 Sep 2020 20:04:22 +0700 +Subject: [PATCH] Add board Helios64 + +note: rpardini: this patch was rebased on top of 6.3.1, finally admitting +that it used to blindly overwrite the mainline dts (it was added when helios64 +was not in the tree, and thus a "file addition"). the resulting patch +is the complete set of changes actually done. + +Signed-off-by: Aditya Prayoga +--- + .../dts/rockchip/rk3399-kobol-helios64.dts | 735 ++++++++++++++++-- + 1 file changed, 654 insertions(+), 81 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts +index 9586bb12a5d8..09e2cfe40696 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts +@@ -11,6 +11,10 @@ + */ + + /dts-v1/; ++#include ++#include ++#include ++#include + #include "rk3399.dtsi" + #include "rk3399-opp.dtsi" + +@@ -48,6 +52,25 @@ chosen { + stdout-path = "serial2:1500000n8"; + }; + ++ adc-keys { ++ compatible = "adc-keys"; ++ io-channels = <&saradc 1>; ++ io-channel-names = "buttons"; ++ keyup-threshold-microvolt = <1800000>; ++ poll-interval = <100>; ++ ++ user2-button { ++ label = "User Button 2"; ++ linux,code = ; ++ press-threshold-microvolt = <100000>; ++ }; ++ }; ++ ++ beeper: beeper { ++ compatible = "gpio-beeper"; ++ gpios = <&gpio4 RK_PD3 GPIO_ACTIVE_HIGH>; ++ }; ++ + clkin_gmac: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; +@@ -55,35 +78,119 @@ clkin_gmac: external-gmac-clock { + #clock-cells = <0>; + }; + +- fan1 { ++ fan1: p7-fan { + /* fan connected to P7 */ + compatible = "pwm-fan"; + pwms = <&pwm0 0 40000 0>; ++ cooling-min-state = <0>; ++ cooling-max-state = <3>; ++ #cooling-cells = <2>; + cooling-levels = <0 80 170 255>; + }; + +- fan2 { ++ fan2: p6-fan { + /* fan connected to P6 */ + compatible = "pwm-fan"; + pwms = <&pwm1 0 40000 0>; ++ cooling-min-state = <0>; ++ cooling-max-state = <3>; ++ #cooling-cells = <2>; + cooling-levels = <0 80 170 255>; + }; + +- leds { ++ io_leds: io-gpio-leds { ++ status = "okay"; + compatible = "gpio-leds"; + pinctrl-names = "default"; +- pinctrl-0 = <&sys_grn_led_on &sys_red_led_on>; ++ pinctrl-0 = <&network_act>, <&usb3_act>, ++ <&sata_act>, <&sata_err_led>; ++ ++ network { ++ label = "helios64:blue:net"; ++ gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "netdev"; ++ default-state = "off"; ++ }; ++ ++ sata { ++ label = "helios64:blue:hdd-status"; ++ gpios = <&gpio4 RK_PD4 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "disk-activity"; ++ default-state = "off"; ++ }; ++ ++ sata_err1 { ++ label = "helios64:red:ata1-err"; ++ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_HIGH>; ++ default-state = "keep"; ++ }; ++ ++ sata_err2 { ++ label = "helios64:red:ata2-err"; ++ gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_HIGH>; ++ default-state = "keep"; ++ }; ++ ++ sata_err3 { ++ label = "helios64:red:ata3-err"; ++ gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_HIGH>; ++ default-state = "keep"; ++ }; ++ ++ sata_err4 { ++ label = "helios64:red:ata4-err"; ++ gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_HIGH>; ++ default-state = "keep"; ++ }; + +- led-0 { ++ sata_err5 { ++ label = "helios64:red:ata5-err"; ++ gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_HIGH>; ++ default-state = "keep"; ++ }; ++ ++ usb3 { ++ label = "helios64:blue:usb3"; ++ gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>; ++ trigger-sources = <&int_hub_port1>, ++ <&int_hub_port2>, ++ <&int_hub_port3>; ++ linux,default-trigger = "usbport"; ++ default-state = "off"; ++ }; ++ }; ++ ++ pwmleds { ++ compatible = "pwm-leds"; ++ status = "okay"; ++ ++ power-led { ++ label = "helios64:blue:power-status"; ++ pwms = <&pwm3 0 2000000000 0>; ++ max-brightness = <255>; ++ }; ++ }; ++ ++ system_leds: system-gpio-leds { ++ status = "okay"; ++ compatible = "gpio-leds"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&system_led>; ++ ++ status-led { + label = "helios64:green:status"; + gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "none"; + default-state = "on"; ++ mode = <0x23>; + }; + +- led-1 { ++ fault-led { + label = "helios64:red:fault"; + gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "panic"; + default-state = "keep"; ++ mode = <0x23>; + }; + }; + +@@ -115,7 +222,7 @@ pcie_power: pcie-power { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>; +- pinctrl-0 = <&pcie_pwr>; ++ pinctrl-0 = <&pcie_pwr_en>; + pinctrl-names = "default"; + regulator-boot-on; + regulator-name = "pcie_power"; +@@ -135,6 +242,7 @@ usblan_power: usblan-power { + vin-supply = <&vcc5v0_usb>; + }; + ++ /* switched by pmic_sleep */ + vcc1v8_sys_s0: vcc1v8-sys-s0 { + compatible = "regulator-fixed"; + regulator-name = "vcc1v8_sys_s0"; +@@ -145,6 +253,36 @@ vcc1v8_sys_s0: vcc1v8-sys-s0 { + vin-supply = <&vcc1v8_sys_s3>; + }; + ++ vcc0v9_s3: vcc0v9-s3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc0v9_s3"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <900000>; ++ regulator-max-microvolt = <900000>; ++ vin-supply = <&vcc3v3_sys_s3>; ++ }; ++ ++ avdd_0v9_s0: avdd-0v9-s0 { ++ compatible = "regulator-fixed"; ++ regulator-name = "avdd_0v9_s0"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <900000>; ++ regulator-max-microvolt = <900000>; ++ vin-supply = <&vcc1v8_sys_s3>; ++ }; ++ ++ avdd_1v8_s0: avdd-1v8-s0 { ++ compatible = "regulator-fixed"; ++ regulator-name = "avdd_1v8_s0"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vin-supply = <&vcc3v3_sys_s3>; ++ }; ++ + vcc3v0_sd: vcc3v0-sd { + compatible = "regulator-fixed"; + enable-active-high; +@@ -210,6 +346,36 @@ vcc5v0_usb: vcc5v0-usb { + vin-supply = <&vcc5v0_perdev>; + }; + ++ vcc5v0_typec: vcc5v0-typec-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&fusb0_vbus_en>; ++ regulator-name = "vcc5v0_typec"; ++ vin-supply = <&vcc5v0_usb>; ++ }; ++ ++ vcc5v0_hdd: vcc5v0-hdd { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc5v0_hdd"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc12v_dcin_bkup>; ++ }; ++ ++ vcc12v_hdd: vcc12v-hdd { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc12v_hdd"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <12000000>; ++ regulator-max-microvolt = <12000000>; ++ vin-supply = <&vcc12v_dcin_bkup>; ++ }; ++ + vcc12v_dcin: vcc12v-dcin { + compatible = "regulator-fixed"; + regulator-name = "vcc12v_dcin"; +@@ -228,36 +394,60 @@ vcc12v_dcin_bkup: vcc12v-dcin-bkup { + regulator-max-microvolt = <12000000>; + vin-supply = <&vcc12v_dcin>; + }; +-}; + +-/* +- * The system doesn't run stable with cpu freq enabled, so disallow the lower +- * frequencies until this problem is properly understood and resolved. +- */ +-&cluster0_opp { +- /delete-node/ opp00; +- /delete-node/ opp01; +- /delete-node/ opp02; +- /delete-node/ opp03; +- /delete-node/ opp04; +-}; ++ vdd_log: vdd-log { ++ compatible = "pwm-regulator"; ++ pwms = <&pwm2 0 25000 1>; ++ pwm-supply = <&vcc5v0_sys>; ++ regulator-name = "vdd_log"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <830000>; ++ regulator-max-microvolt = <1400000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <900000>; ++ }; ++ }; + +-&cluster1_opp { +- /delete-node/ opp00; +- /delete-node/ opp01; +- /delete-node/ opp02; +- /delete-node/ opp03; +- /delete-node/ opp04; +- /delete-node/ opp05; +- /delete-node/ opp06; +-}; ++ gpio-charger { ++ compatible = "gpio-charger"; ++ charger-type = "mains"; ++ gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; ++ charge-status-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&ac_present_ap>, <&charger_status>; ++ }; + +-&cpu_b0 { +- cpu-supply = <&vdd_cpu_b>; +-}; ++ gpio-keys { ++ compatible = "gpio-keys"; ++ autorepeat; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwrbtn>, <&user1btn>, <&wake_on_lan>; ++ ++ power { ++ debounce-interval = <100>; ++ gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; ++ label = "Power"; ++ linux,code = ; ++ wakeup-source; ++ }; + +-&cpu_b1 { +- cpu-supply = <&vdd_cpu_b>; ++ user1-button { ++ debounce-interval = <100>; ++ gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_LOW>; ++ label = "User Button 1"; ++ linux,code = ; ++ wakeup-source; ++ }; ++ }; ++ ++ hdmi_dp_sound: hdmi-dp-sound { ++ status = "okay"; ++ compatible = "rockchip,rk3399-hdmi-dp"; ++ rockchip,cpu = <&i2s2>; ++ rockchip,codec = <&cdn_dp>; ++ }; + }; + + &cpu_l0 { +@@ -276,6 +467,20 @@ &cpu_l3 { + cpu-supply = <&vdd_cpu_l>; + }; + ++&cpu_b0 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&cpu_b1 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&cdn_dp { ++ status = "okay"; ++ extcon = <&fusb0>; ++ phys = <&tcphy0_dp>; ++}; ++ + &emmc_phy { + status = "okay"; + }; +@@ -296,6 +500,11 @@ &gmac { + status = "okay"; + }; + ++&gpu { ++ mali-supply = <&vdd_gpu>; ++ status = "okay"; ++}; ++ + &i2c0 { + clock-frequency = <400000>; + i2c-scl-rising-time-ns = <168>; +@@ -311,6 +520,7 @@ rk808: pmic@1b { + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>; + rockchip,system-power-controller; ++ + vcc1-supply = <&vcc5v0_sys>; + vcc2-supply = <&vcc5v0_sys>; + vcc3-supply = <&vcc5v0_sys>; +@@ -327,6 +537,19 @@ rk808: pmic@1b { + #clock-cells = <1>; + + regulators { ++ vdd_center: DCDC_REG1 { ++ regulator-name = "vdd_center"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <800000>; ++ regulator-max-microvolt = <1000000>; ++ regulator-ramp-delay = <6001>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <950000>; ++ }; ++ }; ++ + vdd_cpu_l: DCDC_REG2 { + regulator-name = "vdd_cpu_l"; + regulator-always-on; +@@ -334,19 +557,48 @@ vdd_cpu_l: DCDC_REG2 { + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; +- + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + ++ vcc_ddr_s3: DCDC_REG3 { ++ regulator-name = "vcc_ddr_s3"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ + vcc1v8_sys_s3: DCDC_REG4 { + regulator-name = "vcc1v8_sys_s3"; + 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>; ++ }; ++ }; ++ ++ /* not used */ ++ vcc1v8_dvp: LDO_REG1 { ++ regulator-name = "vcc1v8_dvp"; ++ }; + ++ /* not used */ ++ vcc3v0_touch: LDO_REG2 { ++ regulator-name = "vcc3v0_touch"; ++ }; ++ ++ vcc1v8_s3: LDO_REG3 { ++ regulator-name = "vcc1v8_s3"; ++ 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>; +@@ -359,25 +611,61 @@ vcc_sdio_s0: LDO_REG4 { + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; +- + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + ++ /* not used */ ++ vcca3v0_codec: LDO_REG5 { ++ regulator-name = "vcca3v0_codec"; ++ }; ++ ++ vcc1v5_s3: LDO_REG6 { ++ regulator-name = "vcc1v5_s3"; ++ 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>; ++ }; ++ }; ++ ++ /* not used */ ++ vcca1v8_codec: LDO_REG7 { ++ regulator-name = "vcca1v8_codec"; ++ }; ++ + vcc3v0_s3: LDO_REG8 { + regulator-name = "vcc3v0_s3"; + 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_sys_s0: SWITCH_REG1 { ++ regulator-name = "vcc3v3_sys_s0"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ /* not used */ ++ vcc3v3_s0: SWITCH_REG2 { ++ regulator-name = "vcc3v3_s0"; ++ }; + }; + }; + +@@ -385,12 +673,33 @@ vdd_cpu_b: regulator@40 { + compatible = "silergy,syr827"; + reg = <0x40>; + fcs,suspend-voltage-selector = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vsel1_gpio>; + regulator-name = "vdd_cpu_b"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <40000>; + 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>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vsel2_gpio>; ++ 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 { +@@ -405,17 +714,101 @@ &i2c2 { + i2c-scl-falling-time-ns = <30>; + status = "okay"; + ++ gpio-expander@20 { ++ compatible = "nxp,pca9555"; ++ reg = <0x20>; ++ gpio-controller; ++ #gpio-cells = <2>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pca0_pins>; ++ interrupt-parent = <&gpio0>; ++ interrupts = <9 IRQ_TYPE_EDGE_FALLING>; ++ interrupt-controller; ++ #interrupt-cells = <2>; ++ vcc-supply = <&vcc3v3_sys_s3>; ++ }; ++ + temp@4c { + compatible = "national,lm75"; + reg = <0x4c>; + }; + }; + ++&i2c4 { ++ clock-frequency = <400000>; ++ i2c-scl-rising-time-ns = <160>; ++ i2c-scl-falling-time-ns = <30>; ++ status = "okay"; ++ ++ fusb0: typec-portc@22 { ++ compatible = "fcs,fusb302"; ++ reg = <0x22>; ++ interrupt-parent = <&gpio1>; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&fusb0_int>; ++ vbus-supply = <&vcc5v0_typec>; ++ ++ connector { ++ compatible = "usb-c-connector"; ++ label = "USB-C"; ++ power-role = "dual"; ++ data-role = "dual"; ++ try-power-role = "sink"; ++ source-pdos = ; ++ sink-pdos = ; ++ op-sink-microwatt = <5000000>; ++ ++ extcon-cables = <1 2 5 6 9 10 12 44>; ++ typec-altmodes = <0xff01 1 0x001c0000 1>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ usb_con_hs: endpoint { ++ remote-endpoint = <&u2phy0_typec_hs>; ++ }; ++ }; ++ port@1 { ++ reg = <1>; ++ usb_con_ss: endpoint { ++ remote-endpoint = <&tcphy0_typec_ss>; ++ }; ++ }; ++ port@2 { ++ reg = <2>; ++ usb_con_sbu: endpoint { ++ remote-endpoint = <&tcphy0_typec_dp>; ++ }; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++/* I2C on UEXT */ ++&i2c7 { ++ status = "okay"; ++}; ++ ++/* External I2C */ ++&i2c8 { ++ status = "okay"; ++}; ++ ++&i2s2 { ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ + &io_domains { +- audio-supply = <&vcc1v8_sys_s0>; + bt656-supply = <&vcc1v8_sys_s0>; +- gpio1830-supply = <&vcc3v0_s3>; ++ audio-supply = <&vcc1v8_sys_s0>; + sdmmc-supply = <&vcc_sdio_s0>; ++ gpio1830-supply = <&vcc3v0_s3>; + status = "okay"; + }; + +@@ -428,6 +821,7 @@ &pcie0 { + max-link-speed = <2>; + num-lanes = <2>; + pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_prst &pcie_clkreqn_cpm>; + status = "okay"; + + vpcie12v-supply = <&vcc12v_dcin>; +@@ -437,36 +831,116 @@ &pcie0 { + }; + + &pinctrl { ++ buttons { ++ pwrbtn: pwrbtn { ++ rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ user1btn: usr1btn { ++ rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ charger { ++ ac_present_ap: ac-present-ap { ++ rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ charger_status: charger-status { ++ rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ fan { ++ fan1_sense: fan1-sense { ++ rockchip,pins = <4 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ fan2_sense: fan2-sense { ++ rockchip,pins = <4 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ fusb30x { ++ fusb0_int: fusb0-int { ++ rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ fusb0_vbus_en: fusb0-vbus-en { ++ rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ + gmac { + gphy_reset: gphy-reset { +- rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_output_low>; ++ rockchip,pins = ++ <3 RK_PB7 RK_FUNC_GPIO &pcfg_output_low>; + }; + }; + + leds { +- sys_grn_led_on: sys-grn-led-on { +- rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_down>; ++ network_act: network-act { ++ rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ usb3_act: usb3-act { ++ rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ sata_act: sata-act { ++ rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ system_led: sys-led { ++ rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_down>, ++ <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ sata_err_led: sata-err-led { ++ rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_down>, ++ <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_down>, ++ <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>, ++ <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_down>, ++ <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ misc { ++ pca0_pins: pca0-pins { ++ rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + +- sys_red_led_on: sys-red-led-on { +- rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_down>; ++ wake_on_lan: wake-on-lan { ++ rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pcie { +- pcie_pwr: pcie-pwr { ++ pcie_pwr_en: pcie-pwr-en { + rockchip,pins = + <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>; + }; ++ ++ pcie_prst: pcie-prst { ++ rockchip,pins = <2 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; + }; + + pmic { + pmic_int_l: pmic-int-l { +- rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; ++ rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ vsel1_gpio: vsel1-gpio { ++ rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ vsel2_gpio: vsel2-gpio { ++ rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + +- power { ++ power { + hdd_a_power_en: hdd-a-power-en { + rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; +@@ -486,7 +960,7 @@ usb_lan_en: usb-lan-en { + + vcc3v0-sd { + sdmmc0_pwr_h: sdmmc0-pwr-h { +- rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; ++ rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_output_high>; + }; + }; + }; +@@ -506,10 +980,29 @@ &pwm1 { + status = "okay"; + }; + ++&pwm2 { ++ status = "okay"; ++}; ++ ++&pwm3 { ++ status = "okay"; ++}; ++ ++&saradc { ++ vref-supply = <&vcc1v8_s3>; ++ status = "okay"; ++}; ++ + &sdhci { ++ assigned-clock-rates = <150000000>; + bus-width = <8>; + mmc-hs200-1_8v; ++ // hs400 is broken on Helios64 since 5.10.60 ++ // mmc-hs400-1_8v; ++ // mmc-hs400-enhanced-strobe; ++ supports-emmc; + non-removable; ++ disable-wp; + vqmmc-supply = <&vcc1v8_sys_s0>; + status = "okay"; + }; +@@ -517,8 +1010,9 @@ &sdhci { + &sdmmc { + bus-width = <4>; + cap-sd-highspeed; +- cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; ++ cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; // TODO: verify what needs to be done to use implicit CD definition + disable-wp; ++ sd-uhs-sdr104; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; + vmmc-supply = <&vcc3v0_sd>; +@@ -547,6 +1041,27 @@ &spi5 { + status = "okay"; + }; + ++&tcphy0 { ++ extcon = <&fusb0>; ++ status = "okay"; ++}; ++ ++&tcphy0_dp { ++ port { ++ tcphy0_typec_dp: endpoint { ++ remote-endpoint = <&usb_con_sbu>; ++ }; ++ }; ++}; ++ ++&tcphy0_usb3 { ++ port { ++ tcphy0_typec_ss: endpoint { ++ remote-endpoint = <&usb_con_ss>; ++ }; ++ }; ++}; ++ + &tcphy1 { + /* phy for &usbdrd_dwc3_1 */ + status = "okay"; +@@ -560,61 +1075,118 @@ &tsadc { + status = "okay"; + }; + +-&u2phy1 { ++&u2phy0 { + status = "okay"; + +- otg-port { +- /* phy for &usbdrd_dwc3_1 */ ++ u2phy0_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy0_host: host-port { + phy-supply = <&vcc5v0_usb>; + status = "okay"; + }; ++ ++ port { ++ u2phy0_typec_hs: endpoint { ++ remote-endpoint = <&usb_con_hs>; ++ }; ++ }; ++}; ++ ++&u2phy1 { ++ status = "okay"; ++ ++ u2phy1_otg: otg-port { ++ status = "okay"; ++ }; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_xfer>; ++ status = "okay"; + }; + + &uart2 { + status = "okay"; + }; + ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usbdrd3_0 { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3_0 { ++ status = "okay"; ++ dr_mode = "otg"; ++}; ++ + &usbdrd3_1 { + status = "okay"; ++}; + +- usb@fe900000 { +- dr_mode = "host"; +- status = "okay"; ++&usbdrd_dwc3_1 { ++ dr_mode = "host"; ++ status = "okay"; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ int_hub: hub@1 { ++ compatible = "usb2109,0815"; ++ reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + +- hub@1 { +- compatible = "usb2109,0815"; ++ int_hub_port1: port@1 { + reg = <1>; +- #address-cells = <1>; +- #size-cells = <0>; +- +- port@1 { +- reg = <1>; +- #trigger-source-cells = <0>; +- }; ++ #trigger-source-cells = <0>; ++ }; + +- port@2 { +- reg = <2>; +- #trigger-source-cells = <0>; +- }; ++ int_hub_port2: port@2 { ++ reg = <2>; ++ #trigger-source-cells = <0>; ++ }; + +- port@3 { +- reg = <3>; +- #trigger-source-cells = <0>; +- }; ++ int_hub_port3: port@3 { ++ reg = <3>; ++ #trigger-source-cells = <0>; ++ }; + +- device@4 { +- compatible = "usbbda,8156"; +- reg = <4>; +- #address-cells = <2>; +- #size-cells = <0>; ++ usb_lan: device@4 { ++ compatible = "usbbda,8156"; ++ reg = <4>; ++ #address-cells = <2>; ++ #size-cells = <0>; + +- interface@0 { /* interface 0 of configuration 1 */ +- compatible = "usbifbda,8156.config1.0"; +- reg = <0 1>; +- }; ++ interface@0 { /* interface 0 of configuration 1 */ ++ compatible = "usbifbda,8156.config1.0"; ++ reg = <0 1>; + }; + }; + }; + }; ++ ++&vopb { ++ status = "okay"; ++}; ++ ++&vopb_mmu { ++ status = "okay"; ++}; ++ ++&vopl { ++ status = "okay"; ++}; ++ ++&vopl_mmu { ++ status = "okay"; ++}; +-- +2.43.0 + diff --git a/patch/kernel/archive/rockchip64-6.10/add-board-xiaobao-nas-dts.patch b/patch/kernel/archive/rockchip64-6.10/add-board-xiaobao-nas-dts.patch new file mode 100644 index 000000000000..a82ffbdd2b5c --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/add-board-xiaobao-nas-dts.patch @@ -0,0 +1,779 @@ +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-xiaobao-nas.dts b/arch/arm64/boot/dts/rockchip/rk3399-xiaobao-nas.dts +new file mode 100644 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-xiaobao-nas.dts +@@ -0,0 +1,774 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++ ++/dts-v1/; ++#include ++#include ++#include ++#include "rk3399.dtsi" ++#include "rk3399-opp.dtsi" ++ ++/ { ++ model = "Codinge Xiaobao NAS"; ++ compatible = "codinge,xiaobao-nas", "rockchip,rk3399"; ++ ++ aliases { ++ mmc0 = &sdmmc; ++ mmc1 = &sdhci; ++ mmc2 = &sdio0; ++ }; ++ ++ chosen { ++ stdout-path = "serial2:1500000n8"; ++ }; ++ ++ clkin_gmac: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "clkin_gmac"; ++ #clock-cells = <0>; ++ }; ++ ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ clocks = <&rk808 1>; ++ clock-names = "ext_clock"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_enable_h>; ++ reset-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_LOW>; ++ }; ++ ++ vcc_dc: vcc-dc { ++ compatible = "regulator-fixed"; ++ regulator-name = "dc_12v"; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ vcc_12v: vcc-12v { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_12v"; ++ regulator-always-on; ++ regulator-min-microvolt = <12000000>; ++ regulator-max-microvolt = <12000000>; ++ }; ++ ++ vcc5v0_sys: vcc5v0-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc5v0_sys"; ++ regulator-always-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ vcc1v8_s3: vcc1v8-s3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc1v8_s3"; ++ regulator-always-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vin-supply = <&vcc_1v8>; ++ }; ++ ++ vcc3v3_sys: vcc3v3-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3_sys"; ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ vcc5v0_host: vcc5v0-host-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc5v0_host_en>; ++ regulator-name = "vcc5v0_host"; ++ }; ++ ++ vcc_sd: vcc-sd { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_sd"; ++ enable-active-high; ++ gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc_sd_h>; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ vcc5v0_typec: vcc5v0-typec { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio4 RK_PD4 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc5v0_typec_en>; ++ regulator-name = "vcc5v0_typec"; ++ regulator-always-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc_12v>; ++ }; ++ ++ vcc3v3_pcie: vcc3v3-pcie-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3_pcie"; ++ enable-active-high; ++ gpio = <&gpio4 RK_PD6 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_pwr_en>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vcc3v3_sys>; ++ }; ++ ++ vcc_lan: vcc3v3-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_lan"; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ adc-keys { ++ compatible = "adc-keys"; ++ io-channels = <&saradc 1>; ++ io-channel-names = "buttons"; ++ keyup-threshold-microvolt = <1800000>; ++ poll-interval = <100>; ++ ++ recovery { ++ label = "Recovery"; ++ linux,code = <0x168>; ++ press-threshold-microvolt = <18000>; ++ }; ++ }; ++ ++ gpio-leds { ++ compatible = "gpio-leds"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&leds_pins>; ++ ++ led1: system-led1 { ++ gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; ++ label = "system_led1"; ++ retain-state-suspended; ++ default-state = "on"; ++ }; ++ ++ led2: system-led2 { ++ gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_HIGH>; ++ label = "system_led2"; ++ retain-state-suspended; ++ default-state = "off"; ++ }; ++ }; ++ ++ pwm-fan { ++ compatible = "pwm-fan"; ++ pwms = <&pwm1 0 50000 0>; ++ }; ++}; ++ ++&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>; ++}; ++ ++&emmc_phy { ++ status = "okay"; ++}; ++ ++&gmac { ++ assigned-clocks = <&cru SCLK_RMII_SRC>; ++ assigned-clock-parents = <&clkin_gmac>; ++ clock_in_out = "input"; ++ phy-supply = <&vcc_lan>; ++ phy-mode = "rgmii"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rgmii_pins>; ++ snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++ tx_delay = <0x28>; ++ rx_delay = <0x11>; ++ status = "okay"; ++}; ++ ++&gpu { ++ mali-supply = <&vdd_gpu>; ++ status = "okay"; ++}; ++ ++&hdmi { ++ ddc-i2c-bus = <&i2c3>; ++ ddc-i2c-scl-high-time-ns = <9625>; ++ ddc-i2c-scl-low-time-ns = <10000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hdmi_cec>; ++ status = "okay"; ++}; ++ ++&hdmi_sound { ++ status = "okay"; ++}; ++ ++&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 = <&gpio1>; ++ interrupts = <21 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 = <&vcc3v3_sys>; ++ vcc2-supply = <&vcc3v3_sys>; ++ vcc3-supply = <&vcc3v3_sys>; ++ vcc4-supply = <&vcc3v3_sys>; ++ vcc6-supply = <&vcc3v3_sys>; ++ vcc7-supply = <&vcc3v3_sys>; ++ vcc8-supply = <&vcc3v3_sys>; ++ vcc9-supply = <&vcc3v3_sys>; ++ vcc10-supply = <&vcc3v3_sys>; ++ vcc11-supply = <&vcc3v3_sys>; ++ vcc12-supply = <&vcc3v3_sys>; ++ vddio-supply = <&vcc_3v0>; ++ ++ regulators { ++ 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>; ++ }; ++ }; ++ ++ vcca_1v8: LDO_REG2 { ++ 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>; ++ }; ++ }; ++ ++ vcc1v8_pmupll: LDO_REG3 { ++ regulator-name = "vcc1v8_pmupll"; ++ 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 = <3000000>; ++ ++ 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-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ 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-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ 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: 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; ++ ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_gpu: regulator@41 { ++ compatible = "silergy,syr828"; ++ reg = <0x41>; ++ fcs,suspend-voltage-selector = <1>; ++ 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; ++ ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ hym8563@51 { ++ compatible = "haoyu,hym8563"; ++ reg = <0x51>; ++ #clock-cells = <0>; ++ clock-frequency = <32768>; ++ clock-output-names = "xin32k"; ++ }; ++}; ++ ++&i2c3 { ++ i2c-scl-rising-time-ns = <450>; ++ i2c-scl-falling-time-ns = <15>; ++ status = "okay"; ++}; ++ ++&i2c4 { ++ clock-frequency = <400000>; ++ i2c-scl-rising-time-ns = <160>; ++ i2c-scl-falling-time-ns = <30>; ++ status = "okay"; ++ ++ typec-portc@22 { ++ compatible = "fcs,fusb302"; ++ reg = <0x22>; ++ interrupt-parent = <&gpio1>; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&fusb0_int>; ++ vbus-supply = <&vcc5v0_typec>; ++ }; ++}; ++ ++&i2s0 { ++ rockchip,capture-channels = <8>; ++ rockchip,playback-channels = <8>; ++ status = "okay"; ++}; ++ ++&i2s1 { ++ rockchip,capture-channels = <2>; ++ rockchip,playback-channels = <2>; ++ status = "okay"; ++}; ++ ++&i2s2 { ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ ++ bt656-supply = <&vcc_3v0>; ++ audio-supply = <&vcca1v8_codec>; ++ sdmmc-supply = <&vcc_sdio>; ++ gpio1830-supply = <&vcc_3v0>; ++}; ++ ++&pcie_phy { ++ status = "okay"; ++ drive-impedance-ohm = <50>; ++}; ++ ++&pcie0 { ++ ep-gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_HIGH>; ++ num-lanes = <4>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_clkreqnb_cpm &fn8274_en_h>; ++ status = "okay"; ++}; ++ ++&pmu_io_domains { ++ status = "okay"; ++ ++ pmu1830-supply = <&vcc_3v0>; ++}; ++ ++&pinctrl { ++ pcie { ++ fn8274_en_h: fn8274-en-h { ++ rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_output_high>, ++ <4 RK_PD5 RK_FUNC_GPIO &pcfg_output_high>, ++ <1 RK_PC7 RK_FUNC_GPIO &pcfg_output_high>; ++ }; ++ ++ pcie_pwr_en: pcie-pwr-en { ++ rockchip,pins = <4 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = <1 RK_PC5 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>; ++ }; ++ }; ++ ++ usb2 { ++ vcc5v0_host_en: vcc5v0-host-en { ++ rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ vcc5v0_typec_en: vcc5v0-typec-en { ++ rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO &pcfg_output_high>; ++ }; ++ }; ++ ++ vcc_sd { ++ vcc_sd_h: vcc-sd-h { ++ rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ fusb30x { ++ fusb0_int: fusb0-int { ++ rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ leds { ++ leds_pins: leds-pins { ++ rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, ++ <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++}; ++ ++&pwm1 { ++ status = "okay"; ++}; ++ ++&saradc { ++ status = "okay"; ++}; ++ ++&sdio0 { ++ bus-width = <4>; ++ clock-frequency = <50000000>; ++ cap-sdio-irq; ++ cap-sd-highspeed; ++ keep-power-in-suspend; ++ mmc-pwrseq = <&sdio_pwrseq>; ++ non-removable; ++ num-slots = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; ++ sd-uhs-sdr104; ++ status = "okay"; ++}; ++ ++&sdmmc { ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; ++ disable-wp; ++ max-frequency = <150000000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cd &sdmmc_cmd &sdmmc_bus4>; ++ vmmc-supply = <&vcc_sd>; ++ vqmmc-supply = <&vcc_sdio>; ++ status = "okay"; ++}; ++ ++&sdhci { ++ bus-width = <8>; ++ mmc-hs400-1_8v; ++ mmc-hs400-enhanced-strobe; ++ non-removable; ++ status = "okay"; ++}; ++ ++&spi1 { ++ status = "okay"; ++ ++ flash@0 { ++ compatible = "jedec,spi-nor"; ++ reg = <0x00>; ++ spi-max-frequency = <10000000>; ++ }; ++}; ++ ++&tcphy0 { ++ status = "okay"; ++}; ++ ++&tcphy1 { ++ status = "okay"; ++}; ++ ++&tsadc { ++ status = "okay"; ++ ++ /* tshut mode 0:CRU 1:GPIO */ ++ rockchip,hw-tshut-mode = <1>; ++ /* tshut polarity 0:LOW 1:HIGH */ ++ rockchip,hw-tshut-polarity = <1>; ++}; ++ ++&u2phy0 { ++ status = "okay"; ++}; ++ ++&u2phy0_otg { ++ status = "okay"; ++}; ++ ++&u2phy0_host { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++}; ++ ++&u2phy1 { ++ status = "okay"; ++}; ++ ++&u2phy1_otg { ++ status = "okay"; ++}; ++ ++&u2phy1_host { ++ 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"; ++}; ++ ++&vopb { ++ status = "okay"; ++}; ++ ++&vopb_mmu { ++ status = "okay"; ++}; ++ ++&vopl { ++ status = "okay"; ++}; ++ ++&vopl_mmu { ++ status = "okay"; ++}; diff --git a/patch/kernel/archive/rockchip64-6.10/board-firefly-rk3399-dts.patch b/patch/kernel/archive/rockchip64-6.10/board-firefly-rk3399-dts.patch new file mode 100644 index 000000000000..f212d69355a7 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-firefly-rk3399-dts.patch @@ -0,0 +1,282 @@ +index c654b6b02f3..f73f792eb44 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts +@@ -217,7 +216,7 @@ + enable-active-high; + gpio = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; +- pinctrl-0 = <&vcc5v0_host_en>; ++ pinctrl-0 = <&vcc5v0_host_en &hub_rst>; + regulator-name = "vcc5v0_host"; + regulator-always-on; + vin-supply = <&vcc_sys>; +@@ -236,8 +235,11 @@ + + vcc_sys: vcc-sys { + compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio2 RK_PA6 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc_sys_en>; + regulator-name = "vcc_sys"; +- regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; +@@ -254,6 +256,27 @@ + regulator-min-microvolt = <430000>; + regulator-max-microvolt = <1400000>; + }; ++ ++ vcca_0v9: vcca-0v9 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcca_0v9"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <900000>; ++ regulator-max-microvolt = <900000>; ++ vin-supply = <&vcc3v3_sys>; ++ }; ++ ++ vcc3v3_3g: vcc3v3-3g-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio0 2 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_3g_drv>; ++ regulator-name = "vcc3v3_3g"; ++ regulator-always-on; ++ regulator-boot-on; ++ }; + }; + + &cpu_l0 { +@@ -306,6 +329,8 @@ + }; + + &hdmi { ++ avdd-0v9-supply = <&vcca0v9_hdmi>; ++ avdd-1v8-supply = <&vcca1v8_hdmi>; + ddc-i2c-bus = <&i2c3>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_cec>; +@@ -330,18 +355,18 @@ + rockchip,system-power-controller; + wakeup-source; + +- vcc1-supply = <&vcc_sys>; +- vcc2-supply = <&vcc_sys>; +- vcc3-supply = <&vcc_sys>; +- vcc4-supply = <&vcc_sys>; +- vcc6-supply = <&vcc_sys>; +- vcc7-supply = <&vcc_sys>; ++ vcc1-supply = <&vcc3v3_sys>; ++ vcc2-supply = <&vcc3v3_sys>; ++ vcc3-supply = <&vcc3v3_sys>; ++ vcc4-supply = <&vcc3v3_sys>; ++ vcc6-supply = <&vcc3v3_sys>; ++ vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; +- vcc9-supply = <&vcc_sys>; +- vcc10-supply = <&vcc_sys>; +- vcc11-supply = <&vcc_sys>; ++ vcc9-supply = <&vcc3v3_sys>; ++ vcc10-supply = <&vcc3v3_sys>; ++ vcc11-supply = <&vcc3v3_sys>; + vcc12-supply = <&vcc3v3_sys>; +- vddio-supply = <&vcc1v8_pmu>; ++ vddio-supply = <&vcc_3v0>; + + regulators { + vdd_center: DCDC_REG1 { +@@ -389,8 +414,8 @@ + }; + }; + +- vcc1v8_dvp: LDO_REG1 { +- regulator-name = "vcc1v8_dvp"; ++ vcca1v8_codec: LDO_REG1 { ++ regulator-name = "vcca1v8_codec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; +@@ -400,12 +425,12 @@ + }; + }; + +- vcc2v8_dvp: LDO_REG2 { +- regulator-name = "vcc2v8_dvp"; ++ vcca1v8_hdmi: LDO_REG2 { ++ regulator-name = "vcca1v8_hdmi"; + regulator-always-on; + regulator-boot-on; +- regulator-min-microvolt = <2800000>; +- regulator-max-microvolt = <2800000>; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-off-in-suspend; + }; +@@ -458,12 +483,12 @@ + }; + }; + +- vcca1v8_codec: LDO_REG7 { +- regulator-name = "vcca1v8_codec"; ++ vcca0v9_hdmi: LDO_REG7 { ++ regulator-name = "vcca0v9_hdmi"; + regulator-always-on; + regulator-boot-on; +- regulator-min-microvolt = <1800000>; +- regulator-max-microvolt = <1800000>; ++ regulator-min-microvolt = <900000>; ++ regulator-max-microvolt = <900000>; + regulator-state-mem { + regulator-off-in-suspend; + }; +@@ -504,14 +529,16 @@ + vdd_cpu_b: regulator@40 { + compatible = "silergy,syr827"; + reg = <0x40>; +- fcs,suspend-voltage-selector = <0>; ++ 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 = <&vcc_sys>; ++ vin-supply = <&vcc3v3_sys>; + + regulator-state-mem { + regulator-off-in-suspend; +@@ -522,13 +549,15 @@ + compatible = "silergy,syr828"; + reg = <0x41>; + fcs,suspend-voltage-selector = <1>; ++ 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 = <&vcc_sys>; ++ vin-supply = <&vcc3v3_sys>; + + regulator-state-mem { + regulator-off-in-suspend; +@@ -565,7 +594,7 @@ + status = "okay"; + + fusb0: typec-portc@22 { +- compatible = "fcs,fusb302"; ++ compatible = "fairchild,fusb302"; + reg = <0x22>; + interrupt-parent = <&gpio1>; + interrupts = ; +@@ -638,7 +667,7 @@ + &io_domains { + status = "okay"; + +- bt656-supply = <&vcc1v8_dvp>; ++ bt656-supply = <&vcc_3v0>; + audio-supply = <&vcca1v8_codec>; + sdmmc-supply = <&vcc_sdio>; + gpio1830-supply = <&vcc_3v0>; +@@ -652,7 +681,10 @@ + ep-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; + num-lanes = <4>; + pinctrl-names = "default"; +- pinctrl-0 = <&pcie_clkreqn_cpm>; ++ pinctrl-0 = <&pcie_perst>; ++ vpcie3v3-supply = <&vcc3v3_pcie>; ++ vpcie1v8-supply = <&vcc1v8_pmu>; ++ vpcie0v9-supply = <&vcca_0v9>; + status = "okay"; + }; + +@@ -704,6 +736,10 @@ + pcie_3g_drv: pcie-3g-drv { + rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; + }; ++ ++ pcie_perst: pcie-perst { ++ rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; + }; + + pmic { +@@ -742,6 +778,14 @@ + vcc5v0_host_en: vcc5v0-host-en { + rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; ++ ++ vcc_sys_en: vcc-sys-en { ++ rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ hub_rst: hub-rst { ++ rockchip,pins = <2 RK_PA4 RK_FUNC_GPIO &pcfg_output_high>; ++ }; + }; + + wifi { +@@ -749,6 +793,20 @@ + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; ++ ++ bt { ++ bt_host_wake_l: bt-host-wake-l { ++ rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ bt_reg_on_h: bt-reg-on-h { ++ rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ bt_wake_l: bt-wake-l { ++ rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; + }; + + &pwm0 { +@@ -788,7 +846,7 @@ + reg = <1>; + compatible = "brcm,bcm4329-fmac"; + interrupt-parent = <&gpio0>; +- interrupts = ; ++ interrupts = ; + interrupt-names = "host-wake"; + brcm,drive-strength = <5>; + pinctrl-names = "default"; +@@ -885,8 +943,22 @@ + + &uart0 { + pinctrl-names = "default"; +- pinctrl-0 = <&uart0_xfer &uart0_cts>; ++ pinctrl-0 = <&uart0_xfer &uart0_rts &uart0_cts>; + status = "okay"; ++ ++ bluetooth { ++ compatible = "brcm,bcm43438-bt"; ++ clocks = <&rk808 1>; ++ clock-names = "lpo"; ++ device-wakeup-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>; ++ host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; ++ shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; ++ max-speed = <4000000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&bt_reg_on_h &bt_host_wake_l &bt_wake_l>; ++ vbat-supply = <&vcc3v3_sys>; ++ vddio-supply = <&vcc_1v8>; ++ }; + }; + + &uart2 { diff --git a/patch/kernel/archive/rockchip64-6.10/board-helios64-dts-fix-stability-issues.patch b/patch/kernel/archive/rockchip64-6.10/board-helios64-dts-fix-stability-issues.patch new file mode 100644 index 000000000000..1b427c141177 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-helios64-dts-fix-stability-issues.patch @@ -0,0 +1,72 @@ +From 4244bd791ab2fe68abebc1b6bf71ffbc02535828 Mon Sep 17 00:00:00 2001 +From: Aditya Prayoga +Date: Thu, 4 Mar 2021 10:39:40 +0700 +Subject: [PATCH] Attempt to improve stability on Helios64 (#2680) + +> X-Git-Archeology: > recovered message: > * Adjust the RK808 buck step to improve stability +> X-Git-Archeology: > recovered message: > * Adjust vdd_log and enable vdd_center init voltage +> X-Git-Archeology: > recovered message: > For some reason, regulator-init-microvolt property under PMIC does not applied. Set the voltage on board file. +> X-Git-Archeology: - Revision eefad69215557708b151a5d9244617a4ffd1281c: https://github.com/armbian/build/commit/eefad69215557708b151a5d9244617a4ffd1281c +> X-Git-Archeology: Date: Thu, 04 Mar 2021 10:39:40 +0700 +> X-Git-Archeology: From: Aditya Prayoga +> X-Git-Archeology: Subject: Attempt to improve stability on Helios64 (#2680) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts +index 09e2cfe40696..4cb72981809a 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts +@@ -522,6 +522,7 @@ rk808: pmic@1b { + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>; + rockchip,system-power-controller; ++ max-buck-steps-per-change = <4>; + + vcc1-supply = <&vcc5v0_sys>; + vcc2-supply = <&vcc5v0_sys>; +-- +2.43.0 + diff --git a/patch/kernel/archive/rockchip64-6.10/board-helios64-remove-pcie-ep-gpios.patch b/patch/kernel/archive/rockchip64-6.10/board-helios64-remove-pcie-ep-gpios.patch new file mode 100644 index 000000000000..ff7ca38b5346 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-helios64-remove-pcie-ep-gpios.patch @@ -0,0 +1,25 @@ +From 9fd42a26755ee7303a033c9c1fba3a492e0044f5 Mon Sep 17 00:00:00 2001 +From: Aditya Prayoga +Date: Tue, 15 Sep 2020 13:42:02 +0700 +Subject: [PATCH] Remove PCIE ep-gpios from Helios64 + +Signed-off-by: Aditya Prayoga +--- + arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts +index 4cb72981809a..824e7a4d8e40 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts +@@ -820,7 +820,6 @@ &pcie_phy { + }; + + &pcie0 { +- ep-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>; + max-link-speed = <2>; + num-lanes = <2>; + pinctrl-names = "default"; +-- +2.43.0 + diff --git a/patch/kernel/archive/rockchip64-6.10/board-nanopc-t4-add-typec-dp.patch b/patch/kernel/archive/rockchip64-6.10/board-nanopc-t4-add-typec-dp.patch new file mode 100644 index 000000000000..b6a2dc3d616b --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-nanopc-t4-add-typec-dp.patch @@ -0,0 +1,147 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: tonymac32 +Date: Wed, 17 Feb 2021 00:54:00 -0500 +Subject: Patching something + +Signed-off-by: tonymac32 +--- + arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts | 96 ++++++++++ + 1 file changed, 96 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts b/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts +index 3bf8f959e42c..2b1220beabd5 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts +@@ -9,6 +9,7 @@ + */ + + /dts-v1/; ++#include + #include "rk3399-nanopi4.dtsi" + + / { +@@ -66,6 +67,12 @@ fan: pwm-fan { + }; + }; + ++&cdn_dp { ++ status = "okay"; ++ extcon = <&fusb0>; ++ phys = <&tcphy0_dp>; ++}; ++ + &cpu_thermal { + trips { + cpu_warm: cpu_warm { +@@ -94,6 +101,50 @@ map3 { + }; + }; + ++&fusb0 { ++ ++ connector { ++ compatible = "usb-c-connector"; ++ label = "USB-C"; ++ power-role = "dual"; ++ data-role = "dual"; ++ try-power-role = "sink"; ++ source-pdos = ; ++ sink-pdos = ; ++ op-sink-microwatt = <5000000>; ++ ++ extcon-cables = <1 2 5 6 9 10 12 44>; ++ typec-altmodes = <0xff01 1 0x001c0000 1>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ port@0 { ++ reg = <0>; ++ usb_con_hs: endpoint { ++ remote-endpoint = ++ <&u2phy0_typec_hs>; ++ }; ++ }; ++ port@1 { ++ reg = <1>; ++ ++ usb_con_ss: endpoint { ++ remote-endpoint = ++ <&tcphy0_typec_ss>; ++ }; ++ }; ++ port@2 { ++ reg = <2>; ++ usb_con_dp: endpoint { ++ remote-endpoint = ++ <&tcphy0_typec_dp>; ++ }; ++ }; ++ }; ++ }; ++}; ++ + &pcie0 { + ep-gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_HIGH>; + num-lanes = <4>; +@@ -114,12 +165,57 @@ &sdhci { + mmc-hs400-enhanced-strobe; + }; + ++&tcphy0 { ++ extcon = <&fusb0>; ++ status = "okay"; ++}; ++ ++&tcphy0_dp { ++ port { ++ tcphy0_typec_dp: endpoint { ++ remote-endpoint = <&usb_con_dp>; ++ }; ++ }; ++}; ++ ++&tcphy0_usb3 { ++ port { ++ tcphy0_typec_ss: endpoint { ++ remote-endpoint = <&usb_con_ss>; ++ }; ++ }; ++}; ++ ++&u2phy0 { ++ extcon = <&fusb0>; ++}; ++ + &u2phy0_host { + phy-supply = <&vcc5v0_host0>; ++ status = "okay"; ++}; ++ ++&u2phy0_otg { ++ status = "okay"; ++ ++ port { ++ u2phy0_typec_hs: endpoint { ++ remote-endpoint = <&usb_con_hs>; ++ }; ++ }; + }; + + &u2phy1_host { + phy-supply = <&vcc5v0_host0>; ++ status = "okay"; ++}; ++ ++&u2phy1_otg { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3_0 { ++ extcon = <&fusb0>; + }; + + &vcc5v0_sys { +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-nanopi-m4v2-dts-add-sound-card.patch b/patch/kernel/archive/rockchip64-6.10/board-nanopi-m4v2-dts-add-sound-card.patch new file mode 100644 index 000000000000..8c03adf2bfa8 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-nanopi-m4v2-dts-add-sound-card.patch @@ -0,0 +1,190 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Piotr Szczepanik +Date: Thu, 28 Nov 2019 22:29:54 +0000 +Subject: [ARCHEOLOGY] Initial addition of NanoPi M4V2 + +> X-Git-Archeology: - Revision c4eecbcef0d4dc499baf0155449e71dc774bc7c4: https://github.com/armbian/build/commit/c4eecbcef0d4dc499baf0155449e71dc774bc7c4 +> X-Git-Archeology: Date: Thu, 28 Nov 2019 22:29:54 +0000 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Initial addition of NanoPi M4V2 +> X-Git-Archeology: +> X-Git-Archeology: - Revision 40a3d4ecb9a75c17183e2129491b7bc03060a315: https://github.com/armbian/build/commit/40a3d4ecb9a75c17183e2129491b7bc03060a315 +> X-Git-Archeology: Date: Sun, 17 May 2020 18:42:24 +0200 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Fixed rt5651 codec probing after its driver was changed to module (#1969) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision e7377248b3cae186e24e2be781cd3365b43246f0: https://github.com/armbian/build/commit/e7377248b3cae186e24e2be781cd3365b43246f0 +> X-Git-Archeology: Date: Thu, 22 Jul 2021 00:15:54 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Second part of EDGE bumping to 5.13.y (#3045) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 744ea89a589d62cb6f409baab60fc6664520bc39: https://github.com/armbian/build/commit/744ea89a589d62cb6f409baab60fc6664520bc39 +> X-Git-Archeology: Date: Wed, 08 Sep 2021 17:51:34 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bumping EDGE kernel to 5.14.y (#3125) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e: https://github.com/armbian/build/commit/dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e +> X-Git-Archeology: Date: Tue, 09 Nov 2021 18:06:34 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump imx6, xu4, rockchip64 and jetson-nano to 5.15 (#3238) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 401fb1fde426c93121c4639b34a450d8ff551c85: https://github.com/armbian/build/commit/401fb1fde426c93121c4639b34a450d8ff551c85 +> X-Git-Archeology: Date: Sat, 20 Nov 2021 19:49:22 +0100 +> X-Git-Archeology: From: simple <991605149@qq.com> +> X-Git-Archeology: Subject: Fixed rt5651 codec build module (#3270) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi | 51 ++++++++++ + sound/soc/rockchip/Kconfig | 9 ++ + 2 files changed, 60 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi +index 7c5f441a2219..3e899f584871 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi +@@ -132,6 +132,27 @@ status_led: led-0 { + }; + }; + ++ rt5651-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,name = "realtek,rt5651-codec"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,widgets = ++ "Microphone", "Mic Jack", ++ "Headphone", "Headphone Jack"; ++ simple-audio-card,routing = ++ "Mic Jack", "micbias1", ++ "IN1P", "Mic Jack", ++ "Headphone Jack", "HPOL", ++ "Headphone Jack", "HPOR"; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s1>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&rt5651>; ++ }; ++ }; ++ + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk808 1>; +@@ -216,6 +237,10 @@ &hdmi_sound { + status = "okay"; + }; + ++&hdmi_sound { ++ status = "okay"; ++}; ++ + &i2c0 { + clock-frequency = <400000>; + i2c-scl-rising-time-ns = <160>; +@@ -463,6 +488,16 @@ &i2c1 { + i2c-scl-rising-time-ns = <150>; + i2c-scl-falling-time-ns = <30>; + status = "okay"; ++ ++ rt5651: rt5651@1a { ++ compatible = "realtek,rt5651"; ++ reg = <0x1a>; ++ clocks = <&cru SCLK_I2S_8CH_OUT>; ++ clock-names = "mclk"; ++ hp-det-gpio = <&gpio4 RK_PC4 GPIO_ACTIVE_LOW>; ++ // spk-con-gpio = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>; ++ #sound-dai-cells = <0>; ++ }; + }; + + &i2c2 { +@@ -494,6 +529,16 @@ &i2s2 { + status = "okay"; + }; + ++&i2s1 { ++ rockchip,playback-channels = <8>; ++ rockchip,capture-channels = <8>; ++ status = "okay"; ++}; ++ ++&i2s2 { ++ status = "okay"; ++}; ++ + &io_domains { + bt656-supply = <&vcc_1v8>; + audio-supply = <&vcca1v8_codec>; +@@ -759,3 +804,9 @@ &vopl { + &vopl_mmu { + status = "okay"; + }; ++ ++&spdif { ++ i2c-scl-rising-time-ns = <450>; ++ i2c-scl-falling-time-ns = <15>; ++ status = "okay"; ++}; +diff --git a/sound/soc/rockchip/Kconfig b/sound/soc/rockchip/Kconfig +index f98a2fa85edd..be36e36c8783 100644 +--- a/sound/soc/rockchip/Kconfig ++++ b/sound/soc/rockchip/Kconfig +@@ -65,6 +65,15 @@ config SND_SOC_ROCKCHIP_RT5645 + Say Y or M here if you want to add support for SoC audio on Rockchip + boards using the RT5645/RT5650 codec, such as Veyron. + ++config SND_SOC_ROCKCHIP_RT5651 ++ tristate "ASoC support for Rockchip boards using a RT5651 codec" ++ depends on SND_SOC_ROCKCHIP && I2C && GPIOLIB && HAVE_CLK ++ select SND_SOC_ROCKCHIP_I2S ++ select SND_SOC_RT5651 ++ help ++ Say Y or M here if you want to add support for SoC audio on Rockchip ++ boards using the RT5651 codec, such as FriendlyARM's Nano{Pi,PC} family. ++ + config SND_SOC_RK3288_HDMI_ANALOG + tristate "ASoC support multiple codecs for Rockchip RK3288 boards" + depends on SND_SOC_ROCKCHIP && I2C && GPIOLIB && HAVE_CLK +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-nanopi-r2c-plus.patch b/patch/kernel/archive/rockchip64-6.10/board-nanopi-r2c-plus.patch new file mode 100644 index 000000000000..72fe01212211 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-nanopi-r2c-plus.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: amazingfate +Date: Thu, 31 Aug 2023 11:41:37 +0200 +Subject: [ARCHEOLOGY] rockchip64: bump rockchip64-edge kernel to 6.5 + +> X-Git-Archeology: - Revision 8254411054a99f9750770bb6055facfbdedacbba: https://github.com/armbian/build/commit/8254411054a99f9750770bb6055facfbdedacbba +> X-Git-Archeology: Date: Thu, 31 Aug 2023 11:41:37 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: rockchip64: bump rockchip64-edge kernel to 6.5 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2c-plus.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2c-plus.dts b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2c-plus.dts +index 16a1958e4572..45954295d51d 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2c-plus.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2c-plus.dts +@@ -27,7 +27,7 @@ &emmc { + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; +- vmmc-supply = <&vcc_io_33>; ++ vmmc-supply = <&vcc_io>; + vqmmc-supply = <&vcc18_emmc>; + status = "okay"; + }; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-nanopi-r2s.patch b/patch/kernel/archive/rockchip64-6.10/board-nanopi-r2s.patch new file mode 100644 index 000000000000..c707061370f8 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-nanopi-r2s.patch @@ -0,0 +1,735 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Sat, 7 Jan 2023 11:59:47 +0000 +Subject: rockchip64: consolidate nanopi r2s device trees + +--- + arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts | 493 ++++++---- + 1 file changed, 328 insertions(+), 165 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +index 1445b879ac7a..7ebf21d7faac 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +@@ -1,119 +1,167 @@ + // SPDX-License-Identifier: (GPL-2.0+ OR MIT) + /* +- * Copyright (c) 2020 David Bauer ++ * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd. ++ * (http://www.friendlyarm.com) ++ * ++ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd + */ + + /dts-v1/; +- +-#include +-#include ++#include "rk3328-dram-default-timing.dtsi" + #include "rk3328.dtsi" + + / { +- model = "FriendlyElec NanoPi R2S"; +- compatible = "friendlyarm,nanopi-r2s", "rockchip,rk3328"; ++ model = "FriendlyElec boards based on Rockchip RK3328"; ++ compatible = "friendlyelec,nanopi-r2", ++ "rockchip,rk3328"; + + aliases { +- ethernet0 = &gmac2io; +- ethernet1 = &rtl8153; +- mmc0 = &sdmmc; ++ ethernet0 = &gmac2io; ++ ethernet1 = &r8153; + }; + + chosen { ++ bootargs = "swiotlb=1 coherent_pool=1m consoleblank=0"; + stdout-path = "serial2:1500000n8"; + }; + +- gmac_clk: gmac-clock { ++ gmac_clkin: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "gmac_clkin"; + #clock-cells = <0>; + }; + +- keys { +- compatible = "gpio-keys"; +- pinctrl-0 = <&reset_button_pin>; +- pinctrl-names = "default"; +- +- key-reset { +- label = "reset"; +- gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>; +- linux,code = ; +- debounce-interval = <50>; +- }; ++ mach: board { ++ compatible = "friendlyelec,board"; ++ machine = "NANOPI-R2"; ++ hwrev = <255>; ++ model = "NanoPi R2 Series"; ++ nvmem-cells = <&efuse_id>, <&efuse_cpu_version>; ++ nvmem-cell-names = "id", "cpu-version"; + }; + +- leds { ++ leds: gpio-leds { + compatible = "gpio-leds"; +- pinctrl-0 = <&lan_led_pin>, <&sys_led_pin>, <&wan_led_pin>; + pinctrl-names = "default"; ++ pinctrl-0 =<&leds_gpio>; ++ status = "disabled"; + +- lan_led: led-0 { +- gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; +- label = "nanopi-r2s:green:lan"; +- }; +- +- sys_led: led-1 { ++ led@1 { + gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; +- label = "nanopi-r2s:red:sys"; +- default-state = "on"; +- }; +- +- wan_led: led-2 { +- gpios = <&gpio2 RK_PC2 GPIO_ACTIVE_HIGH>; +- label = "nanopi-r2s:green:wan"; ++ label = "status_led"; ++ linux,default-trigger = "heartbeat"; ++ linux,default-trigger-delay-ms = <0>; + }; + }; + +- vcc_io_sdio: sdmmcio-regulator { +- compatible = "regulator-gpio"; +- enable-active-high; +- gpios = <&gpio1 RK_PD4 GPIO_ACTIVE_HIGH>; +- pinctrl-0 = <&sdio_vcc_pin>; ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ clocks = <&rk805 1>; ++ clock-names = "ext_clock"; + pinctrl-names = "default"; +- regulator-name = "vcc_io_sdio"; +- regulator-always-on; +- regulator-min-microvolt = <1800000>; +- regulator-max-microvolt = <3300000>; +- regulator-settling-time-us = <5000>; +- regulator-type = "voltage"; +- startup-delay-us = <2000>; +- states = <1800000 0x1>, +- <3300000 0x0>; +- vin-supply = <&vcc_io_33>; ++ pinctrl-0 = <&wifi_enable_h>; ++ ++ /* ++ * On the module itself this is one of these (depending ++ * on the actual card populated): ++ * - SDIO_RESET_L_WL_REG_ON ++ * - PDN (power down when low) ++ */ ++ reset-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>; ++ }; ++ ++ sdmmc_ext: dwmmc@ff5f0000 { ++ compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc"; ++ reg = <0x0 0xff5f0000 0x0 0x4000>; ++ clock-freq-min-max = <400000 150000000>; ++ clocks = <&cru HCLK_SDMMC_EXT>, <&cru SCLK_SDMMC_EXT>, ++ <&cru SCLK_SDMMC_EXT_DRV>, <&cru SCLK_SDMMC_EXT_SAMPLE>; ++ clock-names = "biu", "ciu", "ciu-drv", "ciu-sample"; ++ fifo-depth = <0x100>; ++ interrupts = ; ++ status = "disabled"; + }; + + vcc_sd: sdmmc-regulator { + compatible = "regulator-fixed"; +- gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>; +- pinctrl-0 = <&sdmmc0m1_pin>; ++ gpio = <&gpio0 30 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; +- regulator-name = "vcc_sd"; ++ pinctrl-0 = <&sdmmc0m1_pin>; + regulator-boot-on; ++ regulator-name = "vcc_sd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; +- vin-supply = <&vcc_io_33>; ++ vin-supply = <&vcc_io>; ++ }; ++ ++ vccio_sd: sdmmcio-regulator { ++ compatible = "regulator-gpio"; ++ gpios = <&gpio1 RK_PD4 GPIO_ACTIVE_HIGH>; ++ states = <1800000 0x1 ++ 3300000 0x0>; ++ regulator-name = "vccio_sd"; ++ regulator-type = "voltage"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ vin-supply = <&vcc_io>; ++ startup-delay-us = <2000>; ++ regulator-settling-time-us = <5000>; ++ enable-active-high; ++ status = "disabled"; + }; + +- vdd_5v: vdd-5v { ++ vcc_sys: vcc-sys { + compatible = "regulator-fixed"; +- regulator-name = "vdd_5v"; ++ regulator-name = "vcc_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + +- vdd_5v_lan: vdd-5v-lan { ++ vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; +- enable-active-high; +- gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>; +- pinctrl-0 = <&lan_vdd_pin>; +- pinctrl-names = "default"; +- regulator-name = "vdd_5v_lan"; ++ regulator-name = "vcc_phy"; + regulator-always-on; + regulator-boot-on; +- vin-supply = <&vdd_5v>; ++ }; ++ ++ vcc_host_vbus: host-vbus-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_host_vbus"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ /delete-node/ dmc-opp-table; ++ ++ dmc_opp_table: dmc_opp_table { ++ compatible = "operating-points-v2"; ++ ++ opp-786000000 { ++ opp-hz = /bits/ 64 <786000000>; ++ opp-microvolt = <1075000 1075000 1200000>; ++ }; ++ opp-798000000 { ++ opp-hz = /bits/ 64 <798000000>; ++ opp-microvolt = <1075000 1075000 1200000>; ++ }; ++ opp-840000000 { ++ opp-hz = /bits/ 64 <840000000>; ++ opp-microvolt = <1075000 1075000 1200000>; ++ }; ++ opp-924000000 { ++ opp-hz = /bits/ 64 <924000000>; ++ opp-microvolt = <1100000 1100000 1200000>; ++ }; ++ opp-1056000000 { ++ opp-hz = /bits/ 64 <1056000000>; ++ opp-microvolt = <1175000 1175000 1200000>; ++ }; + }; + }; + +@@ -120,34 +168,57 @@ &cpu0 { + cpu-supply = <&vdd_arm>; + }; + +-&cpu1 { +- cpu-supply = <&vdd_arm>; ++&dfi { ++ status = "okay"; + }; + +-&cpu2 { +- cpu-supply = <&vdd_arm>; ++&dmc { ++ center-supply = <&vdd_logic>; ++ ddr_timing = <&ddr_timing>; ++ status = "okay"; + }; + +-&cpu3 { +- cpu-supply = <&vdd_arm>; ++&emmc { ++ bus-width = <8>; ++ cap-mmc-highspeed; ++ max-frequency = <150000000>; ++ mmc-hs200-1_8v; ++ no-sd; ++ non-removable; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; ++ vmmc-supply = <&vcc_io>; ++ vqmmc-supply = <&vcc18_emmc>; ++ status = "okay"; + }; + +-&display_subsystem { ++&gmac2phy { ++ phy-supply = <&vcc_phy>; ++ clock_in_out = "output"; ++ assigned-clocks = <&cru SCLK_MAC2PHY_SRC>; ++ assigned-clock-rate = <50000000>; ++ assigned-clocks = <&cru SCLK_MAC2PHY>; ++ assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>; + status = "disabled"; + }; + + &gmac2io { + assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>; +- assigned-clock-parents = <&gmac_clk>, <&gmac_clk>; ++ assigned-clock-parents = <&gmac_clkin>, <&gmac_clkin>; + clock_in_out = "input"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rgmiim1_pins>; + phy-handle = <&rtl8211e>; + phy-mode = "rgmii"; +- phy-supply = <&vcc_io_33>; +- pinctrl-0 = <&rgmiim1_pins>; +- pinctrl-names = "default"; +- rx_delay = <0x18>; ++ phy-supply = <&vcc_phy>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 30000>; ++ snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; + snps,aal; ++ snps,rxpbl = <0x4>; ++ snps,txpbl = <0x4>; + tx_delay = <0x24>; ++ rx_delay = <0x18>; + status = "okay"; + + mdio { +@@ -155,13 +226,11 @@ mdio { + #address-cells = <1>; + #size-cells = <0>; + +- rtl8211e: ethernet-phy@1 { +- reg = <1>; +- pinctrl-0 = <ð_phy_reset_pin>; +- pinctrl-names = "default"; ++ rtl8211e: phy@0 { ++ reg = <0>; + reset-assert-us = <10000>; +- reset-deassert-us = <50000>; +- reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; ++ reset-deassert-us = <30000>; ++ /* reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; */ + }; + }; + }; +@@ -169,36 +238,35 @@ rtl8211e: ethernet-phy@1 { + &i2c1 { + status = "okay"; + +- rk805: pmic@18 { ++ rk805: rk805@18 { + compatible = "rockchip,rk805"; + reg = <0x18>; +- interrupt-parent = <&gpio1>; +- interrupts = <24 IRQ_TYPE_LEVEL_LOW>; ++ interrupt-parent = <&gpio2>; ++ interrupts = <6 IRQ_TYPE_LEVEL_LOW>; + #clock-cells = <1>; + clock-output-names = "xin32k", "rk805-clkout2"; + gpio-controller; + #gpio-cells = <2>; +- pinctrl-0 = <&pmic_int_l>; + pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l>; + rockchip,system-power-controller; + wakeup-source; + +- vcc1-supply = <&vdd_5v>; +- vcc2-supply = <&vdd_5v>; +- vcc3-supply = <&vdd_5v>; +- vcc4-supply = <&vdd_5v>; +- vcc5-supply = <&vcc_io_33>; +- vcc6-supply = <&vdd_5v>; ++ vcc1-supply = <&vcc_sys>; ++ vcc2-supply = <&vcc_sys>; ++ vcc3-supply = <&vcc_sys>; ++ vcc4-supply = <&vcc_sys>; ++ vcc5-supply = <&vcc_io>; ++ vcc6-supply = <&vcc_io>; + + regulators { +- vdd_log: DCDC_REG1 { +- regulator-name = "vdd_log"; +- regulator-always-on; +- regulator-boot-on; ++ vdd_logic: DCDC_REG1 { ++ regulator-name = "vdd_logic"; ++ regulator-init-microvolt = <1075000>; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1450000>; +- regulator-ramp-delay = <12500>; +- ++ regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; +@@ -207,12 +275,11 @@ regulator-state-mem { + + vdd_arm: DCDC_REG2 { + regulator-name = "vdd_arm"; +- regulator-always-on; +- regulator-boot-on; ++ regulator-init-microvolt = <1225000>; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1450000>; +- regulator-ramp-delay = <12500>; +- ++ regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <950000>; +@@ -223,19 +290,17 @@ vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; +- + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + +- vcc_io_33: DCDC_REG4 { +- regulator-name = "vcc_io_33"; +- regulator-always-on; +- regulator-boot-on; ++ vcc_io: DCDC_REG4 { ++ regulator-name = "vcc_io"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; +- ++ regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; +@@ -244,11 +309,10 @@ regulator-state-mem { + + vcc_18: LDO_REG1 { + regulator-name = "vcc_18"; +- regulator-always-on; +- regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; +- ++ regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; +@@ -257,11 +321,10 @@ regulator-state-mem { + + vcc18_emmc: LDO_REG2 { + regulator-name = "vcc18_emmc"; +- regulator-always-on; +- regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; +- ++ regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; +@@ -270,11 +333,10 @@ regulator-state-mem { + + vdd_10: LDO_REG3 { + regulator-name = "vdd_10"; +- regulator-always-on; +- regulator-boot-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1000000>; +- ++ regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; +@@ -285,20 +347,21 @@ regulator-state-mem { + }; + + &io_domains { +- pmuio-supply = <&vcc_io_33>; +- vccio1-supply = <&vcc_io_33>; +- vccio2-supply = <&vcc18_emmc>; +- vccio3-supply = <&vcc_io_sdio>; +- vccio4-supply = <&vcc_18>; +- vccio5-supply = <&vcc_io_33>; +- vccio6-supply = <&vcc_io_33>; + status = "okay"; ++ ++ vccio1-supply = <&vcc_io>; ++ vccio2-supply = <&vcc18_emmc>; ++ vccio3-supply = <&vcc_io>; ++ vccio4-supply = <&vcc_io>; ++ vccio5-supply = <&vcc_io>; ++ vccio6-supply = <&vcc_18>; ++ pmuio-supply = <&vcc_io>; + }; + + &pinctrl { +- button { +- reset_button_pin: reset-button-pin { +- rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + +@@ -308,61 +371,165 @@ eth_phy_reset_pin: eth-phy-reset-pin { + }; + }; + +- leds { +- lan_led_pin: lan-led-pin { +- rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = <3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; ++ }; + +- sys_led_pin: sys-led-pin { +- rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ sdmmc0 { ++ sdmmc0_clk: sdmmc0-clk { ++ rockchip,pins = <1 RK_PA6 1 &pcfg_pull_none_4ma>; ++ }; ++ ++ sdmmc0_cmd: sdmmc0-cmd { ++ rockchip,pins = <1 RK_PA4 1 &pcfg_pull_up_4ma>; + }; + +- wan_led_pin: wan-led-pin { +- rockchip,pins = <2 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; ++ sdmmc0_dectn: sdmmc0-dectn { ++ rockchip,pins = <1 RK_PA5 1 &pcfg_pull_up_4ma>; ++ }; ++ ++ sdmmc0_bus4: sdmmc0-bus4 { ++ rockchip,pins = ++ <1 RK_PA0 1 &pcfg_pull_up_4ma>, ++ <1 RK_PA1 1 &pcfg_pull_up_4ma>, ++ <1 RK_PA2 1 &pcfg_pull_up_4ma>, ++ <1 RK_PA3 1 &pcfg_pull_up_4ma>; + }; + }; + +- lan { +- lan_vdd_pin: lan-vdd-pin { +- rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; ++ sdmmc0ext { ++ sdmmc0ext_clk: sdmmc0ext-clk { ++ rockchip,pins = <3 RK_PA2 3 &pcfg_pull_none_2ma>; ++ }; ++ ++ sdmmc0ext_cmd: sdmmc0ext-cmd { ++ rockchip,pins = <3 RK_PA0 3 &pcfg_pull_up_2ma>; ++ }; ++ ++ sdmmc0ext_bus4: sdmmc0ext-bus4 { ++ rockchip,pins = ++ <3 RK_PA4 3 &pcfg_pull_up_2ma>, ++ <3 RK_PA5 3 &pcfg_pull_up_2ma>, ++ <3 RK_PA6 3 &pcfg_pull_up_2ma>, ++ <3 RK_PA7 3 &pcfg_pull_up_2ma>; + }; + }; + +- pmic { +- pmic_int_l: pmic-int-l { +- rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; ++ gmac-1 { ++ rgmiim1_pins: rgmiim1-pins { ++ rockchip,pins = ++ /* mac_txclk */ ++ <1 RK_PB4 2 &pcfg_pull_none_4ma>, ++ /* mac_rxclk */ ++ <1 RK_PB5 2 &pcfg_pull_none>, ++ /* mac_mdio */ ++ <1 RK_PC3 2 &pcfg_pull_none_2ma>, ++ /* mac_txen */ ++ <1 RK_PD1 2 &pcfg_pull_none_4ma>, ++ /* mac_clk */ ++ <1 RK_PC5 2 &pcfg_pull_none_2ma>, ++ /* mac_rxdv */ ++ <1 RK_PC6 2 &pcfg_pull_none>, ++ /* mac_mdc */ ++ <1 RK_PC7 2 &pcfg_pull_none_2ma>, ++ /* mac_rxd1 */ ++ <1 RK_PB2 2 &pcfg_pull_none>, ++ /* mac_rxd0 */ ++ <1 RK_PB3 2 &pcfg_pull_none>, ++ /* mac_txd1 */ ++ <1 RK_PB0 2 &pcfg_pull_none_4ma>, ++ /* mac_txd0 */ ++ <1 RK_PB1 2 &pcfg_pull_none_4ma>, ++ /* mac_rxd3 */ ++ <1 RK_PB6 2 &pcfg_pull_none>, ++ /* mac_rxd2 */ ++ <1 RK_PB7 2 &pcfg_pull_none>, ++ /* mac_txd3 */ ++ <1 RK_PC0 2 &pcfg_pull_none_4ma>, ++ /* mac_txd2 */ ++ <1 RK_PC1 2 &pcfg_pull_none_4ma>, ++ ++ /* mac_txclk */ ++ <0 RK_PB0 1 &pcfg_pull_none>, ++ /* mac_txen */ ++ <0 RK_PB4 1 &pcfg_pull_none>, ++ /* mac_clk */ ++ <0 RK_PD0 1 &pcfg_pull_none>, ++ /* mac_txd1 */ ++ <0 RK_PC0 1 &pcfg_pull_none>, ++ /* mac_txd0 */ ++ <0 RK_PC1 1 &pcfg_pull_none>, ++ /* mac_txd3 */ ++ <0 RK_PC7 1 &pcfg_pull_none>, ++ /* mac_txd2 */ ++ <0 RK_PC6 1 &pcfg_pull_none>; + }; + }; + +- sd { +- sdio_vcc_pin: sdio-vcc-pin { +- rockchip,pins = <1 RK_PD4 RK_FUNC_GPIO &pcfg_pull_up>; ++ usb { ++ host_vbus_drv: host-vbus-drv { ++ rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ otg_vbus_drv: otg-vbus-drv { ++ rockchip,pins = <3 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; ++ ++ gpio-leds { ++ leds_gpio: leds-gpio { ++ rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; + }; + +-&pwm2 { ++&sdmmc { ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ max-frequency = <150000000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>; ++ vmmc-supply = <&vcc_sd>; + status = "okay"; + }; + +-&sdmmc { ++&sdmmc_ext { + bus-width = <4>; + cap-sd-highspeed; ++ cap-sdio-irq; + disable-wp; +- pinctrl-0 = <&sdmmc0_clk>, <&sdmmc0_cmd>, <&sdmmc0_dectn>, <&sdmmc0_bus4>; ++ keep-power-in-suspend; ++ max-frequency = <100000000>; ++ mmc-pwrseq = <&sdio_pwrseq>; ++ non-removable; ++ num-slots = <1>; + pinctrl-names = "default"; +- sd-uhs-sdr12; +- sd-uhs-sdr25; +- sd-uhs-sdr50; ++ pinctrl-0 = <&sdmmc0ext_clk &sdmmc0ext_cmd &sdmmc0ext_bus4>; ++ rockchip,default-sample-phase = <120>; ++ supports-sdio; + sd-uhs-sdr104; +- vmmc-supply = <&vcc_sd>; +- vqmmc-supply = <&vcc_io_sdio>; ++ #address-cells = <1>; ++ #size-cells = <0>; + status = "okay"; ++ ++ brcmf: bcrmf@1 { ++ reg = <1>; ++ compatible = "brcm,bcm4329-fmac"; ++ interrupt-parent = <&gpio1>; ++ interrupts = ; ++ interrupt-names = "host-wake"; ++ }; + }; + + &tsadc { +- rockchip,hw-tshut-mode = <0>; +- rockchip,hw-tshut-polarity = <0>; ++ status = "okay"; ++}; ++ ++&uart2 { + status = "okay"; + }; + +@@ -378,13 +545,16 @@ &u2phy_otg { + status = "okay"; + }; + +-&uart2 { ++&usb20_otg { + status = "okay"; + }; + +-&usb20_otg { ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { + status = "okay"; +- dr_mode = "host"; + }; + + &usbdrd3 { +@@ -393,17 +563,10 @@ &usbdrd3 { + #address-cells = <1>; + #size-cells = <0>; + +- /* Second port is for USB 3.0 */ +- rtl8153: device@2 { ++ r8153: device@2 { + compatible = "usbbda,8153"; + reg = <2>; ++ realtek,led-data = <0x87>; ++ local-mac-address = [00 00 00 00 00 00]; + }; + }; +- +-&usb_host0_ehci { +- status = "okay"; +-}; +- +-&usb_host0_ohci { +- status = "okay"; +-}; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-nanopi-r4s-pwmfan.patch b/patch/kernel/archive/rockchip64-6.10/board-nanopi-r4s-pwmfan.patch new file mode 100644 index 000000000000..2fb280e546cd --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-nanopi-r4s-pwmfan.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Bochun Bai +Date: Sun, 18 Jun 2023 11:56:34 +0200 +Subject: Add pwm-fan support to nanopi r4s + +--- + arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 35 ++++++++++ + 1 file changed, 35 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +index fe5b52610010..10cc254fd1dc 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +@@ -62,6 +62,41 @@ vdd_5v: vdd-5v { + regulator-always-on; + regulator-boot-on; + }; ++ ++ fan: pwm-fan { ++ compatible = "pwm-fan"; ++ cooling-levels = <0 18 102 170 255>; ++ fan-supply = <&vdd_5v>; ++ pwms = <&pwm1 0 50000 0>; ++ }; ++}; ++ ++&cpu_thermal { ++ trips { ++ cpu_warm: cpu_warm { ++ temperature = <55000>; ++ hysteresis = <2000>; ++ type = "active"; ++ }; ++ ++ cpu_hot: cpu_hot { ++ temperature = <65000>; ++ hysteresis = <2000>; ++ type = "active"; ++ }; ++ }; ++ ++ cooling-maps { ++ map2 { ++ trip = <&cpu_warm>; ++ cooling-device = <&fan THERMAL_NO_LIMIT 1>; ++ }; ++ ++ map3 { ++ trip = <&cpu_hot>; ++ cooling-device = <&fan 2 THERMAL_NO_LIMIT>; ++ }; ++ }; + }; + + &emmc_phy { +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-orangepi-r1-plus.patch b/patch/kernel/archive/rockchip64-6.10/board-orangepi-r1-plus.patch new file mode 100644 index 000000000000..7cb0c747bf7b --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-orangepi-r1-plus.patch @@ -0,0 +1,216 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Igor Pecovnik +Date: Sat, 20 Jun 2020 22:39:57 +0200 +Subject: [ARCHEOLOGY] Initial ROCK Pi E support (as WIP) (#2042) + +> X-Git-Archeology: > recovered message: > * WIP: Adding RockpiE config +> X-Git-Archeology: > recovered message: > Signed-off-by: Igor Pecovnik +> X-Git-Archeology: > recovered message: > * Mainline u-boot for ROCK Pi E +> X-Git-Archeology: > recovered message: > * Initial ROCK Pi E device tree in kernel +> X-Git-Archeology: > recovered message: > * Fixed supplies for ROCK Pi E device tree +> X-Git-Archeology: > recovered message: > * Adjusted u-boot load address for rockchip64 boards with 256MB eg. ROCK Pi E +> X-Git-Archeology: > recovered message: > * Blacklisted lima on ROCK Pi E +> X-Git-Archeology: > recovered message: > * Fixed ROCK Pi E patch after merge from master +> X-Git-Archeology: > recovered message: > * Removed mode settings from rk805 regulators +> X-Git-Archeology: > recovered message: > * Fixed issues with offloading for gigabit interface of RockPi E +> X-Git-Archeology: > recovered message: > * Adjusted ROCK Pi E board config +> X-Git-Archeology: > recovered message: > * Added dev branch for ROCK Pi E +> X-Git-Archeology: > recovered message: > * Add build targets +> X-Git-Archeology: > recovered message: > Signed-off-by: Igor Pecovnik +> X-Git-Archeology: > recovered message: > * Exchange legacy to current in ROCK Pi E build targets +> X-Git-Archeology: > recovered message: > Co-authored-by: Piotr Szczepanik +> X-Git-Archeology: - Revision e1ecb098330dc372740371dc2386f911833a0529: https://github.com/armbian/build/commit/e1ecb098330dc372740371dc2386f911833a0529 +> X-Git-Archeology: Date: Sat, 20 Jun 2020 22:39:57 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Initial ROCK Pi E support (as WIP) (#2042) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 72257bd0648c28fca32962126bb885a4a2c188cc: https://github.com/armbian/build/commit/72257bd0648c28fca32962126bb885a4a2c188cc +> X-Git-Archeology: Date: Tue, 23 Jun 2020 16:37:54 +0200 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Make USB3 support of ROCK Pi E on par with other rk3328 boards (#2050) +> X-Git-Archeology: +> X-Git-Archeology: - Revision e36ce875b025e112127cf8cc2d34825ebfe36569: https://github.com/armbian/build/commit/e36ce875b025e112127cf8cc2d34825ebfe36569 +> X-Git-Archeology: Date: Tue, 10 Nov 2020 21:43:13 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switched rockchip64-current to linux 5.9.y (#2309) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ccbc888b3f5731790128684959b55b6552e26190: https://github.com/armbian/build/commit/ccbc888b3f5731790128684959b55b6552e26190 +> X-Git-Archeology: Date: Sat, 28 Nov 2020 16:52:34 +0100 +> X-Git-Archeology: From: Oleg +> X-Git-Archeology: Subject: add dts rk3328-roc-pc, fix WIFI and USB 3.0 rk3328 (#2390) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 25bd76527e1276c4c00829f68c0ca0742ecc94c1: https://github.com/armbian/build/commit/25bd76527e1276c4c00829f68c0ca0742ecc94c1 +> X-Git-Archeology: Date: Sat, 28 Nov 2020 18:10:53 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Fix roc-rk3328-pc device tree reference to missing RK_FUNC_1 +> X-Git-Archeology: +> X-Git-Archeology: - Revision dfd5cf9692e97774f7f0bfd72227144e36f58070: https://github.com/armbian/build/commit/dfd5cf9692e97774f7f0bfd72227144e36f58070 +> X-Git-Archeology: Date: Sun, 13 Dec 2020 22:13:03 -0500 +> X-Git-Archeology: From: tonymac32 +> X-Git-Archeology: Subject: [ rockchip64 ] Clean up patchset +> X-Git-Archeology: +> X-Git-Archeology: - Revision 25e0f1633467c020f6ae68d09964a522fbfbe613: https://github.com/armbian/build/commit/25e0f1633467c020f6ae68d09964a522fbfbe613 +> X-Git-Archeology: Date: Mon, 18 Jan 2021 23:21:40 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Adjusted power and pmic configuration for Station M1 in current/dev +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision d8dbefd61838e5b0cfc2b93d2d168f3fb2666dfb: https://github.com/armbian/build/commit/d8dbefd61838e5b0cfc2b93d2d168f3fb2666dfb +> X-Git-Archeology: Date: Tue, 27 Jul 2021 00:05:09 -0400 +> X-Git-Archeology: From: tonymac32 +> X-Git-Archeology: Subject: [ rockchip64 ] rk3328 change to mainline USB3 +> X-Git-Archeology: +> X-Git-Archeology: - Revision a16699260fb786a4d89a1c335722e9fed49d19d2: https://github.com/armbian/build/commit/a16699260fb786a4d89a1c335722e9fed49d19d2 +> X-Git-Archeology: Date: Fri, 08 Jul 2022 22:35:59 +1200 +> X-Git-Archeology: From: schwar3kat <61094841+schwar3kat@users.noreply.github.com> +> X-Git-Archeology: Subject: Refactored orangepi-r1plus-lts dts in kernel add board patch +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8648dde23ff090b5fb704adab036ed14cd944ba3: https://github.com/armbian/build/commit/8648dde23ff090b5fb704adab036ed14cd944ba3 +> X-Git-Archeology: Date: Thu, 22 Sep 2022 10:25:28 +0200 +> X-Git-Archeology: From: aiamadeus <42570690+aiamadeus@users.noreply.github.com> +> X-Git-Archeology: Subject: rockchip: fixes support for orangepi-r1plus (#4215) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 85bab47bba73e0ef0e4ea5fde60e0aab56f82906: https://github.com/armbian/build/commit/85bab47bba73e0ef0e4ea5fde60e0aab56f82906 +> X-Git-Archeology: Date: Sat, 06 May 2023 12:55:10 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +> X-Git-Archeology: - Revision 906ca66430329ab774f5b9d0f62eef1ce5e398fe: https://github.com/armbian/build/commit/906ca66430329ab774f5b9d0f62eef1ce5e398fe +> X-Git-Archeology: Date: Tue, 16 May 2023 08:55:33 +0200 +> X-Git-Archeology: From: Ricardo Pardini +> X-Git-Archeology: Subject: `rockchip64`/`edge`/`6.3`: rebase/rewrite patches against `v6.3.1`; do archeology for mbox-less patches; materialize overwrites +> X-Git-Archeology: +> X-Git-Archeology: - Revision 19d532b13cabc1a749f61b9c400d933ba5aeb7e3: https://github.com/armbian/build/commit/19d532b13cabc1a749f61b9c400d933ba5aeb7e3 +> X-Git-Archeology: Date: Tue, 13 Jun 2023 12:33:59 +0200 +> X-Git-Archeology: From: Ricardo Pardini +> X-Git-Archeology: Subject: `rockchip64` `edge` 6.3: rename most remaining "add-board" patches to "board" (all "add-board"s are now bare .dts in `dt/` folder) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 41ade999f04c26a277cfa1c3c721cbe869d3ad12: https://github.com/armbian/build/commit/41ade999f04c26a277cfa1c3c721cbe869d3ad12 +> X-Git-Archeology: Date: Tue, 03 Oct 2023 13:54:03 +0200 +> X-Git-Archeology: From: Ricardo Pardini +> X-Git-Archeology: Subject: `rockchip64`/`edge`: bump to `6.6-rc4`; initial copy patches from 6.5 +> X-Git-Archeology: +> X-Git-Archeology: - Revision 1f4df4c41fe33f9822ca2f42d14a2a445e27aed7: https://github.com/armbian/build/commit/1f4df4c41fe33f9822ca2f42d14a2a445e27aed7 +> X-Git-Archeology: Date: Sun, 14 Jan 2024 14:14:50 +0100 +> X-Git-Archeology: From: Paolo Sabatino +> X-Git-Archeology: Subject: rockchip64: bump edge to 6.7, current to 6.6 +> X-Git-Archeology: +> X-Git-Archeology: - Revision e4d413b9166e3633b40fb23382fb1045b9d0e315: https://github.com/armbian/build/commit/e4d413b9166e3633b40fb23382fb1045b9d0e315 +> X-Git-Archeology: Date: Tue, 26 Mar 2024 13:46:35 +0100 +> X-Git-Archeology: From: Paolo Sabatino +> X-Git-Archeology: Subject: rockchip64: bump edge kernel to 6.8 +> X-Git-Archeology: +> X-Git-Archeology: - Revision fae4549764c548cb65d3cbfe319f1e11bc777505: https://github.com/armbian/build/commit/fae4549764c548cb65d3cbfe319f1e11bc777505 +> X-Git-Archeology: Date: Thu, 04 Apr 2024 13:38:18 +0800 +> X-Git-Archeology: From: aiamadeus <2789289348@qq.com> +> X-Git-Archeology: Subject: rockchip: update dts patches for orangepi r1-plus +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts | 45 ++++++++++ + 1 file changed, 45 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts b/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts +index f20662929c77..c55d79e12f16 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts +@@ -8,6 +8,7 @@ + + #include + #include ++#include "rk3328-dram-default-timing.dtsi" + #include "rk3328.dtsi" + + / { +@@ -86,6 +87,33 @@ vdd_5v_lan: vdd-5v-lan-regulator { + regulator-boot-on; + vin-supply = <&vcc_sys>; + }; ++ ++ /delete-node/ dmc-opp-table; ++ ++ dmc_opp_table: dmc_opp_table { ++ compatible = "operating-points-v2"; ++ ++ opp-786000000 { ++ opp-hz = /bits/ 64 <786000000>; ++ opp-microvolt = <1075000 1075000 1200000>; ++ }; ++ opp-798000000 { ++ opp-hz = /bits/ 64 <798000000>; ++ opp-microvolt = <1075000 1075000 1200000>; ++ }; ++ opp-840000000 { ++ opp-hz = /bits/ 64 <840000000>; ++ opp-microvolt = <1075000 1075000 1200000>; ++ }; ++ opp-924000000 { ++ opp-hz = /bits/ 64 <924000000>; ++ opp-microvolt = <1100000 1100000 1200000>; ++ }; ++ opp-1056000000 { ++ opp-hz = /bits/ 64 <1056000000>; ++ opp-microvolt = <1175000 1175000 1200000>; ++ }; ++ }; + }; + + &cpu0 { +@@ -108,6 +136,16 @@ &display_subsystem { + status = "disabled"; + }; + ++&dfi { ++ status = "okay"; ++}; ++ ++&dmc { ++ center-supply = <&vdd_log>; ++ ddr_timing = <&ddr_timing>; ++ status = "okay"; ++}; ++ + &gmac2io { + assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>; + assigned-clock-parents = <&gmac_clk>, <&gmac_clk>; +@@ -138,6 +176,10 @@ rtl8211e: ethernet-phy@1 { + }; + }; + ++&i2c0 { ++ status = "okay"; ++}; ++ + &i2c1 { + status = "okay"; + +@@ -167,6 +209,7 @@ vdd_log: DCDC_REG1 { + regulator-name = "vdd_log"; + regulator-always-on; + regulator-boot-on; ++ regulator-init-microvolt = <1075000>; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1450000>; + regulator-ramp-delay = <12500>; +@@ -181,6 +224,7 @@ vdd_arm: DCDC_REG2 { + regulator-name = "vdd_arm"; + regulator-always-on; + regulator-boot-on; ++ regulator-init-microvolt = <1225000>; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1450000>; + regulator-ramp-delay = <12500>; +@@ -362,6 +406,7 @@ &usbdrd3 { + rtl8153: device@2 { + compatible = "usbbda,8153"; + reg = <2>; ++ realtek,led-data = <0x87>; + }; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-orangepi-rk3399-pcie.patch b/patch/kernel/archive/rockchip64-6.10/board-orangepi-rk3399-pcie.patch new file mode 100644 index 000000000000..dfbf219abd24 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-orangepi-rk3399-pcie.patch @@ -0,0 +1,68 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: amazingfate +Date: Thu, 18 Apr 2024 00:42:13 +0800 +Subject: arm64: dts: rockchip: add pcie support to orangepi rk3399 board + +--- + arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts | 31 ++++++++++ + 1 file changed, 31 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts b/arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts +index e7551449e718..fc23d4733509 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts +@@ -124,6 +124,17 @@ vcc3v0_sd: vcc3v0-sd { + vin-supply = <&vcc3v3_sys>; + }; + ++ vcc3v3_pcie: vcc3v3-pcie-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio0 2 0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_drv>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-name = "vcc3v3_pcie"; ++ }; ++ + vcc3v3_sys: vcc3v3-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_sys"; +@@ -588,6 +599,20 @@ &io_domains { + gpio1830-supply = <&vcc_3v0>; + }; + ++&pcie_phy { ++ status = "okay"; ++ assigned-clocks = <&cru 138>; ++ assigned-clock-parents = <&cru 167>; ++ assigned-clock-rates = <100000000>; ++}; ++ ++&pcie0 { ++ status = "okay"; ++ ep-gpios = <&gpio2 4 0>; ++ num-lanes = <4>; ++ max-link-speed = <1>; ++}; ++ + &pmu_io_domains { + status = "okay"; + pmu1830-supply = <&vcc_3v0>; +@@ -610,6 +635,12 @@ phy_rstb: phy-rstb { + }; + }; + ++ pcie { ++ pcie_drv: pcie-drv { ++ rockchip,pins = <0 2 0 &pcfg_pull_none>; ++ }; ++ }; ++ + pmic { + cpu_b_sleep: cpu-b-sleep { + rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-pbp-add-dp-alt-mode.patch b/patch/kernel/archive/rockchip64-6.10/board-pbp-add-dp-alt-mode.patch new file mode 100644 index 000000000000..6e29666c547e --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-pbp-add-dp-alt-mode.patch @@ -0,0 +1,421 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dan Johansen +Date: Tue, 2 Jun 2020 20:20:29 +0200 +Subject: add-dp-alt-mode-to-PBP + +--- + arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts | 5 + + drivers/phy/rockchip/phy-rockchip-typec.c | 17 ++ + drivers/usb/typec/altmodes/displayport.c | 52 +++- + drivers/usb/typec/tcpm/tcpm.c | 139 +++++++++- + 4 files changed, 210 insertions(+), 3 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts +index 054c6a4d1a45..48b865d30b14 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts +@@ -422,6 +422,7 @@ edp_out_panel: endpoint@0 { + + &emmc_phy { + status = "okay"; ++ extcon = <&fusb0>; + }; + + &gpu { +@@ -706,6 +707,9 @@ connector { + ; + try-power-role = "sink"; + ++ extcon-cables = <1 2 5 6 9 10 12 44>; ++ typec-altmodes = <0xff01 1 0x001c0000 1>; ++ + ports { + #address-cells = <1>; + #size-cells = <0>; +@@ -972,6 +976,7 @@ spiflash: flash@0 { + }; + + &tcphy0 { ++ extcon = <&fusb0>; + status = "okay"; + }; + +diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c +index 4efcb78b0ab1..6a641d9f752c 100644 +--- a/drivers/phy/rockchip/phy-rockchip-typec.c ++++ b/drivers/phy/rockchip/phy-rockchip-typec.c +@@ -40,6 +40,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -1156,6 +1157,22 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev) + dev_err(dev, "Invalid or missing extcon\n"); + return PTR_ERR(tcphy->extcon); + } ++ } else { ++ extcon_set_property_capability(tcphy->extcon, EXTCON_USB, ++ EXTCON_PROP_USB_SS); ++ extcon_set_property_capability(tcphy->extcon, EXTCON_USB_HOST, ++ EXTCON_PROP_USB_SS); ++ extcon_set_property_capability(tcphy->extcon, EXTCON_DISP_DP, ++ EXTCON_PROP_USB_SS); ++ extcon_set_property_capability(tcphy->extcon, EXTCON_USB, ++ EXTCON_PROP_USB_TYPEC_POLARITY); ++ extcon_set_property_capability(tcphy->extcon, EXTCON_USB_HOST, ++ EXTCON_PROP_USB_TYPEC_POLARITY); ++ extcon_set_property_capability(tcphy->extcon, EXTCON_DISP_DP, ++ EXTCON_PROP_USB_TYPEC_POLARITY); ++ extcon_sync(tcphy->extcon, EXTCON_USB); ++ extcon_sync(tcphy->extcon, EXTCON_USB_HOST); ++ extcon_sync(tcphy->extcon, EXTCON_DISP_DP); + } + + pm_runtime_enable(dev); +diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c +index 59e0218a8bc5..5b046eb1fad7 100644 +--- a/drivers/usb/typec/altmodes/displayport.c ++++ b/drivers/usb/typec/altmodes/displayport.c +@@ -9,6 +9,8 @@ + */ + + #include ++#include ++#include + #include + #include + #include +@@ -69,6 +71,8 @@ struct dp_altmode { + struct fwnode_handle *connector_fwnode; + }; + ++void dp_altmode_update_extcon(struct dp_altmode *dp, bool disconnect); ++ + static int dp_altmode_notify(struct dp_altmode *dp) + { + unsigned long conf; +@@ -77,7 +81,9 @@ static int dp_altmode_notify(struct dp_altmode *dp) + if (dp->data.conf) { + state = get_count_order(DP_CONF_GET_PIN_ASSIGN(dp->data.conf)); + conf = TYPEC_MODAL_STATE(state); ++ dp_altmode_update_extcon(dp, false); + } else { ++ dp_altmode_update_extcon(dp, true); + conf = TYPEC_STATE_USB; + } + +@@ -163,6 +169,40 @@ static int dp_altmode_status_update(struct dp_altmode *dp) + return ret; + } + ++void dp_altmode_update_extcon(struct dp_altmode *dp, bool disconnect) { ++ const struct device *dev = &dp->port->dev; ++ struct extcon_dev* edev = NULL; ++ ++ while (dev) { ++ edev = extcon_find_edev_by_node(dev->of_node); ++ if(!IS_ERR(edev)) { ++ break; ++ } ++ dev = dev->parent; ++ } ++ ++ if (IS_ERR_OR_NULL(edev)) { ++ return; ++ } ++ ++ if (disconnect || !dp->data.conf) { ++ extcon_set_state_sync(edev, EXTCON_DISP_DP, false); ++ } else { ++ union extcon_property_value extcon_true = { .intval = true }; ++ extcon_set_state(edev, EXTCON_DISP_DP, true); ++ if (DP_CONF_GET_PIN_ASSIGN(dp->data.conf) & DP_PIN_ASSIGN_MULTI_FUNC_MASK) { ++ extcon_set_state_sync(edev, EXTCON_USB_HOST, true); ++ extcon_set_property(edev, EXTCON_DISP_DP, EXTCON_PROP_USB_SS, ++ extcon_true); ++ } else { ++ extcon_set_state_sync(edev, EXTCON_USB_HOST, false); ++ } ++ extcon_sync(edev, EXTCON_DISP_DP); ++ extcon_set_state_sync(edev, EXTCON_USB, false); ++ } ++ ++} ++ + static int dp_altmode_configured(struct dp_altmode *dp) + { + sysfs_notify(&dp->alt->dev.kobj, "displayport", "configuration"); +@@ -242,6 +282,8 @@ static void dp_altmode_work(struct work_struct *work) + case DP_STATE_EXIT: + if (typec_altmode_exit(dp->alt)) + dev_err(&dp->alt->dev, "Exit Mode Failed!\n"); ++ else ++ dp_altmode_update_extcon(dp, true); + break; + default: + break; +@@ -579,8 +621,14 @@ int dp_altmode_probe(struct typec_altmode *alt) + if (!(DP_CAP_PIN_ASSIGN_DFP_D(port->vdo) & + DP_CAP_PIN_ASSIGN_UFP_D(alt->vdo)) && + !(DP_CAP_PIN_ASSIGN_UFP_D(port->vdo) & +- DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo))) +- return -ENODEV; ++ DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo))) { ++ dev_err(&alt->dev, "No compatible pin configuration found:"\ ++ "%04lx -> %04lx, %04lx <- %04lx", ++ DP_CAP_PIN_ASSIGN_DFP_D(port->vdo), DP_CAP_PIN_ASSIGN_UFP_D(alt->vdo), ++ DP_CAP_PIN_ASSIGN_UFP_D(port->vdo), DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo)); ++ return -ENODEV; ++ } ++ + + ret = sysfs_create_group(&alt->dev.kobj, &dp_altmode_group); + if (ret) +diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c +index d962f67c95ae..5ac809870867 100644 +--- a/drivers/usb/typec/tcpm/tcpm.c ++++ b/drivers/usb/typec/tcpm/tcpm.c +@@ -8,6 +8,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -552,6 +552,12 @@ struct tcpm_port { + */ + unsigned int message_id_prime; + unsigned int rx_msgid_prime; ++ ++#ifdef CONFIG_EXTCON ++ struct extcon_dev *extcon; ++ unsigned int *extcon_cables; ++#endif ++ + #ifdef CONFIG_DEBUG_FS + struct dentry *dentry; + struct mutex logbuffer_lock; /* log buffer access lock */ +@@ -879,6 +886,35 @@ static void tcpm_ams_finish(struct tcpm_port *port) + port->ams = NONE_AMS; + } + ++static void tcpm_update_extcon_data(struct tcpm_port *port, bool attached) { ++#ifdef CONFIG_EXTCON ++ unsigned int *capability = port->extcon_cables; ++ if (port->data_role == TYPEC_HOST) { ++ extcon_set_state(port->extcon, EXTCON_USB, false); ++ extcon_set_state(port->extcon, EXTCON_USB_HOST, attached); ++ } else { ++ extcon_set_state(port->extcon, EXTCON_USB, true); ++ extcon_set_state(port->extcon, EXTCON_USB_HOST, attached); ++ } ++ while (*capability != EXTCON_NONE) { ++ if (attached) { ++ union extcon_property_value val; ++ val.intval = (port->polarity == TYPEC_POLARITY_CC2); ++ extcon_set_property(port->extcon, *capability, ++ EXTCON_PROP_USB_TYPEC_POLARITY, val); ++ } else { ++ extcon_set_state(port->extcon, *capability, false); ++ } ++ extcon_sync(port->extcon, *capability); ++ capability++; ++ } ++ tcpm_log(port, "Extcon update (%s): %s, %s", ++ attached ? "attached" : "detached", ++ port->data_role == TYPEC_HOST ? "host" : "device", ++ port->polarity == TYPEC_POLARITY_CC1 ? "normal" : "flipped"); ++#endif ++} ++ + static int tcpm_pd_transmit(struct tcpm_port *port, + enum tcpm_transmit_type type, + const struct pd_message *msg) +@@ -1091,6 +1127,8 @@ static int tcpm_set_roles(struct tcpm_port *port, bool attached, + typec_set_data_role(port->typec_port, data); + typec_set_pwr_role(port->typec_port, role); + ++ tcpm_update_extcon_data(port, attached); ++ + return 0; + } + +@@ -1562,7 +1600,7 @@ static void svdm_consume_modes(struct tcpm_port *port, const u32 *p, int cnt) + paltmode->mode = i; + paltmode->vdo = p[i]; + +- tcpm_log(port, " Alternate mode %d: SVID 0x%04x, VDO %d: 0x%08x", ++ tcpm_log(port, "Alternate mode %d: SVID 0x%04x, VDO %d: 0x%08x", + pmdata->altmodes, paltmode->svid, + paltmode->mode, paltmode->vdo); + +@@ -1583,6 +1621,8 @@ static void tcpm_register_partner_altmodes(struct tcpm_port *port) + tcpm_log(port, "Failed to register partner SVID 0x%04x", + modep->altmode_desc[i].svid); + altmode = NULL; ++ } else { ++ tcpm_log(port, "Registered altmode 0x%04x", modep->altmode_desc[i].svid); + } + port->partner_altmode[i] = altmode; + } +@@ -2167,11 +2173,13 @@ static int tcpm_pd_svdm(struct tcpm_port *port, struct typec_altmode *adev, + modep->svid_index++; + if (modep->svid_index < modep->nsvids) { + u16 svid = modep->svids[modep->svid_index]; ++ tcpm_log(port, "More modes available, sending discover"); + *response_tx_sop_type = TCPC_TX_SOP; + response[0] = VDO(svid, 1, svdm_version, + CMD_DISCOVER_MODES); + rlen = 1; + } else if (tcpm_cable_vdm_supported(port)) { ++ tcpm_log(port, "Got all patner modes, registering"); + *response_tx_sop_type = TCPC_TX_SOP_PRIME; + response[0] = VDO(USB_SID_PD, 1, + typec_get_cable_svdm_version(typec), +@@ -3650,8 +3692,9 @@ static int tcpm_src_attach(struct tcpm_port *port) + static void tcpm_typec_disconnect(struct tcpm_port *port) + { + if (port->connected) { + if (port->partner) { ++ tcpm_update_extcon_data(port, false); + typec_partner_set_usb_power_delivery(port->partner, NULL); + typec_unregister_partner(port->partner); + port->partner = NULL; + } +@@ -3739,6 +3782,8 @@ static void tcpm_detach(struct tcpm_port *port) + } + + tcpm_reset_port(port); ++ ++ tcpm_update_extcon_data(port, false); + } + + static void tcpm_src_detach(struct tcpm_port *port) +@@ -6258,6 +6303,64 @@ static int tcpm_port_register_pd(struct tcpm_port *port) + return ret; + } + ++unsigned int default_supported_cables[] = { ++ EXTCON_NONE ++}; ++ ++static int tcpm_fw_get_caps_late(struct tcpm_port *port, ++ struct fwnode_handle *fwnode) ++{ ++ int ret, i; ++ ret = fwnode_property_count_u32(fwnode, "typec-altmodes"); ++ if (ret > 0) { ++ u32 *props; ++ if (ret % 4) { ++ dev_err(port->dev, "Length of typec altmode array must be divisible by 4"); ++ return -EINVAL; ++ } ++ ++ props = devm_kzalloc(port->dev, sizeof(u32) * ret, GFP_KERNEL); ++ if (!props) { ++ dev_err(port->dev, "Failed to allocate memory for altmode properties"); ++ return -ENOMEM; ++ } ++ ++ if(fwnode_property_read_u32_array(fwnode, "typec-altmodes", props, ret) < 0) { ++ dev_err(port->dev, "Failed to read altmodes from port"); ++ return -EINVAL; ++ } ++ ++ i = 0; ++ while (ret > 0 && i < ARRAY_SIZE(port->port_altmode)) { ++ struct typec_altmode *alt; ++ struct typec_altmode_desc alt_desc = { ++ .svid = props[i * 4], ++ .mode = props[i * 4 + 1], ++ .vdo = props[i * 4 + 2], ++ .roles = props[i * 4 + 3], ++ }; ++ ++ ++ tcpm_log(port, "Adding altmode SVID: 0x%04x, mode: %d, vdo: %u, role: %d", ++ alt_desc.svid, alt_desc.mode, alt_desc.vdo, alt_desc.roles); ++ alt = typec_port_register_altmode(port->typec_port, ++ &alt_desc); ++ if (IS_ERR(alt)) { ++ tcpm_log(port, ++ "%s: failed to register port alternate mode 0x%x", ++ dev_name(port->dev), alt_desc.svid); ++ break; ++ } ++ typec_altmode_set_drvdata(alt, port); ++ alt->ops = &tcpm_altmode_ops; ++ port->port_altmode[i] = alt; ++ i++; ++ ret -= 4; ++ } ++ } ++ return 0; ++} ++ + static int tcpm_fw_get_caps(struct tcpm_port *port, struct fwnode_handle *fwnode) + { + struct fwnode_handle *capabilities, *child, *caps = NULL; +@@ -6119,6 +6222,23 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, + if (!fwnode) + return -EINVAL; + ++#ifdef CONFIG_EXTCON ++ ret = fwnode_property_count_u32(fwnode, "extcon-cables"); ++ if (ret > 0) { ++ port->extcon_cables = devm_kzalloc(port->dev, sizeof(u32) * ret, GFP_KERNEL); ++ if (!port->extcon_cables) { ++ dev_err(port->dev, "Failed to allocate memory for extcon cable types. "\ ++ "Using default tyes"); ++ goto extcon_default; ++ } ++ fwnode_property_read_u32_array(fwnode, "extcon-cables", port->extcon_cables, ret); ++ } else { ++extcon_default: ++ dev_info(port->dev, "No cable types defined, using default cables"); ++ port->extcon_cables = default_supported_cables; ++ } ++#endif ++ + /* + * This fwnode has a "compatible" property, but is never populated as a + * struct device. Instead we simply parse it to read the properties. +@@ -6571,6 +6691,17 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc) + goto out_destroy_wq; + + port->try_role = port->typec_caps.prefer_role; ++#ifdef CONFIG_EXTCON ++ port->extcon = devm_extcon_dev_allocate(dev, port->extcon_cables); ++ if (IS_ERR(port->extcon)) { ++ dev_err(dev, "Failed to allocate extcon device: %ld", PTR_ERR(port->extcon)); ++ goto out_destroy_wq; ++ } ++ if((err = devm_extcon_dev_register(dev, port->extcon))) { ++ dev_err(dev, "Failed to register extcon device: %d", err); ++ goto out_destroy_wq; ++ } ++#endif + + port->typec_caps.fwnode = tcpc->fwnode; + port->typec_caps.revision = 0x0120; /* Type-C spec release 1.2 */ +@@ -6613,6 +6744,12 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc) + port->port_altmode, ALTMODE_DISCOVERY_MAX); + port->registered = true; + ++ err = tcpm_fw_get_caps_late(port, tcpc->fwnode); ++ if (err < 0) { ++ dev_err(dev, "Failed to get altmodes from fwnode"); ++ goto out_destroy_wq; ++ } ++ + mutex_lock(&port->lock); + tcpm_init(port); + mutex_unlock(&port->lock); +-- +Armbian + + diff --git a/patch/kernel/archive/rockchip64-6.10/board-radxa-e25-sdmmc0-fix.patch b/patch/kernel/archive/rockchip64-6.10/board-radxa-e25-sdmmc0-fix.patch new file mode 100644 index 000000000000..41758a620fbd --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-radxa-e25-sdmmc0-fix.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: krachlatte +Date: Wed, 17 May 2023 00:55:30 +0200 +Subject: [ARCHEOLOGY] Improve SD card compatibility on Radxa E25 (#5165) + +> X-Git-Archeology: - Revision 45c85878613108c238e491aa69650fcad1fba4bb: https://github.com/armbian/build/commit/45c85878613108c238e491aa69650fcad1fba4bb +> X-Git-Archeology: Date: Wed, 17 May 2023 00:55:30 +0200 +> X-Git-Archeology: From: krachlatte +> X-Git-Archeology: Subject: Improve SD card compatibility on Radxa E25 (#5165) +> X-Git-Archeology: +> X-Git-Archeology: - Revision f6a0c53d08f53aadd0588a571662dc199232825b: https://github.com/armbian/build/commit/f6a0c53d08f53aadd0588a571662dc199232825b +> X-Git-Archeology: Date: Wed, 24 May 2023 10:39:21 +0200 +> X-Git-Archeology: From: Ricardo Pardini +> X-Git-Archeology: Subject: manual e25 patch fix +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts b/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts +index 72ad74c38a2b..5751dc7e2ebc 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts +@@ -194,7 +194,7 @@ &sdmmc0 { + disable-wp; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd>; +- sd-uhs-sdr104; ++ sd-uhs-sdr50; + vmmc-supply = <&vcc3v3_sd>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-radxa-e25-usb3-and-emmc-fix.patch b/patch/kernel/archive/rockchip64-6.10/board-radxa-e25-usb3-and-emmc-fix.patch new file mode 100644 index 000000000000..afd5918a0b7e --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-radxa-e25-usb3-and-emmc-fix.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: krachlatte +Date: Wed, 17 May 2023 00:55:30 +0200 +Subject: [ARCHEOLOGY] Improve SD card compatibility on Radxa E25 (#5165) + +> X-Git-Archeology: - Revision 45c85878613108c238e491aa69650fcad1fba4bb: https://github.com/armbian/build/commit/45c85878613108c238e491aa69650fcad1fba4bb +> X-Git-Archeology: Date: Wed, 17 May 2023 00:55:30 +0200 +> X-Git-Archeology: From: krachlatte +> X-Git-Archeology: Subject: Improve SD card compatibility on Radxa E25 (#5165) +> X-Git-Archeology: +> X-Git-Archeology: - Revision f6a0c53d08f53aadd0588a571662dc199232825b: https://github.com/armbian/build/commit/f6a0c53d08f53aadd0588a571662dc199232825b +> X-Git-Archeology: Date: Wed, 24 May 2023 10:39:21 +0200 +> X-Git-Archeology: From: Ricardo Pardini +> X-Git-Archeology: Subject: manual e25 patch fix +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3568-radxa-cm3i.dtsi | 12 ++++++++++ + arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts | 2 ++ + 2 files changed, 14 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3568-radxa-cm3i.dtsi b/arch/arm64/boot/dts/rockchip/rk3568-radxa-cm3i.dtsi +index 45b03dcbbad4..ffae714d56dc 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3568-radxa-cm3i.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3568-radxa-cm3i.dtsi +@@ -389,6 +389,17 @@ &sdhci { + status = "okay"; + }; + ++&sfc { ++ status = "okay"; ++ flash@0 { ++ compatible = "jedec,spi-nor"; ++ reg = <0>; ++ spi-max-frequency = <108000000>; ++ spi-rx-bus-width = <2>; ++ spi-tx-bus-width = <2>; ++ }; ++}; ++ + &tsadc { + rockchip,hw-tshut-mode = <1>; + rockchip,hw-tshut-polarity = <0>; +@@ -409,4 +420,5 @@ &usb2phy1 { + + &usb_host0_xhci { + extcon = <&usb2phy0>; ++ dr_mode = "host"; + }; +diff --git a/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts b/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts +index 5751dc7e2ebc..7d7d00adf10a 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts +@@ -209,6 +209,8 @@ &usb_host0_ohci { + }; + + &usb_host0_xhci { ++ extcon = <&usb2phy0>; ++ dr_mode = "host"; + status = "okay"; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-cc-dts-enable-dmc.patch b/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-cc-dts-enable-dmc.patch new file mode 100644 index 000000000000..658c3e15ce3e --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-cc-dts-enable-dmc.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Tue, 12 Oct 2021 18:31:28 +0000 +Subject: enable roc-cc dmc + +--- + arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 38 ++++++++++ + 1 file changed, 38 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +index 5d5d9574088c..be5d064d6a93 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +@@ -4,6 +4,7 @@ + */ + + /dts-v1/; ++#include "rk3328-dram-renegade-timing.dtsi" + #include "rk3328.dtsi" + + / { +@@ -19,6 +20,32 @@ chosen { + stdout-path = "serial2:1500000n8"; + }; + ++ /delete-node/ dmc-opp-table; ++ dmc_opp_table: dmc-opp-table { ++ compatible = "operating-points-v2"; ++ ++ opp-786000000 { ++ opp-hz = /bits/ 64 <786000000>; ++ opp-microvolt = <1075000 1075000 12000000>; ++ }; ++ opp-798000000 { ++ opp-hz = /bits/ 64 <798000000>; ++ opp-microvolt = <1075000 1075000 12000000>; ++ }; ++ opp-840000000 { ++ opp-hz = /bits/ 64 <840000000>; ++ opp-microvolt = <1075000 1075000 12000000>; ++ }; ++ opp-924000000 { ++ opp-hz = /bits/ 64 <924000000>; ++ opp-microvolt = <1100000 1100000 12000000>; ++ }; ++ opp-1068000000 { ++ opp-hz = /bits/ 64 <1068000000>; ++ opp-microvolt = <1175000 1175000 12000000>; ++ }; ++ }; ++ + gmac_clkin: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; +@@ -115,6 +142,17 @@ &codec { + status = "okay"; + }; + ++&dfi { ++ status = "okay"; ++}; ++ ++&dmc { ++ center-supply = <&vdd_logic>; ++ ddr_timing = <&ddr_timing>; ++ status = "okay"; ++}; ++ ++ + &cpu0 { + cpu-supply = <&vdd_arm>; + }; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-cc-dts-ram-profile.patch b/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-cc-dts-ram-profile.patch new file mode 100644 index 000000000000..71b23c423c80 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-cc-dts-ram-profile.patch @@ -0,0 +1,330 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: tonymac32 +Date: Wed, 7 Oct 2020 23:39:54 -0400 +Subject: board-rk3328-roc-cc-adjust-DMC-opps + +Signed-off-by: tonymac32 +--- + arch/arm64/boot/dts/rockchip/rk3328-dram-renegade-timing.dtsi | 311 ++++++++++ + 1 file changed, 311 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-dram-renegade-timing.dtsi b/arch/arm64/boot/dts/rockchip/rk3328-dram-renegade-timing.dtsi +new file mode 100644 +index 000000000000..303428153094 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3328-dram-renegade-timing.dtsi +@@ -0,0 +1,311 @@ ++/* ++ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd ++ * ++ * This file is dual-licensed: you can use it either under the terms ++ * of the GPL or the X11 license, at your option. Note that this dual ++ * licensing only applies to this file, and not this project as a ++ * whole. ++ * ++ * a) This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 2 of the ++ * License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * Or, alternatively, ++ * ++ * b) Permission is hereby granted, free of charge, to any person ++ * obtaining a copy of this software and associated documentation ++ * files (the "Software"), to deal in the Software without ++ * restriction, including without limitation the rights to use, ++ * copy, modify, merge, publish, distribute, sublicense, and/or ++ * sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following ++ * conditions: ++ * ++ * The above copyright notice and this permission notice shall be ++ * included in all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ++ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ++ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ++ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ++ * OTHER DEALINGS IN THE SOFTWARE. ++ */ ++#include ++#include ++ ++/ { ++ ddr_timing: ddr_timing { ++ compatible = "rockchip,ddr-timing"; ++ ddr3_speed_bin = ; ++ ddr4_speed_bin = ; ++ pd_idle = <0>; ++ sr_idle = <0>; ++ sr_mc_gate_idle = <0>; ++ srpd_lite_idle = <0>; ++ standby_idle = <0>; ++ ++ auto_pd_dis_freq = <1066>; ++ auto_sr_dis_freq = <800>; ++ ddr3_dll_dis_freq = <300>; ++ ddr4_dll_dis_freq = <625>; ++ phy_dll_dis_freq = <400>; ++ ++ ddr3_odt_dis_freq = <100>; ++ phy_ddr3_odt_dis_freq = <100>; ++ ddr3_drv = ; ++ ddr3_odt = ; ++ phy_ddr3_ca_drv = ; ++ phy_ddr3_ck_drv = ; ++ phy_ddr3_dq_drv = ; ++ phy_ddr3_odt = ; ++ ++ lpddr3_odt_dis_freq = <666>; ++ phy_lpddr3_odt_dis_freq = <666>; ++ lpddr3_drv = ; ++ lpddr3_odt = ; ++ phy_lpddr3_ca_drv = ; ++ phy_lpddr3_ck_drv = ; ++ phy_lpddr3_dq_drv = ; ++ phy_lpddr3_odt = ; ++ ++ lpddr4_odt_dis_freq = <800>; ++ phy_lpddr4_odt_dis_freq = <800>; ++ lpddr4_drv = ; ++ lpddr4_dq_odt = ; ++ lpddr4_ca_odt = ; ++ phy_lpddr4_ca_drv = ; ++ phy_lpddr4_ck_cs_drv = ; ++ phy_lpddr4_dq_drv = ; ++ phy_lpddr4_odt = ; ++ ++ ddr4_odt_dis_freq = <666>; ++ phy_ddr4_odt_dis_freq = <666>; ++ ddr4_drv = ; ++ ddr4_odt = ; ++ phy_ddr4_ca_drv = ; ++ phy_ddr4_ck_drv = ; ++ phy_ddr4_dq_drv = ; ++ phy_ddr4_odt = ; ++ ++ /* CA de-skew, one step is 47.8ps, range 0-15 */ ++ ddr3a1_ddr4a9_de-skew = <0>; ++ ddr3a0_ddr4a10_de-skew = <0>; ++ ddr3a3_ddr4a6_de-skew = <1>; ++ ddr3a2_ddr4a4_de-skew = <1>; ++ ddr3a5_ddr4a8_de-skew = <0>; ++ ddr3a4_ddr4a5_de-skew = <2>; ++ ddr3a7_ddr4a11_de-skew = <0>; ++ ddr3a6_ddr4a7_de-skew = <2>; ++ ddr3a9_ddr4a0_de-skew = <1>; ++ ddr3a8_ddr4a13_de-skew = <0>; ++ ddr3a11_ddr4a3_de-skew = <2>; ++ ddr3a10_ddr4cs0_de-skew = <0>; ++ ddr3a13_ddr4a2_de-skew = <1>; ++ ddr3a12_ddr4ba1_de-skew = <0>; ++ ddr3a15_ddr4odt0_de-skew = <0>; ++ ddr3a14_ddr4a1_de-skew = <1>; ++ ddr3ba1_ddr4a15_de-skew = <0>; ++ ddr3ba0_ddr4bg0_de-skew = <0>; ++ ddr3ras_ddr4cke_de-skew = <0>; ++ ddr3ba2_ddr4ba0_de-skew = <1>; ++ ddr3we_ddr4bg1_de-skew = <1>; ++ ddr3cas_ddr4a12_de-skew = <0>; ++ ddr3ckn_ddr4ckn_de-skew = <5>; ++ ddr3ckp_ddr4ckp_de-skew = <5>; ++ ddr3cke_ddr4a16_de-skew = <1>; ++ ddr3odt0_ddr4a14_de-skew = <0>; ++ ddr3cs0_ddr4act_de-skew = <1>; ++ ddr3reset_ddr4reset_de-skew = <0>; ++ ddr3cs1_ddr4cs1_de-skew = <0>; ++ ddr3odt1_ddr4odt1_de-skew = <0>; ++ ++ /* DATA de-skew ++ * RX one step is 25.1ps, range 0-15 ++ * TX one step is 47.8ps, range 0-15 ++ */ ++ cs0_dm0_rx_de-skew = <7>; ++ cs0_dm0_tx_de-skew = <8>; ++ cs0_dq0_rx_de-skew = <7>; ++ cs0_dq0_tx_de-skew = <8>; ++ cs0_dq1_rx_de-skew = <7>; ++ cs0_dq1_tx_de-skew = <8>; ++ cs0_dq2_rx_de-skew = <7>; ++ cs0_dq2_tx_de-skew = <8>; ++ cs0_dq3_rx_de-skew = <7>; ++ cs0_dq3_tx_de-skew = <8>; ++ cs0_dq4_rx_de-skew = <7>; ++ cs0_dq4_tx_de-skew = <8>; ++ cs0_dq5_rx_de-skew = <7>; ++ cs0_dq5_tx_de-skew = <8>; ++ cs0_dq6_rx_de-skew = <7>; ++ cs0_dq6_tx_de-skew = <8>; ++ cs0_dq7_rx_de-skew = <7>; ++ cs0_dq7_tx_de-skew = <8>; ++ cs0_dqs0_rx_de-skew = <6>; ++ cs0_dqs0p_tx_de-skew = <9>; ++ cs0_dqs0n_tx_de-skew = <9>; ++ ++ cs0_dm1_rx_de-skew = <7>; ++ cs0_dm1_tx_de-skew = <7>; ++ cs0_dq8_rx_de-skew = <7>; ++ cs0_dq8_tx_de-skew = <8>; ++ cs0_dq9_rx_de-skew = <7>; ++ cs0_dq9_tx_de-skew = <7>; ++ cs0_dq10_rx_de-skew = <7>; ++ cs0_dq10_tx_de-skew = <8>; ++ cs0_dq11_rx_de-skew = <7>; ++ cs0_dq11_tx_de-skew = <7>; ++ cs0_dq12_rx_de-skew = <7>; ++ cs0_dq12_tx_de-skew = <8>; ++ cs0_dq13_rx_de-skew = <7>; ++ cs0_dq13_tx_de-skew = <7>; ++ cs0_dq14_rx_de-skew = <7>; ++ cs0_dq14_tx_de-skew = <8>; ++ cs0_dq15_rx_de-skew = <7>; ++ cs0_dq15_tx_de-skew = <7>; ++ cs0_dqs1_rx_de-skew = <7>; ++ cs0_dqs1p_tx_de-skew = <9>; ++ cs0_dqs1n_tx_de-skew = <9>; ++ ++ cs0_dm2_rx_de-skew = <7>; ++ cs0_dm2_tx_de-skew = <8>; ++ cs0_dq16_rx_de-skew = <7>; ++ cs0_dq16_tx_de-skew = <8>; ++ cs0_dq17_rx_de-skew = <7>; ++ cs0_dq17_tx_de-skew = <8>; ++ cs0_dq18_rx_de-skew = <7>; ++ cs0_dq18_tx_de-skew = <8>; ++ cs0_dq19_rx_de-skew = <7>; ++ cs0_dq19_tx_de-skew = <8>; ++ cs0_dq20_rx_de-skew = <7>; ++ cs0_dq20_tx_de-skew = <8>; ++ cs0_dq21_rx_de-skew = <7>; ++ cs0_dq21_tx_de-skew = <8>; ++ cs0_dq22_rx_de-skew = <7>; ++ cs0_dq22_tx_de-skew = <8>; ++ cs0_dq23_rx_de-skew = <7>; ++ cs0_dq23_tx_de-skew = <8>; ++ cs0_dqs2_rx_de-skew = <6>; ++ cs0_dqs2p_tx_de-skew = <9>; ++ cs0_dqs2n_tx_de-skew = <9>; ++ ++ cs0_dm3_rx_de-skew = <7>; ++ cs0_dm3_tx_de-skew = <7>; ++ cs0_dq24_rx_de-skew = <7>; ++ cs0_dq24_tx_de-skew = <8>; ++ cs0_dq25_rx_de-skew = <7>; ++ cs0_dq25_tx_de-skew = <7>; ++ cs0_dq26_rx_de-skew = <7>; ++ cs0_dq26_tx_de-skew = <7>; ++ cs0_dq27_rx_de-skew = <7>; ++ cs0_dq27_tx_de-skew = <7>; ++ cs0_dq28_rx_de-skew = <7>; ++ cs0_dq28_tx_de-skew = <7>; ++ cs0_dq29_rx_de-skew = <7>; ++ cs0_dq29_tx_de-skew = <7>; ++ cs0_dq30_rx_de-skew = <7>; ++ cs0_dq30_tx_de-skew = <7>; ++ cs0_dq31_rx_de-skew = <7>; ++ cs0_dq31_tx_de-skew = <7>; ++ cs0_dqs3_rx_de-skew = <7>; ++ cs0_dqs3p_tx_de-skew = <9>; ++ cs0_dqs3n_tx_de-skew = <9>; ++ ++ cs1_dm0_rx_de-skew = <7>; ++ cs1_dm0_tx_de-skew = <8>; ++ cs1_dq0_rx_de-skew = <7>; ++ cs1_dq0_tx_de-skew = <8>; ++ cs1_dq1_rx_de-skew = <7>; ++ cs1_dq1_tx_de-skew = <8>; ++ cs1_dq2_rx_de-skew = <7>; ++ cs1_dq2_tx_de-skew = <8>; ++ cs1_dq3_rx_de-skew = <7>; ++ cs1_dq3_tx_de-skew = <8>; ++ cs1_dq4_rx_de-skew = <7>; ++ cs1_dq4_tx_de-skew = <8>; ++ cs1_dq5_rx_de-skew = <7>; ++ cs1_dq5_tx_de-skew = <8>; ++ cs1_dq6_rx_de-skew = <7>; ++ cs1_dq6_tx_de-skew = <8>; ++ cs1_dq7_rx_de-skew = <7>; ++ cs1_dq7_tx_de-skew = <8>; ++ cs1_dqs0_rx_de-skew = <6>; ++ cs1_dqs0p_tx_de-skew = <9>; ++ cs1_dqs0n_tx_de-skew = <9>; ++ ++ cs1_dm1_rx_de-skew = <7>; ++ cs1_dm1_tx_de-skew = <7>; ++ cs1_dq8_rx_de-skew = <7>; ++ cs1_dq8_tx_de-skew = <8>; ++ cs1_dq9_rx_de-skew = <7>; ++ cs1_dq9_tx_de-skew = <7>; ++ cs1_dq10_rx_de-skew = <7>; ++ cs1_dq10_tx_de-skew = <8>; ++ cs1_dq11_rx_de-skew = <7>; ++ cs1_dq11_tx_de-skew = <7>; ++ cs1_dq12_rx_de-skew = <7>; ++ cs1_dq12_tx_de-skew = <8>; ++ cs1_dq13_rx_de-skew = <7>; ++ cs1_dq13_tx_de-skew = <7>; ++ cs1_dq14_rx_de-skew = <7>; ++ cs1_dq14_tx_de-skew = <8>; ++ cs1_dq15_rx_de-skew = <7>; ++ cs1_dq15_tx_de-skew = <7>; ++ cs1_dqs1_rx_de-skew = <7>; ++ cs1_dqs1p_tx_de-skew = <9>; ++ cs1_dqs1n_tx_de-skew = <9>; ++ ++ cs1_dm2_rx_de-skew = <7>; ++ cs1_dm2_tx_de-skew = <8>; ++ cs1_dq16_rx_de-skew = <7>; ++ cs1_dq16_tx_de-skew = <8>; ++ cs1_dq17_rx_de-skew = <7>; ++ cs1_dq17_tx_de-skew = <8>; ++ cs1_dq18_rx_de-skew = <7>; ++ cs1_dq18_tx_de-skew = <8>; ++ cs1_dq19_rx_de-skew = <7>; ++ cs1_dq19_tx_de-skew = <8>; ++ cs1_dq20_rx_de-skew = <7>; ++ cs1_dq20_tx_de-skew = <8>; ++ cs1_dq21_rx_de-skew = <7>; ++ cs1_dq21_tx_de-skew = <8>; ++ cs1_dq22_rx_de-skew = <7>; ++ cs1_dq22_tx_de-skew = <8>; ++ cs1_dq23_rx_de-skew = <7>; ++ cs1_dq23_tx_de-skew = <8>; ++ cs1_dqs2_rx_de-skew = <6>; ++ cs1_dqs2p_tx_de-skew = <9>; ++ cs1_dqs2n_tx_de-skew = <9>; ++ ++ cs1_dm3_rx_de-skew = <7>; ++ cs1_dm3_tx_de-skew = <7>; ++ cs1_dq24_rx_de-skew = <7>; ++ cs1_dq24_tx_de-skew = <8>; ++ cs1_dq25_rx_de-skew = <7>; ++ cs1_dq25_tx_de-skew = <7>; ++ cs1_dq26_rx_de-skew = <7>; ++ cs1_dq26_tx_de-skew = <7>; ++ cs1_dq27_rx_de-skew = <7>; ++ cs1_dq27_tx_de-skew = <7>; ++ cs1_dq28_rx_de-skew = <7>; ++ cs1_dq28_tx_de-skew = <7>; ++ cs1_dq29_rx_de-skew = <7>; ++ cs1_dq29_tx_de-skew = <7>; ++ cs1_dq30_rx_de-skew = <7>; ++ cs1_dq30_tx_de-skew = <7>; ++ cs1_dq31_rx_de-skew = <7>; ++ cs1_dq31_tx_de-skew = <7>; ++ cs1_dqs3_rx_de-skew = <7>; ++ cs1_dqs3p_tx_de-skew = <9>; ++ cs1_dqs3n_tx_de-skew = <9>; ++ }; ++}; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-pc-dts-ram-profile.patch b/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-pc-dts-ram-profile.patch new file mode 100644 index 000000000000..872a1574beec --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-pc-dts-ram-profile.patch @@ -0,0 +1,301 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tony +Date: Thu, 8 Oct 2020 01:56:28 -0400 +Subject: [ARCHEOLOGY] Add files via upload + +> X-Git-Archeology: - Revision 8fc20a15b12561e76e92d5bd29b5afd1c62f08ac: https://github.com/armbian/build/commit/8fc20a15b12561e76e92d5bd29b5afd1c62f08ac +> X-Git-Archeology: Date: Thu, 08 Oct 2020 01:56:28 -0400 +> X-Git-Archeology: From: Tony +> X-Git-Archeology: Subject: Add files via upload +> X-Git-Archeology: +> X-Git-Archeology: - Revision 2788adccedc25f12fc9e71e01a92863d97683979: https://github.com/armbian/build/commit/2788adccedc25f12fc9e71e01a92863d97683979 +> X-Git-Archeology: Date: Tue, 26 Jan 2021 21:22:04 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Enable DMC for Station M1 in current and dev (#2575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision e7377248b3cae186e24e2be781cd3365b43246f0: https://github.com/armbian/build/commit/e7377248b3cae186e24e2be781cd3365b43246f0 +> X-Git-Archeology: Date: Thu, 22 Jul 2021 00:15:54 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Second part of EDGE bumping to 5.13.y (#3045) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 744ea89a589d62cb6f409baab60fc6664520bc39: https://github.com/armbian/build/commit/744ea89a589d62cb6f409baab60fc6664520bc39 +> X-Git-Archeology: Date: Wed, 08 Sep 2021 17:51:34 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bumping EDGE kernel to 5.14.y (#3125) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3328-roc-pc-dram-timing.dtsi | 223 ++++++++++ + 1 file changed, 223 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-pc-dram-timing.dtsi b/arch/arm64/boot/dts/rockchip/rk3328-roc-pc-dram-timing.dtsi +new file mode 100644 +index 000000000000..8b2077d086f5 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-pc-dram-timing.dtsi +@@ -0,0 +1,223 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd ++ * ++ */ ++#include ++#include ++ ++/ { ++ ddr_timing: ddr_timing { ++ /* CA de-skew, one step is 47.8ps, range 0-15 */ ++ ddr3a1_ddr4a9_de-skew = <0>; ++ ddr3a0_ddr4a10_de-skew = <0>; ++ ddr3a3_ddr4a6_de-skew = <1>; ++ ddr3a2_ddr4a4_de-skew = <1>; ++ ddr3a5_ddr4a8_de-skew = <0>; ++ ddr3a4_ddr4a5_de-skew = <2>; ++ ddr3a7_ddr4a11_de-skew = <0>; ++ ddr3a6_ddr4a7_de-skew = <2>; ++ ddr3a9_ddr4a0_de-skew = <1>; ++ ddr3a8_ddr4a13_de-skew = <0>; ++ ddr3a11_ddr4a3_de-skew = <2>; ++ ddr3a10_ddr4cs0_de-skew = <0>; ++ ddr3a13_ddr4a2_de-skew = <1>; ++ ddr3a12_ddr4ba1_de-skew = <0>; ++ ddr3a15_ddr4odt0_de-skew = <0>; ++ ddr3a14_ddr4a1_de-skew = <1>; ++ ddr3ba1_ddr4a15_de-skew = <0>; ++ ddr3ba0_ddr4bg0_de-skew = <0>; ++ ddr3ras_ddr4cke_de-skew = <0>; ++ ddr3ba2_ddr4ba0_de-skew = <1>; ++ ddr3we_ddr4bg1_de-skew = <1>; ++ ddr3cas_ddr4a12_de-skew = <0>; ++ ddr3ckn_ddr4ckn_de-skew = <5>; ++ ddr3ckp_ddr4ckp_de-skew = <5>; ++ ddr3cke_ddr4a16_de-skew = <1>; ++ ddr3odt0_ddr4a14_de-skew = <0>; ++ ddr3cs0_ddr4act_de-skew = <1>; ++ ddr3reset_ddr4reset_de-skew = <0>; ++ ddr3cs1_ddr4cs1_de-skew = <0>; ++ ddr3odt1_ddr4odt1_de-skew = <0>; ++ ++ /* DATA de-skew ++ * RX one step is 25.1ps, range 0-15 ++ * TX one step is 47.8ps, range 0-15 ++ */ ++ cs0_dm0_rx_de-skew = <7>; ++ cs0_dm0_tx_de-skew = <8>; ++ cs0_dq0_rx_de-skew = <7>; ++ cs0_dq0_tx_de-skew = <8>; ++ cs0_dq1_rx_de-skew = <7>; ++ cs0_dq1_tx_de-skew = <8>; ++ cs0_dq2_rx_de-skew = <7>; ++ cs0_dq2_tx_de-skew = <8>; ++ cs0_dq3_rx_de-skew = <7>; ++ cs0_dq3_tx_de-skew = <8>; ++ cs0_dq4_rx_de-skew = <7>; ++ cs0_dq4_tx_de-skew = <8>; ++ cs0_dq5_rx_de-skew = <7>; ++ cs0_dq5_tx_de-skew = <8>; ++ cs0_dq6_rx_de-skew = <7>; ++ cs0_dq6_tx_de-skew = <8>; ++ cs0_dq7_rx_de-skew = <7>; ++ cs0_dq7_tx_de-skew = <8>; ++ cs0_dqs0_rx_de-skew = <6>; ++ cs0_dqs0p_tx_de-skew = <9>; ++ cs0_dqs0n_tx_de-skew = <9>; ++ ++ cs0_dm1_rx_de-skew = <7>; ++ cs0_dm1_tx_de-skew = <7>; ++ cs0_dq8_rx_de-skew = <7>; ++ cs0_dq8_tx_de-skew = <8>; ++ cs0_dq9_rx_de-skew = <7>; ++ cs0_dq9_tx_de-skew = <7>; ++ cs0_dq10_rx_de-skew = <7>; ++ cs0_dq10_tx_de-skew = <8>; ++ cs0_dq11_rx_de-skew = <7>; ++ cs0_dq11_tx_de-skew = <7>; ++ cs0_dq12_rx_de-skew = <7>; ++ cs0_dq12_tx_de-skew = <8>; ++ cs0_dq13_rx_de-skew = <7>; ++ cs0_dq13_tx_de-skew = <7>; ++ cs0_dq14_rx_de-skew = <7>; ++ cs0_dq14_tx_de-skew = <8>; ++ cs0_dq15_rx_de-skew = <7>; ++ cs0_dq15_tx_de-skew = <7>; ++ cs0_dqs1_rx_de-skew = <7>; ++ cs0_dqs1p_tx_de-skew = <9>; ++ cs0_dqs1n_tx_de-skew = <9>; ++ ++ cs0_dm2_rx_de-skew = <7>; ++ cs0_dm2_tx_de-skew = <8>; ++ cs0_dq16_rx_de-skew = <7>; ++ cs0_dq16_tx_de-skew = <8>; ++ cs0_dq17_rx_de-skew = <7>; ++ cs0_dq17_tx_de-skew = <8>; ++ cs0_dq18_rx_de-skew = <7>; ++ cs0_dq18_tx_de-skew = <8>; ++ cs0_dq19_rx_de-skew = <7>; ++ cs0_dq19_tx_de-skew = <8>; ++ cs0_dq20_rx_de-skew = <7>; ++ cs0_dq20_tx_de-skew = <8>; ++ cs0_dq21_rx_de-skew = <7>; ++ cs0_dq21_tx_de-skew = <8>; ++ cs0_dq22_rx_de-skew = <7>; ++ cs0_dq22_tx_de-skew = <8>; ++ cs0_dq23_rx_de-skew = <7>; ++ cs0_dq23_tx_de-skew = <8>; ++ cs0_dqs2_rx_de-skew = <6>; ++ cs0_dqs2p_tx_de-skew = <9>; ++ cs0_dqs2n_tx_de-skew = <9>; ++ ++ cs0_dm3_rx_de-skew = <7>; ++ cs0_dm3_tx_de-skew = <7>; ++ cs0_dq24_rx_de-skew = <7>; ++ cs0_dq24_tx_de-skew = <8>; ++ cs0_dq25_rx_de-skew = <7>; ++ cs0_dq25_tx_de-skew = <7>; ++ cs0_dq26_rx_de-skew = <7>; ++ cs0_dq26_tx_de-skew = <7>; ++ cs0_dq27_rx_de-skew = <7>; ++ cs0_dq27_tx_de-skew = <7>; ++ cs0_dq28_rx_de-skew = <7>; ++ cs0_dq28_tx_de-skew = <7>; ++ cs0_dq29_rx_de-skew = <7>; ++ cs0_dq29_tx_de-skew = <7>; ++ cs0_dq30_rx_de-skew = <7>; ++ cs0_dq30_tx_de-skew = <7>; ++ cs0_dq31_rx_de-skew = <7>; ++ cs0_dq31_tx_de-skew = <7>; ++ cs0_dqs3_rx_de-skew = <7>; ++ cs0_dqs3p_tx_de-skew = <9>; ++ cs0_dqs3n_tx_de-skew = <9>; ++ ++ cs1_dm0_rx_de-skew = <7>; ++ cs1_dm0_tx_de-skew = <8>; ++ cs1_dq0_rx_de-skew = <7>; ++ cs1_dq0_tx_de-skew = <8>; ++ cs1_dq1_rx_de-skew = <7>; ++ cs1_dq1_tx_de-skew = <8>; ++ cs1_dq2_rx_de-skew = <7>; ++ cs1_dq2_tx_de-skew = <8>; ++ cs1_dq3_rx_de-skew = <7>; ++ cs1_dq3_tx_de-skew = <8>; ++ cs1_dq4_rx_de-skew = <7>; ++ cs1_dq4_tx_de-skew = <8>; ++ cs1_dq5_rx_de-skew = <7>; ++ cs1_dq5_tx_de-skew = <8>; ++ cs1_dq6_rx_de-skew = <7>; ++ cs1_dq6_tx_de-skew = <8>; ++ cs1_dq7_rx_de-skew = <7>; ++ cs1_dq7_tx_de-skew = <8>; ++ cs1_dqs0_rx_de-skew = <6>; ++ cs1_dqs0p_tx_de-skew = <9>; ++ cs1_dqs0n_tx_de-skew = <9>; ++ ++ cs1_dm1_rx_de-skew = <7>; ++ cs1_dm1_tx_de-skew = <7>; ++ cs1_dq8_rx_de-skew = <7>; ++ cs1_dq8_tx_de-skew = <8>; ++ cs1_dq9_rx_de-skew = <7>; ++ cs1_dq9_tx_de-skew = <7>; ++ cs1_dq10_rx_de-skew = <7>; ++ cs1_dq10_tx_de-skew = <8>; ++ cs1_dq11_rx_de-skew = <7>; ++ cs1_dq11_tx_de-skew = <7>; ++ cs1_dq12_rx_de-skew = <7>; ++ cs1_dq12_tx_de-skew = <8>; ++ cs1_dq13_rx_de-skew = <7>; ++ cs1_dq13_tx_de-skew = <7>; ++ cs1_dq14_rx_de-skew = <7>; ++ cs1_dq14_tx_de-skew = <8>; ++ cs1_dq15_rx_de-skew = <7>; ++ cs1_dq15_tx_de-skew = <7>; ++ cs1_dqs1_rx_de-skew = <7>; ++ cs1_dqs1p_tx_de-skew = <9>; ++ cs1_dqs1n_tx_de-skew = <9>; ++ ++ cs1_dm2_rx_de-skew = <7>; ++ cs1_dm2_tx_de-skew = <8>; ++ cs1_dq16_rx_de-skew = <7>; ++ cs1_dq16_tx_de-skew = <8>; ++ cs1_dq17_rx_de-skew = <7>; ++ cs1_dq17_tx_de-skew = <8>; ++ cs1_dq18_rx_de-skew = <7>; ++ cs1_dq18_tx_de-skew = <8>; ++ cs1_dq19_rx_de-skew = <7>; ++ cs1_dq19_tx_de-skew = <8>; ++ cs1_dq20_rx_de-skew = <7>; ++ cs1_dq20_tx_de-skew = <8>; ++ cs1_dq21_rx_de-skew = <7>; ++ cs1_dq21_tx_de-skew = <8>; ++ cs1_dq22_rx_de-skew = <7>; ++ cs1_dq22_tx_de-skew = <8>; ++ cs1_dq23_rx_de-skew = <7>; ++ cs1_dq23_tx_de-skew = <8>; ++ cs1_dqs2_rx_de-skew = <6>; ++ cs1_dqs2p_tx_de-skew = <9>; ++ cs1_dqs2n_tx_de-skew = <9>; ++ ++ cs1_dm3_rx_de-skew = <7>; ++ cs1_dm3_tx_de-skew = <7>; ++ cs1_dq24_rx_de-skew = <7>; ++ cs1_dq24_tx_de-skew = <8>; ++ cs1_dq25_rx_de-skew = <7>; ++ cs1_dq25_tx_de-skew = <7>; ++ cs1_dq26_rx_de-skew = <7>; ++ cs1_dq26_tx_de-skew = <7>; ++ cs1_dq27_rx_de-skew = <7>; ++ cs1_dq27_tx_de-skew = <7>; ++ cs1_dq28_rx_de-skew = <7>; ++ cs1_dq28_tx_de-skew = <7>; ++ cs1_dq29_rx_de-skew = <7>; ++ cs1_dq29_tx_de-skew = <7>; ++ cs1_dq30_rx_de-skew = <7>; ++ cs1_dq30_tx_de-skew = <7>; ++ cs1_dq31_rx_de-skew = <7>; ++ cs1_dq31_tx_de-skew = <7>; ++ cs1_dqs3_rx_de-skew = <7>; ++ cs1_dqs3p_tx_de-skew = <9>; ++ cs1_dqs3n_tx_de-skew = <9>; ++ }; ++}; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-pc.patch b/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-pc.patch new file mode 100644 index 000000000000..43892ae48fb7 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-pc.patch @@ -0,0 +1,593 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Tue, 12 Oct 2021 19:34:29 +0000 +Subject: enable dmc for rk3328-roc-pc + +--- + arch/arm64/boot/dts/rockchip/rk3328-roc-pc.dts | 525 ++++++++-- + 1 file changed, 466 insertions(+), 59 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-pc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-pc.dts +index e3e3984d01d4..02047f049822 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-roc-pc.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-pc.dts +@@ -1,110 +1,517 @@ +-// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +-// Copyright (c) 2021 T-Chip Intelligent Technology Co., Ltd ++/* ++ * SPDX-License-Identifier: (GPL-2.0+ or MIT) ++ * Copyright (c) 2016 Fuzhou Rockchip Electronics Co., Ltd ++ */ + + /dts-v1/; +- ++#include "rk3328-roc-pc-dram-timing.dtsi" ++#include "rk3328.dtsi" + #include + +-#include "rk3328-roc-cc.dts" +- + / { +- model = "Firefly ROC-RK3328-PC"; ++ model = "Firefly roc-rk3328-pc"; + compatible = "firefly,roc-rk3328-pc", "rockchip,rk3328"; + +- adc-keys { +- compatible = "adc-keys"; +- io-channels = <&saradc 0>; +- io-channel-names = "buttons"; +- keyup-threshold-microvolt = <1750000>; ++ aliases { ++ mmc0 = &sdmmc; ++ mmc1 = &emmc; /* MMC boot device */ ++ }; ++ ++ gmac_clkin: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "gmac_clkin"; ++ #clock-cells = <0>; ++ }; ++ ++ sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,name = "rockchip,rk3328"; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s1>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&codec>; ++ }; ++ }; + +- /* This button is unpopulated out of the factory. */ +- button-recovery { +- label = "Recovery"; +- linux,code = ; +- press-threshold-microvolt = <10000>; ++ hdmi-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <128>; ++ simple-audio-card,name = "rockchip,hdmi"; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s0>; + }; ++ simple-audio-card,codec { ++ sound-dai = <&hdmi>; ++ }; ++ }; ++ ++ vcc_host_5v: vcc-host-5v-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&usb30_host_drv>; ++ regulator-name = "vcc_host_5v"; ++ regulator-always-on; ++ regulator-boot-on; ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ vcc_host1_5v: vcc_otg_5v: vcc-host1-5v-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; ++ regulator-always-on; ++ regulator-boot-on; + }; + +- ir-receiver { +- compatible = "gpio-ir-receiver"; +- gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; +- linux,rc-map-name = "rc-khadas"; ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; +- pinctrl-0 = <&ir_int>; ++ pinctrl-0 = <&usb20_host_drv>; ++ regulator-name = "vcc_host1_5v"; ++ regulator-always-on; ++ regulator-boot-on; ++ vin-supply = <&vcc_sys>; + }; + +- sdio_pwrseq: sdio-pwrseq { +- compatible = "mmc-pwrseq-simple"; ++ vcc_sd: sdmmc-regulator { ++ compatible = "regulator-fixed"; ++ gpio = <&gpio0 30 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; +- pinctrl-0 = <&wifi_en>, <&wifi_host_wake>; +- reset-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>; ++ pinctrl-0 = <&sdmmc0m1_pin>; ++ regulator-name = "vcc_sd"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vcc_io>; ++ }; ++ ++ vcc_sys: vcc-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ xin32k: xin32k { ++ compatible = "fixed-clock"; ++ clock-frequency = <32768>; ++ clock-output-names = "xin32k"; ++ #clock-cells = <0>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ power_led: led-0 { ++ label = "firefly:blue:power"; ++ linux,default-trigger = "heartbeat"; ++ gpios = <&rk805 1 GPIO_ACTIVE_LOW>; ++ default-state = "on"; ++ mode = <0x23>; ++ }; ++ ++ user_led: led-1 { ++ label = "firefly:yellow:user"; ++ linux,default-trigger = "mmc1"; ++ gpios = <&rk805 0 GPIO_ACTIVE_LOW>; ++ default-state = "off"; ++ mode = <0x05>; ++ }; ++ }; ++ ++ /delete-node/ dmc-opp-table; ++ dmc_opp_table: dmc-opp-table { ++ compatible = "operating-points-v2"; ++ ++ opp-786000000 { ++ opp-hz = /bits/ 64 <786000000>; ++ opp-microvolt = <1075000 1075000 1200000>; ++ }; ++ opp-798000000 { ++ opp-hz = /bits/ 64 <798000000>; ++ opp-microvolt = <1075000 1075000 1200000>; ++ }; ++ opp-840000000 { ++ opp-hz = /bits/ 64 <840000000>; ++ opp-microvolt = <1075000 1075000 1200000>; ++ }; ++ opp-924000000 { ++ status = "disabled"; // unstable ++ opp-hz = /bits/ 64 <924000000>; ++ opp-microvolt = <1100000 1100000 1200000>; ++ }; + }; + }; + +-&codec { +- mute-gpios = <&grf_gpio 0 GPIO_ACTIVE_LOW>; ++&dfi { ++ status = "okay"; ++}; ++ ++&dmc { ++ center-supply = <&vdd_logic>; ++ ddr_timing = <&ddr_timing>; ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ ++ vccio1-supply = <&vcc_io>; ++ vccio2-supply = <&vcc_18emmc>; ++ vccio3-supply = <&vcc_io>; ++ vccio4-supply = <&vcc_io>; ++ vccio5-supply = <&vcc_io>; ++ vccio6-supply = <&vcc_io>; ++ pmuio-supply = <&vcc_io>; ++}; ++ ++&cpu0 { ++ cpu-supply = <&vdd_arm>; + }; + + &gpu { ++ status = "okay"; + mali-supply = <&vdd_logic>; + }; + +-&pinctrl { +- ir { +- ir_int: ir-int { +- rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++&gmac2phy { ++ phy-supply = <&vcc_phy>; ++ clock_in_out = "output"; ++ assigned-clocks = <&cru SCLK_MAC2PHY_SRC>; ++ assigned-clock-rate = <50000000>; ++ assigned-clocks = <&cru SCLK_MAC2PHY>; ++ assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>; ++ status = "disabled"; ++}; ++ ++&gmac2io { ++ phy-supply = <&vcc_io>; ++ phy-mode = "rgmii"; ++ clock_in_out = "input"; ++ snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++ assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>; ++ assigned-clock-parents = <&gmac_clkin>, <&gmac_clkin>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rgmiim1_pins>; ++ snps,aal; ++ snps,rxpbl = <0x4>; ++ snps,txpbl = <0x4>; ++ tx_delay = <0x24>; ++ rx_delay = <0x18>; ++ status = "okay"; ++}; ++ ++&display_subsystem { ++ status = "okay"; ++}; ++ ++&hdmi { ++ #sound-dai-cells = <0>; ++ ddc-i2c-scl-high-time-ns = <9625>; ++ ddc-i2c-scl-low-time-ns = <10000>; ++ status = "okay"; ++}; ++ ++&hdmiphy { ++ status = "okay"; ++}; ++ ++&hdmi_sound { ++ status = "okay"; ++}; ++ ++/*&h265e { ++ status = "okay"; ++}; ++ ++&vdec { ++ status = "okay"; ++}; ++ ++&vepu { ++ status = "okay"; ++};*/ ++ ++&vop { ++ status = "okay"; ++}; ++ ++&vop_mmu { ++ status = "okay"; ++}; ++ ++/*&vpu_service { ++ status = "okay"; ++};*/ ++ ++&i2s0 { ++ #sound-dai-cells = <0>; ++ rockchip,bclk-fs = <128>; ++ status = "okay"; ++}; ++ ++&i2s1 { ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&codec { ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&emmc { ++ bus-width = <8>; ++ cap-mmc-highspeed; ++ mmc-hs200-1_8v; ++ supports-emmc; ++ disable-wp; ++ non-removable; ++ num-slots = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; ++ status = "okay"; ++}; ++ ++&sdmmc { ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ max-frequency = <150000000>; ++ num-slots = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>; ++ supports-sd; ++ status = "okay"; ++ vmmc-supply = <&vcc_sd>; ++}; ++ ++&i2c1 { ++ status = "okay"; ++ ++ rk805: rk805@18 { ++ compatible = "rockchip,rk805"; ++ status = "okay"; ++ reg = <0x18>; ++ interrupt-parent = <&gpio2>; ++ interrupts = <24 IRQ_TYPE_LEVEL_LOW>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l>; ++ rockchip,system-power-controller; ++ wakeup-source; ++ gpio-controller; ++ #gpio-cells = <2>; ++ #clock-cells = <1>; ++ clock-output-names = "xin32k", "rk805-clkout2"; ++ ++ vcc1-supply = <&vcc_sys>; ++ vcc2-supply = <&vcc_sys>; ++ vcc3-supply = <&vcc_sys>; ++ vcc4-supply = <&vcc_sys>; ++ vcc5-supply = <&vcc_io>; ++ vcc6-supply = <&vcc_io>; ++ ++ rtc { ++ status = "okay"; + }; +- }; + +- sdmmcio { +- sdio_per_pin: sdio-per-pin { +- rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_down>; ++ pwrkey { ++ status = "okay"; ++ }; ++ ++ gpio { ++ status = "okay"; ++ }; ++ ++ regulators { ++ compatible = "rk805-regulator"; ++ status = "okay"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ vdd_logic: DCDC_REG1 { ++ regulator-name = "vdd_logic"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-ramp-delay = <12500>; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1000000>; ++ }; ++ }; ++ ++ vdd_arm: DCDC_REG2 { ++ regulator-name = "vdd_arm"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-ramp-delay = <12500>; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <950000>; ++ }; ++ }; ++ ++ vcc_ddr: DCDC_REG3 { ++ regulator-name = "vcc_ddr"; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_io: DCDC_REG4 { ++ regulator-name = "vcc_io"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3300000>; ++ }; ++ }; ++ ++ vdd_18: LDO_REG1 { ++ regulator-name = "vdd_18"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc_18emmc: LDO_REG2 { ++ regulator-name = "vcc_18emmc"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vdd_11: LDO_REG3 { ++ regulator-name = "vdd_11"; ++ regulator-min-microvolt = <1100000>; ++ regulator-max-microvolt = <1100000>; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1100000>; ++ }; ++ }; + }; + }; ++}; ++ ++&pinctrl { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&clk_32k_out>; + +- wifi { +- wifi_en: wifi-en { +- rockchip,pins = <3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; ++ clk_32k { ++ clk_32k_out: clk-32k-out { ++ rockchip,pins = ++ <1 RK_PD4 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = ++ <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>; /* gpio2_a6 */ + }; ++ }; + +- wifi_host_wake: wifi-host-wake { +- rockchip,pins = <3 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none_4ma>; ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = <3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>, ++ <3 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none_4ma>, ++ <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>, ++ <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; ++ }; + +- bt_rst: bt-rst { +- rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>; ++ usb2 { ++ usb20_host_drv: usb20-host-drv { ++ rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; ++ }; + +- bt_en: bt-en { +- rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; ++ usb3 { ++ usb30_host_drv: usb30-host-drv { ++ rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + }; + +-&pmic_int_l { +- rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; ++&u2phy { ++ status = "okay"; + }; + +-&rk805 { +- interrupt-parent = <&gpio0>; +- interrupts = ; ++&u2phy_host { ++ status = "okay"; + }; + +-&saradc { +- vref-supply = <&vcc_18>; ++&u2phy_otg { ++ status = "okay"; ++}; ++ ++&uart2 { + status = "okay"; + }; + +-&usb20_host_drv { +- rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>; ++&usb20_otg { ++ dr_mode = "host"; ++ status = "okay"; + }; + +-&vcc_host1_5v { +- gpio = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>; ++&usb_host0_ehci { ++ status = "okay"; + }; + +-&vcc_sdio { +- gpios = <&gpio0 RK_PD3 GPIO_ACTIVE_HIGH>; +- pinctrl-names = "default"; +- pinctrl-0 = <&sdio_per_pin>; ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usbdrd3 { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++&wdt { ++ status = "okay"; ++}; ++ ++&saradc { ++ status = "okay"; ++ vref-supply = <&vdd_18>; ++}; ++ ++&tsadc { ++ status = "okay"; ++ rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */ ++ rockchip,hw-tshut-polarity = <1>; /* tshut polarity 0:LOW 1:HIGH */ + }; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rock3a-emmc-sfc.patch b/patch/kernel/archive/rockchip64-6.10/board-rock3a-emmc-sfc.patch new file mode 100644 index 000000000000..84e0169a4d63 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rock3a-emmc-sfc.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jianfeng Liu +Date: Wed, 3 Aug 2022 22:22:55 +0200 +Subject: [ARCHEOLOGY] update rockchip64 edge to 5.19 (#4039) + +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts | 11 ++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +index e05ab11981f5..37de541cd4a1 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +@@ -753,6 +753,17 @@ &sdmmc2 { + status = "okay"; + }; + ++&sfc { ++ status = "okay"; ++ flash@0 { ++ compatible = "jedec,spi-nor"; ++ reg = <0>; ++ spi-max-frequency = <108000000>; ++ spi-rx-bus-width = <2>; ++ spi-tx-bus-width = <2>; ++ }; ++}; ++ + &tsadc { + rockchip,hw-tshut-mode = <1>; + rockchip,hw-tshut-polarity = <0>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rock3a-usb3.patch b/patch/kernel/archive/rockchip64-6.10/board-rock3a-usb3.patch new file mode 100644 index 000000000000..b5dfe00f774a --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rock3a-usb3.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jianfeng Liu +Date: Wed, 3 Aug 2022 22:22:55 +0200 +Subject: [ARCHEOLOGY] update rockchip64 edge to 5.19 (#4039) + +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +index 37de541cd4a1..effcb2ee471f 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +@@ -805,6 +805,7 @@ &usb_host0_ohci { + + &usb_host0_xhci { + extcon = <&usb2phy0>; ++ dr_mode = "host"; + status = "okay"; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rock64-mail-supply.patch b/patch/kernel/archive/rockchip64-6.10/board-rock64-mail-supply.patch new file mode 100644 index 000000000000..a108ddef5e55 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rock64-mail-supply.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: tonymac32 +Date: Sun, 8 Aug 2021 11:49:27 -0400 +Subject: board_rock64_mali-usb-supply + +Signed-off-by: tonymac32 +--- + arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +index 0a27fa5271f5..1596ce3368f7 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +@@ -135,6 +135,11 @@ &emmc { + status = "okay"; + }; + ++&gpu { ++ status = "okay"; ++ mali-supply = <&vdd_logic>; ++}; ++ + &gmac2io { + assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>; + assigned-clock-parents = <&gmac_clkin>, <&gmac_clkin>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpi3-enable-dmc.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpi3-enable-dmc.patch new file mode 100644 index 000000000000..6164405eedc8 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpi3-enable-dmc.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Wed, 8 Mar 2023 11:12:22 +0100 +Subject: [ARCHEOLOGY] rockchip64: enable dmc on Rock PI E board + +> X-Git-Archeology: - Revision 4ea9330e5185e1c6e248af035cc615d23408316d: https://github.com/armbian/build/commit/4ea9330e5185e1c6e248af035cc615d23408316d +> X-Git-Archeology: Date: Wed, 08 Mar 2023 11:12:22 +0100 +> X-Git-Archeology: From: Paolo Sabatino +> X-Git-Archeology: Subject: rockchip64: enable dmc on Rock PI E board +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts +index 018a3a5075c7..9b3453cece85 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts +@@ -15,6 +15,7 @@ + #include + + #include "rk3328.dtsi" ++#include "rk3328-dram-default-timing.dtsi" + + / { + model = "Radxa ROCK Pi E"; +@@ -388,3 +389,9 @@ &usbdrd3 { + &usb_host0_ehci { + status = "okay"; + }; ++ ++&dmc { ++ status = "okay"; ++ center-supply = <&vdd_log>; ++ ddr_timing = <&ddr_timing>; ++}; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpi4-0003-arm64-dts-pcie.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpi4-0003-arm64-dts-pcie.patch new file mode 100644 index 000000000000..3552a282ba37 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpi4-0003-arm64-dts-pcie.patch @@ -0,0 +1,130 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Piotr Szczepanik +Date: Mon, 18 Nov 2019 18:23:10 +0100 +Subject: [ARCHEOLOGY] Rock Pi 4 enable PCIe in device tree for "dev" target + (#1624) + +> X-Git-Archeology: > recovered message: > * Rock Pi 4 enabled support for PCIe in device tree +> X-Git-Archeology: > recovered message: > * Rockchip64-dev added possibility to enable PCIe Gen2 speed via overlay +> X-Git-Archeology: - Revision b3bb9345439250d8247f0e24a8e1ef6290b2c279: https://github.com/armbian/build/commit/b3bb9345439250d8247f0e24a8e1ef6290b2c279 +> X-Git-Archeology: Date: Mon, 18 Nov 2019 18:23:10 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Rock Pi 4 enable PCIe in device tree for "dev" target (#1624) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 150ac0c2afa147d9e3b036c8ecd8238fe5648cf3: https://github.com/armbian/build/commit/150ac0c2afa147d9e3b036c8ecd8238fe5648cf3 +> X-Git-Archeology: Date: Tue, 19 Nov 2019 23:25:39 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Remove K<4, change branches, new features (#1586) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 812245def37a695bce9e7ece148b2920d82c8b37: https://github.com/armbian/build/commit/812245def37a695bce9e7ece148b2920d82c8b37 +> X-Git-Archeology: Date: Sat, 18 Jul 2020 23:07:01 +0200 +> X-Git-Archeology: From: Werner +> X-Git-Archeology: Subject: Move rockchip/64 current to 5.7.y (#2099) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dfd5cf9692e97774f7f0bfd72227144e36f58070: https://github.com/armbian/build/commit/dfd5cf9692e97774f7f0bfd72227144e36f58070 +> X-Git-Archeology: Date: Sun, 13 Dec 2020 22:13:03 -0500 +> X-Git-Archeology: From: tonymac32 +> X-Git-Archeology: Subject: [ rockchip64 ] Clean up patchset +> X-Git-Archeology: +> X-Git-Archeology: - Revision 091d91468e383c3d12a03a465be36b76112ce798: https://github.com/armbian/build/commit/091d91468e383c3d12a03a465be36b76112ce798 +> X-Git-Archeology: Date: Sun, 17 Jan 2021 19:07:59 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switched rockchip64-current to 5.10.y (and synced -dev config/patches) (#2546) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision e7377248b3cae186e24e2be781cd3365b43246f0: https://github.com/armbian/build/commit/e7377248b3cae186e24e2be781cd3365b43246f0 +> X-Git-Archeology: Date: Thu, 22 Jul 2021 00:15:54 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Second part of EDGE bumping to 5.13.y (#3045) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 744ea89a589d62cb6f409baab60fc6664520bc39: https://github.com/armbian/build/commit/744ea89a589d62cb6f409baab60fc6664520bc39 +> X-Git-Archeology: Date: Wed, 08 Sep 2021 17:51:34 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bumping EDGE kernel to 5.14.y (#3125) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e: https://github.com/armbian/build/commit/dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e +> X-Git-Archeology: Date: Tue, 09 Nov 2021 18:06:34 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump imx6, xu4, rockchip64 and jetson-nano to 5.15 (#3238) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 44c4cdf8653104bc395c504d7611d819906ff69b: https://github.com/armbian/build/commit/44c4cdf8653104bc395c504d7611d819906ff69b +> X-Git-Archeology: Date: Fri, 30 Dec 2022 21:17:33 +0100 +> X-Git-Archeology: From: Konstantin Litvinov +> X-Git-Archeology: Subject: Fixed issue with NVMe identification in rk3399-rock-pi-4.dts (#4627) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +> X-Git-Archeology: - Revision 44c95b7b0a64486a85f23c5630842ea1b877a695: https://github.com/armbian/build/commit/44c95b7b0a64486a85f23c5630842ea1b877a695 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:01 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: fix unidiff warning from patches of rockchip64-6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi +index f2279aa6ca9e..9d1b2129431c 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi +@@ -112,6 +112,8 @@ vcc3v3_pcie: vcc3v3-pcie-regulator { + regulator-name = "vcc3v3_pcie"; + regulator-always-on; + regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; + vin-supply = <&vcc5v0_sys>; + }; + +@@ -528,9 +530,11 @@ &pcie0 { + num-lanes = <4>; + pinctrl-0 = <&pcie_clkreqnb_cpm>; + pinctrl-names = "default"; ++ vpcie12v-supply = <&vcc12v_dcin>; + vpcie0v9-supply = <&vcc_0v9>; + vpcie1v8-supply = <&vcc_1v8>; + vpcie3v3-supply = <&vcc3v3_pcie>; ++ bus-scan-delay-ms = <1500>; + status = "okay"; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0001-arm64-dts.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0001-arm64-dts.patch new file mode 100644 index 000000000000..e8f0b61c55d0 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0001-arm64-dts.patch @@ -0,0 +1,408 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: brentr +Date: Fri, 23 Dec 2022 21:57:53 +0100 +Subject: [ARCHEOLOGY] Rockpis devtree mainlined (#4603) + +> X-Git-Archeology: > recovered message: > * moved rockpro64 patch out of rockpis patch sequence +> X-Git-Archeology: > recovered message: > It had been misnamed +> X-Git-Archeology: > recovered message: > * patch new mainline devtree for Rock Pi-S instead of overwritting it. +> X-Git-Archeology: > recovered message: > Also restores lost bluetooth compatibility items on UART4 +> X-Git-Archeology: - Revision 588c2ec17e709dec19304fa50522459702ebfadd: https://github.com/armbian/build/commit/588c2ec17e709dec19304fa50522459702ebfadd +> X-Git-Archeology: Date: Fri, 23 Dec 2022 21:57:53 +0100 +> X-Git-Archeology: From: brentr +> X-Git-Archeology: Subject: Rockpis devtree mainlined (#4603) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts | 240 +++++++--- + 1 file changed, 164 insertions(+), 76 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts b/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts +index e9810d2f0407..0d917658d24a 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts +@@ -2,6 +2,7 @@ + /* + * Copyright (c) 2019 Akash Gajjar + * Copyright (c) 2019 Jagan Teki ++ * Revised: 2022 Brent Roman + */ + + /dts-v1/; +@@ -11,12 +12,6 @@ / { + model = "Radxa ROCK Pi S"; + compatible = "radxa,rockpis", "rockchip,rk3308"; + +- aliases { +- ethernet0 = &gmac; +- mmc0 = &emmc; +- mmc1 = &sdmmc; +- }; +- + chosen { + stdout-path = "serial0:1500000n8"; + }; +@@ -27,48 +22,106 @@ leds { + pinctrl-0 = <&green_led>, <&heartbeat_led>; + + green-led { + color = ; +- default-state = "on"; + function = LED_FUNCTION_POWER; +- gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; + label = "rockpis:green:power"; ++ gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; ++ default-state = "on"; + }; + + blue-led { + color = ; +- default-state = "on"; + function = LED_FUNCTION_HEARTBEAT; +- gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; + label = "rockpis:blue:user"; ++ gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; ++ default-state = "on"; + }; + }; + ++ acodec-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,name = "rockchip,rk3308-acodec"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,codec-hp-det; ++ simple-audio-card,widgets = ++ "Headphone", "Headphones"; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s_8ch_2>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&codec>; ++ }; ++ }; ++ ++ sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,name = "i2s_8ch_0"; ++ ++ simple-audio-card,dai-link@1 { ++ format = "i2s"; ++ cpu { ++ sound-dai = <&i2s_8ch_0>; ++ }; ++ ++ codec { ++ sound-dai = <&pcm5102a>; ++ }; ++ }; ++ }; ++ ++ pcm5102a: pcm5102a { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5102a"; ++ pcm510x,format = "i2s"; ++ }; ++ + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + pinctrl-0 = <&wifi_enable_h>; + pinctrl-names = "default"; ++ /* ++ * On the module itself this is one of these (depending ++ * on the actual card populated): ++ * - SDIO_RESET_L_WL_REG_ON ++ * - PDN (power down when low) ++ */ + reset-gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>; + }; + +- vcc_1v8: vcc-1v8 { ++ vcc5v0_sys: vcc5v0-sys { + compatible = "regulator-fixed"; +- regulator-name = "vcc_1v8"; ++ regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; +- regulator-min-microvolt = <1800000>; +- regulator-max-microvolt = <1800000>; +- vin-supply = <&vcc_io>; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; + }; + +- vcc_io: vcc-io { ++ vdd_core: vdd-core { ++ compatible = "pwm-regulator"; ++ pwms = <&pwm0 0 5000 1>; ++ regulator-name = "vdd_core"; ++ regulator-min-microvolt = <827000>; ++ regulator-max-microvolt = <1340000>; ++ regulator-init-microvolt = <1015000>; ++ regulator-settling-time-up-us = <250>; ++ regulator-always-on; ++ regulator-boot-on; ++ pwm-supply = <&vcc5v0_sys>; ++ }; ++ ++ vdd_log: vdd-log { + compatible = "regulator-fixed"; +- regulator-name = "vcc_io"; ++ regulator-name = "vdd_log"; + regulator-always-on; + regulator-boot-on; +- regulator-min-microvolt = <3300000>; +- regulator-max-microvolt = <3300000>; ++ regulator-min-microvolt = <1050000>; ++ regulator-max-microvolt = <1050000>; + vin-supply = <&vcc5v0_sys>; + }; + +@@ -78,49 +131,50 @@ vcc_ddr: vcc-ddr { + vin-supply = <&vcc5v0_sys>; + }; + +- vcc5v0_otg: vcc5v0-otg { ++ vcc_1v8: vcc-1v8 { + compatible = "regulator-fixed"; +- enable-active-high; +- gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>; +- pinctrl-names = "default"; +- pinctrl-0 = <&otg_vbus_drv>; +- regulator-name = "vcc5v0_otg"; ++ regulator-name = "vcc_1v8"; + regulator-always-on; +- vin-supply = <&vcc5v0_sys>; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vin-supply = <&vcc_io>; + }; + +- vcc5v0_sys: vcc5v0-sys { ++ vcc_io: vcc-io { + compatible = "regulator-fixed"; +- regulator-name = "vcc5v0_sys"; ++ regulator-name = "vcc_io"; + regulator-always-on; + regulator-boot-on; +- regulator-min-microvolt = <5000000>; +- regulator-max-microvolt = <5000000>; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vcc5v0_sys>; + }; + +- vdd_core: vdd-core { +- compatible = "pwm-regulator"; +- pwms = <&pwm0 0 5000 1>; +- pwm-supply = <&vcc5v0_sys>; +- regulator-name = "vdd_core"; +- regulator-min-microvolt = <827000>; +- regulator-max-microvolt = <1340000>; +- regulator-settling-time-up-us = <250>; ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; + regulator-always-on; + regulator-boot-on; + }; + +- vdd_log: vdd-log { ++ vcc5v0_otg: vcc5v0-otg { + compatible = "regulator-fixed"; +- regulator-name = "vdd_log"; ++ regulator-name = "vcc5v0_otg"; + regulator-always-on; +- regulator-boot-on; +- regulator-min-microvolt = <1050000>; +- regulator-max-microvolt = <1050000>; ++ gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&otg_vbus_drv>; + vin-supply = <&vcc5v0_sys>; + }; + }; + ++&acodec { ++ status = "okay"; ++ #sound-dai-cells = <0>; ++}; ++ + &cpu0 { + cpu-supply = <&vdd_core>; + }; +@@ -132,13 +132,43 @@ + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd>; +- vmmc-supply = <&vcc_io>; + status = "okay"; + }; + ++&sdmmc { ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_det &sdmmc_bus4>; ++ card-detect-delay = <800>; ++ status = "okay"; ++}; ++ ++&sdio { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ cap-sd-highspeed; ++ cap-sdio-irq; ++ keep-power-in-suspend; ++ mmc-pwrseq = <&sdio_pwrseq>; ++ non-removable; ++ no-mmc; ++ status = "okay"; ++ ++ rtl8723ds: wifi@1 { ++ interrupt-parent = <&gpio0>; ++ interrupts = ; ++ interrupt-names = "host-wake"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_host_wake>; ++ }; ++}; ++ + &gmac { ++ phy-supply = <&vcc_phy>; + clock_in_out = "output"; +- phy-supply = <&vcc_io>; ++ assigned-clocks = <&cru SCLK_MAC>; ++ assigned-clock-parents = <&cru SCLK_MAC_SRC>; + snps,reset-gpio = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + snps,reset-delays-us = <0 50000 50000>; +@@ -207,8 +237,16 @@ + "", "", "", "", "", "", "", ""; + }; + +-&i2c1 { +- status = "okay"; ++&i2s_8ch_0 { ++ assigned-clocks = <&cru SCLK_I2S0_8CH_RX>; ++ assigned-clock-parents = <&cru SCLK_I2S0_8CH_TX_MUX>; ++ rockchip,clk-trcm = <1>; ++ #sound-dai-cells = <0>; ++}; ++ ++&i2s_8ch_2 { ++ status = "okay"; ++ #sound-dai-cells = <0>; + }; + + &pinctrl { +@@ -171,7 +262,9 @@ sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; ++ }; + ++ wifi { + wifi_host_wake: wifi-host-wake { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_down>; + }; +@@ -188,42 +281,29 @@ &saradc { + status = "okay"; + }; + +-&sdio { +- #address-cells = <1>; +- #size-cells = <0>; +- cap-sd-highspeed; +- cap-sdio-irq; +- keep-power-in-suspend; +- max-frequency = <1000000>; +- mmc-pwrseq = <&sdio_pwrseq>; +- non-removable; +- sd-uhs-sdr104; ++&tsadc { ++ rockchip,hw-tshut-mode = <0>; /* 0:CRU */ ++ rockchip,hw-tshut-polarity = <1>; /* 1:HIGH */ + status = "okay"; + }; + +-&sdmmc { +- cap-sd-highspeed; ++&i2c1 { + status = "okay"; + }; + +-&u2phy { +- status = "okay"; +- +- u2phy_host: host-port { +- phy-supply = <&vcc5v0_otg>; +- status = "okay"; +- }; +- +- u2phy_otg: otg-port { +- phy-supply = <&vcc5v0_otg>; +- status = "okay"; +- }; ++&spi2 { ++// status = "okay"; //conflicts with UART2 ++ max-freq = <10000000>; + }; + + &uart0 { + status = "okay"; + }; + ++&uart2 { ++ status = "okay"; ++}; ++ + &uart4 { + status = "okay"; + +@@ -234,19 +314,27 @@ bluetooth { + }; + }; + +-&usb_host_ehci { ++&u2phy { + status = "okay"; ++ ++ u2phy_host: host-port { ++ phy-supply = <&vcc5v0_otg>; ++ status = "okay"; ++ }; ++ ++ u2phy_otg: otg-port { ++ status = "okay"; ++ }; + }; + +-&usb_host_ohci { ++&usb20_otg { + status = "okay"; + }; + +-&usb20_otg { +- dr_mode = "peripheral"; ++&usb_host_ehci { + status = "okay"; + }; + +-&wdt { ++&usb_host_ohci{ + status = "okay"; + }; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0005-arm64-dts-rk3308-Add-gmac-node-at-dtsi-level.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0005-arm64-dts-rk3308-Add-gmac-node-at-dtsi-level.patch new file mode 100644 index 000000000000..3db2657a852c --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0005-arm64-dts-rk3308-Add-gmac-node-at-dtsi-level.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ashthespy +Date: Thu, 16 Jan 2020 21:13:09 +0100 +Subject: arm64: dts: rk3308: Add mac node at dtsi level + +--- + arch/arm64/boot/dts/rockchip/rk3308.dtsi | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308.dtsi b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +index 2ae4bb7d5e62..2a6f41e2281f 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +@@ -24,6 +24,7 @@ aliases { + i2c1 = &i2c1; + i2c2 = &i2c2; + i2c3 = &i2c3; ++ ethernet0 = &gmac; + serial0 = &uart0; + serial1 = &uart1; + serial2 = &uart2; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0007-arm64-dts-rockchip-add-cpu-s-thermal-config-for-rk33.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0007-arm64-dts-rockchip-add-cpu-s-thermal-config-for-rk33.patch new file mode 100644 index 000000000000..2d86ad6c3580 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0007-arm64-dts-rockchip-add-cpu-s-thermal-config-for-rk33.patch @@ -0,0 +1,87 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ashthespy +Date: Fri, 17 Jan 2020 15:57:53 +0100 +Subject: arm64: dts: rockchip: add cpu's thermal config for rk3308 + +--- + arch/arm64/boot/dts/rockchip/rk3308.dtsi | 64 ++++++++++ + 1 file changed, 64 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308.dtsi b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +index 2a6f41e2281f..fde32008902a 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +@@ -552,6 +552,70 @@ saradc: saradc@ff1e0000 { + status = "disabled"; + }; + ++ thermal_zones: thermal-zones { ++ ++ soc_thermal: soc-thermal { ++ polling-delay-passive = <20>; ++ polling-delay = <1000>; ++ sustainable-power = <300>; ++ ++ thermal-sensors = <&tsadc 1>; ++ ++ trips { ++ threshold: trip-point-0 { ++ temperature = <70000>; ++ hysteresis = <2000>; ++ type = "passive"; ++ }; ++ target: trip-point-1 { ++ temperature = <85000>; ++ hysteresis = <2000>; ++ type = "passive"; ++ }; ++ soc_crit: soc-crit { ++ temperature = <115000>; ++ hysteresis = <2000>; ++ type = "critical"; ++ }; ++ }; ++ ++ cooling-maps { ++ map0 { ++ trip = <&target>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ contribution = <4096>; ++ }; ++ }; ++ ++ }; ++ ++ logic_thermal: logic-thermal { ++ polling-delay-passive = <100>; /* milliseconds */ ++ polling-delay = <1000>; /* milliseconds */ ++ ++ thermal-sensors = <&tsadc 0>; ++ }; ++ }; ++ ++ tsadc: tsadc@ff1f0000 { ++ compatible = "rockchip,rk3308-tsadc"; ++ reg = <0x0 0xff1f0000 0x0 0x100>; ++ interrupts = ; ++ rockchip,grf = <&grf>; ++ clocks = <&cru SCLK_TSADC>, <&cru PCLK_TSADC>; ++ clock-names = "tsadc", "apb_pclk"; ++ assigned-clocks = <&cru SCLK_TSADC>; ++ assigned-clock-rates = <50000>; ++ resets = <&cru SRST_TSADC>; ++ reset-names = "tsadc-apb"; ++ pinctrl-names = "gpio", "otpout"; ++ pinctrl-0 = <&tsadc_otp_pin>; ++ pinctrl-1 = <&tsadc_otp_out>; ++ #thermal-sensor-cells = <1>; ++ rockchip,hw-tshut-temp = <120000>; ++ status = "disabled"; ++ }; ++ + dmac0: dma-controller@ff2c0000 { + compatible = "arm,pl330", "arm,primecell"; + reg = <0x0 0xff2c0000 0x0 0x4000>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0008-thermal-rockchip-add-tsadc-support-for-rk3308.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0008-thermal-rockchip-add-tsadc-support-for-rk3308.patch new file mode 100644 index 000000000000..3902d61c8fba --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0008-thermal-rockchip-add-tsadc-support-for-rk3308.patch @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Rocky Hao +Date: Fri, 9 Mar 2018 17:36:39 +0800 +Subject: thermal: rockchip: add tsadc support for rk3308 + +Change-Id: Ibf1782ca471c8ad4b14d6fd64eeb123181903adc +Signed-off-by: Rocky Hao +--- + Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml | 1 + + drivers/thermal/rockchip_thermal.c | 26 ++++++++++ + 2 files changed, 27 insertions(+) + +diff --git a/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml b/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml +index 55f8ec0bec01..c822baf04aed 100644 +--- a/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml ++++ b/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml +@@ -15,6 +15,7 @@ properties: + - rockchip,px30-tsadc + - rockchip,rk3228-tsadc + - rockchip,rk3288-tsadc ++ - rockchip,rk3308-tsadc + - rockchip,rk3328-tsadc + - rockchip,rk3368-tsadc + - rockchip,rk3399-tsadc +diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c +index 77231a9d28ff..13182e2a3142 100644 +--- a/drivers/thermal/rockchip_thermal.c ++++ b/drivers/thermal/rockchip_thermal.c +@@ -1060,6 +1060,28 @@ static void rk_tsadcv3_tshut_mode(int chn, void __iomem *regs, + writel_relaxed(val_cru, regs + TSADCV3_HSHUT_CRU_INT_EN); + } + ++static const struct rockchip_tsadc_chip rk3308_tsadc_data = { ++ .chn_num = 2, /* 2 channels for tsadc */ ++ ++ .tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */ ++ .tshut_temp = 95000, ++ ++ .initialize = rk_tsadcv4_initialize, ++ .irq_ack = rk_tsadcv3_irq_ack, ++ .control = rk_tsadcv3_control, ++ .get_temp = rk_tsadcv2_get_temp, ++ .set_alarm_temp = rk_tsadcv2_alarm_temp, ++ .set_tshut_temp = rk_tsadcv2_tshut_temp, ++ .set_tshut_mode = rk_tsadcv2_tshut_mode, ++ ++ .table = { ++ .id = rk3328_code_table, ++ .length = ARRAY_SIZE(rk3328_code_table), ++ .data_mask = TSADCV2_DATA_MASK, ++ .mode = ADC_INCREMENT, ++ }, ++}; ++ + static const struct rockchip_tsadc_chip px30_tsadc_data = { + /* cpu, gpu */ + .chn_offset = 0, +@@ -1321,6 +1343,10 @@ static const struct of_device_id of_rockchip_thermal_match[] = { + .compatible = "rockchip,rk3288-tsadc", + .data = (void *)&rk3288_tsadc_data, + }, ++ { ++ .compatible = "rockchip,rk3308-tsadc", ++ .data = (void *)&rk3308_tsadc_data, ++ }, + { + .compatible = "rockchip,rk3328-tsadc", + .data = (void *)&rk3328_tsadc_data, +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0010-arm64-dts-rockchip-add-i2s_8ch-for-rk3308.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0010-arm64-dts-rockchip-add-i2s_8ch-for-rk3308.patch new file mode 100644 index 000000000000..e4c527331216 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0010-arm64-dts-rockchip-add-i2s_8ch-for-rk3308.patch @@ -0,0 +1,126 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ashthespy +Date: Fri, 17 Jan 2020 16:22:13 +0100 +Subject: arm64: dts: rockchip: add i2s_8ch for rk3308 + +--- + arch/arm64/boot/dts/rockchip/rk3308.dtsi | 103 ++++++++++ + 1 file changed, 103 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308.dtsi b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +index fde32008902a..1567758ca90e 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +@@ -638,6 +638,109 @@ dmac1: dma-controller@ff2d0000 { + #dma-cells = <1>; + }; + ++ i2s_8ch_0: i2s@ff300000 { ++ compatible = "rockchip,rk3308-i2s-tdm"; ++ reg = <0x0 0xff300000 0x0 0x1000>; ++ interrupts = ; ++ clocks = <&cru SCLK_I2S0_8CH_TX>, <&cru SCLK_I2S0_8CH_RX>, <&cru HCLK_I2S0_8CH>, ++ <&cru SCLK_I2S0_8CH_TX_SRC>, ++ <&cru SCLK_I2S0_8CH_RX_SRC>, ++ <&cru PLL_VPLL0>, ++ <&cru PLL_VPLL1>; ++ clock-names = "mclk_tx", "mclk_rx", "hclk", ++ "mclk_tx_src", "mclk_rx_src", ++ "mclk_root0", "mclk_root1"; ++ dmas = <&dmac1 0>, <&dmac1 1>; ++ dma-names = "tx", "rx"; ++ resets = <&cru SRST_I2S0_8CH_TX_M>, <&cru SRST_I2S0_8CH_RX_M>; ++ reset-names = "tx-m", "rx-m"; ++ rockchip,cru = <&cru>; ++ rockchip,grf = <&grf>; ++ rockchip,mclk-calibrate; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_8ch_0_sclktx ++ &i2s_8ch_0_sclkrx ++ &i2s_8ch_0_lrcktx ++ &i2s_8ch_0_lrckrx ++ &i2s_8ch_0_sdi0 ++ &i2s_8ch_0_sdi1 ++ &i2s_8ch_0_sdi2 ++ &i2s_8ch_0_sdi3 ++ &i2s_8ch_0_sdo0 ++ &i2s_8ch_0_sdo1 ++ &i2s_8ch_0_sdo2 ++ &i2s_8ch_0_sdo3 ++ &i2s_8ch_0_mclk>; ++ status = "disabled"; ++ }; ++ ++ i2s_8ch_1: i2s@ff310000 { ++ compatible = "rockchip,rk3308-i2s-tdm"; ++ reg = <0x0 0xff310000 0x0 0x1000>; ++ interrupts = ; ++ clocks = <&cru SCLK_I2S1_8CH_TX>, <&cru SCLK_I2S1_8CH_RX>, <&cru HCLK_I2S1_8CH>, ++ <&cru SCLK_I2S1_8CH_TX_SRC>, ++ <&cru SCLK_I2S1_8CH_RX_SRC>, ++ <&cru PLL_VPLL0>, ++ <&cru PLL_VPLL1>; ++ clock-names = "mclk_tx", "mclk_rx", "hclk", ++ "mclk_tx_src", "mclk_rx_src", ++ "mclk_root0", "mclk_root1"; ++ dmas = <&dmac1 2>, <&dmac1 3>; ++ dma-names = "tx", "rx"; ++ resets = <&cru SRST_I2S1_8CH_TX_M>, <&cru SRST_I2S1_8CH_RX_M>; ++ reset-names = "tx-m", "rx-m"; ++ rockchip,cru = <&cru>; ++ rockchip,grf = <&grf>; ++ rockchip,mclk-calibrate; ++ rockchip,io-multiplex; ++ status = "disabled"; ++ }; ++ ++ i2s_8ch_2: i2s@ff320000 { ++ compatible = "rockchip,rk3308-i2s-tdm"; ++ reg = <0x0 0xff320000 0x0 0x1000>; ++ interrupts = ; ++ clocks = <&cru SCLK_I2S2_8CH_TX>, <&cru SCLK_I2S2_8CH_RX>, <&cru HCLK_I2S2_8CH>, ++ <&cru SCLK_I2S2_8CH_TX_SRC>, ++ <&cru SCLK_I2S2_8CH_RX_SRC>, ++ <&cru PLL_VPLL0>, ++ <&cru PLL_VPLL1>; ++ clock-names = "mclk_tx", "mclk_rx", "hclk", ++ "mclk_tx_src", "mclk_rx_src", ++ "mclk_root0", "mclk_root1"; ++ dmas = <&dmac1 4>, <&dmac1 5>; ++ dma-names = "tx", "rx"; ++ resets = <&cru SRST_I2S2_8CH_TX_M>, <&cru SRST_I2S2_8CH_RX_M>; ++ reset-names = "tx-m", "rx-m"; ++ rockchip,cru = <&cru>; ++ rockchip,grf = <&grf>; ++ rockchip,mclk-calibrate; ++ status = "disabled"; ++ }; ++ ++ i2s_8ch_3: i2s@ff330000 { ++ compatible = "rockchip,rk3308-i2s-tdm"; ++ reg = <0x0 0xff330000 0x0 0x1000>; ++ interrupts = ; ++ clocks = <&cru SCLK_I2S3_8CH_TX>, <&cru SCLK_I2S3_8CH_RX>, <&cru HCLK_I2S3_8CH>, ++ <&cru SCLK_I2S3_8CH_TX_SRC>, ++ <&cru SCLK_I2S3_8CH_RX_SRC>, ++ <&cru PLL_VPLL0>, ++ <&cru PLL_VPLL1>; ++ clock-names = "mclk_tx", "mclk_rx", "hclk", ++ "mclk_tx_src", "mclk_rx_src", ++ "mclk_root0", "mclk_root1"; ++ dmas = <&dmac1 7>; ++ dma-names = "rx"; ++ resets = <&cru SRST_I2S3_8CH_TX_M>, <&cru SRST_I2S3_8CH_RX_M>; ++ reset-names = "tx-m", "rx-m"; ++ rockchip,cru = <&cru>; ++ rockchip,grf = <&grf>; ++ rockchip,mclk-calibrate; ++ status = "disabled"; ++ }; ++ + i2s_2ch_0: i2s@ff350000 { + compatible = "rockchip,rk3308-i2s", "rockchip,rk3066-i2s"; + reg = <0x0 0xff350000 0x0 0x1000>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0012-arm64-dts-rk3308-Add-rk-timer-rtc.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0012-arm64-dts-rk3308-Add-rk-timer-rtc.patch new file mode 100644 index 000000000000..e8ecc0a02a2f --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0012-arm64-dts-rk3308-Add-rk-timer-rtc.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ashthespy +Date: Fri, 17 Jan 2020 17:12:51 +0100 +Subject: arm64: dts: rk3308: Add rk-timer-rtc + +--- + arch/arm64/boot/dts/rockchip/rk3308.dtsi | 11 +++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308.dtsi b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +index 1567758ca90e..291f011800b2 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +@@ -540,6 +540,15 @@ rktimer: rktimer@ff1a0000 { + clock-names = "pclk", "timer"; + }; + ++ rk_timer_rtc: rk-timer-rtc@ff1a0020 { ++ compatible = "rockchip,rk3308-timer-rtc"; ++ reg = <0x0 0xff1a0020 0x0 0x20>; ++ interrupts = ; ++ clocks = <&cru PCLK_TIMER>, <&cru SCLK_TIMER1>; ++ clock-names = "pclk", "timer"; ++ status = "disabled"; ++ }; ++ + saradc: saradc@ff1e0000 { + compatible = "rockchip,rk3308-saradc", "rockchip,rk3399-saradc"; + reg = <0x0 0xff1e0000 0x0 0x100>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0018-ASoC-codecs-Add-RK3308-internal-codec-driver.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0018-ASoC-codecs-Add-RK3308-internal-codec-driver.patch new file mode 100644 index 000000000000..30bfaeaf504a --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0018-ASoC-codecs-Add-RK3308-internal-codec-driver.patch @@ -0,0 +1,2638 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Xing Zheng +Date: Sun, 11 Mar 2018 11:37:28 +0800 +Subject: ASoC: codecs: Add RK3308 internal codec driver + +This adds support for the RK3308 audio codec. + +Change-Id: Ieccdebaa27f4a46f6de9406046a6e02e20398013 +Signed-off-by: Xing Zheng +--- + sound/soc/codecs/Kconfig | 5 + + sound/soc/codecs/Makefile | 2 + + sound/soc/codecs/rk3308_codec.c | 1604 ++++++++++ + sound/soc/codecs/rk3308_codec.h | 960 ++++++ + 4 files changed, 2571 insertions(+) + +diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig +index f1e1dbc509f6..8ce353dad530 100644 +--- a/sound/soc/codecs/Kconfig ++++ b/sound/soc/codecs/Kconfig +@@ -177,6 +177,7 @@ config SND_SOC_ALL_CODECS + imply SND_SOC_PCM512x_I2C + imply SND_SOC_PCM512x_SPI + imply SND_SOC_PEB2466 ++ imply SND_SOC_RK3308 + imply SND_SOC_RK3328 + imply SND_SOC_RK817 + imply SND_SOC_RT274 +@@ -1370,6 +1371,10 @@ config SND_SOC_PEB2466 + To compile this driver as a module, choose M here: the module + will be called snd-soc-peb2466. + ++config SND_SOC_RK3308 ++ select REGMAP_MMIO ++ tristate "Rockchip RK3308 CODEC" ++ + config SND_SOC_RK3328 + tristate "Rockchip RK3328 audio CODEC" + select REGMAP_MMIO +diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile +index a87e56938ce5..8f539b13864d 100644 +--- a/sound/soc/codecs/Makefile ++++ b/sound/soc/codecs/Makefile +@@ -199,6 +199,7 @@ snd-soc-pcm512x-objs := pcm512x.o + snd-soc-pcm512x-i2c-objs := pcm512x-i2c.o + snd-soc-pcm512x-spi-objs := pcm512x-spi.o + snd-soc-peb2466-objs := peb2466.o ++snd-soc-rk3308-objs := rk3308_codec.o + snd-soc-rk3328-objs := rk3328_codec.o + snd-soc-rk817-objs := rk817_codec.o + snd-soc-rl6231-objs := rl6231.o +@@ -580,6 +581,7 @@ obj-$(CONFIG_SND_SOC_PCM512x) += snd-soc-pcm512x.o + obj-$(CONFIG_SND_SOC_PCM512x_I2C) += snd-soc-pcm512x-i2c.o + obj-$(CONFIG_SND_SOC_PCM512x_SPI) += snd-soc-pcm512x-spi.o + obj-$(CONFIG_SND_SOC_PEB2466) += snd-soc-peb2466.o ++obj-$(CONFIG_SND_SOC_RK3308) += snd-soc-rk3308.o + obj-$(CONFIG_SND_SOC_RK3328) += snd-soc-rk3328.o + obj-$(CONFIG_SND_SOC_RK817) += snd-soc-rk817.o + obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o +diff --git a/sound/soc/codecs/rk3308_codec.c b/sound/soc/codecs/rk3308_codec.c +new file mode 100644 +index 000000000000..106f09738dd0 +--- /dev/null ++++ b/sound/soc/codecs/rk3308_codec.c +@@ -0,0 +1,1604 @@ ++/* ++ * rk3308_codec.c -- RK3308 ALSA Soc Audio Driver ++ * ++ * Copyright (c) 2018, Fuzhou Rockchip Electronics Co., Ltd All rights reserved. ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms and conditions of the GNU General Public License, ++ * version 2, as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "rk3308_codec.h" ++ ++struct rk3308_codec_priv { ++ const struct device *plat_dev; ++ struct device dev; ++ struct reset_control *reset; ++ struct regmap *regmap; ++ struct clk *pclk; ++ struct gpio_desc *spk_ctl_gpio; ++ int adc_ch; /* To select ADCs for channel */ ++ int adc_ch0_using_linein; ++}; ++ ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_alc_agc_ch_gain_tlv, ++ -1800, 150, 2850); ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_alc_agc_ch_max_gain_tlv, ++ -1350, 600, 2850); ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_alc_agc_ch_min_gain_tlv, ++ -1800, 600, 2400); ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_adc_mic_gain_tlv, ++ 0, 600, 3000); ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_adc_alc_gain_tlv, ++ -1800, 150, 2850); ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_dac_gain_tlv, ++ 0, 150, 600); ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_dac_hpout_gain_tlv, ++ -3900, 150, 600); ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_dac_hpmix_gain_tlv, ++ -600, 600, 0); ++ ++static const struct snd_kcontrol_new rk3308_codec_dapm_controls[] = { ++ /* ALC AGC Channel*/ ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 0 Volume", ++ RK3308_ALC_L_DIG_CON03(0), ++ RK3308_ALC_R_DIG_CON03(0), ++ RK3308_AGC_PGA_GAIN_SFT, ++ RK3308_AGC_PGA_GAIN_NDB_18, ++ RK3308_AGC_PGA_GAIN_PDB_28_5, ++ 0, rk3308_codec_alc_agc_ch_gain_tlv), ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 1 Volume", ++ RK3308_ALC_L_DIG_CON03(1), ++ RK3308_ALC_R_DIG_CON03(1), ++ RK3308_AGC_PGA_GAIN_SFT, ++ RK3308_AGC_PGA_GAIN_NDB_18, ++ RK3308_AGC_PGA_GAIN_PDB_28_5, ++ 0, rk3308_codec_alc_agc_ch_gain_tlv), ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 2 Volume", ++ RK3308_ALC_L_DIG_CON03(2), ++ RK3308_ALC_R_DIG_CON03(2), ++ RK3308_AGC_PGA_GAIN_SFT, ++ RK3308_AGC_PGA_GAIN_NDB_18, ++ RK3308_AGC_PGA_GAIN_PDB_28_5, ++ 0, rk3308_codec_alc_agc_ch_gain_tlv), ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 3 Volume", ++ RK3308_ALC_L_DIG_CON03(3), ++ RK3308_ALC_R_DIG_CON03(3), ++ RK3308_AGC_PGA_GAIN_SFT, ++ RK3308_AGC_PGA_GAIN_NDB_18, ++ RK3308_AGC_PGA_GAIN_PDB_28_5, ++ 0, rk3308_codec_alc_agc_ch_gain_tlv), ++ ++ /* ALC AGC MAX */ ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 0 Max Volume", ++ RK3308_ALC_L_DIG_CON09(0), ++ RK3308_ALC_R_DIG_CON09(0), ++ RK3308_AGC_MAX_GAIN_PGA_SFT, ++ RK3308_AGC_MAX_GAIN_PGA_NDB_13_5, ++ RK3308_AGC_MAX_GAIN_PGA_PDB_28_5, ++ 0, rk3308_codec_alc_agc_ch_max_gain_tlv), ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 1 Max Volume", ++ RK3308_ALC_L_DIG_CON09(1), ++ RK3308_ALC_R_DIG_CON09(1), ++ RK3308_AGC_MAX_GAIN_PGA_SFT, ++ RK3308_AGC_MAX_GAIN_PGA_NDB_13_5, ++ RK3308_AGC_MAX_GAIN_PGA_PDB_28_5, ++ 0, rk3308_codec_alc_agc_ch_max_gain_tlv), ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 2 Max Volume", ++ RK3308_ALC_L_DIG_CON09(2), ++ RK3308_ALC_R_DIG_CON09(2), ++ RK3308_AGC_MAX_GAIN_PGA_SFT, ++ RK3308_AGC_MAX_GAIN_PGA_NDB_13_5, ++ RK3308_AGC_MAX_GAIN_PGA_PDB_28_5, ++ 0, rk3308_codec_alc_agc_ch_max_gain_tlv), ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 3 Max Volume", ++ RK3308_ALC_L_DIG_CON09(3), ++ RK3308_ALC_R_DIG_CON09(3), ++ RK3308_AGC_MAX_GAIN_PGA_SFT, ++ RK3308_AGC_MAX_GAIN_PGA_NDB_13_5, ++ RK3308_AGC_MAX_GAIN_PGA_PDB_28_5, ++ 0, rk3308_codec_alc_agc_ch_max_gain_tlv), ++ ++ /* ALC AGC MIN */ ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 0 Min Volume", ++ RK3308_ALC_L_DIG_CON09(0), ++ RK3308_ALC_R_DIG_CON09(0), ++ RK3308_AGC_MIN_GAIN_PGA_SFT, ++ RK3308_AGC_MIN_GAIN_PGA_NDB_18, ++ RK3308_AGC_MIN_GAIN_PGA_PDB_24, ++ 0, rk3308_codec_alc_agc_ch_min_gain_tlv), ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 1 Min Volume", ++ RK3308_ALC_L_DIG_CON09(1), ++ RK3308_ALC_R_DIG_CON09(1), ++ RK3308_AGC_MIN_GAIN_PGA_SFT, ++ RK3308_AGC_MIN_GAIN_PGA_NDB_18, ++ RK3308_AGC_MIN_GAIN_PGA_PDB_24, ++ 0, rk3308_codec_alc_agc_ch_min_gain_tlv), ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 2 Min Volume", ++ RK3308_ALC_L_DIG_CON09(2), ++ RK3308_ALC_R_DIG_CON09(2), ++ RK3308_AGC_MIN_GAIN_PGA_SFT, ++ RK3308_AGC_MIN_GAIN_PGA_NDB_18, ++ RK3308_AGC_MIN_GAIN_PGA_PDB_24, ++ 0, rk3308_codec_alc_agc_ch_min_gain_tlv), ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 3 Min Volume", ++ RK3308_ALC_L_DIG_CON09(3), ++ RK3308_ALC_R_DIG_CON09(3), ++ RK3308_AGC_MIN_GAIN_PGA_SFT, ++ RK3308_AGC_MIN_GAIN_PGA_NDB_18, ++ RK3308_AGC_MIN_GAIN_PGA_PDB_24, ++ 0, rk3308_codec_alc_agc_ch_min_gain_tlv), ++ ++ /* ADC MIC */ ++ SOC_SINGLE_RANGE_TLV("ADC MIC Channel 0 Left Volume", ++ RK3308_ADC_ANA_CON01(0), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_0DB, ++ RK3308_ADC_CH1_MIC_GAIN_30DB, ++ 0, rk3308_codec_adc_mic_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC MIC Channel 0 Right Volume", ++ RK3308_ADC_ANA_CON01(0), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_0DB, ++ RK3308_ADC_CH2_MIC_GAIN_30DB, ++ 0, rk3308_codec_adc_mic_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC MIC Channel 1 Left Volume", ++ RK3308_ADC_ANA_CON01(1), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_0DB, ++ RK3308_ADC_CH1_MIC_GAIN_30DB, ++ 0, rk3308_codec_adc_mic_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC MIC Channel 1 Right Volume", ++ RK3308_ADC_ANA_CON01(1), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_0DB, ++ RK3308_ADC_CH2_MIC_GAIN_30DB, ++ 0, rk3308_codec_adc_mic_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC MIC Channel 2 Left Volume", ++ RK3308_ADC_ANA_CON01(2), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_0DB, ++ RK3308_ADC_CH1_MIC_GAIN_30DB, ++ 0, rk3308_codec_adc_mic_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC MIC Channel 2 Right Volume", ++ RK3308_ADC_ANA_CON01(2), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_0DB, ++ RK3308_ADC_CH2_MIC_GAIN_30DB, ++ 0, rk3308_codec_adc_mic_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC MIC Channel 3 Left Volume", ++ RK3308_ADC_ANA_CON01(3), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_0DB, ++ RK3308_ADC_CH1_MIC_GAIN_30DB, ++ 0, rk3308_codec_adc_mic_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC MIC Channel 3 Right Volume", ++ RK3308_ADC_ANA_CON01(3), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_0DB, ++ RK3308_ADC_CH2_MIC_GAIN_30DB, ++ 0, rk3308_codec_adc_mic_gain_tlv), ++ ++ /* ADC ALC */ ++ SOC_SINGLE_RANGE_TLV("ADC ALC Channel 0 Left Volume", ++ RK3308_ADC_ANA_CON03(0), ++ RK3308_ADC_CH1_ALC_GAIN_SFT, ++ RK3308_ADC_CH1_ALC_GAIN_NDB_18, ++ RK3308_ADC_CH1_ALC_GAIN_PDB_28_5, ++ 0, rk3308_codec_adc_alc_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC ALC Channel 0 Right Volume", ++ RK3308_ADC_ANA_CON04(0), ++ RK3308_ADC_CH2_ALC_GAIN_SFT, ++ RK3308_ADC_CH2_ALC_GAIN_NDB_18, ++ RK3308_ADC_CH2_ALC_GAIN_PDB_28_5, ++ 0, rk3308_codec_adc_alc_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC ALC Channel 1 Left Volume", ++ RK3308_ADC_ANA_CON03(1), ++ RK3308_ADC_CH1_ALC_GAIN_SFT, ++ RK3308_ADC_CH1_ALC_GAIN_NDB_18, ++ RK3308_ADC_CH1_ALC_GAIN_PDB_28_5, ++ 0, rk3308_codec_adc_alc_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC ALC Channel 1 Right Volume", ++ RK3308_ADC_ANA_CON04(1), ++ RK3308_ADC_CH2_ALC_GAIN_SFT, ++ RK3308_ADC_CH2_ALC_GAIN_NDB_18, ++ RK3308_ADC_CH2_ALC_GAIN_PDB_28_5, ++ 0, rk3308_codec_adc_alc_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC ALC Channel 2 Left Volume", ++ RK3308_ADC_ANA_CON03(2), ++ RK3308_ADC_CH1_ALC_GAIN_SFT, ++ RK3308_ADC_CH1_ALC_GAIN_NDB_18, ++ RK3308_ADC_CH1_ALC_GAIN_PDB_28_5, ++ 0, rk3308_codec_adc_alc_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC ALC Channel 2 Right Volume", ++ RK3308_ADC_ANA_CON04(2), ++ RK3308_ADC_CH2_ALC_GAIN_SFT, ++ RK3308_ADC_CH2_ALC_GAIN_NDB_18, ++ RK3308_ADC_CH2_ALC_GAIN_PDB_28_5, ++ 0, rk3308_codec_adc_alc_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC ALC Channel 3 Left Volume", ++ RK3308_ADC_ANA_CON03(3), ++ RK3308_ADC_CH1_ALC_GAIN_SFT, ++ RK3308_ADC_CH1_ALC_GAIN_NDB_18, ++ RK3308_ADC_CH1_ALC_GAIN_PDB_28_5, ++ 0, rk3308_codec_adc_alc_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC ALC Channel 3 Right Volume", ++ RK3308_ADC_ANA_CON04(3), ++ RK3308_ADC_CH2_ALC_GAIN_SFT, ++ RK3308_ADC_CH2_ALC_GAIN_NDB_18, ++ RK3308_ADC_CH2_ALC_GAIN_PDB_28_5, ++ 0, rk3308_codec_adc_alc_gain_tlv), ++ ++ /* DAC */ ++ SOC_SINGLE_RANGE_TLV("DAC Left Volume", ++ RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_GAIN_SFT, ++ RK3308_DAC_L_GAIN_0DB, ++ RK3308_DAC_L_GAIN_PDB_6, ++ 0, rk3308_codec_dac_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("DAC Right Volume", ++ RK3308_DAC_ANA_CON04, ++ RK3308_DAC_R_GAIN_SFT, ++ RK3308_DAC_R_GAIN_0DB, ++ RK3308_DAC_R_GAIN_PDB_6, ++ 0, rk3308_codec_dac_gain_tlv), ++ ++ /* DAC HPOUT */ ++ SOC_SINGLE_RANGE_TLV("DAC HPOUT Left Volume", ++ RK3308_DAC_ANA_CON05, ++ RK3308_DAC_L_HPOUT_GAIN_SFT, ++ RK3308_DAC_L_HPOUT_GAIN_NDB_39, ++ RK3308_DAC_L_HPOUT_GAIN_PDB_6, ++ 0, rk3308_codec_dac_hpout_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("DAC HPOUT Right Volume", ++ RK3308_DAC_ANA_CON06, ++ RK3308_DAC_R_HPOUT_GAIN_SFT, ++ RK3308_DAC_R_HPOUT_GAIN_NDB_39, ++ RK3308_DAC_R_HPOUT_GAIN_PDB_6, ++ 0, rk3308_codec_dac_hpout_gain_tlv), ++ ++ /* DAC HPMIX */ ++ SOC_SINGLE_RANGE_TLV("DAC HPMIX Left Volume", ++ RK3308_DAC_ANA_CON05, ++ RK3308_DAC_L_HPMIX_GAIN_SFT, ++ RK3308_DAC_L_HPMIX_GAIN_NDB_6, ++ RK3308_DAC_L_HPMIX_GAIN_0DB, ++ 0, rk3308_codec_dac_hpmix_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("DAC HPMIX Right Volume", ++ RK3308_DAC_ANA_CON05, ++ RK3308_DAC_R_HPMIX_GAIN_SFT, ++ RK3308_DAC_R_HPMIX_GAIN_NDB_6, ++ RK3308_DAC_R_HPMIX_GAIN_0DB, ++ 0, rk3308_codec_dac_hpmix_gain_tlv), ++}; ++ ++static void rk3308_speaker_ctl(struct rk3308_codec_priv *rk3308, int on) ++{ ++ gpiod_direction_output(rk3308->spk_ctl_gpio, on); ++} ++ ++static int rk3308_codec_reset(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ reset_control_assert(rk3308->reset); ++ usleep_range(200, 300); /* estimated value */ ++ reset_control_deassert(rk3308->reset); ++ ++ regmap_write(rk3308->regmap, RK3308_GLB_CON, 0x00); ++ usleep_range(200, 300); /* estimated value */ ++ regmap_write(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_SYS_WORK | ++ RK3308_DAC_DIG_WORK | ++ RK3308_ADC_DIG_WORK); ++ ++ return 0; ++} ++ ++static int rk3308_set_bias_level(struct snd_soc_codec *codec, ++ enum snd_soc_bias_level level) ++{ ++ switch (level) { ++ case SND_SOC_BIAS_ON: ++ break; ++ ++ case SND_SOC_BIAS_PREPARE: ++ break; ++ ++ case SND_SOC_BIAS_STANDBY: ++ case SND_SOC_BIAS_OFF: ++ break; ++ } ++ ++ snd_soc_codec_force_bias_level(codec, level); ++ ++ return 0; ++} ++ ++static int rk3308_set_dai_fmt(struct snd_soc_dai *codec_dai, ++ unsigned int fmt) ++{ ++ struct snd_soc_codec *codec = codec_dai->codec; ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ unsigned int adc_aif1 = 0, adc_aif2 = 0, dac_aif1 = 0, dac_aif2 = 0; ++ int ch = rk3308->adc_ch; ++ ++ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { ++ case SND_SOC_DAIFMT_CBS_CFS: ++ adc_aif2 |= RK3308_ADC_IO_MODE_SLAVE; ++ adc_aif2 |= RK3308_ADC_MODE_SLAVE; ++ dac_aif2 |= RK3308_DAC_IO_MODE_SLAVE; ++ dac_aif2 |= RK3308_DAC_MODE_SLAVE; ++ break; ++ case SND_SOC_DAIFMT_CBM_CFM: ++ adc_aif2 |= RK3308_ADC_IO_MODE_MASTER; ++ adc_aif2 |= RK3308_ADC_MODE_MASTER; ++ dac_aif2 |= RK3308_DAC_IO_MODE_MASTER; ++ dac_aif2 |= RK3308_DAC_MODE_MASTER; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { ++ case SND_SOC_DAIFMT_DSP_A: ++ adc_aif1 |= RK3308_ADC_I2S_MODE_PCM; ++ dac_aif1 |= RK3308_DAC_I2S_MODE_PCM; ++ break; ++ case SND_SOC_DAIFMT_I2S: ++ adc_aif1 |= RK3308_ADC_I2S_MODE_I2S; ++ dac_aif1 |= RK3308_DAC_I2S_MODE_I2S; ++ break; ++ case SND_SOC_DAIFMT_RIGHT_J: ++ adc_aif1 |= RK3308_ADC_I2S_MODE_RJ; ++ dac_aif1 |= RK3308_DAC_I2S_MODE_RJ; ++ break; ++ case SND_SOC_DAIFMT_LEFT_J: ++ adc_aif1 |= RK3308_ADC_I2S_MODE_RJ; ++ dac_aif1 |= RK3308_DAC_I2S_MODE_LJ; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ switch (fmt & SND_SOC_DAIFMT_INV_MASK) { ++ case SND_SOC_DAIFMT_NB_NF: ++ adc_aif1 |= RK3308_ADC_I2S_LRC_POL_NORMAL; ++ adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_NORMAL; ++ dac_aif1 |= RK3308_DAC_I2S_LRC_POL_NORMAL; ++ dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_NORMAL; ++ break; ++ case SND_SOC_DAIFMT_IB_IF: ++ adc_aif1 |= RK3308_ADC_I2S_LRC_POL_REVERSAL; ++ adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_REVERSAL; ++ dac_aif1 |= RK3308_DAC_I2S_LRC_POL_REVERSAL; ++ dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_REVERSAL; ++ break; ++ case SND_SOC_DAIFMT_IB_NF: ++ adc_aif1 |= RK3308_ADC_I2S_LRC_POL_NORMAL; ++ adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_REVERSAL; ++ dac_aif1 |= RK3308_DAC_I2S_LRC_POL_NORMAL; ++ dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_REVERSAL; ++ break; ++ case SND_SOC_DAIFMT_NB_IF: ++ adc_aif1 |= RK3308_ADC_I2S_LRC_POL_REVERSAL; ++ adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_NORMAL; ++ dac_aif1 |= RK3308_DAC_I2S_LRC_POL_REVERSAL; ++ dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_NORMAL; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON01(ch), ++ RK3308_ADC_I2S_LRC_POL_MSK | ++ RK3308_ADC_I2S_MODE_MSK, ++ adc_aif1); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON02(ch), ++ RK3308_ADC_IO_MODE_MSK | ++ RK3308_ADC_MODE_MSK | ++ RK3308_ADC_I2S_BIT_CLK_POL_MSK, ++ adc_aif2); ++ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON01, ++ RK3308_DAC_I2S_LRC_POL_MSK | ++ RK3308_DAC_I2S_MODE_MSK, ++ dac_aif1); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON02, ++ RK3308_DAC_IO_MODE_MSK | ++ RK3308_DAC_MODE_MSK | ++ RK3308_DAC_I2S_BIT_CLK_POL_MSK, ++ dac_aif2); ++ ++ return 0; ++} ++ ++static int rk3308_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_codec *codec = dai->codec; ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ unsigned int adc_aif1 = 0, adc_aif2 = 0, dac_aif1 = 0, dac_aif2 = 0; ++ int ch = rk3308->adc_ch; ++ ++ switch (params_format(params)) { ++ case SNDRV_PCM_FORMAT_S16_LE: ++ adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_16BITS; ++ dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_16BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S20_3LE: ++ adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_20BITS; ++ dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_20BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S24_LE: ++ adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_24BITS; ++ dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_24BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S32_LE: ++ adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_32BITS; ++ dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_32BITS; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ switch (params_channels(params)) { ++ case 1: ++ adc_aif1 |= RK3308_ADC_I2S_MONO; ++ break; ++ case 2: ++ adc_aif1 |= RK3308_ADC_I2S_STEREO; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ adc_aif1 |= RK3308_ADC_I2S_LR_NORMAL; ++ adc_aif2 |= RK3308_ADC_I2S_WORK; ++ dac_aif1 |= RK3308_DAC_I2S_LR_NORMAL; ++ dac_aif2 |= RK3308_DAC_I2S_WORK; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON01(ch), ++ RK3308_ADC_I2S_VALID_LEN_MSK | ++ RK3308_ADC_I2S_LR_MSK | ++ RK3308_ADC_I2S_TYPE_MSK, ++ adc_aif1); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON02(ch), ++ RK3308_ADC_I2S_MSK, ++ adc_aif2); ++ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON01, ++ RK3308_DAC_I2S_VALID_LEN_MSK | ++ RK3308_DAC_I2S_LR_MSK, ++ dac_aif1); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON02, ++ RK3308_DAC_I2S_MSK, ++ dac_aif2); ++ ++ return 0; ++} ++ ++static int rk3308_digital_mute(struct snd_soc_dai *dai, int mute) ++{ ++ return 0; ++} ++ ++static int rk3308_codec_dac_enable(struct rk3308_codec_priv *rk3308) ++{ ++ /* Step 01 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON00, ++ RK3308_DAC_CURRENT_MSK, ++ RK3308_DAC_CURRENT_EN); ++ ++ /* Step 02 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_BUF_REF_L_MSK | ++ RK3308_DAC_BUF_REF_R_MSK, ++ RK3308_DAC_BUF_REF_L_EN | ++ RK3308_DAC_BUF_REF_R_EN); ++ ++ /* Step 03 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_POP_SOUND_L_MSK | ++ RK3308_DAC_POP_SOUND_R_MSK, ++ RK3308_DAC_POP_SOUND_L_WORK | ++ RK3308_DAC_POP_SOUND_R_WORK); ++ ++ /* Step 04 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_EN | RK3308_DAC_R_HPMIX_EN, ++ RK3308_DAC_L_HPMIX_EN | RK3308_DAC_R_HPMIX_EN); ++ ++ /* Step 05 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_WORK | RK3308_DAC_R_HPMIX_WORK, ++ RK3308_DAC_L_HPMIX_WORK | RK3308_DAC_R_HPMIX_WORK); ++ ++ /* Step 06 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_EN | RK3308_DAC_R_LINEOUT_EN, ++ RK3308_DAC_L_LINEOUT_EN | RK3308_DAC_R_LINEOUT_EN); ++ ++ /* Step 07 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_EN | RK3308_DAC_R_HPOUT_EN, ++ RK3308_DAC_L_HPOUT_EN | RK3308_DAC_R_HPOUT_EN); ++ ++ /* Step 08 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_WORK | RK3308_DAC_R_HPOUT_WORK, ++ RK3308_DAC_L_HPOUT_WORK | RK3308_DAC_R_HPOUT_WORK); ++ ++ /* Step 09 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_REF_EN | RK3308_DAC_R_REF_EN, ++ RK3308_DAC_L_REF_EN | RK3308_DAC_R_REF_EN); ++ ++ /* Step 10 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_CLK_EN | RK3308_DAC_R_CLK_EN, ++ RK3308_DAC_L_CLK_EN | RK3308_DAC_R_CLK_EN); ++ ++ /* Step 11 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_DAC_EN | RK3308_DAC_R_DAC_EN, ++ RK3308_DAC_L_DAC_EN | RK3308_DAC_R_DAC_EN); ++ ++ /* Step 12 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_DAC_WORK | RK3308_DAC_R_DAC_WORK, ++ RK3308_DAC_L_DAC_WORK | RK3308_DAC_R_DAC_WORK); ++ ++ /* Step 13 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, ++ RK3308_DAC_L_HPMIX_SEL_MSK | ++ RK3308_DAC_R_HPMIX_SEL_MSK, ++ RK3308_DAC_L_HPMIX_I2S | ++ RK3308_DAC_R_HPMIX_I2S); ++ ++ /* Step 14 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_UNMUTE | ++ RK3308_DAC_R_HPMIX_UNMUTE, ++ RK3308_DAC_L_HPMIX_UNMUTE | ++ RK3308_DAC_R_HPMIX_UNMUTE); ++ ++ /* Step 15 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, ++ RK3308_DAC_L_HPMIX_GAIN_MSK | ++ RK3308_DAC_R_HPMIX_GAIN_MSK, ++ RK3308_DAC_L_HPMIX_GAIN_0DB | ++ RK3308_DAC_R_HPMIX_GAIN_0DB); ++ ++ /* Step 16 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_UNMUTE | ++ RK3308_DAC_R_HPOUT_UNMUTE, ++ RK3308_DAC_L_HPOUT_UNMUTE | ++ RK3308_DAC_R_HPOUT_UNMUTE); ++ ++ /* Step 17 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_UNMUTE | ++ RK3308_DAC_R_LINEOUT_UNMUTE, ++ RK3308_DAC_L_LINEOUT_UNMUTE | ++ RK3308_DAC_R_LINEOUT_UNMUTE); ++ ++ /* Step 18 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON05, ++ RK3308_DAC_L_HPOUT_GAIN_MSK, ++ RK3308_DAC_L_HPOUT_GAIN_0DB); ++ ++ /* Step 18 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON06, ++ RK3308_DAC_R_HPOUT_GAIN_MSK, ++ RK3308_DAC_R_HPOUT_GAIN_0DB); ++ ++ /* Step 19 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_GAIN_MSK | RK3308_DAC_R_GAIN_MSK, ++ RK3308_DAC_L_GAIN_0DB | RK3308_DAC_R_GAIN_0DB); ++ ++ return 0; ++} ++ ++static int rk3308_codec_dac_disable(struct rk3308_codec_priv *rk3308) ++{ ++ /* Step 01 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_GAIN_MSK | RK3308_DAC_R_GAIN_MSK, ++ RK3308_DAC_L_GAIN_0DB | RK3308_DAC_R_GAIN_0DB); ++ ++ /* ++ * Step 02 ++ * ++ * Note1. In the step2, adjusting the register step by step to the ++ * appropriate value and taking 20ms as time step ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON05, ++ RK3308_DAC_L_HPOUT_GAIN_MSK, ++ RK3308_DAC_L_HPOUT_GAIN_NDB_39); ++ ++ /* Step 02 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON06, ++ RK3308_DAC_R_HPOUT_GAIN_MSK, ++ RK3308_DAC_R_HPOUT_GAIN_NDB_39); ++ ++ /* Step 03 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_UNMUTE | ++ RK3308_DAC_R_HPMIX_UNMUTE, ++ RK3308_DAC_L_HPMIX_MUTE | ++ RK3308_DAC_R_HPMIX_MUTE); ++ ++ /* Step 04 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, ++ RK3308_DAC_L_HPMIX_SEL_MSK | ++ RK3308_DAC_R_HPMIX_SEL_MSK, ++ RK3308_DAC_L_HPMIX_NONE | ++ RK3308_DAC_R_HPMIX_NONE); ++ ++ /* Step 05 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_UNMUTE | ++ RK3308_DAC_R_HPOUT_UNMUTE, ++ RK3308_DAC_L_HPOUT_MUTE | ++ RK3308_DAC_R_HPOUT_MUTE); ++ ++ /* Step 06 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_DAC_WORK | RK3308_DAC_R_DAC_WORK, ++ RK3308_DAC_L_DAC_INIT | RK3308_DAC_R_DAC_INIT); ++ ++ /* Step 07 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_EN | RK3308_DAC_R_HPOUT_EN, ++ RK3308_DAC_L_HPOUT_DIS | RK3308_DAC_R_HPOUT_DIS); ++ ++ /* Step 08 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_UNMUTE | ++ RK3308_DAC_R_LINEOUT_UNMUTE, ++ RK3308_DAC_L_LINEOUT_MUTE | ++ RK3308_DAC_R_LINEOUT_MUTE); ++ ++ /* Step 09 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_EN | RK3308_DAC_R_LINEOUT_EN, ++ RK3308_DAC_L_LINEOUT_DIS | RK3308_DAC_R_LINEOUT_DIS); ++ ++ /* Step 10 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_EN | RK3308_DAC_R_HPMIX_EN, ++ RK3308_DAC_L_HPMIX_DIS | RK3308_DAC_R_HPMIX_DIS); ++ ++ /* Step 11 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_DAC_EN | RK3308_DAC_R_DAC_EN, ++ RK3308_DAC_L_DAC_DIS | RK3308_DAC_R_DAC_DIS); ++ ++ /* Step 12 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_CLK_EN | RK3308_DAC_R_CLK_EN, ++ RK3308_DAC_L_CLK_DIS | RK3308_DAC_R_CLK_DIS); ++ ++ /* Step 13 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_REF_EN | RK3308_DAC_R_REF_EN, ++ RK3308_DAC_L_REF_DIS | RK3308_DAC_R_REF_DIS); ++ ++ /* Step 14 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_POP_SOUND_L_MSK | ++ RK3308_DAC_POP_SOUND_R_MSK, ++ RK3308_DAC_POP_SOUND_L_INIT | ++ RK3308_DAC_POP_SOUND_R_INIT); ++ ++ /* Step 15 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_BUF_REF_L_EN | RK3308_DAC_BUF_REF_R_EN, ++ RK3308_DAC_BUF_REF_L_DIS | RK3308_DAC_BUF_REF_R_DIS); ++ ++ /* Step 16 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON00, ++ RK3308_DAC_CURRENT_EN, ++ RK3308_DAC_CURRENT_DIS); ++ ++ /* Step 17 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_WORK | RK3308_DAC_R_HPOUT_WORK, ++ RK3308_DAC_L_HPOUT_INIT | RK3308_DAC_R_HPOUT_INIT); ++ ++ /* Step 18 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_WORK | RK3308_DAC_R_HPMIX_WORK, ++ RK3308_DAC_L_HPMIX_INIT | RK3308_DAC_R_HPMIX_INIT); ++ ++ /* Step 19 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, ++ RK3308_DAC_L_HPMIX_GAIN_MSK | ++ RK3308_DAC_R_HPMIX_GAIN_MSK, ++ RK3308_DAC_L_HPMIX_GAIN_NDB_6 | ++ RK3308_DAC_R_HPMIX_GAIN_NDB_6); ++ ++ /* ++ * Note2. If the ACODEC_DAC_ANA_CON12[7] or ACODEC_DAC_ANA_CON12[3] ++ * is set to 0x1, add the steps from the section Disable DAC ++ * Configuration Standard Usage Flow after complete the step 19 ++ */ ++ ++ return 0; ++} ++ ++static int rk3308_codec_power_on(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ /* 1. Supply the power of digital part and reset the Audio Codec */ ++ /* Do nothing */ ++ ++ /* ++ * 2. Configure ACODEC_DAC_ANA_CON1[1:0] and ACODEC_DAC_ANA_CON1[5:4] ++ * to 0x1, to setup dc voltage of the DAC channel output ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_POP_SOUND_L_MSK, RK3308_DAC_POP_SOUND_L_INIT); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_POP_SOUND_R_MSK, RK3308_DAC_POP_SOUND_R_INIT); ++ ++ /* ++ * 3. Configure the register ACODEC_ADC_ANA_CON10[6:0] to 0x1 ++ * ++ * Note: Only the reg (ADC_ANA_CON10+0x0)[6:0] represent the control ++ * signal to select current to pre-charge/dis_charge ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, RK3308_ADC_SEL_I_64(1)); ++ ++ /* 4. Supply the power of the analog part(AVDD,AVDDRV) */ ++ ++ /* ++ * 5. Configure the register ACODEC_ADC_ANA_CON10[7] to 0x1 to setup ++ * reference voltage ++ * ++ * Note: Only the reg (ADC_ANA_CON10+0x0)[7] represent the enable ++ * signal of reference voltage module ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_REF_EN, RK3308_ADC_REF_EN); ++ ++ /* ++ * 6. Change the register ACODEC_ADC_ANA_CON10[6:0] from the 0x1 to ++ * 0x7f step by step or configure the ACODEC_ADC_ANA_CON10[6:0] to ++ * 0x7f directly. The suggestion slot time of the step is 20ms. ++ */ ++ mdelay(20); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, ++ RK3308_ADC_DONT_SEL_ALL); ++ ++ /* 7. Wait until the voltage of VCM keeps stable at the AVDD/2 */ ++ usleep_range(200, 300); /* estimated value */ ++ ++ /* ++ * 8. Configure the register ACODEC_ADC_ANA_CON10[6:0] to the ++ * appropriate value(expect 0x0) for reducing power. ++ */ ++ ++ /* TODO: choose an appropriate charge value */ ++ ++ return 0; ++} ++ ++static int rk3308_codec_power_off(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ /* ++ * 1. Keep the power on and disable the DAC and ADC path according to ++ * the section power on configuration standard usage flow. ++ */ ++ ++ /* 2. Configure the register ACODEC_ADC_ANA_CON10[6:0] to 0x1 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, RK3308_ADC_SEL_I_64(1)); ++ ++ /* 3. Configure the register ACODEC_ADC_ANA_CON10[7] to 0x0 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_REF_EN, RK3308_ADC_REF_DIS); ++ ++ /* ++ * 4.Change the register ACODEC_ADC_ANA_CON10[6:0] from the 0x1 to 0x7f ++ * step by step or configure the ACODEC_ADC_ANA_CON10[6:0] to 0x7f ++ * directly. The suggestion slot time of the step is 20ms ++ */ ++ mdelay(20); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, ++ RK3308_ADC_DONT_SEL_ALL); ++ ++ /* 5. Wait until the voltage of VCM keeps stable at the AGND */ ++ usleep_range(200, 300); /* estimated value */ ++ ++ /* 6. Power off the analog power supply */ ++ /* 7. Power off the digital power supply */ ++ ++ /* Do something via hardware */ ++ ++ return 0; ++} ++ ++static int check_micbias(int micbias) ++{ ++ switch (micbias) { ++ case RK3308_ADC_MICBIAS_VOLT_0_85: ++ case RK3308_ADC_MICBIAS_VOLT_0_8: ++ case RK3308_ADC_MICBIAS_VOLT_0_75: ++ case RK3308_ADC_MICBIAS_VOLT_0_7: ++ case RK3308_ADC_MICBIAS_VOLT_0_65: ++ case RK3308_ADC_MICBIAS_VOLT_0_6: ++ case RK3308_ADC_MICBIAS_VOLT_0_55: ++ case RK3308_ADC_MICBIAS_VOLT_0_5: ++ return 0; ++ } ++ ++ return -EINVAL; ++} ++ ++static int rk3308_codec_micbias_enable(struct rk3308_codec_priv *rk3308, ++ int micbias) ++{ ++ int ch = rk3308->adc_ch; ++ int ret; ++ ++ if (ch != 1 && ch != 2) { ++ dev_err(rk3308->plat_dev, ++ "%s: currnet ch: %d, only ch1/2 control MICBIAS1/2\n", ++ __func__, ch); ++ return -EINVAL; ++ } ++ ++ /* 1. Power up the ACODEC and keep the AVDDH stable */ ++ ++ /* 2. Configure ACODEC_ADC_ANA_CON7[2:0] to the certain value */ ++ ret = check_micbias(micbias); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, "This is an invalid micbias: %d\n", ++ micbias); ++ return ret; ++ } ++ ++ /* ++ * Note: Only the reg (ADC_ANA_CON7+0x0)[2:0] represent the level range ++ * control signal of MICBIAS voltage ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(0), ++ RK3308_ADC_LEVEL_RANGE_MICBIAS_MSK, ++ micbias); ++ ++ /* 3. Wait until the VCMH keep stable */ ++ usleep_range(200, 300); /* estimated value */ ++ ++ /* 4. Configure ACODEC_ADC_ANA_CON8[4] to 0x1 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON08(ch), ++ RK3308_ADC_MICBIAS_CURRENT_MSK, ++ RK3308_ADC_MICBIAS_CURRENT_EN); ++ ++ /* ++ * 5. Configure the (ADC_ANA_CON7+0x40)[3] or (ADC_ANA_CON7+0x80)[3] ++ * to 0x1. ++ * (ADC_ANA_CON7+0x40)[3] used to control the MICBIAS1, and ++ * (ADC_ANA_CON7+0x80)[3] used to control the MICBIAS2 ++ */ ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), ++ RK3308_ADC_MIC_BIAS_BUF_EN, ++ RK3308_ADC_MIC_BIAS_BUF_EN); ++ ++ return 0; ++} ++ ++static int rk3308_codec_micbias_disable(struct rk3308_codec_priv *rk3308) ++{ ++ int ch = rk3308->adc_ch; ++ ++ if (ch != 1 && ch != 2) { ++ dev_err(rk3308->plat_dev, ++ "%s: currnet ch: %d, only ch1/2 control MICBIAS1/2\n", ++ __func__, ch); ++ return -EINVAL; ++ } ++ ++ /* 1. Enable the MICBIAS and keep the Audio Codec stable */ ++ /* Do nothing */ ++ ++ /* ++ * 2. Configure the (ADC_ANA_CON7+0x40)[3] or ++ * (ADC_ANA_CON7+0x80)[3] to 0x0 ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), ++ RK3308_ADC_MIC_BIAS_BUF_EN, ++ RK3308_ADC_MIC_BIAS_BUF_DIS); ++ ++ /* 3. Configure ACODEC_ADC_ANA_CON8[4] to 0x0 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON08(ch), ++ RK3308_ADC_MICBIAS_CURRENT_MSK, ++ RK3308_ADC_MICBIAS_CURRENT_DIS); ++ ++ return 0; ++} ++ ++static int rk3308_codec_alc_enable(struct rk3308_codec_priv *rk3308) ++{ ++ int ch = rk3308->adc_ch; ++ ++ /* ++ * 1. Set he max level and min level of the ALC need to control. ++ * ++ * These values are estimated ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON05(ch), ++ RK3308_AGC_LO_8BITS_AGC_MIN_MSK, ++ 0x16); ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON05(ch), ++ RK3308_AGC_HI_8BITS_AGC_MIN_MSK, ++ 0x40); ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON05(ch), ++ RK3308_AGC_LO_8BITS_AGC_MAX_MSK, ++ 0x26); ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON05(ch), ++ RK3308_AGC_HI_8BITS_AGC_MAX_MSK, ++ 0x40); ++ ++ /* ++ * 2. Set ACODEC_ALC_DIG_CON4[2:0] according to the sample rate ++ * ++ * By default is 44.1KHz for sample. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON04(ch), ++ RK3308_AGC_APPROX_RATE_MSK, ++ RK3308_AGC_APPROX_RATE_44_1K); ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON04(ch), ++ RK3308_AGC_APPROX_RATE_MSK, ++ RK3308_AGC_APPROX_RATE_44_1K); ++ ++ /* 3. Set ACODEC_ALC_DIG_CON9[6] to 0x1, to enable the ALC module */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON09(ch), ++ RK3308_AGC_FUNC_SEL_MSK, ++ RK3308_AGC_FUNC_SEL_EN); ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON09(ch), ++ RK3308_AGC_FUNC_SEL_MSK, ++ RK3308_AGC_FUNC_SEL_EN); ++ ++ /* ++ * 4. Set ACODEC_ADC_ANA_CON11[1:0], (ACODEC_ADC_ANA_CON11+0x40)[1:0], ++ * (ACODEC_ADC_ANA_CON11+0x80)[1:0] and (ACODEC_ADC_ANA_CON11+0xc0)[1:0] ++ * to 0x3, to enable the ALC module to control the gain of PGA. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON11(ch), ++ RK3308_ADC_ALCL_CON_GAIN_PGAL_MSK | ++ RK3308_ADC_ALCR_CON_GAIN_PGAR_MSK, ++ RK3308_ADC_ALCL_CON_GAIN_PGAL_EN | ++ RK3308_ADC_ALCR_CON_GAIN_PGAR_EN); ++ ++ /* ++ * 5.Observe the current ALC output gain by reading ++ * ACODEC_ALC_DIG_CON12[4:0] ++ * ++ * The default GAIN is 0x0c ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON12(ch), ++ RK3308_AGC_GAIN_MSK, ++ 0x0c); ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON12(ch), ++ RK3308_AGC_GAIN_MSK, ++ 0x0c); ++ ++ return 0; ++} ++ ++static int rk3308_codec_alc_disable(struct rk3308_codec_priv *rk3308) ++{ ++ int ch = rk3308->adc_ch; ++ ++ /* ++ * 1. Set ACODEC_ALC_DIG_CON9[6] to 0x0, to disable the ALC module, ++ * then the ALC output gain will keep to the last value ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON09(ch), ++ RK3308_AGC_FUNC_SEL_MSK, ++ RK3308_AGC_FUNC_SEL_DIS); ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON09(ch), ++ RK3308_AGC_FUNC_SEL_MSK, ++ RK3308_AGC_FUNC_SEL_DIS); ++ ++ /* ++ * 2. Set ACODEC_ADC_ANA_CON11[1:0], (ACODEC_ADC_ANA_CON11+0x40)[1:0], ++ * (ACODEC_ADC_ANA_CON11+0x80)[1:0] and (ACODEC_ADC_ANA_CON11+0xc0)[1:0] ++ * to 0x0, to disable the ALC module to control the gain of PGA. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON11(ch), ++ RK3308_ADC_ALCL_CON_GAIN_PGAL_MSK | ++ RK3308_ADC_ALCR_CON_GAIN_PGAR_MSK, ++ RK3308_ADC_ALCL_CON_GAIN_PGAL_DIS | ++ RK3308_ADC_ALCR_CON_GAIN_PGAR_DIS); ++ ++ return 0; ++} ++ ++static int rk3308_codec_adc_ana_enable(struct rk3308_codec_priv *rk3308) ++{ ++ unsigned int adc_aif1 = 0, adc_aif2 = 0; ++ unsigned int agc_func_en; ++ int ch = rk3308->adc_ch; ++ ++ /* ++ * 1. Set the ACODEC_ADC_ANA_CON7[7:6] and ACODEC_ADC_ANA_CON7[5:4], ++ * to select the line-in or microphone as input of ADC ++ * ++ * Note1. Please ignore the step1 for enabling ADC3, ADC4, ADC5, ++ * ADC6, ADC7, and ADC8 ++ */ ++ if (ch == 0) { ++ if (rk3308->adc_ch0_using_linein) { ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), ++ RK3308_ADC_CH1_IN_SEL_MSK, ++ RK3308_ADC_CH1_IN_LINEIN); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), ++ RK3308_ADC_CH2_IN_SEL_MSK, ++ RK3308_ADC_CH2_IN_LINEIN); ++ } else { ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), ++ RK3308_ADC_CH1_IN_SEL_MSK, ++ RK3308_ADC_CH1_IN_MIC); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), ++ RK3308_ADC_CH2_IN_SEL_MSK, ++ RK3308_ADC_CH2_IN_MIC); ++ } ++ } ++ ++ /* ++ * 2. Set ACODEC_ADC_ANA_CON0[7:0] to 0xff, to end the mute station ++ * of ADC, to enable the MIC module, to enable the reference voltage ++ * buffer, and to end the initialization of MIC ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(ch), ++ RK3308_ADC_CH1_CH2_MIC_ALL_MSK, ++ RK3308_ADC_CH1_CH2_MIC_ALL); ++ ++ /* ++ * 3. Set ACODEC_ADC_ANA_CON6[0] to 0x1, to enable the current source ++ * of audio ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON06(ch), ++ RK3308_ADC_CURRENT_MSK, ++ RK3308_ADC_CURRENT_EN); ++ ++ /* ++ * 4. Set ACODEC_ADC_ANA_CON2[7:0] to 0x77, to enable the ALC module, ++ * to enable the zero-crossing detection function, and to end the ++ * initialization of ALC ++ * ++ * Note2. Please set ACODEC_ADC_ANA_CON2[7:0] to 0x33 in step4 ++ * if the AGC function is closed ++ */ ++ ++ adc_aif1 = RK3308_ADC_CH1_ALC_EN | RK3308_ADC_CH1_ALC_WORK; ++ regmap_read(rk3308->regmap, RK3308_ALC_L_DIG_CON09(ch), &agc_func_en); ++ if (agc_func_en & RK3308_AGC_FUNC_SEL_EN) ++ adc_aif1 |= RK3308_ADC_CH1_ZEROCROSS_DET_EN; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(ch), ++ RK3308_ADC_CH1_ALC_ZC_MSK, ++ adc_aif1); ++ ++ adc_aif2 = RK3308_ADC_CH2_ALC_EN | RK3308_ADC_CH2_ALC_WORK; ++ regmap_read(rk3308->regmap, RK3308_ALC_L_DIG_CON09(ch), &agc_func_en); ++ if (agc_func_en & RK3308_AGC_FUNC_SEL_EN) ++ adc_aif2 |= RK3308_ADC_CH2_ZEROCROSS_DET_EN; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(ch), ++ RK3308_ADC_CH2_ALC_ZC_MSK, ++ adc_aif2); ++ ++ /* ++ * 5. Set ACODEC_ADC_ANA_CON5[7:0] to 0x77, to enable the clock and ++ * ADC module, and to end the initialization of ADC ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), ++ RK3308_ADC_CH1_ADC_CLK_MSK, ++ RK3308_ADC_CH1_CLK_EN | ++ RK3308_ADC_CH1_ADC_EN | ++ RK3308_ADC_CH1_ADC_WORK); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), ++ RK3308_ADC_CH2_ADC_CLK_MSK, ++ RK3308_ADC_CH2_CLK_EN | ++ RK3308_ADC_CH2_ADC_EN | ++ RK3308_ADC_CH2_ADC_WORK); ++ ++ /* ++ * 6. Set ACODEC_ADC_ANA_CON1[5:4] and ACODEC_ADC_ANA_CON1[1:0], ++ * to select the gain of the MIC ++ * ++ * By default is 0db. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), ++ RK3308_ADC_CH1_MIC_GAIN_MSK, ++ RK3308_ADC_CH1_MIC_GAIN_0DB); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), ++ RK3308_ADC_CH2_MIC_GAIN_MSK, ++ RK3308_ADC_CH2_MIC_GAIN_0DB); ++ ++ /* ++ * 7.Set ACODEC_ADC_ANA_CON3[4:0] and ACODEC_ADC_ANA_CON4[3:0] to ++ * select the gain of ALC ++ * ++ * By default is 0db. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON03(ch), ++ RK3308_ADC_CH1_ALC_GAIN_MSK, ++ RK3308_ADC_CH1_ALC_GAIN_0DB); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON04(ch), ++ RK3308_ADC_CH2_ALC_GAIN_MSK, ++ RK3308_ADC_CH2_ALC_GAIN_0DB); ++ ++ /* 8.Begin recording */ ++ ++ return 0; ++} ++ ++static int rk3308_codec_adc_ana_disable(struct rk3308_codec_priv *rk3308) ++{ ++ int ch = rk3308->adc_ch; ++ ++ /* ++ * 1. Set ACODEC_ADC_ANA_CON2[7:0] to 0x0, to disable the ALC module, ++ * to disable the zero-crossing detection function, and to begin the ++ * initialization of ALC ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(ch), ++ RK3308_ADC_CH1_ALC_ZC_MSK, ++ 0); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(ch), ++ RK3308_ADC_CH2_ALC_ZC_MSK, ++ 0); ++ ++ /* ++ * 2. Set ACODEC_ADC_ANA_CON5[7:0] to 0x0, to disable the clock and ++ * ADC module, and to begin the initialization of ADC ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), ++ RK3308_ADC_CH1_ADC_CLK_MSK, ++ 0); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), ++ RK3308_ADC_CH2_ADC_CLK_MSK, ++ 0); ++ ++ /* ++ * 3. Set ACODEC_ADC_ANA_CON0[7:0] to 0x88, to disable the MIC module, ++ * to disable the reference voltage buffer, and to begin the ++ * initialization of MIC ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(ch), ++ RK3308_ADC_CH1_CH2_MIC_ALL_MSK, ++ RK3308_ADC_CH1_MIC_UNMUTE | ++ RK3308_ADC_CH2_MIC_UNMUTE); ++ ++ /* ++ * 4. Set ACODEC_ADC_ANA_CON6[0] to 0x0, to disable the current ++ * source of audio ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON06(ch), ++ RK3308_ADC_CURRENT_MSK, ++ RK3308_ADC_CURRENT_DIS); ++ ++ return 0; ++} ++ ++static int rk3308_codec_open_capture(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ rk3308_codec_alc_enable(rk3308); ++ rk3308_codec_adc_ana_enable(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_codec_close_capture(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ rk3308_codec_alc_disable(rk3308); ++ rk3308_codec_adc_ana_disable(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_codec_open_playback(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ rk3308_codec_dac_enable(rk3308); ++ rk3308_speaker_ctl(rk3308, 1); ++ ++ return 0; ++} ++ ++static int rk3308_codec_close_playback(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ rk3308_speaker_ctl(rk3308, 0); ++ rk3308_codec_dac_disable(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_pcm_startup(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_codec *codec = dai->codec; ++ int ret = 0; ++ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ++ ret = rk3308_codec_open_playback(codec); ++ else ++ ret = rk3308_codec_open_capture(codec); ++ ++ return ret; ++} ++ ++static void rk3308_pcm_shutdown(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_codec *codec = dai->codec; ++ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ++ rk3308_codec_close_playback(codec); ++ else ++ rk3308_codec_close_capture(codec); ++} ++ ++static struct snd_soc_dai_ops rk3308_dai_ops = { ++ .hw_params = rk3308_hw_params, ++ .set_fmt = rk3308_set_dai_fmt, ++ .digital_mute = rk3308_digital_mute, ++ .startup = rk3308_pcm_startup, ++ .shutdown = rk3308_pcm_shutdown, ++}; ++ ++static struct snd_soc_dai_driver rk3308_dai[] = { ++ { ++ .name = "rk3308-hifi", ++ .id = RK3308_HIFI, ++ .playback = { ++ .stream_name = "HiFi Playback", ++ .channels_min = 2, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_8000_96000, ++ .formats = (SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S20_3LE | ++ SNDRV_PCM_FMTBIT_S24_LE | ++ SNDRV_PCM_FMTBIT_S32_LE), ++ }, ++ .capture = { ++ .stream_name = "HiFi Capture", ++ .channels_min = 1, ++ .channels_max = 8, ++ .rates = SNDRV_PCM_RATE_8000_96000, ++ .formats = (SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S20_3LE | ++ SNDRV_PCM_FMTBIT_S24_LE | ++ SNDRV_PCM_FMTBIT_S32_LE), ++ }, ++ .ops = &rk3308_dai_ops, ++ }, ++}; ++ ++static int rk3308_suspend(struct snd_soc_codec *codec) ++{ ++ rk3308_set_bias_level(codec, SND_SOC_BIAS_OFF); ++ ++ return 0; ++} ++ ++static int rk3308_resume(struct snd_soc_codec *codec) ++{ ++ rk3308_set_bias_level(codec, SND_SOC_BIAS_STANDBY); ++ ++ return 0; ++} ++ ++static int rk3308_probe(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ rk3308_codec_reset(codec); ++ rk3308_codec_power_on(codec); ++ ++ rk3308_codec_micbias_enable(rk3308, RK3308_ADC_MICBIAS_VOLT_0_7); ++ ++ return 0; ++} ++ ++static int rk3308_remove(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ rk3308_speaker_ctl(rk3308, 0); ++ rk3308_codec_micbias_disable(rk3308); ++ rk3308_codec_power_off(codec); ++ ++ return 0; ++} ++ ++static struct snd_soc_codec_driver soc_codec_dev_rk3308 = { ++ .probe = rk3308_probe, ++ .remove = rk3308_remove, ++ .suspend = rk3308_suspend, ++ .resume = rk3308_resume, ++ .set_bias_level = rk3308_set_bias_level, ++ .controls = rk3308_codec_dapm_controls, ++ .num_controls = ARRAY_SIZE(rk3308_codec_dapm_controls), ++}; ++ ++static const struct reg_default rk3308_codec_reg_defaults[] = { ++ { RK3308_GLB_CON, 0x07 }, ++}; ++ ++static bool rk3308_codec_write_read_reg(struct device *dev, unsigned int reg) ++{ ++ /* All registers can be read / write */ ++ return true; ++} ++ ++static bool rk3308_codec_volatile_reg(struct device *dev, unsigned int reg) ++{ ++ switch (reg) { ++ case RK3308_GLB_CON: ++ return true; ++ default: ++ return false; ++ } ++} ++ ++static const struct regmap_config rk3308_codec_regmap_config = { ++ .reg_bits = 32, ++ .reg_stride = 4, ++ .val_bits = 32, ++ .max_register = RK3308_DAC_ANA_CON13, ++ .writeable_reg = rk3308_codec_write_read_reg, ++ .readable_reg = rk3308_codec_write_read_reg, ++ .volatile_reg = rk3308_codec_volatile_reg, ++ .reg_defaults = rk3308_codec_reg_defaults, ++ .num_reg_defaults = ARRAY_SIZE(rk3308_codec_reg_defaults), ++ .cache_type = REGCACHE_FLAT, ++}; ++ ++static ssize_t adc_ch_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) ++{ ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ ++ return sprintf(buf, "adc_ch: %d\n", rk3308->adc_ch); ++} ++ ++static ssize_t adc_ch_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ unsigned long ch; ++ int ret = kstrtoul(buf, 10, &ch); ++ ++ if (ret < 0 || ch > 4) { ++ dev_err(dev, "Invalid ch: %ld, ret: %d\n", ch, ret); ++ return -EINVAL; ++ } ++ ++ rk3308->adc_ch = ch; ++ ++ dev_info(dev, "Store ch: %d\n", rk3308->adc_ch); ++ ++ return count; ++} ++ ++static const struct device_attribute adc_ch_attrs[] = { ++ __ATTR(adc_ch, 0644, adc_ch_show, adc_ch_store), ++}; ++ ++static void rk3308_codec_device_release(struct device *dev) ++{ ++ /* Do nothing */ ++} ++ ++static int rk3308_codec_sysfs_init(struct platform_device *pdev, ++ struct rk3308_codec_priv *rk3308) ++{ ++ struct device *dev = &rk3308->dev; ++ int i; ++ ++ dev->release = rk3308_codec_device_release; ++ dev->parent = &pdev->dev; ++ set_dev_node(dev, dev_to_node(&pdev->dev)); ++ dev_set_name(dev, "rk3308-acodec-dev"); ++ ++ if (device_register(dev)) { ++ dev_err(&pdev->dev, ++ "Register 'rk3308-acodec-dev' failed\n"); ++ dev->parent = NULL; ++ return -ENOMEM; ++ } ++ ++ for (i = 0; i < ARRAY_SIZE(adc_ch_attrs); i++) { ++ if (device_create_file(dev, &adc_ch_attrs[i])) { ++ dev_err(&pdev->dev, ++ "Create 'rk3308-acodec-dev' attr failed\n"); ++ device_unregister(dev); ++ return -ENOMEM; ++ } ++ } ++ ++ return 0; ++} ++ ++static int rk3308_platform_probe(struct platform_device *pdev) ++{ ++ struct device_node *np = pdev->dev.of_node; ++ struct rk3308_codec_priv *rk3308; ++ struct resource *res; ++ void __iomem *base; ++ int ret = 0; ++ struct regmap *grf; ++ ++ grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); ++ if (IS_ERR(grf)) { ++ dev_err(&pdev->dev, ++ "Missing 'rockchip,grf' property\n"); ++ return PTR_ERR(grf); ++ } ++ ++ rk3308 = devm_kzalloc(&pdev->dev, sizeof(*rk3308), GFP_KERNEL); ++ if (!rk3308) ++ return -ENOMEM; ++ ++ ret = rk3308_codec_sysfs_init(pdev, rk3308); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Sysfs init failed\n"); ++ return ret; ++ } ++ ++ rk3308->plat_dev = &pdev->dev; ++ ++ rk3308->reset = devm_reset_control_get(&pdev->dev, "acodec-reset"); ++ if (IS_ERR(rk3308->reset)) { ++ ret = PTR_ERR(rk3308->reset); ++ if (ret != -ENOENT) ++ return ret; ++ ++ dev_dbg(&pdev->dev, "No reset control found\n"); ++ rk3308->reset = NULL; ++ } ++ ++ /* GPIO0_A5 control speaker on RK3308 EVB */ ++ rk3308->spk_ctl_gpio = devm_gpiod_get_optional(&pdev->dev, "spk_ctl", ++ GPIOD_OUT_HIGH); ++ if (IS_ERR(rk3308->spk_ctl_gpio)) { ++ ret = PTR_ERR(rk3308->spk_ctl_gpio); ++ dev_err(&pdev->dev, "Unable to claim gpio spk_ctl\n"); ++ return ret; ++ } ++ ++ rk3308->pclk = devm_clk_get(&pdev->dev, "acodec"); ++ if (IS_ERR(rk3308->pclk)) { ++ dev_err(&pdev->dev, "Can't get acodec pclk\n"); ++ return PTR_ERR(rk3308->pclk); ++ } ++ ++ ret = clk_prepare_enable(rk3308->pclk); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Failed to enable acodec pclk: %d\n", ret); ++ return ret; ++ } ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ base = devm_ioremap_resource(&pdev->dev, res); ++ if (IS_ERR(base)) { ++ ret = PTR_ERR(base); ++ dev_err(&pdev->dev, "Failed to ioremap resource\n"); ++ goto failed; ++ } ++ ++ rk3308->regmap = devm_regmap_init_mmio(&pdev->dev, base, ++ &rk3308_codec_regmap_config); ++ if (IS_ERR(rk3308->regmap)) { ++ ret = PTR_ERR(rk3308->regmap); ++ dev_err(&pdev->dev, "Failed to regmap mmio\n"); ++ goto failed; ++ } ++ ++ platform_set_drvdata(pdev, rk3308); ++ ++ ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_rk3308, ++ rk3308_dai, ARRAY_SIZE(rk3308_dai)); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); ++ goto failed; ++ } ++ ++ return ret; ++ ++failed: ++ clk_disable_unprepare(rk3308->pclk); ++ ++ return ret; ++} ++ ++static int rk3308_platform_remove(struct platform_device *pdev) ++{ ++ struct rk3308_codec_priv *rk3308 = ++ (struct rk3308_codec_priv *)platform_get_drvdata(pdev); ++ ++ clk_disable_unprepare(rk3308->pclk); ++ snd_soc_unregister_codec(&pdev->dev); ++ ++ return 0; ++} ++ ++static const struct of_device_id rk3308codec_of_match[] = { ++ { .compatible = "rockchip,rk3308-codec", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, rk3308codec_of_match); ++ ++static struct platform_driver rk3308_codec_driver = { ++ .driver = { ++ .name = "rk3308-acodec", ++ .of_match_table = of_match_ptr(rk3308codec_of_match), ++ }, ++ .probe = rk3308_platform_probe, ++ .remove = rk3308_platform_remove, ++}; ++module_platform_driver(rk3308_codec_driver); ++ ++MODULE_AUTHOR("Xing Zheng "); ++MODULE_DESCRIPTION("ASoC RK3308 Codec Driver"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/rk3308_codec.h b/sound/soc/codecs/rk3308_codec.h +new file mode 100644 +index 000000000000..6cfa69157785 +--- /dev/null ++++ b/sound/soc/codecs/rk3308_codec.h +@@ -0,0 +1,960 @@ ++/* ++ * rk3308_codec.h -- RK3308 ALSA Soc Audio Driver ++ * ++ * Copyright (c) 2018, Fuzhou Rockchip Electronics Co., Ltd All rights reserved. ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms and conditions of the GNU General Public License, ++ * version 2, as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#ifndef __RK3308_CODEC_H__ ++#define __RK3308_CODEC_H__ ++ ++#define ACODEC_RESET_CTL 0x00 /* REG 0x00 */ ++ ++/* ADC DIGITAL REGISTERS */ ++#define ACODEC_ADC_I2S_CTL0 0x04 /* REG 0x01 */ ++#define ACODEC_ADC_I2S_CTL1 0x08 /* REG 0x02 */ ++#define ACODEC_ADC_BIST_MODE_SEL 0x0c /* REG 0x03 */ ++/* Resevred REG 0x04 ~ 0x06 */ ++#define ACODEC_ADC_DATA_PATH 0x1c /* REG 0x07 */ ++/* Resevred REG 0x08 ~ 0x0f */ ++ ++/* REG 0x10 ~ 0x1c are used to configure AGC of Left channel (ALC1) */ ++#define ACODEC_ADC_PGA_AGC_L_CTL0 0x40 /* REG 0x10 */ ++#define ACODEC_ADC_PGA_AGC_L_CTL1 0x44 /* REG 0x11 */ ++#define ACODEC_ADC_PGA_AGC_L_CTL2 0x48 /* REG 0x12 */ ++#define ACODEC_ADC_PGA_AGC_L_CTL3 0x4c /* REG 0x13 */ ++#define ACODEC_ADC_PGA_AGC_L_CTL4 0x50 /* REG 0x14 */ ++#define ACODEC_ADC_PGA_AGC_L_LO_MAX 0x54 /* REG 0x15 */ ++#define ACODEC_ADC_PGA_AGC_L_HI_MAX 0x58 /* REG 0x16 */ ++#define ACODEC_ADC_PGA_AGC_L_LO_MIN 0x5c /* REG 0x17 */ ++#define ACODEC_ADC_PGA_AGC_L_HI_MIN 0x60 /* REG 0x18 */ ++#define ACODEC_ADC_PGA_AGC_L_CTL5 0x64 /* REG 0x19 */ ++/* Resevred REG 0x1a ~ 0x1b */ ++#define ACODEC_ADC_AGC_L_RO_GAIN 0x70 /* REG 0x1c */ ++ ++/* REG 0x20 ~ 0x2c are used to configure AGC of Right channel (ALC2) */ ++#define ACODEC_ADC_PGA_AGC_R_CTL0 0x80 /* REG 0x20 */ ++#define ACODEC_ADC_PGA_AGC_R_CTL1 0x84 /* REG 0x21 */ ++#define ACODEC_ADC_PGA_AGC_R_CTL2 0x88 /* REG 0x22 */ ++#define ACODEC_ADC_PGA_AGC_R_CTL3 0x8c /* REG 0x23 */ ++#define ACODEC_ADC_PGA_AGC_R_CTL4 0x90 /* REG 0x24 */ ++#define ACODEC_ADC_PGA_AGC_R_LO_MAX 0x94 /* REG 0x25 */ ++#define ACODEC_ADC_PGA_AGC_R_HI_MAX 0x98 /* REG 0x26 */ ++#define ACODEC_ADC_PGA_AGC_R_LO_MIN 0x9c /* REG 0x27 */ ++#define ACODEC_ADC_PGA_AGC_R_HI_MIN 0xa0 /* REG 0x28 */ ++#define ACODEC_ADC_PGA_AGC_R_CTL5 0xa4 /* REG 0x29 */ ++/* Resevred REG 0x2a ~ 0x2b */ ++#define ACODEC_ADC_AGC_R_RO_GAIN 0xb0 /* REG 0x2c */ ++ ++/* DAC DIGITAL REGISTERS */ ++#define ACODEC_DAC_I2S_CTL0 0x04 /* REG 0x01 */ ++#define ACODEC_DAC_I2S_CTL1 0x08 /* REG 0x02 */ ++#define ACODEC_DAC_BIST_MODE_SEL 0x0c /* REG 0x03 */ ++/* Resevred REG 0x04 */ ++#define ACODEC_DAC_DATA_SEL 0x14 /* REG 0x05 */ ++/* Resevred REG 0x06 ~ 0x09 */ ++#define ACODEC_DAC_DATA_HI 0x28 /* REG 0x0a */ ++#define ACODEC_DAC_DATA_LO 0x2c /* REG 0x0b */ ++/* Resevred REG 0x0c ~ 0x0f */ ++ ++/* ADC ANALOG REGISTERS */ ++#define ACODEC_ADC_ANA_MIC_CTL 0x00 /* REG 0x00 */ ++#define ACODEC_ADC_ANA_MIC_GAIN 0x04 /* REG 0x01 */ ++#define ACODEC_ADC_ANA_ALC_CTL 0x08 /* REG 0x02 */ ++#define ACODEC_ADC_ANA_ALC_GAIN1 0x0c /* REG 0x03 */ ++#define ACODEC_ADC_ANA_ALC_GAIN2 0x10 /* REG 0x04 */ ++#define ACODEC_ADC_ANA_CTL0 0x14 /* REG 0x05 */ ++#define ACODEC_ADC_ANA_CTL1 0x18 /* REG 0x06 */ ++#define ACODEC_ADC_ANA_CTL2 0x1c /* REG 0x07 */ ++#define ACODEC_ADC_ANA_CTL3 0x20 /* REG 0x08 */ ++/* Resevred REG 0x09 */ ++#define ACODEC_ADC_ANA_CTL4 0x28 /* REG 0x0a */ ++#define ACODEC_ADC_ANA_ALC_PGA 0x2c /* REG 0x0b */ ++/* Resevred REG 0x0c ~ 0x0f */ ++ ++/* DAC ANALOG REGISTERS */ ++#define ACODEC_DAC_ANA_CTL0 0x00 /* REG 0x00 */ ++#define ACODEC_DAC_ANA_POP_VOLT 0x04 /* REG 0x01 */ ++#define ACODEC_DAC_ANA_CTL1 0x08 /* REG 0x02 */ ++#define ACODEC_DAC_ANA_HPOUT 0x0c /* REG 0x03 */ ++#define ACODEC_DAC_ANA_LINEOUT 0x10 /* REG 0x04 */ ++#define ACODEC_DAC_ANA_L_HPOUT_GAIN 0x14 /* REG 0x05 */ ++#define ACODEC_DAC_ANA_R_HPOUT_GAIN 0x18 /* REG 0x06 */ ++/* Resevred REG 0x07 ~ 0x0b */ ++#define ACODEC_DAC_ANA_HPMIX_CTL0 0x30 /* REG 0x0c */ ++#define ACODEC_DAC_ANA_HPMIX_CTL1 0x34 /* REG 0x0d */ ++/* Resevred REG 0x0e ~ 0x0f */ ++ ++/* ++ * These registers are referenced by codec driver ++ */ ++ ++#define RK3308_GLB_CON ACODEC_RESET_CTL ++ ++/* ADC DIGITAL REGISTERS */ ++ ++/* ++ * The ADC chanel are 0 ~ 3, that control: ++ * ++ * CH0: left_0(ADC1) and right_0(ADC2) ++ * CH1: left_1(ADC3) and right_1(ADC4) ++ * CH2: left_2(ADC5) and right_2(ADC6) ++ * CH3: left_3(ADC7) and right_3(ADC8) ++ */ ++#define RK3308_ADC_DIG_OFFSET(ch) ((ch & 0x3) * 0xc0 + 0x0) ++ ++#define RK3308_ADC_DIG_CON01(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_I2S_CTL0) ++#define RK3308_ADC_DIG_CON02(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_I2S_CTL1) ++#define RK3308_ADC_DIG_CON03(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_BIST_MODE_SEL) ++#define RK3308_ADC_DIG_CON07(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_DATA_PATH) ++ ++#define RK3308_ALC_L_DIG_CON00(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_CTL0) ++#define RK3308_ALC_L_DIG_CON01(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_CTL1) ++#define RK3308_ALC_L_DIG_CON02(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_CTL2) ++#define RK3308_ALC_L_DIG_CON03(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_CTL3) ++#define RK3308_ALC_L_DIG_CON04(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_CTL4) ++#define RK3308_ALC_L_DIG_CON05(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_LO_MAX) ++#define RK3308_ALC_L_DIG_CON06(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_HI_MAX) ++#define RK3308_ALC_L_DIG_CON07(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_LO_MIN) ++#define RK3308_ALC_L_DIG_CON08(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_HI_MIN) ++#define RK3308_ALC_L_DIG_CON09(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_CTL5) ++#define RK3308_ALC_L_DIG_CON12(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_AGC_L_RO_GAIN) ++ ++#define RK3308_ALC_R_DIG_CON00(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_CTL0) ++#define RK3308_ALC_R_DIG_CON01(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_CTL1) ++#define RK3308_ALC_R_DIG_CON02(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_CTL2) ++#define RK3308_ALC_R_DIG_CON03(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_CTL3) ++#define RK3308_ALC_R_DIG_CON04(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_CTL4) ++#define RK3308_ALC_R_DIG_CON05(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_LO_MAX) ++#define RK3308_ALC_R_DIG_CON06(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_HI_MAX) ++#define RK3308_ALC_R_DIG_CON07(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_LO_MIN) ++#define RK3308_ALC_R_DIG_CON08(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_HI_MIN) ++#define RK3308_ALC_R_DIG_CON09(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_CTL5) ++#define RK3308_ALC_R_DIG_CON12(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_AGC_R_RO_GAIN) ++ ++/* DAC DIGITAL REGISTERS */ ++#define RK3308_DAC_DIG_OFFSET 0x300 ++ ++#define RK3308_DAC_DIG_CON01 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_I2S_CTL0) ++#define RK3308_DAC_DIG_CON02 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_I2S_CTL1) ++#define RK3308_DAC_DIG_CON03 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_BIST_MODE_SEL) ++#define RK3308_DAC_DIG_CON05 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_DATA_SEL) ++#define RK3308_DAC_DIG_CON10 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_DATA_HI) ++#define RK3308_DAC_DIG_CON11 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_DATA_LO) ++ ++/* ADC ANALOG REGISTERS */ ++/* ++ * The ADC chanel are 0 ~ 3, that control: ++ * ++ * CH0: left_0(ADC1) and right_0(ADC2) ++ * CH1: left_1(ADC3) and right_1(ADC4) ++ * CH2: left_2(ADC5) and right_2(ADC6) ++ * CH3: left_3(ADC7) and right_3(ADC8) ++ */ ++#define RK3308_ADC_ANA_OFFSET(ch) ((ch & 0x3) * 0x40 + 0x340) ++ ++#define RK3308_ADC_ANA_CON00(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_MIC_CTL) ++#define RK3308_ADC_ANA_CON01(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_MIC_GAIN) ++#define RK3308_ADC_ANA_CON02(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_ALC_CTL) ++#define RK3308_ADC_ANA_CON03(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_ALC_GAIN1) ++#define RK3308_ADC_ANA_CON04(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_ALC_GAIN2) ++#define RK3308_ADC_ANA_CON05(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_CTL0) ++#define RK3308_ADC_ANA_CON06(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_CTL1) ++#define RK3308_ADC_ANA_CON07(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_CTL2) ++#define RK3308_ADC_ANA_CON08(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_CTL3) ++#define RK3308_ADC_ANA_CON10(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_CTL4) ++#define RK3308_ADC_ANA_CON11(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_ALC_PGA) ++ ++/* DAC ANALOG REGISTERS */ ++#define RK3308_DAC_ANA_OFFSET 0x440 ++ ++#define RK3308_DAC_ANA_CON00 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_CTL0) ++#define RK3308_DAC_ANA_CON01 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_POP_VOLT) ++#define RK3308_DAC_ANA_CON02 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_CTL1) ++#define RK3308_DAC_ANA_CON03 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_HPOUT) ++#define RK3308_DAC_ANA_CON04 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_LINEOUT) ++#define RK3308_DAC_ANA_CON05 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_L_HPOUT_GAIN) ++#define RK3308_DAC_ANA_CON06 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_R_HPOUT_GAIN) ++#define RK3308_DAC_ANA_CON12 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_HPMIX_CTL0) ++#define RK3308_DAC_ANA_CON13 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_HPMIX_CTL1) ++ ++/* ++ * These are the bits for registers ++ */ ++ ++/* RK3308_GLB_CON - REG: 0x0000 */ ++#define RK3308_ADC_BIST_WORK (1 << 7) ++#define RK3308_ADC_BIST_RESET (0 << 7) ++#define RK3308_DAC_BIST_WORK (1 << 6) ++#define RK3308_DAC_BIST_RESET (0 << 6) ++#define RK3308_CODEC_RST_MSK (0x7 << 0) ++#define RK3308_ADC_DIG_WORK (1 << 2) ++#define RK3308_ADC_DIG_RESET (0 << 2) ++#define RK3308_DAC_DIG_WORK (1 << 1) ++#define RK3308_DAC_DIG_RESET (0 << 1) ++#define RK3308_SYS_WORK (1 << 0) ++#define RK3308_SYS_RESET (0 << 0) ++ ++/* RK3308_ADC_DIG_CON01 - REG: 0x0004 */ ++#define RK3308_ADC_I2S_LRC_POL_MSK (1 << 0) ++#define RK3308_ADC_I2S_LRC_POL_REVERSAL (1 << 0) ++#define RK3308_ADC_I2S_LRC_POL_NORMAL (0 << 0) ++#define RK3308_ADC_I2S_VALID_LEN_SFT 5 ++#define RK3308_ADC_I2S_VALID_LEN_MSK (0x3 << RK3308_ADC_I2S_VALID_LEN_SFT) ++#define RK3308_ADC_I2S_VALID_LEN_32BITS (0x3 << RK3308_ADC_I2S_VALID_LEN_SFT) ++#define RK3308_ADC_I2S_VALID_LEN_24BITS (0x2 << RK3308_ADC_I2S_VALID_LEN_SFT) ++#define RK3308_ADC_I2S_VALID_LEN_20BITS (0x1 << RK3308_ADC_I2S_VALID_LEN_SFT) ++#define RK3308_ADC_I2S_VALID_LEN_16BITS (0x0 << RK3308_ADC_I2S_VALID_LEN_SFT) ++#define RK3308_ADC_I2S_MODE_SFT 3 ++#define RK3308_ADC_I2S_MODE_MSK (0x3 << RK3308_ADC_I2S_MODE_SFT) ++#define RK3308_ADC_I2S_MODE_PCM (0x3 << RK3308_ADC_I2S_MODE_SFT) ++#define RK3308_ADC_I2S_MODE_I2S (0x2 << RK3308_ADC_I2S_MODE_SFT) ++#define RK3308_ADC_I2S_MODE_LJ (0x1 << RK3308_ADC_I2S_MODE_SFT) ++#define RK3308_ADC_I2S_MODE_RJ (0x0 << RK3308_ADC_I2S_MODE_SFT) ++#define RK3308_ADC_I2S_LR_MSK (1 << 1) ++#define RK3308_ADC_I2S_LR_SWAP (1 << 1) ++#define RK3308_ADC_I2S_LR_NORMAL (0 << 1) ++#define RK3308_ADC_I2S_TYPE_MSK (1 << 0) ++#define RK3308_ADC_I2S_MONO (1 << 0) ++#define RK3308_ADC_I2S_STEREO (0 << 0) ++ ++/* RK3308_ADC_DIG_CON02 - REG: 0x0008 */ ++#define RK3308_ADC_IO_MODE_MSK (1 << 5) ++#define RK3308_ADC_IO_MODE_MASTER (1 << 5) ++#define RK3308_ADC_IO_MODE_SLAVE (0 << 5) ++#define RK3308_ADC_MODE_MSK (1 << 4) ++#define RK3308_ADC_MODE_MASTER (1 << 4) ++#define RK3308_ADC_MODE_SLAVE (0 << 4) ++#define RK3308_ADC_I2S_FRAME_LEN_SFT 2 ++#define RK3308_ADC_I2S_FRAME_LEN_MSK (0x3 << RK3308_ADC_I2S_FRAME_LEN_SFT) ++#define RK3308_ADC_I2S_FRAME_32BITS (0x3 << RK3308_ADC_I2S_FRAME_LEN_SFT) ++#define RK3308_ADC_I2S_FRAME_24BITS (0x2 << RK3308_ADC_I2S_FRAME_LEN_SFT) ++#define RK3308_ADC_I2S_FRAME_20BITS (0x1 << RK3308_ADC_I2S_FRAME_LEN_SFT) ++#define RK3308_ADC_I2S_FRAME_16BITS (0x0 << RK3308_ADC_I2S_FRAME_LEN_SFT) ++#define RK3308_ADC_I2S_MSK (0x1 << 1) ++#define RK3308_ADC_I2S_WORK (0x1 << 1) ++#define RK3308_ADC_I2S_RESET (0x0 << 1) ++#define RK3308_ADC_I2S_BIT_CLK_POL_MSK (0x1 << 0) ++#define RK3308_ADC_I2S_BIT_CLK_POL_REVERSAL (0x1 << 0) ++#define RK3308_ADC_I2S_BIT_CLK_POL_NORMAL (0x0 << 0) ++ ++/* RK3308_ADC_DIG_CON03 - REG: 0x000c */ ++#define RK3308_ADC_L_CH_BIST_SFT 2 ++#define RK3308_ADC_L_CH_BIST_MSK (0x3 << RK3308_ADC_L_CH_BIST_SFT) ++#define RK3308_ADC_L_CH_BIST_LEFT (0x3 << RK3308_ADC_L_CH_BIST_SFT) /* normal mode */ ++#define RK3308_ADC_L_CH_BIST_SINE (0x2 << RK3308_ADC_L_CH_BIST_SFT) ++#define RK3308_ADC_L_CH_BIST_CUBE (0x1 << RK3308_ADC_L_CH_BIST_SFT) ++#define RK3308_ADC_L_CH_BIST_RIGHT (0x0 << RK3308_ADC_L_CH_BIST_SFT) /* normal mode */ ++#define RK3308_ADC_R_CH_BIST_SFT 0 ++#define RK3308_ADC_R_CH_BIST_MSK (0x3 << RK3308_ADC_R_CH_BIST_SFT) ++#define RK3308_ADC_R_CH_BIST_LEFT (0x3 << RK3308_ADC_R_CH_BIST_SFT) /* normal mode */ ++#define RK3308_ADC_R_CH_BIST_SINE (0x2 << RK3308_ADC_R_CH_BIST_SFT) ++#define RK3308_ADC_R_CH_BIST_CUBE (0x1 << RK3308_ADC_R_CH_BIST_SFT) ++#define RK3308_ADC_R_CH_BIST_RIGHT (0x0 << RK3308_ADC_R_CH_BIST_SFT) /* normal mode */ ++ ++/* RK3308_ADC_DIG_CON07 - REG: 0x001c */ ++#define RK3308_ADCL_DATA_SFT 4 ++#define RK3308_ADCL_DATA(x) (x << RK3308_ADCL_DATA_SFT) ++#define RK3308_ADCR_DATA_SFT 2 ++#define RK3308_ADCR_DATA(x) (x << RK3308_ADCR_DATA_SFT) ++#define RK3308_ADCL_DATA_SEL_ADCL (0x1 << 1) ++#define RK3308_ADCL_DATA_SEL_NORMAL (0x0 << 1) ++#define RK3308_ADCR_DATA_SEL_ADCR (0x1 << 0) ++#define RK3308_ADCR_DATA_SEL_NORMAL (0x0 << 0) ++ ++/* ++ * RK3308_ALC_L_DIG_CON00 - REG: 0x0040 + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON00 - REG: 0x0080 + ch * 0xc0 ++ */ ++#define RK3308_GAIN_ATTACK_JACK (0x1 << 6) ++#define RK3308_GAIN_ATTACK_NORMAL (0x0 << 6) ++#define RK3308_CTRL_GEN_SFT 4 ++#define RK3308_CTRL_GEN_MSK (0x3 << RK3308_ALC_CTRL_GEN_SFT) ++#define RK3308_CTRL_GEN_JACK3 (0x3 << RK3308_ALC_CTRL_GEN_SFT) ++#define RK3308_CTRL_GEN_JACK2 (0x2 << RK3308_ALC_CTRL_GEN_SFT) ++#define RK3308_CTRL_GEN_JACK1 (0x1 << RK3308_ALC_CTRL_GEN_SFT) ++#define RK3308_CTRL_GEN_NORMAL (0x0 << RK3308_ALC_CTRL_GEN_SFT) ++#define RK3308_AGC_HOLD_TIME_SFT 0 ++#define RK3308_AGC_HOLD_TIME_MSK (0xf << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_1S (0xa << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_512MS (0x9 << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_256MS (0x8 << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_128MS (0x7 << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_64MS (0x6 << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_32MS (0x5 << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_16MS (0x4 << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_8MS (0x3 << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_4MS (0x2 << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_2MS (0x1 << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_0MS (0x0 << RK3308_AGC_HOLD_TIME_SFT) ++ ++/* ++ * RK3308_ALC_L_DIG_CON01 - REG: 0x0044 + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON01 - REG: 0x0084 + ch * 0xc0 ++ */ ++#define RK3308_AGC_DECAY_TIME_SFT 4 ++/* Normal mode (reg_agc_mode = 0) */ ++#define RK3308_AGC_DECAY_NORMAL_MSK (0xf << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_512MS (0xa << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_256MS (0x9 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_128MS (0x8 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_64MS (0x7 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_32MS (0x6 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_16MS (0x5 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_8MS (0x4 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_4MS (0x3 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_2MS (0x2 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_1MS (0x1 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_0MS (0x0 << RK3308_AGC_DECAY_TIME_SFT) ++/* Limiter mode (reg_agc_mode = 1) */ ++#define RK3308_AGC_DECAY_LIMITER_MSK (0xf << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_128MS (0xa << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_64MS (0x9 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_32MS (0x8 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_16MS (0x7 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_8MS (0x6 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_4MS (0x5 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_2MS (0x4 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_1MS (0x3 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_500US (0x2 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_250US (0x1 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_125US (0x0 << RK3308_AGC_DECAY_TIME_SFT) ++ ++#define RK3308_AGC_ATTACK_TIME_SFT 0 ++/* Normal mode (reg_agc_mode = 0) */ ++#define RK3308_AGC_ATTACK_NORMAL_MSK (0xf << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_128MS (0xa << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_64MS (0x9 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_32MS (0x8 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_16MS (0x7 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_8MS (0x6 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_4MS (0x5 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_2MS (0x4 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_1MS (0x3 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_500US (0x2 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_250US (0x1 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_125US (0x0 << RK3308_AGC_ATTACK_TIME_SFT) ++/* Limiter mode (reg_agc_mode = 1) */ ++#define RK3308_AGC_ATTACK_LIMITER_MSK (0xf << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_32MS (0xa << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_16MS (0x9 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_8MS (0x8 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_4MS (0x7 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_2MS (0x6 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_1MS (0x5 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_500US (0x4 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_250US (0x3 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_125US (0x2 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_64US (0x1 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_32US (0x0 << RK3308_AGC_ATTACK_TIME_SFT) ++ ++/* ++ * RK3308_ALC_L_DIG_CON02 - REG: 0x0048 + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON02 - REG: 0x0088 + ch * 0xc0 ++ */ ++#define RK3308_AGC_MODE_LIMITER (0x1 << 7) ++#define RK3308_AGC_MODE_NORMAL (0x0 << 7) ++#define RK3308_AGC_ZERO_CRO_EN (0x1 << 6) ++#define RK3308_AGC_ZERO_CRO_DIS (0x0 << 6) ++#define RK3308_AGC_AMP_RECOVER_GAIN (0x1 << 5) ++#define RK3308_AGC_AMP_RECOVER_LVOL (0x0 << 5) ++#define RK3308_AGC_FAST_DEC_EN (0x1 << 4) ++#define RK3308_AGC_FAST_DEC_DIS (0x0 << 4) ++#define RK3308_AGC_NOISE_GATE_EN (0x1 << 3) ++#define RK3308_AGC_NOISE_GATE_DIS (0x0 << 3) ++#define RK3308_AGC_NOISE_GATE_THRESH_SFT 0 ++#define RK3308_AGC_NOISE_GATE_THRESH_MSK (0x7 << RK3308_AGC_NOISE_GATE_THRESH_SFT) ++#define RK3308_AGC_NOISE_GATE_THRESH_N81DB (0x7 << RK3308_AGC_NOISE_GATE_THRESH_SFT) ++#define RK3308_AGC_NOISE_GATE_THRESH_N75DB (0x6 << RK3308_AGC_NOISE_GATE_THRESH_SFT) ++#define RK3308_AGC_NOISE_GATE_THRESH_N69DB (0x5 << RK3308_AGC_NOISE_GATE_THRESH_SFT) ++#define RK3308_AGC_NOISE_GATE_THRESH_N63DB (0x4 << RK3308_AGC_NOISE_GATE_THRESH_SFT) ++#define RK3308_AGC_NOISE_GATE_THRESH_N57DB (0x3 << RK3308_AGC_NOISE_GATE_THRESH_SFT) ++#define RK3308_AGC_NOISE_GATE_THRESH_N51DB (0x2 << RK3308_AGC_NOISE_GATE_THRESH_SFT) ++#define RK3308_AGC_NOISE_GATE_THRESH_N45DB (0x1 << RK3308_AGC_NOISE_GATE_THRESH_SFT) ++#define RK3308_AGC_NOISE_GATE_THRESH_N39DB (0x0 << RK3308_AGC_NOISE_GATE_THRESH_SFT) ++ ++/* ++ * RK3308_ALC_L_DIG_CON03 - REG: 0x004c + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON03 - REG: 0x008c + ch * 0xc0 ++ */ ++#define RK3308_AGC_PGA_ZERO_CRO_EN (0x1 << 5) ++#define RK3308_AGC_PGA_ZERO_CRO_DIS (0x0 << 5) ++#define RK3308_AGC_PGA_GAIN_SFT 0 ++#define RK3308_AGC_PGA_GAIN_MSK (0x1f << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_28_5 (0x1f << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_27 (0x1e << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_25_5 (0x1d << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_24 (0x1c << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_22_5 (0x1b << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_21 (0x1a << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_19_5 (0x19 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_18 (0x18 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_16_5 (0x17 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_15 (0x16 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_13_5 (0x15 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_12 (0x14 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_10_5 (0x13 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_9 (0x12 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_7_5 (0x11 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_6 (0x10 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_4_5 (0x0f << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_3 (0x0e << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_1_5 (0x0d << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_0DB (0x0c << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_1_5 (0x0b << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_3 (0x0a << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_4_5 (0x09 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_6 (0x08 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_7_5 (0x07 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_9 (0x06 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_10_5 (0x05 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_12 (0x04 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_13_5 (0x03 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_15 (0x02 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_16_5 (0x01 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_18 (0x00 << RK3308_AGC_PGA_GAIN_SFT) ++ ++/* ++ * RK3308_ALC_L_DIG_CON04 - REG: 0x0050 + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON04 - REG: 0x0090 + ch * 0xc0 ++ */ ++#define RK3308_AGC_SLOW_CLK_EN (0x1 << 3) ++#define RK3308_AGC_SLOW_CLK_DIS (0x0 << 3) ++#define RK3308_AGC_APPROX_RATE_SFT 0 ++#define RK3308_AGC_APPROX_RATE_MSK (0x7 << RK3308_AGC_APPROX_RATE_SFT) ++#define RK3308_AGC_APPROX_RATE_8K (0x7 << RK3308_AGC_APPROX_RATE_SFT) ++#define RK3308_AGC_APPROX_RATE_12K (0x6 << RK3308_AGC_APPROX_RATE_SFT) ++#define RK3308_AGC_APPROX_RATE_16K (0x5 << RK3308_AGC_APPROX_RATE_SFT) ++#define RK3308_AGC_APPROX_RATE_24K (0x4 << RK3308_AGC_APPROX_RATE_SFT) ++#define RK3308_AGC_APPROX_RATE_32K (0x3 << RK3308_AGC_APPROX_RATE_SFT) ++#define RK3308_AGC_APPROX_RATE_44_1K (0x2 << RK3308_AGC_APPROX_RATE_SFT) ++#define RK3308_AGC_APPROX_RATE_48K (0x1 << RK3308_AGC_APPROX_RATE_SFT) ++#define RK3308_AGC_APPROX_RATE_96K (0x0 << RK3308_AGC_APPROX_RATE_SFT) ++ ++/* ++ * RK3308_ALC_L_DIG_CON05 - REG: 0x0054 + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON05 - REG: 0x0094 + ch * 0xc0 ++ */ ++#define RK3308_AGC_LO_8BITS_AGC_MAX_MSK 0xff ++ ++/* ++ * RK3308_ALC_L_DIG_CON06 - REG: 0x0058 + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON06 - REG: 0x0098 + ch * 0xc0 ++ */ ++#define RK3308_AGC_HI_8BITS_AGC_MAX_MSK 0xff ++ ++/* ++ * RK3308_ALC_L_DIG_CON07 - REG: 0x005c + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON07 - REG: 0x009c + ch * 0xc0 ++ */ ++#define RK3308_AGC_LO_8BITS_AGC_MIN_MSK 0xff ++ ++/* ++ * RK3308_ALC_L_DIG_CON08 - REG: 0x0060 + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON08 - REG: 0x00a0 + ch * 0xc0 ++ */ ++#define RK3308_AGC_HI_8BITS_AGC_MIN_MSK 0xff ++ ++/* ++ * RK3308_ALC_L_DIG_CON09 - REG: 0x0064 + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON09 - REG: 0x00a4 + ch * 0xc0 ++ */ ++#define RK3308_AGC_FUNC_SEL_MSK (0x1 << 6) ++#define RK3308_AGC_FUNC_SEL_EN (0x1 << 6) ++#define RK3308_AGC_FUNC_SEL_DIS (0x0 << 6) ++#define RK3308_AGC_MAX_GAIN_PGA_SFT 3 ++#define RK3308_AGC_MAX_GAIN_PGA_MSK (0x7 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MAX_GAIN_PGA_PDB_28_5 (0x7 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MAX_GAIN_PGA_PDB_22_5 (0x6 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MAX_GAIN_PGA_PDB_16_5 (0x5 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MAX_GAIN_PGA_PDB_10_5 (0x4 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MAX_GAIN_PGA_PDB_4_5 (0x3 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MAX_GAIN_PGA_NDB_1_5 (0x2 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MAX_GAIN_PGA_NDB_7_5 (0x1 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MAX_GAIN_PGA_NDB_13_5 (0x0 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_SFT 0 ++#define RK3308_AGC_MIN_GAIN_PGA_MSK (0x7 << RK3308_AGC_MIN_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_PDB_24 (0x7 << RK3308_AGC_MIN_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_PDB_18 (0x6 << RK3308_AGC_MIN_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_PDB_12 (0x5 << RK3308_AGC_MIN_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_PDB_6 (0x4 << RK3308_AGC_MIN_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_0DB (0x3 << RK3308_AGC_MIN_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_NDB_6 (0x2 << RK3308_AGC_MIN_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_NDB_12 (0x1 << RK3308_AGC_MIN_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_NDB_18 (0x0 << RK3308_AGC_MIN_GAIN_PGA_SFT) ++ ++/* ++ * RK3308_ALC_L_DIG_CON12 - REG: 0x0068 + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON12 - REG: 0x00a8 + ch * 0xc0 ++ */ ++#define RK3308_AGC_GAIN_MSK 0x1f ++ ++/* RK3308_DAC_DIG_CON01 - REG: 0x0304 */ ++#define RK3308_DAC_I2S_LRC_POL_MSK (0x1 << 7) ++#define RK3308_DAC_I2S_LRC_POL_REVERSAL (0x1 << 7) ++#define RK3308_DAC_I2S_LRC_POL_NORMAL (0x0 << 7) ++#define RK3308_DAC_I2S_VALID_LEN_SFT 5 ++#define RK3308_DAC_I2S_VALID_LEN_MSK (0x3 << RK3308_DAC_I2S_VALID_LEN_SFT) ++#define RK3308_DAC_I2S_VALID_LEN_32BITS (0x3 << RK3308_DAC_I2S_VALID_LEN_SFT) ++#define RK3308_DAC_I2S_VALID_LEN_24BITS (0x2 << RK3308_DAC_I2S_VALID_LEN_SFT) ++#define RK3308_DAC_I2S_VALID_LEN_20BITS (0x1 << RK3308_DAC_I2S_VALID_LEN_SFT) ++#define RK3308_DAC_I2S_VALID_LEN_16BITS (0x0 << RK3308_DAC_I2S_VALID_LEN_SFT) ++#define RK3308_DAC_I2S_MODE_SFT 3 ++#define RK3308_DAC_I2S_MODE_MSK (0x3 << RK3308_DAC_I2S_MODE_SFT) ++#define RK3308_DAC_I2S_MODE_PCM (0x3 << RK3308_DAC_I2S_MODE_SFT) ++#define RK3308_DAC_I2S_MODE_I2S (0x2 << RK3308_DAC_I2S_MODE_SFT) ++#define RK3308_DAC_I2S_MODE_LJ (0x1 << RK3308_DAC_I2S_MODE_SFT) ++#define RK3308_DAC_I2S_MODE_RJ (0x0 << RK3308_DAC_I2S_MODE_SFT) ++#define RK3308_DAC_I2S_LR_MSK (0x1 << 2) ++#define RK3308_DAC_I2S_LR_SWAP (0x1 << 2) ++#define RK3308_DAC_I2S_LR_NORMAL (0x0 << 2) ++ ++/* RK3308_DAC_DIG_CON02 - REG: 0x0308 */ ++#define RK3308_DAC_IO_MODE_MSK (0x1 << 5) ++#define RK3308_DAC_IO_MODE_MASTER (0x1 << 5) ++#define RK3308_DAC_IO_MODE_SLAVE (0x0 << 5) ++#define RK3308_DAC_MODE_MSK (0x1 << 4) ++#define RK3308_DAC_MODE_MASTER (0x1 << 4) ++#define RK3308_DAC_MODE_SLAVE (0x0 << 4) ++#define RK3308_DAC_I2S_FRAME_LEN_SFT 2 ++#define RK3308_DAC_I2S_FRAME_LEN_MSK (0x3 << RK3308_DAC_I2S_FRAME_LEN_SFT) ++#define RK3308_DAC_I2S_FRAME_32BITS (0x3 << RK3308_DAC_I2S_FRAME_LEN_SFT) ++#define RK3308_DAC_I2S_FRAME_24BITS (0x2 << RK3308_DAC_I2S_FRAME_LEN_SFT) ++#define RK3308_DAC_I2S_FRAME_20BITS (0x1 << RK3308_DAC_I2S_FRAME_LEN_SFT) ++#define RK3308_DAC_I2S_FRAME_16BITS (0x0 << RK3308_DAC_I2S_FRAME_LEN_SFT) ++#define RK3308_DAC_I2S_MSK (0x1 << 1) ++#define RK3308_DAC_I2S_WORK (0x1 << 1) ++#define RK3308_DAC_I2S_RESET (0x0 << 1) ++#define RK3308_DAC_I2S_BIT_CLK_POL_MSK (0x1 << 0) ++#define RK3308_DAC_I2S_BIT_CLK_POL_REVERSAL (0x1 << 0) ++#define RK3308_DAC_I2S_BIT_CLK_POL_NORMAL (0x0 << 0) ++ ++/* RK3308_DAC_DIG_CON03 - REG: 0x030C */ ++#define RK3308_DAC_L_CH_BIST_SFT 2 ++#define RK3308_DAC_L_CH_BIST_MSK (0x3 << RK3308_DAC_L_CH_BIST_SFT) ++#define RK3308_DAC_L_CH_BIST_LEFT (0x3 << RK3308_DAC_L_CH_BIST_SFT) /* normal mode */ ++#define RK3308_DAC_L_CH_BIST_CUBE (0x2 << RK3308_DAC_L_CH_BIST_SFT) ++#define RK3308_DAC_L_CH_BIST_SINE (0x1 << RK3308_DAC_L_CH_BIST_SFT) ++#define RK3308_DAC_L_CH_BIST_RIGHT (0x0 << RK3308_DAC_L_CH_BIST_SFT) /* normal mode */ ++#define RK3308_DAC_R_CH_BIST_SFT 0 ++#define RK3308_DAC_R_CH_BIST_MSK (0x3 << RK3308_DAC_R_CH_BIST_SFT) ++#define RK3308_DAC_R_CH_BIST_LEFT (0x3 << RK3308_DAC_R_CH_BIST_SFT) /* normal mode */ ++#define RK3308_DAC_R_CH_BIST_CUBE (0x2 << RK3308_DAC_R_CH_BIST_SFT) ++#define RK3308_DAC_R_CH_BIST_SINE (0x1 << RK3308_DAC_R_CH_BIST_SFT) ++#define RK3308_DAC_R_CH_BIST_RIGHT (0x0 << RK3308_DAC_R_CH_BIST_SFT) /* normal mode */ ++ ++/* RK3308_DAC_DIG_CON05 - REG: 0x0314 */ ++#define RK3308_DAC_L_REG_CTL_INDATA (0x1 << 2) ++#define RK3308_DAC_L_NORMAL_DATA (0x0 << 2) ++#define RK3308_DAC_R_REG_CTL_INDATA (0x1 << 1) ++#define RK3308_DAC_R_NORMAL_DATA (0x0 << 1) ++ ++/* RK3308_DAC_DIG_CON10 - REG: 0x0328 */ ++#define RK3308_DAC_DATA_HI4(x) (x & 0xf) /* Need to RK3308_DAC_x_REG_CTL_INDATA */ ++ ++/* RK3308_DAC_DIG_CON11 - REG: 0x032c */ ++#define RK3308_DAC_DATA_LO8(x) (x & 0xff) /* Need to RK3308_DAC_x_REG_CTL_INDATA */ ++ ++/* RK3308_ADC_ANA_CON00 - REG: 0x0340 */ ++#define RK3308_ADC_CH1_CH2_MIC_ALL_MSK (0xff << 0) ++#define RK3308_ADC_CH1_CH2_MIC_ALL 0xff ++#define RK3308_ADC_CH2_MIC_UNMUTE (0x1 << 7) ++#define RK3308_ADC_CH2_MIC_MUTE (0x0 << 7) ++#define RK3308_ADC_CH2_MIC_WORK (0x1 << 6) ++#define RK3308_ADC_CH2_MIC_INIT (0x0 << 6) ++#define RK3308_ADC_CH2_MIC_EN (0x1 << 5) ++#define RK3308_ADC_CH2_MIC_DIS (0x0 << 5) ++#define RK3308_ADC_CH2_BUF_REF_EN (0x1 << 4) ++#define RK3308_ADC_CH2_BUF_REF_DIS (0x0 << 4) ++#define RK3308_ADC_CH1_MIC_UNMUTE (0x1 << 3) ++#define RK3308_ADC_CH1_MIC_MUTE (0x0 << 3) ++#define RK3308_ADC_CH1_MIC_WORK (0x1 << 2) ++#define RK3308_ADC_CH1_MIC_INIT (0x0 << 2) ++#define RK3308_ADC_CH1_MIC_EN (0x1 << 1) ++#define RK3308_ADC_CH1_MIC_DIS (0x0 << 1) ++#define RK3308_ADC_CH1_BUF_REF_EN (0x1 << 0) ++#define RK3308_ADC_CH1_BUF_REF_DIS (0x0 << 0) ++ ++/* RK3308_ADC_ANA_CON01 - REG: 0x0344 */ ++#define RK3308_ADC_CH2_MIC_GAIN_SFT 4 ++#define RK3308_ADC_CH2_MIC_GAIN_MSK (0x3 << RK3308_ADC_CH2_MIC_GAIN_SFT) ++#define RK3308_ADC_CH2_MIC_GAIN_30DB (0x3 << RK3308_ADC_CH2_MIC_GAIN_SFT) ++#define RK3308_ADC_CH2_MIC_GAIN_20DB (0x2 << RK3308_ADC_CH2_MIC_GAIN_SFT) ++#define RK3308_ADC_CH2_MIC_GAIN_6DB (0x1 << RK3308_ADC_CH2_MIC_GAIN_SFT) ++#define RK3308_ADC_CH2_MIC_GAIN_0DB (0x0 << RK3308_ADC_CH2_MIC_GAIN_SFT) ++#define RK3308_ADC_CH1_MIC_GAIN_SFT 0 ++#define RK3308_ADC_CH1_MIC_GAIN_MSK (0x3 << RK3308_ADC_CH1_MIC_GAIN_SFT) ++#define RK3308_ADC_CH1_MIC_GAIN_30DB (0x3 << RK3308_ADC_CH1_MIC_GAIN_SFT) ++#define RK3308_ADC_CH1_MIC_GAIN_20DB (0x2 << RK3308_ADC_CH1_MIC_GAIN_SFT) ++#define RK3308_ADC_CH1_MIC_GAIN_6DB (0x1 << RK3308_ADC_CH1_MIC_GAIN_SFT) ++#define RK3308_ADC_CH1_MIC_GAIN_0DB (0x0 << RK3308_ADC_CH1_MIC_GAIN_SFT) ++ ++/* RK3308_ADC_ANA_CON02 - REG: 0x0348 */ ++#define RK3308_ADC_CH2_ALC_ZC_MSK (0x7 << 4) ++#define RK3308_ADC_CH2_ZEROCROSS_DET_EN (0x1 << 6) ++#define RK3308_ADC_CH2_ZEROCROSS_DET_DIS (0x0 << 6) ++#define RK3308_ADC_CH2_ALC_WORK (0x1 << 5) ++#define RK3308_ADC_CH2_ALC_INIT (0x0 << 5) ++#define RK3308_ADC_CH2_ALC_EN (0x1 << 4) ++#define RK3308_ADC_CH2_ALC_DIS (0x0 << 4) ++ ++#define RK3308_ADC_CH1_ALC_ZC_MSK (0x7 << 0) ++#define RK3308_ADC_CH1_ZEROCROSS_DET_EN (0x1 << 2) ++#define RK3308_ADC_CH1_ZEROCROSS_DET_DIS (0x0 << 2) ++#define RK3308_ADC_CH1_ALC_WORK (0x1 << 1) ++#define RK3308_ADC_CH1_ALC_INIT (0x0 << 1) ++#define RK3308_ADC_CH1_ALC_EN (0x1 << 0) ++#define RK3308_ADC_CH1_ALC_DIS (0x0 << 0) ++ ++/* RK3308_ADC_ANA_CON03 - REG: 0x034c */ ++#define RK3308_ADC_CH1_ALC_GAIN_SFT 0 ++#define RK3308_ADC_CH1_ALC_GAIN_MSK (0x1f << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_28_5 (0x1f << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_27 (0x1e << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_25_5 (0x1d << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_24 (0x1c << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_22_5 (0x1b << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_21 (0x1a << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_19_5 (0x19 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_18 (0x18 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_16_5 (0x17 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_15 (0x16 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_13_5 (0x15 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_12 (0x14 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_10_5 (0x13 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_9 (0x12 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_7_5 (0x11 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_6 (0x10 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_4_5 (0x0f << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_3 (0x0e << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_1_5 (0x0d << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_0DB (0x0c << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_1_5 (0x0b << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_3 (0x0a << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_4_5 (0x09 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_6 (0x08 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_7_5 (0x07 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_9 (0x06 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_10_5 (0x05 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_12 (0x04 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_13_5 (0x03 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_15 (0x02 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_16_5 (0x01 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_18 (0x00 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++ ++/* RK3308_ADC_ANA_CON04 - REG: 0x0350 */ ++#define RK3308_ADC_CH2_ALC_GAIN_SFT 0 ++#define RK3308_ADC_CH2_ALC_GAIN_MSK (0x1f << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_28_5 (0x1f << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_27 (0x1e << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_25_5 (0x1d << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_24 (0x1c << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_22_5 (0x1b << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_21 (0x1a << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_19_5 (0x19 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_18 (0x18 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_16_5 (0x17 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_15 (0x16 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_13_5 (0x15 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_12 (0x14 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_10_5 (0x13 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_9 (0x12 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_7_5 (0x11 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_6 (0x10 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_4_5 (0x0f << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_3 (0x0e << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_1_5 (0x0d << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_0DB (0x0c << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_1_5 (0x0b << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_3 (0x0a << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_4_5 (0x09 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_6 (0x08 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_7_5 (0x07 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_9 (0x06 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_10_5 (0x05 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_12 (0x04 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_13_5 (0x03 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_15 (0x02 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_16_5 (0x01 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_18 (0x00 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++ ++/* RK3308_ADC_ANA_CON05 - REG: 0x0354 */ ++#define RK3308_ADC_CH2_ADC_CLK_MSK (0x7 << 4) ++#define RK3308_ADC_CH2_ADC_WORK (0x1 << 6) ++#define RK3308_ADC_CH2_ADC_INIT (0x0 << 6) ++#define RK3308_ADC_CH2_ADC_EN (0x1 << 5) ++#define RK3308_ADC_CH2_ADC_DIS (0x0 << 5) ++#define RK3308_ADC_CH2_CLK_EN (0x1 << 4) ++#define RK3308_ADC_CH2_CLK_DIS (0x0 << 4) ++ ++#define RK3308_ADC_CH1_ADC_CLK_MSK (0x7 << 0) ++#define RK3308_ADC_CH1_ADC_WORK (0x1 << 2) ++#define RK3308_ADC_CH1_ADC_INIT (0x0 << 2) ++#define RK3308_ADC_CH1_ADC_EN (0x1 << 1) ++#define RK3308_ADC_CH1_ADC_DIS (0x0 << 1) ++#define RK3308_ADC_CH1_CLK_EN (0x1 << 0) ++#define RK3308_ADC_CH1_CLK_DIS (0x0 << 0) ++ ++/* RK3308_ADC_ANA_CON06 - REG: 0x0358 */ ++#define RK3308_ADC_CURRENT_MSK (0x1 << 0) ++#define RK3308_ADC_CURRENT_EN (0x1 << 0) ++#define RK3308_ADC_CURRENT_DIS (0x0 << 0) ++ ++/* RK3308_ADC_ANA_CON07 - REG: 0x035c */ ++/* Note: The register configuration is only valid for ADC2 */ ++#define RK3308_ADC_CH2_IN_SEL_SFT 6 ++#define RK3308_ADC_CH2_IN_SEL_MSK (0x3 << RK3308_ADC_CH2_IN_SEL_SFT) ++#define RK3308_ADC_CH2_IN_LINEIN_MIC (0x3 << RK3308_ADC_CH2_IN_SEL_SFT) ++#define RK3308_ADC_CH2_IN_LINEIN (0x2 << RK3308_ADC_CH2_IN_SEL_SFT) ++#define RK3308_ADC_CH2_IN_MIC (0x1 << RK3308_ADC_CH2_IN_SEL_SFT) ++#define RK3308_ADC_CH2_IN_NONE (0x0 << RK3308_ADC_CH2_IN_SEL_SFT) ++/* Note: The register configuration is only valid for ADC1 */ ++#define RK3308_ADC_CH1_IN_SEL_SFT 4 ++#define RK3308_ADC_CH1_IN_SEL_MSK (0x3 << RK3308_ADC_CH1_IN_SEL_SFT) ++#define RK3308_ADC_CH1_IN_LINEIN_MIC (0x3 << RK3308_ADC_CH1_IN_SEL_SFT) ++#define RK3308_ADC_CH1_IN_LINEIN (0x2 << RK3308_ADC_CH1_IN_SEL_SFT) ++#define RK3308_ADC_CH1_IN_MIC (0x1 << RK3308_ADC_CH1_IN_SEL_SFT) ++#define RK3308_ADC_CH1_IN_NONE (0x0 << RK3308_ADC_CH1_IN_SEL_SFT) ++ ++#define RK3308_ADC_MIC_BIAS_BUF_EN (0x1 << 3) ++#define RK3308_ADC_MIC_BIAS_BUF_DIS (0x0 << 3) ++#define RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT 0 ++#define RK3308_ADC_LEVEL_RANGE_MICBIAS_MSK (0x7 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++#define RK3308_ADC_MICBIAS_VOLT_0_85 (0x7 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++#define RK3308_ADC_MICBIAS_VOLT_0_8 (0x6 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++#define RK3308_ADC_MICBIAS_VOLT_0_75 (0x5 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++#define RK3308_ADC_MICBIAS_VOLT_0_7 (0x4 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++#define RK3308_ADC_MICBIAS_VOLT_0_65 (0x3 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++#define RK3308_ADC_MICBIAS_VOLT_0_6 (0x2 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++#define RK3308_ADC_MICBIAS_VOLT_0_55 (0x1 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++#define RK3308_ADC_MICBIAS_VOLT_0_5 (0x0 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++ ++/* RK3308_ADC_ANA_CON08 - REG: 0x0360 */ ++#define RK3308_ADC_MICBIAS_CURRENT_MSK (0x1 << 4) ++#define RK3308_ADC_MICBIAS_CURRENT_EN (0x1 << 4) ++#define RK3308_ADC_MICBIAS_CURRENT_DIS (0x0 << 4) ++ ++/* RK3308_ADC_ANA_CON10 - REG: 0x0368 */ ++#define RK3308_ADC_REF_EN (0x1 << 7) ++#define RK3308_ADC_REF_DIS (0x0 << 7) ++#define RK3308_ADC_CURRENT_CHARGE_SFT 0 ++#define RK3308_ADC_CURRENT_CHARGE_MSK (0x7f << RK3308_ADC_CURRENT_CHARGE_SFT) ++#define RK3308_ADC_DONT_SEL_ALL (0x7f << RK3308_ADC_CURRENT_CHARGE_SFT) ++/* ++ * 0: Choose the current I ++ * 1: Don't choose the current I ++ */ ++#define RK3308_ADC_SEL_I_1(x) ((x & 0x1) << 6) ++#define RK3308_ADC_SEL_I_2(x) ((x & 0x1) << 5) ++#define RK3308_ADC_SEL_I_4(x) ((x & 0x1) << 4) ++#define RK3308_ADC_SEL_I_8(x) ((x & 0x1) << 3) ++#define RK3308_ADC_SEL_I_16(x) ((x & 0x1) << 2) ++#define RK3308_ADC_SEL_I_32(x) ((x & 0x1) << 1) ++#define RK3308_ADC_SEL_I_64(x) ((x & 0x1) << 0) ++ ++/* RK3308_ADC_ANA_CON11 - REG: 0x036c */ ++#define RK3308_ADC_ALCR_CON_GAIN_PGAR_MSK (0x1 << 1) ++#define RK3308_ADC_ALCR_CON_GAIN_PGAR_EN (0x1 << 1) ++#define RK3308_ADC_ALCR_CON_GAIN_PGAR_DIS (0x0 << 1) ++#define RK3308_ADC_ALCL_CON_GAIN_PGAL_MSK (0x1 << 0) ++#define RK3308_ADC_ALCL_CON_GAIN_PGAL_EN (0x1 << 0) ++#define RK3308_ADC_ALCL_CON_GAIN_PGAL_DIS (0x0 << 0) ++ ++/* RK3308_DAC_ANA_CON00 - REG: 0x0440 */ ++#define RK3308_DAC_HEADPHONE_DET_EN (0x1 << 1) ++#define RK3308_DAC_HEADPHONE_DET_DIS (0x0 << 1) ++#define RK3308_DAC_CURRENT_MSK (0x1 << 0) ++#define RK3308_DAC_CURRENT_EN (0x1 << 0) ++#define RK3308_DAC_CURRENT_DIS (0x0 << 0) ++ ++/* RK3308_DAC_ANA_CON01 - REG: 0x0444 */ ++#define RK3308_DAC_BUF_REF_R_MSK (0x1 << 6) ++#define RK3308_DAC_BUF_REF_R_EN (0x1 << 6) ++#define RK3308_DAC_BUF_REF_R_DIS (0x0 << 6) ++#define RK3308_DAC_POP_SOUND_R_SFT 4 ++#define RK3308_DAC_POP_SOUND_R_MSK (0x3 << RK3308_DAC_POP_SOUND_R_SFT) ++#define RK3308_DAC_POP_SOUND_R_WORK (0x2 << RK3308_DAC_POP_SOUND_R_SFT) ++#define RK3308_DAC_POP_SOUND_R_INIT (0x1 << RK3308_DAC_POP_SOUND_R_SFT) ++#define RK3308_DAC_BUF_REF_L_MSK (0x1 << 2) ++#define RK3308_DAC_BUF_REF_L_EN (0x1 << 2) ++#define RK3308_DAC_BUF_REF_L_DIS (0x0 << 2) ++#define RK3308_DAC_POP_SOUND_L_SFT 0 ++#define RK3308_DAC_POP_SOUND_L_MSK (0x3 << RK3308_DAC_POP_SOUND_L_SFT) ++#define RK3308_DAC_POP_SOUND_L_WORK (0x2 << RK3308_DAC_POP_SOUND_L_SFT) ++#define RK3308_DAC_POP_SOUND_L_INIT (0x1 << RK3308_DAC_POP_SOUND_L_SFT) ++ ++/* RK3308_DAC_ANA_CON02 - REG: 0x0448 */ ++#define RK3308_DAC_R_DAC_WORK (0x1 << 7) ++#define RK3308_DAC_R_DAC_INIT (0x0 << 7) ++#define RK3308_DAC_R_DAC_EN (0x1 << 6) ++#define RK3308_DAC_R_DAC_DIS (0x0 << 6) ++#define RK3308_DAC_R_CLK_EN (0x1 << 5) ++#define RK3308_DAC_R_CLK_DIS (0x0 << 5) ++#define RK3308_DAC_R_REF_EN (0x1 << 4) ++#define RK3308_DAC_R_REF_DIS (0x0 << 4) ++#define RK3308_DAC_L_DAC_WORK (0x1 << 3) ++#define RK3308_DAC_L_DAC_INIT (0x0 << 3) ++#define RK3308_DAC_L_DAC_EN (0x1 << 2) ++#define RK3308_DAC_L_DAC_DIS (0x0 << 2) ++#define RK3308_DAC_L_CLK_EN (0x1 << 1) ++#define RK3308_DAC_L_CLK_DIS (0x0 << 1) ++#define RK3308_DAC_L_REF_EN (0x1 << 0) ++#define RK3308_DAC_L_REF_DIS (0x0 << 0) ++ ++/* RK3308_DAC_ANA_CON03 - REG: 0x044c */ ++#define RK3308_DAC_R_HPOUT_WORK (0x1 << 6) ++#define RK3308_DAC_R_HPOUT_INIT (0x0 << 6) ++#define RK3308_DAC_R_HPOUT_EN (0x1 << 5) ++#define RK3308_DAC_R_HPOUT_DIS (0x0 << 5) ++#define RK3308_DAC_R_HPOUT_UNMUTE (0x1 << 4) ++#define RK3308_DAC_R_HPOUT_MUTE (0x0 << 4) ++#define RK3308_DAC_L_HPOUT_WORK (0x1 << 2) ++#define RK3308_DAC_L_HPOUT_INIT (0x0 << 2) ++#define RK3308_DAC_L_HPOUT_EN (0x1 << 1) ++#define RK3308_DAC_L_HPOUT_DIS (0x0 << 1) ++#define RK3308_DAC_L_HPOUT_UNMUTE (0x1 << 0) ++#define RK3308_DAC_L_HPOUT_MUTE (0x0 << 0) ++ ++/* RK3308_DAC_ANA_CON04 - REG: 0x0450 */ ++#define RK3308_DAC_R_GAIN_SFT 6 ++#define RK3308_DAC_R_GAIN_MSK (0x3 << RK3308_DAC_R_GAIN_SFT) ++#define RK3308_DAC_R_GAIN_0DB (0x3 << RK3308_DAC_R_GAIN_SFT) ++#define RK3308_DAC_R_GAIN_PDB_1_5 (0x2 << RK3308_DAC_R_GAIN_SFT) ++#define RK3308_DAC_R_GAIN_PDB_3 (0x1 << RK3308_DAC_R_GAIN_SFT) ++#define RK3308_DAC_R_GAIN_PDB_6 (0x0 << RK3308_DAC_R_GAIN_SFT) ++#define RK3308_DAC_R_LINEOUT_UNMUTE (0x1 << 5) ++#define RK3308_DAC_R_LINEOUT_MUTE (0x0 << 5) ++#define RK3308_DAC_R_LINEOUT_EN (0x1 << 4) ++#define RK3308_DAC_R_LINEOUT_DIS (0x0 << 4) ++#define RK3308_DAC_L_GAIN_SFT 2 ++#define RK3308_DAC_L_GAIN_MSK (0x3 << RK3308_DAC_L_GAIN_SFT) ++#define RK3308_DAC_L_GAIN_0DB (0x3 << RK3308_DAC_L_GAIN_SFT) ++#define RK3308_DAC_L_GAIN_PDB_1_5 (0x2 << RK3308_DAC_L_GAIN_SFT) ++#define RK3308_DAC_L_GAIN_PDB_3 (0x1 << RK3308_DAC_L_GAIN_SFT) ++#define RK3308_DAC_L_GAIN_PDB_6 (0x0 << RK3308_DAC_L_GAIN_SFT) ++#define RK3308_DAC_L_LINEOUT_UNMUTE (0x1 << 1) ++#define RK3308_DAC_L_LINEOUT_MUTE (0x0 << 1) ++#define RK3308_DAC_L_LINEOUT_EN (0x1 << 0) ++#define RK3308_DAC_L_LINEOUT_DIS (0x0 << 0) ++ ++/* RK3308_DAC_ANA_CON05 - REG: 0x0454, step is 1.5db */ ++#define RK3308_DAC_L_HPOUT_GAIN_SFT 0 ++#define RK3308_DAC_L_HPOUT_GAIN_MSK (0x1f << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_PDB_6 (0x1e << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_PDB_4_5 (0x1d << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_PDB_3 (0x1c << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_PDB_1_5 (0x1b << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_0DB (0x1a << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_1_5 (0x19 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_3 (0x18 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_4_5 (0x17 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_6 (0x16 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_7_5 (0x15 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_9 (0x14 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_10_5 (0x13 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_12 (0x12 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_13_5 (0x11 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_15 (0x10 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_16_5 (0x0f << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_18 (0x0e << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_19_5 (0x0d << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_21 (0x0c << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_22_5 (0x0b << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_24 (0x0a << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_25_5 (0x09 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_27 (0x08 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_28_5 (0x07 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_30 (0x06 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_31_5 (0x05 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_33 (0x04 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_34_5 (0x03 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_36 (0x02 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_37_5 (0x01 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_39 (0x00 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++ ++/* RK3308_DAC_ANA_CON06 - REG: 0x0458, step is 1.5db */ ++#define RK3308_DAC_R_HPOUT_GAIN_SFT 0 ++#define RK3308_DAC_R_HPOUT_GAIN_MSK (0x1f << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_PDB_6 (0x1e << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_PDB_4_5 (0x1d << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_PDB_3 (0x1c << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_PDB_1_5 (0x1b << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_0DB (0x1a << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_1_5 (0x19 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_3 (0x18 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_4_5 (0x17 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_6 (0x16 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_7_5 (0x15 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_9 (0x14 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_10_5 (0x13 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_12 (0x12 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_13_5 (0x11 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_15 (0x10 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_16_5 (0x0f << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_18 (0x0e << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_19_5 (0x0d << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_21 (0x0c << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_22_5 (0x0b << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_24 (0x0a << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_25_5 (0x09 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_27 (0x08 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_28_5 (0x07 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_30 (0x06 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_31_5 (0x05 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_33 (0x04 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_34_5 (0x03 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_36 (0x02 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_37_5 (0x01 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_39 (0x00 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++ ++/* RK3308_DAC_ANA_CON12 - REG: 0x0470 */ ++#define RK3308_DAC_R_HPMIX_SEL_SFT 6 ++#define RK3308_DAC_R_HPMIX_SEL_MSK (0x3 << RK3308_DAC_R_HPMIX_SEL_SFT) ++#define RK3308_DAC_R_HPMIX_LINEIN_I2S (0x3 << RK3308_DAC_R_HPMIX_SEL_SFT) ++#define RK3308_DAC_R_HPMIX_LINEIN (0x2 << RK3308_DAC_R_HPMIX_SEL_SFT) ++#define RK3308_DAC_R_HPMIX_I2S (0x1 << RK3308_DAC_R_HPMIX_SEL_SFT) ++#define RK3308_DAC_R_HPMIX_NONE (0x0 << RK3308_DAC_R_HPMIX_SEL_SFT) ++#define RK3308_DAC_R_HPMIX_GAIN_SFT 4 ++#define RK3308_DAC_R_HPMIX_GAIN_MSK (0x3 << RK3308_DAC_R_HPMIX_GAIN_SFT) ++#define RK3308_DAC_R_HPMIX_GAIN_0DB (0x2 << RK3308_DAC_R_HPMIX_GAIN_SFT) ++#define RK3308_DAC_R_HPMIX_GAIN_NDB_6 (0x1 << RK3308_DAC_R_HPMIX_GAIN_SFT) ++#define RK3308_DAC_L_HPMIX_SEL_SFT 2 ++#define RK3308_DAC_L_HPMIX_SEL_MSK (0x3 << RK3308_DAC_L_HPMIX_SEL_SFT) ++#define RK3308_DAC_L_HPMIX_LINEIN_I2S (0x3 << RK3308_DAC_L_HPMIX_SEL_SFT) ++#define RK3308_DAC_L_HPMIX_LINEIN (0x2 << RK3308_DAC_L_HPMIX_SEL_SFT) ++#define RK3308_DAC_L_HPMIX_I2S (0x1 << RK3308_DAC_L_HPMIX_SEL_SFT) ++#define RK3308_DAC_L_HPMIX_NONE (0x0 << RK3308_DAC_L_HPMIX_SEL_SFT) ++#define RK3308_DAC_L_HPMIX_GAIN_SFT 0 ++#define RK3308_DAC_L_HPMIX_GAIN_MSK (0x3 << RK3308_DAC_L_HPMIX_GAIN_SFT) ++#define RK3308_DAC_L_HPMIX_GAIN_0DB (0x2 << RK3308_DAC_L_HPMIX_GAIN_SFT) ++#define RK3308_DAC_L_HPMIX_GAIN_NDB_6 (0x1 << RK3308_DAC_L_HPMIX_GAIN_SFT) ++ ++/* RK3308_DAC_ANA_CON13 - REG: 0x0474 */ ++#define RK3308_DAC_R_HPMIX_UNMUTE (0x1 << 6) ++#define RK3308_DAC_R_HPMIX_MUTE (0x0 << 6) ++#define RK3308_DAC_R_HPMIX_WORK (0x1 << 5) ++#define RK3308_DAC_R_HPMIX_INIT (0x0 << 5) ++#define RK3308_DAC_R_HPMIX_EN (0x1 << 4) ++#define RK3308_DAC_R_HPMIX_DIS (0x0 << 4) ++#define RK3308_DAC_L_HPMIX_UNMUTE (0x1 << 2) ++#define RK3308_DAC_L_HPMIX_MUTE (0x0 << 2) ++#define RK3308_DAC_L_HPMIX_WORK (0x1 << 1) ++#define RK3308_DAC_L_HPMIX_INIT (0x0 << 1) ++#define RK3308_DAC_L_HPMIX_EN (0x1 << 0) ++#define RK3308_DAC_L_HPMIX_DIS (0x0 << 0) ++ ++#define RK3308_HIFI 0x0 ++ ++#endif /* __RK3308_CODEC_H__ */ +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0019-Sync-rk3308_codec-to-BSP-tree.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0019-Sync-rk3308_codec-to-BSP-tree.patch new file mode 100644 index 000000000000..8c83b14e0c8c --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0019-Sync-rk3308_codec-to-BSP-tree.patch @@ -0,0 +1,6738 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ashthespy +Date: Mon, 3 Feb 2020 17:13:59 +0100 +Subject: Sync `rk3308_codec` to BSP tree + +--- + Documentation/devicetree/bindings/sound/rockchip,rk3308-codec.txt | 78 + + sound/soc/codecs/rk3308_codec.c | 5687 ++++++++-- + sound/soc/codecs/rk3308_codec.h | 217 +- + sound/soc/codecs/rk3308_codec_provider.h | 28 + + 4 files changed, 4894 insertions(+), 1116 deletions(-) + +diff --git a/Documentation/devicetree/bindings/sound/rockchip,rk3308-codec.txt b/Documentation/devicetree/bindings/sound/rockchip,rk3308-codec.txt +new file mode 100644 +index 000000000000..e20bbd73e37e +--- /dev/null ++++ b/Documentation/devicetree/bindings/sound/rockchip,rk3308-codec.txt +@@ -0,0 +1,78 @@ ++* Rockchip RK3308 Internal Codec ++ ++Required properties: ++ ++- compatible: "rockchip,rk3308-codec" ++- reg: The physical base address of the controller and length of memory ++ mapped region. ++- rockchip,grf: The phandle of the syscon node for GRF register. ++- clocks: A list of phandle + clock-specifer pairs, one for each entry in ++ clock-names. ++- clock-names: It should be "acodec". ++- resets : Must contain an entry for each entry in reset-names. ++- reset-names : Must include the following entries: "acodec-reset". ++ ++Optional properties: ++- rockchip,enable-all-adcs: This is a boolean type property, that shows whether ++ force enable all of ADCs. The following shows the relationship between grps ++ and ADC: ++ * grp 0 -- select ADC1 / ADC2 ++ * grp 1 -- select ADC3 / ADC4 ++ * grp 2 -- select ADC5 / ADC6 ++ * grp 3 -- select ADC7 / ADC8 ++ If the property is not used, the enabled ADC groups refer to needed channels ++ via configure hw_params. ++ ++- rockchip,adc-grps-route: This is a variable length array, that shows the ++ mapping route of ACODEC sdo to I2S sdi. By default, they are one-to-one ++ mapping: ++ * sdi_0 <-- sdo_0 ++ * sdi_1 <-- sdo_1 ++ * sdi_2 <-- sdo_2 ++ * sdi_3 <-- sdo_3 ++ If you would like to change the route mapping like this: ++ * sdi_0 <-- sdo_3 ++ * sdi_1 <-- sdo_0 ++ * sdi_2 <-- sdo_2 ++ * sdi_3 <-- sdo_1 ++ You need to add the property on dts: ++ - rockchip,adc-grps-route = <3 0 2 1>; ++ ++- rockchip,delay-loopback-handle-ms: This property points out that the delay for ++ handling ADC after enable PAs during loopback. ++- rockchip,delay-start-play-ms: This property points out the delay ms of start ++ playback according to different amplifier performance. ++- rockchip,en-always-grps: This property will keep the needed ADCs enabled ++ always after enabling once. ++- rockchip,loopback-grp: It points out the ADC group which is the loopback used. ++- rockchip,no-deep-low-power: The codec will not enter deep low power mode ++ during suspend. ++- rockchip,no-hp-det: If there is no headphone on boards, we don't need to ++ enable headphone detection. ++- rockchip,micbias1: Using internal micbias1 supply which are from codec. ++- rockchip,micbias2: Using internal micbias2 supply which are from codec. ++- rockchip,hp-jack-reversed;: To detect headphone via the reversed jack. ++- hp-ctl-gpios: The gpio of head phone controller. ++- pa-drv-gpios: The gpio of poweramplifier controller ++- rockchip,delay-pa-drv-ms: This property points out that the delay for ++ power on amplifier ++- spk-ctl-gpios: The gpio of speak controller. ++- micbias-en-gpios: The GPIO to enable external micbias. ++- vmicbias-supply: The phandle to the regulator to handle external micbias. ++ ++Example for rk3308 internal codec: ++ ++acodec: acodec@ff560000 { ++ compatible = "rockchip,rk3308-codec"; ++ reg = <0x0 0xff560000 0x0 0x10000>; ++ rockchip,grf = <&grf>; ++ clocks = <&cru PCLK_ACODEC>; ++ clock-names = "acodec"; ++ resets = <&cru SRST_ACODEC_P>; ++ reset-names = "acodec-reset"; ++ rockchip,loopback-grp = <0>; ++ hp-ctl-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; ++ pa-drv-gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_HIGH>; ++ spk-ctl-gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++}; +diff --git a/sound/soc/codecs/rk3308_codec.c b/sound/soc/codecs/rk3308_codec.c +index 106f09738dd0..815e22fc346c 100644 +--- a/sound/soc/codecs/rk3308_codec.c ++++ b/sound/soc/codecs/rk3308_codec.c +@@ -29,1420 +29,4699 @@ + #include + #include + #include ++#include + #include + #include + #include + #include + #include + #include ++#include + #include + #include ++#include + #include + #include + + #include "rk3308_codec.h" ++#include "rk3308_codec_provider.h" ++ ++#if defined(CONFIG_DEBUG_FS) ++#include ++#include ++#include ++#endif ++ ++#define CODEC_DRV_NAME "rk3308-acodec" ++ ++#define ADC_GRP_SKIP_MAGIC 0x1001 ++#define ADC_LR_GROUP_MAX 4 ++#define ADC_STABLE_MS 200 ++#define DEBUG_POP_ALWAYS 0 ++#define HPDET_POLL_MS 2000 ++#define NOT_USED 255 ++#define LOOPBACK_HANDLE_MS 100 ++#define PA_DRV_MS 5 ++ ++#define GRF_SOC_CON1 0x304 ++#define GRF_CHIP_ID 0x800 ++#define GRF_I2S2_8CH_SDI_SFT 0 ++#define GRF_I2S3_4CH_SDI_SFT 8 ++#define GRF_I2S1_2CH_SDI_SFT 12 ++ ++#define GRF_I2S2_8CH_SDI_R_MSK(i, v) ((v >> (i * 2 + GRF_I2S2_8CH_SDI_SFT)) & 0x3) ++#define GRF_I2S2_8CH_SDI_W_MSK(i) (0x3 << (i * 2 + GRF_I2S2_8CH_SDI_SFT + 16)) ++#define GRF_I2S2_8CH_SDI(i, v) (((v & 0x3) << (i * 2 + GRF_I2S2_8CH_SDI_SFT)) |\ ++ GRF_I2S2_8CH_SDI_W_MSK(i)) ++ ++#define GRF_I2S3_4CH_SDI_W_MSK(i) (0x3 << (i * 2 + GRF_I2S3_4CH_SDI_SFT + 16)) ++#define GRF_I2S3_4CH_SDI(i, v) (((v & 0x3) << (i * 2 + GRF_I2S3_4CH_SDI_SFT)) |\ ++ GRF_I2S3_4CH_SDI_W_MSK(i)) ++ ++#define GRF_I2S1_2CH_SDI_W_MSK (0x3 << (GRF_I2S1_2CH_SDI_SFT + 16)) ++#define GRF_I2S1_2CH_SDI(v) (((v & 0x3) << GRF_I2S1_2CH_SDI_SFT) |\ ++ GRF_I2S1_2CH_SDI_W_MSK) ++ ++#define DETECT_GRF_ACODEC_HPDET_COUNTER 0x0030 ++#define DETECT_GRF_ACODEC_HPDET_CON 0x0034 ++#define DETECT_GRF_ACODEC_HPDET_STATUS 0x0038 ++#define DETECT_GRF_ACODEC_HPDET_STATUS_CLR 0x003c ++ ++/* 200ms based on pclk is 100MHz */ ++#define DEFAULT_HPDET_COUNT 20000000 ++#define HPDET_NEG_IRQ_SFT 1 ++#define HPDET_POS_IRQ_SFT 0 ++#define HPDET_BOTH_NEG_POS ((1 << HPDET_NEG_IRQ_SFT) |\ ++ (1 << HPDET_POS_IRQ_SFT)) ++ ++#define ACODEC_VERSION_A 0xa ++#define ACODEC_VERSION_B 0xb ++ ++enum { ++ ACODEC_TO_I2S2_8CH = 0, ++ ACODEC_TO_I2S3_4CH, ++ ACODEC_TO_I2S1_2CH, ++}; ++ ++enum { ++ ADC_GRP0_MICIN = 0, ++ ADC_GRP0_LINEIN ++}; ++ ++enum { ++ ADC_TYPE_NORMAL = 0, ++ ADC_TYPE_LOOPBACK, ++ ADC_TYPE_DBG, ++ ADC_TYPE_ALL, ++}; ++ ++enum { ++ DAC_LINEOUT = 0, ++ DAC_HPOUT = 1, ++ DAC_LINEOUT_HPOUT = 11, ++}; ++ ++enum { ++ EXT_MICBIAS_NONE = 0, ++ EXT_MICBIAS_FUNC1, /* enable external micbias via GPIO */ ++ EXT_MICBIAS_FUNC2, /* enable external micbias via regulator */ ++}; ++ ++enum { ++ PATH_IDLE = 0, ++ PATH_BUSY, ++}; ++ ++enum { ++ PM_NORMAL = 0, ++ PM_LLP_DOWN, /* light low power down */ ++ PM_LLP_UP, ++ PM_DLP_DOWN, /* deep low power down */ ++ PM_DLP_UP, ++ PM_DLP_DOWN2, ++ PM_DLP_UP2, ++}; + + struct rk3308_codec_priv { + const struct device *plat_dev; + struct device dev; + struct reset_control *reset; + struct regmap *regmap; ++ struct regmap *grf; ++ struct regmap *detect_grf; + struct clk *pclk; ++ struct clk *mclk_rx; ++ struct clk *mclk_tx; ++ struct gpio_desc *micbias_en_gpio; ++ struct gpio_desc *hp_ctl_gpio; + struct gpio_desc *spk_ctl_gpio; +- int adc_ch; /* To select ADCs for channel */ +- int adc_ch0_using_linein; ++ struct gpio_desc *pa_drv_gpio; ++ struct snd_soc_codec *codec; ++ struct snd_soc_jack *hpdet_jack; ++ struct regulator *vcc_micbias; ++ u32 codec_ver; ++ ++ /* ++ * To select ADCs for groups: ++ * ++ * grp 0 -- select ADC1 / ADC2 ++ * grp 1 -- select ADC3 / ADC4 ++ * grp 2 -- select ADC5 / ADC6 ++ * grp 3 -- select ADC7 / ADC8 ++ */ ++ u32 used_adc_grps; ++ /* The ADC group which is used for loop back */ ++ u32 loopback_grp; ++ u32 cur_dbg_grp; ++ u32 en_always_grps[ADC_LR_GROUP_MAX]; ++ u32 en_always_grps_num; ++ u32 skip_grps[ADC_LR_GROUP_MAX]; ++ u32 i2s_sdis[ADC_LR_GROUP_MAX]; ++ u32 to_i2s_grps; ++ u32 delay_loopback_handle_ms; ++ u32 delay_start_play_ms; ++ u32 delay_pa_drv_ms; ++ u32 micbias_num; ++ u32 micbias_volt; ++ int which_i2s; ++ int irq; ++ int adc_grp0_using_linein; ++ int adc_zerocross; ++ /* 0: line out, 1: hp out, 11: lineout and hpout */ ++ int dac_output; ++ int dac_path_state; ++ ++ int ext_micbias; ++ int pm_state; ++ ++ /* AGC L/R Off/on */ ++ unsigned int agc_l[ADC_LR_GROUP_MAX]; ++ unsigned int agc_r[ADC_LR_GROUP_MAX]; ++ ++ /* AGC L/R Approximate Sample Rate */ ++ unsigned int agc_asr_l[ADC_LR_GROUP_MAX]; ++ unsigned int agc_asr_r[ADC_LR_GROUP_MAX]; ++ ++ /* ADC MIC Mute/Work */ ++ unsigned int mic_mute_l[ADC_LR_GROUP_MAX]; ++ unsigned int mic_mute_r[ADC_LR_GROUP_MAX]; ++ ++ /* For the high pass filter */ ++ unsigned int hpf_cutoff[ADC_LR_GROUP_MAX]; ++ ++ /* Only hpout do fade-in and fade-out */ ++ unsigned int hpout_l_dgain; ++ unsigned int hpout_r_dgain; ++ ++ bool adc_grps_endisable[ADC_LR_GROUP_MAX]; ++ bool dac_endisable; ++ bool enable_all_adcs; ++ bool enable_micbias; ++ bool micbias1; ++ bool micbias2; ++ bool hp_jack_reversed; ++ bool hp_plugged; ++ bool loopback_dacs_enabled; ++ bool no_deep_low_power; ++ bool no_hp_det; ++ struct delayed_work hpdet_work; ++ struct delayed_work loopback_work; ++ ++#if defined(CONFIG_DEBUG_FS) ++ struct dentry *dbg_codec; ++#endif + }; + +-static const DECLARE_TLV_DB_SCALE(rk3308_codec_alc_agc_ch_gain_tlv, ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_alc_agc_grp_gain_tlv, + -1800, 150, 2850); +-static const DECLARE_TLV_DB_SCALE(rk3308_codec_alc_agc_ch_max_gain_tlv, ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_alc_agc_grp_max_gain_tlv, + -1350, 600, 2850); +-static const DECLARE_TLV_DB_SCALE(rk3308_codec_alc_agc_ch_min_gain_tlv, ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_alc_agc_grp_min_gain_tlv, + -1800, 600, 2400); +-static const DECLARE_TLV_DB_SCALE(rk3308_codec_adc_mic_gain_tlv, +- 0, 600, 3000); + static const DECLARE_TLV_DB_SCALE(rk3308_codec_adc_alc_gain_tlv, + -1800, 150, 2850); +-static const DECLARE_TLV_DB_SCALE(rk3308_codec_dac_gain_tlv, +- 0, 150, 600); ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_dac_lineout_gain_tlv, ++ -600, 150, 0); + static const DECLARE_TLV_DB_SCALE(rk3308_codec_dac_hpout_gain_tlv, + -3900, 150, 600); + static const DECLARE_TLV_DB_SCALE(rk3308_codec_dac_hpmix_gain_tlv, + -600, 600, 0); + ++static const DECLARE_TLV_DB_RANGE(rk3308_codec_adc_mic_gain_tlv_a, ++ 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), ++ 3, 3, TLV_DB_SCALE_ITEM(2000, 0, 0), ++); ++ ++static const DECLARE_TLV_DB_RANGE(rk3308_codec_adc_mic_gain_tlv_b, ++ 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), ++ 1, 1, TLV_DB_SCALE_ITEM(660, 0, 0), ++ 2, 2, TLV_DB_SCALE_ITEM(1300, 0, 0), ++ 3, 3, TLV_DB_SCALE_ITEM(2000, 0, 0), ++); ++ ++static bool handle_loopback(struct rk3308_codec_priv *rk3308); ++ ++static int check_micbias(int micbias); ++ ++static int rk3308_codec_micbias_enable(struct rk3308_codec_priv *rk3308, ++ int micbias); ++static int rk3308_codec_micbias_disable(struct rk3308_codec_priv *rk3308); ++ ++static int rk3308_codec_hpout_l_get_tlv(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_hpout_l_put_tlv(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_hpout_r_get_tlv(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_hpout_r_put_tlv(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_hpf_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_hpf_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_agc_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_agc_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_agc_asr_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_agc_asr_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_mic_mute_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_mic_mute_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_mic_gain_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_mic_gain_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_micbias_volts_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_micbias_volts_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_main_micbias_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_main_micbias_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++ ++static const char *offon_text[2] = { ++ [0] = "Off", ++ [1] = "On", ++}; ++ ++static const char *mute_text[2] = { ++ [0] = "Work", ++ [1] = "Mute", ++}; ++ ++/* ADC MICBIAS Volt */ ++#define MICBIAS_VOLT_NUM 8 ++ ++#define MICBIAS_VREFx0_5 0 ++#define MICBIAS_VREFx0_55 1 ++#define MICBIAS_VREFx0_6 2 ++#define MICBIAS_VREFx0_65 3 ++#define MICBIAS_VREFx0_7 4 ++#define MICBIAS_VREFx0_75 5 ++#define MICBIAS_VREFx0_8 6 ++#define MICBIAS_VREFx0_85 7 ++ ++static const char *micbias_volts_enum_array[MICBIAS_VOLT_NUM] = { ++ [MICBIAS_VREFx0_5] = "VREFx0_5", ++ [MICBIAS_VREFx0_55] = "VREFx0_55", ++ [MICBIAS_VREFx0_6] = "VREFx0_6", ++ [MICBIAS_VREFx0_65] = "VREFx0_65", ++ [MICBIAS_VREFx0_7] = "VREFx0_7", ++ [MICBIAS_VREFx0_75] = "VREFx0_75", ++ [MICBIAS_VREFx0_8] = "VREFx0_8", ++ [MICBIAS_VREFx0_85] = "VREFx0_85", ++}; ++ ++static const struct soc_enum rk3308_micbias_volts_enum_array[] = { ++ SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(micbias_volts_enum_array), micbias_volts_enum_array), ++}; ++ ++/* ADC MICBIAS1 and MICBIAS2 Main Switch */ ++static const struct soc_enum rk3308_main_micbias_enum_array[] = { ++ SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(offon_text), offon_text), ++}; ++ ++static const struct soc_enum rk3308_hpf_enum_array[] = { ++ SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(1, 0, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(2, 0, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(3, 0, ARRAY_SIZE(offon_text), offon_text), ++}; ++ ++/* ALC AGC Switch */ ++static const struct soc_enum rk3308_agc_enum_array[] = { ++ SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(0, 1, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(1, 0, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(1, 1, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(2, 0, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(2, 1, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(3, 0, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(3, 1, ARRAY_SIZE(offon_text), offon_text), ++}; ++ ++/* ADC MIC Mute/Work Switch */ ++static const struct soc_enum rk3308_mic_mute_enum_array[] = { ++ SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(mute_text), mute_text), ++ SOC_ENUM_SINGLE(0, 1, ARRAY_SIZE(mute_text), mute_text), ++ SOC_ENUM_SINGLE(1, 0, ARRAY_SIZE(mute_text), mute_text), ++ SOC_ENUM_SINGLE(1, 1, ARRAY_SIZE(mute_text), mute_text), ++ SOC_ENUM_SINGLE(2, 0, ARRAY_SIZE(mute_text), mute_text), ++ SOC_ENUM_SINGLE(2, 1, ARRAY_SIZE(mute_text), mute_text), ++ SOC_ENUM_SINGLE(3, 0, ARRAY_SIZE(mute_text), mute_text), ++ SOC_ENUM_SINGLE(3, 1, ARRAY_SIZE(mute_text), mute_text), ++}; ++ ++/* ALC AGC Approximate Sample Rate */ ++#define AGC_ASR_NUM 8 ++ ++#define AGC_ASR_96KHZ 0 ++#define AGC_ASR_48KHZ 1 ++#define AGC_ASR_44_1KHZ 2 ++#define AGC_ASR_32KHZ 3 ++#define AGC_ASR_24KHZ 4 ++#define AGC_ASR_16KHZ 5 ++#define AGC_ASR_12KHZ 6 ++#define AGC_ASR_8KHZ 7 ++ ++static const char *agc_asr_text[AGC_ASR_NUM] = { ++ [AGC_ASR_96KHZ] = "96KHz", ++ [AGC_ASR_48KHZ] = "48KHz", ++ [AGC_ASR_44_1KHZ] = "44.1KHz", ++ [AGC_ASR_32KHZ] = "32KHz", ++ [AGC_ASR_24KHZ] = "24KHz", ++ [AGC_ASR_16KHZ] = "16KHz", ++ [AGC_ASR_12KHZ] = "12KHz", ++ [AGC_ASR_8KHZ] = "8KHz", ++}; ++ ++static const struct soc_enum rk3308_agc_asr_enum_array[] = { ++ SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(agc_asr_text), agc_asr_text), ++ SOC_ENUM_SINGLE(0, 1, ARRAY_SIZE(agc_asr_text), agc_asr_text), ++ SOC_ENUM_SINGLE(1, 0, ARRAY_SIZE(agc_asr_text), agc_asr_text), ++ SOC_ENUM_SINGLE(1, 1, ARRAY_SIZE(agc_asr_text), agc_asr_text), ++ SOC_ENUM_SINGLE(2, 0, ARRAY_SIZE(agc_asr_text), agc_asr_text), ++ SOC_ENUM_SINGLE(2, 1, ARRAY_SIZE(agc_asr_text), agc_asr_text), ++ SOC_ENUM_SINGLE(3, 0, ARRAY_SIZE(agc_asr_text), agc_asr_text), ++ SOC_ENUM_SINGLE(3, 1, ARRAY_SIZE(agc_asr_text), agc_asr_text), ++}; ++ ++static const struct snd_kcontrol_new mic_gains_a[] = { ++ /* ADC MIC */ ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 0 Left Volume", ++ RK3308_ADC_ANA_CON01(0), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_a), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 0 Right Volume", ++ RK3308_ADC_ANA_CON01(0), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_a), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 1 Left Volume", ++ RK3308_ADC_ANA_CON01(1), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_a), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 1 Right Volume", ++ RK3308_ADC_ANA_CON01(1), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_a), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 2 Left Volume", ++ RK3308_ADC_ANA_CON01(2), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_a), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 2 Right Volume", ++ RK3308_ADC_ANA_CON01(2), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_a), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 3 Left Volume", ++ RK3308_ADC_ANA_CON01(3), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_a), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 3 Right Volume", ++ RK3308_ADC_ANA_CON01(3), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_a), ++}; ++ ++static const struct snd_kcontrol_new mic_gains_b[] = { ++ /* ADC MIC */ ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 0 Left Volume", ++ RK3308_ADC_ANA_CON01(0), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_b), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 0 Right Volume", ++ RK3308_ADC_ANA_CON01(0), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_b), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 1 Left Volume", ++ RK3308_ADC_ANA_CON01(1), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_b), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 1 Right Volume", ++ RK3308_ADC_ANA_CON01(1), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_b), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 2 Left Volume", ++ RK3308_ADC_ANA_CON01(2), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_b), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 2 Right Volume", ++ RK3308_ADC_ANA_CON01(2), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_b), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 3 Left Volume", ++ RK3308_ADC_ANA_CON01(3), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_b), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 3 Right Volume", ++ RK3308_ADC_ANA_CON01(3), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_b), ++}; ++ + static const struct snd_kcontrol_new rk3308_codec_dapm_controls[] = { +- /* ALC AGC Channel*/ +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 0 Volume", ++ /* ALC AGC Group */ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 0 Left Volume", + RK3308_ALC_L_DIG_CON03(0), ++ RK3308_AGC_PGA_GAIN_SFT, ++ RK3308_AGC_PGA_GAIN_MIN, ++ RK3308_AGC_PGA_GAIN_MAX, ++ 0, rk3308_codec_alc_agc_grp_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 0 Right Volume", + RK3308_ALC_R_DIG_CON03(0), + RK3308_AGC_PGA_GAIN_SFT, +- RK3308_AGC_PGA_GAIN_NDB_18, +- RK3308_AGC_PGA_GAIN_PDB_28_5, +- 0, rk3308_codec_alc_agc_ch_gain_tlv), +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 1 Volume", ++ RK3308_AGC_PGA_GAIN_MIN, ++ RK3308_AGC_PGA_GAIN_MAX, ++ 0, rk3308_codec_alc_agc_grp_gain_tlv), ++ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 1 Left Volume", + RK3308_ALC_L_DIG_CON03(1), ++ RK3308_AGC_PGA_GAIN_SFT, ++ RK3308_AGC_PGA_GAIN_MIN, ++ RK3308_AGC_PGA_GAIN_MAX, ++ 0, rk3308_codec_alc_agc_grp_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 1 Right Volume", + RK3308_ALC_R_DIG_CON03(1), + RK3308_AGC_PGA_GAIN_SFT, +- RK3308_AGC_PGA_GAIN_NDB_18, +- RK3308_AGC_PGA_GAIN_PDB_28_5, +- 0, rk3308_codec_alc_agc_ch_gain_tlv), +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 2 Volume", ++ RK3308_AGC_PGA_GAIN_MIN, ++ RK3308_AGC_PGA_GAIN_MAX, ++ 0, rk3308_codec_alc_agc_grp_gain_tlv), ++ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 2 Left Volume", + RK3308_ALC_L_DIG_CON03(2), ++ RK3308_AGC_PGA_GAIN_SFT, ++ RK3308_AGC_PGA_GAIN_MIN, ++ RK3308_AGC_PGA_GAIN_MAX, ++ 0, rk3308_codec_alc_agc_grp_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 2 Right Volume", + RK3308_ALC_R_DIG_CON03(2), + RK3308_AGC_PGA_GAIN_SFT, +- RK3308_AGC_PGA_GAIN_NDB_18, +- RK3308_AGC_PGA_GAIN_PDB_28_5, +- 0, rk3308_codec_alc_agc_ch_gain_tlv), +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 3 Volume", ++ RK3308_AGC_PGA_GAIN_MIN, ++ RK3308_AGC_PGA_GAIN_MAX, ++ 0, rk3308_codec_alc_agc_grp_gain_tlv), ++ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 3 Left Volume", + RK3308_ALC_L_DIG_CON03(3), ++ RK3308_AGC_PGA_GAIN_SFT, ++ RK3308_AGC_PGA_GAIN_MIN, ++ RK3308_AGC_PGA_GAIN_MAX, ++ 0, rk3308_codec_alc_agc_grp_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 3 Right Volume", + RK3308_ALC_R_DIG_CON03(3), + RK3308_AGC_PGA_GAIN_SFT, +- RK3308_AGC_PGA_GAIN_NDB_18, +- RK3308_AGC_PGA_GAIN_PDB_28_5, +- 0, rk3308_codec_alc_agc_ch_gain_tlv), ++ RK3308_AGC_PGA_GAIN_MIN, ++ RK3308_AGC_PGA_GAIN_MAX, ++ 0, rk3308_codec_alc_agc_grp_gain_tlv), + + /* ALC AGC MAX */ +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 0 Max Volume", ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 0 Left Max Volume", + RK3308_ALC_L_DIG_CON09(0), ++ RK3308_AGC_MAX_GAIN_PGA_SFT, ++ RK3308_AGC_MAX_GAIN_PGA_MIN, ++ RK3308_AGC_MAX_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_max_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 0 Right Max Volume", + RK3308_ALC_R_DIG_CON09(0), + RK3308_AGC_MAX_GAIN_PGA_SFT, +- RK3308_AGC_MAX_GAIN_PGA_NDB_13_5, +- RK3308_AGC_MAX_GAIN_PGA_PDB_28_5, +- 0, rk3308_codec_alc_agc_ch_max_gain_tlv), +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 1 Max Volume", ++ RK3308_AGC_MAX_GAIN_PGA_MIN, ++ RK3308_AGC_MAX_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_max_gain_tlv), ++ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 1 Left Max Volume", + RK3308_ALC_L_DIG_CON09(1), ++ RK3308_AGC_MAX_GAIN_PGA_SFT, ++ RK3308_AGC_MAX_GAIN_PGA_MIN, ++ RK3308_AGC_MAX_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_max_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 1 Right Max Volume", + RK3308_ALC_R_DIG_CON09(1), + RK3308_AGC_MAX_GAIN_PGA_SFT, +- RK3308_AGC_MAX_GAIN_PGA_NDB_13_5, +- RK3308_AGC_MAX_GAIN_PGA_PDB_28_5, +- 0, rk3308_codec_alc_agc_ch_max_gain_tlv), +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 2 Max Volume", ++ RK3308_AGC_MAX_GAIN_PGA_MIN, ++ RK3308_AGC_MAX_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_max_gain_tlv), ++ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 2 Left Max Volume", + RK3308_ALC_L_DIG_CON09(2), ++ RK3308_AGC_MAX_GAIN_PGA_SFT, ++ RK3308_AGC_MAX_GAIN_PGA_MIN, ++ RK3308_AGC_MAX_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_max_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 2 Right Max Volume", + RK3308_ALC_R_DIG_CON09(2), + RK3308_AGC_MAX_GAIN_PGA_SFT, +- RK3308_AGC_MAX_GAIN_PGA_NDB_13_5, +- RK3308_AGC_MAX_GAIN_PGA_PDB_28_5, +- 0, rk3308_codec_alc_agc_ch_max_gain_tlv), +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 3 Max Volume", ++ RK3308_AGC_MAX_GAIN_PGA_MIN, ++ RK3308_AGC_MAX_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_max_gain_tlv), ++ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 3 Left Max Volume", + RK3308_ALC_L_DIG_CON09(3), ++ RK3308_AGC_MAX_GAIN_PGA_SFT, ++ RK3308_AGC_MAX_GAIN_PGA_MIN, ++ RK3308_AGC_MAX_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_max_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 3 Right Max Volume", + RK3308_ALC_R_DIG_CON09(3), + RK3308_AGC_MAX_GAIN_PGA_SFT, +- RK3308_AGC_MAX_GAIN_PGA_NDB_13_5, +- RK3308_AGC_MAX_GAIN_PGA_PDB_28_5, +- 0, rk3308_codec_alc_agc_ch_max_gain_tlv), ++ RK3308_AGC_MAX_GAIN_PGA_MIN, ++ RK3308_AGC_MAX_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_max_gain_tlv), + + /* ALC AGC MIN */ +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 0 Min Volume", ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 0 Left Min Volume", + RK3308_ALC_L_DIG_CON09(0), ++ RK3308_AGC_MIN_GAIN_PGA_SFT, ++ RK3308_AGC_MIN_GAIN_PGA_MIN, ++ RK3308_AGC_MIN_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_min_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 0 Right Min Volume", + RK3308_ALC_R_DIG_CON09(0), + RK3308_AGC_MIN_GAIN_PGA_SFT, +- RK3308_AGC_MIN_GAIN_PGA_NDB_18, +- RK3308_AGC_MIN_GAIN_PGA_PDB_24, +- 0, rk3308_codec_alc_agc_ch_min_gain_tlv), +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 1 Min Volume", ++ RK3308_AGC_MIN_GAIN_PGA_MIN, ++ RK3308_AGC_MIN_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_min_gain_tlv), ++ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 1 Left Min Volume", + RK3308_ALC_L_DIG_CON09(1), ++ RK3308_AGC_MIN_GAIN_PGA_SFT, ++ RK3308_AGC_MIN_GAIN_PGA_MIN, ++ RK3308_AGC_MIN_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_min_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 1 Right Min Volume", + RK3308_ALC_R_DIG_CON09(1), + RK3308_AGC_MIN_GAIN_PGA_SFT, +- RK3308_AGC_MIN_GAIN_PGA_NDB_18, +- RK3308_AGC_MIN_GAIN_PGA_PDB_24, +- 0, rk3308_codec_alc_agc_ch_min_gain_tlv), +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 2 Min Volume", ++ RK3308_AGC_MIN_GAIN_PGA_MIN, ++ RK3308_AGC_MIN_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_min_gain_tlv), ++ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 2 Left Min Volume", + RK3308_ALC_L_DIG_CON09(2), ++ RK3308_AGC_MIN_GAIN_PGA_SFT, ++ RK3308_AGC_MIN_GAIN_PGA_MIN, ++ RK3308_AGC_MIN_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_min_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 2 Right Min Volume", + RK3308_ALC_R_DIG_CON09(2), + RK3308_AGC_MIN_GAIN_PGA_SFT, +- RK3308_AGC_MIN_GAIN_PGA_NDB_18, +- RK3308_AGC_MIN_GAIN_PGA_PDB_24, +- 0, rk3308_codec_alc_agc_ch_min_gain_tlv), +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 3 Min Volume", ++ RK3308_AGC_MIN_GAIN_PGA_MIN, ++ RK3308_AGC_MIN_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_min_gain_tlv), ++ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 3 Left Min Volume", + RK3308_ALC_L_DIG_CON09(3), ++ RK3308_AGC_MIN_GAIN_PGA_SFT, ++ RK3308_AGC_MIN_GAIN_PGA_MIN, ++ RK3308_AGC_MIN_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_min_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 3 Right Min Volume", + RK3308_ALC_R_DIG_CON09(3), + RK3308_AGC_MIN_GAIN_PGA_SFT, +- RK3308_AGC_MIN_GAIN_PGA_NDB_18, +- RK3308_AGC_MIN_GAIN_PGA_PDB_24, +- 0, rk3308_codec_alc_agc_ch_min_gain_tlv), +- +- /* ADC MIC */ +- SOC_SINGLE_RANGE_TLV("ADC MIC Channel 0 Left Volume", +- RK3308_ADC_ANA_CON01(0), +- RK3308_ADC_CH1_MIC_GAIN_SFT, +- RK3308_ADC_CH1_MIC_GAIN_0DB, +- RK3308_ADC_CH1_MIC_GAIN_30DB, +- 0, rk3308_codec_adc_mic_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC MIC Channel 0 Right Volume", +- RK3308_ADC_ANA_CON01(0), +- RK3308_ADC_CH2_MIC_GAIN_SFT, +- RK3308_ADC_CH2_MIC_GAIN_0DB, +- RK3308_ADC_CH2_MIC_GAIN_30DB, +- 0, rk3308_codec_adc_mic_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC MIC Channel 1 Left Volume", +- RK3308_ADC_ANA_CON01(1), +- RK3308_ADC_CH1_MIC_GAIN_SFT, +- RK3308_ADC_CH1_MIC_GAIN_0DB, +- RK3308_ADC_CH1_MIC_GAIN_30DB, +- 0, rk3308_codec_adc_mic_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC MIC Channel 1 Right Volume", +- RK3308_ADC_ANA_CON01(1), +- RK3308_ADC_CH2_MIC_GAIN_SFT, +- RK3308_ADC_CH2_MIC_GAIN_0DB, +- RK3308_ADC_CH2_MIC_GAIN_30DB, +- 0, rk3308_codec_adc_mic_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC MIC Channel 2 Left Volume", +- RK3308_ADC_ANA_CON01(2), +- RK3308_ADC_CH1_MIC_GAIN_SFT, +- RK3308_ADC_CH1_MIC_GAIN_0DB, +- RK3308_ADC_CH1_MIC_GAIN_30DB, +- 0, rk3308_codec_adc_mic_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC MIC Channel 2 Right Volume", +- RK3308_ADC_ANA_CON01(2), +- RK3308_ADC_CH2_MIC_GAIN_SFT, +- RK3308_ADC_CH2_MIC_GAIN_0DB, +- RK3308_ADC_CH2_MIC_GAIN_30DB, +- 0, rk3308_codec_adc_mic_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC MIC Channel 3 Left Volume", +- RK3308_ADC_ANA_CON01(3), +- RK3308_ADC_CH1_MIC_GAIN_SFT, +- RK3308_ADC_CH1_MIC_GAIN_0DB, +- RK3308_ADC_CH1_MIC_GAIN_30DB, +- 0, rk3308_codec_adc_mic_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC MIC Channel 3 Right Volume", +- RK3308_ADC_ANA_CON01(3), +- RK3308_ADC_CH2_MIC_GAIN_SFT, +- RK3308_ADC_CH2_MIC_GAIN_0DB, +- RK3308_ADC_CH2_MIC_GAIN_30DB, +- 0, rk3308_codec_adc_mic_gain_tlv), ++ RK3308_AGC_MIN_GAIN_PGA_MIN, ++ RK3308_AGC_MIN_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_min_gain_tlv), ++ ++ /* ALC AGC Switch */ ++ SOC_ENUM_EXT("ALC AGC Group 0 Left Switch", rk3308_agc_enum_array[0], ++ rk3308_codec_agc_get, rk3308_codec_agc_put), ++ SOC_ENUM_EXT("ALC AGC Group 0 Right Switch", rk3308_agc_enum_array[1], ++ rk3308_codec_agc_get, rk3308_codec_agc_put), ++ SOC_ENUM_EXT("ALC AGC Group 1 Left Switch", rk3308_agc_enum_array[2], ++ rk3308_codec_agc_get, rk3308_codec_agc_put), ++ SOC_ENUM_EXT("ALC AGC Group 1 Right Switch", rk3308_agc_enum_array[3], ++ rk3308_codec_agc_get, rk3308_codec_agc_put), ++ SOC_ENUM_EXT("ALC AGC Group 2 Left Switch", rk3308_agc_enum_array[4], ++ rk3308_codec_agc_get, rk3308_codec_agc_put), ++ SOC_ENUM_EXT("ALC AGC Group 2 Right Switch", rk3308_agc_enum_array[5], ++ rk3308_codec_agc_get, rk3308_codec_agc_put), ++ SOC_ENUM_EXT("ALC AGC Group 3 Left Switch", rk3308_agc_enum_array[6], ++ rk3308_codec_agc_get, rk3308_codec_agc_put), ++ SOC_ENUM_EXT("ALC AGC Group 3 Right Switch", rk3308_agc_enum_array[7], ++ rk3308_codec_agc_get, rk3308_codec_agc_put), ++ ++ /* ALC AGC Approximate Sample Rate */ ++ SOC_ENUM_EXT("AGC Group 0 Left Approximate Sample Rate", rk3308_agc_asr_enum_array[0], ++ rk3308_codec_agc_asr_get, rk3308_codec_agc_asr_put), ++ SOC_ENUM_EXT("AGC Group 0 Right Approximate Sample Rate", rk3308_agc_asr_enum_array[1], ++ rk3308_codec_agc_asr_get, rk3308_codec_agc_asr_put), ++ SOC_ENUM_EXT("AGC Group 1 Left Approximate Sample Rate", rk3308_agc_asr_enum_array[2], ++ rk3308_codec_agc_asr_get, rk3308_codec_agc_asr_put), ++ SOC_ENUM_EXT("AGC Group 1 Right Approximate Sample Rate", rk3308_agc_asr_enum_array[3], ++ rk3308_codec_agc_asr_get, rk3308_codec_agc_asr_put), ++ SOC_ENUM_EXT("AGC Group 2 Left Approximate Sample Rate", rk3308_agc_asr_enum_array[4], ++ rk3308_codec_agc_asr_get, rk3308_codec_agc_asr_put), ++ SOC_ENUM_EXT("AGC Group 2 Right Approximate Sample Rate", rk3308_agc_asr_enum_array[5], ++ rk3308_codec_agc_asr_get, rk3308_codec_agc_asr_put), ++ SOC_ENUM_EXT("AGC Group 3 Left Approximate Sample Rate", rk3308_agc_asr_enum_array[6], ++ rk3308_codec_agc_asr_get, rk3308_codec_agc_asr_put), ++ SOC_ENUM_EXT("AGC Group 3 Right Approximate Sample Rate", rk3308_agc_asr_enum_array[7], ++ rk3308_codec_agc_asr_get, rk3308_codec_agc_asr_put), ++ ++ /* ADC MICBIAS Voltage */ ++ SOC_ENUM_EXT("ADC MICBIAS Voltage", rk3308_micbias_volts_enum_array[0], ++ rk3308_codec_micbias_volts_get, rk3308_codec_micbias_volts_put), ++ ++ /* ADC Main MICBIAS Switch */ ++ SOC_ENUM_EXT("ADC Main MICBIAS", rk3308_main_micbias_enum_array[0], ++ rk3308_codec_main_micbias_get, rk3308_codec_main_micbias_put), ++ ++ /* ADC MICBIAS1 and MICBIAS2 Switch */ ++ SOC_SINGLE("ADC MICBIAS1", RK3308_ADC_ANA_CON07(1), ++ RK3308_ADC_MIC_BIAS_BUF_SFT, 1, 0), ++ SOC_SINGLE("ADC MICBIAS2", RK3308_ADC_ANA_CON07(2), ++ RK3308_ADC_MIC_BIAS_BUF_SFT, 1, 0), ++ ++ /* ADC MIC Mute/Work Switch */ ++ SOC_ENUM_EXT("ADC MIC Group 0 Left Switch", rk3308_mic_mute_enum_array[0], ++ rk3308_codec_mic_mute_get, rk3308_codec_mic_mute_put), ++ SOC_ENUM_EXT("ADC MIC Group 0 Right Switch", rk3308_mic_mute_enum_array[1], ++ rk3308_codec_mic_mute_get, rk3308_codec_mic_mute_put), ++ SOC_ENUM_EXT("ADC MIC Group 1 Left Switch", rk3308_mic_mute_enum_array[2], ++ rk3308_codec_mic_mute_get, rk3308_codec_mic_mute_put), ++ SOC_ENUM_EXT("ADC MIC Group 1 Right Switch", rk3308_mic_mute_enum_array[3], ++ rk3308_codec_mic_mute_get, rk3308_codec_mic_mute_put), ++ SOC_ENUM_EXT("ADC MIC Group 2 Left Switch", rk3308_mic_mute_enum_array[4], ++ rk3308_codec_mic_mute_get, rk3308_codec_mic_mute_put), ++ SOC_ENUM_EXT("ADC MIC Group 2 Right Switch", rk3308_mic_mute_enum_array[5], ++ rk3308_codec_mic_mute_get, rk3308_codec_mic_mute_put), ++ SOC_ENUM_EXT("ADC MIC Group 3 Left Switch", rk3308_mic_mute_enum_array[6], ++ rk3308_codec_mic_mute_get, rk3308_codec_mic_mute_put), ++ SOC_ENUM_EXT("ADC MIC Group 3 Right Switch", rk3308_mic_mute_enum_array[7], ++ rk3308_codec_mic_mute_get, rk3308_codec_mic_mute_put), + + /* ADC ALC */ +- SOC_SINGLE_RANGE_TLV("ADC ALC Channel 0 Left Volume", ++ SOC_SINGLE_RANGE_TLV("ADC ALC Group 0 Left Volume", + RK3308_ADC_ANA_CON03(0), + RK3308_ADC_CH1_ALC_GAIN_SFT, +- RK3308_ADC_CH1_ALC_GAIN_NDB_18, +- RK3308_ADC_CH1_ALC_GAIN_PDB_28_5, ++ RK3308_ADC_CH1_ALC_GAIN_MIN, ++ RK3308_ADC_CH1_ALC_GAIN_MAX, + 0, rk3308_codec_adc_alc_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC ALC Channel 0 Right Volume", ++ SOC_SINGLE_RANGE_TLV("ADC ALC Group 0 Right Volume", + RK3308_ADC_ANA_CON04(0), + RK3308_ADC_CH2_ALC_GAIN_SFT, +- RK3308_ADC_CH2_ALC_GAIN_NDB_18, +- RK3308_ADC_CH2_ALC_GAIN_PDB_28_5, ++ RK3308_ADC_CH2_ALC_GAIN_MIN, ++ RK3308_ADC_CH2_ALC_GAIN_MAX, + 0, rk3308_codec_adc_alc_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC ALC Channel 1 Left Volume", ++ SOC_SINGLE_RANGE_TLV("ADC ALC Group 1 Left Volume", + RK3308_ADC_ANA_CON03(1), + RK3308_ADC_CH1_ALC_GAIN_SFT, +- RK3308_ADC_CH1_ALC_GAIN_NDB_18, +- RK3308_ADC_CH1_ALC_GAIN_PDB_28_5, ++ RK3308_ADC_CH1_ALC_GAIN_MIN, ++ RK3308_ADC_CH1_ALC_GAIN_MAX, + 0, rk3308_codec_adc_alc_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC ALC Channel 1 Right Volume", ++ SOC_SINGLE_RANGE_TLV("ADC ALC Group 1 Right Volume", + RK3308_ADC_ANA_CON04(1), + RK3308_ADC_CH2_ALC_GAIN_SFT, +- RK3308_ADC_CH2_ALC_GAIN_NDB_18, +- RK3308_ADC_CH2_ALC_GAIN_PDB_28_5, ++ RK3308_ADC_CH2_ALC_GAIN_MIN, ++ RK3308_ADC_CH2_ALC_GAIN_MAX, + 0, rk3308_codec_adc_alc_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC ALC Channel 2 Left Volume", ++ SOC_SINGLE_RANGE_TLV("ADC ALC Group 2 Left Volume", + RK3308_ADC_ANA_CON03(2), + RK3308_ADC_CH1_ALC_GAIN_SFT, +- RK3308_ADC_CH1_ALC_GAIN_NDB_18, +- RK3308_ADC_CH1_ALC_GAIN_PDB_28_5, ++ RK3308_ADC_CH1_ALC_GAIN_MIN, ++ RK3308_ADC_CH1_ALC_GAIN_MAX, + 0, rk3308_codec_adc_alc_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC ALC Channel 2 Right Volume", ++ SOC_SINGLE_RANGE_TLV("ADC ALC Group 2 Right Volume", + RK3308_ADC_ANA_CON04(2), + RK3308_ADC_CH2_ALC_GAIN_SFT, +- RK3308_ADC_CH2_ALC_GAIN_NDB_18, +- RK3308_ADC_CH2_ALC_GAIN_PDB_28_5, ++ RK3308_ADC_CH2_ALC_GAIN_MIN, ++ RK3308_ADC_CH2_ALC_GAIN_MAX, + 0, rk3308_codec_adc_alc_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC ALC Channel 3 Left Volume", ++ SOC_SINGLE_RANGE_TLV("ADC ALC Group 3 Left Volume", + RK3308_ADC_ANA_CON03(3), + RK3308_ADC_CH1_ALC_GAIN_SFT, +- RK3308_ADC_CH1_ALC_GAIN_NDB_18, +- RK3308_ADC_CH1_ALC_GAIN_PDB_28_5, ++ RK3308_ADC_CH1_ALC_GAIN_MIN, ++ RK3308_ADC_CH1_ALC_GAIN_MAX, + 0, rk3308_codec_adc_alc_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC ALC Channel 3 Right Volume", ++ SOC_SINGLE_RANGE_TLV("ADC ALC Group 3 Right Volume", + RK3308_ADC_ANA_CON04(3), + RK3308_ADC_CH2_ALC_GAIN_SFT, +- RK3308_ADC_CH2_ALC_GAIN_NDB_18, +- RK3308_ADC_CH2_ALC_GAIN_PDB_28_5, ++ RK3308_ADC_CH2_ALC_GAIN_MIN, ++ RK3308_ADC_CH2_ALC_GAIN_MAX, + 0, rk3308_codec_adc_alc_gain_tlv), + +- /* DAC */ +- SOC_SINGLE_RANGE_TLV("DAC Left Volume", +- RK3308_DAC_ANA_CON04, +- RK3308_DAC_L_GAIN_SFT, +- RK3308_DAC_L_GAIN_0DB, +- RK3308_DAC_L_GAIN_PDB_6, +- 0, rk3308_codec_dac_gain_tlv), +- SOC_SINGLE_RANGE_TLV("DAC Right Volume", +- RK3308_DAC_ANA_CON04, +- RK3308_DAC_R_GAIN_SFT, +- RK3308_DAC_R_GAIN_0DB, +- RK3308_DAC_R_GAIN_PDB_6, +- 0, rk3308_codec_dac_gain_tlv), ++ /* ADC High Pass Filter */ ++ SOC_ENUM_EXT("ADC Group 0 HPF Cut-off", rk3308_hpf_enum_array[0], ++ rk3308_codec_hpf_get, rk3308_codec_hpf_put), ++ SOC_ENUM_EXT("ADC Group 1 HPF Cut-off", rk3308_hpf_enum_array[1], ++ rk3308_codec_hpf_get, rk3308_codec_hpf_put), ++ SOC_ENUM_EXT("ADC Group 2 HPF Cut-off", rk3308_hpf_enum_array[2], ++ rk3308_codec_hpf_get, rk3308_codec_hpf_put), ++ SOC_ENUM_EXT("ADC Group 3 HPF Cut-off", rk3308_hpf_enum_array[3], ++ rk3308_codec_hpf_get, rk3308_codec_hpf_put), ++ ++ /* DAC LINEOUT */ ++ SOC_SINGLE_TLV("DAC LINEOUT Left Volume", ++ RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_GAIN_SFT, ++ RK3308_DAC_L_LINEOUT_GAIN_MAX, ++ 0, rk3308_codec_dac_lineout_gain_tlv), ++ SOC_SINGLE_TLV("DAC LINEOUT Right Volume", ++ RK3308_DAC_ANA_CON04, ++ RK3308_DAC_R_LINEOUT_GAIN_SFT, ++ RK3308_DAC_R_LINEOUT_GAIN_MAX, ++ 0, rk3308_codec_dac_lineout_gain_tlv), + + /* DAC HPOUT */ +- SOC_SINGLE_RANGE_TLV("DAC HPOUT Left Volume", +- RK3308_DAC_ANA_CON05, +- RK3308_DAC_L_HPOUT_GAIN_SFT, +- RK3308_DAC_L_HPOUT_GAIN_NDB_39, +- RK3308_DAC_L_HPOUT_GAIN_PDB_6, +- 0, rk3308_codec_dac_hpout_gain_tlv), +- SOC_SINGLE_RANGE_TLV("DAC HPOUT Right Volume", +- RK3308_DAC_ANA_CON06, +- RK3308_DAC_R_HPOUT_GAIN_SFT, +- RK3308_DAC_R_HPOUT_GAIN_NDB_39, +- RK3308_DAC_R_HPOUT_GAIN_PDB_6, +- 0, rk3308_codec_dac_hpout_gain_tlv), ++ SOC_SINGLE_EXT_TLV("DAC HPOUT Left Volume", ++ RK3308_DAC_ANA_CON05, ++ RK3308_DAC_L_HPOUT_GAIN_SFT, ++ RK3308_DAC_L_HPOUT_GAIN_MAX, ++ 0, ++ rk3308_codec_hpout_l_get_tlv, ++ rk3308_codec_hpout_l_put_tlv, ++ rk3308_codec_dac_hpout_gain_tlv), ++ SOC_SINGLE_EXT_TLV("DAC HPOUT Right Volume", ++ RK3308_DAC_ANA_CON06, ++ RK3308_DAC_R_HPOUT_GAIN_SFT, ++ RK3308_DAC_R_HPOUT_GAIN_MAX, ++ 0, ++ rk3308_codec_hpout_r_get_tlv, ++ rk3308_codec_hpout_r_put_tlv, ++ rk3308_codec_dac_hpout_gain_tlv), + + /* DAC HPMIX */ + SOC_SINGLE_RANGE_TLV("DAC HPMIX Left Volume", +- RK3308_DAC_ANA_CON05, ++ RK3308_DAC_ANA_CON12, + RK3308_DAC_L_HPMIX_GAIN_SFT, +- RK3308_DAC_L_HPMIX_GAIN_NDB_6, +- RK3308_DAC_L_HPMIX_GAIN_0DB, ++ RK3308_DAC_L_HPMIX_GAIN_MIN, ++ RK3308_DAC_L_HPMIX_GAIN_MAX, + 0, rk3308_codec_dac_hpmix_gain_tlv), + SOC_SINGLE_RANGE_TLV("DAC HPMIX Right Volume", +- RK3308_DAC_ANA_CON05, ++ RK3308_DAC_ANA_CON12, + RK3308_DAC_R_HPMIX_GAIN_SFT, +- RK3308_DAC_R_HPMIX_GAIN_NDB_6, +- RK3308_DAC_R_HPMIX_GAIN_0DB, ++ RK3308_DAC_R_HPMIX_GAIN_MIN, ++ RK3308_DAC_R_HPMIX_GAIN_MAX, + 0, rk3308_codec_dac_hpmix_gain_tlv), + }; + +-static void rk3308_speaker_ctl(struct rk3308_codec_priv *rk3308, int on) ++static int rk3308_codec_agc_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) + { +- gpiod_direction_output(rk3308->spk_ctl_gpio, on); ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ ++ if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) { ++ dev_err(rk3308->plat_dev, ++ "%s: Invalid ADC grp: %d\n", __func__, e->reg); ++ return -EINVAL; ++ } ++ ++ if (e->shift_l) ++ ucontrol->value.integer.value[0] = rk3308->agc_r[e->reg]; ++ else ++ ucontrol->value.integer.value[0] = rk3308->agc_l[e->reg]; ++ ++ return 0; + } + +-static int rk3308_codec_reset(struct snd_soc_codec *codec) ++static int rk3308_codec_agc_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) + { ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); + struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ unsigned int value = ucontrol->value.integer.value[0]; ++ int grp = e->reg; + +- reset_control_assert(rk3308->reset); +- usleep_range(200, 300); /* estimated value */ +- reset_control_deassert(rk3308->reset); ++ if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) { ++ dev_err(rk3308->plat_dev, ++ "%s: Invalid ADC grp: %d\n", __func__, e->reg); ++ return -EINVAL; ++ } + +- regmap_write(rk3308->regmap, RK3308_GLB_CON, 0x00); +- usleep_range(200, 300); /* estimated value */ +- regmap_write(rk3308->regmap, RK3308_GLB_CON, +- RK3308_SYS_WORK | +- RK3308_DAC_DIG_WORK | +- RK3308_ADC_DIG_WORK); ++ if (value) { ++ /* ALC AGC On */ ++ if (e->shift_l) { ++ /* ALC AGC Right On */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON09(grp), ++ RK3308_AGC_FUNC_SEL_MSK, ++ RK3308_AGC_FUNC_SEL_EN); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON11(grp), ++ RK3308_ADC_ALCR_CON_GAIN_PGAR_MSK, ++ RK3308_ADC_ALCR_CON_GAIN_PGAR_EN); ++ ++ rk3308->agc_r[e->reg] = 1; ++ } else { ++ /* ALC AGC Left On */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON09(grp), ++ RK3308_AGC_FUNC_SEL_MSK, ++ RK3308_AGC_FUNC_SEL_EN); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON11(grp), ++ RK3308_ADC_ALCL_CON_GAIN_PGAL_MSK, ++ RK3308_ADC_ALCL_CON_GAIN_PGAL_EN); ++ ++ rk3308->agc_l[e->reg] = 1; ++ } ++ } else { ++ /* ALC AGC Off */ ++ if (e->shift_l) { ++ /* ALC AGC Right Off */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON09(grp), ++ RK3308_AGC_FUNC_SEL_MSK, ++ RK3308_AGC_FUNC_SEL_DIS); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON11(grp), ++ RK3308_ADC_ALCR_CON_GAIN_PGAR_MSK, ++ RK3308_ADC_ALCR_CON_GAIN_PGAR_DIS); ++ ++ rk3308->agc_r[e->reg] = 0; ++ } else { ++ /* ALC AGC Left Off */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON09(grp), ++ RK3308_AGC_FUNC_SEL_MSK, ++ RK3308_AGC_FUNC_SEL_DIS); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON11(grp), ++ RK3308_ADC_ALCL_CON_GAIN_PGAL_MSK, ++ RK3308_ADC_ALCL_CON_GAIN_PGAL_DIS); ++ ++ rk3308->agc_l[e->reg] = 0; ++ } ++ } + + return 0; + } + +-static int rk3308_set_bias_level(struct snd_soc_codec *codec, +- enum snd_soc_bias_level level) ++static int rk3308_codec_agc_asr_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) + { +- switch (level) { +- case SND_SOC_BIAS_ON: +- break; +- +- case SND_SOC_BIAS_PREPARE: +- break; ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ unsigned int value; ++ int grp = e->reg; + +- case SND_SOC_BIAS_STANDBY: +- case SND_SOC_BIAS_OFF: +- break; ++ if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) { ++ dev_err(rk3308->plat_dev, ++ "%s: Invalid ADC grp: %d\n", __func__, e->reg); ++ return -EINVAL; + } + +- snd_soc_codec_force_bias_level(codec, level); ++ if (e->shift_l) { ++ regmap_read(rk3308->regmap, RK3308_ALC_R_DIG_CON04(grp), &value); ++ rk3308->agc_asr_r[e->reg] = value >> RK3308_AGC_APPROX_RATE_SFT; ++ ucontrol->value.integer.value[0] = rk3308->agc_asr_r[e->reg]; ++ } else { ++ regmap_read(rk3308->regmap, RK3308_ALC_L_DIG_CON04(grp), &value); ++ rk3308->agc_asr_l[e->reg] = value >> RK3308_AGC_APPROX_RATE_SFT; ++ ucontrol->value.integer.value[0] = rk3308->agc_asr_l[e->reg]; ++ } + + return 0; + } + +-static int rk3308_set_dai_fmt(struct snd_soc_dai *codec_dai, +- unsigned int fmt) ++static int rk3308_codec_agc_asr_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = codec_dai->codec; ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); + struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); +- unsigned int adc_aif1 = 0, adc_aif2 = 0, dac_aif1 = 0, dac_aif2 = 0; +- int ch = rk3308->adc_ch; ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ unsigned int value; ++ int grp = e->reg; + +- switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { +- case SND_SOC_DAIFMT_CBS_CFS: +- adc_aif2 |= RK3308_ADC_IO_MODE_SLAVE; +- adc_aif2 |= RK3308_ADC_MODE_SLAVE; +- dac_aif2 |= RK3308_DAC_IO_MODE_SLAVE; +- dac_aif2 |= RK3308_DAC_MODE_SLAVE; +- break; +- case SND_SOC_DAIFMT_CBM_CFM: +- adc_aif2 |= RK3308_ADC_IO_MODE_MASTER; +- adc_aif2 |= RK3308_ADC_MODE_MASTER; +- dac_aif2 |= RK3308_DAC_IO_MODE_MASTER; +- dac_aif2 |= RK3308_DAC_MODE_MASTER; +- break; +- default: ++ if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) { ++ dev_err(rk3308->plat_dev, ++ "%s: Invalid ADC grp: %d\n", __func__, e->reg); + return -EINVAL; + } + +- switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { +- case SND_SOC_DAIFMT_DSP_A: +- adc_aif1 |= RK3308_ADC_I2S_MODE_PCM; +- dac_aif1 |= RK3308_DAC_I2S_MODE_PCM; +- break; +- case SND_SOC_DAIFMT_I2S: +- adc_aif1 |= RK3308_ADC_I2S_MODE_I2S; +- dac_aif1 |= RK3308_DAC_I2S_MODE_I2S; +- break; +- case SND_SOC_DAIFMT_RIGHT_J: +- adc_aif1 |= RK3308_ADC_I2S_MODE_RJ; +- dac_aif1 |= RK3308_DAC_I2S_MODE_RJ; +- break; +- case SND_SOC_DAIFMT_LEFT_J: +- adc_aif1 |= RK3308_ADC_I2S_MODE_RJ; +- dac_aif1 |= RK3308_DAC_I2S_MODE_LJ; +- break; +- default: +- return -EINVAL; ++ value = ucontrol->value.integer.value[0] << RK3308_AGC_APPROX_RATE_SFT; ++ ++ if (e->shift_l) { ++ /* ALC AGC Right Approximate Sample Rate */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON04(grp), ++ RK3308_AGC_APPROX_RATE_MSK, ++ value); ++ rk3308->agc_asr_r[e->reg] = ucontrol->value.integer.value[0]; ++ } else { ++ /* ALC AGC Left Approximate Sample Rate */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON04(grp), ++ RK3308_AGC_APPROX_RATE_MSK, ++ value); ++ rk3308->agc_asr_l[e->reg] = ucontrol->value.integer.value[0]; + } + +- switch (fmt & SND_SOC_DAIFMT_INV_MASK) { +- case SND_SOC_DAIFMT_NB_NF: +- adc_aif1 |= RK3308_ADC_I2S_LRC_POL_NORMAL; +- adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_NORMAL; +- dac_aif1 |= RK3308_DAC_I2S_LRC_POL_NORMAL; +- dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_NORMAL; +- break; +- case SND_SOC_DAIFMT_IB_IF: +- adc_aif1 |= RK3308_ADC_I2S_LRC_POL_REVERSAL; +- adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_REVERSAL; +- dac_aif1 |= RK3308_DAC_I2S_LRC_POL_REVERSAL; +- dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_REVERSAL; +- break; +- case SND_SOC_DAIFMT_IB_NF: +- adc_aif1 |= RK3308_ADC_I2S_LRC_POL_NORMAL; +- adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_REVERSAL; +- dac_aif1 |= RK3308_DAC_I2S_LRC_POL_NORMAL; +- dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_REVERSAL; +- break; +- case SND_SOC_DAIFMT_NB_IF: +- adc_aif1 |= RK3308_ADC_I2S_LRC_POL_REVERSAL; +- adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_NORMAL; +- dac_aif1 |= RK3308_DAC_I2S_LRC_POL_REVERSAL; +- dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_NORMAL; +- break; +- default: ++ return 0; ++} ++ ++static int rk3308_codec_mic_mute_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ unsigned int value; ++ int grp = e->reg; ++ ++ if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) { ++ dev_err(rk3308->plat_dev, ++ "%s: Invalid ADC grp: %d\n", __func__, e->reg); + return -EINVAL; + } + +- regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON01(ch), +- RK3308_ADC_I2S_LRC_POL_MSK | +- RK3308_ADC_I2S_MODE_MSK, +- adc_aif1); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON02(ch), +- RK3308_ADC_IO_MODE_MSK | +- RK3308_ADC_MODE_MSK | +- RK3308_ADC_I2S_BIT_CLK_POL_MSK, +- adc_aif2); +- +- regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON01, +- RK3308_DAC_I2S_LRC_POL_MSK | +- RK3308_DAC_I2S_MODE_MSK, +- dac_aif1); +- regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON02, +- RK3308_DAC_IO_MODE_MSK | +- RK3308_DAC_MODE_MSK | +- RK3308_DAC_I2S_BIT_CLK_POL_MSK, +- dac_aif2); ++ if (e->shift_l) { ++ /* ADC MIC Right Mute/Work Infos */ ++ regmap_read(rk3308->regmap, RK3308_ADC_DIG_CON03(grp), &value); ++ rk3308->mic_mute_r[e->reg] = (value & RK3308_ADC_R_CH_BIST_SINE) >> ++ RK3308_ADC_R_CH_BIST_SFT; ++ ucontrol->value.integer.value[0] = rk3308->mic_mute_r[e->reg]; ++ } else { ++ /* ADC MIC Left Mute/Work Infos */ ++ regmap_read(rk3308->regmap, RK3308_ADC_DIG_CON03(grp), &value); ++ rk3308->mic_mute_l[e->reg] = (value & RK3308_ADC_L_CH_BIST_SINE) >> ++ RK3308_ADC_L_CH_BIST_SFT; ++ ucontrol->value.integer.value[0] = rk3308->mic_mute_l[e->reg]; ++ } + + return 0; + } + +-static int rk3308_hw_params(struct snd_pcm_substream *substream, +- struct snd_pcm_hw_params *params, +- struct snd_soc_dai *dai) ++static int rk3308_codec_mic_mute_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = dai->codec; ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); + struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); +- unsigned int adc_aif1 = 0, adc_aif2 = 0, dac_aif1 = 0, dac_aif2 = 0; +- int ch = rk3308->adc_ch; ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ unsigned int value; ++ int grp = e->reg; + +- switch (params_format(params)) { +- case SNDRV_PCM_FORMAT_S16_LE: +- adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_16BITS; +- dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_16BITS; +- break; +- case SNDRV_PCM_FORMAT_S20_3LE: +- adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_20BITS; +- dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_20BITS; +- break; +- case SNDRV_PCM_FORMAT_S24_LE: +- adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_24BITS; +- dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_24BITS; +- break; +- case SNDRV_PCM_FORMAT_S32_LE: +- adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_32BITS; +- dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_32BITS; +- break; +- default: ++ if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) { ++ dev_err(rk3308->plat_dev, ++ "%s: Invalid ADC grp: %d\n", __func__, e->reg); + return -EINVAL; + } + +- switch (params_channels(params)) { +- case 1: +- adc_aif1 |= RK3308_ADC_I2S_MONO; +- break; +- case 2: +- adc_aif1 |= RK3308_ADC_I2S_STEREO; +- break; +- default: +- return -EINVAL; ++ if (e->shift_l) { ++ /* ADC MIC Right Mute/Work Configuration */ ++ value = ucontrol->value.integer.value[0] << RK3308_ADC_R_CH_BIST_SFT; ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_R_CH_BIST_SINE, ++ value); ++ rk3308->mic_mute_r[e->reg] = ucontrol->value.integer.value[0]; ++ } else { ++ /* ADC MIC Left Mute/Work Configuration */ ++ value = ucontrol->value.integer.value[0] << RK3308_ADC_L_CH_BIST_SFT; ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_L_CH_BIST_SINE, ++ value); ++ rk3308->mic_mute_l[e->reg] = ucontrol->value.integer.value[0]; + } + +- adc_aif1 |= RK3308_ADC_I2S_LR_NORMAL; +- adc_aif2 |= RK3308_ADC_I2S_WORK; +- dac_aif1 |= RK3308_DAC_I2S_LR_NORMAL; +- dac_aif2 |= RK3308_DAC_I2S_WORK; ++ return 0; ++} + +- regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON01(ch), +- RK3308_ADC_I2S_VALID_LEN_MSK | +- RK3308_ADC_I2S_LR_MSK | +- RK3308_ADC_I2S_TYPE_MSK, +- adc_aif1); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON02(ch), +- RK3308_ADC_I2S_MSK, +- adc_aif2); ++static int rk3308_codec_micbias_volts_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); + +- regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON01, +- RK3308_DAC_I2S_VALID_LEN_MSK | +- RK3308_DAC_I2S_LR_MSK, +- dac_aif1); +- regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON02, +- RK3308_DAC_I2S_MSK, +- dac_aif2); ++ ucontrol->value.integer.value[0] = rk3308->micbias_volt; + + return 0; + } + +-static int rk3308_digital_mute(struct snd_soc_dai *dai, int mute) ++static int rk3308_codec_micbias_volts_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) + { ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ unsigned int volt = ucontrol->value.integer.value[0]; ++ int ret; ++ ++ ret = check_micbias(volt); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, "The invalid micbias volt: %d\n", ++ volt); ++ return ret; ++ } ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(0), ++ RK3308_ADC_LEVEL_RANGE_MICBIAS_MSK, ++ volt); ++ ++ rk3308->micbias_volt = volt; ++ + return 0; + } + +-static int rk3308_codec_dac_enable(struct rk3308_codec_priv *rk3308) ++static int rk3308_codec_main_micbias_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) + { +- /* Step 01 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON00, +- RK3308_DAC_CURRENT_MSK, +- RK3308_DAC_CURRENT_EN); +- +- /* Step 02 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, +- RK3308_DAC_BUF_REF_L_MSK | +- RK3308_DAC_BUF_REF_R_MSK, +- RK3308_DAC_BUF_REF_L_EN | +- RK3308_DAC_BUF_REF_R_EN); ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); + +- /* Step 03 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, +- RK3308_DAC_POP_SOUND_L_MSK | +- RK3308_DAC_POP_SOUND_R_MSK, +- RK3308_DAC_POP_SOUND_L_WORK | +- RK3308_DAC_POP_SOUND_R_WORK); ++ ucontrol->value.integer.value[0] = rk3308->enable_micbias; + +- /* Step 04 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, +- RK3308_DAC_L_HPMIX_EN | RK3308_DAC_R_HPMIX_EN, +- RK3308_DAC_L_HPMIX_EN | RK3308_DAC_R_HPMIX_EN); ++ return 0; ++} + +- /* Step 05 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, +- RK3308_DAC_L_HPMIX_WORK | RK3308_DAC_R_HPMIX_WORK, +- RK3308_DAC_L_HPMIX_WORK | RK3308_DAC_R_HPMIX_WORK); ++static int rk3308_codec_main_micbias_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ unsigned int on = ucontrol->value.integer.value[0]; ++ ++ if (on) { ++ if (!rk3308->enable_micbias) ++ rk3308_codec_micbias_enable(rk3308, rk3308->micbias_volt); ++ } else { ++ if (rk3308->enable_micbias) ++ rk3308_codec_micbias_disable(rk3308); ++ } + +- /* Step 06 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, +- RK3308_DAC_L_LINEOUT_EN | RK3308_DAC_R_LINEOUT_EN, +- RK3308_DAC_L_LINEOUT_EN | RK3308_DAC_R_LINEOUT_EN); ++ return 0; ++} + +- /* Step 07 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, +- RK3308_DAC_L_HPOUT_EN | RK3308_DAC_R_HPOUT_EN, +- RK3308_DAC_L_HPOUT_EN | RK3308_DAC_R_HPOUT_EN); ++static int rk3308_codec_mic_gain_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ return snd_soc_get_volsw_range(kcontrol, ucontrol); ++} + +- /* Step 08 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, +- RK3308_DAC_L_HPOUT_WORK | RK3308_DAC_R_HPOUT_WORK, +- RK3308_DAC_L_HPOUT_WORK | RK3308_DAC_R_HPOUT_WORK); ++static int rk3308_codec_mic_gain_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ unsigned int gain = ucontrol->value.integer.value[0]; + +- /* Step 09 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, +- RK3308_DAC_L_REF_EN | RK3308_DAC_R_REF_EN, +- RK3308_DAC_L_REF_EN | RK3308_DAC_R_REF_EN); ++ if (gain > RK3308_ADC_CH1_MIC_GAIN_MAX) { ++ dev_err(rk3308->plat_dev, "%s: invalid mic gain: %d\n", ++ __func__, gain); ++ return -EINVAL; ++ } + +- /* Step 10 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, +- RK3308_DAC_L_CLK_EN | RK3308_DAC_R_CLK_EN, +- RK3308_DAC_L_CLK_EN | RK3308_DAC_R_CLK_EN); ++ if (rk3308->codec_ver == ACODEC_VERSION_A) { ++ /* ++ * From the TRM, there are only suupport 0dB(gain==0) and ++ * 20dB(gain==3) on the codec version A. ++ */ ++ if (!(gain == 0 || gain == RK3308_ADC_CH1_MIC_GAIN_MAX)) { ++ dev_err(rk3308->plat_dev, ++ "version A doesn't supported: %d, expect: 0,%d\n", ++ gain, RK3308_ADC_CH1_MIC_GAIN_MAX); ++ return 0; ++ } ++ } + +- /* Step 11 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, +- RK3308_DAC_L_DAC_EN | RK3308_DAC_R_DAC_EN, +- RK3308_DAC_L_DAC_EN | RK3308_DAC_R_DAC_EN); ++ return snd_soc_put_volsw_range(kcontrol, ucontrol); ++} + +- /* Step 12 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, +- RK3308_DAC_L_DAC_WORK | RK3308_DAC_R_DAC_WORK, +- RK3308_DAC_L_DAC_WORK | RK3308_DAC_R_DAC_WORK); ++static int rk3308_codec_hpf_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ unsigned int value; + +- /* Step 13 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, +- RK3308_DAC_L_HPMIX_SEL_MSK | +- RK3308_DAC_R_HPMIX_SEL_MSK, +- RK3308_DAC_L_HPMIX_I2S | +- RK3308_DAC_R_HPMIX_I2S); ++ if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) { ++ dev_err(rk3308->plat_dev, ++ "%s: Invalid ADC grp: %d\n", __func__, e->reg); ++ return -EINVAL; ++ } + +- /* Step 14 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, +- RK3308_DAC_L_HPMIX_UNMUTE | +- RK3308_DAC_R_HPMIX_UNMUTE, +- RK3308_DAC_L_HPMIX_UNMUTE | +- RK3308_DAC_R_HPMIX_UNMUTE); ++ regmap_read(rk3308->regmap, RK3308_ADC_DIG_CON04(e->reg), &value); ++ if (value & RK3308_ADC_HPF_PATH_MSK) ++ rk3308->hpf_cutoff[e->reg] = 0; ++ else ++ rk3308->hpf_cutoff[e->reg] = 1; + +- /* Step 15 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, +- RK3308_DAC_L_HPMIX_GAIN_MSK | +- RK3308_DAC_R_HPMIX_GAIN_MSK, +- RK3308_DAC_L_HPMIX_GAIN_0DB | +- RK3308_DAC_R_HPMIX_GAIN_0DB); ++ ucontrol->value.integer.value[0] = rk3308->hpf_cutoff[e->reg]; + +- /* Step 16 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, +- RK3308_DAC_L_HPOUT_UNMUTE | +- RK3308_DAC_R_HPOUT_UNMUTE, +- RK3308_DAC_L_HPOUT_UNMUTE | +- RK3308_DAC_R_HPOUT_UNMUTE); ++ return 0; ++} + +- /* Step 17 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, +- RK3308_DAC_L_LINEOUT_UNMUTE | +- RK3308_DAC_R_LINEOUT_UNMUTE, +- RK3308_DAC_L_LINEOUT_UNMUTE | +- RK3308_DAC_R_LINEOUT_UNMUTE); ++static int rk3308_codec_hpf_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ unsigned int value = ucontrol->value.integer.value[0]; + +- /* Step 18 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON05, +- RK3308_DAC_L_HPOUT_GAIN_MSK, +- RK3308_DAC_L_HPOUT_GAIN_0DB); ++ if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) { ++ dev_err(rk3308->plat_dev, ++ "%s: Invalid ADC grp: %d\n", __func__, e->reg); ++ return -EINVAL; ++ } + +- /* Step 18 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON06, +- RK3308_DAC_R_HPOUT_GAIN_MSK, +- RK3308_DAC_R_HPOUT_GAIN_0DB); ++ if (value) { ++ /* Enable high pass filter for ADCs */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON04(e->reg), ++ RK3308_ADC_HPF_PATH_MSK, ++ RK3308_ADC_HPF_PATH_EN); ++ } else { ++ /* Disable high pass filter for ADCs. */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON04(e->reg), ++ RK3308_ADC_HPF_PATH_MSK, ++ RK3308_ADC_HPF_PATH_DIS); ++ } + +- /* Step 19 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, +- RK3308_DAC_L_GAIN_MSK | RK3308_DAC_R_GAIN_MSK, +- RK3308_DAC_L_GAIN_0DB | RK3308_DAC_R_GAIN_0DB); ++ rk3308->hpf_cutoff[e->reg] = value; + + return 0; + } + +-static int rk3308_codec_dac_disable(struct rk3308_codec_priv *rk3308) ++static int rk3308_codec_hpout_l_get_tlv(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) + { +- /* Step 01 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, +- RK3308_DAC_L_GAIN_MSK | RK3308_DAC_R_GAIN_MSK, +- RK3308_DAC_L_GAIN_0DB | RK3308_DAC_R_GAIN_0DB); +- +- /* +- * Step 02 +- * +- * Note1. In the step2, adjusting the register step by step to the +- * appropriate value and taking 20ms as time step +- */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON05, +- RK3308_DAC_L_HPOUT_GAIN_MSK, +- RK3308_DAC_L_HPOUT_GAIN_NDB_39); +- +- /* Step 02 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON06, +- RK3308_DAC_R_HPOUT_GAIN_MSK, +- RK3308_DAC_R_HPOUT_GAIN_NDB_39); ++ return snd_soc_get_volsw_range(kcontrol, ucontrol); ++} + +- /* Step 03 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, +- RK3308_DAC_L_HPMIX_UNMUTE | +- RK3308_DAC_R_HPMIX_UNMUTE, +- RK3308_DAC_L_HPMIX_MUTE | +- RK3308_DAC_R_HPMIX_MUTE); ++static int rk3308_codec_hpout_l_put_tlv(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ unsigned int dgain = ucontrol->value.integer.value[0]; + +- /* Step 04 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, +- RK3308_DAC_L_HPMIX_SEL_MSK | +- RK3308_DAC_R_HPMIX_SEL_MSK, +- RK3308_DAC_L_HPMIX_NONE | +- RK3308_DAC_R_HPMIX_NONE); ++ if (dgain > RK3308_DAC_L_HPOUT_GAIN_MAX) { ++ dev_err(rk3308->plat_dev, "%s: invalid l_dgain: %d\n", ++ __func__, dgain); ++ return -EINVAL; ++ } + +- /* Step 05 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, +- RK3308_DAC_L_HPOUT_UNMUTE | +- RK3308_DAC_R_HPOUT_UNMUTE, +- RK3308_DAC_L_HPOUT_MUTE | +- RK3308_DAC_R_HPOUT_MUTE); ++ rk3308->hpout_l_dgain = dgain; + +- /* Step 06 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, +- RK3308_DAC_L_DAC_WORK | RK3308_DAC_R_DAC_WORK, +- RK3308_DAC_L_DAC_INIT | RK3308_DAC_R_DAC_INIT); ++ return snd_soc_put_volsw_range(kcontrol, ucontrol); ++} + +- /* Step 07 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, +- RK3308_DAC_L_HPOUT_EN | RK3308_DAC_R_HPOUT_EN, +- RK3308_DAC_L_HPOUT_DIS | RK3308_DAC_R_HPOUT_DIS); ++static int rk3308_codec_hpout_r_get_tlv(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ return snd_soc_get_volsw_range(kcontrol, ucontrol); ++} + +- /* Step 08 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, +- RK3308_DAC_L_LINEOUT_UNMUTE | +- RK3308_DAC_R_LINEOUT_UNMUTE, +- RK3308_DAC_L_LINEOUT_MUTE | +- RK3308_DAC_R_LINEOUT_MUTE); ++static int rk3308_codec_hpout_r_put_tlv(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ unsigned int dgain = ucontrol->value.integer.value[0]; + +- /* Step 09 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, +- RK3308_DAC_L_LINEOUT_EN | RK3308_DAC_R_LINEOUT_EN, +- RK3308_DAC_L_LINEOUT_DIS | RK3308_DAC_R_LINEOUT_DIS); ++ if (dgain > RK3308_DAC_R_HPOUT_GAIN_MAX) { ++ dev_err(rk3308->plat_dev, "%s: invalid r_dgain: %d\n", ++ __func__, dgain); ++ return -EINVAL; ++ } + +- /* Step 10 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, +- RK3308_DAC_L_HPMIX_EN | RK3308_DAC_R_HPMIX_EN, +- RK3308_DAC_L_HPMIX_DIS | RK3308_DAC_R_HPMIX_DIS); ++ rk3308->hpout_r_dgain = dgain; + +- /* Step 11 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, +- RK3308_DAC_L_DAC_EN | RK3308_DAC_R_DAC_EN, +- RK3308_DAC_L_DAC_DIS | RK3308_DAC_R_DAC_DIS); ++ return snd_soc_put_volsw_range(kcontrol, ucontrol); ++} + +- /* Step 12 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, +- RK3308_DAC_L_CLK_EN | RK3308_DAC_R_CLK_EN, +- RK3308_DAC_L_CLK_DIS | RK3308_DAC_R_CLK_DIS); ++static u32 to_mapped_grp(struct rk3308_codec_priv *rk3308, int idx) ++{ ++ return rk3308->i2s_sdis[idx]; ++} + +- /* Step 13 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, +- RK3308_DAC_L_REF_EN | RK3308_DAC_R_REF_EN, +- RK3308_DAC_L_REF_DIS | RK3308_DAC_R_REF_DIS); ++static bool adc_for_each_grp(struct rk3308_codec_priv *rk3308, ++ int type, int idx, u32 *grp) ++{ ++ if (type == ADC_TYPE_NORMAL) { ++ u32 mapped_grp = to_mapped_grp(rk3308, idx); ++ int max_grps; ++ ++ if (rk3308->enable_all_adcs) ++ max_grps = ADC_LR_GROUP_MAX; ++ else ++ max_grps = rk3308->used_adc_grps; ++ ++ if (idx >= max_grps) ++ return false; ++ ++ if ((!rk3308->loopback_dacs_enabled) && ++ handle_loopback(rk3308) && ++ rk3308->loopback_grp == mapped_grp) { ++ /* ++ * Ths loopback DACs are closed, and specify the ++ * loopback ADCs. ++ */ ++ *grp = ADC_GRP_SKIP_MAGIC; ++ } else if (rk3308->en_always_grps_num && ++ rk3308->skip_grps[mapped_grp]) { ++ /* To set the skip flag if the ADC GRP is enabled. */ ++ *grp = ADC_GRP_SKIP_MAGIC; ++ } else { ++ *grp = mapped_grp; ++ } + +- /* Step 14 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, +- RK3308_DAC_POP_SOUND_L_MSK | +- RK3308_DAC_POP_SOUND_R_MSK, +- RK3308_DAC_POP_SOUND_L_INIT | +- RK3308_DAC_POP_SOUND_R_INIT); ++ dev_dbg(rk3308->plat_dev, ++ "ADC_TYPE_NORMAL, idx: %d, mapped_grp: %d, get grp: %d,\n", ++ idx, mapped_grp, *grp); ++ } else if (type == ADC_TYPE_ALL) { ++ if (idx >= ADC_LR_GROUP_MAX) ++ return false; ++ ++ *grp = idx; ++ dev_dbg(rk3308->plat_dev, ++ "ADC_TYPE_ALL, idx: %d, get grp: %d\n", ++ idx, *grp); ++ } else if (type == ADC_TYPE_DBG) { ++ if (idx >= ADC_LR_GROUP_MAX) ++ return false; ++ ++ if (idx == (int)rk3308->cur_dbg_grp) ++ *grp = idx; ++ else ++ *grp = ADC_GRP_SKIP_MAGIC; ++ ++ dev_dbg(rk3308->plat_dev, ++ "ADC_TYPE_DBG, idx: %d, get grp: %d\n", ++ idx, *grp); ++ } else { ++ if (idx >= 1) ++ return false; ++ ++ *grp = rk3308->loopback_grp; ++ dev_dbg(rk3308->plat_dev, ++ "ADC_TYPE_LOOPBACK, idx: %d, get grp: %d\n", ++ idx, *grp); ++ } + +- /* Step 15 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, +- RK3308_DAC_BUF_REF_L_EN | RK3308_DAC_BUF_REF_R_EN, +- RK3308_DAC_BUF_REF_L_DIS | RK3308_DAC_BUF_REF_R_DIS); ++ return true; ++} + +- /* Step 16 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON00, +- RK3308_DAC_CURRENT_EN, +- RK3308_DAC_CURRENT_DIS); ++static int rk3308_codec_get_dac_path_state(struct rk3308_codec_priv *rk3308) ++{ ++ return rk3308->dac_path_state; ++} + +- /* Step 17 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, +- RK3308_DAC_L_HPOUT_WORK | RK3308_DAC_R_HPOUT_WORK, +- RK3308_DAC_L_HPOUT_INIT | RK3308_DAC_R_HPOUT_INIT); ++static void rk3308_codec_set_dac_path_state(struct rk3308_codec_priv *rk3308, ++ int state) ++{ ++ rk3308->dac_path_state = state; ++} + +- /* Step 18 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, +- RK3308_DAC_L_HPMIX_WORK | RK3308_DAC_R_HPMIX_WORK, +- RK3308_DAC_L_HPMIX_INIT | RK3308_DAC_R_HPMIX_INIT); ++static void rk3308_headphone_ctl(struct rk3308_codec_priv *rk3308, int on) ++{ ++ if (rk3308->hp_ctl_gpio) ++ gpiod_direction_output(rk3308->hp_ctl_gpio, on); ++} + +- /* Step 19 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, +- RK3308_DAC_L_HPMIX_GAIN_MSK | +- RK3308_DAC_R_HPMIX_GAIN_MSK, +- RK3308_DAC_L_HPMIX_GAIN_NDB_6 | +- RK3308_DAC_R_HPMIX_GAIN_NDB_6); ++static void rk3308_speaker_ctl(struct rk3308_codec_priv *rk3308, int on) ++{ ++ if (on) { ++ if (rk3308->pa_drv_gpio) { ++ gpiod_direction_output(rk3308->pa_drv_gpio, on); ++ msleep(rk3308->delay_pa_drv_ms); ++ } + +- /* +- * Note2. If the ACODEC_DAC_ANA_CON12[7] or ACODEC_DAC_ANA_CON12[3] +- * is set to 0x1, add the steps from the section Disable DAC +- * Configuration Standard Usage Flow after complete the step 19 +- */ ++ if (rk3308->spk_ctl_gpio) ++ gpiod_direction_output(rk3308->spk_ctl_gpio, on); ++ } else { ++ if (rk3308->spk_ctl_gpio) ++ gpiod_direction_output(rk3308->spk_ctl_gpio, on); + +- return 0; ++ if (rk3308->pa_drv_gpio) { ++ msleep(rk3308->delay_pa_drv_ms); ++ gpiod_direction_output(rk3308->pa_drv_gpio, on); ++ } ++ } + } + +-static int rk3308_codec_power_on(struct snd_soc_codec *codec) ++static int rk3308_codec_reset(struct snd_soc_codec *codec) + { + struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); + +- /* 1. Supply the power of digital part and reset the Audio Codec */ +- /* Do nothing */ ++ reset_control_assert(rk3308->reset); ++ usleep_range(2000, 2500); /* estimated value */ ++ reset_control_deassert(rk3308->reset); + +- /* +- * 2. Configure ACODEC_DAC_ANA_CON1[1:0] and ACODEC_DAC_ANA_CON1[5:4] +- * to 0x1, to setup dc voltage of the DAC channel output +- */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, +- RK3308_DAC_POP_SOUND_L_MSK, RK3308_DAC_POP_SOUND_L_INIT); +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, +- RK3308_DAC_POP_SOUND_R_MSK, RK3308_DAC_POP_SOUND_R_INIT); ++ regmap_write(rk3308->regmap, RK3308_GLB_CON, 0x00); ++ usleep_range(200, 300); /* estimated value */ ++ regmap_write(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_SYS_WORK | ++ RK3308_DAC_DIG_WORK | ++ RK3308_ADC_DIG_WORK); + +- /* +- * 3. Configure the register ACODEC_ADC_ANA_CON10[6:0] to 0x1 +- * +- * Note: Only the reg (ADC_ANA_CON10+0x0)[6:0] represent the control +- * signal to select current to pre-charge/dis_charge +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), +- RK3308_ADC_CURRENT_CHARGE_MSK, RK3308_ADC_SEL_I_64(1)); ++ return 0; ++} + +- /* 4. Supply the power of the analog part(AVDD,AVDDRV) */ ++static int rk3308_codec_adc_dig_reset(struct rk3308_codec_priv *rk3308) ++{ ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_ADC_DIG_WORK, ++ RK3308_ADC_DIG_RESET); ++ udelay(50); ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_ADC_DIG_WORK, ++ RK3308_ADC_DIG_WORK); + +- /* +- * 5. Configure the register ACODEC_ADC_ANA_CON10[7] to 0x1 to setup +- * reference voltage +- * +- * Note: Only the reg (ADC_ANA_CON10+0x0)[7] represent the enable +- * signal of reference voltage module +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), +- RK3308_ADC_REF_EN, RK3308_ADC_REF_EN); ++ return 0; ++} + +- /* +- * 6. Change the register ACODEC_ADC_ANA_CON10[6:0] from the 0x1 to +- * 0x7f step by step or configure the ACODEC_ADC_ANA_CON10[6:0] to +- * 0x7f directly. The suggestion slot time of the step is 20ms. +- */ +- mdelay(20); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), +- RK3308_ADC_CURRENT_CHARGE_MSK, +- RK3308_ADC_DONT_SEL_ALL); ++static int rk3308_codec_dac_dig_reset(struct rk3308_codec_priv *rk3308) ++{ ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_DAC_DIG_WORK, ++ RK3308_DAC_DIG_RESET); ++ udelay(50); ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_DAC_DIG_WORK, ++ RK3308_DAC_DIG_WORK); + +- /* 7. Wait until the voltage of VCM keeps stable at the AVDD/2 */ +- usleep_range(200, 300); /* estimated value */ ++ return 0; ++} + +- /* +- * 8. Configure the register ACODEC_ADC_ANA_CON10[6:0] to the +- * appropriate value(expect 0x0) for reducing power. +- */ ++static int rk3308_set_bias_level(struct snd_soc_codec *codec, ++ enum snd_soc_bias_level level) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); + +- /* TODO: choose an appropriate charge value */ ++ switch (level) { ++ case SND_SOC_BIAS_ON: ++ break; ++ case SND_SOC_BIAS_PREPARE: ++ break; ++ case SND_SOC_BIAS_STANDBY: ++ regcache_cache_only(rk3308->regmap, false); ++ regcache_sync(rk3308->regmap); ++ break; ++ case SND_SOC_BIAS_OFF: ++ break; ++ } + + return 0; + } + +-static int rk3308_codec_power_off(struct snd_soc_codec *codec) ++static int rk3308_set_dai_fmt(struct snd_soc_dai *codec_dai, ++ unsigned int fmt) + { ++ struct snd_soc_codec *codec = codec_dai->codec; + struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ unsigned int adc_aif1 = 0, adc_aif2 = 0, dac_aif1 = 0, dac_aif2 = 0; ++ int idx, grp, is_master; ++ int type = ADC_TYPE_ALL; ++ ++ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { ++ case SND_SOC_DAIFMT_CBS_CFS: ++ adc_aif2 |= RK3308_ADC_IO_MODE_SLAVE; ++ adc_aif2 |= RK3308_ADC_MODE_SLAVE; ++ dac_aif2 |= RK3308_DAC_IO_MODE_SLAVE; ++ dac_aif2 |= RK3308_DAC_MODE_SLAVE; ++ is_master = 0; ++ break; ++ case SND_SOC_DAIFMT_CBM_CFM: ++ adc_aif2 |= RK3308_ADC_IO_MODE_MASTER; ++ adc_aif2 |= RK3308_ADC_MODE_MASTER; ++ dac_aif2 |= RK3308_DAC_IO_MODE_MASTER; ++ dac_aif2 |= RK3308_DAC_MODE_MASTER; ++ is_master = 1; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { ++ case SND_SOC_DAIFMT_DSP_A: ++ adc_aif1 |= RK3308_ADC_I2S_MODE_PCM; ++ dac_aif1 |= RK3308_DAC_I2S_MODE_PCM; ++ break; ++ case SND_SOC_DAIFMT_I2S: ++ adc_aif1 |= RK3308_ADC_I2S_MODE_I2S; ++ dac_aif1 |= RK3308_DAC_I2S_MODE_I2S; ++ break; ++ case SND_SOC_DAIFMT_RIGHT_J: ++ adc_aif1 |= RK3308_ADC_I2S_MODE_RJ; ++ dac_aif1 |= RK3308_DAC_I2S_MODE_RJ; ++ break; ++ case SND_SOC_DAIFMT_LEFT_J: ++ adc_aif1 |= RK3308_ADC_I2S_MODE_LJ; ++ dac_aif1 |= RK3308_DAC_I2S_MODE_LJ; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ switch (fmt & SND_SOC_DAIFMT_INV_MASK) { ++ case SND_SOC_DAIFMT_NB_NF: ++ adc_aif1 |= RK3308_ADC_I2S_LRC_POL_NORMAL; ++ adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_NORMAL; ++ dac_aif1 |= RK3308_DAC_I2S_LRC_POL_NORMAL; ++ dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_NORMAL; ++ break; ++ case SND_SOC_DAIFMT_IB_IF: ++ adc_aif1 |= RK3308_ADC_I2S_LRC_POL_REVERSAL; ++ adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_REVERSAL; ++ dac_aif1 |= RK3308_DAC_I2S_LRC_POL_REVERSAL; ++ dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_REVERSAL; ++ break; ++ case SND_SOC_DAIFMT_IB_NF: ++ adc_aif1 |= RK3308_ADC_I2S_LRC_POL_NORMAL; ++ adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_REVERSAL; ++ dac_aif1 |= RK3308_DAC_I2S_LRC_POL_NORMAL; ++ dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_REVERSAL; ++ break; ++ case SND_SOC_DAIFMT_NB_IF: ++ adc_aif1 |= RK3308_ADC_I2S_LRC_POL_REVERSAL; ++ adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_NORMAL; ++ dac_aif1 |= RK3308_DAC_I2S_LRC_POL_REVERSAL; ++ dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_NORMAL; ++ break; ++ default: ++ return -EINVAL; ++ } + + /* +- * 1. Keep the power on and disable the DAC and ADC path according to +- * the section power on configuration standard usage flow. ++ * Hold ADC Digital registers start at master mode ++ * ++ * There are 8 ADCs and use the same SCLK and LRCK internal for master ++ * mode, We need to make sure that they are in effect at the same time, ++ * otherwise they will cause the abnormal clocks. + */ ++ if (is_master) ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_ADC_DIG_WORK, ++ RK3308_ADC_DIG_RESET); ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON01(grp), ++ RK3308_ADC_I2S_LRC_POL_MSK | ++ RK3308_ADC_I2S_MODE_MSK, ++ adc_aif1); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON02(grp), ++ RK3308_ADC_IO_MODE_MSK | ++ RK3308_ADC_MODE_MSK | ++ RK3308_ADC_I2S_BIT_CLK_POL_MSK, ++ adc_aif2); ++ } + +- /* 2. Configure the register ACODEC_ADC_ANA_CON10[6:0] to 0x1 */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), +- RK3308_ADC_CURRENT_CHARGE_MSK, RK3308_ADC_SEL_I_64(1)); ++ /* Hold ADC Digital registers end at master mode */ ++ if (is_master) ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_ADC_DIG_WORK, ++ RK3308_ADC_DIG_WORK); + +- /* 3. Configure the register ACODEC_ADC_ANA_CON10[7] to 0x0 */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), +- RK3308_ADC_REF_EN, RK3308_ADC_REF_DIS); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON01, ++ RK3308_DAC_I2S_LRC_POL_MSK | ++ RK3308_DAC_I2S_MODE_MSK, ++ dac_aif1); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON02, ++ RK3308_DAC_IO_MODE_MSK | ++ RK3308_DAC_MODE_MSK | ++ RK3308_DAC_I2S_BIT_CLK_POL_MSK, ++ dac_aif2); ++ ++ return 0; ++} ++ ++static int rk3308_codec_dac_dig_config(struct rk3308_codec_priv *rk3308, ++ struct snd_pcm_hw_params *params) ++{ ++ unsigned int dac_aif1 = 0, dac_aif2 = 0; ++ ++ /* Clear the status of DAC DIG Digital reigisters */ ++ rk3308_codec_dac_dig_reset(rk3308); ++ ++ switch (params_format(params)) { ++ case SNDRV_PCM_FORMAT_S16_LE: ++ dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_16BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S20_3LE: ++ dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_20BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S24_LE: ++ dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_24BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S32_LE: ++ dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_32BITS; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ dac_aif1 |= RK3308_DAC_I2S_LR_NORMAL; ++ dac_aif2 |= RK3308_DAC_I2S_WORK; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON01, ++ RK3308_DAC_I2S_VALID_LEN_MSK | ++ RK3308_DAC_I2S_LR_MSK, ++ dac_aif1); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON02, ++ RK3308_DAC_I2S_MSK, ++ dac_aif2); ++ ++ return 0; ++} ++ ++static int rk3308_codec_adc_dig_config(struct rk3308_codec_priv *rk3308, ++ struct snd_pcm_hw_params *params) ++{ ++ unsigned int adc_aif1 = 0, adc_aif2 = 0; ++ int type = ADC_TYPE_NORMAL; ++ int idx, grp; ++ ++ /* Clear the status of ADC DIG Digital reigisters */ ++ rk3308_codec_adc_dig_reset(rk3308); ++ ++ switch (params_format(params)) { ++ case SNDRV_PCM_FORMAT_S16_LE: ++ adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_16BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S20_3LE: ++ adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_20BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S24_LE: ++ adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_24BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S32_LE: ++ adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_32BITS; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ switch (params_channels(params)) { ++ case 1: ++ adc_aif1 |= RK3308_ADC_I2S_MONO; ++ break; ++ case 2: ++ case 4: ++ case 6: ++ case 8: ++ adc_aif1 |= RK3308_ADC_I2S_STEREO; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ adc_aif1 |= RK3308_ADC_I2S_LR_NORMAL; ++ adc_aif2 |= RK3308_ADC_I2S_WORK; ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON01(grp), ++ RK3308_ADC_I2S_VALID_LEN_MSK | ++ RK3308_ADC_I2S_LR_MSK | ++ RK3308_ADC_I2S_TYPE_MSK, ++ adc_aif1); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON02(grp), ++ RK3308_ADC_I2S_MSK, ++ adc_aif2); ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_update_adc_grps(struct rk3308_codec_priv *rk3308, ++ struct snd_pcm_hw_params *params) ++{ ++ switch (params_channels(params)) { ++ case 1: ++ rk3308->used_adc_grps = 1; ++ break; ++ case 2: ++ case 4: ++ case 6: ++ case 8: ++ rk3308->used_adc_grps = params_channels(params) / 2; ++ break; ++ default: ++ dev_err(rk3308->plat_dev, "Invalid channels: %d\n", ++ params_channels(params)); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int rk3308_mute_stream(struct snd_soc_dai *dai, int mute, int stream) ++{ ++ struct snd_soc_codec *codec = dai->codec; ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ if (stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ int dgain; ++ ++ if (mute) { ++ for (dgain = 0x2; dgain <= 0x7; dgain++) { ++ /* ++ * Keep the max -> min digital CIC interpolation ++ * filter gain step by step. ++ * ++ * loud: 0x2; whisper: 0x7 ++ */ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_DAC_DIG_CON04, ++ RK3308_DAC_CIC_IF_GAIN_MSK, ++ dgain); ++ usleep_range(200, 300); /* estimated value */ ++ } ++ ++#if !DEBUG_POP_ALWAYS ++ rk3308_headphone_ctl(rk3308, 0); ++ rk3308_speaker_ctl(rk3308, 0); ++#endif ++ } else { ++#if !DEBUG_POP_ALWAYS ++ if (rk3308->dac_output == DAC_LINEOUT) ++ rk3308_speaker_ctl(rk3308, 1); ++ else if (rk3308->dac_output == DAC_HPOUT) ++ rk3308_headphone_ctl(rk3308, 1); ++ ++ if (rk3308->delay_start_play_ms) ++ msleep(rk3308->delay_start_play_ms); ++#endif ++ for (dgain = 0x7; dgain >= 0x2; dgain--) { ++ /* ++ * Keep the min -> max digital CIC interpolation ++ * filter gain step by step ++ * ++ * loud: 0x2; whisper: 0x7 ++ */ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_DAC_DIG_CON04, ++ RK3308_DAC_CIC_IF_GAIN_MSK, ++ dgain); ++ usleep_range(200, 300); /* estimated value */ ++ } ++ } ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_digital_fadein(struct rk3308_codec_priv *rk3308) ++{ ++ unsigned int dgain, dgain_ref; ++ ++ if (rk3308->hpout_l_dgain != rk3308->hpout_r_dgain) { ++ pr_warn("HPOUT l_dgain: 0x%x != r_dgain: 0x%x\n", ++ rk3308->hpout_l_dgain, rk3308->hpout_r_dgain); ++ dgain_ref = min(rk3308->hpout_l_dgain, rk3308->hpout_r_dgain); ++ } else { ++ dgain_ref = rk3308->hpout_l_dgain; ++ } + + /* +- * 4.Change the register ACODEC_ADC_ANA_CON10[6:0] from the 0x1 to 0x7f +- * step by step or configure the ACODEC_ADC_ANA_CON10[6:0] to 0x7f +- * directly. The suggestion slot time of the step is 20ms ++ * We'd better change the gain of the left and right channels ++ * at the same time to avoid different listening + */ +- mdelay(20); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), +- RK3308_ADC_CURRENT_CHARGE_MSK, +- RK3308_ADC_DONT_SEL_ALL); ++ for (dgain = RK3308_DAC_L_HPOUT_GAIN_NDB_39; ++ dgain <= dgain_ref; dgain++) { ++ /* Step 02 decrease dgains for de-pop */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON05, ++ RK3308_DAC_L_HPOUT_GAIN_MSK, ++ dgain); ++ ++ /* Step 02 decrease dgains for de-pop */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON06, ++ RK3308_DAC_R_HPOUT_GAIN_MSK, ++ dgain); ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_digital_fadeout(struct rk3308_codec_priv *rk3308) ++{ ++ unsigned int l_dgain, r_dgain; ++ ++ /* ++ * Note. In the step2, adjusting the register step by step to ++ * the appropriate value and taking 20ms as time step ++ */ ++ regmap_read(rk3308->regmap, RK3308_DAC_ANA_CON05, &l_dgain); ++ l_dgain &= RK3308_DAC_L_HPOUT_GAIN_MSK; ++ ++ regmap_read(rk3308->regmap, RK3308_DAC_ANA_CON06, &r_dgain); ++ r_dgain &= RK3308_DAC_R_HPOUT_GAIN_MSK; ++ ++ if (l_dgain != r_dgain) { ++ pr_warn("HPOUT l_dgain: 0x%x != r_dgain: 0x%x\n", ++ l_dgain, r_dgain); ++ l_dgain = min(l_dgain, r_dgain); ++ } ++ ++ /* ++ * We'd better change the gain of the left and right channels ++ * at the same time to avoid different listening ++ */ ++ while (l_dgain >= RK3308_DAC_L_HPOUT_GAIN_NDB_39) { ++ /* Step 02 decrease dgains for de-pop */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON05, ++ RK3308_DAC_L_HPOUT_GAIN_MSK, ++ l_dgain); ++ ++ /* Step 02 decrease dgains for de-pop */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON06, ++ RK3308_DAC_R_HPOUT_GAIN_MSK, ++ l_dgain); ++ ++ usleep_range(200, 300); /* estimated value */ ++ ++ if (l_dgain == RK3308_DAC_L_HPOUT_GAIN_NDB_39) ++ break; ++ ++ l_dgain--; ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_dac_lineout_enable(struct rk3308_codec_priv *rk3308) ++{ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* Step 04 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON15, ++ RK3308_DAC_LINEOUT_POP_SOUND_L_MSK | ++ RK3308_DAC_LINEOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_L_SEL_DC_FROM_INTERNAL | ++ RK3308_DAC_R_SEL_DC_FROM_INTERNAL); ++ } ++ ++ /* Step 07 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_EN | ++ RK3308_DAC_R_LINEOUT_EN, ++ RK3308_DAC_L_LINEOUT_EN | ++ RK3308_DAC_R_LINEOUT_EN); ++ ++ udelay(20); ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* Step 10 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON15, ++ RK3308_DAC_LINEOUT_POP_SOUND_L_MSK | ++ RK3308_DAC_LINEOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_L_SEL_LINEOUT_FROM_INTERNAL | ++ RK3308_DAC_R_SEL_LINEOUT_FROM_INTERNAL); ++ ++ udelay(20); ++ } ++ ++ /* Step 19 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_UNMUTE | ++ RK3308_DAC_R_LINEOUT_UNMUTE, ++ RK3308_DAC_L_LINEOUT_UNMUTE | ++ RK3308_DAC_R_LINEOUT_UNMUTE); ++ udelay(20); ++ ++ return 0; ++} ++ ++static int rk3308_codec_dac_lineout_disable(struct rk3308_codec_priv *rk3308) ++{ ++ /* Step 08 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_UNMUTE | ++ RK3308_DAC_R_LINEOUT_UNMUTE, ++ RK3308_DAC_L_LINEOUT_MUTE | ++ RK3308_DAC_R_LINEOUT_MUTE); ++ ++ /* Step 09 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_EN | ++ RK3308_DAC_R_LINEOUT_EN, ++ RK3308_DAC_L_LINEOUT_DIS | ++ RK3308_DAC_R_LINEOUT_DIS); ++ ++ return 0; ++} ++ ++static int rk3308_codec_dac_hpout_enable(struct rk3308_codec_priv *rk3308) ++{ ++ /* Step 03 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_HPOUT_POP_SOUND_L_MSK | ++ RK3308_DAC_HPOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_HPOUT_POP_SOUND_L_WORK | ++ RK3308_DAC_HPOUT_POP_SOUND_R_WORK); ++ ++ udelay(20); ++ ++ /* Step 07 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_EN | ++ RK3308_DAC_R_HPOUT_EN, ++ RK3308_DAC_L_HPOUT_EN | ++ RK3308_DAC_R_HPOUT_EN); ++ ++ udelay(20); ++ ++ /* Step 08 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_WORK | ++ RK3308_DAC_R_HPOUT_WORK, ++ RK3308_DAC_L_HPOUT_WORK | ++ RK3308_DAC_R_HPOUT_WORK); ++ ++ udelay(20); ++ ++ /* Step 16 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_UNMUTE | ++ RK3308_DAC_R_HPOUT_UNMUTE, ++ RK3308_DAC_L_HPOUT_UNMUTE | ++ RK3308_DAC_R_HPOUT_UNMUTE); ++ ++ udelay(20); ++ ++ return 0; ++} ++ ++static int rk3308_codec_dac_hpout_disable(struct rk3308_codec_priv *rk3308) ++{ ++ /* Step 03 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_HPOUT_POP_SOUND_L_MSK | ++ RK3308_DAC_HPOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_HPOUT_POP_SOUND_L_INIT | ++ RK3308_DAC_HPOUT_POP_SOUND_R_INIT); ++ ++ /* Step 07 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_EN | ++ RK3308_DAC_R_HPOUT_EN, ++ RK3308_DAC_L_HPOUT_DIS | ++ RK3308_DAC_R_HPOUT_DIS); ++ ++ /* Step 08 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_WORK | ++ RK3308_DAC_R_HPOUT_WORK, ++ RK3308_DAC_L_HPOUT_INIT | ++ RK3308_DAC_R_HPOUT_INIT); ++ ++ /* Step 16 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_UNMUTE | ++ RK3308_DAC_R_HPOUT_UNMUTE, ++ RK3308_DAC_L_HPOUT_MUTE | ++ RK3308_DAC_R_HPOUT_MUTE); ++ ++ return 0; ++} ++ ++static int rk3308_codec_dac_switch(struct rk3308_codec_priv *rk3308, ++ int dac_output) ++{ int ret = 0; ++ ++ if (rk3308->dac_output == dac_output) { ++ dev_info(rk3308->plat_dev, ++ "Don't need to change dac_output: %d\n", dac_output); ++ goto out; ++ } ++ ++ switch (dac_output) { ++ case DAC_LINEOUT: ++ case DAC_HPOUT: ++ case DAC_LINEOUT_HPOUT: ++ break; ++ default: ++ dev_err(rk3308->plat_dev, "Unknown value: %d\n", dac_output); ++ ret = -EINVAL; ++ goto out; ++ } ++ ++ if (rk3308_codec_get_dac_path_state(rk3308) == PATH_BUSY) { ++ /* ++ * We can only switch the audio path to LINEOUT or HPOUT on ++ * codec during playbacking, otherwise, just update the ++ * dac_output flag. ++ */ ++ switch (dac_output) { ++ case DAC_LINEOUT: ++ rk3308_headphone_ctl(rk3308, 0); ++ rk3308_speaker_ctl(rk3308, 1); ++ rk3308_codec_dac_hpout_disable(rk3308); ++ rk3308_codec_dac_lineout_enable(rk3308); ++ break; ++ case DAC_HPOUT: ++ rk3308_speaker_ctl(rk3308, 0); ++ rk3308_headphone_ctl(rk3308, 1); ++ rk3308_codec_dac_lineout_disable(rk3308); ++ rk3308_codec_dac_hpout_enable(rk3308); ++ break; ++ case DAC_LINEOUT_HPOUT: ++ rk3308_speaker_ctl(rk3308, 1); ++ rk3308_headphone_ctl(rk3308, 1); ++ rk3308_codec_dac_lineout_enable(rk3308); ++ rk3308_codec_dac_hpout_enable(rk3308); ++ break; ++ default: ++ break; ++ } ++ } ++ ++ rk3308->dac_output = dac_output; ++out: ++ dev_dbg(rk3308->plat_dev, "switch dac_output to: %d\n", ++ rk3308->dac_output); ++ ++ return ret; ++} ++ ++static int rk3308_codec_dac_enable(struct rk3308_codec_priv *rk3308) ++{ ++ /* ++ * Note1. If the ACODEC_DAC_ANA_CON12[6] or ACODEC_DAC_ANA_CON12[2] ++ * is set to 0x1, ignoring the step9~12. ++ */ ++ ++ /* ++ * Note2. If the ACODEC_ DAC_ANA_CON12[7] or ACODEC_DAC_ANA_CON12[3] ++ * is set to 0x1, the ADC0 or ADC1 should be enabled firstly, and ++ * please refer to Enable ADC Configuration Standard Usage Flow(expect ++ * step7~step9,step14). ++ */ ++ ++ /* ++ * Note3. If no opening the line out, ignoring the step6, step17 and ++ * step19. ++ */ ++ ++ /* ++ * Note4. If no opening the headphone out, ignoring the step3,step7~8, ++ * step16 and step18. ++ */ ++ ++ /* ++ * Note5. In the step18, adjust the register step by step to the ++ * appropriate value and taking 10ms as one time step ++ */ ++ ++ /* ++ * 1. Set the ACODEC_DAC_ANA_CON0[0] to 0x1, to enable the current ++ * source of DAC ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON00, ++ RK3308_DAC_CURRENT_MSK, ++ RK3308_DAC_CURRENT_EN); ++ ++ udelay(20); ++ ++ /* ++ * 2. Set the ACODEC_DAC_ANA_CON1[6] and ACODEC_DAC_ANA_CON1[2] to 0x1, ++ * to enable the reference voltage buffer ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_BUF_REF_L_MSK | ++ RK3308_DAC_BUF_REF_R_MSK, ++ RK3308_DAC_BUF_REF_L_EN | ++ RK3308_DAC_BUF_REF_R_EN); ++ ++ /* Waiting the stable reference voltage */ ++ mdelay(1); ++ ++ if (rk3308->dac_output == DAC_HPOUT || ++ rk3308->dac_output == DAC_LINEOUT_HPOUT) { ++ /* Step 03 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_HPOUT_POP_SOUND_L_MSK | ++ RK3308_DAC_HPOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_HPOUT_POP_SOUND_L_WORK | ++ RK3308_DAC_HPOUT_POP_SOUND_R_WORK); ++ ++ udelay(20); ++ } ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B && ++ (rk3308->dac_output == DAC_LINEOUT || ++ rk3308->dac_output == DAC_LINEOUT_HPOUT)) { ++ /* Step 04 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON15, ++ RK3308_DAC_LINEOUT_POP_SOUND_L_MSK | ++ RK3308_DAC_LINEOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_L_SEL_DC_FROM_INTERNAL | ++ RK3308_DAC_R_SEL_DC_FROM_INTERNAL); ++ ++ udelay(20); ++ } ++ ++ /* Step 05 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_EN | ++ RK3308_DAC_R_HPMIX_EN, ++ RK3308_DAC_L_HPMIX_EN | ++ RK3308_DAC_R_HPMIX_EN); ++ ++ /* Waiting the stable HPMIX */ ++ mdelay(1); ++ ++ /* Step 06. Reset HPMIX and recover HPMIX gains */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_WORK | ++ RK3308_DAC_R_HPMIX_WORK, ++ RK3308_DAC_L_HPMIX_INIT | ++ RK3308_DAC_R_HPMIX_INIT); ++ udelay(50); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_WORK | ++ RK3308_DAC_R_HPMIX_WORK, ++ RK3308_DAC_L_HPMIX_WORK | ++ RK3308_DAC_R_HPMIX_WORK); ++ ++ udelay(20); ++ ++ if (rk3308->dac_output == DAC_LINEOUT || ++ rk3308->dac_output == DAC_LINEOUT_HPOUT) { ++ /* Step 07 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_EN | ++ RK3308_DAC_R_LINEOUT_EN, ++ RK3308_DAC_L_LINEOUT_EN | ++ RK3308_DAC_R_LINEOUT_EN); ++ ++ udelay(20); ++ } ++ ++ if (rk3308->dac_output == DAC_HPOUT || ++ rk3308->dac_output == DAC_LINEOUT_HPOUT) { ++ /* Step 08 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_EN | ++ RK3308_DAC_R_HPOUT_EN, ++ RK3308_DAC_L_HPOUT_EN | ++ RK3308_DAC_R_HPOUT_EN); ++ ++ udelay(20); ++ ++ /* Step 09 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_WORK | ++ RK3308_DAC_R_HPOUT_WORK, ++ RK3308_DAC_L_HPOUT_WORK | ++ RK3308_DAC_R_HPOUT_WORK); ++ ++ udelay(20); ++ } ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* Step 10 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON15, ++ RK3308_DAC_LINEOUT_POP_SOUND_L_MSK | ++ RK3308_DAC_LINEOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_L_SEL_LINEOUT_FROM_INTERNAL | ++ RK3308_DAC_R_SEL_LINEOUT_FROM_INTERNAL); ++ ++ udelay(20); ++ } ++ ++ /* Step 11 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_REF_EN | ++ RK3308_DAC_R_REF_EN, ++ RK3308_DAC_L_REF_EN | ++ RK3308_DAC_R_REF_EN); ++ ++ udelay(20); ++ ++ /* Step 12 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_CLK_EN | ++ RK3308_DAC_R_CLK_EN, ++ RK3308_DAC_L_CLK_EN | ++ RK3308_DAC_R_CLK_EN); ++ ++ udelay(20); ++ ++ /* Step 13 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_DAC_EN | ++ RK3308_DAC_R_DAC_EN, ++ RK3308_DAC_L_DAC_EN | ++ RK3308_DAC_R_DAC_EN); ++ ++ udelay(20); ++ ++ /* Step 14 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_DAC_WORK | ++ RK3308_DAC_R_DAC_WORK, ++ RK3308_DAC_L_DAC_WORK | ++ RK3308_DAC_R_DAC_WORK); ++ ++ udelay(20); ++ ++ /* Step 15 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, ++ RK3308_DAC_L_HPMIX_SEL_MSK | ++ RK3308_DAC_R_HPMIX_SEL_MSK, ++ RK3308_DAC_L_HPMIX_I2S | ++ RK3308_DAC_R_HPMIX_I2S); ++ ++ udelay(20); ++ ++ /* Step 16 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_UNMUTE | ++ RK3308_DAC_R_HPMIX_UNMUTE, ++ RK3308_DAC_L_HPMIX_UNMUTE | ++ RK3308_DAC_R_HPMIX_UNMUTE); ++ ++ udelay(20); ++ ++ /* Step 17: Put configuration HPMIX Gain to DAPM */ ++ ++ if (rk3308->dac_output == DAC_HPOUT || ++ rk3308->dac_output == DAC_LINEOUT_HPOUT) { ++ /* Step 18 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_UNMUTE | ++ RK3308_DAC_R_HPOUT_UNMUTE, ++ RK3308_DAC_L_HPOUT_UNMUTE | ++ RK3308_DAC_R_HPOUT_UNMUTE); ++ ++ udelay(20); ++ } ++ ++ if (rk3308->dac_output == DAC_LINEOUT || ++ rk3308->dac_output == DAC_LINEOUT_HPOUT) { ++ /* Step 19 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_UNMUTE | ++ RK3308_DAC_R_LINEOUT_UNMUTE, ++ RK3308_DAC_L_LINEOUT_UNMUTE | ++ RK3308_DAC_R_LINEOUT_UNMUTE); ++ udelay(20); ++ } ++ ++ /* Step 20, put configuration HPOUT gain to DAPM control */ ++ /* Step 21, put configuration LINEOUT gain to DAPM control */ ++ ++ if (rk3308->dac_output == DAC_HPOUT || ++ rk3308->dac_output == DAC_LINEOUT_HPOUT) { ++ /* Just for HPOUT */ ++ rk3308_codec_digital_fadein(rk3308); ++ } ++ ++ rk3308->dac_endisable = true; ++ ++ /* TODO: TRY TO TEST DRIVE STRENGTH */ ++ ++ return 0; ++} ++ ++static int rk3308_codec_dac_disable(struct rk3308_codec_priv *rk3308) ++{ ++ /* ++ * Step 00 skipped. Keep the DAC channel work and input the mute signal. ++ */ ++ ++ /* Step 01 skipped. May set the min gain for LINEOUT. */ ++ ++ /* Step 02 skipped. May set the min gain for HPOUT. */ ++ ++ if (rk3308->dac_output == DAC_HPOUT || ++ rk3308->dac_output == DAC_LINEOUT_HPOUT) { ++ /* Just for HPOUT */ ++ rk3308_codec_digital_fadeout(rk3308); ++ } ++ ++ /* Step 03 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_UNMUTE | ++ RK3308_DAC_R_HPMIX_UNMUTE, ++ RK3308_DAC_L_HPMIX_UNMUTE | ++ RK3308_DAC_R_HPMIX_UNMUTE); ++ ++ /* Step 04 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, ++ RK3308_DAC_L_HPMIX_SEL_MSK | ++ RK3308_DAC_R_HPMIX_SEL_MSK, ++ RK3308_DAC_L_HPMIX_NONE | ++ RK3308_DAC_R_HPMIX_NONE); ++ /* Step 05 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_UNMUTE | ++ RK3308_DAC_R_HPOUT_UNMUTE, ++ RK3308_DAC_L_HPOUT_MUTE | ++ RK3308_DAC_R_HPOUT_MUTE); ++ ++ /* Step 06 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_DAC_WORK | ++ RK3308_DAC_R_DAC_WORK, ++ RK3308_DAC_L_DAC_INIT | ++ RK3308_DAC_R_DAC_INIT); ++ ++ /* Step 07 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_EN | ++ RK3308_DAC_R_HPOUT_EN, ++ RK3308_DAC_L_HPOUT_DIS | ++ RK3308_DAC_R_HPOUT_DIS); ++ ++ /* Step 08 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_UNMUTE | ++ RK3308_DAC_R_LINEOUT_UNMUTE, ++ RK3308_DAC_L_LINEOUT_MUTE | ++ RK3308_DAC_R_LINEOUT_MUTE); ++ ++ /* Step 09 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_EN | ++ RK3308_DAC_R_LINEOUT_EN, ++ RK3308_DAC_L_LINEOUT_DIS | ++ RK3308_DAC_R_LINEOUT_DIS); ++ ++ /* Step 10 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_EN | ++ RK3308_DAC_R_HPMIX_EN, ++ RK3308_DAC_L_HPMIX_DIS | ++ RK3308_DAC_R_HPMIX_DIS); ++ ++ /* Step 11 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_DAC_EN | ++ RK3308_DAC_R_DAC_EN, ++ RK3308_DAC_L_DAC_DIS | ++ RK3308_DAC_R_DAC_DIS); ++ ++ /* Step 12 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_CLK_EN | ++ RK3308_DAC_R_CLK_EN, ++ RK3308_DAC_L_CLK_DIS | ++ RK3308_DAC_R_CLK_DIS); ++ ++ /* Step 13 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_REF_EN | ++ RK3308_DAC_R_REF_EN, ++ RK3308_DAC_L_REF_DIS | ++ RK3308_DAC_R_REF_DIS); ++ ++ /* Step 14 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_HPOUT_POP_SOUND_L_MSK | ++ RK3308_DAC_HPOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_HPOUT_POP_SOUND_L_INIT | ++ RK3308_DAC_HPOUT_POP_SOUND_R_INIT); ++ ++ /* Step 15 */ ++ if (rk3308->codec_ver == ACODEC_VERSION_B && ++ (rk3308->dac_output == DAC_LINEOUT || ++ rk3308->dac_output == DAC_LINEOUT_HPOUT)) { ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON15, ++ RK3308_DAC_LINEOUT_POP_SOUND_L_MSK | ++ RK3308_DAC_LINEOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_L_SEL_DC_FROM_VCM | ++ RK3308_DAC_R_SEL_DC_FROM_VCM); ++ } ++ ++ /* Step 16 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_BUF_REF_L_EN | ++ RK3308_DAC_BUF_REF_R_EN, ++ RK3308_DAC_BUF_REF_L_DIS | ++ RK3308_DAC_BUF_REF_R_DIS); ++ ++ /* Step 17 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON00, ++ RK3308_DAC_CURRENT_EN, ++ RK3308_DAC_CURRENT_DIS); ++ ++ /* Step 18 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_WORK | ++ RK3308_DAC_R_HPOUT_WORK, ++ RK3308_DAC_L_HPOUT_INIT | ++ RK3308_DAC_R_HPOUT_INIT); ++ ++ /* Step 19 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_WORK | ++ RK3308_DAC_R_HPMIX_WORK, ++ RK3308_DAC_L_HPMIX_WORK | ++ RK3308_DAC_R_HPMIX_WORK); ++ ++ /* Step 20 skipped, may set the min gain for HPOUT. */ ++ ++ /* ++ * Note2. If the ACODEC_DAC_ANA_CON12[7] or ACODEC_DAC_ANA_CON12[3] ++ * is set to 0x1, add the steps from the section Disable ADC ++ * Configuration Standard Usage Flow after complete the step 19 ++ * ++ * IF USING LINE-IN ++ * rk3308_codec_adc_ana_disable(rk3308, type); ++ */ ++ ++ rk3308->dac_endisable = false; ++ ++ return 0; ++} ++ ++static int rk3308_codec_power_on(struct rk3308_codec_priv *rk3308) ++{ ++ unsigned int v; ++ ++ /* 0. Supply the power of digital part and reset the Audio Codec */ ++ /* Do nothing */ ++ ++ /* ++ * 1. Configure ACODEC_DAC_ANA_CON1[1:0] and ACODEC_DAC_ANA_CON1[5:4] ++ * to 0x1, to setup dc voltage of the DAC channel output. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_HPOUT_POP_SOUND_L_MSK, ++ RK3308_DAC_HPOUT_POP_SOUND_L_INIT); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_HPOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_HPOUT_POP_SOUND_R_INIT); ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* ++ * 2. Configure ACODEC_DAC_ANA_CON15[1:0] and ++ * ACODEC_DAC_ANA_CON15[5:4] to 0x1, to setup dc voltage of ++ * the DAC channel output. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON15, ++ RK3308_DAC_LINEOUT_POP_SOUND_L_MSK, ++ RK3308_DAC_L_SEL_DC_FROM_VCM); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON15, ++ RK3308_DAC_LINEOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_R_SEL_DC_FROM_VCM); ++ } ++ ++ /* ++ * 3. Configure the register ACODEC_ADC_ANA_CON10[3:0] to 7’b000_0001. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, ++ RK3308_ADC_SEL_I(0x1)); ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* ++ * 4. Configure the register ACODEC_ADC_ANA_CON14[3:0] to ++ * 4’b0001. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON14, ++ RK3308_DAC_CURRENT_CHARGE_MSK, ++ RK3308_DAC_SEL_I(0x1)); ++ } ++ ++ /* 5. Supply the power of the analog part(AVDD,AVDDRV) */ ++ ++ /* ++ * 6. Configure the register ACODEC_ADC_ANA_CON10[7] to 0x1 to setup ++ * reference voltage ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_REF_EN, RK3308_ADC_REF_EN); ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* ++ * 7. Configure the register ACODEC_ADC_ANA_CON14[4] to 0x1 to ++ * setup reference voltage ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON14, ++ RK3308_DAC_VCM_LINEOUT_EN, ++ RK3308_DAC_VCM_LINEOUT_EN); ++ } ++ ++ /* ++ * 8. Change the register ACODEC_ADC_ANA_CON10[6:0] from the 0x1 to ++ * 0x7f step by step or configure the ACODEC_ADC_ANA_CON10[6:0] to ++ * 0x7f directly. Here the slot time of the step is 200us. ++ */ ++ for (v = 0x1; v <= 0x7f; v++) { ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, ++ v); ++ udelay(200); ++ } ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* ++ * 9. Change the register ACODEC_ADC_ANA_CON14[3:0] from the 0x1 ++ * to 0xf step by step or configure the ++ * ACODEC_ADC_ANA_CON14[3:0] to 0xf directly. Here the slot ++ * time of the step is 200us. ++ */ ++ for (v = 0x1; v <= 0xf; v++) { ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON14, ++ RK3308_DAC_CURRENT_CHARGE_MSK, ++ v); ++ udelay(200); ++ } ++ } ++ ++ /* 10. Wait until the voltage of VCM keeps stable at the AVDD/2 */ ++ msleep(20); /* estimated value */ ++ ++ /* ++ * 11. Configure the register ACODEC_ADC_ANA_CON10[6:0] to the ++ * appropriate value(expect 0x0) for reducing power. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, 0x7c); ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* ++ * 12. Configure the register ACODEC_DAC_ANA_CON14[6:0] to the ++ * appropriate value(expect 0x0) for reducing power. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON14, ++ RK3308_DAC_CURRENT_CHARGE_MSK, 0xf); ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_power_off(struct rk3308_codec_priv *rk3308) ++{ ++ unsigned int v; ++ ++ /* ++ * 0. Keep the power on and disable the DAC and ADC path according to ++ * the section power on configuration standard usage flow. ++ */ ++ ++ /* ++ * 1. Configure the register ACODEC_ADC_ANA_CON10[6:0] to 7’b000_0001. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, ++ RK3308_ADC_SEL_I(0x1)); ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* ++ * 2. Configure the register ACODEC_DAC_ANA_CON14[3:0] to ++ * 4’b0001. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON14, ++ RK3308_DAC_CURRENT_CHARGE_MSK, ++ RK3308_DAC_SEL_I(0x1)); ++ } ++ ++ /* 3. Configure the register ACODEC_ADC_ANA_CON10[7] to 0x0 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_REF_EN, ++ RK3308_ADC_REF_DIS); ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* 4. Configure the register ACODEC_DAC_ANA_CON14[7] to 0x0 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON14, ++ RK3308_DAC_VCM_LINEOUT_EN, ++ RK3308_DAC_VCM_LINEOUT_DIS); ++ } ++ ++ /* ++ * 5. Change the register ACODEC_ADC_ANA_CON10[6:0] from the 0x1 to 0x7f ++ * step by step or configure the ACODEC_ADC_ANA_CON10[6:0] to 0x7f ++ * directly. Here the slot time of the step is 200us. ++ */ ++ for (v = 0x1; v <= 0x7f; v++) { ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, ++ v); ++ udelay(200); ++ } ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* ++ * 6. Change the register ACODEC_DAC_ANA_CON14[3:0] from the 0x1 ++ * to 0xf step by step or configure the ++ * ACODEC_DAC_ANA_CON14[3:0] to 0xf directly. Here the slot ++ * time of the step is 200us. ++ */ ++ for (v = 0x1; v <= 0x7f; v++) { ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, ++ v); ++ udelay(200); ++ } ++ } ++ ++ /* 7. Wait until the voltage of VCM keeps stable at the AGND */ ++ msleep(20); /* estimated value */ ++ ++ /* 8. Power off the analog power supply */ ++ /* 9. Power off the digital power supply */ ++ ++ /* Do something via hardware */ ++ ++ return 0; ++} ++ ++static int rk3308_codec_headset_detect_enable(struct rk3308_codec_priv *rk3308) ++{ ++ /* ++ * Set ACODEC_DAC_ANA_CON0[1] to 0x1, to enable the headset insert ++ * detection ++ * ++ * Note. When the voltage of PAD HPDET> 8*AVDD/9, the output value of ++ * the pin_hpdet will be set to 0x1 and assert a interrupt ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON00, ++ RK3308_DAC_HEADPHONE_DET_MSK, ++ RK3308_DAC_HEADPHONE_DET_EN); ++ ++ return 0; ++} ++ ++static int rk3308_codec_headset_detect_disable(struct rk3308_codec_priv *rk3308) ++{ ++ /* ++ * Set ACODEC_DAC_ANA_CON0[1] to 0x0, to disable the headset insert ++ * detection ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON00, ++ RK3308_DAC_HEADPHONE_DET_MSK, ++ RK3308_DAC_HEADPHONE_DET_DIS); ++ ++ return 0; ++} ++ ++static int rk3308_codec_check_i2s_sdis(struct rk3308_codec_priv *rk3308, ++ int num) ++{ ++ int i, j, ret = 0; ++ ++ switch (num) { ++ case 1: ++ rk3308->which_i2s = ACODEC_TO_I2S1_2CH; ++ break; ++ case 2: ++ rk3308->which_i2s = ACODEC_TO_I2S3_4CH; ++ break; ++ case 4: ++ rk3308->which_i2s = ACODEC_TO_I2S2_8CH; ++ break; ++ default: ++ dev_err(rk3308->plat_dev, "Invalid i2s sdis num: %d\n", num); ++ ret = -EINVAL; ++ goto err; ++ } ++ ++ for (i = 0; i < num; i++) { ++ if (rk3308->i2s_sdis[i] > ADC_LR_GROUP_MAX - 1) { ++ dev_err(rk3308->plat_dev, ++ "i2s_sdis[%d]: %d is overflow\n", ++ i, rk3308->i2s_sdis[i]); ++ ret = -EINVAL; ++ goto err; ++ } ++ ++ for (j = 0; j < num; j++) { ++ if (i == j) ++ continue; ++ ++ if (rk3308->i2s_sdis[i] == rk3308->i2s_sdis[j]) { ++ dev_err(rk3308->plat_dev, ++ "Invalid i2s_sdis: [%d]%d == [%d]%d\n", ++ i, rk3308->i2s_sdis[i], ++ j, rk3308->i2s_sdis[j]); ++ ret = -EINVAL; ++ goto err; ++ } ++ } ++ } ++ ++err: ++ return ret; ++} ++ ++static int rk3308_codec_adc_grps_route_config(struct rk3308_codec_priv *rk3308) ++{ ++ int idx = 0; ++ ++ if (rk3308->which_i2s == ACODEC_TO_I2S2_8CH) { ++ for (idx = 0; idx < rk3308->to_i2s_grps; idx++) { ++ regmap_write(rk3308->grf, GRF_SOC_CON1, ++ GRF_I2S2_8CH_SDI(idx, rk3308->i2s_sdis[idx])); ++ } ++ } else if (rk3308->which_i2s == ACODEC_TO_I2S3_4CH) { ++ for (idx = 0; idx < rk3308->to_i2s_grps; idx++) { ++ regmap_write(rk3308->grf, GRF_SOC_CON1, ++ GRF_I2S3_4CH_SDI(idx, rk3308->i2s_sdis[idx])); ++ } ++ } else if (rk3308->which_i2s == ACODEC_TO_I2S1_2CH) { ++ regmap_write(rk3308->grf, GRF_SOC_CON1, ++ GRF_I2S1_2CH_SDI(rk3308->i2s_sdis[idx])); ++ } ++ ++ return 0; ++} ++ ++/* Put default one-to-one mapping */ ++static int rk3308_codec_adc_grps_route_default(struct rk3308_codec_priv *rk3308) ++{ ++ unsigned int idx; ++ ++ /* ++ * The GRF values may be kept the previous status after hot reboot, ++ * if the property 'rockchip,adc-grps-route' is not set, we need to ++ * recover default the order of sdi/sdo for i2s2_8ch/i2s3_8ch/i2s1_2ch. ++ */ ++ regmap_write(rk3308->grf, GRF_SOC_CON1, ++ GRF_I2S1_2CH_SDI(0)); ++ ++ for (idx = 0; idx < 2; idx++) { ++ regmap_write(rk3308->grf, GRF_SOC_CON1, ++ GRF_I2S3_4CH_SDI(idx, idx)); ++ } ++ ++ /* Using i2s2_8ch by default. */ ++ rk3308->which_i2s = ACODEC_TO_I2S2_8CH; ++ rk3308->to_i2s_grps = ADC_LR_GROUP_MAX; ++ ++ for (idx = 0; idx < ADC_LR_GROUP_MAX; idx++) { ++ rk3308->i2s_sdis[idx] = idx; ++ regmap_write(rk3308->grf, GRF_SOC_CON1, ++ GRF_I2S2_8CH_SDI(idx, idx)); ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_adc_grps_route(struct rk3308_codec_priv *rk3308, ++ struct device_node *np) ++{ ++ int num, ret; ++ ++ num = of_count_phandle_with_args(np, "rockchip,adc-grps-route", NULL); ++ if (num < 0) { ++ if (num == -ENOENT) { ++ /* Not use 'rockchip,adc-grps-route' property here */ ++ rk3308_codec_adc_grps_route_default(rk3308); ++ ret = 0; ++ } else { ++ dev_err(rk3308->plat_dev, ++ "Failed to read 'rockchip,adc-grps-route' num: %d\n", ++ num); ++ ret = num; ++ } ++ return ret; ++ } ++ ++ ret = of_property_read_u32_array(np, "rockchip,adc-grps-route", ++ rk3308->i2s_sdis, num); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, ++ "Failed to read 'rockchip,adc-grps-route': %d\n", ++ ret); ++ return ret; ++ } ++ ++ ret = rk3308_codec_check_i2s_sdis(rk3308, num); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, ++ "Failed to check i2s_sdis: %d\n", ret); ++ return ret; ++ } ++ ++ rk3308->to_i2s_grps = num; ++ ++ rk3308_codec_adc_grps_route_config(rk3308); ++ ++ return 0; ++} ++ ++static int check_micbias(int micbias) ++{ ++ switch (micbias) { ++ case RK3308_ADC_MICBIAS_VOLT_0_85: ++ case RK3308_ADC_MICBIAS_VOLT_0_8: ++ case RK3308_ADC_MICBIAS_VOLT_0_75: ++ case RK3308_ADC_MICBIAS_VOLT_0_7: ++ case RK3308_ADC_MICBIAS_VOLT_0_65: ++ case RK3308_ADC_MICBIAS_VOLT_0_6: ++ case RK3308_ADC_MICBIAS_VOLT_0_55: ++ case RK3308_ADC_MICBIAS_VOLT_0_5: ++ return 0; ++ } ++ ++ return -EINVAL; ++} ++ ++static bool handle_loopback(struct rk3308_codec_priv *rk3308) ++{ ++ /* The version B doesn't need to handle loopback. */ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) ++ return false; ++ ++ switch (rk3308->loopback_grp) { ++ case 0: ++ case 1: ++ case 2: ++ case 3: ++ return true; ++ } ++ ++ return false; ++} ++ ++static bool has_en_always_grps(struct rk3308_codec_priv *rk3308) ++{ ++ int idx; ++ ++ if (rk3308->en_always_grps_num) { ++ for (idx = 0; idx < ADC_LR_GROUP_MAX; idx++) { ++ if (rk3308->en_always_grps[idx] >= 0 && ++ rk3308->en_always_grps[idx] <= ADC_LR_GROUP_MAX - 1) ++ return true; ++ } ++ } ++ ++ return false; ++} ++ ++static int rk3308_codec_micbias_enable(struct rk3308_codec_priv *rk3308, ++ int micbias) ++{ ++ int ret; ++ ++ if (rk3308->ext_micbias != EXT_MICBIAS_NONE) ++ return 0; ++ ++ /* 0. Power up the ACODEC and keep the AVDDH stable */ ++ ++ /* Step 1. Configure ACODEC_ADC_ANA_CON7[2:0] to the certain value */ ++ ret = check_micbias(micbias); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, "This is an invalid micbias: %d\n", ++ micbias); ++ return ret; ++ } ++ ++ /* ++ * Note: Only the reg (ADC_ANA_CON7+0x0)[2:0] represent the level range ++ * control signal of MICBIAS voltage ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(0), ++ RK3308_ADC_LEVEL_RANGE_MICBIAS_MSK, ++ micbias); ++ ++ /* Step 2. Wait until the VCMH keep stable */ ++ msleep(20); /* estimated value */ ++ ++ /* ++ * Step 3. Configure ACODEC_ADC_ANA_CON8[4] to 0x1 ++ * ++ * Note: Only the reg (ADC_ANA_CON8+0x0)[4] represent the enable ++ * signal of current source for MICBIAS ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON08(0), ++ RK3308_ADC_MICBIAS_CURRENT_MSK, ++ RK3308_ADC_MICBIAS_CURRENT_EN); ++ ++ /* ++ * Step 4. Configure the (ADC_ANA_CON7+0x40)[3] or ++ * (ADC_ANA_CON7+0x80)[3] to 0x1. ++ * ++ * (ADC_ANA_CON7+0x40)[3] used to control the MICBIAS1, and ++ * (ADC_ANA_CON7+0x80)[3] used to control the MICBIAS2 ++ */ ++ if (rk3308->micbias1) ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(1), ++ RK3308_ADC_MIC_BIAS_BUF_EN, ++ RK3308_ADC_MIC_BIAS_BUF_EN); ++ ++ if (rk3308->micbias2) ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(2), ++ RK3308_ADC_MIC_BIAS_BUF_EN, ++ RK3308_ADC_MIC_BIAS_BUF_EN); ++ ++ /* waiting micbias stabled*/ ++ mdelay(50); ++ ++ rk3308->enable_micbias = true; ++ ++ return 0; ++} ++ ++static int rk3308_codec_micbias_disable(struct rk3308_codec_priv *rk3308) ++{ ++ if (rk3308->ext_micbias != EXT_MICBIAS_NONE) ++ return 0; ++ ++ /* Step 0. Enable the MICBIAS and keep the Audio Codec stable */ ++ /* Do nothing */ ++ ++ /* ++ * Step 1. Configure the (ADC_ANA_CON7+0x40)[3] or ++ * (ADC_ANA_CON7+0x80)[3] to 0x0 ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(1), ++ RK3308_ADC_MIC_BIAS_BUF_EN, ++ RK3308_ADC_MIC_BIAS_BUF_DIS); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(2), ++ RK3308_ADC_MIC_BIAS_BUF_EN, ++ RK3308_ADC_MIC_BIAS_BUF_DIS); ++ ++ /* ++ * Step 2. Configure ACODEC_ADC_ANA_CON8[4] to 0x0 ++ * ++ * Note: Only the reg (ADC_ANA_CON8+0x0)[4] represent the enable ++ * signal of current source for MICBIAS ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON08(0), ++ RK3308_ADC_MICBIAS_CURRENT_MSK, ++ RK3308_ADC_MICBIAS_CURRENT_DIS); ++ ++ rk3308->enable_micbias = false; ++ ++ return 0; ++} ++ ++static int rk3308_codec_adc_reinit_mics(struct rk3308_codec_priv *rk3308, ++ int type) ++{ ++ int idx, grp; ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 1 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(grp), ++ RK3308_ADC_CH1_ADC_WORK | ++ RK3308_ADC_CH2_ADC_WORK, ++ RK3308_ADC_CH1_ADC_INIT | ++ RK3308_ADC_CH2_ADC_INIT); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 2 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(grp), ++ RK3308_ADC_CH1_ALC_WORK | ++ RK3308_ADC_CH2_ALC_WORK, ++ RK3308_ADC_CH1_ALC_INIT | ++ RK3308_ADC_CH2_ALC_INIT); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 3 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(grp), ++ RK3308_ADC_CH1_MIC_WORK | ++ RK3308_ADC_CH2_MIC_WORK, ++ RK3308_ADC_CH1_MIC_INIT | ++ RK3308_ADC_CH2_MIC_INIT); ++ } ++ ++ usleep_range(200, 250); /* estimated value */ ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 1 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(grp), ++ RK3308_ADC_CH1_ADC_WORK | ++ RK3308_ADC_CH2_ADC_WORK, ++ RK3308_ADC_CH1_ADC_WORK | ++ RK3308_ADC_CH2_ADC_WORK); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 2 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(grp), ++ RK3308_ADC_CH1_ALC_WORK | ++ RK3308_ADC_CH2_ALC_WORK, ++ RK3308_ADC_CH1_ALC_WORK | ++ RK3308_ADC_CH2_ALC_WORK); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 3 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(grp), ++ RK3308_ADC_CH1_MIC_WORK | ++ RK3308_ADC_CH2_MIC_WORK, ++ RK3308_ADC_CH1_MIC_WORK | ++ RK3308_ADC_CH2_MIC_WORK); ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_adc_ana_enable(struct rk3308_codec_priv *rk3308, ++ int type) ++{ ++ unsigned int agc_func_en; ++ int idx, grp; ++ ++ /* ++ * 1. Set the ACODEC_ADC_ANA_CON7[7:6] and ACODEC_ADC_ANA_CON7[5:4], ++ * to select the line-in or microphone as input of ADC ++ * ++ * Note1. Please ignore the step1 for enabling ADC3, ADC4, ADC5, ++ * ADC6, ADC7, and ADC8 ++ */ ++ if (rk3308->adc_grp0_using_linein) { ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(0), ++ RK3308_ADC_CH1_IN_SEL_MSK | ++ RK3308_ADC_CH2_IN_SEL_MSK, ++ RK3308_ADC_CH1_IN_LINEIN | ++ RK3308_ADC_CH2_IN_LINEIN); ++ ++ /* Keep other ADCs as MIC-IN */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ /* The groups without line-in are >= 1 */ ++ if (grp < 1 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_ANA_CON07(grp), ++ RK3308_ADC_CH1_IN_SEL_MSK | ++ RK3308_ADC_CH2_IN_SEL_MSK, ++ RK3308_ADC_CH1_IN_MIC | ++ RK3308_ADC_CH2_IN_MIC); ++ } ++ } else { ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_ANA_CON07(grp), ++ RK3308_ADC_CH1_IN_SEL_MSK | ++ RK3308_ADC_CH2_IN_SEL_MSK, ++ RK3308_ADC_CH1_IN_MIC | ++ RK3308_ADC_CH2_IN_MIC); ++ } ++ } ++ ++ /* ++ * 2. Set ACODEC_ADC_ANA_CON0[7] and [3] to 0x1, to end the mute station ++ * of ADC, to enable the MIC module, to enable the reference voltage ++ * buffer, and to end the initialization of MIC ++ */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(grp), ++ RK3308_ADC_CH1_MIC_UNMUTE | ++ RK3308_ADC_CH2_MIC_UNMUTE, ++ RK3308_ADC_CH1_MIC_UNMUTE | ++ RK3308_ADC_CH2_MIC_UNMUTE); ++ } ++ ++ /* ++ * 3. Set ACODEC_ADC_ANA_CON6[0] to 0x1, to enable the current source ++ * of audio ++ */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON06(grp), ++ RK3308_ADC_CURRENT_MSK, ++ RK3308_ADC_CURRENT_EN); ++ } ++ ++ /* ++ * This is mainly used for BIST mode that wait ADCs are stable. ++ * ++ * By tested results, the type delay is >40us, but we need to leave ++ * enough delay margin. ++ */ ++ usleep_range(400, 500); ++ ++ /* vendor step 4*/ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(grp), ++ RK3308_ADC_CH1_BUF_REF_EN | ++ RK3308_ADC_CH2_BUF_REF_EN, ++ RK3308_ADC_CH1_BUF_REF_EN | ++ RK3308_ADC_CH2_BUF_REF_EN); ++ } ++ ++ /* vendor step 5 */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(grp), ++ RK3308_ADC_CH1_MIC_EN | ++ RK3308_ADC_CH2_MIC_EN, ++ RK3308_ADC_CH1_MIC_EN | ++ RK3308_ADC_CH2_MIC_EN); ++ } ++ ++ /* vendor step 6 */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(grp), ++ RK3308_ADC_CH1_ALC_EN | ++ RK3308_ADC_CH2_ALC_EN, ++ RK3308_ADC_CH1_ALC_EN | ++ RK3308_ADC_CH2_ALC_EN); ++ } ++ ++ /* vendor step 7 */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(grp), ++ RK3308_ADC_CH1_CLK_EN | ++ RK3308_ADC_CH2_CLK_EN, ++ RK3308_ADC_CH1_CLK_EN | ++ RK3308_ADC_CH2_CLK_EN); ++ } ++ ++ /* vendor step 8 */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(grp), ++ RK3308_ADC_CH1_ADC_EN | ++ RK3308_ADC_CH2_ADC_EN, ++ RK3308_ADC_CH1_ADC_EN | ++ RK3308_ADC_CH2_ADC_EN); ++ } ++ ++ /* vendor step 9 */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(grp), ++ RK3308_ADC_CH1_ADC_WORK | ++ RK3308_ADC_CH2_ADC_WORK, ++ RK3308_ADC_CH1_ADC_WORK | ++ RK3308_ADC_CH2_ADC_WORK); ++ } ++ ++ /* vendor step 10 */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(grp), ++ RK3308_ADC_CH1_ALC_WORK | ++ RK3308_ADC_CH2_ALC_WORK, ++ RK3308_ADC_CH1_ALC_WORK | ++ RK3308_ADC_CH2_ALC_WORK); ++ } ++ ++ /* vendor step 11 */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(grp), ++ RK3308_ADC_CH1_MIC_WORK | ++ RK3308_ADC_CH2_MIC_WORK, ++ RK3308_ADC_CH1_MIC_WORK | ++ RK3308_ADC_CH2_MIC_WORK); ++ } ++ ++ /* vendor step 12 */ ++ ++ /* vendor step 13 */ ++ ++ /* vendor step 14 */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_read(rk3308->regmap, RK3308_ALC_L_DIG_CON09(grp), ++ &agc_func_en); ++ if (rk3308->adc_zerocross || ++ agc_func_en & RK3308_AGC_FUNC_SEL_EN) { ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_ANA_CON02(grp), ++ RK3308_ADC_CH1_ZEROCROSS_DET_EN, ++ RK3308_ADC_CH1_ZEROCROSS_DET_EN); ++ } ++ regmap_read(rk3308->regmap, RK3308_ALC_R_DIG_CON09(grp), ++ &agc_func_en); ++ if (rk3308->adc_zerocross || ++ agc_func_en & RK3308_AGC_FUNC_SEL_EN) { ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_ANA_CON02(grp), ++ RK3308_ADC_CH2_ZEROCROSS_DET_EN, ++ RK3308_ADC_CH2_ZEROCROSS_DET_EN); ++ } ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ rk3308->adc_grps_endisable[grp] = true; ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_adc_ana_disable(struct rk3308_codec_priv *rk3308, ++ int type) ++{ ++ int idx, grp; ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 1 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(grp), ++ RK3308_ADC_CH1_ZEROCROSS_DET_EN | ++ RK3308_ADC_CH2_ZEROCROSS_DET_EN, ++ RK3308_ADC_CH1_ZEROCROSS_DET_DIS | ++ RK3308_ADC_CH2_ZEROCROSS_DET_DIS); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 2 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(grp), ++ RK3308_ADC_CH1_ADC_EN | ++ RK3308_ADC_CH2_ADC_EN, ++ RK3308_ADC_CH1_ADC_DIS | ++ RK3308_ADC_CH2_ADC_DIS); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 3 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(grp), ++ RK3308_ADC_CH1_CLK_EN | ++ RK3308_ADC_CH2_CLK_EN, ++ RK3308_ADC_CH1_CLK_DIS | ++ RK3308_ADC_CH2_CLK_DIS); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 4 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(grp), ++ RK3308_ADC_CH1_ALC_EN | ++ RK3308_ADC_CH2_ALC_EN, ++ RK3308_ADC_CH1_ALC_DIS | ++ RK3308_ADC_CH2_ALC_DIS); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 5 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(grp), ++ RK3308_ADC_CH1_MIC_EN | ++ RK3308_ADC_CH2_MIC_EN, ++ RK3308_ADC_CH1_MIC_DIS | ++ RK3308_ADC_CH2_MIC_DIS); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 6 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(grp), ++ RK3308_ADC_CH1_BUF_REF_EN | ++ RK3308_ADC_CH2_BUF_REF_EN, ++ RK3308_ADC_CH1_BUF_REF_DIS | ++ RK3308_ADC_CH2_BUF_REF_DIS); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 7 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON06(grp), ++ RK3308_ADC_CURRENT_MSK, ++ RK3308_ADC_CURRENT_DIS); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 8 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(grp), ++ RK3308_ADC_CH1_ADC_WORK | ++ RK3308_ADC_CH2_ADC_WORK, ++ RK3308_ADC_CH1_ADC_INIT | ++ RK3308_ADC_CH2_ADC_INIT); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 9 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(grp), ++ RK3308_ADC_CH1_ALC_WORK | ++ RK3308_ADC_CH2_ALC_WORK, ++ RK3308_ADC_CH1_ALC_INIT | ++ RK3308_ADC_CH2_ALC_INIT); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 10 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(grp), ++ RK3308_ADC_CH1_MIC_WORK | ++ RK3308_ADC_CH2_MIC_WORK, ++ RK3308_ADC_CH1_MIC_INIT | ++ RK3308_ADC_CH2_MIC_INIT); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ rk3308->adc_grps_endisable[grp] = false; ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_open_capture(struct rk3308_codec_priv *rk3308) ++{ ++ int idx, grp = 0; ++ int type = ADC_TYPE_NORMAL; ++ ++ rk3308_codec_adc_ana_enable(rk3308, type); ++ rk3308_codec_adc_reinit_mics(rk3308, type); ++ ++ if (rk3308->adc_grp0_using_linein) { ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON03(0), ++ RK3308_ADC_L_CH_BIST_MSK, ++ RK3308_ADC_L_CH_NORMAL_RIGHT); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON03(0), ++ RK3308_ADC_R_CH_BIST_MSK, ++ RK3308_ADC_R_CH_NORMAL_LEFT); ++ } else { ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (handle_loopback(rk3308) && ++ idx == rk3308->loopback_grp && ++ grp == ADC_GRP_SKIP_MAGIC) { ++ /* ++ * Switch to dummy BIST mode (BIST keep reset ++ * now) to keep the zero input data in I2S bus. ++ * ++ * It may cause the glitch if we hold the ADC ++ * digtital i2s module in codec. ++ * ++ * Then, the grp which is set from loopback_grp. ++ */ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(rk3308->loopback_grp), ++ RK3308_ADC_L_CH_BIST_MSK, ++ RK3308_ADC_L_CH_BIST_SINE); ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(rk3308->loopback_grp), ++ RK3308_ADC_R_CH_BIST_MSK, ++ RK3308_ADC_R_CH_BIST_SINE); ++ } else { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_L_CH_BIST_MSK, ++ RK3308_ADC_L_CH_NORMAL_LEFT); ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_R_CH_BIST_MSK, ++ RK3308_ADC_R_CH_NORMAL_RIGHT); ++ } ++ } ++ } ++ ++ return 0; ++} ++ ++static void rk3308_codec_adc_mclk_disable(struct rk3308_codec_priv *rk3308) ++{ ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_ADC_MCLK_MSK, ++ RK3308_ADC_MCLK_DIS); ++} ++ ++static void rk3308_codec_adc_mclk_enable(struct rk3308_codec_priv *rk3308) ++{ ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_ADC_MCLK_MSK, ++ RK3308_ADC_MCLK_EN); ++ udelay(20); ++} ++ ++static void rk3308_codec_dac_mclk_disable(struct rk3308_codec_priv *rk3308) ++{ ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_DAC_MCLK_MSK, ++ RK3308_DAC_MCLK_DIS); ++} ++ ++static void rk3308_codec_dac_mclk_enable(struct rk3308_codec_priv *rk3308) ++{ ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_DAC_MCLK_MSK, ++ RK3308_DAC_MCLK_EN); ++ udelay(20); ++} ++ ++static int rk3308_codec_open_dbg_capture(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_adc_ana_enable(rk3308, ADC_TYPE_DBG); ++ ++ return 0; ++} ++ ++static int rk3308_codec_close_dbg_capture(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_adc_ana_disable(rk3308, ADC_TYPE_DBG); ++ ++ return 0; ++} ++ ++static int rk3308_codec_close_all_capture(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_adc_ana_disable(rk3308, ADC_TYPE_ALL); ++ ++ return 0; ++} ++ ++static int rk3308_codec_close_capture(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_adc_ana_disable(rk3308, ADC_TYPE_NORMAL); ++ ++ return 0; ++} ++ ++static int rk3308_codec_open_playback(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_dac_enable(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_codec_close_playback(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_dac_disable(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_codec_llp_down(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_adc_mclk_disable(rk3308); ++ rk3308_codec_dac_mclk_disable(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_codec_llp_up(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_adc_mclk_enable(rk3308); ++ rk3308_codec_dac_mclk_enable(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_codec_dlp_down(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_micbias_disable(rk3308); ++ rk3308_codec_power_off(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_codec_dlp_up(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_power_on(rk3308); ++ rk3308_codec_micbias_enable(rk3308, rk3308->micbias_volt); ++ ++ return 0; ++} ++ ++/* Just used for debug and trace power state */ ++static void rk3308_codec_set_pm_state(struct rk3308_codec_priv *rk3308, ++ int pm_state) ++{ ++ int ret; ++ ++ switch (pm_state) { ++ case PM_LLP_DOWN: ++ rk3308_codec_llp_down(rk3308); ++ break; ++ case PM_LLP_UP: ++ rk3308_codec_llp_up(rk3308); ++ break; ++ case PM_DLP_DOWN: ++ rk3308_codec_dlp_down(rk3308); ++ break; ++ case PM_DLP_UP: ++ rk3308_codec_dlp_up(rk3308); ++ break; ++ case PM_DLP_DOWN2: ++ clk_disable_unprepare(rk3308->mclk_rx); ++ clk_disable_unprepare(rk3308->mclk_tx); ++ clk_disable_unprepare(rk3308->pclk); ++ break; ++ case PM_DLP_UP2: ++ ret = clk_prepare_enable(rk3308->pclk); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, ++ "Failed to enable acodec pclk: %d\n", ret); ++ goto err; ++ } ++ ++ ret = clk_prepare_enable(rk3308->mclk_rx); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, ++ "Failed to enable i2s mclk_rx: %d\n", ret); ++ goto err; ++ } ++ ++ ret = clk_prepare_enable(rk3308->mclk_tx); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, ++ "Failed to enable i2s mclk_tx: %d\n", ret); ++ goto err; ++ } ++ break; ++ default: ++ dev_err(rk3308->plat_dev, "Invalid pm_state: %d\n", pm_state); ++ goto err; ++ } ++ ++ rk3308->pm_state = pm_state; ++ ++err: ++ return; ++} ++ ++static void rk3308_codec_update_adcs_status(struct rk3308_codec_priv *rk3308, ++ int state) ++{ ++ int idx, grp; ++ ++ /* Update skip_grps flags if the ADCs need to be enabled always. */ ++ if (state == PATH_BUSY) { ++ for (idx = 0; idx < rk3308->used_adc_grps; idx++) { ++ u32 mapped_grp = to_mapped_grp(rk3308, idx); ++ ++ for (grp = 0; grp < rk3308->en_always_grps_num; grp++) { ++ u32 en_always_grp = rk3308->en_always_grps[grp]; ++ ++ if (mapped_grp == en_always_grp) ++ rk3308->skip_grps[en_always_grp] = 1; ++ } ++ } ++ } ++} ++ ++static int rk3308_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_codec *codec = dai->codec; ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_pcm_str *playback_str = ++ &substream->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK]; ++ int type = ADC_TYPE_LOOPBACK; ++ int idx, grp; ++ int ret; ++ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ /* DAC only supports 2 channels */ ++ rk3308_codec_dac_mclk_enable(rk3308); ++ rk3308_codec_open_playback(rk3308); ++ rk3308_codec_dac_dig_config(rk3308, params); ++ rk3308_codec_set_dac_path_state(rk3308, PATH_BUSY); ++ } else { ++ if (rk3308->micbias_num && ++ !rk3308->enable_micbias) ++ rk3308_codec_micbias_enable(rk3308, rk3308->micbias_volt); ++ ++ rk3308_codec_adc_mclk_enable(rk3308); ++ ret = rk3308_codec_update_adc_grps(rk3308, params); ++ if (ret < 0) ++ return ret; ++ ++ if (handle_loopback(rk3308)) { ++ if (rk3308->micbias_num && ++ (params_channels(params) == 2) && ++ to_mapped_grp(rk3308, 0) == rk3308->loopback_grp) ++ rk3308_codec_micbias_disable(rk3308); ++ ++ /* Check the DACs are opened */ ++ if (playback_str->substream_opened) { ++ rk3308->loopback_dacs_enabled = true; ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_L_CH_BIST_MSK, ++ RK3308_ADC_L_CH_NORMAL_LEFT); ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_R_CH_BIST_MSK, ++ RK3308_ADC_R_CH_NORMAL_RIGHT); ++ } ++ } else { ++ rk3308->loopback_dacs_enabled = false; ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_L_CH_BIST_MSK, ++ RK3308_ADC_L_CH_BIST_SINE); ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_R_CH_BIST_MSK, ++ RK3308_ADC_R_CH_BIST_SINE); ++ } ++ } ++ } ++ ++ rk3308_codec_open_capture(rk3308); ++ rk3308_codec_adc_dig_config(rk3308, params); ++ rk3308_codec_update_adcs_status(rk3308, PATH_BUSY); ++ } ++ ++ return 0; ++} ++ ++static int rk3308_pcm_trigger(struct snd_pcm_substream *substream, ++ int cmd, struct snd_soc_dai *dai) ++{ ++ struct snd_soc_codec *codec = dai->codec; ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ int type = ADC_TYPE_LOOPBACK; ++ int idx, grp; ++ ++ if (handle_loopback(rk3308) && ++ rk3308->dac_output == DAC_LINEOUT && ++ substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ if (cmd == SNDRV_PCM_TRIGGER_START) { ++ struct snd_pcm_str *capture_str = ++ &substream->pcm->streams[SNDRV_PCM_STREAM_CAPTURE]; ++ ++ if (capture_str->substream_opened) ++ queue_delayed_work(system_power_efficient_wq, ++ &rk3308->loopback_work, ++ msecs_to_jiffies(rk3308->delay_loopback_handle_ms)); ++ } else if (cmd == SNDRV_PCM_TRIGGER_STOP) { ++ /* ++ * Switch to dummy bist mode to kick the glitch during disable ++ * ADCs and keep zero input data ++ */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_L_CH_BIST_MSK, ++ RK3308_ADC_L_CH_BIST_SINE); ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_R_CH_BIST_MSK, ++ RK3308_ADC_R_CH_BIST_SINE); ++ } ++ rk3308_codec_adc_ana_disable(rk3308, ADC_TYPE_LOOPBACK); ++ } ++ } ++ ++ return 0; ++} ++ ++static void rk3308_pcm_shutdown(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_codec *codec = dai->codec; ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ rk3308_codec_close_playback(rk3308); ++ rk3308_codec_dac_mclk_disable(rk3308); ++ regcache_cache_only(rk3308->regmap, false); ++ regcache_sync(rk3308->regmap); ++ rk3308_codec_set_dac_path_state(rk3308, PATH_IDLE); ++ } else { ++ rk3308_codec_close_capture(rk3308); ++ if (!has_en_always_grps(rk3308)) { ++ rk3308_codec_adc_mclk_disable(rk3308); ++ rk3308_codec_update_adcs_status(rk3308, PATH_IDLE); ++ if (rk3308->micbias_num && ++ rk3308->enable_micbias) ++ rk3308_codec_micbias_disable(rk3308); ++ } ++ ++ regcache_cache_only(rk3308->regmap, false); ++ regcache_sync(rk3308->regmap); ++ } ++} ++ ++static struct snd_soc_dai_ops rk3308_dai_ops = { ++ .hw_params = rk3308_hw_params, ++ .set_fmt = rk3308_set_dai_fmt, ++ .mute_stream = rk3308_mute_stream, ++ .trigger = rk3308_pcm_trigger, ++ .shutdown = rk3308_pcm_shutdown, ++}; ++ ++static struct snd_soc_dai_driver rk3308_dai[] = { ++ { ++ .name = "rk3308-hifi", ++ .id = RK3308_HIFI, ++ .playback = { ++ .stream_name = "HiFi Playback", ++ .channels_min = 2, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_8000_192000, ++ .formats = (SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S20_3LE | ++ SNDRV_PCM_FMTBIT_S24_LE | ++ SNDRV_PCM_FMTBIT_S32_LE), ++ }, ++ .capture = { ++ .stream_name = "HiFi Capture", ++ .channels_min = 1, ++ .channels_max = 8, ++ .rates = SNDRV_PCM_RATE_8000_192000, ++ .formats = (SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S20_3LE | ++ SNDRV_PCM_FMTBIT_S24_LE | ++ SNDRV_PCM_FMTBIT_S32_LE), ++ }, ++ .ops = &rk3308_dai_ops, ++ }, ++}; ++ ++static int rk3308_suspend(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ if (rk3308->no_deep_low_power) ++ goto out; ++ ++ rk3308_codec_dlp_down(rk3308); ++ clk_disable_unprepare(rk3308->mclk_rx); ++ clk_disable_unprepare(rk3308->mclk_tx); ++ clk_disable_unprepare(rk3308->pclk); ++ ++out: ++ rk3308_set_bias_level(codec, SND_SOC_BIAS_OFF); ++ return 0; ++} ++ ++static int rk3308_resume(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ int ret = 0; ++ ++ if (rk3308->no_deep_low_power) ++ goto out; ++ ++ ret = clk_prepare_enable(rk3308->pclk); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, ++ "Failed to enable acodec pclk: %d\n", ret); ++ goto out; ++ } ++ ++ ret = clk_prepare_enable(rk3308->mclk_rx); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, ++ "Failed to enable i2s mclk_rx: %d\n", ret); ++ goto out; ++ } ++ ++ ret = clk_prepare_enable(rk3308->mclk_tx); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, ++ "Failed to enable i2s mclk_tx: %d\n", ret); ++ goto out; ++ } ++ ++ rk3308_codec_dlp_up(rk3308); ++out: ++ rk3308_set_bias_level(codec, SND_SOC_BIAS_STANDBY); ++ return ret; ++} ++ ++static int rk3308_codec_default_gains(struct rk3308_codec_priv *rk3308) ++{ ++ int grp; ++ ++ /* Prepare ADC gains */ ++ /* vendor step 12, set MIC PGA default gains */ ++ for (grp = 0; grp < ADC_LR_GROUP_MAX; grp++) { ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON01(grp), ++ RK3308_ADC_CH1_MIC_GAIN_MSK | ++ RK3308_ADC_CH2_MIC_GAIN_MSK, ++ RK3308_ADC_CH1_MIC_GAIN_0DB | ++ RK3308_ADC_CH2_MIC_GAIN_0DB); ++ } ++ ++ /* vendor step 13, set ALC default gains */ ++ for (grp = 0; grp < ADC_LR_GROUP_MAX; grp++) { ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON03(grp), ++ RK3308_ADC_CH1_ALC_GAIN_MSK, ++ RK3308_ADC_CH1_ALC_GAIN_0DB); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON04(grp), ++ RK3308_ADC_CH2_ALC_GAIN_MSK, ++ RK3308_ADC_CH2_ALC_GAIN_0DB); ++ } ++ ++ /* Prepare DAC gains */ ++ /* Step 15, set HPMIX default gains */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, ++ RK3308_DAC_L_HPMIX_GAIN_MSK | ++ RK3308_DAC_R_HPMIX_GAIN_MSK, ++ RK3308_DAC_L_HPMIX_GAIN_NDB_6 | ++ RK3308_DAC_R_HPMIX_GAIN_NDB_6); ++ ++ /* Step 18, set HPOUT default gains */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON05, ++ RK3308_DAC_L_HPOUT_GAIN_MSK, ++ RK3308_DAC_L_HPOUT_GAIN_NDB_39); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON06, ++ RK3308_DAC_R_HPOUT_GAIN_MSK, ++ RK3308_DAC_R_HPOUT_GAIN_NDB_39); ++ ++ /* Using the same gain to HPOUT LR channels */ ++ rk3308->hpout_l_dgain = RK3308_DAC_L_HPOUT_GAIN_NDB_39; ++ ++ /* Step 19, set LINEOUT default gains */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_GAIN_MSK | ++ RK3308_DAC_R_LINEOUT_GAIN_MSK, ++ RK3308_DAC_L_LINEOUT_GAIN_NDB_6 | ++ RK3308_DAC_R_LINEOUT_GAIN_NDB_6); ++ ++ return 0; ++} ++ ++static int rk3308_codec_setup_en_always_adcs(struct rk3308_codec_priv *rk3308, ++ struct device_node *np) ++{ ++ int num, ret; ++ ++ num = of_count_phandle_with_args(np, "rockchip,en-always-grps", NULL); ++ if (num < 0) { ++ if (num == -ENOENT) { ++ /* ++ * If there is note use 'rockchip,en-always-grps' ++ * property, return 0 is also right. ++ */ ++ ret = 0; ++ } else { ++ dev_err(rk3308->plat_dev, ++ "Failed to read 'rockchip,adc-grps-route' num: %d\n", ++ num); ++ ret = num; ++ } ++ ++ rk3308->en_always_grps_num = 0; ++ return ret; ++ } ++ ++ rk3308->en_always_grps_num = num; ++ ++ ret = of_property_read_u32_array(np, "rockchip,en-always-grps", ++ rk3308->en_always_grps, num); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, ++ "Failed to read 'rockchip,en-always-grps': %d\n", ++ ret); ++ return ret; ++ } ++ ++ /* Clear all of skip_grps flags. */ ++ for (num = 0; num < ADC_LR_GROUP_MAX; num++) ++ rk3308->skip_grps[num] = 0; ++ ++ /* The loopback grp should not be enabled always. */ ++ for (num = 0; num < rk3308->en_always_grps_num; num++) { ++ if (rk3308->en_always_grps[num] == rk3308->loopback_grp) { ++ dev_err(rk3308->plat_dev, ++ "loopback_grp: %d should not be enabled always!\n", ++ rk3308->loopback_grp); ++ ret = -EINVAL; ++ return ret; ++ } ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_dapm_mic_gains(struct rk3308_codec_priv *rk3308) ++{ ++ int ret; ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ ret = snd_soc_add_codec_controls(rk3308->codec, ++ mic_gains_b, ++ ARRAY_SIZE(mic_gains_b)); ++ if (ret) { ++ dev_err(rk3308->plat_dev, ++ "%s: add mic_gains_b failed: %d\n", ++ __func__, ret); ++ return ret; ++ } ++ } else { ++ ret = snd_soc_add_codec_controls(rk3308->codec, ++ mic_gains_a, ++ ARRAY_SIZE(mic_gains_a)); ++ if (ret) { ++ dev_err(rk3308->plat_dev, ++ "%s: add mic_gains_a failed: %d\n", ++ __func__, ret); ++ return ret; ++ } ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_check_micbias(struct rk3308_codec_priv *rk3308, ++ struct device_node *np) ++{ ++ struct device *dev = (struct device *)rk3308->plat_dev; ++ int num = 0, ret; ++ ++ /* Check internal micbias */ ++ rk3308->micbias1 = ++ of_property_read_bool(np, "rockchip,micbias1"); ++ if (rk3308->micbias1) ++ num++; ++ ++ rk3308->micbias2 = ++ of_property_read_bool(np, "rockchip,micbias2"); ++ if (rk3308->micbias2) ++ num++; ++ ++ rk3308->micbias_volt = RK3308_ADC_MICBIAS_VOLT_0_85; /* by default */ ++ rk3308->micbias_num = num; ++ ++ /* Check external micbias */ ++ rk3308->ext_micbias = EXT_MICBIAS_NONE; ++ ++ rk3308->micbias_en_gpio = devm_gpiod_get_optional(dev, ++ "micbias-en", ++ GPIOD_IN); ++ if (!rk3308->micbias_en_gpio) { ++ dev_info(dev, "Don't need micbias-en gpio\n"); ++ } else if (IS_ERR(rk3308->micbias_en_gpio)) { ++ ret = PTR_ERR(rk3308->micbias_en_gpio); ++ dev_err(dev, "Unable to claim gpio micbias-en\n"); ++ return ret; ++ } else if (gpiod_get_value(rk3308->micbias_en_gpio)) { ++ rk3308->ext_micbias = EXT_MICBIAS_FUNC1; ++ } ++ ++ rk3308->vcc_micbias = devm_regulator_get_optional(dev, ++ "vmicbias"); ++ if (IS_ERR(rk3308->vcc_micbias)) { ++ if (PTR_ERR(rk3308->vcc_micbias) == -EPROBE_DEFER) ++ return -EPROBE_DEFER; ++ dev_info(dev, "no vmicbias regulator found\n"); ++ } else { ++ ret = regulator_enable(rk3308->vcc_micbias); ++ if (ret) { ++ dev_err(dev, "Can't enable vmicbias: %d\n", ret); ++ return ret; ++ } ++ rk3308->ext_micbias = EXT_MICBIAS_FUNC2; ++ } ++ ++ dev_info(dev, "Check ext_micbias: %d\n", rk3308->ext_micbias); ++ ++ return 0; ++} ++ ++static int rk3308_codec_dapm_controls_prepare(struct rk3308_codec_priv *rk3308) ++{ ++ int grp; ++ ++ for (grp = 0; grp < ADC_LR_GROUP_MAX; grp++) { ++ rk3308->hpf_cutoff[grp] = 0; ++ rk3308->agc_l[grp] = 0; ++ rk3308->agc_r[grp] = 0; ++ rk3308->agc_asr_l[grp] = AGC_ASR_96KHZ; ++ rk3308->agc_asr_r[grp] = AGC_ASR_96KHZ; ++ } ++ ++ rk3308_codec_dapm_mic_gains(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_codec_prepare(struct rk3308_codec_priv *rk3308) ++{ ++ /* Clear registers for ADC and DAC */ ++ rk3308_codec_close_playback(rk3308); ++ rk3308_codec_close_all_capture(rk3308); ++ rk3308_codec_default_gains(rk3308); ++ rk3308_codec_llp_down(rk3308); ++ rk3308_codec_dapm_controls_prepare(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_probe(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ int ext_micbias; ++ ++ rk3308->codec = codec; ++ rk3308_codec_set_dac_path_state(rk3308, PATH_IDLE); ++ ++ rk3308_codec_reset(codec); ++ rk3308_codec_power_on(rk3308); ++ ++ /* From vendor recommend, disable micbias at first. */ ++ ext_micbias = rk3308->ext_micbias; ++ rk3308->ext_micbias = EXT_MICBIAS_NONE; ++ rk3308_codec_micbias_disable(rk3308); ++ rk3308->ext_micbias = ext_micbias; ++ ++ rk3308_codec_prepare(rk3308); ++ if (!rk3308->no_hp_det) ++ rk3308_codec_headset_detect_enable(rk3308); ++ ++ regcache_cache_only(rk3308->regmap, false); ++ regcache_sync(rk3308->regmap); ++ ++ return 0; ++} + +- /* 5. Wait until the voltage of VCM keeps stable at the AGND */ +- usleep_range(200, 300); /* estimated value */ ++static int rk3308_remove(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ rk3308_headphone_ctl(rk3308, 0); ++ rk3308_speaker_ctl(rk3308, 0); ++ if (!rk3308->no_hp_det) ++ rk3308_codec_headset_detect_disable(rk3308); ++ rk3308_codec_micbias_disable(rk3308); ++ rk3308_codec_power_off(rk3308); + +- /* 6. Power off the analog power supply */ +- /* 7. Power off the digital power supply */ ++ rk3308_codec_set_dac_path_state(rk3308, PATH_IDLE); + +- /* Do something via hardware */ ++ regcache_cache_only(rk3308->regmap, false); ++ regcache_sync(rk3308->regmap); + + return 0; + } + +-static int check_micbias(int micbias) ++static struct snd_soc_codec_driver soc_codec_dev_rk3308 = { ++ .probe = rk3308_probe, ++ .remove = rk3308_remove, ++ .suspend = rk3308_suspend, ++ .resume = rk3308_resume, ++ .set_bias_level = rk3308_set_bias_level, ++ .controls = rk3308_codec_dapm_controls, ++ .num_controls = ARRAY_SIZE(rk3308_codec_dapm_controls), ++}; ++ ++static const struct reg_default rk3308_codec_reg_defaults[] = { ++ { RK3308_GLB_CON, 0x07 }, ++}; ++ ++static bool rk3308_codec_write_read_reg(struct device *dev, unsigned int reg) + { +- switch (micbias) { +- case RK3308_ADC_MICBIAS_VOLT_0_85: +- case RK3308_ADC_MICBIAS_VOLT_0_8: +- case RK3308_ADC_MICBIAS_VOLT_0_75: +- case RK3308_ADC_MICBIAS_VOLT_0_7: +- case RK3308_ADC_MICBIAS_VOLT_0_65: +- case RK3308_ADC_MICBIAS_VOLT_0_6: +- case RK3308_ADC_MICBIAS_VOLT_0_55: +- case RK3308_ADC_MICBIAS_VOLT_0_5: +- return 0; +- } ++ /* All registers can be read / write */ ++ return true; ++} + +- return -EINVAL; ++static bool rk3308_codec_volatile_reg(struct device *dev, unsigned int reg) ++{ ++ return true; + } + +-static int rk3308_codec_micbias_enable(struct rk3308_codec_priv *rk3308, +- int micbias) ++static void rk3308_codec_hpdetect_work(struct work_struct *work) + { +- int ch = rk3308->adc_ch; +- int ret; ++ struct rk3308_codec_priv *rk3308 = ++ container_of(work, struct rk3308_codec_priv, hpdet_work.work); ++ unsigned int val; ++ int need_poll = 0, need_irq = 0; ++ int need_report = 0, report_type = 0; ++ int dac_output = DAC_LINEOUT; ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* Check headphone plugged/unplugged directly. */ ++ regmap_read(rk3308->detect_grf, ++ DETECT_GRF_ACODEC_HPDET_STATUS, &val); ++ regmap_write(rk3308->detect_grf, ++ DETECT_GRF_ACODEC_HPDET_STATUS_CLR, val); ++ ++ if (rk3308->hp_jack_reversed) { ++ switch (val) { ++ case 0x0: ++ case 0x2: ++ dac_output = DAC_HPOUT; ++ report_type = SND_JACK_HEADPHONE; ++ break; ++ default: ++ break; ++ } ++ } else { ++ switch (val) { ++ case 0x1: ++ dac_output = DAC_HPOUT; ++ report_type = SND_JACK_HEADPHONE; ++ break; ++ default: ++ /* Includes val == 2 or others. */ ++ break; ++ } ++ } + +- if (ch != 1 && ch != 2) { +- dev_err(rk3308->plat_dev, +- "%s: currnet ch: %d, only ch1/2 control MICBIAS1/2\n", +- __func__, ch); +- return -EINVAL; +- } ++ rk3308_codec_dac_switch(rk3308, dac_output); ++ if (rk3308->hpdet_jack) ++ snd_soc_jack_report(rk3308->hpdet_jack, ++ report_type, ++ SND_JACK_HEADPHONE); + +- /* 1. Power up the ACODEC and keep the AVDDH stable */ ++ enable_irq(rk3308->irq); + +- /* 2. Configure ACODEC_ADC_ANA_CON7[2:0] to the certain value */ +- ret = check_micbias(micbias); +- if (ret < 0) { +- dev_err(rk3308->plat_dev, "This is an invalid micbias: %d\n", +- micbias); +- return ret; ++ return; + } + +- /* +- * Note: Only the reg (ADC_ANA_CON7+0x0)[2:0] represent the level range +- * control signal of MICBIAS voltage +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(0), +- RK3308_ADC_LEVEL_RANGE_MICBIAS_MSK, +- micbias); ++ /* Check headphone unplugged via poll. */ ++ regmap_read(rk3308->regmap, RK3308_DAC_DIG_CON14, &val); + +- /* 3. Wait until the VCMH keep stable */ +- usleep_range(200, 300); /* estimated value */ ++ if (rk3308->hp_jack_reversed) { ++ if (!val) { ++ rk3308->hp_plugged = true; ++ report_type = SND_JACK_HEADPHONE; + +- /* 4. Configure ACODEC_ADC_ANA_CON8[4] to 0x1 */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON08(ch), +- RK3308_ADC_MICBIAS_CURRENT_MSK, +- RK3308_ADC_MICBIAS_CURRENT_EN); ++ need_report = 1; ++ need_irq = 1; ++ } else { ++ if (rk3308->hp_plugged) { ++ rk3308->hp_plugged = false; ++ need_report = 1; ++ } ++ need_poll = 1; ++ } ++ } else { ++ if (!val) { ++ rk3308->hp_plugged = false; + +- /* +- * 5. Configure the (ADC_ANA_CON7+0x40)[3] or (ADC_ANA_CON7+0x80)[3] +- * to 0x1. +- * (ADC_ANA_CON7+0x40)[3] used to control the MICBIAS1, and +- * (ADC_ANA_CON7+0x80)[3] used to control the MICBIAS2 +- */ ++ need_report = 1; ++ need_irq = 1; ++ } else { ++ if (!rk3308->hp_plugged) { ++ rk3308->hp_plugged = true; ++ report_type = SND_JACK_HEADPHONE; ++ need_report = 1; ++ } ++ need_poll = 1; ++ } ++ } + +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), +- RK3308_ADC_MIC_BIAS_BUF_EN, +- RK3308_ADC_MIC_BIAS_BUF_EN); ++ if (need_poll) ++ queue_delayed_work(system_power_efficient_wq, ++ &rk3308->hpdet_work, ++ msecs_to_jiffies(HPDET_POLL_MS)); + +- return 0; +-} ++ if (need_report) { ++ if (report_type) ++ dac_output = DAC_HPOUT; + +-static int rk3308_codec_micbias_disable(struct rk3308_codec_priv *rk3308) +-{ +- int ch = rk3308->adc_ch; ++ rk3308_codec_dac_switch(rk3308, dac_output); + +- if (ch != 1 && ch != 2) { +- dev_err(rk3308->plat_dev, +- "%s: currnet ch: %d, only ch1/2 control MICBIAS1/2\n", +- __func__, ch); +- return -EINVAL; ++ if (rk3308->hpdet_jack) ++ snd_soc_jack_report(rk3308->hpdet_jack, ++ report_type, ++ SND_JACK_HEADPHONE); + } + +- /* 1. Enable the MICBIAS and keep the Audio Codec stable */ +- /* Do nothing */ +- +- /* +- * 2. Configure the (ADC_ANA_CON7+0x40)[3] or +- * (ADC_ANA_CON7+0x80)[3] to 0x0 +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), +- RK3308_ADC_MIC_BIAS_BUF_EN, +- RK3308_ADC_MIC_BIAS_BUF_DIS); +- +- /* 3. Configure ACODEC_ADC_ANA_CON8[4] to 0x0 */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON08(ch), +- RK3308_ADC_MICBIAS_CURRENT_MSK, +- RK3308_ADC_MICBIAS_CURRENT_DIS); ++ if (need_irq) ++ enable_irq(rk3308->irq); ++} + +- return 0; ++static void rk3308_codec_loopback_work(struct work_struct *work) ++{ ++ struct rk3308_codec_priv *rk3308 = ++ container_of(work, struct rk3308_codec_priv, loopback_work.work); ++ int type = ADC_TYPE_LOOPBACK; ++ int idx, grp; ++ ++ /* Prepare loopback ADCs */ ++ rk3308_codec_adc_ana_enable(rk3308, type); ++ ++ /* Waiting ADCs are stable */ ++ msleep(ADC_STABLE_MS); ++ ++ /* Recover normal mode after enable ADCs */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_L_CH_BIST_MSK, ++ RK3308_ADC_L_CH_NORMAL_LEFT); ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_R_CH_BIST_MSK, ++ RK3308_ADC_R_CH_NORMAL_RIGHT); ++ } + } + +-static int rk3308_codec_alc_enable(struct rk3308_codec_priv *rk3308) ++static irqreturn_t rk3308_codec_hpdet_isr(int irq, void *data) + { +- int ch = rk3308->adc_ch; ++ struct rk3308_codec_priv *rk3308 = data; + + /* +- * 1. Set he max level and min level of the ALC need to control. +- * +- * These values are estimated ++ * For the high level irq trigger, disable irq and avoid a lot of ++ * repeated irq handlers entry. + */ +- regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON05(ch), +- RK3308_AGC_LO_8BITS_AGC_MIN_MSK, +- 0x16); +- regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON05(ch), +- RK3308_AGC_HI_8BITS_AGC_MIN_MSK, +- 0x40); +- +- regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON05(ch), +- RK3308_AGC_LO_8BITS_AGC_MAX_MSK, +- 0x26); +- regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON05(ch), +- RK3308_AGC_HI_8BITS_AGC_MAX_MSK, +- 0x40); ++ disable_irq_nosync(rk3308->irq); ++ queue_delayed_work(system_power_efficient_wq, ++ &rk3308->hpdet_work, msecs_to_jiffies(10)); + +- /* +- * 2. Set ACODEC_ALC_DIG_CON4[2:0] according to the sample rate +- * +- * By default is 44.1KHz for sample. +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON04(ch), +- RK3308_AGC_APPROX_RATE_MSK, +- RK3308_AGC_APPROX_RATE_44_1K); +- regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON04(ch), +- RK3308_AGC_APPROX_RATE_MSK, +- RK3308_AGC_APPROX_RATE_44_1K); +- +- /* 3. Set ACODEC_ALC_DIG_CON9[6] to 0x1, to enable the ALC module */ +- regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON09(ch), +- RK3308_AGC_FUNC_SEL_MSK, +- RK3308_AGC_FUNC_SEL_EN); +- regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON09(ch), +- RK3308_AGC_FUNC_SEL_MSK, +- RK3308_AGC_FUNC_SEL_EN); ++ return IRQ_HANDLED; ++} + +- /* +- * 4. Set ACODEC_ADC_ANA_CON11[1:0], (ACODEC_ADC_ANA_CON11+0x40)[1:0], +- * (ACODEC_ADC_ANA_CON11+0x80)[1:0] and (ACODEC_ADC_ANA_CON11+0xc0)[1:0] +- * to 0x3, to enable the ALC module to control the gain of PGA. +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON11(ch), +- RK3308_ADC_ALCL_CON_GAIN_PGAL_MSK | +- RK3308_ADC_ALCR_CON_GAIN_PGAR_MSK, +- RK3308_ADC_ALCL_CON_GAIN_PGAL_EN | +- RK3308_ADC_ALCR_CON_GAIN_PGAR_EN); ++void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_codec *codec, ++ struct snd_soc_jack *hpdet_jack); ++EXPORT_SYMBOL_GPL(rk3308_codec_set_jack_detect_cb); + +- /* +- * 5.Observe the current ALC output gain by reading +- * ACODEC_ALC_DIG_CON12[4:0] +- * +- * The default GAIN is 0x0c +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON12(ch), +- RK3308_AGC_GAIN_MSK, +- 0x0c); +- regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON12(ch), +- RK3308_AGC_GAIN_MSK, +- 0x0c); ++static void rk3308_codec_set_jack_detect(struct snd_soc_codec *codec, ++ struct snd_soc_jack *hpdet_jack) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); + +- return 0; +-} ++ rk3308->hpdet_jack = hpdet_jack; + +-static int rk3308_codec_alc_disable(struct rk3308_codec_priv *rk3308) +-{ +- int ch = rk3308->adc_ch; ++ /* To detect jack once during startup */ ++ disable_irq_nosync(rk3308->irq); ++ queue_delayed_work(system_power_efficient_wq, ++ &rk3308->hpdet_work, msecs_to_jiffies(10)); + +- /* +- * 1. Set ACODEC_ALC_DIG_CON9[6] to 0x0, to disable the ALC module, +- * then the ALC output gain will keep to the last value +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON09(ch), +- RK3308_AGC_FUNC_SEL_MSK, +- RK3308_AGC_FUNC_SEL_DIS); +- regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON09(ch), +- RK3308_AGC_FUNC_SEL_MSK, +- RK3308_AGC_FUNC_SEL_DIS); ++ dev_info(rk3308->plat_dev, "%s: Request detect hp jack once\n", ++ __func__); ++} + +- /* +- * 2. Set ACODEC_ADC_ANA_CON11[1:0], (ACODEC_ADC_ANA_CON11+0x40)[1:0], +- * (ACODEC_ADC_ANA_CON11+0x80)[1:0] and (ACODEC_ADC_ANA_CON11+0xc0)[1:0] +- * to 0x0, to disable the ALC module to control the gain of PGA. +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON11(ch), +- RK3308_ADC_ALCL_CON_GAIN_PGAL_MSK | +- RK3308_ADC_ALCR_CON_GAIN_PGAR_MSK, +- RK3308_ADC_ALCL_CON_GAIN_PGAL_DIS | +- RK3308_ADC_ALCR_CON_GAIN_PGAR_DIS); ++static const struct regmap_config rk3308_codec_regmap_config = { ++ .reg_bits = 32, ++ .reg_stride = 4, ++ .val_bits = 32, ++ .max_register = RK3308_DAC_ANA_CON15, ++ .writeable_reg = rk3308_codec_write_read_reg, ++ .readable_reg = rk3308_codec_write_read_reg, ++ .volatile_reg = rk3308_codec_volatile_reg, ++ .reg_defaults = rk3308_codec_reg_defaults, ++ .num_reg_defaults = ARRAY_SIZE(rk3308_codec_reg_defaults), ++ .cache_type = REGCACHE_FLAT, ++}; + +- return 0; ++static ssize_t pm_state_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) ++{ ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ ++ return sprintf(buf, "pm_state: %d\n", rk3308->pm_state); + } + +-static int rk3308_codec_adc_ana_enable(struct rk3308_codec_priv *rk3308) ++static ssize_t pm_state_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) + { +- unsigned int adc_aif1 = 0, adc_aif2 = 0; +- unsigned int agc_func_en; +- int ch = rk3308->adc_ch; ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ unsigned long pm_state; ++ int ret = kstrtoul(buf, 10, &pm_state); + +- /* +- * 1. Set the ACODEC_ADC_ANA_CON7[7:6] and ACODEC_ADC_ANA_CON7[5:4], +- * to select the line-in or microphone as input of ADC +- * +- * Note1. Please ignore the step1 for enabling ADC3, ADC4, ADC5, +- * ADC6, ADC7, and ADC8 +- */ +- if (ch == 0) { +- if (rk3308->adc_ch0_using_linein) { +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), +- RK3308_ADC_CH1_IN_SEL_MSK, +- RK3308_ADC_CH1_IN_LINEIN); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), +- RK3308_ADC_CH2_IN_SEL_MSK, +- RK3308_ADC_CH2_IN_LINEIN); +- } else { +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), +- RK3308_ADC_CH1_IN_SEL_MSK, +- RK3308_ADC_CH1_IN_MIC); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), +- RK3308_ADC_CH2_IN_SEL_MSK, +- RK3308_ADC_CH2_IN_MIC); +- } ++ if (ret < 0) { ++ dev_err(dev, "Invalid pm_state: %ld, ret: %d\n", ++ pm_state, ret); ++ return -EINVAL; + } + +- /* +- * 2. Set ACODEC_ADC_ANA_CON0[7:0] to 0xff, to end the mute station +- * of ADC, to enable the MIC module, to enable the reference voltage +- * buffer, and to end the initialization of MIC +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(ch), +- RK3308_ADC_CH1_CH2_MIC_ALL_MSK, +- RK3308_ADC_CH1_CH2_MIC_ALL); ++ rk3308_codec_set_pm_state(rk3308, pm_state); + +- /* +- * 3. Set ACODEC_ADC_ANA_CON6[0] to 0x1, to enable the current source +- * of audio +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON06(ch), +- RK3308_ADC_CURRENT_MSK, +- RK3308_ADC_CURRENT_EN); ++ dev_info(dev, "Store pm_state: %d\n", rk3308->pm_state); + +- /* +- * 4. Set ACODEC_ADC_ANA_CON2[7:0] to 0x77, to enable the ALC module, +- * to enable the zero-crossing detection function, and to end the +- * initialization of ALC +- * +- * Note2. Please set ACODEC_ADC_ANA_CON2[7:0] to 0x33 in step4 +- * if the AGC function is closed +- */ ++ return count; ++} + +- adc_aif1 = RK3308_ADC_CH1_ALC_EN | RK3308_ADC_CH1_ALC_WORK; +- regmap_read(rk3308->regmap, RK3308_ALC_L_DIG_CON09(ch), &agc_func_en); +- if (agc_func_en & RK3308_AGC_FUNC_SEL_EN) +- adc_aif1 |= RK3308_ADC_CH1_ZEROCROSS_DET_EN; ++static ssize_t adc_grps_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) ++{ ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ u32 grp; ++ int type = ADC_TYPE_NORMAL, count = 0; ++ int idx; ++ ++ count += sprintf(buf + count, "current used adc_grps:\n"); ++ count += sprintf(buf + count, "- normal:"); ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) ++ count += sprintf(buf + count, " %d", grp); ++ count += sprintf(buf + count, "\n"); ++ count += sprintf(buf + count, "- loopback: %d\n", ++ rk3308->loopback_grp); + +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(ch), +- RK3308_ADC_CH1_ALC_ZC_MSK, +- adc_aif1); ++ return count; ++} + +- adc_aif2 = RK3308_ADC_CH2_ALC_EN | RK3308_ADC_CH2_ALC_WORK; +- regmap_read(rk3308->regmap, RK3308_ALC_L_DIG_CON09(ch), &agc_func_en); +- if (agc_func_en & RK3308_AGC_FUNC_SEL_EN) +- adc_aif2 |= RK3308_ADC_CH2_ZEROCROSS_DET_EN; ++static ssize_t adc_grps_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ char adc_type; ++ int grps, ret; ++ ++ ret = sscanf(buf, "%c,%d", &adc_type, &grps); ++ if (ret != 2) { ++ dev_err(rk3308->plat_dev, "%s sscanf failed: %d\n", ++ __func__, ret); ++ return -EFAULT; ++ } + +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(ch), +- RK3308_ADC_CH2_ALC_ZC_MSK, +- adc_aif2); ++ if (adc_type == 'n') ++ rk3308->used_adc_grps = grps; ++ else if (adc_type == 'l') ++ rk3308->loopback_grp = grps; + +- /* +- * 5. Set ACODEC_ADC_ANA_CON5[7:0] to 0x77, to enable the clock and +- * ADC module, and to end the initialization of ADC +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), +- RK3308_ADC_CH1_ADC_CLK_MSK, +- RK3308_ADC_CH1_CLK_EN | +- RK3308_ADC_CH1_ADC_EN | +- RK3308_ADC_CH1_ADC_WORK); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), +- RK3308_ADC_CH2_ADC_CLK_MSK, +- RK3308_ADC_CH2_CLK_EN | +- RK3308_ADC_CH2_ADC_EN | +- RK3308_ADC_CH2_ADC_WORK); ++ return count; ++} + +- /* +- * 6. Set ACODEC_ADC_ANA_CON1[5:4] and ACODEC_ADC_ANA_CON1[1:0], +- * to select the gain of the MIC +- * +- * By default is 0db. +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), +- RK3308_ADC_CH1_MIC_GAIN_MSK, +- RK3308_ADC_CH1_MIC_GAIN_0DB); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), +- RK3308_ADC_CH2_MIC_GAIN_MSK, +- RK3308_ADC_CH2_MIC_GAIN_0DB); ++static ssize_t adc_grps_route_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) ++{ ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ char which_i2s[32] = {0}; ++ int count = 0; ++ u32 grp; + +- /* +- * 7.Set ACODEC_ADC_ANA_CON3[4:0] and ACODEC_ADC_ANA_CON4[3:0] to +- * select the gain of ALC +- * +- * By default is 0db. +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON03(ch), +- RK3308_ADC_CH1_ALC_GAIN_MSK, +- RK3308_ADC_CH1_ALC_GAIN_0DB); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON04(ch), +- RK3308_ADC_CH2_ALC_GAIN_MSK, +- RK3308_ADC_CH2_ALC_GAIN_0DB); ++ switch (rk3308->which_i2s) { ++ case ACODEC_TO_I2S1_2CH: ++ strcpy(which_i2s, "i2s1_2ch"); ++ break; ++ case ACODEC_TO_I2S3_4CH: ++ strcpy(which_i2s, "i2s3_4ch"); ++ break; ++ default: ++ strcpy(which_i2s, "i2s2_8ch"); ++ break; ++ } + +- /* 8.Begin recording */ ++ count += sprintf(buf + count, "%s from acodec route mapping:\n", ++ which_i2s); ++ for (grp = 0; grp < rk3308->to_i2s_grps; grp++) { ++ count += sprintf(buf + count, "* sdi_%d <-- sdo_%d\n", ++ grp, rk3308->i2s_sdis[grp]); ++ } + +- return 0; ++ return count; + } + +-static int rk3308_codec_adc_ana_disable(struct rk3308_codec_priv *rk3308) ++static ssize_t adc_grps_route_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) + { +- int ch = rk3308->adc_ch; ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ int which_i2s, idx, i2s_sdis[ADC_LR_GROUP_MAX]; ++ int ret; + +- /* +- * 1. Set ACODEC_ADC_ANA_CON2[7:0] to 0x0, to disable the ALC module, +- * to disable the zero-crossing detection function, and to begin the +- * initialization of ALC +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(ch), +- RK3308_ADC_CH1_ALC_ZC_MSK, +- 0); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(ch), +- RK3308_ADC_CH2_ALC_ZC_MSK, +- 0); ++ ret = sscanf(buf, "%d,%d,%d,%d,%d", &which_i2s, ++ &i2s_sdis[0], &i2s_sdis[1], &i2s_sdis[2], &i2s_sdis[3]); ++ if (ret != 5) { ++ dev_err(rk3308->plat_dev, "%s sscanf failed: %d\n", ++ __func__, ret); ++ goto err; ++ } + +- /* +- * 2. Set ACODEC_ADC_ANA_CON5[7:0] to 0x0, to disable the clock and +- * ADC module, and to begin the initialization of ADC +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), +- RK3308_ADC_CH1_ADC_CLK_MSK, +- 0); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), +- RK3308_ADC_CH2_ADC_CLK_MSK, +- 0); ++ if (which_i2s < ACODEC_TO_I2S2_8CH || ++ which_i2s > ACODEC_TO_I2S1_2CH) { ++ dev_err(rk3308->plat_dev, "Invalid i2s type: %d\n", which_i2s); ++ goto err; ++ } + +- /* +- * 3. Set ACODEC_ADC_ANA_CON0[7:0] to 0x88, to disable the MIC module, +- * to disable the reference voltage buffer, and to begin the +- * initialization of MIC +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(ch), +- RK3308_ADC_CH1_CH2_MIC_ALL_MSK, +- RK3308_ADC_CH1_MIC_UNMUTE | +- RK3308_ADC_CH2_MIC_UNMUTE); ++ rk3308->which_i2s = which_i2s; + +- /* +- * 4. Set ACODEC_ADC_ANA_CON6[0] to 0x0, to disable the current +- * source of audio +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON06(ch), +- RK3308_ADC_CURRENT_MSK, +- RK3308_ADC_CURRENT_DIS); ++ switch (rk3308->which_i2s) { ++ case ACODEC_TO_I2S1_2CH: ++ rk3308->to_i2s_grps = 1; ++ break; ++ case ACODEC_TO_I2S3_4CH: ++ rk3308->to_i2s_grps = 2; ++ break; ++ default: ++ rk3308->to_i2s_grps = 4; ++ break; ++ } + +- return 0; ++ for (idx = 0; idx < rk3308->to_i2s_grps; idx++) ++ rk3308->i2s_sdis[idx] = i2s_sdis[idx]; ++ ++ rk3308_codec_adc_grps_route_config(rk3308); ++ ++err: ++ return count; + } + +-static int rk3308_codec_open_capture(struct snd_soc_codec *codec) ++static ssize_t adc_grp0_in_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); +- +- rk3308_codec_alc_enable(rk3308); +- rk3308_codec_adc_ana_enable(rk3308); ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); + +- return 0; ++ return sprintf(buf, "adc ch0 using: %s\n", ++ rk3308->adc_grp0_using_linein ? "line in" : "mic in"); + } + +-static int rk3308_codec_close_capture(struct snd_soc_codec *codec) ++static ssize_t adc_grp0_in_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ unsigned long using_linein; ++ int ret = kstrtoul(buf, 10, &using_linein); ++ ++ if (ret < 0 || using_linein > 1) { ++ dev_err(dev, "Invalid input status: %ld, ret: %d\n", ++ using_linein, ret); ++ return -EINVAL; ++ } + +- rk3308_codec_alc_disable(rk3308); +- rk3308_codec_adc_ana_disable(rk3308); ++ rk3308->adc_grp0_using_linein = using_linein; + +- return 0; ++ dev_info(dev, "store using_linein: %d\n", ++ rk3308->adc_grp0_using_linein); ++ ++ return count; + } + +-static int rk3308_codec_open_playback(struct snd_soc_codec *codec) ++static ssize_t adc_zerocross_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); +- +- rk3308_codec_dac_enable(rk3308); +- rk3308_speaker_ctl(rk3308, 1); ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); + +- return 0; ++ return sprintf(buf, "adc zerocross: %s\n", ++ rk3308->adc_zerocross ? "enabled" : "disabled"); + } + +-static int rk3308_codec_close_playback(struct snd_soc_codec *codec) ++static ssize_t adc_zerocross_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ unsigned long zerocross; ++ int ret = kstrtoul(buf, 10, &zerocross); + +- rk3308_speaker_ctl(rk3308, 0); +- rk3308_codec_dac_disable(rk3308); ++ if (ret < 0 || zerocross > 1) { ++ dev_err(dev, "Invalid zerocross: %ld, ret: %d\n", ++ zerocross, ret); ++ return -EINVAL; ++ } + +- return 0; ++ rk3308->adc_zerocross = zerocross; ++ ++ dev_info(dev, "store adc zerocross: %d\n", rk3308->adc_zerocross); ++ ++ return count; + } + +-static int rk3308_pcm_startup(struct snd_pcm_substream *substream, +- struct snd_soc_dai *dai) ++static ssize_t adc_grps_endisable_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) + { +- struct snd_soc_codec *codec = dai->codec; +- int ret = 0; ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ int count = 0, i; + +- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) +- ret = rk3308_codec_open_playback(codec); +- else +- ret = rk3308_codec_open_capture(codec); ++ count += sprintf(buf + count, "enabled adc grps:"); ++ for (i = 0; i < ADC_LR_GROUP_MAX; i++) ++ count += sprintf(buf + count, "%d ", ++ rk3308->adc_grps_endisable[i]); + +- return ret; ++ count += sprintf(buf + count, "\n"); ++ return count; + } + +-static void rk3308_pcm_shutdown(struct snd_pcm_substream *substream, +- struct snd_soc_dai *dai) ++static ssize_t adc_grps_endisable_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) + { +- struct snd_soc_codec *codec = dai->codec; ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ int grp, endisable, ret; + +- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) +- rk3308_codec_close_playback(codec); +- else +- rk3308_codec_close_capture(codec); +-} ++ ret = sscanf(buf, "%d,%d", &grp, &endisable); ++ if (ret != 2) { ++ dev_err(rk3308->plat_dev, "%s sscanf failed: %d\n", ++ __func__, ret); ++ return -EFAULT; ++ } + +-static struct snd_soc_dai_ops rk3308_dai_ops = { +- .hw_params = rk3308_hw_params, +- .set_fmt = rk3308_set_dai_fmt, +- .digital_mute = rk3308_digital_mute, +- .startup = rk3308_pcm_startup, +- .shutdown = rk3308_pcm_shutdown, +-}; ++ rk3308->cur_dbg_grp = grp; + +-static struct snd_soc_dai_driver rk3308_dai[] = { +- { +- .name = "rk3308-hifi", +- .id = RK3308_HIFI, +- .playback = { +- .stream_name = "HiFi Playback", +- .channels_min = 2, +- .channels_max = 2, +- .rates = SNDRV_PCM_RATE_8000_96000, +- .formats = (SNDRV_PCM_FMTBIT_S16_LE | +- SNDRV_PCM_FMTBIT_S20_3LE | +- SNDRV_PCM_FMTBIT_S24_LE | +- SNDRV_PCM_FMTBIT_S32_LE), +- }, +- .capture = { +- .stream_name = "HiFi Capture", +- .channels_min = 1, +- .channels_max = 8, +- .rates = SNDRV_PCM_RATE_8000_96000, +- .formats = (SNDRV_PCM_FMTBIT_S16_LE | +- SNDRV_PCM_FMTBIT_S20_3LE | +- SNDRV_PCM_FMTBIT_S24_LE | +- SNDRV_PCM_FMTBIT_S32_LE), +- }, +- .ops = &rk3308_dai_ops, +- }, +-}; ++ if (endisable) ++ rk3308_codec_open_dbg_capture(rk3308); ++ else ++ rk3308_codec_close_dbg_capture(rk3308); + +-static int rk3308_suspend(struct snd_soc_codec *codec) +-{ +- rk3308_set_bias_level(codec, SND_SOC_BIAS_OFF); ++ dev_info(dev, "ADC grp %d endisable: %d\n", grp, endisable); + +- return 0; ++ return count; + } + +-static int rk3308_resume(struct snd_soc_codec *codec) ++static ssize_t dac_endisable_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) + { +- rk3308_set_bias_level(codec, SND_SOC_BIAS_STANDBY); ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); + +- return 0; ++ return sprintf(buf, "%d\n", rk3308->dac_endisable); + } + +-static int rk3308_probe(struct snd_soc_codec *codec) ++static ssize_t dac_endisable_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ unsigned long endisable; ++ int ret = kstrtoul(buf, 10, &endisable); + +- rk3308_codec_reset(codec); +- rk3308_codec_power_on(codec); ++ if (ret < 0) { ++ dev_err(dev, "Invalid endisable: %ld, ret: %d\n", ++ endisable, ret); ++ return -EINVAL; ++ } ++ ++ if (endisable) ++ rk3308_codec_open_playback(rk3308); ++ else ++ rk3308_codec_close_playback(rk3308); + +- rk3308_codec_micbias_enable(rk3308, RK3308_ADC_MICBIAS_VOLT_0_7); ++ dev_info(dev, "DAC endisable: %ld\n", endisable); + +- return 0; ++ return count; + } + +-static int rk3308_remove(struct snd_soc_codec *codec) ++static ssize_t dac_output_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ ssize_t ret = 0; + +- rk3308_speaker_ctl(rk3308, 0); +- rk3308_codec_micbias_disable(rk3308); +- rk3308_codec_power_off(codec); ++ switch (rk3308->dac_output) { ++ case DAC_LINEOUT: ++ ret = sprintf(buf, "dac path: %s\n", "line out"); ++ break; ++ case DAC_HPOUT: ++ ret = sprintf(buf, "dac path: %s\n", "hp out"); ++ break; ++ case DAC_LINEOUT_HPOUT: ++ ret = sprintf(buf, "dac path: %s\n", ++ "both line out and hp out"); ++ break; ++ default: ++ pr_err("Invalid dac path: %d ?\n", rk3308->dac_output); ++ break; ++ } + +- return 0; ++ return ret; + } + +-static struct snd_soc_codec_driver soc_codec_dev_rk3308 = { +- .probe = rk3308_probe, +- .remove = rk3308_remove, +- .suspend = rk3308_suspend, +- .resume = rk3308_resume, +- .set_bias_level = rk3308_set_bias_level, +- .controls = rk3308_codec_dapm_controls, +- .num_controls = ARRAY_SIZE(rk3308_codec_dapm_controls), +-}; +- +-static const struct reg_default rk3308_codec_reg_defaults[] = { +- { RK3308_GLB_CON, 0x07 }, +-}; +- +-static bool rk3308_codec_write_read_reg(struct device *dev, unsigned int reg) ++static ssize_t dac_output_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) + { +- /* All registers can be read / write */ +- return true; +-} ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ unsigned long dac_output; ++ int ret = kstrtoul(buf, 10, &dac_output); + +-static bool rk3308_codec_volatile_reg(struct device *dev, unsigned int reg) +-{ +- switch (reg) { +- case RK3308_GLB_CON: +- return true; +- default: +- return false; ++ if (ret < 0) { ++ dev_err(dev, "Invalid input status: %ld, ret: %d\n", ++ dac_output, ret); ++ return -EINVAL; + } +-} + +-static const struct regmap_config rk3308_codec_regmap_config = { +- .reg_bits = 32, +- .reg_stride = 4, +- .val_bits = 32, +- .max_register = RK3308_DAC_ANA_CON13, +- .writeable_reg = rk3308_codec_write_read_reg, +- .readable_reg = rk3308_codec_write_read_reg, +- .volatile_reg = rk3308_codec_volatile_reg, +- .reg_defaults = rk3308_codec_reg_defaults, +- .num_reg_defaults = ARRAY_SIZE(rk3308_codec_reg_defaults), +- .cache_type = REGCACHE_FLAT, +-}; ++ rk3308_codec_dac_switch(rk3308, dac_output); + +-static ssize_t adc_ch_show(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++ dev_info(dev, "Store dac_output: %d\n", rk3308->dac_output); ++ ++ return count; ++} ++ ++static ssize_t enable_all_adcs_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) + { + struct rk3308_codec_priv *rk3308 = + container_of(dev, struct rk3308_codec_priv, dev); + +- return sprintf(buf, "adc_ch: %d\n", rk3308->adc_ch); ++ return sprintf(buf, "%d\n", rk3308->enable_all_adcs); + } + +-static ssize_t adc_ch_store(struct device *dev, +- struct device_attribute *attr, +- const char *buf, size_t count) ++static ssize_t enable_all_adcs_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) + { + struct rk3308_codec_priv *rk3308 = + container_of(dev, struct rk3308_codec_priv, dev); +- unsigned long ch; +- int ret = kstrtoul(buf, 10, &ch); ++ unsigned long enable; ++ int ret = kstrtoul(buf, 10, &enable); + +- if (ret < 0 || ch > 4) { +- dev_err(dev, "Invalid ch: %ld, ret: %d\n", ch, ret); ++ if (ret < 0) { ++ dev_err(dev, "Invalid enable value: %ld, ret: %d\n", ++ enable, ret); + return -EINVAL; + } + +- rk3308->adc_ch = ch; +- +- dev_info(dev, "Store ch: %d\n", rk3308->adc_ch); ++ rk3308->enable_all_adcs = enable; + + return count; + } + +-static const struct device_attribute adc_ch_attrs[] = { +- __ATTR(adc_ch, 0644, adc_ch_show, adc_ch_store), ++static const struct device_attribute acodec_attrs[] = { ++ __ATTR_RW(adc_grps), ++ __ATTR_RW(adc_grps_endisable), ++ __ATTR_RW(adc_grps_route), ++ __ATTR_RW(adc_grp0_in), ++ __ATTR_RW(adc_zerocross), ++ __ATTR_RW(dac_endisable), ++ __ATTR_RW(dac_output), ++ __ATTR_RW(enable_all_adcs), ++ __ATTR_RW(pm_state), + }; + + static void rk3308_codec_device_release(struct device *dev) +@@ -1468,8 +4747,8 @@ static int rk3308_codec_sysfs_init(struct platform_device *pdev, + return -ENOMEM; + } + +- for (i = 0; i < ARRAY_SIZE(adc_ch_attrs); i++) { +- if (device_create_file(dev, &adc_ch_attrs[i])) { ++ for (i = 0; i < ARRAY_SIZE(acodec_attrs); i++) { ++ if (device_create_file(dev, &acodec_attrs[i])) { + dev_err(&pdev->dev, + "Create 'rk3308-acodec-dev' attr failed\n"); + device_unregister(dev); +@@ -1480,32 +4759,136 @@ static int rk3308_codec_sysfs_init(struct platform_device *pdev, + return 0; + } + ++#if defined(CONFIG_DEBUG_FS) ++static int rk3308_codec_debugfs_reg_show(struct seq_file *s, void *v) ++{ ++ struct rk3308_codec_priv *rk3308 = s->private; ++ unsigned int i; ++ unsigned int val; ++ ++ for (i = RK3308_GLB_CON; i <= RK3308_DAC_ANA_CON13; i += 4) { ++ regmap_read(rk3308->regmap, i, &val); ++ if (!(i % 16)) ++ seq_printf(s, "\nR:%04x: ", i); ++ seq_printf(s, "%08x ", val); ++ } ++ ++ seq_puts(s, "\n"); ++ ++ return 0; ++} ++ ++static ssize_t rk3308_codec_debugfs_reg_operate(struct file *file, ++ const char __user *buf, ++ size_t count, loff_t *ppos) ++{ ++ struct rk3308_codec_priv *rk3308 = ++ ((struct seq_file *)file->private_data)->private; ++ unsigned int reg, val; ++ char op; ++ char kbuf[32]; ++ int ret; ++ ++ if (count >= sizeof(kbuf)) ++ return -EINVAL; ++ ++ if (copy_from_user(kbuf, buf, count)) ++ return -EFAULT; ++ kbuf[count] = '\0'; ++ ++ ret = sscanf(kbuf, "%c,%x,%x", &op, ®, &val); ++ if (ret != 3) { ++ pr_err("sscanf failed: %d\n", ret); ++ return -EFAULT; ++ } ++ ++ if (op == 'w') { ++ pr_info("Write reg: 0x%04x with val: 0x%08x\n", reg, val); ++ regmap_write(rk3308->regmap, reg, val); ++ regcache_cache_only(rk3308->regmap, false); ++ regcache_sync(rk3308->regmap); ++ pr_info("Read back reg: 0x%04x with val: 0x%08x\n", reg, val); ++ } else if (op == 'r') { ++ regmap_read(rk3308->regmap, reg, &val); ++ pr_info("Read reg: 0x%04x with val: 0x%08x\n", reg, val); ++ } else { ++ pr_err("This is an invalid operation: %c\n", op); ++ } ++ ++ return count; ++} ++ ++static int rk3308_codec_debugfs_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, ++ rk3308_codec_debugfs_reg_show, inode->i_private); ++} ++ ++static const struct file_operations rk3308_codec_reg_debugfs_fops = { ++ .owner = THIS_MODULE, ++ .open = rk3308_codec_debugfs_open, ++ .read = seq_read, ++ .write = rk3308_codec_debugfs_reg_operate, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++#endif /* CONFIG_DEBUG_FS */ ++ ++static int rk3308_codec_get_version(struct rk3308_codec_priv *rk3308) ++{ ++ unsigned int chip_id; ++ ++ regmap_read(rk3308->grf, GRF_CHIP_ID, &chip_id); ++ switch (chip_id) { ++ case 3306: ++ rk3308->codec_ver = ACODEC_VERSION_A; ++ break; ++ case 0x3308: ++ rk3308->codec_ver = ACODEC_VERSION_B; ++ break; ++ default: ++ pr_err("Unknown chip_id: %d / 0x%x\n", chip_id, chip_id); ++ return -EFAULT; ++ } ++ ++ pr_info("The acodec version is: %x\n", rk3308->codec_ver); ++ return 0; ++} ++ + static int rk3308_platform_probe(struct platform_device *pdev) + { + struct device_node *np = pdev->dev.of_node; + struct rk3308_codec_priv *rk3308; + struct resource *res; + void __iomem *base; +- int ret = 0; +- struct regmap *grf; +- +- grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); +- if (IS_ERR(grf)) { +- dev_err(&pdev->dev, +- "Missing 'rockchip,grf' property\n"); +- return PTR_ERR(grf); +- } ++ int ret; + + rk3308 = devm_kzalloc(&pdev->dev, sizeof(*rk3308), GFP_KERNEL); + if (!rk3308) + return -ENOMEM; + ++ rk3308->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); ++ if (IS_ERR(rk3308->grf)) { ++ dev_err(&pdev->dev, ++ "Missing 'rockchip,grf' property\n"); ++ return PTR_ERR(rk3308->grf); ++ } ++ + ret = rk3308_codec_sysfs_init(pdev, rk3308); + if (ret < 0) { + dev_err(&pdev->dev, "Sysfs init failed\n"); + return ret; + } + ++#if defined(CONFIG_DEBUG_FS) ++ rk3308->dbg_codec = debugfs_create_dir(CODEC_DRV_NAME, NULL); ++ if (IS_ERR(rk3308->dbg_codec)) ++ dev_err(&pdev->dev, ++ "Failed to create debugfs dir for rk3308!\n"); ++ else ++ debugfs_create_file("reg", 0644, rk3308->dbg_codec, ++ rk3308, &rk3308_codec_reg_debugfs_fops); ++#endif + rk3308->plat_dev = &pdev->dev; + + rk3308->reset = devm_reset_control_get(&pdev->dev, "acodec-reset"); +@@ -1518,27 +4901,146 @@ static int rk3308_platform_probe(struct platform_device *pdev) + rk3308->reset = NULL; + } + +- /* GPIO0_A5 control speaker on RK3308 EVB */ +- rk3308->spk_ctl_gpio = devm_gpiod_get_optional(&pdev->dev, "spk_ctl", +- GPIOD_OUT_HIGH); +- if (IS_ERR(rk3308->spk_ctl_gpio)) { ++ rk3308->hp_ctl_gpio = devm_gpiod_get_optional(&pdev->dev, "hp-ctl", ++ GPIOD_OUT_LOW); ++ if (!rk3308->hp_ctl_gpio) { ++ dev_info(&pdev->dev, "Don't need hp-ctl gpio\n"); ++ } else if (IS_ERR(rk3308->hp_ctl_gpio)) { ++ ret = PTR_ERR(rk3308->hp_ctl_gpio); ++ dev_err(&pdev->dev, "Unable to claim gpio hp-ctl\n"); ++ return ret; ++ } ++ ++ rk3308->spk_ctl_gpio = devm_gpiod_get_optional(&pdev->dev, "spk-ctl", ++ GPIOD_OUT_LOW); ++ ++ if (!rk3308->spk_ctl_gpio) { ++ dev_info(&pdev->dev, "Don't need spk-ctl gpio\n"); ++ } else if (IS_ERR(rk3308->spk_ctl_gpio)) { + ret = PTR_ERR(rk3308->spk_ctl_gpio); +- dev_err(&pdev->dev, "Unable to claim gpio spk_ctl\n"); ++ dev_err(&pdev->dev, "Unable to claim gpio spk-ctl\n"); ++ return ret; ++ } ++ ++ rk3308->pa_drv_gpio = devm_gpiod_get_optional(&pdev->dev, "pa-drv", ++ GPIOD_OUT_LOW); ++ ++ if (!rk3308->pa_drv_gpio) { ++ dev_info(&pdev->dev, "Don't need pa-drv gpio\n"); ++ } else if (IS_ERR(rk3308->pa_drv_gpio)) { ++ ret = PTR_ERR(rk3308->pa_drv_gpio); ++ dev_err(&pdev->dev, "Unable to claim gpio pa-drv\n"); + return ret; + } + ++ if (rk3308->pa_drv_gpio) { ++ rk3308->delay_pa_drv_ms = PA_DRV_MS; ++ ret = of_property_read_u32(np, "rockchip,delay-pa-drv-ms", ++ &rk3308->delay_pa_drv_ms); ++ } ++ ++#if DEBUG_POP_ALWAYS ++ dev_info(&pdev->dev, "Enable all ctl gpios always for debugging pop\n"); ++ rk3308_headphone_ctl(rk3308, 1); ++ rk3308_speaker_ctl(rk3308, 1); ++#else ++ dev_info(&pdev->dev, "De-pop as much as possible\n"); ++ rk3308_headphone_ctl(rk3308, 0); ++ rk3308_speaker_ctl(rk3308, 0); ++#endif ++ + rk3308->pclk = devm_clk_get(&pdev->dev, "acodec"); + if (IS_ERR(rk3308->pclk)) { + dev_err(&pdev->dev, "Can't get acodec pclk\n"); + return PTR_ERR(rk3308->pclk); + } + ++ rk3308->mclk_rx = devm_clk_get(&pdev->dev, "mclk_rx"); ++ if (IS_ERR(rk3308->mclk_rx)) { ++ dev_err(&pdev->dev, "Can't get acodec mclk_rx\n"); ++ return PTR_ERR(rk3308->mclk_rx); ++ } ++ ++ rk3308->mclk_tx = devm_clk_get(&pdev->dev, "mclk_tx"); ++ if (IS_ERR(rk3308->mclk_tx)) { ++ dev_err(&pdev->dev, "Can't get acodec mclk_tx\n"); ++ return PTR_ERR(rk3308->mclk_tx); ++ } ++ + ret = clk_prepare_enable(rk3308->pclk); + if (ret < 0) { + dev_err(&pdev->dev, "Failed to enable acodec pclk: %d\n", ret); + return ret; + } + ++ ret = clk_prepare_enable(rk3308->mclk_rx); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Failed to enable i2s mclk_rx: %d\n", ret); ++ return ret; ++ } ++ ++ ret = clk_prepare_enable(rk3308->mclk_tx); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Failed to enable i2s mclk_tx: %d\n", ret); ++ return ret; ++ } ++ ++ rk3308_codec_check_micbias(rk3308, np); ++ ++ rk3308->enable_all_adcs = ++ of_property_read_bool(np, "rockchip,enable-all-adcs"); ++ ++ rk3308->hp_jack_reversed = ++ of_property_read_bool(np, "rockchip,hp-jack-reversed"); ++ ++ rk3308->no_deep_low_power = ++ of_property_read_bool(np, "rockchip,no-deep-low-power"); ++ ++ rk3308->no_hp_det = ++ of_property_read_bool(np, "rockchip,no-hp-det"); ++ ++ rk3308->delay_loopback_handle_ms = LOOPBACK_HANDLE_MS; ++ ret = of_property_read_u32(np, "rockchip,delay-loopback-handle-ms", ++ &rk3308->delay_loopback_handle_ms); ++ ++ rk3308->delay_start_play_ms = 0; ++ ret = of_property_read_u32(np, "rockchip,delay-start-play-ms", ++ &rk3308->delay_start_play_ms); ++ ++ rk3308->loopback_grp = NOT_USED; ++ ret = of_property_read_u32(np, "rockchip,loopback-grp", ++ &rk3308->loopback_grp); ++ /* ++ * If there is no loopback on some board, the -EINVAL indicates that ++ * we don't need add the node, and it is not an error. ++ */ ++ if (ret < 0 && ret != -EINVAL) { ++ dev_err(&pdev->dev, "Failed to read loopback property: %d\n", ++ ret); ++ return ret; ++ } ++ ++ ret = rk3308_codec_adc_grps_route(rk3308, np); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Failed to route ADC groups: %d\n", ++ ret); ++ return ret; ++ } ++ ++ ret = rk3308_codec_setup_en_always_adcs(rk3308, np); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Failed to setup enabled always ADCs: %d\n", ++ ret); ++ return ret; ++ } ++ ++ ret = rk3308_codec_get_version(rk3308); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Failed to get acodec version: %d\n", ++ ret); ++ return ret; ++ } ++ + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(base)) { +@@ -1555,10 +5057,65 @@ static int rk3308_platform_probe(struct platform_device *pdev) + goto failed; + } + ++ if (!rk3308->no_hp_det) { ++ int index = 0; ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) ++ index = 1; ++ ++ rk3308->irq = platform_get_irq(pdev, index); ++ if (rk3308->irq < 0) { ++ dev_err(&pdev->dev, "Can not get codec irq\n"); ++ goto failed; ++ } ++ ++ INIT_DELAYED_WORK(&rk3308->hpdet_work, rk3308_codec_hpdetect_work); ++ ++ ret = devm_request_irq(&pdev->dev, rk3308->irq, ++ rk3308_codec_hpdet_isr, ++ 0, ++ "acodec-hpdet", ++ rk3308); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Failed to request IRQ: %d\n", ret); ++ goto failed; ++ } ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ rk3308->detect_grf = ++ syscon_regmap_lookup_by_phandle(np, "rockchip,detect-grf"); ++ if (IS_ERR(rk3308->detect_grf)) { ++ dev_err(&pdev->dev, ++ "Missing 'rockchip,detect-grf' property\n"); ++ return PTR_ERR(rk3308->detect_grf); ++ } ++ ++ /* Configure filter count and enable hpdet irq. */ ++ regmap_write(rk3308->detect_grf, ++ DETECT_GRF_ACODEC_HPDET_COUNTER, ++ DEFAULT_HPDET_COUNT); ++ regmap_write(rk3308->detect_grf, ++ DETECT_GRF_ACODEC_HPDET_CON, ++ (HPDET_BOTH_NEG_POS << 16) | ++ HPDET_BOTH_NEG_POS); ++ } ++ ++ rk3308_codec_set_jack_detect_cb = rk3308_codec_set_jack_detect; ++ } ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_A) ++ INIT_DELAYED_WORK(&rk3308->loopback_work, ++ rk3308_codec_loopback_work); ++ ++ rk3308->adc_grp0_using_linein = ADC_GRP0_MICIN; ++ rk3308->dac_output = DAC_LINEOUT; ++ rk3308->adc_zerocross = 1; ++ rk3308->pm_state = PM_NORMAL; ++ + platform_set_drvdata(pdev, rk3308); + + ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_rk3308, +- rk3308_dai, ARRAY_SIZE(rk3308_dai)); ++ rk3308_dai, ARRAY_SIZE(rk3308_dai)); + if (ret < 0) { + dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); + goto failed; +@@ -1567,7 +5124,10 @@ static int rk3308_platform_probe(struct platform_device *pdev) + return ret; + + failed: ++ clk_disable_unprepare(rk3308->mclk_rx); ++ clk_disable_unprepare(rk3308->mclk_tx); + clk_disable_unprepare(rk3308->pclk); ++ device_unregister(&rk3308->dev); + + return ret; + } +@@ -1577,8 +5137,11 @@ static int rk3308_platform_remove(struct platform_device *pdev) + struct rk3308_codec_priv *rk3308 = + (struct rk3308_codec_priv *)platform_get_drvdata(pdev); + ++ clk_disable_unprepare(rk3308->mclk_rx); ++ clk_disable_unprepare(rk3308->mclk_tx); + clk_disable_unprepare(rk3308->pclk); + snd_soc_unregister_codec(&pdev->dev); ++ device_unregister(&rk3308->dev); + + return 0; + } +@@ -1591,7 +5154,7 @@ MODULE_DEVICE_TABLE(of, rk3308codec_of_match); + + static struct platform_driver rk3308_codec_driver = { + .driver = { +- .name = "rk3308-acodec", ++ .name = CODEC_DRV_NAME, + .of_match_table = of_match_ptr(rk3308codec_of_match), + }, + .probe = rk3308_platform_probe, +diff --git a/sound/soc/codecs/rk3308_codec.h b/sound/soc/codecs/rk3308_codec.h +index 6cfa69157785..93e089dae081 100644 +--- a/sound/soc/codecs/rk3308_codec.h ++++ b/sound/soc/codecs/rk3308_codec.h +@@ -26,7 +26,8 @@ + #define ACODEC_ADC_I2S_CTL0 0x04 /* REG 0x01 */ + #define ACODEC_ADC_I2S_CTL1 0x08 /* REG 0x02 */ + #define ACODEC_ADC_BIST_MODE_SEL 0x0c /* REG 0x03 */ +-/* Resevred REG 0x04 ~ 0x06 */ ++#define ACODEC_ADC_HPF_PATH 0x10 /* REG 0x04 */ ++/* Resevred REG 0x05 ~ 0x06 */ + #define ACODEC_ADC_DATA_PATH 0x1c /* REG 0x07 */ + /* Resevred REG 0x08 ~ 0x0f */ + +@@ -62,12 +63,15 @@ + #define ACODEC_DAC_I2S_CTL0 0x04 /* REG 0x01 */ + #define ACODEC_DAC_I2S_CTL1 0x08 /* REG 0x02 */ + #define ACODEC_DAC_BIST_MODE_SEL 0x0c /* REG 0x03 */ +-/* Resevred REG 0x04 */ ++#define ACODEC_DAC_DIGITAL_GAIN 0x10 /* REG 0x04 */ + #define ACODEC_DAC_DATA_SEL 0x14 /* REG 0x05 */ + /* Resevred REG 0x06 ~ 0x09 */ + #define ACODEC_DAC_DATA_HI 0x28 /* REG 0x0a */ + #define ACODEC_DAC_DATA_LO 0x2c /* REG 0x0b */ +-/* Resevred REG 0x0c ~ 0x0f */ ++/* Resevred REG 0x0c */ ++#define ACODEC_DAC_HPDET_DELAYTIME 0x34 /* REG 0x0d */ ++#define ACODEC_DAC_HPDET_STATUS 0x38 /* REG 0x0e, Read-only */ ++/* Resevred REG 0x0f */ + + /* ADC ANALOG REGISTERS */ + #define ACODEC_ADC_ANA_MIC_CTL 0x00 /* REG 0x00 */ +@@ -92,10 +96,13 @@ + #define ACODEC_DAC_ANA_LINEOUT 0x10 /* REG 0x04 */ + #define ACODEC_DAC_ANA_L_HPOUT_GAIN 0x14 /* REG 0x05 */ + #define ACODEC_DAC_ANA_R_HPOUT_GAIN 0x18 /* REG 0x06 */ ++#define ACODEC_DAC_ANA_DRV_HPOUT 0x1c /* REG 0x07 */ ++#define ACODEC_DAC_ANA_DRV_LINEOUT 0x20 /* REG 0x08 */ + /* Resevred REG 0x07 ~ 0x0b */ + #define ACODEC_DAC_ANA_HPMIX_CTL0 0x30 /* REG 0x0c */ + #define ACODEC_DAC_ANA_HPMIX_CTL1 0x34 /* REG 0x0d */ +-/* Resevred REG 0x0e ~ 0x0f */ ++#define ACODEC_DAC_ANA_LINEOUT_CTL0 0x38 /* REG 0x0e */ ++#define ACODEC_DAC_ANA_LINEOUT_CTL1 0x3c /* REG 0x0f */ + + /* + * These registers are referenced by codec driver +@@ -106,7 +113,7 @@ + /* ADC DIGITAL REGISTERS */ + + /* +- * The ADC chanel are 0 ~ 3, that control: ++ * The ADC group are 0 ~ 3, that control: + * + * CH0: left_0(ADC1) and right_0(ADC2) + * CH1: left_1(ADC3) and right_1(ADC4) +@@ -118,6 +125,7 @@ + #define RK3308_ADC_DIG_CON01(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_I2S_CTL0) + #define RK3308_ADC_DIG_CON02(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_I2S_CTL1) + #define RK3308_ADC_DIG_CON03(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_BIST_MODE_SEL) ++#define RK3308_ADC_DIG_CON04(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_HPF_PATH) + #define RK3308_ADC_DIG_CON07(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_DATA_PATH) + + #define RK3308_ALC_L_DIG_CON00(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_CTL0) +@@ -150,13 +158,16 @@ + #define RK3308_DAC_DIG_CON01 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_I2S_CTL0) + #define RK3308_DAC_DIG_CON02 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_I2S_CTL1) + #define RK3308_DAC_DIG_CON03 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_BIST_MODE_SEL) ++#define RK3308_DAC_DIG_CON04 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_DIGITAL_GAIN) + #define RK3308_DAC_DIG_CON05 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_DATA_SEL) + #define RK3308_DAC_DIG_CON10 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_DATA_HI) + #define RK3308_DAC_DIG_CON11 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_DATA_LO) ++#define RK3308_DAC_DIG_CON13 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_HPDET_DELAYTIME) ++#define RK3308_DAC_DIG_CON14 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_HPDET_STATUS) + + /* ADC ANALOG REGISTERS */ + /* +- * The ADC chanel are 0 ~ 3, that control: ++ * The ADC group are 0 ~ 3, that control: + * + * CH0: left_0(ADC1) and right_0(ADC2) + * CH1: left_1(ADC3) and right_1(ADC4) +@@ -179,7 +190,6 @@ + + /* DAC ANALOG REGISTERS */ + #define RK3308_DAC_ANA_OFFSET 0x440 +- + #define RK3308_DAC_ANA_CON00 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_CTL0) + #define RK3308_DAC_ANA_CON01 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_POP_VOLT) + #define RK3308_DAC_ANA_CON02 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_CTL1) +@@ -187,8 +197,12 @@ + #define RK3308_DAC_ANA_CON04 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_LINEOUT) + #define RK3308_DAC_ANA_CON05 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_L_HPOUT_GAIN) + #define RK3308_DAC_ANA_CON06 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_R_HPOUT_GAIN) ++#define RK3308_DAC_ANA_CON07 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_DRV_HPOUT) ++#define RK3308_DAC_ANA_CON08 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_DRV_LINEOUT) + #define RK3308_DAC_ANA_CON12 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_HPMIX_CTL0) + #define RK3308_DAC_ANA_CON13 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_HPMIX_CTL1) ++#define RK3308_DAC_ANA_CON14 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_LINEOUT_CTL0) ++#define RK3308_DAC_ANA_CON15 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_LINEOUT_CTL1) + + /* + * These are the bits for registers +@@ -199,6 +213,12 @@ + #define RK3308_ADC_BIST_RESET (0 << 7) + #define RK3308_DAC_BIST_WORK (1 << 6) + #define RK3308_DAC_BIST_RESET (0 << 6) ++#define RK3308_ADC_MCLK_MSK (1 << 5) ++#define RK3308_ADC_MCLK_DIS (1 << 5) ++#define RK3308_ADC_MCLK_EN (0 << 5) ++#define RK3308_DAC_MCLK_MSK (1 << 4) ++#define RK3308_DAC_MCLK_DIS (1 << 4) ++#define RK3308_DAC_MCLK_EN (0 << 4) + #define RK3308_CODEC_RST_MSK (0x7 << 0) + #define RK3308_ADC_DIG_WORK (1 << 2) + #define RK3308_ADC_DIG_RESET (0 << 2) +@@ -253,16 +273,27 @@ + /* RK3308_ADC_DIG_CON03 - REG: 0x000c */ + #define RK3308_ADC_L_CH_BIST_SFT 2 + #define RK3308_ADC_L_CH_BIST_MSK (0x3 << RK3308_ADC_L_CH_BIST_SFT) +-#define RK3308_ADC_L_CH_BIST_LEFT (0x3 << RK3308_ADC_L_CH_BIST_SFT) /* normal mode */ +-#define RK3308_ADC_L_CH_BIST_SINE (0x2 << RK3308_ADC_L_CH_BIST_SFT) +-#define RK3308_ADC_L_CH_BIST_CUBE (0x1 << RK3308_ADC_L_CH_BIST_SFT) +-#define RK3308_ADC_L_CH_BIST_RIGHT (0x0 << RK3308_ADC_L_CH_BIST_SFT) /* normal mode */ ++#define RK3308_ADC_L_CH_NORMAL_RIGHT (0x3 << RK3308_ADC_L_CH_BIST_SFT) /* normal mode */ ++#define RK3308_ADC_L_CH_BIST_CUBE (0x2 << RK3308_ADC_L_CH_BIST_SFT) ++#define RK3308_ADC_L_CH_BIST_SINE (0x1 << RK3308_ADC_L_CH_BIST_SFT) ++#define RK3308_ADC_L_CH_NORMAL_LEFT (0x0 << RK3308_ADC_L_CH_BIST_SFT) /* normal mode */ + #define RK3308_ADC_R_CH_BIST_SFT 0 + #define RK3308_ADC_R_CH_BIST_MSK (0x3 << RK3308_ADC_R_CH_BIST_SFT) +-#define RK3308_ADC_R_CH_BIST_LEFT (0x3 << RK3308_ADC_R_CH_BIST_SFT) /* normal mode */ +-#define RK3308_ADC_R_CH_BIST_SINE (0x2 << RK3308_ADC_R_CH_BIST_SFT) +-#define RK3308_ADC_R_CH_BIST_CUBE (0x1 << RK3308_ADC_R_CH_BIST_SFT) +-#define RK3308_ADC_R_CH_BIST_RIGHT (0x0 << RK3308_ADC_R_CH_BIST_SFT) /* normal mode */ ++#define RK3308_ADC_R_CH_NORMAL_LEFT (0x3 << RK3308_ADC_R_CH_BIST_SFT) /* normal mode */ ++#define RK3308_ADC_R_CH_BIST_CUBE (0x2 << RK3308_ADC_R_CH_BIST_SFT) ++#define RK3308_ADC_R_CH_BIST_SINE (0x1 << RK3308_ADC_R_CH_BIST_SFT) ++#define RK3308_ADC_R_CH_NORMAL_RIGHT (0x0 << RK3308_ADC_R_CH_BIST_SFT) /* normal mode */ ++ ++/* RK3308_ADC_DIG_CON04 - REG: 0x0010 */ ++#define RK3308_ADC_HPF_PATH_SFT 2 ++#define RK3308_ADC_HPF_PATH_MSK (1 << RK3308_ADC_HPF_PATH_SFT) ++#define RK3308_ADC_HPF_PATH_DIS (1 << RK3308_ADC_HPF_PATH_SFT) ++#define RK3308_ADC_HPF_PATH_EN (0 << RK3308_ADC_HPF_PATH_SFT) ++#define RK3308_ADC_HPF_CUTOFF_SFT 0 ++#define RK3308_ADC_HPF_CUTOFF_MSK (0x3 << RK3308_ADC_HPF_CUTOFF_SFT) ++#define RK3308_ADC_HPF_CUTOFF_612HZ (0x2 << RK3308_ADC_HPF_CUTOFF_SFT) ++#define RK3308_ADC_HPF_CUTOFF_245HZ (0x1 << RK3308_ADC_HPF_CUTOFF_SFT) ++#define RK3308_ADC_HPF_CUTOFF_20HZ (0x0 << RK3308_ADC_HPF_CUTOFF_SFT) + + /* RK3308_ADC_DIG_CON07 - REG: 0x001c */ + #define RK3308_ADCL_DATA_SFT 4 +@@ -391,6 +422,8 @@ + */ + #define RK3308_AGC_PGA_ZERO_CRO_EN (0x1 << 5) + #define RK3308_AGC_PGA_ZERO_CRO_DIS (0x0 << 5) ++#define RK3308_AGC_PGA_GAIN_MAX 0x1f ++#define RK3308_AGC_PGA_GAIN_MIN 0 + #define RK3308_AGC_PGA_GAIN_SFT 0 + #define RK3308_AGC_PGA_GAIN_MSK (0x1f << RK3308_AGC_PGA_GAIN_SFT) + #define RK3308_AGC_PGA_GAIN_PDB_28_5 (0x1f << RK3308_AGC_PGA_GAIN_SFT) +@@ -474,6 +507,8 @@ + #define RK3308_AGC_FUNC_SEL_MSK (0x1 << 6) + #define RK3308_AGC_FUNC_SEL_EN (0x1 << 6) + #define RK3308_AGC_FUNC_SEL_DIS (0x0 << 6) ++#define RK3308_AGC_MAX_GAIN_PGA_MAX 0x7 ++#define RK3308_AGC_MAX_GAIN_PGA_MIN 0 + #define RK3308_AGC_MAX_GAIN_PGA_SFT 3 + #define RK3308_AGC_MAX_GAIN_PGA_MSK (0x7 << RK3308_AGC_MAX_GAIN_PGA_SFT) + #define RK3308_AGC_MAX_GAIN_PGA_PDB_28_5 (0x7 << RK3308_AGC_MAX_GAIN_PGA_SFT) +@@ -484,6 +519,8 @@ + #define RK3308_AGC_MAX_GAIN_PGA_NDB_1_5 (0x2 << RK3308_AGC_MAX_GAIN_PGA_SFT) + #define RK3308_AGC_MAX_GAIN_PGA_NDB_7_5 (0x1 << RK3308_AGC_MAX_GAIN_PGA_SFT) + #define RK3308_AGC_MAX_GAIN_PGA_NDB_13_5 (0x0 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_MAX 0x7 ++#define RK3308_AGC_MIN_GAIN_PGA_MIN 0 + #define RK3308_AGC_MIN_GAIN_PGA_SFT 0 + #define RK3308_AGC_MIN_GAIN_PGA_MSK (0x7 << RK3308_AGC_MIN_GAIN_PGA_SFT) + #define RK3308_AGC_MIN_GAIN_PGA_PDB_24 (0x7 << RK3308_AGC_MIN_GAIN_PGA_SFT) +@@ -555,6 +592,18 @@ + #define RK3308_DAC_R_CH_BIST_SINE (0x1 << RK3308_DAC_R_CH_BIST_SFT) + #define RK3308_DAC_R_CH_BIST_RIGHT (0x0 << RK3308_DAC_R_CH_BIST_SFT) /* normal mode */ + ++/* RK3308_DAC_DIG_CON04 - REG: 0x0310 */ ++#define RK3308_DAC_MODULATOR_GAIN_SFT 4 ++#define RK3308_DAC_MODULATOR_GAIN_MSK (0x7 << RK3308_DAC_MODULATOR_GAIN_SFT) ++#define RK3308_DAC_MODULATOR_GAIN_4_8DB (0x5 << RK3308_DAC_MODULATOR_GAIN_SFT) ++#define RK3308_DAC_MODULATOR_GAIN_4_2DB (0x4 << RK3308_DAC_MODULATOR_GAIN_SFT) ++#define RK3308_DAC_MODULATOR_GAIN_3_5DB (0x3 << RK3308_DAC_MODULATOR_GAIN_SFT) ++#define RK3308_DAC_MODULATOR_GAIN_2_8DB (0x2 << RK3308_DAC_MODULATOR_GAIN_SFT) ++#define RK3308_DAC_MODULATOR_GAIN_2DB (0x1 << RK3308_DAC_MODULATOR_GAIN_SFT) ++#define RK3308_DAC_MODULATOR_GAIN_0DB (0x0 << RK3308_DAC_MODULATOR_GAIN_SFT) ++#define RK3308_DAC_CIC_IF_GAIN_SFT 0 ++#define RK3308_DAC_CIC_IF_GAIN_MSK (0x7 << RK3308_DAC_CIC_IF_GAIN_SFT) ++ + /* RK3308_DAC_DIG_CON05 - REG: 0x0314 */ + #define RK3308_DAC_L_REG_CTL_INDATA (0x1 << 2) + #define RK3308_DAC_L_NORMAL_DATA (0x0 << 2) +@@ -587,18 +636,30 @@ + #define RK3308_ADC_CH1_BUF_REF_EN (0x1 << 0) + #define RK3308_ADC_CH1_BUF_REF_DIS (0x0 << 0) + +-/* RK3308_ADC_ANA_CON01 - REG: 0x0344 */ ++/* RK3308_ADC_ANA_CON01 - REG: 0x0344 ++ * ++ * The PGA of MIC-INs: ++ * 0x0 - MIC1~MIC8 0dB ++ * 0x1 - MIC1~MIC8 6.6dB ++ * 0x2 - MIC1~MIC8 13dB ++ * 0x3 - MIC1~MIC8 20dB ++ */ ++#define RK3308_ADC_CH2_MIC_GAIN_MAX 0x3 ++#define RK3308_ADC_CH2_MIC_GAIN_MIN 0 + #define RK3308_ADC_CH2_MIC_GAIN_SFT 4 + #define RK3308_ADC_CH2_MIC_GAIN_MSK (0x3 << RK3308_ADC_CH2_MIC_GAIN_SFT) +-#define RK3308_ADC_CH2_MIC_GAIN_30DB (0x3 << RK3308_ADC_CH2_MIC_GAIN_SFT) +-#define RK3308_ADC_CH2_MIC_GAIN_20DB (0x2 << RK3308_ADC_CH2_MIC_GAIN_SFT) +-#define RK3308_ADC_CH2_MIC_GAIN_6DB (0x1 << RK3308_ADC_CH2_MIC_GAIN_SFT) ++#define RK3308_ADC_CH2_MIC_GAIN_20DB (0x3 << RK3308_ADC_CH2_MIC_GAIN_SFT) ++#define RK3308_ADC_CH2_MIC_GAIN_13DB (0x2 << RK3308_ADC_CH2_MIC_GAIN_SFT) /* TRM: only used for version B */ ++#define RK3308_ADC_CH2_MIC_GAIN_6_6DB (0x1 << RK3308_ADC_CH2_MIC_GAIN_SFT) /* TRM: only used for version B */ + #define RK3308_ADC_CH2_MIC_GAIN_0DB (0x0 << RK3308_ADC_CH2_MIC_GAIN_SFT) ++ ++#define RK3308_ADC_CH1_MIC_GAIN_MAX 0x3 ++#define RK3308_ADC_CH1_MIC_GAIN_MIN 0 + #define RK3308_ADC_CH1_MIC_GAIN_SFT 0 + #define RK3308_ADC_CH1_MIC_GAIN_MSK (0x3 << RK3308_ADC_CH1_MIC_GAIN_SFT) +-#define RK3308_ADC_CH1_MIC_GAIN_30DB (0x3 << RK3308_ADC_CH1_MIC_GAIN_SFT) +-#define RK3308_ADC_CH1_MIC_GAIN_20DB (0x2 << RK3308_ADC_CH1_MIC_GAIN_SFT) +-#define RK3308_ADC_CH1_MIC_GAIN_6DB (0x1 << RK3308_ADC_CH1_MIC_GAIN_SFT) ++#define RK3308_ADC_CH1_MIC_GAIN_20DB (0x3 << RK3308_ADC_CH1_MIC_GAIN_SFT) ++#define RK3308_ADC_CH1_MIC_GAIN_13DB (0x2 << RK3308_ADC_CH1_MIC_GAIN_SFT) /* TRM: only used for version B */ ++#define RK3308_ADC_CH1_MIC_GAIN_6_6DB (0x1 << RK3308_ADC_CH1_MIC_GAIN_SFT) /* TRM: only used for version B */ + #define RK3308_ADC_CH1_MIC_GAIN_0DB (0x0 << RK3308_ADC_CH1_MIC_GAIN_SFT) + + /* RK3308_ADC_ANA_CON02 - REG: 0x0348 */ +@@ -619,6 +680,8 @@ + #define RK3308_ADC_CH1_ALC_DIS (0x0 << 0) + + /* RK3308_ADC_ANA_CON03 - REG: 0x034c */ ++#define RK3308_ADC_CH1_ALC_GAIN_MAX 0x1f ++#define RK3308_ADC_CH1_ALC_GAIN_MIN 0 + #define RK3308_ADC_CH1_ALC_GAIN_SFT 0 + #define RK3308_ADC_CH1_ALC_GAIN_MSK (0x1f << RK3308_ADC_CH1_ALC_GAIN_SFT) + #define RK3308_ADC_CH1_ALC_GAIN_PDB_28_5 (0x1f << RK3308_ADC_CH1_ALC_GAIN_SFT) +@@ -655,6 +718,8 @@ + #define RK3308_ADC_CH1_ALC_GAIN_NDB_18 (0x00 << RK3308_ADC_CH1_ALC_GAIN_SFT) + + /* RK3308_ADC_ANA_CON04 - REG: 0x0350 */ ++#define RK3308_ADC_CH2_ALC_GAIN_MAX 0x1f ++#define RK3308_ADC_CH2_ALC_GAIN_MIN 0 + #define RK3308_ADC_CH2_ALC_GAIN_SFT 0 + #define RK3308_ADC_CH2_ALC_GAIN_MSK (0x1f << RK3308_ADC_CH2_ALC_GAIN_SFT) + #define RK3308_ADC_CH2_ALC_GAIN_PDB_28_5 (0x1f << RK3308_ADC_CH2_ALC_GAIN_SFT) +@@ -728,10 +793,16 @@ + #define RK3308_ADC_CH1_IN_MIC (0x1 << RK3308_ADC_CH1_IN_SEL_SFT) + #define RK3308_ADC_CH1_IN_NONE (0x0 << RK3308_ADC_CH1_IN_SEL_SFT) + +-#define RK3308_ADC_MIC_BIAS_BUF_EN (0x1 << 3) +-#define RK3308_ADC_MIC_BIAS_BUF_DIS (0x0 << 3) ++#define RK3308_ADC_MIC_BIAS_BUF_SFT 3 ++#define RK3308_ADC_MIC_BIAS_BUF_EN (0x1 << RK3308_ADC_MIC_BIAS_BUF_SFT) ++#define RK3308_ADC_MIC_BIAS_BUF_DIS (0x0 << RK3308_ADC_MIC_BIAS_BUF_SFT) + #define RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT 0 + #define RK3308_ADC_LEVEL_RANGE_MICBIAS_MSK (0x7 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++/* ++ * The follow MICBIAS_VOLTs are based on the external reference voltage(Vref). ++ * For example, the Vref == 3.3V, the MICBIAS_VOLT_0_85 is equal: ++ * 3.3V * 0.85 = 2.805V. ++ */ + #define RK3308_ADC_MICBIAS_VOLT_0_85 (0x7 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) + #define RK3308_ADC_MICBIAS_VOLT_0_8 (0x6 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) + #define RK3308_ADC_MICBIAS_VOLT_0_75 (0x5 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) +@@ -751,18 +822,11 @@ + #define RK3308_ADC_REF_DIS (0x0 << 7) + #define RK3308_ADC_CURRENT_CHARGE_SFT 0 + #define RK3308_ADC_CURRENT_CHARGE_MSK (0x7f << RK3308_ADC_CURRENT_CHARGE_SFT) +-#define RK3308_ADC_DONT_SEL_ALL (0x7f << RK3308_ADC_CURRENT_CHARGE_SFT) + /* +- * 0: Choose the current I +- * 1: Don't choose the current I ++ * 1: Choose the current I ++ * 0: Don't choose the current I + */ +-#define RK3308_ADC_SEL_I_1(x) ((x & 0x1) << 6) +-#define RK3308_ADC_SEL_I_2(x) ((x & 0x1) << 5) +-#define RK3308_ADC_SEL_I_4(x) ((x & 0x1) << 4) +-#define RK3308_ADC_SEL_I_8(x) ((x & 0x1) << 3) +-#define RK3308_ADC_SEL_I_16(x) ((x & 0x1) << 2) +-#define RK3308_ADC_SEL_I_32(x) ((x & 0x1) << 1) +-#define RK3308_ADC_SEL_I_64(x) ((x & 0x1) << 0) ++#define RK3308_ADC_SEL_I(x) (x & 0x7f) + + /* RK3308_ADC_ANA_CON11 - REG: 0x036c */ + #define RK3308_ADC_ALCR_CON_GAIN_PGAR_MSK (0x1 << 1) +@@ -773,6 +837,7 @@ + #define RK3308_ADC_ALCL_CON_GAIN_PGAL_DIS (0x0 << 0) + + /* RK3308_DAC_ANA_CON00 - REG: 0x0440 */ ++#define RK3308_DAC_HEADPHONE_DET_MSK (0x1 << 1) + #define RK3308_DAC_HEADPHONE_DET_EN (0x1 << 1) + #define RK3308_DAC_HEADPHONE_DET_DIS (0x0 << 1) + #define RK3308_DAC_CURRENT_MSK (0x1 << 0) +@@ -783,17 +848,17 @@ + #define RK3308_DAC_BUF_REF_R_MSK (0x1 << 6) + #define RK3308_DAC_BUF_REF_R_EN (0x1 << 6) + #define RK3308_DAC_BUF_REF_R_DIS (0x0 << 6) +-#define RK3308_DAC_POP_SOUND_R_SFT 4 +-#define RK3308_DAC_POP_SOUND_R_MSK (0x3 << RK3308_DAC_POP_SOUND_R_SFT) +-#define RK3308_DAC_POP_SOUND_R_WORK (0x2 << RK3308_DAC_POP_SOUND_R_SFT) +-#define RK3308_DAC_POP_SOUND_R_INIT (0x1 << RK3308_DAC_POP_SOUND_R_SFT) ++#define RK3308_DAC_HPOUT_POP_SOUND_R_SFT 4 ++#define RK3308_DAC_HPOUT_POP_SOUND_R_MSK (0x3 << RK3308_DAC_HPOUT_POP_SOUND_R_SFT) ++#define RK3308_DAC_HPOUT_POP_SOUND_R_WORK (0x2 << RK3308_DAC_HPOUT_POP_SOUND_R_SFT) ++#define RK3308_DAC_HPOUT_POP_SOUND_R_INIT (0x1 << RK3308_DAC_HPOUT_POP_SOUND_R_SFT) + #define RK3308_DAC_BUF_REF_L_MSK (0x1 << 2) + #define RK3308_DAC_BUF_REF_L_EN (0x1 << 2) + #define RK3308_DAC_BUF_REF_L_DIS (0x0 << 2) +-#define RK3308_DAC_POP_SOUND_L_SFT 0 +-#define RK3308_DAC_POP_SOUND_L_MSK (0x3 << RK3308_DAC_POP_SOUND_L_SFT) +-#define RK3308_DAC_POP_SOUND_L_WORK (0x2 << RK3308_DAC_POP_SOUND_L_SFT) +-#define RK3308_DAC_POP_SOUND_L_INIT (0x1 << RK3308_DAC_POP_SOUND_L_SFT) ++#define RK3308_DAC_HPOUT_POP_SOUND_L_SFT 0 ++#define RK3308_DAC_HPOUT_POP_SOUND_L_MSK (0x3 << RK3308_DAC_HPOUT_POP_SOUND_L_SFT) ++#define RK3308_DAC_HPOUT_POP_SOUND_L_WORK (0x2 << RK3308_DAC_HPOUT_POP_SOUND_L_SFT) ++#define RK3308_DAC_HPOUT_POP_SOUND_L_INIT (0x1 << RK3308_DAC_HPOUT_POP_SOUND_L_SFT) + + /* RK3308_DAC_ANA_CON02 - REG: 0x0448 */ + #define RK3308_DAC_R_DAC_WORK (0x1 << 7) +@@ -828,28 +893,31 @@ + #define RK3308_DAC_L_HPOUT_MUTE (0x0 << 0) + + /* RK3308_DAC_ANA_CON04 - REG: 0x0450 */ +-#define RK3308_DAC_R_GAIN_SFT 6 +-#define RK3308_DAC_R_GAIN_MSK (0x3 << RK3308_DAC_R_GAIN_SFT) +-#define RK3308_DAC_R_GAIN_0DB (0x3 << RK3308_DAC_R_GAIN_SFT) +-#define RK3308_DAC_R_GAIN_PDB_1_5 (0x2 << RK3308_DAC_R_GAIN_SFT) +-#define RK3308_DAC_R_GAIN_PDB_3 (0x1 << RK3308_DAC_R_GAIN_SFT) +-#define RK3308_DAC_R_GAIN_PDB_6 (0x0 << RK3308_DAC_R_GAIN_SFT) ++#define RK3308_DAC_R_LINEOUT_GAIN_MAX 0x3 ++#define RK3308_DAC_R_LINEOUT_GAIN_SFT 6 ++#define RK3308_DAC_R_LINEOUT_GAIN_MSK (0x3 << RK3308_DAC_R_LINEOUT_GAIN_SFT) ++#define RK3308_DAC_R_LINEOUT_GAIN_0DB (0x3 << RK3308_DAC_R_LINEOUT_GAIN_SFT) ++#define RK3308_DAC_R_LINEOUT_GAIN_NDB_1_5 (0x2 << RK3308_DAC_R_LINEOUT_GAIN_SFT) ++#define RK3308_DAC_R_LINEOUT_GAIN_NDB_3 (0x1 << RK3308_DAC_R_LINEOUT_GAIN_SFT) ++#define RK3308_DAC_R_LINEOUT_GAIN_NDB_6 (0x0 << RK3308_DAC_R_LINEOUT_GAIN_SFT) + #define RK3308_DAC_R_LINEOUT_UNMUTE (0x1 << 5) + #define RK3308_DAC_R_LINEOUT_MUTE (0x0 << 5) + #define RK3308_DAC_R_LINEOUT_EN (0x1 << 4) + #define RK3308_DAC_R_LINEOUT_DIS (0x0 << 4) +-#define RK3308_DAC_L_GAIN_SFT 2 +-#define RK3308_DAC_L_GAIN_MSK (0x3 << RK3308_DAC_L_GAIN_SFT) +-#define RK3308_DAC_L_GAIN_0DB (0x3 << RK3308_DAC_L_GAIN_SFT) +-#define RK3308_DAC_L_GAIN_PDB_1_5 (0x2 << RK3308_DAC_L_GAIN_SFT) +-#define RK3308_DAC_L_GAIN_PDB_3 (0x1 << RK3308_DAC_L_GAIN_SFT) +-#define RK3308_DAC_L_GAIN_PDB_6 (0x0 << RK3308_DAC_L_GAIN_SFT) ++#define RK3308_DAC_L_LINEOUT_GAIN_MAX 0x3 ++#define RK3308_DAC_L_LINEOUT_GAIN_SFT 2 ++#define RK3308_DAC_L_LINEOUT_GAIN_MSK (0x3 << RK3308_DAC_L_LINEOUT_GAIN_SFT) ++#define RK3308_DAC_L_LINEOUT_GAIN_0DB (0x3 << RK3308_DAC_L_LINEOUT_GAIN_SFT) ++#define RK3308_DAC_L_LINEOUT_GAIN_NDB_1_5 (0x2 << RK3308_DAC_L_LINEOUT_GAIN_SFT) ++#define RK3308_DAC_L_LINEOUT_GAIN_NDB_3 (0x1 << RK3308_DAC_L_LINEOUT_GAIN_SFT) ++#define RK3308_DAC_L_LINEOUT_GAIN_NDB_6 (0x0 << RK3308_DAC_L_LINEOUT_GAIN_SFT) + #define RK3308_DAC_L_LINEOUT_UNMUTE (0x1 << 1) + #define RK3308_DAC_L_LINEOUT_MUTE (0x0 << 1) + #define RK3308_DAC_L_LINEOUT_EN (0x1 << 0) + #define RK3308_DAC_L_LINEOUT_DIS (0x0 << 0) + + /* RK3308_DAC_ANA_CON05 - REG: 0x0454, step is 1.5db */ ++#define RK3308_DAC_L_HPOUT_GAIN_MAX 0x1e + #define RK3308_DAC_L_HPOUT_GAIN_SFT 0 + #define RK3308_DAC_L_HPOUT_GAIN_MSK (0x1f << RK3308_DAC_L_HPOUT_GAIN_SFT) + #define RK3308_DAC_L_HPOUT_GAIN_PDB_6 (0x1e << RK3308_DAC_L_HPOUT_GAIN_SFT) +@@ -885,6 +953,7 @@ + #define RK3308_DAC_L_HPOUT_GAIN_NDB_39 (0x00 << RK3308_DAC_L_HPOUT_GAIN_SFT) + + /* RK3308_DAC_ANA_CON06 - REG: 0x0458, step is 1.5db */ ++#define RK3308_DAC_R_HPOUT_GAIN_MAX 0x1e + #define RK3308_DAC_R_HPOUT_GAIN_SFT 0 + #define RK3308_DAC_R_HPOUT_GAIN_MSK (0x1f << RK3308_DAC_R_HPOUT_GAIN_SFT) + #define RK3308_DAC_R_HPOUT_GAIN_PDB_6 (0x1e << RK3308_DAC_R_HPOUT_GAIN_SFT) +@@ -919,6 +988,18 @@ + #define RK3308_DAC_R_HPOUT_GAIN_NDB_37_5 (0x01 << RK3308_DAC_R_HPOUT_GAIN_SFT) + #define RK3308_DAC_R_HPOUT_GAIN_NDB_39 (0x00 << RK3308_DAC_R_HPOUT_GAIN_SFT) + ++/* RK3308_DAC_ANA_CON07 - REG: 0x045c */ ++#define RK3308_DAC_R_HPOUT_DRV_SFT 4 ++#define RK3308_DAC_R_HPOUT_DRV_MSK (0xf << RK3308_DAC_R_HPOUT_DRV_SFT) ++#define RK3308_DAC_L_HPOUT_DRV_SFT 0 ++#define RK3308_DAC_L_HPOUT_DRV_MSK (0xf << RK3308_DAC_L_HPOUT_DRV_SFT) ++ ++/* RK3308_DAC_ANA_CON08 - REG: 0x0460 */ ++#define RK3308_DAC_R_LINEOUT_DRV_SFT 4 ++#define RK3308_DAC_R_LINEOUT_DRV_MSK (0xf << RK3308_DAC_R_LINEOUT_DRV_SFT) ++#define RK3308_DAC_L_LINEOUT_DRV_SFT 0 ++#define RK3308_DAC_L_LINEOUT_DRV_MSK (0xf << RK3308_DAC_L_LINEOUT_DRV_SFT) ++ + /* RK3308_DAC_ANA_CON12 - REG: 0x0470 */ + #define RK3308_DAC_R_HPMIX_SEL_SFT 6 + #define RK3308_DAC_R_HPMIX_SEL_MSK (0x3 << RK3308_DAC_R_HPMIX_SEL_SFT) +@@ -926,6 +1007,8 @@ + #define RK3308_DAC_R_HPMIX_LINEIN (0x2 << RK3308_DAC_R_HPMIX_SEL_SFT) + #define RK3308_DAC_R_HPMIX_I2S (0x1 << RK3308_DAC_R_HPMIX_SEL_SFT) + #define RK3308_DAC_R_HPMIX_NONE (0x0 << RK3308_DAC_R_HPMIX_SEL_SFT) ++#define RK3308_DAC_R_HPMIX_GAIN_MIN 0x1 ++#define RK3308_DAC_R_HPMIX_GAIN_MAX 0x2 + #define RK3308_DAC_R_HPMIX_GAIN_SFT 4 + #define RK3308_DAC_R_HPMIX_GAIN_MSK (0x3 << RK3308_DAC_R_HPMIX_GAIN_SFT) + #define RK3308_DAC_R_HPMIX_GAIN_0DB (0x2 << RK3308_DAC_R_HPMIX_GAIN_SFT) +@@ -936,6 +1019,8 @@ + #define RK3308_DAC_L_HPMIX_LINEIN (0x2 << RK3308_DAC_L_HPMIX_SEL_SFT) + #define RK3308_DAC_L_HPMIX_I2S (0x1 << RK3308_DAC_L_HPMIX_SEL_SFT) + #define RK3308_DAC_L_HPMIX_NONE (0x0 << RK3308_DAC_L_HPMIX_SEL_SFT) ++#define RK3308_DAC_L_HPMIX_GAIN_MIN 0x1 ++#define RK3308_DAC_L_HPMIX_GAIN_MAX 0x2 + #define RK3308_DAC_L_HPMIX_GAIN_SFT 0 + #define RK3308_DAC_L_HPMIX_GAIN_MSK (0x3 << RK3308_DAC_L_HPMIX_GAIN_SFT) + #define RK3308_DAC_L_HPMIX_GAIN_0DB (0x2 << RK3308_DAC_L_HPMIX_GAIN_SFT) +@@ -955,6 +1040,30 @@ + #define RK3308_DAC_L_HPMIX_EN (0x1 << 0) + #define RK3308_DAC_L_HPMIX_DIS (0x0 << 0) + ++/* RK3308_DAC_ANA_CON14 - REG: 0x0478 */ ++#define RK3308_DAC_VCM_LINEOUT_EN (0x1 << 4) ++#define RK3308_DAC_VCM_LINEOUT_DIS (0x0 << 4) ++#define RK3308_DAC_CURRENT_CHARGE_SFT 0 ++#define RK3308_DAC_CURRENT_CHARGE_MSK (0xf << RK3308_DAC_CURRENT_CHARGE_SFT) ++ ++/* ++ * 1: Choose the current I ++ * 0: Don't choose the current I ++ */ ++#define RK3308_DAC_SEL_I(x) (x & 0xf) ++ ++/* RK3308_DAC_ANA_CON15 - REG: 0x047C */ ++#define RK3308_DAC_LINEOUT_POP_SOUND_R_SFT 4 ++#define RK3308_DAC_LINEOUT_POP_SOUND_R_MSK (0x3 << RK3308_DAC_LINEOUT_POP_SOUND_R_SFT) ++#define RK3308_DAC_R_SEL_DC_FROM_INTERNAL (0x2 << RK3308_DAC_LINEOUT_POP_SOUND_R_SFT) ++#define RK3308_DAC_R_SEL_DC_FROM_VCM (0x1 << RK3308_DAC_LINEOUT_POP_SOUND_R_SFT) ++#define RK3308_DAC_R_SEL_LINEOUT_FROM_INTERNAL (0x0 << RK3308_DAC_LINEOUT_POP_SOUND_R_SFT) ++#define RK3308_DAC_LINEOUT_POP_SOUND_L_SFT 0 ++#define RK3308_DAC_LINEOUT_POP_SOUND_L_MSK (0x3 << RK3308_DAC_LINEOUT_POP_SOUND_L_SFT) ++#define RK3308_DAC_L_SEL_DC_FROM_INTERNAL (0x2 << RK3308_DAC_LINEOUT_POP_SOUND_L_SFT) ++#define RK3308_DAC_L_SEL_DC_FROM_VCM (0x1 << RK3308_DAC_LINEOUT_POP_SOUND_L_SFT) ++#define RK3308_DAC_L_SEL_LINEOUT_FROM_INTERNAL (0x0 << RK3308_DAC_LINEOUT_POP_SOUND_L_SFT) ++ + #define RK3308_HIFI 0x0 + + #endif /* __RK3308_CODEC_H__ */ +diff --git a/sound/soc/codecs/rk3308_codec_provider.h b/sound/soc/codecs/rk3308_codec_provider.h +new file mode 100644 +index 000000000000..68042b1328dc +--- /dev/null ++++ b/sound/soc/codecs/rk3308_codec_provider.h +@@ -0,0 +1,28 @@ ++/* ++ * rk3308_codec_provider.h -- RK3308 ALSA Soc Audio Driver ++ * ++ * Copyright (c) 2018, Fuzhou Rockchip Electronics Co., Ltd All rights reserved. ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms and conditions of the GNU General Public License, ++ * version 2, as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#ifndef __RK3308_CODEC_PROVIDER_H__ ++#define __RK3308_CODEC_PROVIDER_H__ ++ ++#ifdef CONFIG_SND_SOC_RK3308 ++extern void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_codec *codec, ++ struct snd_soc_jack *hpdet_jack); ++#endif ++ ++#endif /* __RK3308_CODEC_PROVIDER_H__ */ +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0020-arm64-dts-rockchip-Add-acodec-node-for-rk3308.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0020-arm64-dts-rockchip-Add-acodec-node-for-rk3308.patch new file mode 100644 index 000000000000..821e69964ccd --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0020-arm64-dts-rockchip-Add-acodec-node-for-rk3308.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ashthespy +Date: Mon, 3 Feb 2020 17:19:33 +0100 +Subject: arm64: dts: rockchip: Add acodec node for rk3308 + +Change-Id: I76f4a877711d33620bdef295e9047bdba26d4da4 +Signed-off-by: Xing Zheng +--- + arch/arm64/boot/dts/rockchip/rk3308.dtsi | 18 +++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308.dtsi b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +index 291f011800b2..dd221ee88722 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +@@ -548,7 +548,7 @@ rk_timer_rtc: rk-timer-rtc@ff1a0020 { + clock-names = "pclk", "timer"; + status = "disabled"; + }; +- ++ + saradc: saradc@ff1e0000 { + compatible = "rockchip,rk3308-saradc", "rockchip,rk3399-saradc"; + reg = <0x0 0xff1e0000 0x0 0x100>; +@@ -933,6 +933,22 @@ cru: clock-controller@ff500000 { + assigned-clock-rates = <32768>; + }; + ++ acodec: acodec@ff560000 { ++ compatible = "rockchip,rk3308-codec"; ++ reg = <0x0 0xff560000 0x0 0x10000>; ++ rockchip,grf = <&grf>; ++ rockchip,detect-grf = <&detect_grf>; ++ interrupts = , ++ ; ++ clocks = <&cru PCLK_ACODEC>, ++ <&cru SCLK_I2S2_8CH_TX_OUT>, ++ <&cru SCLK_I2S2_8CH_RX_OUT>; ++ clock-names = "acodec", "mclk_tx", "mclk_rx"; ++ resets = <&cru SRST_ACODEC_P>; ++ reset-names = "acodec-reset"; ++ status = "disabled"; ++}; ++ + gic: interrupt-controller@ff580000 { + compatible = "arm,gic-400"; + reg = <0x0 0xff581000 0x0 0x1000>, +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0022-ASoC-rk3308_codec-replace-codec-to-component.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0022-ASoC-rk3308_codec-replace-codec-to-component.patch new file mode 100644 index 000000000000..5855cf80a551 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0022-ASoC-rk3308_codec-replace-codec-to-component.patch @@ -0,0 +1,459 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ashthespy +Date: Mon, 3 Feb 2020 19:35:42 +0100 +Subject: ASoC: rk3308_codec: replace codec to component + +--- + sound/soc/codecs/rk3308_codec.c | 159 +++++----- + sound/soc/codecs/rk3308_codec_provider.h | 2 +- + 2 files changed, 84 insertions(+), 77 deletions(-) + +diff --git a/sound/soc/codecs/rk3308_codec.c b/sound/soc/codecs/rk3308_codec.c +index 815e22fc346c..b6862fc5a3da 100644 +--- a/sound/soc/codecs/rk3308_codec.c ++++ b/sound/soc/codecs/rk3308_codec.c +@@ -31,7 +31,7 @@ + #include + #include + #include +-#include ++// #include + #include + #include + #include +@@ -156,7 +156,7 @@ struct rk3308_codec_priv { + struct gpio_desc *hp_ctl_gpio; + struct gpio_desc *spk_ctl_gpio; + struct gpio_desc *pa_drv_gpio; +- struct snd_soc_codec *codec; ++ struct snd_soc_component *component; + struct snd_soc_jack *hpdet_jack; + struct regulator *vcc_micbias; + u32 codec_ver; +@@ -883,8 +883,8 @@ static const struct snd_kcontrol_new rk3308_codec_dapm_controls[] = { + static int rk3308_codec_agc_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + + if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) { +@@ -904,8 +904,8 @@ static int rk3308_codec_agc_get(struct snd_kcontrol *kcontrol, + static int rk3308_codec_agc_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + unsigned int value = ucontrol->value.integer.value[0]; + int grp = e->reg; +@@ -970,8 +970,8 @@ static int rk3308_codec_agc_put(struct snd_kcontrol *kcontrol, + static int rk3308_codec_agc_asr_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + unsigned int value; + int grp = e->reg; +@@ -998,8 +998,8 @@ static int rk3308_codec_agc_asr_get(struct snd_kcontrol *kcontrol, + static int rk3308_codec_agc_asr_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + unsigned int value; + int grp = e->reg; +@@ -1032,8 +1032,8 @@ static int rk3308_codec_agc_asr_put(struct snd_kcontrol *kcontrol, + static int rk3308_codec_mic_mute_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + unsigned int value; + int grp = e->reg; +@@ -1064,8 +1064,8 @@ static int rk3308_codec_mic_mute_get(struct snd_kcontrol *kcontrol, + static int rk3308_codec_mic_mute_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + unsigned int value; + int grp = e->reg; +@@ -1098,8 +1098,8 @@ static int rk3308_codec_mic_mute_put(struct snd_kcontrol *kcontrol, + static int rk3308_codec_micbias_volts_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + + ucontrol->value.integer.value[0] = rk3308->micbias_volt; + +@@ -1109,8 +1109,8 @@ static int rk3308_codec_micbias_volts_get(struct snd_kcontrol *kcontrol, + static int rk3308_codec_micbias_volts_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + unsigned int volt = ucontrol->value.integer.value[0]; + int ret; + +@@ -1133,8 +1133,8 @@ static int rk3308_codec_micbias_volts_put(struct snd_kcontrol *kcontrol, + static int rk3308_codec_main_micbias_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + + ucontrol->value.integer.value[0] = rk3308->enable_micbias; + +@@ -1144,8 +1144,8 @@ static int rk3308_codec_main_micbias_get(struct snd_kcontrol *kcontrol, + static int rk3308_codec_main_micbias_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + unsigned int on = ucontrol->value.integer.value[0]; + + if (on) { +@@ -1168,8 +1168,8 @@ static int rk3308_codec_mic_gain_get(struct snd_kcontrol *kcontrol, + static int rk3308_codec_mic_gain_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + unsigned int gain = ucontrol->value.integer.value[0]; + + if (gain > RK3308_ADC_CH1_MIC_GAIN_MAX) { +@@ -1197,8 +1197,8 @@ static int rk3308_codec_mic_gain_put(struct snd_kcontrol *kcontrol, + static int rk3308_codec_hpf_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + unsigned int value; + +@@ -1222,8 +1222,8 @@ static int rk3308_codec_hpf_get(struct snd_kcontrol *kcontrol, + static int rk3308_codec_hpf_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + unsigned int value = ucontrol->value.integer.value[0]; + +@@ -1259,8 +1259,8 @@ static int rk3308_codec_hpout_l_get_tlv(struct snd_kcontrol *kcontrol, + static int rk3308_codec_hpout_l_put_tlv(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + unsigned int dgain = ucontrol->value.integer.value[0]; + + if (dgain > RK3308_DAC_L_HPOUT_GAIN_MAX) { +@@ -1283,8 +1283,8 @@ static int rk3308_codec_hpout_r_get_tlv(struct snd_kcontrol *kcontrol, + static int rk3308_codec_hpout_r_put_tlv(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + unsigned int dgain = ucontrol->value.integer.value[0]; + + if (dgain > RK3308_DAC_R_HPOUT_GAIN_MAX) { +@@ -1408,9 +1408,9 @@ static void rk3308_speaker_ctl(struct rk3308_codec_priv *rk3308, int on) + } + } + +-static int rk3308_codec_reset(struct snd_soc_codec *codec) ++static int rk3308_codec_reset(struct snd_soc_component *component) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + + reset_control_assert(rk3308->reset); + usleep_range(2000, 2500); /* estimated value */ +@@ -1452,10 +1452,10 @@ static int rk3308_codec_dac_dig_reset(struct rk3308_codec_priv *rk3308) + return 0; + } + +-static int rk3308_set_bias_level(struct snd_soc_codec *codec, ++static int rk3308_set_bias_level(struct snd_soc_component *component, + enum snd_soc_bias_level level) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + + switch (level) { + case SND_SOC_BIAS_ON: +@@ -1473,11 +1473,11 @@ static int rk3308_set_bias_level(struct snd_soc_codec *codec, + return 0; + } + +-static int rk3308_set_dai_fmt(struct snd_soc_dai *codec_dai, ++static int rk3308_set_dai_fmt(struct snd_soc_dai *dai, + unsigned int fmt) + { +- struct snd_soc_codec *codec = codec_dai->codec; +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = dai->component; ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + unsigned int adc_aif1 = 0, adc_aif2 = 0, dac_aif1 = 0, dac_aif2 = 0; + int idx, grp, is_master; + int type = ADC_TYPE_ALL; +@@ -1721,8 +1721,8 @@ static int rk3308_codec_update_adc_grps(struct rk3308_codec_priv *rk3308, + + static int rk3308_mute_stream(struct snd_soc_dai *dai, int mute, int stream) + { +- struct snd_soc_codec *codec = dai->codec; +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = dai->component; ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + + if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + int dgain; +@@ -3630,8 +3630,8 @@ static int rk3308_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct snd_soc_dai *dai) + { +- struct snd_soc_codec *codec = dai->codec; +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = dai->component; ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + struct snd_pcm_str *playback_str = + &substream->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK]; + int type = ADC_TYPE_LOOPBACK; +@@ -3705,8 +3705,8 @@ static int rk3308_hw_params(struct snd_pcm_substream *substream, + static int rk3308_pcm_trigger(struct snd_pcm_substream *substream, + int cmd, struct snd_soc_dai *dai) + { +- struct snd_soc_codec *codec = dai->codec; +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = dai->component; ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + int type = ADC_TYPE_LOOPBACK; + int idx, grp; + +@@ -3749,8 +3749,8 @@ static int rk3308_pcm_trigger(struct snd_pcm_substream *substream, + static void rk3308_pcm_shutdown(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) + { +- struct snd_soc_codec *codec = dai->codec; +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = dai->component; ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + rk3308_codec_close_playback(rk3308); +@@ -3809,9 +3809,9 @@ static struct snd_soc_dai_driver rk3308_dai[] = { + }, + }; + +-static int rk3308_suspend(struct snd_soc_codec *codec) ++static int rk3308_suspend(struct snd_soc_component *component) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + + if (rk3308->no_deep_low_power) + goto out; +@@ -3822,13 +3822,13 @@ static int rk3308_suspend(struct snd_soc_codec *codec) + clk_disable_unprepare(rk3308->pclk); + + out: +- rk3308_set_bias_level(codec, SND_SOC_BIAS_OFF); ++ rk3308_set_bias_level(component, SND_SOC_BIAS_OFF); + return 0; + } + +-static int rk3308_resume(struct snd_soc_codec *codec) ++static int rk3308_resume(struct snd_soc_component *component) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + int ret = 0; + + if (rk3308->no_deep_low_power) +@@ -3857,7 +3857,7 @@ static int rk3308_resume(struct snd_soc_codec *codec) + + rk3308_codec_dlp_up(rk3308); + out: +- rk3308_set_bias_level(codec, SND_SOC_BIAS_STANDBY); ++ rk3308_set_bias_level(component, SND_SOC_BIAS_STANDBY); + return ret; + } + +@@ -3972,7 +3972,7 @@ static int rk3308_codec_dapm_mic_gains(struct rk3308_codec_priv *rk3308) + int ret; + + if (rk3308->codec_ver == ACODEC_VERSION_B) { +- ret = snd_soc_add_codec_controls(rk3308->codec, ++ ret = snd_soc_add_component_controls(rk3308->component, + mic_gains_b, + ARRAY_SIZE(mic_gains_b)); + if (ret) { +@@ -3982,7 +3982,7 @@ static int rk3308_codec_dapm_mic_gains(struct rk3308_codec_priv *rk3308) + return ret; + } + } else { +- ret = snd_soc_add_codec_controls(rk3308->codec, ++ ret = snd_soc_add_component_controls(rk3308->component, + mic_gains_a, + ARRAY_SIZE(mic_gains_a)); + if (ret) { +@@ -4081,15 +4081,15 @@ static int rk3308_codec_prepare(struct rk3308_codec_priv *rk3308) + return 0; + } + +-static int rk3308_probe(struct snd_soc_codec *codec) ++static int rk3308_probe(struct snd_soc_component *component) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + int ext_micbias; + +- rk3308->codec = codec; ++ rk3308->component = component; + rk3308_codec_set_dac_path_state(rk3308, PATH_IDLE); + +- rk3308_codec_reset(codec); ++ rk3308_codec_reset(component); + rk3308_codec_power_on(rk3308); + + /* From vendor recommend, disable micbias at first. */ +@@ -4108,9 +4108,9 @@ static int rk3308_probe(struct snd_soc_codec *codec) + return 0; + } + +-static int rk3308_remove(struct snd_soc_codec *codec) ++static void rk3308_remove(struct snd_soc_component *component) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + + rk3308_headphone_ctl(rk3308, 0); + rk3308_speaker_ctl(rk3308, 0); +@@ -4124,17 +4124,25 @@ static int rk3308_remove(struct snd_soc_codec *codec) + regcache_cache_only(rk3308->regmap, false); + regcache_sync(rk3308->regmap); + +- return 0; + } + +-static struct snd_soc_codec_driver soc_codec_dev_rk3308 = { +- .probe = rk3308_probe, +- .remove = rk3308_remove, +- .suspend = rk3308_suspend, +- .resume = rk3308_resume, +- .set_bias_level = rk3308_set_bias_level, +- .controls = rk3308_codec_dapm_controls, +- .num_controls = ARRAY_SIZE(rk3308_codec_dapm_controls), ++static const struct snd_soc_component_driver soc_codec_dev_rk3308_component = { ++ .probe = rk3308_probe, ++ .remove = rk3308_remove, ++ .resume = rk3308_resume, ++ .suspend = rk3308_suspend, ++ .set_bias_level = rk3308_set_bias_level, ++ .controls = rk3308_codec_dapm_controls, ++ .num_controls = ARRAY_SIZE(rk3308_codec_dapm_controls), ++ // .dapm_widgets = rk3308_dapm_widgets, ++ // .num_dapm_widgets = ARRAY_SIZE(rk3308_dapm_widgets), ++ // .dapm_routes = rk3308_dapm_routes, ++ // .num_dapm_routes = ARRAY_SIZE(rk3308_dapm_routes), ++ // .suspend_bias_off = 1, ++ // .idle_bias_on = 1, ++ // .use_pmdown_time = 1, ++ .endianness = 1, ++ .legacy_dai_naming = 1, + }; + + static const struct reg_default rk3308_codec_reg_defaults[] = { +@@ -4299,14 +4307,14 @@ static irqreturn_t rk3308_codec_hpdet_isr(int irq, void *data) + return IRQ_HANDLED; + } + +-void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_codec *codec, ++void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_component *component, + struct snd_soc_jack *hpdet_jack); + EXPORT_SYMBOL_GPL(rk3308_codec_set_jack_detect_cb); + +-static void rk3308_codec_set_jack_detect(struct snd_soc_codec *codec, ++static void rk3308_codec_set_jack_detect(struct snd_soc_component *component, + struct snd_soc_jack *hpdet_jack) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + + rk3308->hpdet_jack = hpdet_jack; + +@@ -5114,10 +5122,10 @@ static int rk3308_platform_probe(struct platform_device *pdev) + + platform_set_drvdata(pdev, rk3308); + +- ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_rk3308, ++ ret = devm_snd_soc_register_component(&pdev->dev, &soc_codec_dev_rk3308_component, + rk3308_dai, ARRAY_SIZE(rk3308_dai)); + if (ret < 0) { +- dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); ++ dev_err(&pdev->dev, "Failed to register component: %d\n", ret); + goto failed; + } + +@@ -5140,7 +5148,6 @@ static int rk3308_platform_remove(struct platform_device *pdev) + clk_disable_unprepare(rk3308->mclk_rx); + clk_disable_unprepare(rk3308->mclk_tx); + clk_disable_unprepare(rk3308->pclk); +- snd_soc_unregister_codec(&pdev->dev); + device_unregister(&rk3308->dev); + + return 0; +diff --git a/sound/soc/codecs/rk3308_codec_provider.h b/sound/soc/codecs/rk3308_codec_provider.h +index 68042b1328dc..34c1ef86a507 100644 +--- a/sound/soc/codecs/rk3308_codec_provider.h ++++ b/sound/soc/codecs/rk3308_codec_provider.h +@@ -21,7 +21,7 @@ + #define __RK3308_CODEC_PROVIDER_H__ + + #ifdef CONFIG_SND_SOC_RK3308 +-extern void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_codec *codec, ++extern void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_component *component, + struct snd_soc_jack *hpdet_jack); + #endif + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0027-arm64-dts-rk3308-add-otp-cpuinfo.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0027-arm64-dts-rk3308-add-otp-cpuinfo.patch new file mode 100644 index 000000000000..f11c766eb4e2 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0027-arm64-dts-rk3308-add-otp-cpuinfo.patch @@ -0,0 +1,115 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Igor Pecovnik +Date: Wed, 8 Sep 2021 17:51:34 +0200 +Subject: [ARCHEOLOGY] Bumping EDGE kernel to 5.14.y (#3125) + +> X-Git-Archeology: > recovered message: > * Bumping EDGE kernel to 5.14.y +> X-Git-Archeology: > recovered message: > Meson64: +> X-Git-Archeology: > recovered message: > - removing Odroid reboot shutdown patch since its probably not needed anymore +> X-Git-Archeology: > recovered message: > Rockchip64: +> X-Git-Archeology: > recovered message: > - removing Rockpi S. No interest to maintain this any further +> X-Git-Archeology: > recovered message: > - removing PBP suspend. Doesn't align. Need inspection if some other way was mainstreamed +> X-Git-Archeology: > recovered message: > - temporally removing Orangepi R1 +> X-Git-Archeology: > recovered message: > * Re-adding rockpis, pbp suspend, HFLPS170 wifi and cleanup +> X-Git-Archeology: > recovered message: > * Removing deprecated patch, fixing ap6256 wifi +> X-Git-Archeology: > recovered message: > * Re-enable Opi R1 plus, untest +> X-Git-Archeology: > recovered message: > * Add and fix Radxa Zero +> X-Git-Archeology: - Revision 744ea89a589d62cb6f409baab60fc6664520bc39: https://github.com/armbian/build/commit/744ea89a589d62cb6f409baab60fc6664520bc39 +> X-Git-Archeology: Date: Wed, 08 Sep 2021 17:51:34 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bumping EDGE kernel to 5.14.y (#3125) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e: https://github.com/armbian/build/commit/dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e +> X-Git-Archeology: Date: Tue, 09 Nov 2021 18:06:34 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump imx6, xu4, rockchip64 and jetson-nano to 5.15 (#3238) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3308.dtsi | 29 ++++++++++ + 1 file changed, 29 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308.dtsi b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +index dd221ee88722..5f48dcee7548 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +@@ -138,6 +138,12 @@ arm-pmu { + interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>; + }; + ++ cpuinfo { ++ compatible = "rockchip,cpuinfo"; ++ nvmem-cells = <&cpu_id>; ++ nvmem-cell-names = "id"; ++ }; ++ + mac_clkin: external-mac-clock { + compatible = "fixed-clock"; + clock-frequency = <50000000>; +@@ -145,6 +151,29 @@ mac_clkin: external-mac-clock { + #clock-cells = <0>; + }; + ++ otp: otp@ff210000 { ++ compatible = "rockchip,rk3308-otp"; ++ reg = <0x0 0xff210000 0x0 0x4000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ clocks = <&cru SCLK_OTP_USR>, <&cru PCLK_OTP_NS>, ++ <&cru PCLK_OTP_PHY>; ++ clock-names = "otp", "apb_pclk", "phy"; ++ resets = <&cru SRST_OTP_PHY>; ++ reset-names = "phy"; ++ ++ /* Data cells */ ++ cpu_id: id@7 { ++ reg = <0x07 0x10>; ++ }; ++ cpu_leakage: cpu-leakage@17 { ++ reg = <0x17 0x1>; ++ }; ++ logic_leakage: logic-leakage@18 { ++ reg = <0x18 0x1>; ++ }; ++ }; ++ + psci { + compatible = "arm,psci-1.0"; + method = "smc"; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0029-arm64-dts-rk3308-add-reserved-memory-ramoops.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0029-arm64-dts-rk3308-add-reserved-memory-ramoops.patch new file mode 100644 index 000000000000..e64c536bc09a --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0029-arm64-dts-rk3308-add-reserved-memory-ramoops.patch @@ -0,0 +1,99 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Igor Pecovnik +Date: Wed, 8 Sep 2021 17:51:34 +0200 +Subject: [ARCHEOLOGY] Bumping EDGE kernel to 5.14.y (#3125) + +> X-Git-Archeology: > recovered message: > * Bumping EDGE kernel to 5.14.y +> X-Git-Archeology: > recovered message: > Meson64: +> X-Git-Archeology: > recovered message: > - removing Odroid reboot shutdown patch since its probably not needed anymore +> X-Git-Archeology: > recovered message: > Rockchip64: +> X-Git-Archeology: > recovered message: > - removing Rockpi S. No interest to maintain this any further +> X-Git-Archeology: > recovered message: > - removing PBP suspend. Doesn't align. Need inspection if some other way was mainstreamed +> X-Git-Archeology: > recovered message: > - temporally removing Orangepi R1 +> X-Git-Archeology: > recovered message: > * Re-adding rockpis, pbp suspend, HFLPS170 wifi and cleanup +> X-Git-Archeology: > recovered message: > * Removing deprecated patch, fixing ap6256 wifi +> X-Git-Archeology: > recovered message: > * Re-enable Opi R1 plus, untest +> X-Git-Archeology: > recovered message: > * Add and fix Radxa Zero +> X-Git-Archeology: - Revision 744ea89a589d62cb6f409baab60fc6664520bc39: https://github.com/armbian/build/commit/744ea89a589d62cb6f409baab60fc6664520bc39 +> X-Git-Archeology: Date: Wed, 08 Sep 2021 17:51:34 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bumping EDGE kernel to 5.14.y (#3125) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e: https://github.com/armbian/build/commit/dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e +> X-Git-Archeology: Date: Tue, 09 Nov 2021 18:06:34 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump imx6, xu4, rockchip64 and jetson-nano to 5.15 (#3238) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3308.dtsi | 20 ++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308.dtsi b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +index 5f48dcee7548..c5fe355c6deb 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +@@ -179,6 +179,26 @@ psci { + method = "smc"; + }; + ++ reserved-memory { ++ #address-cells = <2>; ++ #size-cells = <2>; ++ ranges; ++ ++ drm_logo: drm-logo@00000000 { ++ compatible = "rockchip,drm-logo"; ++ reg = <0x0 0x0 0x0 0x0>; ++ }; ++ ++ ramoops: ramoops@110000 { ++ compatible = "ramoops"; ++ reg = <0x0 0x110000 0x0 0xf0000>; ++ record-size = <0x30000>; ++ console-size = <0xc0000>; ++ ftrace-size = <0x00000>; ++ pmsg-size = <0x00000>; ++ }; ++ }; ++ + timer { + compatible = "arm,armv8-timer"; + interrupts = , +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpro64-0001-Add-pcie-bus-scan-delay.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-0001-Add-pcie-bus-scan-delay.patch new file mode 100644 index 000000000000..42c9ba693774 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-0001-Add-pcie-bus-scan-delay.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Piotr Szczepanik +Date: Mon, 24 Aug 2020 22:47:03 +0200 +Subject: Rockpro64 add pcie bus scan delay + +> X-Git-Archeology: - Revision 42e76b9277ad492e935cc76c2b37c9f6d882a675: https://github.com/armbian/build/commit/42e76b9277ad492e935cc76c2b37c9f6d882a675 +> X-Git-Archeology: Date: Mon, 24 Aug 2020 22:47:03 +0200 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch RockPro64 work led to heartbeat trigger +> X-Git-Archeology: +> X-Git-Archeology: - Revision 4d4c3f58ffc1cbfbb060cbabc9eb414036a2fda5: https://github.com/armbian/build/commit/4d4c3f58ffc1cbfbb060cbabc9eb414036a2fda5 +> X-Git-Archeology: Date: Wed, 02 Sep 2020 23:22:09 +0200 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switched rockchip64 curent to kernel 5.8.y (#2175) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision e7377248b3cae186e24e2be781cd3365b43246f0: https://github.com/armbian/build/commit/e7377248b3cae186e24e2be781cd3365b43246f0 +> X-Git-Archeology: Date: Thu, 22 Jul 2021 00:15:54 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Second part of EDGE bumping to 5.13.y (#3045) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 7be9e8b99590e32c0594365d00a2a2cfc3c4bd5a: https://github.com/armbian/build/commit/7be9e8b99590e32c0594365d00a2a2cfc3c4bd5a +> X-Git-Archeology: Date: Thu, 16 Dec 2021 05:17:33 -0500 +> X-Git-Archeology: From: Dan Pasanen +> X-Git-Archeology: Subject: rockchip-[current,edge]: add pcie hack and lsi scsi/sas support (#3351) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 588c2ec17e709dec19304fa50522459702ebfadd: https://github.com/armbian/build/commit/588c2ec17e709dec19304fa50522459702ebfadd +> X-Git-Archeology: Date: Fri, 23 Dec 2022 21:57:53 +0100 +> X-Git-Archeology: From: brentr +> X-Git-Archeology: Subject: Rockpis devtree mainlined (#4603) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +index bca2b50e0a93..1e7295215b58 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +@@ -663,6 +663,7 @@ &pcie0 { + pinctrl-0 = <&pcie_perst>; + vpcie12v-supply = <&vcc12v_dcin>; + vpcie3v3-supply = <&vcc3v3_pcie>; ++ bus-scan-delay-ms = <1000>; + status = "okay"; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpro64-change-rx_delay-for-gmac.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-change-rx_delay-for-gmac.patch new file mode 100644 index 000000000000..4e7ed60cfbef --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-change-rx_delay-for-gmac.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ayufan +Date: Sun, 30 Dec 2018 13:32:47 +0100 +Subject: ayufan: dts: rockpro64: change rx_delay for gmac + +Change-Id: Ib3899f684188aa1ed1545717af004bba53fe0e07 +--- + arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +index 1e7295215b58..25ee84e06874 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +@@ -307,7 +307,7 @@ &gmac { + snps,reset-active-low; + snps,reset-delays-us = <0 10000 50000>; + tx_delay = <0x28>; +- rx_delay = <0x11>; ++ rx_delay = <0x20>; + status = "okay"; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpro64-fix-emmc.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-fix-emmc.patch new file mode 100644 index 000000000000..7aeb8dc4fac6 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-fix-emmc.patch @@ -0,0 +1,123 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Ayotte +Date: Wed, 5 Dec 2018 14:09:24 -0500 +Subject: [ARCHEOLOGY] fix PMIC_INT_L gpio conflicting with I2C8_SCL in + RockPro64 + +> X-Git-Archeology: - Revision 9324bde9b94db6c2f43ff1e75bedb74fbe6e29a1: https://github.com/armbian/build/commit/9324bde9b94db6c2f43ff1e75bedb74fbe6e29a1 +> X-Git-Archeology: Date: Wed, 05 Dec 2018 14:09:24 -0500 +> X-Git-Archeology: From: Martin Ayotte +> X-Git-Archeology: Subject: fix PMIC_INT_L gpio conflicting with I2C8_SCL in RockPro64 +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8f82cb60b958ad235ee91899ab2ca8e4a8a2a33b: https://github.com/armbian/build/commit/8f82cb60b958ad235ee91899ab2ca8e4a8a2a33b +> X-Git-Archeology: Date: Mon, 31 Dec 2018 12:29:56 -0500 +> X-Git-Archeology: From: Martin Ayotte +> X-Git-Archeology: Subject: set lower speed for RockPro64 eMMC +> X-Git-Archeology: +> X-Git-Archeology: - Revision cbbbf0631969bf0e4578f4b1eef62c1aab115d79: https://github.com/armbian/build/commit/cbbbf0631969bf0e4578f4b1eef62c1aab115d79 +> X-Git-Archeology: Date: Tue, 01 Jan 2019 19:37:27 -0500 +> X-Git-Archeology: From: Martin Ayotte +> X-Git-Archeology: Subject: fix RockPi-4B naming + fix vcc5v0_host gpio pin +> X-Git-Archeology: +> X-Git-Archeology: - Revision a186fd498404fdae7d3a25dec64f014c590027d6: https://github.com/armbian/build/commit/a186fd498404fdae7d3a25dec64f014c590027d6 +> X-Git-Archeology: Date: Wed, 05 Feb 2020 00:19:00 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switched rockchip64-dev to mainline kernel 5.5.y (#1781) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 5e251dc4148f7a7e3fa61d440c5a268626624de3: https://github.com/armbian/build/commit/5e251dc4148f7a7e3fa61d440c5a268626624de3 +> X-Git-Archeology: Date: Mon, 06 Apr 2020 19:06:28 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Merged rockpi-s dev info rockchip64-dev and moved to 5.6.y (#1874) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 812245def37a695bce9e7ece148b2920d82c8b37: https://github.com/armbian/build/commit/812245def37a695bce9e7ece148b2920d82c8b37 +> X-Git-Archeology: Date: Sat, 18 Jul 2020 23:07:01 +0200 +> X-Git-Archeology: From: Werner +> X-Git-Archeology: Subject: Move rockchip/64 current to 5.7.y (#2099) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dfd5cf9692e97774f7f0bfd72227144e36f58070: https://github.com/armbian/build/commit/dfd5cf9692e97774f7f0bfd72227144e36f58070 +> X-Git-Archeology: Date: Sun, 13 Dec 2020 22:13:03 -0500 +> X-Git-Archeology: From: tonymac32 +> X-Git-Archeology: Subject: [ rockchip64 ] Clean up patchset +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision e7377248b3cae186e24e2be781cd3365b43246f0: https://github.com/armbian/build/commit/e7377248b3cae186e24e2be781cd3365b43246f0 +> X-Git-Archeology: Date: Thu, 22 Jul 2021 00:15:54 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Second part of EDGE bumping to 5.13.y (#3045) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 744ea89a589d62cb6f409baab60fc6664520bc39: https://github.com/armbian/build/commit/744ea89a589d62cb6f409baab60fc6664520bc39 +> X-Git-Archeology: Date: Wed, 08 Sep 2021 17:51:34 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bumping EDGE kernel to 5.14.y (#3125) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e: https://github.com/armbian/build/commit/dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e +> X-Git-Archeology: Date: Tue, 09 Nov 2021 18:06:34 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump imx6, xu4, rockchip64 and jetson-nano to 5.15 (#3238) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +index 25ee84e06874..f5f521986d43 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +@@ -17,6 +17,7 @@ aliases { + }; + + chosen { ++ bootargs = "mmc_cmdqueue=0 earlycon=uart8250,mmio32,0xff1a0000"; + stdout-path = "serial2:1500000n8"; + }; + +@@ -815,6 +816,7 @@ &sdmmc { + + &sdhci { + bus-width = <8>; ++ keep-power-in-suspend; + mmc-hs200-1_8v; + non-removable; + status = "okay"; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpro64-fix-spi1-flash-speed.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-fix-spi1-flash-speed.patch new file mode 100644 index 000000000000..3fb67e1c646b --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-fix-spi1-flash-speed.patch @@ -0,0 +1,105 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Ayotte +Date: Sat, 5 Jan 2019 09:50:02 -0500 +Subject: [ARCHEOLOGY] slow SPIFlash to avoid errors + +> X-Git-Archeology: - Revision ea20f750bfead37ced7b604a44f8f014e317abad: https://github.com/armbian/build/commit/ea20f750bfead37ced7b604a44f8f014e317abad +> X-Git-Archeology: Date: Sat, 05 Jan 2019 09:50:02 -0500 +> X-Git-Archeology: From: Martin Ayotte +> X-Git-Archeology: Subject: slow SPIFlash to avoid errors +> X-Git-Archeology: +> X-Git-Archeology: - Revision a186fd498404fdae7d3a25dec64f014c590027d6: https://github.com/armbian/build/commit/a186fd498404fdae7d3a25dec64f014c590027d6 +> X-Git-Archeology: Date: Wed, 05 Feb 2020 00:19:00 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switched rockchip64-dev to mainline kernel 5.5.y (#1781) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 5e251dc4148f7a7e3fa61d440c5a268626624de3: https://github.com/armbian/build/commit/5e251dc4148f7a7e3fa61d440c5a268626624de3 +> X-Git-Archeology: Date: Mon, 06 Apr 2020 19:06:28 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Merged rockpi-s dev info rockchip64-dev and moved to 5.6.y (#1874) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 812245def37a695bce9e7ece148b2920d82c8b37: https://github.com/armbian/build/commit/812245def37a695bce9e7ece148b2920d82c8b37 +> X-Git-Archeology: Date: Sat, 18 Jul 2020 23:07:01 +0200 +> X-Git-Archeology: From: Werner +> X-Git-Archeology: Subject: Move rockchip/64 current to 5.7.y (#2099) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 40665cde86285060e6bdd5ef7dc33be6c301ec66: https://github.com/armbian/build/commit/40665cde86285060e6bdd5ef7dc33be6c301ec66 +> X-Git-Archeology: Date: Sun, 13 Dec 2020 23:22:08 -0500 +> X-Git-Archeology: From: tonymac32 +> X-Git-Archeology: Subject: [ rockchip64 ] Patch reorg round 2 +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision e7377248b3cae186e24e2be781cd3365b43246f0: https://github.com/armbian/build/commit/e7377248b3cae186e24e2be781cd3365b43246f0 +> X-Git-Archeology: Date: Thu, 22 Jul 2021 00:15:54 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Second part of EDGE bumping to 5.13.y (#3045) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 744ea89a589d62cb6f409baab60fc6664520bc39: https://github.com/armbian/build/commit/744ea89a589d62cb6f409baab60fc6664520bc39 +> X-Git-Archeology: Date: Wed, 08 Sep 2021 17:51:34 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bumping EDGE kernel to 5.14.y (#3125) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e: https://github.com/armbian/build/commit/dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e +> X-Git-Archeology: Date: Tue, 09 Nov 2021 18:06:34 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump imx6, xu4, rockchip64 and jetson-nano to 5.15 (#3238) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +index f5f521986d43..6eddc07a958f 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +@@ -838,7 +838,7 @@ &spi1 { + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; +- spi-max-frequency = <10000000>; ++ spi-max-frequency = <3000000>; + }; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpro64-work-led-heartbeat.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-work-led-heartbeat.patch new file mode 100644 index 000000000000..9e17aa826118 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-work-led-heartbeat.patch @@ -0,0 +1,95 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Piotr Szczepanik +Date: Mon, 24 Aug 2020 22:47:03 +0200 +Subject: [ARCHEOLOGY] Switch RockPro64 work led to heartbeat trigger + +> X-Git-Archeology: - Revision 42e76b9277ad492e935cc76c2b37c9f6d882a675: https://github.com/armbian/build/commit/42e76b9277ad492e935cc76c2b37c9f6d882a675 +> X-Git-Archeology: Date: Mon, 24 Aug 2020 22:47:03 +0200 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch RockPro64 work led to heartbeat trigger +> X-Git-Archeology: +> X-Git-Archeology: - Revision d1eb0003854909824d17b529cd513feb542bf228: https://github.com/armbian/build/commit/d1eb0003854909824d17b529cd513feb542bf228 +> X-Git-Archeology: Date: Mon, 24 Aug 2020 23:11:20 +0200 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch RockPro64 work led to heartbeat trigger (in legacy too) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 4d4c3f58ffc1cbfbb060cbabc9eb414036a2fda5: https://github.com/armbian/build/commit/4d4c3f58ffc1cbfbb060cbabc9eb414036a2fda5 +> X-Git-Archeology: Date: Wed, 02 Sep 2020 23:22:09 +0200 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switched rockchip64 curent to kernel 5.8.y (#2175) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision e7377248b3cae186e24e2be781cd3365b43246f0: https://github.com/armbian/build/commit/e7377248b3cae186e24e2be781cd3365b43246f0 +> X-Git-Archeology: Date: Thu, 22 Jul 2021 00:15:54 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Second part of EDGE bumping to 5.13.y (#3045) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 744ea89a589d62cb6f409baab60fc6664520bc39: https://github.com/armbian/build/commit/744ea89a589d62cb6f409baab60fc6664520bc39 +> X-Git-Archeology: Date: Wed, 08 Sep 2021 17:51:34 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bumping EDGE kernel to 5.14.y (#3125) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e: https://github.com/armbian/build/commit/dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e +> X-Git-Archeology: Date: Tue, 09 Nov 2021 18:06:34 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump imx6, xu4, rockchip64 and jetson-nano to 5.15 (#3238) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +index 6eddc07a958f..eb1eebadb637 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +@@ -66,7 +66,7 @@ leds { + + work_led: led-0 { + label = "work"; +- default-state = "on"; ++ linux,default-trigger = "heartbeat"; + gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rocks0-0001-deviceTree.patch b/patch/kernel/archive/rockchip64-6.10/board-rocks0-0001-deviceTree.patch new file mode 100644 index 000000000000..886bbce39a4e --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rocks0-0001-deviceTree.patch @@ -0,0 +1,366 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Brent Roman +Date: Wed, 7 Feb 2024 18:02:07 -0800 +Subject: Added Linux device tree for Rock S0 + +Signed-off-by: Brent Roman +--- + arch/arm64/boot/dts/rockchip/rk3308-rock-s0.dts | 347 ++++++++++ + 1 files changed, 347 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308-rock-s0.dts b/arch/arm64/boot/dts/rockchip/rk3308-rock-s0.dts +new file mode 100644 +index 000000000..aded16959 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3308-rock-s0.dts +@@ -0,0 +1,347 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2019 Akash Gajjar ++ * Copyright (c) 2019 Jagan Teki ++ * Revised: 2024 Brent Roman ++ */ ++ ++/dts-v1/; ++#include "rk3308.dtsi" ++ ++/ { ++ model = "Radxa ROCK S0"; ++ compatible = "radxa,rock-s0", "rockchip,rk3308"; ++ ++ chosen { ++ stdout-path = "serial0:1500000n8"; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&green_led_gio>; ++ ++ green-led { ++ label = "rock-s0:green:power"; ++ gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "heartbeat"; ++ default-state = "on"; ++ }; ++ }; ++ ++ acodec-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,name = "rockchip,rk3308-acodec"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,codec-hp-det; ++ simple-audio-card,widgets = ++ "Headphone", "Headphones"; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s_8ch_2>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&codec>; ++ }; ++ }; ++ ++ sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,name = "i2s_8ch_0"; ++ ++ simple-audio-card,dai-link@1 { ++ format = "i2s"; ++ cpu { ++ sound-dai = <&i2s_8ch_0>; ++ }; ++ ++ codec { ++ sound-dai = <&pcm5102a>; ++ }; ++ }; ++ }; ++ ++ pcm5102a: pcm5102a { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5102a"; ++ pcm510x,format = "i2s"; ++ }; ++ ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ pinctrl-0 = <&wifi_enable_h>; ++ pinctrl-names = "default"; ++ /* ++ * On the module itself this is one of these (depending ++ * on the actual card populated): ++ * - SDIO_RESET_L_WL_REG_ON ++ * - PDN (power down when low) ++ */ ++ reset-gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>; ++ }; ++ ++ vcc_1v8: vcc-1v8 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_1v8"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vin-supply = <&vcc_io>; ++ }; ++ ++ vcc_io: vcc-io { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_io"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vcc5v0_sys>; ++ }; ++ ++ vcc_ddr: vcc-ddr { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_ddr"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1500000>; ++ regulator-max-microvolt = <1500000>; ++ vin-supply = <&vcc5v0_sys>; ++ }; ++ ++ vcc5v0_otg: vcc5v0-otg { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&otg_vbus_drv>; ++ regulator-name = "vcc5v0_otg"; ++ regulator-always-on; ++ vin-supply = <&vcc5v0_sys>; ++ }; ++ ++ 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>; ++ }; ++ ++ vdd_core: vdd-core { ++ compatible = "pwm-regulator"; ++ pwms = <&pwm0 0 5000 1>; ++ pwm-supply = <&vcc5v0_sys>; ++ regulator-name = "vdd_core"; ++ regulator-min-microvolt = <827000>; ++ regulator-max-microvolt = <1340000>; ++ regulator-init-microvolt = <1015000>; ++ regulator-settling-time-up-us = <250>; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ vdd_log: vdd-log { ++ compatible = "regulator-fixed"; ++ regulator-name = "vdd_log"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1050000>; ++ regulator-max-microvolt = <1050000>; ++ vin-supply = <&vcc5v0_sys>; ++ }; ++ ++ board_antenna: board-antenna { ++ status = "okay"; ++ compatible = "regulator-fixed"; ++ enable-active-low; ++ gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; ++ regulator-always-on; ++ regulator-boot-on; ++ pinctrl-0 = <&ant_1>; ++ pinctrl-names = "default"; ++ regulator-name = "board_antenna"; ++ }; ++}; ++ ++&acodec { ++ status = "okay"; ++ #sound-dai-cells = <0>; ++}; ++ ++&cpu0 { ++ cpu-supply = <&vdd_core>; ++}; ++ ++&emmc { ++ cap-mmc-highspeed; ++ mmc-hs200-1_8v; ++ non-removable; ++ vmmc-supply = <&vcc_io>; //was vin-supply ++ status = "okay"; ++}; ++ ++&sdmmc { ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ card-detect-delay = <800>; ++ status = "okay"; ++}; ++ ++&sdio { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ cap-sd-highspeed; ++ cap-sdio-irq; ++ keep-power-in-suspend; ++ mmc-pwrseq = <&sdio_pwrseq>; ++ non-removable; ++ no-mmc; ++ status = "okay"; ++ ++ AP6212: wifi@1 { ++ compatible = "brcm,bcm4329-fmac"; ++ reg = <1>; ++ interrupt-parent = <&gpio0>; ++ interrupts = ; ++ interrupt-names = "host-wake"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_host_wake>; ++ }; ++}; ++ ++&gmac { ++ phy-supply = <&vcc_io>; ++ clock_in_out = "output"; ++ assigned-clocks = <&cru SCLK_MAC>; ++ assigned-clock-parents = <&cru SCLK_MAC_SRC>; ++ snps,reset-gpio = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 50000 50000>; ++ status = "okay"; ++}; ++ ++&i2s_8ch_0 { ++ assigned-clocks = <&cru SCLK_I2S0_8CH_RX>; ++ assigned-clock-parents = <&cru SCLK_I2S0_8CH_TX_MUX>; ++ rockchip,clk-trcm = <1>; ++ #sound-dai-cells = <0>; ++}; ++ ++&i2s_8ch_2 { ++ status = "okay"; ++ #sound-dai-cells = <0>; ++}; ++ ++&pinctrl { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rtc_32k>; ++ ++ leds { ++ green_led_gio: green-led-gpio { ++ rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ usb { ++ otg_vbus_drv: otg-vbus-drv { ++ rockchip,pins = <0 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ wifi { ++ wifi_host_wake: wifi-host-wake { ++ rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ }; ++ antenna { ++ ant_1: ant-1 { ++ rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++}; ++ ++&pwm0 { ++ status = "okay"; ++ pinctrl-0 = <&pwm0_pin_pull_down>; ++}; ++ ++&saradc { ++ vref-supply = <&vcc_1v8>; ++ status = "okay"; ++}; ++ ++&tsadc { ++ rockchip,hw-tshut-mode = <0>; /* 0:CRU */ ++ rockchip,hw-tshut-polarity = <1>; /* 1:HIGH */ ++ status = "okay"; ++}; ++ ++&i2c1 { ++ status = "okay"; ++}; ++ ++&spi2 { ++// status = "okay"; //conflicts with UART2 ++ max-freq = <10000000>; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&uart4 { ++ status = "okay"; ++ ++ bluetooth { ++ compatible = "realtek,rtl8723bs-bt"; ++ device-wake-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>; ++ host-wake-gpios = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>; ++ }; ++}; ++ ++&u2phy { ++ status = "okay"; ++ ++ u2phy_host: host-port { ++ phy-supply = <&vcc5v0_otg>; ++ status = "okay"; ++ }; ++ ++ u2phy_otg: otg-port { ++ status = "okay"; ++ }; ++}; ++ ++&usb20_otg { ++ status = "okay"; ++}; ++ ++&usb_host_ehci { ++ status = "okay"; ++}; ++ ++&usb_host_ohci{ ++ status = "okay"; ++}; ++ ++&wdt { ++ status = "okay"; ++}; ++ +-- +Created with Armbian build tools https://github.com/armbian/build + diff --git a/patch/kernel/archive/rockchip64-6.10/drv-spi-spidev-remove-warnings.patch b/patch/kernel/archive/rockchip64-6.10/drv-spi-spidev-remove-warnings.patch new file mode 100644 index 000000000000..3a6d63592060 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/drv-spi-spidev-remove-warnings.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: The-going <48602507+The-going@users.noreply.github.com> +Date: Wed, 2 Feb 2022 11:56:51 +0300 +Subject: drv:spi:spidev remove warnings + +--- + drivers/spi/spidev.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c +index d13dc15cc191..90d9a33a97bf 100644 +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -704,6 +704,7 @@ static const struct file_operations spidev_fops = { + static struct class *spidev_class; + + static const struct spi_device_id spidev_spi_ids[] = { ++ { .name = "spi-dev" }, + { .name = "dh2228fv" }, + { .name = "ltc2488" }, + { .name = "sx1301" }, +@@ -732,6 +733,7 @@ static int spidev_of_check(struct device *dev) + } + + static const struct of_device_id spidev_dt_ids[] = { ++ { .compatible = "armbian,spi-dev", .data = &spidev_of_check }, + { .compatible = "cisco,spi-petra", .data = &spidev_of_check }, + { .compatible = "dh,dhcom-board", .data = &spidev_of_check }, + { .compatible = "lineartechnology,ltc2488", .data = &spidev_of_check }, +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3308-sakurapi-rk3308b.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3308-sakurapi-rk3308b.dts new file mode 100644 index 000000000000..7d942a8f5e54 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3308-sakurapi-rk3308b.dts @@ -0,0 +1,226 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Akash Gajjar + * Copyright (c) 2019 Jagan Teki + * Copyright (C) 2024 Chiyuki Akatsuki + */ + +/dts-v1/; +#include "rk3308.dtsi" + +/ { + model = "Sakura Pi RK3308B"; + compatible = "rockchip,rk3308"; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + pinctrl-0 = <&wifi_enable_h>; + pinctrl-names = "default"; + /* + * On the module itself this is one of these (depending + * on the actual card populated): + * - SDIO_RESET_L_WL_REG_ON + * - PDN (power down when low) + */ + reset-gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>; + }; + + 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>; + }; + + vdd_core: vdd-core { + compatible = "pwm-regulator"; + pwms = <&pwm0 0 5000 1>; + regulator-name = "vdd_core"; + regulator-min-microvolt = <827000>; + regulator-max-microvolt = <1340000>; + regulator-init-microvolt = <1015000>; + regulator-settling-time-up-us = <250>; + regulator-always-on; + regulator-boot-on; + pwm-supply = <&vcc5v0_sys>; + }; + + vdd_log: vdd-log { + compatible = "regulator-fixed"; + regulator-name = "vdd_log"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1050000>; + regulator-max-microvolt = <1050000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc_ddr: vcc-ddr { + compatible = "regulator-fixed"; + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc_1v8: vcc-1v8 { + compatible = "regulator-fixed"; + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_io>; + }; + + vcc_io: vcc-io { + compatible = "regulator-fixed"; + regulator-name = "vcc_io"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_phy"; + regulator-always-on; + regulator-boot-on; + }; + + vcc5v0_otg: vcc5v0-otg { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_otg"; + regulator-always-on; + gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>; + enable-active-high; + pinctrl-names = "default"; + pinctrl-0 = <&otg_vbus_drv>; + vin-supply = <&vcc5v0_sys>; + }; +}; + +&cpu0 { + cpu-supply = <&vdd_core>; +}; + +&emmc { + bus-width = <8>; + cap-mmc-highspeed; + non-removable; + status = "okay"; +}; + +&i2c1 { + status = "okay"; +}; + +&sdmmc { + cap-mmc-highspeed; + cap-sd-highspeed; + disable-wp; + pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_det &sdmmc_bus4>; + card-detect-delay = <800>; + status = "okay"; +}; + +&sdio { + #address-cells = <1>; + #size-cells = <0>; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + no-mmc; + status = "okay"; + + brcmf: wifi@1 { + compatible = "brcm,bcm43455-fmac"; + reg = <1>; + interrupt-parent = <&gpio0>; + interrupts = ; + interrupt-names = "host-wake"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_host_wake>; + }; +}; + +&spi2 { + status = "okay"; + max-freq = <10000000>; +}; + +&pinctrl { + pinctrl-names = "default"; + pinctrl-0 = <&rtc_32k>; + + usb { + otg_vbus_drv: otg-vbus-drv { + rockchip,pins = <0 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wifi { + wifi_host_wake: wifi-host-wake { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; +}; + +&pwm0 { + status = "okay"; + pinctrl-0 = <&pwm0_pin_pull_down>; +}; + +&saradc { + vref-supply = <&vcc_1v8>; + status = "okay"; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&uart2m0_xfer>; + status = "okay"; +}; + +&usb20_otg { + status = "okay"; +}; + +&u2phy { + status = "okay"; +}; + +&u2phy_otg { + status = "okay"; +}; + +&u2phy_host { + state = "okay"; +}; + +&usb_host_ehci { + status = "okay"; +}; + +&usb_host_ohci{ + status = "okay"; +}; + diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3318-box.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3318-box.dts new file mode 100644 index 000000000000..8024338b41f5 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3318-box.dts @@ -0,0 +1,1007 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2020 Paolo Sabatino + */ + +/dts-v1/; +#include "dt-bindings/pwm/pwm.h" +#include "dt-bindings/input/input.h" +#include +#include +#include "rk3328.dtsi" + +/ { + model = "Rockchip RK3318 BOX"; + compatible = "rockchip,rk3318-box", "rockchip,rk3328-box", "rockchip,rk3328"; + + aliases { + mmc0 = &sdmmc; + mmc1 = &sdio; + mmc2 = &emmc; + mmc3 = &sdmmc_ext; + mmc4 = &sdio_ext; + }; + + /delete-node/ opp-table-0; + /delete-node/ gpu-opp-table; + + cpu0_opp_table: opp_table0 { + compatible = "operating-points-v2"; + opp-shared; + + opp-600000000 { + opp-hz = /bits/ 64 <600000000>; + opp-microvolt = <950000>; + clock-latency-ns = <40000>; + opp-suspend; + }; + opp-816000000 { + opp-hz = /bits/ 64 <816000000>; + opp-microvolt = <1000000>; + clock-latency-ns = <40000>; + }; + opp-1008000000 { + opp-hz = /bits/ 64 <1008000000>; + opp-microvolt = <1100000>; + clock-latency-ns = <40000>; + }; + opp-1200000000 { + opp-hz = /bits/ 64 <1200000000>; + opp-microvolt = <1200000>; + clock-latency-ns = <40000>; + status = "disabled"; + }; + opp-1296000000 { + opp-hz = /bits/ 64 <1296000000>; + opp-microvolt = <1275000>; + clock-latency-ns = <40000>; + status = "disabled"; + }; + }; + + gpu_opp_table: gpu-opp-table { + compatible = "operating-points-v2"; + + opp-200000000 { + opp-hz = /bits/ 64 <200000000>; + opp-microvolt = <1000000 950000 1200000>; + }; + + opp-300000000 { + opp-hz = /bits/ 64 <300000000>; + opp-microvolt = <1050000 950000 1200000>; + }; + + opp-400000000 { + opp-hz = /bits/ 64 <400000000>; + opp-microvolt = <1050000 950000 1200000>; + }; + + opp-500000000 { + opp-hz = /bits/ 64 <500000000>; + opp-microvolt = <1100000 950000 1200000>; + }; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + adc_keys: adc-keys { + + compatible = "adc-keys"; + io-channels = <&saradc 0>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <1800000>; + poll-interval = <100>; + + recovery { + label = "recovery"; + linux,code = ; + press-threshold-microvolt = <17000>; + }; + + }; + + xin32k: xin32k { + compatible = "fixed-clock"; + clock-frequency = <32768>; + clock-output-names = "xin32k"; + #clock-cells = <0>; + }; + + gmac_clkin: gmac-clkin { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "gmac_clkin"; + #clock-cells = <0x00>; + }; + + regulators { + compatible = "simple-bus"; + #address-cells = <0x01>; + #size-cells = <0x00>; + + vcc_18: regulator@0 { + compatible = "regulator-fixed"; + regulator-name = "vccio_1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + + vcc_io: regulator@1 { + compatible = "regulator-fixed"; + regulator-name = "vccio_3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + }; + + vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_phy"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + }; + + vcc_sys: vcc-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vcc_sd: sdmmc-regulator { + compatible = "regulator-fixed"; + gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0m1_pin>; + regulator-name = "vcc_sd"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_io>; + }; + + /* + * USB3 vbus + */ + vcc_host_vbus: vcc-host-vbus { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&usb30_host_drv>; + regulator-name = "vcc_host_vbus"; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_sys>; + }; + + /* + * USB2 OTG vbus + */ + vcc_otg_vbus: vcc-otg-vbus { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&usb20_host_drv>; + regulator-name = "vcc_otg_vbus"; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_sys>; + }; + + vdd_arm: vdd-arm { + compatible = "pwm-regulator"; + pwms = <&pwm0 0 5000 PWM_POLARITY_INVERTED>; + pwm-supply = <&vcc_sys>; + regulator-name = "vdd_arm"; + regulator-min-microvolt = <950000>; + regulator-max-microvolt = <1400000>; + regulator-ramp-delay = <12500>; + regulator-settling-time-up-us = <250>; + regulator-always-on; + regulator-boot-on; + }; + + vdd_logic: vdd-log { + compatible = "pwm-regulator"; + pwms = <&pwm1 0 5000 PWM_POLARITY_INVERTED>; + pwm-supply = <&vcc_sys>; + regulator-name = "vdd_log"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <1300000>; + regulator-ramp-delay = <12500>; + regulator-settling-time-up-us = <250>; + regulator-always-on; + regulator-boot-on; + }; + + gpio_led: gpio-leds { + compatible = "gpio-leds"; + + pinctrl-names = "default"; + pinctrl-0 = <&working_led>; + + working { + gpios = <&gpio2 RK_PC7 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "timer"; + default-state = "on"; + }; + + }; + + ir-receiver { + compatible = "gpio-ir-receiver"; + gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&ir_int>; + pinctrl-names = "default"; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + + /* + * On the module itself this is one of these (depending + * on the actual card populated): + * - SDIO_RESET_L_WL_REG_ON + * - PDN (power down when low) + */ + reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; + }; + + /* + wireless-bluetooth { + compatible = "bluetooth-platdata"; + uart_rts_gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_LOW>; + pinctrl-names = "default", "rts_gpio"; + pinctrl-0 = <&uart0_rts>; + pinctrl-1 = <&uart0_rts_gpio>; + BT,power_gpio = <&gpio1 RK_PC5 GPIO_ACTIVE_HIGH>; + BT,wake_host_irq = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>; + }; + + wireless-wlan { + compatible = "wlan-platdata"; + rockchip,grf = <&grf>; + wifi_chip_type = "ap6330"; + sdio_vref = <1800>; + WIFI,host_wake_irq = <&gpio1 RK_PC3 GPIO_ACTIVE_HIGH>; + }; + */ + + fd628_dev { + compatible = "fd628_dev"; + fd628_gpio_clk = <&gpio2 RK_PC0 GPIO_ACTIVE_HIGH>; + fd628_gpio_dat = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; + status = "okay"; + }; + + analog-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,name = "ANALOG"; + + simple-audio-card,cpu { + sound-dai = <&i2s1>; + }; + + simple-audio-card,codec { + sound-dai = <&codec>; + }; + }; + + hdmi-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <128>; + simple-audio-card,name = "HDMI"; + + simple-audio-card,cpu { + sound-dai = <&i2s0>; + }; + + simple-audio-card,codec { + sound-dai = <&hdmi>; + }; + }; + + /* + * This node is a duplicate of sdmmc_ext: most common board do not use sdmmc_ext + * controller, so it is left unused. Some other boards use it as sdio controller + * for wifi and some others use it as sdcard controller. + * To handle the most critical situation, the controller will be configured as + * sdcard controller by default. An overlay can be set to disable the sdmmc_ext + * node and enable this sdio_ext in case wifi chips are attached to this. + */ + sdio_ext: mmc@ff5f0000 { + compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc"; + reg = <0x0 0xff5f0000 0x0 0x4000>; + interrupts = ; + clocks = <&cru HCLK_SDMMC_EXT>, <&cru SCLK_SDMMC_EXT>, + <&cru SCLK_SDMMC_EXT_DRV>, <&cru SCLK_SDMMC_EXT_SAMPLE>; + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; + fifo-depth = <0x100>; + max-frequency = <150000000>; + resets = <&cru SRST_SDMMCEXT>; + reset-names = "reset"; + #address-cells = <1>; + #size-cells = <0>; + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + disable-wp; + keep-power-in-suspend; + mmc-pwrseq = <>; + non-removable; + num-slots = <1>; + pinctrl-0 = <&sdmmc0ext_cmd &sdmmc0ext_clk &sdmmc0ext_bus4>; + pinctrl-names = "default"; + supports-sdio; + status = "disabled"; + }; + + ddr_timing: ddr_timing { + compatible = "rockchip,ddr-timing"; + ddr3_speed_bin = ; + ddr4_speed_bin = ; + pd_idle = <0>; + sr_idle = <0>; + sr_mc_gate_idle = <0>; + srpd_lite_idle = <0>; + standby_idle = <0>; + + auto_pd_dis_freq = <1066>; + auto_sr_dis_freq = <800>; + ddr3_dll_dis_freq = <300>; + ddr4_dll_dis_freq = <625>; + phy_dll_dis_freq = <400>; + + ddr3_odt_dis_freq = <100>; + phy_ddr3_odt_dis_freq = <100>; + ddr3_drv = ; + ddr3_odt = ; + phy_ddr3_ca_drv = ; + phy_ddr3_ck_drv = ; + phy_ddr3_dq_drv = ; + phy_ddr3_odt = ; + + lpddr3_odt_dis_freq = <666>; + phy_lpddr3_odt_dis_freq = <666>; + lpddr3_drv = ; + lpddr3_odt = ; + phy_lpddr3_ca_drv = ; + phy_lpddr3_ck_drv = ; + phy_lpddr3_dq_drv = ; + phy_lpddr3_odt = ; + + lpddr4_odt_dis_freq = <800>; + phy_lpddr4_odt_dis_freq = <800>; + lpddr4_drv = ; + lpddr4_dq_odt = ; + lpddr4_ca_odt = ; + phy_lpddr4_ca_drv = ; + phy_lpddr4_ck_cs_drv = ; + phy_lpddr4_dq_drv = ; + phy_lpddr4_odt = ; + + ddr4_odt_dis_freq = <666>; + phy_ddr4_odt_dis_freq = <666>; + ddr4_drv = ; + ddr4_odt = ; + phy_ddr4_ca_drv = ; + phy_ddr4_ck_drv = ; + phy_ddr4_dq_drv = ; + phy_ddr4_odt = ; + + /* CA de-skew, one step is 47.8ps, range 0-15 */ + ddr3a1_ddr4a9_de-skew = <2>; + ddr3a0_ddr4a10_de-skew = <3>; + ddr3a3_ddr4a6_de-skew = <3>; + ddr3a2_ddr4a4_de-skew = <2>; + ddr3a5_ddr4a8_de-skew = <3>; + ddr3a4_ddr4a5_de-skew = <2>; + ddr3a7_ddr4a11_de-skew = <3>; + ddr3a6_ddr4a7_de-skew = <2>; + ddr3a9_ddr4a0_de-skew = <2>; + ddr3a8_ddr4a13_de-skew = <1>; + ddr3a11_ddr4a3_de-skew = <2>; + ddr3a10_ddr4cs0_de-skew = <2>; + ddr3a13_ddr4a2_de-skew = <1>; + ddr3a12_ddr4ba1_de-skew = <2>; + ddr3a15_ddr4odt0_de-skew = <3>; + ddr3a14_ddr4a1_de-skew = <2>; + ddr3ba1_ddr4a15_de-skew = <2>; + ddr3ba0_ddr4bg0_de-skew = <4>; + ddr3ras_ddr4cke_de-skew = <4>; + ddr3ba2_ddr4ba0_de-skew = <3>; + ddr3we_ddr4bg1_de-skew = <2>; + ddr3cas_ddr4a12_de-skew = <2>; + ddr3ckn_ddr4ckn_de-skew = <11>; + ddr3ckp_ddr4ckp_de-skew = <11>; + ddr3cke_ddr4a16_de-skew = <2>; + ddr3odt0_ddr4a14_de-skew = <4>; + ddr3cs0_ddr4act_de-skew = <4>; + ddr3reset_ddr4reset_de-skew = <7>; + ddr3cs1_ddr4cs1_de-skew = <7>; + ddr3odt1_ddr4odt1_de-skew = <7>; + + /* DATA de-skew + * RX one step is 25.1ps, range 0-15 + * TX one step is 47.8ps, range 0-15 + */ + cs0_dm0_rx_de-skew = <12>; + cs0_dm0_tx_de-skew = <10>; + cs0_dq0_rx_de-skew = <12>; + cs0_dq0_tx_de-skew = <10>; + cs0_dq1_rx_de-skew = <12>; + cs0_dq1_tx_de-skew = <10>; + cs0_dq2_rx_de-skew = <12>; + cs0_dq2_tx_de-skew = <10>; + cs0_dq3_rx_de-skew = <12>; + cs0_dq3_tx_de-skew = <10>; + cs0_dq4_rx_de-skew = <12>; + cs0_dq4_tx_de-skew = <10>; + cs0_dq5_rx_de-skew = <12>; + cs0_dq5_tx_de-skew = <10>; + cs0_dq6_rx_de-skew = <12>; + cs0_dq6_tx_de-skew = <10>; + cs0_dq7_rx_de-skew = <12>; + cs0_dq7_tx_de-skew = <10>; + cs0_dqs0_rx_de-skew = <10>; + cs0_dqs0p_tx_de-skew = <12>; + cs0_dqs0n_tx_de-skew = <12>; + + cs0_dm1_rx_de-skew = <10>; + cs0_dm1_tx_de-skew = <8>; + cs0_dq8_rx_de-skew = <10>; + cs0_dq8_tx_de-skew = <8>; + cs0_dq9_rx_de-skew = <10>; + cs0_dq9_tx_de-skew = <8>; + cs0_dq10_rx_de-skew = <10>; + cs0_dq10_tx_de-skew = <8>; + cs0_dq11_rx_de-skew = <10>; + cs0_dq11_tx_de-skew = <8>; + cs0_dq12_rx_de-skew = <10>; + cs0_dq12_tx_de-skew = <8>; + cs0_dq13_rx_de-skew = <10>; + cs0_dq13_tx_de-skew = <8>; + cs0_dq14_rx_de-skew = <10>; + cs0_dq14_tx_de-skew = <8>; + cs0_dq15_rx_de-skew = <10>; + cs0_dq15_tx_de-skew = <8>; + cs0_dqs1_rx_de-skew = <9>; + cs0_dqs1p_tx_de-skew = <10>; + cs0_dqs1n_tx_de-skew = <10>; + + cs0_dm2_rx_de-skew = <10>; + cs0_dm2_tx_de-skew = <9>; + cs0_dq16_rx_de-skew = <10>; + cs0_dq16_tx_de-skew = <9>; + cs0_dq17_rx_de-skew = <10>; + cs0_dq17_tx_de-skew = <9>; + cs0_dq18_rx_de-skew = <10>; + cs0_dq18_tx_de-skew = <9>; + cs0_dq19_rx_de-skew = <10>; + cs0_dq19_tx_de-skew = <9>; + cs0_dq20_rx_de-skew = <10>; + cs0_dq20_tx_de-skew = <9>; + cs0_dq21_rx_de-skew = <10>; + cs0_dq21_tx_de-skew = <9>; + cs0_dq22_rx_de-skew = <10>; + cs0_dq22_tx_de-skew = <9>; + cs0_dq23_rx_de-skew = <10>; + cs0_dq23_tx_de-skew = <9>; + cs0_dqs2_rx_de-skew = <9>; + cs0_dqs2p_tx_de-skew = <11>; + cs0_dqs2n_tx_de-skew = <11>; + + cs0_dm3_rx_de-skew = <7>; + cs0_dm3_tx_de-skew = <7>; + cs0_dq24_rx_de-skew = <7>; + cs0_dq24_tx_de-skew = <7>; + cs0_dq25_rx_de-skew = <7>; + cs0_dq25_tx_de-skew = <7>; + cs0_dq26_rx_de-skew = <7>; + cs0_dq26_tx_de-skew = <7>; + cs0_dq27_rx_de-skew = <7>; + cs0_dq27_tx_de-skew = <7>; + cs0_dq28_rx_de-skew = <7>; + cs0_dq28_tx_de-skew = <7>; + cs0_dq29_rx_de-skew = <7>; + cs0_dq29_tx_de-skew = <7>; + cs0_dq30_rx_de-skew = <7>; + cs0_dq30_tx_de-skew = <7>; + cs0_dq31_rx_de-skew = <7>; + cs0_dq31_tx_de-skew = <7>; + cs0_dqs3_rx_de-skew = <7>; + cs0_dqs3p_tx_de-skew = <10>; + cs0_dqs3n_tx_de-skew = <10>; + + cs1_dm0_rx_de-skew = <7>; + cs1_dm0_tx_de-skew = <8>; + cs1_dq0_rx_de-skew = <7>; + cs1_dq0_tx_de-skew = <8>; + cs1_dq1_rx_de-skew = <7>; + cs1_dq1_tx_de-skew = <8>; + cs1_dq2_rx_de-skew = <7>; + cs1_dq2_tx_de-skew = <8>; + cs1_dq3_rx_de-skew = <7>; + cs1_dq3_tx_de-skew = <8>; + cs1_dq4_rx_de-skew = <7>; + cs1_dq4_tx_de-skew = <8>; + cs1_dq5_rx_de-skew = <7>; + cs1_dq5_tx_de-skew = <8>; + cs1_dq6_rx_de-skew = <7>; + cs1_dq6_tx_de-skew = <8>; + cs1_dq7_rx_de-skew = <7>; + cs1_dq7_tx_de-skew = <8>; + cs1_dqs0_rx_de-skew = <6>; + cs1_dqs0p_tx_de-skew = <9>; + cs1_dqs0n_tx_de-skew = <9>; + + cs1_dm1_rx_de-skew = <7>; + cs1_dm1_tx_de-skew = <7>; + cs1_dq8_rx_de-skew = <7>; + cs1_dq8_tx_de-skew = <8>; + cs1_dq9_rx_de-skew = <7>; + cs1_dq9_tx_de-skew = <7>; + cs1_dq10_rx_de-skew = <7>; + cs1_dq10_tx_de-skew = <8>; + cs1_dq11_rx_de-skew = <7>; + cs1_dq11_tx_de-skew = <7>; + cs1_dq12_rx_de-skew = <7>; + cs1_dq12_tx_de-skew = <8>; + cs1_dq13_rx_de-skew = <7>; + cs1_dq13_tx_de-skew = <7>; + cs1_dq14_rx_de-skew = <7>; + cs1_dq14_tx_de-skew = <8>; + cs1_dq15_rx_de-skew = <7>; + cs1_dq15_tx_de-skew = <7>; + cs1_dqs1_rx_de-skew = <7>; + cs1_dqs1p_tx_de-skew = <9>; + cs1_dqs1n_tx_de-skew = <9>; + + cs1_dm2_rx_de-skew = <7>; + cs1_dm2_tx_de-skew = <8>; + cs1_dq16_rx_de-skew = <7>; + cs1_dq16_tx_de-skew = <8>; + cs1_dq17_rx_de-skew = <7>; + cs1_dq17_tx_de-skew = <8>; + cs1_dq18_rx_de-skew = <7>; + cs1_dq18_tx_de-skew = <8>; + cs1_dq19_rx_de-skew = <7>; + cs1_dq19_tx_de-skew = <8>; + cs1_dq20_rx_de-skew = <7>; + cs1_dq20_tx_de-skew = <8>; + cs1_dq21_rx_de-skew = <7>; + cs1_dq21_tx_de-skew = <8>; + cs1_dq22_rx_de-skew = <7>; + cs1_dq22_tx_de-skew = <8>; + cs1_dq23_rx_de-skew = <7>; + cs1_dq23_tx_de-skew = <8>; + cs1_dqs2_rx_de-skew = <6>; + cs1_dqs2p_tx_de-skew = <9>; + cs1_dqs2n_tx_de-skew = <9>; + + cs1_dm3_rx_de-skew = <7>; + cs1_dm3_tx_de-skew = <7>; + cs1_dq24_rx_de-skew = <7>; + cs1_dq24_tx_de-skew = <8>; + cs1_dq25_rx_de-skew = <7>; + cs1_dq25_tx_de-skew = <7>; + cs1_dq26_rx_de-skew = <7>; + cs1_dq26_tx_de-skew = <7>; + cs1_dq27_rx_de-skew = <7>; + cs1_dq27_tx_de-skew = <7>; + cs1_dq28_rx_de-skew = <7>; + cs1_dq28_tx_de-skew = <7>; + cs1_dq29_rx_de-skew = <7>; + cs1_dq29_tx_de-skew = <7>; + cs1_dq30_rx_de-skew = <7>; + cs1_dq30_tx_de-skew = <7>; + cs1_dq31_rx_de-skew = <7>; + cs1_dq31_tx_de-skew = <7>; + cs1_dqs3_rx_de-skew = <7>; + cs1_dqs3p_tx_de-skew = <9>; + cs1_dqs3n_tx_de-skew = <9>; + }; + +}; + +&dfi { + status = "okay"; +}; + +&dmc { + center-supply = <&vdd_logic>; + ddr_timing = <&ddr_timing>; + status = "disabled"; +}; + +&codec { + status = "okay"; + mute-gpios = <&grf_gpio 0 GPIO_ACTIVE_LOW>; +}; + +&cpu0 { + cpu-supply = <&vdd_arm>; +}; + +&cpu1 { + cpu-supply = <&vdd_arm>; +}; + +&cpu2 { + cpu-supply = <&vdd_arm>; +}; + +&cpu3 { + cpu-supply = <&vdd_arm>; +}; + +&display_subsystem { + status = "okay"; +}; + +&emmc { + + supports-emmc; + no-sdio; + no-sd; + cap-mmc-highspeed; + disable-wp; + non-removable; + bus-width = <8>; + num-slots = <0x01>; + + pinctrl-names = "default"; + pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; + + vmmc-supply = <&vcc_io>; + vqmmc-supply = <&vcc_18>; + + status = "okay"; +}; + +&sdmmc { + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + card-detect-delay = <500>; + cd-gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; + disable-wp; + no-sdio; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>; + supports-sd; + status = "okay"; + vmmc-supply = <&vcc_sd>; +}; + +&sdio { + #address-cells = <1>; + #size-cells = <0>; + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + disable-wp; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + num-slots = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk>; + supports-sdio; + status = "okay"; +}; + +/* + * sdmmc_ext is configured as sdcard controller and enabled by default. + * In this way boards which have the sdcard attached to sdmmc_ext will work + * by default. In case the controller is not attached to anything, the + * kernel will just autodetect and give up. + */ +&sdmmc_ext { + #address-cells = <1>; + #size-cells = <0>; + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + card-detect-delay = <500>; + cd-gpios = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>; + disable-wp; + no-sdio; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0ext_clk &sdmmc0ext_cmd &sdmmc0ext_dectn &sdmmc0ext_bus4>; + supports-sd; + status = "okay"; + vmmc-supply = <&vcc_sd>; +}; + +&gmac2phy { + phy-supply = <&vcc_phy>; + + phy-mode = "rmii"; + + clock_in_out = "output"; + assigned-clocks = <&cru SCLK_MAC2PHY>; + assigned-clock-rate = <50000000>; + assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>; + tx_delay = <0x30>; + rx_delay = <0x10>; + + status = "okay"; + +}; + +&gpu { + status = "okay"; + mali-supply = <&vdd_logic>; +}; + +/* +&h265e { + status = "okay"; +}; +*/ + +&h265e_mmu { + status = "okay"; +}; + +&hdmi { + status = "okay"; +}; + +&spdif { + pinctrl-0 = <&spdifm0_tx>; + status = "okay"; +}; + +&spdif_out { + status = "okay"; +}; + +&spdif_sound { + status = "okay"; +}; + +&hdmiphy { + status = "okay"; +}; + +&i2s0 { + status = "okay"; +}; + +&i2s1 { + status = "okay"; +}; + +&io_domains { + status = "okay"; + + vccio1-supply = <&vcc_io>; + vccio2-supply = <&vcc_18>; + vccio3-supply = <&vcc_io>; + vccio4-supply = <&vcc_18>; + vccio5-supply = <&vcc_io>; + vccio6-supply = <&vcc_io>; + pmuio-supply = <&vcc_io>; +}; + +&pinctrl { + pinctrl-names = "default"; + pinctrl-0 = <&clk_32k_out>; + + clk_32k { + clk_32k_out: clk-32k-out { + rockchip,pins = <1 RK_PD4 1 &pcfg_pull_none>; + }; + }; + + leds { + working_led: working-led { + rockchip,pins = <2 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none_2ma>; + }; + }; + + ir { + ir_int: ir-int { + rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none_4ma>;/*, + <1 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none_4ma>;*/ + }; + }; + + usb2 { + usb20_host_drv: usb20-host-drv { + rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + usb3 { + usb30_host_drv: usb30-host-drv { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wireless-wlan { + + /* + * SDIO host wake interrupt on YX_RK3328 board (sdio is attached to + * regular mmc controller mmc@ff510000) + */ + sdio_host_wake: sdio-host-wake { + rockchip,pins = <1 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + /* + * SDIO host wake interrupt on X88_PRO_B board (sdio is attached to + * alternative mmc controller mmc@ff5f0000) + */ + sdio_host_wake_ext: sdio-host-wake-ext { + rockchip,pins = <3 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + }; + +}; + +/* +&vdec { + status = "okay"; + vcodec-supply = <&vdd_logic>; +}; +*/ + +&vdec_mmu { + status = "okay"; +}; + +&threshold { + temperature = <80000>; /* millicelsius */ +}; + +&target { + temperature = <95000>; /* millicelsius */ +}; + +&soc_crit { + temperature = <100000>; /* millicelsius */ +}; + +&tsadc { + rockchip,hw-tshut-mode = <0>; + rockchip,hw-tshut-polarity = <0>; + status = "okay"; +}; + +&uart0 { + + status = "okay"; + +}; + +&uart2 { + /delete-property/ dmas; + /delete-property/ dma-names; + + status = "okay"; +}; + +&u2phy { + status = "okay"; + + u2phy_host: host-port { + status = "okay"; + }; + + u2phy_otg: otg-port { + status = "okay"; + }; +}; + +&usb20_otg { + dr_mode = "host"; + resets = <&cru SRST_USB2OTG>; + reset-names = "dwc2"; + status = "okay"; +}; + +&usb_host0_ehci { + resets = <&cru SRST_USB2HOST_EHCIPHY>; + reset-names = "ehci"; + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usbdrd3 { + #address-cells = <1>; + #size-cells = <0>; + dr_mode = "host"; + status = "okay"; +}; + +&vop { + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vpu { + status = "okay"; + vcodec-supply = <&vdd_logic>; +}; + +&vpu_mmu { + status = "okay"; +}; + +/* +&vepu { + status = "okay"; +}; +*/ + +&vepu_mmu { + status = "okay"; +}; + +&saradc { + vref-supply = <&vcc_18>; + status = "okay"; +}; + +/* +&rga { + status = "okay"; +}; +*/ + +&pwm0 { + status = "okay"; +}; + +&pwm1 { + status = "okay"; +}; + +&hdmi_sound { + status = "okay"; +}; + +&analog_sound { + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-neo3-rev02.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-neo3-rev02.dts new file mode 100644 index 000000000000..496e334d3030 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-neo3-rev02.dts @@ -0,0 +1,195 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 FriendlyElec Computer Tech. Co., Ltd. + * (http://www.friendlyarm.com) + */ + +/dts-v1/; +#include +#include "rk3328-nanopi-r2s.dts" + +/ { + model = "FriendlyElec NanoPi NEO3"; + compatible = "friendlyelec,nanopi-neo3", "rockchip,rk3328"; + + gpio-keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + autorepeat; + + pinctrl-names = "default"; + pinctrl-0 = <&gpio_key1>; + + button@0 { + gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>; + label = "reset"; + linux,code = ; + linux,input-type = <1>; + gpio-key,wakeup = <1>; + debounce-interval = <100>; + }; + }; + + i2s-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,name = "I2S Out"; + status = "okay"; + + simple-audio-card,cpu { + sound-dai = <&i2s1>; + }; + + simple-audio-card,codec { + sound-dai = <&pcm5102>; + }; + }; + + pcm5102: pcm510x { + #sound-dai-cells = <0>; + compatible = "ti,pcm5102a"; + pcm510x,format = "i2s"; + }; + + sound-spdif { + compatible = "simple-audio-card"; + simple-audio-card,name = "SPDIF"; + simple-audio-card,cpu { + sound-dai = <&spdif>; + }; + simple-audio-card,codec { + sound-dai = <&spdif_out>; + }; + }; + + spdif_out: spdif-out { + compatible = "linux,spdif-dit"; + #sound-dai-cells = <0>; + }; + + vcc_rtl8153: vcc-rtl8153-regulator { + compatible = "regulator-fixed"; + gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&usb30_en_drv>; + regulator-always-on; + regulator-name = "vcc_rtl8153"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + off-on-delay-us = <5000>; + enable-active-high; + }; +}; + +&mach { + hwrev = <2>; + model = "NanoPi NEO3"; +}; + +&i2s1 { + rockchip,playback-channels = <2>; + pinctrl-names = "default"; + pinctrl-0 = <&i2s1_mclk + &i2s1_sclk + &i2s1_lrcktx + &i2s1_lrckrx + &i2s1_sdo + &i2s1_sdi>; + status = "okay"; +}; + +&spdif { + status = "okay"; + pinctrl-0 = <&spdifm0_tx>; +}; + +&emmc { + status = "disabled"; +}; + +&i2c0 { + status = "okay"; +}; + +&leds { + status = "okay"; + +}; + +&leds_gpio { + rockchip,pins = + <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; +}; + +&pwm2 { + pinctrl-names = "default", "sleep"; + pinctrl-1 = <&pwm2_sleep_pin>; + status = "okay"; +}; + +&rk805 { + interrupt-parent = <&gpio1>; + interrupts = ; +}; + +&vccio_sd { + status = "okay"; +}; + +&io_domains { + vccio3-supply = <&vccio_sd>; +}; + +&sdmmc { + vqmmc-supply = <&vccio_sd>; + max-frequency = <150000000>; + sd-uhs-sdr50; + sd-uhs-sdr104; + status = "okay"; +}; + +&sdmmc_ext { + status = "disabled"; +}; + +&sdio_pwrseq { + status = "disabled"; +}; + +&pinctrl { + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + pwm { + pwm2_sleep_pin: pwm2-sleep-pin { + rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_output_low>; + }; + }; + + rockchip-key { + gpio_key1: gpio-key1 { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + usb { + otg_vbus_drv: otg-vbus-drv { + rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + usb30_en_drv: usb30-en-drv { + rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&uart1{ + status = "okay"; + pinctl-0 = <&uart1_xfer>; +}; + diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev00.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev00.dts new file mode 100644 index 000000000000..8ba95189c031 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev00.dts @@ -0,0 +1,126 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 FriendlyElec Computer Tech. Co., Ltd. + * (http://www.friendlyarm.com) + */ + +/dts-v1/; +#include +#include "rk3328-nanopi-r2s.dts" + +/ { + model = "FriendlyElec NanoPi R2S"; + compatible = "friendlyelec,nanopi-r2", "rockchip,rk3328"; + + gpio-keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + autorepeat; + + pinctrl-names = "default"; + pinctrl-0 = <&gpio_key1>; + + button@0 { + gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>; + label = "reset"; + linux,code = ; + linux,input-type = <1>; + gpio-key,wakeup = <1>; + debounce-interval = <100>; + }; + }; + + vcc_rtl8153: vcc-rtl8153-regulator { + compatible = "regulator-fixed"; + gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&usb30_en_drv>; + regulator-always-on; + regulator-name = "vcc_rtl8153"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + off-on-delay-us = <5000>; + enable-active-high; + }; +}; + +&mach { + hwrev = <0>; + model = "NanoPi R2S"; +}; + +&emmc { + status = "disabled"; +}; + +&i2c0 { + status = "okay"; +}; + +&leds { + status = "okay"; + + led@2 { + gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; + label = "lan_led"; + }; + + led@3 { + gpios = <&gpio2 RK_PC2 GPIO_ACTIVE_HIGH>; + label = "wan_led"; + }; +}; + +&rk805 { + interrupt-parent = <&gpio1>; + interrupts = ; +}; + +&vccio_sd { + status = "okay"; +}; + +&io_domains { + vccio3-supply = <&vccio_sd>; +}; + +&sdmmc { + vqmmc-supply = <&vccio_sd>; + max-frequency = <150000000>; + sd-uhs-sdr50; + sd-uhs-sdr104; + status = "okay"; +}; + +&sdmmc_ext { + status = "disabled"; +}; + +&sdio_pwrseq { + status = "disabled"; +}; + +&pinctrl { + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + rockchip-key { + gpio_key1: gpio-key1 { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + usb { + otg_vbus_drv: otg-vbus-drv { + rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + usb30_en_drv: usb30-en-drv { + rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev06.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev06.dts new file mode 100644 index 000000000000..5de8b51db0bf --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev06.dts @@ -0,0 +1,92 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2021 FriendlyElec Computer Tech. Co., Ltd. + * (http://www.friendlyarm.com) + */ + +/dts-v1/; + +#include "rk3328-nanopi-r2-rev00.dts" + +/ { + model = "FriendlyElec NanoPi R2C"; + compatible = "friendlyelec,nanopi-r2", "rockchip,rk3328"; +}; + +&mach { + hwrev = <6>; + model = "NanoPi R2C"; +}; + +&rgmiim1_pins { + rockchip,pins = + /* mac_txclk */ + <1 RK_PB4 2 &pcfg_pull_none_8ma>, + /* mac_rxclk */ + <1 RK_PB5 2 &pcfg_pull_none>, + /* mac_mdio */ + <1 RK_PC3 2 &pcfg_pull_none_2ma>, + /* mac_txen */ + <1 RK_PD1 2 &pcfg_pull_none_8ma>, + /* mac_clk */ + <1 RK_PC5 2 &pcfg_pull_none_2ma>, + /* mac_rxdv */ + <1 RK_PC6 2 &pcfg_pull_none>, + /* mac_mdc */ + <1 RK_PC7 2 &pcfg_pull_none_2ma>, + /* mac_rxd1 */ + <1 RK_PB2 2 &pcfg_pull_none>, + /* mac_rxd0 */ + <1 RK_PB3 2 &pcfg_pull_none>, + /* mac_txd1 */ + <1 RK_PB0 2 &pcfg_pull_none_8ma>, + /* mac_txd0 */ + <1 RK_PB1 2 &pcfg_pull_none_8ma>, + /* mac_rxd3 */ + <1 RK_PB6 2 &pcfg_pull_none>, + /* mac_rxd2 */ + <1 RK_PB7 2 &pcfg_pull_none>, + /* mac_txd3 */ + <1 RK_PC0 2 &pcfg_pull_none_8ma>, + /* mac_txd2 */ + <1 RK_PC1 2 &pcfg_pull_none_8ma>, + + /* mac_txclk */ + <0 RK_PB0 1 &pcfg_pull_none>, + /* mac_txen */ + <0 RK_PB4 1 &pcfg_pull_none>, + /* mac_clk */ + <0 RK_PD0 1 &pcfg_pull_none>, + /* mac_txd1 */ + <0 RK_PC0 1 &pcfg_pull_none>, + /* mac_txd0 */ + <0 RK_PC1 1 &pcfg_pull_none>, + /* mac_txd3 */ + <0 RK_PC7 1 &pcfg_pull_none>, + /* mac_txd2 */ + <0 RK_PC6 1 &pcfg_pull_none>; +}; + +/delete-node/ &rtl8211e; + +&gmac2io { + phy-handle = <ðphy3>; + snps,reset-delays-us = <0 15000 50000>; + tx_delay = <0x22>; + rx_delay = <0x12>; + mdio { + + ethphy3: ethernet-phy@3 { + compatible = "ethernet-phy-id0000.011a", + "ethernet-phy-ieee802.3-c22"; + reg = <3>; + interrupt-parent = <&gpio2>; + interrupts = ; + //reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; + motorcomm,clk-out-frequency-hz = <125000000>; // enable gmac clock + motorcomm,keep-pll-enabled; // keep pll run without link + motorcomm,auto-sleep-disabled; // disable sleep without link + keep-clkout-on; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev20.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev20.dts new file mode 100644 index 000000000000..ad327ca56858 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev20.dts @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 FriendlyElec Computer Tech. Co., Ltd. + * (http://www.friendlyarm.com) + */ + +/dts-v1/; +#include "rk3328-nanopi-r2s.dts" + +/ { + model = "FriendlyElec NanoPi R2"; + compatible = "friendlyelec,nanopi-r2", "rockchip,rk3328"; +}; + +&mach { + hwrev = <0x20>; + model = "NanoPi R2"; +}; + +&gmac2io { + pinctrl-0 = <&rgmiim1_pins>, <&phy_intb>, <&phy_rstb>; +}; + +&rtl8211e { + interrupt-parent = <&gpio1>; + interrupts = ; +}; + +&pinctrl { + phy { + phy_intb: phy-intb { + rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + phy_rstb: phy-rstb { + rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3328-orangepi-r1-plus-lts.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-orangepi-r1-plus-lts.dts new file mode 100644 index 000000000000..4e944e0c1908 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-orangepi-r1-plus-lts.dts @@ -0,0 +1,449 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* Copyright (c) 2020 David Bauer + * Copyright (c) 2020 Shenzhen Xunlong Software CO.,Limited + * Copyright (c) 2021 AmadeusGhost + * Revised for Orange Pi R1 Plus LTS (c) 2022 schwar3kat + * Based on Orange Pi R1 plus + */ + +/dts-v1/; + +#include +#include +#include "rk3328.dtsi" + +/ { + model = "Xunlong Orange Pi R1 Plus LTS"; + compatible = "xunlong,orangepi-r1-plus-lts", "rockchip,rk3328"; + + aliases { + ethernet1 = &rtl8153; + mmc0 = &sdmmc; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + gmac_clk: gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "gmac_clkin"; + #clock-cells = <0>; + }; + + keys { + compatible = "gpio-keys"; + pinctrl-0 = <&reset_button_pin>; + pinctrl-names = "default"; + + reset { + label = "reset"; + gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <50>; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-0 = <&lan_led_pin>, <&sys_led_pin>, <&wan_led_pin>; + pinctrl-names = "default"; + + lan_led: led-0 { + gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; + label = "orangepi-r1-plus-lts:green:lan"; + }; + + sys_led: led-1 { + gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; + label = "orangepi-r1-plus-lts:red:status"; + linux,default-trigger = "heartbeat"; + }; + + wan_led: led-2 { + gpios = <&gpio2 RK_PC2 GPIO_ACTIVE_HIGH>; + label = "orangepi-r1-plus-lts:green:wan"; + }; + }; + + vcc_io_sdio: sdmmcio-regulator { + compatible = "regulator-gpio"; + enable-active-high; + gpios = <&gpio1 RK_PD4 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&sdio_vcc_pin>; + pinctrl-names = "default"; + regulator-name = "vcc_io_sdio"; + regulator-always-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-settling-time-us = <5000>; + regulator-type = "voltage"; + startup-delay-us = <2000>; + states = <1800000 0x1>, + <3300000 0x0>; + vin-supply = <&vcc_io_33>; + }; + + vcc_sd: sdmmc-regulator { + compatible = "regulator-fixed"; + gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&sdmmc0m1_pin>; + pinctrl-names = "default"; + regulator-name = "vcc_sd"; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_io_33>; + }; + + vdd_5v: vdd-5v { + compatible = "regulator-fixed"; + regulator-name = "vdd_5v"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vdd_5v_lan: vdd-5v-lan { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&lan_vdd_pin>; + pinctrl-names = "default"; + regulator-name = "vdd_5v_lan"; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vdd_5v>; + }; +}; + +&cpu0 { + cpu-supply = <&vdd_arm>; +}; + +&cpu1 { + cpu-supply = <&vdd_arm>; +}; + +&cpu2 { + cpu-supply = <&vdd_arm>; +}; + +&cpu3 { + cpu-supply = <&vdd_arm>; +}; + +&display_subsystem { + status = "disabled"; +}; + +&gmac2io { + assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>; + assigned-clock-parents = <&gmac_clk>, <&gmac_clk>; + clock_in_out = "input"; + phy-mode = "rgmii"; + phy-supply = <&vcc_io_33>; + pinctrl-0 = <&rgmiim1_pins>; + pinctrl-names = "default"; + snps,aal; + status = "okay"; + phy-handle = <&yt8531c>; + tx_delay = <0x19>; + rx_delay = <0x05>; + + mdio { + compatible = "snps,dwmac-mdio"; + #address-cells = <1>; + #size-cells = <0>; + + yt8531c: ethernet-phy@0 { + compatible = "ethernet-phy-id4f51.e91b", + "ethernet-phy-ieee802.3-c22"; + reg = <0>; + motorcomm,clk-out-frequency-hz = <125000000>; + motorcomm,keep-pll-enabled; + motorcomm,auto-sleep-disabled; + pinctrl-0 = <ð_phy_reset_pin>; + pinctrl-names = "default"; + reset-assert-us = <15000>; + reset-deassert-us = <50000>; + reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&i2c1 { + status = "okay"; + + rk805: pmic@18 { + compatible = "rockchip,rk805"; + reg = <0x18>; + interrupt-parent = <&gpio1>; + interrupts = <24 IRQ_TYPE_LEVEL_LOW>; + #clock-cells = <1>; + clock-output-names = "xin32k", "rk805-clkout2"; + gpio-controller; + #gpio-cells = <2>; + pinctrl-0 = <&pmic_int_l>; + pinctrl-names = "default"; + rockchip,system-power-controller; + wakeup-source; + + vcc1-supply = <&vdd_5v>; + vcc2-supply = <&vdd_5v>; + vcc3-supply = <&vdd_5v>; + vcc4-supply = <&vdd_5v>; + vcc5-supply = <&vcc_io_33>; + vcc6-supply = <&vdd_5v>; + + regulators { + vdd_log: DCDC_REG1 { + regulator-name = "vdd_log"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1450000>; + regulator-ramp-delay = <12500>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; + }; + }; + + vdd_arm: DCDC_REG2 { + regulator-name = "vdd_arm"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1450000>; + regulator-ramp-delay = <12500>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <950000>; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_io_33: DCDC_REG4 { + regulator-name = "vcc_io_33"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_18: LDO_REG1 { + regulator-name = "vcc_18"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc18_emmc: LDO_REG2 { + regulator-name = "vcc18_emmc"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdd_10: LDO_REG3 { + regulator-name = "vdd_10"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1000000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; + }; + }; + }; + }; +}; + +&io_domains { + pmuio-supply = <&vcc_io_33>; + vccio1-supply = <&vcc_io_33>; + vccio2-supply = <&vcc18_emmc>; + vccio3-supply = <&vcc_io_sdio>; + vccio4-supply = <&vcc_18>; + vccio5-supply = <&vcc_io_33>; + vccio6-supply = <&vcc_io_33>; + status = "okay"; +}; + +&pinctrl { + button { + reset_button_pin: reset-button-pin { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + gmac2io { + eth_phy_reset_pin: eth-phy-reset-pin { + rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + leds { + lan_led_pin: lan-led-pin { + rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + sys_led_pin: sys-led-pin { + rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + wan_led_pin: wan-led-pin { + rockchip,pins = <2 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + lan { + lan_vdd_pin: lan-vdd-pin { + rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + sd { + sdio_vcc_pin: sdio-vcc-pin { + rockchip,pins = <1 RK_PD4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; + +&pwm2 { + status = "okay"; +}; + +&sdmmc { + bus-width = <4>; + cap-sd-highspeed; + disable-wp; + pinctrl-0 = <&sdmmc0_clk>, <&sdmmc0_cmd>, <&sdmmc0_dectn>, <&sdmmc0_bus4>; + pinctrl-names = "default"; + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vcc_io_sdio>; + status = "okay"; +}; + +&tsadc { + rockchip,hw-tshut-mode = <0>; + rockchip,hw-tshut-polarity = <0>; + status = "okay"; +}; + +&u2phy { + status = "okay"; +}; + +&u2phy_host { + status = "okay"; +}; + +&u2phy_otg { + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&usb20_otg { + status = "okay"; + dr_mode = "host"; +}; + +&usbdrd3 { + dr_mode = "host"; + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + snps,xhci-trb-ent-quirk; + + /* Second port is for USB 3.0 */ + rtl8153: device@2 { + compatible = "usbbda,8153"; + reg = <2>; + realtek,led-data = <0x87>; + }; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&spi0 { + max-freq = <48000000>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + }; +}; + +&uart1 { + status = "okay"; +}; + +&dmc_opp_table { + opp-798000000 { + status = "disabled"; + }; + opp-840000000 { + status = "disabled"; + }; + opp-924000000 { + status = "disabled"; + }; + opp-1056000000 { + status = "disabled"; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3328-z28pro.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-z28pro.dts new file mode 100644 index 000000000000..0b2e21a13990 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-z28pro.dts @@ -0,0 +1 @@ +#include "rk3328-rock64.dts" diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399-fine3399.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-fine3399.dts new file mode 100644 index 000000000000..9022e0195531 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-fine3399.dts @@ -0,0 +1,797 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; +#include +#include +#include +#include "rk3399.dtsi" +#include "rk3399-opp.dtsi" + + +/ { + model = "Rockchip Fine3399"; + compatible = "rockchip,fine3399", "rockchip,rk3399"; + + aliases { + mmc0 = &sdio0; + mmc1 = &sdmmc; + mmc2 = &sdhci; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + clkin_gmac: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "clkin_gmac"; + #clock-cells = <0>; + }; + + dc_12v: dc-12v { + compatible = "regulator-fixed"; + regulator-name = "dc_12v"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk808 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_reg_on_h>; + reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>; // bsp + }; + + /* switched by pmic_sleep */ + vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 { + compatible = "regulator-fixed"; + regulator-name = "vcc1v8_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_1v8>; + }; + + vcc3v3_sys: vcc3v3_pcie: vcc3v3_bl: vcc3v3-sys { // sch + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&dc_12v>; + }; + + vcc_sys: vcc-sys { // sch + compatible = "regulator-fixed"; + regulator-name = "vcc_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&dc_12v>; + }; + + vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc_phy_h>; + regulator-name = "vcc_phy"; + regulator-always-on; + regulator-boot-on; + }; + + 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 = <1400000>; + vin-supply = <&vcc_sys>; + }; + + leds: gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&user_led2>; + + user_led2 { + label = "blue:work_led"; + gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>; // sch + linux,default-trigger = "heartbeat"; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + autorepeat; + pinctrl-names = "default"; + pinctrl-0 = <&power_key>; + + power { + debounce-interval = <100>; + gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; // bsp + label = "GPIO Key Power"; + linux,code = ; + wakeup-source; + }; + }; + + fan0: pwm-fan { + compatible = "pwm-fan"; + cooling-levels = <0 150 200 255>; + #cooling-cells = <2>; + fan-supply = <&vcc_sys>; + pwms = <&pwm1 0 40000 0>; + }; + + // pwm3 + ir-receiver { + compatible = "gpio-ir-receiver"; + gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&ir_int>; + }; + + adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 1>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <1750000>; + poll-interval = <100>; + + recovery { + label = "Recovery"; + linux,code = ; // ?? + press-threshold-microvolt = <0>; + }; + }; + +}; + +&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>; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&cpu_thermal { + trips { + cpu_hot: cpu_hot { + hysteresis = <10000>; + temperature = <55000>; + type = "active"; + }; + }; + + cooling-maps { + map2 { + cooling-device = + <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + trip = <&cpu_hot>; + }; + }; +}; + +&emmc_phy { + status = "okay"; +}; + +&gmac { + assigned-clocks = <&cru SCLK_RMII_SRC>; + assigned-clock-parents = <&clkin_gmac>; + clock_in_out = "input"; + phy-supply = <&vcc_phy>; + phy-mode = "rgmii"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; // bsp + snps,reset-active-low; + snps,reset-delays-us = <0 10000 50000>; + tx_delay = <0x28>; + rx_delay = <0x11>; + status = "okay"; +}; + +&hdmi { + ddc-i2c-bus = <&i2c3>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_cec>; + status = "okay"; +}; + +&hdmi_sound { + status = "okay"; +}; + +&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 = <&gpio1>; + interrupts = ; + #clock-cells = <1>; + clock-output-names = "xin32k", "rk808-clkout2"; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l &pmic_dvs2>; + rockchip,system-power-controller; + wakeup-source; + + vcc1-supply = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + vcc10-supply = <&vcc3v3_sys>; + vcc11-supply = <&vcc3v3_sys>; + vcc12-supply = <&vcc3v3_sys>; + vddio-supply = <&vcc1v8_pmu>; + + regulators { + 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-off-in-suspend; + }; + }; + + vcc3v0_tp: LDO_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "vcc3v0_tp"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc1v8_pmu: LDO_REG3 { + regulator-name = "vcc1v8_pmu"; + 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_sd: LDO_REG4 { + regulator-name = "vcc_sd"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + 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: 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 = <&cpu_b_sleep>; + 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 = <&vcc_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_gpu: regulator@41 { + compatible = "silergy,syr828"; + reg = <0x41>; + fcs,suspend-voltage-selector = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&gpu_sleep>; + regulator-name = "vdd_gpu"; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1500000>; + regulator-ramp-delay = <1000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +// Used for HDMI +&i2c3 { + i2c-scl-rising-time-ns = <450>; + i2c-scl-falling-time-ns = <15>; + status = "okay"; +}; + +// HDMI sound +&i2s2 { + #sound-dai-cells = <0>; + status = "okay"; +}; + +&io_domains { + status = "okay"; + + bt656-supply = <&vcc_3v0>; + audio-supply = <&vcca1v8_codec>; + sdmmc-supply = <&vcc_sd>; + gpio1830-supply = <&vcc_3v0>; +}; + +&pmu_io_domains { + status = "okay"; + pmu1830-supply = <&vcc_1v8>; +}; + +&pcie_phy { + status = "okay"; +}; + +&pcie0 { + ep-gpios = <&gpio4 RK_PD3 GPIO_ACTIVE_HIGH>; // sch + max-link-speed = <2>; + num-lanes = <2>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_clkreqn_cpm>; + status = "okay"; +}; + +&pinctrl { + pmic { + cpu_b_sleep: cpu-b-sleep { + rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + gpu_sleep: gpu-sleep { + rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + pmic_int_l: pmic-int-l { + rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + pmic_dvs2: pmic-dvs2 { + rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>; // bsp + }; + }; + + sdio-pwrseq { + wifi_reg_on_h: wifi-reg-on-h { + rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wifi { + wifi_host_wake_l: wifi-host-wake-l { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + bt { + bt_enable_h: bt-enable-h { + rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_host_wake_l: bt-host-wake-l { + rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + bt_wake_l: bt-wake-l { + rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + gmac { + vcc_phy_h: vcc-phy-h { + rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + leds { + user_led2: user_led2 { + rockchip,pins = + <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + ir { + ir_int: ir-int { + rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + buttons { + power_key: power_key { + rockchip,pins = + <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; +/* +// TFT +&pwm0 { + status = "okay"; +}; +*/ +// FAN +&pwm1 { + status = "okay"; +}; + +&pwm2 { + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca1v8_s3>; + status = "okay"; +}; + +&sdio0 { + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + clock-frequency = <50000000>; + disable-wp; + keep-power-in-suspend; + max-frequency = <50000000>; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; + sd-uhs-sdr104; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + brcmf: wifi@1 { + reg = <1>; + compatible = "brcm,bcm4329-fmac"; + interrupt-parent = <&gpio0>; + interrupts = ; + interrupt-names = "host-wake"; + brcm,drive-strength = <5>; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_host_wake_l>; + }; +}; + +&sdmmc { + bus-width = <4>; + cap-sd-highspeed; + cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; // bsp + clock-frequency = <150000000>; + disable-wp; + sd-uhs-sdr104; + max-frequency = <150000000>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; + vqmmc-supply = <&vcc_sd>; + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + mmc-hs400-1_8v; + mmc-hs400-enhanced-strobe; + keep-power-in-suspend; + non-removable; + status = "okay"; +}; +/* +&spi1 { + status = "okay"; + + norflash: flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + }; +}; +*/ +/* +&spi2 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&spi2_clk &spi2_tx &spi2_cs0>; + + panel@0 { + compatible = "sitronix,st7789v"; + reg = <0>; + // backlight = <&pwm0>; + dc-gpios = <&gpio4 RK_PD5 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_LOW>; + led-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>; + spi-max-frequency = <15000000>; + spi-cs-high; + status = "okay"; + }; +}; +*/ +&tcphy0 { + status = "okay"; +}; + +&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 { + status = "okay"; + }; +}; + +&u2phy1 { + status = "okay"; + + u2phy1_otg: otg-port { + status = "okay"; + }; + + u2phy1_host: host-port { + status = "okay"; + }; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; + status = "okay"; + + bluetooth { + compatible = "brcm,bcm43438-bt"; + clocks = <&rk808 1>; + clock-names = "lpo"; + device-wakeup-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>; + host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; + shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; + max-speed = <4000000>; + pinctrl-names = "default"; + pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; + vbat-supply = <&vcc3v3_sys>; + vddio-supply = <&vcc_1v8>; + }; +}; + +// Debug TTL +&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"; +}; + +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; + +&vopl { + status = "okay"; +}; + +&vopl_mmu { + status = "okay"; +}; + +&iep_mmu { + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399-nanopi-m4v2.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-nanopi-m4v2.dts new file mode 100644 index 000000000000..094440ce38ad --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-nanopi-m4v2.dts @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * FriendlyElec NanoPi M4V2 board device tree source + * + * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd. + * (http://www.friendlyarm.com) + * + * Copyright (c) 2018 Collabora Ltd. + * Copyright (c) 2019 Arm Ltd. + */ + +/dts-v1/; +#include "rk3399-nanopi4.dtsi" + +/ { + model = "FriendlyElec NanoPi M4 Ver2.0"; + compatible = "friendlyarm,nanopi-m4", "rockchip,rk3399"; + + vdd_5v: vdd-5v { + compatible = "regulator-fixed"; + regulator-name = "vdd_5v"; + regulator-always-on; + regulator-boot-on; + }; + + vcc5v0_core: vcc5v0-core { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_core"; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vdd_5v>; + }; + + vcc5v0_usb1: vcc5v0-usb1 { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_usb1"; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc5v0_sys>; + }; + + vcc5v0_usb2: vcc5v0-usb2 { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_usb2"; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc5v0_sys>; + }; + + 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 = <1400000>; + regulator-init-microvolt = <900000>; + vin-supply = <&vcc5v0_core>; + }; +}; + +&gmac { + rx_delay = <0x16>; +}; + +&rk808 { + max-buck-steps-per-change = <4>; +}; + +&vcc3v3_sys { + vin-supply = <&vcc5v0_core>; +}; + +&u2phy0_host { + phy-supply = <&vcc5v0_usb1>; +}; + +&u2phy1_host { + phy-supply = <&vcc5v0_usb2>; +}; + +&vbus_typec { + regulator-always-on; + vin-supply = <&vdd_5v>; +}; + diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399-nanopi-r4se.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-nanopi-r4se.dts new file mode 100644 index 000000000000..1c9d0c34f151 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-nanopi-r4se.dts @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; +#include "rk3399-nanopi-r4s-enterprise.dts" + +/ { + model = "FriendlyElec NanoPi R4SE"; + compatible = "friendlyarm,nanopi-r4se", "rockchip,rk3399"; +}; + +&emmc_phy { + status = "okay"; +}; + +&sdhci { + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399-orangepi-4-lts.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-orangepi-4-lts.dts new file mode 100644 index 000000000000..2f0baf9fd43b --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-orangepi-4-lts.dts @@ -0,0 +1,1334 @@ +/* + * SPDX-License-Identifier: (GPL-2.0+ or MIT) + * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd. + * Copyright (c) 2018 Akash Gajjar + * Copyright (c) 2020-2022 Armbian (chwe17, piter75, jock) + * + */ + +/dts-v1/; +#include +#include +#include +#include +#include +#include "rk3399.dtsi" +#include "rk3399-opp.dtsi" + +/ { + model = "OrangePi 4 LTS"; + compatible = "xunlong,orangepi-4-lts", "rockchip,rk3399"; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + aliases { + spi1 = &spi1; + }; + + clkin_gmac: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "clkin_gmac"; + #clock-cells = <0>; + }; + + vcc_sys: vcc-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc_sys"; + regulator-always-on; + regulator-boot-on; + }; + + 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 = <&vcc_sys>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + usb_vbus: usb-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + usb3_vbus: usb3-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb3_vbus"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vbus_typec: vbus-typec { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio2 RK_PB4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_typec_en>; + regulator-name = "vbus-5v"; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + /* 0.9 V supply, over PMIC + vcc_0v9: vcc-0v9 { + compatible = "regulator-fixed"; + regulator-name = "vcc_0v9"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + vin-supply = <&vcc3v3_sys>; + } + */ + + vcc3v0_sd: vcc3v0-sd { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_pwr>; + 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; + }; + }; + + vcc3v3_pcie: vcc3v3-pcie-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_drv>; + regulator-always-on; + regulator-boot-on; + regulator-name = "vcc3v3_pcie"; + }; + + 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 = <&vcc_sys>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vdd_log: vdd-log { + compatible = "pwm-regulator"; + pwms = <&pwm2 0 25000 1>; + regulator-name = "vdd_log"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1400000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc3v3_sys>; + }; + + es8316c_card: es8316c-card { + compatible = "simple-audio-card"; + + simple-audio-card,format = "i2s"; + simple-audio-card,name = "rockchip-es8316c"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,hp-det-gpio = <&gpio4 RK_PD4 GPIO_ACTIVE_HIGH>; + + pinctrl-names = "default"; + pinctrl-0 = <&hp_det>; + + simple-audio-card,widgets = + "Microphone", "Mic Jack", + "Headphone", "Headphones"; + + simple-audio-card,routing = + "MIC1", "Mic Jack", + "Headphones", "HPOL", + "Headphones", "HPOR"; + + simple-audio-card,cpu { + sound-dai = <&i2s0>; + }; + + simple-audio-card,codec { + sound-dai = <&es8316c_codec>; + }; + + }; + + hdmi-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,name = "hdmi-sound"; + status = "okay"; + + simple-audio-card,cpu { + sound-dai = <&i2s2>; + }; + + simple-audio-card,codec { + sound-dai = <&hdmi>; + }; + }; + + spdif-sound { + status = "disable"; + compatible = "simple-audio-card"; + simple-audio-card,name = "ROCKCHIP,SPDIF"; + simple-audio-card,cpu { + sound-dai = <&spdif>; + }; + simple-audio-card,codec { + sound-dai = <&spdif_out>; + }; + }; + + spdif_out: spdif-out { + status = "disable"; + compatible = "linux,spdif-dit"; + #sound-dai-cells = <0>; + }; + + pwm_bl: backlight { + status = "disable"; + compatible = "pwm-backlight"; + pwms = <&pwm0 0 25000 0>; + 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>; + }; + + gpio-keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + autorepeat; + + pinctrl-names = "default"; + pinctrl-0 = <&power_key>; + + button@0 { + gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; + linux,code = ; + label = "GPIO Key Power"; + linux,input-type = <1>; + gpio-key,wakeup = <1>; + debounce-interval = <100>; + }; + }; + + adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 1>; + io-channel-names = "buttons"; + poll-interval = <100>; + keyup-threshold-microvolt = <1800000>; + + button-up { + label = "Volume Up"; + linux,code = ; + press-threshold-microvolt = <100000>; + }; + + button-down { + label = "Volume Down"; + linux,code = ; + press-threshold-microvolt = <300000>; + }; + }; + + leds: gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 =<&leds_gpio>; + + led@1 { + gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; + label = "status_led"; + linux,default-trigger = "heartbeat"; + linux,default-trigger-delay-ms = <0>; + }; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk808 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + + /* + * On the module itself this is one of these (depending + * on the actual card populated): + * - SDIO_RESET_L_WL_REG_ON + * - PDN (power down when low) + */ + reset-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; /* GPIO0_B2 */ + }; + + unisoc_uwe_bsp: uwe-bsp { + compatible = "unisoc,uwe_bsp"; + //wl-reg-on = <&gpio0 10 GPIO_ACTIVE_HIGH>; // handled by sdio-pwrseq + bt-reg-on = <&gpio0 9 GPIO_ACTIVE_HIGH>; + wl-wake-host-gpio = <&gpio0 3 GPIO_ACTIVE_HIGH>; + bt-wake-host-gpio = <&gpio0 4 GPIO_ACTIVE_HIGH>; + sdio-ext-int-gpio = <&gpio3 30 GPIO_ACTIVE_HIGH>; + unisoc,btwf-file-name = "/lib/firmware/uwe5622/wcnmodem-38222.bin"; + data-irq; + blksz-512; + keep-power-on; + status = "okay"; + }; + + sprd-wlan { + compatible = "sprd,uwe5622-wifi"; + status = "okay"; + }; + + sprd-mtty { + compatible = "sprd,mtty"; + sprd,name = "ttyBT"; + status = "okay"; + }; + + dmc_opp_table: dmc_opp_table { + compatible = "operating-points-v2"; + + opp00 { + opp-hz = /bits/ 64 <328000000>; + opp-microvolt = <900000>; + }; + + opp01 { + opp-hz = /bits/ 64 <416000000>; + opp-microvolt = <900000>; + }; + + opp02 { + opp-hz = /bits/ 64 <666000000>; + opp-microvolt = <900000>; + }; + + }; + +}; + +&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>; +}; + +&gpu { + status = "okay"; + mali-supply = <&vdd_gpu>; +}; + +&gmac { + assigned-clocks = <&cru SCLK_RMII_SRC>; + assigned-clock-parents = <&clkin_gmac>; + clock_in_out = "input"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>, <&phy_rstb>; + phy-mode = "rgmii"; + phy-supply = <&vcc3v3_s3>; + phy-handle = <&yt8531c>; + snps,reset-active-low; + snps,reset-delays-us = <0 10000 50000>; + snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + tx_delay = <0x28>; + rx_delay = <0x11>; + status = "okay"; + + mdio { + compatible = "snps,dwmac-mdio"; + #address-cells = <1>; + #size-cells = <0>; + yt8531c: ethernet-phy@0 { + compatible = "ethernet-phy-id4f51.e91b", + "ethernet-phy-ieee802.3-c22"; + reg = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&phy_intb>; + motorcomm,clk-out-frequency-hz = <125000000>; + motorcomm,keep-pll-enabled; + motorcomm,auto-sleep-disabled; + interrupt-parent = <&gpio3>; + interrupts = ; + }; + }; + +}; + +&spi1 { + status = "disable"; + pinctrl-names = "default", "sleep"; + pinctrl-1 = <&spi1_gpio>; + + spidev0: spidev@0 { + compatible = "rockchip,spidev"; + reg = <0>; + spi-max-frequency = <10000000>; + status = "okay"; + }; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; + +&vopl { + status = "okay"; +}; + +&vopl_mmu { + status = "okay"; +}; + +&vpu { + status = "okay"; +}; + +&rga { + status = "okay"; +}; + +&cdn_dp { + status = "okay"; + extcon = <&fusb0>; + phys = <&tcphy0_dp>; +}; + +&hdmi { + /* remove the hdmi_i2c_xfer */ + pinctrl-0 = <&hdmi_cec>; + #address-cells = <1>; + #size-cells = <0>; + #sound-dai-cells = <0>; + status = "okay"; + ddc-i2c-bus = <&i2c7>; +}; + +&i2c0 { + clock-frequency = <400000>; + i2c-scl-rising-time-ns = <160>; + i2c-scl-falling-time-ns = <30>; + status = "okay"; + + rk808: pmic@1b { + compatible = "rockchip,rk808"; + reg = <0x1b>; + interrupt-parent = <&gpio2>; + interrupts = ; + #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 = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + vcc10-supply = <&vcc3v3_sys>; + vcc11-supply = <&vcc3v3_sys>; + vcc12-supply = <&vcc3v3_sys>; + vcc13-supply = <&vcc3v3_sys>; + vcc14-supply = <&vcc3v3_sys>; + vddio-supply = <&vcc_3v0>; + + regulators { + 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; + }; + }; + + vcc1v8: vcc1v8_s3: vcca1v8_s3: DCDC_REG4 { + regulator-name = "vcc1v8"; + 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-off-in-suspend; + }; + }; + + vcc3v0_touch: LDO_REG2 { + regulator-name = "vcc3v0_touch"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc1v8_pmu: LDO_REG3 { + regulator-name = "vcc1v8_pmu"; + 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 = <3000000>; + regulator-init-microvolt = <3000000>; + 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_gpio>; + vsel-gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>; + regulator-compatible = "fan53555-reg"; + 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 = <&vcc3v3_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_gpu: regulator@41 { + compatible = "silergy,syr828"; + reg = <0x41>; + fcs,suspend-voltage-selector = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&vsel2_gpio>; + vsel-gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_HIGH>; + regulator-compatible = "fan53555-reg"; + regulator-name = "vdd_gpu"; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1500000>; + regulator-ramp-delay = <1000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc3v3_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c1 { + clock-frequency = <200000>; + i2c-scl-rising-time-ns = <300>; + i2c-scl-falling-time-ns = <15>; + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + es8316c_codec: es8316c@11 { + #sound-dai-cells = <0>; + compatible = "everest,es8316"; + reg = <17>; + clocks = <&cru SCLK_I2S_8CH_OUT>; + clock-names = "mclk"; + //pinctrl-names = "default"; + //pinctrl-0 = <&i2s_8ch_mclk>; + status = "okay"; + }; + +}; + +&i2c3 { + status = "okay"; +}; + +&i2c4 { + status = "okay"; + i2c-scl-rising-time-ns = <160>; + i2c-scl-falling-time-ns = <30>; + clock-frequency = <400000>; + + fusb0: fusb30x@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + pinctrl-names = "default"; + pinctrl-0 = <&fusb0_int>; + interrupt-parent = <&gpio1>; + interrupts = ; + vbus-supply = <&vbus_typec>; + status = "okay"; + + 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"; + + extcon-cables = <1 2 5 6 9 10 12 44>; + typec-altmodes = <0xff01 1 0x001c0000 1>; + + 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>; + }; + }; + + port@2 { + reg = <2>; + + usbc_dp: endpoint { + remote-endpoint = + <&tcphy0_typec_dp>; + }; + }; + }; + }; + + }; + + ft5x06_ts@38 { + compatible = "edt,edt-ft5x06", "ft5x06"; + reg = <0x38>; + interrupt-parent = <&gpio1>; + interrupts = <20 IRQ_TYPE_EDGE_FALLING>; + status = "okay"; + }; + +}; + +&i2c7 { + status = "okay"; +}; + +&spdif { + status = "disable"; + pinctrl-0 = <&spdif_bus>; + i2c-scl-rising-time-ns = <450>; + i2c-scl-falling-time-ns = <15>; + #sound-dai-cells = <0>; +}; + +&i2s0 { + rockchip,i2s-broken-burst-len; + assigned-clocks = <&cru SCLK_I2SOUT_SRC>; + assigned-clock-parents = <&cru SCLK_I2S0_8CH>; + resets = <&cru SRST_I2S0_8CH>, <&cru SRST_H_I2S0_8CH>; + reset-names = "reset-m", "reset-h"; + rockchip,playback-channels = <2>; + rockchip,capture-channels = <2>; + status = "okay"; + #sound-dai-cells = <0>; +}; + +&i2s2 { + #sound-dai-cells = <0>; + status = "okay"; +}; + +&io_domains { + status = "okay"; + + bt656-supply = <&vcc1v8_dvp>; /* bt656_gpio2ab_ms */ + audio-supply = <&vcca1v8_codec>; /* audio_gpio3d4a_ms */ + sdmmc-supply = <&vcc_sdio>; /* sdmmc_gpio4b_ms */ + gpio1830-supply = <&vcc_3v0>; /* gpio1833_gpio4cd_ms */ +}; + +&pmu_io_domains { + status = "okay"; + pmu1830-supply = <&vcc_3v0>; +}; + +&pcie_phy { + status = "okay"; + assigned-clocks = <&cru SCLK_PCIEPHY_REF>; + assigned-clock-parents = <&cru SCLK_PCIEPHY_REF100M>; + assigned-clock-rates = <100000000>; +}; + +&pcie0 { + status = "okay"; + ep-gpios = <&gpio2 4 GPIO_ACTIVE_HIGH>; + num-lanes = <4>; + max-link-speed = <1>; +}; + +&pwm_bl { + status = "okay"; +}; + +&pwm0 { + status = "okay"; +}; + +&pwm1 { + status = "okay"; +}; + +&pwm2 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pwm2_pin_pull_down>; +}; + +&saradc { + status = "okay"; + vref-supply = <&vcca1v8_s3>; /* TBD */ +}; + +&sdhci { + bus-width = <8>; + mmc-hs400-1_8v; + supports-emmc; + non-removable; + keep-power-in-suspend; + mmc-hs400-enhanced-strobe; + status = "okay"; +}; + +&emmc_phy { + status = "okay"; +}; + +&sdio0 { + clock-frequency = <150000000>; + max-frequency = <150000000>; + supports-sdio; + bus-width = <4>; + disable-wp; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + num-slots = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; + sd-uhs-sdr104; + status = "okay"; +}; + +&sdmmc { + bus-width = <4>; + cap-sd-highspeed; + cap-mmc-highspeed; + cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; + cd-debounce-delay-ms = <500>; + disable-wp; + max-frequency = <150000000>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_bus4 &sdmmc_clk &sdmmc_cmd &sdmmc_cd>; + sd-uhs-sdr104; + vmmc-supply = <&vcc3v0_sd>; + vqmmc-supply = <&vcc_sdio>; + 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"; +}; + +&tcphy0 { + extcon = <&fusb0>; + status = "okay"; +}; + +&tcphy0_dp { + port { + tcphy0_typec_dp: endpoint { + remote-endpoint = <&usbc_dp>; + }; + }; +}; + +&tcphy0_usb3 { + port { + tcphy0_typec_ss: endpoint { + remote-endpoint = <&usbc_ss>; + }; + }; +}; + +&tcphy1 { + status = "okay"; +}; + +&u2phy0 { + status = "okay"; + + u2phy0_otg: otg-port { + status = "okay"; + }; + + u2phy0_host: host-port { + phy-supply = <&usb3_vbus>; + 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 = <&usb_vbus>; + status = "okay"; + }; +}; + +&usbdrd3_0 { + status = "okay"; + extcon = <&fusb0>; +}; + +&usbdrd3_1 { + status = "okay"; +}; + +&usbdrd_dwc3_0 { + status = "okay"; +}; + +&usbdrd_dwc3_1 { + status = "okay"; + dr_mode = "host"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&sdmmc_bus4 { + rockchip,pins = + <4 RK_PB0 1 &pcfg_pull_up_12ma>, + <4 RK_PB1 1 &pcfg_pull_up_12ma>, + <4 RK_PB2 1 &pcfg_pull_up_12ma>, + <4 RK_PB3 1 &pcfg_pull_up_12ma>; +}; + +&sdmmc_cmd { + rockchip,pins = + <4 RK_PB5 1 &pcfg_pull_up_12ma>; +}; + +&pinctrl { + + pcfg_pull_up_12ma: pcfg-pull-up-12ma { + bias-pull-up; + drive-strength = <12>; + }; + + pcie { + pcie_drv: pcie-drv { + rockchip,pins = + <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + hdmi { + /delete-node/ hdmi-i2c-xfer; + }; + + i2s0 { + i2s_8ch_mclk: i2s-8ch-mclk { + rockchip,pins = <4 RK_PA0 1 &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <2 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + vsel1_gpio: vsel1-gpio { + rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + vsel2_gpio: vsel2-gpio { + rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + usb-typec { + vcc5v0_typec_en: vcc5v0_typec_en { + rockchip,pins = <2 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + fusb30x { + fusb0_int: fusb0-int { + rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <0 10 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wireless-bluetooth { + uart0_gpios: uart0-gpios { + rockchip,pins = <2 19 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + rockchip-key { + power_key: power-key { + rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + headphone { + hp_det: hp-det { + rockchip,pins = <4 28 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + gpio-leds { + leds_gpio: leds-gpio { + rockchip,pins = <0 11 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + cam_pins { + cif_clkout_a: cif-clkout-a { + rockchip,pins = <2 11 3 &pcfg_pull_none>; + }; + + cif_clkout_a_sleep: cif-clkout-a-sleep { + rockchip,pins = <2 11 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + cam0_default_pins: cam0-default-pins { + rockchip,pins = + <4 27 0 &pcfg_pull_down>, + <2 11 3 &pcfg_pull_none>; + }; + + cam0_sleep_pins: cam0-sleep-pins { + rockchip,pins = + <4 27 3 &pcfg_pull_none>, + <2 11 0 &pcfg_pull_none>; + }; + + cam1_default_pins: cam1-default-pins { + rockchip,pins = + <0 12 RK_FUNC_GPIO &pcfg_pull_down>, + <0 8 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + spi1 { + spi1_gpio: spi1-gpio { + rockchip,pins = + <1 7 RK_FUNC_GPIO &pcfg_output_low>, + <1 8 RK_FUNC_GPIO &pcfg_output_low>, + <1 9 RK_FUNC_GPIO &pcfg_output_low>, + <1 10 RK_FUNC_GPIO &pcfg_output_low>; + }; + }; + + bt { + bt_host_wake: bt-host-wake { + rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_reset: bt-reset { + rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_wake: bt-wake { + rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + gmac { + phy_intb: phy-intb { + rockchip,pins = <3 RK_PB2 1 &pcfg_pull_up>; + }; + + phy_rstb: phy-rstb { + rockchip,pins = <3 RK_PB7 1 &pcfg_pull_none>; + }; + }; + +}; + +&hdmi_in_vopb { + status = "okay"; +}; + +&hdmi_in_vopl { + status = "disable"; +}; + +&dp_in_vopb { + status = "disable"; +}; +&dp_in_vopl { + status = "okay"; +}; + +&dmc { + #cooling-cells = <2>; /* min followed by max */ + + status = "okay"; + center-supply = <&vdd_log>; + operating-points-v2 = <&dmc_opp_table>; + + rockchip,pd-idle-ns = <160>; + rockchip,sr-idle-ns = <10240>; + rockchip,sr-mc-gate-idle-ns = <40960>; + rockchip,srpd-lite-idle-ns = <61440>; + rockchip,standby-idle-ns = <81920>; + + rockchip,ddr3_odt_dis_freq = <666000000>; + rockchip,lpddr3_odt_dis_freq = <666000000>; + rockchip,lpddr4_odt_dis_freq = <666000000>; + + rockchip,sr-mc-gate-idle-dis-freq-hz = <1000000000>; + rockchip,srpd-lite-idle-dis-freq-hz = <0>; + rockchip,standby-idle-dis-freq-hz = <928000000>; + +}; + +&dfi { + status = "okay"; +}; + +/* + * Redefine some parameters for the thermal trip points for Opi4 LTS. + * First of all, the Soc does not like getting over 90°C. My sample + * froze at 94.4°C, so we lower the critical temprature to 90°C, hopefully + * giving enough room for safe reboot of the device. + * Big cores are getting throttled a bit when reaching 82°C, then at 85°C + * we aggressively throttle all the cores and even the memory controller. + * The GPU is handled by existing trip points in the base device tree, here + * we just set the same critical temperature as CPU. + */ +&cpu_alert0 { + temperature = <82000>; +}; + +&cpu_alert1 { + temperature = <85000>; +}; + +&cpu_crit { + temperatue = <90000>; +}; + +&gpu_crit { + temperatue = <90000>; +}; + +&cpu_thermal { + + cooling-maps { + + map0 { + trip = <&cpu_alert0>; + cooling-device = + <&cpu_b0 THERMAL_NO_LIMIT 3>, + <&cpu_b1 THERMAL_NO_LIMIT 3>; + }; + + map1 { + trip = <&cpu_alert1>; + cooling-device = + <&cpu_l0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_l1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_l2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_l3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + + map2 { + trip = <&cpu_alert1>; + cooling-device = + <&dmc THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + + }; + +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399-orangepi-4.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-orangepi-4.dts new file mode 100644 index 000000000000..976d3f9964f3 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-orangepi-4.dts @@ -0,0 +1,1194 @@ +/* + * SPDX-License-Identifier: (GPL-2.0+ or MIT) + * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd. + * Copyright (c) 2018 Akash Gajjar + * Copyright (c) 2020 Armbian (chwe17, piter75) + * + */ + +/dts-v1/; +#include +#include +#include +//#include +#include "rk3399.dtsi" +#include "rk3399-opp.dtsi" + +/ { + model = "OrangePi 4"; + compatible = "xunlong,orangepi-4", "rockchip,rk3399"; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + aliases { + spi1 = &spi1; + }; + + clkin_gmac: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "clkin_gmac"; + #clock-cells = <0>; + }; + + usb_vbus: usb-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + usb3_vbus: usb3-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb3_vbus"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vbus_typec: vbus-typec { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio2 RK_PB4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_typec_en>; + regulator-name = "vbus_typec"; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + /* 0.9 V supply, over PMIC + vcc_0v9: vcc-0v9 { + compatible = "regulator-fixed"; + regulator-name = "vcc_0v9"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + vin-supply = <&vcc3v3_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; + }; + }; + + vcc3v3_pcie: vcc3v3-pcie-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_drv>; + regulator-always-on; + regulator-boot-on; + regulator-name = "vcc3v3_pcie"; + }; + + 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 = <&vcc_sys>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + 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 = <&vcc_sys>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_sys: vcc-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc_sys"; + regulator-always-on; + regulator-boot-on; + }; + + vdd_log: vdd-log { + compatible = "pwm-regulator"; + pwms = <&pwm2 0 25000 1>; + regulator-name = "vdd_log"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1400000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc3v3_sys>; + }; + + rt5651_card: rt5651-sound { + status = "okay"; + compatible = "simple-audio-card"; + pinctrl-names = "default"; + pinctrl-0 = <&hp_det>; + + simple-audio-card,name = "realtek,rt5651-codec"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,hp-det-gpio = <&gpio4 28 GPIO_ACTIVE_HIGH>; + + simple-audio-card,widgets = + "Microphone", "Mic Jack", + "Headphone", "Headphone Jack"; + simple-audio-card,routing = + "Mic Jack", "micbias1", + "IN2P", "Mic Jack", + "IN3P", "Mic Jack", + "Headphone Jack", "HPOL", + "Headphone Jack", "HPOR"; + + simple-audio-card,cpu { + sound-dai = <&i2s1>; + }; + simple-audio-card,codec { + sound-dai = <&rt5651>; + }; + }; + + dw_hdmi_audio: dw-hdmi-audio { + status = "disable"; + compatible = "rockchip,dw-hdmi-audio"; + #sound-dai-cells = <0>; + }; + + hdmi_sound: hdmi-sound { + status = "okay"; + }; + + hdmi_dp_sound: hdmi-dp-sound { + status = "okay"; + compatible = "rockchip,rk3399-hdmi-dp"; + rockchip,cpu = <&i2s2>; + rockchip,codec = <&hdmi>, <&cdn_dp>; + }; + + spdif-sound { + status = "disable"; + compatible = "simple-audio-card"; + simple-audio-card,name = "ROCKCHIP,SPDIF"; + simple-audio-card,cpu { + sound-dai = <&spdif>; + }; + simple-audio-card,codec { + sound-dai = <&spdif_out>; + }; + }; + + spdif_out: spdif-out { + status = "disable"; + compatible = "linux,spdif-dit"; + #sound-dai-cells = <0>; + }; + + pwm_bl: backlight { + status = "disable"; + compatible = "pwm-backlight"; + pwms = <&pwm0 0 25000 0>; + 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>; + }; + + gpio-keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + autorepeat; + + pinctrl-names = "default"; + pinctrl-0 = <&power_key>; + + button@0 { + gpios = <&gpio0 5 GPIO_ACTIVE_LOW>; + linux,code = ; + label = "GPIO Key Power"; + linux,input-type = <1>; + gpio-key,wakeup = <1>; + debounce-interval = <100>; + }; + }; + + adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 1>; + io-channel-names = "buttons"; + poll-interval = <100>; + keyup-threshold-microvolt = <1800000>; + + button-up { + label = "Volume Up"; + linux,code = ; + press-threshold-microvolt = <100000>; + }; + + button-down { + label = "Volume Down"; + linux,code = ; + press-threshold-microvolt = <300000>; + }; + }; + + leds: gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 =<&leds_gpio>; + + led@1 { + gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; + label = "status_led"; + linux,default-trigger = "heartbeat"; + linux,default-trigger-delay-ms = <0>; + }; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk808 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + + /* + * On the module itself this is one of these (depending + * on the actual card populated): + * - SDIO_RESET_L_WL_REG_ON + * - PDN (power down when low) + */ + reset-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; /* GPIO0_B2 */ + }; +}; + +&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>; +}; + +&gpu { + status = "okay"; + mali-supply = <&vdd_gpu>; +}; + +&gmac { + assigned-clocks = <&cru SCLK_RMII_SRC>; + assigned-clock-parents = <&clkin_gmac>; + clock_in_out = "input"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + phy-mode = "rgmii"; + phy-supply = <&vcc3v3_s3>; + snps,reset-active-low; + snps,reset-delays-us = <0 10000 50000>; + snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + tx_delay = <0x28>; + rx_delay = <0x11>; + status = "okay"; +}; + +&spi1 { + status = "disable"; + pinctrl-names = "default", "sleep"; + pinctrl-1 = <&spi1_gpio>; + + spidev0: spidev@0 { + compatible = "rockchip,spidev"; + reg = <0>; + spi-max-frequency = <10000000>; + status = "okay"; + }; +}; +/* +&spi1 { + status = "okay"; + max-freq = <48000000>; + spidev@00 { + compatible = "linux,spidev"; + reg = <0x00>; + spi-max-frequency = <48000000>; + }; +}; +*/ + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; + status = "okay"; + + bluetooth { + compatible = "brcm,bcm4345c5"; + clocks = <&rk808 1>; + clock-names = "lpo"; + device-wakeup-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>; + host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; + shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; + max-speed = <1500000>; + pinctrl-names = "default"; + pinctrl-0 = <&bt_host_wake &bt_wake &bt_reset>; + }; + +}; + +&uart2 { + status = "okay"; +}; + +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; + +&vopl { + status = "okay"; +}; + +&vopl_mmu { + status = "okay"; +}; + +&vpu { + status = "okay"; + /* 0 means ion, 1 means drm */ + //allocator = <0>; +}; + +&rga { + status = "disabled"; +}; + +&cdn_dp { + status = "okay"; + extcon = <&fusb0>; + phys = <&tcphy0_dp>; +}; + +&hdmi { + /* remove the hdmi_i2c_xfer */ + pinctrl-0 = <&hdmi_cec>; + #address-cells = <1>; + #size-cells = <0>; + #sound-dai-cells = <0>; + status = "okay"; + ddc-i2c-bus = <&i2c7>; + rockchip,defaultmode = <16>; /* CEA 1920x1080@60Hz */ +}; + +&i2c0 { + clock-frequency = <400000>; + i2c-scl-rising-time-ns = <160>; + i2c-scl-falling-time-ns = <30>; + status = "okay"; + + rk808: pmic@1b { + compatible = "rockchip,rk808"; + reg = <0x1b>; + interrupt-parent = <&gpio1>; + interrupts = <21 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 = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + vcc10-supply = <&vcc3v3_sys>; + vcc11-supply = <&vcc3v3_sys>; + vcc12-supply = <&vcc3v3_sys>; + vcc13-supply = <&vcc3v3_sys>; + vcc14-supply = <&vcc3v3_sys>; + vddio-supply = <&vcc_3v0>; + + regulators { + 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; + }; + }; + + vcc1v8: vcc1v8_s3: vcca1v8_s3: DCDC_REG4 { + regulator-name = "vcc1v8"; + 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-off-in-suspend; + }; + }; + + vcc3v0_touch: LDO_REG2 { + regulator-name = "vcc3v0_touch"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc1v8_pmu: LDO_REG3 { + regulator-name = "vcc1v8_pmu"; + 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 = <3000000>; + regulator-init-microvolt = <3000000>; + 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_gpio>; + vsel-gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>; + regulator-compatible = "fan53555-reg"; + 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 = <&vcc3v3_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_gpu: regulator@41 { + compatible = "silergy,syr828"; + reg = <0x41>; + fcs,suspend-voltage-selector = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&vsel2_gpio>; + vsel-gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_HIGH>; + regulator-compatible = "fan53555-reg"; + regulator-name = "vdd_gpu"; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1500000>; + regulator-ramp-delay = <1000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc3v3_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c1 { + status = "okay"; + i2c-scl-rising-time-ns = <300>; + i2c-scl-falling-time-ns = <15>; + clock-frequency = <200000>; + + rt5651: rt5651@1a { + #sound-dai-cells = <0>; + compatible = "realtek,rt5651"; + reg = <0x1a>; + clocks = <&cru SCLK_I2S_8CH_OUT>; + clock-names = "mclk"; + status = "okay"; + }; +}; + +&i2c3 { + status = "okay"; +}; + +&i2c4 { + status = "okay"; + i2c-scl-rising-time-ns = <160>; + i2c-scl-falling-time-ns = <30>; + clock-frequency = <400000>; + + fusb0: fusb30x@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + pinctrl-names = "default"; + pinctrl-0 = <&fusb0_int>; + interrupt-parent = <&gpio1>; + interrupts = ; + vbus-supply = <&vbus_typec>; + status = "okay"; + + 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"; + + extcon-cables = <1 2 5 6 9 10 12 44>; + typec-altmodes = <0xff01 1 0x001c0000 1>; + + 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>; + }; + }; + + port@2 { + reg = <2>; + + usbc_dp: endpoint { + remote-endpoint = + <&tcphy0_typec_dp>; + }; + }; + }; + }; + + }; + + ft5x06_ts@38 { + compatible = "edt,edt-ft5x06", "ft5x06"; + reg = <0x38>; + interrupt-parent = <&gpio1>; + interrupts = <20 IRQ_TYPE_EDGE_FALLING>; + status = "okay"; + }; + + /* + onewire_ts@2f { + compatible = "onewire"; + reg = <0x2f>; + interrupt-parent = <&gpio1>; + interrupts = <20 IRQ_TYPE_EDGE_FALLING>; + }; */ +}; + +&i2c7 { + status = "okay"; +}; + +&spdif { + status = "disable"; + pinctrl-0 = <&spdif_bus>; + i2c-scl-rising-time-ns = <450>; + i2c-scl-falling-time-ns = <15>; + #sound-dai-cells = <0>; +}; + +&i2s1 { + assigned-clocks = <&cru SCLK_I2SOUT_SRC>; + assigned-clock-parents = <&cru SCLK_I2S1_8CH>; + pinctrl-names = "default"; + pinctrl-0 = <&i2s_8ch_mclk>,<&i2s1_2ch_bus>; + rockchip,playback-channels = <2>; + rockchip,capture-channels = <2>; + #sound-dai-cells = <0>; + status = "okay"; +}; +/* +&i2s0 { + assigned-clocks = <&cru SCLK_I2S1_DIV>; + assigned-clock-parents = <&cru PLL_GPLL>; +};*/ + +&i2s2 { + #sound-dai-cells = <0>; + status = "okay"; +}; + +&io_domains { + status = "okay"; + + bt656-supply = <&vcc1v8_dvp>; /* bt656_gpio2ab_ms */ + audio-supply = <&vcca1v8_codec>; /* audio_gpio3d4a_ms */ + sdmmc-supply = <&vcc_sdio>; /* sdmmc_gpio4b_ms */ + gpio1830-supply = <&vcc_3v0>; /* gpio1833_gpio4cd_ms */ +}; + +&pmu_io_domains { + status = "okay"; + pmu1830-supply = <&vcc_3v0>; +}; + +&pcie_phy { + status = "okay"; + assigned-clocks = <&cru SCLK_PCIEPHY_REF>; + assigned-clock-parents = <&cru SCLK_PCIEPHY_REF100M>; + assigned-clock-rates = <100000000>; +}; + +&pcie0 { + status = "okay"; + ep-gpios = <&gpio2 4 GPIO_ACTIVE_HIGH>; + num-lanes = <4>; + max-link-speed = <1>; +}; + +&pwm_bl { + status = "okay"; +}; + +&pwm0 { + status = "okay"; +}; + +&pwm1 { + status = "okay"; +}; + +&pwm2 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pwm2_pin_pull_down>; +}; + +&saradc { + status = "okay"; + vref-supply = <&vcca1v8_s3>; /* TBD */ +}; + +&sdhci { + bus-width = <8>; + mmc-hs400-1_8v; + supports-emmc; + non-removable; + keep-power-in-suspend; + mmc-hs400-enhanced-strobe; + status = "okay"; +}; + +&emmc_phy { + status = "okay"; +}; + +&sdio0 { + clock-frequency = <50000000>; + clock-freq-min-max = <200000 50000000>; + supports-sdio; + bus-width = <4>; + disable-wp; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + num-slots = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; + sd-uhs-sdr104; + status = "okay"; +}; + +&sdmmc { + bus-width = <4>; + cap-sd-highspeed; + cap-mmc-highspeed; + cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; + disable-wp; + max-frequency = <150000000>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_bus4 &sdmmc_clk &sdmmc_cmd &sdmmc0_det_l>; +// sd-uhs-sdr104; + vmmc-supply = <&vcc3v0_sd>; + vqmmc-supply = <&vcc_sdio>; + 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"; +}; + +&tcphy0 { + extcon = <&fusb0>; + status = "okay"; +}; + +&tcphy0_dp { + port { + tcphy0_typec_dp: endpoint { + remote-endpoint = <&usbc_dp>; + }; + }; +}; + +&tcphy0_usb3 { + port { + tcphy0_typec_ss: endpoint { + remote-endpoint = <&usbc_ss>; + }; + }; +}; + +&tcphy1 { + status = "okay"; +}; + +&u2phy0 { + status = "okay"; + + u2phy0_otg: otg-port { + status = "okay"; + }; + + u2phy0_host: host-port { + phy-supply = <&usb3_vbus>; + 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 = <&usb_vbus>; + status = "okay"; + }; +}; + +&usbdrd3_0 { + status = "okay"; + extcon = <&fusb0>; +}; + +&usbdrd3_1 { + status = "okay"; +}; + +&usbdrd_dwc3_0 { + status = "okay"; +}; + +&usbdrd_dwc3_1 { + status = "okay"; + dr_mode = "host"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&pinctrl { + pcie { + pcie_drv: pcie-drv { + rockchip,pins = + <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + hdmi { + /delete-node/ hdmi-i2c-xfer; + }; + + i2s1 { + i2s_8ch_mclk: i2s-8ch-mclk { + rockchip,pins = <4 RK_PA0 1 &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + vsel1_gpio: vsel1-gpio { + rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + vsel2_gpio: vsel2-gpio { + rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + sdmmc { + sdmmc0_det_l: sdmmc0-det-l { + rockchip,pins = <0 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + sdmmc0_pwr_h: sdmmc0-pwr-h { + rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + usb-typec { + vcc5v0_typec_en: vcc5v0_typec_en { + rockchip,pins = <2 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + fusb30x { + fusb0_int: fusb0-int { + rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <0 10 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wireless-bluetooth { + uart0_gpios: uart0-gpios { + rockchip,pins = <2 19 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + rockchip-key { + power_key: power-key { + rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + headphone { + hp_det: hp-det { + rockchip,pins = <4 28 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + gpio-leds { + leds_gpio: leds-gpio { + rockchip,pins = <0 11 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + cam_pins { + cif_clkout_a: cif-clkout-a { + rockchip,pins = <2 11 3 &pcfg_pull_none>; + }; + + cif_clkout_a_sleep: cif-clkout-a-sleep { + rockchip,pins = <2 11 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + cam0_default_pins: cam0-default-pins { + rockchip,pins = + <4 27 0 &pcfg_pull_down>, + <2 11 3 &pcfg_pull_none>; + }; + cam0_sleep_pins: cam0-sleep-pins { + rockchip,pins = + <4 27 3 &pcfg_pull_none>, + <2 11 0 &pcfg_pull_none>; + }; + + cam1_default_pins: cam1-default-pins { + rockchip,pins = + <0 12 RK_FUNC_GPIO &pcfg_pull_down>, + <0 8 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + spi1 { + spi1_gpio: spi1-gpio { + rockchip,pins = + <1 7 RK_FUNC_GPIO &pcfg_output_low>, + <1 8 RK_FUNC_GPIO &pcfg_output_low>, + <1 9 RK_FUNC_GPIO &pcfg_output_low>, + <1 10 RK_FUNC_GPIO &pcfg_output_low>; + }; + }; + + bt { + bt_host_wake: bt-host-wake { + rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_reset: bt-reset { + rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_wake: bt-wake { + rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + +}; + +&hdmi_in_vopb { + status = "okay"; +}; + +&hdmi_in_vopl { + status = "disable"; +}; + +&dp_in_vopb { + status = "disable"; +}; +&dp_in_vopl { + status = "okay"; +}; + diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399-rock-pi-4.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-rock-pi-4.dts new file mode 100644 index 000000000000..8d0aa5346293 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-rock-pi-4.dts @@ -0,0 +1 @@ +#include "rk3399-rock-pi-4b.dts" diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399-rock-pi-4c.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-rock-pi-4c.dts new file mode 100644 index 000000000000..4053ba72618c --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-rock-pi-4c.dts @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd + * Copyright (c) 2019 Radxa Limited + * Copyright (c) 2019 Amarula Solutions(India) + */ + +/dts-v1/; +#include "rk3399-rock-pi-4.dtsi" + +/ { + model = "Radxa ROCK Pi 4C"; + compatible = "radxa,rockpi4c", "radxa,rockpi4", "rockchip,rk3399"; + + aliases { + mmc2 = &sdio0; + }; +}; + +&es8316 { + pinctrl-0 = <&hp_detect &hp_int>; + pinctrl-names = "default"; + interrupt-parent = <&gpio1>; + interrupts = ; +}; + +&sdio0 { + status = "okay"; + + brcmf: wifi@1 { + compatible = "brcm,bcm4329-fmac"; + reg = <1>; + interrupt-parent = <&gpio0>; + interrupts = ; + interrupt-names = "host-wake"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_host_wake_l>; + }; +}; + +&sound { + hp-det-gpio = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>; +}; + +&uart0 { + status = "okay"; + + bluetooth { + compatible = "brcm,bcm4345c5"; + clocks = <&rk808 1>; + clock-names = "lpo"; + device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; + host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; + shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; + max-speed = <1500000>; + pinctrl-names = "default"; + pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; + vbat-supply = <&vcc3v3_sys>; + vddio-supply = <&vcc_1v8>; + }; +}; + +&vcc5v0_host { + gpio = <&gpio3 RK_PD6 GPIO_ACTIVE_HIGH>; +}; + +&vcc5v0_host_en { + rockchip,pins = <3 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399-tinker-2.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-tinker-2.dts new file mode 100644 index 000000000000..0f4b28ae0118 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-tinker-2.dts @@ -0,0 +1,751 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2016 Fuzhou Rockchip Electronics Co., Ltd + * Copyright (c) 2021 Thomas McKahan + */ + +/dts-v1/; +#include +#include +#include "rk3399.dtsi" +#include "rk3399-op1-opp.dtsi" + +/ { + model = "Asus Tinker Board 2/2S"; + compatible = "rockchip,rk3399-evb", "rockchip,rk3399"; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + board_info: board-info { + compatible = "board-info"; + + hw-id0 = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>; + hw-id1 = <&gpio4 RK_PA6 GPIO_ACTIVE_HIGH>; + hw-id2 = <&gpio4 RK_PA5 GPIO_ACTIVE_HIGH>; + + pid-id0 = <&gpio2 RK_PA5 GPIO_ACTIVE_HIGH>; + pid-id1 = <&gpio2 RK_PA3 GPIO_ACTIVE_HIGH>; + pid-id2 = <&gpio2 RK_PA2 GPIO_ACTIVE_HIGH>; + + ddr-id1 = <&gpio4 RK_PA4 GPIO_ACTIVE_HIGH>; + ddr-id2 = <&gpio4 RK_PA0 GPIO_ACTIVE_HIGH>; + + pmic-reset = <&gpio1 RK_PA6 GPIO_ACTIVE_HIGH>; + }; + + clkin_gmac: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "clkin_gmac"; + #clock-cells = <0>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + pwr-led { + gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + retain-state-suspended = <1>; + }; + + act-led { + gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_HIGH>; + linux,default-trigger="mmc0"; + }; + + rsv-led { + gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_HIGH>; + linux,default-trigger="heartbeat"; + }; + }; + + vcc_lcd: vcc-lcd { + compatible = "regulator-fixed"; + regulator-name = "vcc_lcd"; + gpio = <&gpio4 30 GPIO_ACTIVE_HIGH>; + startup-delay-us = <20000>; + enable-active-high; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + vin-supply = <&vcc5v0_sys>; + }; + + 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>; + }; + + vcc5v0_host: vcc5v0-host-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_host_en>; + regulator-name = "vcc5v0_host"; + vin-supply = <&vcc5v0_sys>; + }; + + 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>; + }; + + vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_phy"; + regulator-always-on; + regulator-boot-on; + }; + + vbus_typec: vbus-5vout { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_typec0_en_pin>; + regulator-name = "vbus_5vout"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_log: vdd-log { + compatible = "pwm-regulator"; + pwms = <&pwm2 0 25000 1>; + regulator-name = "vdd_log"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1400000>; + regulator-always-on; + regulator-boot-on; + + /* for rockchip boot on */ + rockchip,pwm_id= <2>; + rockchip,pwm_voltage = <900000>; + }; + + xin32k: xin32k { + compatible = "fixed-clock"; + clock-frequency = <32768>; + clock-output-names = "xin32k"; + #clock-cells = <0>; + }; +}; + +&cdn_dp { + status = "okay"; + extcon = <&fusb0>; +}; + +&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>; +}; + +&emmc_phy { + status = "okay"; +}; + +&gmac { + assigned-clocks = <&cru SCLK_RMII_SRC>; + assigned-clock-parents = <&cru SCLK_MAC>; + clock_in_out = "input"; + assigned-clock-rates = <125000000>; + phy-supply = <&vcc_phy>; + phy-mode = "rgmii"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + snps,reset-gpio = <&gpio3 15 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + snps,reset-delays-us = <0 16000 72000>; + tx_delay = <0x25>; + rx_delay = <0x20>; + wakeup-enable = "0"; + status = "okay"; +}; +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&hdmi { + ddc-i2c-bus = <&i2c3>; + status = "okay"; +}; + +&hdmi_sound { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + + rk808: pmic@1b { + compatible = "rockchip,rk808"; + reg = <0x1b>; + interrupt-parent = <&gpio1>; + interrupts = <18 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>; + rockchip,system-power-controller; + wakeup-source; + #clock-cells = <1>; + clock-output-names = "rk808-clkout1", "rk808-clkout2"; + + vcc1-supply = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + vcc10-supply = <&vcc3v3_sys>; + vcc11-supply = <&vcc3v3_sys>; + vcc12-supply = <&vcc3v3_sys>; + vddio-supply = <&vcc1v8_pmu>; + + regulators { + vdd_center: DCDC_REG1 { + regulator-name = "vdd_center"; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vdd_cpu_l: DCDC_REG2 { + regulator-name = "vdd_cpu_l"; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-always-on; + regulator-boot-on; + 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-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc3v3_dsi: LDO_REG1 { + regulator-name = "vcc3v3_dsi"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcca1v8_hdmi: LDO_REG2 { + regulator-name = "vcca1v8_hdmi"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc1v8_pmu: LDO_REG3 { + regulator-name = "vcc1v8_pmu"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vccio_sd: LDO_REG4 { + regulator-name = "vccio_sd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + + vcc3v3_csi: LDO_REG5 { + regulator-name = "vcc3v3_csi"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v5: LDO_REG6 { + regulator-name = "vcc_1v5"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1500000>; + }; + }; + + vcca0v9_hdmi: LDO_REG7 { + regulator-name = "vcca0v9_hdmi"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v0: LDO_REG8 { + regulator-name = "vcc_3v0"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + + vcc3v3_s3: SWITCH_REG1 { + regulator-name = "vcc3v3_s3"; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-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: vdd_cpu_b@60 { + compatible = "fcs,fan53200"; + reg = <0x60>; + vin-supply = <&vcc5v0_sys>; + regulator-compatible = "fan53555-regulator"; + pinctrl-names = "default"; + pinctrl-0 = <&vsel1_gpio>; + vsel-gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>; + regulator-name = "vdd_cpu_b"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1250000>; + regulator-ramp-delay = <1000>; + fcs,suspend-voltage-selector = <1>; + regulator-always-on; + regulator-boot-on; + status = "okay"; + + regulator-initial-state = <3>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c3 { + status = "okay"; +}; + +&i2c4 { + + status = "okay"; + i2c-scl-rising-time-ns = <475>; + i2c-scl-falling-time-ns = <26>; + fusb0: fusb30x@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + pinctrl-names = "default"; + pinctrl-0 = <&fusb0_int>; + interrupt-parent = <&gpio1>; + interrupts = ; + vbus-supply = <&vbus_typec>; + status = "okay"; + + 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"; + + extcon-cables = <1 2 5 6 9 10 12 44>; + typec-altmodes = <0xff01 1 0x001c0000 1>; + + 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>; + }; + }; + + port@2 { + reg = <2>; + + usbc_dp: endpoint { + remote-endpoint = + <&tcphy0_typec_dp>; + }; + }; + }; + }; + + + + + }; + + vdd_gpu: vdd_gpu@60 { + compatible = "fcs,fan53200"; + reg = <0x60>; + vin-supply = <&vcc5v0_sys>; + regulator-compatible = "fan53555-regulator"; + pinctrl-names = "default"; + pinctrl-0 = <&vsel2_gpio>; + vsel-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + regulator-name = "vdd_gpu"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1200000>; + regulator-ramp-delay = <1000>; + fcs,suspend-voltage-selector = <1>; + regulator-always-on; + regulator-boot-on; + status = "okay"; + + regulator-initial-state = <3>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c8 { + + m24c08: m24c08@50 { + compatible = "atmel,24c08"; + reg = <0x50>; + }; +}; + +&i2s0 { + rockchip,playback-channels = <8>; + rockchip,capture-channels = <8>; + status = "okay"; +}; + +&i2s2 { + status = "okay"; +}; + +&pcie_phy { + status = "okay"; +}; + +&pcie0 { + ep-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; + num-lanes = <4>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_clkreqn_cpm>; + status = "okay"; +}; + +&pwm0 { + status = "disabled"; +}; + +&pwm2 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pwm2_pin_pull_down>; +}; + +&pwm3 { + status = "disabled"; +}; + +&saradc { + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + mmc-hs200-1_8v; + supports-emmc; + //mmc-hs400-enhanced-strobe; + non-removable; + keep-power-in-suspend; + status = "okay"; +}; + +&sdmmc { + clock-frequency = <150000000>; + clock-freq-min-max = <100000 150000000>; + supports-sd; + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + disable-wp; + num-slots = <1>; + //sd-uhs-sdr104; + vmmc-supply = <&vcc3v3_s3>; + vqmmc-supply = <&vccio_sd>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; + status = "okay"; +}; + +&tcphy0 { + extcon = <&fusb0>; + status = "okay"; +}; + +&tcphy0_dp { + port { + tcphy0_typec_dp: endpoint { + remote-endpoint = <&usbc_dp>; + }; + }; +}; + +&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"; + }; +}; + +&usbdrd3_0 { + status = "okay"; +}; + +&usbdrd_dwc3_0 { + status = "okay"; + dr_mode = "host"; +}; + +&usbdrd3_1 { + status = "okay"; +}; + +&usbdrd_dwc3_1 { + status = "okay"; + dr_mode = "host"; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&pinctrl { + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = + <1 18 RK_FUNC_GPIO &pcfg_pull_up>, + <0 9 RK_FUNC_GPIO &pcfg_pull_none>; /* GPIO0_B1 */ + }; + vsel1_gpio: vsel1-gpio { + rockchip,pins = + <1 17 RK_FUNC_GPIO &pcfg_pull_down>; + }; + vsel2_gpio: vsel2-gpio { + rockchip,pins = + <1 14 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + usb2 { + vcc5v0_host_en: vcc5v0-host-en { + rockchip,pins = + <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + usb-typec { + vcc5v0_typec0_en_pin: vcc5v0-typec0-en-pin { + rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + fusb30x { + fusb0_int: fusb0-int { + rockchip,pins = <1 2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; + +&vopl { + status = "okay"; +}; + +&vopl_mmu { + status = "okay"; +}; + +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399-xiaobao-nas.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-xiaobao-nas.dts new file mode 100644 index 000000000000..16f12e573472 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-xiaobao-nas.dts @@ -0,0 +1,774 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; +#include +#include +#include +#include "rk3399.dtsi" +#include "rk3399-opp.dtsi" + +/ { + model = "Codinge Xiaobao NAS"; + compatible = "codinge,xiaobao-nas", "rockchip,rk3399"; + + aliases { + mmc0 = &sdmmc; + mmc1 = &sdhci; + mmc2 = &sdio0; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + clkin_gmac: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "clkin_gmac"; + #clock-cells = <0>; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk808 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + reset-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_LOW>; + }; + + vcc_dc: vcc-dc { + compatible = "regulator-fixed"; + regulator-name = "dc_12v"; + regulator-always-on; + regulator-boot-on; + }; + + vcc_12v: vcc-12v { + compatible = "regulator-fixed"; + regulator-name = "vcc_12v"; + regulator-always-on; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + }; + + vcc5v0_sys: vcc5v0-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vcc1v8_s3: vcc1v8-s3 { + compatible = "regulator-fixed"; + regulator-name = "vcc1v8_s3"; + regulator-always-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_1v8>; + }; + + vcc3v3_sys: vcc3v3-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_sys"; + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + vcc5v0_host: vcc5v0-host-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_host_en>; + regulator-name = "vcc5v0_host"; + }; + + vcc_sd: vcc-sd { + compatible = "regulator-fixed"; + regulator-name = "vcc_sd"; + enable-active-high; + gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc_sd_h>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + vcc5v0_typec: vcc5v0-typec { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio4 RK_PD4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_typec_en>; + regulator-name = "vcc5v0_typec"; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_12v>; + }; + + vcc3v3_pcie: vcc3v3-pcie-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_pcie"; + enable-active-high; + gpio = <&gpio4 RK_PD6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_pwr_en>; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc3v3_sys>; + }; + + vcc_lan: vcc3v3-phy-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_lan"; + regulator-always-on; + regulator-boot-on; + }; + + adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 1>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <1800000>; + poll-interval = <100>; + + recovery { + label = "Recovery"; + linux,code = <0x168>; + press-threshold-microvolt = <18000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&leds_pins>; + + led1: system-led1 { + gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; + label = "system_led1"; + retain-state-suspended; + default-state = "on"; + }; + + led2: system-led2 { + gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_HIGH>; + label = "system_led2"; + retain-state-suspended; + default-state = "off"; + }; + }; + + pwm-fan { + compatible = "pwm-fan"; + pwms = <&pwm1 0 50000 0>; + }; +}; + +&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>; +}; + +&emmc_phy { + status = "okay"; +}; + +&gmac { + assigned-clocks = <&cru SCLK_RMII_SRC>; + assigned-clock-parents = <&clkin_gmac>; + clock_in_out = "input"; + phy-supply = <&vcc_lan>; + phy-mode = "rgmii"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + snps,reset-delays-us = <0 10000 50000>; + tx_delay = <0x28>; + rx_delay = <0x11>; + status = "okay"; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&hdmi { + ddc-i2c-bus = <&i2c3>; + ddc-i2c-scl-high-time-ns = <9625>; + ddc-i2c-scl-low-time-ns = <10000>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_cec>; + status = "okay"; +}; + +&hdmi_sound { + status = "okay"; +}; + +&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 = <&gpio1>; + interrupts = <21 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 = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + vcc10-supply = <&vcc3v3_sys>; + vcc11-supply = <&vcc3v3_sys>; + vcc12-supply = <&vcc3v3_sys>; + vddio-supply = <&vcc_3v0>; + + regulators { + 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>; + }; + }; + + vcca_1v8: LDO_REG2 { + 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>; + }; + }; + + vcc1v8_pmupll: LDO_REG3 { + regulator-name = "vcc1v8_pmupll"; + 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 = <3000000>; + + 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-on-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + + 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-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + 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: 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; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_gpu: regulator@41 { + compatible = "silergy,syr828"; + reg = <0x41>; + fcs,suspend-voltage-selector = <1>; + 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; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + hym8563@51 { + compatible = "haoyu,hym8563"; + reg = <0x51>; + #clock-cells = <0>; + clock-frequency = <32768>; + clock-output-names = "xin32k"; + }; +}; + +&i2c3 { + i2c-scl-rising-time-ns = <450>; + i2c-scl-falling-time-ns = <15>; + status = "okay"; +}; + +&i2c4 { + clock-frequency = <400000>; + i2c-scl-rising-time-ns = <160>; + i2c-scl-falling-time-ns = <30>; + status = "okay"; + + typec-portc@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + interrupt-parent = <&gpio1>; + interrupts = ; + pinctrl-names = "default"; + pinctrl-0 = <&fusb0_int>; + vbus-supply = <&vcc5v0_typec>; + }; +}; + +&i2s0 { + rockchip,capture-channels = <8>; + rockchip,playback-channels = <8>; + status = "okay"; +}; + +&i2s1 { + rockchip,capture-channels = <2>; + rockchip,playback-channels = <2>; + status = "okay"; +}; + +&i2s2 { + status = "okay"; +}; + +&io_domains { + status = "okay"; + + bt656-supply = <&vcc_3v0>; + audio-supply = <&vcca1v8_codec>; + sdmmc-supply = <&vcc_sdio>; + gpio1830-supply = <&vcc_3v0>; +}; + +&pcie_phy { + status = "okay"; + drive-impedance-ohm = <50>; +}; + +&pcie0 { + ep-gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_HIGH>; + num-lanes = <4>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_clkreqnb_cpm &fn8274_en_h>; + status = "okay"; +}; + +&pmu_io_domains { + status = "okay"; + + pmu1830-supply = <&vcc_3v0>; +}; + +&pinctrl { + pcie { + fn8274_en_h: fn8274-en-h { + rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_output_high>, + <4 RK_PD5 RK_FUNC_GPIO &pcfg_output_high>, + <1 RK_PC7 RK_FUNC_GPIO &pcfg_output_high>; + }; + + pcie_pwr_en: pcie-pwr-en { + rockchip,pins = <4 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <1 RK_PC5 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>; + }; + }; + + usb2 { + vcc5v0_host_en: vcc5v0-host-en { + rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + vcc5v0_typec_en: vcc5v0-typec-en { + rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO &pcfg_output_high>; + }; + }; + + vcc_sd { + vcc_sd_h: vcc-sd-h { + rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + fusb30x { + fusb0_int: fusb0-int { + rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + leds { + leds_pins: leds-pins { + rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; + +&pwm1 { + status = "okay"; +}; + +&saradc { + status = "okay"; +}; + +&sdio0 { + bus-width = <4>; + clock-frequency = <50000000>; + cap-sdio-irq; + cap-sd-highspeed; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + num-slots = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; + sd-uhs-sdr104; + status = "okay"; +}; + +&sdmmc { + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; + disable-wp; + max-frequency = <150000000>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_clk &sdmmc_cd &sdmmc_cmd &sdmmc_bus4>; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vcc_sdio>; + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + mmc-hs400-1_8v; + mmc-hs400-enhanced-strobe; + non-removable; + status = "okay"; +}; + +&spi1 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0x00>; + spi-max-frequency = <10000000>; + }; +}; + +&tcphy0 { + status = "okay"; +}; + +&tcphy1 { + status = "okay"; +}; + +&tsadc { + status = "okay"; + + /* tshut mode 0:CRU 1:GPIO */ + rockchip,hw-tshut-mode = <1>; + /* tshut polarity 0:LOW 1:HIGH */ + rockchip,hw-tshut-polarity = <1>; +}; + +&u2phy0 { + status = "okay"; +}; + +&u2phy0_otg { + status = "okay"; +}; + +&u2phy0_host { + phy-supply = <&vcc5v0_host>; + status = "okay"; +}; + +&u2phy1 { + status = "okay"; +}; + +&u2phy1_otg { + status = "okay"; +}; + +&u2phy1_host { + 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"; +}; + +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; + +&vopl { + status = "okay"; +}; + +&vopl_mmu { + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399pro-tinker-edge-r.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399pro-tinker-edge-r.dts new file mode 100644 index 000000000000..3785bb5d7f3b --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399pro-tinker-edge-r.dts @@ -0,0 +1,1080 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd + * Copyright (c) 2019 Radxa Limited + * Copyright (c) 2019 Amarula Solutions(India) + * Copyright (c) 2024 ARCW rk3399pro-tinker_edge_r + */ + +/dts-v1/; +#include +#include +#include "rk3399pro.dtsi" +#include "rk3399-opp.dtsi" + +/ { + model = "ASUS Tinker Edge R"; + compatible = "ASUS,rk3399-tinker_edge_r", "rockchip,rk3399pro"; + + chosen { + stdout-path = "serial0:115200n8"; + // bootargs = "earlycon=uart8250,mmio32,0xff180000 swiotlb=1 coherent_pool=1m"; + }; + + clkin_gmac: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "clkin_gmac"; + #clock-cells = <0>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + pwr-led { + gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + retain-state-suspended = <1>; + }; + + act-led { + gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_HIGH>; + linux,default-trigger="mmc0"; + }; + + rsv-led { + gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; + linux,default-trigger="none"; + }; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk809 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + + /* + * On the module itself this is one of these (depending + * on the actual card populated): + * - SDIO_RESET_L_WL_REG_ON + * - PDN (power down when low) + */ + reset-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>; + }; + + rk_headset { + compatible = "rockchip_headset"; + headset_gpio = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&hp_det>; + io-channels = <&saradc 3>; + }; + + sdhci_pwrseq: sdhci-pwrseq { + compatible = "mmc-pwrseq-emmc"; + pinctrl-0 = <&sdhci_reset>; + pinctrl-names = "default"; + reset-gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_HIGH>; + }; + + display-subsystem{ + status = "okay"; + }; + + vdd_3v3_reg: fixedregulator_3v3 { + compatible = "regulator-fixed"; + regulator-name = "3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_phy"; + regulator-always-on; + regulator-boot-on; + }; + + vcc5v0_sys: vccsys { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vbus_typec: vbus-typec { + compatible = "regulator-fixed"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-name = "vbus_typec"; + }; + + backlight: backlight { + status = "disabled"; + compatible = "pwm-backlight"; + pwms = <&pwm0 0 400000 0>;//f=2500 t=400,000ns + brightness-levels = < + 0 1 2 3 4 5 6 7 + 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 37 37 38 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>; + minimal-brightness-level = <26>; + soc_enablekl-gpios = <&gpio1 RK_PB0 GPIO_ACTIVE_HIGH>; + enable_delay = <15>; + disable_delay = <5>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_lvds_bl_en>; + }; + + rk809-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,name = "rockchip,rk809"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,widgets = + "Microphone", "Mic Jack", + "Headphone", "Headphone Jack"; + simple-audio-card,routing = + "Mic Jack", "MICBIAS1", + "IN1P", "Mic Jack", + "Headphone Jack", "HPOL", + "Headphone Jack", "HPOR"; + simple-audio-card,cpu { + sound-dai = <&i2s1>; + }; + simple-audio-card,codec { + sound-dai = <&rk809_codec>; + }; + }; + + spdif-sound { + status = "okay"; + compatible = "simple-audio-card"; + simple-audio-card,name = "rockchip,spdif"; + simple-audio-card,cpu { + sound-dai = <&spdif>; + }; + simple-audio-card,codec { + sound-dai = <&spdif_out>; + }; + }; + + spdif_out: spdif-out { + status = "okay"; + compatible = "linux,spdif-dit"; + #sound-dai-cells = <0>; + }; + + hdmi_dp_sound: hdmi-dp-sound { + status = "okay"; + compatible = "rockchip,rk3399-hdmi-dp"; + rockchip,cpu = <&i2s2>; + rockchip,codec = <&hdmi>, <&cdn_dp>; + }; + + route_hdmi: route-hdmi { + status = "okay"; + logo,mode = "center"; + charge_logo,mode = "center"; + connect = <&vopb_out_hdmi>; + }; +}; + +&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>; +}; + +&emmc_phy { + status = "okay"; +}; + +&gmac { + assigned-clocks = <&cru SCLK_RMII_SRC>; + assigned-clock-parents = <&clkin_gmac>; + clock_in_out = "input"; + phy-supply = <&vcc_phy>; + phy-mode = "rgmii"; + snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + snps,reset-delays-us = <0 16000 72000>; + wolirq-gpio = <&gpio3 16 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + tx_delay = <0x23>; + rx_delay = <0x22>; + wakeup-enable = "0"; + status = "okay"; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&hdmi { + status = "okay"; + ddc-i2c-bus = <&i2c3>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_cec>; + #sound-dai-cells = <0>; // must exist + rockchip,phy-table = + <74250000 0x8009 0x0004 0x0272>, + <165000000 0x802b 0x0004 0x0209>, + <297000000 0x8039 0x0005 0x028d>, + <594000000 0x8039 0x0000 0x019d>, + <000000000 0x0000 0x0000 0x0000>; +}; + +&hdmi_in_vopl { + status = "disabled"; +}; + +&vopb { + status = "okay"; + // assigned-clocks = <&cru DCLK_VOP0_DIV>; + // assigned-clock-parents = <&cru PLL_VPLL>; +}; + +&vopb_mmu { + status = "okay"; +}; + +&vopl { + status = "okay"; + // assigned-clocks = <&cru DCLK_VOP1_DIV>; + // assigned-clock-parents = <&cru PLL_CPLL>; +}; + +&vopl_mmu { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + i2c-scl-rising-time-ns = <180>; + i2c-scl-falling-time-ns = <30>; + clock-frequency = <400000>; + + rk809: pmic@20 { + compatible = "rockchip,rk809"; + reg = <0x20>; + interrupt-parent = <&gpio1>; + interrupts = ; + pinctrl-names = "default", "pmic-sleep", + "pmic-power-off", "pmic-reset"; + pinctrl-0 = <&pmic_int_l>; + pinctrl-1 = <&soc_slppin_slp>, <&rk809_slppin_slp>; + pinctrl-2 = <&soc_slppin_gpio>, <&rk809_slppin_pwrdn>; + pinctrl-3 = <&soc_slppin_gpio>, <&rk809_slppin_null>; + rockchip,system-power-controller; + pmic-reset-func = <0>; + wakeup-source; + #clock-cells = <1>; + clock-output-names = "rk808-clkout1", "rk808-clkout2"; + + vcc1-supply = <&vcc5v0_sys>; + vcc2-supply = <&vcc5v0_sys>; + vcc3-supply = <&vcc5v0_sys>; + vcc4-supply = <&vcc5v0_sys>; + vcc5-supply = <&vcc_buck5>; + vcc6-supply = <&vcc_buck5>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc5v0_sys>; + + pwrkey { + status = "okay"; + }; + + rtc { + status = "okay"; + }; + + pinctrl_rk8xx: pinctrl_rk8xx { + gpio-controller; + #gpio-cells = <2>; + + rk809_slppin_null: rk809_slppin_null { + pins = "gpio_slp"; + function = "pin_fun0"; + }; + + rk809_slppin_slp: rk809_slppin_slp { + pins = "gpio_slp"; + function = "pin_fun1"; + }; + + rk809_slppin_pwrdn: rk809_slppin_pwrdn { + pins = "gpio_slp"; + function = "pin_fun2"; + }; + + rk809_slppin_rst: rk809_slppin_rst { + pins = "gpio_slp"; + function = "pin_fun3"; + }; + }; + + regulators { + vdd_center: DCDC_REG1 { + regulator-name = "vdd_center"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <925000>; + regulator-max-microvolt = <1025000>; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <925000>; + }; + }; + + vdd_cpu_l: DCDC_REG2 { + regulator-name = "vdd_cpu_l"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <925000>; + regulator-max-microvolt = <1225000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc3v3_sys: DCDC_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-initial-mode = <0x2>; + regulator-name = "vcc3v3_sys"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_buck5: DCDC_REG5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc_buck5"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca_0v9: LDO_REG1 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <925000>; + regulator-max-microvolt = <925000>; + regulator-name = "vcca_0v9"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <925000>; + }; + }; + + vcc_1v8: LDO_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1850000>; + regulator-max-microvolt = <1850000>; + + regulator-name = "vcc_1v8"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1850000>; + }; + }; + + vcc0v9_soc: LDO_REG3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <950000>; + regulator-max-microvolt = <950000>; + + regulator-name = "vcc0v9_soc"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <950000>; + }; + }; + + vcca_1v8: LDO_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1850000>; + regulator-max-microvolt = <1850000>; + + regulator-name = "vcca_1v8"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1850000>; + }; + }; + + vdd1v5_dvp: LDO_REG5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1850000>; + regulator-max-microvolt = <1850000>; + + regulator-name = "vdd1v5_dvp"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v5: LDO_REG6 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1550000>; + regulator-max-microvolt = <1550000>; + + regulator-name = "vcc_1v5"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v0: LDO_REG7 { + regulator-name = "vcc_3v0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3075000>; + regulator-max-microvolt = <3075000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd: LDO_REG8 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1850000>; + regulator-max-microvolt = <3375000>; + + regulator-name = "vccio_sd"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_sd: LDO_REG9 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3375000>; + regulator-max-microvolt = <3375000>; + + regulator-name = "vcc_sd"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc5v0_usb: SWITCH_REG1 { + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + + regulator-name = "vcc5v0_usb"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <5000000>; + }; + }; + + vccio_3v3: SWITCH_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-name = "vccio_3v3"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + }; + + rk809_codec: codec { + #sound-dai-cells = <0>; + compatible = "rockchip,rk809-codec", "rockchip,rk817-codec"; + clocks = <&cru SCLK_I2S_8CH_OUT>; + clock-names = "mclk"; + pinctrl-names = "default"; + pinctrl-0 = <&i2s_8ch_mclk>; + hp-volume = <20>; + spk-volume = <3>; + status = "okay"; + }; + }; + + vdd_cpu_b: fan53555@60 { + compatible = "fcs,fan53555"; + reg = <0x60>; + vin-supply = <&vcc5v0_sys>; + regulator-compatible = "fan53555-reg"; + pinctrl-0 = <&vsel1_gpio>; + vsel-gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>; + regulator-name = "vdd_cpu_b"; + regulator-min-microvolt = <925000>; + regulator-max-microvolt = <1275000>; + regulator-ramp-delay = <1000>; + fcs,suspend-voltage-selector = <1>; + regulator-always-on; + regulator-boot-on; + regulator-initial-state = <3>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + bq25700: bq25700@6b { + compatible = "ti,bq25703"; + reg = <0x6b>; + extcon = <&fusb0>; + interrupt-parent = <&gpio1>; + interrupts = ; + pinctrl-names = "default"; + pinctrl-0 = <&charger_ok_int>; + ti,charge-current = <1500000>; + ti,max-charge-voltage = <8704000>; + ti,max-input-voltage = <20000000>; + ti,max-input-current = <6000000>; + ti,input-current-sdp = <500000>; + ti,input-current-dcp = <2000000>; + ti,input-current-cdp = <2000000>; + ti,input-current-dc = <2000000>; + ti,minimum-sys-voltage = <6700000>; + ti,otg-voltage = <5000000>; + ti,otg-current = <500000>; + ti,input-current = <500000>; + pd-charge-only = <0>; + status = "disabled"; + }; +}; + +&spdif { + status = "disabled"; + pinctrl-0 = <&spdif_bus>; + i2c-scl-rising-time-ns = <450>; + i2c-scl-falling-time-ns = <15>; +}; + +&i2c1 { + status = "okay"; + i2c-scl-rising-time-ns = <140>; + i2c-scl-falling-time-ns = <30>; + status = "okay"; +}; + +&i2c2 { + status = "okay"; + i2c-scl-rising-time-ns = <140>; + i2c-scl-falling-time-ns = <30>; +}; + +&i2c3 { + i2c-scl-rising-time-ns = <450>; + i2c-scl-falling-time-ns = <15>; + status = "okay"; +}; + +&i2c4 { + i2c-scl-rising-time-ns = <345>; + i2c-scl-falling-time-ns = <11>; + status = "okay"; +}; + +&i2c8 { + status = "okay"; + i2c-scl-rising-time-ns = <345>; + i2c-scl-falling-time-ns = <11>; + clock-frequency = <100000>; + + fusb0: typec-portc@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + pinctrl-names = "default"; + pinctrl-0 = <&fusb0_int>; + int-n-gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>; + vbus-5v-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; + vbus2-5v-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>; + status = "okay"; + }; + + vdd_gpu: fan53555@60 { + compatible = "fcs,fan53555"; + reg = <0x60>; + vin-supply = <&vcc5v0_sys>; + regulator-compatible = "fan53555-reg"; + pinctrl-0 = <&vsel2_gpio>; + vsel-gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_HIGH>; + regulator-name = "vdd_gpu"; + regulator-min-microvolt = <925000>; + regulator-max-microvolt = <1225000>; + regulator-ramp-delay = <1000>; + fcs,suspend-voltage-selector = <1>; + regulator-always-on; + regulator-boot-on; + regulator-initial-state = <3>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + +}; + +&i2s0 { + i2s_8ch_mclk: i2s-8ch-mclk { + rockchip,pins = <4 RK_PA0 1 &pcfg_pull_none>; + }; +}; + +&i2s1 { + status = "okay"; +}; + +&i2s2 { + status = "okay"; +}; + +&io_domains { + status = "okay"; + bt656-supply = <&vcca_1v8>; + audio-supply = <&vcca_1v8>; + sdmmc-supply = <&vccio_sd>; + gpio1830-supply = <&vcc_3v0>; +}; + +&isp0_mmu { + status = "okay"; +}; + +&isp1_mmu { + status = "okay"; +}; + +&pcie_phy { + status = "okay"; +}; + +&pcie0 { + status = "okay"; +}; + +&pmu_io_domains { + status = "okay"; + pmu1830-supply = <&vcc_1v8>; +}; + +&pwm2 { + status = "okay"; +}; + +// &isp0 { +// status = "okay"; + +// port { +// #address-cells = <1>; +// #size-cells = <0>; + +// isp0_mipi_in: endpoint@0 { +// reg = <0>; +// remote-endpoint = <&dphy_rx0_out>; +// }; +// }; +// }; + +// &isp1 { +// status = "okay"; + +// port { +// #address-cells = <1>; +// #size-cells = <0>; + +// isp1_mipi_in: endpoint@0 { +// reg = <0>; +// remote-endpoint = <&dphy_tx1rx1_out>; +// }; +// }; +// }; + +&saradc { + status = "okay"; + vref-supply = <&vcc_1v8>; +}; + +&sdio0 { + status = "okay"; +}; + +&sdmmc { + status = "okay"; + supports-emmc; + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; +}; + +&sdhci { + mmc-pwrseq = <&sdhci_pwrseq>; + bus-width = <8>; + mmc-hs200-1_8v; + non-removable; + status = "okay"; +}; + +&spi1 { + status = "disable"; + max-freq = <48000000>; /* spi internal clk, don't modify */ + spi_dev@0 { + compatible = "rockchip,spidev"; + reg = <0>; + spi-max-frequency = <48000000>; + }; +}; + +&spi5 { + status = "disable"; + max-freq = <48000000>; //spi internal clk, don't modify + spi_dev@0 { + compatible = "rockchip,spidev"; + reg = <0>; //chip select 0:cs0 1:cs1 + id = <0>; + spi-max-frequency = <48000000>; //spi output clock + }; +}; + +&tcphy0 { + extcon = <&fusb0>; + status = "okay"; +}; + +&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"; + extcon = <&fusb0>; + + u2phy0_otg: otg-port { + status = "okay"; + }; + + u2phy0_host: host-port { + phy-supply = <&vcc5v0_usb>; + status = "okay"; + }; +}; + +&u2phy1 { + status = "okay"; + + u2phy1_otg: otg-port { + status = "okay"; + }; + + u2phy1_host: host-port { + phy-supply = <&vcc5v0_usb>; + status = "okay"; + }; +}; + +&uart0 { + status = "okay"; +}; + +// &uart4 { +// status = "disable"; +// }; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&usbdrd3_0 { + extcon = <&fusb0>; + status = "okay"; +}; + +&usbdrd3_1 { + status = "okay"; +}; + +&usbdrd_dwc3_0 { + dr_mode = "otg"; + status = "okay"; +}; + +&usbdrd_dwc3_1 { + status = "okay"; + dr_mode = "host"; +}; + +&vpu { + status = "okay"; + /* 0 means ion, 1 means drm */ + //allocator = <0>; +}; + +&pinctrl { + pinctrl-names = "default"; + pinctrl-0 = <&npu_ref_clk &gpio_init>; + + mipi_to_lvds { + /*pinctrl_lvds_hdmi_sel: lvds_hdmi_sel { + rockchip,pins = <0 5 0 &pcfg_pull_none>; + };*/ + + pinctrl_sn65dsi84_irq: sn65dsi84_irq{ + rockchip,pins = <1 RK_PB2 0 &pcfg_pull_none>; + }; + + pinctrl_lvds_bl_en: lvds_bl_en { + rockchip,pins = <1 RK_PB0 0 &pcfg_pull_none>; + }; + + pinctrl_sn65dsi84_en: sn65dsi84_en { + rockchip,pins = <1 RK_PA7 0 &pcfg_pull_none>; + }; + + pinctrl_lvds_vdd_en: lvds_vdd_en { + rockchip,pins = <1 RK_PB1 0 &pcfg_pull_none>; + }; + + pinctrl_pwr_source: pwr_source { + rockchip,pins = <0 RK_PA6 0 &pcfg_pull_none>; + }; + }; + + bq2570 { + charger_ok_int: charger-ok-int { + rockchip,pins = <1 RK_PA1 0 &pcfg_pull_up>; + }; + }; + + fusb30x { + fusb0_int: fusb0-int { + rockchip,pins = <1 RK_PA2 0 &pcfg_pull_up>; + }; + }; + + headphone { + hp_det: hp-det { + rockchip,pins = <0 RK_PB5 0 &pcfg_pull_up>; + }; + }; + + lcd_rst { + lcd_rst_gpio: lcd-rst-gpio { + rockchip,pins = <3 RK_PA4 0 &pcfg_pull_none>; + }; + }; + + gpio_init_config { + gpio_init: gpio_init { + rockchip,pins = + <1 9 0 &pcfg_pull_none>, + <1 10 0 &pcfg_pull_none>, + <1 7 0 &pcfg_pull_none>, + <1 8 0 &pcfg_pull_none>; + }; + }; + + npu_clk { + npu_ref_clk: npu-ref-clk { + rockchip,pins = + <0 RK_PA2 1 &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = + <1 RK_PC2 0 &pcfg_pull_up>; + }; + vsel1_gpio: vsel1-gpio { + rockchip,pins = + <1 RK_PC1 0 &pcfg_pull_down>; + }; + vsel2_gpio: vsel2-gpio { + rockchip,pins = + <1 RK_PB6 0 &pcfg_pull_down>; + }; + + soc_slppin_gpio: soc-slppin-gpio { + rockchip,pins = + <1 RK_PA5 0 &pcfg_output_low>; + }; + + soc_slppin_slp: soc-slppin-slp { + rockchip,pins = + <1 RK_PA5 1 &pcfg_pull_down>; + }; + + soc_slppin_rst: soc-slppin-rst { + rockchip,pins = + <1 RK_PA5 2 &pcfg_pull_none>; + }; + }; + + sdhci-pwrseq { + sdhci_reset: sdhci-reset { + rockchip,pins = <2 4 0 &pcfg_pull_none>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = + <2 RK_PD3 0 &pcfg_pull_none>; + }; + }; + + sdmmc { + sdmmc_bus1: sdmmc-bus1 { + rockchip,pins = + <4 RK_PB0 1 &pcfg_pull_up>; + }; + + sdmmc_bus4: sdmmc-bus4 { + rockchip,pins = + <4 RK_PB0 1 &pcfg_pull_up>, + <4 RK_PB1 1 &pcfg_pull_up>, + <4 RK_PB2 1 &pcfg_pull_up>, + <4 RK_PB3 1 &pcfg_pull_up>; + }; + + sdmmc_clk: sdmmc-clk { + rockchip,pins = + <4 RK_PB4 1 &pcfg_pull_none>; + }; + + sdmmc_cmd: sdmmc-cmd { + rockchip,pins = + <4 RK_PB5 1 &pcfg_pull_up>; + }; + }; + + tp_irq { + tp_irq_gpio: tp-irq-gpio { + rockchip,pins = + <3 RK_PB0 0 &pcfg_pull_up>; + }; + }; + + // wireless-bluetooth { + // bt_irq_gpio: bt-irq-gpio { + // rockchip,pins = + // <0 RK_PA5 0 &pcfg_pull_down>; + // }; + + //uart0_gpios: uart0-gpios { + // rockchip,pins = + // <2 RK_PC3 0 &pcfg_pull_none>; + //}; + // }; + + // isp { + // test_clkout2: cif-test_clkout2 { + // rockchip,pins = + // /* test_clkout2 */ + // <0 8 3 &pcfg_pull_none>; + // }; + // }; +}; + diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3566-firefly-roc-pc.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-firefly-roc-pc.dts new file mode 100644 index 000000000000..f999fb2b46b4 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-firefly-roc-pc.dts @@ -0,0 +1,760 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (c) 2021 Rockchip Electronics Co., Ltd. + * + */ + +/dts-v1/; +#include +#include +#include +#include +#include "rk3566.dtsi" + +/ { + model = "Firefly rk3566-roc-pc"; + compatible = "firefly,rk3566-roc-pc", "rockchip,rk3566"; + + aliases { + ethernet0 = &gmac1; + mmc0 = &sdmmc0; + mmc1 = &sdhci; + mmc2 = &sdmmc1; + }; + + chosen: chosen { + stdout-path = "serial2:1500000n8"; + }; + + vcc5v0_in: vcc5v0_in { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_in"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + gmac1_clkin: external-gmac1-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "gmac1_clkin"; + #clock-cells = <0>; + }; + + hdmi-con { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + + 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>; + }; + + 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 = <&vcc5v0_in>; + }; + + vcc5v0_host: vcc5v0-host-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_host"; + enable-active-high; + gpio = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_host_en>; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc5v0_otg: vcc5v0-otg-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_otg"; + enable-active-high; + gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_otg_en>; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc3v3_pcie_p: vcc3v3-pcie-p-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PC4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_enable_h>; + regulator-name = "vcc3v3_pcie_p"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_3v3>; + }; + + firefly_leds: leds { + compatible = "gpio-leds"; + power_led: power { + label = "firefly:blue:power"; + linux,default-trigger = "ir-power-click"; + default-state = "on"; + gpios = <&gpio0 RK_PD3 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&led_power>; + }; + + user_led: user { + label = "firefly:yellow:user"; + linux,default-trigger = "ir-user-click"; + default-state = "off"; + gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&led_user>; + }; + }; + + sdio_pwrseq: sdio-pwrseq { + status = "okay"; + compatible = "mmc-pwrseq-simple"; + clocks = <&rk809 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + reset-gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_LOW>; + }; + + rk809-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,name = "Analog RK809"; + simple-audio-card,mclk-fs = <256>; + + simple-audio-card,cpu { + sound-dai = <&i2s1_8ch>; + }; + simple-audio-card,codec { + sound-dai = <&rk809>; + }; + }; + + rk_headset: rk-headset { + compatible = "rockchip_headset"; + headset_gpio = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&hp_det>; + io-channels = <&saradc 2>; //HP_HOOK pin + }; +}; + +&combphy1 { + status = "okay"; +}; + +&combphy2 { + status = "okay"; +}; + +&cpu0 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu1 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu2 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu3 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu_thermal { + trips { + cpu_hot: cpu_hot { + temperature = <55000>; + hysteresis = <2000>; + type = "active"; + }; + }; +}; + +&gmac1 { + assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru SCLK_GMAC1>; + assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru SCLK_GMAC1>, <&gmac1_clkin>; + clock_in_out = "input"; + phy-supply = <&vcc_3v3>; + phy-mode = "rgmii"; + pinctrl-names = "default"; + pinctrl-0 = <&gmac1m0_miim + &gmac1m0_tx_bus2 + &gmac1m0_rx_bus2 + &gmac1m0_rgmii_clk + &gmac1m0_clkinout + &gmac1m0_rgmii_bus>; + snps,reset-gpio = <&gpio0 RK_PB7 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + /* Reset time is 20ms, 100ms for rtl8211f */ + snps,reset-delays-us = <0 20000 100000>; + tx_delay = <0x4e>; + rx_delay = <0x2c>; + phy-handle = <&rgmii_phy1>; + status = "okay"; +}; + +&hdmi { + avdd-0v9-supply = <&vdda0v9_image>; + avdd-1v8-supply = <&vcca1v8_image>; + status = "okay"; +}; + +&hdmi_in { + hdmi_in_vp0: endpoint@0 { + remote-endpoint = <&vp0_out_hdmi>; + }; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + +&hdmi_sound { + status = "okay"; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&i2c0 { + status = "okay"; + + vdd_cpu: regulator@1c { + compatible = "tcs,tcs4525"; + reg = <0x1c>; + vin-supply = <&vcc5v0_sys>; + regulator-name = "vdd_cpu"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1150000>; + regulator-ramp-delay = <2300>; + fcs,suspend-voltage-selector = <1>; + regulator-boot-on; + regulator-always-on; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + rk809: pmic@20 { + compatible = "rockchip,rk809"; + reg = <0x20>; + interrupt-parent = <&gpio0>; + interrupts = ; + clock-output-names = "rk808-clkout1", "rk808-clkout2"; + assigned-clocks = <&cru I2S1_MCLKOUT_TX>; + assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>; + clock-names = "mclk"; + clocks = <&cru I2S1_MCLKOUT_TX>; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int>, <&i2s1m0_mclk>; + rockchip,system-power-controller; + wakeup-source; + #clock-cells = <1>; + #sound-dai-cells = <0>; + + vcc1-supply = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc5-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + + codec { + mic-in-differential; + }; + + regulators { + vdd_log: DCDC_REG1 { + regulator-name = "vdd_log"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vdd_gpu: DCDC_REG2 { + regulator-name = "vdd_gpu"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vdd_npu: DCDC_REG4 { + regulator-name = "vdd_npu"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <1350000>; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8: DCDC_REG5 { + 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>; + }; + }; + + vdda0v9_image: LDO_REG1 { + regulator-name = "vdda0v9_image"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vdda_0v9: LDO_REG2 { + regulator-name = "vdda_0v9"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vdda0v9_pmu: LDO_REG3 { + regulator-name = "vdda0v9_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vccio_acodec: LDO_REG4 { + regulator-name = "vccio_acodec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + + }; + }; + + vccio_sd: LDO_REG5 { + regulator-name = "vccio_sd"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc3v3_pmu: LDO_REG6 { + regulator-name = "vcc3v3_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca_1v8: LDO_REG7 { + 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>; + }; + }; + + vcca1v8_pmu: LDO_REG8 { + regulator-name = "vcca1v8_pmu"; + 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>; + }; + }; + + vcca1v8_image: LDO_REG9 { + regulator-name = "vcca1v8_image"; + 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_3v3: SWITCH_REG1 { + regulator-boot-on; + regulator-name = "vcc3v3"; + }; + + vcc3v3_sd: SWITCH_REG2 { + regulator-name = "vcc3v3_sd"; + regulator-always-on; + regulator-boot-on; + }; + }; + }; +}; + +&i2s0_8ch { + status = "okay"; +}; + +&i2s1_8ch { + pinctrl-names = "default"; + pinctrl-0 = <&i2s1m0_sclktx + &i2s1m0_lrcktx + &i2s1m0_sdi0 + &i2s1m0_sdo0>; + rockchip,trcm-sync-tx-only; + status = "okay"; +}; + +&mdio1 { + rgmii_phy1: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0x0>; + }; +}; + +&pcie2x1 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie_reset_h>; + reset-gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie_p>; + status = "okay"; +}; + +&pinctrl { + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + bt { + bt_enable_h: bt-enable-h { + rockchip,pins = <2 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_host_wake_l: bt-host-wake-l { + rockchip,pins = <2 RK_PC0 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + bt_wake_l: bt-wake-l { + rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int: pmic_int { + rockchip,pins = + <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + usb { + vcc5v0_host_en: vcc5v0-host-en { + rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + vcc5v0_otg_en: vcc5v0-otg-en { + rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pcie { + pcie_enable_h: pcie-enable-h { + rockchip,pins = <0 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + pcie_reset_h: pcie-reset-h { + rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + leds { + led_power: led-power { + rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + led_user: led-user { + rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + headphone { + hp_det: hp-det { + rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcc3v3_pmu>; + vccio1-supply = <&vccio_acodec>; + vccio2-supply = <&vcc_1v8>; + vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcc_1v8>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_1v8>; + vccio7-supply = <&vcc_3v3>; + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca_1v8>; + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + mmc-hs200-1_8v; + non-removable; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcc_1v8>; + status = "okay"; +}; + +&sdmmc0 { + bus-width = <4>; + cap-sd-highspeed; + cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; + disable-wp; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; + sd-uhs-sdr104; + vmmc-supply = <&vcc3v3_sd>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&sdmmc1 { + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + disable-wp; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + vmmc-supply = <&vcc3v3_sys>; + vqmmc-supply = <&vcca1v8_pmu>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk &uart9m1_xfer &uart8m1_xfer>; + status = "okay"; +}; + +&sdmmc2 { + cap-sd-highspeed; + cap-sdio-irq; + bus-width = <4>; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcca1v8_pmu>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc2m0_bus4 &sdmmc2m0_cmd &sdmmc2m0_clk>; + sd-uhs-sdr104; + status = "okay"; +}; + +&tsadc { + status = "okay"; +}; + +&uart0 { +// pinctrl-names = "default"; +// pinctrl-0 = <&uart0_xfer>; + status = "disabled"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn &uart1m0_rtsn>; + status = "okay"; + uart-has-rtscts; + + bluetooth { + compatible = "brcm,bcm43438-bt"; + clocks = <&rk809 1>; + clock-names = "lpo"; + device-wake-gpios = <&gpio2 RK_PC1 GPIO_ACTIVE_HIGH>; + host-wake-gpios = <&gpio2 RK_PC0 GPIO_ACTIVE_HIGH>; + shutdown-gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; + vbat-supply = <&vcc3v3_sys>; + vddio-supply = <&vcca1v8_pmu>; + }; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host0_xhci { + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + + +&usb_host1_xhci { + status = "okay"; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy0_host { + phy-supply = <&vcc5v0_host>; + status = "okay"; +}; + +&usb2phy0_otg { + vbus-supply = <&vcc5v0_otg>; + status = "okay"; +}; + +&usb2phy1 { + status = "okay"; +}; + +&usb2phy1_host { + phy-supply = <&vcc5v0_host>; + status = "okay"; +}; + +&usb2phy1_otg { + phy-supply = <&vcc5v0_host>; + status = "okay"; +}; + +&vop { + compatible = "rockchip,rk3568-vop"; + assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; + assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi_in_vp0>; + }; +}; \ No newline at end of file diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3566-jp-tvbox.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-jp-tvbox.dts new file mode 100644 index 000000000000..6a53d23a55a4 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-jp-tvbox.dts @@ -0,0 +1,579 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2023 tdleiyao + */ + +/dts-v1/; + +#include +#include +#include +#include +#include "rk3566.dtsi" + +/ { + model = "JP TVbox 3566"; + compatible = "JP-TVbox,rk3566", "rockchip,rk3566"; + + aliases { + ethernet0 = &gmac1; + mmc0 = &sdhci; + mmc1 = &sdmmc1; + }; + + chosen: chosen { + stdout-path = "serial2:1500000n8"; + }; + + hdmi-con { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + + gmac1_clkin: external-gmac1-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "gmac1_clkin"; + #clock-cells = <0>; + }; + + leds { + compatible = "gpio-leds"; + + led_status: led-status { + label = "led-status"; + gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + pinctrl-names = "default"; + pinctrl-0 = <&led_status_enable_h>; + }; + }; + + vbus: vbus-regulator { + compatible = "regulator-fixed"; + regulator-name = "vbus"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vcc5v0_sys: vcc5v0-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vbus>; + }; + + vcc3v3_sys: vcc3v3-sys-regulator { + 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>; + }; + + sdio_pwrseq: sdio-pwrseq { + status = "okay"; + compatible = "mmc-pwrseq-simple"; + clocks = <&rk809 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + reset-gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_LOW>; + post-power-on-delay-ms = <100>; + }; + + wireless_wlan: wireless-wlan { + compatible = "wlan-platdata"; + rockchip,grf = <&grf>; + wifi_chip_type = "ap6398s"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_host_wake_irq>; + WIFI,host_wake_irq = <&gpio2 RK_PB2 GPIO_ACTIVE_HIGH>; + status = "okay"; + }; + +}; + +&combphy1 { + status = "okay"; +}; + +&combphy2 { + status = "okay"; +}; + +&cpu0 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu1 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu2 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu3 { + cpu-supply = <&vdd_cpu>; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&gmac1 { + assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru SCLK_GMAC1>; + assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru SCLK_GMAC1>, <&gmac1_clkin>; + clock_in_out = "input"; + phy-supply = <&vcc_3v3>; + phy-mode = "rgmii"; + pinctrl-names = "default"; + pinctrl-0 = <&gmac1m0_miim + &gmac1m0_tx_bus2 + &gmac1m0_rx_bus2 + &gmac1m0_rgmii_clk + &gmac1m0_clkinout + &gmac1m0_rgmii_bus>; + snps,reset-gpio = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + /* Reset time is 20ms, 100ms for rtl8211f, also works well here */ + snps,reset-delays-us = <0 20000 100000>; + tx_delay = <0x41>; + rx_delay = <0x2e>; + phy-handle = <&rgmii_phy1>; + status = "okay"; +}; + +&mdio1 { + rgmii_phy1: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + status = "okay"; + }; +}; + +&hdmi { + avdd-0v9-supply = <&vdda0v9_image>; + avdd-1v8-supply = <&vcca1v8_image>; + status = "okay"; +}; + +&hdmi_in { + hdmi_in_vp0: endpoint { + remote-endpoint = <&vp0_out_hdmi>; + }; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + +&hdmi_sound { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + + vdd_cpu: regulator@1c { + compatible = "tcs,tcs4525"; + reg = <0x1c>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1150000>; + regulator-ramp-delay = <2300>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + rk809: pmic@20 { + compatible = "rockchip,rk809"; + reg = <0x20>; + interrupt-parent = <&gpio0>; + interrupts = ; + #clock-cells = <1>; + clock-output-names = "rk808-clkout1", "rk808-clkout2"; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>; + rockchip,system-power-controller; + wakeup-source; + + vcc1-supply = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc5-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-init-microvolt = <900000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_gpu: DCDC_REG2 { + regulator-name = "vdd_gpu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-init-microvolt = <900000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-name = "vcc_ddr"; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vdd_npu: DCDC_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-init-microvolt = <900000>; + regulator-initial-mode = <0x2>; + regulator-name = "vdd_npu"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8: DCDC_REG5 { + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_image: LDO_REG1 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-name = "vdda0v9_image"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda_0v9: LDO_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-name = "vdda_0v9"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_pmu: LDO_REG3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-name = "vdda0v9_pmu"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vccio_acodec: LDO_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vccio_acodec"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vccio_sd"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_pmu: LDO_REG6 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc3v3_pmu"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca_1v8: LDO_REG7 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcca_1v8"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcca1v8_pmu: LDO_REG8 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcca1v8_pmu"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcca1v8_image: LDO_REG9 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcca1v8_image"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3: SWITCH_REG1 { + regulator-name = "vcc_3v3"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_sd: SWITCH_REG2 { + regulator-name = "vcc3v3_sd"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + }; + }; +}; + +&pinctrl { + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wireless-wlan { + wifi_host_wake_irq: wifi-host-wake-irq { + rockchip,pins = <2 RK_PB2 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + bt { + bt_enable_h: bt-enable-h { + rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_host_wake_l: bt-host-wake-l { + rockchip,pins = <2 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_wake_l: bt-wake-l { + rockchip,pins = <2 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + leds { + led_status_enable_h: led-status-enable-h { + rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcc3v3_pmu>; + vccio1-supply = <&vccio_acodec>; + vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcc_1v8>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_1v8>; + vccio7-supply = <&vcc_3v3>; + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca_1v8>; + status = "okay"; +}; + +&sata2 { + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + mmc-hs200-1_8v; + non-removable; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcc_1v8>; + status = "okay"; +}; + +&sdmmc1 { + supports-sdio; + bus-width = <4>; + disable-wp; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk>; + non-removable; + mmc-pwrseq = <&sdio_pwrseq>; + status = "okay"; + +}; + +&tsadc { + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn &uart1m0_rtsn>; + status = "okay"; + + bluetooth { + compatible = "brcm,bcm43438-bt"; + clocks = <&rk809 1>; + clock-names = "lpo"; + device-wakeup-gpios = <&gpio2 RK_PC1 GPIO_ACTIVE_HIGH>; + host-wakeup-gpios = <&gpio2 RK_PC0 GPIO_ACTIVE_HIGH>; + shutdown-gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; + max-speed = <1500000>; + pinctrl-names = "default"; + pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; + vbat-supply = <&vcc3v3_sys>; + vddio-supply = <&vcca1v8_pmu>; + }; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_xhci { + dr_mode = "host"; + status = "okay"; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy0_host { + status = "okay"; +}; + +&usb2phy0_otg { + status = "okay"; +}; + +&usb_host1_xhci { + status = "okay"; +}; + +&usb2phy1 { + status = "okay"; +}; + +&usb2phy1_host { + status = "okay"; +}; + +&usb2phy1_otg { + status = "okay"; +}; + +&vop { + assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; + assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi_in_vp0>; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3566-orangepi-3b-sata.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-orangepi-3b-sata.dts new file mode 100644 index 000000000000..7957970244d7 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-orangepi-3b-sata.dts @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "rk3566-orangepi-3b.dts" + +/ { + model = "Rockchip RK3566 OPi 3B with SATA instead of PCIe"; +}; + +&pcie2x1 { + status = "disabled"; +}; + +&sata2 { + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3566-orangepi-3b.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-orangepi-3b.dts new file mode 100644 index 000000000000..0d385cfa23c0 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-orangepi-3b.dts @@ -0,0 +1,869 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2020 Rockchip Electronics Co., Ltd. + * + */ +/dts-v1/; + +#include +#include +#include +#include +#include "rk3566.dtsi" + +/ { + model = "Rockchip RK3566 OPi 3B"; + compatible = "rockchip,rk3566-orangepi-3b", "rockchip,rk3566"; + + aliases { + ethernet0 = &gmac1; + mmc0 = &sdhci; + mmc1 = &sdmmc0; + }; + + chosen: chosen { + stdout-path = "serial2:1500000n8"; + }; + + fan: pwm-fan { + compatible = "pwm-fan"; + #cooling-cells = <2>; + pwms = <&pwm7 0 50000 0>; + cooling-levels = <0 50 100 150 200 255>; + rockchip,temp-trips = < + 50000 1 + 55000 2 + 60000 3 + 65000 4 + 70000 5 + >; + }; + + hdmi-con { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + + leds: leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 =<&leds_gpio>; + + led@1 { + gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_HIGH>; + label = "status_led"; + linux,default-trigger = "heartbeat"; + }; + }; + + rk809-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,name = "Analog RK809"; + simple-audio-card,mclk-fs = <256>; + + simple-audio-card,cpu { + sound-dai = <&i2s1_8ch>; + }; + + simple-audio-card,codec { + sound-dai = <&rk809>; + }; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk809 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + + /* + * On the module itself this is one of these (depending + * on the actual card populated): + * - SDIO_RESET_L_WL_REG_ON + * - PDN (power down when low) + */ + post-power-on-delay-ms = <200>; + reset-gpios = <&gpio0 RK_PD3 GPIO_ACTIVE_LOW>; + }; + + sprd-mtty { + compatible = "sprd,mtty"; + sprd,name = "ttyBT"; + }; + + unisoc_uwe_bsp: uwe-bsp { + compatible = "unisoc,uwe_bsp"; + wl-reg-on = <&gpio0 RK_PD3 GPIO_ACTIVE_HIGH>; + bt-reg-on = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; + wl-wake-host-gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_HIGH>; + bt-wake-host; + bt-wake-host-gpio = <&gpio2 RK_PC0 GPIO_ACTIVE_HIGH>; + sdio-ext-int-gpio = <&gpio2 RK_PC1 GPIO_ACTIVE_HIGH>; + unisoc,btwf-file-name = "/lib/firmware/wcnmodem.bin"; + blksz-512; + keep-power-on; + }; + + /* labeled +12v in schematic */ + vcc12v_dcin: vcc12v-dcin-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc12v_dcin"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + }; + + /* labeled +5v in schematic */ + vcc_5v: vcc-5v-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_5v"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc12v_dcin>; + }; + + vbus: vbus { + compatible = "regulator-fixed"; + regulator-name = "vbus"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + /* labeled +3.3v For PCIe only in schematic */ + vcc3v3_pcie: vcc3v3-pcie-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_pcie"; + regulator-always-on; + regulator-boot-on; + enable-active-high; + gpio = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_drv>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + 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 = <&vbus>; + }; + + 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 = <&vbus>; + }; + + 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 = <&vbus>; + }; + + vcc_sd: vcc-sd { + compatible = "regulator-fixed"; + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <3300000>; + regulator-name = "vcc_sd"; + vin-supply = <&vcc3v3_sys>; + }; + + vcc5v0_host: vcc5v0-host-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_host_en>; + regulator-name = "vcc5v0_host"; + regulator-always-on; + }; + + vcc5v0_otg: vcc5v0-otg-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_otg_en>; + regulator-name = "vcc5v0_otg"; + regulator-always-on; + }; +}; + +&combphy1 { + status = "okay"; +}; + +&combphy2 { + status = "okay"; +}; + +&cpu0 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu1 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu2 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu3 { + cpu-supply = <&vdd_cpu>; +}; + +&gmac1 { + assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>; + assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru CLK_MAC1_2TOP>; + assigned-clock-rates = <0>, <125000000>; + clock_in_out = "input"; + phy-mode = "rgmii"; + pinctrl-names = "default"; + pinctrl-0 = <&gmac1m0_miim + &gmac1m0_tx_bus2 + &gmac1m0_rx_bus2 + &gmac1m0_rgmii_clk + &gmac1m0_clkinout + &gmac1m0_rgmii_bus>; + + snps,reset-gpio = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + /* Reset time is 20ms, 100ms for rtl8211f */ + //snps,reset-delays-us = <0 20000 100000>; + snps,reset-delays-us = <0 50000 200000>; + tx_delay = <0x30>; + rx_delay = <0x10>; + phy-handle = <&rgmii_phy0>; + status = "okay"; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&hdmi { + avdd-0v9-supply = <&vdda0v9_image>; + avdd-1v8-supply = <&vcca1v8_image>; + status = "okay"; +}; + +&hdmi_in { + hdmi_in_vp0: endpoint { + remote-endpoint = <&vp0_out_hdmi>; + }; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + +&hdmi_sound { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + + vdd_cpu: syr837@40 { + compatible = "silergy,syr827"; + reg = <0x40>; + vin-supply = <&vcc5v0_sys>; + regulator-compatible = "fan53555-reg"; + regulator-name = "vdd_cpu"; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1390000>; + regulator-init-microvolt = <900000>; + regulator-initial-mode = <1>; + regulator-ramp-delay = <2300>; + fcs,suspend-voltage-selector = <1>; + regulator-boot-on; + regulator-always-on; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + rk809: pmic@20 { + compatible = "rockchip,rk809"; + reg = <0x20>; + interrupt-parent = <&gpio0>; + interrupts = <3 IRQ_TYPE_LEVEL_LOW>; + + assigned-clocks = <&cru I2S1_MCLKOUT_TX>; + assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>; + #clock-cells = <1>; + clock-names = "mclk"; + clocks = <&cru I2S1_MCLKOUT_TX>; + pinctrl-names = "default", "pmic-sleep", + "pmic-power-off", "pmic-reset"; + pinctrl-0 = <&pmic_int>, <&i2s1m0_mclk>; + pinctrl-1 = <&soc_slppin_slp>, <&rk817_slppin_slp>; + pinctrl-2 = <&soc_slppin_gpio>, <&rk817_slppin_pwrdn>; + pinctrl-3 = <&soc_slppin_gpio>, <&rk817_slppin_rst>; + #sound-dai-cells = <0>; + + rockchip,system-power-controller; + wakeup-source; + + vcc1-supply = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc5-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + + pinctrl_rk8xx: pinctrl_rk8xx { + gpio-controller; + #gpio-cells = <2>; + + rk817_slppin_null: rk817_slppin_null { + pins = "gpio_slp"; + function = "pin_fun0"; + }; + + rk817_slppin_slp: rk817_slppin_slp { + pins = "gpio_slp"; + function = "pin_fun1"; + }; + + rk817_slppin_pwrdn: rk817_slppin_pwrdn { + pins = "gpio_slp"; + function = "pin_fun2"; + }; + + rk817_slppin_rst: rk817_slppin_rst { + pins = "gpio_slp"; + function = "pin_fun3"; + }; + }; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-init-microvolt = <900000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <0x2>; + regulator-name = "vdd_logic"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_gpu: DCDC_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-init-microvolt = <900000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <0x2>; + regulator-name = "vdd_gpu"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-name = "vcc_ddr"; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vdd_npu: DCDC_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-init-microvolt = <900000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <0x2>; + regulator-name = "vdd_npu"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_image: LDO_REG1 { + regulator-boot-on; + regulator-always-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-name = "vdda0v9_image"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda_0v9: LDO_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-name = "vdda_0v9"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_pmu: LDO_REG3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-name = "vdda0v9_pmu"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vccio_acodec: LDO_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "vccio_acodec"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vccio_sd"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_pmu: LDO_REG6 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc3v3_pmu"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca_1v8: LDO_REG7 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcca_1v8"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcca1v8_pmu: LDO_REG8 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcca1v8_pmu"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcca1v8_image: LDO_REG9 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcca1v8_image"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8: DCDC_REG5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc_1v8"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3: SWITCH_REG1 { + regulator-always-on; + regulator-boot-on; + regulator-name = "vcc_3v3"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_sd: SWITCH_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-name = "vcc3v3_sd"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + + codec { + mic-in-differential; + }; + }; +}; + +/* + * i2c3_m0 is exposed on the 40-pin (green connectors) + * pin 27 - i2c3_sda_m0 + * pin 28 - i2c3_scl_m0 + */ +&i2c3 { + status = "okay"; +}; + +&i2s0_8ch { + status = "okay"; +}; + +&i2s1_8ch { + pinctrl-names = "default"; + pinctrl-0 = <&i2s1m0_sclktx + &i2s1m0_lrcktx + &i2s1m0_sdi0 + &i2s1m0_sdo0>; + rockchip,trcm-sync-tx-only; + status = "okay"; +}; + +&mdio1 { + rgmii_phy0: phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0x0>; + }; +}; + +&pcie2x1 { + reset-gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie>; + status = "okay"; +}; + +&pinctrl { + wireless-bluetooth { + uart1_gpios: uart1-gpios { + rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + sd { + sdmmc0_pwr_h: sdmmc0-pwr-h { + rockchip,pins = + <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + mxc6655xa { + mxc6655xa_irq_gpio: mxc6655xa_irq_gpio { + rockchip,pins = <3 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int: pmic_int { + rockchip,pins = + <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + soc_slppin_gpio: soc_slppin_gpio { + rockchip,pins = + <0 RK_PA2 RK_FUNC_GPIO &pcfg_output_low>; + }; + + soc_slppin_slp: soc_slppin_slp { + rockchip,pins = + <0 RK_PA2 1 &pcfg_pull_none>; + }; + + soc_slppin_rst: soc_slppin_rst { + rockchip,pins = + <0 RK_PA2 2 &pcfg_pull_none>; + }; + }; + + touch { + touch_gpio: touch-gpio { + rockchip,pins = + <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, + <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + usb { + vcc5v0_host_en: vcc5v0-host-en { + rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + vcc5v0_otg_en: vcc5v0-otg-en { + rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + work-led { + leds_gpio: leds-gpio { + rockchip,pins = <0 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + headphone { + hp_det: hp-det { + rockchip,pins = <0 RK_PC4 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + pcie { + pcie_drv: pcie-drv { + rockchip,pins = + <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + edp { + edp_hpd: edp-hpd { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bl_en: bl-en { + rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_output_high>; + }; + }; +}; + + /* + * There are 10 independent IO domains in RK3566/RK3568, including PMUIO[0:2] and VCCIO[1:7]. + * 1/ PMUIO0 and PMUIO1 are fixed-level power domains which cannot be configured; + * 2/ PMUIO2 and VCCIO1,VCCIO[3:7] domains require that their hardware power supply voltages + * must be consistent with the software configuration correspondingly + * a/ When the hardware IO level is connected to 1.8V, the software voltage configuration + * should also be configured to 1.8V accordingly; + * b/ When the hardware IO level is connected to 3.3V, the software voltage configuration + * should also be configured to 3.3V accordingly; + * 3/ VCCIO2 voltage control selection (0xFDC20140) + * BIT[0]: 0x0: from GPIO_0A7 (default) + * BIT[0]: 0x1: from GRF + * Default is determined by Pin FLASH_VOL_SEL/GPIO0_A7: + * L:VCCIO2 must supply 3.3V + * H:VCCIO2 must supply 1.8V + */ + +&pmu_io_domains { + status = "okay"; + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcc3v3_pmu>; + vccio1-supply = <&vcc_3v3>; + vccio2-supply = <&vcc_1v8>; + vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcc_1v8>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_3v3>; + vccio7-supply = <&vcc_3v3>; +}; + +&pwm7 { + status = "okay"; +}; + +&saradc { + status = "okay"; + vref-supply = <&vcca_1v8>; +}; + +&sdhci { + bus-width = <8>; + max-frequency = <200000000>; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd>; + status = "okay"; +}; + +&sdmmc0 { + max-frequency = <150000000>; + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + disable-wp; + sd-uhs-sdr104; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vccio_sd>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; + status = "okay"; +}; + +&sdmmc1 { + max-frequency = <150000000>; + bus-width = <4>; + disable-wp; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk>; + sd-uhs-sdr104; + status = "okay"; +}; + +&sfc { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <100000000>; + spi-rx-bus-width = <4>; + spi-tx-bus-width = <1>; + }; +}; + +&tsadc { + status = "okay"; +}; + +&uart1 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn &uart1m0_rtsn>; + uart-has-rtscts; +}; + +/* (debug) uart2 has connectors near the usb-c power, but also on the 40-pin pins 6 (tx) and 8 (rx) - don't wire both */ +&uart2 { + status = "okay"; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy0_host { + phy-supply = <&vbus>; + status = "okay"; +}; + +&usb2phy0_otg { + status = "okay"; +}; + +&usb2phy1 { + status = "okay"; +}; + +&usb2phy1_host { + status = "okay"; +}; + +&usb2phy1_otg { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host0_xhci { + dr_mode = "host"; + extcon = <&usb2phy0>; + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&usb_host1_xhci { + status = "okay"; +}; + +&vop { + assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; + assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi_in_vp0>; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3566-panther-x2.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-panther-x2.dts new file mode 100644 index 000000000000..2d077f3bb36f --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-panther-x2.dts @@ -0,0 +1,579 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2023 tdleiyao + */ + +/dts-v1/; + +#include +#include +#include +#include "rk3566.dtsi" + +/ { + model = "Panther X2"; + compatible = "panther,x2", "rockchip,rk3566"; + + aliases { + ethernet0 = &gmac1; + mmc0 = &sdmmc0; + mmc1 = &sdhci; + mmc2 = &sdmmc1; + }; + + chosen: chosen { + stdout-path = "serial2:1500000n8"; + }; + + gmac1_clkin: external-gmac1-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "gmac1_clkin"; + #clock-cells = <0>; + }; + + leds { + compatible = "gpio-leds"; + //Corresponds to the actual order + led_pwr: led-pwr { + label = "led-pwr"; + default-state = "on"; + gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&led_pwr_enable_h>; + retain-state-suspended; + status = "okay"; + }; + + led_wifi: led-wifi { + label = "led-wifi"; + default-state = "off"; + gpios = <&gpio0 RK_PD6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&led_wifi_enable_h>; + retain-state-suspended; + status = "okay"; + }; + + led_eth: led-eth { + label = "led-eth"; + default-state = "off"; + gpios = <&gpio0 RK_PD5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&led_eth_enable_h>; + retain-state-suspended; + status = "okay"; + }; + + led_status: led-status { + label = "led-status"; + default-state = "on"; + gpios = <&gpio0 RK_PD3 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + pinctrl-names = "default"; + pinctrl-0 = <&led_status_enable_h>; + retain-state-suspended; + status = "okay"; + }; + }; + + vbus: vbus-regulator { + compatible = "regulator-fixed"; + regulator-name = "vbus"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vcc5v0_sys: vcc5v0-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vbus>; + }; + + vcc3v3_sys: vcc3v3-sys-regulator { + 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>; + }; + + sdio_pwrseq: sdio-pwrseq { + status = "okay"; + compatible = "mmc-pwrseq-simple"; + clocks = <&rk809 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + reset-gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_LOW>; + post-power-on-delay-ms = <100>; + }; + + wireless_wlan: wireless-wlan { + compatible = "wlan-platdata"; + rockchip,grf = <&grf>; + wifi_chip_type = "ap6236"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_host_wake_irq>; + WIFI,host_wake_irq = <&gpio2 RK_PB2 GPIO_ACTIVE_HIGH>; + status = "okay"; + }; + +}; + +&cpu0 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu1 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu2 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu3 { + cpu-supply = <&vdd_cpu>; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&gmac1 { + assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru SCLK_GMAC1>; + assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru SCLK_GMAC1>, <&gmac1_clkin>; + clock_in_out = "input"; + phy-supply = <&vcc_3v3>; + phy-mode = "rgmii"; + pinctrl-names = "default"; + pinctrl-0 = <&gmac1m0_miim + &gmac1m0_tx_bus2 + &gmac1m0_rx_bus2 + &gmac1m0_rgmii_clk + &gmac1m0_clkinout + &gmac1m0_rgmii_bus>; + snps,reset-gpio = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + /* Reset time is 20ms, 100ms for rtl8211f, also works well here */ + snps,reset-delays-us = <0 20000 100000>; + tx_delay = <0x30>; + rx_delay = <0x10>; + phy-handle = <&rgmii_phy1>; + status = "okay"; +}; +&mdio1 { + rgmii_phy1: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + status = "okay"; + }; +}; + +&i2c0 { + status = "okay"; + + vdd_cpu: regulator@1c { + compatible = "tcs,tcs4525"; + reg = <0x1c>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1150000>; + regulator-ramp-delay = <2300>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + rk809: pmic@20 { + compatible = "rockchip,rk809"; + reg = <0x20>; + interrupt-parent = <&gpio0>; + interrupts = ; + #clock-cells = <1>; + clock-output-names = "rk808-clkout1", "rk808-clkout2"; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>; + rockchip,system-power-controller; + wakeup-source; + + vcc1-supply = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc5-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-init-microvolt = <900000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vdd_gpu: DCDC_REG2 { + regulator-name = "vdd_gpu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-init-microvolt = <900000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-name = "vcc_ddr"; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vdd_npu: DCDC_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-init-microvolt = <900000>; + regulator-initial-mode = <0x2>; + regulator-name = "vdd_npu"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8: DCDC_REG5 { + 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>; + }; + }; + + vdda0v9_image: LDO_REG1 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-name = "vdda0v9_image"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vdda_0v9: LDO_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-name = "vdda_0v9"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_pmu: LDO_REG3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-name = "vdda0v9_pmu"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vccio_acodec: LDO_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vccio_acodec"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vccio_sd"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_pmu: LDO_REG6 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc3v3_pmu"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca_1v8: LDO_REG7 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcca_1v8"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcca1v8_pmu: LDO_REG8 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcca1v8_pmu"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcca1v8_image: LDO_REG9 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcca1v8_image"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3: SWITCH_REG1 { + regulator-name = "vcc_3v3"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_sd: SWITCH_REG2 { + regulator-name = "vcc3v3_sd"; + status = "disabled"; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + }; + }; +}; + +&i2s1_8ch { + pinctrl-names = "default"; + pinctrl-0 = <&i2s1m1_sclktx &i2s1m1_sclkrx + &i2s1m1_lrcktx &i2s1m1_lrckrx + &i2s1m1_sdi0 &i2s1m1_sdi1 + &i2s1m1_sdi2 &i2s1m1_sdi3 + &i2s1m1_sdo0 &i2s1m1_sdo1 + &i2s1m1_sdo2 &i2s1m1_sdo3>; + status = "disabled"; +}; + +&pinctrl { + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wireless-wlan { + wifi_host_wake_irq: wifi-host-wake-irq { + rockchip,pins = <2 RK_PB2 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + bt { + bt_enable_h: bt-enable-h { + rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_host_wake_l: bt-host-wake-l { + rockchip,pins = <2 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_wake_l: bt-wake-l { + rockchip,pins = <2 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + leds { + led_pwr_enable_h: led-pwr-enable-h { + rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + led_wifi_enable_h: led-wifi-enable-h { + rockchip,pins = <0 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + led_eth_enable_h: led-eth-enable-h { + rockchip,pins = <0 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + led_status_enable_h: led-status-enable-h { + rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcc3v3_pmu>; + vccio1-supply = <&vcc_3v3>; + vccio2-supply = <&vcc_1v8>; + vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcc_1v8>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_3v3>; + vccio7-supply = <&vcc_3v3>; + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca_1v8>; + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + mmc-hs200-1_8v; + non-removable; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcc_1v8>; + status = "okay"; +}; + +&sdmmc0 { + broken-cd; + bus-width = <4>; + cap-sd-highspeed; + disable-wp; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&sdmmc1 { + supports-sdio; + bus-width = <4>; + disable-wp; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk>; + non-removable; + mmc-pwrseq = <&sdio_pwrseq>; + status = "okay"; + +}; + +&tsadc { + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn &uart1m0_rtsn>; + status = "okay"; + + bluetooth { + compatible = "brcm,bcm43438-bt"; + clocks = <&rk809 1>; + clock-names = "lpo"; + device-wakeup-gpios = <&gpio2 RK_PC1 GPIO_ACTIVE_HIGH>; + host-wakeup-gpios = <&gpio2 RK_PC0 GPIO_ACTIVE_HIGH>; + shutdown-gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; + max-speed = <1500000>; + pinctrl-names = "default"; + pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; + vbat-supply = <&vcc3v3_sys>; + vddio-supply = <&vcca1v8_pmu>; + }; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_xhci { + dr_mode = "host"; + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy0_host { + status = "okay"; +}; + +&usb2phy0_otg { + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3.dtsi b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3.dtsi new file mode 100644 index 000000000000..9cc7aa3298d0 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3.dtsi @@ -0,0 +1,531 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +#include +#include +#include +#include "rk3566.dtsi" + +/ { + chosen { + stdout-path = "serial2:1500000n8"; + }; + + hdmi-con { + compatible = "hdmi-connector"; + type = "d"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&user_led2>; + + led-green { + color = ; + default-state = "on"; + function = LED_FUNCTION_HEARTBEAT; + gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + }; + }; + + vcc_1v8: regulator-1v8-vcc { + compatible = "regulator-fixed"; + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_1v8_p>; + }; + + vcca_1v8: regulator-1v8-vcca { + compatible = "regulator-fixed"; + regulator-name = "vcca_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_1v8_p>; + }; + + vcca1v8_image: regulator-1v8-vcca-image { + compatible = "regulator-fixed"; + regulator-name = "vcca1v8_image"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_1v8_p>; + }; + + vcc_3v3: regulator-3v3-vcc { + compatible = "regulator-fixed"; + regulator-name = "vcc_3v3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc3v3_sys>; + }; + + vcc_sys: regulator-5v0-vcc-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; +}; + +&combphy1 { + status = "okay"; +}; + +&cpu0 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu1 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu2 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu3 { + cpu-supply = <&vdd_cpu>; +}; + +&gpio0 { + gpio-line-names = + /* GPIO0_A0 - A7 */ + "", "", "", "", "", "", "", "", + /* GPIO0_B0 - B7 */ + "", "", "", "", "", "", "", "", + /* GPIO0_C0 - C7 */ + "", "", "", "", "", "", "", "", + /* GPIO0_D0 - D7 */ + "pin-10 [GPIO0_D0]", "pin-08 [GPIO0_D1]", "", + "", "", "", "", ""; +}; + +&gpio1 { + gpio-line-names = + /* GPIO1_A0 - A7 */ + "pin-03 [GPIO1_A0]", "pin-05 [GPIO1_A1]", "", + "", "pin-37 [GPIO1_A4]", "", + "", "", + /* GPIO1_B0 - B7 */ + "", "", "", "", "", "", "", "", + /* GPIO1_C0 - C7 */ + "", "", "", "", "", "", "", "", + /* GPIO1_D0 - D7 */ + "", "", "", "", "", "", "", ""; +}; + +&gpio2 { + gpio-line-names = + /* GPIO2_A0 - A7 */ + "", "", "", "", "", "", "", "", + /* GPIO2_B0 - B7 */ + "", "", "", "", "", "", "", "", + /* GPIO2_C0 - C7 */ + "", "", "", "", "", "", "", "", + /* GPIO2_D0 - D7 */ + "", "", "", "", "", "", "", ""; +}; + +&gpio3 { + gpio-line-names = + /* GPIO3_A0 - A7 */ + "", "pin-11 [GPIO3_A1]", "pin-13 [GPIO3_A2]", + "pin-12 [GPIO3_A3]", "pin-35 [GPIO3_A4]", "pin-40 [GPIO3_A5]", + "pin-38 [GPIO3_A6]", "pin-36 [GPIO3_A7]", + /* GPIO3_B0 - B7 */ + "pin-15 [GPIO3_B0]", "pin-16 [GPIO3_B1]", "pin-18 [GPIO3_B2]", + "pin-29 [GPIO3_B3]", "pin-31 [GPIO3_B4]", "", + "", "", + /* GPIO3_C0 - C7 */ + "", "pin-22 [GPIO3_C1]", "pin-32 [GPIO3_C2]", + "pin-33 [GPIO3_C3]", "pin-07 [GPIO3_C4]", "", + "", "", + /* GPIO3_D0 - D7 */ + "", "", "", "", "", "", "", ""; +}; + +&gpio4 { + gpio-line-names = + /* GPIO4_A0 - A7 */ + "", "", "", "", "", "", "", "", + /* GPIO4_B0 - B7 */ + "", "", "pin-27 [GPIO4_B2]", + "pin-28 [GPIO4_B3]", "", "", "", "", + /* GPIO4_C0 - C7 */ + "", "", "pin-23 [GPIO4_C2]", + "pin-19 [GPIO4_C3]", "", "pin-21 [GPIO4_C5]", + "pin-24 [GPIO4_C6]", "", + /* GPIO4_D0 - D7 */ + "", "", "", "", "", "", "", ""; +}; + +&gpu { + mali-supply = <&vdd_gpu_npu>; + status = "okay"; +}; + +&hdmi { + avdd-0v9-supply = <&vdda_0v9>; + avdd-1v8-supply = <&vcca1v8_image>; + status = "okay"; +}; + +&hdmi_in { + hdmi_in_vp0: endpoint { + remote-endpoint = <&vp0_out_hdmi>; + }; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + +&hdmi_sound { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + + rk817: pmic@20 { + compatible = "rockchip,rk817"; + reg = <0x20>; + #clock-cells = <1>; + clock-output-names = "rk817-clkout1", "rk817-clkout2"; + interrupt-parent = <&gpio0>; + interrupts = ; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>; + system-power-controller; + wakeup-source; + + vcc1-supply = <&vcc_sys>; + vcc2-supply = <&vcc_sys>; + vcc3-supply = <&vcc_sys>; + vcc4-supply = <&vcc_sys>; + vcc5-supply = <&vcc_sys>; + vcc6-supply = <&vcc_sys>; + vcc7-supply = <&vcc_sys>; + vcc8-supply = <&vcc_sys>; + vcc9-supply = <&vcc5v_midu>; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vdd_gpu_npu: DCDC_REG2 { + regulator-name = "vdd_gpu_npu"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + 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-initial-mode = <0x2>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc3v3_sys: DCDC_REG4 { + regulator-name = "vcc3v3_sys"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca1v8_pmu: LDO_REG1 { + regulator-name = "vcca1v8_pmu"; + 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>; + }; + }; + + vdda_0v9: LDO_REG2 { + regulator-name = "vdda_0v9"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_pmu: LDO_REG3 { + regulator-name = "vdda0v9_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vccio_acodec: LDO_REG4 { + regulator-name = "vccio_acodec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-name = "vccio_sd"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_pmu: LDO_REG6 { + regulator-name = "vcc3v3_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_1v8_p: LDO_REG7 { + regulator-name = "vcc_1v8_p"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc1v8_dvp: LDO_REG8 { + regulator-name = "vcc1v8_dvp"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc2v8_dvp: LDO_REG9 { + regulator-name = "vcc2v8_dvp"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc5v_midu: BOOST { + regulator-name = "vcc5v_midu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vbus: OTG_SWITCH { + regulator-name = "vbus"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + }; + + vdd_cpu: regulator@40 { + compatible = "rockchip,rk8600"; + reg = <0x40>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1390000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2s0_8ch { + status = "okay"; +}; + +&pinctrl { + leds { + user_led2: user-led2 { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcca1v8_pmu>; + vccio1-supply = <&vccio_acodec>; + vccio2-supply = <&vcc_1v8>; + vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcc_1v8>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_3v3>; + vccio7-supply = <&vcc_3v3>; + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca_1v8>; + status = "okay"; +}; + +&sdmmc0 { + bus-width = <4>; + cap-sd-highspeed; + disable-wp; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; + vmmc-supply = <&vcc3v3_sys>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&tsadc { + rockchip,hw-tshut-mode = <1>; + rockchip,hw-tshut-polarity = <0>; + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_xhci { + dr_mode = "peripheral"; + status = "okay"; +}; + +&usb_host1_xhci { + status = "okay"; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy0_host { + status = "okay"; +}; + +&usb2phy0_otg { + status = "okay"; +}; + +&vop { + assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; + assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi_in_vp0>; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3e.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3e.dts new file mode 100644 index 000000000000..4a830eb09f0b --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3e.dts @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "rk3566-radxa-zero-3.dtsi" + +/ { + model = "Radxa ZERO 3E"; + compatible = "radxa,zero-3e", "rockchip,rk3566"; + + aliases { + ethernet0 = &gmac1; + mmc0 = &sdmmc0; + }; +}; + +&gmac1 { + assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>; + assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru CLK_MAC1_2TOP>; + clock_in_out = "input"; + phy-handle = <&rgmii_phy1>; + phy-mode = "rgmii-id"; + phy-supply = <&vcc_3v3>; + pinctrl-names = "default"; + pinctrl-0 = <&gmac1m1_miim + &gmac1m1_tx_bus2 + &gmac1m1_rx_bus2 + &gmac1m1_rgmii_clk + &gmac1m1_rgmii_bus + &gmac1m1_clkinout>; + status = "okay"; +}; + +&mdio1 { + rgmii_phy1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&gmac1_rstn>; + reset-assert-us = <20000>; + reset-deassert-us = <50000>; + reset-gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; + }; +}; + +&pinctrl { + gmac1 { + gmac1_rstn: gmac1-rstn { + rockchip,pins = <3 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3w.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3w.dts new file mode 100644 index 000000000000..f92475c59deb --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3w.dts @@ -0,0 +1,92 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "rk3566-radxa-zero-3.dtsi" + +/ { + model = "Radxa ZERO 3W"; + compatible = "radxa,zero-3w", "rockchip,rk3566"; + + aliases { + mmc0 = &sdhci; + mmc1 = &sdmmc0; + mmc2 = &sdmmc1; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk817 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_reg_on_h>; + post-power-on-delay-ms = <100>; + power-off-delay-us = <5000000>; + reset-gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_LOW>; + }; +}; + +&pinctrl { + bluetooth { + bt_reg_on_h: bt-reg-on-h { + rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_wake_host_h: bt-wake-host-h { + rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + host_wake_bt_h: host-wake-bt-h { + rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wifi { + wifi_reg_on_h: wifi-reg-on-h { + rockchip,pins = <0 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + wifi_wake_host_h: wifi-wake-host-h { + rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&sdhci { + bus-width = <8>; + cap-mmc-highspeed; + max-frequency = <200000000>; + mmc-hs200-1_8v; + no-sd; + no-sdio; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcc_1v8>; + status = "okay"; +}; + +&sdmmc1 { + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + no-mmc; + no-sd; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_clk &sdmmc1_cmd>; + sd-uhs-sdr104; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcc_1v8>; + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn &uart1m0_rtsn>; + uart-has-rtscts; + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3566-rock-3c.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-rock-3c.dts new file mode 100644 index 000000000000..774134de72a7 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-rock-3c.dts @@ -0,0 +1,786 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; +#include +#include +#include +#include +#include "rk3566.dtsi" + +/ { + model = "Radxa ROCK3 Model C"; + compatible = "radxa,rock3c", "rockchip,rk3566"; + + aliases { + ethernet0 = &gmac1; + mmc0 = &sdhci; + mmc1 = &sdmmc0; + mmc2 = &sdmmc1; + }; + + chosen: chosen { + stdout-path = "serial2:1500000n8"; + }; + + hdmi-con { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + + gmac1_clkin: external-gmac1-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "gmac1_clkin"; + #clock-cells = <0>; + }; + + leds { + compatible = "gpio-leds"; + + led_user: led-0 { + gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>; + function = LED_FUNCTION_HEARTBEAT; + color = ; + linux,default-trigger = "heartbeat"; + pinctrl-names = "default"; + pinctrl-0 = <&led_user_en>; + }; + }; + + pwm-fan { + compatible = "pwm-fan"; + #cooling-cells = <2>; + cooling-levels = <0 64 128 192 255>; + pwms = <&pwm15 0 40000 0>; + }; + + rk809-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,name = "Analog RK809"; + simple-audio-card,mclk-fs = <256>; + + simple-audio-card,cpu { + sound-dai = <&i2s1_8ch>; + }; + + simple-audio-card,codec { + sound-dai = <&rk809>; + }; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk809 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_reg_on_h>; + post-power-on-delay-ms = <100>; + power-off-delay-us = <5000000>; + reset-gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_LOW>; + }; + + vcc5v_dcin: vcc5v-dcin-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v_dcin"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vcc3v3_pcie: vcc3v3-pcie-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_pwr_en>; + regulator-name = "vcc3v3_pcie"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc3v3_sys>; + }; + + vcc3v3_sys: vcc3v3-sys-regulator { + 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>; + }; + + vcc5v0_sys: vcc5v0-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v_dcin>; + }; + + vcc5v0_usb_host: vcc5v0-usb-host-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_usb_host_en>; + regulator-name = "vcc5v0_usb_host"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc5v0_usb_otg: vcc5v0-usb-otg-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PC6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_usb_otg_en>; + regulator-name = "vcc5v0_usb_otg"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc_cam: vcc-cam-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PC4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc_cam_en>; + regulator-name = "vcc_cam"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc3v3_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_mipi: vcc-mipi-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc_mipi_en>; + regulator-name = "vcc_mipi"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc3v3_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&combphy1 { + status = "okay"; +}; + +&combphy2 { + status = "okay"; +}; + +&cpu0 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu1 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu2 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu3 { + cpu-supply = <&vdd_cpu>; +}; + +&gmac1 { + assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>; + assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&gmac1_clkin>; + clock_in_out = "input"; + phy-handle = <&rgmii_phy1>; + phy-mode = "rgmii"; + phy-supply = <&vcc_3v3>; + pinctrl-names = "default"; + pinctrl-0 = <&gmac1m1_miim + &gmac1m1_tx_bus2 + &gmac1m1_rx_bus2 + &gmac1m1_rgmii_clk + &gmac1m1_clkinout + &gmac1m1_rgmii_bus>; + snps,reset-gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + /* Reset time is 20ms, 100ms for rtl8211f */ + snps,reset-delays-us = <0 20000 100000>; + tx_delay = <0x47>; + rx_delay = <0x27>; + status = "okay"; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&hdmi { + avdd-0v9-supply = <&vdda0v9_image>; + avdd-1v8-supply = <&vcca1v8_image>; + status = "okay"; +}; + +&hdmi_in { + hdmi_in_vp0: endpoint { + remote-endpoint = <&vp0_out_hdmi>; + }; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + +&hdmi_sound { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + + vdd_cpu: regulator@1c { + compatible = "tcs,tcs4525"; + reg = <0x1c>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1150000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + rk809: pmic@20 { + compatible = "rockchip,rk809"; + reg = <0x20>; + interrupt-parent = <&gpio0>; + interrupts = ; + assigned-clocks = <&cru I2S1_MCLKOUT_TX>; + assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>; + #clock-cells = <1>; + clock-names = "mclk"; + clocks = <&cru I2S1_MCLKOUT_TX>; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>, <&i2s1m0_mclk>; + rockchip,system-power-controller; + #sound-dai-cells = <0>; + vcc1-supply = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc5-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + wakeup-source; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vdd_gpu: DCDC_REG2 { + regulator-name = "vdd_gpu"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vdd_npu: DCDC_REG4 { + regulator-name = "vdd_npu"; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8: DCDC_REG5 { + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_image: LDO_REG1 { + regulator-name = "vdda0v9_image"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda_0v9: LDO_REG2 { + regulator-name = "vdda_0v9"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_pmu: LDO_REG3 { + regulator-name = "vdda0v9_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vccio_acodec: LDO_REG4 { + regulator-name = "vccio_acodec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-name = "vccio_sd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_pmu: LDO_REG6 { + regulator-name = "vcc3v3_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca_1v8: LDO_REG7 { + regulator-name = "vcca_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcca1v8_pmu: LDO_REG8 { + regulator-name = "vcca1v8_pmu"; + 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>; + }; + }; + + vcca1v8_image: LDO_REG9 { + regulator-name = "vcca1v8_image"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3: SWITCH_REG1 { + regulator-name = "vcc_3v3"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_sd: SWITCH_REG2 { + regulator-name = "vcc3v3_sd"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + + codec { + mic-in-differential; + }; + }; + + eeprom: eeprom@50 { + compatible = "belling,bl24c16a", "atmel,24c16"; + reg = <0x50>; + pagesize = <16>; + }; +}; + +&i2s0_8ch { + status = "okay"; +}; + +&i2s1_8ch { + pinctrl-names = "default"; + pinctrl-0 = <&i2s1m0_sclktx &i2s1m0_lrcktx &i2s1m0_sdi0 &i2s1m0_sdo0>; + rockchip,trcm-sync-tx-only; + status = "okay"; +}; + +&mdio1 { + rgmii_phy1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0x1>; + }; +}; + +&pcie2x1 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie_reset_h>; + reset-gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie>; + status = "okay"; +}; + +&pinctrl { + bluetooth { + bt_reg_on_h: bt-reg-on-h { + rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_wake_host_h: bt-wake-host-h { + rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_host_wake_h: bt-host-wake-h { + rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + cam { + vcc_cam_en: vcc_cam_en { + rockchip,pins = <0 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + display { + vcc_mipi_en: vcc_mipi_en { + rockchip,pins = <0 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + leds { + led_user_en: led_user_en { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pcie { + pcie_pwr_en: pcie-pwr-en { + rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + pcie_reset_h: pcie-reset-h { + rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + usb { + vcc5v0_usb_host_en: vcc5v0-usb-host-en { + rockchip,pins = <0 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + vcc5v0_usb_otg_en: vcc5v0-usb-otg-en { + rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wifi { + wifi_host_wake_h: wifi-host-wake-h { + rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + wifi_reg_on_h: wifi-reg-on-h { + rockchip,pins = <0 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcca1v8_pmu>; + vccio1-supply = <&vccio_acodec>; + vccio2-supply = <&vcc_1v8>; + vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcca1v8_pmu>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_3v3>; + vccio7-supply = <&vcc_3v3>; + status = "okay"; +}; + +&pwm15 { + pinctrl-names = "active"; + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca_1v8>; + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + max-frequency = <200000000>; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcc_1v8>; + status = "okay"; +}; + +&sdmmc0 { + bus-width = <4>; + cap-sd-highspeed; + cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; + disable-wp; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; + sd-uhs-sdr50; + vmmc-supply = <&vcc3v3_sd>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&sdmmc1 { + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_clk &sdmmc1_cmd>; + sd-uhs-sdr104; + vmmc-supply = <&vcc3v3_sys>; + vqmmc-supply = <&vcca1v8_pmu>; + status = "okay"; + + wifi@1 { + reg = <1>; + interrupt-parent = <&gpio0>; + interrupts = ; + interrupt-names = "host-wake"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_host_wake_h>; + }; +}; + +&sfc { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0x0>; + spi-max-frequency = <50000000>; + spi-rx-bus-width = <4>; + spi-tx-bus-width = <1>; + }; +}; + +&tsadc { + rockchip,hw-tshut-mode = <1>; + rockchip,hw-tshut-polarity = <0>; + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1m0_ctsn &uart1m0_rtsn &uart1m0_xfer>; + status = "okay"; + + bluetooth { + compatible = "brcm,bcm4345c5"; + clocks = <&rk809 1>; + clock-names = "lpo"; + device-wakeup-gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>; + host-wakeup-gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>; + shutdown-gpios = <&gpio0 RK_PC1 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&bt_host_wake_h &bt_reg_on_h &bt_wake_host_h>; + vbat-supply = <&vcc3v3_sys>; + vddio-supply = <&vcca1v8_pmu>; + }; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host0_xhci { + dr_mode = "host"; + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&usb_host1_xhci { + status = "okay"; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy0_host { + phy-supply = <&vcc5v0_usb_host>; + status = "okay"; +}; + +&usb2phy0_otg { + phy-supply = <&vcc5v0_usb_otg>; + status = "okay"; +}; + +&usb2phy1 { + status = "okay"; +}; + +&usb2phy1_host { + phy-supply = <&vcc5v0_usb_host>; + status = "okay"; +}; + +&usb2phy1_otg { + phy-supply = <&vcc5v0_usb_host>; + status = "okay"; +}; + +&vop { + assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; + assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi_in_vp0>; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3568-hinlink-h66k.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3568-hinlink-h66k.dts new file mode 100644 index 000000000000..f51e626f28a2 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3568-hinlink-h66k.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +// Copyright (c) 2022 AmadeusGhost +// Copyright (c) 2022 Flippy +// Copyright (c) 2023 amazingfate + +/dts-v1/; + +#include "rk3568-hinlink-h68k.dts" + +/ { + model = "HINLINK H66K"; + compatible = "hinlink,h66k", "rockchip,rk3568"; +}; + +&gmac0 { + status = "disabled"; +}; + +&gmac1 { + status = "disabled"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3568-hinlink-h68k.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3568-hinlink-h68k.dts new file mode 100644 index 000000000000..7eed082c4edf --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3568-hinlink-h68k.dts @@ -0,0 +1,889 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +// Copyright (c) 2022 AmadeusGhost +// Copyright (c) 2023 amazingfate + +/dts-v1/; + +#include +#include +#include +#include +#include +#include "rk3568.dtsi" + +/ { + model = "HINLINK H68K"; + compatible = "hinlink,h68k", "rockchip,rk3568"; + + aliases { + ethernet0 = &gmac0; + ethernet1 = &gmac1; + mmc0 = &sdhci; + mmc1 = &sdmmc0; + + led-boot = &led_work; + led-failsafe = &led_work; + led-running = &led_work; + led-upgrade = &led_work; + }; + + chosen: chosen { + stdout-path = "serial2:1500000n8"; + }; + + hdmi-con { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + + keys { + compatible = "gpio-keys"; + pinctrl-0 = <&reset_button_pin>; + pinctrl-names = "default"; + + reset { + label = "reset"; + gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <50>; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_net_en>, <&led_sata_en>, <&led_work_en>; + + led_net: net { + label = "blue:net"; + gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_HIGH>; + }; + + led_sata: sata { + label = "amber:sata"; + gpios = <&gpio3 RK_PA7 GPIO_ACTIVE_HIGH>; + }; + + led_work: work { + label = "green:work"; + gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_HIGH>; + }; + }; + + dc_12v: dc-12v-regulator { + compatible = "regulator-fixed"; + regulator-name = "dc_12v"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + }; + + vcc5v0_sys: vcc5v0-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&dc_12v>; + }; + + vcc3v3_sys: vcc3v3-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + enable-active-high; + gpio = <&gpio0 RK_PB6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc3v3_sys_en>; + + vin-supply = <&vcc5v0_sys>; + }; + + /* wifi power + for H68K-MAX & H69K-MAX + */ + vcc3v3_pcie2: vcc3v3-pcie2-regulator { + compatible = "regulator-fixed"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc3v3_pcie2"; + regulator-boot-on; + + gpio = <&gpio3 RK_PD5 GPIO_ACTIVE_LOW>; + + pinctrl-names = "default"; + pinctrl-0 = <&vcc3v3_pcie2_en>; + vin-supply = <&vcc3v3_sys>; + }; + + /* eth 2.5g power + for H66K H69K + */ + vcc3v3_pcie3: vcc3v3-pcie3-regulator { + compatible = "regulator-fixed"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc3v3_pcie3"; + regulator-boot-on; + + enable-active-high; + gpio = <&gpio0 RK_PC4 GPIO_ACTIVE_HIGH>; + + pinctrl-names = "default"; + pinctrl-0 = <&vcc3v3_pcie3_en>; + vin-supply = <&vcc3v3_sys>; + }; + + vcc5v0_usb_otg: vcc5v0-usb-otg-regulator { + compatible = "regulator-fixed"; + + regulator-name = "vcc5v0_usb_otg"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + + enable-active-high; + gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_usb_otg_en>; + + vin-supply = <&vcc5v0_sys>; + + }; + + vcc3v3_sd_pwren: vcc3v3-sd-pwren-regulator { + compatible = "regulator-fixed"; + + regulator-name = "vcc3v3_sd_pwren"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + + enable-active-high; + gpio = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; /* SD_PWREN */ + vin-supply = <&vcc3v3_sys>; + + pinctrl-names = "default"; + pinctrl-0 = <&vcc3v3_sd_en>; + }; + + rk809-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,name = "Analog RK809"; + simple-audio-card,mclk-fs = <256>; + + simple-audio-card,cpu { + sound-dai = <&i2s1_8ch>; + }; + simple-audio-card,codec { + sound-dai = <&rk809>; + }; + }; + + fan: pwm-fan { + compatible = "pwm-fan"; + cooling-levels = <0 127 163 255>; + #cooling-cells = <2>; + fan-supply = <&vcc5v0_sys>; + pwms = <&pwm0 0 50000 0>; + }; +}; + +&combphy0 { + status = "okay"; +}; + +&combphy1 { + status = "okay"; +}; + +&combphy2 { + status = "okay"; +}; + +&cpu0 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu1 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu2 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu3 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu_thermal { + trips { + cpu_cool: cpu_cool { + temperature = <45000>; + hysteresis = <2000>; + type = "active"; + }; + + cpu_warm: cpu_warm { + temperature = <55000>; + hysteresis = <2000>; + type = "active"; + }; + + cpu_hot: cpu_hot { + temperature = <65000>; + hysteresis = <2000>; + type = "active"; + }; + }; + + cooling-maps { + map1 { + trip = <&cpu_cool>; + cooling-device = <&fan THERMAL_NO_LIMIT 1>; + }; + + map2 { + trip = <&cpu_warm>; + cooling-device = <&fan 2 THERMAL_NO_LIMIT>; + }; + + map3 { + trip = <&cpu_hot>; + cooling-device = <&fan 3 THERMAL_NO_LIMIT>; + }; + }; +}; + +&gmac0 { + assigned-clocks = <&cru SCLK_GMAC0_RX_TX>, <&cru SCLK_GMAC0>; + assigned-clock-parents = <&cru SCLK_GMAC0_RGMII_SPEED>; + assigned-clock-rates = <0>, <125000000>; + clock_in_out = "input"; + phy-mode = "rgmii-id"; + pinctrl-names = "default"; + pinctrl-0 = <&gmac0_miim + &gmac0_tx_bus2 + &gmac0_rx_bus2 + &gmac0_rgmii_clk + &gmac0_rgmii_bus>; + snps,reset-gpio = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + snps,reset-delays-us = <0 50000 200000>; + tx_delay = <0x3c>; + rx_delay = <0x2f>; + phy-handle = <&rgmii_phy0>; + status = "okay"; +}; + +&gmac1 { + assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>; + assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>; + assigned-clock-rates = <0>, <125000000>; + clock_in_out = "input"; + phy-mode = "rgmii-id"; + pinctrl-names = "default"; + pinctrl-0 = <&gmac1m1_miim + &gmac1m1_tx_bus2 + &gmac1m1_rx_bus2 + &gmac1m1_rgmii_clk + &gmac1m1_rgmii_bus>; + snps,reset-gpio = <&gpio1 RK_PB0 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + snps,reset-delays-us = <0 50000 200000>; + tx_delay = <0x3c>; + rx_delay = <0x2f>; + phy-handle = <&rgmii_phy1>; + status = "okay"; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&hdmi { + avdd-0v9-supply = <&vdda0v9_image>; + avdd-1v8-supply = <&vcca1v8_image>; + status = "okay"; +}; + +&hdmi_in { + hdmi_in_vp0: endpoint { + remote-endpoint = <&vp0_out_hdmi>; + }; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + +&hdmi_sound { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + + vdd_cpu: regulator@1c { + compatible = "tcs,tcs4525"; + reg = <0x1c>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1150000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + rk809: pmic@20 { + compatible = "rockchip,rk809"; + reg = <0x20>; + + interrupt-parent = <&gpio0>; + interrupts = ; + + assigned-clocks = <&cru I2S1_MCLKOUT_TX>; + assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>; + #sound-dai-cells = <0>; + + #clock-cells = <1>; + clock-names = "mclk"; + clocks = <&cru I2S1_MCLKOUT_TX>; + + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int>, <&i2s1m0_mclk>; + + rockchip,system-power-controller; + wakeup-source; + + vcc1-supply = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc5-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + + pwrkey { + status = "okay"; + }; + + pinctrl_rk8xx: pinctrl_rk8xx { + gpio-controller; + #gpio-cells = <2>; + + rk817_slppin_null: rk817_slppin_null { + pins = "gpio_slp"; + function = "pin_fun0"; + }; + + rk817_slppin_slp: rk817_slppin_slp { + pins = "gpio_slp"; + function = "pin_fun1"; + }; + + rk817_slppin_pwrdn: rk817_slppin_pwrdn { + pins = "gpio_slp"; + function = "pin_fun2"; + }; + + rk817_slppin_rst: rk817_slppin_rst { + pins = "gpio_slp"; + function = "pin_fun3"; + }; + }; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-always-on; + regulator-boot-on; + regulator-init-microvolt = <900000>; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_gpu: DCDC_REG2 { + regulator-name = "vdd_gpu"; + regulator-always-on; + regulator-init-microvolt = <900000>; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + 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-initial-mode = <0x2>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vdd_npu: DCDC_REG4 { + regulator-name = "vdd_npu"; + regulator-init-microvolt = <900000>; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8: DCDC_REG5 { + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_image: LDO_REG1 { + regulator-name = "vdda0v9_image"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda_0v9: LDO_REG2 { + regulator-name = "vdda_0v9"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_pmu: LDO_REG3 { + regulator-name = "vdda0v9_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vccio_acodec: LDO_REG4 { + regulator-name = "vccio_acodec"; + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-name = "vccio_sd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_pmu: LDO_REG6 { + regulator-name = "vcc3v3_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca_1v8: LDO_REG7 { + regulator-name = "vcca_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcca1v8_pmu: LDO_REG8 { + regulator-name = "vcca1v8_pmu"; + 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>; + }; + }; + + vcca1v8_image: LDO_REG9 { + regulator-name = "vcca1v8_image"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3: SWITCH_REG1 { + regulator-name = "vcc_3v3"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_sd: SWITCH_REG2 { + regulator-name = "vcc3v3_sd"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + + rk809_codec: codec { + #sound-dai-cells = <0>; + compatible = "rockchip,rk809-codec", "rockchip,rk817-codec"; + clocks = <&cru I2S1_MCLKOUT_TX>; + clock-names = "mclk"; + assigned-clocks = <&cru I2S1_MCLKOUT_TX>; + assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>; + pinctrl-names = "default"; + pinctrl-0 = <&i2s1m0_mclk>; + hp-volume = <20>; + spk-volume = <3>; + mic-in-differential; + status = "okay"; + }; + }; +}; + +&i2c5 { + status = "okay"; +}; + +&i2s0_8ch { + status = "okay"; +}; + +&i2s1_8ch { + rockchip,trcm-sync-tx-only; + status = "okay"; +}; + +&mdio0 { + rgmii_phy0: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + phy-supply = <&vcc3v3_sys>; + reg = <0x0>; + }; +}; + +&mdio1 { + rgmii_phy1: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + phy-supply = <&vcc3v3_sys>; + reg = <0x0>; + }; +}; + +&pcie2x1 { + reset-gpios = <&gpio2 RK_PD6 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie2>; + status = "okay"; +}; + +&pcie30phy { + data-lanes = <1 2>; + status = "okay"; +}; + +&pcie3x1 { + num-lanes = <1>; + reset-gpios = <&gpio3 RK_PA4 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie3>; + status = "okay"; + + pcie@0,0 { + reg = <0x00100000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + + rtl8125_1: pcie-eth@10,0 { + compatible = "pci10ec,8125"; + reg = <0x000000 0 0 0 0>; + realtek,led-data = <0x0200>; + }; + }; +}; + +&pcie3x2 { + num-lanes = <1>; + rockchip,init-delay-ms = <100>; + reset-gpios = <&gpio2 RK_PD0 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie3>; + status = "okay"; + + pcie@0,0 { + reg = <0x00200000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + + rtl8125_2: pcie-eth@20,0 { + compatible = "pci10ec,8125"; + reg = <0x000000 0 0 0 0>; + realtek,led-data = <0x0200>; + }; + }; +}; + +&pinctrl { + button { + reset_button_pin: reset-button-pin { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + leds { + led_work_en: led-work-en { + rockchip,pins = <3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + led_sata_en: led-user-en { + rockchip,pins = <3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + led_net_en: led-net-en { + rockchip,pins = <3 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + vcc { + vcc3v3_sys_en: vcc3v3-sys-en { + rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int: pmic-int { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + usb { + vcc5v0_usb_otg_en: vcc5v0-usb-otg-en { + rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + sd { + vcc3v3_sd_en: vcc3v3-sd_en { + rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pcie { + vcc3v3_pcie2_en: vcc3v3_pcie2_en { + rockchip,pins = <3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + vcc3v3_pcie3_en: vcc3v3_pcie3_en { + rockchip,pins = <0 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcc3v3_pmu>; + vccio1-supply = <&vccio_acodec>; + vccio2-supply = <&vcc_1v8>; + vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcc_1v8>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_1v8>; + vccio7-supply = <&vcc_3v3>; + status = "okay"; +}; + +&pwm0 { + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca_1v8>; + status = "okay"; +}; + +&sata0 { + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + max-frequency = <200000000>; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>; + status = "okay"; +}; + +&sdmmc0 { + bus-width = <4>; + cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; + + cap-sd-highspeed; + max-frequency = <50000000>; + disable-wp; + + vmmc-supply = <&vcc3v3_sd_pwren>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&tsadc { + rockchip,hw-tshut-mode = <1>; + rockchip,hw-tshut-polarity = <0>; + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host0_xhci { + status = "disabled"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&usb_host1_xhci { + status = "okay"; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy0_host { + phy-supply = <&vcc5v0_usb_otg>; + status = "okay"; +}; + +&usb2phy0_otg { + phy-supply = <&vcc5v0_usb_otg>; + status = "okay"; +}; + +&usb2phy1 { + status = "okay"; +}; + +&usb2phy1_host { + phy-supply = <&vcc5v0_usb_otg>; + status = "okay"; +}; + +&usb2phy1_otg { + phy-supply = <&vcc5v0_usb_otg>; + status = "okay"; +}; + +&vop { + assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; + assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi_in_vp0>; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3568-odroid-m1.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3568-odroid-m1.dts new file mode 100644 index 000000000000..2cb03c95a0f4 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3568-odroid-m1.dts @@ -0,0 +1,775 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2022 Hardkernel Co., Ltd. + * + */ + +/dts-v1/; +#include +#include +#include +#include +#include "rk3568.dtsi" + +/ { + model = "Hardkernel ODROID-M1"; + compatible = "rockchip,rk3568-odroid-m1", "rockchip,rk3568"; + + aliases { + ethernet0 = &gmac0; + i2c0 = &i2c3; + i2c3 = &i2c0; + mmc0 = &sdhci; + mmc1 = &sdmmc0; + serial0 = &uart1; + serial1 = &uart0; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + dc_12v: dc-12v-regulator { + compatible = "regulator-fixed"; + regulator-name = "dc_12v"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + }; + + hdmi-con { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + + ir-receiver { + compatible = "gpio-ir-receiver"; + gpios = <&gpio0 RK_PC2 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&ir_receiver_pin>; + }; + + leds { + compatible = "gpio-leds"; + + led_power: led-0 { + gpios = <&gpio0 RK_PC6 GPIO_ACTIVE_HIGH>; + function = LED_FUNCTION_POWER; + color = ; + default-state = "keep"; + linux,default-trigger = "default-on"; + pinctrl-names = "default"; + pinctrl-0 = <&led_power_pin>; + }; + led_work: led-1 { + gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>; + function = LED_FUNCTION_HEARTBEAT; + color = ; + linux,default-trigger = "heartbeat"; + pinctrl-names = "default"; + pinctrl-0 = <&led_work_pin>; + }; + }; + + rk809-sound { + compatible = "simple-audio-card"; + pinctrl-names = "default"; + pinctrl-0 = <&hp_det_pin>; + simple-audio-card,name = "Analog RK817"; + simple-audio-card,format = "i2s"; + simple-audio-card,hp-det-gpio = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,widgets = + "Headphone", "Headphones", + "Speaker", "Speaker"; + simple-audio-card,routing = + "Headphones", "HPOL", + "Headphones", "HPOR", + "Speaker", "SPKO"; + + simple-audio-card,cpu { + sound-dai = <&i2s1_8ch>; + }; + + simple-audio-card,codec { + sound-dai = <&rk809>; + }; + }; + + vcc3v3_pcie: vcc3v3-pcie-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_pcie"; + enable-active-high; + gpio = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc3v3_pcie_en_pin>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + startup-delay-us = <5000>; + vin-supply = <&vcc3v3_sys>; + }; + + vcc3v3_sys: vcc3v3-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&dc_12v>; + }; + + vcc5v0_sys: vcc5v0-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&dc_12v>; + }; + + vcc5v0_usb_host: vcc5v0-usb-host-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_usb_host"; + enable-active-high; + gpio = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_usb_host_en_pin>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc5v0_usb_otg: vcc5v0-usb-otg-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_usb_otg"; + enable-active-high; + gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_usb_otg_en_pin>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + }; +}; + +&combphy0 { + /* Used for USB3 */ + phy-supply = <&vcc5v0_usb_host>; + status = "okay"; +}; + +&combphy1 { + /* Used for USB3 */ + phy-supply = <&vcc5v0_usb_otg>; + status = "okay"; +}; + +&combphy2 { + /* used for SATA */ + status = "okay"; +}; + +&cpu0 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu1 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu2 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu3 { + cpu-supply = <&vdd_cpu>; +}; + +&gmac0 { + assigned-clocks = <&cru SCLK_GMAC0_RX_TX>, <&cru SCLK_GMAC0>; + assigned-clock-parents = <&cru SCLK_GMAC0_RGMII_SPEED>; + assigned-clock-rates = <0>, <125000000>; + clock_in_out = "output"; + phy-handle = <&rgmii_phy0>; + phy-mode = "rgmii"; + phy-supply = <&vcc3v3_sys>; + pinctrl-names = "default"; + pinctrl-0 = <&gmac0_miim + &gmac0_tx_bus2 + &gmac0_rx_bus2 + &gmac0_rgmii_clk + &gmac0_rgmii_bus>; + status = "okay"; + + tx_delay = <0x4f>; + rx_delay = <0x2d>; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&hdmi { + avdd-0v9-supply = <&vdda0v9_image>; + avdd-1v8-supply = <&vcca1v8_image>; + status = "okay"; +}; + +&hdmi_in { + hdmi_in_vp0: endpoint { + remote-endpoint = <&vp0_out_hdmi>; + }; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + +&hdmi_sound { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + + vdd_cpu: regulator@1c { + compatible = "tcs,tcs4525"; + reg = <0x1c>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1150000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc3v3_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + rk809: pmic@20 { + compatible = "rockchip,rk809"; + reg = <0x20>; + interrupt-parent = <&gpio0>; + interrupts = ; + assigned-clocks = <&cru I2S1_MCLKOUT_TX>; + assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>; + #clock-cells = <1>; + clock-names = "mclk"; + clocks = <&cru I2S1_MCLKOUT_TX>; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>, <&i2s1m0_mclk>; + rockchip,system-power-controller; + #sound-dai-cells = <0>; + vcc1-supply = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc5-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + wakeup-source; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_gpu: DCDC_REG2 { + regulator-name = "vdd_gpu"; + regulator-always-on; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + 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-initial-mode = <0x2>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vdd_npu: DCDC_REG4 { + regulator-name = "vdd_npu"; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8: DCDC_REG5 { + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_image: LDO_REG1 { + regulator-name = "vdda0v9_image"; + regulator-always-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda_0v9: LDO_REG2 { + regulator-name = "vdda_0v9"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_pmu: LDO_REG3 { + regulator-name = "vdda0v9_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vccio_acodec: LDO_REG4 { + regulator-name = "vccio_acodec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-name = "vccio_sd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_pmu: LDO_REG6 { + regulator-name = "vcc3v3_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca_1v8: LDO_REG7 { + regulator-name = "vcca_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcca1v8_pmu: LDO_REG8 { + regulator-name = "vcca1v8_pmu"; + 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>; + }; + }; + + vcca1v8_image: LDO_REG9 { + regulator-name = "vcca1v8_image"; + regulator-always-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3: SWITCH_REG1 { + regulator-name = "vcc_3v3"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_sd: SWITCH_REG2 { + regulator-name = "vcc3v3_sd"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + }; +}; + +&i2s0_8ch { + status = "okay"; +}; + +&i2s1_8ch { + rockchip,trcm-sync-tx-only; + status = "okay"; +}; + +&mdio0 { + rgmii_phy0: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0x0>; + reset-assert-us = <20000>; + reset-deassert-us = <100000>; + reset-gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + }; +}; + +&pcie30phy { + status = "okay"; +}; + +&pcie3x2 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie_reset_pin>; + reset-gpios = <&gpio2 RK_PD6 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie>; + status = "okay"; +}; + +&pinctrl { + fspi { + fspi_dual_io_pins: fspi-dual-io-pins { + rockchip,pins = + /* fspi_clk */ + <1 RK_PD0 1 &pcfg_pull_none>, + /* fspi_cs0n */ + <1 RK_PD3 1 &pcfg_pull_none>, + /* fspi_d0 */ + <1 RK_PD1 1 &pcfg_pull_none>, + /* fspi_d1 */ + <1 RK_PD2 1 &pcfg_pull_none>; + }; + }; + + ir-receiver { + ir_receiver_pin: ir-receiver-pin { + /* external pullup to VCC3V3_SYS */ + rockchip,pins = <0 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + leds { + led_power_pin: led-power-pin { + rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + led_work_pin: led-work-pin { + rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pcie { + pcie_reset_pin: pcie-reset-pin { + rockchip,pins = <2 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + vcc3v3_pcie_en_pin: vcc3v3-pcie-en-pin { + rockchip,pins = <4 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + rk809 { + hp_det_pin: hp-det-pin { + rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + usb { + vcc5v0_usb_host_en_pin: vcc5v0-usb-host-en-pin { + rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + vcc5v0_usb_otg_en_pin: vcc5v0-usb-dr-en-pin { + rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcc3v3_pmu>; + vccio1-supply = <&vccio_acodec>; + vccio2-supply = <&vcc_1v8>; + vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcc_1v8>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_3v3>; + vccio7-supply = <&vcc_3v3>; + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca_1v8>; + status = "okay"; +}; + +&sata2 { + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + max-frequency = <200000000>; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe &emmc_rstnout>; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcc_1v8>; + status = "okay"; +}; + +&sdmmc0 { + bus-width = <4>; + cap-sd-highspeed; + cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; + disable-wp; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; + sd-uhs-sdr50; + vmmc-supply = <&vcc3v3_sd>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&sfc { + /* Dual I/O mode as the D2 pin conflicts with the eMMC */ + pinctrl-0 = <&fspi_dual_io_pins>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <100000000>; + spi-rx-bus-width = <2>; + spi-tx-bus-width = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "SPL"; + reg = <0x0 0xe0000>; + }; + partition@e0000 { + label = "U-Boot Env"; + reg = <0xe0000 0x20000>; + }; + partition@100000 { + label = "U-Boot"; + reg = <0x100000 0x200000>; + }; + partition@300000 { + label = "splash"; + reg = <0x300000 0x100000>; + }; + partition@400000 { + label = "Filesystem"; + reg = <0x400000 0xc00000>; + }; + }; + }; +}; + +&tsadc { + rockchip,hw-tshut-mode = <1>; + rockchip,hw-tshut-polarity = <0>; + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host0_xhci { + dr_mode = "host"; + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&usb_host1_xhci { + status = "okay"; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy0_host { + phy-supply = <&vcc5v0_usb_host>; + status = "okay"; +}; + +&usb2phy0_otg { + phy-supply = <&vcc5v0_usb_otg>; + status = "okay"; +}; + +&usb2phy1 { + status = "okay"; +}; + +&usb2phy1_host { + phy-supply = <&vcc5v0_usb_host>; + status = "okay"; +}; + +&usb2phy1_otg { + phy-supply = <&vcc5v0_usb_host>; + status = "okay"; +}; + +&vop { + assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; + assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi_in_vp0>; + }; +}; + +&i2c3 { + status = "disabled"; + pinctrl-names = "default"; + pinctrl-0 = <&i2c3m1_xfer>; +}; + +&pwm1 { + status = "disabled"; + pinctrl-0 = <&pwm1m1_pins>; +}; + +&pwm2 { + status = "disabled"; + pinctrl-0 = <&pwm2m1_pins>; +}; + +&spi0 { + status = "disabled"; + + pinctrl-0 = <&spi0m1_pins>; + pinctrl-1 = <&spi0m1_pins_hs>; + num_chipselect = <1>; + + cs-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_LOW>; +}; + +&uart1 { + status = "disabled"; + dma-names = "tx", "rx"; + /* uart1 uart1-with-ctsrts */ + pinctrl-0 = <&uart1m1_xfer>; + pinctrl-1 = <&uart1m1_xfer &uart1m1_ctsn &uart1m1_rtsn>; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/general-add-miniDP-dt-doc.patch b/patch/kernel/archive/rockchip64-6.10/general-add-miniDP-dt-doc.patch new file mode 100644 index 000000000000..c74bfad3e38f --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/general-add-miniDP-dt-doc.patch @@ -0,0 +1,133 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tony +Date: Wed, 3 Mar 2021 07:59:25 +0100 +Subject: [ARCHEOLOGY] RK3399 Typec DP (#2676) + +> X-Git-Archeology: > recovered message: > * RK3399 NanoPC-T4 Add Type-C alt mode DP +> X-Git-Archeology: > recovered message: > * rk3399 rockpi 4C add mini-DP (WIP) +> X-Git-Archeology: > recovered message: > * [ rockchip64 ] revert rockPi 4C DP patch +> X-Git-Archeology: > recovered message: > Add an extension to disable it, but leave for future work. +> X-Git-Archeology: - Revision 4971535c774a1f49a811baebc083ea028ced0300: https://github.com/armbian/build/commit/4971535c774a1f49a811baebc083ea028ced0300 +> X-Git-Archeology: Date: Wed, 03 Mar 2021 07:59:25 +0100 +> X-Git-Archeology: From: Tony +> X-Git-Archeology: Subject: RK3399 Typec DP (#2676) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + Documentation/devicetree/bindings/extcon/extcon-usbc-virtual-pd.yaml | 66 ++++++++++ + 1 file changed, 66 insertions(+) + +diff --git a/Documentation/devicetree/bindings/extcon/extcon-usbc-virtual-pd.yaml b/Documentation/devicetree/bindings/extcon/extcon-usbc-virtual-pd.yaml +new file mode 100644 +index 000000000000..8110fbe2ddc2 +--- /dev/null ++++ b/Documentation/devicetree/bindings/extcon/extcon-usbc-virtual-pd.yaml +@@ -0,0 +1,66 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/extcon/extcon-usbc-virtual-pd.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Type-C Virtual PD extcon ++ ++maintainers: ++ - Jagan Teki ++ ++description: | ++ USB Type-C protocol supports various modes of operations includes PD, ++ USB3, and Altmode. If the platform design supports a Type-C connector ++ then configuring these modes can be done via enumeration. ++ ++ However, there are some platforms that design these modes as separate ++ protocol connectors like design Display Port from on-chip USB3 controller. ++ So we can access Type-C Altmode Display Port via onboard Display Port ++ connector instead of a Type-C connector. These kinds of platforms require ++ an explicit extcon driver in order to handle Power Delivery and ++ Port Detection. ++ ++properties: ++ compatible: ++ const: linux,extcon-usbc-virtual-pd ++ ++ det-gpios: ++ description: Detect GPIO pin. Pin can be Display Port Detect or USB ID. ++ maxItems: 1 ++ ++ vpd-polarity: ++ description: USB Type-C Polarity. false for Normal and true for Flip. ++ type: boolean ++ ++ vpd-super-speed: ++ description: USB Super Speed. false for USB2 and true for USB3. ++ type: boolean ++ ++ vpd-data-role: ++ description: USB Data roles for Virtual Type-C. ++ $ref: /schemas/types.yaml#definitions/string ++ ++ enum: ++ - host ++ - device ++ - display-port ++ ++required: ++ - compatible ++ - det-gpios ++ - vpd-data-role ++ ++additionalProperties: false ++ ++examples: ++ - | ++ #include ++ #include ++ ++ virtual_pd: virtual-pd { ++ compatible = "linux,extcon-usbc-virtual-pd"; ++ det-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_LOW>; ++ vpd-data-role = "display-port"; ++ vpd-super-speed; ++ }; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/general-add-miniDP-virtual-extcon.patch b/patch/kernel/archive/rockchip64-6.10/general-add-miniDP-virtual-extcon.patch new file mode 100644 index 000000000000..00551e8b3159 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/general-add-miniDP-virtual-extcon.patch @@ -0,0 +1,382 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tony +Date: Wed, 3 Mar 2021 07:59:25 +0100 +Subject: [ARCHEOLOGY] RK3399 Typec DP (#2676) + +> X-Git-Archeology: > recovered message: > * RK3399 NanoPC-T4 Add Type-C alt mode DP +> X-Git-Archeology: > recovered message: > * rk3399 rockpi 4C add mini-DP (WIP) +> X-Git-Archeology: > recovered message: > * [ rockchip64 ] revert rockPi 4C DP patch +> X-Git-Archeology: > recovered message: > Add an extension to disable it, but leave for future work. +> X-Git-Archeology: - Revision 4971535c774a1f49a811baebc083ea028ced0300: https://github.com/armbian/build/commit/4971535c774a1f49a811baebc083ea028ced0300 +> X-Git-Archeology: Date: Wed, 03 Mar 2021 07:59:25 +0100 +> X-Git-Archeology: From: Tony +> X-Git-Archeology: Subject: RK3399 Typec DP (#2676) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + drivers/extcon/Kconfig | 10 + + drivers/extcon/Makefile | 1 + + drivers/extcon/extcon-usbc-virtual-pd.c | 285 ++++++++++ + 3 files changed, 296 insertions(+) + +diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig +index 8de9023c2a38..21f0f856cacb 100644 +--- a/drivers/extcon/Kconfig ++++ b/drivers/extcon/Kconfig +@@ -191,4 +191,14 @@ config EXTCON_USBC_TUSB320 + Say Y here to enable support for USB Type C cable detection extcon + support using a TUSB320. + ++config EXTCON_USBC_VIRTUAL_PD ++ tristate "Virtual Type-C PD EXTCON support" ++ depends on GPIOLIB || COMPILE_TEST ++ help ++ Say Y here to enable Virtual Type-C PD extcon driver support, if ++ hardware platform designed Type-C modes separately. ++ ++ Example, of designing Display Port separately from Type-C Altmode ++ instead of accessing Altmode Display Port in Type-C connector. ++ + endif +diff --git a/drivers/extcon/Makefile b/drivers/extcon/Makefile +index 1b390d934ca9..57c1e65bfcfd 100644 +--- a/drivers/extcon/Makefile ++++ b/drivers/extcon/Makefile +@@ -25,3 +25,4 @@ obj-$(CONFIG_EXTCON_RTK_TYPE_C) += extcon-rtk-type-c.o + obj-$(CONFIG_EXTCON_USBC_CROS_EC) += extcon-usbc-cros-ec.o + obj-$(CONFIG_EXTCON_USBC_TUSB320) += extcon-usbc-tusb320.o + obj-$(CONFIG_EXTCON_RTK_TYPE_C) += extcon-rtk-type-c.o ++obj-$(CONFIG_EXTCON_USBC_VIRTUAL_PD) += extcon-usbc-virtual-pd.o +diff --git a/drivers/extcon/extcon-usbc-virtual-pd.c b/drivers/extcon/extcon-usbc-virtual-pd.c +new file mode 100644 +index 000000000000..e0713670e33d +--- /dev/null ++++ b/drivers/extcon/extcon-usbc-virtual-pd.c +@@ -0,0 +1,285 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Type-C Virtual PD Extcon driver ++ * ++ * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd ++ * Copyright (c) 2019 Radxa Limited ++ * Copyright (c) 2019 Amarula Solutions(India) ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static const unsigned int vpd_cable[] = { ++ EXTCON_USB, ++ EXTCON_USB_HOST, ++ EXTCON_DISP_DP, ++ EXTCON_NONE, ++}; ++ ++enum vpd_data_role { ++ DR_NONE, ++ DR_HOST, ++ DR_DEVICE, ++ DR_DISPLAY_PORT, ++}; ++ ++enum vpd_polarity { ++ POLARITY_NORMAL, ++ POLARITY_FLIP, ++}; ++ ++enum vpd_usb_ss { ++ USB_SS_USB2, ++ USB_SS_USB3, ++}; ++ ++struct vpd_extcon { ++ struct device *dev; ++ struct extcon_dev *extcon; ++ struct gpio_desc *det_gpio; ++ ++ u8 polarity; ++ u8 usb_ss; ++ enum vpd_data_role data_role; ++ ++ int irq; ++ bool enable_irq; ++ struct work_struct work; ++ struct delayed_work irq_work; ++}; ++ ++static void vpd_extcon_irq_work(struct work_struct *work) ++{ ++ struct vpd_extcon *vpd = container_of(work, struct vpd_extcon, irq_work.work); ++ bool host_connected = false, device_connected = false, dp_connected = false; ++ union extcon_property_value property; ++ int det; ++ ++ det = vpd->det_gpio ? gpiod_get_raw_value(vpd->det_gpio) : 0; ++ if (det) { ++ device_connected = (vpd->data_role == DR_DEVICE) ? true : false; ++ host_connected = (vpd->data_role == DR_HOST) ? true : false; ++ dp_connected = (vpd->data_role == DR_DISPLAY_PORT) ? true : false; ++ } ++ ++ extcon_set_state(vpd->extcon, EXTCON_USB, host_connected); ++ extcon_set_state(vpd->extcon, EXTCON_USB_HOST, device_connected); ++ extcon_set_state(vpd->extcon, EXTCON_DISP_DP, dp_connected); ++ ++ property.intval = vpd->polarity; ++ extcon_set_property(vpd->extcon, EXTCON_USB, ++ EXTCON_PROP_USB_TYPEC_POLARITY, property); ++ extcon_set_property(vpd->extcon, EXTCON_USB_HOST, ++ EXTCON_PROP_USB_TYPEC_POLARITY, property); ++ extcon_set_property(vpd->extcon, EXTCON_DISP_DP, ++ EXTCON_PROP_USB_TYPEC_POLARITY, property); ++ ++ property.intval = vpd->usb_ss; ++ extcon_set_property(vpd->extcon, EXTCON_USB, ++ EXTCON_PROP_USB_SS, property); ++ extcon_set_property(vpd->extcon, EXTCON_USB_HOST, ++ EXTCON_PROP_USB_SS, property); ++ extcon_set_property(vpd->extcon, EXTCON_DISP_DP, ++ EXTCON_PROP_USB_SS, property); ++ ++ extcon_sync(vpd->extcon, EXTCON_USB); ++ extcon_sync(vpd->extcon, EXTCON_USB_HOST); ++ extcon_sync(vpd->extcon, EXTCON_DISP_DP); ++} ++ ++static irqreturn_t vpd_extcon_irq_handler(int irq, void *dev_id) ++{ ++ struct vpd_extcon *vpd = dev_id; ++ ++ schedule_delayed_work(&vpd->irq_work, msecs_to_jiffies(10)); ++ ++ return IRQ_HANDLED; ++} ++ ++static enum vpd_data_role vpd_extcon_data_role(struct vpd_extcon *vpd) ++{ ++ const char *const data_roles[] = { ++ [DR_NONE] = "NONE", ++ [DR_HOST] = "host", ++ [DR_DEVICE] = "device", ++ [DR_DISPLAY_PORT] = "display-port", ++ }; ++ struct device *dev = vpd->dev; ++ int ret; ++ const char *dr; ++ ++ ret = device_property_read_string(dev, "vpd-data-role", &dr); ++ if (ret < 0) ++ return DR_NONE; ++ ++ ret = match_string(data_roles, ARRAY_SIZE(data_roles), dr); ++ ++ return (ret < 0) ? DR_NONE : ret; ++} ++ ++static int vpd_extcon_parse_dts(struct vpd_extcon *vpd) ++{ ++ struct device *dev = vpd->dev; ++ bool val = false; ++ int ret; ++ ++ val = device_property_read_bool(dev, "vpd-polarity"); ++ if (val) ++ vpd->polarity = POLARITY_FLIP; ++ else ++ vpd->polarity = POLARITY_NORMAL; ++ ++ val = device_property_read_bool(dev, "vpd-super-speed"); ++ if (val) ++ vpd->usb_ss = USB_SS_USB3; ++ else ++ vpd->usb_ss = USB_SS_USB2; ++ ++ vpd->data_role = vpd_extcon_data_role(vpd); ++ ++ vpd->det_gpio = devm_gpiod_get_optional(dev, "det", GPIOD_OUT_LOW); ++ if (IS_ERR(vpd->det_gpio)) { ++ ret = PTR_ERR(vpd->det_gpio); ++ dev_warn(dev, "failed to get det gpio: %d\n", ret); ++ return ret; ++ } ++ ++ vpd->irq = gpiod_to_irq(vpd->det_gpio); ++ if (vpd->irq < 0) { ++ dev_err(dev, "failed to get irq for gpio: %d\n", vpd->irq); ++ return vpd->irq; ++ } ++ ++ ret = devm_request_threaded_irq(dev, vpd->irq, NULL, ++ vpd_extcon_irq_handler, ++ IRQF_TRIGGER_FALLING | ++ IRQF_TRIGGER_RISING | IRQF_ONESHOT, ++ NULL, vpd); ++ if (ret) ++ dev_err(dev, "failed to request gpio irq\n"); ++ ++ return ret; ++} ++ ++static int vpd_extcon_probe(struct platform_device *pdev) ++{ ++ struct vpd_extcon *vpd; ++ struct device *dev = &pdev->dev; ++ int ret; ++ ++ vpd = devm_kzalloc(dev, sizeof(*vpd), GFP_KERNEL); ++ if (!vpd) ++ return -ENOMEM; ++ ++ vpd->dev = dev; ++ ret = vpd_extcon_parse_dts(vpd); ++ if (ret) ++ return ret; ++ ++ INIT_DELAYED_WORK(&vpd->irq_work, vpd_extcon_irq_work); ++ ++ vpd->extcon = devm_extcon_dev_allocate(dev, vpd_cable); ++ if (IS_ERR(vpd->extcon)) { ++ dev_err(dev, "allocat extcon failed\n"); ++ return PTR_ERR(vpd->extcon); ++ } ++ ++ ret = devm_extcon_dev_register(dev, vpd->extcon); ++ if (ret) { ++ dev_err(dev, "register extcon failed: %d\n", ret); ++ return ret; ++ } ++ ++ extcon_set_property_capability(vpd->extcon, EXTCON_USB, ++ EXTCON_PROP_USB_VBUS); ++ extcon_set_property_capability(vpd->extcon, EXTCON_USB_HOST, ++ EXTCON_PROP_USB_VBUS); ++ ++ extcon_set_property_capability(vpd->extcon, EXTCON_USB, ++ EXTCON_PROP_USB_TYPEC_POLARITY); ++ extcon_set_property_capability(vpd->extcon, EXTCON_USB_HOST, ++ EXTCON_PROP_USB_TYPEC_POLARITY); ++ extcon_set_property_capability(vpd->extcon, EXTCON_USB, ++ EXTCON_PROP_USB_SS); ++ extcon_set_property_capability(vpd->extcon, EXTCON_USB_HOST, ++ EXTCON_PROP_USB_SS); ++ ++ extcon_set_property_capability(vpd->extcon, EXTCON_DISP_DP, ++ EXTCON_PROP_USB_SS); ++ extcon_set_property_capability(vpd->extcon, EXTCON_DISP_DP, ++ EXTCON_PROP_USB_TYPEC_POLARITY); ++ ++ platform_set_drvdata(pdev, vpd); ++ ++ vpd_extcon_irq_work(&vpd->irq_work.work); ++ ++ return 0; ++} ++ ++static int vpd_extcon_remove(struct platform_device *pdev) ++{ ++ struct vpd_extcon *vpd = platform_get_drvdata(pdev); ++ ++ cancel_delayed_work_sync(&vpd->irq_work); ++ ++ return 0; ++} ++ ++#ifdef CONFIG_PM_SLEEP ++static int vpd_extcon_suspend(struct device *dev) ++{ ++ struct vpd_extcon *vpd = dev_get_drvdata(dev); ++ ++ if (!vpd->enable_irq) { ++ disable_irq_nosync(vpd->irq); ++ vpd->enable_irq = true; ++ } ++ ++ return 0; ++} ++ ++static int vpd_extcon_resume(struct device *dev) ++{ ++ struct vpd_extcon *vpd = dev_get_drvdata(dev); ++ ++ if (vpd->enable_irq) { ++ enable_irq(vpd->irq); ++ vpd->enable_irq = false; ++ } ++ ++ return 0; ++} ++#endif ++ ++static SIMPLE_DEV_PM_OPS(vpd_extcon_pm_ops, ++ vpd_extcon_suspend, vpd_extcon_resume); ++ ++static const struct of_device_id vpd_extcon_dt_match[] = { ++ { .compatible = "linux,extcon-usbc-virtual-pd", }, ++ { /* sentinel */ } ++}; ++ ++static struct platform_driver vpd_extcon_driver = { ++ .probe = vpd_extcon_probe, ++ .remove = vpd_extcon_remove, ++ .driver = { ++ .name = "extcon-usbc-virtual-pd", ++ .pm = &vpd_extcon_pm_ops, ++ .of_match_table = vpd_extcon_dt_match, ++ }, ++}; ++ ++module_platform_driver(vpd_extcon_driver); ++ ++MODULE_AUTHOR("Jagan Teki "); ++MODULE_DESCRIPTION("Type-C Virtual PD extcon driver"); ++MODULE_LICENSE("GPL v2"); +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/general-add-overlay-compilation-support.patch b/patch/kernel/archive/rockchip64-6.10/general-add-overlay-compilation-support.patch new file mode 100644 index 000000000000..3a0c05e60cab --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/general-add-overlay-compilation-support.patch @@ -0,0 +1,64 @@ +From a8f9689004d59f0a454ce8cb06bf1556971c1bad Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Sat, 20 Jul 2024 13:58:49 +0200 +Subject: [PATCH] compile .scr and install overlays in right path + +--- + scripts/Makefile.dtbinst | 13 ++++++++++++- + scripts/Makefile.lib | 8 +++++++- + 2 files changed, 19 insertions(+), 2 deletions(-) + +diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst +index 9d920419a62c..9144a1b7c909 100644 +--- a/scripts/Makefile.dtbinst ++++ b/scripts/Makefile.dtbinst +@@ -33,7 +33,18 @@ endef + + $(foreach d, $(sort $(dir $(dtbs))), $(eval $(call gen_install_rules,$(d)))) + +-dtbs := $(notdir $(dtbs)) ++# Very convoluted way to flatten all the device tree ++# directories, but keep the "/overlay/" directory ++ ++# topmost directory (ie: from rockchip/overlay/rk322x-emmc.dtbo extracts rockchip) ++topmost_dir = $(firstword $(subst /, ,$(dtbs))) ++# collect dtbs entries which starts with "$topmost_dir/overlay/", then remove "$topmost_dir" ++dtbs_overlays = $(subst $(topmost_dir)/,,$(filter $(topmost_dir)/overlay/%, $(dtbs))) ++# collect the non-overlay dtbs ++dtbs_regular = $(filter-out $(topmost_dir)/overlay/%, $(dtbs)) ++# compose the dtbs variable flattening all the non-overlays entries ++# and appending the overlays entries ++dtbs := $(notdir $(dtbs_regular)) $(dtbs_overlays) + + endif # CONFIG_ARCH_WANT_FLAT_DTB_INSTALL + +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib +index 9f06f6aaf7fc..67a7b73b6688 100644 +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -394,15 +394,21 @@ quiet_cmd_wrap_S_dtb = WRAP $@ + echo '.balign STRUCT_ALIGNMENT'; \ + } > $@ + ++quiet_cmd_scr = MKIMAGE $@ ++cmd_scr = mkimage -C none -A $(ARCH) -T script -d $< $@ ++ + $(obj)/%.dtb.S: $(obj)/%.dtb FORCE + $(call if_changed,wrap_S_dtb) + + $(obj)/%.dtbo.S: $(obj)/%.dtbo FORCE + $(call if_changed,wrap_S_dtb) + ++$(obj)/%.scr: $(src)/%.scr-cmd FORCE ++ $(call if_changed,scr) ++ + quiet_cmd_dtc = DTC $@ + cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ +- $(DTC) -o $@ -b 0 \ ++ $(DTC) -@ -o $@ -b 0 \ + $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \ + -d $(depfile).dtc.tmp $(dtc-tmp) ; \ + cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) +-- +2.34.1 + diff --git a/patch/kernel/archive/rockchip64-6.10/general-add-overlay-configfs.patch b/patch/kernel/archive/rockchip64-6.10/general-add-overlay-configfs.patch new file mode 100644 index 000000000000..895edaddbfbf --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/general-add-overlay-configfs.patch @@ -0,0 +1,419 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Pantelis Antoniou +Date: Wed, 3 Dec 2014 13:23:28 +0200 +Subject: OF: DT-Overlay configfs interface + +This is a port of Pantelis Antoniou's v3 port that makes use of the +new upstreamed configfs support for binary attributes. + +Original commit message: + +Add a runtime interface to using configfs for generic device tree overlay +usage. With it its possible to use device tree overlays without having +to use a per-platform overlay manager. + +Please see Documentation/devicetree/configfs-overlays.txt for more info. + +Changes since v2: +- Removed ifdef CONFIG_OF_OVERLAY (since for now it's required) +- Created a documentation entry +- Slight rewording in Kconfig + +Changes since v1: +- of_resolve() -> of_resolve_phandles(). + +Originally-signed-off-by: Pantelis Antoniou +Signed-off-by: Phil Elwell + +DT configfs: Fix build errors on other platforms + +Signed-off-by: Phil Elwell + +DT configfs: fix build error + +There is an error when compiling rpi-4.6.y branch: + CC drivers/of/configfs.o +drivers/of/configfs.c:291:21: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] + .default_groups = of_cfs_def_groups, + ^ +drivers/of/configfs.c:291:21: note: (near initialization for 'of_cfs_subsys.su_group.default_groups.next') + +The .default_groups is linked list since commit +1ae1602de028acaa42a0f6ff18d19756f8e825c6. +This commit uses configfs_add_default_group to fix this problem. + +Signed-off-by: Slawomir Stepien + +configfs: New of_overlay API + +of: configfs: Use of_overlay_fdt_apply API call + +The published API to the dynamic overlay application mechanism now +takes a Flattened Device Tree blob as input so that it can manage the +lifetime of the unflattened tree. Conveniently, the new API call - +of_overlay_fdt_apply - is virtually a drop-in replacement for +create_overlay, which can now be deleted. + +Signed-off-by: Phil Elwell +--- + Documentation/devicetree/configfs-overlays.txt | 31 ++ + drivers/of/Kconfig | 11 + + drivers/of/Makefile | 1 + + drivers/of/configfs.c | 277 ++++++++++ + 4 files changed, 320 insertions(+) + +diff --git a/Documentation/devicetree/configfs-overlays.txt b/Documentation/devicetree/configfs-overlays.txt +new file mode 100644 +index 000000000000..5fa43e064307 +--- /dev/null ++++ b/Documentation/devicetree/configfs-overlays.txt +@@ -0,0 +1,31 @@ ++Howto use the configfs overlay interface. ++ ++A device-tree configfs entry is created in /config/device-tree/overlays ++and and it is manipulated using standard file system I/O. ++Note that this is a debug level interface, for use by developers and ++not necessarily something accessed by normal users due to the ++security implications of having direct access to the kernel's device tree. ++ ++* To create an overlay you mkdir the directory: ++ ++ # mkdir /config/device-tree/overlays/foo ++ ++* Either you echo the overlay firmware file to the path property file. ++ ++ # echo foo.dtbo >/config/device-tree/overlays/foo/path ++ ++* Or you cat the contents of the overlay to the dtbo file ++ ++ # cat foo.dtbo >/config/device-tree/overlays/foo/dtbo ++ ++The overlay file will be applied, and devices will be created/destroyed ++as required. ++ ++To remove it simply rmdir the directory. ++ ++ # rmdir /config/device-tree/overlays/foo ++ ++The rationalle of the dual interface (firmware & direct copy) is that each is ++better suited to different use patterns. The firmware interface is what's ++intended to be used by hardware managers in the kernel, while the copy interface ++make sense for developers (since it avoids problems with namespaces). +diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig +index da9826accb1b..69e7c420b8f4 100644 +--- a/drivers/of/Kconfig ++++ b/drivers/of/Kconfig +@@ -102,4 +102,15 @@ config OF_OVERLAY + config OF_NUMA + bool + ++config OF_DMA_DEFAULT_COHERENT ++ # arches should select this if DMA is coherent by default for OF devices ++ bool ++ ++config OF_CONFIGFS ++ bool "Device Tree Overlay ConfigFS interface" ++ select CONFIGFS_FS ++ select OF_OVERLAY ++ help ++ Enable a simple user-space driven DT overlay interface. ++ + endif # OF +diff --git a/drivers/of/Makefile b/drivers/of/Makefile +index eff624854575..61bd05f08ca1 100644 +--- a/drivers/of/Makefile ++++ b/drivers/of/Makefile +@@ -1,6 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + obj-y = base.o cpu.o device.o module.o platform.o property.o + obj-$(CONFIG_OF_KOBJ) += kobj.o ++obj-$(CONFIG_OF_CONFIGFS) += configfs.o + obj-$(CONFIG_OF_DYNAMIC) += dynamic.o + obj-$(CONFIG_OF_FLATTREE) += fdt.o + obj-$(CONFIG_OF_EARLY_FLATTREE) += fdt_address.o +diff --git a/drivers/of/configfs.c b/drivers/of/configfs.c +new file mode 100644 +index 000000000000..1c30f35c3ca1 +--- /dev/null ++++ b/drivers/of/configfs.c +@@ -0,0 +1,277 @@ ++/* ++ * Configfs entries for device-tree ++ * ++ * Copyright (C) 2013 - Pantelis Antoniou ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "of_private.h" ++ ++struct cfs_overlay_item { ++ struct config_item item; ++ ++ char path[PATH_MAX]; ++ ++ const struct firmware *fw; ++ struct device_node *overlay; ++ int ov_id; ++ ++ void *dtbo; ++ int dtbo_size; ++}; ++ ++static inline struct cfs_overlay_item *to_cfs_overlay_item( ++ struct config_item *item) ++{ ++ return item ? container_of(item, struct cfs_overlay_item, item) : NULL; ++} ++ ++static ssize_t cfs_overlay_item_path_show(struct config_item *item, ++ char *page) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ return sprintf(page, "%s\n", overlay->path); ++} ++ ++static ssize_t cfs_overlay_item_path_store(struct config_item *item, ++ const char *page, size_t count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ const char *p = page; ++ char *s; ++ int err; ++ ++ /* if it's set do not allow changes */ ++ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) ++ return -EPERM; ++ ++ /* copy to path buffer (and make sure it's always zero terminated */ ++ count = snprintf(overlay->path, sizeof(overlay->path) - 1, "%s", p); ++ overlay->path[sizeof(overlay->path) - 1] = '\0'; ++ ++ /* strip trailing newlines */ ++ s = overlay->path + strlen(overlay->path); ++ while (s > overlay->path && *--s == '\n') ++ *s = '\0'; ++ ++ pr_debug("%s: path is '%s'\n", __func__, overlay->path); ++ ++ err = request_firmware(&overlay->fw, overlay->path, NULL); ++ if (err != 0) ++ goto out_err; ++ ++ err = of_overlay_fdt_apply((void *)overlay->fw->data, ++ (u32)overlay->fw->size, &overlay->ov_id, NULL); ++ if (err != 0) ++ goto out_err; ++ ++ return count; ++ ++out_err: ++ ++ release_firmware(overlay->fw); ++ overlay->fw = NULL; ++ ++ overlay->path[0] = '\0'; ++ return err; ++} ++ ++static ssize_t cfs_overlay_item_status_show(struct config_item *item, ++ char *page) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ return sprintf(page, "%s\n", ++ overlay->ov_id > 0 ? "applied" : "unapplied"); ++} ++ ++CONFIGFS_ATTR(cfs_overlay_item_, path); ++CONFIGFS_ATTR_RO(cfs_overlay_item_, status); ++ ++static struct configfs_attribute *cfs_overlay_attrs[] = { ++ &cfs_overlay_item_attr_path, ++ &cfs_overlay_item_attr_status, ++ NULL, ++}; ++ ++ssize_t cfs_overlay_item_dtbo_read(struct config_item *item, ++ void *buf, size_t max_count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ pr_debug("%s: buf=%p max_count=%zu\n", __func__, ++ buf, max_count); ++ ++ if (overlay->dtbo == NULL) ++ return 0; ++ ++ /* copy if buffer provided */ ++ if (buf != NULL) { ++ /* the buffer must be large enough */ ++ if (overlay->dtbo_size > max_count) ++ return -ENOSPC; ++ ++ memcpy(buf, overlay->dtbo, overlay->dtbo_size); ++ } ++ ++ return overlay->dtbo_size; ++} ++ ++ssize_t cfs_overlay_item_dtbo_write(struct config_item *item, ++ const void *buf, size_t count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ int err; ++ ++ /* if it's set do not allow changes */ ++ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) ++ return -EPERM; ++ ++ /* copy the contents */ ++ overlay->dtbo = kmemdup(buf, count, GFP_KERNEL); ++ if (overlay->dtbo == NULL) ++ return -ENOMEM; ++ ++ overlay->dtbo_size = count; ++ ++ err = of_overlay_fdt_apply(overlay->dtbo, overlay->dtbo_size, ++ &overlay->ov_id, NULL); ++ if (err != 0) ++ goto out_err; ++ ++ return count; ++ ++out_err: ++ kfree(overlay->dtbo); ++ overlay->dtbo = NULL; ++ overlay->dtbo_size = 0; ++ overlay->ov_id = 0; ++ ++ return err; ++} ++ ++CONFIGFS_BIN_ATTR(cfs_overlay_item_, dtbo, NULL, SZ_1M); ++ ++static struct configfs_bin_attribute *cfs_overlay_bin_attrs[] = { ++ &cfs_overlay_item_attr_dtbo, ++ NULL, ++}; ++ ++static void cfs_overlay_release(struct config_item *item) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ if (overlay->ov_id > 0) ++ of_overlay_remove(&overlay->ov_id); ++ if (overlay->fw) ++ release_firmware(overlay->fw); ++ /* kfree with NULL is safe */ ++ kfree(overlay->dtbo); ++ kfree(overlay); ++} ++ ++static struct configfs_item_operations cfs_overlay_item_ops = { ++ .release = cfs_overlay_release, ++}; ++ ++static struct config_item_type cfs_overlay_type = { ++ .ct_item_ops = &cfs_overlay_item_ops, ++ .ct_attrs = cfs_overlay_attrs, ++ .ct_bin_attrs = cfs_overlay_bin_attrs, ++ .ct_owner = THIS_MODULE, ++}; ++ ++static struct config_item *cfs_overlay_group_make_item( ++ struct config_group *group, const char *name) ++{ ++ struct cfs_overlay_item *overlay; ++ ++ overlay = kzalloc(sizeof(*overlay), GFP_KERNEL); ++ if (!overlay) ++ return ERR_PTR(-ENOMEM); ++ ++ config_item_init_type_name(&overlay->item, name, &cfs_overlay_type); ++ return &overlay->item; ++} ++ ++static void cfs_overlay_group_drop_item(struct config_group *group, ++ struct config_item *item) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ config_item_put(&overlay->item); ++} ++ ++static struct configfs_group_operations overlays_ops = { ++ .make_item = cfs_overlay_group_make_item, ++ .drop_item = cfs_overlay_group_drop_item, ++}; ++ ++static struct config_item_type overlays_type = { ++ .ct_group_ops = &overlays_ops, ++ .ct_owner = THIS_MODULE, ++}; ++ ++static struct configfs_group_operations of_cfs_ops = { ++ /* empty - we don't allow anything to be created */ ++}; ++ ++static struct config_item_type of_cfs_type = { ++ .ct_group_ops = &of_cfs_ops, ++ .ct_owner = THIS_MODULE, ++}; ++ ++struct config_group of_cfs_overlay_group; ++ ++static struct configfs_subsystem of_cfs_subsys = { ++ .su_group = { ++ .cg_item = { ++ .ci_namebuf = "device-tree", ++ .ci_type = &of_cfs_type, ++ }, ++ }, ++ .su_mutex = __MUTEX_INITIALIZER(of_cfs_subsys.su_mutex), ++}; ++ ++static int __init of_cfs_init(void) ++{ ++ int ret; ++ ++ pr_info("%s\n", __func__); ++ ++ config_group_init(&of_cfs_subsys.su_group); ++ config_group_init_type_name(&of_cfs_overlay_group, "overlays", ++ &overlays_type); ++ configfs_add_default_group(&of_cfs_overlay_group, ++ &of_cfs_subsys.su_group); ++ ++ ret = configfs_register_subsystem(&of_cfs_subsys); ++ if (ret != 0) { ++ pr_err("%s: failed to register subsys\n", __func__); ++ goto out; ++ } ++ pr_info("%s: OK\n", __func__); ++out: ++ return ret; ++} ++late_initcall(of_cfs_init); +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/general-add-panel-simple-dsi.patch b/patch/kernel/archive/rockchip64-6.10/general-add-panel-simple-dsi.patch new file mode 100644 index 000000000000..536acee59be8 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/general-add-panel-simple-dsi.patch @@ -0,0 +1,856 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: simple <991605149@qq.com> +Date: Sun, 12 Sep 2021 20:06:02 +0200 +Subject: [ARCHEOLOGY] general add panel simple dsi (#3140) + +> X-Git-Archeology: > recovered message: > * Backporting patch to 5.10 kernel makes sense. Lets do it. +> X-Git-Archeology: > recovered message: > Co-authored-by: iamdrq +> X-Git-Archeology: > recovered message: > Co-authored-by: Igor Pecovnik +> X-Git-Archeology: - Revision 15819f00e21238e36ca70f6d8445efd6157fbe66: https://github.com/armbian/build/commit/15819f00e21238e36ca70f6d8445efd6157fbe66 +> X-Git-Archeology: Date: Sun, 12 Sep 2021 20:06:02 +0200 +> X-Git-Archeology: From: simple <991605149@qq.com> +> X-Git-Archeology: Subject: general add panel simple dsi (#3140) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e: https://github.com/armbian/build/commit/dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e +> X-Git-Archeology: Date: Tue, 09 Nov 2021 18:06:34 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump imx6, xu4, rockchip64 and jetson-nano to 5.15 (#3238) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6b490e16944b30ff69bf9c13678905187df0d9d4: https://github.com/armbian/build/commit/6b490e16944b30ff69bf9c13678905187df0d9d4 +> X-Git-Archeology: Date: Tue, 11 Jan 2022 15:26:11 +0100 +> X-Git-Archeology: From: Oleg +> X-Git-Archeology: Subject: move kernel edge to 5.16 (#3387) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 3b78b57fe367e60ad874d9e16ff1cd67957f8382: https://github.com/armbian/build/commit/3b78b57fe367e60ad874d9e16ff1cd67957f8382 +> X-Git-Archeology: Date: Sat, 24 Dec 2022 09:43:51 +0100 +> X-Git-Archeology: From: simple <991605149@qq.com> +> X-Git-Archeology: Subject: Fix general-add-panel-simple-dsi.patch on linux6.1 (#4607) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + drivers/gpu/drm/panel/Makefile | 1 + + drivers/gpu/drm/panel/panel-simple-dsi.c | 772 ++++++++++ + 2 files changed, 773 insertions(+) + +diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile +index 433e93d57949..02076386ed5f 100644 +--- a/drivers/gpu/drm/panel/Makefile ++++ b/drivers/gpu/drm/panel/Makefile +@@ -9,6 +9,7 @@ obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o + obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o + obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o + obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o ++obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple-dsi.o + obj-$(CONFIG_DRM_PANEL_EDP) += panel-edp.o + obj-$(CONFIG_DRM_PANEL_EBBG_FT8719) += panel-ebbg-ft8719.o + obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += panel-elida-kd35t133.o +diff --git a/drivers/gpu/drm/panel/panel-simple-dsi.c b/drivers/gpu/drm/panel/panel-simple-dsi.c +new file mode 100644 +index 000000000000..e3c8dcf8cb5e +--- /dev/null ++++ b/drivers/gpu/drm/panel/panel-simple-dsi.c +@@ -0,0 +1,772 @@ ++/* ++ * Copyright (C) 2021 ++ * This simple dsi driver porting from rock-chip panel-simple.c on linux-4.4 ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#include